A_FirePistol
Jump to navigation
Jump to search
action void A_FirePistol()
Usage
Performs Doom's pistol attack, firing one pellet dealing 5 * 1d3 damage. This is a shortcut to calling A_FireBullets, A_PlaySound and A_GunFlash with certain predetermined hardcoded parameters.
If vertical bullet spread for weapons is enabled, the function applies vertical spread in addition to the horizontal one.
This code is the equivalent of calling A_FirePistol:
PISG B 6
{
A_FireBullets (5.6, 0, 1, 5, "BulletPuff");
A_StartSound("weapons/pistol", CHAN_WEAPON);
A_GunFlash();
}
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_FirePistol()
{
bool accurate;
if (player != null)
{
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 ();
accurate = !player.refire;
}
else
{
accurate = true;
}
A_StartSound ("weapons/pistol", CHAN_WEAPON);
GunShot (accurate, "BulletPuff", BulletSlope ());
}
