Prev: 7CD0 Up: Map Next: 7CFE
7CE1: Make a character walk up and down a few times or until a certain time
Used by command lists 0x12, 0x2A and 0x2C to make a character walk about a fixed location until a specified time, or until a certain number of walkabouts have been performed.
Input
H Character number (0xB7-0xD1)
7CE1 LD L,$06 Collect the event ID (always 0, denoting the end of the lesson) and the maximum walkabout count from the command list and copy them into bytes 0x06 and 0x07 of the character's buffer
7CE3 CALL $6264
7CE6 LD L,$07 Decrease the walkabout counter at byte 0x07 of the character's buffer
7CE8 DEC (HL)
7CE9 JR NZ,$7CF9 If the character has not yet performed the maximum number of walkabouts, check whether the specified time has arrived
7CEB INC (HL) Set the walkabout counter back to 1 to ensure that we return to this execution path next time (to check whether the character has returned to the walkabout origin)
7CEC LD L,$05 Byte 0x05 holds the x-coordinate of the walkabout origin
7CEE CALL $7CB4 Reset the carry flag if the character is at the walkabout origin
7CF1 JP NC,$638C Move to the next command in the command list if the specified time has arrived or the character has completed all his walkabouts
7CF4 CALL $639F Otherwise send the character off to another walkabout destination via the routine at 63ED, and return to the instruction at 7CF7 (below) when done
7CF7 JR $7CE6
7CF9 CALL $7CAB Reset the carry flag if the specified time has arrived and the character is at the walkabout origin
7CFC JR $7CF1
Prev: 7CD0 Up: Map Next: 7CFE