Prev: C33C Up: Map Next: C3E3
C374: Move the ship and the world for one pass of the game
Used by the routine at play.
The first call of each pass of the play loop (play), and of the death sequence. It counts the pass (pass_counter), counts the shield pick-up's timer shield_timer down on odd passes, and every fourth pass offers the place as a restart point (save_restart_point). Then, unless the ship is dying or the finished rocket is lifting off (launch_state), the controls are read and the ship's speeds worked out (move_ship, which leaves this pass's scroll steps in scroll_down and scroll_across), the ship record is given the opposite step (ship_speed_from_scroll) and tested against the landscape (collide_with_landscape) and the other objects (ship_hits_ground_objects), and the record is moved (move_object).
It ends by jumping to scroll_landscape, which scrolls the view, redraws the landscape and the stars, and jumps on to draw_ship to draw the ship: IY, pushed here, is popped there.
ship_pass C374 LD HL,(pass_counter) Count the pass.
C377 INC HL
C378 LD (pass_counter),HL
C37B BIT 0,L On odd passes, run the shield timer down.
C37D JR Z,ship_pass_0
C37F LD A,(shield_timer)
C382 AND A
C383 JR Z,ship_pass_0
C385 DEC A
C386 LD (shield_timer),A
ship_pass_0 C389 LD A,L Every fourth pass, perhaps a restart point.
C38A AND $03
C38C CALL Z,save_restart_point
C38F PUSH IY Kept for draw_ship.
C391 XOR A No scroll unless the ship moves.
C392 LD (scroll_across),A
C395 LD (scroll_down),A
C398 LD A,(death_count) Dying (death byte $0B or more): no movement.
C39B CP $0B
C39D JR NC,ship_pass_2
C39F LD IX,ship_record Read the controls and work out the ship's speeds and this pass's scroll.
C3A3 CALL move_ship
C3A6 LD A,$FF piece_step_x = $FF: a marker for the landscape test (collide_with_landscape clears ship_on_slope if it is still $FF afterwards).
C3A8 LD (piece_step_x),A
C3AB LD A,(launch_state) The finished rocket is lifting off (launch_state): no tests.
C3AE AND A
C3AF JR NZ,ship_pass_2
C3B1 CALL ship_speed_from_scroll The ship record's step is minus the scroll.
C3B4 LD C,$30 Test it against the landscape: B the ship's height plus 4 (plus nothing with the add-on at +$0F of the player's record).
C3B6 LD A,(addon_nine)
C3B9 AND A
C3BA LD B,$04
C3BC JR Z,ship_pass_1
C3BE LD B,$00
ship_pass_1 C3C0 LD A,(ship_height)
C3C3 ADD A,B
C3C4 LD B,A
C3C5 CALL collide_with_landscape
C3C8 CALL ship_hits_ground_objects Test it against the other objects (this is what calls the damage routine).
C3CB LD HL,(ship_dx) Keep a copy of the ship record's two step words (at ship_across_speed and ship_down_speed).
C3CE LD (ship_across_speed),HL
C3D1 LD HL,(ship_dy)
C3D4 LD (ship_down_speed),HL
C3D7 CALL ship_speed_from_scroll Set the step again and move the record by it.
C3DA CALL move_object
ship_pass_2 C3DD CALL update_shots Then the landscape, and the ship.
C3E0 JP scroll_landscape
Prev: C33C Up: Map Next: C3E3