From 6c04f5609997893f0d59479fb99d218468e8d1e1 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 27 Jul 2020 15:50:51 -0700 Subject: [PATCH] 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. --- desktop_version/src/Logic.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index 70dd470c..55f871ce 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -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; } } }