Prev: 27531 Up: Map Next: 27616
27567: Handle End Of Life
The handler for Charlie's actor slot once he has fallen to the bottom of the screen (ID 24). Nothing happens until all of the other actors have gone. Then, if the game is for one player, or the other player has no lives left, the game goes on with StartLife if the active player has a life left, and is over (see GameOver_ControllerRestart) if not. In a two player game, when both players have lives left, the players swap. If the active player has just lost the last life then "GAME OVER PLAYER n" is shown for that player first.
Input
IX Actor
HandleEndOfLife 27567 LD A,(24348) Fetch the number of actors which were in play on the last pass.
27570 AND A Were there any actors in play on the last pass?
27571 RET NZ Return if there were.
27572 LD A,(24332) Fetch the game options.
27575 AND A Are the game options zero (a 1UP game with the keyboard)?
27576 JR NZ,HandleEndOfLife_TwoPlayer Jump to HandleEndOfLife_TwoPlayer if the options are not zero.
HandleEndOfLife_OnePlayer 27578 LD A,(24366) Fetch the lives of the active player.
27581 AND A Has the active player run out of lives?
27582 JR Z,GameOver_ControllerRestart Jump to GameOver_ControllerRestart if so.
27584 JP StartLife Jump to StartLife to start the next life.
HandleEndOfLife_TwoPlayer 27587 LD A,(24370) Fetch the lives of the inactive player.
27590 AND A Has the other player run out of lives?
27591 JR Z,HandleEndOfLife_OnePlayer Jump to HandleEndOfLife_OnePlayer if so.
27593 LD A,(24366) Fetch the lives of the active player.
27596 AND A Has the active player run out of lives?
27597 CALL Z,GameOver_Controller Call GameOver_Controller if so, to show the "GAME OVER" message.
27600 CALL ChangePlayer Swap the data for the two players using ChangePlayer.
27603 LD A,(24353) Fetch the active player (0 for 1UP, 255 for 2UP).
27606 CPL Invert A, so the other player is active.
27607 LD (24353),A Update the active player (Flag_ActivePlayer).
27610 CALL StartLevel_TestLevel Draw the window, the pantry and the lives using StartLevel_TestLevel.
27613 JP StartLife Jump to StartLife to start the next life.
Prev: 27531 Up: Map Next: 27616