![]() |
Routines |
| Prev: 9E35 | Up: Map | Next: 9EE3 |
|
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 | 9E7A | LD A,(IX+$00) | Fetch the left edge of the object. | |||||
| 9E7D | LD B,(IX+$02) | Fetch the right limit of the object. | ||||||
| 9E80 | LD (IX+$00),B | Store the right limit as the left edge. | ||||||
| 9E83 | LD (IX+$02),A | Store the left edge as the right limit. | ||||||
| 9E86 | CALL FindSlopeOverlap | Find the overlap with the slope. | ||||||
| 9E89 | LD A,(IX+$00) | Fetch the left edge of the object. | ||||||
| 9E8C | LD C,(IX+$02) | Fetch the right limit of the object. | ||||||
| 9E8F | LD (IX+$00),C | Store the right limit as the left edge. | ||||||
| 9E92 | LD (IX+$02),A | Store the left edge as the right limit. | ||||||
| 9E95 | LD A,($5C1C) | Fetch the result. | ||||||
| 9E98 | AND A | Test it. | ||||||
| 9E99 | RET Z | Return if the box does not overlap. | ||||||
| 9E9A | LD A,L | Fetch the horizontal position of the box. | ||||||
| 9E9B | ADD A,D | Add the width of the box. | ||||||
| 9E9C | CP (IX+$02) | Compare it with the right limit of the object. | ||||||
| 9E9F | RET NC | Return if it is further to the right. | ||||||
| 9EA0 | XOR A | Clear the result. | ||||||
| 9EA1 | LD ($5C1C),A | Store it. | ||||||
| 9EA4 | RET | Return. | ||||||
|
This entry point is used by the routine at TestSlopeCollision.
|
||||||||
| TestSlopeCollision_Mirrored | 9EA5 | CALL FindMirroredSlopeOverlap | Find the overlap with the mirrored slope. | |||||
| TestSlopeCollision_MirroredDepth | 9EA8 | LD A,($5C1C) | Fetch the result. | |||||
| 9EAB | AND A | Test it. | ||||||
| 9EAC | RET Z | Return if the box does not overlap. | ||||||
| 9EAD | DEC A | Reduce the result to zero. | ||||||
| 9EAE | LD ($5C1C),A | Store it. | ||||||
| 9EB1 | LD A,(IX+$00) | Fetch the left edge of the object. | ||||||
| 9EB4 | SUB B | Subtract the distance up the slope. | ||||||
| 9EB5 | SUB L | Subtract the horizontal position of the box. | ||||||
| 9EB6 | RET C | Return if the box is clear of the slope. | ||||||
| 9EB7 | RET Z | Return if the depth is zero. | ||||||
| 9EB8 | NEG | Make the depth positive. | ||||||
| 9EBA | LD ($5C1A),A | Store the depth. | ||||||
| 9EBD | 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 | 9EC0 | CALL FindSlopeOverlap | Find the overlap with the slope. | |||||
| 9EC3 | LD A,B | Fetch the distance up the slope. | ||||||
| 9EC4 | NEG | Negate it. | ||||||
| 9EC6 | LD B,A | Store it. | ||||||
| 9EC7 | LD A,($5C1C) | Fetch the result. | ||||||
| 9ECA | AND A | Test it. | ||||||
| 9ECB | RET Z | Return if the box does not overlap. | ||||||
| 9ECC | LD A,L | Fetch the horizontal position of the box. | ||||||
| 9ECD | ADD A,D | Add the width of the box. | ||||||
| 9ECE | CP (IX+$00) | Compare it with the left edge of the object. | ||||||
| 9ED1 | JP NC,TestSlopeCollision_MirroredDepth | Jump to TestSlopeCollision_MirroredDepth if it is further to the right. | ||||||
| 9ED4 | XOR A | Clear the result. | ||||||
| 9ED5 | LD ($5C1C),A | Store it. | ||||||
| 9ED8 | RET | Return. | ||||||
|
This entry point is used by the routine at TestSlopeCollision.
|
||||||||
| TestSlopeCollision_UpMirrored | 9ED9 | CALL FindMirroredSlopeOverlap | Find the overlap with the mirrored slope. | |||||
| 9EDC | LD A,B | Fetch the distance up the slope. | ||||||
| 9EDD | NEG | Negate it. | ||||||
| 9EDF | LD B,A | Store it. | ||||||
| 9EE0 | JP TestSlopeCollision_Depth | Jump to TestSlopeCollision_Depth. | ||||||
| Prev: 9E35 | Up: Map | Next: 9EE3 |