Skip to content
Permalink
Browse files
FnSetSky: open Graphics.ocg before re-loading sky (#1827)
Needed to load shader slices in C4Sky::Init.
  • Loading branch information
aburgm committed Oct 16, 2016
1 parent 8f61918 commit 2362a73e60db01e04e46560fc1d2146a996374ae
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/game/C4GameScript.cpp
@@ -46,6 +46,7 @@
#include "landscape/C4Landscape.h"
#include "landscape/C4Sky.h"
#include "landscape/C4Particles.h"
#include "graphics/C4GraphicsResource.h"

C4Effect ** FnGetEffectsFor(C4PropList * pTarget)
{
@@ -1671,8 +1672,19 @@ static bool FnSetSky(C4PropList * _this, C4String * name)
{
if (!name) return false;
auto& sky = ::Landscape.GetSky();

// Open Graphics.ocg -- we might need to fetch some shader (slices)
// from there when reloading the sky.
if (!::GraphicsResource.RegisterGlobalGraphics()) return false;
if (!::GraphicsResource.RegisterMainGroups()) return false;

sky.Clear();
return sky.Init(false, name->GetCStr());
const bool result = sky.Init(false, name->GetCStr());

// close Graphics.ocg again
::GraphicsResource.CloseFiles();

return result;
}

static bool FnSetSkyAdjust(C4PropList * _this, long dwAdjust, long dwBackClr)

0 comments on commit 2362a73

Please sign in to comment.