![]() |
Routines |
| Prev: B8B7 | Up: Map | Next: B8E2 |
|
Used by the routines at BlockMovementInX, BlockMovementInY, BlockMovementInZ, TestObjectIntersections and TestObjectCanBePickedUp.
Tests whether two objects overlap along z, once the first has moved by its new speed along z. They overlap when the distance between the z positions is smaller than the height of whichever of the objects is lower.
|
||||||||||||||||
|
Use the height of the lower object.
|
||||||||||||||||
| TestOverlapInZ | B8CC | LD A,(IX+$03) | Fetch the z position of the first object. | |||||||||||||
| B8CF | ADD A,H | Add H. | ||||||||||||||
| B8D0 | SUB (IY+$03) | Subtract the z position of the second object. | ||||||||||||||
| B8D3 | JP P,TestOverlapInZ_SecondLower | Jump to TestOverlapInZ_SecondLower if the first object is the higher. | ||||||||||||||
| B8D6 | NEG | Negate A. | ||||||||||||||
| B8D8 | LD D,(IX+$06) | Fetch the height of the first object, which is the lower. | ||||||||||||||
|
Compare the distance with the height of the lower object.
|
||||||||||||||||
| TestOverlapInZ_Compare | B8DB | SUB D | Subtract the height of the lower object, which sets the carry flag if they overlap. | |||||||||||||
| B8DC | RET | Return. | ||||||||||||||
| TestOverlapInZ_SecondLower | B8DD | LD D,(IY+$06) | Fetch the height of the second object, which is the lower. | |||||||||||||
| B8E0 | JR TestOverlapInZ_Compare | Jump to TestOverlapInZ_Compare. | ||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||
| Prev: B8B7 | Up: Map | Next: B8E2 |