1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Change some BeatmapInfo defaults in a backwards compatible manner

This commit is contained in:
Bartłomiej Dach 2022-01-27 21:41:30 +01:00
parent 7dc3940dee
commit 1b8136e3e0
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
3 changed files with 18 additions and 10 deletions

View File

@ -99,11 +99,11 @@ namespace osu.Game.Beatmaps
public bool LetterboxInBreaks { get; set; }
public bool WidescreenStoryboard { get; set; }
public bool WidescreenStoryboard { get; set; } = true;
public bool EpilepsyWarning { get; set; }
public bool SamplesMatchPlaybackRate { get; set; }
public bool SamplesMatchPlaybackRate { get; set; } = true;
public double DistanceSpacing { get; set; }

View File

@ -90,14 +90,7 @@ namespace osu.Game.Beatmaps
{
Beatmaps =
{
new BeatmapInfo
{
Difficulty = new BeatmapDifficulty(),
Ruleset = ruleset,
Metadata = metadata,
WidescreenStoryboard = true,
SamplesMatchPlaybackRate = true,
}
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata)
}
};

View File

@ -56,6 +56,8 @@ namespace osu.Game.Beatmaps.Formats
this.beatmap = beatmap;
this.beatmap.BeatmapInfo.BeatmapVersion = FormatVersion;
applyLegacyDefaults(this.beatmap.BeatmapInfo);
base.ParseStreamInto(stream, beatmap);
flushPendingPoints();
@ -70,6 +72,19 @@ namespace osu.Game.Beatmaps.Formats
hitObject.ApplyDefaults(this.beatmap.ControlPointInfo, this.beatmap.Difficulty);
}
/// <summary>
/// Some `BeatmapInfo` members have default values that differ from the default values used by stable.
/// In addition, legacy beatmaps will sometimes not contain some configuration keys, in which case
/// the legacy default values should be used.
/// 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
/// </summary>
private void applyLegacyDefaults(BeatmapInfo beatmapInfo)
{
beatmapInfo.WidescreenStoryboard = false;
beatmapInfo.SamplesMatchPlaybackRate = false;
}
protected override bool ShouldSkipLine(string line) => base.ShouldSkipLine(line) || line.StartsWith(' ') || line.StartsWith('_');
protected override void ParseLine(Beatmap beatmap, Section section, string line)