A_GunFlash [(str state)]
A_GunFlash [(str state[, int flags])]
This function can be called in a weapon's Fire or AltFire state sequence. It sets the player sprite to a version where the player is illuminated by his gunfire and it starts the appropriate flash state sequence. These flash state sequences are run at the same time as the normal weapon animation.
It is ideal for the flash to last as long as the weapon's firing state, or at least when the gun is lit. You can make your own muzzleflash sprites which, as long as the offsets are correct, will be overlayed when the gun is fired, making only that part of the gun visible when fires in pitch darkness. If this isn't an option, you can simply use TNT1A0. The example below was taken from a weapon with muzzle flash sprites.
- state: The state to go to. By default, it is the Flash, or the AltFlash state if the function is called from the AltFire sequence.
- flags: The following flags can be combined by using the | character between the constant names:
- GFF_NOEXTCHANGE — No external change: The player sprite will not be affected.
Fire: DEAG C 0 A_PlayWeaponSound("weapons/eagle") DEAG C 0 A_GunFlash //This should be run the same time as the gun fires DEAG C 3 A_FireBullets(5, 7, 1, 50,"BulletPuff") Goto Ready Flash: DEFL A 1 BRIGHT A_Light1 DEFL A 2 BRIGHT A_Light2 DEFL A 0 A_Light0 Stop