Merge branch 'x-y-deadzone' into 'master'

Make separate deadzones for x/y axis + menu options

See merge request KartKrew/Kart-Public!265
This commit is contained in:
Sal 2022-08-22 23:47:49 +00:00
commit 153b5acc84
4 changed files with 147 additions and 72 deletions

View file

@ -912,10 +912,14 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_driftaxis2); CV_RegisterVar(&cv_driftaxis2);
CV_RegisterVar(&cv_driftaxis3); CV_RegisterVar(&cv_driftaxis3);
CV_RegisterVar(&cv_driftaxis4); CV_RegisterVar(&cv_driftaxis4);
CV_RegisterVar(&cv_deadzone); CV_RegisterVar(&cv_xdeadzone);
CV_RegisterVar(&cv_deadzone2); CV_RegisterVar(&cv_ydeadzone);
CV_RegisterVar(&cv_deadzone3); CV_RegisterVar(&cv_xdeadzone2);
CV_RegisterVar(&cv_deadzone4); CV_RegisterVar(&cv_ydeadzone2);
CV_RegisterVar(&cv_xdeadzone3);
CV_RegisterVar(&cv_ydeadzone3);
CV_RegisterVar(&cv_xdeadzone4);
CV_RegisterVar(&cv_ydeadzone4);
// filesrch.c // filesrch.c
CV_RegisterVar(&cv_addons_option); CV_RegisterVar(&cv_addons_option);

View file

