Add LegacyContext

This commit is contained in:
OliBomby
2023-04-25 12:12:46 +02:00
parent a4c6850ab2
commit ea1e6e9798
8 changed files with 155 additions and 29 deletions

View File

@ -18,6 +18,7 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Context;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
@ -30,7 +31,7 @@ namespace osu.Game.Rulesets.Objects
/// HitObjects may contain more properties for which you should be checking through the IHas* types.
/// </para>
/// </summary>
public class HitObject
public class HitObject : ContextContainer
{
/// <summary>
/// A small adjustment to the start time of control points to account for rounding/precision errors.
@ -81,12 +82,6 @@ namespace osu.Game.Rulesets.Objects
public SampleControlPoint SampleControlPoint = SampleControlPoint.DEFAULT;
public DifficultyControlPoint DifficultyControlPoint = DifficultyControlPoint.DEFAULT;
/// <summary>
/// Legacy BPM multiplier that introduces floating-point errors for rulesets that depend on it.
/// DO NOT USE THIS UNLESS 100% SURE.
/// </summary>
public double? LegacyBpmMultiplier { get; private set; }
/// <summary>
/// Whether this <see cref="HitObject"/> is in Kiai time.
/// </summary>
@ -174,12 +169,6 @@ namespace osu.Game.Rulesets.Objects
{
var legacyInfo = controlPointInfo as LegacyControlPointInfo;
DifficultyControlPoint difficultyControlPoint = legacyInfo != null ? legacyInfo.DifficultyPointAt(StartTime) : DifficultyControlPoint.DEFAULT;
#pragma warning disable 618
if (difficultyControlPoint is LegacyBeatmapDecoder.LegacyDifficultyControlPoint legacyDifficultyControlPoint)
#pragma warning restore 618
LegacyBpmMultiplier = legacyDifficultyControlPoint.BpmMultiplier;
ApplyLegacyInfoToSelf(controlPointInfo, difficulty);
// This is done here after ApplyLegacyInfoToSelf as we may require custom defaults to be applied to have an accurate end time.