![]() |
Routines |
| Prev: 52381 | Up: Map | Next: 52423 |
|
Used by the routines at TestObjectIntersections, TestObjectCanBePickedUp, BlockMovementInX, BlockMovementInY and BlockMovementInZ.
Tests whether two objects overlap along y, once the first has moved by its new speed along y. They overlap when the distance between the y positions is smaller than the two depths added together.
|
||||||||||||||||
|
Compare the y distance with the depths.
|
||||||||||||||||
| TestOverlapInY | 52402 | LD A,(IX+5) | Fetch the depth of the first object. | |||||||||||||
| 52405 | ADD A,(IY+5) | Add the depth of the second object. | ||||||||||||||
| 52408 | LD D,A | Copy the total to D. | ||||||||||||||
|
Take the Y coordinate of the second object off the Y coordinate of the first object plus the new speed.
|
||||||||||||||||
| 52409 | LD A,(IX+2) | Fetch the y position of the first object. | ||||||||||||||
| 52412 | ADD A,L | Add L. | ||||||||||||||
| 52413 | SUB (IY+2) | Subtract the y position of the second object. | ||||||||||||||
| 52416 | JP P,TestOverlapInY_TakeDepths | Jump to TestOverlapInY_TakeDepths if it is not negative. | ||||||||||||||
| 52419 | NEG | Negate A. | ||||||||||||||
| TestOverlapInY_TakeDepths | 52421 | SUB D | Take the total depths off it, which sets the carry flag if the objects overlap. | |||||||||||||
| 52422 | RET | Return. | ||||||||||||||
| Prev: 52381 | Up: Map | Next: 52423 |