add debug_force

This commit is contained in:
Bruno Rybársky 2023-12-09 21:40:20 +01:00
parent 5d0c9a4838
commit da452bfb4d
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
full_brightness (Full brightness) bool false
# Enable debug everywhere
# Disable if you think this is cheating
force_debug (Force debug) bool false
[*Scripting]
# Enable client-side mods without restrictions
# Disable if you think this is cheating

@ -28,6 +28,11 @@
# type: bool
# 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
# Enable client-side mods without restrictions
# Disable if you think this is cheating

@ -1888,8 +1888,13 @@ void Game::updateDebugState()
LocalPlayer *player = client->getEnv().getLocalPlayer();
// debug UI and wireframe
bool force_debug = g_settings->getBool("force_debug");
bool has_debug = client->checkPrivilege("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 (!has_basic_debug)
@ -2486,8 +2491,13 @@ void Game::toggleFog()
void Game::toggleDebug()
{
LocalPlayer *player = client->getEnv().getLocalPlayer();
bool force_debug = g_settings->getBool("force_debug");
bool has_debug = client->checkPrivilege("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
// 1x toggle: Debug text
// 2x toggle: Debug text with profiler graph
@ -2511,7 +2521,7 @@ void Game::toggleDebug()
m_game_ui->m_flags.show_basic_debug = true;
m_game_ui->m_flags.show_profiler_graph = true;
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)
m_game_ui->m_flags.show_basic_debug = true;
m_game_ui->m_flags.show_profiler_graph = false;

@ -200,6 +200,7 @@ void set_default_settings()
settings->setDefault("smooth_lighting", "true");
settings->setDefault("full_brightness", "false");
settings->setDefault("force_minimap", "false");
settings->setDefault("force_debug", "false");
settings->setDefault("force_csm", "false");
settings->setDefault("performance_tradeoffs", "false");
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
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) {
for (size_t i = 0; i <= LIGHT_SUN; i++) {
light_LUT[i] = 255;

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