Randomwalk caves: Add parameters for number, proportion flooded. Allow small caves...
authorParamat <paramat@users.noreply.github.com>
Fri, 8 Nov 2019 03:09:43 +0000 (03:09 +0000)
committerGitHub <noreply@github.com>
Fri, 8 Nov 2019 03:09:43 +0000 (03:09 +0000)
Add mapgen parameters to set the range of the random number of
randomwalk caves per mapchunk, and to set the proportion that are
flooded with liquids.
Default values are, for now, unchanged from the previous hardcoded
values.

Add parameters to allow small randomwalk caves
Disabled by default for now as they have never been present in the
non-mgv6 mapgens.

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 e74b8ea8b84afdb4920c24d93623876ffedf2f35..b6e5de599ed12cd5704b5adb737d4b5d6b5eae3a 100644 (file)
@@ -1479,6 +1479,21 @@ mgv5_large_cave_depth (Large cave depth) int -256
 #    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
+
+#    Maximum limit of random number of small caves per mapchunk.
+mgv5_small_cave_num_max (Small cave maximum number) int 0 0 256
+
+#    Minimum limit of random number of large caves per mapchunk.
+mgv5_large_cave_num_min (Large cave minimum number) int 0 0 64
+
+#    Maximum limit of random number of large caves per mapchunk.
+mgv5_large_cave_num_max (Large cave maximum number) int 2 0 64
+
+#    Proportion of large caves that contain liquid.
+mgv5_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
+
 #    Y-level of cavern upper limit.
 mgv5_cavern_limit (Cavern limit) int -256
 
@@ -1596,6 +1611,21 @@ mgv7_large_cave_depth (Large cave depth) int -33
 #    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
+
+#    Maximum limit of random number of small caves per mapchunk.
+mgv7_small_cave_num_max (Small cave maximum number) int 0 0 256
+
+#    Minimum limit of random number of large caves per mapchunk.
+mgv7_large_cave_num_min (Large cave minimum number) int 0 0 64
+
+#    Maximum limit of random number of large caves per mapchunk.
+mgv7_large_cave_num_max (Large cave maximum number) int 2 0 64
+
+#    Proportion of large caves that contain liquid.
+mgv7_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
+
 #    Controls the density of mountain-type floatlands.
 #    Is a noise offset added to the 'mgv7_np_mountain' noise value.
 mgv7_float_mount_density (Floatland mountain density) float 0.6
@@ -1704,6 +1734,21 @@ mgcarpathian_large_cave_depth (Large cave depth) int -33
 #    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
+
+#    Maximum limit of random number of small caves per mapchunk.
+mgcarpathian_small_cave_num_max (Small cave maximum number) int 0 0 256
+
+#    Minimum limit of random number of large caves per mapchunk.
+mgcarpathian_large_cave_num_min (Large cave minimum number) int 0 0 64
+
+#    Maximum limit of random number of large caves per mapchunk.
+mgcarpathian_large_cave_num_max (Large cave maximum number) int 2 0 64
+
+#    Proportion of large caves that contain liquid.
+mgcarpathian_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
+
 #    Y-level of cavern upper limit.
 mgcarpathian_cavern_limit (Cavern limit) int -256
 
@@ -1788,6 +1833,21 @@ mgflat_large_cave_depth (Large cave depth) int -33
 #    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
+
+#    Maximum limit of random number of small caves per mapchunk.
+mgflat_small_cave_num_max (Small cave maximum number) int 0 0 256
+
+#    Minimum limit of random number of large caves per mapchunk.
+mgflat_large_cave_num_min (Large cave minimum number) int 0 0 64
+
+#    Maximum limit of random number of large caves per mapchunk.
+mgflat_large_cave_num_max (Large cave maximum number) int 2 0 64
+
+#    Proportion of large caves that contain liquid.
+mgflat_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
+
 #    Controls width of tunnels, a smaller value creates wider tunnels.
 mgflat_cave_width (Cave width) float 0.09
 
@@ -1847,6 +1907,21 @@ mgfractal_large_cave_depth (Large cave depth) int -33
 #    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
+
+#    Maximum limit of random number of small caves per mapchunk.
+mgfractal_small_cave_num_max (Small cave maximum number) int 0 0 256
+
+#    Minimum limit of random number of large caves per mapchunk.
+mgfractal_large_cave_num_min (Large cave minimum number) int 0 0 64
+
+#    Maximum limit of random number of large caves per mapchunk.
+mgfractal_large_cave_num_max (Large cave maximum number) int 2 0 64
+
+#    Proportion of large caves that contain liquid.
+mgfractal_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
+
 #    Lower Y limit of dungeons.
 mgfractal_dungeon_ymin (Dungeon minimum Y) int -31000
 
@@ -1970,6 +2045,21 @@ mgvalleys_large_cave_depth (Large cave depth) int -33
 #    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
