![]() |
Routines |
| Prev: 6C2D | Up: Map | Next: 6C96 |
|
Used by the routine at UpdateCurrentObject.
Finds the distance between the first co-ordinate of the player's map position at PlayerMapPosition and the value in DE. The carry flag is set when the distance is less than 60.
|
||||||||||||||
| GetMapDistance | 6C82 | LD HL,($5E05) | Fetch the player's X position on the map (PlayerMapPosition). | |||||||||||
| 6C85 | AND A | HL=HL - DE. | ||||||||||||
| 6C86 | SBC HL,DE | |||||||||||||
| 6C88 | JR NC,GetMapDistance_Compare | Jump to GetMapDistance_Compare if there was no carry. | ||||||||||||
| 6C8A | CALL NegateHL | Call NegateHL. | ||||||||||||
| GetMapDistance_Compare | 6C8D | PUSH HL | Stash HL on the stack. | |||||||||||
| 6C8E | LD DE,$0060 | Set the furthest distance in view, 0060. | ||||||||||||
| 6C91 | AND A | Compare the distance with the furthest distance in view. | ||||||||||||
| 6C92 | SBC HL,DE | |||||||||||||
| 6C94 | POP HL | Restore HL from the stack. | ||||||||||||
| 6C95 | RET | Return. | ||||||||||||
| Prev: 6C2D | Up: Map | Next: 6C96 |