1
0

Temporary jungle trees (swamp-like), based on code by STR_Warrior). Also vines don't overwrite leaves anymore.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@646 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-07-02 19:54:47 +00:00
parent a627a3a261
commit b587a7f3a5
3 changed files with 51 additions and 2 deletions

View File

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

View File

@ -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: // Blocks that a tree may overwrite when growing:
#define CASE_TREE_OVERWRITTEN_BLOCKS \ #define CASE_TREE_OVERWRITTEN_BLOCKS \
case E_BLOCK_AIR: \ 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_SNOW: \
case E_BLOCK_TALL_GRASS: \ case E_BLOCK_TALL_GRASS: \
case E_BLOCK_DEAD_BUSH: \ case E_BLOCK_DEAD_BUSH: \

View File

@ -697,6 +697,14 @@ void cChunkMap::ReplaceTreeBlocks(const sSetBlockVector & a_Blocks)
Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta);
break; 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[] } // for itr - a_Blocks[]
} }