Dungeons: Add Y limits in all mapgens
authorparamat <paramat@users.noreply.github.com>
Sat, 17 Feb 2018 17:43:13 +0000 (17:43 +0000)
committerparamat <mat.gregory@virginmedia.com>
Tue, 20 Feb 2018 15:25:37 +0000 (15:25 +0000)
Preserve the upper limit used in mgvalleys.

15 files changed:
builtin/settingtypes.txt
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_v6.cpp
src/mapgen/mapgen_v6.h
src/mapgen/mapgen_v7.cpp
src/mapgen/mapgen_v7.h
src/mapgen/mapgen_valleys.cpp
src/mapgen/mapgen_valleys.h

index c515b19ed20ad3dacd83732110f21292b219df3c..ed7e6c6b11b0c33f9e6e0537635f090663f31761 100644 (file)
@@ -1323,6 +1323,12 @@ mgv5_cavern_taper (Cavern taper) int 256
 #    Defines full size of caverns, smaller values create larger caverns.
 mgv5_cavern_threshold (Cavern threshold) float 0.7
 
+#    Lower Y limit of dungeons.
+mgv5_dungeon_ymin (Dungeon minimum Y) int -31000
+
+#    Upper Y limit of dungeons.
+mgv5_dungeon_ymax (Dungeon maximum Y) int 31000
+
 [**Noises]
 
 #    Variation of biome filler depth.
@@ -1364,6 +1370,12 @@ mgv6_freq_desert (Desert noise threshold) float 0.45
 #    Sandy beaches occur when np_beach exceeds this value.
 mgv6_freq_beach (Beach noise threshold) float 0.15
 
+#    Lower Y limit of dungeons.
+mgv6_dungeon_ymin (Dungeon minimum Y) int -31000
+
+#    Upper Y limit of dungeons.
+mgv6_dungeon_ymax (Dungeon maximum Y) int 31000
+
 [**Noises]
 
 #    Y-level of lower terrain and lakebeds.
@@ -1444,6 +1456,12 @@ mgv7_cavern_taper (Cavern taper) int 256
 #    Defines full size of caverns, smaller values create larger caverns.
 mgv7_cavern_threshold (Cavern threshold) float 0.7
 
+#    Lower Y limit of dungeons.
+mgv7_dungeon_ymin (Dungeon minimum Y) int -31000
+
+#    Upper Y limit of dungeons.
+mgv7_dungeon_ymax (Dungeon maximum Y) int 31000
+
 [**Noises]
 
 #    Y-level of higher (cliff-top) terrain.
@@ -1516,6 +1534,12 @@ mgcarpathian_cavern_taper (Cavern taper) int 256
 #    Defines full size of caverns, smaller values create larger caverns.
 mgcarpathian_cavern_threshold (Cavern threshold) float 0.7
 
+#    Lower Y limit of dungeons.
+mgcarpathian_dungeon_ymin (Dungeon minimum Y) int -31000
+
+#    Upper Y limit of dungeons.
+mgcarpathian_dungeon_ymax (Dungeon maximum Y) int 31000
+
 [**Noises]
 
 #    2D noise that defines the base ground level.
@@ -1602,6 +1626,12 @@ mgflat_hill_threshold (Hill threshold) float 0.45
 #    Controls steepness/height of hills.
 mgflat_hill_steepness (Hill steepness) float 64.0
 
+#    Lower Y limit of dungeons.
+mgflat_dungeon_ymin (Dungeon minimum Y) int -31000
+
+#    Upper Y limit of dungeons.
+mgflat_dungeon_ymax (Dungeon maximum Y) int 31000
+
 [**Noises]
 
 #    Defines location and terrain of optional hills and lakes.
@@ -1627,6 +1657,12 @@ 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
 
+#    Lower Y limit of dungeons.
+mgfractal_dungeon_ymin (Dungeon minimum Y) int -31000
+
+#    Upper Y limit of dungeons.
+mgfractal_dungeon_ymax (Dungeon maximum Y) int 31000
+
 #    Choice of 18 fractals from 9 formulas.
 #    1 = 4D "Roundy" mandelbrot set.
 #    2 = 4D "Roundy" julia set.
@@ -1734,6 +1770,12 @@ mgvalleys_water_features (Water features) int 0
 #    Controls width of tunnels, a smaller value creates wider tunnels.
 mgvalleys_cave_width (Cave width) float 0.09
 
