![]() |
Routines |
| Prev: C0EA | Up: Map | Next: C152 |
|
Used by the routine at draw_star_layer.
Called by draw_star_layer for each star. The first code map typed these bytes as data, because no session then flew high enough for stars; the tour at map row 3 runs them.
The new x is the star's x (flag off) plus the layer's x offset, and the star is out of sight unless that is between 8 and $E7 (inside the frame); the new y is the star's y plus the layer's y offset, out of sight unless between $18 and $B8. In map row 3, the lowest with stars, it is also out of sight once it is level with or below the top of the landscape (y against the complement of the view's y less $31), so stars do not show through the hills.
|
||||||||
| star_in_sight | C10E | LD HL,(star_layer_pointer) | The layer's offsets and the star. | |||||
| C111 | LD DE,(star_pointer) | |||||||
| C115 | LD A,(DE) | |||||||
| C116 | AND $FE | x: inside 8 to $E7, or out of sight; into the mover's new x (old_sprite_x's second pair). | ||||||
| C118 | ADD A,(HL) | |||||||
| C119 | SUB $08 | |||||||
| C11B | CP $E0 | |||||||
| C11D | JR NC,star_in_sight_1 | |||||||
| C11F | ADD A,$08 | |||||||
| C121 | LD (new_sprite_x),A | |||||||
| C124 | INC DE | |||||||
| C125 | INC HL | |||||||
| C126 | LD A,(DE) | y: inside $18 to $B8, or out of sight. | ||||||
| C127 | ADD A,(HL) | |||||||
| C128 | SUB $18 | |||||||
| C12A | CP $A1 | |||||||
| C12C | JR NC,star_in_sight_1 | |||||||
| C12E | ADD A,$18 | Into the mover's new y. In map row 3 ... | ||||||
| C130 | LD (new_sprite_y),A | |||||||
| C133 | LD A,(view_row) | |||||||
| C136 | CP $03 | ... the star must be above the top of the landscape. | ||||||
| C138 | JR NZ,star_in_sight_0 | |||||||
| C13A | LD A,(view_y) | |||||||
| C13D | CPL | |||||||
| C13E | SUB $31 | In sight: say there is something to draw (star_drawn) and return NZ; out of sight return Z. | ||||||
| C140 | LD B,A | |||||||
| C141 | LD A,(new_sprite_y) | |||||||
| C144 | CP B | |||||||
| C145 | JR NC,star_in_sight_1 | |||||||
| star_in_sight_0 | C147 | LD A,(star_drawn) | ||||||
| C14A | OR $01 | |||||||
| C14C | LD (star_drawn),A | |||||||
| C14F | RET | |||||||
| star_in_sight_1 | C150 | XOR A | ||||||
| C151 | RET | |||||||
| Prev: C0EA | Up: Map | Next: C152 |