From aafbdd442f6bb6d6730fc7fdff76cbd0e3be301b Mon Sep 17 00:00:00 2001 From: Paramat Date: Thu, 14 Mar 2019 00:27:16 +0000 Subject: Valleys mapgen code rewrite (#8101) Shorter, simpler, clearer and more consistent with other mapgens, while preserving functionality. Base terrain shape is unchanged. With the 'vary river depth' option disabled, river surface level is unchanged. Behaviour of the 4 heat/humidity/river depth options is very slightly changed due to bugfixes and code cleanup (the mapgen is 'unstable'). Apply heat and humidity gradients above water_level instead of above y = 0. --- src/mapgen/mapgen_valleys.h | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'src/mapgen/mapgen_valleys.h') diff --git a/src/mapgen/mapgen_valleys.h b/src/mapgen/mapgen_valleys.h index 8bde7a622..06920a477 100644 --- a/src/mapgen/mapgen_valleys.h +++ b/src/mapgen/mapgen_valleys.h @@ -1,11 +1,11 @@ /* Minetest -Copyright (C) 2016-2018 Duane Robertson -Copyright (C) 2016-2018 paramat +Copyright (C) 2016-2019 Duane Robertson +Copyright (C) 2016-2019 paramat Based on Valleys Mapgen by Gael de Sailly (https://forum.minetest.net/viewtopic.php?f=9&t=11430) -and mapgen_v7 by kwolekr and paramat. +and mapgen_v7, mapgen_flat by kwolekr and paramat. Licensing changed by permission of Gael de Sailly. @@ -24,20 +24,16 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once #include "mapgen.h" -/////////////////// Mapgen Valleys flags #define MGVALLEYS_ALT_CHILL 0x01 #define MGVALLEYS_HUMID_RIVERS 0x02 #define MGVALLEYS_VARY_RIVER_DEPTH 0x04 #define MGVALLEYS_ALT_DRY 0x08 -// Feed only one variable into these -#define MYSQUARE(x) (x) * (x) -#define MYCUBE(x) (x) * (x) * (x) - class BiomeManager; class BiomeGenOriginal; @@ -79,16 +75,6 @@ struct MapgenValleysParams : public MapgenParams { void writeParams(Settings *settings) const; }; -struct TerrainNoise { - s16 x; - s16 z; - float terrain_height; - float *rivers; - float *valley; - float valley_profile; - float *slope; - float inter_valley_fill; -}; class MapgenValleys : public MapgenBasic { public: @@ -106,7 +92,6 @@ private: BiomeGenOriginal *m_bgen; float altitude_chill; - float humidity_adjust; float river_depth_bed; float river_size_factor; @@ -121,9 +106,5 @@ private: Noise *noise_valley_depth; Noise *noise_valley_profile; - float terrainLevelAtPoint(s16 x, s16 z); - void calculateNoise(); virtual int generateTerrain(); - float terrainLevelFromNoise(TerrainNoise *tn); - float adjustedTerrainLevelFromNoise(TerrainNoise *tn); }; -- cgit v1.2.3