Client/Server: Handle 'skyname' universally and guess on the client whether we're using a Source Engine style skybox path

This commit is contained in:
Marco Cawthorne 2023-09-13 07:56:11 -07:00
parent b77ec906f6
commit 5db3db539a
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
2 changed files with 17 additions and 2 deletions

View File

@ -16,12 +16,27 @@
var string g_strSkyName;
bool
Sky_SourceBSPCheck(string sky)
{
if not (whichpack(strcat("materials/skybox/", sky, "bk.vmt")))
return false;
return true;
}
void
Sky_Update(int force)
{
if (g_strSkyName != serverkey("skyname") || force == TRUE) {
g_strSkyName = serverkey("skyname");
localcmd(sprintf("sky \"%s\"\n", g_strSkyName));
/* is it a Source Engine material? */
if (Sky_SourceBSPCheck(g_strSkyName))
localcmd(sprintf("sky \"materials/skybox/%s\"\n", g_strSkyName));
else
localcmd(sprintf("sky \"%s\"\n", g_strSkyName));
print(sprintf("sky update applying %s.\n", g_strSkyName));
}
}

View File

@ -485,8 +485,8 @@ worldspawn(void)
if (!self.skyname) {
self.skyname = "desert";
}
forceinfokey(world, "skyname", self.skyname);
}
forceinfokey(world, "skyname", self.skyname);
print("Spawning entities\n");
}