From 8c04abf9aa749af3b15bc92f517b636c9593109e Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 30 Oct 2014 16:24:35 +0100 Subject: QtBiomeVisualiser: Added a prototyping int generator flavor. This generator is easier to manipulate, since it doesn't require rewriting the sizes in the template parameters. On the other hand, it doesn't optimize so well, so it's a bit slower. --- src/Generating/BioGen.cpp | 124 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 111 insertions(+), 13 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index 6fab1b9d9..f9a0a571b 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -6,6 +6,7 @@ #include "Globals.h" #include "BioGen.h" #include "IntGen.h" +#include "ProtIntGen.h" #include "../IniFile.h" #include "../LinearUpscale.h" @@ -927,9 +928,9 @@ public: cBioGenGrown(int a_Seed) { auto FinalRivers = - std::make_shared> (a_Seed + 1, - std::make_shared> (a_Seed + 2, - std::make_shared> (a_Seed + 3, + std::make_shared> (a_Seed + 1, + std::make_shared> (a_Seed + 3, + std::make_shared> (a_Seed + 2, std::make_shared> (a_Seed + 4, std::make_shared> (a_Seed + 5, std::make_shared> (a_Seed + 6, @@ -942,10 +943,10 @@ public: )))))))))))); auto FinalBiomes = - std::make_shared> (a_Seed + 1008, - std::make_shared>(a_Seed + 15, - std::make_shared> (a_Seed + 1000, - std::make_shared> (a_Seed + 16, + std::make_shared> (a_Seed + 1008, + std::make_shared>(a_Seed + 15, + std::make_shared> (a_Seed + 1000, + std::make_shared> (a_Seed + 16, std::make_shared> ( std::make_shared> (a_Seed + 1002, std::make_shared>(a_Seed + 1, @@ -953,7 +954,8 @@ public: std::make_shared> (a_Seed + 2, std::make_shared> (a_Seed + 2004, 10, std::make_shared> (a_Seed + 4, - std::make_shared> (a_Seed + 9, 50, biMushroomIsland, + std::make_shared> (a_Seed + 9, 10, biMushroomIsland, + std::make_shared> (biIcePlains, biIcePlainsSpikes, 5, a_Seed + 99, std::make_shared> (a_Seed + 8, std::make_shared> (a_Seed + 10, 500, biDeepOcean, std::make_shared> (a_Seed + 3000, @@ -961,22 +963,26 @@ public: std::make_shared> ( std::make_shared> (a_Seed + 1003, std::make_shared> (a_Seed + 7, + std::make_shared> (a_Seed + 8, 50, bgOcean, std::make_shared> (bgJungle, bgTemperate, 50, a_Seed + 100, std::make_shared> (bgIce, bgTemperate, 50, a_Seed + 101, + std::make_shared> (bgDesert, bgMesa, 30, a_Seed + 102, std::make_shared> (a_Seed + 2000, 70, + std::make_shared> (a_Seed + 9, 50, bgOcean, std::make_shared> (a_Seed + 1004, std::make_shared> (a_Seed + 10, std::make_shared> (a_Seed + 100, 65 - ))))))))))))))))))))))))); + ))))))))))))))))))))))))))))); m_Gen = std::make_shared>(a_Seed, std::make_shared>(a_Seed, - std::make_shared>(a_Seed, - std::make_shared>(a_Seed, - std::make_shared> ( + std::make_shared>(a_Seed, + std::make_shared>(a_Seed, + std::make_shared>(a_Seed, + std::make_shared> ( FinalBiomes, FinalRivers - ))))); + )))))); } virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override @@ -1000,6 +1006,94 @@ protected: +//////////////////////////////////////////////////////////////////////////////// +// cBioGenGrown: + +class cBioGenProtGrown: + public cBiomeGen +{ +public: + cBioGenProtGrown(int a_Seed) + { + auto FinalRivers = + std::make_shared(a_Seed + 1, + std::make_shared(a_Seed + 3, + std::make_shared(a_Seed + 2, + std::make_shared(a_Seed + 4, + std::make_shared(a_Seed + 5, + std::make_shared(a_Seed + 6, + std::make_shared(a_Seed + 7, + std::make_shared(a_Seed + 8, + std::make_shared(a_Seed + 9, + std::make_shared(a_Seed + 10, + std::make_shared(a_Seed + 11, + std::make_shared(a_Seed + 12, 2 + )))))))))))); + + auto FinalBiomes = + std::make_shared(a_Seed + 1008, + std::make_shared(a_Seed + 15, + std::make_shared(a_Seed + 1000, + std::make_shared(a_Seed + 16, + std::make_shared( + std::make_shared(a_Seed + 1002, + std::make_shared(a_Seed + 1, + std::make_shared(a_Seed + 1002, + std::make_shared(a_Seed + 2, + std::make_shared(a_Seed + 2004, 10, + std::make_shared(a_Seed + 4, + std::make_shared(a_Seed + 9, 10, biMushroomIsland, + std::make_shared(biIcePlains, biIcePlainsSpikes, 5, a_Seed + 99, + std::make_shared(a_Seed + 8, + std::make_shared(a_Seed + 10, 500, biDeepOcean, + std::make_shared(a_Seed + 3000, + std::make_shared(a_Seed + 5, + std::make_shared( + std::make_shared(a_Seed + 1003, + std::make_shared(a_Seed + 7, + std::make_shared(a_Seed + 8, 50, bgOcean, + std::make_shared(bgJungle, bgTemperate, 50, a_Seed + 100, + std::make_shared(bgIce, bgTemperate, 50, a_Seed + 101, + std::make_shared(bgDesert, bgMesa, 30, a_Seed + 102, + std::make_shared(a_Seed + 2000, 70, + std::make_shared(a_Seed + 9, 50, bgOcean, + std::make_shared(a_Seed + 1004, + std::make_shared(a_Seed + 10, + std::make_shared(a_Seed + 100, 65 + ))))))))))))))))))))))))))))); + + m_Gen = + std::make_shared(a_Seed, + std::make_shared(a_Seed, + std::make_shared(a_Seed, + std::make_shared(a_Seed, + std::make_shared(a_Seed, + std::make_shared( + FinalBiomes, FinalRivers + )))))); + } + + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override + { + int vals[16 * 16]; + m_Gen->GetInts(a_ChunkX * cChunkDef::Width, a_ChunkZ * cChunkDef::Width, 16, 16, vals); + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + cChunkDef::SetBiome(a_Biomes, x, z, (EMCSBiome)vals[x + cChunkDef::Width * z]); + } + } + } + +protected: + std::shared_ptr m_Gen; +}; + + + + + //////////////////////////////////////////////////////////////////////////////// // cBiomeGen: @@ -1040,6 +1134,10 @@ cBiomeGenPtr cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & { res = new cBioGenGrown(a_Seed); } + else if (NoCaseCompare(BiomeGenName, "grownprot") == 0) + { + res = new cBioGenProtGrown(a_Seed); + } else { if (NoCaseCompare(BiomeGenName, "multistepmap") != 0) -- cgit v1.2.3