add back toggle for mouse cursor visability behaviour

This commit is contained in:
Alug committed 2025-09-20 18:51:55 +02:00
1 parent e1ad48ec16
commit fcadd03607
4 files changed
+14 -3

No files matched your search

+3 -1
View File
@@ -277,7 +277,8 @@ consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0,
INT32 cv_debug;
static void UseMouse_OnChange(void);
consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, UseMouse_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL, usemouse_cons_t, UseMouse_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mousevisible = {"mousevisible", "Off", CV_SAVE|CV_CALL, CV_OnOff, UseMouse_OnChange, 0, NULL, NULL, 0, 0, NULL};
static void UseMouse_OnChange(void)
{
@@ -1004,6 +1005,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_invertmouse);
CV_RegisterVar(&cv_mousesens);
CV_RegisterVar(&cv_mouseysens);
CV_RegisterVar(&cv_mousevisible);
// s_sound.c
CV_RegisterVar(&cv_soundvolume);
+1
View File
@@ -50,6 +50,7 @@ extern consvar_t cv_splitplayers;
extern consvar_t cv_seenames, cv_allowseenames;
#endif
extern consvar_t cv_usemouse;
extern consvar_t cv_mousevisible;
//WTF
extern consvar_t cv_mouseturn;
extern consvar_t cv_usejoystick[4]; //MAXSPLITSCREENPLAYERS
+3
View File
@@ -1180,6 +1180,8 @@ static menuitem_t OP_FocusOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Background FPS Cap", &cv_fpscapbg, 80},
{IT_STRING|IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 100},
{IT_STRING|IT_CVAR, NULL, "Visible Mouse", &cv_mousevisible, 120},
};
static const char* OP_FocusOptionsTooltips[] =
@@ -1190,6 +1192,7 @@ static const char* OP_FocusOptionsTooltips[] =
"Should the game pause while the game is unfocused?",
"Set manual framerate cap while the game is unfocused.",
"Should the FOCUS LOST window appear\n while the game is unfocused?",
"Displays the mouse cursor while the game is in focus.",
};
static menuitem_t OP_DataOptionsMenu[] =
+7 -2
View File
@@ -613,7 +613,8 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
case SDL_WINDOWEVENT_FOCUS_GAINED:
kbfocus = SDL_TRUE;
mousefocus = SDL_TRUE;
SDL_ShowCursor(SDL_FALSE);
if (!cv_mousevisible.value)
SDL_ShowCursor(SDL_FALSE);
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
kbfocus = SDL_FALSE;
@@ -1195,7 +1196,11 @@ void I_StartupMouse(void)
if (disable_mouse)
return;
SDL_ShowCursor(SDL_FALSE);
if (!cv_mousevisible.value)
SDL_ShowCursor(SDL_FALSE);
else
SDL_ShowCursor(SDL_TRUE);
SDL_SetWindowGrab(window, SDL_FALSE);
SDL_SetRelativeMouseMode(SDL_FALSE);
}