Prev: 38585 Up: Map Next: 38780
38724: Kill Magic Knight's jump if he cannot vertically pass through a block above him
Used by the routine at 38205.
Output
A Zero (if Magic Knight's jump was not impeded) or 1 (if the jump was impeded)
38724 LD A,(24841) Load Magic Knight's current y-coordinate into B...
38727 LD B,A ...
38728 LD A,(24845) Load A with Magic Knight's y-velocity
38731 ADD A,B Add y-velocity to y-coordinate in A
38732 CALL 40658 Divide A by eight, rounding down to nearest integer
38735 LD B,A Load Magic Knight's y-coordinate (characters) into B
38736 LD A,(24840) Load Magic Knight's current x-coordinate into A
38739 ADD A,4 Add 4 to x-coordinate (to get point roughly quarter of the way through Magic Knight's total width)
38741 CALL 40658 Divide A by eight, rounding down to nearest integer
38744 LD C,A Load Magic Knight's current x-coordinate (characters) into C
38745 CALL 63233 Point HL at terrain interaction data for character coordinates x=C, y=B
38748 BIT 4,(HL) If bit 4 of Magic Knight's current position's terrain data (block is impassable vertically, upwards) is set then...
38750 JR NZ,38772 ...kill Magic Knight's y-velocity and exit routine
38752 INC HL Advance to next character block along in "terrain interaction data"
38753 BIT 4,(HL) If bit 4 of this position's terrain data (block is impassable vertically, upwards) is set then...
38755 JR NZ,38772 ...kill Magic Knight's y-velocity and exit routine
38757 DEC B Advance y-coordinate by one character (to get point roughly three quarters of the way through Magic Knight's total width)
38758 CALL 63233 Point HL at terrain interaction data for character coordinates x=C, y=B
38761 BIT 4,(HL) If bit 4 of this position's terrain data (block is impassable vertically, upwards) is set then...
38763 JR NZ,38772 ...kill Magic Knight's y-velocity and exit routine
38765 INC HL Advance to next character block along in "terrain interaction data"
38766 BIT 4,(HL) If bit 4 of this position's terrain data (block is impassable vertically, upwards) is set then...
38768 JR NZ,38772 ...kill Magic Knight's y-velocity and exit routine
38770 XOR A Set A to zero, as jump was not impeded
38771 RET Return
38772 XOR A Set Magic Knight's y-velocity to zero...
38773 LD (24845),A ...
38776 LD A,1 Set A to one
38778 OR A Reset zero flag
38779 RET Return
Prev: 38585 Up: Map Next: 38780