![]() |
Routines |
| Prev: 52278 | Up: Map | Next: 52452 |
|
Used by the routines at StartNewLife and CheckMonstersDefeated.
Shows the game over screen, with the percentage of the game that has been completed and the score, and plays a tune. A new game is started if any of the monsters is still alive. Otherwise all of the monsters have been killed, so the ending is shown.
|
|||||
|
Show the game over screen.
|
|||||
| GameOver | 52310 | CALL CalculatePercentage | Work out the percentage of the game that has been completed. | ||
| 52313 | CALL ClearScreen | Clear the screen and draw the frame. | |||
| 52316 | CALL DrawFrame | ||||
| 52319 | LD HL,34648 | Print "GAME OVER". | |||
| 52322 | LD DE,52655 | ||||
| 52325 | CALL PrintStringWithAttribute | ||||
| 52328 | LD HL,28472 | Print "PERCENTAGE OF GAME". | |||
| 52331 | CALL PrintStringWithAttribute | ||||
| 52334 | LD HL,24392 | Print "COMPLETED =". | |||
| 52337 | CALL PrintStringWithAttribute | ||||
| 52340 | LD HL,18248 | Print "SCORE". | |||
| 52343 | CALL PrintStringWithAttribute | ||||
| 52346 | LD HL,18580 | Use bright cyan ink (attribute 69), and print the percentage at 18580 (in the screen buffer). | |||
| 52349 | LD A,69 | ||||
| 52351 | EX AF,AF' | ||||
| 52352 | CALL PrintPercentage | ||||
| 52355 | LD HL,18672 | Use bright yellow ink (attribute 70), and print the score at 18672 (in the screen buffer). | |||
| 52358 | LD A,70 | ||||
| 52360 | EX AF,AF' | ||||
| 52361 | CALL PrintScore_Position | ||||
|
Play the tune.
|
|||||
| 52364 | LD DE,51203 | Play the game over tune. | |||
| 52367 | CALL PlayMusic | ||||
| 52370 | LD B,4 | Wait for about half a second. | |||
| 52372 | CALL Wait | ||||
|
Start a new game if any of the monsters is still alive.
|
|||||
| 52375 | LD HL,48478 | Point at the first monster, set the distance from one object to the next (16 bytes) and set a counter for the four monsters. | |||
| 52378 | LD DE,16 | ||||
| 52381 | LD B,4 | ||||
| GameOver_CheckMonsters | 52383 | LD A,(HL) | Start a new game, keeping the settings, if this monster is still alive. | ||
| 52384 | SUB 96 | ||||
| 52386 | CP 16 | ||||
| 52388 | JP C,StartGame_KeepSettings | ||||
| 52391 | ADD HL,DE | Move on to the next monster and loop back until all four have been checked. | |||
| 52392 | DJNZ GameOver_CheckMonsters | ||||
|
All four monsters have been killed. Set up the ending.
|
|||||
| 52394 | CALL RemoveAllObjects | Remove all of the objects. | |||
| 52397 | LD IX,48270 | Point IX at the first object, point at the table of pieces for the ending, set the distance from one object to the next (16 bytes) and set a counter for ten pieces. | |||
| 52401 | LD HL,52452 | ||||
| 52404 | LD DE,16 | ||||
| 52407 | LD B,10 | ||||
| GameOver_Pieces | 52409 | LD A,(HL) | Set the type and the velocities of a piece, clear its flags and offsets, and loop back until all ten pieces have been set up. | ||
| 52410 | INC HL | ||||
| 52411 | LD (IX+0),A | ||||
| 52414 | LD A,(HL) | ||||
| 52415 | INC HL | ||||
| 52416 | LD (IX+10),A | ||||
| 52419 | LD A,(HL) | ||||
| 52420 | INC HL | ||||
| 52421 | LD (IX+11),A | ||||
| 52424 | XOR A | ||||
| 52425 | LD (IX+7),A | ||||
| 52428 | LD (IX+12),A | ||||
| 52431 | LD (IX+13),A | ||||
| 52434 | ADD IX,DE | ||||
| 52436 | DJNZ GameOver_Pieces | ||||
| 52438 | CALL ClearScreen | Clear the screen. | |||
| 52441 | LD A,1 | Flag that the game has been finished. | |||
| 52443 | LD (48127),A | ||||
| 52446 | CALL ClearScreenBuffer | Clear the playing area. | |||
| 52449 | JP MainLoop | Jump to MainLoop to show the ending. | |||
| Prev: 52278 | Up: Map | Next: 52452 |