Mgvalleys: Make river depth variation and humidity drop optional (#7532)
[oweals/minetest.git] / src / mapgen / mapgen_valleys.h
index b44439030b73db6d236108699555ff965a37821b..8bde7a622af3a6b0ed82a90d6cbb1937d0f8b0ed 100644 (file)
@@ -28,46 +28,50 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "mapgen.h"
 
-////////////// Mapgen Valleys flags
-#define MGVALLEYS_ALT_CHILL    0x01
-#define MGVALLEYS_HUMID_RIVERS 0x02
+/////////////////// 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.
+// Feed only one variable into these
 #define MYSQUARE(x) (x) * (x)
 #define MYCUBE(x) (x) * (x) * (x)
 
 class BiomeManager;
 class BiomeGenOriginal;
 
-// Global profiler
-//class Profiler;
-//extern Profiler *mapgen_profiler;
+extern FlagDesc flagdesc_mapgen_valleys[];
 
 
 struct MapgenValleysParams : public MapgenParams {
-       u32 spflags = MGVALLEYS_HUMID_RIVERS | MGVALLEYS_ALT_CHILL;
-       s16 large_cave_depth = -33;
-       s16 massive_cave_depth = -256; // highest altitude of massive caves
-       u16 altitude_chill = 90; // The altitude at which temperature drops by 20C.
-       u16 lava_features = 0; // How often water will occur in caves.
-       u16 river_depth = 4; // How deep to carve river channels.
-       u16 river_size = 5; // How wide to make rivers.
-       u16 water_features = 0; // How often water will occur in caves.
+       u32 spflags = MGVALLEYS_ALT_CHILL | MGVALLEYS_HUMID_RIVERS |
+               MGVALLEYS_VARY_RIVER_DEPTH | MGVALLEYS_ALT_DRY;
+       u16 altitude_chill = 90;
+       u16 river_depth = 4;
+       u16 river_size = 5;
+
        float cave_width = 0.09f;
+       s16 large_cave_depth = -33;
+       s16 lava_depth = 1;
+       s16 cavern_limit = -256;
+       s16 cavern_taper = 192;
+       float cavern_threshold = 0.6f;
        s16 dungeon_ymin = -31000;
-       s16 dungeon_ymax = 63; // No higher than surface mapchunks
+       s16 dungeon_ymax = 63;
 
-       NoiseParams np_cave1;
-       NoiseParams np_cave2;
        NoiseParams np_filler_depth;
        NoiseParams np_inter_valley_fill;
        NoiseParams np_inter_valley_slope;
        NoiseParams np_rivers;
-       NoiseParams np_massive_caves;
        NoiseParams np_terrain_height;
        NoiseParams np_valley_depth;
        NoiseParams np_valley_profile;
 
+       NoiseParams np_cave1;
+       NoiseParams np_cave2;
+       NoiseParams np_cavern;
+
        MapgenValleysParams();
        ~MapgenValleysParams() = default;
 
@@ -89,7 +93,8 @@ struct TerrainNoise {
 class MapgenValleys : public MapgenBasic {
 public:
 
-       MapgenValleys(int mapgenid, MapgenValleysParams *params, EmergeManager *emerge);
+       MapgenValleys(int mapgenid, MapgenValleysParams *params,
+               EmergeManager *emerge);
        ~MapgenValleys();
 
        virtual MapgenType getType() const { return MAPGEN_VALLEYS; }
@@ -97,44 +102,28 @@ public:
        virtual void makeChunk(BlockMakeData *data);
        int getSpawnLevelAtPoint(v2s16 p);
 
-       s16 large_cave_depth;
-
 private:
        BiomeGenOriginal *m_bgen;
 
        float altitude_chill;
-       s16 massive_cave_depth;
-       s16 dungeon_ymin;
-       s16 dungeon_ymax;
-
-       bool humid_rivers;
-       bool use_altitude_chill;
        float humidity_adjust;
-       s16 cave_water_max_height;
-       s16 lava_max_height;
-       s16 lava_features_lim;
        float river_depth_bed;
        float river_size_factor;
-       float *tcave_cache;
-       s16 water_features_lim;
+
+       s16 large_cave_depth;
+       s16 dungeon_ymin;
+       s16 dungeon_ymax;
 
        Noise *noise_inter_valley_fill;
        Noise *noise_inter_valley_slope;
        Noise *noise_rivers;
-       Noise *noise_cave1;
-       Noise *noise_cave2;
-       Noise *noise_massive_caves;
        Noise *noise_terrain_height;
        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);
-
-       virtual void generateCaves(s16 max_stone_y, s16 large_cave_depth);
 };