* Get the frame of animation for the current animationState based on animation speed and animation frames */
| 901 | * Get the frame of animation for the current animationState based on animation speed and animation frames |
| 902 | */ |
| 903 | static uint8_t GetTargetFrame(const CarEntry& carEntry, uint32_t animationState) |
| 904 | { |
| 905 | if (carEntry.AnimationSpeed == 0) |
| 906 | return 0; |
| 907 | auto targetFrame = animationState / (carEntry.AnimationSpeed << 2); |
| 908 | // mask of 0xFF |
| 909 | targetFrame &= std::numeric_limits<uint8_t>::max(); |
| 910 | // multiply by number of frames. After the bitshift 8, the range will be 0 to AnimationFrames - 1 |
| 911 | targetFrame *= carEntry.AnimationFrames; |
| 912 | return targetFrame >> std::numeric_limits<uint8_t>::digits; |
| 913 | } |
| 914 | |
| 915 | /** |
| 916 | * Compute the position that steam should be spawned |
no outgoing calls
no test coverage detected