Prev: D0C8 Up: Map Next: D161
D12A: Lose Life
Used by the routine at StartLife.
Puts the player back as it was when it entered the room, and takes a life off. If there are no lives left the game is over. The player is a human if the sun is out, or a wulf if the moon is out.
LoseLife D12A LD HL,$D161 Point HL at the copy of the player, PlayerCopy.
D12D LD DE,$5C08 Point DE at ObjectsTable.
D130 PUSH DE Point IX at the objects table (using the stack).
D131 POP IX
D133 LD BC,$0040 Set the length to 40, for the two halves of the player.
D136 LDIR Copy the player back.
D138 XOR A Clear the flag that says the player has to transform, TransformFlag.
D139 LD ($5BB1),A
D13C LD HL,$5BBA Take a life off Lives.
D13F DEC (HL)
D140 JP M,GameOver Jump to GameOver if there are none left.
D143 LD A,($C44D) Fetch the graphic number of the sun/moon from SunMoonObject.
D146 RRCA Move bit 0 into bit 5.
D147 RRCA
D148 RRCA
D149 AND %00100000 Keep it, which is 20 if the moon is out.
D14B LD C,A Stash it in C.
D14C LD A,(IX+$10) Fetch the graphic number that the legs of the player will have when it appears.
D14F AND %00011111 Keep the number of the legs of a human.
D151 ADD A,C Add 20 if the moon is out, to make the legs of a wulf.
D152 LD (IX+$10),A Store it.
D155 LD A,(IX+$30) Fetch the graphic number that the top half of the player will have when it appears.
D158 AND %00001111 Keep the number of the top half without the form.
D15A ADD A,C Add 20 if the moon is out.
D15B ADD A,$20 Add 20 to make the top half of a human or of a wulf.
D15D LD (IX+$30),A Store it.
D160 RET Return.
Prev: D0C8 Up: Map Next: D161