![]() |
Routines |
| Prev: 40501 | Up: Map | Next: 40675 |
|
Finds the overlap with a slope that faces the other way by swapping the horizontal edges of the object, calling FindSlopeOverlap and swapping them back.
|
||||||||
| FindMirroredSlopeOverlap | 40570 | LD A,(IX+0) | Fetch the left edge of the object. | |||||
| 40573 | LD B,(IX+2) | Fetch the right limit of the object. | ||||||
| 40576 | LD (IX+0),B | Store the right limit as the left edge. | ||||||
| 40579 | LD (IX+2),A | Store the left edge as the right limit. | ||||||
| 40582 | CALL FindSlopeOverlap | Find the overlap with the slope. | ||||||
| 40585 | LD A,(IX+0) | Fetch the left edge of the object. | ||||||
| 40588 | LD C,(IX+2) | Fetch the right limit of the object. | ||||||
| 40591 | LD (IX+0),C | Store the right limit as the left edge. | ||||||
| 40594 | LD (IX+2),A | Store the left edge as the right limit. | ||||||
| 40597 | LD A,(23580) | Fetch the result. | ||||||
| 40600 | AND A | Test it. | ||||||
| 40601 | RET Z | Return if the box does not overlap. | ||||||
| 40602 | LD A,L | Fetch the horizontal position of the box. | ||||||
| 40603 | ADD A,D | Add the width of the box. | ||||||
| 40604 | CP (IX+2) | Compare it with the right limit of the object. | ||||||
| 40607 | RET NC | Return if it is further to the right. | ||||||
| 40608 | XOR A | Clear the result. | ||||||
| 40609 | LD (23580),A | Store it. | ||||||
| 40612 | RET | Return. | ||||||
|
This entry point is used by the routine at TestSlopeCollision.
|
||||||||
| TestSlopeCollision_Mirrored | 40613 | CALL FindMirroredSlopeOverlap | Find the overlap with the mirrored slope. | |||||
| TestSlopeCollision_MirroredDepth | 40616 | LD A,(23580) | Fetch the result. | |||||
| 40619 | AND A | Test it. | ||||||
| 40620 | RET Z | Return if the box does not overlap. | ||||||
| 40621 | DEC A | Reduce the result to zero. | ||||||
| 40622 | LD (23580),A | Store it. | ||||||
| 40625 | LD A,(IX+0) | Fetch the left edge of the object. | ||||||
| 40628 | SUB B | Subtract the distance up the slope. | ||||||
| 40629 | SUB L | Subtract the horizontal position of the box. | ||||||
| 40630 | RET C | Return if the box is clear of the slope. | ||||||
| 40631 | RET Z | Return if the depth is zero. | ||||||
| 40632 | NEG | Make the depth positive. | ||||||
| 40634 | LD (23578),A | Store the depth. | ||||||
| 40637 | JP SetOverlapFlag | Jump to SetOverlapFlag to say that the box touches the slope. | ||||||
|
This entry point is used by the routine at TestSlopeCollision.
|
||||||||
| TestSlopeCollision_Up | 40640 | CALL FindSlopeOverlap | Find the overlap with the slope. | |||||
| 40643 | LD A,B | Fetch the distance up the slope. | ||||||
| 40644 | NEG | Negate it. | ||||||
| 40646 | LD B,A | Store it. | ||||||
| 40647 | LD A,(23580) | Fetch the result. | ||||||
| 40650 | AND A | Test it. | ||||||
| 40651 | RET Z | Return if the box does not overlap. | ||||||
| 40652 | LD A,L | Fetch the horizontal position of the box. | ||||||
| 40653 | ADD A,D | Add the width of the box. | ||||||
| 40654 | CP (IX+0) | Compare it with the left edge of the object. | ||||||
| 40657 | JP NC,TestSlopeCollision_MirroredDepth | Jump to TestSlopeCollision_MirroredDepth if it is further to the right. | ||||||
| 40660 | XOR A | Clear the result. | ||||||
| 40661 | LD (23580),A | Store it. | ||||||
| 40664 | RET | Return. | ||||||
|
This entry point is used by the routine at TestSlopeCollision.
|
||||||||
| TestSlopeCollision_UpMirrored | 40665 | CALL FindMirroredSlopeOverlap | Find the overlap with the mirrored slope. | |||||
| 40668 | LD A,B | Fetch the distance up the slope. | ||||||
| 40669 | NEG | Negate it. | ||||||
| 40671 | LD B,A | Store it. | ||||||
| 40672 | JP TestSlopeCollision_Depth | Jump to TestSlopeCollision_Depth. | ||||||
| Prev: 40501 | Up: Map | Next: 40675 |