Prev: CF67 Up: Map Next: CFC5
CFA1: Check Walls Vertical First
Used by the routines at CheckWallHorizontal and CheckWallHorizontalReverse.
Checks whether an object touches any wall rectangle in the cell containing a point. The list for the cell is found from WallRectanglePointers. The vertical range is checked first.
Input
DE The horizontal position of the point
HL The vertical position of the point
IX The address of the object
Output
A The depth into the wall along X, negative if they overlap
F The carry flag is set if the object touches a wall
Find the cell and its rectangle list.
CheckWallsVerticalFirst CFA1 CALL FindPositionInCell Call FindPositionInCell.
CFA4 LD BC,$6151 Point BC at WallRectanglePointers.
CFA7 CALL GetTableEntry Call GetTableEntry.
CFAA PUSH HL Copy the rectangle list to IY (using the stack).
CFAB POP IY
Test the next rectangle.
CheckWallsVerticalFirst_Next CFAD LD A,(IY+$00) Return if this is the end of the list.
CFB0 AND A
CFB1 RET Z
CFB2 CALL CheckOverlapAlongY Call CheckOverlapAlongY.
CFB5 JR NC,CheckWallsVerticalFirst_Skip Jump to CheckWallsVerticalFirst_Skip if the object is not touching the rectangle.
CFB7 CALL CheckOverlapAlongX Call CheckOverlapAlongX.
CFBA RET C Return if the object is touching the rectangle.
Move on to the next rectangle.
CheckWallsVerticalFirst_Skip CFBB INC IY Move on to the next rectangle.
CFBD INC IY
CFBF INC IY
CFC1 INC IY
CFC3 JR CheckWallsVerticalFirst_Next Jump to CheckWallsVerticalFirst_Next.
View the equivalent code in;
Prev: CF67 Up: Map Next: CFC5