![]() |
Routines |
| Prev: 47088 | Up: Map | Next: 47146 |
|
Used by the routines at HandleMoneyBag, HandleTumbleweed, HandleHorse, HandleCactus, HandlePointer and HandleBystander.
Checks whether an object is within a number of cells of the sheriff, both across and up the screen.
|
||||||||||||||
|
Compare the horizontal cells.
|
||||||||||||||
| CheckDistance | 47120 | LD A,(41599) | Fetch the horizontal cell of the sheriff from 41599. | |||||||||||
| 47123 | SUB (IX+2) | Subtract the horizontal cell of the object. | ||||||||||||
| 47126 | JP P,CheckDistance_CompareHorizontal | Jump to CheckDistance_CompareHorizontal if the difference is not negative. | ||||||||||||
| 47129 | NEG | Make the difference positive. | ||||||||||||
| CheckDistance_CompareHorizontal | 47131 | CP C | Compare it with the distance. | |||||||||||
| 47132 | RET NC | Return if the object is too far away. | ||||||||||||
|
Compare the vertical cells.
|
||||||||||||||
| 47133 | LD A,(41601) | Fetch the vertical cell of the sheriff from 41601. | ||||||||||||
| 47136 | SUB (IX+4) | Subtract the vertical cell of the object. | ||||||||||||
| 47139 | JP P,CheckDistance_CompareVertical | Jump to CheckDistance_CompareVertical if the difference is not negative. | ||||||||||||
| 47142 | NEG | Make the difference positive. | ||||||||||||
| CheckDistance_CompareVertical | 47144 | CP C | Compare it with the distance. | |||||||||||
| 47145 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: 47088 | Up: Map | Next: 47146 |