![]() |
Routines |
| Prev: 83CE | Up: Map | Next: 8459 |
|
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 | 83D6 | LD DE,$84A9 | Use the first text record at PlanetCompleteText. | |
| 83D9 | LD B,$04 | Set a counter in B for four records. | ||
| 83DB | CALL PrintTextRepeatedly | Print the four text records. | ||
|
Fill in the name of the planet just completed.
|
||||
| 83DE | LD A,($F5F9) | Fetch the planet number from F5F9. | ||
| 83E1 | ADD A,A | Multiply it by sixteen, the length of a name in PlanetNames. | ||
| 83E2 | ADD A,A | |||
| 83E3 | ADD A,A | |||
| 83E4 | ADD A,A | |||
| 83E5 | LD HL,$8459 | Use the table of planet names and add the offset. | ||
| 83E8 | CALL AddAToHL | |||
| 83EB | LD DE,$8505 | Use the planet name slot in the text record at PlanetCompleteText_FirstRecord. | ||
| 83EE | LD C,$10 | Set the length of the name in C. | ||
| 83F0 | 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.
|
||||
| 83F2 | LD A,($F5F9) | Fetch the planet number again. | ||
| 83F5 | CP $04 | Jump to CompletePlanet_NextName if it is not the last planet. | ||
| 83F7 | JR NZ,CompletePlanet_NextName | |||
| 83F9 | LD A,$FF | Set the planet number to FF, so that it wraps to zero when incremented below. | ||
| 83FB | LD ($F5F9),A | |||
| 83FE | LD HL,$8459 | Use the first planet name. | ||
| CompletePlanet_NextName | 8401 | LD DE,$8527 | Use the planet name slot in the text record at 8523. | |
| 8404 | LD C,$0F | Set the length of the name in C. | ||
| 8406 | LDIR | Copy the name of the next planet into the text record. | ||
|
Print the planet names, then the rest of the message.
|
||||
| 8408 | LD DE,$8501 | Use the text record at PlanetCompleteText_FirstRecord. | ||
| 840B | CALL PrintText | Print the record. | ||
| 840E | LD HL,$5268 | Set the screen position parameters in 96AC... | ||
| 8411 | LD ($96AC),HL | |||
| 8414 | LD HL,$0A73 | ...and 96AE. | ||
| 8417 | LD ($96AE),HL | |||
| 841A | LD A,($F5F9) | Move on to the next planet number. | ||
| 841D | INC A | |||
| 841E | LD ($F5F9),A | |||
| 8421 | LD B,$04 | Set a counter in B for four records. | ||
| 8423 | CALL PrintTextRepeatedly | Print the remaining four text records. | ||
|
Reward the player.
|
||||
| 8426 | LD A,$06 | Set the bytes at F601 and F602 to 06. | ||
| 8428 | LD ($F601),A | |||
| 842B | LD ($F602),A | |||
| 842E | LD B,$0A | Set a counter in B for 0A repetitions. | ||
| CompletePlanet_Loop | 8430 | PUSH BC | Save the counter. | |
| 8431 | LD BC,$5000 | Add 5000 points to the score of player one. | ||
| 8434 | CALL AddToScore | |||
| 8437 | CALL PlayHitSound | Play the explosion sound. | ||
| 843A | LD D,$FF | Delay for a short while. | ||
| 843C | CALL Delay | |||
| 843F | POP BC | Restore the counter. | ||
| 8440 | 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.
|
||||
| 8442 | LD DE,$F64C | Use the table of item sites for player two. | ||
| 8445 | LD IY,$61BB | Use the list of pool numbers at ItemSitePoolNumbers_End. | ||
| 8449 | CALL ChooseItemSites_ClearUsed | Choose the item sites. | ||
| 844C | LD A,($CA1C) | Fetch the player count flag from CA1C. | ||
| 844F | INC A | Turn it into a mask in E. | ||
| 8450 | XOR $03 | |||
| 8452 | CPL | |||
| 8453 | RRCA | |||
| 8454 | RRCA | |||
| 8455 | LD E,A | |||
| 8456 | JP MaskMapTable | Clear the table at MapTable (masked with E) and carry on. | ||
| Prev: 83CE | Up: Map | Next: 8459 |