Prev: F9E4 Up: Map Next: FAA8
FA3C: Action: Open
Action_Open FA3C CALL Parser_ValidateDirectObject Call Parser_ValidateDirectObject.
FA3F RET C Return if the direct object is malformed.
Was the player trying to open the door?
FA40 LD HL,$EABE Call MatchPhraseTokens with PhraseTokens_Door.
FA43 CALL MatchPhraseTokens
FA46 JR NZ,Open_RockDoor Jump to Open_RockDoor if the token isn't for the door.
The player was trying to open the door but which door? Was it the "normal" door?
FA48 LD A,($BCCB) Jump to Validate_Open_LockedDoor if *CurrentRoom is room 61: " The Dusty Corridor".
FA4B CP $61
FA4D JR Z,Validate_Open_LockedDoor
FA4F CP $62 Jump to Open_RockDoor if *CurrentRoom is not room 62: " The Pirate Treasure Chamber".
FA51 JR NZ,Open_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_Open_LockedDoor FA53 LD HL,$E8CA Call CheckActiveScenicEvents with Data_ItemGroup_Door.
FA56 CALL CheckActiveScenicEvents
Is the door locked?
FA59 CP $2E Jump to Validate_Open_ClosedDoor if the player is not in the room with the "A closed door".
FA5B JR NZ,Validate_Open_ClosedDoor
Print "The door is locked.".
FA5D LD HL,$E2F1 HL=E2F1.
FA60 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
Is the door just closed?
Validate_Open_ClosedDoor FA63 CP $2D Jump to Open_ClosedDoor if the player is in the room with the "A closed door".
FA65 JR Z,Open_ClosedDoor
FA67 CP $30 Jump to Response_ItsAlreadyOpen if the player is not in the room with the "A closed door".
FA69 JP NZ,Response_ItsAlreadyOpen
Change the door states!
Open_ClosedDoor FA6C LD BC,$2D2C Call TransformItem to transform item 2D ("A closed door") into item 2C ("An open door").
FA6F CALL TransformItem
FA72 LD BC,$302F Call TransformItem to transform item 30 ("A closed door") into item 2F ("An open door").
FA75 CALL TransformItem
Now the door is opened, this opens up various routes.
FA78 LD A,$62 Write 62 to *ED57 to open up southbound access to The Pirate Treasure Chamber from The Dusty Corridor.
FA7A LD ($ED57),A
FA7D LD A,$61 Write 61 to *ED5C to open up northbound access to The Dusty Corridor from The Pirate Treasure Chamber.
FA7F LD ($ED5C),A
FA82 JP Response_OK_Duplicate Jump to Response_OK_Duplicate.
Was the player trying to open the rock door?
Open_RockDoor FA85 LD HL,$EAC0 Call MatchPhraseTokens with PhraseTokens_RockDoor.
FA88 CALL MatchPhraseTokens
FA8B JR NZ,Open_Invalid Jump to Open_Invalid if the token isn't for the rock door.
The player was trying to open the rock door, but is it in the current room with them?
FA8D LD A,($BCCB) Jump to Open_Invalid if *CurrentRoom is not room 6A: " The Mighty Rock Door".
FA90 CP $6A
FA92 JR NZ,Open_Invalid
Is the rock door already open?
FA94 LD A,$31 Call ValidateItemPresent with "The door is open".
FA96 CALL ValidateItemPresent
FA99 JP Z,Response_ItsAlreadyOpen Jump to Response_ItsAlreadyOpen if "The door is open" is present in the current room.
The rock door is here, but ...
Print "You can't.".
FA9C CALL Response_YouCant_Duplicate Call Response_YouCant_Duplicate.
Print "It's much too heavy.".
FA9F LD HL,$E305 HL=E305.
FAA2 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
Nothing else is valid.
Open_Invalid FAA5 JP Response_YouCant_Duplicate Jump to Response_YouCant_Duplicate.
Prev: F9E4 Up: Map Next: FAA8