3 Copyright (C) 2017-2019 vlapsley, Vaughan Lapsley <vlapsley@gmail.com>
4 Copyright (C) 2017-2019 paramat
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.
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.
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.
25 #define MGCARPATHIAN_CAVERNS 0x01
26 #define MGCARPATHIAN_RIVERS 0x02
30 extern FlagDesc flagdesc_mapgen_carpathian[];
33 struct MapgenCarpathianParams : public MapgenParams
35 float base_level = 12.0f;
36 float river_width = 0.05f;
37 float river_depth = 24.0f;
38 float valley_width = 0.25f;
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;
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;
63 NoiseParams np_ridge_mnt;
64 NoiseParams np_step_mnt;
65 NoiseParams np_rivers;
66 NoiseParams np_mnt_var;
69 NoiseParams np_cavern;
70 NoiseParams np_dungeons;
72 MapgenCarpathianParams();
73 ~MapgenCarpathianParams() = default;
75 void readParams(const Settings *settings);
76 void writeParams(Settings *settings) const;
79 class MapgenCarpathian : public MapgenBasic
82 MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge);
85 virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
87 virtual void makeChunk(BlockMakeData *data);
88 int getSpawnLevelAtPoint(v2s16 p);
100 Noise *noise_hills_terrain;
101 Noise *noise_ridge_terrain;
102 Noise *noise_step_terrain;
104 Noise *noise_ridge_mnt;
105 Noise *noise_step_mnt;
106 Noise *noise_rivers = nullptr;
107 Noise *noise_mnt_var;
111 float getSteps(float noise);
112 inline float getLerp(float noise1, float noise2, float mod);
113 int generateTerrain();