summaryrefslogtreecommitdiffstats
path: root/source/BioGen.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-05-25 09:18:52 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-05-25 09:18:52 +0200
commita4a418a679f1ac760a8763edd856f0178cfc6dde (patch)
tree85300ca3a2b3a942998a0c864ae90894857ebf5f /source/BioGen.cpp
parentFixed output directory structure in the "Release profiled" configuration (diff)
downloadcuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.gz
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.bz2
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.lz
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.xz
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.zst
cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.zip
Diffstat (limited to '')
-rw-r--r--source/BioGen.cpp89
1 files changed, 89 insertions, 0 deletions
diff --git a/source/BioGen.cpp b/source/BioGen.cpp
new file mode 100644
index 000000000..c87a6ec1b
--- /dev/null
+++ b/source/BioGen.cpp
@@ -0,0 +1,89 @@
+
+// BioGen.cpp
+
+// Implements the various biome generators
+
+#include "Globals.h"
+#include "BioGen.h"
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cBioGenConstant:
+
+void cBioGenConstant::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+{
+ for (int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
+ {
+ a_BiomeMap[i] = m_Biome;
+ }
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cBioGenDistortedVoronoi:
+
+void cBioGenDistortedVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+{
+ // TODO: Replace this placeholder
+ ASSERT(!"Not implemented yet");
+ for (int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
+ {
+ a_BiomeMap[i] = (EMCSBiome)(a_ChunkX + a_ChunkZ);
+ }
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cBioGenCheckerboard:
+
+void cBioGenCheckerboard::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+{
+ // The list of biomes we will generate in the checkerboard:
+ static EMCSBiome Biomes[] =
+ {
+ biOcean,
+ biPlains,
+ biDesert,
+ biExtremeHills,
+ biForest,
+ biTaiga,
+ biSwampland,
+ biRiver,
+ biFrozenOcean,
+ biFrozenRiver,
+ biIcePlains,
+ biIceMountains,
+ biMushroomIsland,
+ biMushroomShore,
+ biBeach,
+ biDesertHills,
+ biForestHills,
+ biTaigaHills,
+ biExtremeHillsEdge,
+ biJungle,
+ biJungleHills,
+ } ;
+
+ for (int z = 0; z < cChunkDef::Width; z++)
+ {
+ int Base = cChunkDef::Width * a_ChunkZ + z;
+ for (int x = 0; x < cChunkDef::Width; x++)
+ {
+ int Add = cChunkDef::Width * a_ChunkX + x;
+ a_BiomeMap[x + cChunkDef::Width * z] = Biomes[(Base / m_BiomeSize + Add / m_BiomeSize) % ARRAYCOUNT(Biomes)];
+ }
+ }
+}
+
+
+
+