![]() |
Routines |
| Prev: D125 | Up: Map | Next: D161 |
|
Used by the routine at player_dies.
Reached at the start of every game and after every death (player_dies). Puts the player's two saved records from plyr_spr_1_scratchpad back into object records 0 and 1 -- the legs and head as they were on entering the current room, but with the materialising type -- and takes a life from $5BBA. When the count goes below zero the game is over.
The game begins with $5BBA at 5, and this first call takes it to 4, so the player has five lives: the fifth death ends the game. Touching the extra-life object (type 103, upd_103) adds one.
The saved records say what the legs and head become once they have materialised (+$10). That is corrected here for the time of day: knight by day, werewolf by night (bit 0 of the sun and moon's type at sun_moon_scratchpad). Werewolf types are the knight's plus 32, so the creature bit is replaced and the frame and facing kept. A transformation that was pending ($5BB1) is cancelled, as the new body is already the right one.
|
||||
| lose_life | D12A | LD HL,plyr_spr_1_scratchpad | copy both 32-byte records; IX = object 0 | |
| D12D | LD DE,$5C08 | |||
| D130 | PUSH DE | |||
| D131 | POP IX | |||
| D133 | LD BC,$0040 | |||
| D136 | LDIR | |||
| D138 | XOR A | no transformation pending | ||
| D139 | LD ($5BB1),A | |||
| D13C | LD HL,$5BBA | one life fewer; below zero is game over | ||
| D13F | DEC (HL) | |||
| D140 | JP M,game_over | |||
| D143 | LD A,(sun_moon_scratchpad) | C = 32 at night, 0 by day | ||
| D146 | RRCA | |||
| D147 | RRCA | |||
| D148 | RRCA | |||
| D149 | AND $20 | |||
| D14B | LD C,A | |||
| D14C | LD A,(IX+$10) | legs: knight legs type (16 to 31), plus 32 at night | ||
| D14F | AND $1F | |||
| D151 | ADD A,C | |||
| D152 | LD (IX+$10),A | |||
| D155 | LD A,(IX+$30) | head: knight head type (32 to 47), plus 32 at night | ||
| D158 | AND $0F | |||
| D15A | ADD A,C | |||
| D15B | ADD A,$20 | |||
| D15D | LD (IX+$30),A | |||
| D160 | RET | |||
| Prev: D125 | Up: Map | Next: D161 |