Skip to content

Commit

Permalink
Update difficulty/sample points on hitobjects
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo committed Jun 13, 2022
1 parent 5a18547 commit ef87b8a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions osu.Game/Screens/Edit/LegacyEditorBeatmapPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.Legacy;
using osu.Game.IO;
using osu.Game.Skinning;
using Decoder = osu.Game.Beatmaps.Formats.Decoder;
Expand Down Expand Up @@ -51,12 +52,16 @@ private void processTimingPoints(DiffResult result, Func<IBeatmap> getNewBeatmap

// Due to conversion from legacy to non-legacy control points, it becomes difficult to diff control points correctly.
// So instead _all_ control points are reloaded if _any_ control point is changed.

var newControlPoints = EditorBeatmap.ConvertControlPoints(getNewBeatmap().ControlPointInfo);
LegacyControlPointInfo legacyControlPoints = (LegacyControlPointInfo)getNewBeatmap().ControlPointInfo;

editorBeatmap.ControlPointInfo.Clear();
foreach (var point in newControlPoints.AllControlPoints)
foreach (var point in EditorBeatmap.ConvertControlPoints(legacyControlPoints).AllControlPoints)
editorBeatmap.ControlPointInfo.Add(point.Time, point);

// We need to update the existing difficulty/sample control points in hitobjects.
// Note: EditorBeatmap.UpdateAllHitObjects() can't be used since it uses a non-legacy ControlPointInfo.
foreach (var obj in editorBeatmap.HitObjects)
obj.ApplyDefaults(legacyControlPoints, editorBeatmap.Difficulty);
}

private void processHitObjects(DiffResult result, Func<IBeatmap> getNewBeatmap)
Expand Down

0 comments on commit ef87b8a

Please sign in to comment.