mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-21 03:21:08 +00:00
more tidying.. apply deadzone before swapping move/look
This commit is contained in:
parent
bc447db0b0
commit
68cb97c864
1 changed files with 9 additions and 15 deletions
|
@ -390,6 +390,7 @@ void IN_MouseMotion(int dx, int dy)
|
||||||
|
|
||||||
#if defined(USE_SDL2)
|
#if defined(USE_SDL2)
|
||||||
// Joystick support based on code from Jeremiah Sypult
|
// Joystick support based on code from Jeremiah Sypult
|
||||||
|
// https://github.com/jeremiah-sypult/Quakespasm-Rift
|
||||||
|
|
||||||
/* analog axis ease math functions */
|
/* analog axis ease math functions */
|
||||||
#define sine(x) ((0.5f) * ( (1) - (cosf( (x) * M_PI )) ))
|
#define sine(x) ((0.5f) * ( (1) - (cosf( (x) * M_PI )) ))
|
||||||
|
@ -543,29 +544,22 @@ void IN_ControllerAxis(SDL_JoystickID instanceid, SDL_GameControllerAxis axis, S
|
||||||
|
|
||||||
void IN_JoyMove (usercmd_t *cmd)
|
void IN_JoyMove (usercmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
#if defined(USE_SDL2)
|
||||||
float speed, aspeed;
|
float speed, aspeed;
|
||||||
|
dualAxis_t moveDualAxis = {0};
|
||||||
|
|
||||||
if (!joy_enable.value)
|
if (!joy_enable.value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(USE_SDL2)
|
moveDualAxis.left = ApplyJoyDeadzone( _rawDualAxis.left, Sint16ToPlusMinusOne(joy_deadzone_l.value) );
|
||||||
// jeremiah sypult -- BEGIN joystick
|
moveDualAxis.right = ApplyJoyDeadzone( _rawDualAxis.right, Sint16ToPlusMinusOne(joy_deadzone_r.value) );
|
||||||
//
|
|
||||||
dualAxis_t moveDualAxis = {0};
|
|
||||||
|
|
||||||
if (!joy_swapmovelook.value)
|
if (joy_swapmovelook.value)
|
||||||
{
|
{
|
||||||
moveDualAxis.left = _rawDualAxis.left;
|
joyAxis_t temp = moveDualAxis.left;
|
||||||
moveDualAxis.right = _rawDualAxis.right;
|
moveDualAxis.left = moveDualAxis.right;
|
||||||
|
moveDualAxis.right = temp;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
moveDualAxis.left = _rawDualAxis.right;
|
|
||||||
moveDualAxis.right = _rawDualAxis.left;
|
|
||||||
}
|
|
||||||
|
|
||||||
moveDualAxis.left = ApplyJoyDeadzone( moveDualAxis.left, Sint16ToPlusMinusOne(joy_deadzone_l.value) );
|
|
||||||
moveDualAxis.right = ApplyJoyDeadzone( moveDualAxis.right, Sint16ToPlusMinusOne(joy_deadzone_r.value) );
|
|
||||||
|
|
||||||
switch ( (int)joy_function.value ) {
|
switch ( (int)joy_function.value ) {
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue