]> git.lizzy.rs Git - minetest.git/blob - src/biome.h
Add setting for tooltips show delay.
[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 nname_top;
49         std::string nname_filler;
50         std::string nname_water;
51         std::string nname_dust;
52         std::string nname_dust_water;
53
54         content_t c_top;
55         content_t c_filler;
56         content_t c_water;
57         content_t c_dust;
58         content_t c_dust_water;
59         
60         s16 depth_top;
61         s16 depth_filler;
62         
63         s16 height_min;
64         s16 height_max;
65         float heat_point;
66         float humidity_point;
67 };
68
69 struct BiomeNoiseInput {
70         v2s16 mapsize;
71         float *heat_map;
72         float *humidity_map;
73         s16 *height_map;
74 };
75
76 class BiomeDefManager {
77 public:
78         std::vector<Biome *> biomes;
79
80         bool biome_registration_finished;
81         NoiseParams *np_heat;
82         NoiseParams *np_humidity;
83
84         BiomeDefManager();
85         ~BiomeDefManager();
86         
87         Biome *createBiome(BiomeTerrainType btt);
88         void  calcBiomes(BiomeNoiseInput *input, u8 *biomeid_map);
89         Biome *getBiome(float heat, float humidity, s16 y);
90
91         void addBiome(Biome *b);
92         void resolveNodeNames(INodeDefManager *ndef);
93         u8 getBiomeIdByName(const char *name);
94         
95         s16 calcBlockHeat(v3s16 p, u64 seed, float timeofday, float totaltime);
96         s16 calcBlockHumidity(v3s16 p, u64 seed, float timeofday, float totaltime);
97 };
98
99 #endif