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