Prev: 62051 Up: Map Next: 62107
62058: Take: Is Player Holding Item
Input
A Object ID
Output
B The object ID (when returning so the take may proceed)
Take_IsPlayerHoldingItem 62058 CALL CheckObjectInInventory Call CheckObjectInInventory.
Refuse when that object is already being carried.
62061 JR NZ,Take_InventoryFull Jump to Take_InventoryFull if the item is not being held.
62063 POP HL Restore HL from the stack.
Finish the sentence "You're already carrying" with "it" or "them".
Print "You're already carrying ".
62064 LD HL,48912 HL=Messaging_YoureAlreadyCarrying.
62067 CALL PrintString Call PrintString.
62070 LD HL,62107 HL=Table_ItemsWhichArePlural.
62073 LD A,E Copy the object ID back into A.
62074 LD BC,1 BC=0001.
62077 CPIR Search Table_ItemsWhichArePlural for the item ID among the plural items (count 0001) to finish "You're already carrying " with "them." or "it.".
62079 JR Z,Take_AlreadyCarrying_Them Jump to Take_AlreadyCarrying_Them if the item is plural.
Print "it.".
62081 LD HL,48939 HL=Messaging_It.
62084 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
Print "them.".
Take_AlreadyCarrying_Them 62087 LD HL,48943 HL=Messaging_Them.
62090 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
Refuse the object when the player is already holding 5 things.
Take_InventoryFull 62093 LD A,(48280) Compare *Count_InventoryItems with 5...
62096 CP 5
62098 LD B,E Copy the object ID into B.
62099 RET NZ Return if *Count_InventoryItems is not equal to 5.
62100 POP HL Restore HL from the stack.
Print "You can't carry any more.".
62101 LD HL,48949 HL=Messaging_YouCantCarryAnyMore.
62104 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
View the equivalent code in;
Prev: 62051 Up: Map Next: 62107