Rename "opaque_water" setting to "translucent_liquids" with inverted meaning (#14660)

The old setting will be migrated properly.

---------

Co-authored-by: grorp <gregor.parzefall@posteo.de>
This commit is contained in:
Xeno333 2024-05-22 09:46:05 -05:00 committed by GitHub
parent bd4572cfd1
commit a078cfee3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 25 additions and 8 deletions

@ -265,8 +265,8 @@ undersampling (Undersampling) int 1 1 8
[**Graphics Effects] [**Graphics Effects]
# Makes all liquids opaque # Allows liquids to be translucent.
opaque_water (Opaque liquids) bool false translucent_liquids (Translucent liquids) bool true
# Leaves style: # Leaves style:
# - Fancy: all faces visible # - Fancy: all faces visible

@ -282,7 +282,7 @@ void set_default_settings()
settings->setDefault("enable_3d_clouds", "true"); settings->setDefault("enable_3d_clouds", "true");
settings->setDefault("cloud_radius", "12"); settings->setDefault("cloud_radius", "12");
settings->setDefault("menu_clouds", "true"); settings->setDefault("menu_clouds", "true");
settings->setDefault("opaque_water", "false"); settings->setDefault("translucent_liquids", "true");
settings->setDefault("console_height", "0.6"); settings->setDefault("console_height", "0.6");
settings->setDefault("console_color", "(0,0,0)"); settings->setDefault("console_color", "(0,0,0)");
settings->setDefault("console_alpha", "200"); settings->setDefault("console_alpha", "200");

@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h" #include "filesys.h"
#include "version.h" #include "version.h"
#include "defaultsettings.h" #include "defaultsettings.h"
#include "migratesettings.h"
#include "gettext.h" #include "gettext.h"
#include "log.h" #include "log.h"
#include "util/quicktune.h" #include "util/quicktune.h"
@ -687,6 +688,8 @@ static bool init_common(const Settings &cmd_args, int argc, char *argv[])
if (!read_config_file(cmd_args)) if (!read_config_file(cmd_args))
return false; return false;
migrate_settings();
init_log_streams(cmd_args); init_log_streams(cmd_args);
// Initialize random seed // Initialize random seed

14
src/migratesettings.h Normal file

@ -0,0 +1,14 @@
// Minetest
// SPDX-License-Identifier: LGPL-2.1-or-later
#include "settings.h"
void migrate_settings()
{
// Converts opaque_water to translucent_liquids
if (g_settings->existsLocal("opaque_water")) {
g_settings->set("translucent_liquids",
g_settings->getBool("opaque_water") ? "false" : "true");
g_settings->remove("opaque_water");
}
}

@ -283,7 +283,7 @@ void TileDef::deSerialize(std::istream &is, NodeDrawType drawtype, u16 protocol_
void TextureSettings::readSettings() void TextureSettings::readSettings()
{ {
connected_glass = g_settings->getBool("connected_glass"); connected_glass = g_settings->getBool("connected_glass");
opaque_water = g_settings->getBool("opaque_water"); translucent_liquids = g_settings->getBool("translucent_liquids");
bool smooth_lighting = g_settings->getBool("smooth_lighting"); bool smooth_lighting = g_settings->getBool("smooth_lighting");
enable_mesh_cache = g_settings->getBool("enable_mesh_cache"); enable_mesh_cache = g_settings->getBool("enable_mesh_cache");
enable_minimap = g_settings->getBool("enable_minimap"); enable_minimap = g_settings->getBool("enable_minimap");
@ -825,14 +825,14 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
solidness = 0; solidness = 0;
break; break;
case NDT_LIQUID: case NDT_LIQUID:
if (tsettings.opaque_water) if (!tsettings.translucent_liquids)
alpha = ALPHAMODE_OPAQUE; alpha = ALPHAMODE_OPAQUE;
solidness = 1; solidness = 1;
is_liquid = true; is_liquid = true;
break; break;
case NDT_FLOWINGLIQUID: case NDT_FLOWINGLIQUID:
solidness = 0; solidness = 0;
if (tsettings.opaque_water) if (!tsettings.translucent_liquids)
alpha = ALPHAMODE_OPAQUE; alpha = ALPHAMODE_OPAQUE;
is_liquid = true; is_liquid = true;
break; break;

@ -184,7 +184,7 @@ public:
WorldAlignMode world_aligned_mode; WorldAlignMode world_aligned_mode;
AutoScale autoscale_mode; AutoScale autoscale_mode;
int node_texture_size; int node_texture_size;
bool opaque_water; bool translucent_liquids;
bool connected_glass; bool connected_glass;
bool enable_mesh_cache; bool enable_mesh_cache;
bool enable_minimap; bool enable_minimap;