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
This commit is contained in:
terminx 2019-07-08 00:41:03 +00:00 committed by Christoph Oelckers
parent 4c290ab4ec
commit cf7ac8f16e
1 changed files with 10 additions and 6 deletions

View File

@ -3939,11 +3939,18 @@ static void P_ProcessWeapon(int playerNum)
pPlayer->rapid_fire_hold = 0; 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) if (playerShrunk || pPlayer->tipincs || pPlayer->access_incs)
playerBits &= ~BIT(SK_FIRE); 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->last_weapon == -1 && (pPlayer->weapon_pos == 0 || pPlayer->holster_weapon == 1))
{ {
pPlayer->crack_time = PCRACKTIME; pPlayer->crack_time = PCRACKTIME;
@ -3961,10 +3968,7 @@ static void P_ProcessWeapon(int playerNum)
{ {
P_SetWeaponGamevars(playerNum, pPlayer); P_SetWeaponGamevars(playerNum, pPlayer);
if (doAltFire) if (doFire && VM_OnEvent(EVENT_FIRE, pPlayer->i, playerNum) == 0)
VM_OnEvent(EVENT_ALTFIRE, pPlayer->i, playerNum);
if (playerBits & BIT(SK_FIRE) && VM_OnEvent(EVENT_FIRE, pPlayer->i, playerNum) == 0)
{ {
// this event is deprecated // this event is deprecated
VM_OnEvent(EVENT_FIREWEAPON, pPlayer->i, playerNum); VM_OnEvent(EVENT_FIREWEAPON, pPlayer->i, playerNum);