mirror of
https://github.com/ppy/osu
synced 2025-03-19 09:34:49 +00:00
Merge pull request #8461 from peppy/fix-minia-mod-replay-recording
Fix osu!mania replays recording incorrectly when key mod applied
This commit is contained in:
commit
f25b1b33e3
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Replays.Legacy;
|
using osu.Game.Replays.Legacy;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
@ -26,13 +27,7 @@ namespace osu.Game.Rulesets.Mania.Replays
|
|||||||
|
|
||||||
public void FromLegacy(LegacyReplayFrame legacyFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
|
public void FromLegacy(LegacyReplayFrame legacyFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
|
||||||
{
|
{
|
||||||
// We don't need to fully convert, just create the converter
|
var maniaBeatmap = (ManiaBeatmap)beatmap;
|
||||||
var converter = new ManiaBeatmapConverter(beatmap, new ManiaRuleset());
|
|
||||||
|
|
||||||
// NB: Via co-op mod, osu-stable can have two stages with floor(col/2) and ceil(col/2) columns. This will need special handling
|
|
||||||
// elsewhere in the game if we do choose to support the old co-op mod anyway. For now, assume that there is only one stage.
|
|
||||||
|
|
||||||
var stage = new StageDefinition { Columns = converter.TargetColumns };
|
|
||||||
|
|
||||||
var normalAction = ManiaAction.Key1;
|
var normalAction = ManiaAction.Key1;
|
||||||
var specialAction = ManiaAction.Special1;
|
var specialAction = ManiaAction.Special1;
|
||||||
@ -42,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Replays
|
|||||||
|
|
||||||
while (activeColumns > 0)
|
while (activeColumns > 0)
|
||||||
{
|
{
|
||||||
var isSpecial = stage.IsSpecialColumn(counter);
|
var isSpecial = maniaBeatmap.Stages.First().IsSpecialColumn(counter);
|
||||||
|
|
||||||
if ((activeColumns & 1) > 0)
|
if ((activeColumns & 1) > 0)
|
||||||
Actions.Add(isSpecial ? specialAction : normalAction);
|
Actions.Add(isSpecial ? specialAction : normalAction);
|
||||||
@ -59,17 +54,15 @@ namespace osu.Game.Rulesets.Mania.Replays
|
|||||||
|
|
||||||
public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
|
public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
|
||||||
{
|
{
|
||||||
|
var maniaBeatmap = (ManiaBeatmap)beatmap;
|
||||||
|
|
||||||
int keys = 0;
|
int keys = 0;
|
||||||
|
|
||||||
var converter = new ManiaBeatmapConverter(beatmap, new ManiaRuleset());
|
|
||||||
|
|
||||||
var stage = new StageDefinition { Columns = converter.TargetColumns };
|
|
||||||
|
|
||||||
var specialColumns = new List<int>();
|
var specialColumns = new List<int>();
|
||||||
|
|
||||||
for (int i = 0; i < converter.TargetColumns; i++)
|
for (int i = 0; i < maniaBeatmap.TotalColumns; i++)
|
||||||
{
|
{
|
||||||
if (stage.IsSpecialColumn(i))
|
if (maniaBeatmap.Stages.First().IsSpecialColumn(i))
|
||||||
specialColumns.Add(i);
|
specialColumns.Add(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,9 +45,6 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
if (workingBeatmap is DummyWorkingBeatmap)
|
if (workingBeatmap is DummyWorkingBeatmap)
|
||||||
throw new BeatmapNotFoundException();
|
throw new BeatmapNotFoundException();
|
||||||
|
|
||||||
currentBeatmap = workingBeatmap.Beatmap;
|
|
||||||
scoreInfo.Beatmap = currentBeatmap.BeatmapInfo;
|
|
||||||
|
|
||||||
scoreInfo.User = new User { Username = sr.ReadString() };
|
scoreInfo.User = new User { Username = sr.ReadString() };
|
||||||
|
|
||||||
// MD5Hash
|
// MD5Hash
|
||||||
@ -68,6 +65,9 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
|
|
||||||
scoreInfo.Mods = currentRuleset.ConvertFromLegacyMods((LegacyMods)sr.ReadInt32()).ToArray();
|
scoreInfo.Mods = currentRuleset.ConvertFromLegacyMods((LegacyMods)sr.ReadInt32()).ToArray();
|
||||||
|
|
||||||
|
currentBeatmap = workingBeatmap.GetPlayableBeatmap(currentRuleset.RulesetInfo, scoreInfo.Mods);
|
||||||
|
scoreInfo.Beatmap = currentBeatmap.BeatmapInfo;
|
||||||
|
|
||||||
/* score.HpGraphString = */
|
/* score.HpGraphString = */
|
||||||
sr.ReadString();
|
sr.ReadString();
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
using (var stream = new MemoryStream())
|
using (var stream = new MemoryStream())
|
||||||
{
|
{
|
||||||
new LegacyScoreEncoder(score, gameplayBeatmap).Encode(stream);
|
new LegacyScoreEncoder(score, gameplayBeatmap.PlayableBeatmap).Encode(stream);
|
||||||
replayReader = new LegacyByteArrayReader(stream.ToArray(), "replay.osr");
|
replayReader = new LegacyByteArrayReader(stream.ToArray(), "replay.osr");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user