A_SeekTracer
From DoomWiki.org
A_SeekTracer(threshold, maxturnangle) is a generic homing missile function that is part of the MBF21 specification. It has two parameters, using the values in the "Args1" and "Args2" fields as arguments.
The first argument sets the minimum threshold angle for the missile – should the angle to the target be smaller than this value, the missile's flightpath will "snap" to the target directly. The second argument sets the maximum turn angle for the missile – as long as the angle to the target is below this value and above the threshold angle, the missile will home in on the target; should the angle to the target be larger than this value, the turn angle will be set to this value. Both arguments have to be passed to the function in fixed point, meaning the intended value has to be multiplied by 65536 (FRACUNIT).
The function's behavior is based on Heretic's P_SeekerMissile function rather than Doom's native A_Tracer, resulting in some slight differences in homing behavior for the affected missile, such as improved z-axis homing.
Note that A_SeekTracer
does not spawn a smoke trail behind the missile and will be executed on every gametic it is called, unlike Doom's native A_Tracer, which is only executed on gametics that are multiples of four. This means a missile that calls A_SeekTracer
will always be homing, and the frequency at which the function is invoked by the calling actor directly controls how aggressively the missile will home in on the position of its target.
Example[edit]
The following is an example of how to set the A_SeekTracer
code pointer in a DeHackEd file using BEX syntax:
Frame 316 Args1 = 0 Args2 = 552960 Frame 317 Args1 = 0 Args2 = 552960 [CODEPTR] FRAME 316 = SeekTracer FRAME 317 = SeekTracer
Or using DECOHack syntax:
state 316 { FATB A 2 A_SeekTracer(0, 8.4375) goto 317 } state 317 { FATB B 2 A_SeekTracer(0, 8.4375) goto 316 }
The example above replaces A_Tracer in the revenant fireball's animation with A_SeekTracer
while retaining the correct homing strength1 for the missile. However, the resulting fireball will not spawn a smoke trail behind it and has no chance of being non-homing as opposed to a regular revenant missile.
- A revenant missile calls A_Tracer every two tics, but the function itself is only executed on gametics which are multiples of four, meaning a homing missile will only home every four tics rather than every two. To emulate this behavior,
A_SeekTracer
's maximum turn angle is set to half that of A_Tracer's maximum turn angle of 16.875 degrees, since it would otherwise home in twice as strongly, asA_SeekTracer
is executed independent of which gametic it is called on. (Alternatively, the state duration could simply be doubled, but this would alter the visual animation of the projectile, making the missile switch between its two animation sprites at half its normal frequency.)
External links[edit]
- A_SeekTracer in the DSDA-Doom source code, hosted on GitHub.
- MBF21 specification, hosted on GitHub.