Prev: 63972 Up: Map Next: 64168
64060: Action: Open
Action_Open 64060 CALL Parser_ValidateDirectObject Call Parser_ValidateDirectObject.
64063 RET C Return if the direct object is malformed.
Was the player trying to open the door?
64064 LD HL,60094 Call MatchPhraseTokens with PhraseTokens_Door.
64067 CALL MatchPhraseTokens
64070 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?
64072 LD A,(48331) Jump to Validate_Open_LockedDoor if *CurrentRoom is room 97: " The Dusty Corridor".
64075 CP 97
64077 JR Z,Validate_Open_LockedDoor
64079 CP 98 Jump to Open_RockDoor if *CurrentRoom is not room 98: " The Pirate Treasure Chamber".
64081 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 64083 LD HL,59594 Call CheckActiveScenicEvents with Data_ItemGroup_Door.
64086 CALL CheckActiveScenicEvents
Is the door locked?
64089 CP 46 Jump to Validate_Open_ClosedDoor if the player is not in the room with the "A closed door".
64091 JR NZ,Validate_Open_ClosedDoor
Print "The door is locked.".
64093 LD HL,58097 HL=58097.
64096 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
Is the door just closed?
Validate_Open_ClosedDoor 64099 CP 45 Jump to Open_ClosedDoor if the player is in the room with the "A closed door".
64101 JR Z,Open_ClosedDoor
64103 CP 48 Jump to Response_ItsAlreadyOpen if the player is not in the room with the "A closed door".
64105 JP NZ,Response_ItsAlreadyOpen
Change the door states!
Open_ClosedDoor 64108 LD BC,11564 Call TransformItem to transform item 45 ("A closed door") into item 44 ("An open door").
64111 CALL TransformItem
64114 LD BC,12335 Call TransformItem to transform item 48 ("A closed door") into item 47 ("An open door").
64117 CALL TransformItem
Now the door is opened, this opens up various routes.
64120 LD A,98 Write 98 to *60759 to open up southbound access to The Pirate Treasure Chamber from The Dusty Corridor.
64122 LD (60759),A
64125 LD A,97 Write 97 to *60764 to open up northbound access to The Dusty Corridor from The Pirate Treasure Chamber.
64127 LD (60764),A
64130 JP Response_OK_Duplicate Jump to Response_OK_Duplicate.
Was the player trying to open the rock door?
Open_RockDoor 64133 LD HL,60096 Call MatchPhraseTokens with PhraseTokens_RockDoor.
64136 CALL MatchPhraseTokens
64139 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?
64141 LD A,(48331) Jump to Open_Invalid if *CurrentRoom is not room 106: " The Mighty Rock Door".
64144 CP 106
64146 JR NZ,Open_Invalid
Is the rock door already open?
64148 LD A,49 Call ValidateItemPresent with "The door is open".
64150 CALL ValidateItemPresent
64153 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.".
64156 CALL Response_YouCant_Duplicate Call Response_YouCant_Duplicate.
Print "It's much too heavy.".
64159 LD HL,58117 HL=58117.
64162 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
Nothing else is valid.
Open_Invalid 64165 JP Response_YouCant_Duplicate Jump to Response_YouCant_Duplicate.
Prev: 63972 Up: Map Next: 64168