Skip to content

Commit

Permalink
Revert "Looping of character sing and strumline confirm animations on…
Browse files Browse the repository at this point in the history
… hold notes"

This reverts commit 3b69379.
  • Loading branch information
charlesisfeline authored Jun 24, 2024
1 parent bfa8e53 commit afa452f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 62 deletions.
49 changes: 8 additions & 41 deletions source/funkin/play/character/BaseCharacter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,6 @@ class BaseCharacter extends Bopper
}
}

/**
* Stored the direction of the last note that was hit by this player.
*/
var lastNoteDirection:Null<NoteDirection> = null;

/**
* Stores the time at which the player should stop looping the sing animation when pressing a hold note.
*/
var lastHoldFinish:Null<Float> = null;

public override function onUpdate(event:UpdateScriptEvent):Void
{
super.onUpdate(event);
Expand Down Expand Up @@ -398,17 +388,6 @@ class BaseCharacter extends Bopper

// Without this check here, the player character would only play the `sing` animation
// for one beat, as opposed to holding it as long as the player is holding the button.

// Repeat the sing animation when pressing a hold note just like in the old input system.
if ((this.characterType != BF || isHoldingNote())
&& this.animation.curAnim.curFrame >= 3
&& lastNoteDirection != null
&& (lastHoldFinish != null && lastHoldFinish >= Conductor.instance.songPosition))
{
this.playSingAnimation(lastNoteDirection, false);
holdTimer = 0;
}

var shouldStopSinging:Bool = (this.characterType == BF) ? !isHoldingNote() : true;

FlxG.watch.addQuick('singTimeSec-${characterId}', singTimeSec);
Expand Down Expand Up @@ -500,15 +479,6 @@ class BaseCharacter extends Bopper
return false;
}

/**
* Resets the hold data values to stop the animation from looping
*/
function stopHolding()
{
lastNoteDirection = null;
lastHoldFinish = null;
}

/**
* Every time a note is hit, check if the note is from the same strumline.
* If it is, then play the sing animation.
Expand All @@ -517,16 +487,17 @@ class BaseCharacter extends Bopper
{
super.onNoteHit(event);

var noteDirection:NoteDirection = event.note.noteData.getDirection();

if ((event.note.noteData.getMustHitNote() && characterType == BF) || (!event.note.noteData.getMustHitNote() && characterType == DAD))
if (event.note.noteData.getMustHitNote() && characterType == BF)
{
// If the note is from the same strumline, play the sing animation.
this.playSingAnimation(noteDirection, false);
this.playSingAnimation(event.note.noteData.getDirection(), false);
holdTimer = 0;
}
else if (!event.note.noteData.getMustHitNote() && characterType == DAD)
{
// If the note is from the same strumline, play the sing animation.
this.playSingAnimation(event.note.noteData.getDirection(), false);
holdTimer = 0;

lastNoteDirection = noteDirection;
if (event.note.noteData.isHoldNote) lastHoldFinish = event.note.strumTime + event.note.noteData.length;
}
}

Expand Down Expand Up @@ -569,8 +540,6 @@ class BaseCharacter extends Bopper
this.playAnimation(dropAnim, true, true);
}
}

stopHolding();
}

/**
Expand All @@ -592,8 +561,6 @@ class BaseCharacter extends Bopper
// trace('Playing ghost miss animation...');
this.playSingAnimation(event.dir, true);
}

stopHolding();
}

public override function onDestroy(event:ScriptEvent):Void
Expand Down
8 changes: 1 addition & 7 deletions source/funkin/play/notes/Strumline.hx
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,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); */
playConfirmHold(holdNote.noteDirection);
holdConfirm(holdNote.noteDirection);
holdNote.visible = true;

holdNote.sustainLength = (holdNote.strumTime + holdNote.fullSustainLength) - conductorInUse.songPosition;
Expand Down Expand Up @@ -645,11 +644,6 @@ class Strumline extends FlxSpriteGroup
getByDirection(direction).playConfirm();
}

public function playConfirmHold(direction:NoteDirection):Void
{
getByDirection(direction).playConfirmHold();
}

public function holdConfirm(direction:NoteDirection):Void
{
getByDirection(direction).holdConfirm();
Expand Down
14 changes: 0 additions & 14 deletions source/funkin/play/notes/StrumlineNote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ class StrumlineNote extends FlxSprite
this.playAnimation('confirm', true);
}

public function playConfirmHold():Void
{
if (getCurrentAnimationFrame() >= 3)
{
this.active = true;
this.playAnimation('confirm', true);
}
}

public function isConfirm():Bool
{
return getCurrentAnimation().startsWith('confirm');
Expand Down Expand Up @@ -147,11 +138,6 @@ class StrumlineNote extends FlxSprite
}
}

public function getCurrentAnimationFrame():Int
{
return this.animation.curAnim.curFrame;
}

/**
* Returns the name of the animation that is currently playing.
* If no animation is playing (usually this means the sprite is BROKEN!),
Expand Down

0 comments on commit afa452f

Please sign in to comment.