Prev: 49962 Up: Map Next: 50047
50015: Validate If Item Is Present
Input
A Object ID
F Z flag set if the object is available
ValidateItemPresent 50015 PUSH HL Stash HL and DE on the stack.
50016 PUSH DE
50017 LD E,A Store the object ID in DE.
50018 LD D,0
50020 BIT 7,E Jump to Objects_UseScenicTable if this is a scenic object.
50022 JR NZ,Objects_UseScenicTable
Else check the regular objects.
50024 LD HL,48112 HL=Table_ItemLocations.
50027 JR Objects_CheckLocation Jump to Objects_CheckLocation.
Prepare object ID for use.
Objects_UseScenicTable 50029 RES 7,E Clear the scenic flag.
50031 LD HL,48248 HL=Table_ScenicEventLocations.
Both object types continue from here.
Objects_CheckLocation 50034 ADD HL,DE Add the object ID to the object/ event locations table.
50035 LD A,(48331) 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.
50038 CP (HL)
50039 JR Z,Handler_Objects_Return
Check the players inventory, as an object can still be used if it's being held.
50041 LD A,1 Lastly, set the Z flag if the item is in the players inventory.
50043 CP (HL)
Housekeeping; restore DE and HL to their previous values.
Handler_Objects_Return 50044 POP DE Restore DE and HL from the stack.
50045 POP HL
50046 RET Return.
Prev: 49962 Up: Map Next: 50047