![]() |
Routines |
| Prev: 33742 | Up: Map | Next: 33881 |
|
Used by the routine at FinishPlanet.
Shows the "planet completed" message and sets up the next planet. The text records at PlanetCompleteText are printed, with the name of the planet just finished and the name of the next planet filled in, then the player is rewarded with a sound and a short delay before new item sites are chosen for the next planet.
|
||||
|
Print the first four lines of the message.
|
||||
| CompletePlanet | 33750 | LD DE,33961 | Use the first text record at PlanetCompleteText. | |
| 33753 | LD B,4 | Set a counter in B for four records. | ||
| 33755 | CALL PrintTextRepeatedly | Print the four text records. | ||
|
Fill in the name of the planet just completed.
|
||||
| 33758 | LD A,(62969) | Fetch the planet number from 62969. | ||
| 33761 | ADD A,A | Multiply it by sixteen, the length of a name in PlanetNames. | ||
| 33762 | ADD A,A | |||
| 33763 | ADD A,A | |||
| 33764 | ADD A,A | |||
| 33765 | LD HL,33881 | Use the table of planet names and add the offset. | ||
| 33768 | CALL AddAToHL | |||
| 33771 | LD DE,34053 | Use the planet name slot in the text record at PlanetCompleteText_FirstRecord. | ||
| 33774 | LD C,16 | Set the length of the name in C. | ||
| 33776 | LDIR | Copy the name of the planet just finished into the text record. | ||
|
Fill in the name of the next planet, wrapping round after the last one.
|
||||
| 33778 | LD A,(62969) | Fetch the planet number again. | ||
| 33781 | CP 4 | Jump to CompletePlanet_NextName if it is not the last planet. | ||
| 33783 | JR NZ,CompletePlanet_NextName | |||
| 33785 | LD A,255 | Set the planet number to 255, so that it wraps to zero when incremented below. | ||
| 33787 | LD (62969),A | |||
| 33790 | LD HL,33881 | Use the first planet name. | ||
| CompletePlanet_NextName | 33793 | LD DE,34087 | Use the planet name slot in the text record at 34083. | |
| 33796 | LD C,15 | Set the length of the name in C. | ||
| 33798 | LDIR | Copy the name of the next planet into the text record. | ||
|
Print the planet names, then the rest of the message.
|
||||
| 33800 | LD DE,34049 | Use the text record at PlanetCompleteText_FirstRecord. | ||
| 33803 | CALL PrintText | Print the record. | ||
| 33806 | LD HL,21096 | Set the screen position parameters in 38572... | ||
| 33809 | LD (38572),HL | |||
| 33812 | LD HL,2675 | ...and 38574. | ||
| 33815 | LD (38574),HL | |||
| 33818 | LD A,(62969) | Move on to the next planet number. | ||
| 33821 | INC A | |||
| 33822 | LD (62969),A | |||
| 33825 | LD B,4 | Set a counter in B for four records. | ||
| 33827 | CALL PrintTextRepeatedly | Print the remaining four text records. | ||
|
Reward the player.
|
||||
| 33830 | LD A,6 | Set the bytes at 62977 and 62978 to 6. | ||
| 33832 | LD (62977),A | |||
| 33835 | LD (62978),A | |||
| 33838 | LD B,10 | Set a counter in B for 10 repetitions. | ||
| CompletePlanet_Loop | 33840 | PUSH BC | Save the counter. | |
| 33841 | LD BC,20480 | Add 20480 points to the score of player one. | ||
| 33844 | CALL AddToScore | |||
| 33847 | CALL PlayHitSound | Play the explosion sound. | ||
| 33850 | LD D,255 | Delay for a short while. | ||
| 33852 | CALL Delay | |||
| 33855 | POP BC | Restore the counter. | ||
| 33856 | DJNZ CompletePlanet_Loop | Decrease the counter by one and loop back to CompletePlanet_Loop until none remain. | ||
|
Choose the item sites for the next planet.
|
||||
| 33858 | LD DE,63052 | Use the table of item sites for player two. | ||
| 33861 | LD IY,25019 | Use the list of pool numbers at ItemSitePoolNumbers_End. | ||
| 33865 | CALL ChooseItemSites_ClearUsed | Choose the item sites. | ||
| 33868 | LD A,(51740) | Fetch the player count flag from 51740. | ||
| 33871 | INC A | Turn it into a mask in E. | ||
| 33872 | XOR 3 | |||
| 33874 | CPL | |||
| 33875 | RRCA | |||
| 33876 | RRCA | |||
| 33877 | LD E,A | |||
| 33878 | JP MaskMapTable | Clear the table at MapTable (masked with E) and carry on. | ||
| Prev: 33742 | Up: Map | Next: 33881 |