summaryrefslogtreecommitdiff
path: root/src/mapgen
diff options
context:
space:
mode:
authorParamat <paramat@users.noreply.github.com>2018-04-21 20:35:29 +0100
committerGitHub <noreply@github.com>2018-04-21 20:35:29 +0100
commit5abd0efb903877efc2d6f4af571db400bc6551aa (patch)
tree9617a5029ed3dbed5366e120408994e554abedee /src/mapgen
parentcb92cdf3a4656379cda5569754e748904417687d (diff)
downloadminetest-5abd0efb903877efc2d6f4af571db400bc6551aa.tar.gz
minetest-5abd0efb903877efc2d6f4af571db400bc6551aa.tar.bz2
minetest-5abd0efb903877efc2d6f4af571db400bc6551aa.zip
Cave liquids: Use a more precise point for calculating biome
Use the centre point of the route being carved for a more precise match between cave liquids and biome.
Diffstat (limited to 'src/mapgen')
-rw-r--r--src/mapgen/cavegen.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mapgen/cavegen.cpp b/src/mapgen/cavegen.cpp
index 0b49f653f..e7b98e84f 100644
--- a/src/mapgen/cavegen.cpp
+++ b/src/mapgen/cavegen.cpp
@@ -497,28 +497,29 @@ void CavesRandomWalk::carveRoute(v3f vec, float f, bool randomize_xz)
v3s16 startp(orp.X, orp.Y, orp.Z);
startp += of;
- // Get biome at 'startp', use 'node_cave_liquid' if stated, otherwise
- // fallback to classic behaviour.
+ v3f fp = orp + vec * f;
+ fp.X += 0.1f * ps->range(-10, 10);
+ fp.Z += 0.1f * ps->range(-10, 10);
+ v3s16 cp(fp.X, fp.Y, fp.Z);
+
+ // Get biome at 'cp + of', the absolute centre point of this route
+ v3s16 cpabs = cp + of;
MapNode liquidnode = CONTENT_IGNORE;
if (bmgn) {
- Biome *biome = (Biome *)bmgn->calcBiomeAtPoint(startp);
+ Biome *biome = (Biome *)bmgn->calcBiomeAtPoint(cpabs);
if (biome->c_cave_liquid != CONTENT_IGNORE)
liquidnode = biome->c_cave_liquid;
}
if (liquidnode == CONTENT_IGNORE) {
+ // Fallback to classic behaviour using point 'startp'
float nval = NoisePerlin3D(np_caveliquids, startp.X,
startp.Y, startp.Z, seed);
liquidnode = (nval < 0.40f && node_max.Y < lava_depth) ?
lavanode : waternode;
}
- v3f fp = orp + vec * f;
- fp.X += 0.1f * ps->range(-10, 10);
- fp.Z += 0.1f * ps->range(-10, 10);
- v3s16 cp(fp.X, fp.Y, fp.Z);
-
s16 d0 = -rs / 2;
s16 d1 = d0 + rs;
if (randomize_xz) {