Prev: 46379 Up: Map Next: 46453
46432: Validate If Item Is Present
Input
A Object ID
Output
F Z flag set if the object is available
ValidateItemPresent 46432 PUSH HL Stash HL and DE on the stack.
46433 PUSH DE
46434 LD E,A HL=Table_ItemLocations + the object ID.
46435 LD D,0
46437 LD HL,44406
46440 ADD HL,DE
46441 LD A,(44749) 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.
46444 CP (HL) Jump to Handler_Objects_Return if the object is in the current room.
46445 JR Z,Handler_Objects_Return
Check the players inventory, as an object can still be used if it's being held.
46447 LD A,1 Lastly, set the Z flag if the item is in the players inventory.
46449 CP (HL)
Housekeeping; restore DE and HL to their previous values.
Handler_Objects_Return 46450 POP DE Restore DE and HL from the stack.
46451 POP HL
46452 RET Return.
Prev: 46379 Up: Map Next: 46453