Prev: 59344 Up: Map Next: 59429
59363: Handle Death
Handler for the object types 62 and 63 the sprites that Sabreman has when he dies (see Start_Dying). The sprite is drawn until the countdown in byte 10 reaches zero. Then he loses a life and the game is over if he has none left (see Show_Game_Over).
Otherwise his position is saved (see Saved_Position), all of the object records are cleared (see Clear_Object_Records), Sabreman is reset (see Reset_Sabreman), his position is put back and the room is drawn again, so he carries on where he died.
Input
IX Object record of Sabreman
Handle_Death 59363 CALL StoreEntity Save the state of Sabreman.
59366 DEC (IX+10) Jump to Update_Object_Sprite if the countdown is not zero.
59369 JP NZ,Update_Object_Sprite
59372 LD A,(36570) Fetch the number of lives.
59375 DEC A Jump to Handle_Death_Game_Over if he had none left.
59376 JP M,Handle_Death_Game_Over
59379 DAA Adjust the result to a BCD value.
59380 LD (36570),A Store the number of lives.
59383 CALL Draw_Lives_Print_Number Print the number of lives.
59386 LD HL,(36635) Fetch the x position and the room x of Sabreman.
59389 LD (36571),HL Save them.
59392 LD HL,(36637) Fetch the y position and the room y of Sabreman.
59395 LD (36573),HL Save them.
59398 CALL Clear_Object_Records Clear the object records.
59401 CALL Reset_Sabreman Reset Sabreman.
59404 LD HL,(36571) Fetch the saved x position and room x.
59407 LD (36635),HL Put them back in the record of Sabreman.
59410 LD HL,(36573) Fetch the saved y position and room y.
59413 LD (36637),HL Put them back in the record of Sabreman.
59416 LD A,16 Set the contact flags of Sabreman to 16 so that he stands on a floor.
59418 LD (36645),A
59421 CALL Draw_Room Draw the room.
59424 RET Return.
Handle_Death_Game_Over 59425 POP HL Discard the return address.
59426 JP Show_Game_Over Show the game over message.
Prev: 59344 Up: Map Next: 59429