Prev: A591 Up: Map Next: A5DB
A5C6: Validate If Item Is Present
Input
A Object ID
F Z flag set if the object is available
ValidateItemPresent A5C6 PUSH HL Stash HL and DE on the stack.
A5C7 PUSH DE
A5C8 LD E,A Store the object ID in DE.
A5C9 LD D,$00
A5CB LD HL,$9F88 HL=Table_ItemLocations.
A5CE ADD HL,DE Add the object ID to the object/ event locations table.
A5CF LD A,($A106) Jump to Handler_Objects_Return if the object/ event table states that it's located in *CurrentRoom. Note also sets/ unsets the Z flag accordingly.
A5D2 CP (HL)
A5D3 JR Z,Handler_Objects_Return
Check the players inventory, as an object can still be used if it's being held.
A5D5 LD A,$01 Lastly, set the Z flag if the item is in the players inventory.
A5D7 CP (HL)
Housekeeping; restore DE and HL to their previous values.
Handler_Objects_Return A5D8 POP DE Restore DE and HL from the stack.
A5D9 POP HL
A5DA RET Return.
View the equivalent code in;
Prev: A591 Up: Map Next: A5DB