A_TroopAttack

From DoomWiki.org

An imp about to call A_TroopAttack to launch a fireball.

A_TroopAttack is a code pointer used in the attack animation for the imp.

A_TroopAttack is used for both of the imp's methods of attack. If the imp is within melee range of its target, it does a random amount of damage to its target and plays the sound effect DSCLAW. Otherwise, it launches a fireball (object of type MT_TROOPSHOT) towards its target. If the monster has no target, nothing happens.

The naming of this code pointer is a somewhat confusing artifact of Doom's development process where the imp was initially called a "troop" before the addition of the zombieman (a.k.a. trooper). A similar situation exists with A_SargAttack.

Uses[edit]

The A_TroopAttack 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_TroopAttack code pointer in a DeHackEd file:

Pointer 21 (Frame 34)
Codep Frame = 454

Or using BEX syntax:

[CODEPTR]
Frame 1234 = TroopAttack

Code structure[edit]

The following call graph shows the code structure of the A_TroopAttack function. The graph has two main branches corresponding to the melee (P_CheckMeleeRange and P_DamageMobj) and fireball (P_SpawnMissile) attacks.

A TroopAttack call graph.svg

External links[edit]