forked from Mirrorlandia_minetest/minetest
Merge remote-tracking branch 'kahrl/hidehud'
This commit is contained in:
commit
365f7a5bfe
@ -40,8 +40,6 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control):
|
|||||||
m_wieldlight(0),
|
m_wieldlight(0),
|
||||||
|
|
||||||
m_draw_control(draw_control),
|
m_draw_control(draw_control),
|
||||||
m_viewing_range_min(5.0),
|
|
||||||
m_viewing_range_max(5.0),
|
|
||||||
|
|
||||||
m_camera_position(0,0,0),
|
m_camera_position(0,0,0),
|
||||||
m_camera_direction(0,0,0),
|
m_camera_direction(0,0,0),
|
||||||
@ -50,7 +48,6 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control):
|
|||||||
m_fov_x(1.0),
|
m_fov_x(1.0),
|
||||||
m_fov_y(1.0),
|
m_fov_y(1.0),
|
||||||
|
|
||||||
m_wanted_frametime(0.0),
|
|
||||||
m_added_frametime(0),
|
m_added_frametime(0),
|
||||||
m_added_frames(0),
|
m_added_frames(0),
|
||||||
m_range_old(0),
|
m_range_old(0),
|
||||||
@ -79,8 +76,6 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control):
|
|||||||
m_wieldmgr = smgr->createNewSceneManager();
|
m_wieldmgr = smgr->createNewSceneManager();
|
||||||
m_wieldmgr->addCameraSceneNode();
|
m_wieldmgr->addCameraSceneNode();
|
||||||
m_wieldnode = m_wieldmgr->addMeshSceneNode(createCubeMesh(v3f(1,1,1)), NULL); // need a dummy mesh
|
m_wieldnode = m_wieldmgr->addMeshSceneNode(createCubeMesh(v3f(1,1,1)), NULL); // need a dummy mesh
|
||||||
|
|
||||||
updateSettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Camera::~Camera()
|
Camera::~Camera()
|
||||||
@ -259,14 +254,17 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize)
|
|||||||
// *100.0 helps in large map coordinates
|
// *100.0 helps in large map coordinates
|
||||||
m_cameranode->setTarget(m_camera_position + 100 * m_camera_direction);
|
m_cameranode->setTarget(m_camera_position + 100 * m_camera_direction);
|
||||||
|
|
||||||
// FOV and and aspect ratio
|
// Get FOV setting
|
||||||
|
f32 fov_degrees = g_settings->getFloat("fov");
|
||||||
|
fov_degrees = MYMAX(fov_degrees, 10.0);
|
||||||
|
fov_degrees = MYMIN(fov_degrees, 170.0);
|
||||||
|
|
||||||
|
// FOV and aspect ratio
|
||||||
m_aspect = (f32)screensize.X / (f32) screensize.Y;
|
m_aspect = (f32)screensize.X / (f32) screensize.Y;
|
||||||
|
m_fov_y = fov_degrees * PI / 180.0;
|
||||||
m_fov_x = 2 * atan(0.5 * m_aspect * tan(m_fov_y));
|
m_fov_x = 2 * atan(0.5 * m_aspect * tan(m_fov_y));
|
||||||
m_cameranode->setAspectRatio(m_aspect);
|
m_cameranode->setAspectRatio(m_aspect);
|
||||||
m_cameranode->setFOV(m_fov_y);
|
m_cameranode->setFOV(m_fov_y);
|
||||||
// Just so big a value that everything rendered is visible
|
|
||||||
// Some more allowance that m_viewing_range_max * BS because of active objects etc.
|
|
||||||
m_cameranode->setFarValue(m_viewing_range_max * BS * 10);
|
|
||||||
|
|
||||||
// Position the wielded item
|
// Position the wielded item
|
||||||
v3f wield_position = v3f(45, -35, 65);
|
v3f wield_position = v3f(45, -35, 65);
|
||||||
@ -343,7 +341,18 @@ void Camera::updateViewingRange(f32 frametime_in)
|
|||||||
<<m_draw_control.blocks_would_have_drawn
|
<<m_draw_control.blocks_would_have_drawn
|
||||||
<<std::endl;*/
|
<<std::endl;*/
|
||||||
|
|
||||||
m_draw_control.wanted_min_range = m_viewing_range_min;
|
// Get current viewing range and FPS settings
|
||||||
|
f32 viewing_range_min = g_settings->getS16("viewing_range_nodes_min");
|
||||||
|
viewing_range_min = MYMAX(5.0, viewing_range_min);
|
||||||
|
|
||||||
|
f32 viewing_range_max = g_settings->getS16("viewing_range_nodes_max");
|
||||||
|
viewing_range_max = MYMAX(viewing_range_min, viewing_range_max);
|
||||||
|
|
||||||
|
f32 wanted_fps = g_settings->getFloat("wanted_fps");
|
||||||
|
wanted_fps = MYMAX(wanted_fps, 1.0);
|
||||||
|
f32 wanted_frametime = 1.0 / wanted_fps;
|
||||||
|
|
||||||
|
m_draw_control.wanted_min_range = viewing_range_min;
|
||||||
m_draw_control.wanted_max_blocks = (2.0*m_draw_control.blocks_would_have_drawn)+1;
|
m_draw_control.wanted_max_blocks = (2.0*m_draw_control.blocks_would_have_drawn)+1;
|
||||||
if (m_draw_control.wanted_max_blocks < 10)
|
if (m_draw_control.wanted_max_blocks < 10)
|
||||||
m_draw_control.wanted_max_blocks = 10;
|
m_draw_control.wanted_max_blocks = 10;
|
||||||
@ -362,13 +371,13 @@ void Camera::updateViewingRange(f32 frametime_in)
|
|||||||
m_added_frametime = 0.0;
|
m_added_frametime = 0.0;
|
||||||
m_added_frames = 0;
|
m_added_frames = 0;
|
||||||
|
|
||||||
f32 wanted_frametime_change = m_wanted_frametime - frametime;
|
f32 wanted_frametime_change = wanted_frametime - frametime;
|
||||||
//dstream<<"wanted_frametime_change="<<wanted_frametime_change<<std::endl;
|
//dstream<<"wanted_frametime_change="<<wanted_frametime_change<<std::endl;
|
||||||
|
|
||||||
// If needed frametime change is small, just return
|
// If needed frametime change is small, just return
|
||||||
// This value was 0.4 for many months until 2011-10-18 by c55;
|
// This value was 0.4 for many months until 2011-10-18 by c55;
|
||||||
// Let's see how this works out.
|
// Let's see how this works out.
|
||||||
if (fabs(wanted_frametime_change) < m_wanted_frametime*0.33)
|
if (fabs(wanted_frametime_change) < wanted_frametime*0.33)
|
||||||
{
|
{
|
||||||
//dstream<<"ignoring small wanted_frametime_change"<<std::endl;
|
//dstream<<"ignoring small wanted_frametime_change"<<std::endl;
|
||||||
return;
|
return;
|
||||||
@ -421,8 +430,8 @@ void Camera::updateViewingRange(f32 frametime_in)
|
|||||||
new_range += wanted_range_change;
|
new_range += wanted_range_change;
|
||||||
|
|
||||||
//f32 new_range_unclamped = new_range;
|
//f32 new_range_unclamped = new_range;
|
||||||
new_range = MYMAX(new_range, m_viewing_range_min);
|
new_range = MYMAX(new_range, viewing_range_min);
|
||||||
new_range = MYMIN(new_range, m_viewing_range_max);
|
new_range = MYMIN(new_range, viewing_range_max);
|
||||||
/*dstream<<"new_range="<<new_range_unclamped
|
/*dstream<<"new_range="<<new_range_unclamped
|
||||||
<<", clamped to "<<new_range<<std::endl;*/
|
<<", clamped to "<<new_range<<std::endl;*/
|
||||||
|
|
||||||
@ -430,24 +439,11 @@ void Camera::updateViewingRange(f32 frametime_in)
|
|||||||
|
|
||||||
m_range_old = new_range;
|
m_range_old = new_range;
|
||||||
m_frametime_old = frametime;
|
m_frametime_old = frametime;
|
||||||
}
|
|
||||||
|
|
||||||
void Camera::updateSettings()
|
// Just so big a value that everything rendered is visible
|
||||||
{
|
// Some more allowance than viewing_range_max * BS because of active objects etc.
|
||||||
m_viewing_range_min = g_settings->getS16("viewing_range_nodes_min");
|
m_cameranode->setFarValue(viewing_range_max * BS * 10);
|
||||||
m_viewing_range_min = MYMAX(5.0, m_viewing_range_min);
|
|
||||||
|
|
||||||
m_viewing_range_max = g_settings->getS16("viewing_range_nodes_max");
|
|
||||||
m_viewing_range_max = MYMAX(m_viewing_range_min, m_viewing_range_max);
|
|
||||||
|
|
||||||
f32 fov_degrees = g_settings->getFloat("fov");
|
|
||||||
fov_degrees = MYMAX(fov_degrees, 10.0);
|
|
||||||
fov_degrees = MYMIN(fov_degrees, 170.0);
|
|
||||||
m_fov_y = fov_degrees * PI / 180.0;
|
|
||||||
|
|
||||||
f32 wanted_fps = g_settings->getFloat("wanted_fps");
|
|
||||||
wanted_fps = MYMAX(wanted_fps, 1.0);
|
|
||||||
m_wanted_frametime = 1.0 / wanted_fps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setDigging(s32 button)
|
void Camera::setDigging(s32 button)
|
||||||
|
@ -110,9 +110,6 @@ public:
|
|||||||
// Render distance feedback loop
|
// Render distance feedback loop
|
||||||
void updateViewingRange(f32 frametime_in);
|
void updateViewingRange(f32 frametime_in);
|
||||||
|
|
||||||
// Update settings from g_settings
|
|
||||||
void updateSettings();
|
|
||||||
|
|
||||||
// Start digging animation
|
// Start digging animation
|
||||||
// Pass 0 for left click, 1 for right click
|
// Pass 0 for left click, 1 for right click
|
||||||
void setDigging(s32 button);
|
void setDigging(s32 button);
|
||||||
@ -139,11 +136,6 @@ private:
|
|||||||
// draw control
|
// draw control
|
||||||
MapDrawControl& m_draw_control;
|
MapDrawControl& m_draw_control;
|
||||||
|
|
||||||
// viewing_range_min_nodes setting
|
|
||||||
f32 m_viewing_range_min;
|
|
||||||
// viewing_range_max_nodes setting
|
|
||||||
f32 m_viewing_range_max;
|
|
||||||
|
|
||||||
// Absolute camera position
|
// Absolute camera position
|
||||||
v3f m_camera_position;
|
v3f m_camera_position;
|
||||||
// Absolute camera direction
|
// Absolute camera direction
|
||||||
@ -155,7 +147,6 @@ private:
|
|||||||
f32 m_fov_y;
|
f32 m_fov_y;
|
||||||
|
|
||||||
// Stuff for viewing range calculations
|
// Stuff for viewing range calculations
|
||||||
f32 m_wanted_frametime;
|
|
||||||
f32 m_added_frametime;
|
f32 m_added_frametime;
|
||||||
s16 m_added_frames;
|
s16 m_added_frames;
|
||||||
f32 m_range_old;
|
f32 m_range_old;
|
||||||
|
@ -43,14 +43,25 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("keymap_rangeselect", "KEY_KEY_R");
|
settings->setDefault("keymap_rangeselect", "KEY_KEY_R");
|
||||||
settings->setDefault("keymap_freemove", "KEY_KEY_K");
|
settings->setDefault("keymap_freemove", "KEY_KEY_K");
|
||||||
settings->setDefault("keymap_fastmove", "KEY_KEY_J");
|
settings->setDefault("keymap_fastmove", "KEY_KEY_J");
|
||||||
settings->setDefault("keymap_frametime_graph", "KEY_F1");
|
|
||||||
settings->setDefault("keymap_screenshot", "KEY_F12");
|
settings->setDefault("keymap_screenshot", "KEY_F12");
|
||||||
settings->setDefault("keymap_toggle_profiler", "KEY_F2");
|
settings->setDefault("keymap_toggle_hud", "KEY_F1");
|
||||||
|
settings->setDefault("keymap_toggle_chat", "KEY_F2");
|
||||||
settings->setDefault("keymap_toggle_force_fog_off", "KEY_F3");
|
settings->setDefault("keymap_toggle_force_fog_off", "KEY_F3");
|
||||||
settings->setDefault("keymap_toggle_update_camera", "KEY_F4");
|
settings->setDefault("keymap_toggle_update_camera", "KEY_F4");
|
||||||
|
settings->setDefault("keymap_toggle_debug", "KEY_F5");
|
||||||
|
settings->setDefault("keymap_toggle_profiler", "KEY_F6");
|
||||||
|
settings->setDefault("keymap_increase_viewing_range_min", "KEY_PRIOR");
|
||||||
|
settings->setDefault("keymap_decrease_viewing_range_min", "KEY_NEXT");
|
||||||
// Some (temporary) keys for debugging
|
// Some (temporary) keys for debugging
|
||||||
settings->setDefault("keymap_print_debug_stacks", "KEY_KEY_P");
|
settings->setDefault("keymap_print_debug_stacks", "KEY_KEY_P");
|
||||||
|
|
||||||
|
// Show debug info by default?
|
||||||
|
#ifdef NDEBUG
|
||||||
|
settings->setDefault("show_debug", "false");
|
||||||
|
#else
|
||||||
|
settings->setDefault("show_debug", "true");
|
||||||
|
#endif
|
||||||
|
|
||||||
settings->setDefault("wanted_fps", "30");
|
settings->setDefault("wanted_fps", "30");
|
||||||
settings->setDefault("fps_max", "60");
|
settings->setDefault("fps_max", "60");
|
||||||
settings->setDefault("viewing_range_nodes_max", "300");
|
settings->setDefault("viewing_range_nodes_max", "300");
|
||||||
@ -66,7 +77,6 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("new_style_water", "false");
|
settings->setDefault("new_style_water", "false");
|
||||||
settings->setDefault("new_style_leaves", "false");
|
settings->setDefault("new_style_leaves", "false");
|
||||||
settings->setDefault("smooth_lighting", "true");
|
settings->setDefault("smooth_lighting", "true");
|
||||||
settings->setDefault("frametime_graph", "false");
|
|
||||||
settings->setDefault("enable_texture_atlas", "true");
|
settings->setDefault("enable_texture_atlas", "true");
|
||||||
settings->setDefault("texture_path", "");
|
settings->setDefault("texture_path", "");
|
||||||
settings->setDefault("video_driver", "opengl");
|
settings->setDefault("video_driver", "opengl");
|
||||||
|
378
src/game.cpp
378
src/game.cpp
@ -634,6 +634,36 @@ void draw_load_screen(const std::wstring &text,
|
|||||||
//return guitext;
|
//return guitext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Profiler display */
|
||||||
|
|
||||||
|
void update_profiler_gui(gui::IGUIStaticText *guitext_profiler,
|
||||||
|
gui::IGUIFont *font, u32 text_height,
|
||||||
|
u32 show_profiler, u32 show_profiler_max)
|
||||||
|
{
|
||||||
|
if(show_profiler == 0)
|
||||||
|
{
|
||||||
|
guitext_profiler->setVisible(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
std::ostringstream os(std::ios_base::binary);
|
||||||
|
g_profiler->printPage(os, show_profiler, show_profiler_max);
|
||||||
|
std::wstring text = narrow_to_wide(os.str());
|
||||||
|
guitext_profiler->setText(text.c_str());
|
||||||
|
guitext_profiler->setVisible(true);
|
||||||
|
|
||||||
|
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);
|
||||||
|
guitext_profiler->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void the_game(
|
void the_game(
|
||||||
bool &kill,
|
bool &kill,
|
||||||
bool random_input,
|
bool random_input,
|
||||||
@ -932,6 +962,16 @@ void the_game(
|
|||||||
core::rect<s32>(0,0,400,text_height+5) + v2s32(100,200),
|
core::rect<s32>(0,0,400,text_height+5) + v2s32(100,200),
|
||||||
false, false);
|
false, false);
|
||||||
|
|
||||||
|
// Status text (displays info when showing and hiding GUI stuff, etc.)
|
||||||
|
gui::IGUIStaticText *guitext_status = guienv->addStaticText(
|
||||||
|
L"<Status>",
|
||||||
|
core::rect<s32>(0,0,0,0),
|
||||||
|
false, false);
|
||||||
|
guitext_status->setVisible(false);
|
||||||
|
|
||||||
|
std::wstring statustext;
|
||||||
|
float statustext_time = 0;
|
||||||
|
|
||||||
// Chat text
|
// Chat text
|
||||||
gui::IGUIStaticText *guitext_chat = guienv->addStaticText(
|
gui::IGUIStaticText *guitext_chat = guienv->addStaticText(
|
||||||
L"",
|
L"",
|
||||||
@ -944,8 +984,7 @@ void the_game(
|
|||||||
// Profiler text (size is updated when text is updated)
|
// Profiler text (size is updated when text is updated)
|
||||||
gui::IGUIStaticText *guitext_profiler = guienv->addStaticText(
|
gui::IGUIStaticText *guitext_profiler = guienv->addStaticText(
|
||||||
L"<Profiler>",
|
L"<Profiler>",
|
||||||
core::rect<s32>(6, 4+(text_height+5)*2, 400,
|
core::rect<s32>(0,0,0,0),
|
||||||
(text_height+5)*2 + text_height*35),
|
|
||||||
false, false);
|
false, false);
|
||||||
guitext_profiler->setBackgroundColor(video::SColor(80,0,0,0));
|
guitext_profiler->setBackgroundColor(video::SColor(80,0,0,0));
|
||||||
guitext_profiler->setVisible(false);
|
guitext_profiler->setVisible(false);
|
||||||
@ -968,11 +1007,6 @@ void the_game(
|
|||||||
(new GUIPauseMenu(guienv, guiroot, -1, g_gamecallback,
|
(new GUIPauseMenu(guienv, guiroot, -1, g_gamecallback,
|
||||||
&g_menumgr))->drop();
|
&g_menumgr))->drop();
|
||||||
|
|
||||||
// Enable texts
|
|
||||||
/*guitext2->setVisible(true);
|
|
||||||
guitext_info->setVisible(true);
|
|
||||||
guitext_chat->setVisible(true);*/
|
|
||||||
|
|
||||||
//s32 guitext_chat_pad_bottom = 70;
|
//s32 guitext_chat_pad_bottom = 70;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1008,9 +1042,14 @@ void the_game(
|
|||||||
bool respawn_menu_active = false;
|
bool respawn_menu_active = false;
|
||||||
bool update_wielded_item_trigger = false;
|
bool update_wielded_item_trigger = false;
|
||||||
|
|
||||||
bool show_profiler = false;
|
bool show_hud = true;
|
||||||
|
bool show_chat = true;
|
||||||
bool force_fog_off = false;
|
bool force_fog_off = false;
|
||||||
bool disable_camera_update = false;
|
bool disable_camera_update = false;
|
||||||
|
bool show_debug = g_settings->getBool("show_debug");
|
||||||
|
bool show_debug_frametime = false;
|
||||||
|
u32 show_profiler = 0;
|
||||||
|
u32 show_profiler_max = 3; // Number of pages
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Main loop
|
Main loop
|
||||||
@ -1247,20 +1286,10 @@ void the_game(
|
|||||||
g_profiler->print(infostream);
|
g_profiler->print(infostream);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream os(std::ios_base::binary);
|
update_profiler_gui(guitext_profiler, font, text_height,
|
||||||
g_profiler->print(os);
|
show_profiler, show_profiler_max);
|
||||||
std::wstring text = narrow_to_wide(os.str());
|
|
||||||
guitext_profiler->setText(text.c_str());
|
|
||||||
|
|
||||||
g_profiler->clear();
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1349,12 +1378,14 @@ void the_game(
|
|||||||
if(g_settings->getBool("free_move"))
|
if(g_settings->getBool("free_move"))
|
||||||
{
|
{
|
||||||
g_settings->set("free_move","false");
|
g_settings->set("free_move","false");
|
||||||
chat_lines.push_back(ChatLine(L"free_move disabled"));
|
statustext = L"free_move disabled";
|
||||||
|
statustext_time = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_settings->set("free_move","true");
|
g_settings->set("free_move","true");
|
||||||
chat_lines.push_back(ChatLine(L"free_move enabled"));
|
statustext = L"free_move enabled";
|
||||||
|
statustext_time = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(input->wasKeyDown(getKeySetting("keymap_fastmove")))
|
else if(input->wasKeyDown(getKeySetting("keymap_fastmove")))
|
||||||
@ -1362,25 +1393,14 @@ void the_game(
|
|||||||
if(g_settings->getBool("fast_move"))
|
if(g_settings->getBool("fast_move"))
|
||||||
{
|
{
|
||||||
g_settings->set("fast_move","false");
|
g_settings->set("fast_move","false");
|
||||||
chat_lines.push_back(ChatLine(L"fast_move disabled"));
|
statustext = L"fast_move disabled";
|
||||||
|
statustext_time = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_settings->set("fast_move","true");
|
g_settings->set("fast_move","true");
|
||||||
chat_lines.push_back(ChatLine(L"fast_move enabled"));
|
statustext = L"fast_move enabled";
|
||||||
}
|
statustext_time = 0;
|
||||||
}
|
|
||||||
else if(input->wasKeyDown(getKeySetting("keymap_frametime_graph")))
|
|
||||||
{
|
|
||||||
if(g_settings->getBool("frametime_graph"))
|
|
||||||
{
|
|
||||||
g_settings->set("frametime_graph","false");
|
|
||||||
chat_lines.push_back(ChatLine(L"frametime_graph disabled"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_settings->set("frametime_graph","true");
|
|
||||||
chat_lines.push_back(ChatLine(L"frametime_graph enabled"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(input->wasKeyDown(getKeySetting("keymap_screenshot")))
|
else if(input->wasKeyDown(getKeySetting("keymap_screenshot")))
|
||||||
@ -1395,37 +1415,120 @@ void the_game(
|
|||||||
std::wstringstream sstr;
|
std::wstringstream sstr;
|
||||||
sstr<<"Saved screenshot to '"<<filename<<"'";
|
sstr<<"Saved screenshot to '"<<filename<<"'";
|
||||||
infostream<<"Saved screenshot to '"<<filename<<"'"<<std::endl;
|
infostream<<"Saved screenshot to '"<<filename<<"'"<<std::endl;
|
||||||
chat_lines.push_back(ChatLine(sstr.str()));
|
statustext = sstr.str();
|
||||||
|
statustext_time = 0;
|
||||||
} else{
|
} else{
|
||||||
infostream<<"Failed to save screenshot '"<<filename<<"'"<<std::endl;
|
infostream<<"Failed to save screenshot '"<<filename<<"'"<<std::endl;
|
||||||
}
|
}
|
||||||
image->drop();
|
image->drop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(input->wasKeyDown(getKeySetting("keymap_toggle_profiler")))
|
else if(input->wasKeyDown(getKeySetting("keymap_toggle_hud")))
|
||||||
{
|
{
|
||||||
show_profiler = !show_profiler;
|
show_hud = !show_hud;
|
||||||
guitext_profiler->setVisible(show_profiler);
|
if(show_hud)
|
||||||
if(show_profiler)
|
statustext = L"HUD shown";
|
||||||
chat_lines.push_back(ChatLine(L"Profiler disabled"));
|
|
||||||
else
|
else
|
||||||
chat_lines.push_back(ChatLine(L"Profiler enabled"));
|
statustext = L"HUD hidden";
|
||||||
|
statustext_time = 0;
|
||||||
|
}
|
||||||
|
else if(input->wasKeyDown(getKeySetting("keymap_toggle_chat")))
|
||||||
|
{
|
||||||
|
show_chat = !show_chat;
|
||||||
|
if(show_chat)
|
||||||
|
statustext = L"Chat shown";
|
||||||
|
else
|
||||||
|
statustext = L"Chat hidden";
|
||||||
|
statustext_time = 0;
|
||||||
}
|
}
|
||||||
else if(input->wasKeyDown(getKeySetting("keymap_toggle_force_fog_off")))
|
else if(input->wasKeyDown(getKeySetting("keymap_toggle_force_fog_off")))
|
||||||
{
|
{
|
||||||
force_fog_off = !force_fog_off;
|
force_fog_off = !force_fog_off;
|
||||||
if(force_fog_off)
|
if(force_fog_off)
|
||||||
chat_lines.push_back(ChatLine(L"Fog disabled"));
|
statustext = L"Fog disabled";
|
||||||
else
|
else
|
||||||
chat_lines.push_back(ChatLine(L"Fog enabled"));
|
statustext = L"Fog enabled";
|
||||||
|
statustext_time = 0;
|
||||||
}
|
}
|
||||||
else if(input->wasKeyDown(getKeySetting("keymap_toggle_update_camera")))
|
else if(input->wasKeyDown(getKeySetting("keymap_toggle_update_camera")))
|
||||||
{
|
{
|
||||||
disable_camera_update = !disable_camera_update;
|
disable_camera_update = !disable_camera_update;
|
||||||
if(disable_camera_update)
|
if(disable_camera_update)
|
||||||
chat_lines.push_back(ChatLine(L"Camera update disabled"));
|
statustext = L"Camera update disabled";
|
||||||
else
|
else
|
||||||
chat_lines.push_back(ChatLine(L"Camera update enabled"));
|
statustext = L"Camera update enabled";
|
||||||
|
statustext_time = 0;
|
||||||
|
}
|
||||||
|
else if(input->wasKeyDown(getKeySetting("keymap_toggle_debug")))
|
||||||
|
{
|
||||||
|
// Initial / 3x toggle: Chat only
|
||||||
|
// 1x toggle: Debug text with chat
|
||||||
|
// 2x toggle: Debug text with frametime
|
||||||
|
if(!show_debug)
|
||||||
|
{
|
||||||
|
show_debug = true;
|
||||||
|
show_debug_frametime = false;
|
||||||
|
statustext = L"Debug info shown";
|
||||||
|
statustext_time = 0;
|
||||||
|
}
|
||||||
|
else if(show_debug_frametime)
|
||||||
|
{
|
||||||
|
show_debug = false;
|
||||||
|
show_debug_frametime = false;
|
||||||
|
statustext = L"Debug info and frametime graph hidden";
|
||||||
|
statustext_time = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
show_debug_frametime = true;
|
||||||
|
statustext = L"Frametime graph shown";
|
||||||
|
statustext_time = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(input->wasKeyDown(getKeySetting("keymap_toggle_profiler")))
|
||||||
|
{
|
||||||
|
show_profiler = (show_profiler + 1) % (show_profiler_max + 1);
|
||||||
|
|
||||||
|
// FIXME: This updates the profiler with incomplete values
|
||||||
|
update_profiler_gui(guitext_profiler, font, text_height,
|
||||||
|
show_profiler, show_profiler_max);
|
||||||
|
|
||||||
|
if(show_profiler != 0)
|
||||||
|
{
|
||||||
|
std::wstringstream sstr;
|
||||||
|
sstr<<"Profiler shown (page "<<show_profiler
|
||||||
|
<<" of "<<show_profiler_max<<")";
|
||||||
|
statustext = sstr.str();
|
||||||
|
statustext_time = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
statustext = L"Profiler hidden";
|
||||||
|
statustext_time = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(input->wasKeyDown(getKeySetting("keymap_increase_viewing_range_min")))
|
||||||
|
{
|
||||||
|
s16 range = g_settings->getS16("viewing_range_nodes_min");
|
||||||
|
s16 range_new = range + 10;
|
||||||
|
g_settings->set("viewing_range_nodes_min", itos(range_new));
|
||||||
|
statustext = narrow_to_wide(
|
||||||
|
"Minimum viewing range changed to "
|
||||||
|
+ itos(range_new));
|
||||||
|
statustext_time = 0;
|
||||||
|
}
|
||||||
|
else if(input->wasKeyDown(getKeySetting("keymap_decrease_viewing_range_min")))
|
||||||
|
{
|
||||||
|
s16 range = g_settings->getS16("viewing_range_nodes_min");
|
||||||
|
s16 range_new = range - 10;
|
||||||
|
if(range_new < 0)
|
||||||
|
range_new = range;
|
||||||
|
g_settings->set("viewing_range_nodes_min",
|
||||||
|
itos(range_new));
|
||||||
|
statustext = narrow_to_wide(
|
||||||
|
"Minimum viewing range changed to "
|
||||||
|
+ itos(range_new));
|
||||||
|
statustext_time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item selection with mouse wheel
|
// Item selection with mouse wheel
|
||||||
@ -1470,15 +1573,18 @@ void the_game(
|
|||||||
// Viewing range selection
|
// Viewing range selection
|
||||||
if(input->wasKeyDown(getKeySetting("keymap_rangeselect")))
|
if(input->wasKeyDown(getKeySetting("keymap_rangeselect")))
|
||||||
{
|
{
|
||||||
|
draw_control.range_all = !draw_control.range_all;
|
||||||
if(draw_control.range_all)
|
if(draw_control.range_all)
|
||||||
{
|
{
|
||||||
draw_control.range_all = false;
|
infostream<<"Enabled full viewing range"<<std::endl;
|
||||||
infostream<<"Disabled full viewing range"<<std::endl;
|
statustext = L"Enabled full viewing range";
|
||||||
|
statustext_time = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
draw_control.range_all = true;
|
infostream<<"Disabled full viewing range"<<std::endl;
|
||||||
infostream<<"Enabled full viewing range"<<std::endl;
|
statustext = L"Disabled full viewing range";
|
||||||
|
statustext_time = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2105,55 +2211,110 @@ void the_game(
|
|||||||
|
|
||||||
//TimeTaker guiupdatetimer("Gui updating");
|
//TimeTaker guiupdatetimer("Gui updating");
|
||||||
|
|
||||||
|
const char program_name_and_version[] =
|
||||||
|
"Minetest-c55 " VERSION_STRING;
|
||||||
|
|
||||||
|
if(show_debug)
|
||||||
{
|
{
|
||||||
static float drawtime_avg = 0;
|
static float drawtime_avg = 0;
|
||||||
drawtime_avg = drawtime_avg * 0.95 + (float)drawtime*0.05;
|
drawtime_avg = drawtime_avg * 0.95 + (float)drawtime*0.05;
|
||||||
static float beginscenetime_avg = 0;
|
/*static float beginscenetime_avg = 0;
|
||||||
beginscenetime_avg = beginscenetime_avg * 0.95 + (float)beginscenetime*0.05;
|
beginscenetime_avg = beginscenetime_avg * 0.95 + (float)beginscenetime*0.05;
|
||||||
static float scenetime_avg = 0;
|
static float scenetime_avg = 0;
|
||||||
scenetime_avg = scenetime_avg * 0.95 + (float)scenetime*0.05;
|
scenetime_avg = scenetime_avg * 0.95 + (float)scenetime*0.05;
|
||||||
static float endscenetime_avg = 0;
|
static float endscenetime_avg = 0;
|
||||||
endscenetime_avg = endscenetime_avg * 0.95 + (float)endscenetime*0.05;
|
endscenetime_avg = endscenetime_avg * 0.95 + (float)endscenetime*0.05;*/
|
||||||
|
|
||||||
char temptext[300];
|
char temptext[300];
|
||||||
snprintf(temptext, 300, "Minetest-c55 %s ("
|
snprintf(temptext, 300, "%s ("
|
||||||
"R: range_all=%i"
|
"R: range_all=%i"
|
||||||
")"
|
")"
|
||||||
" drawtime=%.0f, beginscenetime=%.0f"
|
" drawtime=%.0f, dtime_jitter = % .1f %%"
|
||||||
", scenetime=%.0f, endscenetime=%.0f",
|
", v_range = %.1f, RTT = %.3f",
|
||||||
VERSION_STRING,
|
program_name_and_version,
|
||||||
draw_control.range_all,
|
draw_control.range_all,
|
||||||
drawtime_avg,
|
drawtime_avg,
|
||||||
beginscenetime_avg,
|
|
||||||
scenetime_avg,
|
|
||||||
endscenetime_avg
|
|
||||||
);
|
|
||||||
|
|
||||||
guitext->setText(narrow_to_wide(temptext).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
char temptext[300];
|
|
||||||
snprintf(temptext, 300,
|
|
||||||
"(% .1f, % .1f, % .1f)"
|
|
||||||
" (% .3f < btime_jitter < % .3f"
|
|
||||||
", dtime_jitter = % .1f %%"
|
|
||||||
", v_range = %.1f, RTT = %.3f)",
|
|
||||||
player_position.X/BS,
|
|
||||||
player_position.Y/BS,
|
|
||||||
player_position.Z/BS,
|
|
||||||
busytime_jitter1_min_sample,
|
|
||||||
busytime_jitter1_max_sample,
|
|
||||||
dtime_jitter1_max_fraction * 100.0,
|
dtime_jitter1_max_fraction * 100.0,
|
||||||
draw_control.wanted_range,
|
draw_control.wanted_range,
|
||||||
client.getRTT()
|
client.getRTT()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
guitext->setText(narrow_to_wide(temptext).c_str());
|
||||||
|
guitext->setVisible(true);
|
||||||
|
}
|
||||||
|
else if(show_hud || show_chat)
|
||||||
|
{
|
||||||
|
guitext->setText(narrow_to_wide(program_name_and_version).c_str());
|
||||||
|
guitext->setVisible(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
guitext->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(show_debug)
|
||||||
|
{
|
||||||
|
char temptext[300];
|
||||||
|
snprintf(temptext, 300,
|
||||||
|
"(% .1f, % .1f, % .1f)"
|
||||||
|
" (yaw = %.1f)",
|
||||||
|
player_position.X/BS,
|
||||||
|
player_position.Y/BS,
|
||||||
|
player_position.Z/BS,
|
||||||
|
wrapDegrees_0_360(camera_yaw));
|
||||||
|
|
||||||
guitext2->setText(narrow_to_wide(temptext).c_str());
|
guitext2->setText(narrow_to_wide(temptext).c_str());
|
||||||
|
guitext2->setVisible(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
guitext2->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
guitext_info->setText(infotext.c_str());
|
guitext_info->setText(infotext.c_str());
|
||||||
|
guitext_info->setVisible(show_hud);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
float statustext_time_max = 3.0;
|
||||||
|
if(!statustext.empty())
|
||||||
|
{
|
||||||
|
statustext_time += dtime;
|
||||||
|
if(statustext_time >= statustext_time_max)
|
||||||
|
{
|
||||||
|
statustext = L"";
|
||||||
|
statustext_time = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
guitext_status->setText(statustext.c_str());
|
||||||
|
guitext_status->setVisible(!statustext.empty());
|
||||||
|
|
||||||
|
if(!statustext.empty())
|
||||||
|
{
|
||||||
|
s32 status_y = screensize.Y - 130;
|
||||||
|
core::rect<s32> rect(
|
||||||
|
10,
|
||||||
|
status_y - guitext_status->getTextHeight(),
|
||||||
|
screensize.X - 10,
|
||||||
|
status_y
|
||||||
|
);
|
||||||
|
guitext_status->setRelativePosition(rect);
|
||||||
|
|
||||||
|
// Fade out
|
||||||
|
video::SColor initial_color(255,0,0,0);
|
||||||
|
if(guienv->getSkin())
|
||||||
|
initial_color = guienv->getSkin()->getColor(gui::EGDC_BUTTON_TEXT);
|
||||||
|
video::SColor final_color = initial_color;
|
||||||
|
final_color.setAlpha(0);
|
||||||
|
video::SColor fade_color =
|
||||||
|
initial_color.getInterpolated_quadratic(
|
||||||
|
initial_color,
|
||||||
|
final_color,
|
||||||
|
statustext_time / (float) statustext_time_max);
|
||||||
|
guitext_status->setOverrideColor(fade_color);
|
||||||
|
guitext_status->enableOverrideColor(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2224,20 +2385,22 @@ void the_game(
|
|||||||
screensize.X - 10,
|
screensize.X - 10,
|
||||||
screensize.Y - guitext_chat_pad_bottom
|
screensize.Y - guitext_chat_pad_bottom
|
||||||
);*/
|
);*/
|
||||||
|
|
||||||
|
s32 chat_y = 5+(text_height+5);
|
||||||
|
if(show_debug)
|
||||||
|
chat_y += (text_height+5);
|
||||||
core::rect<s32> rect(
|
core::rect<s32> rect(
|
||||||
10,
|
10,
|
||||||
50,
|
chat_y,
|
||||||
screensize.X - 10,
|
screensize.X - 10,
|
||||||
50 + guitext_chat->getTextHeight()
|
chat_y + guitext_chat->getTextHeight()
|
||||||
);
|
);
|
||||||
|
|
||||||
guitext_chat->setRelativePosition(rect);
|
guitext_chat->setRelativePosition(rect);
|
||||||
|
|
||||||
// Don't show chat if empty or profiler is enabled
|
// Don't show chat if empty or profiler or debug is enabled
|
||||||
if(chat_lines.size() == 0 || show_profiler)
|
guitext_chat->setVisible(chat_lines.size() != 0
|
||||||
guitext_chat->setVisible(false);
|
&& show_chat && show_profiler == 0);
|
||||||
else
|
|
||||||
guitext_chat->setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2275,7 +2438,7 @@ void the_game(
|
|||||||
|
|
||||||
{
|
{
|
||||||
TimeTaker timer("beginScene");
|
TimeTaker timer("beginScene");
|
||||||
driver->beginScene(true, true, bgcolor);
|
driver->beginScene(false, true, bgcolor);
|
||||||
//driver->beginScene(false, true, bgcolor);
|
//driver->beginScene(false, true, bgcolor);
|
||||||
beginscenetime = timer.stop(true);
|
beginscenetime = timer.stop(true);
|
||||||
}
|
}
|
||||||
@ -2305,20 +2468,24 @@ void the_game(
|
|||||||
|
|
||||||
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||||
|
|
||||||
for(core::list< core::aabbox3d<f32> >::Iterator i=hilightboxes.begin();
|
if(show_hud)
|
||||||
i != hilightboxes.end(); i++)
|
|
||||||
{
|
{
|
||||||
/*infostream<<"hilightbox min="
|
for(core::list<aabb3f>::Iterator i=hilightboxes.begin();
|
||||||
<<"("<<i->MinEdge.X<<","<<i->MinEdge.Y<<","<<i->MinEdge.Z<<")"
|
i != hilightboxes.end(); i++)
|
||||||
<<" max="
|
{
|
||||||
<<"("<<i->MaxEdge.X<<","<<i->MaxEdge.Y<<","<<i->MaxEdge.Z<<")"
|
/*infostream<<"hilightbox min="
|
||||||
<<std::endl;*/
|
<<"("<<i->MinEdge.X<<","<<i->MinEdge.Y<<","<<i->MinEdge.Z<<")"
|
||||||
driver->draw3DBox(*i, video::SColor(255,0,0,0));
|
<<" max="
|
||||||
|
<<"("<<i->MaxEdge.X<<","<<i->MaxEdge.Y<<","<<i->MaxEdge.Z<<")"
|
||||||
|
<<std::endl;*/
|
||||||
|
driver->draw3DBox(*i, video::SColor(255,0,0,0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Wielded tool
|
Wielded tool
|
||||||
*/
|
*/
|
||||||
|
if(show_hud)
|
||||||
{
|
{
|
||||||
// Warning: This clears the Z buffer.
|
// Warning: This clears the Z buffer.
|
||||||
camera.drawWieldedTool();
|
camera.drawWieldedTool();
|
||||||
@ -2334,16 +2501,17 @@ void the_game(
|
|||||||
/*
|
/*
|
||||||
Frametime log
|
Frametime log
|
||||||
*/
|
*/
|
||||||
if(g_settings->getBool("frametime_graph") == true)
|
if(show_debug_frametime)
|
||||||
{
|
{
|
||||||
s32 x = 10;
|
s32 x = 10;
|
||||||
|
s32 y = screensize.Y - 10;
|
||||||
for(core::list<float>::Iterator
|
for(core::list<float>::Iterator
|
||||||
i = frametime_log.begin();
|
i = frametime_log.begin();
|
||||||
i != frametime_log.end();
|
i != frametime_log.end();
|
||||||
i++)
|
i++)
|
||||||
{
|
{
|
||||||
driver->draw2DLine(v2s32(x,50),
|
driver->draw2DLine(v2s32(x,y),
|
||||||
v2s32(x,50+(*i)*1000),
|
v2s32(x,y-(*i)*1000),
|
||||||
video::SColor(255,255,255,255));
|
video::SColor(255,255,255,255));
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
@ -2352,12 +2520,15 @@ void the_game(
|
|||||||
/*
|
/*
|
||||||
Draw crosshair
|
Draw crosshair
|
||||||
*/
|
*/
|
||||||
driver->draw2DLine(displaycenter - core::vector2d<s32>(10,0),
|
if(show_hud)
|
||||||
displaycenter + core::vector2d<s32>(10,0),
|
{
|
||||||
video::SColor(255,255,255,255));
|
driver->draw2DLine(displaycenter - core::vector2d<s32>(10,0),
|
||||||
driver->draw2DLine(displaycenter - core::vector2d<s32>(0,10),
|
displaycenter + core::vector2d<s32>(10,0),
|
||||||
displaycenter + core::vector2d<s32>(0,10),
|
video::SColor(255,255,255,255));
|
||||||
video::SColor(255,255,255,255));
|
driver->draw2DLine(displaycenter - core::vector2d<s32>(0,10),
|
||||||
|
displaycenter + core::vector2d<s32>(0,10),
|
||||||
|
video::SColor(255,255,255,255));
|
||||||
|
}
|
||||||
|
|
||||||
} // timer
|
} // timer
|
||||||
|
|
||||||
@ -2373,6 +2544,7 @@ void the_game(
|
|||||||
/*
|
/*
|
||||||
Draw hotbar
|
Draw hotbar
|
||||||
*/
|
*/
|
||||||
|
if(show_hud)
|
||||||
{
|
{
|
||||||
draw_hotbar(driver, font, gamedef,
|
draw_hotbar(driver, font, gamedef,
|
||||||
v2s32(displaycenter.X, screensize.Y),
|
v2s32(displaycenter.X, screensize.Y),
|
||||||
|
@ -99,12 +99,31 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void print(std::ostream &o)
|
void print(std::ostream &o)
|
||||||
|
{
|
||||||
|
printPage(o, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void printPage(std::ostream &o, u32 page, u32 pagecount)
|
||||||
{
|
{
|
||||||
JMutexAutoLock lock(m_mutex);
|
JMutexAutoLock lock(m_mutex);
|
||||||
|
|
||||||
|
u32 minindex, maxindex;
|
||||||
|
paging(m_data.size(), page, pagecount, minindex, maxindex);
|
||||||
|
|
||||||
for(core::map<std::string, float>::Iterator
|
for(core::map<std::string, float>::Iterator
|
||||||
i = m_data.getIterator();
|
i = m_data.getIterator();
|
||||||
i.atEnd() == false; i++)
|
i.atEnd() == false; i++)
|
||||||
{
|
{
|
||||||
|
if(maxindex == 0)
|
||||||
|
break;
|
||||||
|
maxindex--;
|
||||||
|
|
||||||
|
if(minindex != 0)
|
||||||
|
{
|
||||||
|
minindex--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
std::string name = i.getNode()->getKey();
|
std::string name = i.getNode()->getKey();
|
||||||
int avgcount = 1;
|
int avgcount = 1;
|
||||||
core::map<std::string, int>::Node *n = m_avgcounts.find(name);
|
core::map<std::string, int>::Node *n = m_avgcounts.find(name);
|
||||||
|
@ -1757,6 +1757,50 @@ protected:
|
|||||||
float m_accumulator;
|
float m_accumulator;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Splits a list into "pages". For example, the list [1,2,3,4,5] split
|
||||||
|
into two pages would be [1,2,3],[4,5]. This function computes the
|
||||||
|
minimum and maximum indices of a single page.
|
||||||
|
|
||||||
|
length: Length of the list that should be split
|
||||||
|
page: Page number, 1 <= page <= pagecount
|
||||||
|
pagecount: The number of pages, >= 1
|
||||||
|
minindex: Receives the minimum index (inclusive).
|
||||||
|
maxindex: Receives the maximum index (exclusive).
|
||||||
|
|
||||||
|
Ensures 0 <= minindex <= maxindex <= length.
|
||||||
|
*/
|
||||||
|
inline void paging(u32 length, u32 page, u32 pagecount, u32 &minindex, u32 &maxindex)
|
||||||
|
{
|
||||||
|
if(length < 1 || pagecount < 1 || page < 1 || page > pagecount)
|
||||||
|
{
|
||||||
|
// Special cases or invalid parameters
|
||||||
|
minindex = maxindex = 0;
|
||||||
|
}
|
||||||
|
else if(pagecount <= length)
|
||||||
|
{
|
||||||
|
// Less pages than entries in the list:
|
||||||
|
// Each page contains at least one entry
|
||||||
|
minindex = (length * (page-1) + (pagecount-1)) / pagecount;
|
||||||
|
maxindex = (length * page + (pagecount-1)) / pagecount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// More pages than entries in the list:
|
||||||
|
// Make sure the empty pages are at the end
|
||||||
|
if(page < length)
|
||||||
|
{
|
||||||
|
minindex = page-1;
|
||||||
|
maxindex = page;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minindex = 0;
|
||||||
|
maxindex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string translatePassword(std::string playername, std::wstring password);
|
std::string translatePassword(std::string playername, std::wstring password);
|
||||||
|
|
||||||
enum PointedThingType
|
enum PointedThingType
|
||||||
|
Loading…
Reference in New Issue
Block a user