Prev: 49683 Up: Map Next: 49775
49743: Validate If Item Is Present
Input
A Object ID
Output
F Z flag set if the object is available
ValidateItemPresent 49743 PUSH HL Stash HL and DE on the stack.
49744 PUSH DE
49745 LD E,A Store the object ID in DE.
49746 LD D,0
49748 BIT 7,E Jump to Objects_UseScenicTable if this is a scenic object.
49750 JR NZ,Objects_UseScenicTable
Else check the regular objects.
49752 LD HL,47560 HL=Table_ItemLocations.
49755 JR Objects_CheckLocation Jump to Objects_CheckLocation.
Prepare object ID for use.
Objects_UseScenicTable 49757 RES 7,E Clear the scenic flag.
49759 LD HL,47688 HL=Table_ScenicEventLocations.
Both object types continue from here.
Objects_CheckLocation 49762 ADD HL,DE Add the object ID to the object/ event locations table.
49763 LD A,(47771) 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.
49766 CP (HL)
49767 JR Z,Handler_Objects_Return
Check the players inventory, as an object can still be used if it's being held.
49769 LD A,1 Lastly, set the Z flag if the item is in the players inventory.
49771 CP (HL)
Housekeeping; restore DE and HL to their previous values.
Handler_Objects_Return 49772 POP DE Restore DE and HL from the stack.
49773 POP HL
49774 RET Return.
Prev: 49683 Up: Map Next: 49775