![]() |
Routines |
| Prev: CFA1 | Up: Map | Next: CFDE |
|
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 | CFC5 | LD A,(IX+$08) | Find the sum of half of the width of the object and the half width of the rectangle, in C. | |||||||||||||||
| CFC8 | SRL A | |||||||||||||||||
| CFCA | ADD A,(IY+$02) | |||||||||||||||||
| CFCD | LD C,A | |||||||||||||||||
|
Find the distance between the middles.
|
||||||||||||||||||
| CFCE | LD A,($A214) | Fetch HorizontalSpeed. | ||||||||||||||||
| CFD1 | SRA A | Add half of it to the position, then find the distance from the middle of the rectangle. | ||||||||||||||||
| CFD3 | ADD A,E | |||||||||||||||||
| CFD4 | SUB (IY+$00) | |||||||||||||||||
|
Make the distance positive, then subtract the sum.
|
||||||||||||||||||
| CFD7 | JP P,CheckOverlapAlongX_Depth | Make the distance positive. | ||||||||||||||||
| CFDA | NEG | |||||||||||||||||
| CheckOverlapAlongX_Depth | CFDC | SUB C | Subtract the sum. | |||||||||||||||
| CFDD | RET | Return. | ||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||
| Prev: CFA1 | Up: Map | Next: CFDE |