#include "gettext.h"
#include "log.h"
#include "filesys.h"
-
-/*
- TODO: Move content-aware stuff to separate file by adding properties
- and virtual interfaces
-*/
+// Needed for some special cases for CONTENT_TORCH and CONTENT_SIGN_WALL
+// TODO: A generic way for handling such should be created
#include "content_mapnode.h"
+// Needed for sign text input
+// TODO: A generic way for handling such should be created
#include "content_nodemeta.h"
+// Needed for determining pointing to nodes
+#include "mapnode_contentfeatures.h"
/*
Setting this to 1 enables a special camera mode that forces
L"",
core::rect<s32>(5, 5+(text_height+5)*1, 795, (5+text_height)*2),
false, false);
-
// At the middle of the screen
// Object infos are shown in this
gui::IGUIStaticText *guitext_info = guienv->addStaticText(
//guitext_chat->setBackgroundColor(video::SColor(96,0,0,0));
core::list<ChatLine> chat_lines;
+ // Profiler text (size is updated when text is updated)
+ gui::IGUIStaticText *guitext_profiler = guienv->addStaticText(
+ L"<Profiler>",
+ core::rect<s32>(6, 4+(text_height+5)*2, 400,
+ (text_height+5)*2 + text_height*35),
+ false, false);
+ guitext_profiler->setBackgroundColor(video::SColor(80,0,0,0));
+ guitext_profiler->setVisible(false);
+
/*GUIQuickInventory *quick_inventory = new GUIQuickInventory
(guienv, NULL, v2s32(10, 70), 5, &local_inventory);*/
/*GUIQuickInventory *quick_inventory = new GUIQuickInventory
bool respawn_menu_active = false;
+ bool show_profiler = false;
+ bool force_fog_off = false;
+ bool disable_camera_update = false;
+
/*
Main loop
*/
*/
float profiler_print_interval =
g_settings->getFloat("profiler_print_interval");
- if(profiler_print_interval != 0)
+ bool print_to_log = true;
+ if(profiler_print_interval == 0){
+ print_to_log = false;
+ profiler_print_interval = 5;
+ }
+ if(m_profiler_interval.step(dtime, profiler_print_interval))
{
- if(m_profiler_interval.step(0.030, profiler_print_interval))
- {
+ if(print_to_log){
infostream<<"Profiler:"<<std::endl;
g_profiler->print(infostream);
- g_profiler->clear();
}
+
+ std::ostringstream os(std::ios_base::binary);
+ g_profiler->print(os);
+ std::wstring text = narrow_to_wide(os.str());
+ guitext_profiler->setText(text.c_str());
+
+ g_profiler->clear();
+
+ s32 w = font->getDimension(text.c_str()).Width;
+ if(w < 400)
+ w = 400;
+ core::rect<s32> rect(6, 4+(text_height+5)*2, 12+w,
+ 8+(text_height+5)*2 +
+ font->getDimension(text.c_str()).Height);
+ guitext_profiler->setRelativePosition(rect);
}
/*
image->drop();
}
}
+ else if(input->wasKeyDown(getKeySetting("keymap_toggle_profiler")))
+ {
+ show_profiler = !show_profiler;
+ guitext_profiler->setVisible(show_profiler);
+ if(show_profiler)
+ chat_lines.push_back(ChatLine(L"Profiler disabled"));
+ else
+ chat_lines.push_back(ChatLine(L"Profiler enabled"));
+ }
+ else if(input->wasKeyDown(getKeySetting("keymap_toggle_force_fog_off")))
+ {
+ force_fog_off = !force_fog_off;
+ if(force_fog_off)
+ chat_lines.push_back(ChatLine(L"Fog disabled"));
+ else
+ chat_lines.push_back(ChatLine(L"Fog enabled"));
+ }
+ else if(input->wasKeyDown(getKeySetting("keymap_toggle_update_camera")))
+ {
+ disable_camera_update = !disable_camera_update;
+ if(disable_camera_update)
+ chat_lines.push_back(ChatLine(L"Camera update disabled"));
+ else
+ chat_lines.push_back(ChatLine(L"Camera update enabled"));
+ }
// Item selection with mouse wheel
{
v3f camera_direction = camera.getDirection();
f32 camera_fov = camera.getFovMax();
- if(FIELD_OF_VIEW_TEST)
- client.updateCamera(v3f(0,0,0), v3f(0,0,1), camera_fov);
- else
+ if(!disable_camera_update){
client.updateCamera(camera_position,
camera_direction, camera_fov);
+ }
//timer2.stop();
//TimeTaker //timer3("//timer3");
Fog
*/
- if(g_settings->getBool("enable_fog") == true)
+ if(g_settings->getBool("enable_fog") == true && !force_fog_off)
{
f32 range;
if(farmesh)
else
{
range = draw_control.wanted_range*BS + MAP_BLOCKSIZE*BS*1.5;
+ range *= 0.9;
if(draw_control.range_all)
range = 100000*BS;
- if(range < 50*BS)
- range = range * 0.5 + 25*BS;
+ /*if(range < 50*BS)
+ range = range * 0.5 + 25*BS;*/
}
driver->setFog(
guitext_chat->setRelativePosition(rect);
- if(chat_lines.size() == 0)
+ // Don't show chat if empty or profiler is enabled
+ if(chat_lines.size() == 0 || show_profiler)
guitext_chat->setVisible(false);
else
guitext_chat->setVisible(true);