mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Fixed overflow in trigger rumble calculation
This commit is contained in:
parent
52486d018a
commit
e749c1266f
@ -117,7 +117,7 @@ UpdateWindowTitle()
|
||||
static Uint16 ConvertAxisToRumble(Sint16 axis)
|
||||
{
|
||||
/* Only start rumbling if the axis is past the halfway point */
|
||||
const int half_axis = (SDL_JOYSTICK_AXIS_MAX / 2);
|
||||
const Sint16 half_axis = (Sint16)SDL_ceil(SDL_JOYSTICK_AXIS_MAX / 2.0f);
|
||||
if (axis > half_axis) {
|
||||
return (Uint16)(axis - half_axis) * 4;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user