mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:52:55 +08:00
Apply beatmap offsets to legacy replay frame handling
This commit is contained in:
parent
3b97de04b7
commit
a7d5f2281c
@ -23,6 +23,8 @@ namespace osu.Game.Scoring.Legacy
|
||||
private IBeatmap currentBeatmap;
|
||||
private Ruleset currentRuleset;
|
||||
|
||||
private float beatmapOffset;
|
||||
|
||||
public Score Parse(Stream stream)
|
||||
{
|
||||
var score = new Score
|
||||
@ -72,6 +74,10 @@ namespace osu.Game.Scoring.Legacy
|
||||
currentBeatmap = workingBeatmap.GetPlayableBeatmap(currentRuleset.RulesetInfo, scoreInfo.Mods);
|
||||
scoreInfo.BeatmapInfo = currentBeatmap.BeatmapInfo;
|
||||
|
||||
// BeatmapVersion 4 and lower had an incorrect offset (stable has this set as 24ms off)
|
||||
// As this is baked into hitobject timing (see `LegacyBeatmapDecoder`) we also need to apply this to replay frame timing.
|
||||
beatmapOffset = currentBeatmap.BeatmapInfo.BeatmapVersion < 5 ? 24 : 0;
|
||||
|
||||
/* score.HpGraphString = */
|
||||
sr.ReadString();
|
||||
|
||||
@ -229,7 +235,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
|
||||
private void readLegacyReplay(Replay replay, StreamReader reader)
|
||||
{
|
||||
float lastTime = 0;
|
||||
float lastTime = beatmapOffset;
|
||||
ReplayFrame currentFrame = null;
|
||||
|
||||
string[] frames = reader.ReadToEnd().Split(',');
|
||||
|
@ -111,6 +111,10 @@ namespace osu.Game.Scoring.Legacy
|
||||
{
|
||||
StringBuilder replayData = new StringBuilder();
|
||||
|
||||
// BeatmapVersion 4 and lower had an incorrect offset (stable has this set as 24ms off)
|
||||
// As this is baked into hitobject timing (see `LegacyBeatmapDecoder`) we also need to apply this to replay frame timing.
|
||||
double offset = beatmap?.BeatmapInfo.BeatmapVersion < 5 ? -24 : 0;
|
||||
|
||||
if (score.Replay != null)
|
||||
{
|
||||
int lastTime = 0;
|
||||
@ -120,7 +124,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
var legacyFrame = getLegacyFrame(f);
|
||||
|
||||
// Rounding because stable could only parse integral values
|
||||
int time = (int)Math.Round(legacyFrame.Time);
|
||||
int time = (int)Math.Round(legacyFrame.Time + offset);
|
||||
replayData.Append(FormattableString.Invariant($"{time - lastTime}|{legacyFrame.MouseX ?? 0}|{legacyFrame.MouseY ?? 0}|{(int)legacyFrame.ButtonState},"));
|
||||
lastTime = time;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user