Some rewriting of windowed_mouse setting, in preparation of releasing the mouse in the menu.

This commit is contained in:
svdijk 2012-10-29 20:41:46 +01:00 committed by Yamagi Burmeister
parent a1adac8ba9
commit 76e3480ccb
6 changed files with 19 additions and 13 deletions

View file

@ -72,7 +72,6 @@ Con_ToggleConsole_f(void)
if (cl.attractloop)
{
Cvar_SetValue("windowed_mouse", 0);
Cbuf_AddText("killserver\n");
return;
}
@ -80,7 +79,6 @@ Con_ToggleConsole_f(void)
if (cls.state == ca_disconnected)
{
/* start the demo loop again */
Cvar_SetValue("windowed_mouse", 1);
Cbuf_AddText("d1\n");
return;
}

View file

@ -88,6 +88,7 @@ cvar_t *skin;
cvar_t *rate;
cvar_t *fov;
cvar_t *horplus;
cvar_t *windowed_mouse;
cvar_t *msg;
cvar_t *hand;
cvar_t *gender;
@ -540,6 +541,7 @@ CL_InitLocal(void)
hand = Cvar_Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE);
fov = Cvar_Get("fov", "90", CVAR_USERINFO | CVAR_ARCHIVE);
horplus = Cvar_Get("horplus", "1", CVAR_ARCHIVE);
windowed_mouse = Cvar_Get("windowed_mouse", "1", CVAR_USERINFO | CVAR_ARCHIVE);
gender = Cvar_Get("gender", "male", CVAR_USERINFO | CVAR_ARCHIVE);
gender_auto = Cvar_Get("gender_auto", "1", CVAR_ARCHIVE);
gender->modified = false;
@ -687,9 +689,26 @@ CL_FixCvarCheats(void)
}
}
void
CL_UpdateWindowedMouse(void)
{
if (cls.key_dest == key_console ||
(cls.key_dest == key_game && cls.state == ca_disconnected))
{
Cvar_SetValue("windowed_mouse", 0);
}
else
{
Cvar_SetValue("windowed_mouse", 1);
}
}
void
CL_SendCommand(void)
{
/* update windowed_mouse cvar */
CL_UpdateWindowedMouse();
/* get new key events */
Sys_SendKeyEvents();

View file

@ -500,7 +500,6 @@ SCR_RunConsole(void)
if (scr_conlines < scr_con_current)
{
Cvar_SetValue("windowed_mouse", 1);
scr_con_current -= scr_conspeed->value * cls.frametime;
if (scr_conlines > scr_con_current)
@ -510,7 +509,6 @@ SCR_RunConsole(void)
}
else if (scr_conlines > scr_con_current)
{
Cvar_SetValue("windowed_mouse", 0);
scr_con_current += scr_conspeed->value * cls.frametime;
if (scr_conlines < scr_con_current)

View file

@ -1411,7 +1411,6 @@ ConsoleFunc(void *unused)
if (cl.attractloop)
{
Cvar_SetValue("windowed_mouse", 0);
Cbuf_AddText("killserver\n");
return;
}

View file

@ -43,7 +43,6 @@ static cvar_t *gl_picmip;
static cvar_t *gl_ext_palettedtexture;
static cvar_t *fov;
static cvar_t *windowed_mouse;
static menuframework_s s_opengl_menu;
@ -239,12 +238,6 @@ VID_MenuInit(void)
"0", CVAR_ARCHIVE);
}
if (!windowed_mouse)
{
windowed_mouse = Cvar_Get("windowed_mouse", "1",
CVAR_USERINFO | CVAR_ARCHIVE);
}
if (!horplus)
{
horplus = Cvar_Get("horplus", "1", CVAR_ARCHIVE);

View file

@ -299,7 +299,6 @@ SV_SpawnServer(char *server, char *spawnpoint, server_state_t serverstate,
/* set serverinfo variable */
Cvar_FullSet("mapname", sv.name, CVAR_SERVERINFO | CVAR_NOSET);
Cvar_SetValue("windowed_mouse", 1);
Com_Printf("------------------------------------\n\n");
}