![]()  | 
Routines | 
| Prev: 64664 | Up: Map | Next: 64770 | 
| 
 | 
||||
| Action_Unlock | 64717 | CALL Parser_ValidateDirectObject | Call Parser_ValidateDirectObject. | |
| 64720 | RET C | Return if the direct object is malformed. | ||
| 
 
Was the player trying to unlock the door?
 
 | 
||||
| 64721 | LD HL,60134 | Call MatchPhraseTokens with PhraseTokens_Door_2. | ||
| 64724 | CALL MatchPhraseTokens | |||
| 64727 | JR NZ,Unlock_Invalid | Jump to Unlock_Invalid if the token isn't for the door. | ||
| 
 
The player was trying to unlock the door, but is the door even in the current room?
 
 | 
||||
| 64729 | LD A,(48331) | Jump to Response_YouCant_Duplicate if *CurrentRoom is room 106: " The Mighty Rock Door". | ||
| 64732 | CP 106 | |||
| 64734 | JP Z,Response_YouCant_Duplicate | |||
| 
 
It's the correct door, but is it already unlocked?
 
 | 
||||
| 64737 | LD A,46 | Call ValidateItemPresent with "A closed door". | ||
| 64739 | CALL ValidateItemPresent | |||
| 64742 | JP NZ,Response_YouveDoneThatAlready | Jump to Response_YouveDoneThatAlready if "A closed door" isn't in the current room. | ||
| 
 
And does the player have the key?
 
 | 
||||
| 64745 | LD A,31 | Call CheckObjectInInventory with item 31: "A key". | ||
| 64747 | CALL CheckObjectInInventory | |||
| 64750 | JR Z,Unlock_Door | Jump to Unlock_Door if the key is either in the room, or in the players inventory. | ||
| 
 
Print "You haven't got the key.".
 
 | 
||||
| 64752 | LD HL,58884 | HL=Messaging_YouHaventGotTheKey. | ||
| 64755 | JP PrintStringAndNewline_Alias | Jump to PrintStringAndNewline_Alias. | ||
| 
 
Change the door state!
 
 | 
||||
| Unlock_Door | 64758 | LD BC,11821 | Call TransformItem to transform item 46 ("A closed door") into item 45 ("A closed door"). | |
| 64761 | CALL TransformItem | |||
| 64764 | JP Response_OK_Duplicate | Jump to Response_OK_Duplicate. | ||
| 
 
Nothing else is valid.
 
 | 
||||
| Unlock_Invalid | 64767 | JP Response_YouCant_Duplicate | Jump to Response_YouCant_Duplicate. | |
| Prev: 64664 | Up: Map | Next: 64770 |