Prev: 45095 Up: Map Next: 45127
45105: Get Whole Pixels
Used by the routines at CalculateNewPosition and MoveActor.
Divides a signed velocity by sixteen, to give the number of whole pixels to move. The direction is kept. For example, 48 gives 3 and 208 (-48) gives 253 (-3).
Input
A Velocity
Output
A Pixels to move
GetWholePixels 45105 AND A Jump to GetWholePixels_Positive if the velocity is positive.
45106 JP P,GetWholePixels_Positive
45109 NEG Make the velocity positive.
45111 RRCA Divide by sixteen (by rotating right four times).
45112 RRCA
45113 RRCA
45114 RRCA
45115 AND %00001111 Keep only bits 0-3.
45117 NEG Make the result negative again.
45119 RET Return.
GetWholePixels_Positive 45120 RRCA Divide by sixteen (by rotating right four times).
45121 RRCA
45122 RRCA
45123 RRCA
45124 AND %00001111 Keep only bits 0-3.
45126 RET Return.
View the equivalent code in;
Prev: 45095 Up: Map Next: 45127