Prev: 27960 Up: Map Next: 28007
27973: Create Introduction Ingredient
Used by the routine at StartLevelIntroduction.
Clears the screen and the attributes, and creates the actor for the ingredient which is needed for the level in the first of the six actor slots, using the data at IntroductionIngredients for the level (bits 0-2 of ActivePlayer_Level). The actor is created by CreateIntroductionActor.
CreateIntroductionIngredient 27973 XOR A Clear the flag which says whether Charlie is running (CharlieRunningFlag).
27974 LD (24361),A
Self modifying code; this updates the command at 29973 to "CP 30", so the colouring can go further to the right.
27977 LD A,30 Write 30 to 29974.
27979 LD (29974),A
27982 CALL ResetAttributes Reset the attribute buffer using ResetAttributes.
27985 CALL ResetScreen Reset the screen buffer using ResetScreen.
27988 LD HL,28029 Point HL at IntroductionIngredients.
27991 LD A,(24365) Fetch the level of the active player.
27994 LD C,6 C=6 (the ID for the ingredient).
27996 RLCA Multiply the level by two, as there are two bytes of data for each level.
27997 AND %00001111 Keep only bits 0-3.
27999 LD E,A Use the result as the offset into the table.
28000 LD D,0
28002 ADD HL,DE Find the data for the level.
28003 EX DE,HL DE=the address of the data for the level.
28004 LD HL,24405 Point HL at the first spawned actor slot (ActorSpawnSlots).
Prev: 27960 Up: Map Next: 28007