1
0
Fork 0

Renamed cFinishGenFoliage to cFinishGenTallGrass

Better grass density
Added double tall grass.
This commit is contained in:
STRWarrior 2014-07-20 19:22:41 +02:00
parent 51ad6cd1b2
commit 76b79b51ad
3 changed files with 34 additions and 17 deletions

View File

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

View File

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

View File

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