Prev: C397 Up: Map Next: C3C3
C3A4: Place the sun or moon, and redraw its window
Used by the routine at no_delay.
Once the sun or moon reaches pixel X 225 its half of the day is over and toggle_day_night swaps them. Before that, its height comes from the arc at sun_moon_yoff, one entry for every four pixels across: it climbs, levels off and sinks. Also called directly from no_delay when a room is entered, to draw the window afresh.
Input
IX sun_moon_scratchpad
display_sun_moon_frame C3A4 LD A,($5BC3) the sun stops once the game is complete
C3A7 AND A
C3A8 RET NZ
C3A9 LD A,(IX+$1A) reached the right-hand edge?
C3AC CP $E1
C3AE JR Z,toggle_day_night
C3B0 LD A,(IX+$1A) height = the table entry for ((X + 16) / 4) mod 16; X runs 176 to 224, so the index runs 0 to 12
C3B3 ADD A,$10
C3B5 LD HL,sun_moon_yoff
C3B8 RRCA
C3B9 RRCA
C3BA AND $0F
C3BC CALL add_HL_A
C3BF LD A,(HL)
C3C0 LD (IX+$1B),A
Prev: C397 Up: Map Next: C3C3