From 49aaa2525502d9f9cbd6b17da0962b48d7fd2115 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Thu, 16 Nov 2023 22:52:56 -0500 Subject: [PATCH] Mouse Controls for saturn --- src/d_netcmd.c | 2 ++ src/d_netcmd.h | 2 ++ src/g_game.c | 4 ++-- src/k_kart.c | 3 +++ src/m_menu.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 5 files changed, 47 insertions(+), 12 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index eb246a199..e483d846d 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -301,6 +301,8 @@ INT32 cv_debug; consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL}; +//WTF +consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2 consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 9b6d99b25..e21fdbb6f 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -41,6 +41,8 @@ extern consvar_t cv_splitplayers; extern consvar_t cv_seenames, cv_allowseenames; #endif extern consvar_t cv_usemouse; +//WTF +extern consvar_t cv_mouseturn; extern consvar_t cv_usejoystick; extern consvar_t cv_usejoystick2; extern consvar_t cv_usejoystick3; diff --git a/src/g_game.c b/src/g_game.c index b4dfbf074..2a482bfaa 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1427,9 +1427,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) side += ((axis * sidemove[0]) >> 10); } - // Specator mouse turning - if (player->spectator) + if (player->spectator || cv_mouseturn.value) { + //THIS WORKS WTF???????? cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8))); cmd->driftturn = (INT16)(cmd->driftturn - ((mousex*(encoremode ? -1 : 1)*8))); } diff --git a/src/k_kart.c b/src/k_kart.c index 98e4e8e27..387979682 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -720,6 +720,9 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_stagetitle); CV_RegisterVar(&cv_lessflicker); + + CV_RegisterVar(&cv_mouseturn); + } //} diff --git a/src/m_menu.c b/src/m_menu.c index c5c3249f9..8b5597dad 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1166,9 +1166,11 @@ 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_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 60}, - {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 60}, - {IT_STRING | IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth, 70}, + {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 80}, + {IT_STRING | IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth, 90}, }; static const char* OP_ControlsTooltips[] = @@ -1179,6 +1181,9 @@ static const char* OP_ControlsTooltips[] = "Setup player 3 controls.", "Setup player 4 controls.", + "Options for mouse control.", + + "Allowed amount of controls per key.", "Turn smoothing for non-analog turning.", @@ -1298,22 +1303,34 @@ static menuitem_t OP_JoystickSetMenu[] = {IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, (LINEHEIGHT*8)+5}, }; -/*static menuitem_t OP_MouseOptionsMenu[] = +//WTF +static menuitem_t OP_MouseOptionsMenu[] = { {IT_STRING | IT_CVAR, NULL, "Use Mouse", &cv_usemouse, 10}, - {IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook, 30}, - {IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook, 40}, - {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove, 50}, - {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 60}, + //{IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook, 30}, + //{IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook, 40}, + {IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20}, + {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 30}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse X Speed", &cv_mousesens, 70}, + NULL, "Mouse X Speed", &cv_mousesens, 40}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse Y Speed", &cv_mouseysens, 80}, + NULL, "Mouse Y Speed", &cv_mouseysens, 50}, }; -static menuitem_t OP_Mouse2OptionsMenu[] = +static const char* OP_MouseTooltips[] = +{ + + "Enable the use of the mouse.", + "Turn using the mouse.", + "Invert mouse movements.", + "Mouse horizontal sensitivity.", + "Mouse vertical sensitivity.", + +}; + +/*static menuitem_t OP_Mouse2OptionsMenu[] = { {IT_STRING | IT_CVAR, NULL, "Use Mouse 2", &cv_usemouse2, 10}, {IT_STRING | IT_CVAR, NULL, "Second Mouse Serial Port", @@ -2648,6 +2665,8 @@ menu_t OP_MainDef = }; menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30); +//WTF +menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30); menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef); menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 60, 30); menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 60, 30); @@ -4866,6 +4885,15 @@ static void M_DrawGenericMenu(void) } } + if (currentMenu == &OP_MouseOptionsDef) + { + if (!(OP_MouseTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_MouseTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } if (currentMenu == &OP_VideoOptionsDef) {