Don't savestats() every frame of New Record animation

Otherwise, this would cause immense slowdown during the New Record
animation that plays when you die, as the game would be writing
unlock.vvv every frame.

To fix this, I just put it under the same if-guard as the
music.playef(), since the sound effect also only plays once. But I have
to watch out for frame ordering and make sure the record is actually set
before I call game.savestats(), and then of course I have to move
game.swnmessage = 1 over because that's the variable being checked in
the conditional.
This commit is contained in:
Misa 2020-07-27 15:50:51 -07:00 committed by Ethan Lee
parent 18b7d1ca14
commit 6c04f56099
1 changed files with 6 additions and 3 deletions

View File

@ -556,10 +556,13 @@ void gamelogic()
game.swndelay = 0;
if (game.swntimer >= game.swnrecord)
{
if (game.swnmessage == 0) music.playef(25);
game.swnmessage = 1;
game.swnrecord = game.swntimer;
game.savestats();
if (game.swnmessage == 0)
{
music.playef(25);
game.savestats();
}
game.swnmessage = 1;
}
}
}