From 0e691d5935255c58ac04ea35de99e3ebe6096f76 Mon Sep 17 00:00:00 2001 From: Pasi4K5 Date: Sat, 19 Aug 2023 00:16:05 +0200 Subject: [PATCH] Revert changes in `SliderPath` --- osu.Game/Rulesets/Objects/SliderPath.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/osu.Game/Rulesets/Objects/SliderPath.cs b/osu.Game/Rulesets/Objects/SliderPath.cs index 171298e6c0..028f8b6839 100644 --- a/osu.Game/Rulesets/Objects/SliderPath.cs +++ b/osu.Game/Rulesets/Objects/SliderPath.cs @@ -202,7 +202,7 @@ namespace osu.Game.Rulesets.Objects { ensureValid(); - return segmentEnds.Select(i => cumulativeLength[i] / Distance); + return segmentEnds.Select(i => cumulativeLength[i] / calculatedLength); } private void invalidate() @@ -251,9 +251,8 @@ namespace osu.Game.Rulesets.Objects calculatedPath.Add(t); } - if (i > 0) - // Remember the index of the segment end - segmentEnds.Add(calculatedPath.Count - 1); + // Remember the index of the segment end + segmentEnds.Add(calculatedPath.Count - 1); // Start the new segment at the current vertex start = i; @@ -315,11 +314,15 @@ namespace osu.Game.Rulesets.Objects if (calculatedLength > expectedDistance) { - // The path will be shortened further, in which case we should trim any more unnecessary lengths + // The path will be shortened further, in which case we should trim any more unnecessary lengths and their associated path segments while (cumulativeLength.Count > 0 && cumulativeLength[^1] >= expectedDistance) { cumulativeLength.RemoveAt(cumulativeLength.Count - 1); calculatedPath.RemoveAt(pathEndIndex--); + + // Shorten the last segment to the expected distance + if (segmentEnds.Count > 0) + segmentEnds[^1]--; } } @@ -336,12 +339,6 @@ namespace osu.Game.Rulesets.Objects calculatedPath[pathEndIndex] = calculatedPath[pathEndIndex - 1] + dir * (float)(expectedDistance - cumulativeLength[^1]); cumulativeLength.Add(expectedDistance); - - // Shorten the segments to the expected distance - for (int i = 0; i < segmentEnds.Count; i++) - { - segmentEnds[i] = Math.Min(segmentEnds[i], cumulativeLength.Count - 1); - } } }