aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mapgen_flat.cpp37
-rw-r--r--src/mapgen_flat.h7
-rw-r--r--src/mapgen_fractal.cpp103
-rw-r--r--src/mapgen_fractal.h8
-rw-r--r--src/mapgen_v5.cpp15
-rw-r--r--src/mapgen_v5.h4
-rw-r--r--src/mapgen_v7.cpp15
-rw-r--r--src/mapgen_v7.h4
-rw-r--r--src/mapgen_valleys.cpp120
-rw-r--r--src/mapgen_valleys.h39
10 files changed, 178 insertions, 174 deletions
diff --git a/src/mapgen_flat.cpp b/src/mapgen_flat.cpp
index 0c243842e..4669f1716 100644
--- a/src/mapgen_flat.cpp
+++ b/src/mapgen_flat.cpp
@@ -67,14 +67,15 @@ MapgenFlat::MapgenFlat(int mapgenid, MapgenParams *params, EmergeManager *emerge
this->humidmap = NULL;
MapgenFlatParams *sp = (MapgenFlatParams *)params->sparams;
- this->spflags = sp->spflags;
- this->ground_level = sp->ground_level;
+ this->spflags = sp->spflags;
+ this->ground_level = sp->ground_level;
this->large_cave_depth = sp->large_cave_depth;
- this->lake_threshold = sp->lake_threshold;
- this->lake_steepness = sp->lake_steepness;
- this->hill_threshold = sp->hill_threshold;
- this->hill_steepness = sp->hill_steepness;
+ this->cave_width = sp->cave_width;
+ this->lake_threshold = sp->lake_threshold;
+ this->lake_steepness = sp->lake_steepness;
+ this->hill_threshold = sp->hill_threshold;
+ this->hill_steepness = sp->hill_steepness;
//// 2D noise
noise_terrain = new Noise(&sp->np_terrain, seed, csize.X, csize.Z);
@@ -139,14 +140,14 @@ MapgenFlat::~MapgenFlat()
MapgenFlatParams::MapgenFlatParams()
{
- spflags = 0;
-
- ground_level = 8;
+ spflags = 0;
+ ground_level = 8;
large_cave_depth = -33;
- lake_threshold = -0.45;
- lake_steepness = 48.0;
- hill_threshold = 0.45;
- hill_steepness = 64.0;
+ cave_width = 0.3;
+ lake_threshold = -0.45;
+ lake_steepness = 48.0;
+ hill_threshold = 0.45;
+ hill_steepness = 64.0;
np_terrain = NoiseParams(0, 1, v3f(600, 600, 600), 7244, 5, 0.6, 2.0);
np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0);
@@ -157,10 +158,10 @@ MapgenFlatParams::MapgenFlatParams()
void MapgenFlatParams::readParams(const Settings *settings)
{
- settings->getFlagStrNoEx("mgflat_spflags", spflags, flagdesc_mapgen_flat);
-
+ 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->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);
@@ -175,10 +176,10 @@ void MapgenFlatParams::readParams(const Settings *settings)
void MapgenFlatParams::writeParams(Settings *settings) const
{
- settings->setFlagStr("mgflat_spflags", spflags, flagdesc_mapgen_flat, U32_MAX);
-
+ 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->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);
@@ -592,7 +593,7 @@ void MapgenFlat::generateCaves(s16 max_stone_y)
float d1 = contour(noise_cave1->result[index3d]);
float d2 = contour(noise_cave2->result[index3d]);
- if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
+ if (d1 * d2 > cave_width && ndef->get(c).is_ground_content) {
// In tunnel and ground content, excavate
vm->m_data[vi] = MapNode(CONTENT_AIR);
is_tunnel = true;
diff --git a/src/mapgen_flat.h b/src/mapgen_flat.h
index 8ddfe708f..8aed09be5 100644
--- a/src/mapgen_flat.h
+++ b/src/mapgen_flat.h
@@ -34,14 +34,13 @@ extern FlagDesc flagdesc_mapgen_flat[];
struct MapgenFlatParams : public MapgenSpecificParams {
u32 spflags;
-
s16 ground_level;
s16 large_cave_depth;
+ float cave_width;
float lake_threshold;
float lake_steepness;
float hill_threshold;
float hill_steepness;
-
NoiseParams np_terrain;
NoiseParams np_filler_depth;
NoiseParams np_cave1;
@@ -61,20 +60,20 @@ public:
int ystride;
int zstride_1d;
- u32 spflags;
v3s16 node_min;
v3s16 node_max;
v3s16 full_node_min;
v3s16 full_node_max;
+ u32 spflags;
s16 ground_level;
s16 large_cave_depth;
+ float cave_width;
float lake_threshold;
float lake_steepness;
float hill_threshold;
float hill_steepness;
-
Noise *noise_terrain;
Noise *noise_filler_depth;
Noise *noise_cave1;
diff --git a/src/mapgen_fractal.cpp b/src/mapgen_fractal.cpp
index d75d1149e..e2e29f875 100644
--- a/src/mapgen_fractal.cpp
+++ b/src/mapgen_fractal.cpp
@@ -65,21 +65,18 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
this->humidmap = NULL;
MapgenFractalParams *sp = (MapgenFractalParams *)params->sparams;
- this->spflags = sp->spflags;
+ this->spflags = sp->spflags;
+ this->cave_width = sp->cave_width;
this->fractal = sp->fractal;
this->iterations = sp->iterations;
this->scale = sp->scale;
this->offset = sp->offset;
this->slice_w = sp->slice_w;
-
- this->julia_x = sp->julia_x;
- this->julia_y = sp->julia_y;
- this->julia_z = sp->julia_z;
- this->julia_w = sp->julia_w;
-
- this->formula = fractal / 2 + fractal % 2;
- this->julia = fractal % 2 == 0;
+ this->julia_x = sp->julia_x;
+ this->julia_y = sp->julia_y;
+ this->julia_z = sp->julia_z;
+ this->julia_w = sp->julia_w;
//// 2D terrain noise
noise_seabed = new Noise(&sp->np_seabed, seed, csize.X, csize.Z);
@@ -96,6 +93,9 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
noise_heat_blend = new Noise(&params->np_biome_heat_blend, seed, csize.X, csize.Z);
noise_humidity_blend = new Noise(&params->np_biome_humidity_blend, seed, csize.X, csize.Z);
+ this->formula = fractal / 2 + fractal % 2;
+ this->julia = fractal % 2 == 0;
+
//// Resolve nodes to be used
INodeDefManager *ndef = emerge->ndef;
@@ -144,18 +144,17 @@ MapgenFractal::~MapgenFractal()
MapgenFractalParams::MapgenFractalParams()
{
- spflags = 0;
-
- fractal = 1;
+ spflags = 0;
+ cave_width = 0.3;
+ fractal = 1;
iterations = 11;
- scale = v3f(4096.0, 1024.0, 4096.0);
- offset = v3f(1.79, 0.0, 0.0);
- slice_w = 0.0;
-
- julia_x = 0.33;
- julia_y = 0.33;
- julia_z = 0.33;
- julia_w = 0.33;
+ scale = v3f(4096.0, 1024.0, 4096.0);
+ offset = v3f(1.79, 0.0, 0.0);
+ slice_w = 0.0;
+ julia_x = 0.33;
+ julia_y = 0.33;
+ julia_z = 0.33;
+ julia_w = 0.33;
np_seabed = NoiseParams(-14, 9, v3f(600, 600, 600), 41900, 5, 0.6, 2.0);
np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0);
@@ -166,45 +165,43 @@ MapgenFractalParams::MapgenFractalParams()
void MapgenFractalParams::readParams(const Settings *settings)
{
- settings->getFlagStrNoEx("mgfractal_spflags", spflags, flagdesc_mapgen_fractal);
-
- 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->getFlagStrNoEx("mgfractal_spflags", spflags, flagdesc_mapgen_fractal);
+ settings->getFloatNoEx("mgfractal_cave_width", cave_width);
+ 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);
- settings->getNoiseParams("mgfractal_np_cave1", np_cave1);
- settings->getNoiseParams("mgfractal_np_cave2", np_cave2);
+ settings->getNoiseParams("mgfractal_np_cave1", np_cave1);
+ settings->getNoiseParams("mgfractal_np_cave2", np_cave2);
}
void MapgenFractalParams::writeParams(Settings *settings) const
{
- settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX);
-
- 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->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX);
+ settings->setFloat("mgfractal_cave_width", cave_width);
+ 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);
- settings->setNoiseParams("mgfractal_np_cave1", np_cave1);
- settings->setNoiseParams("mgfractal_np_cave2", np_cave2);
+ settings->setNoiseParams("mgfractal_np_cave1", np_cave1);
+ settings->setNoiseParams("mgfractal_np_cave2", np_cave2);
}
@@ -720,7 +717,7 @@ void MapgenFractal::generateCaves(s16 max_stone_y)
float d1 = contour(noise_cave1->result[index3d]);
float d2 = contour(noise_cave2->result[index3d]);
- if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
+ if (d1 * d2 > cave_width && ndef->get(c).is_ground_content) {
// In tunnel and ground content, excavate
vm->m_data[vi] = MapNode(CONTENT_AIR);
is_tunnel = true;
diff --git a/src/mapgen_fractal.h b/src/mapgen_fractal.h
index 8c21a8a4e..dd96045e2 100644
--- a/src/mapgen_fractal.h
+++ b/src/mapgen_fractal.h
@@ -35,18 +35,16 @@ extern FlagDesc flagdesc_mapgen_fractal[];
struct MapgenFractalParams : public MapgenSpecificParams {
u32 spflags;
-
+ float cave_width;
u16 fractal;
u16 iterations;
v3f scale;
v3f offset;
float slice_w;
-
float julia_x;
float julia_y;
float julia_z;
float julia_w;
-
NoiseParams np_seabed;
NoiseParams np_filler_depth;
NoiseParams np_cave1;
@@ -75,18 +73,16 @@ public:
v3s16 full_node_max;
u32 spflags;
-
+ float cave_width;
u16 fractal;
u16 iterations;
v3f scale;
v3f offset;
float slice_w;
-
float julia_x;
float julia_y;
float julia_z;
float julia_w;
-
Noise *noise_seabed;
Noise *noise_filler_depth;
Noise *noise_cave1;
diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp
index 5ae2568ae..b98acb928 100644
--- a/src/mapgen_v5.cpp
+++ b/src/mapgen_v5.cpp
@@ -63,7 +63,9 @@ MapgenV5::MapgenV5(int mapgenid, MapgenParams *params, EmergeManager *emerge)
this->humidmap = NULL;
MapgenV5Params *sp = (MapgenV5Params *)params->sparams;
- this->spflags = sp->spflags;
+
+ this->spflags = sp->spflags;
+ this->cave_width = sp->cave_width;
// Terrain noise
noise_filler_depth = new Noise(&sp->np_filler_depth, seed, csize.X, csize.Z);
@@ -133,7 +135,8 @@ MapgenV5::~MapgenV5()
MapgenV5Params::MapgenV5Params()
{
- spflags = 0;
+ spflags = 0;
+ cave_width = 0.125;
np_filler_depth = NoiseParams(0, 1, v3f(150, 150, 150), 261, 4, 0.7, 2.0);
np_factor = NoiseParams(0, 1, v3f(250, 250, 250), 920381, 3, 0.45, 2.0);
@@ -150,7 +153,8 @@ MapgenV5Params::MapgenV5Params()
void MapgenV5Params::readParams(const Settings *settings)
{
- settings->getFlagStrNoEx("mgv5_spflags", spflags, flagdesc_mapgen_v5);
+ settings->getFlagStrNoEx("mgv5_spflags", spflags, flagdesc_mapgen_v5);
+ settings->getFloatNoEx("mgv5_cave_width", cave_width);
settings->getNoiseParams("mgv5_np_filler_depth", np_filler_depth);
settings->getNoiseParams("mgv5_np_factor", np_factor);
@@ -163,7 +167,8 @@ void MapgenV5Params::readParams(const Settings *settings)
void MapgenV5Params::writeParams(Settings *settings) const
{
- settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, U32_MAX);
+ settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, U32_MAX);
+ settings->setFloat("mgv5_cave_width", cave_width);
settings->setNoiseParams("mgv5_np_filler_depth", np_filler_depth);
settings->setNoiseParams("mgv5_np_factor", np_factor);
@@ -598,7 +603,7 @@ void MapgenV5::generateCaves(int max_stone_y)
float d1 = contour(noise_cave1->result[index3d]);
float d2 = contour(noise_cave2->result[index3d]);
- if (d1 * d2 > 0.125f && ndef->get(c).is_ground_content) {
+ if (d1 * d2 > cave_width && ndef->get(c).is_ground_content) {
// In tunnel and ground content, excavate
vm->m_data[vi] = MapNode(CONTENT_AIR);
is_tunnel = true;
diff --git a/src/mapgen_v5.h b/src/mapgen_v5.h
index 8047f225f..fd2f7f4d8 100644
--- a/src/mapgen_v5.h
+++ b/src/mapgen_v5.h
@@ -32,6 +32,7 @@ extern FlagDesc flagdesc_mapgen_v5[];
struct MapgenV5Params : public MapgenSpecificParams {
u32 spflags;
+ float cave_width;
NoiseParams np_filler_depth;
NoiseParams np_factor;
NoiseParams np_height;
@@ -54,13 +55,14 @@ public:
int ystride;
int zstride_1d;
- u32 spflags;
v3s16 node_min;
v3s16 node_max;
v3s16 full_node_min;
v3s16 full_node_max;
+ u32 spflags;
+ float cave_width;
Noise *noise_filler_depth;
Noise *noise_factor;
Noise *noise_height;
diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp
index 162bf068f..9fb65f577 100644
--- a/src/mapgen_v7.cpp
+++ b/src/mapgen_v7.cpp
@@ -71,7 +71,9 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge)
this->ridge_heightmap = new s16[csize.X * csize.Z];
MapgenV7Params *sp = (MapgenV7Params *)params->sparams;
- this->spflags = sp->spflags;
+
+ this->spflags = sp->spflags;
+ this->cave_width = sp->cave_width;
//// Terrain noise
noise_terrain_base = new Noise(&sp->np_terrain_base, seed, csize.X, csize.Z);
@@ -152,7 +154,8 @@ MapgenV7::~MapgenV7()
MapgenV7Params::MapgenV7Params()
{
- spflags = MGV7_MOUNTAINS | MGV7_RIDGES;
+ spflags = MGV7_MOUNTAINS | MGV7_RIDGES;
+ cave_width = 0.3;
np_terrain_base = NoiseParams(4, 70, v3f(600, 600, 600), 82341, 5, 0.6, 2.0);
np_terrain_alt = NoiseParams(4, 25, v3f(600, 600, 600), 5934, 5, 0.6, 2.0);
@@ -170,7 +173,8 @@ MapgenV7Params::MapgenV7Params()
void MapgenV7Params::readParams(const Settings *settings)
{
- settings->getFlagStrNoEx("mgv7_spflags", spflags, flagdesc_mapgen_v7);
+ settings->getFlagStrNoEx("mgv7_spflags", spflags, flagdesc_mapgen_v7);
+ settings->getFloatNoEx("mgv7_cave_width", cave_width);
settings->getNoiseParams("mgv7_np_terrain_base", np_terrain_base);
settings->getNoiseParams("mgv7_np_terrain_alt", np_terrain_alt);
@@ -188,7 +192,8 @@ void MapgenV7Params::readParams(const Settings *settings)
void MapgenV7Params::writeParams(Settings *settings) const
{
- settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, U32_MAX);
+ settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, U32_MAX);
+ settings->setFloat("mgv7_cave_width", cave_width);
settings->setNoiseParams("mgv7_np_terrain_base", np_terrain_base);
settings->setNoiseParams("mgv7_np_terrain_alt", np_terrain_alt);
@@ -735,7 +740,7 @@ void MapgenV7::generateCaves(s16 max_stone_y)
float d1 = contour(noise_cave1->result[index3d]);
float d2 = contour(noise_cave2->result[index3d]);
- if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
+ if (d1 * d2 > cave_width && ndef->get(c).is_ground_content) {
// In tunnel and ground content, excavate
vm->m_data[vi] = MapNode(CONTENT_AIR);
is_tunnel = true;
diff --git a/src/mapgen_v7.h b/src/mapgen_v7.h
index 57cb55a8a..c25220646 100644
--- a/src/mapgen_v7.h
+++ b/src/mapgen_v7.h
@@ -34,6 +34,7 @@ extern FlagDesc flagdesc_mapgen_v7[];
struct MapgenV7Params : public MapgenSpecificParams {
u32 spflags;
+ float cave_width;
NoiseParams np_terrain_base;
NoiseParams np_terrain_alt;
NoiseParams np_terrain_persist;
@@ -61,7 +62,6 @@ public:
int ystride;
int zstride_1u1d;
int zstride_1d;
- u32 spflags;
v3s16 node_min;
v3s16 node_max;
@@ -70,6 +70,8 @@ public:
s16 *ridge_heightmap;
+ u32 spflags;
+ float cave_width;
Noise *noise_terrain_base;
Noise *noise_terrain_alt;
Noise *noise_terrain_persist;
diff --git a/src/mapgen_valleys.cpp b/src/mapgen_valleys.cpp
index 3926deb4a..0ec5409cb 100644
--- a/src/mapgen_valleys.cpp
+++ b/src/mapgen_valleys.cpp
@@ -86,25 +86,16 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager *
g_settings->getU16("map_generation_limit"));
MapgenValleysParams *sp = (MapgenValleysParams *)params->sparams;
- this->spflags = sp->spflags;
-
- this->humid_rivers = (spflags & MGVALLEYS_HUMID_RIVERS);
- this->use_altitude_chill = (spflags & MGVALLEYS_ALT_CHILL);
+ this->spflags = sp->spflags;
this->altitude_chill = sp->altitude_chill;
- this->humidity_adjust = params->np_biome_humidity.offset - 50.f;
this->large_cave_depth = sp->large_cave_depth;
this->lava_features_lim = rangelim(sp->lava_features, 0, 10);
this->massive_cave_depth = sp->massive_cave_depth;
this->river_depth_bed = sp->river_depth + 1.f;
this->river_size_factor = sp->river_size / 100.f;
this->water_features_lim = rangelim(sp->water_features, 0, 10);
-
- // a small chance of overflows if the settings are very high
- this->cave_water_max_height = water_level + MYMAX(0, water_features_lim - 4) * 50;
- this->lava_max_height = water_level + MYMAX(0, lava_features_lim - 4) * 50;
-
- tcave_cache = new float[csize.Y + 2];
+ this->cave_width = sp->cave_width;
//// 2D Terrain noise
noise_filler_depth = new Noise(&sp->np_filler_depth, seed, csize.X, csize.Z);
@@ -128,6 +119,16 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager *
noise_humidity_blend = new Noise(&params->np_biome_humidity_blend, seed, csize.X, csize.Z);
noise_humidity = new Noise(&params->np_biome_humidity, seed, csize.X, csize.Z);
+ this->humid_rivers = (spflags & MGVALLEYS_HUMID_RIVERS);
+ this->use_altitude_chill = (spflags & MGVALLEYS_ALT_CHILL);
+ this->humidity_adjust = params->np_biome_humidity.offset - 50.f;
+
+ // a small chance of overflows if the settings are very high
+ this->cave_water_max_height = water_level + MYMAX(0, water_features_lim - 4) * 50;
+ this->lava_max_height = water_level + MYMAX(0, lava_features_lim - 4) * 50;
+
+ tcave_cache = new float[csize.Y + 2];
+
//// Resolve nodes to be used
INodeDefManager *ndef = emerge->ndef;
@@ -165,10 +166,6 @@ MapgenValleys::~MapgenValleys()
delete noise_cave1;
delete noise_cave2;
delete noise_filler_depth;
- delete noise_heat;
- delete noise_heat_blend;
- delete noise_humidity;
- delete noise_humidity_blend;
delete noise_inter_valley_fill;
delete noise_inter_valley_slope;
delete noise_rivers;
@@ -177,6 +174,11 @@ MapgenValleys::~MapgenValleys()
delete noise_valley_depth;
delete noise_valley_profile;
+ delete noise_heat;
+ delete noise_heat_blend;
+ delete noise_humidity;
+ delete noise_humidity_blend;
+
delete[] biomemap;
delete[] heightmap;
delete[] tcave_cache;
@@ -185,8 +187,7 @@ MapgenValleys::~MapgenValleys()
MapgenValleysParams::MapgenValleysParams()
{
- spflags = MGVALLEYS_HUMID_RIVERS | MGVALLEYS_ALT_CHILL;
-
+ spflags = MGVALLEYS_HUMID_RIVERS | MGVALLEYS_ALT_CHILL;
altitude_chill = 90; // The altitude at which temperature drops by 20C.
large_cave_depth = -33;
lava_features = 0; // How often water will occur in caves.
@@ -194,6 +195,7 @@ MapgenValleysParams::MapgenValleysParams()
river_depth = 4; // How deep to carve river channels.
river_size = 5; // How wide to make rivers.
water_features = 0; // How often water will occur in caves.
+ cave_width = 0.3;
np_cave1 = NoiseParams(0, 12, v3f(96, 96, 96), 52534, 4, 0.5, 2.0);
np_cave2 = NoiseParams(0, 12, v3f(96, 96, 96), 10325, 4, 0.5, 2.0);
@@ -205,56 +207,56 @@ MapgenValleysParams::MapgenValleysParams()
np_terrain_height = NoiseParams(-10.f, 50.f, v3f(1024, 1024, 1024), 5202, 6, 0.4f, 2.f);
np_valley_depth = NoiseParams(5.f, 4.f, v3f(512, 512, 512), -1914, 1, 1.f, 2.f);
np_valley_profile = NoiseParams(0.6f, 0.5f, v3f(512, 512, 512), 777, 1, 1.f, 2.f);
- }
+}
void MapgenValleysParams::readParams(const Settings *settings)
{
- settings->getFlagStrNoEx("mg_valleys_spflags", spflags, flagdesc_mapgen_valleys);
-
- settings->getU16NoEx("mg_valleys_altitude_chill", altitude_chill);
- settings->getS16NoEx("mg_valleys_large_cave_depth", large_cave_depth);
- settings->getU16NoEx("mg_valleys_lava_features", lava_features);
- settings->getS16NoEx("mg_valleys_massive_cave_depth", massive_cave_depth);
- settings->getU16NoEx("mg_valleys_river_depth", river_depth);
- settings->getU16NoEx("mg_valleys_river_size", river_size);
- settings->getU16NoEx("mg_valleys_water_features", water_features);
-
- settings->getNoiseParams("mg_valleys_np_cave1", np_cave1);
- settings->getNoiseParams("mg_valleys_np_cave2", np_cave2);
- settings->getNoiseParams("mg_valleys_np_filler_depth", np_filler_depth);
- settings->getNoiseParams("mg_valleys_np_inter_valley_fill", np_inter_valley_fill);
- settings->getNoiseParams("mg_valleys_np_inter_valley_slope", np_inter_valley_slope);
- settings->getNoiseParams("mg_valleys_np_rivers", np_rivers);
- settings->getNoiseParams("mg_valleys_np_massive_caves", np_massive_caves);
- settings->getNoiseParams("mg_valleys_np_terrain_height", np_terrain_height);
- settings->getNoiseParams("mg_valleys_np_valley_depth", np_valley_depth);
- settings->getNoiseParams("mg_valleys_np_valley_profile", np_valley_profile);
+ 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->getU16NoEx("mgvalleys_lava_features", lava_features);
+ settings->getS16NoEx("mgvalleys_massive_cave_depth", massive_cave_depth);
+ settings->getU16NoEx("mgvalleys_river_depth", river_depth);
+ settings->getU16NoEx("mgvalleys_river_size", river_size);
+ settings->getU16NoEx("mgvalleys_water_features", water_features);
+ settings->getFloatNoEx("mgvalleys_cave_width", cave_width);
+
+ settings->getNoiseParams("mgvalleys_np_cave1", np_cave1);
+ settings->getNoiseParams("mgvalleys_np_cave2", np_cave2);
+ settings->getNoiseParams("mgvalleys_np_filler_depth", np_filler_depth);
+ settings->getNoiseParams("mgvalleys_np_inter_valley_fill", np_inter_valley_fill);
+ settings->getNoiseParams("mgvalleys_np_inter_valley_slope", np_inter_valley_slope);
+ settings->getNoiseParams("mgvalleys_np_rivers", np_rivers);
+ settings->getNoiseParams("mgvalleys_np_massive_caves", np_massive_caves);
+ settings->getNoiseParams("mgvalleys_np_terrain_height", np_terrain_height);
+ settings->getNoiseParams("mgvalleys_np_valley_depth", np_valley_depth);
+ settings->getNoiseParams("mgvalleys_np_valley_profile", np_valley_profile);
}
void MapgenValleysParams::writeParams(Settings *settings) const
{
- settings->setFlagStr("mg_valleys_spflags", spflags, flagdesc_mapgen_valleys, U32_MAX);
-
- settings->setU16("mg_valleys_altitude_chill", altitude_chill);
- settings->setS16("mg_valleys_large_cave_depth", large_cave_depth);
- settings->setU16("mg_valleys_lava_features", lava_features);
- settings->setS16("mg_valleys_massive_cave_depth", massive_cave_depth);
- settings->setU16("mg_valleys_river_depth", river_depth);
- settings->setU16("mg_valleys_river_size", river_size);
- settings->setU16("mg_valleys_water_features", water_features);
-
- settings->setNoiseParams("mg_valleys_np_cave1", np_cave1);
- settings->setNoiseParams("mg_valleys_np_cave2", np_cave2);
- settings->setNoiseParams("mg_valleys_np_filler_depth", np_filler_depth);
- settings->setNoiseParams("mg_valleys_np_inter_valley_fill", np_inter_valley_fill);
- settings->setNoiseParams("mg_valleys_np_inter_valley_slope", np_inter_valley_slope);
- settings->setNoiseParams("mg_valleys_np_rivers", np_rivers);
- settings->setNoiseParams("mg_valleys_np_massive_caves", np_massive_caves);
- settings->setNoiseParams("mg_valleys_np_terrain_height", np_terrain_height);
- settings->setNoiseParams("mg_valleys_np_valley_depth", np_valley_depth);
- settings->setNoiseParams("mg_valleys_np_valley_profile", np_valley_profile);
+ 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->setU16("mgvalleys_lava_features", lava_features);
+ settings->setS16("mgvalleys_massive_cave_depth", massive_cave_depth);
+ settings->setU16("mgvalleys_river_depth", river_depth);
+ settings->setU16("mgvalleys_river_size", river_size);
+ settings->setU16("mgvalleys_water_features", water_features);
+ settings->setFloat("mgvalleys_cave_width", cave_width);
+
+ settings->setNoiseParams("mgvalleys_np_cave1", np_cave1);
+ settings->setNoiseParams("mgvalleys_np_cave2", np_cave2);
+ settings->setNoiseParams("mgvalleys_np_filler_depth", np_filler_depth);
+ settings->setNoiseParams("mgvalleys_np_inter_valley_fill", np_inter_valley_fill);
+ settings->setNoiseParams("mgvalleys_np_inter_valley_slope", np_inter_valley_slope);
+ settings->setNoiseParams("mgvalleys_np_rivers", np_rivers);
+ settings->setNoiseParams("mgvalleys_np_massive_caves", np_massive_caves);
+ settings->setNoiseParams("mgvalleys_np_terrain_height", np_terrain_height);
+ settings->setNoiseParams("mgvalleys_np_valley_depth", np_valley_depth);
+ settings->setNoiseParams("mgvalleys_np_valley_profile", np_valley_profile);
}
@@ -964,7 +966,7 @@ void MapgenValleys::generateCaves(s16 max_stone_y)
// when a tunnel undercuts a river. However, that's not for
// the mapgen to correct. Fix it in lua.
- if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
+ if (d1 * d2 > cave_width && ndef->get(c).is_ground_content) {
// in a tunnel
vm->m_data[index_data] = n_air;
tunnel_air_above = true;
diff --git a/src/mapgen_valleys.h b/src/mapgen_valleys.h
index 4ad2d2076..5224ea54b 100644
--- a/src/mapgen_valleys.h
+++ b/src/mapgen_valleys.h
@@ -47,7 +47,6 @@ class BiomeManager;
struct MapgenValleysParams : public MapgenSpecificParams {
u32 spflags;
-
s16 large_cave_depth;
s16 massive_cave_depth;
u16 altitude_chill;
@@ -55,11 +54,7 @@ struct MapgenValleysParams : public MapgenSpecificParams {
u16 river_depth;
u16 river_size;
u16 water_features;
-
- NoiseParams np_biome_heat;
- NoiseParams np_biome_heat_blend;
- NoiseParams np_biome_humidity;
- NoiseParams np_biome_humidity_blend;
+ float cave_width;
NoiseParams np_cave1;
NoiseParams np_cave2;
NoiseParams np_filler_depth;
@@ -110,23 +105,29 @@ private:
float map_gen_limit;
- u32 spflags;
bool humid_rivers;
bool use_altitude_chill;
+ float humidity_adjust;
+ s16 cave_water_max_height;
+ s16 lava_max_height;
v3s16 node_min;
v3s16 node_max;
v3s16 full_node_min;
v3s16 full_node_max;
+ u32 spflags;
+ 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;
+ float cave_width;
Noise *noise_filler_depth;
-
Noise *noise_cave1;
Noise *noise_cave2;
- Noise *noise_heat;
- Noise *noise_heat_blend;
- Noise *noise_humidity;
- Noise *noise_humidity_blend;
Noise *noise_inter_valley_fill;
Noise *noise_inter_valley_slope;
Noise *noise_rivers;
@@ -135,16 +136,10 @@ private:
Noise *noise_valley_depth;
Noise *noise_valley_profile;
- float altitude_chill;
- s16 cave_water_max_height;
- float humidity_adjust;
- s16 lava_features_lim;
- s16 lava_max_height;
- s16 massive_cave_depth;
- float river_depth_bed;
- float river_size_factor;
- float *tcave_cache;
- s16 water_features_lim;
+ Noise *noise_heat;
+ Noise *noise_heat_blend;
+ Noise *noise_humidity;
+ Noise *noise_humidity_blend;
content_t c_cobble;
content_t c_desert_stone;