Fix osu!mania hold notes occasionally getting in a visually incorrect hit state

To correctly end a mania hold note, `endHold()` needs to be called. This
was not happening in a very specific scenario:

- The hold note's head is not hit
- The user pressed the column's key within the hold note's tail's window,
  but does so to hit the next object (a note in proximity to the hold note's tail).
- The hit policy forces a miss on the hold note, but `endHold()` is not called
- `CheckForResult` is not called after this point due to `Judged` being `true`.

Closes #21311.
This commit is contained in:
Dean Herbert 2022-11-22 16:15:32 +09:00
parent 6b75f529c7
commit 57723107dd
2 changed files with 13 additions and 3 deletions

View File

@ -262,14 +262,24 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
tick.MissForcefully();
}
ApplyResult(r => r.Type = Tail.IsHit ? r.Judgement.MaxResult : r.Judgement.MinResult);
endHold();
if (Tail.IsHit)
ApplyResult(r => r.Type = r.Judgement.MaxResult);
else
MissForcefully();
}
if (Tail.Judged && !Tail.IsHit)
HoldBrokenTime = Time.Current;
}
public override void MissForcefully()
{
base.MissForcefully();
// Important that this is always called when a result is applied.
endHold();
}
public bool OnPressed(KeyBindingPressEvent<ManiaAction> e)
{
if (AllJudged)

View File

@ -87,7 +87,7 @@ protected override void UpdateHitStateTransforms(ArmedState state)
/// <summary>
/// Causes this <see cref="DrawableManiaHitObject"/> to get missed, disregarding all conditions in implementations of <see cref="DrawableHitObject.CheckForResult"/>.
/// </summary>
public void MissForcefully() => ApplyResult(r => r.Type = r.Judgement.MinResult);
public virtual void MissForcefully() => ApplyResult(r => r.Type = r.Judgement.MinResult);
}
public abstract class DrawableManiaHitObject<TObject> : DrawableManiaHitObject