From ffaf5b729f4da8af9b5061f2ea037c1e4ad5d640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 3 Mar 2022 17:07:36 +0100 Subject: [PATCH] Move and reword docs of allowable rate range constants --- osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs index b3a318e307..bde85c60ad 100644 --- a/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs +++ b/osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs @@ -21,10 +21,6 @@ namespace osu.Game.Rulesets.Mods { public class ModAdaptiveSpeed : Mod, IApplicableToRate, IApplicableToDrawableHitObject, IApplicableToBeatmap, IUpdatableByPlayfield { - // use a wider range so there's still room for adjustment when the initial rate is extreme - private const double fastest_rate = 2.5f; - private const double slowest_rate = 0.4f; - /// /// Adjust track rate using the average speed of the last x hits /// @@ -61,10 +57,18 @@ namespace osu.Game.Rulesets.Mods public BindableNumber SpeedChange { get; } = new BindableDouble { + MinValue = min_allowable_rate, + MaxValue = max_allowable_rate, Default = 1, Value = 1 }; + // The two constants below denote the maximum allowable range of rates that `SpeedChange` can take. + // The range is purposefully wider than the range of values that `InitialRate` allows + // in order to give some leeway for change even when extreme initial rates are chosen. + private const double min_allowable_rate = 0.4f; + private const double max_allowable_rate = 2.5f; + private ITrack track; private double targetRate = 1d; @@ -122,7 +126,7 @@ namespace osu.Game.Rulesets.Mods double prevEndTime = previousEndTimes[result.HitObject]; - recentRates.Add(Math.Clamp((result.HitObject.GetEndTime() - prevEndTime) / (result.TimeAbsolute - prevEndTime) * SpeedChange.Value, slowest_rate, fastest_rate)); + recentRates.Add(Math.Clamp((result.HitObject.GetEndTime() - prevEndTime) / (result.TimeAbsolute - prevEndTime) * SpeedChange.Value, min_allowable_rate, max_allowable_rate)); dequeuedRates.Add(result.HitObject, recentRates[0]); recentRates.RemoveAt(0);