A_FaceTarget
From DoomWiki.org
A_FaceTarget is a code pointer used in the melee attack and attack animations for various monsters.
True to its name, A_FaceTarget
changes the angle of the monster it is called on to be facing in the direction of its target; if it has no target, it does nothing. This is important for attack animations so that the monster appears to observers be attacking the right thing, but for hitscanners it also sets the direction in which the monster shoots. This is not the case for projectile launchers where the aiming calculation is done separately.
If the target has invisibility (an example is due to the partial invisibility, but also if the target is an invisible monster like the spectre), a random offset is added to the angle so that the monster appears to be attacking the wrong location. This has different effects depending on the monster:
- for melee attacks such as the demon, it is entirely cosmetic. Although the monster may appear to be facing the wrong way there is no effect on the damage done to the target;
- for hitscan attacks, the monster can end up facing and firing in the wrong direction (although the two will match);
- for projectile launchers, the direction that the monster appears to be facing and the direction that the projectile is launched are independent. Both are independently fuzzed due to the invisibility effect.
Contents
Uses[edit]
The A_FaceTarget
code pointer appears in the following states in Doom's state table:
Frame number | Doom internal name | Use |
---|---|---|
184 | S_POSS_ATK1 | attack animation for the zombieman |
217 | S_SPOS_ATK1 | attack animation for the shotgun guy |
256 | S_VILE_ATK2 | attack animation for the arch-vile |
258 | S_VILE_ATK4 | attack animation for the arch-vile |
259 | S_VILE_ATK5 | attack animation for the arch-vile |
260 | S_VILE_ATK6 | attack animation for the arch-vile |
261 | S_VILE_ATK7 | attack animation for the arch-vile |
262 | S_VILE_ATK8 | attack animation for the arch-vile |
263 | S_VILE_ATK9 | attack animation for the arch-vile |
335 | S_SKEL_FIST1 | melee attack animation for the revenant |
337 | S_SKEL_FIST3 | melee attack animation for the revenant |
339 | S_SKEL_MISS1 | attack animation for the revenant |
340 | S_SKEL_MISS2 | attack animation for the revenant |
342 | S_SKEL_MISS4 | attack animation for the revenant |
378 | S_FATT_ATK3 | attack animation for the mancubus |
379 | S_FATT_ATK4 | attack animation for the mancubus |
381 | S_FATT_ATK6 | attack animation for the mancubus |
382 | S_FATT_ATK7 | attack animation for the mancubus |
384 | S_FATT_ATK9 | attack animation for the mancubus |
385 | S_FATT_ATK10 | attack animation for the mancubus |
416 | S_CPOS_ATK1 | attack animation for the heavy weapon dude |
452 | S_TROO_ATK1 | melee attack animation for the imp |
453 | S_TROO_ATK2 | melee attack animation for the imp |
485 | S_SARG_ATK1 | melee attack animation for the spectre and demon |
486 | S_SARG_ATK2 | melee attack animation for the spectre and demon |
504 | S_HEAD_ATK1 | attack animation for the cacodemon |
505 | S_HEAD_ATK2 | attack animation for the cacodemon |
537 | S_BOSS_ATK1 | melee attack animation for the baron of Hell |
538 | S_BOSS_ATK2 | melee attack animation for the baron of Hell |
566 | S_BOS2_ATK1 | melee attack animation for the Hell knight |
567 | S_BOS2_ATK2 | melee attack animation for the Hell knight |
589 | S_SKULL_ATK1 | attack animation for the lost soul |
615 | S_SPID_ATK1 | attack animation for the spiderdemon |
647 | S_BSPI_ATK1 | attack animation for the arachnotron |
684 | S_CYBER_ATK1 | attack animation for the cyberdemon |
686 | S_CYBER_ATK3 | attack animation for the cyberdemon |
688 | S_CYBER_ATK5 | attack animation for the cyberdemon |
708 | S_PAIN_ATK1 | attack animation for the pain elemental |
709 | S_PAIN_ATK2 | attack animation for the pain elemental |
710 | S_PAIN_ATK3 | attack animation for the pain elemental |
736 | S_SSWV_ATK1 | attack animation for the Wolfenstein SS |
737 | S_SSWV_ATK2 | attack animation for the Wolfenstein SS |
739 | S_SSWV_ATK4 | attack animation for the Wolfenstein SS |
Internal calls[edit]
Many other code pointers also call A_FaceTarget internally:
- A_PosAttack (zombieman)
- A_SPosAttack (shotgun guy)
- A_CPosAttack and A_CPosRefire (heavy weapon dude)
- A_TroopAttack (imp)
- A_SargAttack (demon and spectre)
- A_HeadAttack (cacodemon)
- A_SkullAttack (lost soul)
- A_PainAttack (pain elemental)
- A_SkelMissile, A_SkelWhoosh and A_SkelFist (revenant)
- A_VileTarget and A_VileAttack (arch-vile)
- A_FatRaise, A_FatAttack1, A_FatAttack2, A_FatAttack3 (mancubus)
- A_BspiAttack (arachnotron)
- A_SpidRefire (spiderdemon)
- A_CyberAttack (cyberdemon)
Example[edit]
The following is an example of how to set the A_FaceTarget
code pointer in a DeHackEd file:
Pointer 21 (Frame 34) Codep Frame = 739
Or using BEX syntax:
[CODEPTR] Frame 1234 = FaceTarget
External links[edit]
- A_FaceTarget in the Doom source code.
- A_FaceTarget at the ZDoom wiki
- FaceTarget at the Eternity Engine wiki