2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
// Trees.h
|
|
|
|
|
|
|
|
// Interfaces to helper functions used for generating trees
|
|
|
|
|
|
|
|
/*
|
|
|
|
Note that all of these functions must generate the same tree image for the same input (x, y, z, seq)
|
|
|
|
- cStructGenTrees depends on this
|
|
|
|
To generate a random image for the (x, y, z) coords, pass an arbitrary value as (seq).
|
2012-07-15 09:33:43 -04:00
|
|
|
Each function returns two arrays of blocks, "logs" and "other". The point is that logs are of higher priority,
|
|
|
|
logs can overwrite others(leaves), but others shouldn't overwrite logs. This is an optimization for the generator.
|
2012-06-14 09:06:06 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2014-11-18 06:07:08 -05:00
|
|
|
#include "../Noise/Noise.h"
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-13 13:02:00 -04:00
|
|
|
class cWorld;
|
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Blocks that don't block tree growth:
|
|
|
|
#define CASE_TREE_ALLOWED_BLOCKS \
|
|
|
|
case E_BLOCK_AIR: \
|
|
|
|
case E_BLOCK_LEAVES: \
|
2014-08-02 15:44:16 -04:00
|
|
|
case E_BLOCK_NEW_LEAVES: \
|
2012-06-14 09:06:06 -04:00
|
|
|
case E_BLOCK_SNOW: \
|
|
|
|
case E_BLOCK_TALL_GRASS: \
|
|
|
|
case E_BLOCK_DEAD_BUSH: \
|
|
|
|
case E_BLOCK_SAPLING: \
|
|
|
|
case E_BLOCK_VINES
|
|
|
|
|
|
|
|
// Blocks that a tree may overwrite when growing:
|
|
|
|
#define CASE_TREE_OVERWRITTEN_BLOCKS \
|
|
|
|
case E_BLOCK_AIR: \
|
2012-07-02 15:54:47 -04:00
|
|
|
/* case E_BLOCK_LEAVES: LEAVES are a special case, they can be overwritten only by log. Handled in cChunkMap::ReplaceTreeBlocks(). */ \
|
2012-06-14 09:06:06 -04:00
|
|
|
case E_BLOCK_SNOW: \
|
|
|
|
case E_BLOCK_TALL_GRASS: \
|
2014-08-02 15:44:16 -04:00
|
|
|
case E_BLOCK_BIG_FLOWER: \
|
2012-06-14 09:06:06 -04:00
|
|
|
case E_BLOCK_DEAD_BUSH: \
|
|
|
|
case E_BLOCK_SAPLING: \
|
|
|
|
case E_BLOCK_VINES
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a tree at the specified coords (lowest trunk block) in the specified biome */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, EMCSBiome a_Biome, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random apple tree */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a small (nonbranching) apple tree */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetSmallAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a large (branching) apple tree */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetLargeAppleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates a branch for a large apple tree */
|
2014-11-13 04:44:36 -05:00
|
|
|
void GetLargeAppleTreeBranch(int a_BlockX, int a_BlockY, int a_BlockZ, int a_BranchLength, Vector3d a_StartDirection, Vector3d a_Direction, int a_TreeHeight, cNoise & a_Noise, sSetBlockVector & a_LogBlocks);
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Returns the meta for a log from the given direction */
|
2014-11-13 04:44:36 -05:00
|
|
|
NIBBLETYPE GetLogMetaFromDirection(NIBBLETYPE a_BlockMeta, Vector3d a_Direction);
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random birch tree */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2014-02-19 10:58:31 -05:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random acacia tree */
|
2014-02-19 10:58:31 -05:00
|
|
|
void GetAcaciaTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random darkoak tree */
|
2014-02-19 13:18:40 -05:00
|
|
|
void GetDarkoakTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random large birch tree */
|
2014-07-19 08:53:41 -04:00
|
|
|
void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2013-12-29 01:49:51 -05:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random conifer tree */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetConiferTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random spruce (short conifer, two layers of leaves) */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetSpruceTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random pine (tall conifer, little leaves at top) */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetPineTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random swampland tree */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetSwampTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random apple bush (for jungles) */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetAppleBushImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a random jungle tree */
|
2015-07-13 13:02:00 -04:00
|
|
|
void GetJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks, bool a_Large);
|
2012-07-15 09:33:43 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a large jungle tree (2x2 trunk) */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetLargeJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates an image of a small jungle tree (1x1 trunk) */
|
2012-07-15 09:33:43 -04:00
|
|
|
void GetSmallJungleTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Moves the x and z coordinants to the north-west corner of a 2x2 of saplings. Returns true if a 2x2 was found, otherwise it returns false */
|
2015-07-13 13:02:00 -04:00
|
|
|
bool GetLargeTreeAdjustment(cWorld & a_World, int & a_X, int & a_Y, int & a_Z, NIBBLETYPE a_Meta);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|