![]() |
Routines |
| Prev: BFB8 | Up: Map | Next: C032 |
|
Used by the routine at scroll_landscape.
Called each pass from scroll_landscape after the landscape. Only in the top four rows of the map (the view's map row view_row below 4: open sky) are there stars; lower down this returns at once. It runs in the build's tour at map row 3.
There are three layers of six stars. Each layer keeps an x and a y offset (in star_offsets) that is moved each pass by the scroll steps (scroll_across across, scroll_down down) scaled for the layer by parallax_step: a quarter for the far layer, a half for the middle one, the whole step for the near one. A star's place on the screen is its fixed position in star_layer_pointer plus its layer's offset, wrapping at 256 both ways, so the layers slide past one another at three speeds: parallax for six additions a pass. Last pass's offsets are kept so each star can be erased where it was drawn.
|
||||
| draw_stars | BFE3 | LD A,(view_row) | No stars below map row 3. | |
| BFE6 | CP $04 | |||
| BFE8 | RET NC | |||
| BFE9 | LD BC,$0006 | Keep last pass's offsets (six bytes) for the erasing. | ||
| BFEC | LD HL,star_offsets | |||
| BFEF | LD DE,star_offsets_before | |||
| BFF2 | LDIR | |||
| BFF4 | LD B,$03 | Three layers, B=3 (the far one) first. | ||
| BFF6 | LD IX,star_offsets | |||
| draw_stars_0 | BFFA | LD HL,(scroll_down) | Across: the horizontal step (H, from scroll_across) scaled for the layer and added to the layer's x offset. | |
| BFFD | CALL parallax_step | |||
| C000 | LD A,H | |||
| C001 | ADD A,(IX+$00) | |||
| C004 | LD (IX+$00),A | |||
| C007 | LD H,L | Down: the vertical step (L, from scroll_down) scaled the same way and added to its y offset. | ||
| C008 | INC IX | |||
| C00A | CALL parallax_step | |||
| C00D | LD A,H | |||
| C00E | ADD A,(IX+$00) | |||
| C011 | LD (IX+$00),A | |||
| C014 | INC IX | |||
| C016 | DJNZ draw_stars_0 | |||
| C018 | LD HL,star_positions | Point at the first star in star_layer_pointer, the first layer's frame slot (star_frames) and its offsets. | ||
| C01B | LD (star_pointer),HL | |||
| C01E | LD IX,star_frames | |||
| C022 | LD HL,star_offsets | |||
| C025 | LD (star_layer_pointer),HL | |||
| C028 | LD B,$03 | |||
| draw_stars_1 | C02A | PUSH BC | Draw the three layers. | |
| C02B | CALL draw_star_layer | |||
| C02E | POP BC | |||
| C02F | DJNZ draw_stars_1 | |||
| C031 | RET | |||
| Prev: BFB8 | Up: Map | Next: C032 |