Prev: F8AB Up: Map Next: F916
F8E4: Action: Unlock
Unlock a door with the key.
Action_Unlock F8E4 CALL Parser_ValidateDirectObject Call Parser_ValidateDirectObject.
F8E7 RET C Return if the direct object is malformed.
Was the player trying to unlock ... the chest?
F8E8 LD HL,$E92E Call Parser_AdvanceToSeparator with E92E.
F8EB CALL Parser_AdvanceToSeparator
F8EE JR NZ,Unlock_YouCant Jump to Unlock_YouCant if the token isn't for the chest.
F8F0 LD A,$0B Jump to Unlock_CheckKey if ValidateItemPresent reports that "A chest" is in the current room.
F8F2 CALL ValidateItemPresent
F8F5 JR Z,Unlock_CheckKey
Print "It is already unlocked.".
F8F7 LD HL,$E36F HL=Messaging_ItIsAlreadyUnlocked.
F8FA JP PrintResponse Jump to PrintResponse.
Does the player hold the key?
Unlock_CheckKey F8FD LD A,$10 Jump to Unlock_Chest if "A key" is held.
F8FF CALL IsObjectCarried
F902 JR Z,Unlock_Chest
Print "You're not carrying a key.".
F904 LD HL,$E387 HL=Messaging_YoureNotCarryingAKey.
F907 JP PrintResponse Jump to PrintResponse.
Change the chest state!
Unlock_Chest F90A LD BC,$0B0C Call TransformItem to transform "A chest" into "A closed chest".
F90D CALL TransformItem
F910 JP Response_OK_GameLoop Jump to Response_OK_GameLoop.
Nothing else is valid.
Unlock_YouCant F913 JP Response_YouCant_GameLoop Jump to Response_YouCant_GameLoop.
View the equivalent code in;
Prev: F8AB Up: Map Next: F916