Prev: E087 Up: Map Next: E0C4
E0A0: Check Walls Horizontal First
Used by the routines at TestCellMovingUp and TestCellMovingDown.
Tests an object against the walls in a cell, in the same way as CheckWallsVerticalFirst but with the position along the X axis first.
Input
DE X position to test
HL Y position to test
IX Object
Output
A The depth into the wall along the Y axis (negative)
F The carry flag is set if there was a collision
Find the cell and its rectangle list.
CheckWallsHorizontalFirst E0A0 CALL FindPositionInCell Call FindPositionInCell.
Find the list of rectangles for the tile.
E0A3 LD BC,$6334 Point BC at RectangleListTable.
E0A6 CALL GetTableEntry Call GetTableEntry.
E0A9 PUSH HL Copy the rectangle list to IY (using the stack).
E0AA POP IY
Test the next rectangle.
CheckWallsHorizontalFirst_Loop E0AC LD A,(IY+$00) Return if this is the end of the list.
E0AF AND A
E0B0 RET Z
E0B1 CALL CheckOverlapAlongX Call CheckOverlapAlongX.
E0B4 JR NC,CheckWallsHorizontalFirst_Next Jump to CheckWallsHorizontalFirst_Next if the object is not touching the rectangle.
E0B6 CALL CheckOverlapAlongY Call CheckOverlapAlongY.
E0B9 RET C Return if the object is touching the rectangle.
Move on to the next rectangle.
CheckWallsHorizontalFirst_Next E0BA INC IY Move on to the next rectangle.
E0BC INC IY
E0BE INC IY
E0C0 INC IY
E0C2 JR CheckWallsHorizontalFirst_Loop Jump to CheckWallsHorizontalFirst_Loop.
View the equivalent code in;
Prev: E087 Up: Map Next: E0C4