Swap gamepad attack and throw button on dualwield weapons to make left trigger match left weapon etc

This commit is contained in:
Jan 2021-08-30 21:57:31 +02:00
parent a07a00da93
commit 8b53ce4cfe
2 changed files with 24 additions and 0 deletions

View File

@ -831,6 +831,21 @@ namespace Components
cmd->rightmove = ClampChar(cmd->rightmove + rightMove);
cmd->forwardmove = ClampChar(cmd->forwardmove + forwardMove);
// Swap attack and throw buttons when using controller and akimbo to match "left trigger"="left weapon" and "right trigger"="right weapon"
if(gamePad.inUse && clientActive.snap.ps.weapCommon.lastWeaponHand == Game::WEAPON_HAND_LEFT)
{
auto oldButtons = cmd->buttons;
if (oldButtons & Game::CMD_BUTTON_ATTACK)
cmd->buttons |= Game::CMD_BUTTON_THROW;
else
cmd->buttons &= ~Game::CMD_BUTTON_THROW;
if (oldButtons & Game::CMD_BUTTON_THROW)
cmd->buttons |= Game::CMD_BUTTON_ATTACK;
else
cmd->buttons &= ~Game::CMD_BUTTON_ATTACK;
}
// Check for frozen controls. Flag name should start with PMF_
if (CG_ShouldUpdateViewAngles(gamePadIndex) && (clientActive.snap.ps.pm_flags & 0x800) == 0)
{

View File

@ -1296,6 +1296,15 @@ namespace Game
CMD_BUTTON_ACTIVATE = 0x8,
CMD_BUTTON_RELOAD = 0x10,
CMD_BUTTON_USE_RELOAD = 0x20,
CMD_BUTTON_PRONE = 0x100,
CMD_BUTTON_CROUCH = 0x200,
CMD_BUTTON_UP = 0x400,
CMD_BUTTON_ADS = 0x800,
CMD_BUTTON_DOWN = 0x1000,
CMD_BUTTON_BREATH = 0x2000,
CMD_BUTTON_FRAG = 0x4000,
CMD_BUTTON_OFFHAND_SECONDARY = 0x8000,
CMD_BUTTON_THROW = 0x80000,
};
#pragma pack(push, 4)