Move samples to LegacyControlPointInfo

This commit is contained in:
Dean Herbert
2021-08-25 18:00:57 +09:00
parent 6b3cc81e19
commit 7257aae7f2
7 changed files with 110 additions and 63 deletions

View File

@ -44,6 +44,13 @@ namespace osu.Game.Beatmaps.Formats
offset = FormatVersion < 5 ? 24 : 0;
}
protected override Beatmap CreateTemplateObject()
{
var templateBeatmap = base.CreateTemplateObject();
templateBeatmap.ControlPointInfo = new LegacyControlPointInfo();
return templateBeatmap;
}
protected override void ParseStreamInto(LineBufferedReader stream, Beatmap beatmap)
{
this.beatmap = beatmap;
@ -394,8 +401,16 @@ namespace osu.Game.Beatmaps.Formats
private readonly HashSet<Type> pendingControlPointTypes = new HashSet<Type>();
private double pendingControlPointsTime;
private readonly LegacyControlPointInfo controlPointInfo = new LegacyControlPointInfo();
private void addControlPoint(double time, ControlPoint point, bool timingChange)
{
if (point is SampleControlPoint)
{
controlPointInfo.Add(time, point);
return;
}
if (time != pendingControlPointsTime)
flushPendingPoints();
@ -430,8 +445,15 @@ namespace osu.Game.Beatmaps.Formats
parser ??= new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
var obj = parser.Parse(line);
if (obj != null)
{
// assign legacy control points directly to hitobject
//obj.SampleControlPoint = controlPointInfo.SamplePointAt(obj.StartTime);
obj.ApplyDefaults(controlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
beatmap.HitObjects.Add(obj);
}
}
private int getOffsetTime(int time) => time + (ApplyOffsets ? offset : 0);