![]() |
Routines |
| Prev: CD58 | Up: Map | Next: CDAF |
|
Used by the routine at UpdateEndingGhost.
Subtracts a position from a target and limits the difference to four pixels in either direction.
|
||||||||||||||
| LimitDistance | CD9E | SUB (IX+$0A) | Work out how far the object is from the target along the X axis, and jump to LimitDistance_Negative if the target is on the left. | |||||||||||
| CDA1 | JR C,LimitDistance_Negative | |||||||||||||
| CDA3 | CP $04 | Return if the distance is less than four. | ||||||||||||
| CDA5 | RET C | |||||||||||||
| CDA6 | LD A,$04 | Limit the distance to four and return. | ||||||||||||
| CDA8 | RET | |||||||||||||
| LimitDistance_Negative | CDA9 | CP $FC | Return if the distance is FC or more, which means it is less than four to the left. | |||||||||||
| CDAB | RET NC | |||||||||||||
| CDAC | LD A,$FC | Limit the distance to minus four and return. | ||||||||||||
| CDAE | RET | |||||||||||||
| Prev: CD58 | Up: Map | Next: CDAF |