From 859141a0ce38fbd606d95ae7a2f0999acf2fbe84 Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 12 Mar 2017 13:26:09 +0000 Subject: Cavegen/Mgv5/Mgv7: Add optional giant caverns Add to MapgenBasic for use by multiple mapgens. Add to mgv5 and mgv7, enabled by default. Similar to mgvalleys caverns but half the scale. Parameters for upper y limit, distance caverns taper to full size, and noise threshold (full cavern size). As with mgvalleys caverns are generated first and classic caves are disabled in any mapchunk containing a cavern, to avoid excessive spreading volumes of liquids. This also avoids floating blobs of liquid where a large classic cave has overgenerated out into a neighbouring previously-generated mapchunk. --- src/mapgen.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index b6e8c0fd1..c63c426fa 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -840,6 +840,18 @@ void MapgenBasic::generateCaves(s16 max_stone_y, s16 large_cave_depth) } +bool MapgenBasic::generateCaverns(s16 max_stone_y) +{ + if (node_min.Y > max_stone_y || node_min.Y > cavern_limit) + return false; + + CavernsNoise caverns_noise(ndef, csize, &np_cavern, + seed, cavern_limit, cavern_taper, cavern_threshold); + + return caverns_noise.generateCaverns(vm, node_min, node_max); +} + + void MapgenBasic::generateDungeons(s16 max_stone_y, MgStoneType stone_type) { if (max_stone_y < node_min.Y) -- cgit v1.2.3