1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 14:12:56 +08:00

Fix slider velocity changes not being applied in patcher

This commit is contained in:
Bartłomiej Dach 2023-05-22 22:19:10 +02:00
parent 843d2903d2
commit f253d17a7f
No known key found for this signature in database

View File

@ -15,7 +15,9 @@ using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.Legacy;
using osu.Game.IO;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Skinning;
using Decoder = osu.Game.Beatmaps.Formats.Decoder;
@ -42,6 +44,7 @@ namespace osu.Game.Screens.Edit
editorBeatmap.BeginChange();
processHitObjects(result, () => newBeatmap ??= readBeatmap(newState));
processTimingPoints(() => newBeatmap ??= readBeatmap(newState));
processSliderVelocity(() => newBeatmap ??= readBeatmap(newState));
editorBeatmap.EndChange();
}
@ -71,6 +74,17 @@ namespace osu.Game.Screens.Edit
}
}
private void processSliderVelocity(Func<IBeatmap> getNewBeatmap)
{
var legacyControlPoints = (LegacyControlPointInfo)getNewBeatmap().ControlPointInfo;
foreach (var hitObject in editorBeatmap.HitObjects.Where(ho => ho is IHasSliderVelocity))
{
var difficultyPoint = legacyControlPoints.DifficultyPointAt(hitObject.StartTime);
((IHasSliderVelocity)hitObject).SliderVelocity = difficultyPoint.SliderVelocity;
}
}
private void processHitObjects(DiffResult result, Func<IBeatmap> getNewBeatmap)
{
findChangedIndices(result, LegacyDecoder<Beatmap>.Section.HitObjects, out var removedIndices, out var addedIndices);