Difference between revisions of "A WeaponReady"

From DoomWiki.org

[checked revision][checked revision]
(fix caps, fmtg, add wls, rm dupe wl)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:A_WeaponReady}}
+
{{DISPLAYTITLE:A_WeaponReady}}{{DEFAULTSORT:WeaponReady}}
{{stub}}
 
 
'''A_WeaponReady''' is a [[code pointer]] used in the normal weapon animation for all weapons.
 
'''A_WeaponReady''' is a [[code pointer]] used in the normal weapon animation for all weapons.
 +
 +
<code>A_WeaponReady</code> 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 <code>A_WeaponReady</code> 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 <code>A_WeaponReady</code> is called.
 +
 +
* If the player's avatar is in state <code>S_PLAY_ATK1</code> ([[DeHackEd]] frame 154) or <code>S_PLAY_ATK2</code> (frame 155), transitions to <code>S_PLAY</code> (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 <code>A_WeaponReady</code> once every four tics, its bobbing is visibly less smooth than other weapons.
 +
 +
* If the chainsaw is equipped, the {{c|DSSAWIDL}} sound effect is played.
  
 
== Uses ==
 
== Uses ==
 
+
The <code>A_WeaponReady</code> code pointer appears in the following [[state]]s in Doom's state table:
The <code>A_WeaponReady</code> code pointer appears in the following [[state|states]] in Doom's state table:
 
  
 
{| {{prettytable|classes=plainlinks}}
 
{| {{prettytable|classes=plainlinks}}
Line 11: Line 21:
 
! Frame number || Doom internal name || Use
 
! Frame number || Doom internal name || Use
 
|-
 
|-
| 2 || {{DoomSrc|text=S_PUNCH|file=info.c|line=138}} || normal weapon animation for the [[Fists]]
+
| 2 || {{DoomSrc|text=S_PUNCH|file=info.c|line=138}} || normal weapon animation for the [[fist]]
 
|-
 
|-
| 10 || {{DoomSrc|text=S_PISTOL|file=info.c|line=146}} || normal weapon animation for the [[Pistol]]
+
| 10 || {{DoomSrc|text=S_PISTOL|file=info.c|line=146}} || normal weapon animation for the [[pistol]]
 
|-
 
|-
| 18 || {{DoomSrc|text=S_SGUN|file=info.c|line=154}} || normal weapon animation for the [[Shotgun]]
+
| 18 || {{DoomSrc|text=S_SGUN|file=info.c|line=154}} || normal weapon animation for the [[shotgun]]
 
|-
 
|-
| 32 || {{DoomSrc|text=S_DSGUN|file=info.c|line=168}} || normal weapon animation for the [[Super Shotgun]]
+
| 32 || {{DoomSrc|text=S_DSGUN|file=info.c|line=168}} || normal weapon animation for the [[super shotgun]]
 
|-
 
|-
| 49 || {{DoomSrc|text=S_CHAIN|file=info.c|line=185}} || normal weapon animation for the [[Chaingun]]
+
| 49 || {{DoomSrc|text=S_CHAIN|file=info.c|line=185}} || normal weapon animation for the [[chaingun]]
 
|-
 
|-
| 57 || {{DoomSrc|text=S_MISSILE|file=info.c|line=193}} || normal weapon animation for the [[Rocket Launcher]]
+
| 57 || {{DoomSrc|text=S_MISSILE|file=info.c|line=193}} || normal weapon animation for the [[rocket launcher]]
 
|-
 
|-
| 67 || {{DoomSrc|text=S_SAW|file=info.c|line=203}} || normal weapon animation for the [[Chainsaw]]
+
| 67 || {{DoomSrc|text=S_SAW|file=info.c|line=203}} || normal weapon animation for the [[chainsaw]]
 
|-
 
|-
| 68 || {{DoomSrc|text=S_SAWB|file=info.c|line=204}} || normal weapon animation for the [[Chainsaw]]
+
| 68 || {{DoomSrc|text=S_SAWB|file=info.c|line=204}} || normal weapon animation for the chainsaw
 
|-
 
|-
| 74 || {{DoomSrc|text=S_PLASMA|file=info.c|line=210}} || normal weapon animation for the [[Plasma Gun]]
+
| 74 || {{DoomSrc|text=S_PLASMA|file=info.c|line=210}} || normal weapon animation for the [[plasma gun]]
 
|-
 
|-
| 81 || {{DoomSrc|text=S_BFG|file=info.c|line=217}} || normal weapon animation for the [[BFG 9000]]
+
| 81 || {{DoomSrc|text=S_BFG|file=info.c|line=217}} || normal weapon animation for the [[BFG9000]]
 
|-
 
|-
 
|}
 
|}
  
 
== Example ==
 
== Example ==
 
+
The following is an example of how to set the <code>A_WeaponReady</code> code pointer in a [[DeHackEd]] file:
The following is an example of how to set the <code>A_WeaponReady</code> code pointer in a Dehacked file:
 
  
 
  Pointer 21 (Frame 34)
 
  Pointer 21 (Frame 34)
Line 47: Line 56:
 
== External links ==
 
== External links ==
 
* {{DoomSrc|file=p_pspr.c|line=282|text=A_WeaponReady}} in the Doom source code.
 
* {{DoomSrc|file=p_pspr.c|line=282|text=A_WeaponReady}} in the Doom source code.
 +
* {{zdoomwiki|title=A_WeaponReady}}
 +
* {{eterwiki|title=WeaponReady}}
  
 
[[Category:Weapon code pointers]]
 
[[Category:Weapon code pointers]]
 +
[[Category:Sound effect code pointers]]

Latest revision as of 13:25, 3 January 2024

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) or S_PLAY_ATK2 (frame 155), transitions to S_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:

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]