![]() |
Routines |
| Prev: CFDE | Up: Map | Next: D01B |
|
Used by the routines at CheckWallsVerticalFirst and CheckWallsHorizontalFirst.
Checks whether the vertical range of an object, after it moves by VerticalSpeed, overlaps the vertical range of a rectangle of a wall. The distance between the middles is compared with half of the height of the object plus the half height of the rectangle.
|
||||||||||||||||||
|
Find the sum of the half heights.
|
||||||||||||||||||
| CheckOverlapAlongY | D002 | LD A,(IX+$09) | Find the sum of half of the height of the object and the half height of the rectangle, in C. | |||||||||||||||
| D005 | SRL A | |||||||||||||||||
| D007 | ADD A,(IY+$03) | |||||||||||||||||
| D00A | LD C,A | |||||||||||||||||
|
Find the distance between the middles.
|
||||||||||||||||||
| D00B | LD A,($A215) | Fetch VerticalSpeed. | ||||||||||||||||
| D00E | SRA A | Add half of it to the position, then find the distance from the middle of the rectangle. | ||||||||||||||||
| D010 | ADD A,D | |||||||||||||||||
| D011 | SUB (IY+$01) | |||||||||||||||||
|
Make the distance positive, then subtract the sum.
|
||||||||||||||||||
| D014 | JP P,CheckOverlapAlongY_Depth | Make the distance positive. | ||||||||||||||||
| D017 | NEG | |||||||||||||||||
| CheckOverlapAlongY_Depth | D019 | SUB C | Subtract the sum. | |||||||||||||||
| D01A | RET | Return. | ||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||
| Prev: CFDE | Up: Map | Next: D01B |