Prev: 62278 Up: Map Next: 62325
62297: Control a character who has knocked on a door and is waiting for an answer
The address of this interruptible subcommand routine is placed into bytes 14 and 15 of a character's buffer by the routine at 62278. It makes the character continue to wait for someone to open the door, or give up and move on if he's already waited long enough.
Input
H Character number (215-229)
62297 LD D,H D=character number
62298 CALL 62099 Check whether the door is open
62301 EX DE,HL H=character number
62302 JP NZ,62084 Terminate this subcommand if the door is open
62305 LD L,17 Decrement the wait counter in byte 17 of the character's buffer
62307 DEC (HL)
62308 RET NZ Return unless it's now zero
62309 DEC (HL) Set the wait counter in byte 17 to 255; since it could just as well be left at 0, this instruction is redundant
62310 DEC L L=16
62311 LD E,(HL) Point DE at the door knock status flags for the door that the character knocked on
62312 LD D,127
62314 LD A,(DE) Pick up the flags
62315 BIT 6,A Is somebody coming to answer the door?
62317 RET NZ Return if so
The character has waited long enough for someone to open the door, and will now give up and move on.
62318 LD L,15 Remove the address of this routine from bytes 14 and 15 of the character's buffer
62320 LD (HL),0
62322 JP 63198 Restart the command list
Prev: 62278 Up: Map Next: 62325