1
0

Added random offsets to cGridStructGen.

Fixes #740.
This commit is contained in:
madmaxoft 2014-06-15 23:30:43 +02:00
parent a72ec6300d
commit d9719e696c
17 changed files with 127 additions and 85 deletions

View File

@ -125,7 +125,7 @@ public:
int m_BlockX; int m_BlockX;
int m_BlockZ; int m_BlockZ;
cCaveSystem(int a_OriginX, int a_OriginZ, int a_MaxOffset, int a_Size, cNoise & a_Noise); cCaveSystem(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_MaxOffset, int a_Size, cNoise & a_Noise);
~cCaveSystem(); ~cCaveSystem();
protected: protected:
@ -574,8 +574,8 @@ AString cCaveTunnel::ExportAsSVG(int a_Color, int a_OffsetX, int a_OffsetZ) cons
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cStructGenWormNestCaves::cCaveSystem: // cStructGenWormNestCaves::cCaveSystem:
cStructGenWormNestCaves::cCaveSystem::cCaveSystem(int a_OriginX, int a_OriginZ, int a_MaxOffset, int a_Size, cNoise & a_Noise) : cStructGenWormNestCaves::cCaveSystem::cCaveSystem(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_MaxOffset, int a_Size, cNoise & a_Noise) :
super(a_OriginX, a_OriginZ), super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Size(a_Size) m_Size(a_Size)
{ {
int Num = 1 + a_Noise.IntNoise2DInt(a_OriginX, a_OriginZ) % 3; int Num = 1 + a_Noise.IntNoise2DInt(a_OriginX, a_OriginZ) % 3;
@ -690,9 +690,9 @@ int cStructGenWormNestCaves::cCaveSystem::GetRadius(cNoise & a_Noise, int a_Orig
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cStructGenWormNestCaves: // cStructGenWormNestCaves:
cGridStructGen::cStructurePtr cStructGenWormNestCaves::CreateStructure(int a_OriginX, int a_OriginZ) cGridStructGen::cStructurePtr cStructGenWormNestCaves::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{ {
return cStructurePtr(new cCaveSystem(a_OriginX, a_OriginZ, m_MaxOffset, m_Size, m_Noise)); return cStructurePtr(new cCaveSystem(a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_MaxOffset, m_Size, m_Noise));
} }

View File

@ -69,7 +69,7 @@ class cStructGenWormNestCaves :
typedef cGridStructGen super; typedef cGridStructGen super;
public: public:
cStructGenWormNestCaves(int a_Seed, int a_Size = 64, int a_Grid = 96, int a_MaxOffset = 128) : cStructGenWormNestCaves(int a_Seed, int a_Size = 64, int a_Grid = 96, int a_MaxOffset = 128) :
super(a_Seed, a_Grid, a_Grid, a_Size + a_MaxOffset, a_Size + a_MaxOffset, 100), super(a_Seed, a_Grid, a_Grid, a_MaxOffset, a_MaxOffset, a_Size, a_Size, 100),
m_Noise(a_Seed), m_Noise(a_Seed),
m_Size(a_Size), m_Size(a_Size),
m_MaxOffset(a_MaxOffset), m_MaxOffset(a_MaxOffset),
@ -86,7 +86,7 @@ protected:
int m_Grid; // average spacing of the nests int m_Grid; // average spacing of the nests
// cGridStructGen override: // cGridStructGen override:
virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override; virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ; } ;

View File

@ -357,12 +357,13 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
else if (NoCaseCompare(*itr, "MineShafts") == 0) else if (NoCaseCompare(*itr, "MineShafts") == 0)
{ {
int GridSize = a_IniFile.GetValueSetI("Generator", "MineShaftsGridSize", 512); int GridSize = a_IniFile.GetValueSetI("Generator", "MineShaftsGridSize", 512);
int MaxOffset = a_IniFile.GetValueSetI("Generator", "MineShaftsMaxOffset", 256);
int MaxSystemSize = a_IniFile.GetValueSetI("Generator", "MineShaftsMaxSystemSize", 160); int MaxSystemSize = a_IniFile.GetValueSetI("Generator", "MineShaftsMaxSystemSize", 160);
int ChanceCorridor = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCorridor", 600); int ChanceCorridor = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCorridor", 600);
int ChanceCrossing = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCrossing", 200); int ChanceCrossing = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCrossing", 200);
int ChanceStaircase = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceStaircase", 200); int ChanceStaircase = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceStaircase", 200);
m_FinishGens.push_back(new cStructGenMineShafts( m_FinishGens.push_back(new cStructGenMineShafts(
Seed, GridSize, MaxSystemSize, Seed, GridSize, MaxOffset, MaxSystemSize,
ChanceCorridor, ChanceCrossing, ChanceStaircase ChanceCorridor, ChanceCrossing, ChanceStaircase
)); ));
} }
@ -376,9 +377,10 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
} }
else if (NoCaseCompare(*itr, "NetherForts") == 0) else if (NoCaseCompare(*itr, "NetherForts") == 0)
{ {
int GridSize = a_IniFile.GetValueSetI("Generator", "NetherFortsGridSize", 512); int GridSize = a_IniFile.GetValueSetI("Generator", "NetherFortsGridSize", 512);
int MaxDepth = a_IniFile.GetValueSetI("Generator", "NetherFortsMaxDepth", 12); int MaxOffset = a_IniFile.GetValueSetI("Generator", "NetherFortMaxOffset", 128);
m_FinishGens.push_back(new cNetherFortGen(Seed, GridSize, MaxDepth)); int MaxDepth = a_IniFile.GetValueSetI("Generator", "NetherFortsMaxDepth", 12);
m_FinishGens.push_back(new cNetherFortGen(Seed, GridSize, MaxOffset, MaxDepth));
} }
else if (NoCaseCompare(*itr, "OreNests") == 0) else if (NoCaseCompare(*itr, "OreNests") == 0)
{ {
@ -394,10 +396,11 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
} }
else if (NoCaseCompare(*itr, "RainbowRoads") == 0) else if (NoCaseCompare(*itr, "RainbowRoads") == 0)
{ {
int GridSize = a_IniFile.GetValueSetI("Generator", "RainbowRoadsGridSize", 512); int GridSize = a_IniFile.GetValueSetI("Generator", "RainbowRoadsGridSize", 512);
int MaxDepth = a_IniFile.GetValueSetI("Generator", "RainbowRoadsMaxDepth", 30); int MaxOffset = a_IniFile.GetValueSetI("Generator", "RainbowRoadsMaxOffset", 128);
int MaxSize = a_IniFile.GetValueSetI("Generator", "RainbowRoadsMaxSize", 260); int MaxDepth = a_IniFile.GetValueSetI("Generator", "RainbowRoadsMaxDepth", 30);
m_FinishGens.push_back(new cRainbowRoadsGen(Seed, GridSize, MaxDepth, MaxSize)); int MaxSize = a_IniFile.GetValueSetI("Generator", "RainbowRoadsMaxSize", 260);
m_FinishGens.push_back(new cRainbowRoadsGen(Seed, GridSize, MaxOffset, MaxDepth, MaxSize));
} }
else if (NoCaseCompare(*itr, "Ravines") == 0) else if (NoCaseCompare(*itr, "Ravines") == 0)
{ {
@ -417,19 +420,21 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
} }
else if (NoCaseCompare(*itr, "UnderwaterBases") == 0) else if (NoCaseCompare(*itr, "UnderwaterBases") == 0)
{ {
int GridSize = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseGridSize", 1024); int GridSize = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseGridSize", 1024);
int MaxDepth = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseMaxDepth", 7); int MaxOffset = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseMaxOffset", 128);
int MaxSize = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseMaxSize", 128); int MaxDepth = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseMaxDepth", 7);
m_FinishGens.push_back(new cUnderwaterBaseGen(Seed, GridSize, MaxDepth, MaxSize, *m_BiomeGen)); int MaxSize = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseMaxSize", 128);
m_FinishGens.push_back(new cUnderwaterBaseGen(Seed, GridSize, MaxOffset, MaxDepth, MaxSize, *m_BiomeGen));
} }
else if (NoCaseCompare(*itr, "Villages") == 0) else if (NoCaseCompare(*itr, "Villages") == 0)
{ {
int GridSize = a_IniFile.GetValueSetI("Generator", "VillageGridSize", 384); int GridSize = a_IniFile.GetValueSetI("Generator", "VillageGridSize", 384);
int MaxOffset = a_IniFile.GetValueSetI("Generator", "VillageMaxOffset", 128);
int MaxDepth = a_IniFile.GetValueSetI("Generator", "VillageMaxDepth", 2); int MaxDepth = a_IniFile.GetValueSetI("Generator", "VillageMaxDepth", 2);
int MaxSize = a_IniFile.GetValueSetI("Generator", "VillageMaxSize", 128); int MaxSize = a_IniFile.GetValueSetI("Generator", "VillageMaxSize", 128);
int MinDensity = a_IniFile.GetValueSetI("Generator", "VillageMinDensity", 50); int MinDensity = a_IniFile.GetValueSetI("Generator", "VillageMinDensity", 50);
int MaxDensity = a_IniFile.GetValueSetI("Generator", "VillageMaxDensity", 80); int MaxDensity = a_IniFile.GetValueSetI("Generator", "VillageMaxDensity", 80);
m_FinishGens.push_back(new cVillageGen(Seed, GridSize, MaxDepth, MaxSize, MinDensity, MaxDensity, *m_BiomeGen, *m_HeightGen)); m_FinishGens.push_back(new cVillageGen(Seed, GridSize, MaxOffset, MaxDepth, MaxSize, MinDensity, MaxDensity, *m_BiomeGen, *m_HeightGen));
} }
else if (NoCaseCompare(*itr, "WaterLakes") == 0) else if (NoCaseCompare(*itr, "WaterLakes") == 0)
{ {
@ -442,7 +447,10 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
} }
else if (NoCaseCompare(*itr, "WormNestCaves") == 0) else if (NoCaseCompare(*itr, "WormNestCaves") == 0)
{ {
m_FinishGens.push_back(new cStructGenWormNestCaves(Seed)); int Size = a_IniFile.GetValueSetI("Generator", "WormNestCavesSize", 64);
int Grid = a_IniFile.GetValueSetI("Generator", "WormNestCavesGrid", 96);
int MaxOffset = a_IniFile.GetValueSetI("Generator", "NetherFortMaxOffset", 32);
m_FinishGens.push_back(new cStructGenWormNestCaves(Seed, Size, Grid, MaxOffset));
} }
else else
{ {

View File

@ -21,8 +21,8 @@ class cEmptyStructure :
typedef cGridStructGen::cStructure super; typedef cGridStructGen::cStructure super;
public: public:
cEmptyStructure(int a_OriginX, int a_OriginZ) : cEmptyStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) :
super(a_OriginX, a_OriginZ) super(a_GridX, a_GridZ, a_OriginX, a_OriginZ)
{ {
} }
@ -40,17 +40,20 @@ protected:
cGridStructGen::cGridStructGen( cGridStructGen::cGridStructGen(
int a_Seed, int a_Seed,
int a_GridSizeX, int a_GridSizeZ, int a_GridSizeX, int a_GridSizeZ,
int a_MaxOffsetX, int a_MaxOffsetZ,
int a_MaxStructureSizeX, int a_MaxStructureSizeZ, int a_MaxStructureSizeX, int a_MaxStructureSizeZ,
size_t a_MaxCacheSize size_t a_MaxCacheSize
) : ) :
m_Seed(a_Seed), m_Noise(a_Seed),
m_GridSizeX(a_GridSizeX), m_GridSizeX(a_GridSizeX),
m_GridSizeZ(a_GridSizeZ), m_GridSizeZ(a_GridSizeZ),
m_MaxOffsetX(a_MaxOffsetX),
m_MaxOffsetZ(a_MaxOffsetZ),
m_MaxStructureSizeX(a_MaxStructureSizeX), m_MaxStructureSizeX(a_MaxStructureSizeX),
m_MaxStructureSizeZ(a_MaxStructureSizeZ), m_MaxStructureSizeZ(a_MaxStructureSizeZ),
m_MaxCacheSize(a_MaxCacheSize) m_MaxCacheSize(a_MaxCacheSize)
{ {
size_t NumStructuresPerQuery = (size_t)((m_MaxStructureSizeX / m_GridSizeX + 1) * (m_MaxStructureSizeZ / m_GridSizeZ + 1)); size_t NumStructuresPerQuery = (size_t)(((m_MaxStructureSizeX + m_MaxOffsetX) / m_GridSizeX + 1) * ((m_MaxStructureSizeZ + m_MaxOffsetZ) / m_GridSizeZ + 1));
if (NumStructuresPerQuery > m_MaxCacheSize) if (NumStructuresPerQuery > m_MaxCacheSize)
{ {
m_MaxCacheSize = NumStructuresPerQuery * 4; m_MaxCacheSize = NumStructuresPerQuery * 4;
@ -68,10 +71,10 @@ cGridStructGen::cGridStructGen(
void cGridStructGen::GetStructuresForChunk(int a_ChunkX, int a_ChunkZ, cStructurePtrs & a_Structures) void cGridStructGen::GetStructuresForChunk(int a_ChunkX, int a_ChunkZ, cStructurePtrs & a_Structures)
{ {
// Calculate the min and max grid coords of the structures to be returned: // Calculate the min and max grid coords of the structures to be returned:
int MinBlockX = a_ChunkX * cChunkDef::Width - m_MaxStructureSizeX; int MinBlockX = a_ChunkX * cChunkDef::Width - m_MaxStructureSizeX - m_MaxOffsetX;
int MinBlockZ = a_ChunkZ * cChunkDef::Width - m_MaxStructureSizeZ; int MinBlockZ = a_ChunkZ * cChunkDef::Width - m_MaxStructureSizeZ - m_MaxOffsetZ;
int MaxBlockX = a_ChunkX * cChunkDef::Width + m_MaxStructureSizeX + cChunkDef::Width - 1; int MaxBlockX = a_ChunkX * cChunkDef::Width + m_MaxStructureSizeX + m_MaxOffsetX + cChunkDef::Width - 1;
int MaxBlockZ = a_ChunkZ * cChunkDef::Width + m_MaxStructureSizeZ + cChunkDef::Width - 1; int MaxBlockZ = a_ChunkZ * cChunkDef::Width + m_MaxStructureSizeZ + m_MaxOffsetZ + cChunkDef::Width - 1;
int MinGridX = MinBlockX / m_GridSizeX; int MinGridX = MinBlockX / m_GridSizeX;
int MinGridZ = MinBlockZ / m_GridSizeZ; int MinGridZ = MinBlockZ / m_GridSizeZ;
int MaxGridX = (MaxBlockX + m_GridSizeX - 1) / m_GridSizeX; int MaxGridX = (MaxBlockX + m_GridSizeX - 1) / m_GridSizeX;
@ -103,14 +106,14 @@ void cGridStructGen::GetStructuresForChunk(int a_ChunkX, int a_ChunkZ, cStructur
// Create those structures that haven't been in the cache: // Create those structures that haven't been in the cache:
for (int x = MinGridX; x < MaxGridX; x++) for (int x = MinGridX; x < MaxGridX; x++)
{ {
int OriginX = x * m_GridSizeX; int GridX = x * m_GridSizeX;
for (int z = MinGridZ; z < MaxGridZ; z++) for (int z = MinGridZ; z < MaxGridZ; z++)
{ {
int OriginZ = z * m_GridSizeZ; int GridZ = z * m_GridSizeZ;
bool Found = false; bool Found = false;
for (cStructurePtrs::const_iterator itr = a_Structures.begin(), end = a_Structures.end(); itr != end; ++itr) for (cStructurePtrs::const_iterator itr = a_Structures.begin(), end = a_Structures.end(); itr != end; ++itr)
{ {
if (((*itr)->m_OriginX == OriginX) && ((*itr)->m_OriginZ == OriginZ)) if (((*itr)->m_GridX == GridX) && ((*itr)->m_GridZ == GridZ))
{ {
Found = true; Found = true;
break; break;
@ -118,10 +121,12 @@ void cGridStructGen::GetStructuresForChunk(int a_ChunkX, int a_ChunkZ, cStructur
} // for itr - a_Structures[] } // for itr - a_Structures[]
if (!Found) if (!Found)
{ {
cStructurePtr Structure = CreateStructure(OriginX, OriginZ); int OriginX = GridX + ((m_Noise.IntNoise2DInt(GridX + 3, GridZ + 5) / 7) % (m_MaxOffsetX * 2)) - m_MaxOffsetX;
int OriginZ = GridZ + ((m_Noise.IntNoise2DInt(GridX + 5, GridZ + 3) / 7) % (m_MaxOffsetZ * 2)) - m_MaxOffsetZ;
cStructurePtr Structure = CreateStructure(GridX, GridZ, OriginX, OriginZ);
if (Structure.get() == NULL) if (Structure.get() == NULL)
{ {
Structure.reset(new cEmptyStructure(OriginX, OriginZ)); Structure.reset(new cEmptyStructure(GridX, GridZ, OriginX, OriginZ));
} }
a_Structures.push_back(Structure); a_Structures.push_back(Structure);
} }

View File

@ -10,6 +10,7 @@
#pragma once #pragma once
#include "ComposableGenerator.h" #include "ComposableGenerator.h"
#include "../Noise.h"
@ -19,7 +20,12 @@
Defines a grid in the XZ space with predefined cell size in each direction. Each cell then receives exactly Defines a grid in the XZ space with predefined cell size in each direction. Each cell then receives exactly
one structure (provided by the descendant class). The structure is placed within the cell, but doesn't need one structure (provided by the descendant class). The structure is placed within the cell, but doesn't need
to be bounded by the cell, it can be well outside the cell; the generator uses the MaxStructureSize parameter to be bounded by the cell, it can be well outside the cell; the generator uses the MaxStructureSize parameter
to determine how far away from the cell the structure can be at most. to determine how far away from the cell the structure can be at most. Each structure has an offset from the
grid's center point, the offset is generated randomly from a range given to this class as a parameter.
Each structure thus contains the coords of its grid center (m_GridX, m_GridZ) and the actual origin from
which it's built (m_OriginX, m_OriginZ).
This class provides a cache for the structures generated for successive chunks and manages that cache. It This class provides a cache for the structures generated for successive chunks and manages that cache. It
also provides the cFinishGen override that uses the cache to actually generate the structure into chunk data. also provides the cFinishGen override that uses the cache to actually generate the structure into chunk data.
@ -43,12 +49,17 @@ public:
class cStructure class cStructure
{ {
public: public:
/** The origin (the coords of the gridpoint for which the structure is generated) */ /** The grid point for which the structure is generated. */
int m_GridX, m_GridZ;
/** The origin (the coords for which the structure is generated) */
int m_OriginX, m_OriginZ; int m_OriginX, m_OriginZ;
/** Creates a structure that has its originset at the specified coords. */ /** Creates a structure that has its origin set at the specified coords. */
cStructure (int a_OriginX, int a_OriginZ) : cStructure (int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) :
m_GridX(a_GridX),
m_GridZ(a_GridZ),
m_OriginX(a_OriginX), m_OriginX(a_OriginX),
m_OriginZ(a_OriginZ) m_OriginZ(a_OriginZ)
{ {
@ -70,20 +81,30 @@ public:
cGridStructGen( cGridStructGen(
int a_Seed, int a_Seed,
int a_GridSizeX, int a_GridSizeZ, int a_GridSizeX, int a_GridSizeZ,
int a_MaxOffsetX, int a_MaxOffsetZ,
int a_MaxStructureSizeX, int a_MaxStructureSizeZ, int a_MaxStructureSizeX, int a_MaxStructureSizeZ,
size_t a_MaxCacheSize size_t a_MaxCacheSize
); );
protected: protected:
/** Seed for generating the semi-random grid. */ /** Seed for generating grid offsets and also available for descendants. */
int m_Seed; int m_Seed;
/** The noise used for generating grid offsets. */
cNoise m_Noise;
/** The size of each grid's cell in the X axis */ /** The size of each grid's cell in the X axis */
int m_GridSizeX; int m_GridSizeX;
/** The size of each grid's cell in the Z axis */ /** The size of each grid's cell in the Z axis */
int m_GridSizeZ; int m_GridSizeZ;
/** The maximum offset of the structure's origin from the grid midpoint, in X coord. */
int m_MaxOffsetX;
/** The maximum offset of the structure's origin from the grid midpoint, in Z coord. */
int m_MaxOffsetZ;
/** Maximum theoretical size of the structure in the X axis. /** Maximum theoretical size of the structure in the X axis.
This limits the structures considered for a single chunk, so the lesser the number, the better performance. This limits the structures considered for a single chunk, so the lesser the number, the better performance.
Structures large than this may get cropped. */ Structures large than this may get cropped. */
@ -115,7 +136,7 @@ protected:
// Functions for the descendants to override: // Functions for the descendants to override:
/** Create a new structure at the specified gridpoint */ /** Create a new structure at the specified gridpoint */
virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) = 0; virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) = 0;
} ; } ;

View File

@ -248,7 +248,8 @@ public:
/** Creates and generates the entire system */ /** Creates and generates the entire system */
cMineShaftSystem( cMineShaftSystem(
int a_OriginX, int a_OriginZ, int a_GridSize, int a_MaxSystemSize, cNoise & a_Noise, int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ,
int a_GridSize, int a_MaxSystemSize, cNoise & a_Noise,
int a_ProbLevelCorridor, int a_ProbLevelCrossing, int a_ProbLevelStaircase int a_ProbLevelCorridor, int a_ProbLevelCrossing, int a_ProbLevelStaircase
); );
@ -278,10 +279,11 @@ public:
// cStructGenMineShafts::cMineShaftSystem: // cStructGenMineShafts::cMineShaftSystem:
cStructGenMineShafts::cMineShaftSystem::cMineShaftSystem( cStructGenMineShafts::cMineShaftSystem::cMineShaftSystem(
int a_OriginX, int a_OriginZ, int a_GridSize, int a_MaxSystemSize, cNoise & a_Noise, int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ,
int a_GridSize, int a_MaxSystemSize, cNoise & a_Noise,
int a_ProbLevelCorridor, int a_ProbLevelCrossing, int a_ProbLevelStaircase int a_ProbLevelCorridor, int a_ProbLevelCrossing, int a_ProbLevelStaircase
) : ) :
super(a_OriginX, a_OriginZ), super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_GridSize(a_GridSize), m_GridSize(a_GridSize),
m_MaxRecursion(8), // TODO: settable m_MaxRecursion(8), // TODO: settable
m_ProbLevelCorridor(a_ProbLevelCorridor), m_ProbLevelCorridor(a_ProbLevelCorridor),
@ -1280,10 +1282,10 @@ void cMineShaftStaircase::ProcessChunk(cChunkDesc & a_ChunkDesc)
// cStructGenMineShafts: // cStructGenMineShafts:
cStructGenMineShafts::cStructGenMineShafts( cStructGenMineShafts::cStructGenMineShafts(
int a_Seed, int a_GridSize, int a_MaxSystemSize, int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxSystemSize,
int a_ChanceCorridor, int a_ChanceCrossing, int a_ChanceStaircase int a_ChanceCorridor, int a_ChanceCrossing, int a_ChanceStaircase
) : ) :
super(a_Seed, a_GridSize, a_GridSize, a_MaxSystemSize, a_MaxSystemSize, 100), super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSystemSize, a_MaxSystemSize, 100),
m_Noise(a_Seed), m_Noise(a_Seed),
m_GridSize(a_GridSize), m_GridSize(a_GridSize),
m_MaxSystemSize(a_MaxSystemSize), m_MaxSystemSize(a_MaxSystemSize),
@ -1297,9 +1299,9 @@ cStructGenMineShafts::cStructGenMineShafts(
cGridStructGen::cStructurePtr cStructGenMineShafts::CreateStructure(int a_OriginX, int a_OriginZ) cGridStructGen::cStructurePtr cStructGenMineShafts::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{ {
return cStructurePtr(new cMineShaftSystem(a_OriginX, a_OriginZ, m_GridSize, m_MaxSystemSize, m_Noise, m_ProbLevelCorridor, m_ProbLevelCrossing, m_ProbLevelStaircase)); return cStructurePtr(new cMineShaftSystem(a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_GridSize, m_MaxSystemSize, m_Noise, m_ProbLevelCorridor, m_ProbLevelCrossing, m_ProbLevelStaircase));
} }

View File

@ -23,7 +23,7 @@ class cStructGenMineShafts :
public: public:
cStructGenMineShafts( cStructGenMineShafts(
int a_Seed, int a_GridSize, int a_MaxSystemSize, int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxSystemSize,
int a_ChanceCorridor, int a_ChanceCrossing, int a_ChanceStaircase int a_ChanceCorridor, int a_ChanceCrossing, int a_ChanceStaircase
); );
@ -43,7 +43,7 @@ protected:
int m_ProbLevelStaircase; ///< Probability level of a branch object being the staircase, minus Crossing int m_ProbLevelStaircase; ///< Probability level of a branch object being the staircase, minus Crossing
// cGridStructGen overrides: // cGridStructGen overrides:
virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override; virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ; } ;

View File

@ -26,8 +26,8 @@ public:
cPlacedPieces m_Pieces; cPlacedPieces m_Pieces;
cNetherFort(cNetherFortGen & a_ParentGen, int a_OriginX, int a_OriginZ, int a_GridSize, int a_MaxDepth, int a_Seed) : cNetherFort(cNetherFortGen & a_ParentGen, int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_GridSize, int a_MaxDepth, int a_Seed) :
super(a_OriginX, a_OriginZ), super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_ParentGen(a_ParentGen), m_ParentGen(a_ParentGen),
m_GridSize(a_GridSize), m_GridSize(a_GridSize),
m_Seed(a_Seed) m_Seed(a_Seed)
@ -108,8 +108,8 @@ cPrefabPiecePool cNetherFortGen::m_PiecePool(g_NetherFortPrefabs, g_NetherFortPr
cNetherFortGen::cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxDepth) : cNetherFortGen::cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth) :
super(a_Seed, a_GridSize, a_GridSize, a_MaxDepth * 10, a_MaxDepth * 10, 200), super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxDepth * 10, a_MaxDepth * 10, 200),
m_MaxDepth(a_MaxDepth) m_MaxDepth(a_MaxDepth)
{ {
/* /*
@ -124,8 +124,11 @@ cNetherFortGen::cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxDepth) :
cGridStructGen::cStructurePtr cNetherFortGen::CreateStructure(int a_OriginX, int a_OriginZ) cGridStructGen::cStructurePtr cNetherFortGen::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{ {
return cStructurePtr(new cNetherFort(*this, a_OriginX, a_OriginZ, m_GridSizeX, m_MaxDepth, m_Seed)); return cStructurePtr(new cNetherFort(*this, a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_GridSizeX, m_MaxDepth, m_Seed));
} }

View File

@ -23,7 +23,7 @@ class cNetherFortGen :
typedef cGridStructGen super; typedef cGridStructGen super;
public: public:
cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxDepth); cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth);
protected: protected:
friend class cNetherFortPerfTest; // fwd: NetherFortGen.cpp friend class cNetherFortPerfTest; // fwd: NetherFortGen.cpp
@ -37,7 +37,7 @@ protected:
// cGridStructGen overrides: // cGridStructGen overrides:
virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override; virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ; } ;

View File

@ -29,11 +29,12 @@ class cRainbowRoadsGen::cRainbowRoads :
public: public:
cRainbowRoads( cRainbowRoads(
int a_Seed, int a_Seed,
int a_GridX, int a_GridZ,
int a_OriginX, int a_OriginZ, int a_OriginX, int a_OriginZ,
int a_MaxDepth, int a_MaxDepth,
int a_MaxSize int a_MaxSize
) : ) :
super(a_OriginX, a_OriginZ), super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Seed(a_Seed), m_Seed(a_Seed),
m_Noise(a_Seed), m_Noise(a_Seed),
m_MaxSize(a_MaxSize), m_MaxSize(a_MaxSize),
@ -92,8 +93,8 @@ protected:
cRainbowRoadsGen::cRainbowRoadsGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize) : cRainbowRoadsGen::cRainbowRoadsGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize) :
super(a_Seed, a_GridSize, a_GridSize, a_MaxSize, a_MaxSize, 100), super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 100),
m_Noise(a_Seed + 9000), m_Noise(a_Seed + 9000),
m_MaxDepth(a_MaxDepth), m_MaxDepth(a_MaxDepth),
m_MaxSize(a_MaxSize) m_MaxSize(a_MaxSize)
@ -104,10 +105,10 @@ cRainbowRoadsGen::cRainbowRoadsGen(int a_Seed, int a_GridSize, int a_MaxDepth, i
cGridStructGen::cStructurePtr cRainbowRoadsGen::CreateStructure(int a_OriginX, int a_OriginZ) cGridStructGen::cStructurePtr cRainbowRoadsGen::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{ {
// Create a base based on the chosen prefabs: // Create a base based on the chosen prefabs:
return cStructurePtr(new cRainbowRoads(m_Seed, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize)); return cStructurePtr(new cRainbowRoads(m_Seed, a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize));
} }

View File

@ -22,7 +22,7 @@ class cRainbowRoadsGen :
typedef cGridStructGen super; typedef cGridStructGen super;
public: public:
cRainbowRoadsGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize); cRainbowRoadsGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize);
protected: protected:
class cRainbowRoads; // fwd: RainbowRoadsGen.cpp class cRainbowRoads; // fwd: RainbowRoadsGen.cpp
@ -39,7 +39,7 @@ protected:
// cGridStructGen overrides: // cGridStructGen overrides:
virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override; virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ; } ;

View File

@ -61,7 +61,7 @@ class cStructGenRavines::cRavine :
public: public:
cRavine(int a_BlockX, int a_BlockZ, int a_Size, cNoise & a_Noise); cRavine(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_Size, cNoise & a_Noise);
#ifdef _DEBUG #ifdef _DEBUG
/// Exports itself as a SVG line definition /// Exports itself as a SVG line definition
@ -81,7 +81,7 @@ protected:
// cStructGenRavines: // cStructGenRavines:
cStructGenRavines::cStructGenRavines(int a_Seed, int a_Size) : cStructGenRavines::cStructGenRavines(int a_Seed, int a_Size) :
super(a_Seed, a_Size, a_Size, a_Size * 2, a_Size * 2, 100), super(a_Seed, a_Size, a_Size, a_Size, a_Size, a_Size * 2, a_Size * 2, 100),
m_Noise(a_Seed), m_Noise(a_Seed),
m_Size(a_Size) m_Size(a_Size)
{ {
@ -91,9 +91,9 @@ cStructGenRavines::cStructGenRavines(int a_Seed, int a_Size) :
cGridStructGen::cStructurePtr cStructGenRavines::CreateStructure(int a_OriginX, int a_OriginZ) cGridStructGen::cStructurePtr cStructGenRavines::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{ {
return cStructurePtr(new cRavine(a_OriginX, a_OriginZ, m_Size, m_Noise)); return cStructurePtr(new cRavine(a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_Size, m_Noise));
} }
@ -104,8 +104,8 @@ cGridStructGen::cStructurePtr cStructGenRavines::CreateStructure(int a_OriginX,
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cStructGenRavines::cRavine // cStructGenRavines::cRavine
cStructGenRavines::cRavine::cRavine(int a_OriginX, int a_OriginZ, int a_Size, cNoise & a_Noise) : cStructGenRavines::cRavine::cRavine(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_Size, cNoise & a_Noise) :
super(a_OriginX, a_OriginZ) super(a_GridX, a_GridZ, a_OriginX, a_OriginZ)
{ {
// Calculate the ravine shape-defining points: // Calculate the ravine shape-defining points:
GenerateBaseDefPoints(a_OriginX, a_OriginZ, a_Size, a_Noise); GenerateBaseDefPoints(a_OriginX, a_OriginZ, a_Size, a_Noise);

View File

@ -32,7 +32,7 @@ protected:
// cGridStructGen overrides: // cGridStructGen overrides:
virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override; virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ; } ;

View File

@ -29,11 +29,12 @@ class cUnderwaterBaseGen::cUnderwaterBase :
public: public:
cUnderwaterBase( cUnderwaterBase(
int a_Seed, int a_Seed,
int a_GridX, int a_GridZ,
int a_OriginX, int a_OriginZ, int a_OriginX, int a_OriginZ,
int a_MaxDepth, int a_MaxDepth,
int a_MaxSize int a_MaxSize
) : ) :
super(a_OriginX, a_OriginZ), super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Seed(a_Seed), m_Seed(a_Seed),
m_Noise(a_Seed), m_Noise(a_Seed),
m_MaxSize(a_MaxSize), m_MaxSize(a_MaxSize),
@ -92,8 +93,8 @@ protected:
cUnderwaterBaseGen::cUnderwaterBaseGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, cBiomeGen & a_BiomeGen) : cUnderwaterBaseGen::cUnderwaterBaseGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, cBiomeGen & a_BiomeGen) :
super(a_Seed, a_GridSize, a_GridSize, a_MaxSize, a_MaxSize, 100), super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 100),
m_Noise(a_Seed + 1000), m_Noise(a_Seed + 1000),
m_MaxDepth(a_MaxDepth), m_MaxDepth(a_MaxDepth),
m_MaxSize(a_MaxSize), m_MaxSize(a_MaxSize),
@ -105,7 +106,7 @@ cUnderwaterBaseGen::cUnderwaterBaseGen(int a_Seed, int a_GridSize, int a_MaxDept
cGridStructGen::cStructurePtr cUnderwaterBaseGen::CreateStructure(int a_OriginX, int a_OriginZ) cGridStructGen::cStructurePtr cUnderwaterBaseGen::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{ {
// Generate the biomes for the chunk surrounding the origin: // Generate the biomes for the chunk surrounding the origin:
int ChunkX, ChunkZ; int ChunkX, ChunkZ;
@ -134,7 +135,7 @@ cGridStructGen::cStructurePtr cUnderwaterBaseGen::CreateStructure(int a_OriginX,
} // for i - Biomes[] } // for i - Biomes[]
// Create a base based on the chosen prefabs: // Create a base based on the chosen prefabs:
return cStructurePtr(new cUnderwaterBase(m_Seed, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize)); return cStructurePtr(new cUnderwaterBase(m_Seed, a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize));
} }

View File

@ -22,7 +22,7 @@ class cUnderwaterBaseGen :
typedef cGridStructGen super; typedef cGridStructGen super;
public: public:
cUnderwaterBaseGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, cBiomeGen & a_BiomeGen); cUnderwaterBaseGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, cBiomeGen & a_BiomeGen);
protected: protected:
class cUnderwaterBase; // fwd: UnderwaterBaseGen.cpp class cUnderwaterBase; // fwd: UnderwaterBaseGen.cpp
@ -42,7 +42,7 @@ protected:
// cGridStructGen overrides: // cGridStructGen overrides:
virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override; virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ; } ;

View File

@ -110,6 +110,7 @@ class cVillageGen::cVillage :
public: public:
cVillage( cVillage(
int a_Seed, int a_Seed,
int a_GridX, int a_GridZ,
int a_OriginX, int a_OriginZ, int a_OriginX, int a_OriginZ,
int a_MaxRoadDepth, int a_MaxRoadDepth,
int a_MaxSize, int a_MaxSize,
@ -119,7 +120,7 @@ public:
BLOCKTYPE a_RoadBlock, BLOCKTYPE a_RoadBlock,
BLOCKTYPE a_WaterRoadBlock BLOCKTYPE a_WaterRoadBlock
) : ) :
super(a_OriginX, a_OriginZ), super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Seed(a_Seed), m_Seed(a_Seed),
m_Noise(a_Seed), m_Noise(a_Seed),
m_MaxSize(a_MaxSize), m_MaxSize(a_MaxSize),
@ -358,8 +359,8 @@ static cVillagePiecePool * g_PlainsVillagePools[] =
cVillageGen::cVillageGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen) : cVillageGen::cVillageGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen) :
super(a_Seed, a_GridSize, a_GridSize, a_MaxSize, a_MaxSize, 100), super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 100),
m_Noise(a_Seed + 1000), m_Noise(a_Seed + 1000),
m_MaxDepth(a_MaxDepth), m_MaxDepth(a_MaxDepth),
m_MaxSize(a_MaxSize), m_MaxSize(a_MaxSize),
@ -374,7 +375,7 @@ cVillageGen::cVillageGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSi
cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_OriginX, int a_OriginZ) cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{ {
// Generate the biomes for the chunk surrounding the origin: // Generate the biomes for the chunk surrounding the origin:
int ChunkX, ChunkZ; int ChunkX, ChunkZ;
@ -435,7 +436,7 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_OriginX, int a_
{ {
return cStructurePtr(); return cStructurePtr();
} }
return cStructurePtr(new cVillage(m_Seed, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize, Density, *VillagePrefabs, m_HeightGen, RoadBlock, WaterRoadBlock)); return cStructurePtr(new cVillage(m_Seed, a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize, Density, *VillagePrefabs, m_HeightGen, RoadBlock, WaterRoadBlock));
} }

View File

@ -21,7 +21,7 @@ class cVillageGen :
{ {
typedef cGridStructGen super; typedef cGridStructGen super;
public: public:
cVillageGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen); cVillageGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen);
protected: protected:
class cVillage; // fwd: VillageGen.cpp class cVillage; // fwd: VillageGen.cpp
@ -49,7 +49,7 @@ protected:
// cGridStructGen overrides: // cGridStructGen overrides:
virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override; virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ; } ;