![]() |
Routines |
| Prev: CBAC | Up: Map | Next: CC1D |
|
Used by the routines at StartGame and CheckPlayerDead.
Starts a new life for the player: sets up the objects for the player, sets the player's health, uses up a life and shows the lives that are left. The game is over when no lives are left.
|
||||
| StartNewLife | CBC5 | LD HL,$CC36 | Copy the template for the two objects that make up the player (legs and body) into the object table. | |
| CBC8 | LD DE,$BC8E | |||
| CBCB | LD BC,$0020 | |||
| CBCE | LDIR | |||
| CBD0 | LD A,$28 | Set the player's materialise timer to 28. | ||
| CBD2 | LD ($BC02),A | |||
| CBD5 | LD A,$03 | Give the player 03 health. | ||
| CBD7 | LD ($BBF3),A | |||
|
See Infinite Lives.
|
||||
| CBDA | LD HL,$BBCD | Use up a life, and jump to GameOver if there were none left. | ||
| CBDD | DEC (HL) | |||
| CBDE | JP M,GameOver | |||
| CBE1 | CALL ClearShortLivedObjects | Remove the ghosts and other short-lived objects. | ||
| CBE4 | LD IX,$BC8E | Point IX at the player and mark the cell that the player starts in as visited. | ||
| CBE8 | CALL MarkCellVisited_NewCell | |||
|
Draw the lives that are left.
|
||||
| CBEB | LD HL,$7AEF | Set the font to the knight icons, and use bright white ink (attribute 47). | ||
| CBEE | LD ($BBAC),HL | |||
| CBF1 | LD A,$47 | |||
| CBF3 | EX AF,AF' | |||
| CBF4 | LD DE,$CC2E | Point at the characters of an icon, and set the screen address of the first icon to 5045 (in the screen buffer). | ||
| CBF7 | LD HL,$5045 | |||
| CBFA | LD A,($BBCD) | Find the number of lives left, and work out the number of lives that have been used (05 minus the lives left). | ||
| CBFD | LD B,A | |||
| CBFE | NEG | |||
| CC00 | ADD A,$05 | |||
| CC02 | LD C,A | |||
| StartNewLife_LifeLoop | CC03 | LD A,B | Jump to StartNewLife_UsedLives if there are no more lives left to draw. | |
| CC04 | AND A | |||
| CC05 | JR Z,StartNewLife_UsedLives | |||
| CC07 | CALL DrawLifeIcon | Draw an icon, move on two positions and loop back until all of the lives left have been drawn. | ||
| CC0A | INC L | |||
| CC0B | INC L | |||
| CC0C | DJNZ StartNewLife_LifeLoop | |||
| StartNewLife_UsedLives | CC0E | LD A,$41 | Use blue ink (attribute 41) for the lives that have been used. | |
| CC10 | EX AF,AF' | |||
| CC11 | LD A,C | Return if no lives have been used. | ||
| CC12 | AND A | |||
| CC13 | RET Z | |||
| CC14 | LD B,A | Set a counter for the lives that have been used. | ||
| StartNewLife_UsedLoop | CC15 | CALL DrawLifeIcon | Draw an icon, move on two positions and loop back until all of the used lives have been drawn. | |
| CC18 | INC L | |||
| CC19 | INC L | |||
| CC1A | DJNZ StartNewLife_UsedLoop | |||
| CC1C | RET | Return. | ||
| Prev: CBAC | Up: Map | Next: CC1D |