![]() |
Routines |
| Prev: D60E | Up: Map | Next: D647 |
|
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 | D616 | LD C,(IX+$00) | C=horizontal co-ordinate. | |||||||||||||||
| D619 | LD B,(IX+$01) | B=vertical co-ordinate. | ||||||||||||||||
| D61C | LD E,(IX+$02) | E=horizontal offset. | ||||||||||||||||
| D61F | LD D,(IX+$03) | D=vertical offset. | ||||||||||||||||
| D622 | LD A,(IX+$04) | A=horizontal movement. | ||||||||||||||||
| D625 | ADD A,E | Add it to the horizontal offset. | ||||||||||||||||
| D626 | CP $80 | Jump to Handler_SeaCreatureMovement_StepColumnRight if the offset overflowed (moving right). | ||||||||||||||||
| D628 | JR NC,Handler_SeaCreatureMovement_StepColumnRight | |||||||||||||||||
| D62A | CP $04 | Jump to Handler_SeaCreatureMovement_StoreHorizontalOffset if the offset is still in-range. | ||||||||||||||||
| D62C | JR C,Handler_SeaCreatureMovement_StoreHorizontalOffset | |||||||||||||||||
| D62E | INC C | Step the horizontal co-ordinate two left, then... | ||||||||||||||||
| D62F | INC C | |||||||||||||||||
| Handler_SeaCreatureMovement_StepColumnRight | D630 | DEC C | ...one right, so a crossed boundary updates the column. | |||||||||||||||
| D631 | AND %00000011 | Keep the horizontal offset in the range 00-03. | ||||||||||||||||
| Handler_SeaCreatureMovement_StoreHorizontalOffset | D633 | LD E,A | E=the updated horizontal offset. | |||||||||||||||
|
Apply vertical movement the same way.
|
||||||||||||||||||
| D634 | LD A,(IX+$05) | A=vertical movement. | ||||||||||||||||
| D637 | ADD A,D | Add it to the vertical offset. | ||||||||||||||||
| D638 | CP $80 | Jump to Handler_SeaCreatureMovement_StepRowDown if the offset overflowed (moving down). | ||||||||||||||||
| D63A | JR NC,Handler_SeaCreatureMovement_StepRowDown | |||||||||||||||||
| D63C | CP $04 | Jump to Handler_SeaCreatureMovement_StoreVerticalOffset if the offset is still in-range. | ||||||||||||||||
| D63E | JR C,Handler_SeaCreatureMovement_StoreVerticalOffset | |||||||||||||||||
| D640 | INC B | Step the vertical co-ordinate two up, then... | ||||||||||||||||
| D641 | INC B | |||||||||||||||||
| Handler_SeaCreatureMovement_StepRowDown | D642 | DEC B | ...one down, so a crossed boundary updates the row. | |||||||||||||||
| D643 | AND %00000011 | Keep the vertical offset in the range 00-03. | ||||||||||||||||
| Handler_SeaCreatureMovement_StoreVerticalOffset | D645 | LD D,A | D=the updated vertical offset. | |||||||||||||||
| D646 | RET | Return. | ||||||||||||||||
| Prev: D60E | Up: Map | Next: D647 |