Prev: DC97 Up: Map Next: DD79
DCA1: Set up the landscape for a life and scroll it into view
Used by the routine at play.
Called by play when a player's life starts. Fills the fuel, blacks out the play area's colour, takes the planet's landscape colours from planet_ground_colours, and restores the view from the player's record score: the map column and row (+$13, and +$14 kept one less), the in-cell x and y at the play area's left and bottom edges (+$15, +$16; bit 0 of the x set means the play area does not need filling with the checker first), and the scroll origins (+$17, +$18).
Then, with map_rebuild = $FF (the fly-in), the landscape is scrolled vertically 4 pixels a pass (2 on the first if that brings the origin to a multiple of 4) through scroll_landscape, with fly_in_step deciding when to stop; with map_rebuild = 3 one more pass is drawn; and with map_rebuild = 0 the window is rebuilt with its objects, the ship's record (in bare_ship) gets the map position, and play goes on by way of sound_rising_whine.
start_landscape DCA1 LD A,$BE Fuel full.
DCA3 LD (fuel_shown),A
DCA6 LD HL,$4200
DCA9 LD (fuel),HL
DCAC XOR A Play area's attributes black (the colour patch at play_area_colour, 28 by 20 cells).
DCAD LD ($F111),A
DCB0 CALL colour_play_area
DCB3 LD A,(level) This planet's two landscape attributes.
DCB6 ADD A,A
DCB7 LD HL,planet_ground_colours
DCBA CALL add_a_to_hl
DCBD LD A,(HL)
DCBE LD (ground_attr_above),A
DCC1 INC HL
DCC2 LD A,(HL)
DCC3 LD (ground_attr_below),A
DCC6 LD A,(ground_attr_above) Starting below ground (map row 12 or more): the below-ground colour, and items 9 and 10 of the player's item records (bit 7 of +$41 and +$45 of score) and +$10 reset.
DCC9 LD B,A
DCCA LD A,($F5FB)
DCCD CP $0C
DCCF JR C,start_landscape_0
DCD1 LD A,(ground_attr_below)
DCD4 LD B,A
DCD5 LD HL,place_nine
DCD8 RES 7,(HL)
DCDA LD HL,place_ten
DCDD RES 7,(HL)
DCDF XOR A
DCE0 LD (player_count_nine),A
start_landscape_0 DCE3 LD A,B The play area's colour, applied later.
DCE4 LD ($F111),A
DCE7 LD A,(restart_view) Fill the play area (28 columns by 160 rows, from the bottom) with the checker unless bit 0 of the saved x says not to.
DCEA AND $01
DCEC XOR $01
DCEE LD (start_filled),A
DCF1 JR Z,start_landscape_3
DCF3 LD HL,$57C1
DCF6 LD C,$50
start_landscape_1 DCF8 LD B,$1C
DCFA PUSH HL
start_landscape_2 DCFB LD (HL),$55
DCFD DEC H
DCFE LD (HL),$AA
DD00 INC H
DD01 INC HL
DD02 DJNZ start_landscape_2
DD04 POP HL
DD05 DEC H
DD06 CALL line_up_hl
DD09 DEC C
DD0A JR NZ,start_landscape_1
start_landscape_3 DD0C LD HL,(restart_scroll) Map position, edge positions and scroll origins from the player's record.
DD0F INC H
DD10 LD (view_column),HL
DD13 LD HL,(restart_view)
DD16 LD A,L
DD17 AND $FE
DD19 LD L,A
DD1A LD (view_x),HL
DD1D LD HL,(restart_fine)
DD20 LD (origin_x),HL
DD23 LD A,$02 Vertical scroll step: 2 if bit 1 of the vertical origin is set, else 4.
DD25 BIT 1,H
DD27 JR NZ,start_landscape_4
DD29 ADD A,A
start_landscape_4 DD2A LD (scroll_down),A
DD2D LD A,$FF Fly-in phase; build the map window (load_map_window).
DD2F LD (map_rebuild),A
DD32 LD HL,(view_column)
DD35 CALL load_map_window
DD38 XOR A No horizontal scroll; the ship's screen x (ship_screen_x) = $60; clear 300 bytes from ship_picture.
DD39 LD (scroll_across),A
DD3C LD A,$60
DD3E LD (ship_screen_x),A
DD41 LD BC,$012C
DD44 LD HL,ship_picture
start_landscape_5 DD47 LD (HL),$00
DD49 INC HL
DD4A DEC BC
DD4B LD A,B
DD4C OR C
DD4D JR NZ,start_landscape_5
DD4F CALL build_ship_sprite Ship and panel set-up (build_ship_sprite, toggle_carried_part, the end of load_ore); at most 40 passes of fly-in.
DD52 LD A,(rocket_part_carried)
DD55 INC A
DD56 JR Z,start_landscape_6
DD58 DEC A
DD59 OR $C0
DD5B LD (part_being_fitted),A
DD5E CALL toggle_carried_part
start_landscape_6 DD61 XOR A
DD62 LD (part_being_fitted),A
DD65 CALL load_ore_3
DD68 LD A,(ship_line)
DD6B SUB $09
DD6D LD (trail_y),A
DD70 LD B,$28
This entry point is used by the routine at fly_in_step.
start_landscape_7 DD72 PUSH BC One pass: fuel gauge, then the scroll and landscape (scroll_landscape). fly_in_step comes back here for the next.
DD73 CALL update_fuel_gauge
DD76 JP scroll_landscape
Prev: DC97 Up: Map Next: DD79