fixed end_pos for sliders

This commit is contained in:
MaxOhn
2021-11-07 22:45:02 +01:00
parent afb89da0ba
commit 5b2f32a897
4 changed files with 13 additions and 16 deletions
+3 -3
View File
@@ -109,7 +109,7 @@ pub fn stars(
if curr_dist < target { if curr_dist < target {
for tick_idx in 1.. { for tick_idx in 1.. {
let progress = curr_dist / *pixel_len; let progress = curr_dist / *pixel_len;
let pos = curve.position_at(progress); let pos = h.pos + curve.position_at(progress);
let time = h.start_time + time_add * tick_idx as f32; let time = h.start_time + time_add * tick_idx as f32;
ticks.push((pos, time)); ticks.push((pos, time));
curr_dist += tick_dist; curr_dist += tick_dist;
@@ -136,7 +136,7 @@ pub fn stars(
let dist = (span_idx % 2) as f32 * *pixel_len; let dist = (span_idx % 2) as f32 * *pixel_len;
let time_offset = (duration / span_count as f32) * span_idx as f32; let time_offset = (duration / span_count as f32) * span_idx as f32;
let progress = dist / *pixel_len; let progress = dist / *pixel_len;
let pos = curve.position_at(progress); let pos = h.pos + curve.position_at(progress);
// Reverse tick // Reverse tick
slider_objects.push((pos, h.start_time + time_offset)); slider_objects.push((pos, h.start_time + time_offset));
@@ -155,7 +155,7 @@ pub fn stars(
} }
// Slider tail // Slider tail
let pos = curve.position_at(1.0); // TODO: what if reversing odd amount? let pos = h.pos + curve.position_at(1.0); // TODO: what if reversing odd amount?
slider_objects.push((pos, h.start_time + duration)); slider_objects.push((pos, h.start_time + duration));
fruits += span_count; // TODO: +1? fruits += span_count; // TODO: +1?
+9 -10
View File
@@ -54,8 +54,7 @@ fn custom_osu() {
use crate::{Beatmap, OsuPP}; use crate::{Beatmap, OsuPP};
let path = "./maps/2753127.osu"; let path = "E:Games/osu!/beatmaps/1402167_.osu";
// let path = "E:Games/osu!/beatmaps/2571051.osu";
let file = File::open(path).unwrap(); let file = File::open(path).unwrap();
let start = Instant::now(); let start = Instant::now();
@@ -65,19 +64,19 @@ fn custom_osu() {
let accum = start.elapsed(); let accum = start.elapsed();
// * Tiny benchmark for map parsing // * Tiny benchmark for map parsing
let mut accum = accum; // let mut accum = accum;
for _ in 0..iters { // for _ in 0..iters {
let file = File::open(path).unwrap(); // let file = File::open(path).unwrap();
let start = Instant::now(); // let start = Instant::now();
let _map = Beatmap::parse(file).unwrap(); // let _map = Beatmap::parse(file).unwrap();
accum += start.elapsed(); // accum += start.elapsed();
} // }
println!("Parsing average: {:?}", accum / iters); println!("Parsing average: {:?}", accum / iters);
let start = Instant::now(); let start = Instant::now();
let result = OsuPP::new(&map).mods(0).calculate(); let result = OsuPP::new(&map).mods(1024).calculate();
let iters = 100; let iters = 100;
let accum = start.elapsed(); let accum = start.elapsed();
@@ -179,7 +179,6 @@ impl OsuObject {
ticks.clear(); ticks.clear();
// TODO: what if reversing odd amount? // TODO: what if reversing odd amount?
// TODO: Correct addition?
let mut end_pos = h.pos + curve.position_at(1.0); let mut end_pos = h.pos + curve.position_at(1.0);
travel_dist *= *scaling_factor; travel_dist *= *scaling_factor;
+1 -2
View File
@@ -162,8 +162,7 @@ impl OsuObject {
ticks.clear(); ticks.clear();
// TODO: what if reversing odd amount? // TODO: what if reversing odd amount?
// TODO: + h.pos? let end_pos = h.pos + curve.position_at(1.0);
let end_pos = curve.position_at(1.0);
travel_dist *= *scaling_factor; travel_dist *= *scaling_factor;
Self { Self {