Difference between revisions of "A Look"

From DoomWiki.org

[checked revision][checked revision]
(recategorize)
(fix caps and wls, fmtg, add wls and rm dupe wls)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:A_Look}}
+
{{DISPLAYTITLE:A_Look}}{{DEFAULTSORT:Look}}
{{stub}}
+
[[File:MAP01 start.png|thumb|right|[[Zombiemen]] at the start of [[MAP01: Entryway (Doom II)|MAP01]] in their spawn state, cycling through <code>A_Look</code> to try to locate a target.]]
 
'''A_Look''' is a [[code pointer]] used in the normal animation for various monsters.
 
'''A_Look''' is a [[code pointer]] used in the normal animation for various monsters.
 +
 +
<code>A_Look</code> scans the immediate area for targets (i.e. [[player]]s to attack). Most monsters are initially spawned cycling through a series of states that repeatedly call <code>A_Look</code>. The following strategies are used to find a target:
 +
 +
# The sound target of the sector that the monster is standing in is checked; if the player fires a weapon, the monster will wake up and attack, unless the monster has the ambush/deaf flag set.
 +
# The monster checks if it can see any players who are still alive and still in the game. Players must be in the 180 degree field in front of the monster.
 +
 +
When a target is located, the monster plays its "see sound" (for example, in the case of an [[imp]] that is {{c|DSBGSIT1}} or {{c|DSBGSIT2}}) and jumps to the "see state" that will lead it to attack the player by calling [[A_Chase]].
 +
 +
The following call graph shows some of the internals of the A_Look code pointer:
 +
 +
[[File:A Look Call Graph.svg|center|A_Look call graph]]
  
 
== Uses ==
 
== Uses ==
 
+
The <code>A_Look</code> code pointer appears in the following [[state]]s in Doom's state table:
The <code>A_Look</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
 
|-
 
|-
| 174 || {{DoomSrc|text=S_POSS_STND|file=info.c|line=310}} || normal animation for the [[Trooper]]
+
| 174 || {{DoomSrc|text=S_POSS_STND|file=info.c|line=310}} || normal animation for the [[zombieman]]
 
|-
 
|-
| 175 || {{DoomSrc|text=S_POSS_STND2|file=info.c|line=311}} || normal animation for the [[Trooper]]
+
| 175 || {{DoomSrc|text=S_POSS_STND2|file=info.c|line=311}} || normal animation for the zombieman
 
|-
 
|-
| 207 || {{DoomSrc|text=S_SPOS_STND|file=info.c|line=343}} || normal animation for the [[Sargeant]]
+
| 207 || {{DoomSrc|text=S_SPOS_STND|file=info.c|line=343}} || normal animation for the [[shotgun guy]]
 
|-
 
|-
| 208 || {{DoomSrc|text=S_SPOS_STND2|file=info.c|line=344}} || normal animation for the [[Sargeant]]
+
| 208 || {{DoomSrc|text=S_SPOS_STND2|file=info.c|line=344}} || normal animation for the shotgun guy
 
|-
 
|-
| 241 || {{DoomSrc|text=S_VILE_STND|file=info.c|line=377}} || normal animation for the [[Archvile]]
+
| 241 || {{DoomSrc|text=S_VILE_STND|file=info.c|line=377}} || normal animation for the [[arch-vile]]
 
|-
 
|-
| 242 || {{DoomSrc|text=S_VILE_STND2|file=info.c|line=378}} || normal animation for the [[Archvile]]
+
| 242 || {{DoomSrc|text=S_VILE_STND2|file=info.c|line=378}} || normal animation for the arch-vile
 
|-
 
|-
| 321 || {{DoomSrc|text=S_SKEL_STND|file=info.c|line=457}} || normal animation for the [[Revenant]]
+
| 321 || {{DoomSrc|text=S_SKEL_STND|file=info.c|line=457}} || normal animation for the [[revenant]]
 
|-
 
|-
| 322 || {{DoomSrc|text=S_SKEL_STND2|file=info.c|line=458}} || normal animation for the [[Revenant]]
+
| 322 || {{DoomSrc|text=S_SKEL_STND2|file=info.c|line=458}} || normal animation for the revenant
 
|-
 
|-
| 362 || {{DoomSrc|text=S_FATT_STND|file=info.c|line=498}} || normal animation for the [[Mancubus]]
+
| 362 || {{DoomSrc|text=S_FATT_STND|file=info.c|line=498}} || normal animation for the [[mancubus]]
 
|-
 
