Prev: 6AA0 Up: Map Next: 6B18
6AFC: Convert Actors
Used by the routines at LoseHat and TakeIngredients.
Changes every actor in the six slots from ActorSpawnSlots into ID 0F so they can be cleared away by HandleClearedActor. The original ID is kept in byte 04 of the actor, and byte 05 is set to 01.
ConvertActors 6AFC LD HL,$5F55 Point HL at the first spawned actor.
6AFF LD DE,$0004 Set the offset to byte 04 of an actor.
6B02 LD B,$06 Set the actor counter to 06.
ConvertActors_Loop 6B04 LD A,(HL) Fetch the actor ID.
6B05 AND A Is the slot empty?
6B06 JR Z,ConvertActors_Empty Jump to ConvertActors_Empty if it is.
6B08 LD C,A Keep the actor ID in C.
6B09 LD (HL),$0F Change the ID to 0F (the cleared actor).
6B0B ADD HL,DE Move on to byte 04 of the actor.
6B0C LD (HL),C Write the original ID to byte 04 of the actor.
6B0D INC HL Move on to byte 05 of the actor.
6B0E LD (HL),$01 Write 01 to byte 05 of the actor.
6B10 DEC HL Move back to byte 04 of the actor.
6B11 JR ConvertActors_Next Jump to ConvertActors_Next.
ConvertActors_Empty 6B13 ADD HL,DE Move on to byte 04 of the actor.
ConvertActors_Next 6B14 ADD HL,DE Move on to the next actor.
6B15 DJNZ ConvertActors_Loop Decrease the actor counter by one and loop back to ConvertActors_Loop until all six actors have been done.
6B17 RET Return.
Prev: 6AA0 Up: Map Next: 6B18