Prev: F263 Up: Map Next: F29B
F26A: Take: Is Player Holding Item
Input
A Object ID
Output
B The object ID (when returning so the take may proceed)
Take_IsPlayerHoldingItem F26A CALL CheckObjectInInventory Call CheckObjectInInventory.
Refuse when that object is already being carried.
F26D JR NZ,Take_InventoryFull Jump to Take_InventoryFull if the item is not being held.
F26F POP HL Restore HL from the stack.
Finish the sentence "You're already carrying" with "it" or "them".
Print "You're already carrying ".
F270 LD HL,$BF10 HL=Messaging_YoureAlreadyCarrying.
F273 CALL PrintString Call PrintString.
F276 LD HL,$F29B HL=Table_ItemsWhichArePlural.
F279 LD A,E Copy the object ID back into A.
F27A LD BC,$0001 BC=0001.
F27D CPIR Search Table_ItemsWhichArePlural for the item ID among the plural items (count 0001) to finish "You're already carrying " with "them." or "it.".
F27F JR Z,Take_AlreadyCarrying_Them Jump to Take_AlreadyCarrying_Them if the item is plural.
Print "it.".
F281 LD HL,$BF2B HL=Messaging_It.
F284 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
Print "them.".
Take_AlreadyCarrying_Them F287 LD HL,$BF2F HL=Messaging_Them.
F28A JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
Refuse the object when the player is already holding 05 things.
Take_InventoryFull F28D LD A,($BC98) Compare *Count_InventoryItems with 05...
F290 CP $05
F292 LD B,E Copy the object ID into B.
F293 RET NZ Return if *Count_InventoryItems is not equal to 05.
F294 POP HL Restore HL from the stack.
Print "You can't carry any more.".
F295 LD HL,$BF35 HL=Messaging_YouCantCarryAnyMore.
F298 JP PrintStringAndNewline_Alias Jump to PrintStringAndNewline_Alias.
View the equivalent code in;
Prev: F263 Up: Map Next: F29B