From ab6e8b790c1269912aceb7b3759a7c03e4deca08 Mon Sep 17 00:00:00 2001 From: NiLSPACE Date: Sat, 5 Mar 2016 23:56:08 +0100 Subject: Implemented OverworldClumpFlowers --- src/Generating/FinishGen.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'src/Generating/FinishGen.h') diff --git a/src/Generating/FinishGen.h b/src/Generating/FinishGen.h index 8e90f9f2a..30108b6da 100644 --- a/src/Generating/FinishGen.h +++ b/src/Generating/FinishGen.h @@ -70,6 +70,80 @@ protected: +class cFinishGenClumpTopBlock : + public cFinishGen +{ +public: + // Contains the meta, type and weight for a clump block + struct FoliageInfo + { + BLOCKTYPE m_BlockType; + NIBBLETYPE m_BlockMeta; + int m_Weight; + + FoliageInfo(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_Weight) : + m_BlockType(a_BlockType), + m_BlockMeta(a_BlockMeta), + m_Weight(a_Weight) + {} + }; + + // Contains the minimum and maximum amount of clumps for a biome and it's blocks. + struct BiomeInfo + { + int m_MinNumClumpsPerChunk; + int m_MaxNumClumpsPerChunk; + std::vector m_Blocks; + + BiomeInfo() : + m_MinNumClumpsPerChunk(0), + m_MaxNumClumpsPerChunk(2), + m_Blocks() + {} + + BiomeInfo(int a_MinNumClumpsPerChunk, int a_MaxNumClumpsPerChunk, std::vector a_Blocks) : + m_MinNumClumpsPerChunk(a_MinNumClumpsPerChunk), + m_MaxNumClumpsPerChunk(a_MaxNumClumpsPerChunk), + m_Blocks(a_Blocks) + {} + }; + + + cFinishGenClumpTopBlock(int a_Seed, std::vector a_BlockList) : + m_Noise(a_Seed), + m_FlowersPerBiome() + { + std::swap(a_BlockList, m_FlowersPerBiome); + } + + /** Parses a string and puts a vector with a length of biMaxVariantBiome in a_Output. + The format of the string is ";". This can also be repeated with a | */ + static void ParseConfigurationString(AString a_String, std::vector & a_Output); + + /** Parses an inifile in search for all clumps */ + static std::vector ParseIniFile(cIniFile & a_IniFile, AString a_ClumpPrefix); +protected: + + cNoise m_Noise; + std::vector m_FlowersPerBiome; + + /** The maximum number of foliage per clump */ + const int MAX_NUM_FOLIAGE = 8; + + /** The mininum number of foliage per clump */ + const int MIN_NUM_FOLIAGE = 4; + + /** The maximum range a foliage can be placed from the center of the clump */ + const int RANGE_FROM_CENTER = 5; + + void TryPlaceFoliageClump(cChunkDesc & a_ChunkDesc, int a_RelX, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, bool a_IsDoubleTall); + virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; +}; + + + + + class cFinishGenGlowStone : public cFinishGen { -- cgit v1.2.3