+
+#    Maximum limit of random number of small caves per mapchunk.
+mgvalleys_small_cave_num_max (Small cave maximum number) int 0 0 256
+
+#    Minimum limit of random number of large caves per mapchunk.
+mgvalleys_large_cave_num_min (Large cave minimum number) int 0 0 64
+
+#    Maximum limit of random number of large caves per mapchunk.
+mgvalleys_large_cave_num_max (Large cave maximum number) int 2 0 64
+
+#    Proportion of large caves that contain liquid.
+mgvalleys_large_cave_flooded (Large cave proportion flooded) float 0.5 0.0 1.0
+
 #    Depth below which you'll find giant caverns.
 mgvalleys_cavern_limit (Cavern upper limit) int -256
 
index 21540d7ce8b68ab438c40b0ba87c2269e183d215..2e2a1bbe3d0c2840c1c9f8c50ea5c93edd7a18bd 100644 (file)
@@ -280,18 +280,20 @@ CavesRandomWalk::CavesRandomWalk(
        int water_level,
        content_t water_source,
        content_t lava_source,
+       float large_cave_flooded,
        int lava_depth,
        BiomeGen *biomegen)
 {
        assert(ndef);
 
-       this->ndef           = ndef;
-       this->gennotify      = gennotify;
-       this->seed           = seed;
-       this->water_level    = water_level;
-       this->np_caveliquids = &nparams_caveliquids;
-       this->lava_depth     = lava_depth;
-       this->bmgn           = biomegen;
+       this->ndef               = ndef;
+       this->gennotify          = gennotify;
+       this->seed               = seed;
+       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;
        if (c_water_source == CONTENT_IGNORE)
@@ -322,7 +324,7 @@ void CavesRandomWalk::makeCave(MMVManip *vm, v3s16 nmin, v3s16 nmax,
 
        this->ystride = nmax.X - nmin.X + 1;
 
-       flooded = ps->range(1, 2) == 2;
+       flooded = ps->range(1, 1000) <= large_cave_flooded * 1000.0f;
 
        // If flooded:
        // Get biome at mapchunk midpoint. If cave liquid defined for biome, use it.
index 3f1730ddb92d37b4b24f04e795da4aa728e53956..dc73e83f10c294daf7b94caf3d769a0406c5c647 100644 (file)
@@ -116,15 +116,14 @@ public:
        s16 *heightmap;
        BiomeGen *bmgn;
 
-       // configurable parameters
        s32 seed;
        int water_level;
+       float large_cave_flooded;
        // TODO 'lava_depth' and 'np_caveliquids' are deprecated and should be removed.
        // Cave liquids are now defined and located using biome definitions.
        int lava_depth;
        NoiseParams *np_caveliquids;
 
-       // intermediate state variables
        u16 ystride;
 
        s16 min_tunnel_diameter;
@@ -161,7 +160,8 @@ 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,
-               int lava_depth = -256, BiomeGen *biomegen = NULL);
+               float large_cave_flooded = 0.5f, int lava_depth = -256,
+               BiomeGen *biomegen = NULL);
 
        // vm and ps are mandatory parameters.
        // If heightmap is NULL, the surface level at all points is assumed to
index 6d5e721ce3c25bc9af18afadd6d5b26b6bd93289..a1ac7a5ca7fc33622233b5f4793a60bb6326b35e 100644 (file)
@@ -843,18 +843,29 @@ void MapgenBasic::generateCavesNoiseIntersection(s16 max_stone_y)
 
 void MapgenBasic::generateCavesRandomWalk(s16 max_stone_y, s16 large_cave_depth)
 {
-       if (node_min.Y > max_stone_y || node_max.Y > large_cave_depth)
+       if (node_min.Y > max_stone_y)
                return;
 
        PseudoRandom ps(blockseed + 21343);
-       u32 bruises_count = ps.range(0, 2);
+       // Small randomwalk caves
+       u32 num_small_caves = ps.range(small_cave_num_min, small_cave_num_max);
 
-       for (u32 i = 0; i < bruises_count; i++) {
+       for (u32 i = 0; i < num_small_caves; i++) {
                CavesRandomWalk cave(ndef, &gennotify, seed, water_level,
-                       c_water_source, c_lava_source, lava_depth, biomegen);
+                       c_water_source, c_lava_source, large_cave_flooded, lava_depth, biomegen);
+               cave.makeCave(vm, node_min, node_max, &ps, false, max_stone_y, heightmap);
+       }
+
+       if (node_max.Y > large_cave_depth)
+               return;
+
+       // Large randomwalk caves below 'large_cave_depth'
+       u32 num_large_caves = ps.range(large_cave_num_min, large_cave_num_max);
 
-               cave.makeCave(vm, node_min, node_max, &ps, true, max_stone_y,
-                       heightmap);
+       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);
+               cave.makeCave(vm, node_min, node_max, &ps, true, max_stone_y, heightmap);
        }
 }
 
index f7697cab409a8cddf9d9bcb11777221fcc5071ab..01a55948b43ef39a87b8f0cb253383db00074109 100644 (file)
@@ -280,6 +280,11 @@ protected:
        float cavern_limit;
        float cavern_taper;
        float cavern_threshold;
