Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/funkin/play/notes/Strumline.hx
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ class Strumline extends FlxSpriteGroup
else if (conductorInUse.songPosition > holdNote.strumTime && holdNote.hitNote)
{
// Hold note is currently being hit, clip it off.
holdConfirm(holdNote.noteDirection);
holdConfirm(holdNote.noteDirection, holdNote.fullSustainLength);
holdNote.visible = true;

holdNote.sustainLength = (holdNote.strumTime + holdNote.fullSustainLength) - conductorInUse.songPosition;
Expand Down Expand Up @@ -1019,9 +1019,9 @@ class Strumline extends FlxSpriteGroup
* Play a confirm animation for a hold note.
* @param direction The direction of the note to play the confirm animation for.
*/
public function holdConfirm(direction:NoteDirection):Void
public function holdConfirm(direction:NoteDirection, ?length:Float = 0):Void
{
getByDirection(direction).holdConfirm();
getByDirection(direction).holdConfirm(length / 1000);

if (isPlayer) noteVibrations.noteStatuses[direction] = NoteStatus.holdConfirm;
}
Expand Down
46 changes: 27 additions & 19 deletions source/funkin/play/notes/StrumlineNote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class StrumlineNote extends FunkinSprite
{
// Run a timer before we stop playing the confirm animation.
// On player, this allows holding the confirm key to fall back to press.
if (isPlayer && name == 'confirm')
if (isPlayer && name == 'confirm' && !holding)
{
confirmHoldTimer = 0;
confirmHoldTimer = CONFIRM_HOLD_TIME;
}
}

Expand All @@ -85,15 +85,16 @@ class StrumlineNote extends FunkinSprite

centerOrigin();

if (confirmHoldTimer >= 0)
if (confirmHoldTimer > 0)
{
confirmHoldTimer += elapsed;
confirmHoldTimer -= elapsed;

// Ensure the opponent stops holding the key after a certain amount of time.
if (confirmHoldTimer >= CONFIRM_HOLD_TIME)
if (confirmHoldTimer <= 0)
{
confirmHoldTimer = -1;
playStatic();
holding = false;
}
}
}
Expand Down Expand Up @@ -145,36 +146,43 @@ class StrumlineNote extends FunkinSprite

// On opponent, run a timer to stop playing the confirm animation.
// On player, stop the timer to avoid stopping the confirm animation earlier.
confirmHoldTimer = isPlayer ? -1 : 0;
confirmHoldTimer = isPlayer ? -1 : CONFIRM_HOLD_TIME;
holding = false;
}

public function isConfirm():Bool
{
return getCurrentAnimation().startsWith('confirm');
}

public function holdConfirm():Void
public var holding:Bool = false;

public function holdConfirm(?length:Float = 0):Void
{
this.active = true;

if (getCurrentAnimation() == "confirm-hold")
{
return;
}
else if (getCurrentAnimation() == "confirm")
if (holding) return;

this.confirmHoldTimer = isPlayer ? -1 : Math.max(length, CONFIRM_HOLD_TIME);

if ((getCurrentAnimation() == 'confirm' && isAnimationFinished()) || !gotCorrectConfirmHoldAnimation()) holding = true;

if (holding)
{
if (isAnimationFinished())
if (gotCorrectConfirmHoldAnimation())
{
this.confirmHoldTimer = -1;
this.playAnimation('confirm-hold', false, false);
}
}
else
{
this.playAnimation('confirm', false, false);
else
{
// Commented out, since it will spam this trace in console on every hold note with default notestlyes lol.
// trace('[WARN] Incorrect data for `confirm-hold` animation!');
}
}
}

private inline function gotCorrectConfirmHoldAnimation():Bool
return animation?.getByName("confirm-hold")?.looped ?? false;
/**
* Returns the name of the animation that is currently playing.
* If no animation is playing (usually this means the sprite is BROKEN!),
Expand All @@ -188,7 +196,7 @@ class StrumlineNote extends FunkinSprite

public function isAnimationFinished():Bool
{
return this.animation.finished;
return this.animation?.finished ?? true;
}

static final DEFAULT_OFFSET:Int = 13;
Expand Down