From 8a3e29204129e6a572869f5ec57498d03fab3203 Mon Sep 17 00:00:00 2001 From: Misa Date: Tue, 12 Jan 2021 20:11:50 -0800 Subject: [PATCH] Fix 1-frame text glitch returning to pause menu from in-game options The new loop order introduces a glitch where the menu would display whichever menu was saved to kludge_ingametemp for 1 frame right as the user returned to the pause menu. This happened because the game.returntomenu() happens in titleinput(), which comes before titlerender(). To fix this, we just need to defer it to the end of the frame. --- desktop_version/src/Game.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index c81357ae..2af98304 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -6618,6 +6618,12 @@ void Game::returntoeditor(void) } #endif +static void returntoingametemp(void) +{ + extern Game game; + game.returntomenu(game.kludge_ingametemp); +} + void Game::returntoingame(void) { ingame_titlemode = false; @@ -6633,7 +6639,7 @@ void Game::returntoingame(void) else #endif { - returntomenu(kludge_ingametemp); + DEFER_CALLBACK(returntoingametemp); gamestate = MAPMODE; graphics.flipmode = graphics.setflipmode; if (!map.custommode && !graphics.flipmode)