2012-06-14 06:06:06 -07:00
|
|
|
|
|
|
|
// FinishGen.h
|
|
|
|
|
|
|
|
/* Interfaces to the various finishing generators:
|
|
|
|
- cFinishGenSnow
|
|
|
|
- cFinishGenIce
|
|
|
|
- cFinishGenSprinkleFoliage
|
2012-07-27 14:00:11 -07:00
|
|
|
- cFinishGenLilypads
|
|
|
|
- cFinishGenBottomLava
|
2012-11-11 07:35:49 -08:00
|
|
|
- cFinishGenPreSimulator
|
|
|
|
- cFinishGenDeadBushes
|
2012-06-14 06:06:06 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-25 02:12:29 -08:00
|
|
|
#include "ComposableGenerator.h"
|
2012-09-23 15:09:57 -07:00
|
|
|
#include "../Noise.h"
|
2013-03-14 02:52:57 -07:00
|
|
|
#include "../ProbabDistrib.h"
|
2012-06-14 06:06:06 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cFinishGenSnow :
|
|
|
|
public cFinishGen
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(
|
|
|
|
int a_ChunkX, int a_ChunkZ,
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
|
|
|
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
|
|
|
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
|
|
|
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
|
|
|
cEntityList & a_Entities, // Entities may be added or deleted
|
|
|
|
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
|
|
|
) override;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cFinishGenIce :
|
|
|
|
public cFinishGen
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(
|
|
|
|
int a_ChunkX, int a_ChunkZ,
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
|
|
|
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
|
|
|
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
|
|
|
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
|
|
|
cEntityList & a_Entities, // Entities may be added or deleted
|
|
|
|
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
|
|
|
) override;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-11 07:35:49 -08:00
|
|
|
|
2012-06-14 06:06:06 -07:00
|
|
|
class cFinishGenSprinkleFoliage :
|
|
|
|
public cFinishGen
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cFinishGenSprinkleFoliage(int a_Seed) : m_Seed(a_Seed) {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_Seed;
|
|
|
|
|
|
|
|
/// Tries to place sugarcane at the coords specified, returns true if successful
|
|
|
|
bool TryAddSugarcane(
|
|
|
|
int a_ChunkX, int a_ChunkZ,
|
|
|
|
int a_RelX, int a_RelY, int a_RelZ, // relative block coords of the sugarcane's base
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
|
|
|
cChunkDef::BlockNibbles & a_BlockMeta // Block meta to read and change
|
|
|
|
);
|
|
|
|
|
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(
|
|
|
|
int a_ChunkX, int a_ChunkZ,
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
|
|
|
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
|
|
|
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
|
|
|
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
|
|
|
cEntityList & a_Entities, // Entities may be added or deleted
|
|
|
|
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
|
|
|
) override;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-03 12:16:09 -07:00
|
|
|
|
|
|
|
class cFinishGenLilypads :
|
|
|
|
public cFinishGen
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cFinishGenLilypads(int a_Seed) :
|
|
|
|
m_Noise(a_Seed)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
cNoise m_Noise;
|
|
|
|
|
|
|
|
int GetNumLilypads(const cChunkDef::BiomeMap & a_BiomeMap);
|
|
|
|
|
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(
|
|
|
|
int a_ChunkX, int a_ChunkZ,
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
|
|
|
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
|
|
|
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
|
|
|
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
|
|
|
cEntityList & a_Entities, // Entities may be added or deleted
|
|
|
|
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
|
|
|
) override;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-27 14:00:11 -07:00
|
|
|
class cFinishGenBottomLava :
|
|
|
|
public cFinishGen
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cFinishGenBottomLava(int a_Level) :
|
|
|
|
m_Level(a_Level)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_Level;
|
|
|
|
|
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(
|
|
|
|
int a_ChunkX, int a_ChunkZ,
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
|
|
|
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
|
|
|
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
|
|
|
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
|
|
|
cEntityList & a_Entities, // Entities may be added or deleted
|
|
|
|
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
|
|
|
) override;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-21 13:06:31 -07:00
|
|
|
class cFinishGenPreSimulator :
|
|
|
|
public cFinishGen
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cFinishGenPreSimulator(void);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Drops hanging sand and gravel down to the ground, recalculates heightmap
|
|
|
|
void CollapseSandGravel(
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
2012-10-21 14:15:44 -07:00
|
|
|
cChunkDef::HeightMap & a_HeightMap // Height map to update by the current data
|
2012-10-21 13:06:31 -07:00
|
|
|
);
|
|
|
|
|
2012-10-21 14:15:44 -07:00
|
|
|
/** For each fluid block:
|
|
|
|
- if all surroundings are of the same fluid, makes it stationary; otherwise makes it flowing (excl. top)
|
|
|
|
- all fluid on the chunk's edge is made flowing
|
|
|
|
*/
|
|
|
|
void StationarizeFluid(
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
|
|
|
cChunkDef::HeightMap & a_HeightMap, // Height map to read
|
|
|
|
BLOCKTYPE a_Fluid,
|
|
|
|
BLOCKTYPE a_StationaryFluid
|
|
|
|
);
|
|
|
|
|
2012-10-21 13:06:31 -07:00
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(
|
|
|
|
int a_ChunkX, int a_ChunkZ,
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
|
|
|
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
|
|
|
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
|
|
|
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
|
|
|
cEntityList & a_Entities, // Entities may be added or deleted
|
|
|
|
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
|
|
|
) override;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-11 07:35:49 -08:00
|
|
|
|
|
|
|
class cFinishGenDeadBushes :
|
|
|
|
public cFinishGen
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cFinishGenDeadBushes(int a_Seed) :
|
|
|
|
m_Noise(a_Seed)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
cNoise m_Noise;
|
|
|
|
|
|
|
|
int GetNumDeadBushes(const cChunkDef::BiomeMap & a_BiomeMap);
|
|
|
|
|
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(
|
|
|
|
int a_ChunkX, int a_ChunkZ,
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
|
|
|
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
|
|
|
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
|
|
|
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
|
|
|
cEntityList & a_Entities, // Entities may be added or deleted
|
|
|
|
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
|
|
|
) override;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-14 02:52:57 -07:00
|
|
|
|
|
|
|
class cFinishGenFluidSprings :
|
|
|
|
public cFinishGen
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cIniFile & a_IniFile, const cWorld & a_World);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
cNoise m_Noise;
|
|
|
|
cProbabDistrib m_HeightDistribution;
|
|
|
|
BLOCKTYPE m_Fluid;
|
|
|
|
int m_Chance; ///< Chance, [0..100], that a spring will be generated in a chunk
|
|
|
|
|
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(
|
|
|
|
int a_ChunkX, int a_ChunkZ,
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
|
|
|
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
|
|
|
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
|
|
|
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
|
|
|
cEntityList & a_Entities, // Entities may be added or deleted
|
|
|
|
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
|
|
|
) override;
|
|
|
|
|
|
|
|
/// Tries to place a spring at the specified coords, checks neighbors. Returns true if successful
|
|
|
|
bool TryPlaceSpring(
|
|
|
|
cChunkDef::BlockTypes & a_BlockTypes,
|
|
|
|
cChunkDef::BlockNibbles & a_BlockMetas,
|
|
|
|
int x, int y, int z
|
|
|
|
);
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|