Prev: A240 Up: Map Next: A311
A2CE: Draw the remaining lives on the scroll
Used by the routines at START_GAME and PLACE_PLAYER.
Draws up to three small figures at the foot of the panel, sixteen pixels apart, in whichever character the player chose. The count comes from $5E21, and the loop always runs three times: the slots past the count are drawn over rather than skipped, so a life that has just been lost is erased.
The sprite is worked out from the menu selection rather than stored. $5E00 holds the character in bits 3 and 4, so shifting it up one and masking to $30 gives $00, $10 or $20, and setting bit 0 makes it $01, $11 or $21 -- the first sprite of the knight, the wizard and the serf. Checked by starting a game as each: $5E00 reads $00, $08 and $10 and the player's own sprite byte comes out $08, $18 and $28, seven along from those bases.
DRAW_LIVES A2CE PUSH IX
A2D0 LD IX,UI_RECORD Not an actor, so borrow UI_RECORD to draw from.
A2D4 LD A,($5E00) Turn the menu selection into the chosen character's first sprite.
A2D7 RLCA
A2D8 AND $30
A2DA OR $01
A2DC LD (IX+$00),A Bright white.
A2DF LD (IX+$05),$47
A2E3 LD HL,$8DC8 The foot of the scroll: x = 200, y = 141.
A2E6 LD (IX+$03),L The record wants x then y, and HL holds them the other way round.
A2E9 LD (IX+$04),H
A2EC LD A,($5E21) Lives remaining, but three slots regardless.
A2EF LD C,A
A2F0 LD B,$03
DRAW_LIVES_0 A2F2 PUSH BC
A2F3 CALL ERASE_STRIP
A2F6 LD A,C
A2F7 AND A
A2F8 JR Z,DRAW_LIVES_1
A2FA CALL DRAW_THING
DRAW_LIVES_1 A2FD LD A,(IX+$03) Sixteen pixels along for the next one.
A300 ADD A,$10
A302 LD (IX+$03),A
A305 POP BC
A306 DEC C Once the count runs out it stays at zero, and the rest are blanks.
A307 JP P,DRAW_LIVES_2
A30A LD C,$00
DRAW_LIVES_2 A30C DJNZ DRAW_LIVES_0
A30E POP IX
A310 RET
Prev: A240 Up: Map Next: A311