Gen refactor: Implemented CompositedHeiGen.
This fixes crashes in the Village generator due to the missing generator.
This commit is contained in:
@@ -570,220 +570,6 @@ protected:
|
||||
return patDirt.Get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
/** Fills a single column with grass-based terrain (grass or water, dirt, stone). */
|
||||
void FillColumnGrass(int a_RelX, int a_RelZ, const Byte * a_ShapeColumn, cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
static const PatternItem pattern[] =
|
||||
{
|
||||
{ E_BLOCK_GRASS, 0},
|
||||
{ E_BLOCK_DIRT, 0},
|
||||
{ E_BLOCK_DIRT, 0},
|
||||
{ E_BLOCK_DIRT, 0},
|
||||
} ;
|
||||
FillColumnPattern(a_RelX, a_RelZ, a_ShapeColumn, a_ChunkDesc, pattern, ARRAYCOUNT(pattern));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Fills a single column with grass-based terrain (grass or water, dirt, stone). */
|
||||
void FillColumnStone(int a_RelX, int a_RelZ, const Byte * a_ShapeColumn, cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
static const PatternItem pattern[] =
|
||||
{
|
||||
{ E_BLOCK_STONE, 0},
|
||||
} ;
|
||||
FillColumnPattern(a_RelX, a_RelZ, a_ShapeColumn, a_ChunkDesc, pattern, ARRAYCOUNT(pattern));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Fills a single column with Mesa-like terrain (variations of clay). */
|
||||
void FillColumnMesa(int a_RelX, int a_RelZ, const Byte * a_ShapeColumn, cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
// Fill with grass and dirt on the very top of mesa plateaus:
|
||||
size_t curIdx = 0;
|
||||
for (int y = 255; y > m_MesaDirtLevel; y--)
|
||||
{
|
||||
if (a_ShapeColumn[y] > 0)
|
||||
{
|
||||
a_ChunkDesc.SetBlockType(a_RelX, y, a_RelZ, (curIdx > 0) ? E_BLOCK_DIRT : E_BLOCK_GRASS);
|
||||
curIdx += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
curIdx = 0;
|
||||
}
|
||||
} // for y
|
||||
|
||||
// Fill with clays from the DirtLevel down to SandLevel:
|
||||
for (int y = m_MesaDirtLevel; y > m_MesaSandLevel; y--)
|
||||
{
|
||||
if (a_ShapeColumn[y] > 0)
|
||||
{
|
||||
a_ChunkDesc.SetBlockTypeMeta(a_RelX, y, a_RelZ, m_MesaPattern[y].m_BlockType, m_MesaPattern[y].m_BlockMeta);
|
||||
}
|
||||
else
|
||||
{
|
||||
curIdx = 0;
|
||||
}
|
||||
} // for y
|
||||
|
||||
// If currently air, switch to red sand pattern:
|
||||
static const PatternItem redSandPattern[] =
|
||||
{
|
||||
{ E_BLOCK_SAND, E_META_SAND_RED},
|
||||
{ E_BLOCK_STAINED_CLAY, E_META_STAINED_CLAY_ORANGE},
|
||||
{ E_BLOCK_STAINED_CLAY, E_META_STAINED_CLAY_ORANGE},
|
||||
{ E_BLOCK_STAINED_CLAY, E_META_STAINED_CLAY_ORANGE},
|
||||
};
|
||||
Pattern pattern;
|
||||
size_t patternSize;
|
||||
if (curIdx == 0)
|
||||
{
|
||||
pattern = redSandPattern;
|
||||
patternSize = ARRAYCOUNT(redSandPattern);
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern = m_MesaPattern + m_MesaSandLevel;
|
||||
patternSize = static_cast<size_t>(m_MesaSandLevel);
|
||||
}
|
||||
|
||||
// Fill with current pattern (MesaPattern or RedSand) until sealevel:
|
||||
for (int y = m_MesaSandLevel; y > m_SeaLevel; y--)
|
||||
{
|
||||
if (a_ShapeColumn[y] > 0)
|
||||
{
|
||||
if (curIdx >= patternSize)
|
||||
{
|
||||
a_ChunkDesc.SetBlockTypeMeta(a_RelX, y, a_RelZ, E_BLOCK_STAINED_CLAY, E_META_STAINED_CLAY_ORANGE);
|
||||
}
|
||||
else
|
||||
{
|
||||
a_ChunkDesc.SetBlockTypeMeta(a_RelX, y, a_RelZ, pattern[curIdx].m_BlockType, pattern[curIdx].m_BlockMeta);
|
||||
}
|
||||
curIdx += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Air resets the pattern to red sand:
|
||||
curIdx = 0;
|
||||
pattern = redSandPattern;
|
||||
patternSize = ARRAYCOUNT(redSandPattern);
|
||||
}
|
||||
} // for y
|
||||
|
||||
// If there is an ocean, fill it with water and then redsand:
|
||||
int y = m_SeaLevel;
|
||||
for (; y > 0; y--)
|
||||
{
|
||||
if ((a_ShapeColumn[y] == 0) || (curIdx >= ARRAYCOUNT(redSandPattern)))
|
||||
{
|
||||
// water pocket or out of red sand pattern, use stone from now on
|
||||
break;
|
||||
}
|
||||
a_ChunkDesc.SetBlockTypeMeta(a_RelX, y, a_RelZ, E_BLOCK_STAINED_CLAY, E_META_STAINED_CLAY_ORANGE);
|
||||
curIdx = curIdx + 1;
|
||||
} // for y
|
||||
|
||||
// The rest should be filled with stone:
|
||||
for (; y > 0; y--)
|
||||
{
|
||||
if (a_ShapeColumn[y] > 0)
|
||||
{
|
||||
a_ChunkDesc.SetBlockType(a_RelX, y, a_RelZ, E_BLOCK_STONE);
|
||||
}
|
||||
} // for y
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Fills a single column with megataiga-based terrain (grass or podzol on top). */
|
||||
void FillColumnMegaTaiga(int a_RelX, int a_RelZ, const Byte * a_ShapeColumn, cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Fills a single column with sand-based terrain (such as desert or beach). */
|
||||
void FillColumnSand(int a_RelX, int a_RelZ, const Byte * a_ShapeColumn, cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
static const PatternItem pattern[] =
|
||||
{
|
||||
{ E_BLOCK_SAND, 0},
|
||||
{ E_BLOCK_SAND, 0},
|
||||
{ E_BLOCK_SAND, 0},
|
||||
{ E_BLOCK_SANDSTONE, 0},
|
||||
} ;
|
||||
FillColumnPattern(a_RelX, a_RelZ, a_ShapeColumn, a_ChunkDesc, pattern, ARRAYCOUNT(pattern));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FillColumnMycelium(int a_RelX, int a_RelZ, const Byte * a_ShapeColumn, cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
static const PatternItem pattern[] =
|
||||
{
|
||||
{ E_BLOCK_MYCELIUM, 0},
|
||||
{ E_BLOCK_DIRT, 0},
|
||||
{ E_BLOCK_DIRT, 0},
|
||||
{ E_BLOCK_DIRT, 0},
|
||||
} ;
|
||||
FillColumnPattern(a_RelX, a_RelZ, a_ShapeColumn, a_ChunkDesc, pattern, ARRAYCOUNT(pattern));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Fills the column with the specified pattern, repeating it if there's an air pocket in between. */
|
||||
void FillColumnPattern(int a_RelX, int a_RelZ, const Byte * a_ShapeColumn, cChunkDesc & a_ChunkDesc, Pattern a_Pattern, size_t a_PatternSize)
|
||||
{
|
||||
// Fill with pattern until sealevel:
|
||||
size_t curIdx = 0;
|
||||
for (int y = 255; y > m_SeaLevel; y--)
|
||||
{
|
||||
if (a_ShapeColumn[y] > 0)
|
||||
{
|
||||
// Continue with the pattern:
|
||||
if (curIdx >= a_PatternSize)
|
||||
{
|
||||
a_ChunkDesc.SetBlockType(a_RelX, y, a_RelZ, E_BLOCK_STONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
a_ChunkDesc.SetBlockTypeMeta(a_RelX, y, a_RelZ, a_Pattern[curIdx].m_BlockType, a_Pattern[curIdx].m_BlockMeta);
|
||||
}
|
||||
curIdx += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Air pocket, restart the pattern:
|
||||
curIdx = 0;
|
||||
}
|
||||
} // for y
|
||||
|
||||
// From sealevel downward use the ocean floor pattern:
|
||||
FillOceanFloor(a_RelX, a_RelZ, a_ShapeColumn, a_ChunkDesc, a_Pattern, a_PatternSize, curIdx);
|
||||
}
|
||||
|
||||
|
||||
/** Fills the blocks from sealevel down to bottom with ocean-floor pattern.
|
||||
a_PatternStartOffset specifies the offset at which to start the pattern, in case there was air just above. */
|
||||
void FillOceanFloor(int a_RelX, int a_RelZ, const Byte * a_ShapeColumn, cChunkDesc & a_ChunkDesc, Pattern a_Pattern, size_t a_PatternSize, size_t a_PatternStartOffset)
|
||||
{
|
||||
for (int y = m_SeaLevel; y > 0; y--)
|
||||
{
|
||||
if (a_ShapeColumn[y] > 0)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
} // for y
|
||||
}
|
||||
#endif
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user