diff --git a/source/core/inputstate.cpp b/source/core/inputstate.cpp index 01bd661b5..b43ff16b4 100644 --- a/source/core/inputstate.cpp +++ b/source/core/inputstate.cpp @@ -370,7 +370,7 @@ CCMD(show_weapon) gi->ToggleShowWeapon(); } -void ApplyGlobalInput(InputPacket& input, HIDInput* hidInput, bool const crouchable, bool const disableToggle) +void ApplyGlobalInput(InputPacket& input, HIDInput* const hidInput) { if (WeaponToSend != 0) input.setNewWeapon(WeaponToSend); WeaponToSend = 0; @@ -413,11 +413,11 @@ void ApplyGlobalInput(InputPacket& input, HIDInput* hidInput, bool const croucha if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch)) { - crouch_toggle = !crouch_toggle && crouchable; - if (crouchable) buttonMap.ClearButton(gamefunc_Toggle_Crouch); + crouch_toggle = !crouch_toggle; + buttonMap.ClearButton(gamefunc_Toggle_Crouch); } - if (buttonMap.ButtonDown(gamefunc_Crouch) || buttonMap.ButtonDown(gamefunc_Jump) || disableToggle) + if (buttonMap.ButtonDown(gamefunc_Crouch) || buttonMap.ButtonDown(gamefunc_Jump)) crouch_toggle = false; if (buttonMap.ButtonDown(gamefunc_Fire)) diff --git a/source/core/inputstate.h b/source/core/inputstate.h index bc766c7fd..377aaab7e 100644 --- a/source/core/inputstate.h +++ b/source/core/inputstate.h @@ -96,7 +96,7 @@ enum GameFunction_t }; void SetupGameButtons(); -void ApplyGlobalInput(InputPacket& input, HIDInput* const hidInput, bool const crouchable = true, bool const disableToggle = false); +void ApplyGlobalInput(InputPacket& input, HIDInput* const hidInput); extern ESyncBits ActionsToSend; extern bool gamesetinput; diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 1e8edefee..32be5c849 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -530,9 +530,15 @@ static void processInputBits(player_struct *p, HIDInput* const hidInput) bool const crouchable = sectorLotag != ST_2_UNDERWATER && (sectorLotag != ST_1_ABOVE_WATER || p->spritebridge); bool const disableToggle = p->jetpack_on || (!crouchable && p->on_ground) || (isRRRA() && (p->OnMotorcycle || p->OnBoat)); - ApplyGlobalInput(loc, hidInput, crouchable, disableToggle); + ApplyGlobalInput(loc, hidInput); if (isRR() && (loc.actions & SB_CROUCH)) loc.actions &= ~SB_JUMP; + if (!crouchable || disableToggle) + { + crouch_toggle = false; + loc.actions &= ~SB_CROUCH; + } + if (p->OnMotorcycle || p->OnBoat) { // mask out all actions not compatible with vehicles. diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 4c49e6bd3..cdc7c255b 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1738,7 +1738,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo p->on_warping_sector = 0; - if ((actions & SB_CROUCH) || crouch_toggle) // FIXME: The crouch_toggle check here is not network safe and needs revision when multiplayer is going. + if (actions & SB_CROUCH) { playerCrouch(snum); } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index fa1f1b375..27d188228 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -2106,7 +2106,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo p->on_warping_sector = 0; - if (((actions & SB_CROUCH) || crouch_toggle) && !p->OnMotorcycle) // FIXME: The crouch_toggle check here is not network safe and needs revision when multiplayer is going. + if ((actions & SB_CROUCH) && !p->OnMotorcycle) { playerCrouch(snum); }