mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
Report 16-bit analog axis precision to the game instead of arbitrarily truncating it to ~14.3 bits.
git-svn-id: https://svn.eduke32.com/eduke32@7956 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
44d5371ad3
commit
56998c4840
2 changed files with 9 additions and 8 deletions
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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 {};
|
||||
|
||||
|
|
Loading…
Reference in a new issue