fixed bugs where game would crash if pressing R during cutscene or state transition

This commit is contained in:
MtH 2021-03-30 18:43:07 +02:00
parent d136168a5a
commit 1bd5cbf472
1 changed files with 38 additions and 35 deletions

View File

@ -941,7 +941,7 @@ class PlayState extends MusicBeatState
}); });
} }
var startTimer:FlxTimer; var startTimer:FlxTimer = new FlxTimer();
var perfectMode:Bool = false; var perfectMode:Bool = false;
function startCountdown():Void function startCountdown():Void
@ -958,7 +958,7 @@ class PlayState extends MusicBeatState
var swagCounter:Int = 0; var swagCounter:Int = 0;
startTimer = new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer) startTimer.start(Conductor.crochet / 1000, function(tmr:FlxTimer)
{ {
// this just based on beatHit stuff but compact // this just based on beatHit stuff but compact
if (swagCounter % gfSpeed == 0) if (swagCounter % gfSpeed == 0)
@ -1563,42 +1563,45 @@ class PlayState extends MusicBeatState
} }
// better streaming of shit // better streaming of shit
// RESET = Quick Game Over Screen if (!inCutscene && !_exiting)
if (controls.RESET)
{ {
health = 0; // RESET = Quick Game Over Screen
trace("RESET = True"); if (controls.RESET)
} {
health = 0;
trace("RESET = True");
}
#if CAN_CHEAT // brandon's a pussy #if CAN_CHEAT // brandon's a pussy
if (controls.CHEAT) if (controls.CHEAT)
{ {
health += 1; health += 1;
trace("User is cheating!"); trace("User is cheating!");
} }
#end
if (health <= 0 && !practiceMode)
{
boyfriend.stunned = true;
persistentUpdate = false;
persistentDraw = false;
paused = true;
vocals.stop();
FlxG.sound.music.stop();
deathCounter += 1;
openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
// FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
#if discord_rpc
// Game Over doesn't get his own variable because it's only used here
DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end #end
if (health <= 0 && !practiceMode)
{
boyfriend.stunned = true;
persistentUpdate = false;
persistentDraw = false;
paused = true;
vocals.stop();
FlxG.sound.music.stop();
deathCounter += 1;
openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
// FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
#if discord_rpc
// Game Over doesn't get his own variable because it's only used here
DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end
}
} }
if (unspawnNotes[0] != null) if (unspawnNotes[0] != null)