Prev: 36813 Up: Map Next: 36880
36834: Take: Is Player Holding Item
Input
A Object ID
Output
B The object ID (when returning so the take may proceed)
Take_IsPlayerHoldingItem 36834 CALL IsObjectCarried Call IsObjectCarried.
Refuse when that object is already being carried.
36837 JR NZ,Take_InventoryFull Jump to Take_InventoryFull if the item is not being held.
36839 POP HL Restore HL from the stack.
Finish the sentence "You're already carrying" with "it" or "them".
Print "You're already carrying ".
36840 LD HL,31263 HL=Messaging_YouReAlreadyCarrying.
36843 CALL PrintString Call PrintString.
Take_AlreadyCarrying_CheckPlural 36846 LD HL,36880 HL=Table_ItemsWhichArePlural.
36849 LD A,E Copy the object ID back into A.
36850 LD BC,4 BC=0004.
36853 CPIR Search Table_ItemsWhichArePlural for the item ID among the plural items.
36855 JR Z,Take_AlreadyCarrying_Them Jump to Take_AlreadyCarrying_Them if the item is plural.
Print "it.".
36857 LD HL,31288 HL=Messaging_It.
36860 JR TakeItem_PrintAndReturn Jump to TakeItem_PrintAndReturn.
Print "them.".
Take_AlreadyCarrying_Them 36862 LD HL,31292 HL=Messaging_Them.
36865 JR TakeItem_PrintAndReturn Jump to TakeItem_PrintAndReturn.
Refuse the object when the player is already holding 5 things.
Take_InventoryFull 36867 LD A,(25132) Compare *Count_InventoryItems with 5.
36870 CP 5
36872 LD B,E B=E.
36873 RET NZ Return if *Count_InventoryItems is not equal to 5.
36874 POP HL Restore HL from the stack.
Print "You can't carry any more.".
36875 LD HL,30722 HL=Messaging_YouCanTCarryAnyMore.
36878 JR TakeItem_PrintAndReturn Jump to TakeItem_PrintAndReturn.
View the equivalent code in;
Prev: 36813 Up: Map Next: 36880