X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fmg_biome.h;h=8d519f808cc175de92254c1c2dea33a72315e397;hb=65c09a96f41705bb8e75fc5ff4276342be91ed11;hp=3724652bd7651637473785383a401214a8cc98e0;hpb=9e811a92e7846b958e4bc84aeb30bad8b51e8e1d;p=minetest.git diff --git a/src/mg_biome.h b/src/mg_biome.h index 3724652bd..8d519f808 100644 --- a/src/mg_biome.h +++ b/src/mg_biome.h @@ -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 +#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 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 +