diff --git a/source/Caves.cpp b/source/Caves.cpp index e702e1902..4cc8506ed 100644 --- a/source/Caves.cpp +++ b/source/Caves.cpp @@ -480,7 +480,7 @@ void cCaveTunnel::ProcessChunk( int DifX = itr->m_BlockX - BlockStartX; // substitution for faster calc int DifY = itr->m_BlockY; int DifZ = itr->m_BlockZ - BlockStartZ; // substitution for faster calc - int Bottom = std::max(itr->m_BlockY - itr->m_Radius, 0); + int Bottom = std::max(itr->m_BlockY - itr->m_Radius, 1); int Top = std::min(itr->m_BlockY + itr->m_Radius, cChunkDef::Height); int SqRad = itr->m_Radius * itr->m_Radius; for (int z = 0; z < cChunkDef::Width; z++) for (int x = 0; x < cChunkDef::Width; x++) @@ -881,14 +881,7 @@ void cStructGenMarbleCaves::GenStructures( const float WaveNoise = 1; if (cosf(GetMarbleNoise(xx, yy * 0.5f, zz, Noise)) * fabs(cosf(yy * 0.2f + WaveNoise * 2) * 0.75f + WaveNoise) > 0.0005f) { - if (y > 4) - { - cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR); - } - else - { - cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_STATIONARY_LAVA); - } + cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR); } } // for y } // for x @@ -938,14 +931,7 @@ void cStructGenDualRidgeCaves::GenStructures( float n4 = Noise2.CubicNoise3D(xx * 4, yy * 4, zz * 4) / 4; if ((abs(n1 + n3) * abs(n2 + n4)) > m_Threshold) { - if (y > 10) - { - cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR); - } - else - { - cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_STATIONARY_LAVA); - } + cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR); } } // for y } // for x diff --git a/source/FinishGen.cpp b/source/FinishGen.cpp index 819bfff76..26c3a70f1 100644 --- a/source/FinishGen.cpp +++ b/source/FinishGen.cpp @@ -356,3 +356,32 @@ void cFinishGenLilypads::GenFinish( +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cFinishGenBottomLava: + +void cFinishGenBottomLava::GenFinish( + int a_ChunkX, int a_ChunkZ, + cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change + cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change + cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data + const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to + cEntityList & a_Entities, // Entities may be added or deleted + cBlockEntityList & a_BlockEntities // Block entities may be added or deleted +) +{ + for (int y = m_Level; y > 0; y--) + { + for (int z = 0; z < cChunkDef::Width; z++) for (int x = 0; x < cChunkDef::Width; x++) + { + int Index = cChunkDef::MakeIndexNoCheck(x, y, z); + if (a_BlockTypes[Index] == E_BLOCK_AIR) + { + a_BlockTypes[Index] = E_BLOCK_STATIONARY_LAVA; + } + } // for x, for z + } // for y +} + + + + diff --git a/source/FinishGen.h b/source/FinishGen.h index 39a79c384..afa570fdf 100644 --- a/source/FinishGen.h +++ b/source/FinishGen.h @@ -5,6 +5,8 @@ - cFinishGenSnow - cFinishGenIce - cFinishGenSprinkleFoliage + - cFinishGenLilypads + - cFinishGenBottomLava */ @@ -120,3 +122,31 @@ protected: +class cFinishGenBottomLava : + public cFinishGen +{ +public: + cFinishGenBottomLava(int a_Level) : + m_Level(a_Level) + { + } + +protected: + int m_Level; + + // cFinishGen override: + virtual void GenFinish( + int a_ChunkX, int a_ChunkZ, + cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change + cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change + cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data + const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to + cEntityList & a_Entities, // Entities may be added or deleted + cBlockEntityList & a_BlockEntities // Block entities may be added or deleted + ) override; +} ; + + + + + diff --git a/source/cChunkGenerator.cpp b/source/cChunkGenerator.cpp index c6b6fc26a..96e41508c 100644 --- a/source/cChunkGenerator.cpp +++ b/source/cChunkGenerator.cpp @@ -253,13 +253,7 @@ void cChunkGenerator::InitCompositionGen(cIniFile & a_IniFile) } if (NoCaseCompare(CompoGenName, "sameblock") == 0) { - AString BlockType = a_IniFile.GetValueSet("Generator", "SameBlockType", ""); - if (BlockType.empty()) - { - LOGWARN("[Generator]::SameBlockType value not found in world.ini, using \"stone\"."); - BlockType = "stone"; - } - int Block = GetIniBlock(a_IniFile, "[Generator]", "SameBlockType", "stone"); + int Block = GetIniBlock(a_IniFile, "Generator", "SameBlockType", "stone"); bool Bedrocked = (a_IniFile.GetValueSetI("Generator", "SameBlockBedrocked", 1) != 0); m_CompositionGen = new cCompoGenSameBlock((BLOCKTYPE)Block, Bedrocked); } @@ -346,7 +340,7 @@ void cChunkGenerator::InitStructureGens(cIniFile & a_IniFile) void cChunkGenerator::InitFinishGens(cIniFile & a_IniFile) { - AString Structures = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads"); + AString Structures = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads,BottomLava"); AStringVector Str = StringSplit(Structures, ","); for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr) @@ -367,6 +361,11 @@ void cChunkGenerator::InitFinishGens(cIniFile & a_IniFile) { m_FinishGens.push_back(new cFinishGenLilypads(m_Seed)); } + else if (NoCaseCompare(*itr, "BottomLava") == 0) + { + int BottomLavaLevel = a_IniFile.GetValueSetI("Generator", "BottomLavaLevel", 10); + m_FinishGens.push_back(new cFinishGenBottomLava(BottomLavaLevel)); + } } // for itr - Str[] }