2012-02-13 16:47:03 -05:00
|
|
|
|
2011-12-25 21:39:43 -05:00
|
|
|
#pragma once
|
|
|
|
|
2012-02-13 16:47:03 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-14 16:56:09 -04:00
|
|
|
#include "ChunkDef.h"
|
2012-02-13 16:47:03 -05:00
|
|
|
#include "MersenneTwister.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-14 16:56:09 -04:00
|
|
|
// fwd:
|
|
|
|
class cWorld;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-25 21:39:43 -05:00
|
|
|
class cWorldGenerator
|
|
|
|
{
|
|
|
|
public:
|
2012-02-16 12:45:26 -05:00
|
|
|
cWorldGenerator(cWorld * a_World);
|
2011-12-25 21:39:43 -05:00
|
|
|
~cWorldGenerator();
|
|
|
|
|
2012-03-14 17:21:03 -04:00
|
|
|
virtual void GenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, BLOCKTYPE * a_BlockData, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities);
|
2012-02-18 14:18:16 -05:00
|
|
|
|
|
|
|
virtual void PostGenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Called when the chunk has been already generated and set valid
|
2011-12-25 21:39:43 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-02-16 12:45:26 -05:00
|
|
|
cWorld * m_World;
|
|
|
|
|
|
|
|
// Thread-unsafe:
|
2012-02-13 16:47:03 -05:00
|
|
|
MTRand r1;
|
2012-02-22 16:20:20 -05:00
|
|
|
|
2012-03-14 16:56:09 -04:00
|
|
|
void GenerateOre(char a_OreType, int a_MaxHeight, int a_NumNests, int a_NestSize, BLOCKTYPE * a_BlockData);
|
2012-02-13 16:47:03 -05:00
|
|
|
|
2012-02-18 12:53:22 -05:00
|
|
|
static unsigned int MakeIndex(int x, int y, int z );
|
|
|
|
|
2012-03-14 16:56:09 -04:00
|
|
|
virtual void GenerateTerrain(int a_ChunkX, int a_ChunkY, int a_ChunkZ, BLOCKTYPE * a_BlockData);
|
2012-02-18 12:53:22 -05:00
|
|
|
|
2012-02-18 14:18:16 -05:00
|
|
|
virtual void GenerateFoliage(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
|
2012-02-13 16:47:03 -05:00
|
|
|
|
2012-02-18 14:18:16 -05:00
|
|
|
/// Checks if the chunk has all 8 neighbors valid, if so, foliage is generated on that chunk
|
|
|
|
void CheckNeighbors(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
|
2012-02-13 16:47:03 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-25 21:39:43 -05:00
|
|
|
|