![]() |
Routines |
Prev: FC98 | Up: Map | Next: FD02 |
|
||||
Action_Unlock | FCCD | CALL Parser_ValidateDirectObject | Call Parser_ValidateDirectObject. | |
FCD0 | RET C | Return if the direct object is malformed. | ||
Was the player trying to unlock the door?
|
||||
FCD1 | LD HL,$EAE6 | Call MatchPhraseTokens with PhraseTokens_Door_2. | ||
FCD4 | CALL MatchPhraseTokens | |||
FCD7 | 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?
|
||||
FCD9 | LD A,($BCCB) | Jump to Response_YouCant_Duplicate if *CurrentRoom is room 6A: " The Mighty Rock Door". | ||
FCDC | CP $6A | |||
FCDE | JP Z,Response_YouCant_Duplicate | |||
It's the correct door, but is it already unlocked?
|
||||
FCE1 | LD A,$2E | Call ValidateItemPresent with "A closed door". | ||
FCE3 | CALL ValidateItemPresent | |||
FCE6 | 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?
|
||||
FCE9 | LD A,$1F | Call CheckObjectInInventory with item 1F: "A key". | ||
FCEB | CALL CheckObjectInInventory | |||
FCEE | 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.".
|
||||
FCF0 | LD HL,$E604 | HL=Messaging_YouHaventGotTheKey. | ||
FCF3 | JP PrintStringAndNewline_Alias | Jump to PrintStringAndNewline_Alias. | ||
Change the door state!
|
||||
Unlock_Door | FCF6 | LD BC,$2E2D | Call TransformItem to transform item 2E ("A closed door") into item 2D ("A closed door"). | |
FCF9 | CALL TransformItem | |||
FCFC | JP Response_OK_Duplicate | Jump to Response_OK_Duplicate. | ||
Nothing else is valid.
|
||||
Unlock_Invalid | FCFF | JP Response_YouCant_Duplicate | Jump to Response_YouCant_Duplicate. |
Prev: FC98 | Up: Map | Next: FD02 |