]> git.lizzy.rs Git - dragonfireclient.git/blob - src/mapgen_carpathian.h
b7c3935f7118b467d5d2d0e2856cef96881df9bd
[dragonfireclient.git] / src / mapgen_carpathian.h
1 /*
2 Minetest
3 Copyright (C) 2010-2016 paramat, Matt Gregory
4 Copyright (C) 2010-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
5 Copyright (C) 2017 vlapsley, Vaughan Lapsley <vlapsley@gmail.com>
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
44         NoiseParams np_base;
45         NoiseParams np_filler_depth;
46         NoiseParams np_height1;
47         NoiseParams np_height2;
48         NoiseParams np_height3;
49         NoiseParams np_height4;
50         NoiseParams np_hills_terrain;
51         NoiseParams np_ridge_terrain;
52         NoiseParams np_step_terrain;
53         NoiseParams np_hills;
54         NoiseParams np_ridge_mnt;
55         NoiseParams np_step_mnt;
56         NoiseParams np_mnt_var;
57         NoiseParams np_cave1;
58         NoiseParams np_cave2;
59         NoiseParams np_cavern;
60
61         MapgenCarpathianParams();
62         ~MapgenCarpathianParams() = default;
63
64         void readParams(const Settings *settings);
65         void writeParams(Settings *settings) const;
66 };
67
68 class MapgenCarpathian : public MapgenBasic
69 {
70 public:
71         MapgenCarpathian(int mapgenid, MapgenCarpathianParams *params,
72                         EmergeManager *emerge);
73         ~MapgenCarpathian();
74
75         virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
76
77         float getSteps(float noise1, float noise2);
78         inline float getLerp(float noise1, float noise2, float mod);
79
80         virtual void makeChunk(BlockMakeData *data);
81         int getSpawnLevelAtPoint(v2s16 p);
82
83 private:
84         s16 large_cave_depth;
85         s32 grad_wl;
86
87         Noise *noise_base;
88         Noise *noise_height1;
89         Noise *noise_height2;
90         Noise *noise_height3;
91         Noise *noise_height4;
92         Noise *noise_hills_terrain;
93         Noise *noise_ridge_terrain;
94         Noise *noise_step_terrain;
95         Noise *noise_hills;
96         Noise *noise_ridge_mnt;
97         Noise *noise_step_mnt;
98         Noise *noise_mnt_var;
99
100         float terrainLevelAtPoint(s16 x, s16 z);
101         int generateTerrain();
102 };