![]() |
Routines |
| Prev: CCB2 | Up: Map | Next: CCDD |
|
Used by the routines at TestObjectIntersections, TestObjectCanBePickedUp, BlockMovementInX, BlockMovementInY and BlockMovementInZ.
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 | CCC7 | LD A,(IX+$03) | Fetch the z position of the first object. | |||||||||||||
| CCCA | ADD A,H | Add H. | ||||||||||||||
| CCCB | SUB (IY+$03) | Subtract the z position of the second object. | ||||||||||||||
| CCCE | JP P,TestOverlapInZ_Second | Jump to TestOverlapInZ_Second if it is not negative. | ||||||||||||||
| CCD1 | NEG | Negate A. | ||||||||||||||
| CCD3 | LD D,(IX+$06) | Fetch the height of the first object, which is the lower. | ||||||||||||||
| TestOverlapInZ_Compare | CCD6 | SUB D | Take the height off it, which sets the carry flag if the objects overlap. | |||||||||||||
| CCD7 | RET | Return. | ||||||||||||||
| TestOverlapInZ_Second | CCD8 | LD D,(IY+$06) | Fetch the height of the second object, which is the lower. | |||||||||||||
| CCDB | JR TestOverlapInZ_Compare | Jump to TestOverlapInZ_Compare. | ||||||||||||||
| Prev: CCB2 | Up: Map | Next: CCDD |