+       int small_cave_num_min;
+       int small_cave_num_max;
+       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 12ce07da40ceb2d4db6bab5961330ad8c0dc016a..0bf6126eda1952ccc26c785eae53afdeed5034d1 100644 (file)
@@ -58,15 +58,20 @@ MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager
        river_depth      = params->river_depth;
        valley_width     = params->valley_width;
 
-       spflags          = params->spflags;
-       cave_width       = params->cave_width;
-       large_cave_depth = params->large_cave_depth;
-       lava_depth       = params->lava_depth;
-       cavern_limit     = params->cavern_limit;
-       cavern_taper     = params->cavern_taper;
-       cavern_threshold = params->cavern_threshold;
-       dungeon_ymin     = params->dungeon_ymin;
-       dungeon_ymax     = params->dungeon_ymax;
+       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;
+       large_cave_num_max = params->large_cave_num_max;
+       large_cave_flooded = params->large_cave_flooded;
+       cavern_limit       = params->cavern_limit;
+       cavern_taper       = params->cavern_taper;
+       cavern_threshold   = params->cavern_threshold;
+       dungeon_ymin       = params->dungeon_ymin;
+       dungeon_ymax       = params->dungeon_ymax;
 
        grad_wl = 1 - water_level;
 
@@ -148,14 +153,19 @@ void MapgenCarpathianParams::readParams(const Settings *settings)
        settings->getFloatNoEx("mgcarpathian_river_depth",  river_depth);
        settings->getFloatNoEx("mgcarpathian_valley_width", valley_width);
 
-       settings->getFloatNoEx("mgcarpathian_cave_width",       cave_width);
-       settings->getS16NoEx("mgcarpathian_large_cave_depth",   large_cave_depth);
-       settings->getS16NoEx("mgcarpathian_lava_depth",         lava_depth);
-       settings->getS16NoEx("mgcarpathian_cavern_limit",       cavern_limit);
-       settings->getS16NoEx("mgcarpathian_cavern_taper",       cavern_taper);
-       settings->getFloatNoEx("mgcarpathian_cavern_threshold", cavern_threshold);
-       settings->getS16NoEx("mgcarpathian_dungeon_ymin",       dungeon_ymin);
-       settings->getS16NoEx("mgcarpathian_dungeon_ymax",       dungeon_ymax);
+       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);
+       settings->getU16NoEx("mgcarpathian_large_cave_num_max",   large_cave_num_max);
+       settings->getFloatNoEx("mgcarpathian_large_cave_flooded", large_cave_flooded);
+       settings->getS16NoEx("mgcarpathian_cavern_limit",         cavern_limit);
+       settings->getS16NoEx("mgcarpathian_cavern_taper",         cavern_taper);
+       settings->getFloatNoEx("mgcarpathian_cavern_threshold",   cavern_threshold);
+       settings->getS16NoEx("mgcarpathian_dungeon_ymin",         dungeon_ymin);
+       settings->getS16NoEx("mgcarpathian_dungeon_ymax",         dungeon_ymax);
 
        settings->getNoiseParams("mgcarpathian_np_filler_depth",  np_filler_depth);
        settings->getNoiseParams("mgcarpathian_np_height1",       np_height1);
@@ -186,14 +196,19 @@ void MapgenCarpathianParams::writeParams(Settings *settings) const
        settings->setFloat("mgcarpathian_river_depth",  river_depth);
        settings->setFloat("mgcarpathian_valley_width", valley_width);
 
-       settings->setFloat("mgcarpathian_cave_width",       cave_width);
-       settings->setS16("mgcarpathian_large_cave_depth",   large_cave_depth);
-       settings->setS16("mgcarpathian_lava_depth",         lava_depth);
-       settings->setS16("mgcarpathian_cavern_limit",       cavern_limit);
-       settings->setS16("mgcarpathian_cavern_taper",       cavern_taper);
-       settings->setFloat("mgcarpathian_cavern_threshold", cavern_threshold);
-       settings->setS16("mgcarpathian_dungeon_ymin",       dungeon_ymin);
-       settings->setS16("mgcarpathian_dungeon_ymax",       dungeon_ymax);
+       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);
+       settings->setU16("mgcarpathian_large_cave_num_max",   large_cave_num_max);
+       settings->setFloat("mgcarpathian_large_cave_flooded", large_cave_flooded);
+       settings->setS16("mgcarpathian_cavern_limit",         cavern_limit);
+       settings->setS16("mgcarpathian_cavern_taper",         cavern_taper);
+       settings->setFloat("mgcarpathian_cavern_threshold",   cavern_threshold);
+       settings->setS16("mgcarpathian_dungeon_ymin",         dungeon_ymin);
+       settings->setS16("mgcarpathian_dungeon_ymax",         dungeon_ymax);
 
        settings->setNoiseParams("mgcarpathian_np_filler_depth",  np_filler_depth);
        settings->setNoiseParams("mgcarpathian_np_height1",       np_height1);
