Prev: C331 Up: Map Next: C374
C33C: Remember where to start the next ship, if this is a safe place
Used by the routine at ship_pass.
Called every fourth pass by ship_pass. A place is safe if the bottom pixel row of the play area (from screen address $57C1, 28 bytes) is nothing but the flat ground's dither ($55: the ship is over flat ground filling the bottom of the screen), or if all four map cells on the screen (the four tile bytes kept by load_map_window) are empty sky (0) or cloud ($A6). Then the view's map cell, its x and y in the cell and the fine scroll are saved in the player's record, where start_landscape finds them when the next ship starts. Bit 0 of the saved x says which kind of place it was (0 over the ground, 1 in the sky): over the ground, start_landscape first paints the dither across the bottom of the play area.
save_restart_point C33C LD HL,$57C1 Is the bottom row of the play area all ground dither?
C33F LD B,$1C
save_restart_point_0 C341 LD A,(HL)
C342 CP $55
C344 JR NZ,save_restart_point_2
C346 INC L
C347 DJNZ save_restart_point_0
C349 LD B,$00 Yes: an over-the-ground restart.
save_restart_point_1 C34B LD HL,(view_column) Save the view's map cell (view_column), its x and y in the cell (view_x, with bit 0 of x the kind of place) and the origins (origin_x) at +$13, +$15 and +$17 of the player's record (score).
C34E LD (restart_scroll),HL
C351 LD HL,(view_x)
C354 LD A,L
C355 OR B
C356 LD L,A
C357 LD (restart_view),HL
C35A LD HL,(origin_x)
C35D LD (restart_fine),HL
C360 RET
save_restart_point_2 C361 LD HL,map_window_tile_bytes Otherwise every cell on the screen must be sky or cloud.
C364 LD B,$04
save_restart_point_3 C366 LD A,(HL)
C367 AND A
C368 JR Z,save_restart_point_4
C36A CP $A6
C36C RET NZ
save_restart_point_4 C36D INC HL
C36E DJNZ save_restart_point_3
C370 LD B,$01 A sky restart.
C372 JR save_restart_point_1
Prev: C331 Up: Map Next: C374