![]() |
Routines |
| Prev: AE0D | Up: Map | Next: AE5E |
|
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 listed in Table_PluralItems use the "them" wording.
|
||||||||||||||
|
First refuse the take when the item is already in the inventory.
|
||||||||||||||
| Handler_CanTakeItem | AE2C | CALL CheckObjectInInventory | Call CheckObjectInInventory to test whether the item is carried. | |||||||||||
| AE2F | JR NZ,CanTakeItem_CheckLimit | Jump to CanTakeItem_CheckLimit if the item is not carried. | ||||||||||||
|
Print "You're already carrying it.".
|
||||||||||||||
| CanTakeItem_AlreadyCarried | AE31 | LD HL,$001B | HL=Messaging_YoureAlreadyCarryingIt. | |||||||||||
| AE34 | LD BC,$0003 | Load BC with the plural-list length 0003. | ||||||||||||
|
Prefer the plural wording when this item ID appears in Table_PluralItems.
|
||||||||||||||
| AE37 | XOR A | Jump to CanTakeItem_PrintReject when the plural list length in C is zero. | ||||||||||||
| AE38 | OR C | |||||||||||||
| AE39 | JR Z,CanTakeItem_PrintReject | |||||||||||||
| AE3B | PUSH HL | Stash the singular-message pointer on the stack. | ||||||||||||
| AE3C | LD HL,$B6F1 | Point HL at the plural items table at Table_PluralItems. | ||||||||||||
| AE3F | LD A,E | Copy the item ID from E back into A. | ||||||||||||
| AE40 | CPIR | Search Table_PluralItems for that item ID. | ||||||||||||
| AE42 | POP HL | Restore the message pointer from the stack. | ||||||||||||
| AE43 | JR NZ,CanTakeItem_PrintReject | Jump to CanTakeItem_PrintReject when this item is singular. | ||||||||||||
| AE45 | INC HL | Move HL on to the plural article string. | ||||||||||||
| AE46 | JR CanTakeItem_PrintReject | Jump to CanTakeItem_PrintReject. | ||||||||||||
|
The item is not already carried: check the carrying limit next.
Print "You can't carry any more." when the inventory is full.
|
||||||||||||||
| CanTakeItem_CheckLimit | AE48 | LD HL,$001F | HL=Messaging_YouCantCarryAnyMore. | |||||||||||
| AE4B | LD A,($A0D3) | Jump to CanTakeItem_OK if *Count_InventoryItems is less than *CarryingLimit. | ||||||||||||
| AE4E | LD B,A | |||||||||||||
| AE4F | LD A,($A0D2) | |||||||||||||
| AE52 | CP B | |||||||||||||
| AE53 | JR C,CanTakeItem_OK | |||||||||||||
|
Print the rejection message and return failure.
|
||||||||||||||
| CanTakeItem_PrintReject | AE55 | CALL PrintCompressedStringAndNewline | Call PrintCompressedStringAndNewline to print that compressed string and a newline. | |||||||||||
| AE58 | LD A,$01 | Load 01 into A. | ||||||||||||
| AE5A | AND A | Clear the zero flag; the take is rejected. | ||||||||||||
| AE5B | RET | Return. | ||||||||||||
|
The inventory has room, so allow the take.
|
||||||||||||||
| CanTakeItem_OK | AE5C | XOR A | Clear A and set the zero flag; the item can be taken. | |||||||||||
| AE5D | RET | Return. | ||||||||||||
| Prev: AE0D | Up: Map | Next: AE5E |