From 255a6108c820aa0a1bc391f4541fb5e159979f8a Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 5 Mar 2021 19:34:15 -0800 Subject: [PATCH] Fix up/down being reversed in in-game menu in Flip Mode This bug is technically NOT a regression - the code responsible for it has been around since the source release. However, it hasn't been a problem until Graphic Options and Game Options were added to the pause screen. Since then, if you opened the pause menu in Flip Mode, pressing up would move to the menu option below, and pressing down would move to the menu option above. Notably, left and right still remain the same. This is because the map screen input code assumes that the menu options will be flipped around - however, this has never been the case. What happens instead is that the menu options get flipped around time when in Flip Mode - flipping what's already flipped - so it ends up the same again. (Incidentally enough, the up/down reversing code is present on the title screen, and is correct - if you happen to set graphics.flipmode to true on the title screen, the title screen doesn't negate the flipped menu options, so pressing up SHOULD be treated like pressing down, and vice versa. However, in 2.3, it's not really possible to set graphics.flipmode to true on the title screen without using GDB or modifying the game. In 2.2 and previous, you can just complete the game in Flip Mode, and the variable won't be reset; 2.3 cleaned up all exit paths to the menu to make sure everything got reset.) This isn't a problem when there's only two options, but since 2.3 adds two more options to the pause screen, it's pretty noticeable. Anyway, this is fixed by simply removing the branch of the graphics.flipmode if-else in mapinput(). The 'else' branch is now the code that gets executed unconditionally. Don't get confused by the diff; I decided to unindent in the same commit because it's not that many lines of code. --- desktop_version/src/Input.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 199ed335..4366dc45 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -2119,21 +2119,13 @@ void mapinput(void) && ((!game.glitchrunnermode && !game.fadetomenu && game.fadetomenudelay <= 0 && !game.fadetolab && game.fadetolabdelay <= 0) || graphics.fademode == 0)) { - if (graphics.flipmode) + if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_w)|| key.controllerWantsLeft(true)) { - if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_s) || key.controllerWantsLeft(true) ) game.press_left = true; - if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_d) || key.isDown(KEYBOARD_w) || key.controllerWantsRight(true)) game.press_right = true; + game.press_left = true; } - else + if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_d) || key.isDown(KEYBOARD_s)|| key.controllerWantsRight(true)) { - if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_w)|| key.controllerWantsLeft(true)) - { - game.press_left = true; - } - if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_d) || key.isDown(KEYBOARD_s)|| key.controllerWantsRight(true)) - { - game.press_right = true; - } + game.press_right = true; } if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v) || key.isDown(game.controllerButton_flip)) {