Prev: D978 Up: Map Next: D9EB
D9A3: The update routine for a find in a building (graphics 48-63)
A find is one of the four kinds of antibody (SPAWN_FIND makes it, from the cell's type), and is there only while the knight is in its cell. It wanders at random (WANDER_STEP, steps of up to 8 each way) and, touched, is taken up (PICK_UP_THING) as thing 5-8 and vanishes -- even with all eleven places full, when it is simply lost.
If the knight leaves the cell, or dies, it vanishes and is given back to its cell type's stock (STOCKS), so it can be found there again. Its +5 holds the cell type, not a speed, and +6 its turns to the next change of course.
Input
IX The find's record (FINDS)
FIND_WANDER D9A3 LD A,(KNIGHT) Is the knight alive (graphics 16-47)?
D9A6 SUB $10
D9A8 CP $20
D9AA JR NC,FIND_WANDER_0
D9AC LD A,(KNIGHT_COLUMN) And still in its cell?
D9AF CP (IX+$02)
D9B2 JR NZ,FIND_WANDER_1
D9B4 LD A,(KNIGHT_ROW)
D9B7 CP (IX+$04)
D9BA JR NZ,FIND_WANDER_1
D9BC LD B,$04 Yes: now and then a new random step, of up to 8 each way
D9BE CALL WANDER_STEP
D9C1 CALL MOVE_SPLIT Move along U and then V, trimmed at walls
D9C4 CALL APPLY_STEP
D9C7 CALL NEXT_FRAME_MOD4 Next frame
D9CA CALL TOUCHING_KNIGHT Done unless the knight touches it
D9CD RET NC
D9CE CALL PICK_UP_THING Take it up, and it vanishes (full or not)
D9D1 LD (IX+$00),$0C
D9D5 RET
FIND_WANDER_0 D9D6 LD (IX+$00),$0D The knight is dead: vanish, from the second frame...
D9DA JR FIND_WANDER_2
FIND_WANDER_1 D9DC LD (IX+$00),$0C He has left the cell: vanish
FIND_WANDER_2 D9E0 LD C,(IX+$05) Either way, one more to be found in a cell of its type
D9E3 LD B,$00
D9E5 LD HL,STOCKS
D9E8 ADD HL,BC
D9E9 INC (HL)
D9EA RET
Prev: D978 Up: Map Next: D9EB