|-
| 363 || {{DoomSrc|text=S_FATT_STND2|file=info.c|line=499}} || normal animation for the [[Mancubus]]
+
| 363 || {{DoomSrc|text=S_FATT_STND2|file=info.c|line=499}} || normal animation for the mancubus
 
|-
 
|-
| 406 || {{DoomSrc|text=S_CPOS_STND|file=info.c|line=542}} || normal animation for the [[Chaingun Sargeant]]
+
| 406 || {{DoomSrc|text=S_CPOS_STND|file=info.c|line=542}} || normal animation for the [[heavy weapon dude]]
 
|-
 
|-
| 407 || {{DoomSrc|text=S_CPOS_STND2|file=info.c|line=543}} || normal animation for the [[Chaingun Sargeant]]
+
| 407 || {{DoomSrc|text=S_CPOS_STND2|file=info.c|line=543}} || normal animation for the heavy weapon dude
 
|-
 
|-
| 442 || {{DoomSrc|text=S_TROO_STND|file=info.c|line=578}} || normal animation for the [[Imp]]
+
| 442 || {{DoomSrc|text=S_TROO_STND|file=info.c|line=578}} || normal animation for the [[imp]]
 
|-
 
|-
| 443 || {{DoomSrc|text=S_TROO_STND2|file=info.c|line=579}} || normal animation for the [[Imp]]
+
| 443 || {{DoomSrc|text=S_TROO_STND2|file=info.c|line=579}} || normal animation for the imp
 
|-
 
|-
| 475 || {{DoomSrc|text=S_SARG_STND|file=info.c|line=611}} || normal animation for the [[Spectre]] and [[Demon]]
+
| 475 || {{DoomSrc|text=S_SARG_STND|file=info.c|line=611}} || normal animation for the [[spectre]] and [[demon]]
 
|-
 
|-
| 476 || {{DoomSrc|text=S_SARG_STND2|file=info.c|line=612}} || normal animation for the [[Spectre]] and [[Demon]]
+
| 476 || {{DoomSrc|text=S_SARG_STND2|file=info.c|line=612}} || normal animation for the spectre and demon
 
|-
 
|-
| 502 || {{DoomSrc|text=S_HEAD_STND|file=info.c|line=638}} || normal animation for the [[Cacodemon]]
+
| 502 || {{DoomSrc|text=S_HEAD_STND|file=info.c|line=638}} || normal animation for the [[cacodemon]]
 
|-
 
|-
| 527 || {{DoomSrc|text=S_BOSS_STND|file=info.c|line=663}} || normal animation for the [[Baron of Hell]]
+
| 527 || {{DoomSrc|text=S_BOSS_STND|file=info.c|line=663}} || normal animation for the [[baron of Hell]]
 
|-
 
|-
| 528 || {{DoomSrc|text=S_BOSS_STND2|file=info.c|line=664}} || normal animation for the [[Baron of Hell]]
+
| 528 || {{DoomSrc|text=S_BOSS_STND2|file=info.c|line=664}} || normal animation for the baron of Hell
 
|-
 
|-
| 556 || {{DoomSrc|text=S_BOS2_STND|file=info.c|line=692}} || normal animation for the [[Hell Knight]]
+
| 556 || {{DoomSrc|text=S_BOS2_STND|file=info.c|line=692}} || normal animation for the [[Hell knight]]
 
|-
 
|-
| 557 || {{DoomSrc|text=S_BOS2_STND2|file=info.c|line=693}} || normal animation for the [[Hell Knight]]
+
| 557 || {{DoomSrc|text=S_BOS2_STND2|file=info.c|line=693}} || normal animation for the Hell knight
 
|-
 
|-
| 585 || {{DoomSrc|text=S_SKULL_STND|file=info.c|line=721}} || normal animation for the [[Lost Soul]]
+
| 585 || {{DoomSrc|text=S_SKULL_STND|file=info.c|line=721}} || normal animation for the [[lost soul]]
 
|-
 
|-
| 586 || {{DoomSrc|text=S_SKULL_STND2|file=info.c|line=722}} || normal animation for the [[Lost Soul]]
+
| 586 || {{DoomSrc|text=S_SKULL_STND2|file=info.c|line=722}} || normal animation for the lost soul
 
|-
 
|-
| 601 || {{DoomSrc|text=S_SPID_STND|file=info.c|line=737}} || normal animation for the [[Spiderdemon]]
+
| 601 || {{DoomSrc|text=S_SPID_STND|file=info.c|line=737}} || normal animation for the [[spiderdemon]]
 
|-
 
|-
| 602 || {{DoomSrc|text=S_SPID_STND2|file=info.c|line=738}} || normal animation for the [[Spiderdemon]]
+
| 602 || {{DoomSrc|text=S_SPID_STND2|file=info.c|line=738}} || normal animation for the spiderdemon
 
