Prev: 44598 Up: Map Next: 44672
44651: Validate If Item Is Present
Used by the routines at Action_ExamineItem, 44791, 45035, 45087, 59881, 60435, 60449, 60606, 60768, 60981, 62207, 62380 and 63485.
Input
A Object ID
F Z flag set if the object is available
ValidateItemPresent 44651 PUSH HL Stash HL and DE on the stack.
44652 PUSH DE
44653 LD E,A Store the object ID in DE.
44654 LD D,0
44656 LD HL,42604 HL=Table_ItemLocations.
44659 ADD HL,DE Add the object ID to the object/ event locations table.
44660 LD A,(42947) 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.
44663 CP (HL)
44664 JR Z,Handler_Objects_Return
Check the players inventory, as an object can still be used if it's being held.
44666 LD A,1 Lastly, set the Z flag if the item is in the players inventory.
44668 CP (HL)
Housekeeping; restore DE and HL to their previous values.
Handler_Objects_Return 44669 POP DE Restore DE and HL from the stack.
44670 POP HL
44671 RET Return.
Prev: 44598 Up: Map Next: 44672