]> git.lizzy.rs Git - dragonfireclient.git/blob - src/mapgen/mapgen_valleys.h
Remove "generate normal maps" feature (#10313)
[dragonfireclient.git] / src / mapgen / mapgen_valleys.h
1 /*
2 Minetest
3 Copyright (C) 2016-2019 Duane Robertson <duane@duanerobertson.com>
4 Copyright (C) 2016-2019 paramat
5
6 Based on Valleys Mapgen by Gael de Sailly
7 (https://forum.minetest.net/viewtopic.php?f=9&t=11430)
8 and mapgen_v7, mapgen_flat by kwolekr and paramat.
9
10 Licensing changed by permission of Gael de Sailly.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 GNU Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License along
23 with this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 */
26
27
28 #pragma once
29
30 #include "mapgen.h"
31
32 #define MGVALLEYS_ALT_CHILL        0x01
33 #define MGVALLEYS_HUMID_RIVERS     0x02
34 #define MGVALLEYS_VARY_RIVER_DEPTH 0x04
35 #define MGVALLEYS_ALT_DRY          0x08
36
37 class BiomeManager;
38 class BiomeGenOriginal;
39
40 extern FlagDesc flagdesc_mapgen_valleys[];
41
42
43 struct MapgenValleysParams : public MapgenParams {
44         u16 altitude_chill = 90;
45         u16 river_depth = 4;
46         u16 river_size = 5;
47
48         float cave_width = 0.09f;
49         s16 large_cave_depth = -33;
50         u16 small_cave_num_min = 0;
51         u16 small_cave_num_max = 0;
52         u16 large_cave_num_min = 0;
53         u16 large_cave_num_max = 2;
54         float large_cave_flooded = 0.5f;
55         s16 cavern_limit = -256;
56         s16 cavern_taper = 192;
57         float cavern_threshold = 0.6f;
58         s16 dungeon_ymin = -31000;
59         s16 dungeon_ymax = 63;
60
61         NoiseParams np_filler_depth;
62         NoiseParams np_inter_valley_fill;
63         NoiseParams np_inter_valley_slope;
64         NoiseParams np_rivers;
65         NoiseParams np_terrain_height;
66         NoiseParams np_valley_depth;
67         NoiseParams np_valley_profile;
68
69         NoiseParams np_cave1;
70         NoiseParams np_cave2;
71         NoiseParams np_cavern;
72         NoiseParams np_dungeons;
73
74         MapgenValleysParams();
75         ~MapgenValleysParams() = default;
76
77         void readParams(const Settings *settings);
78         void writeParams(Settings *settings) const;
79         void setDefaultSettings(Settings *settings);
80 };
81
82
83 class MapgenValleys : public MapgenBasic {
84 public:
85
86         MapgenValleys(MapgenValleysParams *params,
87                 EmergeParams *emerge);
88         ~MapgenValleys();
89
90         virtual MapgenType getType() const { return MAPGEN_VALLEYS; }
91
92         virtual void makeChunk(BlockMakeData *data);
93         int getSpawnLevelAtPoint(v2s16 p);
94
95 private:
96         BiomeGenOriginal *m_bgen;
97
98         float altitude_chill;
99         float river_depth_bed;
100         float river_size_factor;
101
102         Noise *noise_inter_valley_fill;
103         Noise *noise_inter_valley_slope;
104         Noise *noise_rivers;
105         Noise *noise_terrain_height;
106         Noise *noise_valley_depth;
107         Noise *noise_valley_profile;
108
109         virtual int generateTerrain();
110 };