Prev: 99AA Up: Map Next: 9A1D
99F0: Next Actor
Moves on to the next actor in the actor table. If a new frame has just started only the player's actor is processed before the interrupted pass carries on; otherwise the loop runs until the end of the actor table is reached.
NextActor 99F0 LD DE,$000C Set the size of an actor record in DE to 0C.
99F3 ADD IX,DE Move onto the next actor.
99F5 PUSH IX Copy the actor pointer to HL (using the stack).
99F7 POP HL
99F8 LD A,($9697) Fetch the frame updated flag from FrameUpdated.
99FB AND A Jump to NextActor_FrameUpdated if the frame has just updated.
99FC JR NZ,NextActor_FrameUpdated
99FE LD DE,$982E Point DE at the end of the actor table at StoredActorTable.
NextActor_Compare 9A01 AND A Subtract the end of the actor table from the actor pointer.
9A02 SBC HL,DE
9A04 JR C,MainLoop_NextActor Jump to MainLoop_NextActor if there are more actors to process.
The end of the range has been reached. If this was just the player's actor then go back to where the interrupted pass left off; otherwise the pass through the actor table is complete.
9A06 LD A,($9697) Fetch the frame updated flag from FrameUpdated.
9A09 AND A Jump to UpdateCounters if the frame has not just updated (every actor has been processed).
9A0A JR Z,UpdateCounters
9A0C LD IX,($96A9) Restore the actor which was being processed before the frame updated from SavedActorPointer.
9A10 XOR A Clear the frame updated flag in FrameUpdated.
9A11 LD ($9697),A
9A14 EI Enable interrupts.
9A15 JP MainLoop_NextActor Jump to MainLoop_NextActor.
The frame has just updated, so only the player's actor is processed before the interrupted pass is resumed (i.e. stop once IX reaches the second actor).
NextActor_FrameUpdated 9A18 LD DE,$970E Point DE at the second actor record at ImmortalData_Actors.
9A1B JR NextActor_Compare Jump to NextActor_Compare.
Prev: 99AA Up: Map Next: 9A1D