]> git.lizzy.rs Git - minetest.git/blobdiff - src/mg_biome.h
Set acceleration only once in falling node
[minetest.git] / src / mg_biome.h
index 3724652bd7651637473785383a401214a8cc98e0..8d519f808cc175de92254c1c2dea33a72315e397 100644 (file)
@@ -20,73 +20,68 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #ifndef MG_BIOME_HEADER
 #define MG_BIOME_HEADER
 
-#include <string>
+#include "objdef.h"
 #include "nodedef.h"
-#include "gamedef.h"
-#include "mapnode.h"
-#include "noise.h"
-#include "mapgen.h"
 
-enum BiomeTerrainType
+enum BiomeType
 {
-       BIOME_TERRAIN_NORMAL,
-       BIOME_TERRAIN_LIQUID,
-       BIOME_TERRAIN_NETHER,
-       BIOME_TERRAIN_AETHER,
-       BIOME_TERRAIN_FLAT
+       BIOME_NORMAL,
+       BIOME_LIQUID,
+       BIOME_NETHER,
+       BIOME_AETHER,
+       BIOME_FLAT
 };
 
-extern NoiseParams nparams_biome_def_heat;
-extern NoiseParams nparams_biome_def_humidity;
-
-class Biome {
+class Biome : public ObjDef, public NodeResolver {
 public:
-       u8 id;
-       std::string name;
        u32 flags;
 
        content_t c_top;
        content_t c_filler;
+       content_t c_stone;
+       content_t c_water_top;
        content_t c_water;
+       content_t c_river_water;
        content_t c_dust;
-       content_t c_dust_water;
 
        s16 depth_top;
        s16 depth_filler;
+       s16 depth_water_top;
 
-       s16 height_min;
-       s16 height_max;
+       s16 y_min;
+       s16 y_max;
        float heat_point;
        float humidity_point;
-};
 
-struct BiomeNoiseInput {
-       v2s16 mapsize;
-       float *heat_map;
-       float *humidity_map;
-       s16 *height_map;
+       virtual void resolveNodeNames();
 };
 
-class BiomeDefManager {
+class BiomeManager : public ObjDefManager {
 public:
-       std::vector<Biome *> biomes;
+       static const char *OBJECT_TITLE;
 
-       bool biome_registration_finished;
-       NoiseParams *np_heat;
-       NoiseParams *np_humidity;
+       BiomeManager(IGameDef *gamedef);
+       virtual ~BiomeManager();
 
-       BiomeDefManager(NodeResolver *resolver);
-       ~BiomeDefManager();
+       const char *getObjectTitle() const
+       {
+               return "biome";
+       }
 
-       Biome *createBiome(BiomeTerrainType btt);
-       void  calcBiomes(BiomeNoiseInput *input, u8 *biomeid_map);
-       Biome *getBiome(float heat, float humidity, s16 y);
+       static Biome *create(BiomeType type)
+       {
+               return new Biome;
+       }
 
-       bool addBiome(Biome *b);
-       u8 getBiomeIdByName(const char *name);
+       virtual void clear();
 
-       s16 calcBlockHeat(v3s16 p, u64 seed, float timeofday, float totaltime);
-       s16 calcBlockHumidity(v3s16 p, u64 seed, float timeofday, float totaltime);
+       void calcBiomes(s16 sx, s16 sy, float *heat_map, float *humidity_map,
+               s16 *height_map, u8 *biomeid_map);
+       Biome *getBiome(float heat, float humidity, s16 y);
+
+private:
+       IGameDef *m_gamedef;
 };
 
 #endif
+