Line data Source code
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 MG_BIOME_HEADER
21 : #define MG_BIOME_HEADER
22 :
23 : #include "objdef.h"
24 : #include "nodedef.h"
25 :
26 : enum BiomeType
27 : {
28 : BIOME_NORMAL,
29 : BIOME_LIQUID,
30 : BIOME_NETHER,
31 : BIOME_AETHER,
32 : BIOME_FLAT
33 : };
34 :
35 0 : class Biome : public ObjDef, public NodeResolver {
36 : public:
37 : u32 flags;
38 :
39 : content_t c_top;
40 : content_t c_filler;
41 : content_t c_stone;
42 : content_t c_water_top;
43 : content_t c_water;
44 : content_t c_river_water;
45 : content_t c_dust;
46 :
47 : s16 depth_top;
48 : s16 depth_filler;
49 : s16 depth_water_top;
50 :
51 : s16 y_min;
52 : s16 y_max;
53 : float heat_point;
54 : float humidity_point;
55 :
56 : virtual void resolveNodeNames();
57 : };
58 :
59 : class BiomeManager : public ObjDefManager {
60 : public:
61 : static const char *OBJECT_TITLE;
62 :
63 : BiomeManager(IGameDef *gamedef);
64 : virtual ~BiomeManager();
65 :
66 0 : const char *getObjectTitle() const
67 : {
68 0 : return "biome";
69 : }
70 :
71 0 : static Biome *create(BiomeType type)
72 : {
73 0 : return new Biome;
74 : }
75 :
76 : virtual void clear();
77 :
78 : void calcBiomes(s16 sx, s16 sy, float *heat_map, float *humidity_map,
79 : s16 *height_map, u8 *biomeid_map);
80 : Biome *getBiome(float heat, float humidity, s16 y);
81 :
82 : private:
83 : IGameDef *m_gamedef;
84 : };
85 :
86 : #endif
87 :
|