This commit is contained in:
Lasercar 2025-04-05 06:28:40 +10:00 committed by GitHub
commit 3b3031a181
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 38 additions and 3 deletions

View file

@ -2634,13 +2634,13 @@ class PlayState extends MusicBeatSubState
});
}
}
vocals.playerVolume = 0;
if (!currentStage.getBoyfriend().tempVocals) vocals.playerVolume = 0;
applyScore(-10, 'miss', healthChange, true);
if (playSound)
{
vocals.playerVolume = 0;
if (!currentStage.getBoyfriend().tempVocals) vocals.playerVolume = 0;
FunkinSound.playOnce(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.5, 0.6));
}
}
@ -2695,7 +2695,7 @@ class PlayState extends MusicBeatSubState
if (event.playSound)
{
vocals.playerVolume = 0;
if (!currentStage.getBoyfriend().tempVocals) vocals.playerVolume = 0;
FunkinSound.playOnce(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.1, 0.2));
}
}

View file

@ -62,6 +62,11 @@ class BaseCharacter extends Bopper
final _data:CharacterData;
final singTimeSteps:Float;
/**
* When set to true, the next animation to play will temporarily force the character's vocals to play.
*/
public var tempVocals:Bool = false;
/**
* The offset between the corner of the sprite and the origin of the sprite (at the character's feet).
* cornerPosition = stageData - characterOrigin
@ -308,6 +313,20 @@ class BaseCharacter extends Bopper
// Force the character to play the idle after the animation ends.
this.dance(true);
}
if (tempVocals)
{
// stop the temporary vocals
if (characterType == BF && PlayState.instance.vocals.playerVolume == 1)
{
PlayState.instance.vocals.playerVolume = 0;
}
if (characterType == DAD && PlayState.instance.vocals.opponentVolume == 1)
{
PlayState.instance.vocals.opponentVolume = 0;
}
tempVocals = false;
}
}
function resetCameraFocusPoint():Void
@ -642,6 +661,21 @@ class BaseCharacter extends Bopper
public override function playAnimation(name:String, restart:Bool = false, ignoreOther:Bool = false, reversed:Bool = false):Void
{
if (tempVocals)
{
// restart the character's vocals for the duration of the animation
if (characterType == BF && PlayState.instance.vocals.playerVolume == 0)
{
PlayState.instance.vocals.playerVolume = 1;
}
else if (characterType == DAD && PlayState.instance.vocals.opponentVolume == 0)
{
PlayState.instance.vocals.opponentVolume = 1;
}
else if (characterType != BF || characterType != DAD)
tempVocals = false;
}
super.playAnimation(name, restart, ignoreOther, reversed);
}

View file

@ -50,6 +50,7 @@ class PlayAnimationSongEvent extends SongEvent
if (Std.isOfType(target, BaseCharacter))
{
var targetChar:BaseCharacter = cast target;
targetChar.tempVocals = force;
targetChar.playAnimation(anim, force, force);
}
else