diff --git a/osu.Game.Tests/Editor/TestSceneHitObjectComposerDistanceSnapping.cs b/osu.Game.Tests/Editor/TestSceneHitObjectComposerDistanceSnapping.cs index e825df5a3f..5a4e76d586 100644 --- a/osu.Game.Tests/Editor/TestSceneHitObjectComposerDistanceSnapping.cs +++ b/osu.Game.Tests/Editor/TestSceneHitObjectComposerDistanceSnapping.cs @@ -118,17 +118,19 @@ namespace osu.Game.Tests.Editor [Test] public void TestGetSnappedDurationFromDistance() { - assertSnappedDuration(50, 0); + assertSnappedDuration(0, 0); + assertSnappedDuration(50, 1000); assertSnappedDuration(100, 1000); - assertSnappedDuration(150, 1000); + assertSnappedDuration(150, 2000); assertSnappedDuration(200, 2000); - assertSnappedDuration(250, 2000); + assertSnappedDuration(250, 3000); AddStep("set slider multiplier = 2", () => composer.EditorBeatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier = 2); + assertSnappedDuration(0, 0); assertSnappedDuration(50, 0); - assertSnappedDuration(100, 0); - assertSnappedDuration(150, 0); + assertSnappedDuration(100, 1000); + assertSnappedDuration(150, 1000); assertSnappedDuration(200, 1000); assertSnappedDuration(250, 1000); @@ -139,8 +141,8 @@ namespace osu.Game.Tests.Editor }); assertSnappedDuration(50, 0); - assertSnappedDuration(100, 0); - assertSnappedDuration(150, 0); + assertSnappedDuration(100, 500); + assertSnappedDuration(150, 500); assertSnappedDuration(200, 500); assertSnappedDuration(250, 500); assertSnappedDuration(400, 1000); @@ -149,17 +151,17 @@ namespace osu.Game.Tests.Editor [Test] public void GetSnappedDistanceFromDistance() { - assertSnappedDistance(50, 0); + assertSnappedDistance(50, 100); assertSnappedDistance(100, 100); - assertSnappedDistance(150, 100); + assertSnappedDistance(150, 200); assertSnappedDistance(200, 200); - assertSnappedDistance(250, 200); + assertSnappedDistance(250, 300); AddStep("set slider multiplier = 2", () => composer.EditorBeatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier = 2); assertSnappedDistance(50, 0); - assertSnappedDistance(100, 0); - assertSnappedDistance(150, 0); + assertSnappedDistance(100, 200); + assertSnappedDistance(150, 200); assertSnappedDistance(200, 200); assertSnappedDistance(250, 200); @@ -170,8 +172,8 @@ namespace osu.Game.Tests.Editor }); assertSnappedDistance(50, 0); - assertSnappedDistance(100, 0); - assertSnappedDistance(150, 0); + assertSnappedDistance(100, 200); + assertSnappedDistance(150, 200); assertSnappedDistance(200, 200); assertSnappedDistance(250, 200); assertSnappedDistance(400, 400); diff --git a/osu.Game/Screens/Edit/EditorBeatmap.cs b/osu.Game/Screens/Edit/EditorBeatmap.cs index 2d3ecf583e..385afc2392 100644 --- a/osu.Game/Screens/Edit/EditorBeatmap.cs +++ b/osu.Game/Screens/Edit/EditorBeatmap.cs @@ -135,7 +135,7 @@ namespace osu.Game.Screens.Edit var beatLength = timingPoint.BeatLength / BeatDivisor; // A 1ms offset prevents rounding errors due to minute variations in duration - return timingPoint.Time + (int)Math.Round(((time - timingPoint.Time) + 1) / beatLength) * beatLength; + return timingPoint.Time + (int)Math.Round((time - timingPoint.Time) / beatLength, MidpointRounding.AwayFromZero) * beatLength; } public double GetBeatLengthAtTime(double referenceTime) => ControlPointInfo.TimingPointAt(referenceTime).BeatLength / BeatDivisor;