1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-06 21:52:58 +08:00

Fix combo properties multiple reassignments

This commit is contained in:
Andrei Zavatski 2025-01-07 14:00:31 +03:00
parent 01e9c0f15e
commit 8f4eafea4e
3 changed files with 48 additions and 40 deletions

View File

@ -159,27 +159,29 @@ namespace osu.Game.Rulesets.Catch.Objects
{ {
// Note that this implementation is shared with the osu! ruleset's implementation. // Note that this implementation is shared with the osu! ruleset's implementation.
// If a change is made here, OsuHitObject.cs should also be updated. // If a change is made here, OsuHitObject.cs should also be updated.
ComboIndex = lastObj?.ComboIndex ?? 0; int index = lastObj?.ComboIndex ?? 0;
ComboIndexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0; int indexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0;
IndexInCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0; int inCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0;
if (this is BananaShower) // For the purpose of combo colours, spinners never start a new combo even if they are flagged as doing so.
if (this is not BananaShower)
{ {
// For the purpose of combo colours, spinners never start a new combo even if they are flagged as doing so. // At decode time, the first hitobject in the beatmap and the first hitobject after a banana shower are both enforced to be a new combo,
return; // but this isn't directly enforced by the editor so the extra checks against the last hitobject are duplicated here.
if (NewCombo || lastObj == null || lastObj is BananaShower)
{
inCurrentCombo = 0;
index++;
indexWithOffsets += ComboOffset + 1;
if (lastObj != null)
lastObj.LastInCombo = true;
}
} }
// At decode time, the first hitobject in the beatmap and the first hitobject after a banana shower are both enforced to be a new combo, ComboIndex = index;
// but this isn't directly enforced by the editor so the extra checks against the last hitobject are duplicated here. ComboIndexWithOffsets = indexWithOffsets;
if (NewCombo || lastObj == null || lastObj is BananaShower) IndexInCurrentCombo = inCurrentCombo;
{
IndexInCurrentCombo = 0;
ComboIndex++;
ComboIndexWithOffsets += ComboOffset + 1;
if (lastObj != null)
lastObj.LastInCombo = true;
}
} }
protected override HitWindows CreateHitWindows() => HitWindows.Empty; protected override HitWindows CreateHitWindows() => HitWindows.Empty;

View File

@ -184,27 +184,29 @@ namespace osu.Game.Rulesets.Osu.Objects
{ {
// Note that this implementation is shared with the osu!catch ruleset's implementation. // Note that this implementation is shared with the osu!catch ruleset's implementation.
// If a change is made here, CatchHitObject.cs should also be updated. // If a change is made here, CatchHitObject.cs should also be updated.
ComboIndex = lastObj?.ComboIndex ?? 0; int index = lastObj?.ComboIndex ?? 0;
ComboIndexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0; int indexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0;
IndexInCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0; int inCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0;
if (this is Spinner) // For the purpose of combo colours, spinners never start a new combo even if they are flagged as doing so.
if (this is not Spinner)
{ {
// For the purpose of combo colours, spinners never start a new combo even if they are flagged as doing so. // At decode time, the first hitobject in the beatmap and the first hitobject after a spinner are both enforced to be a new combo,
return; // but this isn't directly enforced by the editor so the extra checks against the last hitobject are duplicated here.
if (NewCombo || lastObj == null || lastObj is Spinner)
{
inCurrentCombo = 0;
index++;
indexWithOffsets += ComboOffset + 1;
if (lastObj != null)
lastObj.LastInCombo = true;
}
} }
// At decode time, the first hitobject in the beatmap and the first hitobject after a spinner are both enforced to be a new combo, ComboIndex = index;
// but this isn't directly enforced by the editor so the extra checks against the last hitobject are duplicated here. ComboIndexWithOffsets = indexWithOffsets;
if (NewCombo || lastObj == null || lastObj is Spinner) IndexInCurrentCombo = inCurrentCombo;
{
IndexInCurrentCombo = 0;
ComboIndex++;
ComboIndexWithOffsets += ComboOffset + 1;
if (lastObj != null)
lastObj.LastInCombo = true;
}
} }
protected override HitWindows CreateHitWindows() => new OsuHitWindows(); protected override HitWindows CreateHitWindows() => new OsuHitWindows();

View File

@ -84,19 +84,23 @@ namespace osu.Game.Rulesets.Objects.Types
/// <param name="lastObj">The previous hitobject, or null if this is the first object in the beatmap.</param> /// <param name="lastObj">The previous hitobject, or null if this is the first object in the beatmap.</param>
void UpdateComboInformation(IHasComboInformation? lastObj) void UpdateComboInformation(IHasComboInformation? lastObj)
{ {
ComboIndex = lastObj?.ComboIndex ?? 0; int index = lastObj?.ComboIndex ?? 0;
ComboIndexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0; int indexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0;
IndexInCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0; int inCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0;
if (NewCombo || lastObj == null) if (NewCombo || lastObj == null)
{ {
IndexInCurrentCombo = 0; inCurrentCombo = 0;
ComboIndex++; index++;
ComboIndexWithOffsets += ComboOffset + 1; indexWithOffsets += ComboOffset + 1;
if (lastObj != null) if (lastObj != null)
lastObj.LastInCombo = true; lastObj.LastInCombo = true;
} }
ComboIndex = index;
ComboIndexWithOffsets = indexWithOffsets;
IndexInCurrentCombo = inCurrentCombo;
} }
} }
} }