Separate deadzones for players 2 3 and 4

This commit is contained in:
Lonsfor 2021-09-01 18:57:37 -04:00 committed by Lonsfor
parent 2dd21de302
commit 0e1a91c655
No known key found for this signature in database
GPG key ID: A4B7179A9CA2B527
3 changed files with 103 additions and 52 deletions

View file

@ -914,9 +914,12 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_driftaxis4);
CV_RegisterVar(&cv_xdeadzone);
CV_RegisterVar(&cv_ydeadzone);
CV_RegisterVar(&cv_deadzone2);
CV_RegisterVar(&cv_deadzone3);
CV_RegisterVar(&cv_deadzone4);
CV_RegisterVar(&cv_xdeadzone2);
CV_RegisterVar(&cv_ydeadzone2);
CV_RegisterVar(&cv_xdeadzone3);
CV_RegisterVar(&cv_ydeadzone3);
CV_RegisterVar(&cv_xdeadzone4);
CV_RegisterVar(&cv_ydeadzone4);
// filesrch.c
CV_RegisterVar(&cv_addons_option);

View file

@ -503,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_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_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_moveaxis3 = {"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -512,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_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_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_moveaxis4 = {"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -521,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_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_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
@ -964,7 +967,7 @@ static INT32 Joy1Axis(axis_input_e axissel)
if (flp) retaxis = -retaxis; //flip it around
return retaxis;
}
}
}
#ifdef _arch_dreamcast
skipDC:
@ -1025,17 +1028,6 @@ static INT32 Joy2Axis(axis_input_e axissel)
{
axisval /= 2;
retaxis = joy2xmove[axisval];
}
else
{
axisval--;
axisval /= 2;
retaxis = joy2ymove[axisval];
}
#ifdef _arch_dreamcast
skipDC:
#endif
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
@ -1043,14 +1035,40 @@ static INT32 Joy2Axis(axis_input_e axissel)
retaxis = +JOYAXISRANGE;
if (!Joystick2.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone2.value) >> FRACBITS;
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
{
axisval--;
axisval /= 2;
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
skipDC:
#endif
static INT32 Joy3Axis(axis_input_e axissel)
{
INT32 retaxis;
@ -1106,17 +1124,6 @@ static INT32 Joy3Axis(axis_input_e axissel)
{
axisval /= 2;
retaxis = joy3xmove[axisval];
}
else
{
axisval--;
axisval /= 2;
retaxis = joy3ymove[axisval];
}
#ifdef _arch_dreamcast
skipDC:
#endif
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
@ -1124,14 +1131,40 @@ static INT32 Joy3Axis(axis_input_e axissel)
retaxis = +JOYAXISRANGE;
if (!Joystick3.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone3.value) >> FRACBITS;
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
{
axisval--;
axisval /= 2;
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
skipDC:
#endif
static INT32 Joy4Axis(axis_input_e axissel)
{
INT32 retaxis;
@ -1186,17 +1219,6 @@ static INT32 Joy4Axis(axis_input_e axissel)
{
axisval /= 2;
retaxis = joy4xmove[axisval];
}
else
{
axisval--;
axisval /= 2;
retaxis = joy4ymove[axisval];
}
#ifdef _arch_dreamcast
skipDC:
#endif
if (retaxis < (-JOYAXISRANGE))
retaxis = -JOYAXISRANGE;
@ -1204,14 +1226,40 @@ static INT32 Joy4Axis(axis_input_e axissel)
retaxis = +JOYAXISRANGE;
if (!Joystick4.bGamepadStyle && axissel < AXISDEAD)
{
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone4.value) >> FRACBITS;
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
{
axisval--;
axisval /= 2;
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
skipDC:
#endif
boolean InputDown(INT32 gc, UINT8 p)
{
switch (p)

View file

@ -119,9 +119,9 @@ extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mo
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_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_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_deadzone3;
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_deadzone4;
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_xdeadzone3,cv_ydeadzone3;
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;
typedef enum