Prev: 29080 Up: Map Next: 29144
29091: Next Actor
Every actor handler returns here. Moves on to the next actor, and goes back to MainLoop until the last one has been done. After the last actor the game is paused while "SHIFT" is held down, the frame counter at FrameCounter is increased, and the number of actors which were in play is saved in ActorsInPlay_Last. If there are no actors in play and no ingredients are needed then the level is finished. Otherwise the actors are created by CreateActor.
NextActor 29091 LD DE,8 Move on to the next actor by adding 8 to IX.
29094 ADD IX,DE
29096 PUSH IX Copy the pointer to the actor into HL, using the stack.
29098 POP HL
Self modifying code; the operand of this command is written as 24405 by FrameUpdate (for the extra pass over the first four actors) and as 24453 by ResetModifiedCode (the end of the last actor).
29099 LD BC,24453 Fetch the address of the end of the actors (24453).
29102 AND A Subtract the end of the actors from the pointer.
29103 SBC HL,BC
29105 JP C,MainLoop Jump to MainLoop if the last actor has not been done yet.
Holding "SHIFT" pauses the game.
NextActor_Pause 29108 LD A,254 Read from the keyboard;
Port Number Bit
0 1 2 3 4
254 SHIFT Z X C V
29110 OUT (253),A
29112 IN A,(254)
29114 BIT 0,A Jump to NextActor_Pause if key "SHIFT" has been pressed.
29116 JR Z,NextActor_Pause
Self modifying code; this command is changed to JP FrameUpdateEnd by FrameUpdate, to end the extra pass over the first four actors, and is put back by ResetModifiedCode.
NextActor_FrameCounter 29118 LD HL,(24349) Fetch the frame counter.
29121 INC HL Increase the frame counter by one.
29122 LD (24349),HL Update the frame counter.
29125 LD A,(24347) Fetch the number of actors in play.
29128 LD (24348),A Remember the number of actors in play for the next pass (ActorsInPlay_Last).
29131 LD B,A Keep the number of actors in play in B.
29132 LD A,(24367) Fetch the number of ingredients which the active player needs.
29135 OR B Combine with the number of actors in play.
29136 JR NZ,CreateActor Jump to CreateActor if there are still actors in play, or ingredients needed.
The level has been finished, so remove all of the actors, and move on to the next level.
29138 CALL RemoveAllActors Remove all of the actors using RemoveAllActors.
29141 CALL NextLevel Set up the next level using NextLevel.
Prev: 29080 Up: Map Next: 29144