From dc99bc19c5ab7cb00f1d18b36924e8c1d2e10059 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 27 Dec 2010 23:12:46 +0900 Subject: [PATCH] Make sure the r_skyname serverinfo key gets cleared on map change. This ensures that the map's sky is always used unless the client itself has set its r_skyname cvar. The server's r_skyname cvar is now the default name for the skybox for when the map does not specify one. The map's sky worldspawn field overrides this. The r_skyname cvar is no longer a serverinfo cvar. --- qw/source/cl_main.c | 5 ++--- qw/source/sv_progs.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 21aa88bac..39dce700e 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -648,9 +648,8 @@ CL_FullServerinfo_f (void) if ((p = Info_ValueForKey (cl.serverinfo, "fbskins")) && *p) { cl.fbskins = atoi (p); } - if ((p = Info_ValueForKey (cl.serverinfo, "r_skyname")) && *p) { - R_LoadSkys (p); - } + // R_LoadSkys does the right thing with null pointers. + R_LoadSkys (Info_ValueForKey (cl.serverinfo, "r_skyname")); } static void diff --git a/qw/source/sv_progs.c b/qw/source/sv_progs.c index db4c92179..a75bcac71 100644 --- a/qw/source/sv_progs.c +++ b/qw/source/sv_progs.c @@ -190,8 +190,8 @@ parse_field (progs_t *pr, const char *key, const char *value) if (strcaseequal (key, "skyname") // QuakeForge || strcaseequal (key, "sky") // Q2/DarkPlaces || strcaseequal (key, "qlsky")) { // QuakeLives - Info_SetValueForKey (svs.info, "skybox", "1", !sv_highchars->int_val); - Cvar_Set (r_skyname, value); + Info_SetValueForKey (svs.info, "skybox", "1", 0); + Info_SetValueForKey (svs.info, "r_skyname", value, 0); return 1; } if (*key == '_') // ignore _fields @@ -509,6 +509,10 @@ SV_LoadProgs (void) memset (&sv_globals, 0, sizeof (sv_funcs)); memset (&sv_funcs, 0, sizeof (sv_funcs)); + Info_RemoveKey (svs.info, "skybox"); + Info_RemoveKey (svs.info, "r_skyname"); + if (*r_skyname->string) + Info_SetValueForKey (svs.info, "r_skyname", r_skyname->string, 0); sv_cbuf->unknown_command = 0; ucmd_unknown = 0; @@ -567,8 +571,8 @@ SV_Progs_Init (void) void SV_Progs_Init_Cvars (void) { - r_skyname = Cvar_Get ("r_skyname", "", CVAR_SERVERINFO, Cvar_Info, - "name of skybox"); + r_skyname = Cvar_Get ("r_skyname", "", CVAR_NONE, NULL, + "Default name of skybox if none given by map"); sv_progs = Cvar_Get ("sv_progs", "", CVAR_NONE, NULL, "Override the default game progs."); sv_progs_zone = Cvar_Get ("sv_progs_zone", "256", CVAR_NONE, NULL,