1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-19 12:23:13 +08:00

Better explanation for fixComboInfo

This commit is contained in:
Henry Lin 2021-06-24 11:21:43 +08:00
parent 6202eed5e2
commit 6fca8ba5b0

View File

@ -249,13 +249,20 @@ namespace osu.Game.Rulesets.Osu.Mods
private void fixComboInfo(List<OsuHitObject> hitObjects) private void fixComboInfo(List<OsuHitObject> hitObjects)
{ {
// First follow the combo indices in the original beatmap // Copy combo indices from the closest preceding object
hitObjects.ForEach(x => hitObjects.ForEach(obj =>
{ {
var origObj = origHitObjects.FindLast(y => Precision.AlmostBigger(x.StartTime, y.StartTime)); var closestOrigObj = origHitObjects.FindLast(y => Precision.AlmostBigger(obj.StartTime, y.StartTime));
x.ComboIndex = origObj?.ComboIndex ?? 0;
// It shouldn't be possible for origObj to be null
// But if it is, obj should be in the first combo
obj.ComboIndex = closestOrigObj?.ComboIndex ?? 0;
}); });
// Then reprocess them to ensure continuity in the combo indices and add indices in current combo
// The copied combo indices may not be continuous if the original map starts and ends a combo in between beats
// e.g. A stream with each object starting a new combo
// So combo indices need to be reprocessed to ensure continuity
// Other kinds of combo info are also added in the process
var combos = hitObjects.GroupBy(x => x.ComboIndex).ToList(); var combos = hitObjects.GroupBy(x => x.ComboIndex).ToList();
for (var i = 0; i < combos.Count; i++) for (var i = 0; i < combos.Count; i++)