![]() |
Routines |
| Prev: D1BF | Up: Map | Next: D2BC |
|
Used by the routines at CheckScoreAwardLife and PlayerDeath.
Entry point for wave staging. Resets the entity list write pointer to Entity_List_Base and writes a terminator. If Active_Enemy_Count is non-zero the current wave set is re-populated (Stage_Next_Wave_Populate); otherwise a fresh wave is loaded: enemy parameters are cleared, the next entry in the wave definition table (Wave_Definition_Pointer) is read, the display is reinitialised via Clear_Screen_And_Render_HUD, and the main game loop is entered via Main_Game_Loop with the playfield entity handler CE62 in place.
|
||||
| Stage_Next_Wave | D24C | LD HL,$6100 | Reset the entity list write pointer to Entity_List_Base. | |
| D24F | LD ($C509),HL | Write the entity list terminator routine address D1A4 and the FF sentinel; store the updated write pointer at Entity_List_Write_Pointer. | ||
| D252 | LD DE,$D1A4 | |||
| D255 | LD (HL),E | |||
| D256 | INC HL | |||
| D257 | LD (HL),D | |||
| D258 | INC HL | |||
| D259 | LD (HL),$FF | |||
| D25B | LD A,($C41C) | Check whether the wave counter at Active_Enemy_Count is non-zero; if so, jump to Stage_Next_Wave_Populate to re-populate the current wave set. | ||
| D25E | AND A | |||
| D25F | JR NZ,Stage_Next_Wave_Populate | |||
|
New wave: clear enemy parameters, read the next wave definition entry, and reinitialise the display.
|
||||
| D261 | LD HL,$C423 | Clear the enemy parameter block at Wave_Enemy_Count (0C bytes) ready for the incoming wave. | ||
| D264 | LD DE,$C424 | |||
| D267 | LD (HL),$00 | |||
| D269 | LD BC,$000C | |||
| D26C | LDIR | |||
| D26E | LD HL,($C409) | Read the new wave number from Wave_Definition_Pointer into WaveNumber, then reinitialise the display via Clear_Screen_And_Render_HUD. | ||
| D271 | LD A,(HL) | |||
| D272 | LD ($C408),A | |||
| D275 | CALL Clear_Screen_And_Render_HUD | |||
| D278 | LD HL,($C409) | Advance the wave definition pointer in Wave_Definition_Pointer past the current entry via DispatchWordFromHL. | ||
| D27B | INC HL | |||
| D27C | CALL DispatchWordFromHL | |||
| D27F | LD ($C409),HL | Store the updated wave definition pointer back to Wave_Definition_Pointer. | ||
| Stage_Next_Wave_Activate | D282 | LD HL,$6000 | Point the playfield write pointer (Playfield_Entity_List_Pointer) to Entity_List and write the playfield entity handler address CE62 to the entity list. | |
| D285 | LD DE,$CE62 | |||
| D288 | LD ($C4D1),HL | |||
| D28B | LD (HL),E | Write the FF end-of-list sentinel after the handler address. | ||
| D28C | INC HL | |||
| D28D | LD (HL),D | |||
| D28E | INC HL | |||
| D28F | LD (HL),$FF | |||
| D291 | LD HL,$C4DE | Set the wave active flag at Wave_Active_Flag to 01 and jump to the main game loop at Main_Game_Loop. | ||
| D294 | LD (HL),$01 | |||
| D296 | JP Main_Game_Loop | |||
|
Re-populate: clear the wave counter, redraw the HUD, and spawn all enemy types for the current wave before restarting the game loop.
|
||||
| Stage_Next_Wave_Populate | D299 | XOR A | Clear the wave counter at Active_Enemy_Count and redraw the HUD via RenderHUD. | |
| D29A | LD ($C41C),A | |||
| D29D | CALL RenderHUD | |||
| D2A0 | LD HL,$C423 | Call Spawn_Primary_Wave_Enemies using Wave_Enemy_Count. | ||
| D2A3 | CALL Spawn_Primary_Wave_Enemies | |||
| D2A6 | CALL Spawn_Wave_Enemies_Class2 | Spawn the secondary wave enemies via Spawn_Wave_Enemies_Class2. | ||
| D2A9 | CALL Spawn_Wave_Enemies | Run the entity update pass via Spawn_Wave_Enemies. | ||
| D2AC | CALL Spawn_Horizontal_Wave_Enemies | Call Spawn_Horizontal_Wave_Enemies. | ||
| D2AF | CALL Evaluate_And_Spawn_Tracked_Enemies | Call Evaluate_And_Spawn_Tracked_Enemies. | ||
| D2B2 | CALL Apply_Wave_Border_Colour | Call Apply_Wave_Border_Colour. | ||
| D2B5 | CALL Spawn_Wall_Bouncing_Enemies | Call Spawn_Wall_Bouncing_Enemies. | ||
| D2B8 | XOR A | Clear A and restart the playfield via Stage_Next_Wave_Activate. | ||
| D2B9 | JP Stage_Next_Wave_Activate | |||
| Prev: D1BF | Up: Map | Next: D2BC |