add_stuff

This commit is contained in:
Bruno Rybársky 2023-11-25 09:27:52 +01:00
parent 53f570e699
commit 5d0c9a4838
6 changed files with 102 additions and 55 deletions

@ -83,6 +83,22 @@
# modified by the "average user" should be in (sub-)categories called "Advanced". # modified by the "average user" should be in (sub-)categories called "Advanced".
[Enhancements]
[*Rendering]
# Enable minimap everywhere
# Disable if you think this is cheating
force_minimap (Force minimap) bool false
# Enable full brightness for great visibility in the dark
# Disable if you think this is cheating
full_brightness (Full brightness) bool false
[*Scripting]
# Enable client-side mods without restrictions
# Disable if you think this is cheating
force_csm (Force client-side mods) bool false
[Controls] [Controls]
[*General] [*General]
@ -256,9 +272,6 @@ connected_glass (Connect glass) bool false
# Disable for speed or for different looks. # Disable for speed or for different looks.
smooth_lighting (Smooth lighting) bool true smooth_lighting (Smooth lighting) bool true
# Enable full brightness for great visibility in the dark
# Disable if you think this is cheating
full_brightness (Full brightness) bool false
# Enables tradeoffs that reduce CPU load or increase rendering performance # Enables tradeoffs that reduce CPU load or increase rendering performance
# at the expense of minor visual glitches that do not impact game playability. # at the expense of minor visual glitches that do not impact game playability.

@ -12,6 +12,28 @@
# Further documentation: # Further documentation:
# https://wiki.minetest.net/ # https://wiki.minetest.net/
#
# Enhancements
#
## Rendering
# Enable full brightness for great visibility in the dark
# Disable if you think this is cheating
# type: bool
# full_brightness (Full brightness) bool false
# Enable minimap everywhere
# Disable if you think this is cheating
# type: bool
# force_minimap (Force minimap) bool false
## Scripting
# Enable client-side mods without restrictions
# Disable if you think this is cheating
#force_csm (Force client-side mods) bool false
# #
# Controls # Controls
# #
@ -187,11 +209,6 @@
# type: bool # type: bool
# smooth_lighting = true # smooth_lighting = true
# Enable full brightness for great visibility in the dark
# Disable if you think this is cheating
# type: bool
full_brightness (Full brightness) bool false
# Enables tradeoffs that reduce CPU load or increase rendering performance # Enables tradeoffs that reduce CPU load or increase rendering performance
# at the expense of minor visual glitches that do not impact game playability. # at the expense of minor visual glitches that do not impact game playability.
# type: bool # type: bool

@ -2460,16 +2460,16 @@ void Game::toggleMinimap(bool shift_pressed)
mapper->getModeDef().type == MINIMAP_TYPE_RADAR) mapper->getModeDef().type == MINIMAP_TYPE_RADAR)
mapper->nextMode(); mapper->nextMode();
m_game_ui->m_flags.show_minimap = mapper->getModeDef().type != m_game_ui->m_flags.show_minimap = mapper->getModeDef().type != MINIMAP_TYPE_OFF;
MINIMAP_TYPE_OFF;
}
// <-- // <--
// End of 'not so satifying code' // End of 'not so satifying code'
if ((hud_flags & HUD_FLAG_MINIMAP_VISIBLE) || if ((hud_flags & HUD_FLAG_MINIMAP_VISIBLE) ||
(hud && hud->hasElementOfType(HUD_ELEM_MINIMAP))) (hud && hud->hasElementOfType(HUD_ELEM_MINIMAP)))
m_game_ui->showStatusText(utf8_to_wide(mapper->getModeDef().label)); m_game_ui->showStatusText(utf8_to_wide(mapper->getModeDef().label));
else else
m_game_ui->showTranslatedStatusText("Minimap currently disabled by game or mod"); m_game_ui->showTranslatedStatusText(
"Minimap currently disabled by game or mod");
}
} }
void Game::toggleFog() void Game::toggleFog()

