Prev: 42385 Up: Map Next: 42459
42438: Validate If Item Is Present
Input
A Object ID
F Z flag set if the object is available
ValidateItemPresent 42438 PUSH HL Stash HL and DE on the stack.
42439 PUSH DE
42440 LD E,A Store the object ID in DE.
42441 LD D,0
42443 LD HL,40840 HL=Table_ItemLocations.
42446 ADD HL,DE Add the object ID to the object/ event locations table.
42447 LD A,(41222) 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.
42450 CP (HL)
42451 JR Z,Handler_Objects_Return
Check the players inventory, as an object can still be used if it's being held.
42453 LD A,1 Lastly, set the Z flag if the item is in the players inventory.
42455 CP (HL)
Housekeeping; restore DE and HL to their previous values.
Handler_Objects_Return 42456 POP DE Restore DE and HL from the stack.
42457 POP HL
42458 RET Return.
View the equivalent code in;
Prev: 42385 Up: Map Next: 42459