fix linear perfect curves and subpaths

This commit is contained in:
MaxOhn
2021-04-28 21:23:51 +02:00
parent 97f3cb2030
commit bb6ee0332c
8 changed files with 107 additions and 109 deletions
+2 -13
View File
@@ -89,20 +89,9 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
/ (map.sv * slider_state.speed_mult)
/ 100.0;
// Ensure path type validity
let path_type = if (*path_type == PathType::PerfectCurve && curve_points.len() > 3)
|| (*path_type == PathType::Linear && curve_points.len() != 2)
{
PathType::Bezier
} else if curve_points.len() == 2 {
PathType::Linear
} else {
*path_type
};
// 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::Linear => Curve::linear(curve_points),
PathType::Bezier => Curve::bezier(curve_points),
PathType::Catmull => Curve::catmull(curve_points),
PathType::PerfectCurve => Curve::perfect(curve_points),
@@ -349,7 +338,7 @@ pub fn strains(map: &Beatmap, mods: impl Mods) -> Strains {
// 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::Linear => Curve::linear(curve_points),
PathType::Bezier => Curve::bezier(curve_points),
PathType::Catmull => Curve::catmull(curve_points),
PathType::PerfectCurve => Curve::perfect(curve_points),