Prev: 689F Up: Map Next: 68F7
68B8: 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 68B8 LD HL,$5FB2 Decrease *WormsRemaining by one.
68BB DEC (HL)
68BC RET NZ Return if the worms remaining counter is not zero.
68BD PUSH IX Stash IX on the stack.
68BF LD B,$28 Set a sound step counter in B of 28 steps.
68C1 LD HL,$0320 HL=0320 (initial sound pitch).
68C4 LD DE,$0008 DE=08 (pitch step per iteration).
Play the level complete sound effect.
Level_Complete_Sound_Loop 68C7 CALL LevelCompleteSoundStep Call LevelCompleteSoundStep.
68CA DJNZ Level_Complete_Sound_Loop Decrease the step counter by one and loop back to Level_Complete_Sound_Loop until the sound is complete.
68CC LD A,$0F Write 0F to;
68CE LD ($5C48),A
68D1 LD ($5FBD),A
68D4 LD A,$01 Set border to BLUE.
68D6 OUT ($FE),A
68D8 POP IX Restore IX from the stack.
68DA CALL SetUp_NextLevel Call SetUp_NextLevel.
Locate the level splash screen.
68DD LD A,($5FB1) Fetch the current level from *CurrentLevel.
68E0 ADD A,$0B Add 0B (the total number of rooms) to calculate the pointer to the level splash screen.
68E2 LD ($5FC5),A Write the result to *CurrentRoom.
68E5 CALL PopulateRoomBuffer Call PopulateRoomBuffer.
68E8 LD HL,$FBF9 HL=Audio_LevelCompleteJingle.
68EB CALL PlaySound Call PlaySound.
68EE DI Disable interrupts.
68EF CALL SetUpNewLevel Call SetUpNewLevel.
68F2 XOR A Write 00 to *PercyFacingDirection (Percy is facing right).
68F3 LD ($5FA5),A
68F6 RET Return.
Prev: 689F Up: Map Next: 68F7