![]() |
Routines |
| Prev: 54798 | Up: Map | Next: 54855 |
|
Used by the routines at GoldfishGame_UpdatePlayer and Handler_SeaCreatures.
Applies horizontal and vertical movement deltas. Clone used in the main game is at ApplyMovementDeltas.
|
||||||||||||||||||
|
Fetch the current position and apply horizontal movement.
|
||||||||||||||||||
| Handler_SeaCreatureMovement | 54806 | LD C,(IX+0) | C=horizontal co-ordinate. | |||||||||||||||
| 54809 | LD B,(IX+1) | B=vertical co-ordinate. | ||||||||||||||||
| 54812 | LD E,(IX+2) | E=horizontal offset. | ||||||||||||||||
| 54815 | LD D,(IX+3) | D=vertical offset. | ||||||||||||||||
| 54818 | LD A,(IX+4) | A=horizontal movement. | ||||||||||||||||
| 54821 | ADD A,E | Add it to the horizontal offset. | ||||||||||||||||
| 54822 | CP 128 | Jump to Handler_SeaCreatureMovement_StepColumnRight if the offset overflowed (moving right). | ||||||||||||||||
| 54824 | JR NC,Handler_SeaCreatureMovement_StepColumnRight | |||||||||||||||||
| 54826 | CP 4 | Jump to Handler_SeaCreatureMovement_StoreHorizontalOffset if the offset is still in-range. | ||||||||||||||||
| 54828 | JR C,Handler_SeaCreatureMovement_StoreHorizontalOffset | |||||||||||||||||
| 54830 | INC C | Step the horizontal co-ordinate two left, then... | ||||||||||||||||
| 54831 | INC C | |||||||||||||||||
| Handler_SeaCreatureMovement_StepColumnRight | 54832 | DEC C | ...one right, so a crossed boundary updates the column. | |||||||||||||||
| 54833 | AND %00000011 | Keep the horizontal offset in the range 0-3. | ||||||||||||||||
| Handler_SeaCreatureMovement_StoreHorizontalOffset | 54835 | LD E,A | E=the updated horizontal offset. | |||||||||||||||
|
Apply vertical movement the same way.
|
||||||||||||||||||
| 54836 | LD A,(IX+5) | A=vertical movement. | ||||||||||||||||
| 54839 | ADD A,D | Add it to the vertical offset. | ||||||||||||||||
| 54840 | CP 128 | Jump to Handler_SeaCreatureMovement_StepRowDown if the offset overflowed (moving down). | ||||||||||||||||
| 54842 | JR NC,Handler_SeaCreatureMovement_StepRowDown | |||||||||||||||||
| 54844 | CP 4 | Jump to Handler_SeaCreatureMovement_StoreVerticalOffset if the offset is still in-range. | ||||||||||||||||
| 54846 | JR C,Handler_SeaCreatureMovement_StoreVerticalOffset | |||||||||||||||||
| 54848 | INC B | Step the vertical co-ordinate two up, then... | ||||||||||||||||
| 54849 | INC B | |||||||||||||||||
| Handler_SeaCreatureMovement_StepRowDown | 54850 | DEC B | ...one down, so a crossed boundary updates the row. | |||||||||||||||
| 54851 | AND %00000011 | Keep the vertical offset in the range 0-3. | ||||||||||||||||
| Handler_SeaCreatureMovement_StoreVerticalOffset | 54853 | LD D,A | D=the updated vertical offset. | |||||||||||||||
| 54854 | RET | Return. | ||||||||||||||||
| Prev: 54798 | Up: Map | Next: 54855 |