A_SargAttack

From DoomWiki.org

Demon attacking using A_SargAttack.

A_SargAttack is a code pointer used in the melee attack animation for the spectre and demon.

A_SargAttack implements the demon's bite attack where the monster does a random amount of damage to its target provided that it is within melee range of the target. If it is not, or if it has no target, nothing happens. Internally A_FaceTarget is also called.

The naming of this function is a somewhat confusing artifact of Doom's development where the demons were initially known as "demon sergeants" before the addition of the shotgun guy (a.k.a. former human sergeant). A similar situation exists with A_TroopAttack.

Uses[edit]

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

Pointer 21 (Frame 34)
Codep Frame = 487

Or using BEX syntax:

[CODEPTR]
Frame 1234 = SargAttack

Code structure[edit]

The following call graph shows the code structure of the A_SargAttack function. Compare with the structure of A_TroopAttack which has both a melee and a ranged attack; the functions in common are the P_CheckMeleeRange and P_DamageMobj functions.

A SargAttack call graph.svg

External links[edit]