- 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
parent e0c751114f
commit 445bc148b7
4 changed files with 17 additions and 6 deletions

View File

@ -215,6 +215,7 @@ enum
WF_DISABLESWITCH = 1 << 4, // Disable weapon switching completely
WF_WEAPONRELOADOK = 1 << 5, // [XA] Okay to reload this weapon.
WF_WEAPONZOOMOK = 1 << 6, // [XA] Okay to use weapon zoom function.
WF_REFIRESWITCHOK = 1 << 7, // Mirror WF_WEAPONSWITCHOK for A_ReFire
};
#define WPIECE1 1

View File

@ -1107,7 +1107,6 @@ void APowerWeaponLevel2::EndEffect ()
Super::EndEffect();
if (player != NULL)
{
if (player->ReadyWeapon != NULL &&
player->ReadyWeapon->WeaponFlags & WIF_POWERED_UP)
{

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)
{

View File

@ -94,7 +94,7 @@ void P_GunShot (AActor *mo, bool accurate, const PClass *pufftype, angle_t pitch
void DoReadyWeapon(AActor * self);
void DoReadyWeaponToBob(AActor * self);
void DoReadyWeaponToFire(AActor * self, bool primary = true, bool secondary = true);
void DoReadyWeaponToSwitch(AActor * self);
void DoReadyWeaponToSwitch(AActor * self, bool switchable = true);
DECLARE_ACTION(A_Raise)
void A_ReFire(AActor *self, FState *state = NULL);