@ -199,6 +199,8 @@ void set_default_settings()
settings->setDefault("connected_glass", "false"); settings->setDefault("connected_glass", "false");
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_csm", "false");
settings->setDefault("performance_tradeoffs", "false"); settings->setDefault("performance_tradeoffs", "false");
settings->setDefault("lighting_alpha", "0.0"); settings->setDefault("lighting_alpha", "0.0");
settings->setDefault("lighting_beta", "1.5"); settings->setDefault("lighting_beta", "1.5");

@ -43,9 +43,6 @@ static LightingParams params;
float decode_light_f(float x) float decode_light_f(float x)
{ {
if (params.full_brightness){
return 1.0f;
}
if (x >= 1.0f) // x is often 1.0f if (x >= 1.0f) // x is often 1.0f
return 1.0f; return 1.0f;
x = std::fmax(x, 0.0f); x = std::fmax(x, 0.0f);
@ -63,11 +60,16 @@ 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");
if (full_brightness) {
for (size_t i = 0; i <= LIGHT_SUN; i++) {
light_LUT[i] = 255;
}
return;
}
// Lighting curve bounding gradients // Lighting curve bounding gradients
const float alpha = rangelim(g_settings->getFloat("lighting_alpha"), 0.0f, 3.0f); const float alpha = rangelim(g_settings->getFloat("lighting_alpha"), 0.0f, 3.0f);
const float beta = rangelim(g_settings->getFloat("lighting_beta"), 0.0f, 3.0f); const float beta = rangelim(g_settings->getFloat("lighting_beta"), 0.0f, 3.0f);
const bool full_brightness = g_settings->getBool("full_brightness");
params.full_brightness = full_brightness;
// Lighting curve polynomial coefficients // Lighting curve polynomial coefficients
params.a = alpha + beta - 2.0f; params.a = alpha + beta - 2.0f;
params.b = 3.0f - 2.0f * alpha - beta; params.b = 3.0f - 2.0f * alpha - beta;

@ -1287,8 +1287,14 @@ 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");
if (force_minimap){
player->hud_flags = player->hud_flags | HUD_FLAG_MINIMAP_VISIBLE | HUD_FLAG_MINIMAP_RADAR_VISIBLE;
}
else {
m_minimap_disabled_by_server = !(player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE); m_minimap_disabled_by_server = !(player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE);
bool m_minimap_radar_disabled_by_server = !(player->hud_flags & HUD_FLAG_MINIMAP_RADAR_VISIBLE); bool m_minimap_radar_disabled_by_server =
!(player->hud_flags & HUD_FLAG_MINIMAP_RADAR_VISIBLE);
// Not so satisying code to keep compatibility with old fixed mode system // Not so satisying code to keep compatibility with old fixed mode system
// --> // -->
@ -1300,12 +1306,13 @@ void Client::handleCommand_HudSetFlags(NetworkPacket* pkt)
m_minimap->setModeIndex(0); m_minimap->setModeIndex(0);
// If radar has been disabled, try to find a non radar mode or fall back to 0 // If radar has been disabled, try to find a non radar mode or fall back to 0
if (m_minimap && m_minimap_radar_disabled_by_server if (m_minimap && m_minimap_radar_disabled_by_server &&
&& was_minimap_radar_visible) { was_minimap_radar_visible) {
while (m_minimap->getModeIndex() > 0 && while (m_minimap->getModeIndex() > 0 &&
m_minimap->getModeDef().type == MINIMAP_TYPE_RADAR) m_minimap->getModeDef().type == MINIMAP_TYPE_RADAR)
m_minimap->nextMode(); m_minimap->nextMode();
} }
}
// <-- // <--
// End of 'not so satifying code' // End of 'not so satifying code'
} }
@ -1611,8 +1618,14 @@ 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");
if(force_csm) {
m_csm_restriction_flags = 0;
m_csm_restriction_noderange = 4294967295;
}
else {
*pkt >> m_csm_restriction_flags >> m_csm_restriction_noderange; *pkt >> m_csm_restriction_flags >> m_csm_restriction_noderange;
}
// Restrictions were received -> load mods if it's enabled // Restrictions were received -> load mods if it's enabled
// Note: this should be moved after mods receptions from server instead // Note: this should be moved after mods receptions from server instead
loadMods(); loadMods();