Prev: 27666 Up: Map Next: 27865
27809: Kill Magic Knight's jump if he cannot vertically pass through a block above him
Used by the routine at 27176.
Output
A 0 (if Magic Knight's jump was not impeded) or 1 (if the jump was impeded)
27809 LD A,(25388) Load Magic Knight's current y-coordinate into B...
27812 LD B,A ...
27813 LD A,(25392) Load A with Magic Knight's y-velocity
27816 ADD A,B Add y-velocity to y-coordinate in A
27817 CALL 30123 Divide A by eight, rounding down to nearest integer
27820 LD B,A Load Magic Knight's y-coordinate (characters) into B
27821 LD A,(25387) Load Magic Knight's current x-coordinate into A
27824 ADD A,4 Add 4 to x-coordinate (to get point roughly quarter of the way through Magic Knight's total width)
27826 CALL 30123 Divide A by eight, rounding down to nearest integer
27829 LD C,A Load Magic Knight's current x-coordinate (characters) into C
27830 CALL 36586 Point HL at terrain interaction data for character coordinates x=C, y=B
27833 BIT 7,(HL) If bit 7 of Magic Knight's current position's terrain data (block is impassable vertically) is set then...
27835 JR NZ,27857 ...kill Magic Knight's y-velocity and exit routine
27837 INC HL Advance to next character block along in terrain interaction data
27838 BIT 7,(HL) If bit 7 of this position's terrain data (block is impassable vertically) is set then...
27840 JR NZ,27857 ...kill Magic Knight's y-velocity and exit routine
27842 DEC B Advance y-coordinate by one character (to get point roughly three quarters of the way through Magic Knight's total width)
27843 CALL 36586 Point HL at terrain interaction data for character coordinates x=C, y=B
27846 BIT 7,(HL) If bit 7 of this position's terrain data (block is impassable vertically) is set then...
27848 JR NZ,27857 ...kill Magic Knight's y-velocity and exit routine
27850 INC HL Advance to next character block along in terrain interaction data
27851 BIT 7,(HL) If bit 7 of this position's terrain data (block is impassable vertically) is set then...
27853 JR NZ,27857 ...kill Magic Knight's y-velocity and exit routine
27855 XOR A Set A to zero, as jump was not impeded
27856 RET Return
27857 XOR A Set Magic Knight's y-velocity to zero...
27858 LD (25392),A ...
27861 LD A,1 Set A to one
27863 OR A Reset zero flag
27864 RET Return
Prev: 27666 Up: Map Next: 27865