Randomwalk cave liquids: Remove deprecated 'lava depth' parameter (#9105)
authorParamat <paramat@users.noreply.github.com>
Mon, 18 Nov 2019 23:40:01 +0000 (23:40 +0000)
committerGitHub <noreply@github.com>
Mon, 18 Nov 2019 23:40:01 +0000 (23:40 +0000)
Low-disruption first step towards removing the hardcoded cave liquid
code. Since MT 5.0.0 cave liquids can be defined and located by
biome definitions instead.
In games that do not yet use biome definitions to define and locate
cave liquids (MTGame does), lava will now appear below
y = water_level - 256 instead of below 'lava depth' (usually y = -256).
Therefore no change in most mapgens if using the default 'lava depth'.

17 files changed:
builtin/settingtypes.txt
src/mapgen/cavegen.cpp
src/mapgen/cavegen.h
src/mapgen/mapgen.cpp
src/mapgen/mapgen.h
src/mapgen/mapgen_carpathian.cpp
src/mapgen/mapgen_carpathian.h
src/mapgen/mapgen_flat.cpp
src/mapgen/mapgen_flat.h
src/mapgen/mapgen_fractal.cpp
src/mapgen/mapgen_fractal.h
src/mapgen/mapgen_v5.cpp
src/mapgen/mapgen_v5.h
src/mapgen/mapgen_v7.cpp
src/mapgen/mapgen_v7.h
src/mapgen/mapgen_valleys.cpp
src/mapgen/mapgen_valleys.h

index 3334926e7c7de74184051c1129a1aa85f1461f76..fd8c50d4c48af2f2d2b0091ad950db4dbd2de5bd 100644 (file)
@@ -1477,10 +1477,6 @@ mgv5_cave_width (Cave width) float 0.09
 #    Y of upper limit of large caves.
 mgv5_large_cave_depth (Large cave depth) int -256
 
-#    Deprecated, define and locate cave liquids using biome definitions instead.
-#    Y of upper limit of lava in large caves.
-mgv5_lava_depth (Lava depth) int -256
-
 #    Minimum limit of random number of small caves per mapchunk.
 mgv5_small_cave_num_min (Small cave minimum number) int 0 0 256
 
@@ -1611,10 +1607,6 @@ mgv7_cave_width (Cave width) float 0.09
 #    Y of upper limit of large caves.
 mgv7_large_cave_depth (Large cave depth) int -33
 
-#    Deprecated, define and locate cave liquids using biome definitions instead.
-#    Y of upper limit of lava in large caves.
-mgv7_lava_depth (Lava depth) int -256
-
 #    Minimum limit of random number of small caves per mapchunk.
 mgv7_small_cave_num_min (Small cave minimum number) int 0 0 256
 
@@ -1736,10 +1728,6 @@ mgcarpathian_cave_width (Cave width) float 0.09
 #    Y of upper limit of large caves.
 mgcarpathian_large_cave_depth (Large cave depth) int -33
 
-#    Deprecated, define and locate cave liquids using biome definitions instead.
-#    Y of upper limit of lava in large caves.
-mgcarpathian_lava_depth (Lava depth) int -256
-
 #    Minimum limit of random number of small caves per mapchunk.
 mgcarpathian_small_cave_num_min (Small cave minimum number) int 0 0 256
 
@@ -1835,10 +1823,6 @@ mgflat_ground_level (Ground level) int 8
 #    Y of upper limit of large caves.
 mgflat_large_cave_depth (Large cave depth) int -33
 
-#    Deprecated, define and locate cave liquids using biome definitions instead.
-#    Y of upper limit of lava in large caves.
-mgflat_lava_depth (Lava depth) int -256
-
 #    Minimum limit of random number of small caves per mapchunk.
 mgflat_small_cave_num_min (Small cave minimum number) int 0 0 256
 
@@ -1913,10 +1897,6 @@ mgfractal_cave_width (Cave width) float 0.09
 #    Y of upper limit of large caves.
 mgfractal_large_cave_depth (Large cave depth) int -33
 
-#    Deprecated, define and locate cave liquids using biome definitions instead.
-#    Y of upper limit of lava in large caves.
-mgfractal_lava_depth (Lava depth) int -256
-
 #    Minimum limit of random number of small caves per mapchunk.
 mgfractal_small_cave_num_min (Small cave minimum number) int 0 0 256
 
@@ -2051,10 +2031,6 @@ mgvalleys_altitude_chill (Altitude chill) int 90
 #    Depth below which you'll find large caves.
 mgvalleys_large_cave_depth (Large cave depth) int -33
 
-#    Deprecated, define and locate cave liquids using biome definitions instead.
-#    Y of upper limit of lava in large caves.
-mgvalleys_lava_depth (Lava depth) int 1
-
 #    Minimum limit of random number of small caves per mapchunk.
 mgvalleys_small_cave_num_min (Small cave minimum number) int 0 0 256
 
index d3d51935ba300d335106680a0ea79285d181b254..a9df4506fb0c606a434cb40a00791b29f90be362 100644 (file)
@@ -281,7 +281,6 @@ CavesRandomWalk::CavesRandomWalk(
        content_t water_source,
        content_t lava_source,
        float large_cave_flooded,
-       int lava_depth,
        BiomeGen *biomegen)
 {
        assert(ndef);
@@ -292,7 +291,6 @@ CavesRandomWalk::CavesRandomWalk(
        this->water_level        = water_level;
        this->np_caveliquids     = &nparams_caveliquids;
        this->large_cave_flooded = large_cave_flooded;
-       this->lava_depth         = lava_depth;
        this->bmgn               = biomegen;
 
        c_water_source = water_source;
@@ -530,12 +528,12 @@ void CavesRandomWalk::carveRoute(v3f vec, float f, bool randomize_xz)
                if (use_biome_liquid) {
                        liquidnode = c_biome_liquid;
                } else {
-                       // TODO remove this. Cave liquids are now defined and located using biome
-                       // definitions.
                        // If cave liquid not defined by biome, fallback to old hardcoded behaviour.
+                       // TODO 'np_caveliquids' is deprecated and should eventually be removed.
+                       // Cave liquids are now defined and located using biome definitions.
                        float nval = NoisePerlin3D(np_caveliquids, startp.X,
                                startp.Y, startp.Z, seed);
-                       liquidnode = (nval < 0.40f && node_max.Y < lava_depth) ?
+                       liquidnode = (nval < 0.40f && node_max.Y < water_level - 256) ?
                                lavanode : waternode;
                }
        }
index dc73e83f10c294daf7b94caf3d769a0406c5c647..ff09f942341c34e26d438e58089870dfb33ac62d 100644 (file)
@@ -119,9 +119,8 @@ public:
        s32 seed;
        int water_level;
        float large_cave_flooded;
-       // TODO 'lava_depth' and 'np_caveliquids' are deprecated and should be removed.
+       // TODO 'np_caveliquids' is deprecated and should eventually be removed.
        // Cave liquids are now defined and located using biome definitions.
-       int lava_depth;
        NoiseParams *np_caveliquids;
 
        u16 ystride;
@@ -160,8 +159,7 @@ public:
        CavesRandomWalk(const NodeDefManager *ndef, GenerateNotifier *gennotify =
                NULL, s32 seed = 0, int water_level = 1, content_t water_source =
                CONTENT_IGNORE, content_t lava_source = CONTENT_IGNORE,
-               float large_cave_flooded = 0.5f, int lava_depth = -256,
-               BiomeGen *biomegen = NULL);
+               float large_cave_flooded = 0.5f, BiomeGen *biomegen = NULL);
 
        // vm and ps are mandatory parameters.
        // If heightmap is NULL, the surface level at all points is assumed to
index bd074d1580d7febc4d33bc028365d41f0ed19421..f465c05a05619fc30f6d8bdc71332848c1faa96f 100644 (file)
@@ -854,7 +854,7 @@ void MapgenBasic::generateCavesRandomWalk(s16 max_stone_y, s16 large_cave_depth)
 
        for (u32 i = 0; i < num_small_caves; i++) {
                CavesRandomWalk cave(ndef, &gennotify, seed, water_level,
-                       c_water_source, c_lava_source, large_cave_flooded, lava_depth, biomegen);
+                       c_water_source, c_lava_source, large_cave_flooded, biomegen);
                cave.makeCave(vm, node_min, node_max, &ps, false, max_stone_y, heightmap);
        }
 
