Prev: B52B Up: Map Next: B575
B560: Validate If Item Is Present
Input
A Object ID
Output
F Z flag set if the object is available
ValidateItemPresent B560 PUSH HL Stash HL and DE on the stack.
B561 PUSH DE
B562 LD E,A HL=Table_ItemLocations + the object ID.
B563 LD D,$00
B565 LD HL,$AD76
B568 ADD HL,DE
B569 LD A,($AECD) A=*CurrentRoom.
Jump to Handler_Objects_Return if the object/ event table states that it's located in *the current room. Note also sets/ unsets the Z flag accordingly.
B56C CP (HL) Jump to Handler_Objects_Return if the object is in the current room.
B56D JR Z,Handler_Objects_Return
Check the players inventory, as an object can still be used if it's being held.
B56F LD A,$01 Lastly, set the Z flag if the item is in the players inventory.
B571 CP (HL)
Housekeeping; restore DE and HL to their previous values.
Handler_Objects_Return B572 POP DE Restore DE and HL from the stack.
B573 POP HL
B574 RET Return.
Prev: B52B Up: Map Next: B575