From 63611932ebae93620386b26cfa82f7c4552b22ff Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 29 May 2011 21:11:16 +0300 Subject: player passwords and privileges in world/auth.txt --HG-- extra : rebase_source : 7260636295d9068fbeeddf4143c89f2b8a91446c --- src/game.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 603a86da3..cc758be7e 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -764,8 +764,9 @@ void the_game( { if(client.accessDenied()) { - error_message = L"Access denied. Check your password and try again."; - std::cout< Date: Sun, 29 May 2011 21:13:29 +0300 Subject: invert_mouse config option --HG-- extra : rebase_source : 2695ad71185244cefbcf6e3e28ba1ab5e54c882f --- src/game.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index cc758be7e..6932b45f1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -894,6 +894,8 @@ void the_game( core::list frametime_log; float damage_flash_timer = 0; + + bool invert_mouse = g_settings.getBool("invert_mouse"); /* Main loop @@ -1306,6 +1308,8 @@ void the_game( else{ s32 dx = input->getMousePos().X - displaycenter.X; s32 dy = input->getMousePos().Y - displaycenter.Y; + if(invert_mouse) + dy = -dy; //std::cout<<"window active, pos difference "< Date: Tue, 31 May 2011 00:15:43 +0300 Subject: Reduced the CPU usage of the sent block selector algorithm --- src/game.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 6932b45f1..e8e6cb71f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -903,6 +903,10 @@ void the_game( bool first_loop_after_window_activation = true; + // TODO: Convert the static interval timers to these + // Interval limiter for profiler + IntervalLimiter m_profiler_interval; + // Time is in milliseconds // NOTE: getRealTime() causes strange problems in wine (imprecision?) // NOTE: So we have to use getTime() and call run()s between them @@ -1089,6 +1093,21 @@ void the_game( } } + /* + Profiler + */ + float profiler_print_interval = + g_settings.getFloat("profiler_print_interval"); + if(profiler_print_interval != 0) + { + if(m_profiler_interval.step(0.030, profiler_print_interval)) + { + dstream<<"Profiler:"< Date: Tue, 7 Jun 2011 22:08:16 +0300 Subject: Added an experimental "far view" thing. Doesn't work exactly like it should and not suitable for real use yet, and might never be. --- src/game.cpp | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index e8e6cb71f..ef574c348 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "config.h" #include "clouds.h" #include "keycode.h" +#include "farmesh.h" /* Setting this to 1 enables a special camera mode that forces @@ -595,6 +596,10 @@ void update_skybox(video::IVideoDriver* driver, skybox->remove(); } + // Disable skybox if FarMesh is enabled + if(g_settings.getBool("enable_farmesh")) + return; + if(brightness >= 0.5) { skybox = smgr->addSkyBoxSceneNode( @@ -815,8 +820,21 @@ void the_game( float cloud_height = BS*100; Clouds *clouds = NULL; - clouds = new Clouds(smgr->getRootSceneNode(), smgr, -1, - cloud_height, time(0)); + if(g_settings.getBool("enable_clouds")) + { + clouds = new Clouds(smgr->getRootSceneNode(), smgr, -1, + cloud_height, time(0)); + } + + /* + FarMesh + */ + + FarMesh *farmesh = NULL; + if(g_settings.getBool("enable_farmesh")) + { + farmesh = new FarMesh(smgr->getRootSceneNode(), smgr, -1, client.getMapSeed()); + } /* Move into game @@ -1789,6 +1807,16 @@ void the_game( 0.05+brightness*0.95); } + /* + Update farmesh (TODO: Remove from here) + */ + if(farmesh) + { + farmesh->step(dtime); + farmesh->update(v2f(player_position.X, player_position.Z), + 0.05+brightness*0.95); + } + // Store brightness value old_brightness = brightness; @@ -1999,6 +2027,13 @@ void the_game( //driver->beginScene(false, true, bgcolor); beginscenetime = timer.stop(true); } + + /* + Draw farmesh before everything else + */ + { + //farmesh->render(); + } //timer3.stop(); @@ -2131,7 +2166,8 @@ void the_game( /* Drop stuff */ - clouds->drop(); + if(clouds) + clouds->drop(); /* Draw a "shutting down" screen, which will be shown while the map -- cgit v1.2.3 From dc5319b6c9f2e39d93f2fa881403f36fc47ffaac Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 17 Jun 2011 22:20:15 +0300 Subject: Moved some mapnode content stuff from mapnode.{h,cpp} and digging property stuff from material.cpp to content_mapnode.{h,cpp} --- src/game.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index ef574c348..eef27c805 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -32,6 +32,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "keycode.h" #include "farmesh.h" +// TODO: Move content-aware stuff to separate file +#include "content_mapnode.h" + /* Setting this to 1 enables a special camera mode that forces the renderers to think that the camera statically points from -- cgit v1.2.3 From e7580d2804d29afb486f4eb2bd4dfb94f7181824 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 17 Jun 2011 23:55:21 +0300 Subject: added in-game key shortcuts for toggling free_move and fast_move (default K and J) --- src/game.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index eef27c805..09f06f4f6 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1190,6 +1190,32 @@ void the_game( &g_menumgr, dest, L""))->drop(); } + else if(input->wasKeyDown(getKeySetting("keymap_freemove"))) + { + if(g_settings.getBool("free_move")) + { + g_settings.set("free_move","false"); + chat_lines.push_back(ChatLine(L"free_move disabled")); + } + else + { + g_settings.set("free_move","true"); + chat_lines.push_back(ChatLine(L"free_move enabled")); + } + } + else if(input->wasKeyDown(getKeySetting("keymap_fastmove"))) + { + if(g_settings.getBool("fast_move")) + { + g_settings.set("fast_move","false"); + chat_lines.push_back(ChatLine(L"fast_move disabled")); + } + else + { + g_settings.set("fast_move","true"); + chat_lines.push_back(ChatLine(L"fast_move enabled")); + } + } // Item selection with mouse wheel { -- cgit v1.2.3 From da692355e84f8d1e5210c3c89daf775cf23ec38b Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 18 Jun 2011 00:46:50 +0300 Subject: Created and moved stuff to content_nodemeta.{h,cpp} --- src/game.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 09f06f4f6..b11547679 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc., // TODO: Move content-aware stuff to separate file #include "content_mapnode.h" +#include "content_nodemeta.h" /* Setting this to 1 enables a special camera mode that forces @@ -1730,7 +1731,11 @@ void the_game( dstream<<"Chest node right-clicked"< Date: Sat, 18 Jun 2011 02:00:01 +0300 Subject: moved inventory menu definition of chest and furnace to content_nodemeta.{h,cpp} --- src/game.cpp | 87 ++++++++++++++++++++++++------------------------------------ 1 file changed, 34 insertions(+), 53 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index b11547679..c36688d12 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1709,75 +1709,56 @@ void the_game( { std::cout<typeId() == CONTENT_SIGN_WALL && !random_input) + // If metadata provides an inventory view, activate it + if(meta && meta->getInventoryDrawSpecString() != "" && !random_input) { - dstream<<"Sign node right-clicked"<getText()); - - (new GUITextInputMenu(guienv, guiroot, -1, - &g_menumgr, dest, - wtext))->drop(); - } - else if(meta && meta->typeId() == CONTENT_CHEST && !random_input) - { - dstream<<"Chest node right-clicked"< draw_spec; + v2s16 invsize = + GUIInventoryMenu::makeDrawSpecArrayFromString( + draw_spec, + meta->getInventoryDrawSpecString(), + current_name); + GUIInventoryMenu *menu = new GUIInventoryMenu(guienv, guiroot, -1, - &g_menumgr, v2s16(8,9), + &g_menumgr, invsize, client.getInventoryContext(), &client); - - core::array draw_spec; - - draw_spec.push_back(GUIInventoryMenu::DrawSpec( - "list", chest_inv_id, "0", - v2s32(0, 0), v2s32(8, 4))); - draw_spec.push_back(GUIInventoryMenu::DrawSpec( - "list", "current_player", "main", - v2s32(0, 5), v2s32(8, 4))); - menu->setDrawSpec(draw_spec); - menu->drop(); - } - else if(meta && meta->typeId() == CONTENT_FURNACE && !random_input) + else if(meta && meta->typeId() == CONTENT_SIGN_WALL && !random_input) { - dstream<<"Furnace node right-clicked"<drop(); + TextDest *dest = new TextDestSignNode(nodepos, &client); + + std::wstring wtext = + narrow_to_wide(signmeta->getText()); + (new GUITextInputMenu(guienv, guiroot, -1, + &g_menumgr, dest, + wtext))->drop(); } else { -- cgit v1.2.3 From c391bcee1698beabaec76ed13361d2930cb22f94 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 18 Jun 2011 02:32:34 +0300 Subject: removed furnace menu because it is not needed anymore --- src/game.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index c36688d12..d9bbe795e 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "guiPasswordChange.h" #include "guiInventoryMenu.h" #include "guiTextInputMenu.h" -#include "guiFurnaceMenu.h" #include "materials.h" #include "config.h" #include "clouds.h" -- cgit v1.2.3 From 4a6e6cee2087deaf45d741154d03227774bb5168 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 18 Jun 2011 08:50:14 +0300 Subject: enabled word wrap in chat --- src/game.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index d9bbe795e..4d943f45f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -871,8 +871,8 @@ void the_game( gui::IGUIStaticText *guitext_chat = guienv->addStaticText( L"", core::rect(0,0,0,0), - false, false); // Disable word wrap as of now - //false, true); + //false, false); // Disable word wrap as of now + false, true); //guitext_chat->setBackgroundColor(video::SColor(96,0,0,0)); core::list chat_lines; @@ -1996,7 +1996,7 @@ void the_game( 10, 50, screensize.X - 10, - 50 + text_height*chat_lines.size() + 50 + guitext_chat->getTextHeight() ); guitext_chat->setRelativePosition(rect); -- cgit v1.2.3 From 0bd1b782d0134180ae1af692533f1c59e29a03de Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 18 Jun 2011 09:04:31 +0300 Subject: modified health bar a bit --- src/game.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 4d943f45f..7ad7746ad 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -362,7 +362,7 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font, core::rect(core::position2d(0,0), core::dimension2di(heart_texture->getOriginalSize())), NULL, colors, true); - p += v2s32(20,0); + p += v2s32(16,0); } if(halfheartcount % 2 == 1) { @@ -375,7 +375,7 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font, driver->draw2DImage(heart_texture, rect, core::rect(core::position2d(0,0), srcd), NULL, colors, true); - p += v2s32(20,0); + p += v2s32(16,0); } } } -- cgit v1.2.3 From 7773e68c2a42659b4a34af56e1fc799ffc9362ed Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 18 Jun 2011 12:42:17 +0300 Subject: farmesh is now usable. --- src/game.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 7ad7746ad..237867be1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -599,9 +599,9 @@ void update_skybox(video::IVideoDriver* driver, skybox->remove(); } - // Disable skybox if FarMesh is enabled + /*// Disable skybox if FarMesh is enabled if(g_settings.getBool("enable_farmesh")) - return; + return;*/ if(brightness >= 0.5) { @@ -836,7 +836,7 @@ void the_game( FarMesh *farmesh = NULL; if(g_settings.getBool("enable_farmesh")) { - farmesh = new FarMesh(smgr->getRootSceneNode(), smgr, -1, client.getMapSeed()); + farmesh = new FarMesh(smgr->getRootSceneNode(), smgr, -1, client.getMapSeed(), &client); } /* @@ -1844,11 +1844,19 @@ void the_game( if(g_settings.getBool("enable_fog") == true) { - f32 range = draw_control.wanted_range*BS + MAP_BLOCKSIZE*BS*1.5; - if(draw_control.range_all) - range = 100000*BS; - if(range < 50*BS) - range = range * 0.5 + 25*BS; + f32 range; + if(farmesh) + { + range = BS*MAP_BLOCKSIZE*20; + } + else + { + range = draw_control.wanted_range*BS + MAP_BLOCKSIZE*BS*1.5; + if(draw_control.range_all) + range = 100000*BS; + if(range < 50*BS) + range = range * 0.5 + 25*BS; + } driver->setFog( bgcolor, -- cgit v1.2.3 From c78d61061863559cc3daf6b838a0f936ce53acf9 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 18 Jun 2011 13:43:49 +0300 Subject: farmesh render range is now dynamic --- src/game.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 237867be1..1ab3d7962 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -915,6 +915,7 @@ void the_game( core::list frametime_log; float damage_flash_timer = 0; + s16 farmesh_range = 20*MAP_BLOCKSIZE; bool invert_mouse = g_settings.getBool("invert_mouse"); @@ -1826,13 +1827,19 @@ void the_game( } /* - Update farmesh (TODO: Remove from here) + Update farmesh */ if(farmesh) { + farmesh_range = draw_control.wanted_range * 10; + if(draw_control.range_all && farmesh_range < 500) + farmesh_range = 500; + if(farmesh_range > 1000) + farmesh_range = 1000; + farmesh->step(dtime); farmesh->update(v2f(player_position.X, player_position.Z), - 0.05+brightness*0.95); + 0.05+brightness*0.95, farmesh_range); } // Store brightness value @@ -1847,7 +1854,7 @@ void the_game( f32 range; if(farmesh) { - range = BS*MAP_BLOCKSIZE*20; + range = BS*farmesh_range; } else { @@ -2054,13 +2061,6 @@ void the_game( beginscenetime = timer.stop(true); } - /* - Draw farmesh before everything else - */ - { - //farmesh->render(); - } - //timer3.stop(); //std::cout<drawAll()"< Date: Sat, 18 Jun 2011 18:44:01 +0300 Subject: Hand-picked Mac OSX cursor and bundle path fixes from https://bitbucket.org/toabi/minetest-mac --- src/game.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 1ab3d7962..f3fac0c84 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1366,7 +1366,11 @@ void the_game( if((device->isWindowActive() && noMenuActive()) || random_input) { if(!random_input) - device->getCursorControl()->setVisible(false); + { + // Mac OSX gets upset if this is set every frame + if(device->getCursorControl()->isVisible()) + device->getCursorControl()->setVisible(false); + } if(first_loop_after_window_activation){ //std::cout<<"window active, first loop"<setMousePos(displaycenter.X, displaycenter.Y); } else{ - device->getCursorControl()->setVisible(true); + // Mac OSX gets upset if this is set every frame + if(device->getCursorControl()->isVisible() == false) + device->getCursorControl()->setVisible(true); //std::cout<<"window inactive"<