Prev: ED71 Up: Map Next: EDA6
ED75: Check Player Inventory
Input
A Item ID
Is the passed item ID already in the players inventory?
Check_PlayerInventory ED75 CALL CheckObjectInInventory Call CheckObjectInInventory.
ED78 JR NZ,PlayerCanPickUpItem Jump to PlayerCanPickUpItem if the item isn't already in the players inventory.
The player is already carrying the item.
ED7A POP HL Discard the return address on the stack.
Print "You're already carrying ".
ED7B LD HL,$A9FC HL=Messaging_YoureAlreadyCarrying.
This entry point is used by the routines at Handler_DropItem and IsPlayerCarryingItem.
PrintStringAndItThemHandler ED7E CALL PrintString Call PrintString.
Check if the item is referring to as an "it" or a "them".
ED81 LD HL,$ED6C Load Table_PluralItems into HL.
ED84 LD A,E Load the item ID into A.
ED85 LD BC,$0001 Set the count of the number of items in the table (0001).
ED88 CPIR Search for the item ID in the table.
ED8A JR Z,ItemIsPlural Jump to ItemIsPlural if the item ID is in the plurals table.
The item is singular.
Print "it.".
ED8C LD HL,$AA17 HL=Messaging_It.
ED8F JP PrintStringAndNewline_Duplicate Jump to PrintStringAndNewline_Duplicate.
The item is a plural.
Print "them.".
ItemIsPlural ED92 LD HL,$AA1B HL=Messaging_Them.
ED95 JP PrintStringAndNewline_Duplicate Jump to PrintStringAndNewline_Duplicate.
The item is not already in the players inventory, but does the player have a full inventory? Do they have room to pick up another item?
PlayerCanPickUpItem ED98 LD A,($A790) Is *Count_InventoryItems at the maximum of 05 items?
ED9B CP $05
ED9D LD B,E Load the item ID into B.
ED9E RET NZ Return if the players inventory is not yet full.
The player can't pick up any more items.
ED9F POP HL Discard the return address on the stack.
Print "You can't carry any more.".
EDA0 LD HL,$AA21 HL=Messaging_YouCantCarryAnyMore.
EDA3 JP PrintStringAndNewline_Duplicate Jump to PrintStringAndNewline_Duplicate.
Prev: ED71 Up: Map Next: EDA6