Imported fix from dev: 640:a8280796340e - Fixed the default sky on the first map not reverting properly if zr_veffects_sky was enabled in zombiereloaded.cfg.

This commit is contained in:
Richard Helgeby 2010-02-14 16:27:20 +01:00
parent b531c1d880
commit 12f5092e9e
4 changed files with 29 additions and 15 deletions

View File

@ -453,7 +453,7 @@ zr_veffects_sky_path "sky_borealis01up.vmt"
// Sun // Sun
// Disable sun rendering on map. // Disable sun rendering on map.
// Default: "1" // Default: "0"
zr_veffects_sun_disable "0" zr_veffects_sun_disable "0"
// Fog (UNSUPPORTED) SourceMod currently doesn't support this feature. // Fog (UNSUPPORTED) SourceMod currently doesn't support this feature.

View File

@ -188,6 +188,7 @@ public OnMapEnd()
{ {
// Forward event to modules. // Forward event to modules.
VolOnMapEnd(); VolOnMapEnd();
VEffectsOnMapEnd();
} }
/** /**

View File

@ -30,24 +30,21 @@
*/ */
new String:g_VAmbienceDefaultSky[PLATFORM_MAX_PATH]; new String:g_VAmbienceDefaultSky[PLATFORM_MAX_PATH];
/**
* The map is ending.
*/
VAmbienceOnMapEnd()
{
// Reset the default sky cache to empty, to be re-cached for the next map.
g_VAmbienceDefaultSky[0] = 0;
}
/** /**
* Validate cvar data. * Validate cvar data.
*/ */
VAmbienceLoad() VAmbienceLoad()
{ {
// Find map's default sky. // Apply all visual effects now.
new Handle:hSkyname = FindConVar("sv_skyname");
if (hSkyname != INVALID_HANDLE)
{
// Store map's default sky before applying new one.
GetConVarString(hSkyname, g_VAmbienceDefaultSky, sizeof(g_VAmbienceDefaultSky));
}
else
{
LogEvent(false, LogType_Error, LOG_CORE_EVENTS, LogModule_VEffects, "Sky Caching", "Couldn't find handle to cvar: \"sv_skyname\"");
}
// Apply all visual effects now
VAmbienceApplyAll(); VAmbienceApplyAll();
// If sky is disabled, then stop. // If sky is disabled, then stop.
@ -240,18 +237,25 @@ VAmbienceApplyLightStyle(bool:disable = false)
VAmbienceApplySky(bool:disable = false) VAmbienceApplySky(bool:disable = false)
{ {
// if we can't find the sv_skyname cvar, then stop. // If we can't find the sv_skyname cvar, then stop.
new Handle:hSkyname = FindConVar("sv_skyname"); new Handle:hSkyname = FindConVar("sv_skyname");
if (hSkyname == INVALID_HANDLE) if (hSkyname == INVALID_HANDLE)
{ {
return; return;
} }
// Store map's default sky before applying new one.
if (!g_VAmbienceDefaultSky[0])
{
GetConVarString(hSkyname, g_VAmbienceDefaultSky, sizeof(g_VAmbienceDefaultSky));
}
// If default, then set to default sky. // If default, then set to default sky.
if (disable) if (disable)
{ {
if (g_VAmbienceDefaultSky[0]) if (g_VAmbienceDefaultSky[0])
{ {
// Set default sky on all clients.
SetConVarString(hSkyname, g_VAmbienceDefaultSky, true); SetConVarString(hSkyname, g_VAmbienceDefaultSky, true);
} }

View File

@ -28,6 +28,15 @@
#include "zr/visualeffects/visualambience" #include "zr/visualeffects/visualambience"
#include "zr/visualeffects/ragdoll" #include "zr/visualeffects/ragdoll"
/**
* The map is ending.
*/
VEffectsOnMapEnd()
{
// Forward event to sub-modules.
VAmbienceOnMapEnd();
}
/** /**
* Visual effect loading. * Visual effect loading.
*/ */