Prev: 97BD Up: Map Next: 97FF
97DF: Change an attacker's course now and then
Used by the routines at update_tough_attacker and update_attacker.
Counts +$15 down and, at 0, sets it again to 1-32 passes and jumps to the type's steering routine through the table steering_routines. Once bit 7 of +$16 is set (home_on_ship), there is no wait: the steering runs every pass. The routines: $14 and $16 home in on the ship (home_on_ship), $17 turns at it every 10-25 passes (turn_at_ship), $18 and $1A drift diagonally at random (drift_at_random), and $19 turns at it or stops (steer_tough_attacker).
Input
IX The attacker
change_course 97DF BIT 7,(IX+$16) Wait
97E3 JR NZ,change_course_0
97E5 DEC (IX+$15)
97E8 RET NZ
97E9 LD A,(random_b) The next wait, 1-32 passes
97EC AND $1F
97EE INC A
97EF LD (IX+$15),A
change_course_0 97F2 LD A,(IX+$00) The type's steering
97F5 SUB $13
97F7 LD C,A
97F8 LD HL,steering_routines
97FB CALL table_word
97FE JP (HL)
Prev: 97BD Up: Map Next: 97FF