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;
function startCountdown():Void
@ -958,7 +958,7 @@ class PlayState extends MusicBeatState
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
if (swagCounter % gfSpeed == 0)
@ -1563,42 +1563,45 @@ class PlayState extends MusicBeatState
}
// better streaming of shit
// RESET = Quick Game Over Screen
if (controls.RESET)
if (!inCutscene && !_exiting)
{
health = 0;
trace("RESET = True");
}
// RESET = Quick Game Over Screen
if (controls.RESET)
{
health = 0;
trace("RESET = True");
}
#if CAN_CHEAT // brandon's a pussy
if (controls.CHEAT)
{
health += 1;
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);
#if CAN_CHEAT // brandon's a pussy
if (controls.CHEAT)
{
health += 1;
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
}
}
if (unspawnNotes[0] != null)