![]()  | 
Routines | 
| Prev: 64060 | Up: Map | Next: 64278 | 
| 
 | 
||||
| Action_Close | 64168 | CALL Parser_ValidateDirectObject | Call Parser_ValidateDirectObject. | |
| 64171 | RET C | Return if the direct object is malformed. | ||
| 
 
Was the player trying to close the door?
 
 | 
||||
| 64172 | LD HL,60094 | Call MatchPhraseTokens with PhraseTokens_Door. | ||
| 64175 | CALL MatchPhraseTokens | |||
| 64178 | 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?
 
 | 
||||
| 64180 | LD A,(48331) | Jump to Validate_CloseShut_Door if *CurrentRoom is room 97: " The Dusty Corridor". | ||
| 64183 | CP 97 | |||
| 64185 | JR Z,Validate_CloseShut_Door | |||
| 64187 | CP 98 | Jump to CloseShut_RockDoor if *CurrentRoom is not room 98: " The Pirate Treasure Chamber". | ||
| 64189 | 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 | 64191 | LD HL,59594 | Call CheckActiveScenicEvents with Data_ItemGroup_Door. | |
| 64194 | CALL CheckActiveScenicEvents | |||
| 
 
Is the door already closed?
 
 | 
||||
| 64197 | CP 45 | Jump to Response_ItsAlreadyClosed if the player is by item 45: "A closed door" or item 48: "A closed door". | ||
| 64199 | JP Z,Response_ItsAlreadyClosed | |||
| 64202 | CP 48 | |||
| 64204 | JP Z,Response_ItsAlreadyClosed | |||
| 
 
Change the door states!
 
 | 
||||
| 64207 | LD BC,11309 | Call TransformItem to transform item 44 ("An open door") into item 45 ("A closed door"). | ||
| 64210 | CALL TransformItem | |||
| 64213 | LD BC,12080 | Call TransformItem to transform item 47 ("An open door") into item 48 ("A closed door"). | ||
| 64216 | CALL TransformItem | |||
| 
 
Now the door is shut, this closes off various routes.
 
 | 
||||
| 64219 | XOR A | Write 0 to *60759 to close off southbound access to The Pirate Treasure Chamber from The Dusty Corridor. | ||
| 64220 | LD (60759),A | |||
| 64223 | LD (60764),A | Write 0 to *60764 to close off northbound access to The Dusty Corridor from The Pirate Treasure Chamber. | ||
| 64226 | JP Response_OK_Duplicate | Jump to Response_OK_Duplicate. | ||
| 
 
Was the player trying to close the rock door?
 
 | 
||||
| CloseShut_RockDoor | 64229 | LD HL,60096 | Call MatchPhraseTokens with PhraseTokens_RockDoor. | |
| 64232 | CALL MatchPhraseTokens | |||
| 64235 | 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?
 
 | 
||||
| 64237 | LD A,(48331) | Jump to CloseShut_TrapDoor if *CurrentRoom is not room 106: " The Mighty Rock Door". | ||
| 64240 | CP 106 | |||
| 64242 | JR NZ,CloseShut_TrapDoor | |||
| 
 
Is the rock door already closed?
 
 | 
||||
| 64244 | LD A,50 | Call ValidateItemPresent with "The door is closed". | ||
| 64246 | CALL ValidateItemPresent | |||
| 64249 | JP Z,Response_ItsAlreadyClosed | Jump to Response_ItsAlreadyClosed if "The door is closed" is present in the current room. | ||
| 
 
Print "You can't.".
 
 | 
||||
| 64252 | CALL Response_YouCant_Duplicate | Call Response_YouCant_Duplicate. | ||
| 
 
Print "It's much too heavy.".
 
 | 
||||
| 64255 | LD HL,58117 | HL=58117. | ||
| 64258 | JP PrintStringAndNewline_Alias | Jump to PrintStringAndNewline_Alias. | ||
| 
 
Was the player trying to close the trapdoor?
 
 | 
||||
| CloseShut_TrapDoor | 64261 | LD HL,60101 | Call MatchPhraseTokens with PhraseTokens_TrapDoor. | |
| 64264 | CALL MatchPhraseTokens | |||
| 64267 | JR NZ,CloseShut_Invalid | Jump to CloseShut_Invalid if the token isn't for the trapdoor. | ||
| 
 
Print "No. I can't be bothered.".
 
 | 
||||
| 64269 | LD HL,58138 | HL=58138. | ||
| 64272 | JP PrintStringAndNewline_Alias | Jump to PrintStringAndNewline_Alias. | ||
| 
 
Nothing else is valid.
 
 | 
||||
| CloseShut_Invalid | 64275 | JP Response_YouCant_Duplicate | Jump to Response_YouCant_Duplicate. | |
| Prev: 64060 | Up: Map | Next: 64278 |