Prev: 8CA6 Up: Map Next: 8D25
8CF1: Action: Add The Object's Mass
Used by the routines at Action_Pickup and Action_ThrowAt.
Adds the current object's mass to what the character is carrying. Too much and the player sees "You are carrying too much".
Action_AddTheObjectMass 8CF1 LD IX,($B708) Read *B708.
8CF5 LD A,($B6E8) Read *CurrentObject.
8CF8 CALL Condition_TotalTheMassInside Call Condition_TotalTheMassInside to total the mass inside the object.
8CFB ADD A,(IX+$03) Add this object's mass onto the count.
8CFE JR NC,Action_AddTheObjectMass_Putdown_CopyTheResult Jump to Action_AddTheObjectMass_Putdown_CopyTheResult if the sum did not overflow.
8D00 LD A,$FF Cap the total mass at FF.
Action_AddTheObjectMass_Putdown_CopyTheResult 8D02 LD B,A Copy the result into B.
8D03 LD IY,($B70C) Read *Pointer_CurrentCharacter.
8D07 LD A,(IY+$03) Read the mass from IY.
8D0A SUB B Point HL at AE04 and jump to Action_AddTheObjectMass_Putdown_PrintTheMessage if the mass of the object at Pointer_CurrentCharacter is below the total in B.
8D0B LD HL,$AE04
8D0E JR C,Action_AddTheObjectMass_Putdown_PrintTheMessage
8D10 PUSH AF Read *CurrentCharacter.
8D11 LD A,($B6EA)
8D14 CALL Condition_TotalTheMassInside Call Condition_TotalTheMassInside to total the mass inside the character.
8D17 LD B,A Copy the result into B.
8D18 POP AF Subtract the count in B from the value saved on the stack.
8D19 SUB B
8D1A JP P,Action_StopIfTheObjectIsFixed Jump to Action_StopIfTheObjectIsFixed if the result is not negative.
8D1D LD HL,$AE0C Point at the message "You are carrying too much" (AE0C).
Action_AddTheObjectMass_Putdown_PrintTheMessage 8D20 EX (SP),HL Swap HL with the address on the stack.
8D21 POP HL Jump back to PrintMessage to print message.
8D22 JP PrintMessage
Prev: 8CA6 Up: Map Next: 8D25