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:
parent
b77ec906f6
commit
5db3db539a
2 changed files with 17 additions and 2 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue