Prev: 61019 Up: Map Next: 61143
61094: Apply Movement Deltas
Applies horizontal and vertical movement deltas. Clone of Handler_SeaCreatureMovement.
Input
IX Sprite data
Output
B Updated vertical position
C Updated horizontal position
D Updated vertical offset
E Updated horizontal offset
Fetch the current position and apply horizontal movement.
ApplyMovementDeltas 61094 LD C,(IX+0) C=horizontal co-ordinate.
61097 LD B,(IX+1) B=vertical co-ordinate.
61100 LD E,(IX+2) E=horizontal offset.
61103 LD D,(IX+3) D=vertical offset.
61106 LD A,(IX+4) A=horizontal movement.
61109 ADD A,E Add it to the horizontal offset.
61110 CP 128 Jump to ApplyMovementDeltas_StepColumnRight if the offset overflowed (moving right).
61112 JR NC,ApplyMovementDeltas_StepColumnRight
61114 CP 4 Jump to ApplyMovementDeltas_StoreHorizontalOffset if the offset is still in-range.
61116 JR C,ApplyMovementDeltas_StoreHorizontalOffset
61118 INC C Step the horizontal co-ordinate two left, then...
61119 INC C
ApplyMovementDeltas_StepColumnRight 61120 DEC C ...one right, so a crossed boundary updates the column.
61121 AND %00000011 Keep the horizontal offset in the range 0-3.
ApplyMovementDeltas_StoreHorizontalOffset 61123 LD E,A E=the updated horizontal offset.
Apply vertical movement the same way.
61124 LD A,(IX+5) A=vertical movement.
61127 ADD A,D Add it to the vertical offset.
61128 CP 128 Jump to ApplyMovementDeltas_StepRowDown if the offset overflowed (moving down).
61130 JR NC,ApplyMovementDeltas_StepRowDown
61132 CP 4 Jump to ApplyMovementDeltas_StoreVerticalOffset if the offset is still in-range.
61134 JR C,ApplyMovementDeltas_StoreVerticalOffset
61136 INC B Step the vertical co-ordinate two up, then...
61137 INC B
ApplyMovementDeltas_StepRowDown 61138 DEC B ...one down, so a crossed boundary updates the row.
61139 AND %00000011 Keep the vertical offset in the range 0-3.
ApplyMovementDeltas_StoreVerticalOffset 61141 LD D,A D=the updated vertical offset.
61142 RET Return.
Prev: 61019 Up: Map Next: 61143