Skip to content

Commit

Permalink
FnSetSky: open Graphics.ocg before re-loading sky (#1827)
Browse files Browse the repository at this point in the history
Needed to load shader slices in C4Sky::Init.
  • Loading branch information
aburgm committed Oct 16, 2016
1 parent 8f61918 commit 2362a73
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/game/C4GameScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "landscape/C4Landscape.h"
#include "landscape/C4Sky.h"
#include "landscape/C4Particles.h"
#include "graphics/C4GraphicsResource.h"

C4Effect ** FnGetEffectsFor(C4PropList * pTarget)
{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2362a73

Please sign in to comment.