1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 11:12:59 +08:00

Fix speed change calculation in time ramp mods

This commit is contained in:
Bartłomiej Dach 2021-01-31 20:34:56 +01:00
parent 81b052b866
commit 547b3d8bed

View File

@ -66,17 +66,18 @@ namespace osu.Game.Rulesets.Mods
public virtual void ApplyToBeatmap(IBeatmap beatmap) public virtual void ApplyToBeatmap(IBeatmap beatmap)
{ {
HitObject lastObject = beatmap.HitObjects.LastOrDefault();
SpeedChange.SetDefault(); SpeedChange.SetDefault();
beginRampTime = beatmap.HitObjects.FirstOrDefault()?.StartTime ?? 0; double firstObjectStart = beatmap.HitObjects.FirstOrDefault()?.StartTime ?? 0;
finalRateTime = FINAL_RATE_PROGRESS * (lastObject?.GetEndTime() ?? 0); double lastObjectEnd = beatmap.HitObjects.LastOrDefault()?.GetEndTime() ?? 0;
beginRampTime = firstObjectStart;
finalRateTime = firstObjectStart + FINAL_RATE_PROGRESS * (lastObjectEnd - firstObjectStart);
} }
public virtual void Update(Playfield playfield) public virtual void Update(Playfield playfield)
{ {
applyRateAdjustment((track.CurrentTime - beginRampTime) / finalRateTime); applyRateAdjustment((track.CurrentTime - beginRampTime) / (finalRateTime - beginRampTime));
} }
/// <summary> /// <summary>