![]() |
Routines |
| Prev: CC38 | Up: Map | Next: CCB2 |
|
Used by the routines at TestObjectIntersections, TestObjectCanBePickedUp, BlockMovementInX, BlockMovementInY and BlockMovementInZ.
Tests whether two objects overlap along x, once the first has moved by its new speed along x. They overlap when the distance between the x positions is smaller than the two widths added together.
|
||||||||||||||||
|
Compare the x distance with the widths.
|
||||||||||||||||
| TestOverlapInX | CC9D | LD A,(IX+$04) | Fetch the width of the first object. | |||||||||||||
| CCA0 | ADD A,(IY+$04) | Add the width of the second object. | ||||||||||||||
| CCA3 | LD D,A | Copy the total to D. | ||||||||||||||
|
Take the X coordinate of the second object off the X coordinate of the first object plus the new speed.
|
||||||||||||||||
| CCA4 | LD A,(IX+$01) | Fetch the x position of the first object. | ||||||||||||||
| CCA7 | ADD A,C | Add C. | ||||||||||||||
| CCA8 | SUB (IY+$01) | Subtract the x position of the second object. | ||||||||||||||
| CCAB | JP P,TestOverlapInX_TakeWidths | Jump to TestOverlapInX_TakeWidths if it is not negative. | ||||||||||||||
| CCAE | NEG | Negate A. | ||||||||||||||
| TestOverlapInX_TakeWidths | CCB0 | SUB D | Take the total widths off it, which sets the carry flag if the objects overlap. | |||||||||||||
| CCB1 | RET | Return. | ||||||||||||||
| Prev: CC38 | Up: Map | Next: CCB2 |