Translation to Portuguese of Brazil for Minetest
[oweals/minetest.git] / src / biome.h
1 /*
2 Minetest
3 Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
4
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.
9
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.
14
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.
18 */
19
20 #ifndef BIOME_HEADER
21 #define BIOME_HEADER
22
23 #include <string>
24 #include "nodedef.h"
25 #include "gamedef.h"
26 #include "mapnode.h"
27 #include "noise.h"
28 #include "mapgen.h"
29
30 enum BiomeTerrainType
31 {
32         BIOME_TERRAIN_NORMAL,
33         BIOME_TERRAIN_LIQUID,
34         BIOME_TERRAIN_NETHER,
35         BIOME_TERRAIN_AETHER,
36         BIOME_TERRAIN_FLAT
37 };
38
39 extern NoiseParams nparams_biome_def_heat;
40 extern NoiseParams nparams_biome_def_humidity;
41
42 class Biome {
43 public:
44         u8 id;
45         std::string name;
46         u32 flags;
47         
48         std::string top_nodename;
49         std::string filler_nodename;
50
51         content_t c_top;
52         s16 top_depth;
53
54         content_t c_filler;
55         s16 filler_height;
56         
57         s16 height_min;
58         s16 height_max;
59         float heat_point;
60         float humidity_point;
61 };
62
63 struct BiomeNoiseInput {
64         v2s16 mapsize;
65         float *heat_map;
66         float *humidity_map;
67         s16 *height_map;
68 };
69
70 class BiomeDefManager {
71 public:
72         std::vector<Biome *> biomes;
73
74         bool biome_registration_finished;
75         NoiseParams *np_heat;
76         NoiseParams *np_humidity;
77
78         BiomeDefManager();
79         ~BiomeDefManager();
80         
81         Biome *createBiome(BiomeTerrainType btt);
82         void  calcBiomes(BiomeNoiseInput *input, u8 *biomeid_map);
83         Biome *getBiome(float heat, float humidity, s16 y);
84
85         void addBiome(Biome *b);
86         void resolveNodeNames(INodeDefManager *ndef);
87 };
88
89 #endif