+#    Lower Y limit of dungeons.
+mgvalleys_dungeon_ymin (Dungeon minimum Y) int -31000
+
+#    Upper Y limit of dungeons.
+mgvalleys_dungeon_ymax (Dungeon maximum Y) int 31000
+
 [**Noises]
 
 # Caves and tunnels form at the intersection of the two noises
index dd751d9cf830797370867a4177fb131a1189cb7d..1a2456ae999a5c3e37e6de60f514419fd408f1e3 100644 (file)
@@ -61,7 +61,10 @@ MapgenCarpathian::MapgenCarpathian(
        cavern_limit     = params->cavern_limit;
        cavern_taper     = params->cavern_taper;
        cavern_threshold = params->cavern_threshold;
-       grad_wl          = 1 - water_level;
+       dungeon_ymin     = params->dungeon_ymin;
+       dungeon_ymax     = params->dungeon_ymax;
+
+       grad_wl = 1 - water_level;
 
        //// 2D Terrain noise
        noise_base          = new Noise(&params->np_base,          seed, csize.X, csize.Z);
@@ -136,6 +139,8 @@ void MapgenCarpathianParams::readParams(const Settings *settings)
        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_base",          np_base);
        settings->getNoiseParams("mgcarpathian_np_filler_depth",  np_filler_depth);
@@ -165,6 +170,8 @@ void MapgenCarpathianParams::writeParams(Settings *settings) const
        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_base",          np_base);
        settings->setNoiseParams("mgcarpathian_np_filler_depth",  np_filler_depth);
@@ -264,7 +271,8 @@ void MapgenCarpathian::makeChunk(BlockMakeData *data)
        }
 
        // Generate dungeons
-       if (flags & MG_DUNGEONS)
+       if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
+                       full_node_max.Y <= dungeon_ymax)
                generateDungeons(stone_surface_max_y, mgstone_type, biome_stone);
 
        // Generate the registered decorations
index 0ca46d18aedebe93b626f051a98e74b47d708239..ac63eca4a2dfbe716247cb1c971c3cfb6c182371 100644 (file)
@@ -40,6 +40,8 @@ struct MapgenCarpathianParams : public MapgenParams
        s16 cavern_limit       = -256;
        s16 cavern_taper       = 256;
        float cavern_threshold = 0.7f;
+       s16 dungeon_ymin       = -31000;
+       s16 dungeon_ymax       = 31000;
 
        NoiseParams np_base;
        NoiseParams np_filler_depth;
@@ -83,6 +85,8 @@ public:
 private:
        s16 large_cave_depth;
        s32 grad_wl;
+       s16 dungeon_ymin;
+       s16 dungeon_ymax;
 
        Noise *noise_base;
        Noise *noise_height1;
index 32f39fd34760eab9c343dd1753001a201e92c345..1de87df8723bce6fdac1de7f0a9bdfe3a6969c6d 100644 (file)
@@ -60,6 +60,8 @@ MapgenFlat::MapgenFlat(int mapgenid, MapgenFlatParams *params, EmergeManager *em
        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);
@@ -101,6 +103,8 @@ void MapgenFlatParams::readParams(const Settings *settings)
        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);
@@ -120,6 +124,8 @@ void MapgenFlatParams::writeParams(Settings *settings) const
        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);
@@ -198,7 +204,8 @@ void MapgenFlat::makeChunk(BlockMakeData *data)
        if (flags & MG_CAVES)
                generateCaves(stone_surface_max_y, large_cave_depth);
 
-       if (flags & MG_DUNGEONS)
+       if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
+                       full_node_max.Y <= dungeon_ymax)
                generateDungeons(stone_surface_max_y, mgstone_type, biome_stone);
 
        // Generate the registered decorations
index ad7c149a3b53fd436e93c3f8a7528f77ad7f77f0..d8ec9f12678c84c48ab2609de21be913551b42bc 100644 (file)
@@ -41,6 +41,9 @@ struct MapgenFlatParams : public MapgenParams
        float lake_steepness = 48.0f;
        float hill_threshold = 0.45f;
        float hill_steepness = 64.0f;
+       s16 dungeon_ymin = -31000;
+       s16 dungeon_ymax = 31000;
+
        NoiseParams np_terrain;
        NoiseParams np_filler_depth;
        NoiseParams np_cave1;
@@ -72,5 +75,8 @@ private:
        float lake_steepness;
        float hill_threshold;
        float hill_steepness;
+       s16 dungeon_ymin;
+       s16 dungeon_ymax;
+
        Noise *noise_terrain;
 };