index 1fbac4bfdc16b8d9453ddc8e02db4797416a842b..f970b85c6e9dd6accaf8ed12f41fb805fa9ab391 100644 (file)
@@ -37,15 +37,20 @@ struct MapgenCarpathianParams : public MapgenParams
        float river_depth      = 24.0f;
        float valley_width     = 0.25f;
 
-       u32 spflags            = MGCARPATHIAN_CAVERNS;
-       float cave_width       = 0.09f;
-       s16 large_cave_depth   = -33;
-       s16 lava_depth         = -256;
-       s16 cavern_limit       = -256;
-       s16 cavern_taper       = 256;
-       float cavern_threshold = 0.7f;
-       s16 dungeon_ymin       = -31000;
-       s16 dungeon_ymax       = 31000;
+       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;
+       u16 large_cave_num_max   = 2;
+       float large_cave_flooded = 0.5f;
+       s16 cavern_limit         = -256;
+       s16 cavern_taper         = 256;
+       float cavern_threshold   = 0.7f;
+       s16 dungeon_ymin         = -31000;
+       s16 dungeon_ymax         = 31000;
 
        NoiseParams np_filler_depth;
        NoiseParams np_height1;
index 773b7b10f188556ce9e0a7cd14c8f35f065caa8f..359182f5a700d13d1a3f2f60aadf8cbeb9b64e17 100644 (file)
@@ -51,17 +51,22 @@ FlagDesc flagdesc_mapgen_flat[] = {
 MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge)
        : MapgenBasic(MAPGEN_FLAT, params, emerge)
 {
-       spflags          = params->spflags;
-       ground_level     = params->ground_level;
-       large_cave_depth = params->large_cave_depth;
-       lava_depth       = params->lava_depth;
-       cave_width       = params->cave_width;
-       lake_threshold   = params->lake_threshold;
-       lake_steepness   = params->lake_steepness;
-       hill_threshold   = params->hill_threshold;
-       hill_steepness   = params->hill_steepness;
-       dungeon_ymin     = params->dungeon_ymin;
-       dungeon_ymax     = params->dungeon_ymax;
+       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;
+       large_cave_num_max = params->large_cave_num_max;
+       large_cave_flooded = params->large_cave_flooded;
+       cave_width         = params->cave_width;
+       lake_threshold     = params->lake_threshold;
+       lake_steepness     = params->lake_steepness;
+       hill_threshold     = params->hill_threshold;
+       hill_steepness     = params->hill_steepness;
+       dungeon_ymin       = params->dungeon_ymin;
+       dungeon_ymax       = params->dungeon_ymax;
 
        // 2D noise
        noise_filler_depth = new Noise(&params->np_filler_depth, seed, csize.X, csize.Z);
@@ -96,17 +101,22 @@ MapgenFlatParams::MapgenFlatParams():
 
 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->getFloatNoEx("mgflat_cave_width",     cave_width);
-       settings->getFloatNoEx("mgflat_lake_threshold", lake_threshold);
-       settings->getFloatNoEx("mgflat_lake_steepness", lake_steepness);
-       settings->getFloatNoEx("mgflat_hill_threshold", hill_threshold);
-       settings->getFloatNoEx("mgflat_hill_steepness", hill_steepness);
-       settings->getS16NoEx("mgflat_dungeon_ymin",     dungeon_ymin);
-       settings->getS16NoEx("mgflat_dungeon_ymax",     dungeon_ymax);
+       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);
+       settings->getU16NoEx("mgflat_large_cave_num_max",   large_cave_num_max);
+       settings->getFloatNoEx("mgflat_large_cave_flooded", large_cave_flooded);
+       settings->getFloatNoEx("mgflat_cave_width",         cave_width);
+       settings->getFloatNoEx("mgflat_lake_threshold",     lake_threshold);
+       settings->getFloatNoEx("mgflat_lake_steepness",     lake_steepness);
+       settings->getFloatNoEx("mgflat_hill_threshold",     hill_threshold);
+       settings->getFloatNoEx("mgflat_hill_steepness",     hill_steepness);
+       settings->getS16NoEx("mgflat_dungeon_ymin",         dungeon_ymin);
+       settings->getS16NoEx("mgflat_dungeon_ymax",         dungeon_ymax);
 
        settings->getNoiseParams("mgflat_np_terrain",      np_terrain);
        settings->getNoiseParams("mgflat_np_filler_depth", np_filler_depth);
@@ -118,17 +128,22 @@ void MapgenFlatParams::readParams(const Settings *settings)
 
 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->setFloat("mgflat_cave_width",     cave_width);
