Prev: FA3C Up: Map Next: FB16
FAA8: Action: Close
Close the named door, chest or other container.
Action_Close FAA8 CALL Parser_ValidateDirectObject Call Parser_ValidateDirectObject.
FAAB RET C Return if the direct object is malformed.
Was the player trying to close the door?
FAAC LD HL,$EABE Call MatchPhraseTokens with PhraseTokens_Door.
FAAF CALL MatchPhraseTokens
FAB2 JR NZ,CloseShut_RockDoor Jump to CloseShut_RockDoor if the token isn't for closing the door.
The player is trying to close the door but which door? Was it the "normal" door?
FAB4 LD A,($BCCB) Jump to Validate_CloseShut_Door if *CurrentRoom is room 61: " The Dusty Corridor".
FAB7 CP $61
FAB9 JR Z,Validate_CloseShut_Door
FABB CP $62 Jump to CloseShut_RockDoor if *CurrentRoom is not room 62: " The Pirate Treasure Chamber".
FABD JR NZ,CloseShut_RockDoor
The player is in either of The Dusty Corridor or The Pirate Treasure Chamber, but the door has a few "states" it can be in.
Validate_CloseShut_Door FABF LD HL,$E8CA Call CheckActiveScenicEvents with Data_ItemGroup_Door.
FAC2 CALL CheckActiveScenicEvents
Is the door already closed?
FAC5 CP $2D Jump to Response_ItsAlreadyClosed if the player is by item 2D: "A closed door" or item 30: "A closed door".
FAC7 JP Z,Response_ItsAlreadyClosed
FACA CP $30
FACC JP Z,Response_ItsAlreadyClosed
Change the door states!
FACF LD BC,$2C2D Call TransformItem to transform item 2C ("An open door") into item 2D ("A closed door").
FAD2 CALL TransformItem
FAD5 LD BC,$2F30 Call TransformItem to transform item 2F ("An open door") into item 30 ("A closed door").
FAD8 CALL TransformItem
This action changes the map:
Now the door is shut, this closes off various routes.
FADB XOR A Write 00 to *ED57 to close off southbound access to The Pirate Treasure Chamber from The Dusty Corridor.
FADC LD ($ED57),A
FADF LD ($ED5C),A Write 00 to *ED5C to close off northbound access to The Dusty Corridor from The Pirate Treasure Chamber.
FAE2 JP Response_OK_Duplicate Jump to Response_OK_Duplicate.
Was the player trying to close the rock door?
CloseShut_RockDoor FAE5 LD HL,$EAC0 Call MatchPhraseTokens with PhraseTokens_RockDoor.
FAE8 CALL MatchPhraseTokens
FAEB JR NZ,CloseShut_TrapDoor Jump to CloseShut_TrapDoor if the token isn't for the rock door.
The player is trying to close the rock door, but is it in the current room with them?
FAED LD A,($BCCB) Jump to CloseShut_TrapDoor if *CurrentRoom is not room 6A: " The Mighty Rock Door".
FAF0 CP $6A
FAF2 JR NZ,CloseShut_TrapDoor
Is the rock door already closed?
FAF4 LD A,$32 Call ValidateItemPresent with item 32: "The door is closed".
FAF6 CALL ValidateItemPresent
FAF9 JP Z,Response_ItsAlreadyClosed Jump to Response_ItsAlreadyClosed if "The door is closed" is present in the current room.
Print "You can't.".
FAFC CALL Response_YouCant_Duplicate Call Response_YouCant_Duplicate.
Print "It's much too heavy.".
FAFF LD HL,$E305 HL=Messaging_MuchTooHeavy.
FB02 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
Was the player trying to close the trapdoor?
CloseShut_TrapDoor FB05 LD HL,$EAC5 Call MatchPhraseTokens with PhraseTokens_TrapDoor.
FB08 CALL MatchPhraseTokens
FB0B JR NZ,CloseShut_Invalid Jump to CloseShut_Invalid if the token isn't for the trapdoor.
Print "No. I can't be bothered.".
FB0D LD HL,$E31A HL=Messaging_NoCantBeBothered.
FB10 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
Nothing else is valid.
CloseShut_Invalid FB13 JP Response_YouCant_Duplicate Jump to Response_YouCant_Duplicate.
Prev: FA3C Up: Map Next: FB16