mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-10 19:32:10 +00:00
Refactor "Cavegen y biome check"
This commit is contained in:
parent
486dc3288d
commit
3af226cb06
4 changed files with 29 additions and 51 deletions
|
@ -82,8 +82,6 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm,
|
|||
const v3s16 &em = vm->m_area.getExtent();
|
||||
u32 index2d = 0; // Biomemap index
|
||||
|
||||
s16 *biome_transitions = m_bmgn->getBiomeTransitions();
|
||||
|
||||
for (s16 z = nmin.Z; z <= nmax.Z; z++)
|
||||
for (s16 x = nmin.X; x <= nmax.X; x++, index2d++) {
|
||||
bool column_is_open = false; // Is column open to overground
|
||||
|
@ -101,8 +99,7 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm,
|
|||
u16 depth_riverbed = biome->depth_riverbed;
|
||||
u16 nplaced = 0;
|
||||
|
||||
int cur_biome_depth = 0;
|
||||
s16 biome_y_min = biome_transitions[cur_biome_depth];
|
||||
s16 biome_y_min = m_bmgn->getNextTransitionY(nmax.Y);
|
||||
|
||||
// Don't excavate the overgenerated stone at nmax.Y + 1,
|
||||
// this creates a 'roof' over the tunnel, preventing light in
|
||||
|
@ -114,15 +111,12 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm,
|
|||
// We need this check to make sure that biomes don't generate too far down
|
||||
if (y < biome_y_min) {
|
||||
biome = m_bmgn->getBiomeAtIndex(index2d, v3s16(x, y, z));
|
||||
biome_y_min = m_bmgn->getNextTransitionY(y);
|
||||
|
||||
// Finding the height of the next biome
|
||||
// On first iteration this may loop a couple times after than it should just run once
|
||||
while (y < biome_y_min) {
|
||||
biome_y_min = biome_transitions[++cur_biome_depth];
|
||||
if (x == nmin.X && z == nmin.Z && false) {
|
||||
dstream << "cavegen: biome at " << y << " is " << biome->name
|
||||
<< ", next at " << biome_y_min << std::endl;
|
||||
}
|
||||
|
||||
/*if (x == nmin.X && z == nmin.Z)
|
||||
printf("Cave: check @ %i -> %s -> again at %i\n", y, biome->name.c_str(), biome_y_min);*/
|
||||
}
|
||||
|
||||
content_t c = vm->m_data[vi].getContent();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue