settings->getS16NoEx("water_level", params.water_level);
settings->getS16NoEx("chunksize", params.chunksize);
settings->getFlagStrNoEx("mg_flags", params.flags, flagdesc_mapgen);
+ settings->getNoiseParams("mg_biome_np_heat", params.np_biome_heat);
+ settings->getNoiseParams("mg_biome_np_humidity", params.np_biome_humidity);
delete params.sparams;
params.sparams = createMapgenParams(params.mg_name);
settings->setS16("water_level", params.water_level);
settings->setS16("chunksize", params.chunksize);
settings->setFlagStr("mg_flags", params.flags, flagdesc_mapgen, (u32)-1);
+ settings->setNoiseParams("mg_biome_np_heat", params.np_biome_heat);
+ settings->setNoiseParams("mg_biome_np_humidity", params.np_biome_humidity);
if (params.sparams)
params.sparams->writeParams(settings);
#ifndef MAPGEN_HEADER
#define MAPGEN_HEADER
+#include "noise.h"
#include "nodedef.h"
#include "mapnode.h"
#include "util/string.h"
s16 water_level;
u32 flags;
+ NoiseParams np_biome_heat;
+ NoiseParams np_biome_humidity;
+
MapgenSpecificParams *sparams;
MapgenParams()
chunksize = 5;
flags = MG_TREES | MG_CAVES | MG_LIGHT;
sparams = NULL;
+ np_biome_heat = NoiseParams(50, 50, v3f(500.0, 500.0, 500.0), 5349, 3, 0.70, 2.0);
+ np_biome_humidity = NoiseParams(50, 50, v3f(500.0, 500.0, 500.0), 842, 3, 0.55, 2.0);
}
};
noise_wetness = new Noise(&sp->np_wetness, seed, csize.X, csize.Y + 2, csize.Z);
// Biome noise
- noise_heat = new Noise(bmgr->np_heat, seed, csize.X, csize.Z);
- noise_humidity = new Noise(bmgr->np_humidity, seed, csize.X, csize.Z);
+ noise_heat = new Noise(¶ms->np_biome_heat, seed, csize.X, csize.Z);
+ noise_humidity = new Noise(¶ms->np_biome_humidity, seed, csize.X, csize.Z);
//// Resolve nodes to be used
INodeDefManager *ndef = emerge->ndef;
noise_ridge = new Noise(&sp->np_ridge, seed, csize.X, csize.Y, csize.Z);
//// Biome noise
- noise_heat = new Noise(bmgr->np_heat, seed, csize.X, csize.Z);
- noise_humidity = new Noise(bmgr->np_humidity, seed, csize.X, csize.Z);
+ noise_heat = new Noise(¶ms->np_biome_heat, seed, csize.X, csize.Z);
+ noise_humidity = new Noise(¶ms->np_biome_humidity, seed, csize.X, csize.Z);
//// Resolve nodes to be used
INodeDefManager *ndef = emerge->ndef;
Biome *MapgenV7::getBiomeAtPoint(v3s16 p) {
- float heat = NoisePerlin2D(bmgr->np_heat, p.X, p.Z, seed);
- float humidity = NoisePerlin2D(bmgr->np_humidity, p.X, p.Z, seed);
+ float heat = NoisePerlin2D(noise_heat->np, p.X, p.Z, seed);
+ float humidity = NoisePerlin2D(noise_humidity->np, p.X, p.Z, seed);
s16 groundlevel = baseTerrainLevelAtPoint(p.X, p.Z);
return bmgr->getBiome(heat, humidity, groundlevel);
const char *BiomeManager::ELEMENT_TITLE = "biome";
-NoiseParams nparams_biome_def_heat(50, 50, v3f(500.0, 500.0, 500.0), 5349, 3, 0.70, 2.0);
-NoiseParams nparams_biome_def_humidity(50, 50, v3f(500.0, 500.0, 500.0), 842, 3, 0.55, 2.0);
-
///////////////////////////////////////////////////////////////////////////////
BiomeManager::BiomeManager(IGameDef *gamedef)
{
m_resolver = gamedef->getNodeDefManager()->getResolver();
- np_heat = &nparams_biome_def_heat;
- np_humidity = &nparams_biome_def_humidity;
// Create default biome to be used in case none exist
Biome *b = new Biome;
#define MG_BIOME_HEADER
#include "mapgen.h"
-#include "noise.h"
+
+struct NoiseParams;
enum BiomeType
{
BIOME_TYPE_FLAT
};
-extern NoiseParams nparams_biome_def_heat;
-extern NoiseParams nparams_biome_def_humidity;
-
-
class Biome : public GenElement {
public:
u32 flags;
static const char *ELEMENT_TITLE;
static const size_t ELEMENT_LIMIT = 0x100;
- NoiseParams *np_heat;
- NoiseParams *np_humidity;
-
BiomeManager(IGameDef *gamedef);
~BiomeManager();