From c9967d6d07a4863f2278376b34bb68d86392e902 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 24 Apr 2011 15:37:41 +0300 Subject: [PATCH] updated menu a bit, and some other small fixes --- CMakeLists.txt | 2 +- doc/changelog.txt | 3 ++- src/clientobject.cpp | 2 +- src/guiMainMenu.cpp | 43 ++++++++++++++++++++++++++++++++++++++++++- src/guiMainMenu.h | 11 +++++++++++ src/main.cpp | 7 +++++++ src/map.cpp | 3 +++ src/mapnode.cpp | 3 +++ src/serverobject.cpp | 2 +- 9 files changed, 71 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ba6678a8..1bd5e776b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/doc/changelog.txt b/doc/changelog.txt index f467d6ecd..574ea60b1 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -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 diff --git a/src/clientobject.cpp b/src/clientobject.cpp index 78258add8..f7e6e051d 100644 --- a/src/clientobject.cpp +++ b/src/clientobject.cpp @@ -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)) diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index 04341fe22..ac02f79e3 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -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 rect(0, 0, 250, 30); + rect += topleft_client + v2s32(40, 150); + Environment->addCheckBox(fancy_trees, rect, this, 263, + L"Fancy trees"); + } + { + core::rect 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 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; } diff --git a/src/guiMainMenu.h b/src/guiMainMenu.h index d003599c4..4999d68ba 100644 --- a/src/guiMainMenu.h +++ b/src/guiMainMenu.h @@ -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 diff --git a/src/main.cpp b/src/main.cpp index 429b769f7..3bc4de777 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1352,6 +1352,8 @@ int main(int argc, char *argv[]) menudata.address = narrow_to_wide(address); menudata.name = narrow_to_wide(playername); 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.creative_mode = g_settings.getBool("creative_mode"); menudata.enable_damage = g_settings.getBool("enable_damage"); @@ -1413,6 +1415,8 @@ int main(int argc, char *argv[]) int newport = stoi(wide_to_narrow(menudata.port)); if(newport != 0) port = newport; + g_settings.set("new_style_leaves", itos(menudata.fancy_trees)); + g_settings.set("smooth_lighting", itos(menudata.smooth_lighting)); g_settings.set("creative_mode", itos(menudata.creative_mode)); g_settings.set("enable_damage", itos(menudata.enable_damage)); @@ -1439,6 +1443,9 @@ int main(int argc, char *argv[]) if(device->run() == false) break; + // Initialize mapnode again to enable changed graphics settings + init_mapnode(); + /* Run game */ diff --git a/src/map.cpp b/src/map.cpp index 7e4fc4f47..9610b0b53 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1794,6 +1794,7 @@ ServerMap::ServerMap(std::string savedir): Map(dout_server), m_seed(0) { + dstream<<__FUNCTION_NAME<tiles[j].material_type = initial_material_type; } diff --git a/src/serverobject.cpp b/src/serverobject.cpp index 30234f7e9..aa36dad92 100644 --- a/src/serverobject.cpp +++ b/src/serverobject.cpp @@ -507,7 +507,7 @@ void Oerkki1SAO::step(float dtime, Queue &messages, */ m_age += dtime; - if(m_age > 60) + if(m_age > 120) { // Die m_removed = true;