![]() |
Routines |
| Prev: B7F0 | Up: Map | Next: B82A |
|
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 | B810 | LD A,($A27F) | Fetch the horizontal cell of the sheriff from A27F. | |||||||||||
| B813 | SUB (IX+$02) | Subtract the horizontal cell of the object. | ||||||||||||
| B816 | JP P,CheckDistance_CompareHorizontal | Jump to CheckDistance_CompareHorizontal if the difference is not negative. | ||||||||||||
| B819 | NEG | Make the difference positive. | ||||||||||||
| CheckDistance_CompareHorizontal | B81B | CP C | Compare it with the distance. | |||||||||||
| B81C | RET NC | Return if the object is too far away. | ||||||||||||
|
Compare the vertical cells.
|
||||||||||||||
| B81D | LD A,($A281) | Fetch the vertical cell of the sheriff from A281. | ||||||||||||
| B820 | SUB (IX+$04) | Subtract the vertical cell of the object. | ||||||||||||
| B823 | JP P,CheckDistance_CompareVertical | Jump to CheckDistance_CompareVertical if the difference is not negative. | ||||||||||||
| B826 | NEG | Make the difference positive. | ||||||||||||
| CheckDistance_CompareVertical | B828 | CP C | Compare it with the distance. | |||||||||||
| B829 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: B7F0 | Up: Map | Next: B82A |