![]() |
Routines |
| Prev: 41536 | Up: Map | Next: 41745 |
|
Used by the routines at StartGame and PreparePlayer.
Draws an icon of the character for each life that the player has left (up to three) in the side panel, and clears the icon of each life that has been lost. The icon is the first sprite of the character that was chosen in the menu (GameOptions bits 3-4).
|
||||||||
| DisplayPlayerLives | 41678 | PUSH IX | Stash IX on the stack. | |||||
| 41680 | LD IX,41341 | Point IX at the entity to draw at EntityToDraw. | ||||||
| 41684 | LD A,(24064) | Fetch the character that was chosen from GameOptions. | ||||||
| 41687 | RLCA | Rotate left once. | ||||||
| 41688 | AND %00110000 | Keep only bits 4-5. | ||||||
| 41690 | OR %00000001 | Set bit 0, to get the first sprite of the character (1 17 or 33). | ||||||
| 41692 | LD (IX+0),A | Write the sprite ID to *IX+0. | ||||||
| 41695 | LD (IX+5),71 | Write 71 (the attribute) to *IX+5. | ||||||
| 41699 | LD HL,36296 | HL=36296 (the Y position is 141 and the X position is 200). | ||||||
| 41702 | LD (IX+3),L | Write the X position to *IX+3. | ||||||
| 41705 | LD (IX+4),H | Write the Y position to *IX+4. | ||||||
| 41708 | LD A,(24097) | Fetch the number of lives from PlayerLives and keep the number of lives left to draw in C. | ||||||
| 41711 | LD C,A | |||||||
| 41712 | LD B,3 | B=3 (the number of icons). | ||||||
| DisplayPlayerLives_Loop | 41714 | PUSH BC | Stash the counters on the stack. | |||||
| 41715 | CALL ClearSprite | Clear the icon with ClearSprite. | ||||||
| 41718 | LD A,C | Fetch the number of lives left to draw. | ||||||
| 41719 | AND A | Jump to DisplayPlayerLives_Next if there are no lives left to draw. | ||||||
| 41720 | JR Z,DisplayPlayerLives_Next | |||||||
| 41722 | CALL DrawEntity | Draw the icon with DrawEntity. | ||||||
| DisplayPlayerLives_Next | 41725 | LD A,(IX+3) | Fetch the X position. | |||||
| 41728 | ADD A,16 | Add 16 to move on to the next icon. | ||||||
| 41730 | LD (IX+3),A | Write the X position back to *IX+3. | ||||||
| 41733 | POP BC | Restore the counters from the stack. | ||||||
| 41734 | DEC C | Decrease the number of lives left to draw by one, and jump to DisplayPlayerLives_Count if it is not negative. | ||||||
| 41735 | JP P,DisplayPlayerLives_Count | |||||||
| 41738 | LD C,0 | C=0 (no lives left to draw). | ||||||
| DisplayPlayerLives_Count | 41740 | DJNZ DisplayPlayerLives_Loop | Decrease the icon counter by one and loop back to DisplayPlayerLives_Loop until it is zero. | |||||
| 41742 | POP IX | Restore IX from the stack. | ||||||
| 41744 | RET | Return. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 41536 | Up: Map | Next: 41745 |