Prev: 64E8 Up: Map Next: 6524
64F4: Handle Cake
The handler for the five pieces of the cake (IDs 2C to 30). Each piece rises until its vertical co-ordinate is A0. Then the music is played (unless the sound is off), and the next level is set up.
Input
IX Actor
HandleCake 64F4 CALL StoreEntity Record the position of the sprite using StoreEntity.
64F7 LD HL,$5F1B Increase the number of actors in play (ActorsInPlay) by one.
64FA INC (HL)
64FB LD A,(IX+$02) Fetch the vertical co-ordinate of the piece of cake.
64FE CP $A0 Jump to HandleCake_Finished if the piece has risen as far as it goes.
6500 JR Z,HandleCake_Finished
6502 DEC (IX+$02) Raise the piece of cake by decreasing the vertical co-ordinate by one.
6505 CALL DisplayEntity Erase the sprite and draw it in its new position using DisplayEntity.
6508 JP ColourSprite Jump to ColourSprite to colour the sprite.
All of the pieces of the cake stop at the same height, so the first one to be handled does the following; it plays the tune for a level finishing and then goes on to the next level.
HandleCake_Finished 650B LD A,($5F0D) Fetch the sound mute flag.
650E AND A Is the sound switched off?
650F JR NZ,HandleCake_Pause Jump to HandleCake_Pause if it is.
6511 LD DE,$65DA Point DE at MusicData_LevelFinished.
6514 CALL PlayMusic Play the tune using PlayMusic.
Remove all of the actors, and then set up the next level.
HandleCake_NextLevel 6517 CALL RemoveAllActors Remove all of the actors using RemoveAllActors.
651A JP SetUpLevel Jump to SetUpLevel.
If the sound is switched off, pause instead of playing the tune.
HandleCake_Pause 651D LD B,$08 Set the number of times to count down for the pause to 08.
651F CALL PauseForCount Pause using PauseForCount.
6522 JR HandleCake_NextLevel Jump to HandleCake_NextLevel.
Prev: 64E8 Up: Map Next: 6524