Skip to content

Commit 6c25983

Browse files
committed
remove shit
1 parent 2bbf12b commit 6c25983

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

prpr/src/judge.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ impl JudgeInner {
249249
pub mod inner;
250250
#[cfg(feature = "closed")]
251251
use inner::*;
252+
use crate::core::Note;
252253

253254
#[repr(C)]
254255
pub struct Judge {
@@ -557,31 +558,32 @@ impl Judge {
557558
}
558559
}
559560
if let (Some((line_id, id)), dist, dt, _, posx) = closest {
560-
let unattr_drag = &chart.lines.iter_mut().any(|line| { // Check drag in good range & not flag
561-
line.notes.iter_mut().any(|note| {
562-
let x = &mut note.object.translation.0;
563-
x.set_time(t);
564-
let dist2 = (x.now() - posx).abs();
565-
let dist = (dist2 - dist).abs();
566-
let judge_time = t - note.time;
567-
matches!(note.kind, NoteKind::Drag | NoteKind::Flick) && dist <= X_DIFF_MAX && matches!(note.fake, false) && !note.attr && judge_time >= -LIMIT_GOOD && judge_time <= LIMIT_BAD
568-
})
561+
let drag_or_flick = |note: &mut Note| {
562+
let x = &mut note.object.translation.0;
563+
x.set_time(t);
564+
let dist2 = (x.now() - posx).abs();
565+
let dist = (dist2 - dist).abs();
566+
let judge_time = t - note.time;
567+
matches!(note.kind, NoteKind::Drag | NoteKind::Flick)
568+
&& dist <= X_DIFF_MAX
569+
&& !note.fake
570+
&& !note.attr
571+
&& judge_time >= -LIMIT_GOOD
572+
&& judge_time <= LIMIT_BAD
573+
};
574+
let unattr_drag = chart.lines.iter_mut().any(|line| {
575+
line.notes.iter_mut().any(|note| drag_or_flick(note))
569576
});
570577
let line = &mut chart.lines[line_id];
571578
if matches!(line.notes[id as usize].kind, NoteKind::Drag) {
572579
// debug!("reject by drag");
573580
continue;
574581
}
575582
if click {
576-
if *unattr_drag && dt > LIMIT_PERFECT { // flag drag
583+
if unattr_drag && dt > LIMIT_PERFECT { // flag drag
577584
for line in &mut chart.lines {
578585
for note in &mut line.notes {
579-
let x = &mut note.object.translation.0;
580-
x.set_time(t);
581-
let dist2 = (x.now() - posx).abs();
582-
let dist = (dist2 - dist).abs();
583-
let judge_time = t - note.time;
584-
if matches!(note.kind, NoteKind::Drag | NoteKind::Flick) && dist <= X_DIFF_MAX && matches!(note.fake, false) && !note.attr && judge_time >= -LIMIT_GOOD && judge_time <= LIMIT_BAD { //LIMIT_PERFECT * 0.25
586+
if drag_or_flick(note) {
585587
note.attr = true;
586588
// debug!("flag drag");
587589
}

0 commit comments

Comments
 (0)