A_JumpIfTargetInSight
From DoomWiki.org
A_JumpIfTargetInSight(state, fov) is a monster function that is part of the MBF21 specification. It jumps the calling actor to a specified state if its current target is within its line of sight. It has two parameters, using the values in the Args fields as arguments.
The first argument determines the state that the actor will jump to, using the index number of the frame. The second argument sets the field of view relative to the direction the calling actor is facing. The angle of the field of view has to be passed to the function in fixed point, meaning the intended value has to be multiplied by 65536 (FRACUNIT). If the field of view is set to ≤ 0, the function will check for the target in all directions.
Example[edit]
The following is an example of how to set the A_JumpIfTargetInSight code pointer in a DeHackEd file using BEX syntax:
Frame 1234 Args1 = 420 Args2 = 65536 [CODEPTR] FRAME 1234 = JumpIfTargetInSight
Or using DECOHack syntax:
state 1234
{
TNT1 A 1 A_JumpIfTargetInSight(420, 1.0)
}
In the above example A_JumpIfTargetInSight will jump the calling actor to state 420 if its target is found within a field of view of exactly 1° from the direction the calling actor is facing, meaning it has to be directly ahead of it or a jump will not occur.
External links[edit]
- A_JumpIfTargetInSight in the DSDA-Doom source code, hosted on GitHub.
- MBF21 specification, hosted on GitHub.
