From 3eb77ef2e0bbe7c7b71548b4279beba2e7585297 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 23 Nov 2019 22:05:30 -0600 Subject: [PATCH] Allow speeding up and disabling digital turn easing If anyone complains about this being an unfair advantage, you can literally get the same result in the base game by building a custom controller that maps digital keypresses to an analog joystick. Ask Tyrone about his hitbox. All this does is remove the hardware differential between keyboard and controller. --- src/d_netcmd.c | 1 + src/g_game.c | 2 +- src/g_game.h | 2 +- src/g_input.c | 2 ++ src/g_input.h | 2 +- src/m_menu.c | 3 ++- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7d94d2ed2..d66ff16dc 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -906,6 +906,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_mouse2opt); #endif CV_RegisterVar(&cv_controlperkey); + CV_RegisterVar(&cv_turnsmooth); CV_RegisterVar(&cv_usemouse); CV_RegisterVar(&cv_usemouse2); diff --git a/src/g_game.c b/src/g_game.c index bf0557d02..01506a196 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1356,7 +1356,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) th = 0; if (th < SLOWTURNTICS) - tspeed = 2; // slow turn + tspeed = cv_turnsmooth.value == 2 ? 2 : 0; // slow turn else tspeed = speed; diff --git a/src/g_game.h b/src/g_game.h index 0edc13c74..0c5e2f365 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -139,7 +139,7 @@ typedef enum // mouseaiming (looking up/down with the mouse or keyboard) #define KB_LOOKSPEED (1<<25) #define MAXPLMOVE (50) -#define SLOWTURNTICS (6) +#define SLOWTURNTICS (cv_turnsmooth.value * 3) // build an internal map name MAPxx from map number const char *G_BuildMapName(INT32 map); diff --git a/src/g_input.c b/src/g_input.c index 08a323c78..b13eaca2f 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -23,6 +23,7 @@ static CV_PossibleValue_t mousesens_cons_t[] = {{1, "MIN"}, {MAXMOUSESENSITIVITY, "MAX"}, {0, NULL}}; static CV_PossibleValue_t onecontrolperkey_cons_t[] = {{1, "One"}, {2, "Several"}, {0, NULL}}; +static CV_PossibleValue_t turnsmooth_cons_t[] = {{2, "Slow"}, {1, "Fast"}, {0, "Off"}, {0, NULL}}; // mouse values are used once consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -30,6 +31,7 @@ consvar_t cv_mousesens2 = {"mousesens2", "20", CV_SAVE, mousesens_cons_t, NULL, consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_mouseysens2 = {"mouseysens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_turnsmooth = {"turnsmoothing", "Slow", CV_SAVE, turnsmooth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; INT32 mousex, mousey; INT32 mlooky; // like mousey but with a custom sensitivity for mlook diff --git a/src/g_input.h b/src/g_input.h index 6d0c7e2c8..3d170ba1d 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -127,7 +127,7 @@ typedef enum // mouse values are used once extern consvar_t cv_mousesens, cv_mouseysens; extern consvar_t cv_mousesens2, cv_mouseysens2; -extern consvar_t cv_controlperkey; +extern consvar_t cv_controlperkey, cv_turnsmooth; extern INT32 mousex, mousey; extern INT32 mlooky; //mousey with mlookSensitivity diff --git a/src/m_menu.c b/src/m_menu.c index e08a53c56..7c01a0e9b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1091,7 +1091,8 @@ static menuitem_t OP_ControlsMenu[] = {IT_CALL | IT_STRING, NULL, "Player 3 Controls...", &M_Setup3PControlsMenu, 30}, {IT_CALL | IT_STRING, NULL, "Player 4 Controls...", &M_Setup4PControlsMenu, 40}, - {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 60}, + {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 60}, + {IT_STRING | IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth, 70}, }; static menuitem_t OP_AllControlsMenu[] =