aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen_flat.cpp
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2016-04-25 11:47:25 +0100
committerkwolekr <kwolekr@minetest.net>2016-04-28 23:36:19 -0400
commit8b1f8e99cf860625ebd20531ab7f3e8316a66b51 (patch)
treeea03ca34bd86180bae270493b47f1f6ad5e19705 /src/mapgen_flat.cpp
parent46fd114e9a4e05b74576dce682e24357363298e7 (diff)
downloadminetest-8b1f8e99cf860625ebd20531ab7f3e8316a66b51.tar.gz
minetest-8b1f8e99cf860625ebd20531ab7f3e8316a66b51.tar.bz2
minetest-8b1f8e99cf860625ebd20531ab7f3e8316a66b51.zip
Mapgen: Make 3D noise tunnels' width settable
Correct parameter names mg_valleys to mgvalleys Remove biome NoiseParams from MapgenValleysParams Improve format of parameter code
Diffstat (limited to 'src/mapgen_flat.cpp')
-rw-r--r--src/mapgen_flat.cpp37
1 files changed, 19 insertions, 18 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;