- Move some Duke-specific stuff out of ApplyGlobalInput().

This commit is contained in:
Mitchell Richters 2023-03-18 09:15:15 +11:00
parent eed9716d86
commit a45890e064
5 changed files with 14 additions and 8 deletions

View file

@ -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))

View file

@ -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;

View file

@ -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.

View file

@ -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);
}

View file

@ -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);
}