A_FireShotgun
Jump to navigation
Jump to search
action void A_FireShotgun()
Usage
Performs Doom's shotgun attack, firing seven pellets each dealing 5 * 1d3 damage. This is a shortcut for calling A_FireBullets, A_StartSound and A_GunFlash with predetermined hard-coded parameters.
This code is the equivalent of calling A_FireShotgun for 7 tics on the A frame of the SHTG sprite:
SHTG A 7
{
A_FireBullets (5.6, 0, 7, 5);
A_StartSound("weapons/shotgf", CHAN_WEAPON);
A_GunFlash();
}
If vertical bullet spread for weapons is enabled, the function applies vertical spread in addition to the horizontal one.
ZScript definition
| Note: The ZScript definition below is for reference and may be different in the current version of UZDoom. The most up-to-date version of this code can be found on UZDoom GitHub. |
action void A_FireShotgun()
{
if (player == null)
{
return;
}
A_StartSound ("weapons/shotgf", CHAN_WEAPON);
Weapon weap = player.ReadyWeapon;
if (weap != null && invoker == weap && stateinfo != null && stateinfo.mStateType == STATE_Psprite)
{
if (!weap.DepleteAmmo (weap.bAltFire, true))
return;
player.SetPsprite(PSP_FLASH, weap.FindState('Flash'), true);
}
player.mo.PlayAttacking2 ();
double pitch = BulletSlope ();
for (int i = 0; i < 7; i++)
{
GunShot (false, "BulletPuff", pitch);
}
}
