forked from Mirrorlandia_minetest/minetest
Cavegen: Remove now unnecessary checks for water, lava, ice
Remove large cave checks for air Mgv5/mgv7:Add is_ground_content checks to 3d noise tunnels More large caves Shorten lines
This commit is contained in:
parent
f81759792e
commit
392ac41c99
@ -262,11 +262,8 @@ void CaveV5::carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
u32 i = vm->m_area.index(p);
|
u32 i = vm->m_area.index(p);
|
||||||
|
|
||||||
// Don't replace air, water, lava, or ice
|
|
||||||
content_t c = vm->m_data[i].getContent();
|
content_t c = vm->m_data[i].getContent();
|
||||||
if (!ndef->get(c).is_ground_content || c == CONTENT_AIR ||
|
if (!ndef->get(c).is_ground_content)
|
||||||
c == c_water_source || c == c_lava_source || c == c_ice)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int full_ymin = node_min.Y - MAP_BLOCKSIZE;
|
int full_ymin = node_min.Y - MAP_BLOCKSIZE;
|
||||||
@ -551,9 +548,7 @@ void CaveV6::carveRoute(v3f vec, float f, bool randomize_xz) {
|
|||||||
vm->m_data[i] = airnode;
|
vm->m_data[i] = airnode;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Don't replace air or water or lava or ignore
|
if (c == CONTENT_IGNORE || c == CONTENT_AIR)
|
||||||
if (c == CONTENT_IGNORE || c == CONTENT_AIR ||
|
|
||||||
c == c_water_source || c == c_lava_source)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
vm->m_data[i] = airnode;
|
vm->m_data[i] = airnode;
|
||||||
@ -800,11 +795,8 @@ void CaveV7::carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
u32 i = vm->m_area.index(p);
|
u32 i = vm->m_area.index(p);
|
||||||
|
|
||||||
// Don't replace air, water, lava, or ice
|
|
||||||
content_t c = vm->m_data[i].getContent();
|
content_t c = vm->m_data[i].getContent();
|
||||||
if (!ndef->get(c).is_ground_content || c == CONTENT_AIR ||
|
if (!ndef->get(c).is_ground_content)
|
||||||
c == c_water_source || c == c_lava_source || c == c_ice)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int full_ymin = node_min.Y - MAP_BLOCKSIZE;
|
int full_ymin = node_min.Y - MAP_BLOCKSIZE;
|
||||||
|
@ -411,11 +411,12 @@ bool MapgenV5::generateBiomes(float *heat_map, float *humidity_map)
|
|||||||
for (s16 y = node_max.Y; y >= node_min.Y; y--) {
|
for (s16 y = node_max.Y; y >= node_min.Y; y--) {
|
||||||
content_t c = vm->m_data[i].getContent();
|
content_t c = vm->m_data[i].getContent();
|
||||||
|
|
||||||
if (c != CONTENT_IGNORE && c != CONTENT_AIR && (y == node_max.Y || have_air)) {
|
if (c != CONTENT_IGNORE && c != CONTENT_AIR &&
|
||||||
biome = bmgr->getBiome(heat_map[index], humidity_map[index], y);
|
(y == node_max.Y || have_air)) {
|
||||||
dfiller = biome->depth_filler + noise_filler_depth->result[index];
|
biome = bmgr->getBiome(heat_map[index], humidity_map[index], y);
|
||||||
y0_top = biome->depth_top;
|
dfiller = biome->depth_filler + noise_filler_depth->result[index];
|
||||||
y0_filler = biome->depth_top + dfiller;
|
y0_top = biome->depth_top;
|
||||||
|
y0_filler = biome->depth_top + dfiller;
|
||||||
depth_water_top = biome->depth_water_top;
|
depth_water_top = biome->depth_water_top;
|
||||||
|
|
||||||
if (biome->c_stone == c_desert_stone)
|
if (biome->c_stone == c_desert_stone)
|
||||||
@ -478,18 +479,19 @@ void MapgenV5::generateCaves(int max_stone_y)
|
|||||||
for (s16 y=node_min.Y - 1; y<=node_max.Y + 1; y++) {
|
for (s16 y=node_min.Y - 1; y<=node_max.Y + 1; y++) {
|
||||||
u32 i = vm->m_area.index(node_min.X, y, z);
|
u32 i = vm->m_area.index(node_min.X, y, z);
|
||||||
for (s16 x=node_min.X; x<=node_max.X; x++, i++, index++, index2d++) {
|
for (s16 x=node_min.X; x<=node_max.X; x++, i++, index++, index2d++) {
|
||||||
Biome *biome = (Biome *)bmgr->getRaw(biomemap[index2d]);
|
|
||||||
content_t c = vm->m_data[i].getContent();
|
|
||||||
if (c == CONTENT_AIR
|
|
||||||
|| (y <= water_level
|
|
||||||
&& c != biome->c_stone
|
|
||||||
&& c != c_stone))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
float d1 = contour(noise_cave1->result[index]);
|
float d1 = contour(noise_cave1->result[index]);
|
||||||
float d2 = contour(noise_cave2->result[index]);
|
float d2 = contour(noise_cave2->result[index]);
|
||||||
if (d1*d2 > 0.125)
|
if (d1*d2 > 0.125) {
|
||||||
|
Biome *biome = (Biome *)bmgr->getRaw(biomemap[index2d]);
|
||||||
|
content_t c = vm->m_data[i].getContent();
|
||||||
|
if (!ndef->get(c).is_ground_content || c == CONTENT_AIR ||
|
||||||
|
(y <= water_level &&
|
||||||
|
c != biome->c_stone &&
|
||||||
|
c != c_stone))
|
||||||
|
continue;
|
||||||
|
|
||||||
vm->m_data[i] = MapNode(CONTENT_AIR);
|
vm->m_data[i] = MapNode(CONTENT_AIR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
index2d -= ystride;
|
index2d -= ystride;
|
||||||
}
|
}
|
||||||
@ -500,7 +502,7 @@ void MapgenV5::generateCaves(int max_stone_y)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
PseudoRandom ps(blockseed + 21343);
|
PseudoRandom ps(blockseed + 21343);
|
||||||
u32 bruises_count = (ps.range(1, 5) == 1) ? ps.range(1, 2) : 0;
|
u32 bruises_count = (ps.range(1, 4) == 1) ? ps.range(1, 2) : 0;
|
||||||
for (u32 i = 0; i < bruises_count; i++) {
|
for (u32 i = 0; i < bruises_count; i++) {
|
||||||
CaveV5 cave(this, &ps);
|
CaveV5 cave(this, &ps);
|
||||||
cave.makeCave(node_min, node_max, max_stone_y);
|
cave.makeCave(node_min, node_max, max_stone_y);
|
||||||
|
@ -605,11 +605,12 @@ bool MapgenV7::generateBiomes(float *heat_map, float *humidity_map)
|
|||||||
for (s16 y = node_max.Y; y >= node_min.Y; y--) {
|
for (s16 y = node_max.Y; y >= node_min.Y; y--) {
|
||||||
content_t c = vm->m_data[i].getContent();
|
content_t c = vm->m_data[i].getContent();
|
||||||
|
|
||||||
if (c != CONTENT_IGNORE && c != CONTENT_AIR && (y == node_max.Y || have_air)) {
|
if (c != CONTENT_IGNORE && c != CONTENT_AIR &&
|
||||||
biome = bmgr->getBiome(heat_map[index], humidity_map[index], y);
|
(y == node_max.Y || have_air)) {
|
||||||
dfiller = biome->depth_filler + noise_filler_depth->result[index];
|
biome = bmgr->getBiome(heat_map[index], humidity_map[index], y);
|
||||||
y0_top = biome->depth_top;
|
dfiller = biome->depth_filler + noise_filler_depth->result[index];
|
||||||
y0_filler = biome->depth_top + dfiller;
|
y0_top = biome->depth_top;
|
||||||
|
y0_filler = biome->depth_top + dfiller;
|
||||||
depth_water_top = biome->depth_water_top;
|
depth_water_top = biome->depth_water_top;
|
||||||
|
|
||||||
if (biome->c_stone == c_desert_stone)
|
if (biome->c_stone == c_desert_stone)
|
||||||
@ -820,16 +821,21 @@ void MapgenV7::generateCaves(int max_stone_y)
|
|||||||
u32 i = vm->m_area.index(node_min.X, y, z);
|
u32 i = vm->m_area.index(node_min.X, y, z);
|
||||||
for (s16 x = node_min.X; x <= node_max.X;
|
for (s16 x = node_min.X; x <= node_max.X;
|
||||||
x++, i++, index++, index2d++) {
|
x++, i++, index++, index2d++) {
|
||||||
Biome *biome = (Biome *)bmgr->getRaw(biomemap[index2d]);
|
|
||||||
content_t c = vm->m_data[i].getContent();
|
|
||||||
if (c == CONTENT_AIR || (y <= water_level &&
|
|
||||||
c != biome->c_stone && c != c_stone))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
float d1 = contour(noise_cave1->result[index]);
|
float d1 = contour(noise_cave1->result[index]);
|
||||||
float d2 = contour(noise_cave2->result[index]);
|
float d2 = contour(noise_cave2->result[index]);
|
||||||
if (d1 * d2 > 0.3)
|
if (d1 * d2 > 0.3) {
|
||||||
|
Biome *biome = (Biome *)bmgr->
|
||||||
|
getRaw(biomemap[index2d]);
|
||||||
|
content_t c = vm->m_data[i].getContent();
|
||||||
|
if (!ndef->get(c).is_ground_content ||
|
||||||
|
c == CONTENT_AIR ||
|
||||||
|
(y <= water_level &&
|
||||||
|
c != biome->c_stone &&
|
||||||
|
c != c_stone))
|
||||||
|
continue;
|
||||||
|
|
||||||
vm->m_data[i] = MapNode(CONTENT_AIR);
|
vm->m_data[i] = MapNode(CONTENT_AIR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
index2d -= ystride;
|
index2d -= ystride;
|
||||||
}
|
}
|
||||||
@ -838,7 +844,7 @@ void MapgenV7::generateCaves(int max_stone_y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PseudoRandom ps(blockseed + 21343);
|
PseudoRandom ps(blockseed + 21343);
|
||||||
u32 bruises_count = (ps.range(1, 5) == 1) ? ps.range(1, 2) : 0;
|
u32 bruises_count = (ps.range(1, 4) == 1) ? ps.range(1, 2) : 0;
|
||||||
for (u32 i = 0; i < bruises_count; i++) {
|
for (u32 i = 0; i < bruises_count; i++) {
|
||||||
CaveV7 cave(this, &ps);
|
CaveV7 cave(this, &ps);
|
||||||
cave.makeCave(node_min, node_max, max_stone_y);
|
cave.makeCave(node_min, node_max, max_stone_y);
|
||||||
|
Loading…
Reference in New Issue
Block a user