-       settings->setFloat("mgflat_lake_threshold", lake_threshold);
-       settings->setFloat("mgflat_lake_steepness", lake_steepness);
-       settings->setFloat("mgflat_hill_threshold", hill_threshold);
-       settings->setFloat("mgflat_hill_steepness", hill_steepness);
-       settings->setS16("mgflat_dungeon_ymin",     dungeon_ymin);
-       settings->setS16("mgflat_dungeon_ymax",     dungeon_ymax);
+       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);
+       settings->setU16("mgflat_large_cave_num_max",   large_cave_num_max);
+       settings->setFloat("mgflat_large_cave_flooded", large_cave_flooded);
+       settings->setFloat("mgflat_cave_width",         cave_width);
+       settings->setFloat("mgflat_lake_threshold",     lake_threshold);
+       settings->setFloat("mgflat_lake_steepness",     lake_steepness);
+       settings->setFloat("mgflat_hill_threshold",     hill_threshold);
+       settings->setFloat("mgflat_hill_steepness",     hill_steepness);
+       settings->setS16("mgflat_dungeon_ymin",         dungeon_ymin);
+       settings->setS16("mgflat_dungeon_ymax",         dungeon_ymax);
 
        settings->setNoiseParams("mgflat_np_terrain",      np_terrain);
        settings->setNoiseParams("mgflat_np_filler_depth", np_filler_depth);
index d2598695ff1087b780e63598468f7300b0e85625..cd4a106a629fc95915f99dc410ccf20a40abe4fb 100644 (file)
@@ -36,6 +36,11 @@ struct MapgenFlatParams : public MapgenParams
        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;
+       u16 large_cave_num_max = 2;
+       float large_cave_flooded = 0.5f;
        float cave_width = 0.09f;
        float lake_threshold = -0.45f;
        float lake_steepness = 48.0f;
index 091dbacfa28e9044e35d3a7a851d53a5833af657..7615e6350f7fe2dd0daf567fbedac3682a8a5a9f 100644 (file)
@@ -51,21 +51,26 @@ FlagDesc flagdesc_mapgen_fractal[] = {
 MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge)
        : MapgenBasic(MAPGEN_FRACTAL, params, emerge)
 {
-       spflags          = params->spflags;
-       cave_width       = params->cave_width;
-       large_cave_depth = params->large_cave_depth;
-       lava_depth       = params->lava_depth;
-       dungeon_ymin     = params->dungeon_ymin;
-       dungeon_ymax     = params->dungeon_ymax;
-       fractal          = params->fractal;
-       iterations       = params->iterations;
-       scale            = params->scale;
-       offset           = params->offset;
-       slice_w          = params->slice_w;
-       julia_x          = params->julia_x;
-       julia_y          = params->julia_y;
-       julia_z          = params->julia_z;
-       julia_w          = params->julia_w;
+       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;
+       large_cave_num_max = params->large_cave_num_max;
+       large_cave_flooded = params->large_cave_flooded;
+       dungeon_ymin       = params->dungeon_ymin;
+       dungeon_ymax       = params->dungeon_ymax;
+       fractal            = params->fractal;
+       iterations         = params->iterations;
+       scale              = params->scale;
+       offset             = params->offset;
+       slice_w            = params->slice_w;
+       julia_x            = params->julia_x;
+       julia_y            = params->julia_y;
+       julia_z            = params->julia_z;
+       julia_w            = params->julia_w;
 
        //// 2D noise
        if (spflags & MGFRACTAL_TERRAIN)
@@ -105,21 +110,26 @@ MapgenFractalParams::MapgenFractalParams():
 
 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->getS16NoEx("mgfractal_dungeon_ymin",     dungeon_ymin);
-       settings->getS16NoEx("mgfractal_dungeon_ymax",     dungeon_ymax);
-       settings->getU16NoEx("mgfractal_fractal",          fractal);
-       settings->getU16NoEx("mgfractal_iterations",       iterations);
-       settings->getV3FNoEx("mgfractal_scale",            scale);
-       settings->getV3FNoEx("mgfractal_offset",           offset);
-       settings->getFloatNoEx("mgfractal_slice_w",        slice_w);
-       settings->getFloatNoEx("mgfractal_julia_x",        julia_x);
-       settings->getFloatNoEx("mgfractal_julia_y",        julia_y);
-       settings->getFloatNoEx("mgfractal_julia_z",        julia_z);
-       settings->getFloatNoEx("mgfractal_julia_w",        julia_w);
+       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);
+       settings->getU16NoEx("mgfractal_large_cave_num_max",   large_cave_num_max);
+       settings->getFloatNoEx("mgfractal_large_cave_flooded", large_cave_flooded);
+       settings->getS16NoEx("mgfractal_dungeon_ymin",         dungeon_ymin);
+       settings->getS16NoEx("mgfractal_dungeon_ymax",         dungeon_ymax);
+       settings->getU16NoEx("mgfractal_fractal",              fractal);
+       settings->getU16NoEx("mgfractal_iterations",           iterations);
+       settings->getV3FNoEx("mgfractal_scale",                scale);
+       settings->getV3FNoEx("mgfractal_offset",               offset);
+       settings->getFloatNoEx("mgfractal_slice_w",            slice_w);
+       settings->getFloatNoEx("mgfractal_julia_x",            julia_x);
+       settings->getFloatNoEx("mgfractal_julia_y",            julia_y);
+       settings->getFloatNoEx("mgfractal_julia_z",            julia_z);
+       settings->getFloatNoEx("mgfractal_julia_w",            julia_w);
 
        settings->getNoiseParams("mgfractal_np_seabed",       np_seabed);
        settings->getNoiseParams("mgfractal_np_filler_depth", np_filler_depth);
