1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 01:32:55 +08:00

Force new combo on objects succeeding a break

No issue thread for this again. Reported internally on discord:
https://discord.com/channels/90072389919997952/1259818301517725707/1320420768814727229

Placing this logic in the beatmap processor, as a post-processing step,
means that the new combo force won't be visible until a placement has
been committed. That can be seen as subpar, but I tried putting this
logic in the placement and it sucked anyway:

- While the combo number was correct, the colour looked off, because it
  would use the same combo colour as the already-placed objects after
  said break, which would only cycle to the next, correct one on
  placement

- Not all scenarios can be handled in the placement. Refer to one of the
  test cases added in the preceding commit, wherein two objects are
  placed far apart from each other, and an automated break is inserted
  between them - the placement has no practical way of knowing whether
  it's going to have a break inserted automatically before it or not.
This commit is contained in:
Bartłomiej Dach 2025-01-07 13:59:53 +01:00
parent 973f606a9e
commit c93b87583a
No known key found for this signature in database

View File

@ -41,6 +41,7 @@ namespace osu.Game.Screens.Edit
rulesetBeatmapProcessor?.PostProcess();
autoGenerateBreaks();
ensureNewComboAfterBreaks();
}
private void autoGenerateBreaks()
@ -100,5 +101,31 @@ namespace osu.Game.Screens.Edit
Beatmap.Breaks.Add(breakPeriod);
}
}
private void ensureNewComboAfterBreaks()
{
var breakEnds = Beatmap.Breaks.Select(b => b.EndTime).OrderBy(t => t).ToList();
if (breakEnds.Count == 0)
return;
int currentBreak = 0;
for (int i = 0; i < Beatmap.HitObjects.Count; ++i)
{
var hitObject = Beatmap.HitObjects[i];
if (hitObject is not IHasComboInformation hasCombo)
continue;
if (currentBreak < breakEnds.Count && hitObject.StartTime >= breakEnds[currentBreak])
{
hasCombo.NewCombo = true;
currentBreak += 1;
}
hasCombo.UpdateComboInformation(i > 0 ? Beatmap.HitObjects[i - 1] as IHasComboInformation : null);
}
}
}
}