diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index 633e66472..ef3f9a8c7 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -2041,14 +2041,15 @@ int32_t handleevents_sdlcommon(SDL_Event *ev) case SDL_JOYAXISMOTION: if (appactive && ev->jaxis.axis < joystick.numAxes) { - joystick.pAxis[ev->jaxis.axis] = ev->jaxis.value * 10000 / 32767; - if ((joystick.pAxis[ev->jaxis.axis] < joydead[ev->jaxis.axis]) && - (joystick.pAxis[ev->jaxis.axis] > -joydead[ev->jaxis.axis])) + joystick.pAxis[ev->jaxis.axis] = ev->jaxis.value; + int32_t const scaledValue = ev->jaxis.value * 10000 / 32767; + if ((scaledValue < joydead[ev->jaxis.axis]) && + (scaledValue > -joydead[ev->jaxis.axis])) joystick.pAxis[ev->jaxis.axis] = 0; - else if (joystick.pAxis[ev->jaxis.axis] >= joysatur[ev->jaxis.axis]) - joystick.pAxis[ev->jaxis.axis] = 10000; - else if (joystick.pAxis[ev->jaxis.axis] <= -joysatur[ev->jaxis.axis]) - joystick.pAxis[ev->jaxis.axis] = -10000; + else if (scaledValue >= joysatur[ev->jaxis.axis]) + joystick.pAxis[ev->jaxis.axis] = 32767; + else if (scaledValue <= -joysatur[ev->jaxis.axis]) + joystick.pAxis[ev->jaxis.axis] = -32767; else joystick.pAxis[ev->jaxis.axis] = joystick.pAxis[ev->jaxis.axis] * 10000 / joysatur[ev->jaxis.axis]; } diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 34b5c45b4..42299f958 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -2946,7 +2946,7 @@ void P_GetInput(int const playerNum) int const playerRunning = (ud.runkey_mode) ? (BUTTON(gamefunc_Run) | ud.auto_run) : (ud.auto_run ^ BUTTON(gamefunc_Run)); int const turnAmount = playerRunning ? (NORMALTURN << 1) : NORMALTURN; int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE; - constexpr int const analogExtent = 10000; // KEEPINSYNC sdlayer.cpp + constexpr int const analogExtent = 32767; // KEEPINSYNC sdlayer.cpp input_t input {};