Prev: AE0D Up: Map Next: AE5E
AE2C: Handler: Can Take Item
Used by the routines at Condition_CanTakeItem and Condition_CannotTakeItem.
Rejects a take when the item is already carried or the inventory is full.
Plural items in Table_PluralItems use the "them" message.
Input
A Item ID
Output
A 00 when the item can be taken, otherwise 01
F The zero flag is set when the item can be taken
Handler_CanTakeItem AE2C CALL CheckObjectInInventory Call CheckObjectInInventory.
AE2F JR NZ,Handler_CanTakeItem_0 Jump to Handler_CanTakeItem_0 when it is not in the inventory.
Print "You're already carrying it.".
AE31 LD HL,$001B HL=Messaging_YoureAlreadyCarryingIt.
AE34 LD BC,$0003 BC=0003.
Skip the plural-item search when the list length in C is zero.
AE37 XOR A Jump to Handler_CanTakeItem_1 when the plural list is empty.
AE38 OR C
AE39 JR Z,Handler_CanTakeItem_1
AE3B PUSH HL Stash HL on the stack.
AE3C LD HL,$B6F1 HL=Table_PluralItems.
AE3F LD A,E A=E.
AE40 CPIR Search the plural-item list.
AE42 POP HL Restore HL from the stack.
AE43 JR NZ,Handler_CanTakeItem_1 Jump to Handler_CanTakeItem_1 when this item is singular.
AE45 INC HL Move HL on to the plural article string.
AE46 JR Handler_CanTakeItem_1 Jump to Handler_CanTakeItem_1.
Print "You can't carry any more.".
Handler_CanTakeItem_0 AE48 LD HL,$001F HL=Messaging_YouCantCarryAnyMore.
AE4B LD A,($A0D3) Jump to Handler_CanTakeItem_2 if *Count_InventoryItems is less than *CarryingLimit.
AE4E LD B,A
AE4F LD A,($A0D2)
AE52 CP B
AE53 JR C,Handler_CanTakeItem_2
Handler_CanTakeItem_1 AE55 CALL PrintCompressedStringAndNewline Call PrintCompressedStringAndNewline.
AE58 LD A,$01 A=01.
AE5A AND A The take is rejected.
AE5B RET Return.
Handler_CanTakeItem_2 AE5C XOR A A=00.
AE5D RET Return.
Prev: AE0D Up: Map Next: AE5E