@@ -866,7 +866,7 @@ void MapgenBasic::generateCavesRandomWalk(s16 max_stone_y, s16 large_cave_depth)
 
        for (u32 i = 0; i < num_large_caves; i++) {
                CavesRandomWalk cave(ndef, &gennotify, seed, water_level,
-                       c_water_source, c_lava_source, large_cave_flooded, lava_depth, biomegen);
+                       c_water_source, c_lava_source, large_cave_flooded, biomegen);
                cave.makeCave(vm, node_min, node_max, &ps, true, max_stone_y, heightmap);
        }
 }
index 01a55948b43ef39a87b8f0cb253383db00074109..11db0353867239a293947307903b72c3c1f9e6df 100644 (file)
@@ -285,7 +285,4 @@ protected:
        int large_cave_num_min;
        int large_cave_num_max;
        float large_cave_flooded;
-       // TODO 'lava_depth' is deprecated and should be removed. Cave liquids are
-       // now defined and located using biome definitions.
-       int lava_depth;
 };
index 0bf6126eda1952ccc26c785eae53afdeed5034d1..b0783c998d5a0b52af348aacc405f8a878cbf515 100644 (file)
@@ -61,7 +61,6 @@ MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager
        spflags            = params->spflags;
        cave_width         = params->cave_width;
        large_cave_depth   = params->large_cave_depth;
