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
23 #include "dungeongen.h"
26 #define AVERAGE_MUD_AMOUNT 4
34 extern NoiseParams nparams_v6_def_terrain_base;
35 extern NoiseParams nparams_v6_def_terrain_higher;
36 extern NoiseParams nparams_v6_def_steepness;
37 extern NoiseParams nparams_v6_def_height_select;
38 extern NoiseParams nparams_v6_def_trees;
39 extern NoiseParams nparams_v6_def_mud;
40 extern NoiseParams nparams_v6_def_beach;
41 extern NoiseParams nparams_v6_def_biome;
42 extern NoiseParams nparams_v6_def_cave;
44 struct MapgenV6Params : public MapgenParams {
47 NoiseParams *np_terrain_base;
48 NoiseParams *np_terrain_higher;
49 NoiseParams *np_steepness;
50 NoiseParams *np_height_select;
51 NoiseParams *np_trees;
53 NoiseParams *np_beach;
54 NoiseParams *np_biome;
60 np_terrain_base = &nparams_v6_def_terrain_base;
61 np_terrain_higher = &nparams_v6_def_terrain_higher;
62 np_steepness = &nparams_v6_def_steepness;
63 np_height_select = &nparams_v6_def_height_select;
64 np_trees = &nparams_v6_def_trees;
65 np_mud = &nparams_v6_def_mud;
66 np_beach = &nparams_v6_def_beach;
67 np_biome = &nparams_v6_def_biome;
68 np_cave = &nparams_v6_def_cave;
71 bool readParams(Settings *settings);
72 void writeParams(Settings *settings);
75 class MapgenV6 : public Mapgen {
77 //ManualMapVoxelManipulator &vmanip;
85 Noise *noise_terrain_base;
86 Noise *noise_terrain_higher;
87 Noise *noise_steepness;
88 Noise *noise_height_select;
94 float *map_terrain_base;
95 float *map_terrain_higher;
97 float *map_height_select;
103 NoiseParams *np_cave;
109 MapgenV6(int mapgenid, MapgenV6Params *params);
112 void makeChunk(BlockMakeData *data);
113 int getGroundLevelAtPoint(v2s16 p);
115 double baseRockLevelFromNoise(v2s16 p);
116 static s16 find_ground_level(VoxelManipulator &vmanip,
117 v2s16 p2d, INodeDefManager *ndef);
118 static s16 find_stone_level(VoxelManipulator &vmanip,
119 v2s16 p2d, INodeDefManager *ndef);
120 void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0,
121 bool is_apple_tree, INodeDefManager *ndef);
122 double tree_amount_2d(u64 seed, v2s16 p);
123 bool block_is_underground(u64 seed, v3s16 blockpos);
124 double base_rock_level_2d(u64 seed, v2s16 p);
125 s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision);
126 double get_mud_add_amount(u64 seed, v2s16 p);
127 bool get_have_beach(u64 seed, v2s16 p2d);
128 BiomeType get_biome(u64 seed, v2s16 p2d);
129 u32 get_blockseed(u64 seed, v3s16 p);
132 struct MapgenFactoryV6 : public MapgenFactory {
133 Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
134 return new MapgenV6(mgid, (MapgenV6Params *)params);
137 MapgenParams *createMapgenParams() {
138 return new MapgenV6Params();