2012-02-13 13:47:03 -08:00
|
|
|
|
2011-12-25 18:39:43 -08:00
|
|
|
#pragma once
|
|
|
|
|
2012-02-13 13:47:03 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-14 13:56:09 -07:00
|
|
|
#include "ChunkDef.h"
|
2012-02-13 13:47:03 -08:00
|
|
|
#include "MersenneTwister.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-14 13:56:09 -07:00
|
|
|
// fwd:
|
|
|
|
class cWorld;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-25 18:39:43 -08:00
|
|
|
class cWorldGenerator
|
|
|
|
{
|
|
|
|
public:
|
2012-02-16 09:45:26 -08:00
|
|
|
cWorldGenerator(cWorld * a_World);
|
2011-12-25 18:39:43 -08:00
|
|
|
~cWorldGenerator();
|
|
|
|
|
2012-02-18 09:53:22 -08:00
|
|
|
virtual void GenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, char * a_BlockData, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities);
|
2012-02-18 11:18:16 -08: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 18:39:43 -08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-02-16 09:45:26 -08:00
|
|
|
cWorld * m_World;
|
|
|
|
|
|
|
|
// Thread-unsafe:
|
2012-02-13 13:47:03 -08:00
|
|
|
MTRand r1;
|
2012-02-22 13:20:20 -08:00
|
|
|
|
2012-03-14 13:56:09 -07:00
|
|
|
void GenerateOre(char a_OreType, int a_MaxHeight, int a_NumNests, int a_NestSize, BLOCKTYPE * a_BlockData);
|
2012-02-13 13:47:03 -08:00
|
|
|
|
2012-02-18 09:53:22 -08:00
|
|
|
static unsigned int MakeIndex(int x, int y, int z );
|
|
|
|
|
2012-03-14 13:56:09 -07:00
|
|
|
virtual void GenerateTerrain(int a_ChunkX, int a_ChunkY, int a_ChunkZ, BLOCKTYPE * a_BlockData);
|
2012-02-18 09:53:22 -08:00
|
|
|
|
2012-02-18 11:18:16 -08:00
|
|
|
virtual void GenerateFoliage(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
|
2012-02-13 13:47:03 -08:00
|
|
|
|
2012-02-18 11:18:16 -08: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 13:47:03 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-25 18:39:43 -08:00
|
|
|
|