Prev: 34211 Up: Map Next: 34256
34224: Test whether current object is too heavy for a character to pick up
Used by the routine at 34202.
Input
A Character's current strength
IX Points to character's current inventory
Output
F Sign flag set if object is light enough to be picked up, reset otherwise
34224 PUSH AF Store AF (A = character's current strength)
34225 LD BC,1280 Load B with 5 (as five inventory slots to check) and C (total weight carried) with zero
34228 LD A,(IX+0) Load object in current inventory slot
34231 OR A If no object present...
34232 JR Z,34243 ...skip ahead to 34243...
34234 CALL 34126 Load A with weight of object A
34237 ADD A,C Add C to this...
34238 LD C,A ...and load result into C (total weight so far)
34239 INC IX Advance to next inventory slot
34241 DJNZ 34228 Loop back for next inventory slot
34243 POP AF Restore AF (A = character's current strength)
34244 AND 127 Ensure that strength is capped at 127 and that sign flag is reset (in reality, Magic Knight's strength can only go as high as 96)
34246 SUB C Subtract total weight of character's carried objects from his/her strength to get "surplus" strength...
34247 LD C,A ...and load into C
34248 LD A,(30467) Load A with index of Current Object (e.g. object character is trying to receive)
34251 CALL 34126 Load A with weight of object A
34254 CP C Set sign flag if surplus strength exceeds weight of object, otherwise reset
34255 RET Return
Prev: 34211 Up: Map Next: 34256