From 5ebc65d1a26c30af41ed60afa9b0f5d3caa528f3 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 17 Dec 2021 23:35:08 -0800 Subject: [PATCH] Pull out fade mode handling into separate function The next commit will add logic that more-or-less quits the whole block if ingame_titlemode, and instead of adding another layer of indentation I will just pull this into its own function so we can use a return statement. --- desktop_version/src/Input.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 5690d3cc..c5e0481f 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -288,6 +288,19 @@ static void startmode(const int mode) fadetomodedelay = 19; } +static void handlefadetomode(void) +{ + if (fadetomodedelay > 0) + { + --fadetomodedelay; + } + else + { + fadetomode = false; + script.startgamemode(gotomode); + } +} + static int* user_changing_volume = NULL; static int previous_volume = 0; @@ -1928,15 +1941,7 @@ void titleinput(void) if (fadetomode) { - if (fadetomodedelay > 0) - { - --fadetomodedelay; - } - else - { - fadetomode = false; - script.startgamemode(gotomode); - } + handlefadetomode(); } }