Prev: 60785 Up: Map Next: 60838
60789: Check Player Inventory
Input
A Item ID
Is the passed item ID already in the players inventory?
Check_PlayerInventory 60789 CALL CheckObjectInInventory Call CheckObjectInInventory.
60792 JR NZ,PlayerCanPickUpItem Jump to PlayerCanPickUpItem if the item isn't already in the players inventory.
The player is already carrying the item.
60794 POP HL Discard the return address on the stack.
Print "You're already carrying ".
60795 LD HL,43516 HL=Messaging_YoureAlreadyCarrying.
This entry point is used by the routines at Handler_DropItem and IsPlayerCarryingItem.
PrintStringAndItThemHandler 60798 CALL PrintString Call PrintString.
Check if the item is referring to as an "it" or a "them".
60801 LD HL,60780 Load Table_PluralItems into HL.
60804 LD A,E Load the item ID into A.
60805 LD BC,1 Set the count of the number of items in the table (0001).
60808 CPIR Search for the item ID in the table.
60810 JR Z,ItemIsPlural Jump to ItemIsPlural if the item ID is in the plurals table.
The item is singular.
Print "it.".
60812 LD HL,43543 HL=Messaging_It.
60815 JP PrintStringAndNewline_Duplicate Jump to PrintStringAndNewline_Duplicate.
The item is a plural.
Print "them.".
ItemIsPlural 60818 LD HL,43547 HL=Messaging_Them.
60821 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 60824 LD A,(42896) Is *Count_InventoryItems at the maximum of 5 items?
60827 CP 5
60829 LD B,E Load the item ID into B.
60830 RET NZ Return if the players inventory is not yet full.
The player can't pick up any more items.
60831 POP HL Discard the return address on the stack.
Print "You can't carry any more.".
60832 LD HL,43553 HL=Messaging_YouCantCarryAnyMore.
60835 JP PrintStringAndNewline_Duplicate Jump to PrintStringAndNewline_Duplicate.
Prev: 60785 Up: Map Next: 60838