From 2dd21de302054a93c8ef2170fd3b4fd606adf2b0 Mon Sep 17 00:00:00 2001 From: Lonsfor <827632-Lonsfor@users.noreply.gitlab.com> Date: Mon, 30 Aug 2021 11:38:52 -0400 Subject: [PATCH 1/6] Add separate x/y deadzones --- src/d_netcmd.c | 3 ++- src/g_game.c | 44 +++++++++++++++++++++++++++++--------------- src/g_game.h | 2 +- src/m_menu.c | 2 +- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 4d383f60..2bd45b11 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -912,7 +912,8 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_driftaxis2); CV_RegisterVar(&cv_driftaxis3); CV_RegisterVar(&cv_driftaxis4); - CV_RegisterVar(&cv_deadzone); + CV_RegisterVar(&cv_xdeadzone); + CV_RegisterVar(&cv_ydeadzone); CV_RegisterVar(&cv_deadzone2); CV_RegisterVar(&cv_deadzone3); CV_RegisterVar(&cv_deadzone4); diff --git a/src/g_game.c b/src/g_game.c index 0b0631f0..d125f265 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -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_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_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_moveaxis2 = {"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -930,32 +931,45 @@ static INT32 Joy1Axis(axis_input_e axissel) { axisval /= 2; 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 { axisval--; axisval /= 2; 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 skipDC: #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) { INT32 retaxis; diff --git a/src/g_game.h b/src/g_game.h index d77f4268..05225164 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -118,7 +118,7 @@ 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_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_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_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; diff --git a/src/m_menu.c b/src/m_menu.c index 3243e0fc..bdf2048c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2563,7 +2563,7 @@ boolean M_Responder(event_t *ev) { if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime()) { - const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_deadzone.value) >> FRACBITS; + const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone.value) >> FRACBITS; if (ev->data3 != INT32_MAX) { if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone) From 0e1a91c655f8996aae3c1f715ab4f6efc3e7cea9 Mon Sep 17 00:00:00 2001 From: Lonsfor <827632-Lonsfor@users.noreply.gitlab.com> Date: Wed, 1 Sep 2021 18:57:37 -0400 Subject: [PATCH 2/6] Separate deadzones for players 2 3 and 4 --- src/d_netcmd.c | 9 ++-- src/g_game.c | 140 +++++++++++++++++++++++++++++++++---------------- src/g_game.h | 6 +-- 3 files changed, 103 insertions(+), 52 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 2bd45b11..057bdf2a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -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); diff --git a/src/g_game.c b/src/g_game.c index d125f265..404e233d 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -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,32 +1028,47 @@ static INT32 Joy2Axis(axis_input_e axissel) { axisval /= 2; 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 { 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 - 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) { INT32 retaxis; @@ -1106,32 +1124,47 @@ static INT32 Joy3Axis(axis_input_e axissel) { axisval /= 2; 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 { 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 - 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) { INT32 retaxis; @@ -1186,32 +1219,47 @@ static INT32 Joy4Axis(axis_input_e axissel) { axisval /= 2; 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 { 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 - 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) { switch (p) diff --git a/src/g_game.h b/src/g_game.h index 05225164..0dcc69c3 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -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 From 080a4f080adc30c194fb14011022e40026ebcd55 Mon Sep 17 00:00:00 2001 From: Lonsfor <827632-Lonsfor@users.noreply.gitlab.com> Date: Wed, 1 Sep 2021 19:00:28 -0400 Subject: [PATCH 3/6] Menu options for deadzones --- src/m_menu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index bdf2048c..3991c739 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1164,6 +1164,8 @@ static menuitem_t OP_Joystick1Menu[] = {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis , 70}, {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, "X deadzone" , &cv_xdeadzone , 110}, + {IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone , 120}, }; 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, "Use Item" , &cv_fireaxis2 , 80}, {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[] = @@ -1188,6 +1192,8 @@ static menuitem_t OP_Joystick3Menu[] = {IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis3 , 70}, {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, "X DeadZone" , &cv_xdeadzone3 , 110}, + {IT_STRING | IT_CVAR, NULL, "Y DeadZone" , &cv_ydeadzone3 , 120}, }; 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, "Use Item" , &cv_fireaxis4 , 80}, {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[] = From 8724b01ae4837f21ea3776006824bb2935ed21fd Mon Sep 17 00:00:00 2001 From: Lonsfor <827632-Lonsfor@users.noreply.gitlab.com> Date: Wed, 1 Sep 2021 20:23:18 -0400 Subject: [PATCH 4/6] Set minimum deadzone for menus and prevent setting deadzone to 0 (c Ashnal) --- src/g_game.c | 2 +- src/m_menu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 404e233d..a76d4770 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -421,7 +421,7 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, #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. diff --git a/src/m_menu.c b/src/m_menu.c index 3991c739..6205c6ea 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2571,7 +2571,7 @@ boolean M_Responder(event_t *ev) { if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime()) { - const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone.value) >> FRACBITS; + const INT32 jdeadzone = ((JOYAXISRANGE-1) * max(cv_ydeadzone.value, 3*FRACUNIT/4)) >> FRACBITS; if (ev->data3 != INT32_MAX) { if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone) From c9a6f9f9a30917454d6d9d9e1518619f23716b32 Mon Sep 17 00:00:00 2001 From: Lonsfor <827632-Lonsfor@users.noreply.gitlab.com> Date: Fri, 3 Sep 2021 23:32:36 +0000 Subject: [PATCH 5/6] Change minimum deadzone for menus from 3/4 to 1/2 --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 6205c6ea..10505980 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2571,7 +2571,7 @@ boolean M_Responder(event_t *ev) { if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime()) { - const INT32 jdeadzone = ((JOYAXISRANGE-1) * max(cv_ydeadzone.value, 3*FRACUNIT/4)) >> FRACBITS; + const INT32 jdeadzone = ((JOYAXISRANGE-1) * max(cv_ydeadzone.value, FRACUNIT/2)) >> FRACBITS; if (ev->data3 != INT32_MAX) { if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone) From 75efde143b500c04b53fe5bbd67ba3607815e30c Mon Sep 17 00:00:00 2001 From: Lonsfor Date: Sat, 4 Sep 2021 15:25:41 -0400 Subject: [PATCH 6/6] Separate deadzones for menus --- src/m_menu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 10505980..0dc908fc 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2571,10 +2571,11 @@ boolean M_Responder(event_t *ev) { if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime()) { - const INT32 jdeadzone = ((JOYAXISRANGE-1) * max(cv_ydeadzone.value, FRACUNIT/2)) >> 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 (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone) + if (Joystick.bGamepadStyle || abs(ev->data3) > jydeadzone) { if (ev->data3 < 0 && pjoyy >= 0) { @@ -2594,7 +2595,7 @@ boolean M_Responder(event_t *ev) 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) {