-       lava_depth         = params->lava_depth;
        small_cave_num_min = params->small_cave_num_min;
        small_cave_num_max = params->small_cave_num_max;
        large_cave_num_min = params->large_cave_num_min;
@@ -155,7 +154,6 @@ void MapgenCarpathianParams::readParams(const Settings *settings)
 
        settings->getFloatNoEx("mgcarpathian_cave_width",         cave_width);
        settings->getS16NoEx("mgcarpathian_large_cave_depth",     large_cave_depth);
-       settings->getS16NoEx("mgcarpathian_lava_depth",           lava_depth);
        settings->getU16NoEx("mgcarpathian_small_cave_num_min",   small_cave_num_min);
        settings->getU16NoEx("mgcarpathian_small_cave_num_max",   small_cave_num_max);
        settings->getU16NoEx("mgcarpathian_large_cave_num_min",   large_cave_num_min);
@@ -198,7 +196,6 @@ void MapgenCarpathianParams::writeParams(Settings *settings) const
 
        settings->setFloat("mgcarpathian_cave_width",         cave_width);
        settings->setS16("mgcarpathian_large_cave_depth",     large_cave_depth);
-       settings->setS16("mgcarpathian_lava_depth",           lava_depth);
        settings->setU16("mgcarpathian_small_cave_num_min",   small_cave_num_min);
        settings->setU16("mgcarpathian_small_cave_num_max",   small_cave_num_max);
        settings->setU16("mgcarpathian_large_cave_num_min",   large_cave_num_min);
index f970b85c6e9dd6accaf8ed12f41fb805fa9ab391..f77ffd1b15422b6f0a78cc4206a763f0bab8d07f 100644 (file)
@@ -40,7 +40,6 @@ struct MapgenCarpathianParams : public MapgenParams
        u32 spflags              = MGCARPATHIAN_CAVERNS;
        float cave_width         = 0.09f;
        s16 large_cave_depth     = -33;
-       s16 lava_depth           = -256;
        u16 small_cave_num_min   = 0;
        u16 small_cave_num_max   = 0;
        u16 large_cave_num_min   = 0;
index 359182f5a700d13d1a3f2f60aadf8cbeb9b64e17..5cd4752020080d60b4ac55763451532eed642fd1 100644 (file)
@@ -54,7 +54,6 @@ MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge)
        spflags            = params->spflags;
        ground_level       = params->ground_level;
        large_cave_depth   = params->large_cave_depth;
