Prev: 36006 Up: Map Next: 36133
36081: 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 36081 LD IX,(46856) Read *46856.
36085 LD A,(46824) Read *CurrentObject.
36088 CALL Condition_TotalTheMassInside Call Condition_TotalTheMassInside to total the mass inside the object.
36091 ADD A,(IX+3) Add this object's mass onto the count.
36094 JR NC,Action_AddTheObjectMass_Putdown_CopyTheResult Jump to Action_AddTheObjectMass_Putdown_CopyTheResult if the sum did not overflow.
36096 LD A,255 Cap the total mass at 255.
Action_AddTheObjectMass_Putdown_CopyTheResult 36098 LD B,A Copy the result into B.
36099 LD IY,(46860) Read *Pointer_CurrentCharacter.
36103 LD A,(IY+3) Read the mass from IY.
36106 SUB B Point HL at 44548 and jump to Action_AddTheObjectMass_Putdown_PrintTheMessage if the mass of the object at Pointer_CurrentCharacter is below the total in B.
36107 LD HL,44548
36110 JR C,Action_AddTheObjectMass_Putdown_PrintTheMessage
36112 PUSH AF Read *CurrentCharacter.
36113 LD A,(46826)
36116 CALL Condition_TotalTheMassInside Call Condition_TotalTheMassInside to total the mass inside the character.
36119 LD B,A Copy the result into B.
36120 POP AF Subtract the count in B from the value saved on the stack.
36121 SUB B
36122 JP P,Action_StopIfTheObjectIsFixed Jump to Action_StopIfTheObjectIsFixed if the result is not negative.
36125 LD HL,44556 Point at the message "You are carrying too much" (44556).
Action_AddTheObjectMass_Putdown_PrintTheMessage 36128 EX (SP),HL Swap HL with the address on the stack.
36129 POP HL Jump back to PrintMessage to print message.
36130 JP PrintMessage
Prev: 36006 Up: Map Next: 36133