what the hell am i doing

This commit is contained in:
Michael Zhang 2021-01-10 01:49:16 -06:00
parent f244d62a88
commit d107e7670b
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B

View file

@ -285,11 +285,16 @@ impl Game {
if pos > timing_point.time.as_seconds() {
let diff = pos - timing_point.time.as_seconds();
let tick = info.mpb / 1000.0 / info.meter as f64;
if (diff / tick).abs() < 0.001 {
let beats = (diff / tick).round();
let frac = diff - beats * tick;
if frac.abs() < 0.0001 {
delta = Some(n as f64 * tick);
} else {
let tick = info.mpb / 1000.0;
delta = Some(n as f64 * tick);
if n > 0 {
delta = Some((n - 1) as f64 * tick + (tick - frac));
} else {
delta = Some((n - 1) as f64 * tick - frac);
}
}
break;
}