-       lava_depth         = params->lava_depth;
        small_cave_num_min = params->small_cave_num_min;
        small_cave_num_max = params->small_cave_num_max;
        large_cave_num_min = params->large_cave_num_min;
@@ -104,7 +103,6 @@ void MapgenFlatParams::readParams(const Settings *settings)
        settings->getFlagStrNoEx("mgflat_spflags", spflags, flagdesc_mapgen_flat);
        settings->getS16NoEx("mgflat_ground_level",         ground_level);
        settings->getS16NoEx("mgflat_large_cave_depth",     large_cave_depth);
-       settings->getS16NoEx("mgflat_lava_depth",           lava_depth);
        settings->getU16NoEx("mgflat_small_cave_num_min",   small_cave_num_min);
        settings->getU16NoEx("mgflat_small_cave_num_max",   small_cave_num_max);
        settings->getU16NoEx("mgflat_large_cave_num_min",   large_cave_num_min);
@@ -131,7 +129,6 @@ void MapgenFlatParams::writeParams(Settings *settings) const
        settings->setFlagStr("mgflat_spflags", spflags, flagdesc_mapgen_flat, U32_MAX);
        settings->setS16("mgflat_ground_level",         ground_level);
        settings->setS16("mgflat_large_cave_depth",     large_cave_depth);
-       settings->setS16("mgflat_lava_depth",           lava_depth);
        settings->setU16("mgflat_small_cave_num_min",   small_cave_num_min);
        settings->setU16("mgflat_small_cave_num_max",   small_cave_num_max);
        settings->setU16("mgflat_large_cave_num_min",   large_cave_num_min);
index cd4a106a629fc95915f99dc410ccf20a40abe4fb..dd6d51f54cd2d23f7315c75ff2a3cb7440731666 100644 (file)
@@ -35,7 +35,6 @@ struct MapgenFlatParams : public MapgenParams
        u32 spflags = 0;
        s16 ground_level = 8;
        s16 large_cave_depth = -33;
-       s16 lava_depth = -256;
        u16 small_cave_num_min = 0;
        u16 small_cave_num_max = 0;
        u16 large_cave_num_min = 0;
index 7615e6350f7fe2dd0daf567fbedac3682a8a5a9f..0431714fe43984daceff7b36c2ef75c5fce9ea81 100644 (file)
@@ -54,7 +54,6 @@ MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge)
        spflags            = params->spflags;
        cave_width         = params->cave_width;
        large_cave_depth   = params->large_cave_depth;
-       lava_depth         = params->lava_depth;
        small_cave_num_min = params->small_cave_num_min;
        small_cave_num_max = params->small_cave_num_max;
        large_cave_num_min = params->large_cave_num_min;
@@ -113,7 +112,6 @@ void MapgenFractalParams::readParams(const Settings *settings)
        settings->getFlagStrNoEx("mgfractal_spflags", spflags, flagdesc_mapgen_fractal);
        settings->getFloatNoEx("mgfractal_cave_width",         cave_width);
        settings->getS16NoEx("mgfractal_large_cave_depth",     large_cave_depth);
-       settings->getS16NoEx("mgfractal_lava_depth",           lava_depth);
        settings->getU16NoEx("mgfractal_small_cave_num_min",   small_cave_num_min);
        settings->getU16NoEx("mgfractal_small_cave_num_max",   small_cave_num_max);
        settings->getU16NoEx("mgfractal_large_cave_num_min",   large_cave_num_min);
@@ -144,7 +142,6 @@ void MapgenFractalParams::writeParams(Settings *settings) const
        settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX);
        settings->setFloat("mgfractal_cave_width",         cave_width);
        settings->setS16("mgfractal_large_cave_depth",     large_cave_depth);
-       settings->setS16("mgfractal_lava_depth",           lava_depth);
        settings->setU16("mgfractal_small_cave_num_min",   small_cave_num_min);
        settings->setU16("mgfractal_small_cave_num_max",   small_cave_num_max);
        settings->setU16("mgfractal_large_cave_num_min",   large_cave_num_min);
