3 Copyright (C) 2010-2015 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
4 Copyright (C) 2010-2015 paramat, Matt Gregory
5 Copyright (C) 2016 Duane Robertson <duane@duanerobertson.com>
7 Based on Valleys Mapgen by Gael de Sailly
8 (https://forum.minetest.net/viewtopic.php?f=9&t=11430)
9 and mapgen_v7 by kwolekr and paramat.
11 Licensing changed by permission of Gael de Sailly.
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
16 (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
23 You should have received a copy of the GNU Lesser General Public License along
24 with this program; if not, write to the Free Software Foundation, Inc.,
25 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #ifndef MAPGEN_VALLEYS_HEADER
29 #define MAPGEN_VALLEYS_HEADER
33 ////////////// Mapgen Valleys flags
34 #define MGVALLEYS_ALT_CHILL 0x01
35 #define MGVALLEYS_HUMID_RIVERS 0x02
37 // Feed only one variable into these.
38 #define MYSQUARE(x) (x) * (x)
39 #define MYCUBE(x) (x) * (x) * (x)
42 class BiomeGenOriginal;
46 //extern Profiler *mapgen_profiler;
49 struct MapgenValleysParams : public MapgenSpecificParams {
52 s16 massive_cave_depth;
61 NoiseParams np_filler_depth;
62 NoiseParams np_inter_valley_fill;
63 NoiseParams np_inter_valley_slope;
64 NoiseParams np_rivers;
65 NoiseParams np_massive_caves;
66 NoiseParams np_terrain_height;
67 NoiseParams np_valley_depth;
68 NoiseParams np_valley_profile;
70 MapgenValleysParams();
71 ~MapgenValleysParams() {}
73 void readParams(const Settings *settings);
74 void writeParams(Settings *settings) const;
85 float inter_valley_fill;
88 class MapgenValleys : public MapgenBasic {
91 MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager *emerge);
94 virtual void makeChunk(BlockMakeData *data);
95 int getSpawnLevelAtPoint(v2s16 p);
100 BiomeGenOriginal *m_bgen;
107 bool use_altitude_chill;
108 float humidity_adjust;
109 s16 cave_water_max_height;
113 float altitude_chill;
114 s16 lava_features_lim;
115 s16 massive_cave_depth;
116 float river_depth_bed;
117 float river_size_factor;
119 s16 water_features_lim;
120 Noise *noise_inter_valley_fill;
121 Noise *noise_inter_valley_slope;
123 Noise *noise_massive_caves;
124 Noise *noise_terrain_height;
125 Noise *noise_valley_depth;
126 Noise *noise_valley_profile;
130 content_t c_lava_source;
131 content_t c_mossycobble;
133 content_t c_sandstonebrick;
134 content_t c_stair_cobble;
135 content_t c_stair_sandstonebrick;
137 float terrainLevelAtPoint(s16 x, s16 z);
139 void calculateNoise();
141 virtual int generateTerrain();
142 float terrainLevelFromNoise(TerrainNoise *tn);
143 float adjustedTerrainLevelFromNoise(TerrainNoise *tn);
145 virtual void generateCaves(s16 max_stone_y, s16 large_cave_depth);
148 struct MapgenFactoryValleys : public MapgenFactory {
149 Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge)
151 return new MapgenValleys(mgid, params, emerge);
154 MapgenSpecificParams *createMapgenParams()
156 return new MapgenValleysParams();