Prev: A35F Up: Map Next: A38C
A373: Set prisoners and guards route (variant "B")
This sets joint routes for all characters in prisoners_and_guards.
The first half of the list (guards 12,13 and prisoners 1,2,3) are set to the route passed in (A',C). The second half of the list (guards 14,15 and prisoners 4,5,6) are set to route (A'+1,C).
Input
A' Route index.
C Route step.
set_prisoners_and_guards_route_B A373 LD HL,$A27F Point HL at prisoners_and_guards table of character indices
A376 LD B,$0A Iterate over the ten entries
Start loop
set_prisoners_and_guards_route_B_0 A378 PUSH HL Save
A379 PUSH BC Save
A37A LD A,(HL) Fetch the character index
A37B CALL set_character_route Set the route for the character
A37E POP BC Check the loop index
When this is 6, the character being processed is character_22_PRISONER_3 and the next is character_14_GUARD_14, the start of the second half of the list.
A37F LD A,B Is it six?
A380 CP $06
A382 JR NZ,set_prisoners_and_guards_route_B_1 Jump over if not
A384 EX AF,AF' Otherwise increment the route index
A385 INC A
A386 EX AF,AF'
set_prisoners_and_guards_route_B_1 A387 POP HL Restore
A388 INC HL Advance to the next character
A389 DJNZ set_prisoners_and_guards_route_B_0 ...loop
A38B RET Return
Prev: A35F Up: Map Next: A38C