index e317f759d7347ba388f171ac43d081ffc8ffee31..e5cb2c8327084044c6a00988c663c4b4160c785d 100644 (file)
@@ -38,7 +38,6 @@ struct MapgenFractalParams : public MapgenParams
        u32 spflags = MGFRACTAL_TERRAIN;
        float cave_width = 0.09f;
        s16 large_cave_depth = -33;
-       s16 lava_depth = -256;
        u16 small_cave_num_min = 0;
        u16 small_cave_num_max = 0;
        u16 large_cave_num_min = 0;
index 5164c5991fa7cf7216c90baaa7a40ac7a52f8553..73fc4229534c917b16ac7bec8b9cc8dde5071f75 100644 (file)
@@ -51,7 +51,6 @@ MapgenV5::MapgenV5(MapgenV5Params *params, EmergeManager *emerge)
        spflags            = params->spflags;
        cave_width         = params->cave_width;
        large_cave_depth   = params->large_cave_depth;
-       lava_depth         = params->lava_depth;
        small_cave_num_min = params->small_cave_num_min;
        small_cave_num_max = params->small_cave_num_max;
        large_cave_num_min = params->large_cave_num_min;
@@ -106,7 +105,6 @@ void MapgenV5Params::readParams(const Settings *settings)
        settings->getFlagStrNoEx("mgv5_spflags", spflags, flagdesc_mapgen_v5);
        settings->getFloatNoEx("mgv5_cave_width",         cave_width);
        settings->getS16NoEx("mgv5_large_cave_depth",     large_cave_depth);
-       settings->getS16NoEx("mgv5_lava_depth",           lava_depth);
        settings->getU16NoEx("mgv5_small_cave_num_min",   small_cave_num_min);
        settings->getU16NoEx("mgv5_small_cave_num_max",   small_cave_num_max);
        settings->getU16NoEx("mgv5_large_cave_num_min",   large_cave_num_min);
@@ -134,7 +132,6 @@ void MapgenV5Params::writeParams(Settings *settings) const
        settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, U32_MAX);
        settings->setFloat("mgv5_cave_width",         cave_width);
        settings->setS16("mgv5_large_cave_depth",     large_cave_depth);
-       settings->setS16("mgv5_lava_depth",           lava_depth);
        settings->setU16("mgv5_small_cave_num_min",   small_cave_num_min);
        settings->setU16("mgv5_small_cave_num_max",   small_cave_num_max);
        settings->setU16("mgv5_large_cave_num_min",   large_cave_num_min);
index 249f61121ca4ca0e4a7a86452587e0408115cd86..4623405a1491eb7cc8677991d14c6b130d0a5e3b 100644 (file)
@@ -34,7 +34,6 @@ struct MapgenV5Params : public MapgenParams
        u32 spflags = MGV5_CAVERNS;
        float cave_width = 0.09f;
        s16 large_cave_depth = -256;
-       s16 lava_depth = -256;
        u16 small_cave_num_min = 0;
        u16 small_cave_num_max = 0;
        u16 large_cave_num_min = 0;
index eaaff6ac6fad9c2911ed6ec322f3040d63230521..a3cd8a557638d1aac67f8e655cd18b8e1588270b 100644 (file)
@@ -64,7 +64,6 @@ MapgenV7::MapgenV7(MapgenV7Params *params, EmergeManager *emerge)
 
        cave_width         = params->cave_width;
        large_cave_depth   = params->large_cave_depth;
-       lava_depth         = params->lava_depth;
        small_cave_num_min = params->small_cave_num_min;
        small_cave_num_max = params->small_cave_num_max;
        large_cave_num_min = params->large_cave_num_min;
@@ -177,7 +176,6 @@ void MapgenV7Params::readParams(const Settings *settings)
        settings->getS16NoEx("mgv7_mount_zero_level",       mount_zero_level);
        settings->getFloatNoEx("mgv7_cave_width",           cave_width);
        settings->getS16NoEx("mgv7_large_cave_depth",       large_cave_depth);
