Prev: 26783 Up: Map Next: 26871
26808: Handle Level Complete
Used by the routine at Position_Worm_In_Beak.
Called after a worm is delivered to check if all worms have been collected. Decrements the worms remaining counter and if zero, plays a completion jingle, advances to the next room and sets up the new level.
Handle_Level_Complete 26808 LD HL,24498 Decrease *WormsRemaining by one.
26811 DEC (HL)
26812 RET NZ Return if the worms remaining counter is not zero.
26813 PUSH IX Stash IX on the stack.
26815 LD B,40 Set a sound step counter in B of 40 steps.
26817 LD HL,800 HL=800 (initial sound pitch).
26820 LD DE,8 DE=8 (pitch step per iteration).
Play the level complete sound effect.
Level_Complete_Sound_Loop 26823 CALL LevelCompleteSoundStep Call LevelCompleteSoundStep.
26826 DJNZ Level_Complete_Sound_Loop Decrease the step counter by one and loop back to Level_Complete_Sound_Loop until the sound is complete.
26828 LD A,15 Write 15 to;
26830 LD (23624),A
26833 LD (24509),A
26836 LD A,1 Set border to BLUE.
26838 OUT (254),A
26840 POP IX Restore IX from the stack.
26842 CALL SetUp_NextLevel Call SetUp_NextLevel.
Locate the level splash screen.
26845 LD A,(24497) Fetch the current level from *CurrentLevel.
26848 ADD A,11 Add 11 (the total number of rooms) to calculate the pointer to the level splash screen.
26850 LD (24517),A Write the result to *CurrentRoom.
26853 CALL PopulateRoomBuffer Call PopulateRoomBuffer.
26856 LD HL,64505 HL=Audio_LevelCompleteJingle.
26859 CALL PlaySound Call PlaySound.
26862 DI Disable interrupts.
26863 CALL SetUpNewLevel Call SetUpNewLevel.
26866 XOR A Write 0 to *PercyFacingDirection (Percy is facing right).
26867 LD (24485),A
26870 RET Return.
Prev: 26783 Up: Map Next: 26871