Prev: AE2C Up: Map Next: AE7D
AE5E: Handler: Is Carrying Item
Rejects a drop when the item is not carried. Plural items listed in Table_PluralItems use the "them" wording.
Input
A Item ID
Output
A 00 when the item is carried, otherwise 01
F The zero flag is set when the item is carried
The drop is valid when the item is already being carried.
Handler_IsCarryingItem AE5E CALL CheckObjectInInventory Call CheckObjectInInventory to test whether the item is carried.
AE61 RET Z Return if the item is carried.
Tell the player the item is not carried. Prefer the plural form from Table_PluralItems when the item is one of those three.
AE62 LD HL,$001D Point HL at the singular "not carrying" message Messaging_YoureNotCarryingIt.
AE65 LD BC,$0003 Load BC with the plural-list length 0003.
AE68 XOR A
AE69 OR C
AE6A JR Z,IsCarryingItem_PrintReject Jump to IsCarryingItem_PrintReject when the plural list length is zero.
AE6C PUSH HL Stash the message pointer on the stack.
AE6D LD HL,$B6F1 Point HL at the plural items table at Table_PluralItems.
AE70 CPIR Search Table_PluralItems for the item ID.
AE72 POP HL Restore the message pointer from the stack.
AE73 JR NZ,IsCarryingItem_PrintReject Jump to IsCarryingItem_PrintReject when this item is singular.
AE75 INC HL Move HL on to the plural message.
Print the rejection message and return failure.
IsCarryingItem_PrintReject AE76 CALL PrintCompressedStringAndNewline Call PrintCompressedStringAndNewline to print that compressed string and a newline.
AE79 LD A,$01 Load 01 into A and clear the zero flag; the drop is rejected.
AE7B AND A
AE7C RET Return.
Prev: AE2C Up: Map Next: AE7D