mirror of
https://github.com/minetest/minetest.git
synced 2024-09-12 00:26:50 +02:00
Cavegen, mgv5: Cleanup code
Conf.example: Update mgv5 mapgen params Mgv7: Lava caves only below -256
This commit is contained in:
parent
cd684497c2
commit
eb7482fd73
@ -486,33 +486,14 @@
|
|||||||
# flags = "defaults"
|
# flags = "defaults"
|
||||||
#}
|
#}
|
||||||
# Only the group format supports noise flags which are needed for eased noise.
|
# Only the group format supports noise flags which are needed for eased noise.
|
||||||
# Mgv5 uses eased noise for np_cave1, np_cave2, np_ground and np_crumble, so these are shown in
|
# Mgv5 uses eased noise for np_ground so this is shown in group format,
|
||||||
# group format, other noise parameters are shown in positional format to save space.
|
# other noise parameters are shown in positional format to save space.
|
||||||
|
|
||||||
#mgv5_spflags = blobs
|
|
||||||
#mgv5_np_filler_depth = 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0
|
#mgv5_np_filler_depth = 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0
|
||||||
#mgv5_np_factor = 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0
|
#mgv5_np_factor = 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0
|
||||||
#mgv5_np_height = 0, 10, (250, 250, 250), 84174, 4, 0.5, 2.0
|
#mgv5_np_height = 0, 10, (250, 250, 250), 84174, 4, 0.5, 2.0
|
||||||
#mgv5_np_cave1 = {
|
#mgv5_np_cave1 = 0, 12, (50, 50, 50), 52534, 4, 0.5, 2.0
|
||||||
# offset = 0
|
#mgv5_np_cave2 = 0, 12, (50, 50, 50), 10325, 4, 0.5, 2.0
|
||||||
# scale = 6
|
|
||||||
# spread = (50, 50, 50)
|
|
||||||
# seed = 52534
|
|
||||||
# octaves = 4
|
|
||||||
# persistence = 0.5
|
|
||||||
# lacunarity = 2.0
|
|
||||||
# flags = "eased"
|
|
||||||
#}
|
|
||||||
#mgv5_np_cave2 = {
|
|
||||||
# offset = 0
|
|
||||||
# scale = 6
|
|
||||||
# spread = (50, 50, 50)
|
|
||||||
# seed = 10325
|
|
||||||
# octaves = 4
|
|
||||||
# persistence = 0.5
|
|
||||||
# lacunarity = 2.0
|
|
||||||
# flags = "eased"
|
|
||||||
#}
|
|
||||||
#mgv5_np_ground = {
|
#mgv5_np_ground = {
|
||||||
# offset = 0
|
# offset = 0
|
||||||
# scale = 40
|
# scale = 40
|
||||||
@ -523,17 +504,6 @@
|
|||||||
# lacunarity = 2.0
|
# lacunarity = 2.0
|
||||||
# flags = "eased"
|
# flags = "eased"
|
||||||
#}
|
#}
|
||||||
#mgv5_np_crumble = {
|
|
||||||
# offset = 0
|
|
||||||
# scale = 1
|
|
||||||
# spread = (20, 20, 20)
|
|
||||||
# seed = 34413
|
|
||||||
# octaves = 3
|
|
||||||
# persistence = 1.3
|
|
||||||
# lacunarity = 2.0
|
|
||||||
# flags = "eased"
|
|
||||||
#}
|
|
||||||
#mgv5_np_wetness = 0, 1, (40, 40, 40), 32474, 4, 1.1, 2.0
|
|
||||||
|
|
||||||
#mgv6_spflags = biomeblend, jungles, mudflow
|
#mgv6_spflags = biomeblend, jungles, mudflow
|
||||||
#mgv6_np_terrain_base = -4, 20, (250, 250, 250), 82341, 5, 0.6, 2.0
|
#mgv6_np_terrain_base = -4, 20, (250, 250, 250), 82341, 5, 0.6, 2.0
|
||||||
|
1138
src/cavegen.cpp
1138
src/cavegen.cpp
File diff suppressed because it is too large
Load Diff
@ -129,7 +129,6 @@ public:
|
|||||||
int dswitchint;
|
int dswitchint;
|
||||||
int part_max_length_rs;
|
int part_max_length_rs;
|
||||||
|
|
||||||
bool large_cave;
|
|
||||||
bool large_cave_is_flat;
|
bool large_cave_is_flat;
|
||||||
bool flooded;
|
bool flooded;
|
||||||
|
|
||||||
@ -155,7 +154,7 @@ public:
|
|||||||
int water_level;
|
int water_level;
|
||||||
|
|
||||||
CaveV7() {}
|
CaveV7() {}
|
||||||
CaveV7(MapgenV7 *mg, PseudoRandom *ps, bool large_cave);
|
CaveV7(MapgenV7 *mg, PseudoRandom *ps);
|
||||||
void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height);
|
void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height);
|
||||||
void makeTunnel(bool dirswitch);
|
void makeTunnel(bool dirswitch);
|
||||||
void carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine);
|
void carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine);
|
||||||
|
@ -171,9 +171,9 @@ int MapgenV5::getGroundLevelAtPoint(v2s16 p)
|
|||||||
//TimeTaker t("getGroundLevelAtPoint", NULL, PRECISION_MICRO);
|
//TimeTaker t("getGroundLevelAtPoint", NULL, PRECISION_MICRO);
|
||||||
|
|
||||||
float f = 0.55 + NoisePerlin2D(&noise_factor->np, p.X, p.Y, seed);
|
float f = 0.55 + NoisePerlin2D(&noise_factor->np, p.X, p.Y, seed);
|
||||||
if(f < 0.01)
|
if (f < 0.01)
|
||||||
f = 0.01;
|
f = 0.01;
|
||||||
else if(f >= 1.0)
|
else if (f >= 1.0)
|
||||||
f *= 1.6;
|
f *= 1.6;
|
||||||
float h = water_level + NoisePerlin2D(&noise_height->np, p.X, p.Y, seed);
|
float h = water_level + NoisePerlin2D(&noise_height->np, p.X, p.Y, seed);
|
||||||
|
|
||||||
@ -183,8 +183,8 @@ int MapgenV5::getGroundLevelAtPoint(v2s16 p)
|
|||||||
s16 level = -31000;
|
s16 level = -31000;
|
||||||
for (s16 y = search_top; y >= search_base; y--) {
|
for (s16 y = search_top; y >= search_base; y--) {
|
||||||
float n_ground = NoisePerlin3D(&noise_ground->np, p.X, y, p.Y, seed);
|
float n_ground = NoisePerlin3D(&noise_ground->np, p.X, y, p.Y, seed);
|
||||||
if(n_ground * f > y - h) {
|
if (n_ground * f > y - h) {
|
||||||
if(y >= search_top - 7)
|
if (y >= search_top - 7)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
level = y;
|
level = y;
|
||||||
@ -322,22 +322,22 @@ int MapgenV5::generateBaseTerrain()
|
|||||||
u32 index2d = 0;
|
u32 index2d = 0;
|
||||||
int stone_surface_max_y = -MAP_GENERATION_LIMIT;
|
int stone_surface_max_y = -MAP_GENERATION_LIMIT;
|
||||||
|
|
||||||
for(s16 z=node_min.Z; z<=node_max.Z; z++) {
|
for (s16 z=node_min.Z; z<=node_max.Z; z++) {
|
||||||
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++) {
|
||||||
if(vm->m_data[i].getContent() != CONTENT_IGNORE)
|
if (vm->m_data[i].getContent() != CONTENT_IGNORE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float f = 0.55 + noise_factor->result[index2d];
|
float f = 0.55 + noise_factor->result[index2d];
|
||||||
if(f < 0.01)
|
if (f < 0.01)
|
||||||
f = 0.01;
|
f = 0.01;
|
||||||
else if(f >= 1.0)
|
else if (f >= 1.0)
|
||||||
f *= 1.6;
|
f *= 1.6;
|
||||||
float h = noise_height->result[index2d];
|
float h = noise_height->result[index2d];
|
||||||
|
|
||||||
if(noise_ground->result[index] * f < y - h) {
|
if (noise_ground->result[index] * f < y - h) {
|
||||||
if(y <= water_level)
|
if (y <= water_level)
|
||||||
vm->m_data[i] = MapNode(c_water_source);
|
vm->m_data[i] = MapNode(c_water_source);
|
||||||
else
|
else
|
||||||
vm->m_data[i] = MapNode(CONTENT_AIR);
|
vm->m_data[i] = MapNode(CONTENT_AIR);
|
||||||
@ -443,13 +443,13 @@ void MapgenV5::generateCaves(int max_stone_y)
|
|||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
u32 index2d = 0;
|
u32 index2d = 0;
|
||||||
|
|
||||||
for(s16 z=node_min.Z; z<=node_max.Z; z++) {
|
for (s16 z=node_min.Z; z<=node_max.Z; z++) {
|
||||||
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->get(biomemap[index2d]);
|
Biome *biome = (Biome *)bmgr->get(biomemap[index2d]);
|
||||||
content_t c = vm->m_data[i].getContent();
|
content_t c = vm->m_data[i].getContent();
|
||||||
if(c == CONTENT_AIR
|
if (c == CONTENT_AIR
|
||||||
|| (y <= water_level
|
|| (y <= water_level
|
||||||
&& c != biome->c_stone
|
&& c != biome->c_stone
|
||||||
&& c != c_stone))
|
&& c != c_stone))
|
||||||
@ -457,7 +457,7 @@ void MapgenV5::generateCaves(int max_stone_y)
|
|||||||
|
|
||||||
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)
|
||||||
vm->m_data[i] = MapNode(CONTENT_AIR);
|
vm->m_data[i] = MapNode(CONTENT_AIR);
|
||||||
}
|
}
|
||||||
index2d = index2d - ystride;
|
index2d = index2d - ystride;
|
||||||
|
@ -790,7 +790,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, 5) == 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, true);
|
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