diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-20 19:22:41 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-07-20 19:22:41 +0200 |
commit | 76b79b51adfd8e71312cf777595483bb1ec68910 (patch) | |
tree | 0ecc7201cad6e719a0252e8da04c5956c9d1513b | |
parent | Fixed warnings (diff) | |
download | cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar.gz cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar.bz2 cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar.lz cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar.xz cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.tar.zst cuberite-76b79b51adfd8e71312cf777595483bb1ec68910.zip |
-rw-r--r-- | src/Generating/ComposableGenerator.cpp | 8 | ||||
-rw-r--r-- | src/Generating/FinishGen.cpp | 34 | ||||
-rw-r--r-- | src/Generating/FinishGen.h | 9 |
3 files changed, 34 insertions, 17 deletions
diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp index 21626e76b..2717f4e41 100644 --- a/src/Generating/ComposableGenerator.cpp +++ b/src/Generating/ComposableGenerator.cpp @@ -338,10 +338,6 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile) float Threshold = (float)a_IniFile.GetValueSetF("Generator", "DualRidgeCavesThreshold", 0.3); m_FinishGens.push_back(new cStructGenDualRidgeCaves(Seed, Threshold)); } - else if (NoCaseCompare(*itr, "Foliage") == 0) - { - m_FinishGens.push_back(new cFinishGenFoliage(Seed)); - } else if (NoCaseCompare(*itr, "Ice") == 0) { m_FinishGens.push_back(new cFinishGenIce); @@ -419,6 +415,10 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile) { m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed)); } + else if (NoCaseCompare(*itr, "TallGrass") == 0) + { + m_FinishGens.push_back(new cFinishGenTallGrass(Seed)); + } else if (NoCaseCompare(*itr, "TestRails") == 0) { m_FinishGens.push_back(new cTestRailsGen(Seed, 100, 1, 7, 50)); diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 86f5711a7..3ee657e38 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -162,24 +162,42 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cFinishGenFoliage: -void cFinishGenFoliage::GenFinish(cChunkDesc & a_ChunkDesc) +void cFinishGenTallGrass::GenFinish(cChunkDesc & a_ChunkDesc) { - for (int x = 1; x < cChunkDef::Width; x++) + for (int x = 0; x < cChunkDef::Width; x++) { - int xx = x + a_ChunkDesc.GetChunkX(); - for (int z = 1; z < cChunkDef::Width; z++) + float xx = (float) x + a_ChunkDesc.GetChunkX(); + for (int z = 0; z < cChunkDef::Width; z++) { - int zz = z + a_ChunkDesc.GetChunkZ(); - if (m_Noise.CubicNoise2D((float) xx + m_Noise.CubicNoise1D(xx), (float) zz + m_Noise.CubicNoise1D(zz)) < GetBiomeDensity(a_ChunkDesc.GetBiome(x, z))) + float zz = (float) z + a_ChunkDesc.GetChunkZ(); + float BiomeDensity = GetBiomeDensity(a_ChunkDesc.GetBiome(x, z)); + if (m_Noise.CubicNoise2D(xx + m_Noise.CubicNoise1D(xx), zz + m_Noise.CubicNoise1D(zz)) < BiomeDensity) { for (int y = a_ChunkDesc.GetHeight(x, z) + 1; y >= 1; y--) { if ( (a_ChunkDesc.GetBlockType(x, y, z) == E_BLOCK_AIR) && - (a_ChunkDesc.GetBlockType(x, y - 1, z) == E_BLOCK_GRASS) + ((a_ChunkDesc.GetBlockType(x, y - 1, z) == E_BLOCK_GRASS) || (a_ChunkDesc.GetBlockType(x, y - 1, z) == E_BLOCK_DIRT)) ) { - a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, m_Noise.CubicNoise2D(xx * 100, zz * 100) > -0.2 ? 1 : 2); + float GrassType = m_Noise.CubicNoise2D(xx * 50, zz * 50); + if (GrassType < 0.2f) + { + a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 1); + } + else if (GrassType < 0.8f) + { + a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 2); + } + else + { + if (a_ChunkDesc.GetBlockType(x, y + 1, z) == E_BLOCK_AIR) + { + NIBBLETYPE Meta = m_Noise.CubicNoise2D(xx * 100, zz * 100) > -0.5f ? 2 : 3; + a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_BIG_FLOWER, Meta); + a_ChunkDesc.SetBlockTypeMeta(x, y + 1, z, E_BLOCK_BIG_FLOWER, 8); + } + } } } } diff --git a/src/Generating/FinishGen.h b/src/Generating/FinishGen.h index d2968e592..17a807e9b 100644 --- a/src/Generating/FinishGen.h +++ b/src/Generating/FinishGen.h @@ -69,11 +69,11 @@ protected: -class cFinishGenFoliage : +class cFinishGenTallGrass : public cFinishGen { public: - cFinishGenFoliage(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {} + cFinishGenTallGrass(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {} protected: cNoise m_Noise; @@ -92,14 +92,13 @@ protected: case biSavannaPlateauM: case biPlains: { - return 0.0f; + return 0.4f; } default: { - return -0.4f; + return -0.6f; } } - return -0.3f; } }; |