Prev: F1E0 Up: Map Next: F309
F2F7: Keep a creature's course, or aim it at the knight when its count runs out
Used by the routines at CHE3D and CREATURE_UPDATE.
The author's ZZ1. The creatures that chase -- the guards (CREATURE_UPDATE, and state 9 in CHE3D), the wraith and the troll -- each keep a countdown at +15 of their record and their course at +18. Every pass takes one off the count; when it reaches nought ZOOMIN aims the creature at the knight (or, for a state-9 guard, at a lure lying in the room), sets the count again (10 passes, or 3 when he is within 14 along y) and says how far away he is. So a creature changes its mind only every few passes.
Input
IX The creature's record (the pass's working copy of it is at IY+$64)
E Its state (+14)
Output
C The direction to go in, with the low two bits cleared (the direction bits are described at KNIGHT_CONTROLS)
D How far the knight is, along the floor axis on which he is further, if the course was set again this pass; nought if it was not
STEER F2F7 LD A,(WORK_HEADING) The course it is on (+18, from the working copy)
F2FA DEC (IX+OBJ_COUNT) Count this pass off the record's +15; at nought, take a new course (and distance) from ZOOMIN
F2FD LD D,$00
F2FF CALL Z,ZOOMIN
F302 AND $FC Only the way to go, not the low bits: in C, and kept at +18
F304 LD C,A
F305 LD (IX+OBJ_COURSE),A
F308 RET
Prev: F1E0 Up: Map Next: F309