diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/emerge.cpp | 4 | ||||
-rw-r--r-- | src/mapgen.h | 6 | ||||
-rw-r--r-- | src/mapgen_v5.cpp | 4 | ||||
-rw-r--r-- | src/mapgen_v7.cpp | 8 | ||||
-rw-r--r-- | src/mg_biome.cpp | 5 | ||||
-rw-r--r-- | src/mg_biome.h | 10 |
6 files changed, 18 insertions, 19 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp index 8813a71a9..133fd4a59 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -363,6 +363,8 @@ void EmergeManager::loadParamsFromSettings(Settings *settings) { 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); @@ -377,6 +379,8 @@ void EmergeManager::saveParamsToSettings(Settings *settings) { 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); diff --git a/src/mapgen.h b/src/mapgen.h index 5feeaf97c..834495036 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef MAPGEN_HEADER #define MAPGEN_HEADER +#include "noise.h" #include "nodedef.h" #include "mapnode.h" #include "util/string.h" @@ -107,6 +108,9 @@ struct MapgenParams { s16 water_level; u32 flags; + NoiseParams np_biome_heat; + NoiseParams np_biome_humidity; + MapgenSpecificParams *sparams; MapgenParams() @@ -117,6 +121,8 @@ struct 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); } }; diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp index 959e5c33f..04e9d8c95 100644 --- a/src/mapgen_v5.cpp +++ b/src/mapgen_v5.cpp @@ -77,8 +77,8 @@ MapgenV5::MapgenV5(int mapgenid, MapgenParams *params, EmergeManager *emerge) 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; diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp index 7b7377611..739efadd8 100644 --- a/src/mapgen_v7.cpp +++ b/src/mapgen_v7.cpp @@ -81,8 +81,8 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge) 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; @@ -305,8 +305,8 @@ void MapgenV7::calculateNoise() { 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); diff --git a/src/mg_biome.cpp b/src/mg_biome.cpp index dff73e34f..13dc67e74 100644 --- a/src/mg_biome.cpp +++ b/src/mg_biome.cpp @@ -29,17 +29,12 @@ with this program; if not, write to the Free Software Foundation, Inc., 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; diff --git a/src/mg_biome.h b/src/mg_biome.h index 9180069df..04567267f 100644 --- a/src/mg_biome.h +++ b/src/mg_biome.h @@ -21,7 +21,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MG_BIOME_HEADER #include "mapgen.h" -#include "noise.h" + +struct NoiseParams; enum BiomeType { @@ -32,10 +33,6 @@ enum BiomeType BIOME_TYPE_FLAT }; -extern NoiseParams nparams_biome_def_heat; -extern NoiseParams nparams_biome_def_humidity; - - class Biome : public GenElement { public: u32 flags; @@ -61,9 +58,6 @@ public: static const char *ELEMENT_TITLE; static const size_t ELEMENT_LIMIT = 0x100; - NoiseParams *np_heat; - NoiseParams *np_humidity; - BiomeManager(IGameDef *gamedef); ~BiomeManager(); |