Don't ease with 0 time difference

This commit is contained in:
smoogipoo
2021-07-05 17:52:10 +09:00
parent 12ca845e55
commit 2b8efe21ca

View File

@ -245,8 +245,11 @@ namespace osu.Game.Rulesets.Osu.Replays
double timeDifference = ApplyModsToTimeDelta(lastFrame.Time, h.StartTime); double timeDifference = ApplyModsToTimeDelta(lastFrame.Time, h.StartTime);
OsuReplayFrame lastLastFrame = Frames.Count >= 2 ? (OsuReplayFrame)Frames[^2] : null; OsuReplayFrame lastLastFrame = Frames.Count >= 2 ? (OsuReplayFrame)Frames[^2] : null;
if (timeDifference > 0)
{
// If the last frame is a key-up frame and there has been no wait period, adjust the last frame's position such that it begins eased movement instantaneously. // If the last frame is a key-up frame and there has been no wait period, adjust the last frame's position such that it begins eased movement instantaneously.
if (lastLastFrame != null && lastFrame is OsuKeyUpReplayFrame && !hasWaited) if (lastLastFrame != null && lastFrame is OsuKeyUpReplayFrame && !hasWaited
&& lastFrame.Time > lastLastFrame.Time) //
{ {
// [lastLastFrame] ... [lastFrame] ... [current frame] // [lastLastFrame] ... [lastFrame] ... [current frame]
// We want to find the cursor position at lastFrame, so interpolate between lastLastFrame and the new target position. // We want to find the cursor position at lastFrame, so interpolate between lastLastFrame and the new target position.
@ -261,6 +264,7 @@ namespace osu.Game.Rulesets.Osu.Replays
Vector2 currentPosition = Interpolation.ValueAt(time, lastPosition, targetPos, lastFrame.Time, h.StartTime, easing); Vector2 currentPosition = Interpolation.ValueAt(time, lastPosition, targetPos, lastFrame.Time, h.StartTime, easing);
AddFrameToReplay(new OsuReplayFrame((int)time, new Vector2(currentPosition.X, currentPosition.Y)) { Actions = lastFrame.Actions }); AddFrameToReplay(new OsuReplayFrame((int)time, new Vector2(currentPosition.X, currentPosition.Y)) { Actions = lastFrame.Actions });
} }
}
// Start alternating once the time separation is too small (equivalent 120BPM @ 1/4 divisor). // Start alternating once the time separation is too small (equivalent 120BPM @ 1/4 divisor).
if (timeDifference > 0 && timeDifference < 125) if (timeDifference > 0 && timeDifference < 125)