Prev: 53877 Up: Map Next: 53930
53884: Draw Lives
Used by the routines at CheckSheriffLost and DrawGameScreen.
Draws 4 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 53884 LD A,(41575) Fetch TownOffset.
53887 AND A
53888 RET Z Return if this is not the town.
Draw the hats for the lives which are left.
53889 LD A,70 Set the attribute to INK:YELLOW, PAPER:BLACK (BRIGHT).
53891 EX AF,AF'
53892 LD HL,20544 Point HL at 20544 (in the screen buffer).
53895 LD A,(41571) Fetch Lives.
Draw that many hats.
53898 CALL DrawLifeIcons Call DrawLifeIcons.
Draw the hats for the lives which have been lost.
53901 XOR A Set the attribute to INK:BLACK, PAPER:BLACK.
53902 EX AF,AF'
53903 LD A,(41571) Fetch Lives.
53906 NEG Find 4 minus the number of lives.
53908 ADD A,4
Draw hats from LifeIconTiles, each of 2 tiles wide and 3 high, from left to right.
DrawLifeIcons 53910 AND A Return if there are no hats.
53911 RET Z
Draw a hat.
53912 PUSH AF Stash the number on the stack.
53913 LD DE,53930 Point DE at LifeIconTiles, and set the size to 2 by 3.
53916 LD BC,515
53919 PUSH HL Stash the screen address on the stack.
Draw the hat.
53920 CALL DrawTileBlock Call DrawTileBlock.
53923 POP HL Restore the screen address from the stack.
Move on to the next hat.
53924 INC L Move on two columns.
53925 INC L
53926 POP AF Restore the number from the stack.
53927 DEC A Count it down.
53928 JR DrawLifeIcons Jump to DrawLifeIcons.
Prev: 53877 Up: Map Next: 53930