Prev: EAEE Up: Map Next: EB25
EAF4: Take: Is Player Holding Item
Refuse the take when the object is already carried or the inventory is full; otherwise return so the caller can take it.
Input
A Object ID
Output
B The object ID (when returning so the take may proceed)
Take_IsPlayerHoldingItem EAF4 CALL IsObjectInInventory Call IsObjectInInventory.
Refuse when that object is already being carried.
EAF7 JR NZ,Take_InventoryFull Jump to Take_InventoryFull if the item is not being held.
EAF9 POP HL Restore HL from the stack.
Finish the sentence "You're already carrying" with "it" or "them".
Print "You're already carrying ".
EAFA LD HL,$B0F2 HL=Messaging_YoureAlreadyCarrying.
This entry point is used by the routines at Drop_IsPlayerHoldingItem and IsPlayerCarryingItem.
Print the string at HL, then finish with "it." or "them.".
PrintStringAndItThemHandler EAFD CALL PrintString Call PrintString.
Search Table_ItemsWhichArePlural among the plural items.
Take_AlreadyCarrying_CheckPlural EB00 LD HL,$EA9D HL=Table_ItemsWhichArePlural.
EB03 LD A,E Copy the object ID back into A.
EB04 LD BC,$0001 BC=0001.
EB07 CPIR Search Table_ItemsWhichArePlural for the item ID among the plural items.
EB09 JR Z,Take_AlreadyCarrying_Them Jump to Take_AlreadyCarrying_Them if the item is plural.
Print "it.".
EB0B LD HL,$B10D HL=Messaging_It.
EB0E JP PrintResponse Jump to PrintResponse.
Print "them.".
Take_AlreadyCarrying_Them EB11 LD HL,$B111 HL=Messaging_Them.
EB14 JP PrintResponse Jump to PrintResponse.
Refuse the object when the player is already holding 08 things.
Take_InventoryFull EB17 LD A,($AE9A) Compare *Count_InventoryItems with 08.
EB1A CP $08
EB1C LD B,E B=E.
EB1D RET NZ Return if *Count_InventoryItems is not equal to 08.
EB1E POP HL Restore HL from the stack.
Print "You can't carry any more.".
EB1F LD HL,$B117 HL=Messaging_YouCantCarryAnyMore.
EB22 JP PrintResponse Jump to PrintResponse.
Prev: EAEE Up: Map Next: EB25