cvar_t joy_sensitivityyaw = {0, "joy_sensitivityyaw", "-1", "movement multiplier"};
cvar_t joy_sensitivityroll = {0, "joy_sensitivityroll", "1", "movement multiplier"};
cvar_t joy_axiskeyevents = {CVAR_SAVE, "joy_axiskeyevents", "0", "generate uparrow/leftarrow etc. keyevents for joystick axes, use if your joystick driver is not generating them"};
+cvar_t joy_axiskeyevents_deadzone = {CVAR_SAVE, "joy_axiskeyevents_deadzone", "0.5", "deadzone value for axes"};
#ifdef __IPHONEOS__
# define SETVIDEOMODE 0
SDL_Joystick *joy = vid_joysticks[joy_index.integer];
if (keycode == K_UPARROW || keycode == K_DOWNARROW)
- if (IN_JoystickGetAxis(joy, joy_axisforward.integer, 1, 0.01) || joy_axescache[joy_axisforward.integer].move || joy_axescache[joy_axisforward.integer].oldmove)
+ if (IN_JoystickGetAxis(joy, joy_axisforward.integer, 1, joy_axiskeyevents_deadzone.value) || joy_axescache[joy_axisforward.integer].move || joy_axescache[joy_axisforward.integer].oldmove)
return true;
if (keycode == K_RIGHTARROW || keycode == K_LEFTARROW)
- if (IN_JoystickGetAxis(joy, joy_axisside.integer, 1, 0.01) || joy_axescache[joy_axisside.integer].move || joy_axescache[joy_axisside.integer].oldmove)
+ if (IN_JoystickGetAxis(joy, joy_axisside.integer, 1, joy_axiskeyevents_deadzone.value) || joy_axescache[joy_axisside.integer].move || joy_axescache[joy_axisside.integer].oldmove)
return true;
}
for (j = 0; j < numaxes; j++)
{
joy_axescache[j].oldmove = joy_axescache[j].move;
- joy_axescache[j].move = IN_JoystickGetAxis(joy, j, 1, 0.01);
+ joy_axescache[j].move = IN_JoystickGetAxis(joy, j, 1, joy_axiskeyevents_deadzone.value);
}
// run keyevents
Cvar_RegisterVariable(&joy_sensitivityyaw);
//Cvar_RegisterVariable(&joy_sensitivityroll);
Cvar_RegisterVariable(&joy_axiskeyevents);
+ Cvar_RegisterVariable(&joy_axiskeyevents_deadzone);
#ifdef __IPHONEOS__
Cvar_SetValueQuick(&vid_touchscreen, 1);
#endif
static cvar_t joy_wwhack1 = {0, "joywwhack1", "0.0", "special hack for wingman warrior"};
static cvar_t joy_wwhack2 = {0, "joywwhack2", "0.0", "special hack for wingman warrior"};
static cvar_t joy_axiskeyevents = {CVAR_SAVE, "joy_axiskeyevents", "0", "generate uparrow/leftarrow etc. keyevents for joystick axes, use if your joystick driver is not generating them"};
+static cvar_t joy_axiskeyevents_deadzone = {CVAR_SAVE, "joy_axiskeyevents_deadzone", "0.5", "deadzone value for axes"};
static cvar_t vid_forcerefreshrate = {0, "vid_forcerefreshrate", "0", "try to set the given vid_refreshrate even if Windows doesn't list it as valid video mode"};
return false;
axis = IN_JoystickGetAxisNum(AxisForward);
if (keycode == K_UPARROW || keycode == K_DOWNARROW)
- if (IN_JoystickGetAxis(axis, 1, 0.01) || joy_axescache[axis].move || joy_axescache[axis].oldmove)
+ if (IN_JoystickGetAxis(axis, 1, joy_axiskeyevents_deadzone.value) || joy_axescache[axis].move || joy_axescache[axis].oldmove)
return true;
axis = IN_JoystickGetAxisNum(AxisSide);
if (keycode == K_RIGHTARROW || keycode == K_LEFTARROW)
- if (IN_JoystickGetAxis(axis, 1, 0.01) || joy_axescache[axis].move || joy_axescache[axis].oldmove)
+ if (IN_JoystickGetAxis(axis, 1, joy_axiskeyevents_deadzone.value) || joy_axescache[axis].move || joy_axescache[axis].oldmove)
return true;
}
// cache for keyevents
joy_axescache[i].oldmove = joy_axescache[i].move;
- joy_axescache[i].move = IN_JoystickGetAxis(i, 1, 0.01);
+ joy_axescache[i].move = IN_JoystickGetAxis(i, 1, joy_axiskeyevents_deadzone.value);
}
// run keyevents
Cvar_RegisterVariable (&joy_wwhack1);
Cvar_RegisterVariable (&joy_wwhack2);
Cvar_RegisterVariable (&joy_axiskeyevents);
+ Cvar_RegisterVariable (&joy_axiskeyevents_deadzone);
Cvar_RegisterVariable (&vid_forcerefreshrate);
Cmd_AddCommand ("joyadvancedupdate", Joy_AdvancedUpdate_f, "applies current joyadv* cvar settings to the joystick driver");
}