Prev: 25832 Up: Map Next: 25892
25844: Handle Cake
The handler for the five pieces of the cake (IDs 44 to 48). Each piece rises until its vertical co-ordinate is 160. Then the music is played (unless the sound is off), and the next level is set up.
Input
IX Actor
HandleCake 25844 CALL StoreEntity Record the position of the sprite using StoreEntity.
25847 LD HL,24347 Increase the number of actors in play (ActorsInPlay) by one.
25850 INC (HL)
25851 LD A,(IX+2) Fetch the vertical co-ordinate of the piece of cake.
25854 CP 160 Jump to HandleCake_Finished if the piece has risen as far as it goes.
25856 JR Z,HandleCake_Finished
25858 DEC (IX+2) Raise the piece of cake by decreasing the vertical co-ordinate by one.
25861 CALL DisplayEntity Erase the sprite and draw it in its new position using DisplayEntity.
25864 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 25867 LD A,(24333) Fetch the sound mute flag.
25870 AND A Is the sound switched off?
25871 JR NZ,HandleCake_Pause Jump to HandleCake_Pause if it is.
25873 LD DE,26074 Point DE at MusicData_LevelFinished.
25876 CALL PlayMusic Play the tune using PlayMusic.
Remove all of the actors, and then set up the next level.
HandleCake_NextLevel 25879 CALL RemoveAllActors Remove all of the actors using RemoveAllActors.
25882 JP SetUpLevel Jump to SetUpLevel.
If the sound is switched off, pause instead of playing the tune.
HandleCake_Pause 25885 LD B,8 Set the number of times to count down for the pause to 8.
25887 CALL PauseForCount Pause using PauseForCount.
25890 JR HandleCake_NextLevel Jump to HandleCake_NextLevel.
Prev: 25832 Up: Map Next: 25892