|-
 
|-
| 632 || {{DoomSrc|text=S_BSPI_STND|file=info.c|line=768}} || normal animation for the [[Arachnotron]]
+
| 632 || {{DoomSrc|text=S_BSPI_STND|file=info.c|line=768}} || normal animation for the [[arachnotron]]
 
|-
 
|-
| 633 || {{DoomSrc|text=S_BSPI_STND2|file=info.c|line=769}} || normal animation for the [[Arachnotron]]
+
| 633 || {{DoomSrc|text=S_BSPI_STND2|file=info.c|line=769}} || normal animation for the arachnotron
 
|-
 
|-
| 674 || {{DoomSrc|text=S_CYBER_STND|file=info.c|line=810}} || normal animation for the [[Cyberdemon]]
+
| 674 || {{DoomSrc|text=S_CYBER_STND|file=info.c|line=810}} || normal animation for the [[cyberdemon]]
 
|-
 
|-
| 675 || {{DoomSrc|text=S_CYBER_STND2|file=info.c|line=811}} || normal animation for the [[Cyberdemon]]
+
| 675 || {{DoomSrc|text=S_CYBER_STND2|file=info.c|line=811}} || normal animation for the cyberdemon
 
|-
 
|-
| 701 || {{DoomSrc|text=S_PAIN_STND|file=info.c|line=837}} || normal animation for the [[Pain Elemental]]
+
| 701 || {{DoomSrc|text=S_PAIN_STND|file=info.c|line=837}} || normal animation for the [[pain elemental]]
 
|-
 
|-
| 726 || {{DoomSrc|text=S_SSWV_STND|file=info.c|line=862}} || normal animation for the [[SS Nazi]]
+
| 726 || {{DoomSrc|text=S_SSWV_STND|file=info.c|line=862}} || normal animation for the [[Wolfenstein SS]]
 
|-
 
|-
| 727 || {{DoomSrc|text=S_SSWV_STND2|file=info.c|line=863}} || normal animation for the [[SS Nazi]]
+
| 727 || {{DoomSrc|text=S_SSWV_STND2|file=info.c|line=863}} || normal animation for the Wolfenstein SS
 
|-
 
|-
| 784 || {{DoomSrc|text=S_BRAINEYE|file=info.c|line=920}} || normal animation for the [[Demon Spawner]]
+
| 784 || {{DoomSrc|text=S_BRAINEYE|file=info.c|line=920}} || normal animation for the [[monster spawner]]
 
|-
 
|-
 
|}
 
|}
  
 
== Example ==
 
== Example ==
 
+
The following is an example of how to set the <code>A_Look</code> code pointer in a [[DeHackEd]] file:
The following is an example of how to set the <code>A_Look</code> code pointer in a Dehacked file:
 
  
 
  Pointer 21 (Frame 34)
 
  Pointer 21 (Frame 34)
Line 93: Line 102:
 
== External links ==
 
== External links ==
 
* {{DoomSrc|file=p_enemy.c|line=604|text=A_Look}} in the Doom source code.
 
* {{DoomSrc|file=p_enemy.c|line=604|text=A_Look}} in the Doom source code.
 +
* {{zdoomwiki|title=A_Look}}
 +
* {{eterwiki|title=Look}}
  
 
[[Category:Core monster AI code pointers]]
 
[[Category:Core monster AI code pointers]]
 +
[[Category:Sound effect code pointers]]

Latest revision as of 15:13, 4 January 2024

Zombiemen at the start of MAP01 in their spawn state, cycling through A_Look to try to locate a target.

A_Look is a code pointer used in the normal animation for various monsters.

A_Look scans the immediate area for targets (i.e. players to attack). Most monsters are initially spawned cycling through a series of states that repeatedly call A_Look. The following strategies are used to find a target:

  1. The sound target of the sector that the monster is standing in is checked; if the player fires a weapon, the monster will wake up and attack, unless the monster has the ambush/deaf flag set.
  2. The monster checks if it can see any players who are still alive and still in the game. Players must be in the 180 degree field in front of the monster.

When a target is located, the monster plays its "see sound" (for example, in the case of an imp that is DSBGSIT1 or DSBGSIT2) and jumps to the "see state" that will lead it to attack the player by calling A_Chase.

The following call graph shows some of the internals of the A_Look code pointer:

A_Look call graph

Uses[edit]

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

Pointer 21 (Frame 34)
Codep Frame = 784

Or using BEX syntax:

[CODEPTR]
Frame 1234 = Look

External links[edit]