From c076310e346345a6dc186ddceb66913b3222b1dd Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 1 Apr 2021 13:46:16 +1100 Subject: [PATCH] - `InputState::ClearAllInput()`: Only clear `crouch_toggle` bool if outside of a level, and resend `SB_CROUCH` sync bit if inside a level and `crouch_toggle` is true. * Fixes #287. --- source/core/inputstate.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/source/core/inputstate.cpp b/source/core/inputstate.cpp index 98500826a..a87a24219 100644 --- a/source/core/inputstate.cpp +++ b/source/core/inputstate.cpp @@ -119,13 +119,26 @@ void InputState::ClearAllInput() { memset(KeyStatus, 0, sizeof(KeyStatus)); AnyKeyStatus = false; - ActionsToSend = 0; WeaponToSend = 0; dpad_lock = 0; lastCheck = 0; - crouch_toggle = false; + + if (gamestate != GS_LEVEL) + { + ActionsToSend = 0; + crouch_toggle = false; + gi->clearlocalinputstate(); // also clear game local input state. + } + else if (gamestate == GS_LEVEL && crouch_toggle) + { + ActionsToSend |= SB_CROUCH; + } + else + { + ActionsToSend = 0; + } + buttonMap.ResetButtonStates(); // this is important. If all input is cleared, the buttons must be cleared as well. - gi->clearlocalinputstate(); // also clear game local input state. resetTurnHeldAmt(); }