Skip to content

Commit

Permalink
fix: hold partial cover (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
2278535805 authored Feb 9, 2025
1 parent c64f644 commit efb6927
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions prpr/src/core/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,22 @@ impl Note {
let height = self.height / res.aspect_ratio * spd;

let base = height - line_height;
let cover_base = if !config.settings.hold_partial_cover {
height - line_height
} else {
match self.kind {
NoteKind::Hold { end_time: _, end_height } => {
let end_height = end_height / res.aspect_ratio * spd;
end_height - line_height
}
_ => {
height - line_height
}
}
};

if !config.draw_below
&& ((res.time - FADEOUT_TIME >= self.time) || (self.fake && res.time >= self.time) || (self.time > res.time && base <= -1e-5))
&& !matches!(self.kind, NoteKind::Hold { .. })
&& ((res.time - FADEOUT_TIME >= self.time && !matches!(self.kind, NoteKind::Hold { .. })) || (self.time > res.time && cover_base <= -0.001))
{
return;
}
Expand Down Expand Up @@ -247,14 +260,9 @@ impl Note {
}
let end_height = end_height / res.aspect_ratio * spd;

let clip = !config.draw_below && config.settings.hold_partial_cover;

let h = if self.time <= res.time { line_height } else { height };
let bottom = h - line_height;
let top = end_height - line_height;
if res.time < self.time && bottom < -1e-6 && !config.settings.hold_partial_cover {
return;
}
let tex = &style.hold;
let ratio = style.hold_ratio();
// body
Expand Down Expand Up @@ -284,7 +292,7 @@ impl Note {
dest_size: Some(vec2(scale * 2., top - bottom)),
..Default::default()
},
clip,
false,
);
// head
if res.time < self.time || res.res_pack.info.hold_keep_head {
Expand All @@ -302,7 +310,7 @@ impl Note {
dest_size: Some(hf * 2.),
..Default::default()
},
clip,
false,
);
}
// tail
Expand All @@ -320,7 +328,7 @@ impl Note {
dest_size: Some(hf * 2.),
..Default::default()
},
clip,
false,
);
});
}
Expand Down

0 comments on commit efb6927

Please sign in to comment.