- Fixed: r4067 completely disabled weapon switching via A_ReFire.

SVN r4157 (trunk)
This commit is contained in:
Randy Heit 2013-02-22 02:42:42 +00:00
commit 445bc148b7
4 changed files with 17 additions and 6 deletions

View file

@ -480,12 +480,22 @@ void P_BobWeapon (player_t *player, pspdef_t *psp, fixed_t *x, fixed_t *y)
//
//============================================================================
void DoReadyWeaponToSwitch (AActor *self)
void DoReadyWeaponToSwitch (AActor *self, bool switchable)
{
// Prepare for switching action.
player_t *player;
if (self && (player = self->player))
player->WeaponState |= WF_WEAPONSWITCHOK;
{
if (switchable)
{
player->WeaponState |= WF_WEAPONSWITCHOK | WF_REFIRESWITCHOK;
}
else
{
// WF_WEAPONSWITCHOK is automatically cleared every tic by P_SetPsprite().
player->WeaponState &= ~WF_REFIRESWITCHOK;
}
}
}
void DoReadyWeaponDisableSwitch (AActor *self, INTBOOL disable)
@ -497,6 +507,7 @@ void DoReadyWeaponDisableSwitch (AActor *self, INTBOOL disable)
if (disable)
{
player->WeaponState |= WF_DISABLESWITCH;
player->WeaponState &= ~WF_REFIRESWITCHOK;
}
else
{
@ -592,7 +603,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_WeaponReady)
ACTION_PARAM_START(1);
ACTION_PARAM_INT(paramflags, 0);
if (!(paramflags & WRF_NoSwitch)) DoReadyWeaponToSwitch(self);
DoReadyWeaponToSwitch(self, !(paramflags & WRF_NoSwitch));
if ((paramflags & WRF_NoFire) != WRF_NoFire) DoReadyWeaponToFire(self, !(paramflags & WRF_NoPrimary), !(paramflags & WRF_NoSecondary));
if (!(paramflags & WRF_NoBob)) DoReadyWeaponToBob(self);
if ((paramflags & WRF_AllowReload)) DoReadyWeaponToReload(self);
@ -742,7 +753,7 @@ void A_ReFire(AActor *self, FState *state)
{
return;
}
pending = player->PendingWeapon == WP_NOCHANGE && (player->WeaponState & WF_WEAPONSWITCHOK);
pending = player->PendingWeapon != WP_NOCHANGE && (player->WeaponState & WF_REFIRESWITCHOK);
if ((player->cmd.ucmd.buttons & BT_ATTACK)
&& !player->ReadyWeapon->bAltFire && !pending && player->health > 0)
{