From b1bd1001f713b3f4af95f46093bbd48e43227fa7 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 12 May 2013 20:04:07 +0000 Subject: DistortedHeightmap: Deserts are now covered with sand and mushroom islands with mycelium (patch contributed by STR_Warrior) git-svn-id: http://mc-server.googlecode.com/svn/trunk@1476 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Generating/DistortedHeightmap.cpp | 42 +++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/source/Generating/DistortedHeightmap.cpp b/source/Generating/DistortedHeightmap.cpp index d44ef60e5..f1b74e70d 100644 --- a/source/Generating/DistortedHeightmap.cpp +++ b/source/Generating/DistortedHeightmap.cpp @@ -270,18 +270,54 @@ void cDistortedHeightmap::ComposeTerrain(cChunkDesc & a_ChunkDesc) continue; } // "ground" part: - if (LastAir - y > 4) + if (y < LastAir - 4) { a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STONE); continue; } if (HasHadWater) { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SAND); + // TODO: Decide between sand and dirt + a_ChunkDesc.SetBlockType(x, y, z, (y < LastAir - 3) ? E_BLOCK_SANDSTONE : E_BLOCK_SAND); } else { - a_ChunkDesc.SetBlockType(x, y, z, (LastAir == y + 1) ? E_BLOCK_GRASS : E_BLOCK_DIRT); + switch (a_ChunkDesc.GetBiome(x, z)) + { + case biOcean: + case biPlains: + case biExtremeHills: + case biForest: + case biTaiga: + case biSwampland: + case biRiver: + case biFrozenOcean: + case biFrozenRiver: + case biIcePlains: + case biIceMountains: + case biForestHills: + case biTaigaHills: + case biExtremeHillsEdge: + case biJungle: + case biJungleHills: + { + a_ChunkDesc.SetBlockType(x, y, z, (y == LastAir - 1) ? E_BLOCK_GRASS : E_BLOCK_DIRT); + break; + } + case biDesertHills: + case biDesert: + case biBeach: + { + a_ChunkDesc.SetBlockType(x, y, z, (y < LastAir - 3) ? E_BLOCK_SANDSTONE : E_BLOCK_SAND); + break; + } + case biMushroomIsland: + case biMushroomShore: + { + a_ChunkDesc.SetBlockType(x, y, z, (y == LastAir - 1) ? E_BLOCK_MYCELIUM : E_BLOCK_DIRT); + break; + } + } } } // for y a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); -- cgit v1.2.3