Curve method changes & fixed all_included

This commit is contained in:
MaxOhn
2021-04-28 22:44:50 +02:00
parent 643a67888d
commit 964b972eac
6 changed files with 46 additions and 77 deletions
+6 -6
View File
@@ -369,18 +369,18 @@ fn stacking(hit_objects: &mut [OsuObject], stack_threshold: f32) {
}
if hit_objects[n].is_slider()
&& hit_objects[n].end_pos().distance(&hit_objects[i].pos) < STACK_DISTANCE
&& hit_objects[n].end_pos().distance(hit_objects[i].pos) < STACK_DISTANCE
{
let offset = hit_objects[i].stack_height - hit_objects[n].stack_height + 1.0;
for j in n + 1..=i {
if hit_objects[n].pos.distance(&hit_objects[j].pos) < STACK_DISTANCE {
if hit_objects[n].pos.distance(hit_objects[j].pos) < STACK_DISTANCE {
hit_objects[j].stack_height -= offset;
}
}
break;
} else if hit_objects[n].pos.distance(&hit_objects[i].pos) < STACK_DISTANCE {
} else if hit_objects[n].pos.distance(hit_objects[i].pos) < STACK_DISTANCE {
hit_objects[n].stack_height = hit_objects[i].stack_height + 1.0;
i = n;
}
@@ -396,7 +396,7 @@ fn stacking(hit_objects: &mut [OsuObject], stack_threshold: f32) {
continue;
} else if hit_objects[i].time - hit_objects[n].time > stack_threshold {
break;
} else if hit_objects[n].end_pos().distance(&hit_objects[i].pos) < STACK_DISTANCE {
} else if hit_objects[n].end_pos().distance(hit_objects[i].pos) < STACK_DISTANCE {
hit_objects[n].stack_height = hit_objects[i].stack_height + 1.0;
i = n;
}
@@ -421,10 +421,10 @@ fn old_stacking(hit_objects: &mut [OsuObject], stack_threshold: f32) {
break;
}
if hit_objects[j].pos.distance(&hit_objects[i].pos) < STACK_DISTANCE {
if hit_objects[j].pos.distance(hit_objects[i].pos) < STACK_DISTANCE {
hit_objects[i].stack_height += 1.0;
start_time = hit_objects[j].end_time();
} else if hit_objects[j].pos.distance(&end_pos) < STACK_DISTANCE {
} else if hit_objects[j].pos.distance(end_pos) < STACK_DISTANCE {
slider_stack += 1.0;
hit_objects[j].stack_height -= slider_stack;
start_time = hit_objects[j].end_time();
+2 -7
View File
@@ -3,7 +3,7 @@ use super::slider_state::SliderState;
use crate::{
curve::Curve,
parse::{HitObject, HitObjectKind, PathType, Pos2},
parse::{HitObject, HitObjectKind, Pos2},
Beatmap,
};
@@ -76,12 +76,7 @@ impl OsuObject {
let span_duration = duration / *repeats as f32;
// Build the curve w.r.t. the curve points
let curve = match path_type {
PathType::Linear => Curve::linear(curve_points[0], curve_points[1]),
PathType::Bezier => Curve::bezier(&curve_points),
PathType::Catmull => Curve::catmull(&curve_points),
PathType::PerfectCurve => Curve::perfect(&curve_points),
};
let curve = Curve::new(curve_points, *path_type);
// Called on each slider object except for the head.
// Increases combo and adjusts `end_pos` and `travel_dist`
+2 -7
View File
@@ -3,7 +3,7 @@ use super::slider_state::SliderState;
use crate::{
curve::Curve,
parse::{HitObject, HitObjectKind, PathType, Pos2},
parse::{HitObject, HitObjectKind, Pos2},
Beatmap,
};
@@ -63,12 +63,7 @@ impl OsuObject {
let span_duration = duration / *repeats as f32;
// Build the curve w.r.t. the curve points
let curve = match path_type {
PathType::Linear => Curve::linear(curve_points),
PathType::Bezier => Curve::bezier(curve_points),
PathType::Catmull => Curve::catmull(curve_points),
PathType::PerfectCurve => Curve::perfect(curve_points),
};
let curve = Curve::new(curve_points, *path_type);
// Called on each slider object except for the head.
// Increases combo and adjusts `end_pos` and `travel_dist`