1
0
Fork 0

Removed bottom lava from caves generator, added a new finish generator BottomLava for that. Also fixed a slight error in SameBlock composition generator cfg

git-svn-id: http://mc-server.googlecode.com/svn/trunk@698 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-07-27 21:00:11 +00:00
parent ccd7e3f38c
commit 5b69087b72
4 changed files with 69 additions and 25 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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;
} ;

View File

@ -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[]
}