Prev: F304 Up: Map Next: F336
F308: Deal with Sam when he has knocked on or is opening a door
Used by the routine at 74D8 when bit 6 at 7FFC is set (by the routine at F2F0), indicating that Sam has knocked on or is opening a door.
Input
H 0xE6 (Sam)
F308 XOR A Clear Sam's status flags at 7FFC
F309 LD ($7FFC),A
F30C PUSH HL Save Sam's character number (in H) briefly
F30D CALL $EB13 Obtain descriptors for Sam's current location
F310 POP HL Restore Sam's character number to H
F311 CP $04 Is Sam standing behind or in front of a closed door?
F313 JR NZ,$F324 Jump if not
F315 LD L,$04 Point HL at byte 0x04 of Sam's buffer
F317 BIT 0,(HL) Is Sam indoors?
F319 JR NZ,$F327 Jump if so
F31B CALL $F2A8 Open the door if Sam has the key, or signal that he has knocked on the door
F31E JR $F324
F320 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 7FAA)
F321 SET 5,(HL)
F323 EX DE,HL
F324 JP $EC7B Lower Sam's arm and make a sound effect
Sam is standing behind a closed door.
F327 CALL $EC7B Lower Sam's arm and make a sound effect
F32A LD H,$E6 0xE6=Sam
This entry point is used by the routines at F600 and F7BF.
F32C LD D,H D=character number
F32D CALL $F293 Check whether the door is open
F330 EX DE,HL Restore the character number to H
F331 RET NZ Return if the door is open
F332 EX DE,HL Point HL at the door status flags
F333 JP $F2B3 Open the door
Prev: F304 Up: Map Next: F336