Skip to content

Commit

Permalink
Merge pull request #551 from LumpBloom7/HoldNote-excess-input-passthr…
Browse files Browse the repository at this point in the history
…ough

Prevent HOLD notes from blocking input meant for future hitobjects
  • Loading branch information
LumpBloom7 authored Feb 21, 2024
2 parents 939ea4b + 0d748ab commit 7a9acb8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions osu.Game.Rulesets.Sentakki/Objects/Drawables/DrawableHold.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ protected override void OnFree()
base.OnFree();
HoldStartTime = null;
TotalHoldTime = 0;
pressedCount = 0;
}

protected override void UpdateInitialTransforms()
Expand Down Expand Up @@ -199,6 +200,9 @@ protected override void ClearNestedHitObjects()

private bool beginHoldAt(double timeOffset)
{
if (HoldStartTime is not null)
return false;

if (timeOffset < -Head.HitObject.HitWindows.WindowFor(HitResult.Miss))
return false;

Expand All @@ -214,6 +218,8 @@ private void endHold()
HoldStartTime = null;
}

// Tracks how many inputs are pressing on this HitObject currently
private int pressedCount = 0;
public bool OnPressed(KeyBindingPressEvent<SentakkiAction> e)
{
if (AllJudged)
Expand All @@ -222,13 +228,17 @@ public bool OnPressed(KeyBindingPressEvent<SentakkiAction> e)
if (e.Action != SentakkiAction.Key1 + HitObject.Lane)
return false;

pressedCount++;

if (beginHoldAt(Time.Current - Head.HitObject.StartTime))
{
Head.UpdateResult();
NoteBody.FadeColour(AccentColour.Value, 50);
return true;
}

return true;
// Passthrough excess inputs to later hitobjects in the same lane
return false;
}

public void OnReleased(KeyBindingReleaseEvent<SentakkiAction> e)
Expand All @@ -239,7 +249,9 @@ public void OnReleased(KeyBindingReleaseEvent<SentakkiAction> e)
if (e.Action != SentakkiAction.Key1 + HitObject.Lane)
return;

endHold();
// We only release the hold once ALL inputs are released
if (--pressedCount == 0)
endHold();

if (!AllJudged)
NoteBody.FadeColour(Color4.Gray, 100);
Expand Down

0 comments on commit 7a9acb8

Please sign in to comment.