![]() |
Routines |
| Prev: 6BFE | Up: Map | Next: 6C82 |
|
Used by the routine at HandlerAccelerate.
Moves the pointer at CurrentObject so that it still points to the first map point which is within 60 map units of the player's X position.
|
||||
| UpdateCurrentObject | 6C2D | XOR A | Write 00 to Flag_PointerMovedBack (it is set to 01 if the pointer moves back). | |
| 6C2E | LD ($5E1B),A | |||
| 6C31 | LD BC,($5E19) | Fetch the pointer to the first map point in view (CurrentObject). | ||
|
Look at the earlier map points to see if the pointer has to move back.
|
||||
| UpdateCurrentObject_Back | 6C35 | DEC BC | Decrease BC by three (to the previous map point). | |
| 6C36 | DEC BC | |||
| 6C37 | DEC BC | |||
| 6C38 | LD A,(BC) | Fetch the X position of the map point. | ||
| 6C39 | LD D,A | Keep the X position in D. | ||
| 6C3A | CALL ScaleValue_DivideByEight | Call ScaleValue_DivideByEight to convert it to map units in DE. | ||
| 6C3D | CALL GetMapDistance | Find how far the map point is from the player using GetMapDistance. | ||
| 6C40 | JR NC,UpdateCurrentObject_Moved | Jump to UpdateCurrentObject_Moved if the map point is not close enough. | ||
| 6C42 | LD A,$01 | Write 01 to Flag_PointerMovedBack. | ||
| 6C44 | LD ($5E1B),A | |||
| 6C47 | JR UpdateCurrentObject_Back | Jump to UpdateCurrentObject_Back. | ||
| UpdateCurrentObject_Moved | 6C49 | LD A,($5E1B) | Fetch the flag which says whether the pointer moved back (Flag_PointerMovedBack). | |
| 6C4C | AND A | Jump to UpdateCurrentObject_Forward if the pointer did not move back. | ||
| 6C4D | JR Z,UpdateCurrentObject_Forward | |||
| 6C4F | INC BC | Increment BC by three (to the first map point which is close enough). | ||
| 6C50 | INC BC | |||
| 6C51 | INC BC | |||
| UpdateCurrentObject_Store | 6C52 | LD ($5E19),BC | Write BC to CurrentObject. | |
| 6C56 | RET | Return. | ||
|
Check whether the pointer has to move forward.
|
||||
| UpdateCurrentObject_Forward | 6C57 | LD BC,($5E19) | Fetch the pointer to the first map point in view (CurrentObject). | |
| 6C5B | LD A,(BC) | Fetch the X position of the map point. | ||
| 6C5C | LD D,A | Keep the X position in D. | ||
| 6C5D | CALL ScaleValue_DivideByEight | Call ScaleValue_DivideByEight to convert it to map units in DE. | ||
| 6C60 | CALL GetMapDistance | Find how far the map point is from the player using GetMapDistance. | ||
| 6C63 | RET C | Return if the map point is close enough. | ||
| UpdateCurrentObject_Closer | 6C64 | LD ($5E1C),HL | Write the distance to PreviousDistance. | |
| UpdateCurrentObject_NextPoint | 6C67 | INC BC | Increment BC by three (to the next map point). | |
| 6C68 | INC BC | |||
| 6C69 | INC BC | |||
| 6C6A | LD A,(BC) | Fetch the X position of the map point. | ||
| 6C6B | LD D,A | Keep the X position in D. | ||
| 6C6C | CALL ScaleValue_DivideByEight | Call ScaleValue_DivideByEight to convert it to map units in DE. | ||
| 6C6F | CALL GetMapDistance | Find how far the map point is from the player using GetMapDistance. | ||
| 6C72 | JR C,UpdateCurrentObject_Store | Jump to UpdateCurrentObject_Store if the map point is close enough. | ||
| 6C74 | PUSH HL | Stash the distance on the stack. | ||
| 6C75 | LD DE,($5E1C) | Fetch the previous distance from PreviousDistance. | ||
| 6C79 | AND A | HL=HL - DE. | ||
| 6C7A | SBC HL,DE | |||
| 6C7C | POP HL | Restore the distance (HL) from the stack. | ||
| 6C7D | JR Z,UpdateCurrentObject_NextPoint | Jump to UpdateCurrentObject_NextPoint if the distance is the same as before. | ||
| 6C7F | JR C,UpdateCurrentObject_Closer | Jump to UpdateCurrentObject_Closer if the map point is nearer than the previous one. | ||
| 6C81 | RET | Return. | ||
| Prev: 6BFE | Up: Map | Next: 6C82 |