Prev: E051 Up: Map Next: E087
E063: Check Walls Vertical First
Used by the routines at TestCellMovingRight and TestCellMovingLeft.
Tests an object against the walls in a cell, by testing it against each rectangle of the tile of the cell in turn, with the position along the Y axis first. The rectangles are four bytes each (the X and Y positions of the centre, then the half width and half depth), and a zero X position ends the list.
Input
DE X position to test
HL Y position to test
IX Object
Output
A The depth into the wall along the X axis (negative)
F The carry flag is set if there was a collision
Find the cell and its rectangle list.
CheckWallsVerticalFirst E063 CALL FindPositionInCell Call FindPositionInCell.
Find the list of rectangles for the tile.
E066 LD BC,$6334 Point BC at RectangleListTable.
E069 CALL GetTableEntry Call GetTableEntry.
E06C PUSH HL Copy the rectangle list to IY (using the stack).
E06D POP IY
Test the next rectangle.
CheckWallsVerticalFirst_Loop E06F LD A,(IY+$00) Return if this is the end of the list.
E072 AND A
E073 RET Z
Jump to CheckWallsVerticalFirst_Next if the object is not touching the rectangle.
E074 CALL CheckOverlapAlongY Call CheckOverlapAlongY.
E077 JR NC,CheckWallsVerticalFirst_Next Jump to CheckWallsVerticalFirst_Next if the object is not touching the rectangle.
Return if the object is touching the rectangle.
E079 CALL CheckOverlapAlongX Call CheckOverlapAlongX.
E07C RET C Return if the object is touching the rectangle.
Move on to the next rectangle.
CheckWallsVerticalFirst_Next E07D INC IY Move on to the next rectangle.
E07F INC IY
E081 INC IY
E083 INC IY
E085 JR CheckWallsVerticalFirst_Loop Jump to CheckWallsVerticalFirst_Loop.
View the equivalent code in;
Prev: E051 Up: Map Next: E087