dont count any of first three frames towards time deficit

This commit is contained in:
Liam DeVoe 2023-07-27 17:20:54 -04:00
parent 61760f614a
commit 7d174dd8bb

View File

@ -267,7 +267,6 @@ namespace osu.Game.Scoring.Legacy
private void readLegacyReplay(Replay replay, StreamReader reader) private void readLegacyReplay(Replay replay, StreamReader reader)
{ {
float lastTime = beatmapOffset; float lastTime = beatmapOffset;
bool skipFramesPresent = false;
ReplayFrame currentFrame = null; ReplayFrame currentFrame = null;
// the negative time amount that must be "paid back" by positive frames before we start including frames again. // the negative time amount that must be "paid back" by positive frames before we start including frames again.
@ -299,22 +298,20 @@ namespace osu.Game.Scoring.Legacy
lastTime += diff; lastTime += diff;
if (i < 2 && mouseX == 256 && mouseY == -500) if (i < 2 && mouseX == 256 && mouseY == -500)
{
// at the start of the replay, stable places two replay frames, at time 0 and SkipBoundary - 1, respectively. // at the start of the replay, stable places two replay frames, at time 0 and SkipBoundary - 1, respectively.
// both frames use a position of (256, -500). // both frames use a position of (256, -500).
// ignore these frames as they serve no real purpose (and can even mislead ruleset-specific handlers - see mania) // ignore these frames as they serve no real purpose (and can even mislead ruleset-specific handlers - see mania)
skipFramesPresent = true;
continue; continue;
}
// if the skip frames inserted by stable are present, the third frame will have a large negative time // negative frames are only counted towards the deficit after the very beginning of the replay.
// roughly equal to SkipBoundary. We don't want this to count towards the deficit: doing so would cause // When the two skip frames are present (see directly above), the third frame will have a large
// the replay data before the skip to be, well, skipped. // negative time roughly equal to SkipBoundary. This shouldn't be counted towards the deficit, otherwise
// In other words, this frame, if present, is a different kind of negative frame. It sets the "offset" // any replay data before the skip would be, well, skipped.
// for the beginning of the replay. This is the only negative frame to be handled in such a way. //
bool isNegativeBreakFrame = i == 2 && skipFramesPresent && diff < 0; // On testing against stable it appears that stable ignores the negative time of *any* of the first
// three frames, regardless of if the skip frames are present. Hence the condition here.
if (!isNegativeBreakFrame) // But this may be incorrect and need to be revisited later.
if (i > 2)
{ {
timeDeficit += diff; timeDeficit += diff;
timeDeficit = Math.Min(0, timeDeficit); timeDeficit = Math.Min(0, timeDeficit);