diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/EffectiveBPMPreprocessor.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/EffectiveBPMPreprocessor.cs index 3f594bb63ad3..a26577d16f23 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/EffectiveBPMPreprocessor.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/EffectiveBPMPreprocessor.cs @@ -10,13 +10,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing public class EffectiveBPMPreprocessor { private readonly IList noteObjects; - private readonly IReadOnlyList timingControlPoints; private readonly double globalSliderVelocity; public EffectiveBPMPreprocessor(IBeatmap beatmap, List noteObjects) { this.noteObjects = noteObjects; - timingControlPoints = beatmap.ControlPointInfo.TimingPoints; globalSliderVelocity = beatmap.Difficulty.SliderMultiplier; } @@ -25,35 +23,17 @@ public EffectiveBPMPreprocessor(IBeatmap beatmap, List /// public void LoadEffectiveBPM(ControlPointInfo controlPointInfo, double clockRate) { - using var controlPointEnumerator = timingControlPoints.GetEnumerator(); - controlPointEnumerator.MoveNext(); - var currentControlPoint = controlPointEnumerator.Current; - var nextControlPoint = controlPointEnumerator.MoveNext() ? controlPointEnumerator.Current : null; - foreach (var currentNoteObject in noteObjects) { - currentControlPoint = getNextControlPoint(currentNoteObject, currentControlPoint, ref nextControlPoint, controlPointEnumerator); + // Retrieve the timing point at the note's start time + TimingControlPoint currentControlPoint = controlPointInfo.TimingPointAt(currentNoteObject.StartTime); - // Calculate and set slider velocity for the current note object. + // Calculate the slider velocity at the note's start time. double currentSliderVelocity = calculateSliderVelocity(controlPointInfo, currentNoteObject.StartTime, clockRate); currentNoteObject.CurrentSliderVelocity = currentSliderVelocity; - calculateEffectiveBPM(currentNoteObject, currentControlPoint, currentSliderVelocity); - } - } - - /// - /// Advances to the next timing control point if the current note's start time exceeds the current control point's time. - /// - private TimingControlPoint? getNextControlPoint(TaikoDifficultyHitObject currentNoteObject, TimingControlPoint? currentControlPoint, ref TimingControlPoint? nextControlPoint, IEnumerator controlPointEnumerator) - { - if (nextControlPoint != null && currentNoteObject.StartTime > nextControlPoint.Time) - { - currentControlPoint = nextControlPoint; - nextControlPoint = controlPointEnumerator.MoveNext() ? controlPointEnumerator.Current : null; + currentNoteObject.EffectiveBPM = currentControlPoint.BPM * currentSliderVelocity; } - - return currentControlPoint; } /// @@ -64,16 +44,5 @@ private double calculateSliderVelocity(ControlPointInfo controlPointInfo, double var activeEffectControlPoint = controlPointInfo.EffectPointAt(startTime); return globalSliderVelocity * (activeEffectControlPoint.ScrollSpeed) * clockRate; } - - /// - /// Sets the effective BPM for the given note object. - /// - private void calculateEffectiveBPM(TaikoDifficultyHitObject currentNoteObject, TimingControlPoint? currentControlPoint, double currentSliderVelocity) - { - if (currentControlPoint != null) - { - currentNoteObject.EffectiveBPM = currentControlPoint.BPM * currentSliderVelocity; - } - } } }