]> git.lizzy.rs Git - minetest.git/blobdiff - src/game.cpp
Remove ClientMap::m_camera_mutex
[minetest.git] / src / game.cpp
index 0e26493a24fe070e303955589b55737121cba062..cae468d4cc72ecfbc3b67bddc33d99ab6113a049 100644 (file)
@@ -40,7 +40,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "guiPasswordChange.h"
 #include "guiVolumeChange.h"
 #include "hud.h"
-#include "logoutputbuffer.h"
 #include "mainmenumanager.h"
 #include "mapblock.h"
 #include "nodedef.h"         // Needed for determining pointing to nodes
@@ -58,6 +57,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "util/pointedthing.h"
 #include "version.h"
 #include "minimap.h"
+#include "mapblock_mesh.h"
 
 #include "sound.h"
 
@@ -289,14 +289,16 @@ inline bool isPointableNode(const MapNode &n,
 /*
        Find what the player is pointing at
 */
-PointedThing getPointedThing(Client *client, v3f player_position,
-               v3f camera_direction, v3f camera_position, core::line3d<f32> shootline,
-               f32 d, bool liquids_pointable, bool look_for_object, v3s16 camera_offset,
-               std::vector<aabb3f> &hilightboxes, ClientActiveObject *&selected_object)
+PointedThing getPointedThing(Client *client, Hud *hud, const v3f &player_position,
+               const v3f &camera_direction, const v3f &camera_position,
+               core::line3d<f32> shootline, f32 d, bool liquids_pointable,
+               bool look_for_object, const v3s16 &camera_offset,
+               ClientActiveObject *&selected_object)
 {
        PointedThing result;
 
-       hilightboxes.clear();
+       std::vector<aabb3f> *selectionboxes = hud->getSelectionBoxes();
+       selectionboxes->clear();
        selected_object = NULL;
 
        INodeDefManager *nodedef = client->getNodeDefManager();
@@ -317,9 +319,9 @@ PointedThing getPointedThing(Client *client, v3f player_position,
                                assert(selection_box);
 
                                v3f pos = selected_object->getPosition();
-                               hilightboxes.push_back(aabb3f(
-                                                              selection_box->MinEdge + pos - intToFloat(camera_offset, BS),
-                                                              selection_box->MaxEdge + pos - intToFloat(camera_offset, BS)));
+                               selectionboxes->push_back(aabb3f(
+                                       selection_box->MinEdge, selection_box->MaxEdge));
+                               hud->setSelectionPos(pos, camera_offset);
                        }
 
                        mindistance = (selected_object->getPosition() - camera_position).getLength();
@@ -415,22 +417,56 @@ PointedThing getPointedThing(Client *client, v3f player_position,
                                                result.node_abovesurface = np_above;
                                                mindistance = distance;
 
-                                               hilightboxes.clear();
-
-                                               if (!g_settings->getBool("enable_node_highlighting")) {
-                                                       for (std::vector<aabb3f>::const_iterator
-                                                                       i2 = boxes.begin();
-                                                                       i2 != boxes.end(); ++i2) {
-                                                               aabb3f box = *i2;
-                                                               box.MinEdge += npf + v3f(-d, -d, -d) - intToFloat(camera_offset, BS);
-                                                               box.MaxEdge += npf + v3f(d, d, d) - intToFloat(camera_offset, BS);
-                                                               hilightboxes.push_back(box);
-                                                       }
+                                               selectionboxes->clear();
+                                               for (std::vector<aabb3f>::const_iterator
+                                                               i2 = boxes.begin();
+                                                               i2 != boxes.end(); ++i2) {
+                                                       aabb3f box = *i2;
+                                                       box.MinEdge += v3f(-d, -d, -d);
+                                                       box.MaxEdge += v3f(d, d, d);
+                                                       selectionboxes->push_back(box);
                                                }
+                                               hud->setSelectionPos(npf, camera_offset);
                                        }
                                }
                        } // for coords
 
+       // Update selection mesh light level and vertex colors
+       if (selectionboxes->size() > 0) {
+               v3f pf = hud->getSelectionPos();
+               v3s16 p = floatToInt(pf, BS);  
+
+               // Get selection mesh light level
+               MapNode n = map.getNodeNoEx(p); 
+               u16 node_light = getInteriorLight(n, -1, nodedef);
+               u16 light_level = node_light;
+
+               for (u8 i = 0; i < 6; i++) {
+                       n = map.getNodeNoEx(p + g_6dirs[i]);
+                       node_light = getInteriorLight(n, -1, nodedef);
+                       if (node_light > light_level)
+                               light_level = node_light;
+               }
+
+               video::SColor c = MapBlock_LightColor(255, light_level, 0);
+               u8 day = c.getRed();
+               u8 night = c.getGreen();
+               u32 daynight_ratio = client->getEnv().getDayNightRatio();
+               finalColorBlend(c, day, night, daynight_ratio);
+
+               // Modify final color a bit with time
+               u32 timer = porting::getTimeMs() % 5000;
+               float timerf = (float)(irr::core::PI * ((timer / 2500.0) - 0.5));
+               float sin_r = 0.08 * sin(timerf);
+               float sin_g = 0.08 * sin(timerf + irr::core::PI * 0.5);
+               float sin_b = 0.08 * sin(timerf + irr::core::PI);
+               c.setRed(core::clamp(core::round32(c.getRed() * (0.8 + sin_r)), 0, 255));
+               c.setGreen(core::clamp(core::round32(c.getGreen() * (0.8 + sin_g)), 0, 255));
+               c.setBlue(core::clamp(core::round32(c.getBlue() * (0.8 + sin_b)), 0, 255));
+
+               // Set mesh final color
+               hud->setSelectionMeshColor(c);
+       }
        return result;
 }
 
