aboutsummaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 407672ac2..ef694b6af 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1337,6 +1337,8 @@ void the_game(
Sky *sky = NULL;
sky = new Sky(smgr->getRootSceneNode(), smgr, -1, client.getEnv().getLocalPlayer());
+
+ scene::ISceneNode* skybox = NULL;
/*
A copy of the local inventory
@@ -2462,6 +2464,40 @@ void the_game(
delete event.hudchange.v2fdata;
delete event.hudchange.sdata;
}
+ else if (event.type == CE_SET_SKY)
+ {
+ sky->setVisible(false);
+ if(skybox){
+ skybox->drop();
+ skybox = NULL;
+ }
+ // Handle according to type
+ if(*event.set_sky.type == "regular"){
+ sky->setVisible(true);
+ }
+ else if(*event.set_sky.type == "skybox" &&
+ event.set_sky.params->size() == 6){
+ sky->setFallbackBgColor(*event.set_sky.bgcolor);
+ skybox = smgr->addSkyBoxSceneNode(
+ tsrc->getTexture((*event.set_sky.params)[0]),
+ tsrc->getTexture((*event.set_sky.params)[1]),
+ tsrc->getTexture((*event.set_sky.params)[2]),
+ tsrc->getTexture((*event.set_sky.params)[3]),
+ tsrc->getTexture((*event.set_sky.params)[4]),
+ tsrc->getTexture((*event.set_sky.params)[5]));
+ }
+ // Handle everything else as plain color
+ else {
+ if(*event.set_sky.type != "plain")
+ infostream<<"Unknown sky type: "
+ <<(*event.set_sky.type)<<std::endl;
+ sky->setFallbackBgColor(*event.set_sky.bgcolor);
+ }
+
+ delete event.set_sky.bgcolor;
+ delete event.set_sky.type;
+ delete event.set_sky.params;
+ }
}
}