-       settings->getS16NoEx("mgv7_lava_depth",             lava_depth);
        settings->getU16NoEx("mgv7_small_cave_num_min",     small_cave_num_min);
        settings->getU16NoEx("mgv7_small_cave_num_max",     small_cave_num_max);
        settings->getU16NoEx("mgv7_large_cave_num_min",     large_cave_num_min);
@@ -218,7 +216,6 @@ void MapgenV7Params::writeParams(Settings *settings) const
        settings->setS16("mgv7_mount_zero_level",       mount_zero_level);
        settings->setFloat("mgv7_cave_width",           cave_width);
        settings->setS16("mgv7_large_cave_depth",       large_cave_depth);
-       settings->setS16("mgv7_lava_depth",             lava_depth);
        settings->setU16("mgv7_small_cave_num_min",     small_cave_num_min);
        settings->setU16("mgv7_small_cave_num_max",     small_cave_num_max);
        settings->setU16("mgv7_large_cave_num_min",     large_cave_num_min);
index 8aeb2652e6bae76ef1d16490710f5ec83ce47e46..85c9b6beba9faf4fa5d98552982362b469c6e85f 100644 (file)
@@ -45,7 +45,6 @@ struct MapgenV7Params : public MapgenParams {
 
        float cave_width = 0.09f;
        s16 large_cave_depth = -33;
-       s16 lava_depth = -256;
        u16 small_cave_num_min = 0;
        u16 small_cave_num_max = 0;
        u16 large_cave_num_min = 0;
index 413967cbd1e0e74bf1e048ae3e26977a81e5a8a7..c4ea5067d43b53e12bd94c93f7a49e51154c070c 100644 (file)
@@ -67,7 +67,6 @@ MapgenValleys::MapgenValleys(MapgenValleysParams *params, EmergeManager *emerge)
 
        cave_width         = params->cave_width;
        large_cave_depth   = params->large_cave_depth;
-       lava_depth         = params->lava_depth;
        small_cave_num_min = params->small_cave_num_min;
        small_cave_num_max = params->small_cave_num_max;
        large_cave_num_min = params->large_cave_num_min;
@@ -132,7 +131,6 @@ void MapgenValleysParams::readParams(const Settings *settings)
        settings->getFlagStrNoEx("mgvalleys_spflags", spflags, flagdesc_mapgen_valleys);
        settings->getU16NoEx("mgvalleys_altitude_chill",       altitude_chill);
        settings->getS16NoEx("mgvalleys_large_cave_depth",     large_cave_depth);
-       settings->getS16NoEx("mgvalleys_lava_depth",           lava_depth);
        settings->getU16NoEx("mgvalleys_small_cave_num_min",   small_cave_num_min);
        settings->getU16NoEx("mgvalleys_small_cave_num_max",   small_cave_num_max);
        settings->getU16NoEx("mgvalleys_large_cave_num_min",   large_cave_num_min);
@@ -167,7 +165,6 @@ void MapgenValleysParams::writeParams(Settings *settings) const
        settings->setFlagStr("mgvalleys_spflags", spflags, flagdesc_mapgen_valleys, U32_MAX);
        settings->setU16("mgvalleys_altitude_chill",       altitude_chill);
        settings->setS16("mgvalleys_large_cave_depth",     large_cave_depth);
-       settings->setS16("mgvalleys_lava_depth",           lava_depth);
        settings->setU16("mgvalleys_small_cave_num_min",   small_cave_num_min);
        settings->setU16("mgvalleys_small_cave_num_max",   small_cave_num_max);
        settings->setU16("mgvalleys_large_cave_num_min",   large_cave_num_min);
index 945621ab48247801dc85c83974c38b27c527d7cc..f5a19eaec39546429b494ad37a3c287eae24c7bd 100644 (file)
@@ -49,7 +49,6 @@ struct MapgenValleysParams : public MapgenParams {
 
        float cave_width = 0.09f;
        s16 large_cave_depth = -33;
-       s16 lava_depth = 1;
        u16 small_cave_num_min = 0;
        u16 small_cave_num_max = 0;
        u16 large_cave_num_min = 0;