Prev: 92FA Up: Map Next: 9341
9307: Update a homing missile
Used by the routine at update_shots.
Called by update_shots for each of the player's shots that is a homing missile (bit 7 of +$16) and is flying (first byte 0; $FF when spent). With no target (the high nibble of +$17 is $F) it looks for one (the code at offset 24 of type_points). With one it steers at it (steer_towards), and gives it up when the target's record is freed. Then it moves (move_missile).
Input
IX The missile's record
update_missile 9307 LD A,(IX+$17) No target: look for one
930A AND $F0
930C CP $F0
930E CALL Z,find_missile_target
9311 LD A,(IX+$17) Still none: just move
9314 AND $F0
9316 CP $F0
9318 JP Z,move_missile
931B RLCA The target's record
931C RLCA
931D RLCA
931E RLCA
931F LD B,A
9320 LD DE,$0018
9323 LD IY,object_records
9327 AND A
9328 JR Z,update_missile_1
update_missile_0 932A ADD IY,DE
932C DJNZ update_missile_0
update_missile_1 932E LD A,(IY+$00) Freed: no target
9331 INC A
9332 JR NZ,update_missile_2
9334 LD (IX+$17),$F0
9338 JP move_missile
update_missile_2 933B CALL steer_towards Steer at it, and move
933E JP move_missile
Prev: 92FA Up: Map Next: 9341