Prev: 62212 Up: Map Next: 62262
62216: Deal with Sam when he has knocked on or is opening a door
Used by the routine at 29912 when bit 6 at 32764 is set (by the routine at 62192), indicating that Sam has knocked on or is opening a door.
Input
H 230 (Sam)
62216 XOR A Clear Sam's status flags at 32764
62217 LD (32764),A
62220 PUSH HL Save Sam's character number (in H) briefly
62221 CALL 60179 Obtain descriptors for Sam's current location
62224 POP HL Restore Sam's character number to H
62225 CP 4 Is Sam standing behind or in front of a closed door?
62227 JR NZ,62244 Jump if not
62229 LD L,4 Point HL at byte 4 of Sam's buffer
62231 BIT 0,(HL) Is Sam indoors?
62233 JR NZ,62247 Jump if so
62235 CALL 62120 Open the door if Sam has the key, or signal that he has knocked on the door
62238 JR 62244
62240 EX DE,HL These three instructions are never executed; but if the relative jump above were made only when the carry flag is reset (meaning Sam has opened the door), these instructions would set bit 5 of the door knock status flags for the door (see 32682)
62241 SET 5,(HL)
62243 EX DE,HL
62244 JP 60539 Lower Sam's arm and make a sound effect
Sam is standing behind a closed door.
62247 CALL 60539 Lower Sam's arm and make a sound effect
62250 LD H,230 230=Sam
This entry point is used by the routines at 62976 and 63423.
62252 LD D,H D=character number
62253 CALL 62099 Check whether the door is open
62256 EX DE,HL Restore the character number to H
62257 RET NZ Return if the door is open
62258 EX DE,HL Point HL at the door status flags
62259 JP 62131 Open the door
Prev: 62212 Up: Map Next: 62262