index a6f3ef7b78dcd6399dbccfae2ec4149ba803fed2..d0c670acc1a7d1bbfd6eec9f48dc964219d2d20d 100644 (file)
@@ -53,6 +53,8 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenFractalParams *params, EmergeMa
        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;
@@ -97,6 +99,8 @@ void MapgenFractalParams::readParams(const Settings *settings)
        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);
@@ -120,6 +124,8 @@ void MapgenFractalParams::writeParams(Settings *settings) const
        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);
@@ -208,7 +214,8 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
        if (flags & MG_CAVES)
                generateCaves(stone_surface_max_y, large_cave_depth);
 
-       if (flags & MG_DUNGEONS)
+       if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
+                       full_node_max.Y <= dungeon_ymax)
                generateDungeons(stone_surface_max_y, mgstone_type, biome_stone);
 
        // Generate the registered decorations
index d016029bae9067d096f1ab00e0aa4d0afb2796a5..5a1948b9ab128d59a550511310d995e6732067a2 100644 (file)
@@ -35,6 +35,8 @@ struct MapgenFractalParams : public MapgenParams
        float cave_width = 0.09f;
        s16 large_cave_depth = -33;
        s16 lava_depth = -256;
+       s16 dungeon_ymin = -31000;
+       s16 dungeon_ymax = 31000;
        u16 fractal = 1;
        u16 iterations = 11;
        v3f scale = v3f(4096.0, 1024.0, 4096.0);
@@ -44,6 +46,7 @@ struct MapgenFractalParams : public MapgenParams
        float julia_y = 0.2f;
        float julia_z = 0.133f;
        float julia_w = 0.067f;
+
        NoiseParams np_seabed;
        NoiseParams np_filler_depth;
        NoiseParams np_cave1;
@@ -74,6 +77,8 @@ private:
        bool julia;
 
        s16 large_cave_depth;
+       s16 dungeon_ymin;
+       s16 dungeon_ymax;
        u16 fractal;
        u16 iterations;
        v3f scale;
index 89c65cc207cbae750b164118a79846748e496fca..2e788e8f1e79166acbefdb9fecce43bf465ec55c 100644 (file)
@@ -55,6 +55,8 @@ MapgenV5::MapgenV5(int mapgenid, MapgenV5Params *params, EmergeManager *emerge)
        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);
@@ -101,6 +103,8 @@ void MapgenV5Params::readParams(const Settings *settings)
        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,6 +125,8 @@ void MapgenV5Params::writeParams(Settings *settings) const
        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);
@@ -223,7 +229,8 @@ void MapgenV5::makeChunk(BlockMakeData *data)
        }
 
        // Generate dungeons and desert temples
-       if (flags & MG_DUNGEONS)
+       if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
+                       full_node_max.Y <= dungeon_ymax)
                generateDungeons(stone_surface_max_y, mgstone_type, biome_stone);
 
        // Generate the registered decorations
index e917d7deb31aa70a7d14a063d38ecba318fbcf9d..f3b2f5d440b1c9dcf2c9000bb6d379bdf59c6baa 100644 (file)
@@ -38,6 +38,8 @@ struct MapgenV5Params : public MapgenParams
        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_factor;
@@ -68,6 +70,9 @@ public:
 
 private:
        s16 large_cave_depth;
+       s16 dungeon_ymin;
+       s16 dungeon_ymax;
+
        Noise *noise_factor;
        Noise *noise_height;
        Noise *noise_ground;
index 92f131dcdc726d3a5187da28754b648a6a51a4b9..43c6f36654f3ed7eec3003aa784f915a1c5ef1f3 100644 (file)
@@ -63,9 +63,11 @@ MapgenV6::MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge)
 
        heightmap = new s16[csize.X * csize.Z];
 
-       spflags     = params->spflags;
-       freq_desert = params->freq_desert;
-       freq_beach  = params->freq_beach;
+       spflags      = params->spflags;
+       freq_desert  = params->freq_desert;
+       freq_beach   = params->freq_beach;
+       dungeon_ymin = params->dungeon_ymin;
+       dungeon_ymax = params->dungeon_ymax;
 
        np_cave        = &params->np_cave;
        np_humidity    = &params->np_humidity;
@@ -166,6 +168,8 @@ void MapgenV6Params::readParams(const Settings *settings)
        settings->getFlagStrNoEx("mgv6_spflags", spflags, flagdesc_mapgen_v6);
        settings->getFloatNoEx("mgv6_freq_desert", freq_desert);
        settings->getFloatNoEx("mgv6_freq_beach",  freq_beach);
