![]() |
Routines |
| Prev: 57425 | Up: Map | Next: 57479 |
|
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.
|
||||||||||||||||||
|
Find the cell and its rectangle list.
|
||||||||||||||||||
| CheckWallsVerticalFirst | 57443 | CALL FindPositionInCell | Call FindPositionInCell. | |||||||||||||||
|
Find the list of rectangles for the tile.
|
||||||||||||||||||
| 57446 | LD BC,25396 | Point BC at RectangleListTable. | ||||||||||||||||
| 57449 | CALL GetTableEntry | Call GetTableEntry. | ||||||||||||||||
| 57452 | PUSH HL | Copy the rectangle list to IY (using the stack). | ||||||||||||||||
| 57453 | POP IY | |||||||||||||||||
|
Test the next rectangle.
|
||||||||||||||||||
| CheckWallsVerticalFirst_Loop | 57455 | LD A,(IY+0) | Return if this is the end of the list. | |||||||||||||||
| 57458 | AND A | |||||||||||||||||
| 57459 | RET Z | |||||||||||||||||
|
Jump to CheckWallsVerticalFirst_Next if the object is not touching the rectangle.
|
||||||||||||||||||
| 57460 | CALL CheckOverlapAlongY | Call CheckOverlapAlongY. | ||||||||||||||||
| 57463 | JR NC,CheckWallsVerticalFirst_Next | Jump to CheckWallsVerticalFirst_Next if the object is not touching the rectangle. | ||||||||||||||||
|
Return if the object is touching the rectangle.
|
||||||||||||||||||
| 57465 | CALL CheckOverlapAlongX | Call CheckOverlapAlongX. | ||||||||||||||||
| 57468 | RET C | Return if the object is touching the rectangle. | ||||||||||||||||
|
Move on to the next rectangle.
|
||||||||||||||||||
| CheckWallsVerticalFirst_Next | 57469 | INC IY | Move on to the next rectangle. | |||||||||||||||
| 57471 | INC IY | |||||||||||||||||
| 57473 | INC IY | |||||||||||||||||
| 57475 | INC IY | |||||||||||||||||
| 57477 | JR CheckWallsVerticalFirst_Loop | Jump to CheckWallsVerticalFirst_Loop. | ||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||
| Prev: 57425 | Up: Map | Next: 57479 |