3 Copyright (C) 2010-2015 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef MAPGENV6_HEADER
21 #define MAPGENV6_HEADER
26 #define MGV6_AVERAGE_MUD_AMOUNT 4
27 #define MGV6_DESERT_STONE_BASE -32
28 #define MGV6_ICE_BASE 0
29 #define MGV6_FREQ_HOT 0.4
30 #define MGV6_FREQ_SNOW -0.4
31 #define MGV6_FREQ_TAIGA 0.5
32 #define MGV6_FREQ_JUNGLE 0.5
34 //////////// Mapgen V6 flags
35 #define MGV6_JUNGLES 0x01
36 #define MGV6_BIOMEBLEND 0x02
37 #define MGV6_MUDFLOW 0x04
38 #define MGV6_SNOWBIOMES 0x08
39 #define MGV6_FLAT 0x10
40 #define MGV6_TREES 0x20
43 extern FlagDesc flagdesc_mapgen_v6[];
56 struct MapgenV6Params : public MapgenSpecificParams {
60 NoiseParams np_terrain_base;
61 NoiseParams np_terrain_higher;
62 NoiseParams np_steepness;
63 NoiseParams np_height_select;
68 NoiseParams np_humidity;
70 NoiseParams np_apple_trees;
75 void readParams(const Settings *settings);
76 void writeParams(Settings *settings) const;
80 class MapgenV6 : public Mapgen {
82 EmergeManager *m_emerge;
91 v3s16 central_area_size;
94 Noise *noise_terrain_base;
95 Noise *noise_terrain_higher;
96 Noise *noise_steepness;
97 Noise *noise_height_select;
101 Noise *noise_humidity;
102 NoiseParams *np_cave;
103 NoiseParams *np_humidity;
104 NoiseParams *np_trees;
105 NoiseParams *np_apple_trees;
111 content_t c_dirt_with_grass;
113 content_t c_water_source;
114 content_t c_lava_source;
116 content_t c_desert_stone;
117 content_t c_desert_sand;
118 content_t c_dirt_with_snow;
120 content_t c_snowblock;
124 content_t c_mossycobble;
125 content_t c_stair_cobble;
127 MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge);
130 void makeChunk(BlockMakeData *data);
131 int getGroundLevelAtPoint(v2s16 p);
133 float baseTerrainLevel(float terrain_base, float terrain_higher,
134 float steepness, float height_select);
135 virtual float baseTerrainLevelFromNoise(v2s16 p);
136 virtual float baseTerrainLevelFromMap(v2s16 p);
137 virtual float baseTerrainLevelFromMap(int index);
139 s16 find_stone_level(v2s16 p2d);
140 bool block_is_underground(u64 seed, v3s16 blockpos);
141 s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision);
143 float getHumidity(v2s16 p);
144 float getTreeAmount(v2s16 p);
145 bool getHaveAppleTree(v2s16 p);
146 float getMudAmount(v2s16 p);
147 virtual float getMudAmount(int index);
148 bool getHaveBeach(v2s16 p);
149 bool getHaveBeach(int index);
150 BiomeV6Type getBiome(v2s16 p);
151 BiomeV6Type getBiome(int index, v2s16 p);
153 u32 get_blockseed(u64 seed, v3s16 p);
155 virtual void calculateNoise();
156 int generateGround();
158 void flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos);
160 void placeTreesAndJungleGrass();
161 virtual void generateCaves(int max_stone_y);
165 struct MapgenFactoryV6 : public MapgenFactory {
166 Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge)
168 return new MapgenV6(mgid, params, emerge);
171 MapgenSpecificParams *createMapgenParams()
173 return new MapgenV6Params();