Prev: 27296 Up: Map Next: 27416
27388: Convert Actors
Used by the routines at LoseHat and TakeIngredients.
Changes every actor in the six slots from ActorSpawnSlots into ID 15 so they can be cleared away by HandleClearedActor. The original ID is kept in byte 4 of the actor, and byte 5 is set to 1.
ConvertActors 27388 LD HL,24405 Point HL at the first spawned actor.
27391 LD DE,4 Set the offset to byte 4 of an actor.
27394 LD B,6 Set the actor counter to 6.
ConvertActors_Loop 27396 LD A,(HL) Fetch the actor ID.
27397 AND A Is the slot empty?
27398 JR Z,ConvertActors_Empty Jump to ConvertActors_Empty if it is.
27400 LD C,A Keep the actor ID in C.
27401 LD (HL),15 Change the ID to 15 (the cleared actor).
27403 ADD HL,DE Move on to byte 4 of the actor.
27404 LD (HL),C Write the original ID to byte 4 of the actor.
27405 INC HL Move on to byte 5 of the actor.
27406 LD (HL),1 Write 1 to byte 5 of the actor.
27408 DEC HL Move back to byte 4 of the actor.
27409 JR ConvertActors_Next Jump to ConvertActors_Next.
ConvertActors_Empty 27411 ADD HL,DE Move on to byte 4 of the actor.
ConvertActors_Next 27412 ADD HL,DE Move on to the next actor.
27413 DJNZ ConvertActors_Loop Decrease the actor counter by one and loop back to ConvertActors_Loop until all six actors have been done.
27415 RET Return.
Prev: 27296 Up: Map Next: 27416