[qw] Fix handling of sky box name

The handling was broken during some merge work. Need to find a good way
to unify it all (probably by giving nq a fake serverinfo).
This commit is contained in:
Bill Currie 2021-03-25 15:56:01 +09:00
parent 999dd8248b
commit 457306edad

View file

@ -177,15 +177,29 @@ CL_LoadSky (void)
{ {
plitem_t *item; plitem_t *item;
const char *name = 0; const char *name = 0;
static const char *sky_keys[] = {
"sky", // Q2/DarkPlaces
"skyname", // old QF
"qlsky", // QuakeLives
0
};
if (!cl.worldspawn) { // R_LoadSkys does the right thing with null pointers.
r_funcs->R_LoadSkys (0); if (cl.serverinfo) {
return; name = Info_ValueForKey (cl.serverinfo, "sky");
} }
if ((item = PL_ObjectForKey (cl.worldspawn, "sky")) // Q2/DarkPlaces
|| (item = PL_ObjectForKey (cl.worldspawn, "skyname")) // old QF if (!name) {
|| (item = PL_ObjectForKey (cl.worldspawn, "qlsky"))) /* QuakeLives */ { if (!cl.worldspawn) {
name = PL_String (item); r_funcs->R_LoadSkys (0);
return;
}
for (const char **key = sky_keys; *key; key++) {
if ((item = PL_ObjectForKey (cl.worldspawn, *key))) {
name = PL_String (item);
break;
}
}
} }
r_funcs->R_LoadSkys (name); r_funcs->R_LoadSkys (name);
} }