Prev: 44993 Up: Map Next: 45024
45008: Limit Velocity
Used by the routine at HandlerChasingNastie.
Limits a signed velocity to a maximum speed.
Input
A Velocity
B Maximum speed
Output
A The limited velocity
LimitVelocity 45008 JP M,LimitVelocity_Negative Jump to LimitVelocity_Negative if the velocity is negative.
45011 CP B Return if the velocity is less than the maximum speed.
45012 RET C
45013 LD A,B Limit the velocity to the maximum speed.
45014 RET Return.
LimitVelocity_Negative 45015 NEG Make the velocity positive.
45017 CP B Jump to LimitVelocity_Restore if the speed is less than the maximum speed.
45018 JR C,LimitVelocity_Restore
45020 LD A,B Limit the speed to the maximum speed.
LimitVelocity_Restore 45021 NEG Make the velocity negative again.
45023 RET Return.
Prev: 44993 Up: Map Next: 45024