]> git.lizzy.rs Git - dragonfireclient.git/blob - src/mapgen/mapgen_carpathian.h
ContentCAO: Fix broken attachments on join (#8701)
[dragonfireclient.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         s16 lava_depth         = -256;
44         s16 cavern_limit       = -256;
45         s16 cavern_taper       = 256;
46         float cavern_threshold = 0.7f;
47         s16 dungeon_ymin       = -31000;
48         s16 dungeon_ymax       = 31000;
49
50         NoiseParams np_filler_depth;
51         NoiseParams np_height1;
52         NoiseParams np_height2;
53         NoiseParams np_height3;
54         NoiseParams np_height4;
55         NoiseParams np_hills_terrain;
56         NoiseParams np_ridge_terrain;
57         NoiseParams np_step_terrain;
58         NoiseParams np_hills;
59         NoiseParams np_ridge_mnt;
60         NoiseParams np_step_mnt;
61         NoiseParams np_rivers;
62         NoiseParams np_mnt_var;
63         NoiseParams np_cave1;
64         NoiseParams np_cave2;
65         NoiseParams np_cavern;
66         NoiseParams np_dungeons;
67
68         MapgenCarpathianParams();
69         ~MapgenCarpathianParams() = default;
70
71         void readParams(const Settings *settings);
72         void writeParams(Settings *settings) const;
73 };
74
75 class MapgenCarpathian : public MapgenBasic
76 {
77 public:
78         MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge);
79         ~MapgenCarpathian();
80
81         virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
82
83         virtual void makeChunk(BlockMakeData *data);
84         int getSpawnLevelAtPoint(v2s16 p);
85
86 private:
87         float base_level;
88         float river_width;
89         float river_depth;
90         float valley_width;
91
92         s16 large_cave_depth;
93         s16 dungeon_ymin;
94         s16 dungeon_ymax;
95
96         Noise *noise_height1;
97         Noise *noise_height2;
98         Noise *noise_height3;
99         Noise *noise_height4;
100         Noise *noise_hills_terrain;
101         Noise *noise_ridge_terrain;
102         Noise *noise_step_terrain;
103         Noise *noise_hills;
104         Noise *noise_ridge_mnt;
105         Noise *noise_step_mnt;
106         Noise *noise_rivers = nullptr;
107         Noise *noise_mnt_var;
108
109         s32 grad_wl;
110
111         float getSteps(float noise);
112         inline float getLerp(float noise1, float noise2, float mod);
113         int generateTerrain();
114 };