/*
-Minetest-c55
-Copyright (C) 2010-2011 kwolekr, Ryan Kwolek <kwolekr2@cs.scranton.edu>
+Minetest
+Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
#ifndef BIOME_HEADER
#define BIOME_HEADER
+#include <string>
#include "nodedef.h"
#include "gamedef.h"
#include "mapnode.h"
#include "noise.h"
#include "mapgen.h"
+enum BiomeTerrainType
+{
+ BIOME_TERRAIN_NORMAL,
+ BIOME_TERRAIN_LIQUID,
+ BIOME_TERRAIN_NETHER,
+ BIOME_TERRAIN_AETHER,
+ BIOME_TERRAIN_FLAT
+};
+
+extern NoiseParams nparams_biome_def_heat;
+extern NoiseParams nparams_biome_def_humidity;
+
class Biome {
public:
- MapNode n_top;
- MapNode n_filler;
- s16 ntopnodes;
- s16 flags;
+ u8 id;
+ std::string name;
+ u32 flags;
+
+ std::string nname_top;
+ std::string nname_filler;
+ std::string nname_water;
+ std::string nname_dust;
+ std::string nname_dust_water;
+
+ content_t c_top;
+ content_t c_filler;
+ content_t c_water;
+ content_t c_dust;
+ content_t c_dust_water;
+
+ s16 depth_top;
+ s16 depth_filler;
+
s16 height_min;
s16 height_max;
- float heat_min;
- float heat_max;
- float humidity_min;
- float humidity_max;
- const char *name;
- NoiseParams *np;
-
- virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
- virtual int getSurfaceHeight(float noise_terrain);
+ float heat_point;
+ float humidity_point;
};
-class BiomeOcean : public Biome {
- virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
-};
-
-class BiomeHell : public Biome {
- virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
- virtual int getSurfaceHeight(float noise_terrain);
-};
-
-class BiomeSuperflat : public Biome {
- virtual void genColumn(Mapgen *mg, int x, int z, int y1, int y2);
- virtual int getSurfaceHeight(float noise_terrain);
+struct BiomeNoiseInput {
+ v2s16 mapsize;
+ float *heat_map;
+ float *humidity_map;
+ s16 *height_map;
};
class BiomeDefManager {
public:
- std::vector<float> bgroup_freqs;
- std::vector<std::vector<Biome *> *> bgroups;
- Biome *biome_default;
- IGameDef *m_gamedef;
- INodeDefManager *ndef;
+ std::vector<Biome *> biomes;
- BiomeDefManager(IGameDef *gamedef);
- ~BiomeDefManager();
+ bool biome_registration_finished;
+ NoiseParams *np_heat;
+ NoiseParams *np_humidity;
- Biome *getBiome(float bgfreq, float heat, float humidity);
+ BiomeDefManager();
+ ~BiomeDefManager();
+
+ Biome *createBiome(BiomeTerrainType btt);
+ void calcBiomes(BiomeNoiseInput *input, u8 *biomeid_map);
+ Biome *getBiome(float heat, float humidity, s16 y);
- void addBiome();
- void addDefaultBiomes();
+ void addBiome(Biome *b);
+ void resolveNodeNames(INodeDefManager *ndef);
+ u8 getBiomeIdByName(const char *name);
+
+ s16 calcBlockHeat(v3s16 p, u64 seed, float timeofday, float totaltime);
+ s16 calcBlockHumidity(v3s16 p, u64 seed, float timeofday, float totaltime);
};
#endif