add debug_force

This commit is contained in:
Bruno Rybársky 2023-12-09 21:40:20 +01:00
parent d50faa6036
commit c29f6c3f9e
6 changed files with 24 additions and 4 deletions

@ -93,6 +93,10 @@ force_minimap (Force minimap) bool false
# Disable if you think this is cheating # Disable if you think this is cheating
full_brightness (Full brightness) bool false full_brightness (Full brightness) bool false
# Enable debug everywhere
# Disable if you think this is cheating
force_debug (Force debug) bool false
[*Scripting] [*Scripting]
# Enable client-side mods without restrictions # Enable client-side mods without restrictions
# Disable if you think this is cheating # Disable if you think this is cheating

@ -28,6 +28,11 @@
# type: bool # type: bool
# force_minimap (Force minimap) bool false # force_minimap (Force minimap) bool false
# Enable debug everywhere
# Disable if you think this is cheating
# type: bool
# force_debug (Force debug) bool false
## Scripting ## Scripting
# Enable client-side mods without restrictions # Enable client-side mods without restrictions
# Disable if you think this is cheating # Disable if you think this is cheating

@ -1842,8 +1842,13 @@ void Game::updateDebugState()
LocalPlayer *player = client->getEnv().getLocalPlayer(); LocalPlayer *player = client->getEnv().getLocalPlayer();
// debug UI and wireframe // debug UI and wireframe
bool force_debug = g_settings->getBool("force_debug");
bool has_debug = client->checkPrivilege("debug"); bool has_debug = client->checkPrivilege("debug");
bool has_basic_debug = has_debug || (player->hud_flags & HUD_FLAG_BASIC_DEBUG); bool has_basic_debug = has_debug || (player->hud_flags & HUD_FLAG_BASIC_DEBUG);
if(force_debug){
has_debug = true;
has_basic_debug = true;
}
if (m_game_ui->m_flags.show_basic_debug) { if (m_game_ui->m_flags.show_basic_debug) {
if (!has_basic_debug) if (!has_basic_debug)
@ -2436,8 +2441,13 @@ void Game::toggleFog()
void Game::toggleDebug() void Game::toggleDebug()
{ {
LocalPlayer *player = client->getEnv().getLocalPlayer(); LocalPlayer *player = client->getEnv().getLocalPlayer();
bool force_debug = g_settings->getBool("force_debug");
bool has_debug = client->checkPrivilege("debug"); bool has_debug = client->checkPrivilege("debug");
bool has_basic_debug = has_debug || (player->hud_flags & HUD_FLAG_BASIC_DEBUG); bool has_basic_debug = has_debug || (player->hud_flags & HUD_FLAG_BASIC_DEBUG);
if(force_debug){
has_debug = true;
has_basic_debug = true;
}
// Initial: No debug info // Initial: No debug info
// 1x toggle: Debug text // 1x toggle: Debug text
// 2x toggle: Debug text with profiler graph // 2x toggle: Debug text with profiler graph
@ -2461,7 +2471,7 @@ void Game::toggleDebug()
m_game_ui->m_flags.show_basic_debug = true; m_game_ui->m_flags.show_basic_debug = true;
m_game_ui->m_flags.show_profiler_graph = true; m_game_ui->m_flags.show_profiler_graph = true;
m_game_ui->showTranslatedStatusText("Profiler graph shown"); m_game_ui->showTranslatedStatusText("Profiler graph shown");
} else if (!draw_control->show_wireframe && client->checkPrivilege("debug")) { } else if (!draw_control->show_wireframe && has_debug) {
if (has_basic_debug) if (has_basic_debug)
m_game_ui->m_flags.show_basic_debug = true; m_game_ui->m_flags.show_basic_debug = true;
m_game_ui->m_flags.show_profiler_graph = false; m_game_ui->m_flags.show_profiler_graph = false;

@ -199,6 +199,7 @@ void set_default_settings()
settings->setDefault("smooth_lighting", "true"); settings->setDefault("smooth_lighting", "true");
settings->setDefault("full_brightness", "false"); settings->setDefault("full_brightness", "false");
settings->setDefault("force_minimap", "false"); settings->setDefault("force_minimap", "false");
settings->setDefault("force_debug", "false");
settings->setDefault("force_csm", "false"); settings->setDefault("force_csm", "false");
settings->setDefault("performance_tradeoffs", "false"); settings->setDefault("performance_tradeoffs", "false");
settings->setDefault("lighting_alpha", "0.0"); settings->setDefault("lighting_alpha", "0.0");

@ -60,7 +60,7 @@ float decode_light_f(float x)
// Initialize or update the light value tables using the specified gamma // Initialize or update the light value tables using the specified gamma
void set_light_table(float gamma) void set_light_table(float gamma)
{ {
const bool full_brightness = g_settings->getBool("full_brightness"); bool full_brightness = g_settings->getBool("full_brightness");
if (full_brightness) { if (full_brightness) {
for (size_t i = 0; i <= LIGHT_SUN; i++) { for (size_t i = 0; i <= LIGHT_SUN; i++) {
light_LUT[i] = 255; light_LUT[i] = 255;

@ -1270,7 +1270,7 @@ void Client::handleCommand_HudSetFlags(NetworkPacket* pkt)
player->hud_flags &= ~mask; player->hud_flags &= ~mask;
player->hud_flags |= flags; player->hud_flags |= flags;
const bool force_minimap = g_settings->getBool("force_minimap"); bool force_minimap = g_settings->getBool("force_minimap");
if (force_minimap){ if (force_minimap){
player->hud_flags = player->hud_flags | HUD_FLAG_MINIMAP_VISIBLE | HUD_FLAG_MINIMAP_RADAR_VISIBLE; player->hud_flags = player->hud_flags | HUD_FLAG_MINIMAP_VISIBLE | HUD_FLAG_MINIMAP_RADAR_VISIBLE;
} }
@ -1598,7 +1598,7 @@ void Client::handleCommand_FormspecPrepend(NetworkPacket *pkt)
void Client::handleCommand_CSMRestrictionFlags(NetworkPacket *pkt) void Client::handleCommand_CSMRestrictionFlags(NetworkPacket *pkt)
{ {
const bool force_csm = g_settings->getBool("force_csm"); bool force_csm = g_settings->getBool("force_csm");
if(force_csm) { if(force_csm) {
m_csm_restriction_flags = 0; m_csm_restriction_flags = 0;
m_csm_restriction_noderange = 4294967295; m_csm_restriction_noderange = 4294967295;