X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fcavegen.cpp;h=bb6aa25a6ede7bf0f4acb93640056211756c4401;hb=8bc6a303b461662b7434a5ee8557292d43682cc9;hp=51309ad609ae0c58e2ed17a03e6e4c0b0a019273;hpb=548d99bb456931192609e8c6fa1eb4c80679af42;p=minetest.git diff --git a/src/cavegen.cpp b/src/cavegen.cpp index 51309ad60..bb6aa25a6 100644 --- a/src/cavegen.cpp +++ b/src/cavegen.cpp @@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mg_biome.h" #include "cavegen.h" -NoiseParams nparams_caveliquids(0, 1, v3f(150.0, 150.0, 150.0), 776, 3, 0.6, 2.0); +static NoiseParams nparams_caveliquids(0, 1, v3f(150.0, 150.0, 150.0), 776, 3, 0.6, 2.0); //// @@ -35,7 +35,7 @@ NoiseParams nparams_caveliquids(0, 1, v3f(150.0, 150.0, 150.0), 776, 3, 0.6, 2.0 CavesNoiseIntersection::CavesNoiseIntersection( INodeDefManager *nodedef, BiomeManager *biomemgr, v3s16 chunksize, - NoiseParams *np_cave1, NoiseParams *np_cave2, int seed, float cave_width) + NoiseParams *np_cave1, NoiseParams *np_cave2, s32 seed, float cave_width) { assert(nodedef); assert(biomemgr); @@ -79,6 +79,7 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm, 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 + bool is_under_river = false; // Is column under river water bool is_tunnel = false; // Is tunnel or tunnel floor u32 vi = vm->m_area.index(x, nmax.Y, z); u32 index3d = (z - nmin.Z) * m_zstride_1d + m_csize.Y * m_ystride + @@ -99,6 +100,10 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm, c == biome->c_water) { column_is_open = true; continue; + } else if (c == biome->c_river_water) { + column_is_open = true; + is_under_river = true; + continue; } // Ground float d1 = contour(noise_cave1->result[index3d]); @@ -111,9 +116,13 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm, } else { // Not in tunnel or not ground content if (is_tunnel && column_is_open && - (c == biome->c_filler || c == biome->c_stone)) + (c == biome->c_filler || c == biome->c_stone)) { // Tunnel entrance floor - vm->m_data[vi] = MapNode(biome->c_top); + if (is_under_river) + vm->m_data[vi] = MapNode(biome->c_riverbed); + else + vm->m_data[vi] = MapNode(biome->c_top); + } column_is_open = false; is_tunnel = false; @@ -130,7 +139,7 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm, CavesRandomWalk::CavesRandomWalk( INodeDefManager *ndef, GenerateNotifier *gennotify, - int seed, + s32 seed, int water_level, content_t water_source, content_t lava_source)