Prev: 9341 Up: Map Next: 93F2
938D: Move, draw and time out a homing missile
Used by the routine at update_missile.
Rubs out its old picture, accelerates it (accelerate), faces it (set_facing), counts its life down in +$15 (freed at 0, or when marked by a hit), moves it bouncing off the landscape in a 16 by 11 box (move_bouncing), and draws it.
One odd case: when the landscape piece under the missile is $3E (looked up in the four in map_window_pointer by which quarter of the view it is in) and its line is between $18 and $D7, its line is set to $6A. Not yet worked out.
Input
IX The missile's record
move_missile 938D CALL clear_sprite_pair Rub out last pass's picture
9390 BIT 7,(IX+$10)
9394 CALL NZ,prepare_erase
9397 RES 6,(IX+$10)
939B EXX Accelerate, and face the way it moves
939C CALL accelerate
939F CALL set_facing
93A2 DEC (IX+$15) Its life is out: free it
93A5 JR NZ,move_missile_1
move_missile_0 93A7 LD (IX+$00),$FF
93AB JP move_missile_5
move_missile_1 93AE BIT 4,(IX+$10) Hit something: free it
93B2 JR NZ,move_missile_0
93B4 LD BC,$0B10 Move it, bouncing
93B7 CALL move_bouncing
93BA LD HL,(view_column) The landscape piece in its quarter of the view
93BD LD B,$00
93BF LD A,L
93C0 CP (IX+$01)
93C3 JR Z,move_missile_2
93C5 INC B
93C6 INC B
move_missile_2 93C7 LD A,H
93C8 CP (IX+$04)
93CB JR Z,move_missile_3
93CD INC B
move_missile_3 93CE LD A,B
93CF LD HL,map_window_tile_bytes
93D2 CALL add_a_to_hl
93D5 LD A,(HL)
93D6 CP $3E Piece $3E
93D8 JR NZ,move_missile_4
93DA LD A,(IX+$02)
93DD CP $18
93DF JR C,move_missile_4
93E1 CP $D8
93E3 JR NC,move_missile_4
93E5 LD (IX+$05),$6A
move_missile_4 93E9 CALL prepare_draw Place it
move_missile_5 93EC CALL draw_object_images Draw it
93EF JP colour_sprite
Prev: 9341 Up: Map Next: 93F2