From 82dfa0b86ceebc710ee1573a1e6064dda6ec8ad5 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 25 Mar 2021 20:11:27 -0700 Subject: [PATCH] Decouple fademode from starting gamemode Assuming glitchrunner mode is off, if you open the pause menu while fully faded-out and then go to Graphic Options or Game Options, then the 'mode' that you selected previously will kick in again and you'll be suddenly warped back. So if you previously started a new game in the main game (mode 0, also the selected mode if you do this from command-line playtesting), and then open the pause menu and go to in-game options, then you'll suddenly go back to starting a new game again. If you had started a custom level, doing this will warp you back to the start of the level again. The problem is simple - when the title screen is fully faded out, it calls startgamemode(). So the solution is simple as well - just decouple the fademode from calling startgamemode(), and use a different variable to know when to actually call startgamemode(). --- desktop_version/src/Input.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index ed622a50..549e3e96 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -188,10 +188,15 @@ static void toggleflipmode(void) } } +static bool fadetomode = false; +static int fadetomodedelay = 0; + static void startmode(const int mode) { game.mainmenu = mode; graphics.fademode = 2; /* fading out */ + fadetomode = true; + fadetomodedelay = 16; } static void menuactionpress(void) @@ -1654,8 +1659,18 @@ void titleinput(void) } - if (graphics.fademode == 1) - script.startgamemode(game.mainmenu); + if (fadetomode) + { + if (fadetomodedelay > 0) + { + --fadetomodedelay; + } + else + { + fadetomode = false; + script.startgamemode(game.mainmenu); + } + } } void gameinput(void)