![]() |
Routines |
| Prev: 68B8 | Up: Map | Next: 693B |
|
Used by the routines at Initialise_Lives and Handle_Level_Complete.
Prepares the game state for the next level. Increments the current level number, awards an extra life on level 04 loads the worm collection target for the new level from the lookup table, and resets all collected and disabled worm markers in the room attribute data.
|
||||
|
Increment the level counter and check for extra life award.
|
||||
| SetUp_NextLevel | 68F7 | LD A,($5FB1) | Fetch the current level from *CurrentLevel. | |
| 68FA | LD HL,$5FB3 | Point HL at LivesDisplayCharacter. | ||
| 68FD | CP $05 | Jump to SetWorm_Target if this is level 05 (don't increment past the maximum). | ||
| 68FF | JR Z,SetWorm_Target | |||
| 6901 | INC A | Increment the level number and write it back to *CurrentLevel. | ||
| 6902 | LD ($5FB1),A | |||
| 6905 | CP $04 | Jump to SetWorm_Target if the new level is not equal to 04. | ||
| 6907 | JR NZ,SetWorm_Target | |||
|
Award an extra life on level 04.
|
||||
| 6909 | INC (HL) | Increment the lives display character at *HL. | ||
| 690A | LD A,(HL) | |||
| 690B | LD HL,$50F0 | Point HL at 50F0 (screen buffer position for the lives display). | ||
| 690E | CALL PrintCharacter | Call PrintCharacter. | ||
|
Load the worm collection target for the new level.
|
||||
| SetWorm_Target | 6911 | LD A,($5FB1) | Fetch the current level from *CurrentLevel. | |
| 6914 | LD B,$00 | Set BC to the level number minus one as a table index. | ||
| 6916 | LD C,A | |||
| 6917 | DEC C | |||
| 6918 | LD HL,$6961 | Point HL at Table_WormCollectionCount. | ||
| 691B | ADD HL,BC | Add the index to get the table entry address. | ||
| 691C | LD A,(HL) | Write the worm collection count for this level to *WormsRemaining. | ||
| 691D | LD HL,$5FB2 | |||
| 6920 | LD (HL),A | |||
|
Reset all collected and disabled worm markers in the room object data back to 00.
|
||||
| 6921 | LD HL,$DE9E | Point HL at Room_Object_Data. | ||
| 6924 | LD BC,$0160 | Set the byte counter to 0160 in BC. | ||
| ResetWorm_Markers_Loop | 6927 | LD A,(HL) | If *HL equals 1F (delivered marker), write 00 to *HL. | |
| 6928 | CP $1F | |||
| 692A | JR NZ,ResetWorm_Test_Collected | |||
| 692C | LD (HL),$00 | |||
| ResetWorm_Test_Collected | 692E | CP $1E | If *HL equals 1E (collected marker), write 00 to *HL. | |
| 6930 | JR NZ,ResetWorm_Markers_Next | |||
| 6932 | LD (HL),$00 | |||
| ResetWorm_Markers_Next | 6934 | INC HL | Move to the next data byte. | |
| 6935 | DEC BC | Decrease the byte counter by one. | ||
| 6936 | LD A,C | Jump back to ResetWorm_Markers_Loop until all 0160 bytes are processed. | ||
| 6937 | OR B | |||
| 6938 | JR NZ,ResetWorm_Markers_Loop | |||
| 693A | RET | Return. | ||
| Prev: 68B8 | Up: Map | Next: 693B |