3 Copyright (C) 2010-2013 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 AVERAGE_MUD_AMOUNT 4
28 /////////////////// Mapgen V6 flags
29 #define MGV6_JUNGLES 0x01
30 #define MGV6_BIOMEBLEND 0x02
31 #define MGV6_MUDFLOW 0x04
34 extern FlagDesc flagdesc_mapgen_v6[];
43 struct MapgenV6Params : public MapgenSpecificParams {
47 NoiseParams np_terrain_base;
48 NoiseParams np_terrain_higher;
49 NoiseParams np_steepness;
50 NoiseParams np_height_select;
55 NoiseParams np_humidity;
57 NoiseParams np_apple_trees;
62 void readParams(const Settings *settings);
63 void writeParams(Settings *settings) const;
66 class MapgenV6 : public Mapgen {
68 EmergeManager *m_emerge;
77 v3s16 central_area_size;
80 Noise *noise_terrain_base;
81 Noise *noise_terrain_higher;
82 Noise *noise_steepness;
83 Noise *noise_height_select;
88 NoiseParams *np_humidity;
89 NoiseParams *np_trees;
90 NoiseParams *np_apple_trees;
96 content_t c_dirt_with_grass;
98 content_t c_water_source;
99 content_t c_lava_source;
102 content_t c_desert_sand;
103 content_t c_desert_stone;
105 content_t c_mossycobble;
106 content_t c_sandbrick;
107 content_t c_stair_cobble;
108 content_t c_stair_sandstone;
110 MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge);
113 void makeChunk(BlockMakeData *data);
114 int getGroundLevelAtPoint(v2s16 p);
116 float baseTerrainLevel(float terrain_base, float terrain_higher,
117 float steepness, float height_select);
118 virtual float baseTerrainLevelFromNoise(v2s16 p);
119 virtual float baseTerrainLevelFromMap(v2s16 p);
120 virtual float baseTerrainLevelFromMap(int index);
122 s16 find_stone_level(v2s16 p2d);
123 bool block_is_underground(u64 seed, v3s16 blockpos);
124 s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision);
126 float getHumidity(v2s16 p);
127 float getTreeAmount(v2s16 p);
128 bool getHaveAppleTree(v2s16 p);
129 float getMudAmount(v2s16 p);
130 virtual float getMudAmount(int index);
131 bool getHaveBeach(v2s16 p);
132 bool getHaveBeach(int index);
133 BiomeV6Type getBiome(v2s16 p);
134 BiomeV6Type getBiome(int index, v2s16 p);
136 u32 get_blockseed(u64 seed, v3s16 p);
138 virtual void calculateNoise();
139 int generateGround();
141 void flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos);
142 void addDirtGravelBlobs();
144 void placeTreesAndJungleGrass();
145 virtual void generateCaves(int max_stone_y);
146 virtual void generateExperimental() {}
149 struct MapgenFactoryV6 : public MapgenFactory {
150 Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge)
152 return new MapgenV6(mgid, params, emerge);
155 MapgenSpecificParams *createMapgenParams()
157 return new MapgenV6Params();