1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 15:07:52 +08:00

Fix WidescreenStoryboard breakage after moving out of BeatmapInfo

This commit is contained in:
Bartłomiej Dach 2024-07-23 12:19:45 +02:00
parent d707e29ff7
commit 1d4d806362
No known key found for this signature in database
3 changed files with 23 additions and 3 deletions

View File

@ -80,7 +80,7 @@ namespace osu.Game.Beatmaps.Formats
this.beatmap = beatmap; this.beatmap = beatmap;
this.beatmap.BeatmapInfo.BeatmapVersion = FormatVersion; this.beatmap.BeatmapInfo.BeatmapVersion = FormatVersion;
applyLegacyDefaults(this.beatmap); ApplyLegacyDefaults(this.beatmap);
base.ParseStreamInto(stream, beatmap); base.ParseStreamInto(stream, beatmap);
@ -186,7 +186,7 @@ namespace osu.Game.Beatmaps.Formats
/// This method's intention is to restore those legacy defaults. /// This method's intention is to restore those legacy defaults.
/// See also: https://osu.ppy.sh/wiki/en/Client/File_formats/Osu_%28file_format%29 /// See also: https://osu.ppy.sh/wiki/en/Client/File_formats/Osu_%28file_format%29
/// </summary> /// </summary>
private static void applyLegacyDefaults(Beatmap beatmap) internal static void ApplyLegacyDefaults(Beatmap beatmap)
{ {
beatmap.WidescreenStoryboard = false; beatmap.WidescreenStoryboard = false;
beatmap.SamplesMatchPlaybackRate = false; beatmap.SamplesMatchPlaybackRate = false;

View File

@ -37,6 +37,17 @@ namespace osu.Game.Beatmaps.Formats
SetFallbackDecoder<Storyboard>(() => new LegacyStoryboardDecoder()); SetFallbackDecoder<Storyboard>(() => new LegacyStoryboardDecoder());
} }
protected override Storyboard CreateTemplateObject()
{
var sb = base.CreateTemplateObject();
var beatmap = new Beatmap();
LegacyBeatmapDecoder.ApplyLegacyDefaults(beatmap);
sb.Beatmap = beatmap;
return sb;
}
protected override void ParseStreamInto(LineBufferedReader stream, Storyboard storyboard) protected override void ParseStreamInto(LineBufferedReader stream, Storyboard storyboard)
{ {
this.storyboard = storyboard; this.storyboard = storyboard;
@ -72,6 +83,10 @@ namespace osu.Game.Beatmaps.Formats
case "UseSkinSprites": case "UseSkinSprites":
storyboard.UseSkinSprites = pair.Value == "1"; storyboard.UseSkinSprites = pair.Value == "1";
break; break;
case @"WidescreenStoryboard":
storyboard.Beatmap.WidescreenStoryboard = Parsing.ParseInt(pair.Value) == 1;
break;
} }
} }

View File

@ -62,7 +62,12 @@ namespace osu.Game.Beatmaps
#region Resource getters #region Resource getters
protected virtual Waveform GetWaveform() => new Waveform(null); protected virtual Waveform GetWaveform() => new Waveform(null);
protected virtual Storyboard GetStoryboard() => new Storyboard { BeatmapInfo = BeatmapInfo };
protected virtual Storyboard GetStoryboard() => new Storyboard
{
BeatmapInfo = BeatmapInfo,
Beatmap = Beatmap,
};
protected abstract IBeatmap GetBeatmap(); protected abstract IBeatmap GetBeatmap();
public abstract Texture GetBackground(); public abstract Texture GetBackground();