summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-25 21:29:56 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-25 21:29:56 +0200
commitc40eb92de3981ec5a1666b64ab469b4d2df0d85a (patch)
tree9ebee5cfe180012ae7765a7bb890abfc718f29e2
parentAdded the initial version of DirectOverhangs (diff)
downloadcuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar.gz
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar.bz2
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar.lz
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar.xz
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.tar.zst
cuberite-c40eb92de3981ec5a1666b64ab469b4d2df0d85a.zip
-rw-r--r--source/Generating/ComposableGenerator.cpp4
-rw-r--r--source/Generating/StructGen.cpp49
-rw-r--r--source/Generating/StructGen.h20
3 files changed, 72 insertions, 1 deletions
diff --git a/source/Generating/ComposableGenerator.cpp b/source/Generating/ComposableGenerator.cpp
index 8c2d2d3c1..1612d038b 100644
--- a/source/Generating/ComposableGenerator.cpp
+++ b/source/Generating/ComposableGenerator.cpp
@@ -360,6 +360,10 @@ void cComposableGenerator::InitStructureGens(cIniFile & a_IniFile)
{
m_StructureGens.push_back(new cStructGenDirectOverhangs(Seed));
}
+ else if (NoCaseCompare(*itr, "DistortedMembraneOverhangs") == 0)
+ {
+ m_StructureGens.push_back(new cStructGenDistortedMembraneOverhangs(Seed));
+ }
else if (NoCaseCompare(*itr, "LavaLakes") == 0)
{
int Probability = a_IniFile.GetValueSetI("Generator", "LavaLakesProbability", 10);
diff --git a/source/Generating/StructGen.cpp b/source/Generating/StructGen.cpp
index c9af06afb..044e789b5 100644
--- a/source/Generating/StructGen.cpp
+++ b/source/Generating/StructGen.cpp
@@ -513,7 +513,7 @@ void cStructGenLakes::CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// cStructGenBiomeOverhangs:
+// cStructGenDirectOverhangs:
cStructGenDirectOverhangs::cStructGenDirectOverhangs(int a_Seed) :
m_Noise1(a_Seed),
@@ -625,3 +625,50 @@ bool cStructGenDirectOverhangs::HasWantedBiome(cChunkDesc & a_ChunkDesc) const
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cStructGenDistortedMembraneOverhangs:
+
+cStructGenDistortedMembraneOverhangs::cStructGenDistortedMembraneOverhangs(int a_Seed) :
+ m_NoiseX(a_Seed + 1000),
+ m_NoiseY(a_Seed + 2000),
+ m_NoiseZ(a_Seed + 3000),
+ m_NoiseH(a_Seed + 4000)
+{
+}
+
+
+
+
+
+void cStructGenDistortedMembraneOverhangs::GenStructures(cChunkDesc & a_ChunkDesc)
+{
+ const NOISE_DATATYPE Frequency = (NOISE_DATATYPE)16;
+ const NOISE_DATATYPE Amount = (NOISE_DATATYPE)1;
+ for (int y = 50; y < 128; y++)
+ {
+ NOISE_DATATYPE NoiseY = (NOISE_DATATYPE)y / 32;
+ // TODO: proper water level - where to get?
+ BLOCKTYPE ReplacementBlock = (y > 62) ? E_BLOCK_AIR : E_BLOCK_STATIONARY_WATER;
+ for (int z = 0; z < cChunkDef::Width; z++)
+ {
+ NOISE_DATATYPE NoiseZ = ((NOISE_DATATYPE)(a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z)) / Frequency;
+ for (int x = 0; x < cChunkDef::Width; x++)
+ {
+ NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x)) / Frequency;
+ NOISE_DATATYPE DistortX = m_NoiseX.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * Amount;
+ NOISE_DATATYPE DistortY = m_NoiseY.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * Amount;
+ NOISE_DATATYPE DistortZ = m_NoiseZ.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * Amount;
+ int MembraneHeight = 96 - (int)((DistortY + m_NoiseH.CubicNoise2D(NoiseX + DistortX, NoiseZ + DistortZ)) * 30);
+ if (MembraneHeight < y)
+ {
+ a_ChunkDesc.SetBlockType(x, y, z, ReplacementBlock);
+ }
+ } // for y
+ } // for x
+ } // for z
+}
+
+
+
+
diff --git a/source/Generating/StructGen.h b/source/Generating/StructGen.h
index 907c66544..853748bb8 100644
--- a/source/Generating/StructGen.h
+++ b/source/Generating/StructGen.h
@@ -143,3 +143,23 @@ protected:
+
+class cStructGenDistortedMembraneOverhangs :
+ public cStructureGen
+{
+public:
+ cStructGenDistortedMembraneOverhangs(int a_Seed);
+
+protected:
+ cNoise m_NoiseX;
+ cNoise m_NoiseY;
+ cNoise m_NoiseZ;
+ cNoise m_NoiseH;
+
+ // cStructureGen override:
+ virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
+} ;
+
+
+
+