@@ -131,21 +141,26 @@ void MapgenFractalParams::readParams(const Settings *settings)
 
 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->setS16("mgfractal_dungeon_ymin",     dungeon_ymin);
-       settings->setS16("mgfractal_dungeon_ymax",     dungeon_ymax);
-       settings->setU16("mgfractal_fractal",          fractal);
-       settings->setU16("mgfractal_iterations",       iterations);
-       settings->setV3F("mgfractal_scale",            scale);
-       settings->setV3F("mgfractal_offset",           offset);
-       settings->setFloat("mgfractal_slice_w",        slice_w);
-       settings->setFloat("mgfractal_julia_x",        julia_x);
-       settings->setFloat("mgfractal_julia_y",        julia_y);
-       settings->setFloat("mgfractal_julia_z",        julia_z);
-       settings->setFloat("mgfractal_julia_w",        julia_w);
+       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);
+       settings->setU16("mgfractal_large_cave_num_max",   large_cave_num_max);
+       settings->setFloat("mgfractal_large_cave_flooded", large_cave_flooded);
+       settings->setS16("mgfractal_dungeon_ymin",         dungeon_ymin);
+       settings->setS16("mgfractal_dungeon_ymax",         dungeon_ymax);
+       settings->setU16("mgfractal_fractal",              fractal);
+       settings->setU16("mgfractal_iterations",           iterations);
+       settings->setV3F("mgfractal_scale",                scale);
+       settings->setV3F("mgfractal_offset",               offset);
+       settings->setFloat("mgfractal_slice_w",            slice_w);
+       settings->setFloat("mgfractal_julia_x",            julia_x);
+       settings->setFloat("mgfractal_julia_y",            julia_y);
+       settings->setFloat("mgfractal_julia_z",            julia_z);
+       settings->setFloat("mgfractal_julia_w",            julia_w);
 
        settings->setNoiseParams("mgfractal_np_seabed",       np_seabed);
        settings->setNoiseParams("mgfractal_np_filler_depth", np_filler_depth);
index 82622d4d98c39c37fc541123b9ef7ef23881270f..e317f759d7347ba388f171ac43d081ffc8ffee31 100644 (file)
@@ -39,6 +39,11 @@ struct MapgenFractalParams : 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;
+       u16 large_cave_num_max = 2;
+       float large_cave_flooded = 0.5f;
        s16 dungeon_ymin = -31000;
        s16 dungeon_ymax = 31000;
        u16 fractal = 1;
