aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2016-05-22 16:27:31 -0400
committerkwolekr <kwolekr@minetest.net>2016-05-27 23:23:58 -0400
commitfd0efb21c3d40a963a813d73a09bb80df625b247 (patch)
treeda5d49dfb93dd854b93a325a264e896482549e78 /src
parent081090176666e849d01f9a02b15279bdf72570bc (diff)
downloadminetest-fd0efb21c3d40a963a813d73a09bb80df625b247.tar.gz
minetest-fd0efb21c3d40a963a813d73a09bb80df625b247.tar.bz2
minetest-fd0efb21c3d40a963a813d73a09bb80df625b247.zip
Mapgen: Combine dungeon generation code
Diffstat (limited to 'src')
-rw-r--r--src/mapgen.cpp73
-rw-r--r--src/mapgen.h11
-rw-r--r--src/mapgen_flat.cpp61
-rw-r--r--src/mapgen_flat.h6
-rw-r--r--src/mapgen_fractal.cpp61
-rw-r--r--src/mapgen_fractal.h6
-rw-r--r--src/mapgen_v5.cpp61
-rw-r--r--src/mapgen_v5.h6
-rw-r--r--src/mapgen_v7.cpp61
-rw-r--r--src/mapgen_v7.h6
-rw-r--r--src/mapgen_valleys.cpp61
-rw-r--r--src/mapgen_valleys.h5
12 files changed, 94 insertions, 324 deletions
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index a2d207bff..56fe34e16 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -40,6 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h"
#include "log.h"
#include "cavegen.h"
+#include "dungeongen.h"
FlagDesc flagdesc_mapgen[] = {
{"trees", MG_TREES},
@@ -414,13 +415,30 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer
c_sandstone = ndef->getId("mapgen_sandstone");
c_river_water_source = ndef->getId("mapgen_river_water_source");
- //// Fall back to more basic content if not defined
+ // Fall back to more basic content if not defined
if (c_desert_stone == CONTENT_IGNORE)
c_desert_stone = c_stone;
if (c_sandstone == CONTENT_IGNORE)
c_sandstone = c_stone;
if (c_river_water_source == CONTENT_IGNORE)
c_river_water_source = c_water_source;
+
+ //// Content used for dungeon generation
+ c_cobble = ndef->getId("mapgen_cobble");
+ c_stair_cobble = ndef->getId("mapgen_stair_cobble");
+ c_mossycobble = ndef->getId("mapgen_mossycobble");
+ c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
+ c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
+
+ // Fall back to more basic content if not defined
+ if (c_mossycobble == CONTENT_IGNORE)
+ c_mossycobble = c_cobble;
+ if (c_stair_cobble == CONTENT_IGNORE)
+ c_stair_cobble = c_cobble;
+ if (c_sandstonebrick == CONTENT_IGNORE)
+ c_sandstonebrick = c_sandstone;
+ if (c_stair_sandstonebrick == CONTENT_IGNORE)
+ c_stair_sandstonebrick = c_sandstone;
}
@@ -614,6 +632,59 @@ void MapgenBasic::generateCaves(s16 max_stone_y, s16 large_cave_depth)
}
+void MapgenBasic::generateDungeons(s16 max_stone_y, MgStoneType stone_type)
+{
+ if (max_stone_y < node_min.Y)
+ return;
+
+ DungeonParams dp;
+
+ dp.np_rarity = nparams_dungeon_rarity;
+ dp.np_density = nparams_dungeon_density;
+ dp.np_wetness = nparams_dungeon_wetness;
+ dp.c_water = c_water_source;
+ switch (stone_type) {
+ default:
+ case MGSTONE_STONE:
+ dp.c_cobble = c_cobble;
+ dp.c_moss = c_mossycobble;
+ dp.c_stair = c_stair_cobble;
+
+ dp.diagonal_dirs = false;
+ dp.mossratio = 3.0;
+ dp.holesize = v3s16(1, 2, 1);
+ dp.roomsize = v3s16(0, 0, 0);
+ dp.notifytype = GENNOTIFY_DUNGEON;
+ break;
+ case MGSTONE_DESERT_STONE:
+ dp.c_cobble = c_desert_stone;
+ dp.c_moss = c_desert_stone;
+ dp.c_stair = c_desert_stone;
+
+ dp.diagonal_dirs = true;
+ dp.mossratio = 0.0;
+ dp.holesize = v3s16(2, 3, 2);
+ dp.roomsize = v3s16(2, 5, 2);
+ dp.notifytype = GENNOTIFY_TEMPLE;
+ break;
+ case MGSTONE_SANDSTONE:
+ dp.c_cobble = c_sandstonebrick;
+ dp.c_moss = c_sandstonebrick;
+ dp.c_stair = c_sandstonebrick;
+
+ dp.diagonal_dirs = false;
+ dp.mossratio = 0.0;
+ dp.holesize = v3s16(2, 2, 2);
+ dp.roomsize = v3s16(2, 0, 2);
+ dp.notifytype = GENNOTIFY_DUNGEON;
+ break;
+ }
+
+ DungeonGen dgen(this, &dp);
+ dgen.generate(blockseed, full_node_min, full_node_max);
+}
+
+
////
//// GenerateNotifier
////
diff --git a/src/mapgen.h b/src/mapgen.h
index 0b552e508..10595fafc 100644
--- a/src/mapgen.h
+++ b/src/mapgen.h
@@ -219,9 +219,10 @@ public:
MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emerge);
virtual ~MapgenBasic();
+ virtual void generateCaves(s16 max_stone_y, s16 large_cave_depth);
+ virtual void generateDungeons(s16 max_stone_y, MgStoneType stone_type);
virtual MgStoneType generateBiomes();
virtual void dustTopNodes();
- virtual void generateCaves(s16 max_stone_y, s16 large_cave_depth);
protected:
EmergeManager *m_emerge;
@@ -234,12 +235,20 @@ protected:
v3s16 full_node_min;
v3s16 full_node_max;
+ // Content required for generateBiomes
content_t c_stone;
content_t c_water_source;
content_t c_river_water_source;
content_t c_desert_stone;
content_t c_sandstone;
+ // Content required for generateDungeons
+ content_t c_cobble;
+ content_t c_stair_cobble;
+ content_t c_mossycobble;
+ content_t c_sandstonebrick;
+ content_t c_stair_sandstonebrick;
+
int ystride;
int zstride;
int zstride_1d;
diff --git a/src/mapgen_flat.cpp b/src/mapgen_flat.cpp
index cc43684c4..724f06825 100644
--- a/src/mapgen_flat.cpp
+++ b/src/mapgen_flat.cpp
@@ -69,23 +69,6 @@ MapgenFlat::MapgenFlat(int mapgenid, MapgenParams *params, EmergeManager *emerge
MapgenBasic::np_cave1 = sp->np_cave1;
MapgenBasic::np_cave2 = sp->np_cave2;
-
- // Content used for dungeon generation
- c_cobble = ndef->getId("mapgen_cobble");
- c_stair_cobble = ndef->getId("mapgen_stair_cobble");
- c_mossycobble = ndef->getId("mapgen_mossycobble");
- c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
- c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
-
- // Fall back to more basic content if not defined
- if (c_mossycobble == CONTENT_IGNORE)
- c_mossycobble = c_cobble;
- if (c_stair_cobble == CONTENT_IGNORE)
- c_stair_cobble = c_cobble;
- if (c_sandstonebrick == CONTENT_IGNORE)
- c_sandstonebrick = c_sandstone;
- if (c_stair_sandstonebrick == CONTENT_IGNORE)
- c_stair_sandstonebrick = c_sandstone;
}
@@ -215,48 +198,8 @@ void MapgenFlat::makeChunk(BlockMakeData *data)
if (flags & MG_CAVES)
generateCaves(stone_surface_max_y, large_cave_depth);
- if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
- DungeonParams dp;
-
- dp.np_rarity = nparams_dungeon_rarity;
- dp.np_density = nparams_dungeon_density;
- dp.np_wetness = nparams_dungeon_wetness;
- dp.c_water = c_water_source;
- if (stone_type == MGSTONE_STONE) {
- dp.c_cobble = c_cobble;
- dp.c_moss = c_mossycobble;
- dp.c_stair = c_stair_cobble;
-
- dp.diagonal_dirs = false;
- dp.mossratio = 3.0;
- dp.holesize = v3s16(1, 2, 1);
- dp.roomsize = v3s16(0, 0, 0);
- dp.notifytype = GENNOTIFY_DUNGEON;
- } else if (stone_type == MGSTONE_DESERT_STONE) {
- dp.c_cobble = c_desert_stone;
- dp.c_moss = c_desert_stone;
- dp.c_stair = c_desert_stone;
-
- dp.diagonal_dirs = true;
- dp.mossratio = 0.0;
- dp.holesize = v3s16(2, 3, 2);
- dp.roomsize = v3s16(2, 5, 2);
- dp.notifytype = GENNOTIFY_TEMPLE;
- } else if (stone_type == MGSTONE_SANDSTONE) {
- dp.c_cobble = c_sandstonebrick;
- dp.c_moss = c_sandstonebrick;
- dp.c_stair = c_sandstonebrick;
-
- dp.diagonal_dirs = false;
- dp.mossratio = 0.0;
- dp.holesize = v3s16(2, 2, 2);
- dp.roomsize = v3s16(2, 0, 2);
- dp.notifytype = GENNOTIFY_DUNGEON;
- }
-
- DungeonGen dgen(this, &dp);
- dgen.generate(blockseed, full_node_min, full_node_max);
- }
+ if (flags & MG_DUNGEONS)
+ generateDungeons(stone_surface_max_y, stone_type);
// Generate the registered decorations
if (flags & MG_DECORATIONS)
diff --git a/src/mapgen_flat.h b/src/mapgen_flat.h
index ffec4b924..afe67b04e 100644
--- a/src/mapgen_flat.h
+++ b/src/mapgen_flat.h
@@ -70,12 +70,6 @@ private:
float hill_threshold;
float hill_steepness;
Noise *noise_terrain;
-
- content_t c_cobble;
- content_t c_stair_cobble;
- content_t c_mossycobble;
- content_t c_sandstonebrick;
- content_t c_stair_sandstonebrick;
};
struct MapgenFactoryFlat : public MapgenFactory {
diff --git a/src/mapgen_fractal.cpp b/src/mapgen_fractal.cpp
index 50e10d128..b613bf358 100644
--- a/src/mapgen_fractal.cpp
+++ b/src/mapgen_fractal.cpp
@@ -73,23 +73,6 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
this->formula = fractal / 2 + fractal % 2;
this->julia = fractal % 2 == 0;
-
- // Content used for dungeon generation
- c_cobble = ndef->getId("mapgen_cobble");
- c_stair_cobble = ndef->getId("mapgen_stair_cobble");
- c_mossycobble = ndef->getId("mapgen_mossycobble");
- c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
- c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
-
- // Fall back to more basic content if not defined
- if (c_mossycobble == CONTENT_IGNORE)
- c_mossycobble = c_cobble;
- if (c_stair_cobble == CONTENT_IGNORE)
- c_stair_cobble = c_cobble;
- if (c_sandstonebrick == CONTENT_IGNORE)
- c_sandstonebrick = c_sandstone;
- if (c_stair_sandstonebrick == CONTENT_IGNORE)
- c_stair_sandstonebrick = c_sandstone;
}
@@ -231,48 +214,8 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
if (flags & MG_CAVES)
generateCaves(stone_surface_max_y, MGFRACTAL_LARGE_CAVE_DEPTH);
- if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
- DungeonParams dp;
-
- dp.np_rarity = nparams_dungeon_rarity;
- dp.np_density = nparams_dungeon_density;
- dp.np_wetness = nparams_dungeon_wetness;
- dp.c_water = c_water_source;
- if (stone_type == MGSTONE_STONE) {
- dp.c_cobble = c_cobble;
- dp.c_moss = c_mossycobble;
- dp.c_stair = c_stair_cobble;
-
- dp.diagonal_dirs = false;
- dp.mossratio = 3.0;
- dp.holesize = v3s16(1, 2, 1);
- dp.roomsize = v3s16(0, 0, 0);
- dp.notifytype = GENNOTIFY_DUNGEON;
- } else if (stone_type == MGSTONE_DESERT_STONE) {
- dp.c_cobble = c_desert_stone;
- dp.c_moss = c_desert_stone;
- dp.c_stair = c_desert_stone;
-
- dp.diagonal_dirs = true;
- dp.mossratio = 0.0;
- dp.holesize = v3s16(2, 3, 2);
- dp.roomsize = v3s16(2, 5, 2);
- dp.notifytype = GENNOTIFY_TEMPLE;
- } else if (stone_type == MGSTONE_SANDSTONE) {
- dp.c_cobble = c_sandstonebrick;
- dp.c_moss = c_sandstonebrick;
- dp.c_stair = c_sandstonebrick;
-
- dp.diagonal_dirs = false;
- dp.mossratio = 0.0;
- dp.holesize = v3s16(2, 2, 2);
- dp.roomsize = v3s16(2, 0, 2);
- dp.notifytype = GENNOTIFY_DUNGEON;
- }
-
- DungeonGen dgen(this, &dp);
- dgen.generate(blockseed, full_node_min, full_node_max);
- }
+ if (flags & MG_DUNGEONS)
+ generateDungeons(stone_surface_max_y, stone_type);
// Generate the registered decorations
if (flags & MG_DECORATIONS)
diff --git a/src/mapgen_fractal.h b/src/mapgen_fractal.h
index de0ccaa2f..065142b84 100644
--- a/src/mapgen_fractal.h
+++ b/src/mapgen_fractal.h
@@ -81,12 +81,6 @@ private:
float julia_z;
float julia_w;
Noise *noise_seabed;
-
- content_t c_cobble;
- content_t c_stair_cobble;
- content_t c_mossycobble;
- content_t c_sandstonebrick;
- content_t c_stair_sandstonebrick;
};
struct MapgenFactoryFractal : public MapgenFactory {
diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp
index 167a38282..3e10ec2a5 100644
--- a/src/mapgen_v5.cpp
+++ b/src/mapgen_v5.cpp
@@ -64,23 +64,6 @@ MapgenV5::MapgenV5(int mapgenid, MapgenParams *params, EmergeManager *emerge)
MapgenBasic::np_cave1 = sp->np_cave1;
MapgenBasic::np_cave2 = sp->np_cave2;
-
- // Content used for dungeon generation
- c_cobble = ndef->getId("mapgen_cobble");
- c_stair_cobble = ndef->getId("mapgen_stair_cobble");
- c_mossycobble = ndef->getId("mapgen_mossycobble");
- c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
- c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
-
- // Fall back to more basic content if not defined
- if (c_mossycobble == CONTENT_IGNORE)
- c_mossycobble = c_cobble;
- if (c_stair_cobble == CONTENT_IGNORE)
- c_stair_cobble = c_cobble;
- if (c_sandstonebrick == CONTENT_IGNORE)
- c_sandstonebrick = c_sandstone;
- if (c_stair_sandstonebrick == CONTENT_IGNORE)
- c_stair_sandstonebrick = c_sandstone;
}
@@ -215,48 +198,8 @@ void MapgenV5::makeChunk(BlockMakeData *data)
generateCaves(stone_surface_max_y, MGV5_LARGE_CAVE_DEPTH);
// Generate dungeons and desert temples
- if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
- DungeonParams dp;
-
- dp.np_rarity = nparams_dungeon_rarity;
- dp.np_density = nparams_dungeon_density;
- dp.np_wetness = nparams_dungeon_wetness;
- dp.c_water = c_water_source;
- if (stone_type == MGSTONE_STONE) {
- dp.c_cobble = c_cobble;
- dp.c_moss = c_mossycobble;
- dp.c_stair = c_stair_cobble;
-
- dp.diagonal_dirs = false;
- dp.mossratio = 3.0;
- dp.holesize = v3s16(1, 2, 1);
- dp.roomsize = v3s16(0, 0, 0);
- dp.notifytype = GENNOTIFY_DUNGEON;
- } else if (stone_type == MGSTONE_DESERT_STONE) {
- dp.c_cobble = c_desert_stone;
- dp.c_moss = c_desert_stone;
- dp.c_stair = c_desert_stone;
-
- dp.diagonal_dirs = true;
- dp.mossratio = 0.0;
- dp.holesize = v3s16(2, 3, 2);
- dp.roomsize = v3s16(2, 5, 2);
- dp.notifytype = GENNOTIFY_TEMPLE;
- } else if (stone_type == MGSTONE_SANDSTONE) {
- dp.c_cobble = c_sandstonebrick;
- dp.c_moss = c_sandstonebrick;
- dp.c_stair = c_sandstonebrick;
-
- dp.diagonal_dirs = false;
- dp.mossratio = 0.0;
- dp.holesize = v3s16(2, 2, 2);
- dp.roomsize = v3s16(2, 0, 2);
- dp.notifytype = GENNOTIFY_DUNGEON;
- }
-
- DungeonGen dgen(this, &dp);
- dgen.generate(blockseed, full_node_min, full_node_max);
- }
+ if (flags & MG_DUNGEONS)
+ generateDungeons(stone_surface_max_y, stone_type);
// Generate the registered decorations
if (flags & MG_DECORATIONS)
diff --git a/src/mapgen_v5.h b/src/mapgen_v5.h
index e7e5b2327..4e1772a64 100644
--- a/src/mapgen_v5.h
+++ b/src/mapgen_v5.h
@@ -61,12 +61,6 @@ private:
Noise *noise_factor;
Noise *noise_height;
Noise *noise_ground;
-
- content_t c_cobble;
- content_t c_stair_cobble;
- content_t c_mossycobble;
- content_t c_sandstonebrick;
- content_t c_stair_sandstonebrick;
};
diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp
index 29c81e8a7..9ff2fbe66 100644
--- a/src/mapgen_v7.cpp
+++ b/src/mapgen_v7.cpp
@@ -74,23 +74,6 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge)
MapgenBasic::np_cave1 = sp->np_cave1;
MapgenBasic::np_cave2 = sp->np_cave2;
-
- // Content used for dungeon generation
- c_cobble = ndef->getId("mapgen_cobble");
- c_stair_cobble = ndef->getId("mapgen_stair_cobble");
- c_mossycobble = ndef->getId("mapgen_mossycobble");
- c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
- c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
-
- // Fall back to more basic content if not defined
- if (c_mossycobble == CONTENT_IGNORE)
- c_mossycobble = c_cobble;
- if (c_stair_cobble == CONTENT_IGNORE)
- c_stair_cobble = c_cobble;
- if (c_sandstonebrick == CONTENT_IGNORE)
- c_sandstonebrick = c_sandstone;
- if (c_stair_sandstonebrick == CONTENT_IGNORE)
- c_stair_sandstonebrick = c_sandstone;
}
@@ -240,48 +223,8 @@ void MapgenV7::makeChunk(BlockMakeData *data)
if (flags & MG_CAVES)
generateCaves(stone_surface_max_y, water_level);
- if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
- DungeonParams dp;
-
- dp.np_rarity = nparams_dungeon_rarity;
- dp.np_density = nparams_dungeon_density;
- dp.np_wetness = nparams_dungeon_wetness;
- dp.c_water = c_water_source;
- if (stone_type == MGSTONE_STONE) {
- dp.c_cobble = c_cobble;
- dp.c_moss = c_mossycobble;
- dp.c_stair = c_stair_cobble;
-
- dp.diagonal_dirs = false;
- dp.mossratio = 3.0;
- dp.holesize = v3s16(1, 2, 1);
- dp.roomsize = v3s16(0, 0, 0);
- dp.notifytype = GENNOTIFY_DUNGEON;
- } else if (stone_type == MGSTONE_DESERT_STONE) {
- dp.c_cobble = c_desert_stone;
- dp.c_moss = c_desert_stone;
- dp.c_stair = c_desert_stone;
-
- dp.diagonal_dirs = true;
- dp.mossratio = 0.0;
- dp.holesize = v3s16(2, 3, 2);
- dp.roomsize = v3s16(2, 5, 2);
- dp.notifytype = GENNOTIFY_TEMPLE;
- } else if (stone_type == MGSTONE_SANDSTONE) {
- dp.c_cobble = c_sandstonebrick;
- dp.c_moss = c_sandstonebrick;
- dp.c_stair = c_sandstonebrick;
-
- dp.diagonal_dirs = false;
- dp.mossratio = 0.0;
- dp.holesize = v3s16(2, 2, 2);
- dp.roomsize = v3s16(2, 0, 2);
- dp.notifytype = GENNOTIFY_DUNGEON;
- }
-
- DungeonGen dgen(this, &dp);
- dgen.generate(blockseed, full_node_min, full_node_max);
- }
+ if (flags & MG_DUNGEONS)
+ generateDungeons(stone_surface_max_y, stone_type);
// Generate the registered decorations
if (flags & MG_DECORATIONS)
diff --git a/src/mapgen_v7.h b/src/mapgen_v7.h
index aee171b48..9ed89a511 100644
--- a/src/mapgen_v7.h
+++ b/src/mapgen_v7.h
@@ -78,12 +78,6 @@ private:
Noise *noise_ridge_uwater;
Noise *noise_mountain;
Noise *noise_ridge;
-
- content_t c_cobble;
- content_t c_stair_cobble;
- content_t c_mossycobble;
- content_t c_sandstonebrick;
- content_t c_stair_sandstonebrick;
};
struct MapgenFactoryV7 : public MapgenFactory {
diff --git a/src/mapgen_valleys.cpp b/src/mapgen_valleys.cpp
index c0094eb3b..2cd733d36 100644
--- a/src/mapgen_valleys.cpp
+++ b/src/mapgen_valleys.cpp
@@ -113,25 +113,12 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager *
tcave_cache = new float[csize.Y + 2];
// Resolve content to be used
- c_cobble = ndef->getId("mapgen_cobble");
- c_lava_source = ndef->getId("mapgen_lava_source");
- c_mossycobble = ndef->getId("mapgen_mossycobble");
- c_sand = ndef->getId("mapgen_sand");
- c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
- c_stair_cobble = ndef->getId("mapgen_stair_cobble");
- c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
+ c_lava_source = ndef->getId("mapgen_lava_source");
+ c_sand = ndef->getId("mapgen_sand");
// Fall back to more basic content if not defined
- if (c_mossycobble == CONTENT_IGNORE)
- c_mossycobble = c_cobble;
if (c_sand == CONTENT_IGNORE)
c_sand = c_stone;
- if (c_sandstonebrick == CONTENT_IGNORE)
- c_sandstonebrick = c_sandstone;
- if (c_stair_cobble == CONTENT_IGNORE)
- c_stair_cobble = c_cobble;
- if (c_stair_sandstonebrick == CONTENT_IGNORE)
- c_stair_sandstonebrick = c_sandstone;
}
@@ -279,48 +266,8 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
generateCaves(stone_surface_max_y, large_cave_depth);
// Dungeon creation
- if ((flags & MG_DUNGEONS) && node_max.Y < 50 && (stone_surface_max_y >= node_min.Y)) {
- DungeonParams dp;
-
- dp.np_rarity = nparams_dungeon_rarity;
- dp.np_density = nparams_dungeon_density;
- dp.np_wetness = nparams_dungeon_wetness;
- dp.c_water = c_water_source;
- if (stone_type == MGSTONE_STONE) {
- dp.c_cobble = c_cobble;
- dp.c_moss = c_mossycobble;
- dp.c_stair = c_stair_cobble;
-
- dp.diagonal_dirs = false;
- dp.mossratio = 3.f;
- dp.holesize = v3s16(1, 2, 1);
- dp.roomsize = v3s16(0, 0, 0);
- dp.notifytype = GENNOTIFY_DUNGEON;
- } else if (stone_type == MGSTONE_DESERT_STONE) {
- dp.c_cobble = c_desert_stone;
- dp.c_moss = c_desert_stone;
- dp.c_stair = c_desert_stone;
-
- dp.diagonal_dirs = true;
- dp.mossratio = 0.f;
- dp.holesize = v3s16(2, 3, 2);
- dp.roomsize = v3s16(2, 5, 2);
- dp.notifytype = GENNOTIFY_TEMPLE;
- } else if (stone_type == MGSTONE_SANDSTONE) {
- dp.c_cobble = c_sandstonebrick;
- dp.c_moss = c_sandstonebrick;
- dp.c_stair = c_sandstonebrick;
-
- dp.diagonal_dirs = false;
- dp.mossratio = 0.f;
- dp.holesize = v3s16(2, 2, 2);
- dp.roomsize = v3s16(2, 0, 2);
- dp.notifytype = GENNOTIFY_DUNGEON;
- }
-
- DungeonGen dgen(this, &dp);
- dgen.generate(blockseed, full_node_min, full_node_max);
- }
+ if ((flags & MG_DUNGEONS) && node_max.Y < 50)
+ generateDungeons(stone_surface_max_y, stone_type);
// Generate the registered decorations
if (flags & MG_DECORATIONS)
diff --git a/src/mapgen_valleys.h b/src/mapgen_valleys.h
index bab3a756e..a7369ea92 100644
--- a/src/mapgen_valleys.h
+++ b/src/mapgen_valleys.h
@@ -124,13 +124,8 @@ private:
Noise *noise_valley_depth;
Noise *noise_valley_profile;
- content_t c_cobble;
content_t c_lava_source;
- content_t c_mossycobble;
content_t c_sand;
- content_t c_sandstonebrick;
- content_t c_stair_cobble;
- content_t c_stair_sandstonebrick;
float terrainLevelAtPoint(s16 x, s16 z);