From 6b18e3875d11278efe938629047075dd75d53f27 Mon Sep 17 00:00:00 2001 From: Misa Date: Tue, 5 Jan 2021 17:18:00 -0800 Subject: [PATCH] Move title screen color initialization to main() This fixes a bug where if you completed a custom level during command-line playtesting, when returning to the title screen, the background would be red and the text would be white. This is because playtesting skips over the code path of pressing ACTION to start the game and advance to the title screen, and the code path of that ACTION press specifically initializes the title screen colors to cyan. This is also caused by the fact that completing a custom level doesn't call map.nexttowercolour(), but my guess is that the intent there was that the player would select a custom level, complete it, and return to the title screen on the same screen with the same colors, so I decided not to add a map.nexttowercolour() there. Instead, I've moved the cyan color initialization to main(), so that it is always executed no matter what, and doesn't require you to take a specific code path to do it. --- desktop_version/src/Input.cpp | 2 -- desktop_version/src/main.cpp | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index b3d04487..b838df01 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -1686,8 +1686,6 @@ void titleinput() music.playef(18); game.screenshake = 10; game.flashlight = 5; - graphics.titlebg.colstate = 10; - map.nexttowercolour(); } else { diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index c3b922c3..387b1b55 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -227,6 +227,10 @@ int main(int argc, char *argv[]) game.menustart = false; game.mainmenu = 0; + // Initialize title screen to cyan + graphics.titlebg.colstate = 10; + map.nexttowercolour(); + map.ypos = (700-29) * 8; graphics.towerbg.bypos = map.ypos / 2; graphics.titlebg.bypos = map.ypos / 2;