diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-07-02 21:54:47 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-07-02 21:54:47 +0200 |
commit | b587a7f3a5c338afbc07b4d7db4da527eb97d7ae (patch) | |
tree | 4003e8c356da5329b1058b2bac8e7a11fdaaa669 /source | |
parent | Leaves decay adjusted to 4 blocks in between the leaves and the log, instead of previous 3 (diff) | |
download | cuberite-b587a7f3a5c338afbc07b4d7db4da527eb97d7ae.tar cuberite-b587a7f3a5c338afbc07b4d7db4da527eb97d7ae.tar.gz cuberite-b587a7f3a5c338afbc07b4d7db4da527eb97d7ae.tar.bz2 cuberite-b587a7f3a5c338afbc07b4d7db4da527eb97d7ae.tar.lz cuberite-b587a7f3a5c338afbc07b4d7db4da527eb97d7ae.tar.xz cuberite-b587a7f3a5c338afbc07b4d7db4da527eb97d7ae.tar.zst cuberite-b587a7f3a5c338afbc07b4d7db4da527eb97d7ae.zip |
Diffstat (limited to 'source')
-rw-r--r-- | source/Trees.cpp | 43 | ||||
-rw-r--r-- | source/Trees.h | 2 | ||||
-rw-r--r-- | source/cChunkMap.cpp | 8 |
3 files changed, 51 insertions, 2 deletions
diff --git a/source/Trees.cpp b/source/Trees.cpp index f6734d85c..91c039369 100644 --- a/source/Trees.cpp +++ b/source/Trees.cpp @@ -530,9 +530,50 @@ void GetAppleBushImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois void GetJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_Blocks) { - // TODO + // TODO: generate proper jungle trees + // Temporary: generate just some high swamp-like trees with jungle materials: + + // Vines are around the BigO3, but not in the corners; need proper meta for direction + static const sMetaCoords Vines[] = + { + {-2, -4, 1}, {-1, -4, 1}, {0, -4, 1}, {1, -4, 1}, {2, -4, 1}, // North face + {-2, 4, 4}, {-1, 4, 4}, {0, 4, 4}, {1, 4, 4}, {2, 4, 4}, // South face + {4, -2, 2}, {4, -1, 2}, {4, 0, 2}, {4, 1, 2}, {4, 2, 2}, // East face + {-4, -2, 8}, {-4, -1, 8}, {-4, 0, 8}, {-4, 1, 8}, {-4, 2, 8}, // West face + } ; + + int Height = 6 + (a_Noise.IntNoise3DInt(a_BlockX + 32 * a_Seq, a_BlockY, a_BlockZ + 32 * a_Seq) / 8) % 16; + + a_Blocks.reserve(2 * ARRAYCOUNT(BigO3) + 2 * ARRAYCOUNT(BigO2) + Height * ARRAYCOUNT(Vines) + 20); + + for (int i = 0; i < Height; i++) + { + a_Blocks.push_back(sSetBlock(a_BlockX, a_BlockY + i, a_BlockZ, E_BLOCK_LOG, E_META_LOG_JUNGLE)); + } + int hei = a_BlockY + Height - 2; + + // Put vines around the lowermost leaves layer: + PushSomeColumns(a_BlockX, hei, a_BlockZ, Height, a_Seq, a_Noise, 0x3fffffff, a_Blocks, Vines, ARRAYCOUNT(Vines), E_BLOCK_VINES); + + // The lower two leaves layers are BigO3 with log in the middle and possibly corners: + for (int i = 0; i < 2; i++) + { + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_Blocks, BigO3, ARRAYCOUNT(BigO3), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); + PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_Blocks, 3, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); + hei++; + } // for i - 2* + + // The upper two leaves layers are BigO2 with leaves in the middle and possibly corners: + for (int i = 0; i < 2; i++) + { + PushCoordBlocks(a_BlockX, hei, a_BlockZ, a_Blocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); + PushCornerBlocks(a_BlockX, hei, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_Blocks, 3, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE); + a_Blocks.push_back(sSetBlock(a_BlockX, hei, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_JUNGLE)); + hei++; + } // for i - 2* } + diff --git a/source/Trees.h b/source/Trees.h index aa8190e44..387c14536 100644 --- a/source/Trees.h +++ b/source/Trees.h @@ -35,7 +35,7 @@ To generate a random image for the (x, y, z) coords, pass an arbitrary value as // Blocks that a tree may overwrite when growing: #define CASE_TREE_OVERWRITTEN_BLOCKS \ case E_BLOCK_AIR: \ - case E_BLOCK_LEAVES: \ + /* case E_BLOCK_LEAVES: LEAVES are a special case, they can be overwritten only by log. Handled in cChunkMap::ReplaceTreeBlocks(). */ \ case E_BLOCK_SNOW: \ case E_BLOCK_TALL_GRASS: \ case E_BLOCK_DEAD_BUSH: \ diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp index 0cf6e6c6d..e8167e3a5 100644 --- a/source/cChunkMap.cpp +++ b/source/cChunkMap.cpp @@ -697,6 +697,14 @@ void cChunkMap::ReplaceTreeBlocks(const sSetBlockVector & a_Blocks) Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); break; } + case E_BLOCK_LEAVES: + { + if (itr->BlockType == E_BLOCK_LOG) + { + Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); + } + break; + } } } // for itr - a_Blocks[] } |