Truncate break times for legacy beatmap export

This commit is contained in:
Dan Balasescu 2024-06-26 16:20:54 +09:00
parent 173c4f430a
commit 276d8fe158
No known key found for this signature in database
1 changed files with 5 additions and 0 deletions

View File

@ -8,6 +8,7 @@
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.Timing;
using osu.Game.IO;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
@ -59,9 +60,13 @@ public LegacyBeatmapExporter(Storage storage)
// Convert beatmap elements to be compatible with legacy format
// So we truncate time and position values to integers, and convert paths with multiple segments to bezier curves
foreach (var controlPoint in playableBeatmap.ControlPointInfo.AllControlPoints)
controlPoint.Time = Math.Floor(controlPoint.Time);
for (int i = 0; i < playableBeatmap.Breaks.Count; i++)
playableBeatmap.Breaks[i] = new BreakPeriod(Math.Floor(playableBeatmap.Breaks[i].StartTime), Math.Floor(playableBeatmap.Breaks[i].EndTime));
foreach (var hitObject in playableBeatmap.HitObjects)
{
// Truncate end time before truncating start time because end time is dependent on start time