+       settings->getS16NoEx("mgv6_dungeon_ymin",  dungeon_ymin);
+       settings->getS16NoEx("mgv6_dungeon_ymax",  dungeon_ymax);
 
        settings->getNoiseParams("mgv6_np_terrain_base",   np_terrain_base);
        settings->getNoiseParams("mgv6_np_terrain_higher", np_terrain_higher);
@@ -186,6 +190,8 @@ void MapgenV6Params::writeParams(Settings *settings) const
        settings->setFlagStr("mgv6_spflags", spflags, flagdesc_mapgen_v6, U32_MAX);
        settings->setFloat("mgv6_freq_desert", freq_desert);
        settings->setFloat("mgv6_freq_beach",  freq_beach);
+       settings->setS16("mgv6_dungeon_ymin",  dungeon_ymin);
+       settings->setS16("mgv6_dungeon_ymax",  dungeon_ymax);
 
        settings->setNoiseParams("mgv6_np_terrain_base",   np_terrain_base);
        settings->setNoiseParams("mgv6_np_terrain_higher", np_terrain_higher);
@@ -553,7 +559,8 @@ void MapgenV6::makeChunk(BlockMakeData *data)
        updateHeightmap(node_min, node_max);
 
        // Add dungeons
-       if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
+       if ((flags & MG_DUNGEONS) && stone_surface_max_y >= node_min.Y &&
+                       full_node_min.Y >= dungeon_ymin && full_node_max.Y <= dungeon_ymax) {
                DungeonParams dp;
 
                dp.seed             = seed;
index a7e566816c79811a44814432dac38ab81fba9d4d..056281f2fcaed1a4249b3fce69d5f318333be587 100644 (file)
@@ -59,6 +59,9 @@ struct MapgenV6Params : public MapgenParams {
                MGV6_BIOMEBLEND | MGV6_MUDFLOW;
        float freq_desert = 0.45f;
        float freq_beach = 0.15f;
+       s16 dungeon_ymin = -31000;
+       s16 dungeon_ymax = 31000;
+
        NoiseParams np_terrain_base;
        NoiseParams np_terrain_higher;
        NoiseParams np_steepness;
@@ -104,8 +107,11 @@ public:
        NoiseParams *np_humidity;
        NoiseParams *np_trees;
        NoiseParams *np_apple_trees;
+
        float freq_desert;
        float freq_beach;
+       s16 dungeon_ymin;
+       s16 dungeon_ymax;
 
        content_t c_stone;
        content_t c_dirt;
index 57bf4ac06fa852c258dd76003134924c1b03a26d..252469457a124b783a8c0221c1ff5aa48d65f6fc 100644 (file)
@@ -66,6 +66,8 @@ MapgenV7::MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge)
        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.
@@ -162,6 +164,8 @@ void MapgenV7Params::readParams(const Settings *settings)
        settings->getS16NoEx("mgv7_cavern_limit",           cavern_limit);
        settings->getS16NoEx("mgv7_cavern_taper",           cavern_taper);
        settings->getFloatNoEx("mgv7_cavern_threshold",     cavern_threshold);
+       settings->getS16NoEx("mgv7_dungeon_ymin",           dungeon_ymin);
+       settings->getS16NoEx("mgv7_dungeon_ymax",           dungeon_ymax);
 
        settings->getNoiseParams("mgv7_np_terrain_base",      np_terrain_base);
        settings->getNoiseParams("mgv7_np_terrain_alt",       np_terrain_alt);
@@ -195,6 +199,8 @@ void MapgenV7Params::writeParams(Settings *settings) const
        settings->setS16("mgv7_cavern_limit",           cavern_limit);
        settings->setS16("mgv7_cavern_taper",           cavern_taper);
        settings->setFloat("mgv7_cavern_threshold",     cavern_threshold);
+       settings->setS16("mgv7_dungeon_ymin",           dungeon_ymin);
+       settings->setS16("mgv7_dungeon_ymax",           dungeon_ymax);
 
        settings->setNoiseParams("mgv7_np_terrain_base",      np_terrain_base);
        settings->setNoiseParams("mgv7_np_terrain_alt",       np_terrain_alt);
@@ -327,7 +333,8 @@ void MapgenV7::makeChunk(BlockMakeData *data)
        }
 
        // Generate dungeons
-       if (flags & MG_DUNGEONS)
+       if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
+                       full_node_max.Y <= dungeon_ymax)
                generateDungeons(stone_surface_max_y, mgstone_type, biome_stone);
 
        // Generate the registered decorations
