Prev: 33585 Up: Map Next: 33640
33601: Test whether current object is too heavy for Magic Knight to pick up (or take)
Used by the routines at 29330 and 29619.
Output
F Sign flag set if object is light enough to be picked up, reset otherwise
33601 LD IX,25164 Point IX at start of Magic Knight's current inventory
33605 LD A,(25020) Load Magic Knight's current strength into A
33608 PUSH AF Store AF (A = Magic Knight's current strength)
33609 LD BC,1280 Load B with 5 (as five inventory slots to check) and C (total weight carried) with zero
33612 LD A,(IX+0) Load object in current inventory slot
33615 OR A If no object present...
33616 JR Z,33627 ...skip ahead to 33627...
33618 CALL 33487 Load A with weight of object A
33621 ADD A,C Add C to this...
33622 LD C,A ...and load result into C (total weight so far)
33623 INC IX Advance to next inventory slot
33625 DJNZ 33612 Loop back for next inventory slot
33627 POP AF Restore AF (A = Magic Knight's current strength)
33628 AND 127 Ensure that strength is capped at 127 and that sign flag is reset
33630 SUB C Subtract total weight of Magic Knight's carried objects from his strength to get "surplus" strength...
33631 LD C,A ...and load into C
33632 LD A,(29526) Load A with index of Current Object (i.e. object Magic Knight is trying to pick up)
33635 CALL 33487 Load A with weight of object A
33638 CP C Set sign flag if surplus strength exceeds weight of object, otherwise reset
33639 RET Return
Prev: 33585 Up: Map Next: 33640