Prev: C213 Up: Map Next: C26F
C24F: Validate If Item Is Present
Input
A Object ID
Output
F Z flag set if the object is available
ValidateItemPresent C24F PUSH HL Stash HL and DE on the stack.
C250 PUSH DE
C251 LD E,A Store the object ID in DE.
C252 LD D,$00
C254 BIT 7,E Jump to Objects_UseScenicTable if this is a scenic object.
C256 JR NZ,Objects_UseScenicTable
Else check the regular objects.
C258 LD HL,$B9C8 HL=Table_ItemLocations.
C25B JR Objects_CheckLocation Jump to Objects_CheckLocation.
Prepare object ID for use.
Objects_UseScenicTable C25D RES 7,E Clear the scenic flag.
C25F LD HL,$BA48 HL=Table_ScenicEventLocations.
Both object types continue from here.
Objects_CheckLocation C262 ADD HL,DE Add the object ID to the object/ event locations table.
C263 LD A,($BA9B) 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.
C266 CP (HL)
C267 JR Z,Handler_Objects_Return
Check the players inventory, as an object can still be used if it's being held.
C269 LD A,$01 Lastly, set the Z flag if the item is in the players inventory.
C26B CP (HL)
Housekeeping; restore DE and HL to their previous values.
Handler_Objects_Return C26C POP DE Restore DE and HL from the stack.
C26D POP HL
C26E RET Return.
Prev: C213 Up: Map Next: C26F