mirror of https://github.com/ppy/osu
Always apply easing, adjust heuristic a bit
This commit is contained in:
parent
96c0ab8ded
commit
6a2c0f772e
|
@ -240,40 +240,33 @@ private void moveToHitObject(OsuHitObject h, Vector2 targetPos, Easing easing)
|
|||
AddFrameToReplay(lastFrame);
|
||||
}
|
||||
|
||||
Vector2 lastPosition = lastFrame.Position;
|
||||
|
||||
double timeDifference = ApplyModsToTimeDelta(lastFrame.Time, h.StartTime);
|
||||
|
||||
// Only "snap" to hitcircles if they are far enough apart. As the time between hitcircles gets shorter the snapping threshold goes up.
|
||||
if (timeDifference > 0 && // Sanity checks
|
||||
((lastPosition - targetPos).Length > h.Radius * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough
|
||||
timeDifference >= 266)) // ... or the beats are slow enough to tap anyway.
|
||||
OsuReplayFrame lastLastFrame = Frames.Count >= 2 ? (OsuReplayFrame)Frames[^2] : null;
|
||||
|
||||
// The last frame may be a key-up frame if it shares a position with the second-last frame.
|
||||
// If it is a key-up frame and its time occurs after the "wait time" (i.e. there was no wait period), adjust its position to begin eased movement instantaneously.
|
||||
if (lastLastFrame?.Position == lastFrame.Position && lastFrame.Time >= waitTime)
|
||||
{
|
||||
OsuReplayFrame lastLastFrame = Frames.Count >= 2 ? (OsuReplayFrame)Frames[^2] : null;
|
||||
|
||||
// The last frame may be a key-up frame if it shares a position with the second-last frame.
|
||||
// If it is a key-up frame and its time occurs after the "wait time" (i.e. there was no wait period), adjust its position to begin eased movement instantaneously.
|
||||
if (lastLastFrame?.Position == lastFrame.Position && lastFrame.Time >= waitTime)
|
||||
{
|
||||
// [lastLastFrame] ... [lastFrame] ... [current frame]
|
||||
// We want to find the cursor position at lastFrame, so interpolate between lastLastFrame and the new target position.
|
||||
lastFrame.Position = Interpolation.ValueAt(lastFrame.Time, lastFrame.Position, targetPos, lastLastFrame.Time, h.StartTime, easing);
|
||||
lastPosition = lastFrame.Position;
|
||||
}
|
||||
|
||||
// Perform eased movement
|
||||
for (double time = lastFrame.Time + GetFrameDelay(lastFrame.Time); time < h.StartTime; time += GetFrameDelay(time))
|
||||
{
|
||||
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 });
|
||||
}
|
||||
|
||||
buttonIndex = 0;
|
||||
// [lastLastFrame] ... [lastFrame] ... [current frame]
|
||||
// We want to find the cursor position at lastFrame, so interpolate between lastLastFrame and the new target position.
|
||||
lastFrame.Position = Interpolation.ValueAt(lastFrame.Time, lastFrame.Position, targetPos, lastLastFrame.Time, h.StartTime, easing);
|
||||
}
|
||||
else
|
||||
|
||||
Vector2 lastPosition = lastFrame.Position;
|
||||
|
||||
// Perform eased movement.
|
||||
for (double time = lastFrame.Time + GetFrameDelay(lastFrame.Time); time < h.StartTime; time += GetFrameDelay(time))
|
||||
{
|
||||
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 });
|
||||
}
|
||||
|
||||
// Start alternating once the time separation is too small (equivalent 120BPM @ 1/4 divisor).
|
||||
if (timeDifference > 0 && timeDifference < 125)
|
||||
buttonIndex++;
|
||||
}
|
||||
else
|
||||
buttonIndex = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue