A_WeaponSound

From DoomWiki.org

A_WeaponSound(sound, fullvol) is a generic weapon sound function that is part of the MBF21 specification. It has two parameters, using the values in the "Args1" and "Args2" fields as arguments.

The first argument determines the sound that is played when the weapon is fired, using its DeHackEd index number. If the second argument is set to 1, the firing sound will be played at full volume, just like the wakeup or death sounds of a cyberdemon and spider mastermind; otherwise the origin of the sound is the player's position.

Example[edit]

The following is an example of how to set the A_WeaponSound code pointer in a DeHackEd file using BEX syntax:

Frame 1234
Next frame = 1235
Args1 = 1
Args2 = 0

[CODEPTR]
FRAME 1234 = WeaponSound

Or using DECOHack syntax:

state 1234
{
 TNT1 A 0 A_WeaponSound("PISTOL", 0)
 goto 1235
}

The example above uses A_WeaponSound to play the firing sound for the pistol on an invisible, zero-duration state. This can be used to trigger the firing sound for a custom weapon that makes use of a generic weapon function like A_WeaponBulletAttack, which does not trigger any firing sound by itself.

External links[edit]