- fixed: All access to weapon info in DECORATE functions should be restricted to when they get called from an actual weapon, not from a CustomInventory item.

Issues this fixes:

 * all original Doom attack functions unconditionally altered the flash state.
 * A_FireOldBFG, A_RailAttack and A_Blast never checked for a valid ReadyWeapon.
 * CustomInventory items could deplete an unrelated weapon's ammo.
This commit is contained in:
Christoph Oelckers 2016-01-26 09:43:47 +01:00
commit 623276f5a6
4 changed files with 27 additions and 24 deletions

View file

@ -109,10 +109,10 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast)
TThinkerIterator<AActor> iterator;
fixed_t dist;
if (self->player && (blastflags & BF_USEAMMO))
if (self->player && (blastflags & BF_USEAMMO) && ACTION_CALL_FROM_WEAPON())
{
AWeapon * weapon = self->player->ReadyWeapon;
if (!weapon->DepleteAmmo(weapon->bAltFire))
if (weapon != NULL && !weapon->DepleteAmmo(weapon->bAltFire))
return;
}