Prev: 8FCD Up: Map Next: 9010
8FE2: Take: Is Player Holding Item
Input
A Object ID
Output
B The object ID (when returning so the take may proceed)
Take_IsPlayerHoldingItem 8FE2 CALL IsObjectCarried Call IsObjectCarried.
Refuse when that object is already being carried.
8FE5 JR NZ,Take_InventoryFull Jump to Take_InventoryFull if the item is not being held.
8FE7 POP HL Restore HL from the stack.
Finish the sentence "You're already carrying" with "it" or "them".
Print "You're already carrying ".
8FE8 LD HL,$7A1F HL=Messaging_YouReAlreadyCarrying.
8FEB CALL PrintString Call PrintString.
Take_AlreadyCarrying_CheckPlural 8FEE LD HL,$9010 HL=Table_ItemsWhichArePlural.
8FF1 LD A,E Copy the object ID back into A.
8FF2 LD BC,$0004 BC=0004.
8FF5 CPIR Search Table_ItemsWhichArePlural for the item ID among the plural items.
8FF7 JR Z,Take_AlreadyCarrying_Them Jump to Take_AlreadyCarrying_Them if the item is plural.
Print "it.".
8FF9 LD HL,$7A38 HL=Messaging_It.
8FFC JR TakeItem_PrintAndReturn Jump to TakeItem_PrintAndReturn.
Print "them.".
Take_AlreadyCarrying_Them 8FFE LD HL,$7A3C HL=Messaging_Them.
9001 JR TakeItem_PrintAndReturn Jump to TakeItem_PrintAndReturn.
Refuse the object when the player is already holding 05 things.
Take_InventoryFull 9003 LD A,($622C) Compare *Count_InventoryItems with 05.
9006 CP $05
9008 LD B,E B=E.
9009 RET NZ Return if *Count_InventoryItems is not equal to 05.
900A POP HL Restore HL from the stack.
Print "You can't carry any more.".
900B LD HL,$7802 HL=Messaging_YouCanTCarryAnyMore.
900E JR TakeItem_PrintAndReturn Jump to TakeItem_PrintAndReturn.
View the equivalent code in;
Prev: 8FCD Up: Map Next: 9010