Prev: AFAC Up: Map Next: AFD0
AFC1: Limit Player Velocity
Used by the routine at AcceleratePlayer.
Limits a velocity to the top speed of the player, which depends on the colour of the player. The top speed is 20 for red (INK:RED, PAPER:BLACK (BRIGHT)), 40 for cyan (INK:CYAN, PAPER:BLACK (BRIGHT)) and 30 otherwise. The velocity may be negative.
Input
A Velocity
IX Actor record of the player
Output
A The limited velocity
LimitPlayerVelocity AFC1 PUSH AF Stash the velocity on the stack.
AFC2 LD A,(IX+$05) Fetch the colour of the player.
AFC5 CP $42 Jump to SetSlowSpeedLimit if the player is red (INK:RED, PAPER:BLACK (BRIGHT)), which slows the player.
AFC7 JR Z,SetSlowSpeedLimit
AFC9 CP $45 Jump to SetFastSpeedLimit if the player is cyan (INK:CYAN, PAPER:BLACK (BRIGHT)), which speeds the player up.
AFCB JR Z,SetFastSpeedLimit
AFCD LD B,$30 Set the normal maximum speed in B to 30.
This entry point is used by the routines at SetSlowSpeedLimit and SetFastSpeedLimit.
LimitPlayerVelocity_Restore AFCF POP AF Restore the velocity from the stack.
Prev: AFAC Up: Map Next: AFD0