Add 3d cloud checkbox in main menu (and rename setting from enable_2d_clouds to enabl...
authorPerttu Ahola <celeron55@gmail.com>
Wed, 2 Nov 2011 10:50:21 +0000 (12:50 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Wed, 2 Nov 2011 10:50:21 +0000 (12:50 +0200)
src/clouds.cpp
src/defaultsettings.cpp
src/guiMainMenu.cpp
src/guiMainMenu.h
src/main.cpp

index 063a4b1117cf3ec1bb939781c08ca14c54681158..23243659707bb8c56ddc2a9ce72f920d57d5e4f9 100644 (file)
@@ -81,9 +81,9 @@ void Clouds::render()
 
        ScopeProfiler sp(g_profiler, "Rendering of clouds, avg", SPT_AVG);
 
-       int num_faces_to_draw = 6;
-       if(g_settings->getBool("enable_2d_clouds"))
-               num_faces_to_draw = 1;
+       int num_faces_to_draw = 1;
+       if(g_settings->getBool("enable_3d_clouds"))
+               num_faces_to_draw = 6;
 
        driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
        driver->setMaterial(m_material);
index 7f0d46a10b6c8cc5d1aa5ae29d1c3a314e92da79..fea000804b9a096ae0f3dba57ab14c2684c4b531 100644 (file)
@@ -62,7 +62,7 @@ void set_default_settings(Settings *settings)
        settings->setDefault("fov", "72");
        settings->setDefault("view_bobbing", "true");
        settings->setDefault("new_style_water", "false");
-       settings->setDefault("new_style_leaves", "true");
+       settings->setDefault("new_style_leaves", "false");
        settings->setDefault("smooth_lighting", "true");
        settings->setDefault("frametime_graph", "false");
        settings->setDefault("enable_texture_atlas", "true");
@@ -77,7 +77,7 @@ void set_default_settings(Settings *settings)
        settings->setDefault("invisible_stone", "false");
        settings->setDefault("screenshot_path", ".");
        settings->setDefault("view_bobbing_amount", "1.0");
-       settings->setDefault("enable_2d_clouds", "false");
+       settings->setDefault("enable_3d_clouds", "false");
 
        // Server stuff
        // "map-dir" doesn't exist by default.
index cf9b8eda42f658bf6e071d63d088d092a2e08efd..a0a23828ae61a4f68c12fabf337559e595927e49 100644 (file)
@@ -80,6 +80,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
        bool enable_damage;
        bool fancy_trees;
        bool smooth_lighting;
+       bool clouds_3d;
        
        // Client options
        {
@@ -117,6 +118,13 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
                else
                        smooth_lighting = m_data->smooth_lighting;
        }
+       {
+               gui::IGUIElement *e = getElementFromId(GUI_ID_3D_CLOUDS_CB);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       clouds_3d = ((gui::IGUICheckBox*)e)->isChecked();
+               else
+                       clouds_3d = m_data->clouds_3d;
+       }
        
        // Server options
        {
@@ -242,10 +250,16 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
        }
        {
                core::rect<s32> rect(0, 0, 250, 30);
-               rect += topleft_client + v2s32(35, 150+30);
+               rect += topleft_client + v2s32(35, 150+20);
                Environment->addCheckBox(smooth_lighting, rect, this, GUI_ID_SMOOTH_LIGHTING_CB,
                                wgettext("Smooth Lighting"));
        }
+       {
+               core::rect<s32> rect(0, 0, 250, 30);
+               rect += topleft_client + v2s32(35, 150+40);
+               Environment->addCheckBox(clouds_3d, rect, this, GUI_ID_3D_CLOUDS_CB,
+                               wgettext("3D Clouds"));
+       }
        // Start game button
        {
                core::rect<s32> rect(0, 0, 180, 30);
@@ -362,6 +376,11 @@ void GUIMainMenu::acceptInput()
                if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
                        m_data->enable_damage = ((gui::IGUICheckBox*)e)->isChecked();
        }
+       {
+               gui::IGUIElement *e = getElementFromId(GUI_ID_3D_CLOUDS_CB);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       m_data->clouds_3d = ((gui::IGUICheckBox*)e)->isChecked();
+       }
        {
                gui::IGUIElement *e = getElementFromId(GUI_ID_SMOOTH_LIGHTING_CB);
                if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
index 87561f7974fd075dd4bea9c6fc440a5470fffcfb..a451a9c21ffb40bbac2e45b8e24623cc2af0f9ad 100644 (file)
@@ -35,6 +35,7 @@ enum
        GUI_ID_PORT_INPUT,
        GUI_ID_FANCYTREE_CB,
        GUI_ID_SMOOTH_LIGHTING_CB,
+       GUI_ID_3D_CLOUDS_CB,
        GUI_ID_DAMAGE_CB,
        GUI_ID_CREATIVE_CB,
        GUI_ID_JOIN_GAME_BUTTON,
@@ -64,6 +65,7 @@ struct MainMenuData
        std::wstring password;
        bool fancy_trees;
        bool smooth_lighting;
+       bool clouds_3d;
        // Server options
        bool creative_mode;
        bool enable_damage;
index bc44775bdeaba6246dc3898507169a63bf790d30..6739a77590e01a503bbd8e2495c524937806e284 100644 (file)
@@ -1543,6 +1543,7 @@ int main(int argc, char *argv[])
                                menudata.port = narrow_to_wide(itos(port));
                                menudata.fancy_trees = g_settings->getBool("new_style_leaves");
                                menudata.smooth_lighting = g_settings->getBool("smooth_lighting");
+                               menudata.clouds_3d = g_settings->getBool("enable_3d_clouds");
                                menudata.creative_mode = g_settings->getBool("creative_mode");
                                menudata.enable_damage = g_settings->getBool("enable_damage");
 
@@ -1615,6 +1616,7 @@ int main(int argc, char *argv[])
                                        port = newport;
                                g_settings->set("new_style_leaves", itos(menudata.fancy_trees));
                                g_settings->set("smooth_lighting", itos(menudata.smooth_lighting));
+                               g_settings->set("enable_3d_clouds", itos(menudata.clouds_3d));
                                g_settings->set("creative_mode", itos(menudata.creative_mode));
                                g_settings->set("enable_damage", itos(menudata.enable_damage));