index 5c99b8aaa5e9dda056d940049b3652fcb8bc9718..301cbdbec3b95b10f2ace2866568c547f48f61fc 100644 (file)
@@ -48,6 +48,8 @@ struct MapgenV7Params : public MapgenParams {
        s16 cavern_limit = -256;
        s16 cavern_taper = 256;
        float cavern_threshold = 0.7f;
+       s16 dungeon_ymin = -31000;
+       s16 dungeon_ymax = 31000;
 
        NoiseParams np_terrain_base;
        NoiseParams np_terrain_alt;
@@ -99,6 +101,8 @@ private:
        float float_mount_exponent;
        s16 floatland_level;
        s16 shadow_limit;
+       s16 dungeon_ymin;
+       s16 dungeon_ymax;
 
        Noise *noise_terrain_base;
        Noise *noise_terrain_alt;
index 0a5e014ef4719481cd9cc4c6e170be0aed623e31..1705dce1ce3145e6b48803a1705eaac0e58652a0 100644 (file)
@@ -78,6 +78,8 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenValleysParams *params, EmergeMa
        river_size_factor  = params->river_size / 100.f;
        water_features_lim = rangelim(params->water_features, 0, 10);
        cave_width         = params->cave_width;
+       dungeon_ymin       = params->dungeon_ymin;
+       dungeon_ymax       = params->dungeon_ymax;
 
        //// 2D Terrain noise
        noise_filler_depth       = new Noise(&params->np_filler_depth,       seed, csize.X, csize.Z);
@@ -150,6 +152,8 @@ void MapgenValleysParams::readParams(const Settings *settings)
        settings->getU16NoEx("mgvalleys_river_size",         river_size);
        settings->getU16NoEx("mgvalleys_water_features",     water_features);
        settings->getFloatNoEx("mgvalleys_cave_width",       cave_width);
+       settings->getS16NoEx("mgvalleys_dungeon_ymin",       dungeon_ymin);
+       settings->getS16NoEx("mgvalleys_dungeon_ymax",       dungeon_ymax);
 
        settings->getNoiseParams("mgvalleys_np_cave1",              np_cave1);
        settings->getNoiseParams("mgvalleys_np_cave2",              np_cave2);
@@ -175,6 +179,8 @@ void MapgenValleysParams::writeParams(Settings *settings) const
        settings->setU16("mgvalleys_river_size",         river_size);
        settings->setU16("mgvalleys_water_features",     water_features);
        settings->setFloat("mgvalleys_cave_width",       cave_width);
+       settings->setS16("mgvalleys_dungeon_ymin",       dungeon_ymin);
+       settings->setS16("mgvalleys_dungeon_ymax",       dungeon_ymax);
 
        settings->setNoiseParams("mgvalleys_np_cave1",              np_cave1);
        settings->setNoiseParams("mgvalleys_np_cave2",              np_cave2);
@@ -244,7 +250,8 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
                generateCaves(stone_surface_max_y, large_cave_depth);
 
        // Dungeon creation
-       if ((flags & MG_DUNGEONS) && node_max.Y < 50)
+       if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
+                       full_node_max.Y <= dungeon_ymax)
                generateDungeons(stone_surface_max_y, mgstone_type, biome_stone);
 
        // Generate the registered decorations
index 9d0e3fd19c673762099b84f28522ce72dbb91f23..b44439030b73db6d236108699555ff965a37821b 100644 (file)
@@ -54,6 +54,9 @@ struct MapgenValleysParams : public MapgenParams {
        u16 river_size = 5; // How wide to make rivers.
        u16 water_features = 0; // How often water will occur in caves.
        float cave_width = 0.09f;
+       s16 dungeon_ymin = -31000;
+       s16 dungeon_ymax = 63; // No higher than surface mapchunks
+
        NoiseParams np_cave1;
        NoiseParams np_cave2;
        NoiseParams np_filler_depth;
@@ -99,19 +102,22 @@ public:
 private:
        BiomeGenOriginal *m_bgen;
 
+       float altitude_chill;
+       s16 massive_cave_depth;
+       s16 dungeon_ymin;
+       s16 dungeon_ymax;
+
        bool humid_rivers;
        bool use_altitude_chill;
        float humidity_adjust;
        s16 cave_water_max_height;
        s16 lava_max_height;
-
-       float altitude_chill;
        s16 lava_features_lim;
-       s16 massive_cave_depth;
        float river_depth_bed;
        float river_size_factor;
        float *tcave_cache;
        s16 water_features_lim;
+
        Noise *noise_inter_valley_fill;
        Noise *noise_inter_valley_slope;
        Noise *noise_rivers;