Prev: F57B Up: Map Next: F5EB
F5B8: Process: Place Sword On Slab
The players wants to place the sword on the stone slab, check which version of the sword is in the current room or the players inventory.
Process_PlaceSwordOnSlab F5B8 LD HL,$E392 Call CheckItemGroupPresent with Data_ItemGroup_Sword.
F5BB CALL CheckItemGroupPresent
Print "You've done that already." if the version of the sword in the current room is the one where it's on the stone slab.
F5BE CP $59 Jump to Response_YouveDoneThatAlready if the version of the sword in the current room is "A shimmering stone slab with a sword laying upon it".
F5C0 JP Z,Response_YouveDoneThatAlready
Print "I don't see the point." if the version of the sword in the current room is item 39 instead of item 38.
F5C3 CP $39 Jump to Response_IDontSeeThePoint if the version of the sword in the current room is "A sword".
F5C5 JP Z,Response_IDontSeeThePoint
Ensure the player is carrying the sword.
F5C8 CALL IsPlayerCarryingItem Call IsPlayerCarryingItem with the item ID of the originally requsted item.
F5CB LD A,E
The sword item itself is destroyed, it's the stone slab item which changes to the version where it has a sword laying on it.
F5CC CALL Handler_DestroyItemEvent Call Handler_DestroyItemEvent.
Change the stone slab state!
F5CF LD BC,$5859 Call TransformItem to transform item 58 ("A stone slab") into item 59 ("A shimmering stone slab with a sword laying upon it").
F5D2 CALL TransformItem
The sword has been used so handle the inventory count.
F5D5 LD HL,$A790 Decrease *Count_InventoryItems by one.
F5D8 DEC (HL)
Is this the first time the player has placed the sword on the stone slab?
F5D9 LD HL,$A76D Jump to Response_OK_Duplicate if bit 4 of *Flag_GameStates_02 is set, which relates to placing the sword on the stone slab.
F5DC BIT 4,(HL)
F5DE JP NZ,Response_OK_Duplicate
F5E1 SET 4,(HL) Set bit 4 of *Flag_GameStates_02 to signify that the sword has been placed on the stone slab. This is to prevent the points from being awarded more than one time.
F5E3 LD A,$04 Call AddToScore to add 04 points to the score.
F5E5 CALL AddToScore
F5E8 JP Response_OK_Duplicate Jump to Response_OK_Duplicate.
Prev: F57B Up: Map Next: F5EB