aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen/mapgen_fractal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapgen/mapgen_fractal.cpp')
-rw-r--r--src/mapgen/mapgen_fractal.cpp116
1 files changed, 66 insertions, 50 deletions
diff --git a/src/mapgen/mapgen_fractal.cpp b/src/mapgen/mapgen_fractal.cpp
index 091dbacfa..96febb4f4 100644
--- a/src/mapgen/mapgen_fractal.cpp
+++ b/src/mapgen/mapgen_fractal.cpp
@@ -51,21 +51,25 @@ 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;
+ 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)
@@ -86,9 +90,7 @@ MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge)
MapgenFractal::~MapgenFractal()
{
- if (noise_seabed)
- delete noise_seabed;
-
+ delete noise_seabed;
delete noise_filler_depth;
}
@@ -105,21 +107,25 @@ 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->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 +137,25 @@ 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);
+ settings->setFloat("mgfractal_cave_width", cave_width);
+ settings->setS16("mgfractal_large_cave_depth", large_cave_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);
@@ -155,6 +165,13 @@ void MapgenFractalParams::writeParams(Settings *settings) const
}
+void MapgenFractalParams::setDefaultSettings(Settings *settings)
+{
+ settings->setDefault("mgfractal_spflags", flagdesc_mapgen_fractal,
+ MGFRACTAL_TERRAIN);
+}
+
+
/////////////////////////////////////////////////////////////////
@@ -237,8 +254,7 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
// Generate dungeons
- if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
- full_node_max.Y <= dungeon_ymax)
+ if (flags & MG_DUNGEONS)
generateDungeons(stone_surface_max_y);
// Generate the registered decorations