Fix stack leniency

This commit is contained in:
Michael Zhang 2022-01-12 23:48:53 -06:00
parent d70b1c59f3
commit dfd921875c
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
3 changed files with 12 additions and 13 deletions

2
run.sh
View file

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
export LD_LIBRARY_PATH=$(pwd)/bass-sys/linux/bass24/x64 export LD_LIBRARY_PATH=$(pwd)/bass-sys/linux/bass24/x64
echo $LD_LIBRARY_PATH echo $LD_LIBRARY_PATH
exec mold -run cargo run --release "$@" exec mold -run cargo run --release -- "$@"

View file

@ -70,7 +70,7 @@ impl BeatmapExt {
* self.inner.stack_leniency; * self.inner.stack_leniency;
// We are no longer within stacking range of the next object. // We are no longer within stacking range of the next object.
if (object_n.inner.start_time.0 as f64 - end_time) > stack_threshold { if (object_n.inner.start_time.as_seconds() - end_time) > stack_threshold {
break; break;
} }
@ -98,9 +98,7 @@ impl BeatmapExt {
// Reverse pass for stack calculation. // Reverse pass for stack calculation.
let mut extended_start_idx = start_idx; let mut extended_start_idx = start_idx;
for i in (start_idx..=extended_end_idx).rev() { for i in ((start_idx + 1)..=extended_end_idx).rev() {
let mut n = i;
// We should check every note which has not yet got a stack. // We should check every note which has not yet got a stack.
// Consider the case we have two interwound stacks and this will make sense. // Consider the case we have two interwound stacks and this will make sense.
// o <-1 o <-2 // o <-1 o <-2
@ -121,7 +119,7 @@ impl BeatmapExt {
match object_i.inner.kind { match object_i.inner.kind {
HitObjectKind::Circle => { HitObjectKind::Circle => {
for n in (0..n).rev() { for n in (0..i).rev() {
if self.hit_objects[n].inner.kind.is_spinner() { if self.hit_objects[n].inner.kind.is_spinner() {
continue; continue;
} }
@ -131,7 +129,7 @@ impl BeatmapExt {
.get_hitobject_end_time(&self.hit_objects[n].inner) .get_hitobject_end_time(&self.hit_objects[n].inner)
.unwrap(); .unwrap();
if (self.hit_objects[iidx].inner.start_time.0 as f64 - end_time) if (self.hit_objects[iidx].inner.start_time.as_seconds() - end_time)
> stack_threshold > stack_threshold
{ {
break; break;
@ -183,15 +181,15 @@ impl BeatmapExt {
} }
} }
} }
HitObjectKind::Slider(_) => { HitObjectKind::Slider(_) => {
for n in (start_idx..n).rev() { for n in (start_idx..i).rev() {
if self.hit_objects[n].inner.kind.is_spinner() { if self.hit_objects[n].inner.kind.is_spinner() {
continue; continue;
} }
if (self.hit_objects[iidx].inner.start_time.0 if (self.hit_objects[iidx].inner.start_time.as_seconds()
- self.hit_objects[n].inner.start_time.0) - self.hit_objects[n].inner.start_time.as_seconds())
as f64
> stack_threshold > stack_threshold
{ {
break; break;
@ -208,6 +206,7 @@ impl BeatmapExt {
} }
} }
} }
_ => {} _ => {}
} }
} }

View file

@ -230,10 +230,10 @@ impl Game {
graphics::queue_text(ctx, &text, [0.0, 0.0], Some(Color::WHITE)); graphics::queue_text(ctx, &text, [0.0, 0.0], Some(Color::WHITE));
graphics::draw_queued_text(ctx, DrawParam::default(), None, FilterMode::Linear)?; graphics::draw_queued_text(ctx, DrawParam::default(), None, FilterMode::Linear)?;
self.draw_timeline(ctx, time)?;
self.draw_hitobjects(ctx, time)?; self.draw_hitobjects(ctx, time)?;
self.draw_timeline(ctx, time)?;
self.draw_seeker(ctx)?; self.draw_seeker(ctx)?;
// TODO: don't duplicate these from hitobjects.rs // TODO: don't duplicate these from hitobjects.rs