Prev: E7D0 Up: Map Next: E825
E7E3: Handle Death
Handler for the object types 3E and 3F the sprites that Sabreman has when he dies (see Start_Dying). The sprite is drawn until the countdown in byte 0A 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 E7E3 CALL StoreEntity Save the state of Sabreman.
E7E6 DEC (IX+$0A) Jump to Update_Object_Sprite if the countdown is not zero.
E7E9 JP NZ,Update_Object_Sprite
E7EC LD A,($8EDA) Fetch the number of lives.
E7EF DEC A Jump to Handle_Death_Game_Over if he had none left.
E7F0 JP M,Handle_Death_Game_Over
E7F3 DAA Adjust the result to a BCD value.
E7F4 LD ($8EDA),A Store the number of lives.
E7F7 CALL Draw_Lives_Print_Number Print the number of lives.
E7FA LD HL,($8F1B) Fetch the x position and the room x of Sabreman.
E7FD LD ($8EDB),HL Save them.
E800 LD HL,($8F1D) Fetch the y position and the room y of Sabreman.
E803 LD ($8EDD),HL Save them.
E806 CALL Clear_Object_Records Clear the object records.
E809 CALL Reset_Sabreman Reset Sabreman.
E80C LD HL,($8EDB) Fetch the saved x position and room x.
E80F LD ($8F1B),HL Put them back in the record of Sabreman.
E812 LD HL,($8EDD) Fetch the saved y position and room y.
E815 LD ($8F1D),HL Put them back in the record of Sabreman.
E818 LD A,$10 Set the contact flags of Sabreman to 10 so that he stands on a floor.
E81A LD ($8F25),A
E81D CALL Draw_Room Draw the room.
E820 RET Return.
Handle_Death_Game_Over E821 POP HL Discard the return address.
E822 JP Show_Game_Over Show the game over message.
Prev: E7D0 Up: Map Next: E825