Prev: C374 Up: Map Next: C421
C3E3: Draw the ship, its trail and its jets
Used by the routine at scroll_landscape.
Reached by a jump from scroll_landscape at the end of each pass's landscape drawing; returns to the play loop. IY was pushed by ship_pass.
The ship stays where it is on the screen and the world moves under it, so its image is drawn over itself and only erased when it changes: when the ship turns (the steering direction steer_push against the facing byte, +$18 of the ship record), when a part is being fitted (+$1F of the record, part_being_fitted), or while docking with the finished rocket (death byte 10). It is redrawn on every odd pass, and on even passes only when one of those things happens; on even passes the carried part (carried_part) is drawn instead.
The ship's image is draw_ship_image; then come the trail (draw_trail), the pause key (check_pause_in_play), the fire button (fire), and one of the two jets: the lift jet (lift_jet) on even passes, the side jet (side_jet) on odd ones.
All of them are drawn by draw_direct_pair, which interleaves an erase of the old image (main registers: DE the graphic, HL the screen, IY the eraser for its width, scratch_count its height, direct_old_line its y) with the drawing of the new (alternate registers, IX the drawer, ground_cell the height, the byte after direct_old_line the y), a row of each in turn, so that nothing is ever missing from the screen for long. Images are drawn with OR and erased with AND NOT, without masks.
draw_ship C3E3 POP IY IY as it was before ship_pass.
C3E5 LD A,(launch_state) Nothing to draw once the rocket is lifting off or the ship is dying.
C3E8 AND A
C3E9 RET NZ
C3EA LD A,(death_count)
C3ED CP $0B
C3EF RET NC
C3F0 CALL drop_part First drop_part, which lets a carried rocket part go over its slot.
C3F3 LD A,(pass_counter) Odd pass: redraw the ship.
C3F6 AND $01
C3F8 JR NZ,draw_ship_image
C3FA CALL carried_part Even pass: the carried part.
C3FD LD A,(part_being_fitted) Redraw the ship anyway when a part is being fitted, while docking with the finished rocket (death byte 10) or when ship_on_slope is set.
C400 AND A
C401 JR NZ,draw_ship_image
C403 LD A,(death_count)
C406 CP $0A
C408 JR Z,draw_ship_image
C40A LD A,(ship_on_slope)
C40D AND A
C40E JR NZ,draw_ship_image
C410 LD A,(steer_push) Otherwise only when it is steered the other way from the way it faces.
C413 AND A
C414 JP Z,draw_trail_9
C417 LD B,A
C418 LD A,(ship_facing)
C41B XOR B
C41C BIT 7,A
C41E JP Z,draw_trail_9
Prev: C374 Up: Map Next: C421