![]() |
Routines |
| Prev: 47637 | Up: Map | Next: 47771 |
|
Ends the game, whether the player has run out of lives, the forty days have passed or the final sparkles have caught the player. If the game was completed, the message of the potion is shown first. The results screen shows the days that have passed, the percentage of the quest that was completed, the number of charms collected and a rating. The game then returns to the menu when a key is pressed.
|
||||||
| GameOver | 47650 | LD A,(23491) | Fetch the flag that is set when the game has been completed from FinalAnimationFlag. | |||
| 47653 | AND A | Test it. | ||||
| 47654 | JP NZ,GameCompleted | Show the message of the potion first if the game has been completed. | ||||
|
This entry point is used by the routine at GameCompleted.
Show the results screen.
|
||||||
| GameOver_ShowResults | 47657 | CALL ClearScreenBuffer | Clear the screen buffer. | |||
| 47660 | CALL ClearScreen | Clear the screen and make the border black. | ||||
| 47663 | LD DE,47948 | Point DE at GameOverColours. | ||||
| 47666 | EXX | Switch to the alternate registers to keep it there. | ||||
| 47667 | LD HL,47954 | Point HL at GameOverCoordinates. | ||||
| 47670 | LD DE,47966 | Point DE at GameOverText. | ||||
| 47673 | LD B,6 | Set the number of lines of text to 6. | ||||
| 47675 | CALL DisplayTextList | Print the lines of text. | ||||
| 47678 | LD HL,59618 | Point HL at ScreenBuffer_ResultsDays. | ||||
| 47681 | LD DE,23481 | Point DE at Days. | ||||
| 47684 | LD B,1 | Set the number of bytes to print to 1. | ||||
| 47686 | CALL PrintBCDNumber | Print the number of days. | ||||
| 47689 | CALL PrintPercentageComplete | Print the percentage of the quest that was completed. | ||||
|
Work out the rating from the number of rooms visited and from whether the game was completed.
|
||||||
| 47692 | LD A,(23494) | Fetch the number of rooms visited, less one from RoomsVisited. | ||||
| 47695 | RLCA | Rotate the highest bit round to the lowest. | ||||
| 47696 | AND %11000000 | Keep the next two highest bits (the number of rooms divided by 32). | ||||
| 47698 | LD C,A | Stash them in C. | ||||
| 47699 | LD A,(23491) | Fetch the flag that is set when the game has been completed from FinalAnimationFlag. | ||||
| 47702 | AND %00000001 | Keep only the lowest bit. | ||||
| 47704 | OR C | Combine it with the number of rooms. | ||||
| 47705 | RLCA | Rotate the bits into place to make the number of a word. | ||||
| 47706 | RLCA | |||||
| 47707 | RLCA | |||||
| 47708 | AND %00001110 | Keep the bits of the number of the word. | ||||
| 47710 | LD L,A | Set HL to the number of bytes into the table of ratings. | ||||
| 47711 | LD H,0 | |||||
| 47713 | LD BC,48055 | Point BC at RatingTable. | ||||
| 47716 | ADD HL,BC | Point HL at the entry for the rating. | ||||
| 47717 | LD E,(HL) | Fetch the low byte of the address of the text of the rating. | ||||
| 47718 | INC HL | Move on to the high byte. | ||||
| 47719 | LD D,(HL) | Fetch the high byte. | ||||
| 47720 | LD HL,10072 | Set HL to the position of the rating. | ||||
| 47723 | CALL PrintTextStandardFont | Print the rating. | ||||
|
Print the number of charms collected, which is the number of objects that were put into the cauldron.
|
||||||
| 47726 | LD DE,23483 | Point DE at Charms. | ||||
| 47729 | LD A,(DE) | Fetch the number of charms. | ||||
| 47730 | SUB 10 | Take off 10 to see if the number is in double digits. | ||||
| 47732 | JR C,GameOver_PrintCharms | Jump to GameOver_PrintCharms if it is not. | ||||
| 47734 | OR %00010000 | Convert it to a BCD number between 16 and 20. | ||||
| 47736 | LD (DE),A | Store the BCD number. | ||||
| GameOver_PrintCharms | 47737 | LD HL,58090 | Point HL at the position of the charms in the screen buffer, ScreenBuffer_ResultsCharms. | |||
| 47740 | LD B,1 | Set the number of bytes to print to 1. | ||||
| 47742 | CALL PrintBCDNumber | Print the number of charms collected. | ||||
| 47745 | CALL PrintBorder | Draw the border. | ||||
| 47748 | CALL UpdateScreen | Copy the screen buffer to the display. | ||||
|
Play the tune, wait for a key to be pressed and then go back to the menu.
|
||||||
| GameOver_WaitForKeyRelease | 47751 | XOR A | Select all the half-rows of the keyboard. | |||
| 47752 | CALL ReadKeyboardPort | Read the keyboard. | ||||
| 47755 | JR NZ,GameOver_WaitForKeyRelease | Jump to GameOver_WaitForKeyRelease until all the keys are released. | ||||
| 47757 | LD DE,45592 | Point DE at GameOverTune. | ||||
| 47760 | CALL PlayMusic_WaitKey | Play the tune, until a key is pressed. | ||||
| 47763 | LD B,8 | Set the number of times to wait to 8. | ||||
| 47765 | CALL WaitForKeyPress | Wait for a key to be pressed, up to a limit. | ||||
| 47768 | JP RestartGame | Go back to the menu, to start another game. | ||||
| Prev: 47637 | Up: Map | Next: 47771 |