Prev: FC40 Up: Map Next: FC66
FC48: Aim a chasing creature at the knight, or at a decoy (the author's ZOOMIN)
Used by the routine at STEER.
Called by STEER when a chaser's timer (+15) runs out: the guards (behaviours 6, 9 and 10), the troll (7) and the wraith (11, and 15 once woken). The target is the knight's record (KNIGHT), except for a behaviour-9 guard while a decoy is in the room (bit 0 of THINGS_NOTED): then it is the decoy's record, which CHE3D keeps in DECOY. IY is pointed at the target for AIM_AT, so (IY+6) and (IY+8) there are the target's x and z rather than variables -- which is why THINGS_NOTED is read by its address here -- and then set back to OBJECT_COUNT.
Input
E The chaser's behaviour byte (+14)
IX The chaser's record
Output
A The new heading
D How far off the target is along that axis
ZOOMIN FC48 LD A,E The target is the knight...
FC49 LD IY,KNIGHT
FC4D AND $0F
FC4F CP $09
FC51 JR NZ,ZOOMIN_0
FC53 LD A,(THINGS_NOTED) ...unless this is a behaviour-9 guard and a decoy has been seen
FC56 BIT 0,A
FC58 JR Z,ZOOMIN_0
FC5A LD IY,(DECOY) The decoy's record
ZOOMIN_0 FC5E CALL AIM_AT Work out the heading
FC61 LD IY,OBJECT_COUNT IY back on the variables
FC65 RET
Prev: FC40 Up: Map Next: FC66