A_WeaponReady
From DoomWiki.org
A_WeaponReady is a code pointer used in the normal weapon animation for all weapons.
A_WeaponReady
is used in every weapon's idle/weapon bobbing sequence; most weapons (with the exception of the chainsaw) have an idle sequence that simply calls this code pointer every tic. The function performs a number of different actions:
- If the player's attack button is held down, it begins the firing animation for the current weapon. For this reason, if the player is switching weapons, pressing fire will do nothing until the weapon raise sequence has completed and
A_WeaponReady
is called.
- If the player is selecting a new weapon, begins the weapon lower sequence to switch to the new weapon. For this reason, if the player tries to switch to a new weapon while firing their current weapon, the change will not begin until the current firing sequence has completed and
A_WeaponReady
is called.
- If the player's avatar is in state
S_PLAY_ATK1
(DeHackEd frame 154) orS_PLAY_ATK2
(frame 155), transitions toS_PLAY
(frame 149). This ensures that once a player stops firing, other players in a multiplayer game see their avatar stop firing.
- Performs the weapon "bobbing" effect. As a result, because the chainsaw only calls
A_WeaponReady
once every four tics, its bobbing is visibly less smooth than other weapons.
- If the chainsaw is equipped, the DSSAWIDL sound effect is played.
Uses[edit]
The A_WeaponReady
code pointer appears in the following states in Doom's state table:
Frame number | Doom internal name | Use |
---|---|---|
2 | S_PUNCH | normal weapon animation for the fist |
10 | S_PISTOL | normal weapon animation for the pistol |
18 | S_SGUN | normal weapon animation for the shotgun |
32 | S_DSGUN | normal weapon animation for the super shotgun |
49 | S_CHAIN | normal weapon animation for the chaingun |
57 | S_MISSILE | normal weapon animation for the rocket launcher |
67 | S_SAW | normal weapon animation for the chainsaw |
68 | S_SAWB | normal weapon animation for the chainsaw |
74 | S_PLASMA | normal weapon animation for the plasma gun |
81 | S_BFG | normal weapon animation for the BFG9000 |
Example[edit]
The following is an example of how to set the A_WeaponReady
code pointer in a DeHackEd file:
Pointer 21 (Frame 34) Codep Frame = 81
Or using BEX syntax:
[CODEPTR] Frame 1234 = WeaponReady
External links[edit]
- A_WeaponReady in the Doom source code.
- A_WeaponReady at the ZDoom wiki
- WeaponReady at the Eternity Engine wiki