Prev: D275 Up: Map Next: D2AA
D27C: Draw Lives
Used by the routines at CheckSheriffLost and DrawGameScreen.
Draws 04 sheriff hats from LifeIconTiles in the lower left of the town screen. The hats for the lives in Lives are in INK:YELLOW, PAPER:BLACK (BRIGHT), and the hats for the lives which have been lost are in black. This does nothing when TownOffset is zero.
lives
Return if this is not the town.
DrawLives D27C LD A,($A267) Fetch TownOffset.
D27F AND A
D280 RET Z Return if this is not the town.
Draw the hats for the lives which are left.
D281 LD A,$46 Set the attribute to INK:YELLOW, PAPER:BLACK (BRIGHT).
D283 EX AF,AF'
D284 LD HL,$5040 Point HL at 5040 (in the screen buffer).
D287 LD A,($A263) Fetch Lives.
Draw that many hats.
D28A CALL DrawLifeIcons Call DrawLifeIcons.
Draw the hats for the lives which have been lost.
D28D XOR A Set the attribute to INK:BLACK, PAPER:BLACK.
D28E EX AF,AF'
D28F LD A,($A263) Fetch Lives.
D292 NEG Find 04 minus the number of lives.
D294 ADD A,$04
Draw hats from LifeIconTiles, each of 02 tiles wide and 03 high, from left to right.
DrawLifeIcons D296 AND A Return if there are no hats.
D297 RET Z
Draw a hat.
D298 PUSH AF Stash the number on the stack.
D299 LD DE,$D2AA Point DE at LifeIconTiles, and set the size to 02 by 03.
D29C LD BC,$0203
D29F PUSH HL Stash the screen address on the stack.
Draw the hat.
D2A0 CALL DrawTileBlock Call DrawTileBlock.
D2A3 POP HL Restore the screen address from the stack.
Move on to the next hat.
D2A4 INC L Move on two columns.
D2A5 INC L
D2A6 POP AF Restore the number from the stack.
D2A7 DEC A Count it down.
D2A8 JR DrawLifeIcons Jump to DrawLifeIcons.
Prev: D275 Up: Map Next: D2AA