@@ -490,7 +526,7 @@ class ProfilerGraph
                        color(color)
                {}
        };
-       std::vector<Piece> m_log;
+       std::deque<Piece> m_log;
 public:
        u32 m_log_max_size;
 
@@ -513,7 +549,7 @@ class ProfilerGraph
        {
                std::map<std::string, Meta> m_meta;
 
-               for (std::vector<Piece>::const_iterator k = m_log.begin();
+               for (std::deque<Piece>::const_iterator k = m_log.begin();
                                k != m_log.end(); ++k) {
                        const Piece &piece = *k;
 
@@ -601,7 +637,7 @@ class ProfilerGraph
                        float lastscaledvalue = 0.0;
                        bool lastscaledvalue_exists = false;
 
-                       for (std::vector<Piece>::const_iterator j = m_log.begin();
+                       for (std::deque<Piece>::const_iterator j = m_log.begin();
                                        j != m_log.end(); ++j) {
                                const Piece &piece = *j;
                                float value = 0;
@@ -1049,7 +1085,7 @@ static void show_chat_menu(GUIFormSpecMenu **cur_formspec,
                FORMSPEC_VERSION_STRING
                SIZE_TAG
                "field[3,2.35;6,0.5;f_text;;" + text + "]"
-               "button_exit[4,3;3,0.5;btn_send;" + wide_to_utf8(wstrgettext("Proceed")) + "]"
+               "button_exit[4,3;3,0.5;btn_send;" + strgettext("Proceed") + "]"
                ;
 
        /* Create menu */
@@ -1089,32 +1125,32 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
                bool singleplayermode)
 {
 #ifdef __ANDROID__
-       std::string control_text = wide_to_utf8(wstrgettext("Default Controls:\n"
-                                  "No menu visible:\n"
-                                  "- single tap: button activate\n"
-                                  "- double tap: place/use\n"
-                                  "- slide finger: look around\n"
-                                  "Menu/Inventory visible:\n"
-                                  "- double tap (outside):\n"
-                                  " -->close\n"
-                                  "- touch stack, touch slot:\n"
-                                  " --> move stack\n"
-                                  "- touch&drag, tap 2nd finger\n"
-                                  " --> place single item to slot\n"
-                                                            ));
+       std::string control_text = strgettext("Default Controls:\n"
+               "No menu visible:\n"
+               "- single tap: button activate\n"
+               "- double tap: place/use\n"
+               "- slide finger: look around\n"
+               "Menu/Inventory visible:\n"
+               "- double tap (outside):\n"
+               " -->close\n"
+               "- touch stack, touch slot:\n"
+               " --> move stack\n"
+               "- touch&drag, tap 2nd finger\n"
+               " --> place single item to slot\n"
+               );
 #else
-       std::string control_text = wide_to_utf8(wstrgettext("Default Controls:\n"
-                                  "- WASD: move\n"
-                                  "- Space: jump/climb\n"
-                                  "- Shift: sneak/go down\n"
-                                  "- Q: drop item\n"
-                                  "- I: inventory\n"
-                                  "- Mouse: turn/look\n"
-                                  "- Mouse left: dig/punch\n"
-                                  "- Mouse right: place/use\n"
-                                  "- Mouse wheel: select item\n"
-                                  "- T: chat\n"
-                                                            ));
+       std::string control_text = strgettext("Default Controls:\n"
+               "- WASD: move\n"
+               "- Space: jump/climb\n"
+               "- Shift: sneak/go down\n"
+               "- Q: drop item\n"
+               "- I: inventory\n"
+               "- Mouse: turn/look\n"
+               "- Mouse left: dig/punch\n"
+               "- Mouse right: place/use\n"
+               "- Mouse wheel: select item\n"
+               "- T: chat\n"
+               );
 #endif
 
        float ypos = singleplayermode ? 0.5 : 0.1;
@@ -1122,23 +1158,23 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
 
        os << FORMSPEC_VERSION_STRING  << SIZE_TAG
           << "button_exit[4," << (ypos++) << ";3,0.5;btn_continue;"
-          << wide_to_utf8(wstrgettext("Continue"))     << "]";
+          << strgettext("Continue") << "]";
 
        if (!singleplayermode) {
                os << "button_exit[4," << (ypos++) << ";3,0.5;btn_change_password;"
-                  << wide_to_utf8(wstrgettext("Change Password")) << "]";
+                  << strgettext("Change Password") << "]";
        }
 
 #ifndef __ANDROID__
        os              << "button_exit[4," << (ypos++) << ";3,0.5;btn_sound;"
-                       << wide_to_utf8(wstrgettext("Sound Volume")) << "]";
+                       << strgettext("Sound Volume") << "]";
        os              << "button_exit[4," << (ypos++) << ";3,0.5;btn_key_config;"
-                       << wide_to_utf8(wstrgettext("Change Keys"))  << "]";
+                       << strgettext("Change Keys")  << "]";
 #endif
        os              << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_menu;"
-                       << wide_to_utf8(wstrgettext("Exit to Menu")) << "]";
+                       << strgettext("Exit to Menu") << "]";
        os              << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
-                       << wide_to_utf8(wstrgettext("Exit to OS"))   << "]"
+                       << strgettext("Exit to OS")   << "]"
                        << "textarea[7.5,0.25;3.9,6.25;;" << control_text << ";]"
                        << "textarea[0.4,0.25;3.5,6;;" << PROJECT_NAME_C "\n"
                        << g_build_info << "\n"
@@ -1163,7 +1199,7 @@ static void updateChat(Client &client, f32 dtime, bool show_debug,
                ChatBackend &chat_backend, gui::IGUIStaticText *guitext_chat)
 {
        // Add chat log output for errors to be shown in chat
-       static LogOutputBuffer chat_log_error_buf(LMT_ERROR);
+       static LogOutputBuffer chat_log_error_buf(g_logger, LL_ERROR);
 
        // Get new messages from error log buffer
        while (!chat_log_error_buf.empty()) {
@@ -1235,6 +1271,7 @@ struct KeyCache {
                KEYMAP_ID_JUMP,
                KEYMAP_ID_SPECIAL1,
                KEYMAP_ID_SNEAK,
+               KEYMAP_ID_AUTORUN,
 
                // Other
                KEYMAP_ID_DROP,
@@ -1287,6 +1324,8 @@ void KeyCache::populate()
        key[KEYMAP_ID_SPECIAL1]     = getKeySetting("keymap_special1");
        key[KEYMAP_ID_SNEAK]        = getKeySetting("keymap_sneak");
 
+       key[KEYMAP_ID_AUTORUN]      = getKeySetting("keymap_autorun");
+
        key[KEYMAP_ID_DROP]         = getKeySetting("keymap_drop");
        key[KEYMAP_ID_INVENTORY]    = getKeySetting("keymap_inventory");
        key[KEYMAP_ID_CHAT]         = getKeySetting("keymap_chat");
@@ -1494,6 +1533,7 @@ class Game {
        void toggleFast(float *statustext_time);
        void toggleNoClip(float *statustext_time);
        void toggleCinematic(float *statustext_time);
+       void toggleAutorun(float *statustext_time);
 
        void toggleChat(float *statustext_time, bool *flag);
        void toggleHud(float *statustext_time, bool *flag);
@@ -1519,9 +1559,9 @@ class Game {
        void updateCamera(VolatileRunFlags *flags, u32 busy_time, f32 dtime,
                        float time_from_last_punch);
        void updateSound(f32 dtime);
-       void processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
-                       GameRunData *runData, f32 dtime, bool show_hud,
+       void processPlayerInteraction(GameRunData *runData, f32 dtime, bool show_hud,
                        bool show_debug);
+       void handlePointingAtNothing(GameRunData *runData, const ItemStack &playerItem);
        void handlePointingAtNode(GameRunData *runData,
                        const PointedThing &pointed, const ItemDefinition &playeritem_def,
                        const ToolCapabilities &playeritem_toolcap, f32 dtime);
@@ -1531,8 +1571,7 @@ class Game {
        void handleDigging(GameRunData *runData, const PointedThing &pointed,
                        const v3s16 &nodepos, const ToolCapabilities &playeritem_toolcap,
                        f32 dtime);
-       void updateFrame(std::vector<aabb3f> &highlight_boxes, ProfilerGraph *graph,
-                       RunStats *stats, GameRunData *runData,
+       void updateFrame(ProfilerGraph *graph, RunStats *stats, GameRunData *runData,
                        f32 dtime, const VolatileRunFlags &flags, const CameraOrientation &cam);
        void updateGui(float *statustext_time, const RunStats &stats,
                        const GameRunData& runData, f32 dtime, const VolatileRunFlags &flags,
@@ -1626,7 +1665,6 @@ class Game {
         *       a later release.
         */
        bool m_cache_doubletap_jump;
-       bool m_cache_enable_node_highlighting;
        bool m_cache_enable_clouds;
        bool m_cache_enable_particles;
        bool m_cache_enable_fog;
@@ -1664,8 +1702,6 @@ Game::Game() :
 {
        g_settings->registerChangedCallback("doubletap_jump",
                &settingChangedCallback, this);
-       g_settings->registerChangedCallback("enable_node_highlighting",
-               &settingChangedCallback, this);
        g_settings->registerChangedCallback("enable_clouds",
                &settingChangedCallback, this);
        g_settings->registerChangedCallback("enable_particles",
@@ -1715,8 +1751,6 @@ Game::~Game()
 
        g_settings->deregisterChangedCallback("doubletap_jump",
                &settingChangedCallback, this);
-       g_settings->deregisterChangedCallback("enable_node_highlighting",
-               &settingChangedCallback, this);
        g_settings->deregisterChangedCallback("enable_clouds",
                &settingChangedCallback, this);
        g_settings->deregisterChangedCallback("enable_particles",
@@ -1803,8 +1837,6 @@ void Game::run()
                        &runData.fog_range,
                        client));
 
-       std::vector<aabb3f> highlight_boxes;
-
        set_light_table(g_settings->getFloat("display_gamma"));
 
 #ifdef __ANDROID__
@@ -1812,7 +1844,9 @@ void Game::run()
                        && client->checkPrivilege("fast");
 #endif
 
-       while (device->run() && !(*kill || g_gamecallback->shutdown_requested)) {
+       while (device->run()
+                       && !(*kill || g_gamecallback->shutdown_requested
+                       || (server && server->getShutdownRequested()))) {
 
                /* Must be called immediately after a device->run() call because it
                 * uses device->getTimer()->getTime()
@@ -1852,17 +1886,23 @@ void Game::run()
                updateCamera(&flags, draw_times.busy_time, dtime,
                                runData.time_from_last_punch);
                updateSound(dtime);
-               processPlayerInteraction(highlight_boxes, &runData, dtime,
-                               flags.show_hud, flags.show_debug);
-               updateFrame(highlight_boxes, &graph, &stats, &runData, dtime,
-                               flags, cam_view);
+               processPlayerInteraction(&runData, dtime, flags.show_hud,
+                               flags.show_debug);
+               updateFrame(&graph, &stats, &runData, dtime, flags, cam_view);
                updateProfilerGraphs(&graph);
+
+               // Update if minimap has been disabled by the server
+               flags.show_minimap &= !client->isMinimapDisabledByServer();
        }
 }
 
 
 void Game::shutdown()
 {
+       if (g_settings->get("3d_mode") == "pageflip") {
+               driver->setRenderTarget(irr::video::ERT_STEREO_BOTH_BUFFERS);
+       }
+
        showOverlayMessage(wgettext("Shutting down..."), 0, 0, false);
 
        if (clouds)
@@ -2166,7 +2206,7 @@ bool Game::initGui()
 #ifdef HAVE_TOUCHSCREENGUI
 
        if (g_touchscreengui)
-               g_touchscreengui->init(texture_src, porting::getDisplayDensity());
+               g_touchscreengui->init(texture_src);
 
 #endif
 
@@ -2562,7 +2602,17 @@ void Game::processUserInput(VolatileRunFlags *flags,
                        || noMenuActive() == false
                        || guienv->hasFocus(gui_chat_console)) {
                input->clear();
+#ifdef HAVE_TOUCHSCREENGUI
+               g_touchscreengui->hide();
+#endif
+       }
+#ifdef HAVE_TOUCHSCREENGUI
+       else if (g_touchscreengui) {
+               /* on touchscreengui step may generate own input events which ain't
+                * what we want in case we just did clear them */
+               g_touchscreengui->step(dtime);
        }
+#endif
 
        if (!guienv->hasFocus(gui_chat_console) && gui_chat_console->isOpen()) {
                gui_chat_console->closeConsoleAtOnce();
@@ -2571,13 +2621,6 @@ void Game::processUserInput(VolatileRunFlags *flags,
        // Input handler step() (used by the random input generator)
        input->step(dtime);
 
-#ifdef HAVE_TOUCHSCREENGUI
-
-       if (g_touchscreengui) {
-               g_touchscreengui->step(dtime);
-       }
-
-#endif
 #ifdef __ANDROID__
 
        if (current_formspec != 0)
@@ -2613,6 +2656,8 @@ void Game::processKeyboardInput(VolatileRunFlags *flags,
 
        if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_DROP])) {
                dropSelectedItem();
+       } else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_AUTORUN])) {
+               toggleAutorun(statustext_time);
        } else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_INVENTORY])) {
                openInventory();
        } else if (input->wasKeyDown(EscapeKey) || input->wasKeyDown(CancelKey)) {
@@ -2672,7 +2717,7 @@ void Game::processKeyboardInput(VolatileRunFlags *flags,
                // Print debug stacks
                dstream << "-----------------------------------------"
                        << std::endl;
-               dstream << DTIME << "Printing debug stacks:" << std::endl;
+               dstream << "Printing debug stacks:" << std::endl;
                dstream << "-----------------------------------------"
                        << std::endl;
                debug_stacks_print();
@@ -2842,6 +2887,16 @@ void Game::toggleCinematic(float *statustext_time)
        statustext = msg[cinematic];
 }
 
+// Add WoW-style autorun by toggling continuous forward.
+void Game::toggleAutorun(float *statustext_time)
+{
+       static const wchar_t *msg[] = { L"autorun disabled", L"autorun enabled" };
+       bool autorun_enabled = !g_settings->getBool("continuous_forward");
+       g_settings->set("continuous_forward", bool_to_cstr(autorun_enabled));
+
+       *statustext_time = 0;
+       statustext = msg[autorun_enabled ? 1 : 0];
+}
 
 void Game::toggleChat(float *statustext_time, bool *flag)
 {
@@ -2860,8 +2915,6 @@ void Game::toggleHud(float *statustext_time, bool *flag)
        *flag = !*flag;
        *statustext_time = 0;
        statustext = msg[*flag];
-       if (g_settings->getBool("enable_node_highlighting"))
-               client->setHighlighted(client->getHighlighted(), *flag);
 }
 
 void Game::toggleMinimap(float *statustext_time, bool *flag,
@@ -3447,8 +3500,8 @@ void Game::updateSound(f32 dtime)
 }
 
 
-void Game::processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
-               GameRunData *runData, f32 dtime, bool show_hud, bool show_debug)
+void Game::processPlayerInteraction(GameRunData *runData,
+               f32 dtime, bool show_hud, bool show_debug)
 {
        LocalPlayer *player = client->getEnv().getLocalPlayer();
 
@@ -3506,25 +3559,17 @@ void Game::processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
 
        PointedThing pointed = getPointedThing(
                        // input
-                       client, player_position, camera_direction,
+                       client, hud, player_position, camera_direction,
                        camera_position, shootline, d,
                        playeritem_def.liquids_pointable,
                        !runData->ldown_for_dig,
                        camera_offset,
                        // output
-                       highlight_boxes,
                        runData->selected_object);
 
        if (pointed != runData->pointed_old) {
                infostream << "Pointing at " << pointed.dump() << std::endl;
-
-               if (m_cache_enable_node_highlighting) {
-                       if (pointed.type == POINTEDTHING_NODE) {
-                               client->setHighlighted(pointed.node_undersurface, show_hud);
-                       } else {
-                               client->setHighlighted(pointed.node_undersurface, false);
-                       }
-               }
+               hud->updateSelectionMesh(camera_offset);
        }
 
        /*
@@ -3548,6 +3593,7 @@ void Game::processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
                                infostream << "Pointing away from node"
                                           << " (stopped digging)" << std::endl;
                                runData->digging = false;
+                               hud->updateSelectionMesh(camera_offset);
                        }
                }
 
@@ -3585,6 +3631,8 @@ void Game::processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
        } else if (input->getLeftState()) {
                // When button is held down in air, show continuous animation
                runData->left_punch = true;
+       } else if (input->getRightClicked()) {
+               handlePointingAtNothing(runData, playeritem);
        }
 
        runData->pointed_old = pointed;
@@ -3600,6 +3648,15 @@ void Game::processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
 }
 
 
+void Game::handlePointingAtNothing(GameRunData *runData, const ItemStack &playerItem)
+{
+       infostream << "Right Clicked in Air" << std::endl;
+       PointedThing fauxPointed;
+       fauxPointed.type = POINTEDTHING_NOTHING;
+       client->interact(5, fauxPointed);
+}
+
+
 void Game::handlePointingAtNode(GameRunData *runData,
                const PointedThing &pointed, const ItemDefinition &playeritem_def,
                const ToolCapabilities &playeritem_toolcap, f32 dtime)
@@ -3671,11 +3728,15 @@ void Game::handlePointingAtNode(GameRunData *runData,
                        } else {
                                soundmaker->m_player_rightpunch_sound =
                                                SimpleSoundSpec();
-                       }
 
-                       if (playeritem_def.node_placement_prediction == "" ||
-                                       nodedef_manager->get(map.getNodeNoEx(nodepos)).rightclickable)
-                               client->interact(3, pointed); // Report to server
+                               if (playeritem_def.node_placement_prediction == "" ||
+                                               nodedef_manager->get(map.getNodeNoEx(nodepos)).rightclickable) {
+                                       client->interact(3, pointed); // Report to server
+                               } else {
+                                       soundmaker->m_player_rightpunch_sound =
+                                               playeritem_def.sound_place_failed;
+                               }
+                       }
                }
        }
 }
@@ -3689,8 +3750,11 @@ void Game::handlePointingAtObject(GameRunData *runData,
 {
        infotext = utf8_to_wide(runData->selected_object->infoText());
 
-       if (infotext == L"" && show_debug) {
-               infotext = utf8_to_wide(runData->selected_object->debugInfoText());
+       if (show_debug) {
+               if (infotext != L"") {
+                       infotext += L"\n";
+               }
+               infotext += utf8_to_wide(runData->selected_object->debugInfoText());
        }
 
        if (input->getLeftState()) {
@@ -3854,9 +3918,9 @@ void Game::handleDigging(GameRunData *runData,
 }
 
 
-void Game::updateFrame(std::vector<aabb3f> &highlight_boxes,
-               ProfilerGraph *graph, RunStats *stats, GameRunData *runData,
-               f32 dtime, const VolatileRunFlags &flags, const CameraOrientation &cam)
+void Game::updateFrame(ProfilerGraph *graph, RunStats *stats,
+               GameRunData *runData, f32 dtime, const VolatileRunFlags &flags,
+               const CameraOrientation &cam)
 {
        LocalPlayer *player = client->getEnv().getLocalPlayer();
 
@@ -4048,7 +4112,7 @@ void Game::updateFrame(std::vector<aabb3f> &highlight_boxes,
        }
 
        draw_scene(driver, smgr, *camera, *client, player, *hud, *mapper,
-                       guienv, highlight_boxes, screensize, skycolor, flags.show_hud,
+                       guienv, screensize, skycolor, flags.show_hud,
                        flags.show_minimap);
 
        /*
@@ -4328,7 +4392,6 @@ void Game::settingChangedCallback(const std::string &setting_name, void *data)
 void Game::readSettings()
 {
        m_cache_doubletap_jump            = g_settings->getBool("doubletap_jump");
-       m_cache_enable_node_highlighting  = g_settings->getBool("enable_node_highlighting");
        m_cache_enable_clouds             = g_settings->getBool("enable_clouds");
        m_cache_enable_particles          = g_settings->getBool("enable_particles");
        m_cache_enable_fog                = g_settings->getBool("enable_fog");
@@ -4420,4 +4483,3 @@ void the_game(bool *kill,
                errorstream << "ModError: " << error_message << std::endl;
        }
 }
-