Prev: 57479 Up: Map Next: 57540
57504: 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 57504 CALL FindPositionInCell Call FindPositionInCell.
Find the list of rectangles for the tile.
57507 LD BC,25396 Point BC at RectangleListTable.
57510 CALL GetTableEntry Call GetTableEntry.
57513 PUSH HL Copy the rectangle list to IY (using the stack).
57514 POP IY
Test the next rectangle.
CheckWallsHorizontalFirst_Loop 57516 LD A,(IY+0) Return if this is the end of the list.
57519 AND A
57520 RET Z
57521 CALL CheckOverlapAlongX Call CheckOverlapAlongX.
57524 JR NC,CheckWallsHorizontalFirst_Next Jump to CheckWallsHorizontalFirst_Next if the object is not touching the rectangle.
57526 CALL CheckOverlapAlongY Call CheckOverlapAlongY.
57529 RET C Return if the object is touching the rectangle.
Move on to the next rectangle.
CheckWallsHorizontalFirst_Next 57530 INC IY Move on to the next rectangle.
57532 INC IY
57534 INC IY
57536 INC IY
57538 JR CheckWallsHorizontalFirst_Loop Jump to CheckWallsHorizontalFirst_Loop.
View the equivalent code in;
Prev: 57479 Up: Map Next: 57540