![]() |
Routines |
| Prev: EE5B | Up: Map | Next: EED7 |
|
Applies horizontal and vertical movement deltas. Clone of Handler_SeaCreatureMovement.
|
||||||||||||||||||
|
Fetch the current position and apply horizontal movement.
|
||||||||||||||||||
| ApplyMovementDeltas | EEA6 | LD C,(IX+$00) | C=horizontal co-ordinate. | |||||||||||||||
| EEA9 | LD B,(IX+$01) | B=vertical co-ordinate. | ||||||||||||||||
| EEAC | LD E,(IX+$02) | E=horizontal offset. | ||||||||||||||||
| EEAF | LD D,(IX+$03) | D=vertical offset. | ||||||||||||||||
| EEB2 | LD A,(IX+$04) | A=horizontal movement. | ||||||||||||||||
| EEB5 | ADD A,E | Add it to the horizontal offset. | ||||||||||||||||
| EEB6 | CP $80 | Jump to ApplyMovementDeltas_StepColumnRight if the offset overflowed (moving right). | ||||||||||||||||
| EEB8 | JR NC,ApplyMovementDeltas_StepColumnRight | |||||||||||||||||
| EEBA | CP $04 | Jump to ApplyMovementDeltas_StoreHorizontalOffset if the offset is still in-range. | ||||||||||||||||
| EEBC | JR C,ApplyMovementDeltas_StoreHorizontalOffset | |||||||||||||||||
| EEBE | INC C | Step the horizontal co-ordinate two left, then... | ||||||||||||||||
| EEBF | INC C | |||||||||||||||||
| ApplyMovementDeltas_StepColumnRight | EEC0 | DEC C | ...one right, so a crossed boundary updates the column. | |||||||||||||||
| EEC1 | AND %00000011 | Keep the horizontal offset in the range 00-03. | ||||||||||||||||
| ApplyMovementDeltas_StoreHorizontalOffset | EEC3 | LD E,A | E=the updated horizontal offset. | |||||||||||||||
|
Apply vertical movement the same way.
|
||||||||||||||||||
| EEC4 | LD A,(IX+$05) | A=vertical movement. | ||||||||||||||||
| EEC7 | ADD A,D | Add it to the vertical offset. | ||||||||||||||||
| EEC8 | CP $80 | Jump to ApplyMovementDeltas_StepRowDown if the offset overflowed (moving down). | ||||||||||||||||
| EECA | JR NC,ApplyMovementDeltas_StepRowDown | |||||||||||||||||
| EECC | CP $04 | Jump to ApplyMovementDeltas_StoreVerticalOffset if the offset is still in-range. | ||||||||||||||||
| EECE | JR C,ApplyMovementDeltas_StoreVerticalOffset | |||||||||||||||||
| EED0 | INC B | Step the vertical co-ordinate two up, then... | ||||||||||||||||
| EED1 | INC B | |||||||||||||||||
| ApplyMovementDeltas_StepRowDown | EED2 | DEC B | ...one down, so a crossed boundary updates the row. | |||||||||||||||
| EED3 | AND %00000011 | Keep the vertical offset in the range 00-03. | ||||||||||||||||
| ApplyMovementDeltas_StoreVerticalOffset | EED5 | LD D,A | D=the updated vertical offset. | |||||||||||||||
| EED6 | RET | Return. | ||||||||||||||||
| Prev: EE5B | Up: Map | Next: EED7 |