1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:32:55 +08:00

Move legacy beatmap combo offset to osu! processor

Better suited there, I intiailly wanted the whole legacy interface to reside in `osu.Game.Rulesets.Osu` but it's required in `ConvertHitObjectParser` and that's in the main game project, so had to leave the interface as-is for now.
This commit is contained in:
Salman Ahmed 2021-05-05 14:24:13 +03:00
parent bf6e98345c
commit 6fb9eb8b33
2 changed files with 19 additions and 10 deletions

View File

@ -2,9 +2,11 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
using osuTK;
@ -19,6 +21,23 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
{
}
public override void PreProcess()
{
base.PreProcess();
OsuHitObject lastObj = null;
foreach (var obj in Beatmap.HitObjects.OfType<OsuHitObject>())
{
if (obj.NewCombo)
obj.LegacyBeatmapComboIndex = (lastObj?.LegacyBeatmapComboIndex ?? 0) + obj.LegacyBeatmapComboOffset + 1;
else if (lastObj != null)
obj.LegacyBeatmapComboIndex = lastObj.LegacyBeatmapComboIndex;
lastObj = obj;
}
}
public override void PostProcess()
{
base.PostProcess();

View File

@ -48,16 +48,6 @@ namespace osu.Game.Beatmaps
obj.ComboIndex = lastObj.ComboIndex;
}
if (obj is IHasLegacyBeatmapComboOffset legacyObj)
{
var lastLegacyObj = (IHasLegacyBeatmapComboOffset)lastObj;
if (obj.NewCombo)
legacyObj.LegacyBeatmapComboIndex = (lastLegacyObj?.LegacyBeatmapComboIndex ?? 0) + legacyObj.LegacyBeatmapComboOffset + 1;
else if (lastLegacyObj != null)
legacyObj.LegacyBeatmapComboIndex = lastLegacyObj.LegacyBeatmapComboIndex;
}
lastObj = obj;
}
}