From cf7ac8f16ebe224524c3d045f4795b78f8f1d334 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 8 Jul 2019 00:41:03 +0000 Subject: [PATCH] Untie EVENT_ALTFIRE from the conditions required to trigger EVENT_FIRE git-svn-id: https://svn.eduke32.com/eduke32@7772 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/player.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 5060dd204..c8700685f 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -3939,11 +3939,18 @@ static void P_ProcessWeapon(int playerNum) pPlayer->rapid_fire_hold = 0; } - int const doAltFire = g_player[playerNum].inputBits->extbits & (1<<6); + bool const doFire = (playerBits & BIT(SK_FIRE) && (*weaponFrame) == 0); + bool const doAltFire = g_player[playerNum].inputBits->extbits & (1 << 6); + + if (doAltFire) + { + P_SetWeaponGamevars(playerNum, pPlayer); + VM_OnEvent(EVENT_ALTFIRE, pPlayer->i, playerNum); + } if (playerShrunk || pPlayer->tipincs || pPlayer->access_incs) playerBits &= ~BIT(SK_FIRE); - else if ((playerBits & BIT(SK_FIRE) || doAltFire) && (*weaponFrame) == 0 && pPlayer->fist_incs == 0 && + else if (doFire && pPlayer->fist_incs == 0 && pPlayer->last_weapon == -1 && (pPlayer->weapon_pos == 0 || pPlayer->holster_weapon == 1)) { pPlayer->crack_time = PCRACKTIME; @@ -3961,10 +3968,7 @@ static void P_ProcessWeapon(int playerNum) { P_SetWeaponGamevars(playerNum, pPlayer); - if (doAltFire) - VM_OnEvent(EVENT_ALTFIRE, pPlayer->i, playerNum); - - if (playerBits & BIT(SK_FIRE) && VM_OnEvent(EVENT_FIRE, pPlayer->i, playerNum) == 0) + if (doFire && VM_OnEvent(EVENT_FIRE, pPlayer->i, playerNum) == 0) { // this event is deprecated VM_OnEvent(EVENT_FIREWEAPON, pPlayer->i, playerNum);