index bf99fd335634a94cc28e5d82fcaf7c7cac5e02fe..5164c5991fa7cf7216c90baaa7a40ac7a52f8553 100644 (file)
@@ -48,15 +48,20 @@ FlagDesc flagdesc_mapgen_v5[] = {
 MapgenV5::MapgenV5(MapgenV5Params *params, EmergeManager *emerge)
        : MapgenBasic(MAPGEN_V5, params, emerge)
 {
-       spflags          = params->spflags;
-       cave_width       = params->cave_width;
-       large_cave_depth = params->large_cave_depth;
-       lava_depth       = params->lava_depth;
-       cavern_limit     = params->cavern_limit;
-       cavern_taper     = params->cavern_taper;
-       cavern_threshold = params->cavern_threshold;
-       dungeon_ymin     = params->dungeon_ymin;
-       dungeon_ymax     = params->dungeon_ymax;
+       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;
+       large_cave_num_max = params->large_cave_num_max;
+       large_cave_flooded = params->large_cave_flooded;
+       cavern_limit       = params->cavern_limit;
+       cavern_taper       = params->cavern_taper;
+       cavern_threshold   = params->cavern_threshold;
+       dungeon_ymin       = params->dungeon_ymin;
+       dungeon_ymax       = params->dungeon_ymax;
 
        // Terrain noise
        noise_filler_depth = new Noise(&params->np_filler_depth, seed, csize.X, csize.Z);
@@ -98,15 +103,20 @@ MapgenV5Params::MapgenV5Params():
 
 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->getS16NoEx("mgv5_cavern_limit",       cavern_limit);
-       settings->getS16NoEx("mgv5_cavern_taper",       cavern_taper);
-       settings->getFloatNoEx("mgv5_cavern_threshold", cavern_threshold);
-       settings->getS16NoEx("mgv5_dungeon_ymin",       dungeon_ymin);
-       settings->getS16NoEx("mgv5_dungeon_ymax",       dungeon_ymax);
+       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);
+       settings->getU16NoEx("mgv5_large_cave_num_max",   large_cave_num_max);
+       settings->getFloatNoEx("mgv5_large_cave_flooded", large_cave_flooded);
+       settings->getS16NoEx("mgv5_cavern_limit",         cavern_limit);
+       settings->getS16NoEx("mgv5_cavern_taper",         cavern_taper);
+       settings->getFloatNoEx("mgv5_cavern_threshold",   cavern_threshold);
+       settings->getS16NoEx("mgv5_dungeon_ymin",         dungeon_ymin);
+       settings->getS16NoEx("mgv5_dungeon_ymax",         dungeon_ymax);
 
        settings->getNoiseParams("mgv5_np_filler_depth", np_filler_depth);
        settings->getNoiseParams("mgv5_np_factor",       np_factor);
@@ -121,15 +131,20 @@ void MapgenV5Params::readParams(const Settings *settings)
 
 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->setS16("mgv5_cavern_limit",       cavern_limit);
-       settings->setS16("mgv5_cavern_taper",       cavern_taper);
-       settings->setFloat("mgv5_cavern_threshold", cavern_threshold);
-       settings->setS16("mgv5_dungeon_ymin",       dungeon_ymin);
-       settings->setS16("mgv5_dungeon_ymax",       dungeon_ymax);
+       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);
+       settings->setU16("mgv5_large_cave_num_max",   large_cave_num_max);
+       settings->setFloat("mgv5_large_cave_flooded", large_cave_flooded);
+       settings->setS16("mgv5_cavern_limit",         cavern_limit);
+       settings->setS16("mgv5_cavern_taper",         cavern_taper);
+       settings->setFloat("mgv5_cavern_threshold",   cavern_threshold);
+       settings->setS16("mgv5_dungeon_ymin",         dungeon_ymin);
+       settings->setS16("mgv5_dungeon_ymax",         dungeon_ymax);
 
        settings->setNoiseParams("mgv5_np_filler_depth", np_filler_depth);
        settings->setNoiseParams("mgv5_np_factor",       np_factor);
index 1a3b6d3c30e738e2bb0a7769bb4e788ebfeff951..249f61121ca4ca0e4a7a86452587e0408115cd86 100644 (file)
@@ -35,6 +35,11 @@ struct MapgenV5Params : public MapgenParams
        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;
+       u16 large_cave_num_max = 2;
+       float large_cave_flooded = 0.5f;
        s16 cavern_limit = -256;
        s16 cavern_taper = 256;
        float cavern_threshold = 0.7f;
index c9568760f2e1caaf02c1216001ecae0292adc39d..eaaff6ac6fad9c2911ed6ec322f3040d63230521 100644 (file)
@@ -62,14 +62,19 @@ MapgenV7::MapgenV7(MapgenV7Params *params, EmergeManager *emerge)
        floatland_level      = params->floatland_level;
        shadow_limit         = params->shadow_limit;
 
-       cave_width           = params->cave_width;
-       large_cave_depth     = params->large_cave_depth;
-       lava_depth           = params->lava_depth;
-       cavern_limit         = params->cavern_limit;
-       cavern_taper         = params->cavern_taper;
-       cavern_threshold     = params->cavern_threshold;
-       dungeon_ymin         = params->dungeon_ymin;
-       dungeon_ymax         = params->dungeon_ymax;
+       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;
+       large_cave_num_max = params->large_cave_num_max;
+       large_cave_flooded = params->large_cave_flooded;
+       cavern_limit       = params->cavern_limit;
+       cavern_taper       = params->cavern_taper;
+       cavern_threshold   = params->cavern_threshold;
+       dungeon_ymin       = params->dungeon_ymin;
+       dungeon_ymax       = params->dungeon_ymax;
 
        // This is to avoid a divide-by-zero.
        // Parameter will be saved to map_meta.txt in limited form.
@@ -173,6 +178,11 @@ void MapgenV7Params::readParams(const Settings *settings)
        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);
+       settings->getU16NoEx("mgv7_large_cave_num_max",     large_cave_num_max);
+       settings->getFloatNoEx("mgv7_large_cave_flooded",   large_cave_flooded);
        settings->getFloatNoEx("mgv7_float_mount_density",  float_mount_density);
        settings->getFloatNoEx("mgv7_float_mount_height",   float_mount_height);
        settings->getFloatNoEx("mgv7_float_mount_exponent", float_mount_exponent);
@@ -209,6 +219,11 @@ void MapgenV7Params::writeParams(Settings *settings) const
        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);
+       settings->setU16("mgv7_large_cave_num_max",     large_cave_num_max);
+       settings->setFloat("mgv7_large_cave_flooded",   large_cave_flooded);
        settings->setFloat("mgv7_float_mount_density",  float_mount_density);
        settings->setFloat("mgv7_float_mount_height",   float_mount_height);
        settings->setFloat("mgv7_float_mount_exponent", float_mount_exponent);
