@@ -249,6 +249,7 @@ impl JudgeInner {
249
249
pub mod inner;
250
250
#[ cfg( feature = "closed" ) ]
251
251
use inner:: * ;
252
+ use crate :: core:: Note ;
252
253
253
254
#[ repr( C ) ]
254
255
pub struct Judge {
@@ -557,31 +558,32 @@ impl Judge {
557
558
}
558
559
}
559
560
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) )
569
576
} ) ;
570
577
let line = & mut chart. lines [ line_id] ;
571
578
if matches ! ( line. notes[ id as usize ] . kind, NoteKind :: Drag ) {
572
579
// debug!("reject by drag");
573
580
continue ;
574
581
}
575
582
if click {
576
- if * unattr_drag && dt > LIMIT_PERFECT { // flag drag
583
+ if unattr_drag && dt > LIMIT_PERFECT { // flag drag
577
584
for line in & mut chart. lines {
578
585
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) {
585
587
note. attr = true ;
586
588
// debug!("flag drag");
587
589
}
0 commit comments