Prev: E0A0 Up: Map Next: E0DD
E0C4: Check Overlap Along Y
Used by the routines at CheckWallsVerticalFirst and CheckWallsHorizontalFirst.
Checks whether an object overlaps a rectangle along the Y axis, using the position that the velocity takes the object to.
Input
D Position of the object along the Y axis in the cell
IX Object
IY Rectangle
Output
A The depth that the object has gone into the rectangle (negative)
F The carry flag is set if the object overlaps the rectangle
Find the sum of the half depths.
CheckOverlapAlongY E0C4 LD A,(IX+$09) Work out the combined half depths of the object and the rectangle.
E0C7 SRL A
E0C9 ADD A,(IY+$03)
E0CC LD C,A
Find the distance between the middles.
E0CD LD A,(IX+$0B) Fetch the velocity along y.
E0D0 SRA A Add half of it to the position, then find the distance from the middle of the rectangle.
E0D2 ADD A,D
E0D3 SUB (IY+$01)
Make the distance positive, then subtract the sum.
E0D6 JP P,CheckOverlapAlongY_Depth Make the distance positive.
E0D9 NEG
CheckOverlapAlongY_Depth E0DB SUB C Subtract the sum.
E0DC RET Return.
View the equivalent code in;
Prev: E0A0 Up: Map Next: E0DD