A VileChase

A_VileChase is a code pointer used in the normal animation for the arch-vile.

Each time  is called, it calculates the blockmap area to be searched and calls   for each of the entities inside this area to determine if it is a corpse that can be resurrected. To pass the check, an object must fulfill several conditions: it must have the flag set, designating it as a corpse; its current animation frame must have a duration of -1 (meaning it lasts indefinitely); it must have a raise state (arch-viles, lost souls, cyberdemons and spider masterminds lack such a state); it must be no further away than its own radius plus the radius of the monster calling   (meaning their collision boxes must touch); and it must be inert and positioned in a location where it can be resurrected, and that is not also currently occupied by another actor, like the player or a monster. If all these conditions are met,  will set the found corpse as a temporary target and call. After this, it switches back to the previous target (player, monster or none) and jumps the monster performing the resurrection to its state, the first state of the arch-vile's heal sequence. This state (#266) and its associated animation frame are hard-coded to be transitioned to after   initiates. After this, the target emits the gibbing sound, and its raise state is triggered. The target's health, height, radius and flags are all set to their default values, placing it in its spawn state. In the case of the arch-vile, once it has finished its heal sequence, it will return to the beginning of its walk state, calling  again.

If  fails to find a corpse to resurrect, it will transition to   instead.

Uses
The  code pointer appears in the following states in Doom's state table:

Example
The following is an example of how to set the  code pointer in a Dehacked file:

Pointer 21 (Frame 34) Codep Frame = 254

Or using BEX syntax:

[CODEPTR] Frame 1234 = VileChase