diff options
author | paramat <paramat@users.noreply.github.com> | 2017-12-24 22:38:35 +0000 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2018-01-03 04:05:55 +0000 |
commit | 2aad3be2cb72aa8f1715f4b938fdf8be22ca39b9 (patch) | |
tree | 70b78b2c28a3664355177b5358078c105ce89d8b /src | |
parent | f3b9d8707691b16d9c8b6a2e9e13db54b091dc93 (diff) | |
download | minetest-2aad3be2cb72aa8f1715f4b938fdf8be22ca39b9.tar.gz minetest-2aad3be2cb72aa8f1715f4b938fdf8be22ca39b9.tar.bz2 minetest-2aad3be2cb72aa8f1715f4b938fdf8be22ca39b9.zip |
Mgv7 floatlands: Add exponent parameter
Allows more control over shape of floatland mountain terrain.
Terrain shape is unchanged.
Diffstat (limited to 'src')
-rw-r--r-- | src/mapgen/mapgen_v7.cpp | 79 | ||||
-rw-r--r-- | src/mapgen/mapgen_v7.h | 2 |
2 files changed, 44 insertions, 37 deletions
diff --git a/src/mapgen/mapgen_v7.cpp b/src/mapgen/mapgen_v7.cpp index 404780158..1bf8aab04 100644 --- a/src/mapgen/mapgen_v7.cpp +++ b/src/mapgen/mapgen_v7.cpp @@ -54,17 +54,18 @@ FlagDesc flagdesc_mapgen_v7[] = { MapgenV7::MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge) : MapgenBasic(mapgenid, params, emerge) { - spflags = params->spflags; - mount_zero_level = params->mount_zero_level; - cave_width = params->cave_width; - large_cave_depth = params->large_cave_depth; - lava_depth = params->lava_depth; - float_mount_density = params->float_mount_density; - floatland_level = params->floatland_level; - shadow_limit = params->shadow_limit; - cavern_limit = params->cavern_limit; - cavern_taper = params->cavern_taper; - cavern_threshold = params->cavern_threshold; + spflags = params->spflags; + mount_zero_level = params->mount_zero_level; + cave_width = params->cave_width; + large_cave_depth = params->large_cave_depth; + lava_depth = params->lava_depth; + float_mount_density = params->float_mount_density; + float_mount_exponent = params->float_mount_exponent; + floatland_level = params->floatland_level; + shadow_limit = params->shadow_limit; + cavern_limit = params->cavern_limit; + cavern_taper = params->cavern_taper; + cavern_threshold = params->cavern_threshold; // This is to avoid a divide-by-zero. // Parameter will be saved to map_meta.txt in limited form. @@ -148,18 +149,19 @@ MapgenV7Params::MapgenV7Params(): void MapgenV7Params::readParams(const Settings *settings) { - settings->getFlagStrNoEx("mgv7_spflags", spflags, flagdesc_mapgen_v7); - settings->getS16NoEx("mgv7_mount_zero_level", mount_zero_level); - settings->getFloatNoEx("mgv7_cave_width", cave_width); - settings->getS16NoEx("mgv7_large_cave_depth", large_cave_depth); - settings->getS16NoEx("mgv7_lava_depth", lava_depth); - settings->getFloatNoEx("mgv7_float_mount_density", float_mount_density); - settings->getFloatNoEx("mgv7_float_mount_height", float_mount_height); - settings->getS16NoEx("mgv7_floatland_level", floatland_level); - settings->getS16NoEx("mgv7_shadow_limit", shadow_limit); - settings->getS16NoEx("mgv7_cavern_limit", cavern_limit); - settings->getS16NoEx("mgv7_cavern_taper", cavern_taper); - settings->getFloatNoEx("mgv7_cavern_threshold", cavern_threshold); + settings->getFlagStrNoEx("mgv7_spflags", spflags, flagdesc_mapgen_v7); + settings->getS16NoEx("mgv7_mount_zero_level", mount_zero_level); + settings->getFloatNoEx("mgv7_cave_width", cave_width); + settings->getS16NoEx("mgv7_large_cave_depth", large_cave_depth); + settings->getS16NoEx("mgv7_lava_depth", lava_depth); + 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); + settings->getS16NoEx("mgv7_floatland_level", floatland_level); + settings->getS16NoEx("mgv7_shadow_limit", shadow_limit); + settings->getS16NoEx("mgv7_cavern_limit", cavern_limit); + settings->getS16NoEx("mgv7_cavern_taper", cavern_taper); + settings->getFloatNoEx("mgv7_cavern_threshold", cavern_threshold); settings->getNoiseParams("mgv7_np_terrain_base", np_terrain_base); settings->getNoiseParams("mgv7_np_terrain_alt", np_terrain_alt); @@ -180,18 +182,19 @@ void MapgenV7Params::readParams(const Settings *settings) void MapgenV7Params::writeParams(Settings *settings) const { - settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, U32_MAX); - settings->setS16("mgv7_mount_zero_level", mount_zero_level); - settings->setFloat("mgv7_cave_width", cave_width); - settings->setS16("mgv7_large_cave_depth", large_cave_depth); - settings->setS16("mgv7_lava_depth", lava_depth); - settings->setFloat("mgv7_float_mount_density", float_mount_density); - settings->setFloat("mgv7_float_mount_height", float_mount_height); - settings->setS16("mgv7_floatland_level", floatland_level); - settings->setS16("mgv7_shadow_limit", shadow_limit); - settings->setS16("mgv7_cavern_limit", cavern_limit); - settings->setS16("mgv7_cavern_taper", cavern_taper); - settings->setFloat("mgv7_cavern_threshold", cavern_threshold); + settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, U32_MAX); + settings->setS16("mgv7_mount_zero_level", mount_zero_level); + settings->setFloat("mgv7_cave_width", cave_width); + settings->setS16("mgv7_large_cave_depth", large_cave_depth); + settings->setS16("mgv7_lava_depth", lava_depth); + 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); + settings->setS16("mgv7_floatland_level", floatland_level); + settings->setS16("mgv7_shadow_limit", shadow_limit); + settings->setS16("mgv7_cavern_limit", cavern_limit); + settings->setS16("mgv7_cavern_taper", cavern_taper); + settings->setFloat("mgv7_cavern_threshold", cavern_threshold); settings->setNoiseParams("mgv7_np_terrain_base", np_terrain_base); settings->setNoiseParams("mgv7_np_terrain_alt", np_terrain_alt); @@ -416,8 +419,10 @@ bool MapgenV7::getFloatlandMountainFromMap(int idx_xyz, int idx_xz, s16 y) { // Make rim 2 nodes thick to match floatland base terrain float density_gradient = (y >= floatland_level) ? - -pow((float)(y - floatland_level) / float_mount_height, 0.75f) : - -pow((float)(floatland_level - 1 - y) / float_mount_height, 0.75f); + -pow((float)(y - floatland_level) / float_mount_height, + float_mount_exponent) : + -pow((float)(floatland_level - 1 - y) / float_mount_height, + float_mount_exponent); float floatn = noise_mountain->result[idx_xyz] + float_mount_density; diff --git a/src/mapgen/mapgen_v7.h b/src/mapgen/mapgen_v7.h index 6fb7dc4bb..fe990958f 100644 --- a/src/mapgen/mapgen_v7.h +++ b/src/mapgen/mapgen_v7.h @@ -42,6 +42,7 @@ struct MapgenV7Params : public MapgenParams { s16 lava_depth = -256; float float_mount_density = 0.6f; float float_mount_height = 128.0f; + float float_mount_exponent = 0.75f; s16 floatland_level = 1280; s16 shadow_limit = 1024; s16 cavern_limit = -256; @@ -95,6 +96,7 @@ private: s16 large_cave_depth; float float_mount_density; float float_mount_height; + float float_mount_exponent; s16 floatland_level; s16 shadow_limit; |