void A_GunFlash [(statelabel flashlabel [, 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.
- flashlabel: The state sequence to enter. If this is null(ZScript only)/0 or "" (empty string)(DECORATE only), the AltFlash state sequence, if it exists, is entered if the function is called from the AltFire state sequence, otherwise it is the Flash state sequence that is entered. Default is null.
- 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.
- Default is 0.
Fire: DEAG C 0 A_StartSound("weapons/eagle", CHAN_WEAPON) 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