Prev: 36736 Up: Map Next: 36810
36758: Slow Velocity
Used by the routine at ControlPlayer.
Takes some speed off both of the velocities of an entity, which are at offsets 6 and 7. Neither of them goes beyond zero. Nothing is done while an automatic walk is under way (see AutoWalkStep).
Input
HL The amount to take off each velocity (X in L and Y in H)
IX The entity
SlowVelocity 36758 LD A,(IX+2) Fetch offset 2 of the entity.
36761 AND %00001111 Keep only bits 0-3.
36763 RET NZ Return if an automatic walk is under way.
36764 LD A,(IX+6) Fetch the X velocity.
36767 AND A Test whether it is zero.
36768 JR Z,SlowVelocity_Y Jump to SlowVelocity_Y if it is.
36770 JP M,SlowVelocity_NegativeX Jump to SlowVelocity_NegativeX if it is negative.
36773 SUB L Subtract the amount from the velocity.
36774 JP P,SlowVelocity_SetX Jump to SlowVelocity_SetX if it is still positive.
SlowVelocity_ZeroX 36777 XOR A A=0 (the velocity when it is stopped).
SlowVelocity_SetX 36778 LD (IX+6),A Update the X velocity.
SlowVelocity_Y 36781 LD A,(IX+7) Fetch the Y velocity.
36784 AND A Test whether it is zero.
36785 RET Z Return if it is.
36786 JP M,SlowVelocity_NegativeY Jump to SlowVelocity_NegativeY if it is negative.
36789 SUB H Subtract the amount from the velocity.
36790 JP P,SlowVelocity_SetY Jump to SlowVelocity_SetY if it is still positive.
SlowVelocity_ZeroY 36793 XOR A A=0 (the velocity when it is stopped).
SlowVelocity_SetY 36794 LD (IX+7),A Update the Y velocity.
36797 RET Return.
SlowVelocity_NegativeX 36798 ADD A,L Add the amount to the velocity.
36799 JP M,SlowVelocity_SetX Jump to SlowVelocity_SetX if it is still negative.
36802 JR SlowVelocity_ZeroX Jump to SlowVelocity_ZeroX to zero the X velocity.
SlowVelocity_NegativeY 36804 ADD A,H Add the amount to the velocity.
36805 JP M,SlowVelocity_SetY Jump to SlowVelocity_SetY if it is still negative.
36808 JR SlowVelocity_ZeroY Jump to SlowVelocity_ZeroY to zero the Y velocity.
Prev: 36736 Up: Map Next: 36810