| 18 | static uint32 s_randomLCG; |
| 19 | |
| 20 | uint16 Tools_AdjustToGameSpeed(uint16 normal, uint16 minimum, uint16 maximum, bool inverseSpeed) |
| 21 | { |
| 22 | uint16 gameSpeed = g_gameConfig.gameSpeed; |
| 23 | |
| 24 | if (gameSpeed == 2) return normal; |
| 25 | if (gameSpeed > 4) return normal; |
| 26 | |
| 27 | if (maximum > normal * 2) maximum = normal * 2; |
| 28 | if (minimum < normal / 2) minimum = normal / 2; |
| 29 | |
| 30 | if (inverseSpeed) gameSpeed = 4 - gameSpeed; |
| 31 | |
| 32 | switch (gameSpeed) { |
| 33 | case 0: return minimum; |
| 34 | case 1: return normal - (normal - minimum) / 2; |
| 35 | case 3: return normal + (maximum - normal) / 2; |
| 36 | case 4: return maximum; |
| 37 | } |
| 38 | |
| 39 | /* Never reached, but avoids compiler errors */ |
| 40 | return normal; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Get the type of the given encoded index. |
no outgoing calls
no test coverage detected