1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-02-10 21:43:06 +00:00

Merge pull request #331 from FunkinCrew/bugfix/countdown-pause-music

Fix issue with incorrect music after pausing during countdown
This commit is contained in:
Cameron Taylor 2024-02-16 17:36:23 -05:00 committed by GitHub
commit 928f941c2f

View file

@ -354,6 +354,11 @@ class PlayState extends MusicBeatSubState
*/ */
var startingSong:Bool = false; var startingSong:Bool = false;
/**
* False if `FlxG.sound.music`
*/
var musicPausedBySubState:Bool = false;
/** /**
* False until `create()` has completed. * False until `create()` has completed.
*/ */
@ -1042,6 +1047,7 @@ class PlayState extends MusicBeatSubState
// Pause the music. // Pause the music.
if (FlxG.sound.music != null) if (FlxG.sound.music != null)
{ {
musicPausedBySubState = FlxG.sound.music.playing;
FlxG.sound.music.pause(); FlxG.sound.music.pause();
if (vocals != null) vocals.pause(); if (vocals != null) vocals.pause();
} }
@ -1049,7 +1055,6 @@ class PlayState extends MusicBeatSubState
// Pause the countdown. // Pause the countdown.
Countdown.pauseCountdown(); Countdown.pauseCountdown();
} }
else {}
super.openSubState(subState); super.openSubState(subState);
} }
@ -1069,7 +1074,10 @@ class PlayState extends MusicBeatSubState
if (event.eventCanceled) return; if (event.eventCanceled) return;
// Resume // Resume
if (musicPausedBySubState)
{
FlxG.sound.music.play(FlxG.sound.music.time); FlxG.sound.music.play(FlxG.sound.music.time);
}
if (FlxG.sound.music != null && !startingSong && !isInCutscene) resyncVocals(); if (FlxG.sound.music != null && !startingSong && !isInCutscene) resyncVocals();