index 50039b16aad24067e9127d9954e28ce74d2d122a..8aeb2652e6bae76ef1d16490710f5ec83ce47e46 100644 (file)
@@ -46,6 +46,11 @@ 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;
+       u16 large_cave_num_max = 2;
+       float large_cave_flooded = 0.5f;
        s16 cavern_limit = -256;
        s16 cavern_taper = 256;
        float cavern_threshold = 0.7f;
index d0b36f29b98cbacc7b13e6395618ad3575caf915..413967cbd1e0e74bf1e048ae3e26977a81e5a8a7 100644 (file)
@@ -68,6 +68,11 @@ 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;
+       large_cave_num_max = params->large_cave_num_max;
+       large_cave_flooded = params->large_cave_flooded;
        cavern_limit       = params->cavern_limit;
        cavern_taper       = params->cavern_taper;
        cavern_threshold   = params->cavern_threshold;
@@ -124,18 +129,23 @@ MapgenValleysParams::MapgenValleysParams():
 
 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_river_depth",        river_depth);
-       settings->getU16NoEx("mgvalleys_river_size",         river_size);
-       settings->getFloatNoEx("mgvalleys_cave_width",       cave_width);
-       settings->getS16NoEx("mgvalleys_cavern_limit",       cavern_limit);
-       settings->getS16NoEx("mgvalleys_cavern_taper",       cavern_taper);
-       settings->getFloatNoEx("mgvalleys_cavern_threshold", cavern_threshold);
-       settings->getS16NoEx("mgvalleys_dungeon_ymin",       dungeon_ymin);
-       settings->getS16NoEx("mgvalleys_dungeon_ymax",       dungeon_ymax);
+       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);
+       settings->getU16NoEx("mgvalleys_large_cave_num_max",   large_cave_num_max);
+       settings->getFloatNoEx("mgvalleys_large_cave_flooded", large_cave_flooded);
+       settings->getU16NoEx("mgvalleys_river_depth",          river_depth);
+       settings->getU16NoEx("mgvalleys_river_size",           river_size);
+       settings->getFloatNoEx("mgvalleys_cave_width",         cave_width);
+       settings->getS16NoEx("mgvalleys_cavern_limit",         cavern_limit);
+       settings->getS16NoEx("mgvalleys_cavern_taper",         cavern_taper);
+       settings->getFloatNoEx("mgvalleys_cavern_threshold",   cavern_threshold);
+       settings->getS16NoEx("mgvalleys_dungeon_ymin",         dungeon_ymin);
+       settings->getS16NoEx("mgvalleys_dungeon_ymax",         dungeon_ymax);
 
        settings->getNoiseParams("mgvalleys_np_filler_depth",       np_filler_depth);
        settings->getNoiseParams("mgvalleys_np_inter_valley_fill",  np_inter_valley_fill);
@@ -154,18 +164,23 @@ void MapgenValleysParams::readParams(const Settings *settings)
 
 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_river_depth",        river_depth);
-       settings->setU16("mgvalleys_river_size",         river_size);
-       settings->setFloat("mgvalleys_cave_width",       cave_width);
-       settings->setS16("mgvalleys_cavern_limit",       cavern_limit);
-       settings->setS16("mgvalleys_cavern_taper",       cavern_taper);
-       settings->setFloat("mgvalleys_cavern_threshold", cavern_threshold);
-       settings->setS16("mgvalleys_dungeon_ymin",       dungeon_ymin);
-       settings->setS16("mgvalleys_dungeon_ymax",       dungeon_ymax);
+       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);
+       settings->setU16("mgvalleys_large_cave_num_max",   large_cave_num_max);
+       settings->setFloat("mgvalleys_large_cave_flooded", large_cave_flooded);
+       settings->setU16("mgvalleys_river_depth",          river_depth);
+       settings->setU16("mgvalleys_river_size",           river_size);
+       settings->setFloat("mgvalleys_cave_width",         cave_width);
+       settings->setS16("mgvalleys_cavern_limit",         cavern_limit);
+       settings->setS16("mgvalleys_cavern_taper",         cavern_taper);
+       settings->setFloat("mgvalleys_cavern_threshold",   cavern_threshold);
+       settings->setS16("mgvalleys_dungeon_ymin",         dungeon_ymin);
+       settings->setS16("mgvalleys_dungeon_ymax",         dungeon_ymax);
 
        settings->setNoiseParams("mgvalleys_np_filler_depth",       np_filler_depth);
        settings->setNoiseParams("mgvalleys_np_inter_valley_fill",  np_inter_valley_fill);
index ab80dc5c9466b5d76de9fc6e3934af6596a99642..945621ab48247801dc85c83974c38b27c527d7cc 100644 (file)
@@ -50,6 +50,11 @@ 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;
+       u16 large_cave_num_max = 2;
+       float large_cave_flooded = 0.5f;
        s16 cavern_limit = -256;
        s16 cavern_taper = 192;
        float cavern_threshold = 0.6f;