mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
Require 'basic_debug' priv to view gameplay-relevant debug info, require 'debug' priv to view wireframe (#9315)
Fixes #7245.
This commit is contained in:
parent
51bf4a6e26
commit
63fc728a84
8 changed files with 85 additions and 20 deletions
|
@ -99,7 +99,8 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
|
|||
{
|
||||
v2u32 screensize = RenderingEngine::getWindowSize();
|
||||
|
||||
if (m_flags.show_debug) {
|
||||
// Minimal debug text must only contain info that can't give a gameplay advantage
|
||||
if (m_flags.show_minimal_debug) {
|
||||
static float drawtime_avg = 0;
|
||||
drawtime_avg = drawtime_avg * 0.95 + stats.drawtime * 0.05;
|
||||
u16 fps = 1.0 / stats.dtime_jitter.avg;
|
||||
|
@ -125,9 +126,10 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
|
|||
}
|
||||
|
||||
// Finally set the guitext visible depending on the flag
|
||||
m_guitext->setVisible(m_flags.show_debug);
|
||||
m_guitext->setVisible(m_flags.show_minimal_debug);
|
||||
|
||||
if (m_flags.show_debug) {
|
||||
// Basic debug text also shows info that might give a gameplay advantage
|
||||
if (m_flags.show_basic_debug) {
|
||||
LocalPlayer *player = client->getEnv().getLocalPlayer();
|
||||
v3f player_position = player->getPosition();
|
||||
|
||||
|
@ -160,7 +162,7 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
|
|||
));
|
||||
}
|
||||
|
||||
m_guitext2->setVisible(m_flags.show_debug);
|
||||
m_guitext2->setVisible(m_flags.show_basic_debug);
|
||||
|
||||
setStaticText(m_guitext_info, m_infotext.c_str());
|
||||
m_guitext_info->setVisible(m_flags.show_hud && g_menumgr.menuCount() == 0);
|
||||
|
@ -204,7 +206,8 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
|
|||
void GameUI::initFlags()
|
||||
{
|
||||
m_flags = GameUI::Flags();
|
||||
m_flags.show_debug = g_settings->getBool("show_debug");
|
||||
m_flags.show_minimal_debug = g_settings->getBool("show_debug");
|
||||
m_flags.show_basic_debug = false;
|
||||
}
|
||||
|
||||
void GameUI::showMinimap(bool show)
|
||||
|
@ -225,8 +228,10 @@ void GameUI::setChatText(const EnrichedString &chat_text, u32 recent_chat_count)
|
|||
// Update gui element size and position
|
||||
s32 chat_y = 5;
|
||||
|
||||
if (m_flags.show_debug)
|
||||
chat_y += 2 * g_fontengine->getLineHeight();
|
||||
if (m_flags.show_minimal_debug)
|
||||
chat_y += g_fontengine->getLineHeight();
|
||||
if (m_flags.show_basic_debug)
|
||||
chat_y += g_fontengine->getLineHeight();
|
||||
|
||||
const v2u32 &window_size = RenderingEngine::getWindowSize();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue