diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index f7f73f74a5..cb1ea5cc5f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -93,12 +93,36 @@ namespace osu.Game.Rulesets.Osu.Tests AddStep("Big Single, Large StackOffset", () => testSimpleBigLargeStackOffset()); AddStep("Big 1 Repeat, Large StackOffset", () => testSimpleBigLargeStackOffset(1)); + + AddStep("Distance Overflow", () => testDistanceOverflow()); + AddStep("Distance Overflow 1 Repeat", () => testDistanceOverflow(1)); } private void testSimpleBig(int repeats = 0) => createSlider(2, repeats: repeats); private void testSimpleBigLargeStackOffset(int repeats = 0) => createSlider(2, repeats: repeats, stackHeight: 10); + private void testDistanceOverflow(int repeats = 0) + { + var slider = new Slider + { + StartTime = Time.Current + 1000, + Position = new Vector2(239, 176), + ControlPoints = new List + { + Vector2.Zero, + new Vector2(154, 28), + new Vector2(52, -34) + }, + Distance = 700, + RepeatCount = repeats, + RepeatSamples = createEmptySamples(repeats), + StackHeight = 10 + }; + + addSlider(slider, 2, 2); + } + private void testSimpleMedium(int repeats = 0) => createSlider(5, repeats: repeats); private void testSimpleSmall(int repeats = 0) => createSlider(7, repeats: repeats); diff --git a/osu.Game/Rulesets/Objects/SliderCurve.cs b/osu.Game/Rulesets/Objects/SliderCurve.cs index 86fe74f9af..3932d8ed9d 100644 --- a/osu.Game/Rulesets/Objects/SliderCurve.cs +++ b/osu.Game/Rulesets/Objects/SliderCurve.cs @@ -99,11 +99,9 @@ namespace osu.Game.Rulesets.Objects cumulativeLength.Add(l); } - //TODO: Figure out if the following code is needed in some cases. Judging by the map - // "Transform" http://osu.ppy.sh/s/484689 it seems like we should _not_ be doing this. // Lengthen slider curves that are too short compared to what's // in the .osu file. - /*if (l < Length && calculatedPath.Count > 1) + if (l < Distance && calculatedPath.Count > 1) { Vector2 diff = calculatedPath[calculatedPath.Count - 1] - calculatedPath[calculatedPath.Count - 2]; double d = diff.Length; @@ -111,9 +109,9 @@ namespace osu.Game.Rulesets.Objects if (d <= 0) return; - calculatedPath[calculatedPath.Count - 1] += diff * (float)((Length - l) / d); - cumulativeLength[calculatedPath.Count - 1] = Length; - }*/ + calculatedPath[calculatedPath.Count - 1] += diff * (float)((Distance - l) / d); + cumulativeLength[calculatedPath.Count - 1] = Distance; + } } public void Calculate()