Prev: A8B5 Up: Map Next: A94B
A8E3: Game Over
Prints the "GAME OVER PLAYER X" message for the player who has lost their last life. If the lunar rover was destroyed, it also prints "YOUR LUNAR ROVER HAS BEEN DESTROYED." and "ALL IS LOST." before pausing.
Set up altering the "game-over-0up" message for 1UP.
GameOver_1UP_Messaging A8E3 LD A,"1"+$80 A="1" + 80 (bit 7 marks the last character).
Print the altered messaging and pause to show it for a period of time.
GameOver_Write A8E5 LD ($A95D),A Write ASCII player number to A95D.
A8E8 CALL CreateWindow Call CreateWindow.
Handle printing "game-over" messaging.
A8EB LD DE,$A94B DE=String_GameOver.
A8EE LD HL,$7038 HL=7038 (screen location).
A8F1 CALL PrintStringColour Call PrintStringColour.
A8F4 LD DE,$B9D2 DE=Tune_Game_Over.
A8F7 CALL QueueTune Call QueueTune.
Set a lower delay period for the following test.
A8FA LD B,$04 Set a delay counter in B for 04 loops.
A8FC LD A,($6090) A=*Rover_Slot-1A.
A8FF SUB $1A
A901 CP $10 If the lunar rover was not destroyed, jump straight to GameOverDelay.
A903 JR C,GameOverDelay
Handle printing "lunar-rover" messaging.
A905 LD DE,$A95E DE=String_Lunar_Rover.
A908 LD HL,$3818 HL=3818 (screen location).
A90B CALL PrintStringColour Call PrintStringColour.
Handle printing "destroyed" messaging.
A90E LD DE,$A979 DE=String_Destroyed.
A911 LD HL,$4858 HL=4858 (screen location).
A914 CALL PrintStringColour Call PrintStringColour.
Handle printing "all-lost" messaging.
A917 LD DE,$A985 DE=String_All_Lost.
A91A LD HL,$5850 HL=5850 (screen location).
A91D CALL PrintStringColour Call PrintStringColour.
Provide a pause for us to reflect that the game has now ended.
A920 LD B,$08 Set a delay counter in B for 08 loops.
GameOverDelay A922 LD HL,$0000 HL=0000.
Decrementing 0000 by one gives FFFF, so the inner loop runs a full 16-bit count.
GameOverDelay_Loop A925 DEC HL Decrease HL by one.
A926 LD A,H Jump back to GameOverDelay_Loop until HL is zero.
A927 OR L
A928 JR NZ,GameOverDelay_Loop
A92A DJNZ GameOverDelay_Loop Decrease the counter by one and jump back to GameOverDelay_Loop until it is zero.
A92C RET Return.
Set up altering the "game-over-0up" message for 2UP.
GameOver_2UP_Messaging A92D LD A,"2"+$80 A="2" + 80 (bit 7 marks the last character).
A92F JR GameOver_Write Jump to GameOver_Write.
Handles checking if this is a 1UP or 2UP game.
GameOver_Check_Player_1UP A931 LD A,($5E65) If Flag_ActivePlayer is zero, jump to GameOver_1UP_Messaging.
A934 AND A
A935 JR Z,GameOver_1UP_Messaging
A937 JR GameOver_2UP_Messaging Jump to GameOver_2UP_Messaging.
Handles checking if this is a 2UP or 1UP game.
GameOver_Check_Player_2UP A939 LD A,($5E65) If Flag_ActivePlayer is not zero, jump to GameOver_2UP.
A93C AND A
A93D JR NZ,GameOver_2UP
A93F CALL GameOver_1UP_Messaging Call GameOver_1UP_Messaging.
A942 JP NewHighScore Jump to NewHighScore.
Handle 2UP, and then check if this is a new high score.
GameOver_2UP A945 CALL GameOver_2UP_Messaging Call GameOver_2UP_Messaging.
A948 JP NewHighScore Jump to NewHighScore.
View the equivalent code in;
Prev: A8B5 Up: Map Next: A94B