![]() |
Routines |
| Prev: 53153 | Up: Map | Next: 53214 |
|
Used by the routines at CheckWallsVerticalFirst and CheckWallsHorizontalFirst.
Checks whether the horizontal range of an object, after it moves by HorizontalSpeed, overlaps the horizontal range of a rectangle of a wall. The distance between the middles is compared with half of the width of the object plus the half width of the rectangle.
|
||||||||||||||||||
|
Find the sum of the half widths.
|
||||||||||||||||||
| CheckOverlapAlongX | 53189 | LD A,(IX+8) | Find the sum of half of the width of the object and the half width of the rectangle, in C. | |||||||||||||||
| 53192 | SRL A | |||||||||||||||||
| 53194 | ADD A,(IY+2) | |||||||||||||||||
| 53197 | LD C,A | |||||||||||||||||
|
Find the distance between the middles.
|
||||||||||||||||||
| 53198 | LD A,(41492) | Fetch HorizontalSpeed. | ||||||||||||||||
| 53201 | SRA A | Add half of it to the position, then find the distance from the middle of the rectangle. | ||||||||||||||||
| 53203 | ADD A,E | |||||||||||||||||
| 53204 | SUB (IY+0) | |||||||||||||||||
|
Make the distance positive, then subtract the sum.
|
||||||||||||||||||
| 53207 | JP P,CheckOverlapAlongX_Depth | Make the distance positive. | ||||||||||||||||
| 53210 | NEG | |||||||||||||||||
| CheckOverlapAlongX_Depth | 53212 | SUB C | Subtract the sum. | |||||||||||||||
| 53213 | RET | Return. | ||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||
| Prev: 53153 | Up: Map | Next: 53214 |