]> git.lizzy.rs Git - minetest.git/blob - src/mapgen/mapgen_carpathian.h
Randomwalk cave liquids: Remove deprecated 'lava depth' parameter (#9105)
[minetest.git] / src / mapgen / mapgen_carpathian.h
1 /*
2 Minetest
3 Copyright (C) 2017-2019 vlapsley, Vaughan Lapsley <vlapsley@gmail.com>
4 Copyright (C) 2017-2019 paramat
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #pragma once
22
23 #include "mapgen.h"
24
25 #define MGCARPATHIAN_CAVERNS 0x01
26 #define MGCARPATHIAN_RIVERS  0x02
27
28 class BiomeManager;
29
30 extern FlagDesc flagdesc_mapgen_carpathian[];
31
32
33 struct MapgenCarpathianParams : public MapgenParams
34 {
35         float base_level       = 12.0f;
36         float river_width      = 0.05f;
37         float river_depth      = 24.0f;
38         float valley_width     = 0.25f;
39
40         u32 spflags              = MGCARPATHIAN_CAVERNS;
41         float cave_width         = 0.09f;
42         s16 large_cave_depth     = -33;
43         u16 small_cave_num_min   = 0;
44         u16 small_cave_num_max   = 0;
45         u16 large_cave_num_min   = 0;
46         u16 large_cave_num_max   = 2;
47         float large_cave_flooded = 0.5f;
48         s16 cavern_limit         = -256;
49         s16 cavern_taper         = 256;
50         float cavern_threshold   = 0.7f;
51         s16 dungeon_ymin         = -31000;
52         s16 dungeon_ymax         = 31000;
53
54         NoiseParams np_filler_depth;
55         NoiseParams np_height1;
56         NoiseParams np_height2;
57         NoiseParams np_height3;
58         NoiseParams np_height4;
59         NoiseParams np_hills_terrain;
60         NoiseParams np_ridge_terrain;
61         NoiseParams np_step_terrain;
62         NoiseParams np_hills;
63         NoiseParams np_ridge_mnt;
64         NoiseParams np_step_mnt;
65         NoiseParams np_rivers;
66         NoiseParams np_mnt_var;
67         NoiseParams np_cave1;
68         NoiseParams np_cave2;
69         NoiseParams np_cavern;
70         NoiseParams np_dungeons;
71
72         MapgenCarpathianParams();
73         ~MapgenCarpathianParams() = default;
74
75         void readParams(const Settings *settings);
76         void writeParams(Settings *settings) const;
77 };
78
79 class MapgenCarpathian : public MapgenBasic
80 {
81 public:
82         MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge);
83         ~MapgenCarpathian();
84
85         virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
86
87         virtual void makeChunk(BlockMakeData *data);
88         int getSpawnLevelAtPoint(v2s16 p);
89
90 private:
91         float base_level;
92         float river_width;
93         float river_depth;
94         float valley_width;
95
96         s16 large_cave_depth;
97         s16 dungeon_ymin;
98         s16 dungeon_ymax;
99
100         Noise *noise_height1;
101         Noise *noise_height2;
102         Noise *noise_height3;
103         Noise *noise_height4;
104         Noise *noise_hills_terrain;
105         Noise *noise_ridge_terrain;
106         Noise *noise_step_terrain;
107         Noise *noise_hills;
108         Noise *noise_ridge_mnt;
109         Noise *noise_step_mnt;
110         Noise *noise_rivers = nullptr;
111         Noise *noise_mnt_var;
112
113         s32 grad_wl;
114
115         float getSteps(float noise);
116         inline float getLerp(float noise1, float noise2, float mod);
117         int generateTerrain();
118 };