From 6f143b51c72f2076916a8a1ed5c0be305be715fe Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Sun, 19 Aug 2018 19:22:17 -0700 Subject: [PATCH] Dual wield weapon fire input change Switched the inputs for dual wield weapon fire when gamepad is disabled --- components/game_mod/bg_weapons.cpp | 47 +++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/components/game_mod/bg_weapons.cpp b/components/game_mod/bg_weapons.cpp index 1a999e1d..2e543c6e 100644 --- a/components/game_mod/bg_weapons.cpp +++ b/components/game_mod/bg_weapons.cpp @@ -223,10 +223,20 @@ int PM_Weapon_WeaponTimeAdjust(pmove_t *pm, pml_t *pml) bool holdingGrenadeBtn = (weapDef->weapType == WEAPTYPE_GRENADE || weapDef->weapType == WEAPTYPE_MINE) && weapDef->holdButtonToThrow; bool holdingFireBtn = false; - if (ps->bRunLeftGun) - holdingFireBtn = pm->cmd.button_bits.testBit(0x18) != 0; + if (weapDef->bDualWield && !Dvar_GetString("gpad_enabled")) + { + if (ps->bRunLeftGun) + holdingFireBtn = pm->cmd.button_bits.testBit(0) != 0; + else + holdingFireBtn = pm->cmd.button_bits.testBit(24) != 0; + } else - holdingFireBtn = pm->cmd.button_bits.testBit(0) != 0; + { + if (ps->bRunLeftGun) + holdingFireBtn = pm->cmd.button_bits.testBit(24) != 0; + else + holdingFireBtn = pm->cmd.button_bits.testBit(0) != 0; + } if ((*weaponState < WEAPON_OFFHAND_INIT || *weaponState > WEAPON_OFFHAND_END) && (pausedAfterFiring || holdingGrenadeBtn) @@ -298,16 +308,33 @@ int PM_Weapon_ShouldBeFiring(pmove_t *pm, int delayedAction, bool testOnly) WeaponDef *weapDef = BG_GetWeaponDef(ps->weapon); int weaponBit = PM_GetWeaponFireButton(ps->weapon); - bool shouldStartFiring = pm->cmd.button_bits.testBit(weaponBit) != 0; + int dualWieldWeaponBit = 24; + bool shouldStartFiring = false; - // If this is a dw weapon and we're using the offhand - if (ps->bRunLeftGun && weapDef->bDualWield) + if (weapDef->bDualWield) { - // Check if player holding the fire key - if (pm->cmd.button_bits.testBit(24)) - shouldStartFiring = true; + if (!Dvar_GetString("gpad_enabled")) + { + if (ps->bRunLeftGun) + { + shouldStartFiring = pm->cmd.button_bits.testBit(weaponBit); + } + else + { + shouldStartFiring = pm->cmd.button_bits.testBit(dualWieldWeaponBit); + } + } else - shouldStartFiring = false; + { + if (ps->bRunLeftGun) + { + shouldStartFiring = pm->cmd.button_bits.testBit(dualWieldWeaponBit); + } + else + { + shouldStartFiring = pm->cmd.button_bits.testBit(weaponBit); + } + } } if (weapDef->freezeMovementWhenFiring && ps->groundEntityNum == 1023)