1
0

CompoGen and HeiGen read their settings in their respective Initialize() functions.

This commit is contained in:
madmaxoft
2013-10-11 10:18:01 +02:00
parent 47b64b63fa
commit a9e70c84b5
8 changed files with 199 additions and 92 deletions

View File

@@ -60,7 +60,7 @@ cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGen & a_BiomeGen) :
m_OceanFloorSelect(a_Seed + 3000),
m_BiomeGen(a_BiomeGen),
m_UnderlyingHeiGen(a_Seed, a_BiomeGen),
m_HeightGen(&m_UnderlyingHeiGen, 64)
m_HeightGen(m_UnderlyingHeiGen, 64)
{
m_NoiseDistortX.AddOctave((NOISE_DATATYPE)1, (NOISE_DATATYPE)0.5);
m_NoiseDistortX.AddOctave((NOISE_DATATYPE)0.5, (NOISE_DATATYPE)1);
@@ -77,11 +77,18 @@ cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGen & a_BiomeGen) :
void cDistortedHeightmap::Initialize(cIniFile & a_IniFile)
{
if (m_IsInitialized)
{
return;
}
// Read the params from the INI file:
m_SeaLevel = a_IniFile.GetValueSetI("Generator", "DistortedHeightmapSeaLevel", 62);
m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyX", 10);
m_FrequencyY = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyY", 10);
m_FrequencyZ = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyZ", 10);
m_IsInitialized = true;
}
@@ -184,6 +191,15 @@ void cDistortedHeightmap::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::He
void cDistortedHeightmap::InitializeHeightGen(cIniFile & a_IniFile)
{
Initialize(a_IniFile);
}
void cDistortedHeightmap::ComposeTerrain(cChunkDesc & a_ChunkDesc)
{
// Frequencies for the ocean floor selecting noise:
@@ -311,6 +327,15 @@ void cDistortedHeightmap::ComposeTerrain(cChunkDesc & a_ChunkDesc)
void cDistortedHeightmap::InitializeCompoGen(cIniFile & a_IniFile)
{
Initialize(a_IniFile);
}
int cDistortedHeightmap::GetHeightmapAt(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Z)
{
int ChunkX = (int)floor(a_X / (NOISE_DATATYPE)16);