updated menu a bit, and some other small fixes
authorPerttu Ahola <celeron55@gmail.com>
Sun, 24 Apr 2011 12:37:41 +0000 (15:37 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 24 Apr 2011 12:37:41 +0000 (15:37 +0300)
CMakeLists.txt
doc/changelog.txt
src/clientobject.cpp
src/guiMainMenu.cpp
src/guiMainMenu.h
src/main.cpp
src/map.cpp
src/mapnode.cpp
src/serverobject.cpp

index 6ba6678a8ab73b54f713651ba6842664f3b02daf..1bd5e776b424a555e4c26d59420d6dd40d057a02 100644 (file)
@@ -9,7 +9,7 @@ project(minetest)
 
 set(VERSION_MAJOR 0)
 set(VERSION_MINOR 2)
-set(VERSION_PATCH 20110423_0_test)
+set(VERSION_PATCH 20110424_0)
 set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
 
 # Configuration options
index f467d6ecde5b511b49046854194ee3326b0bb8a7..574ea60b15508940f0a1c3d1c2d0271d49a027f4 100644 (file)
@@ -3,8 +3,9 @@ Minetest-c55 changelog
 This should contain all the major changes.
 For minor stuff, refer to the commit log of the repository.
 
-X:
+2011-04-24:
 - Smooth lighting with simple ambient occlusion
+- Updated main menu
 
 2011-04-23_0_test:
 - Small bug fixes
index 78258add88bce8cb1fdcc4cbf5806c16ac6054c8..f7e6e051d30624813f3c1ed94c3c40aff164eb83 100644 (file)
@@ -683,7 +683,7 @@ void Oerkki1CAO::step(float dtime, ClientEnvironment *env)
        v2f playerpos_2d(playerpos.X,playerpos.Z);
        v2f objectpos_2d(m_position.X,m_position.Z);
 
-       if(fabs(objectpos_2d.Y - playerpos_2d.Y) < 2.0*BS &&
+       if(fabs(m_position.Y - playerpos.Y) < 3.0*BS &&
                        objectpos_2d.getDistanceFrom(playerpos_2d) < 1.0*BS)
        {
                if(m_attack_interval.step(dtime, 0.5))
index 04341fe227f81dc18463f29e2803f56351257f05..ac02f79e37facaeedb0a2db4465b4387b01e2616 100644 (file)
@@ -65,7 +65,10 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
        std::wstring text_port;
        bool creative_mode;
        bool enable_damage;
-
+       bool fancy_trees;
+       bool smooth_lighting;
+       
+       // Client options
        {
                gui::IGUIElement *e = getElementFromId(258);
                if(e != NULL)
@@ -87,6 +90,22 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
                else
                        text_port = m_data->port;
        }
+       {
+               gui::IGUIElement *e = getElementFromId(263);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       fancy_trees = ((gui::IGUICheckBox*)e)->isChecked();
+               else
+                       fancy_trees = m_data->fancy_trees;
+       }
+       {
+               gui::IGUIElement *e = getElementFromId(262);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       smooth_lighting = ((gui::IGUICheckBox*)e)->isChecked();
+               else
+                       smooth_lighting = m_data->smooth_lighting;
+       }
+       
+       // Server options
        {
                gui::IGUIElement *e = getElementFromId(259);
                if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
@@ -187,6 +206,18 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
                const wchar_t *text = L"Leave address blank to start a local server.";
                Environment->addStaticText(text, rect, false, true, this, -1);
        }
+       {
+               core::rect<s32> rect(0, 0, 250, 30);
+               rect += topleft_client + v2s32(40, 150);
+               Environment->addCheckBox(fancy_trees, rect, this, 263,
+                               L"Fancy trees");
+       }
+       {
+               core::rect<s32> rect(0, 0, 250, 30);
+               rect += topleft_client + v2s32(40, 150+30);
+               Environment->addCheckBox(smooth_lighting, rect, this, 262,
+                               L"Smooth Lighting");
+       }
        // Start game button
        {
                core::rect<s32> rect(0, 0, 180, 30);
@@ -285,6 +316,16 @@ void GUIMainMenu::acceptInput()
                if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
                        m_data->enable_damage = ((gui::IGUICheckBox*)e)->isChecked();
        }
+       {
+               gui::IGUIElement *e = getElementFromId(262);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       m_data->smooth_lighting = ((gui::IGUICheckBox*)e)->isChecked();
+       }
+       {
+               gui::IGUIElement *e = getElementFromId(263);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       m_data->fancy_trees = ((gui::IGUICheckBox*)e)->isChecked();
+       }
        
        m_accepted = true;
 }
index d003599c42a48d0e7a3bd63d4c78d5b787273233..4999d68ba668923ceec5326b906af2c9be230885 100644 (file)
@@ -30,14 +30,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 struct MainMenuData
 {
        MainMenuData():
+               // Client opts
+               fancy_trees(false),
+               smooth_lighting(false),
+               // Server opts
                creative_mode(false),
                enable_damage(false),
+               // Actions
                delete_map(false)
        {}
+
        // These are in the native format of the gui elements
+       
+       // Client options
        std::wstring address;
        std::wstring port;
        std::wstring name;
+       bool fancy_trees;
+       bool smooth_lighting;
+       // Server options
        bool creative_mode;
        bool enable_damage;
        // If map deletion is requested, this is set to true
index 429b769f7b28081ffa1270e1753d237b1f3c0b2c..3bc4de7778ac367bf79a6d82845381f3973bdaed 100644 (file)
@@ -1352,6 +1352,8 @@ int main(int argc, char *argv[])
                                menudata.address = narrow_to_wide(address);\r
                                menudata.name = narrow_to_wide(playername);\r
                                menudata.port = narrow_to_wide(itos(port));\r
+                               menudata.fancy_trees = g_settings.getBool("new_style_leaves");\r
+                               menudata.smooth_lighting = g_settings.getBool("smooth_lighting");\r
                                menudata.creative_mode = g_settings.getBool("creative_mode");\r
                                menudata.enable_damage = g_settings.getBool("enable_damage");\r
 \r
@@ -1413,6 +1415,8 @@ int main(int argc, char *argv[])
                                int newport = stoi(wide_to_narrow(menudata.port));\r
                                if(newport != 0)\r
                                        port = newport;\r
+                               g_settings.set("new_style_leaves", itos(menudata.fancy_trees));\r
+                               g_settings.set("smooth_lighting", itos(menudata.smooth_lighting));\r
                                g_settings.set("creative_mode", itos(menudata.creative_mode));\r
                                g_settings.set("enable_damage", itos(menudata.enable_damage));\r
                                \r
@@ -1439,6 +1443,9 @@ int main(int argc, char *argv[])
                        if(device->run() == false)\r
                                break;\r
                        \r
+                       // Initialize mapnode again to enable changed graphics settings\r
+                       init_mapnode();\r
+\r
                        /*\r
                                Run game\r
                        */\r
index 7e4fc4f47313abbe2e450c5aa37aa085eadd1e2a..9610b0b53f5795255a45cb5847387387204d2fc5 100644 (file)
@@ -1794,6 +1794,7 @@ ServerMap::ServerMap(std::string savedir):
        Map(dout_server),
        m_seed(0)
 {
+       dstream<<__FUNCTION_NAME<<std::endl;
        
        //m_chunksize = 64;
        //m_chunksize = 16; // Too slow
@@ -1891,6 +1892,8 @@ ServerMap::ServerMap(std::string savedir):
 
 ServerMap::~ServerMap()
 {
+       dstream<<__FUNCTION_NAME<<std::endl;
+       
        try
        {
                if(m_map_saving_enabled)
index 81408205f65eebb8659a589ec80f6774741672d8..2d4d75b37ed453425480f3ed4a23d89230d4ea9b 100644 (file)
@@ -128,6 +128,9 @@ void init_mapnode()
        for(u16 i=0; i<256; i++)
        {
                ContentFeatures *f = &g_content_features[i];
+               // Re-initialize
+               *f = ContentFeatures();
+
                for(u16 j=0; j<6; j++)
                        f->tiles[j].material_type = initial_material_type;
        }
index 30234f7e98920caa5e047556ae3afe6852a102e2..aa36dad922b99aab9474b8d7126acd83e8457a94 100644 (file)
@@ -507,7 +507,7 @@ void Oerkki1SAO::step(float dtime, Queue<ActiveObjectMessage> &messages,
        */
 
        m_age += dtime;
-       if(m_age > 60)
+       if(m_age > 120)
        {
                // Die
                m_removed = true;