@ -421,7 +421,7 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
#endif #endif
#endif #endif
static CV_PossibleValue_t deadzone_cons_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}}; static CV_PossibleValue_t deadzone_cons_t[] = {{FRACUNIT/16, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
// don't mind me putting these here, I was lazy to figure out where else I could put those without blowing up the compiler. // don't mind me putting these here, I was lazy to figure out where else I could put those without blowing up the compiler.
@ -493,7 +493,8 @@ consvar_t cv_aimaxis = {"joyaxis_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL,
consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fireaxis = {"joyaxis_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_fireaxis = {"joyaxis_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_driftaxis = {"joyaxis_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_driftaxis = {"joyaxis_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_deadzone = {"joy_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_xdeadzone = {"joy_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ydeadzone = {"joy_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_turnaxis2 = {"joyaxis2_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_turnaxis2 = {"joyaxis2_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_moveaxis2 = {"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_moveaxis2 = {"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -502,7 +503,8 @@ consvar_t cv_aimaxis2 = {"joyaxis2_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL
consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fireaxis2 = {"joyaxis2_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_fireaxis2 = {"joyaxis2_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_driftaxis2 = {"joyaxis2_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_driftaxis2 = {"joyaxis2_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_deadzone2 = {"joy2_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_xdeadzone2 = {"joy2_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ydeadzone2 = {"joy2_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_turnaxis3 = {"joyaxis3_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_turnaxis3 = {"joyaxis3_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_moveaxis3 = {"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_moveaxis3 = {"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -511,7 +513,8 @@ consvar_t cv_aimaxis3 = {"joyaxis3_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL
consvar_t cv_lookaxis3 = {"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis3 = {"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fireaxis3 = {"joyaxis3_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_fireaxis3 = {"joyaxis3_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_driftaxis3 = {"joyaxis3_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_driftaxis3 = {"joyaxis3_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_deadzone3 = {"joy3_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_xdeadzone3 = {"joy3_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ydeadzone3 = {"joy3_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_turnaxis4 = {"joyaxis4_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_turnaxis4 = {"joyaxis4_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_moveaxis4 = {"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_moveaxis4 = {"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -520,7 +523,8 @@ consvar_t cv_aimaxis4 = {"joyaxis4_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL
consvar_t cv_lookaxis4 = {"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_lookaxis4 = {"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fireaxis4 = {"joyaxis4_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_fireaxis4 = {"joyaxis4_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_driftaxis4 = {"joyaxis4_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_driftaxis4 = {"joyaxis4_drift", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_deadzone4 = {"joy4_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_xdeadzone4 = {"joy4_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#if MAXPLAYERS > 16 #if MAXPLAYERS > 16
@ -930,32 +934,45 @@ static INT32 Joy1Axis(axis_input_e axissel)
{ {
axisval /= 2; axisval /= 2;
retaxis = joyxmove[axisval]; retaxis = joyxmove[axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone.value) >> FRACBITS;
if (abs(retaxis) <= jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
} }
else else
{ {
axisval--; axisval--;
axisval /= 2; axisval /= 2;
retaxis = joyymove[axisval]; retaxis = joyymove[axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone.value) >> FRACBITS;
if (abs(retaxis) <= jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
} }
}
#ifdef _arch_dreamcast #ifdef _arch_dreamcast
skipDC: skipDC:
#endif #endif
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone.value) >> FRACBITS;
if (abs(retaxis) <= jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
}
static INT32 Joy2Axis(axis_input_e axissel) static INT32 Joy2Axis(axis_input_e axissel)
{ {
INT32 retaxis; INT32 retaxis;
@ -1011,32 +1028,47 @@ static INT32 Joy2Axis(axis_input_e axissel)
{ {
axisval /= 2; axisval /= 2;
retaxis = joy2xmove[axisval]; retaxis = joy2xmove[axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick2.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone2.value) >> FRACBITS;
if (-jdeadzone < retaxis && retaxis < jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
} }
else else
{ {
axisval--; axisval--;
axisval /= 2; axisval /= 2;
retaxis = joy2ymove[axisval]; retaxis = joy2ymove[axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick2.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone2.value) >> FRACBITS;
if (-jdeadzone < retaxis && retaxis < jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
} }
}
#ifdef _arch_dreamcast #ifdef _arch_dreamcast
skipDC: skipDC:
#endif #endif
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick2.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone2.value) >> FRACBITS;
if (-jdeadzone < retaxis && retaxis < jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
}
static INT32 Joy3Axis(axis_input_e axissel) static INT32 Joy3Axis(axis_input_e axissel)
{ {
INT32 retaxis; INT32 retaxis;
@ -1092,32 +1124,47 @@ static INT32 Joy3Axis(axis_input_e axissel)
{ {
axisval /= 2; axisval /= 2;
retaxis = joy3xmove[axisval]; retaxis = joy3xmove[axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick3.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone3.value) >> FRACBITS;
if (-jdeadzone < retaxis && retaxis < jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
} }
else else
{ {
axisval--; axisval--;
axisval /= 2; axisval /= 2;
retaxis = joy3ymove[axisval]; retaxis = joy3ymove[axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick3.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone3.value) >> FRACBITS;
if (-jdeadzone < retaxis && retaxis < jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
} }
}
#ifdef _arch_dreamcast #ifdef _arch_dreamcast
skipDC: skipDC:
#endif #endif
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick3.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone3.value) >> FRACBITS;
if (-jdeadzone < retaxis && retaxis < jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
}
static INT32 Joy4Axis(axis_input_e axissel) static INT32 Joy4Axis(axis_input_e axissel)
{ {
INT32 retaxis; INT32 retaxis;
@ -1172,32 +1219,47 @@ static INT32 Joy4Axis(axis_input_e axissel)
{ {
axisval /= 2; axisval /= 2;
retaxis = joy4xmove[axisval]; retaxis = joy4xmove[axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick4.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone4.value) >> FRACBITS;
if (-jdeadzone < retaxis && retaxis < jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
} }
else else
{ {
axisval--; axisval--;
axisval /= 2; axisval /= 2;
retaxis = joy4ymove[axisval]; retaxis = joy4ymove[axisval];
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick4.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone4.value) >> FRACBITS;
if (-jdeadzone < retaxis && retaxis < jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
} }
}
#ifdef _arch_dreamcast #ifdef _arch_dreamcast
skipDC: skipDC:
#endif #endif
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
if (retaxis > (+JOYAXISRANGE))
retaxis = +JOYAXISRANGE;
if (!Joystick4.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone4.value) >> FRACBITS;
if (-jdeadzone < retaxis && retaxis < jdeadzone)
return 0;
}
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
}
boolean InputDown(INT32 gc, UINT8 p) boolean InputDown(INT32 gc, UINT8 p)
{ {
switch (p) switch (p)

View file

@ -118,10 +118,10 @@ extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mouse
extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/; extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/;
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4; extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4; extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis,cv_deadzone; extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis,cv_xdeadzone,cv_ydeadzone;
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2,cv_deadzone2; extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2,cv_xdeadzone2,cv_ydeadzone2;
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_deadzone3; extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_xdeadzone3,cv_ydeadzone3;
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_deadzone4; extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_xdeadzone4,cv_ydeadzone4;
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff; extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
typedef enum typedef enum

View file

@ -1164,6 +1164,8 @@ static menuitem_t OP_Joystick1Menu[] =
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis , 70}, {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis , 70},
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis , 80}, {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis , 80},
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis , 90}, {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis , 90},
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone , 110},
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone , 120},
}; };
static menuitem_t OP_Joystick2Menu[] = static menuitem_t OP_Joystick2Menu[] =
@ -1176,6 +1178,8 @@ static menuitem_t OP_Joystick2Menu[] =
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis2 , 70}, {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis2 , 70},
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis2 , 80}, {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis2 , 80},
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis2 , 90}, {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis2 , 90},
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone2 , 110},
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone2 , 120},
}; };
static menuitem_t OP_Joystick3Menu[] = static menuitem_t OP_Joystick3Menu[] =
@ -1188,6 +1192,8 @@ static menuitem_t OP_Joystick3Menu[] =
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis3 , 70}, {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis3 , 70},
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis3 , 80}, {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis3 , 80},
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis3 , 90}, {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis3 , 90},
{IT_STRING | IT_CVAR, NULL, "X DeadZone" , &cv_xdeadzone3 , 110},
{IT_STRING | IT_CVAR, NULL, "Y DeadZone" , &cv_ydeadzone3 , 120},
}; };
static menuitem_t OP_Joystick4Menu[] = static menuitem_t OP_Joystick4Menu[] =
@ -1200,6 +1206,8 @@ static menuitem_t OP_Joystick4Menu[] =
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis4 , 70}, {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis4 , 70},
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis4 , 80}, {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis4 , 80},
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis4 , 90}, {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis4 , 90},
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone4 , 110},
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone4 , 120},
}; };
static menuitem_t OP_JoystickSetMenu[] = static menuitem_t OP_JoystickSetMenu[] =
@ -2563,10 +2571,11 @@ boolean M_Responder(event_t *ev)
{ {
if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime()) if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime())
{ {
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone.value) >> FRACBITS; const INT32 jxdeadzone = ((JOYAXISRANGE-1) * max(cv_xdeadzone.value, FRACUNIT/2)) >> FRACBITS;
const INT32 jydeadzone = ((JOYAXISRANGE-1) * max(cv_ydeadzone.value, FRACUNIT/2)) >> FRACBITS;
if (ev->data3 != INT32_MAX) if (ev->data3 != INT32_MAX)
{ {
if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone) if (Joystick.bGamepadStyle || abs(ev->data3) > jydeadzone)
{ {
if (ev->data3 < 0 && pjoyy >= 0) if (ev->data3 < 0 && pjoyy >= 0)
{ {
@ -2586,7 +2595,7 @@ boolean M_Responder(event_t *ev)
if (ev->data2 != INT32_MAX) if (ev->data2 != INT32_MAX)
{ {
if (Joystick.bGamepadStyle || abs(ev->data2) > jdeadzone) if (Joystick.bGamepadStyle || abs(ev->data2) > jxdeadzone)
{ {
if (ev->data2 < 0 && pjoyx >= 0) if (ev->data2 < 0 && pjoyx >= 0)
{ {