Prev: C32A Up: Map Next: C37F
C35F: Validate If Item Is Present
Input
A Object ID
F Z flag set if the object is available
ValidateItemPresent C35F PUSH HL Stash HL and DE on the stack.
C360 PUSH DE
C361 LD E,A Store the object ID in DE.
C362 LD D,$00
C364 BIT 7,E Jump to Objects_UseScenicTable if this is a scenic object.
C366 JR NZ,Objects_UseScenicTable
Else check the regular objects.
C368 LD HL,$BBF0 HL=Table_ItemLocations.
C36B JR Objects_CheckLocation Jump to Objects_CheckLocation.
Prepare object ID for use.
Objects_UseScenicTable C36D RES 7,E Clear the scenic flag.
C36F LD HL,$BC78 HL=Table_ScenicEventLocations.
Both object types continue from here.
Objects_CheckLocation C372 ADD HL,DE Add the object ID to the object/ event locations table.
C373 LD A,($BCCB) 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.
C376 CP (HL)
C377 JR Z,Handler_Objects_Return
Check the players inventory, as an object can still be used if it's being held.
C379 LD A,$01 Lastly, set the Z flag if the item is in the players inventory.
C37B CP (HL)
Housekeeping; restore DE and HL to their previous values.
Handler_Objects_Return C37C POP DE Restore DE and HL from the stack.
C37D POP HL
C37E RET Return.
Prev: C32A Up: Map Next: C37F