diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 45d009742..398f91bb2 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -83,6 +83,22 @@ # 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] [*General] @@ -256,9 +272,6 @@ connected_glass (Connect glass) bool false # Disable for speed or for different looks. 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 # at the expense of minor visual glitches that do not impact game playability. diff --git a/minetest.conf.example b/minetest.conf.example index 1679632f5..717a69381 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -12,6 +12,28 @@ # Further documentation: # 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 # @@ -187,11 +209,6 @@ # type: bool # 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 # at the expense of minor visual glitches that do not impact game playability. # type: bool diff --git a/src/client/game.cpp b/src/client/game.cpp index cc8891547..1edbc1ede 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -2404,22 +2404,22 @@ void Game::toggleMinimap(bool shift_pressed) m_game_ui->m_flags.show_minimap = false; } else { - // If radar is disabled, try to find a non radar mode or fall back to 0 + // If radar is disabled, try to find a non radar mode or fall back to 0 if (!(hud_flags & HUD_FLAG_MINIMAP_RADAR_VISIBLE)) while (mapper->getModeIndex() && mapper->getModeDef().type == MINIMAP_TYPE_RADAR) mapper->nextMode(); - m_game_ui->m_flags.show_minimap = mapper->getModeDef().type != - MINIMAP_TYPE_OFF; + m_game_ui->m_flags.show_minimap = mapper->getModeDef().type != MINIMAP_TYPE_OFF; + // <-- + // End of 'not so satifying code' + if ((hud_flags & HUD_FLAG_MINIMAP_VISIBLE) || + (hud && hud->hasElementOfType(HUD_ELEM_MINIMAP))) + m_game_ui->showStatusText(utf8_to_wide(mapper->getModeDef().label)); + else + m_game_ui->showTranslatedStatusText( + "Minimap currently disabled by game or mod"); } - // <-- - // End of 'not so satifying code' - if ((hud_flags & HUD_FLAG_MINIMAP_VISIBLE) || - (hud && hud->hasElementOfType(HUD_ELEM_MINIMAP))) - m_game_ui->showStatusText(utf8_to_wide(mapper->getModeDef().label)); - else - m_game_ui->showTranslatedStatusText("Minimap currently disabled by game or mod"); } void Game::toggleFog() diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index f9ba4e1fd..9384680b0 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -198,6 +198,8 @@ void set_default_settings() settings->setDefault("connected_glass", "false"); settings->setDefault("smooth_lighting", "true"); settings->setDefault("full_brightness", "false"); + settings->setDefault("force_minimap", "false"); + settings->setDefault("force_csm", "false"); settings->setDefault("performance_tradeoffs", "false"); settings->setDefault("lighting_alpha", "0.0"); settings->setDefault("lighting_beta", "1.5"); diff --git a/src/light.cpp b/src/light.cpp index 82da00876..47f2f6794 100644 --- a/src/light.cpp +++ b/src/light.cpp @@ -3,19 +3,19 @@ Minetest Copyright (C) 2013 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ #include "light.h" #include @@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef SERVER -static u8 light_LUT[LIGHT_SUN + 1]; + static u8 light_LUT[LIGHT_SUN + 1]; // The const ref to light_LUT is what is actually used in the code const u8 *light_decode_table = light_LUT; @@ -43,15 +43,12 @@ static LightingParams params; float decode_light_f(float x) { - if (params.full_brightness){ - return 1.0f; - } if (x >= 1.0f) // x is often 1.0f return 1.0f; x = std::fmax(x, 0.0f); float brightness = ((params.a * x + params.b) * x + params.c) * x; brightness += params.boost * - std::exp(-0.5f * sqr((x - params.center) / params.sigma)); + std::exp(-0.5f * sqr((x - params.center) / params.sigma)); if (brightness <= 0.0f) // May happen if parameters are extreme return 0.0f; if (brightness >= 1.0f) @@ -63,23 +60,28 @@ float decode_light_f(float x) // Initialize or update the light value tables using the specified gamma void set_light_table(float gamma) { -// Lighting curve bounding gradients + 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 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 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.b = 3.0f - 2.0f * alpha - beta; params.c = alpha; -// Lighting curve parametric boost + // Lighting curve parametric boost params.boost = rangelim(g_settings->getFloat("lighting_boost"), 0.0f, 0.4f); params.center = rangelim(g_settings->getFloat("lighting_boost_center"), 0.0f, 1.0f); params.sigma = rangelim(g_settings->getFloat("lighting_boost_spread"), 0.0f, 0.4f); -// Lighting curve gamma correction + // Lighting curve gamma correction params.gamma = rangelim(gamma, 0.33f, 3.0f); -// Boundary values should be fixed + // Boundary values should be fixed light_LUT[0] = 0; light_LUT[LIGHT_SUN] = 255; @@ -96,4 +98,4 @@ void set_light_table(float gamma) } } -#endif +#endif \ No newline at end of file diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 2cb3b20ed..9e8dc11ee 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -1270,24 +1270,31 @@ void Client::handleCommand_HudSetFlags(NetworkPacket* pkt) player->hud_flags &= ~mask; player->hud_flags |= flags; - 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); + 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); + 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 + // --> - // Hide minimap if it has been disabled by the server - if (m_minimap && m_minimap_disabled_by_server && was_minimap_visible) - // defers a minimap update, therefore only call it if really - // needed, by checking that minimap was visible before - m_minimap->setModeIndex(0); + // Hide minimap if it has been disabled by the server + if (m_minimap && m_minimap_disabled_by_server && was_minimap_visible) + // defers a minimap update, therefore only call it if really + // needed, by checking that minimap was visible before + m_minimap->setModeIndex(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 - && was_minimap_radar_visible) { - while (m_minimap->getModeIndex() > 0 && - m_minimap->getModeDef().type == MINIMAP_TYPE_RADAR) - m_minimap->nextMode(); + // 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 && + was_minimap_radar_visible) { + while (m_minimap->getModeIndex() > 0 && + m_minimap->getModeDef().type == MINIMAP_TYPE_RADAR) + m_minimap->nextMode(); + } } // <-- // End of 'not so satifying code' @@ -1591,8 +1598,14 @@ void Client::handleCommand_FormspecPrepend(NetworkPacket *pkt) void Client::handleCommand_CSMRestrictionFlags(NetworkPacket *pkt) { - *pkt >> m_csm_restriction_flags >> m_csm_restriction_noderange; - + 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; + } // Restrictions were received -> load mods if it's enabled // Note: this should be moved after mods receptions from server instead loadMods();