Skip to content

Commit fd0efb2

Browse files
committedMay 28, 2016
Mapgen: Combine dungeon generation code
1 parent 0810901 commit fd0efb2

12 files changed

+94
-324
lines changed
 

Diff for: ‎src/mapgen.cpp

+72-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
4040
#include "filesys.h"
4141
#include "log.h"
4242
#include "cavegen.h"
43+
#include "dungeongen.h"
4344

4445
FlagDesc flagdesc_mapgen[] = {
4546
{"trees", MG_TREES},
@@ -414,13 +415,30 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer
414415
c_sandstone = ndef->getId("mapgen_sandstone");
415416
c_river_water_source = ndef->getId("mapgen_river_water_source");
416417

417-
//// Fall back to more basic content if not defined
418+
// Fall back to more basic content if not defined
418419
if (c_desert_stone == CONTENT_IGNORE)
419420
c_desert_stone = c_stone;
420421
if (c_sandstone == CONTENT_IGNORE)
421422
c_sandstone = c_stone;
422423
if (c_river_water_source == CONTENT_IGNORE)
423424
c_river_water_source = c_water_source;
425+
426+
//// Content used for dungeon generation
427+
c_cobble = ndef->getId("mapgen_cobble");
428+
c_stair_cobble = ndef->getId("mapgen_stair_cobble");
429+
c_mossycobble = ndef->getId("mapgen_mossycobble");
430+
c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
431+
c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
432+
433+
// Fall back to more basic content if not defined
434+
if (c_mossycobble == CONTENT_IGNORE)
435+
c_mossycobble = c_cobble;
436+
if (c_stair_cobble == CONTENT_IGNORE)
437+
c_stair_cobble = c_cobble;
438+
if (c_sandstonebrick == CONTENT_IGNORE)
439+
c_sandstonebrick = c_sandstone;
440+
if (c_stair_sandstonebrick == CONTENT_IGNORE)
441+
c_stair_sandstonebrick = c_sandstone;
424442
}
425443

426444

@@ -614,6 +632,59 @@ void MapgenBasic::generateCaves(s16 max_stone_y, s16 large_cave_depth)
614632
}
615633

616634

635+
void MapgenBasic::generateDungeons(s16 max_stone_y, MgStoneType stone_type)
636+
{
637+
if (max_stone_y < node_min.Y)
638+
return;
639+
640+
DungeonParams dp;
641+
642+
dp.np_rarity = nparams_dungeon_rarity;
643+
dp.np_density = nparams_dungeon_density;
644+
dp.np_wetness = nparams_dungeon_wetness;
645+
dp.c_water = c_water_source;
646+
switch (stone_type) {
647+
default:
648+
case MGSTONE_STONE:
649+
dp.c_cobble = c_cobble;
650+
dp.c_moss = c_mossycobble;
651+
dp.c_stair = c_stair_cobble;
652+
653+
dp.diagonal_dirs = false;
654+
dp.mossratio = 3.0;
655+
dp.holesize = v3s16(1, 2, 1);
656+
dp.roomsize = v3s16(0, 0, 0);
657+
dp.notifytype = GENNOTIFY_DUNGEON;
658+
break;
659+
case MGSTONE_DESERT_STONE:
660+
dp.c_cobble = c_desert_stone;
661+
dp.c_moss = c_desert_stone;
662+
dp.c_stair = c_desert_stone;
663+
664+
dp.diagonal_dirs = true;
665+
dp.mossratio = 0.0;
666+
dp.holesize = v3s16(2, 3, 2);
667+
dp.roomsize = v3s16(2, 5, 2);
668+
dp.notifytype = GENNOTIFY_TEMPLE;
669+
break;
670+
case MGSTONE_SANDSTONE:
671+
dp.c_cobble = c_sandstonebrick;
672+
dp.c_moss = c_sandstonebrick;
673+
dp.c_stair = c_sandstonebrick;
674+
675+
dp.diagonal_dirs = false;
676+
dp.mossratio = 0.0;
677+
dp.holesize = v3s16(2, 2, 2);
678+
dp.roomsize = v3s16(2, 0, 2);
679+
dp.notifytype = GENNOTIFY_DUNGEON;
680+
break;
681+
}
682+
683+
DungeonGen dgen(this, &dp);
684+
dgen.generate(blockseed, full_node_min, full_node_max);
685+
}
686+
687+
617688
////
618689
//// GenerateNotifier
619690
////

Diff for: ‎src/mapgen.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,10 @@ class MapgenBasic : public Mapgen {
219219
MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emerge);
220220
virtual ~MapgenBasic();
221221

222+
virtual void generateCaves(s16 max_stone_y, s16 large_cave_depth);
223+
virtual void generateDungeons(s16 max_stone_y, MgStoneType stone_type);
222224
virtual MgStoneType generateBiomes();
223225
virtual void dustTopNodes();
224-
virtual void generateCaves(s16 max_stone_y, s16 large_cave_depth);
225226

226227
protected:
227228
EmergeManager *m_emerge;
@@ -234,12 +235,20 @@ class MapgenBasic : public Mapgen {
234235
v3s16 full_node_min;
235236
v3s16 full_node_max;
236237

238+
// Content required for generateBiomes
237239
content_t c_stone;
238240
content_t c_water_source;
239241
content_t c_river_water_source;
240242
content_t c_desert_stone;
241243
content_t c_sandstone;
242244

245+
// Content required for generateDungeons
246+
content_t c_cobble;
247+
content_t c_stair_cobble;
248+
content_t c_mossycobble;
249+
content_t c_sandstonebrick;
250+
content_t c_stair_sandstonebrick;
251+
243252
int ystride;
244253
int zstride;
245254
int zstride_1d;

Diff for: ‎src/mapgen_flat.cpp

+2-59
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,6 @@ MapgenFlat::MapgenFlat(int mapgenid, MapgenParams *params, EmergeManager *emerge
6969

7070
MapgenBasic::np_cave1 = sp->np_cave1;
7171
MapgenBasic::np_cave2 = sp->np_cave2;
72-
73-
// Content used for dungeon generation
74-
c_cobble = ndef->getId("mapgen_cobble");
75-
c_stair_cobble = ndef->getId("mapgen_stair_cobble");
76-
c_mossycobble = ndef->getId("mapgen_mossycobble");
77-
c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
78-
c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
79-
80-
// Fall back to more basic content if not defined
81-
if (c_mossycobble == CONTENT_IGNORE)
82-
c_mossycobble = c_cobble;
83-
if (c_stair_cobble == CONTENT_IGNORE)
84-
c_stair_cobble = c_cobble;
85-
if (c_sandstonebrick == CONTENT_IGNORE)
86-
c_sandstonebrick = c_sandstone;
87-
if (c_stair_sandstonebrick == CONTENT_IGNORE)
88-
c_stair_sandstonebrick = c_sandstone;
8972
}
9073

9174

@@ -215,48 +198,8 @@ void MapgenFlat::makeChunk(BlockMakeData *data)
215198
if (flags & MG_CAVES)
216199
generateCaves(stone_surface_max_y, large_cave_depth);
217200

218-
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
219-
DungeonParams dp;
220-
221-
dp.np_rarity = nparams_dungeon_rarity;
222-
dp.np_density = nparams_dungeon_density;
223-
dp.np_wetness = nparams_dungeon_wetness;
224-
dp.c_water = c_water_source;
225-
if (stone_type == MGSTONE_STONE) {
226-
dp.c_cobble = c_cobble;
227-
dp.c_moss = c_mossycobble;
228-
dp.c_stair = c_stair_cobble;
229-
230-
dp.diagonal_dirs = false;
231-
dp.mossratio = 3.0;
232-
dp.holesize = v3s16(1, 2, 1);
233-
dp.roomsize = v3s16(0, 0, 0);
234-
dp.notifytype = GENNOTIFY_DUNGEON;
235-
} else if (stone_type == MGSTONE_DESERT_STONE) {
236-
dp.c_cobble = c_desert_stone;
237-
dp.c_moss = c_desert_stone;
238-
dp.c_stair = c_desert_stone;
239-
240-
dp.diagonal_dirs = true;
241-
dp.mossratio = 0.0;
242-
dp.holesize = v3s16(2, 3, 2);
243-
dp.roomsize = v3s16(2, 5, 2);
244-
dp.notifytype = GENNOTIFY_TEMPLE;
245-
} else if (stone_type == MGSTONE_SANDSTONE) {
246-
dp.c_cobble = c_sandstonebrick;
247-
dp.c_moss = c_sandstonebrick;
248-
dp.c_stair = c_sandstonebrick;
249-
250-
dp.diagonal_dirs = false;
251-
dp.mossratio = 0.0;
252-
dp.holesize = v3s16(2, 2, 2);
253-
dp.roomsize = v3s16(2, 0, 2);
254-
dp.notifytype = GENNOTIFY_DUNGEON;
255-
}
256-
257-
DungeonGen dgen(this, &dp);
258-
dgen.generate(blockseed, full_node_min, full_node_max);
259-
}
201+
if (flags & MG_DUNGEONS)
202+
generateDungeons(stone_surface_max_y, stone_type);
260203

261204
// Generate the registered decorations
262205
if (flags & MG_DECORATIONS)

Diff for: ‎src/mapgen_flat.h

-6
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ class MapgenFlat : public MapgenBasic {
7070
float hill_threshold;
7171
float hill_steepness;
7272
Noise *noise_terrain;
73-
74-
content_t c_cobble;
75-
content_t c_stair_cobble;
76-
content_t c_mossycobble;
77-
content_t c_sandstonebrick;
78-
content_t c_stair_sandstonebrick;
7973
};
8074

8175
struct MapgenFactoryFlat : public MapgenFactory {

Diff for: ‎src/mapgen_fractal.cpp

+2-59
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,6 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
7373

7474
this->formula = fractal / 2 + fractal % 2;
7575
this->julia = fractal % 2 == 0;
76-
77-
// Content used for dungeon generation
78-
c_cobble = ndef->getId("mapgen_cobble");
79-
c_stair_cobble = ndef->getId("mapgen_stair_cobble");
80-
c_mossycobble = ndef->getId("mapgen_mossycobble");
81-
c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
82-
c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
83-
84-
// Fall back to more basic content if not defined
85-
if (c_mossycobble == CONTENT_IGNORE)
86-
c_mossycobble = c_cobble;
87-
if (c_stair_cobble == CONTENT_IGNORE)
88-
c_stair_cobble = c_cobble;
89-
if (c_sandstonebrick == CONTENT_IGNORE)
90-
c_sandstonebrick = c_sandstone;
91-
if (c_stair_sandstonebrick == CONTENT_IGNORE)
92-
c_stair_sandstonebrick = c_sandstone;
9376
}
9477

9578

@@ -231,48 +214,8 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
231214
if (flags & MG_CAVES)
232215
generateCaves(stone_surface_max_y, MGFRACTAL_LARGE_CAVE_DEPTH);
233216

234-
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
235-
DungeonParams dp;
236-
237-
dp.np_rarity = nparams_dungeon_rarity;
238-
dp.np_density = nparams_dungeon_density;
239-
dp.np_wetness = nparams_dungeon_wetness;
240-
dp.c_water = c_water_source;
241-
if (stone_type == MGSTONE_STONE) {
242-
dp.c_cobble = c_cobble;
243-
dp.c_moss = c_mossycobble;
244-
dp.c_stair = c_stair_cobble;
245-
246-
dp.diagonal_dirs = false;
247-
dp.mossratio = 3.0;
248-
dp.holesize = v3s16(1, 2, 1);
249-
dp.roomsize = v3s16(0, 0, 0);
250-
dp.notifytype = GENNOTIFY_DUNGEON;
251-
} else if (stone_type == MGSTONE_DESERT_STONE) {
252-
dp.c_cobble = c_desert_stone;
253-
dp.c_moss = c_desert_stone;
254-
dp.c_stair = c_desert_stone;
255-
256-
dp.diagonal_dirs = true;
257-
dp.mossratio = 0.0;
258-
dp.holesize = v3s16(2, 3, 2);
259-
dp.roomsize = v3s16(2, 5, 2);
260-
dp.notifytype = GENNOTIFY_TEMPLE;
261-
} else if (stone_type == MGSTONE_SANDSTONE) {
262-
dp.c_cobble = c_sandstonebrick;
263-
dp.c_moss = c_sandstonebrick;
264-
dp.c_stair = c_sandstonebrick;
265-
266-
dp.diagonal_dirs = false;
267-
dp.mossratio = 0.0;
268-
dp.holesize = v3s16(2, 2, 2);
269-
dp.roomsize = v3s16(2, 0, 2);
270-
dp.notifytype = GENNOTIFY_DUNGEON;
271-
}
272-
273-
DungeonGen dgen(this, &dp);
274-
dgen.generate(blockseed, full_node_min, full_node_max);
275-
}
217+
if (flags & MG_DUNGEONS)
218+
generateDungeons(stone_surface_max_y, stone_type);
276219

277220
// Generate the registered decorations
278221
if (flags & MG_DECORATIONS)

Diff for: ‎src/mapgen_fractal.h

-6
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ class MapgenFractal : public MapgenBasic {
8181
float julia_z;
8282
float julia_w;
8383
Noise *noise_seabed;
84-
85-
content_t c_cobble;
86-
content_t c_stair_cobble;
87-
content_t c_mossycobble;
88-
content_t c_sandstonebrick;
89-
content_t c_stair_sandstonebrick;
9084
};
9185

9286
struct MapgenFactoryFractal : public MapgenFactory {

Diff for: ‎src/mapgen_v5.cpp

+2-59
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,6 @@ MapgenV5::MapgenV5(int mapgenid, MapgenParams *params, EmergeManager *emerge)
6464

6565
MapgenBasic::np_cave1 = sp->np_cave1;
6666
MapgenBasic::np_cave2 = sp->np_cave2;
67-
68-
// Content used for dungeon generation
69-
c_cobble = ndef->getId("mapgen_cobble");
70-
c_stair_cobble = ndef->getId("mapgen_stair_cobble");
71-
c_mossycobble = ndef->getId("mapgen_mossycobble");
72-
c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
73-
c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
74-
75-
// Fall back to more basic content if not defined
76-
if (c_mossycobble == CONTENT_IGNORE)
77-
c_mossycobble = c_cobble;
78-
if (c_stair_cobble == CONTENT_IGNORE)
79-
c_stair_cobble = c_cobble;
80-
if (c_sandstonebrick == CONTENT_IGNORE)
81-
c_sandstonebrick = c_sandstone;
82-
if (c_stair_sandstonebrick == CONTENT_IGNORE)
83-
c_stair_sandstonebrick = c_sandstone;
8467
}
8568

8669

@@ -215,48 +198,8 @@ void MapgenV5::makeChunk(BlockMakeData *data)
215198
generateCaves(stone_surface_max_y, MGV5_LARGE_CAVE_DEPTH);
216199

217200
// Generate dungeons and desert temples
218-
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
219-
DungeonParams dp;
220-
221-
dp.np_rarity = nparams_dungeon_rarity;
222-
dp.np_density = nparams_dungeon_density;
223-
dp.np_wetness = nparams_dungeon_wetness;
224-
dp.c_water = c_water_source;
225-
if (stone_type == MGSTONE_STONE) {
226-
dp.c_cobble = c_cobble;
227-
dp.c_moss = c_mossycobble;
228-
dp.c_stair = c_stair_cobble;
229-
230-
dp.diagonal_dirs = false;
231-
dp.mossratio = 3.0;
232-
dp.holesize = v3s16(1, 2, 1);
233-
dp.roomsize = v3s16(0, 0, 0);
234-
dp.notifytype = GENNOTIFY_DUNGEON;
235-
} else if (stone_type == MGSTONE_DESERT_STONE) {
236-
dp.c_cobble = c_desert_stone;
237-
dp.c_moss = c_desert_stone;
238-
dp.c_stair = c_desert_stone;
239-
240-
dp.diagonal_dirs = true;
241-
dp.mossratio = 0.0;
242-
dp.holesize = v3s16(2, 3, 2);
243-
dp.roomsize = v3s16(2, 5, 2);
244-
dp.notifytype = GENNOTIFY_TEMPLE;
245-
} else if (stone_type == MGSTONE_SANDSTONE) {
246-
dp.c_cobble = c_sandstonebrick;
247-
dp.c_moss = c_sandstonebrick;
248-
dp.c_stair = c_sandstonebrick;
249-
250-
dp.diagonal_dirs = false;
251-
dp.mossratio = 0.0;
252-
dp.holesize = v3s16(2, 2, 2);
253-
dp.roomsize = v3s16(2, 0, 2);
254-
dp.notifytype = GENNOTIFY_DUNGEON;
255-
}
256-
257-
DungeonGen dgen(this, &dp);
258-
dgen.generate(blockseed, full_node_min, full_node_max);
259-
}
201+
if (flags & MG_DUNGEONS)
202+
generateDungeons(stone_surface_max_y, stone_type);
260203

261204
// Generate the registered decorations
262205
if (flags & MG_DECORATIONS)

Diff for: ‎src/mapgen_v5.h

-6
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ class MapgenV5 : public MapgenBasic {
6161
Noise *noise_factor;
6262
Noise *noise_height;
6363
Noise *noise_ground;
64-
65-
content_t c_cobble;
66-
content_t c_stair_cobble;
67-
content_t c_mossycobble;
68-
content_t c_sandstonebrick;
69-
content_t c_stair_sandstonebrick;
7064
};
7165

7266

Diff for: ‎src/mapgen_v7.cpp

+2-59
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,6 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge)
7474

7575
MapgenBasic::np_cave1 = sp->np_cave1;
7676
MapgenBasic::np_cave2 = sp->np_cave2;
77-
78-
// Content used for dungeon generation
79-
c_cobble = ndef->getId("mapgen_cobble");
80-
c_stair_cobble = ndef->getId("mapgen_stair_cobble");
81-
c_mossycobble = ndef->getId("mapgen_mossycobble");
82-
c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
83-
c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
84-
85-
// Fall back to more basic content if not defined
86-
if (c_mossycobble == CONTENT_IGNORE)
87-
c_mossycobble = c_cobble;
88-
if (c_stair_cobble == CONTENT_IGNORE)
89-
c_stair_cobble = c_cobble;
90-
if (c_sandstonebrick == CONTENT_IGNORE)
91-
c_sandstonebrick = c_sandstone;
92-
if (c_stair_sandstonebrick == CONTENT_IGNORE)
93-
c_stair_sandstonebrick = c_sandstone;
9477
}
9578

9679

@@ -240,48 +223,8 @@ void MapgenV7::makeChunk(BlockMakeData *data)
240223
if (flags & MG_CAVES)
241224
generateCaves(stone_surface_max_y, water_level);
242225

243-
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
244-
DungeonParams dp;
245-
246-
dp.np_rarity = nparams_dungeon_rarity;
247-
dp.np_density = nparams_dungeon_density;
248-
dp.np_wetness = nparams_dungeon_wetness;
249-
dp.c_water = c_water_source;
250-
if (stone_type == MGSTONE_STONE) {
251-
dp.c_cobble = c_cobble;
252-
dp.c_moss = c_mossycobble;
253-
dp.c_stair = c_stair_cobble;
254-
255-
dp.diagonal_dirs = false;
256-
dp.mossratio = 3.0;
257-
dp.holesize = v3s16(1, 2, 1);
258-
dp.roomsize = v3s16(0, 0, 0);
259-
dp.notifytype = GENNOTIFY_DUNGEON;
260-
} else if (stone_type == MGSTONE_DESERT_STONE) {
261-
dp.c_cobble = c_desert_stone;
262-
dp.c_moss = c_desert_stone;
263-
dp.c_stair = c_desert_stone;
264-
265-
dp.diagonal_dirs = true;
266-
dp.mossratio = 0.0;
267-
dp.holesize = v3s16(2, 3, 2);
268-
dp.roomsize = v3s16(2, 5, 2);
269-
dp.notifytype = GENNOTIFY_TEMPLE;
270-
} else if (stone_type == MGSTONE_SANDSTONE) {
271-
dp.c_cobble = c_sandstonebrick;
272-
dp.c_moss = c_sandstonebrick;
273-
dp.c_stair = c_sandstonebrick;
274-
275-
dp.diagonal_dirs = false;
276-
dp.mossratio = 0.0;
277-
dp.holesize = v3s16(2, 2, 2);
278-
dp.roomsize = v3s16(2, 0, 2);
279-
dp.notifytype = GENNOTIFY_DUNGEON;
280-
}
281-
282-
DungeonGen dgen(this, &dp);
283-
dgen.generate(blockseed, full_node_min, full_node_max);
284-
}
226+
if (flags & MG_DUNGEONS)
227+
generateDungeons(stone_surface_max_y, stone_type);
285228

286229
// Generate the registered decorations
287230
if (flags & MG_DECORATIONS)

Diff for: ‎src/mapgen_v7.h

-6
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ class MapgenV7 : public MapgenBasic {
7878
Noise *noise_ridge_uwater;
7979
Noise *noise_mountain;
8080
Noise *noise_ridge;
81-
82-
content_t c_cobble;
83-
content_t c_stair_cobble;
84-
content_t c_mossycobble;
85-
content_t c_sandstonebrick;
86-
content_t c_stair_sandstonebrick;
8781
};
8882

8983
struct MapgenFactoryV7 : public MapgenFactory {

Diff for: ‎src/mapgen_valleys.cpp

+4-57
Original file line numberDiff line numberDiff line change
@@ -113,25 +113,12 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager *
113113
tcave_cache = new float[csize.Y + 2];
114114

115115
// Resolve content to be used
116-
c_cobble = ndef->getId("mapgen_cobble");
117-
c_lava_source = ndef->getId("mapgen_lava_source");
118-
c_mossycobble = ndef->getId("mapgen_mossycobble");
119-
c_sand = ndef->getId("mapgen_sand");
120-
c_sandstonebrick = ndef->getId("mapgen_sandstonebrick");
121-
c_stair_cobble = ndef->getId("mapgen_stair_cobble");
122-
c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick");
116+
c_lava_source = ndef->getId("mapgen_lava_source");
117+
c_sand = ndef->getId("mapgen_sand");
123118

124119
// Fall back to more basic content if not defined
125-
if (c_mossycobble == CONTENT_IGNORE)
126-
c_mossycobble = c_cobble;
127120
if (c_sand == CONTENT_IGNORE)
128121
c_sand = c_stone;
129-
if (c_sandstonebrick == CONTENT_IGNORE)
130-
c_sandstonebrick = c_sandstone;
131-
if (c_stair_cobble == CONTENT_IGNORE)
132-
c_stair_cobble = c_cobble;
133-
if (c_stair_sandstonebrick == CONTENT_IGNORE)
134-
c_stair_sandstonebrick = c_sandstone;
135122
}
136123

137124

@@ -279,48 +266,8 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
279266
generateCaves(stone_surface_max_y, large_cave_depth);
280267

281268
// Dungeon creation
282-
if ((flags & MG_DUNGEONS) && node_max.Y < 50 && (stone_surface_max_y >= node_min.Y)) {
283-
DungeonParams dp;
284-
285-
dp.np_rarity = nparams_dungeon_rarity;
286-
dp.np_density = nparams_dungeon_density;
287-
dp.np_wetness = nparams_dungeon_wetness;
288-
dp.c_water = c_water_source;
289-
if (stone_type == MGSTONE_STONE) {
290-
dp.c_cobble = c_cobble;
291-
dp.c_moss = c_mossycobble;
292-
dp.c_stair = c_stair_cobble;
293-
294-
dp.diagonal_dirs = false;
295-
dp.mossratio = 3.f;
296-
dp.holesize = v3s16(1, 2, 1);
297-
dp.roomsize = v3s16(0, 0, 0);
298-
dp.notifytype = GENNOTIFY_DUNGEON;
299-
} else if (stone_type == MGSTONE_DESERT_STONE) {
300-
dp.c_cobble = c_desert_stone;
301-
dp.c_moss = c_desert_stone;
302-
dp.c_stair = c_desert_stone;
303-
304-
dp.diagonal_dirs = true;
305-
dp.mossratio = 0.f;
306-
dp.holesize = v3s16(2, 3, 2);
307-
dp.roomsize = v3s16(2, 5, 2);
308-
dp.notifytype = GENNOTIFY_TEMPLE;
309-
} else if (stone_type == MGSTONE_SANDSTONE) {
310-
dp.c_cobble = c_sandstonebrick;
311-
dp.c_moss = c_sandstonebrick;
312-
dp.c_stair = c_sandstonebrick;
313-
314-
dp.diagonal_dirs = false;
315-
dp.mossratio = 0.f;
316-
dp.holesize = v3s16(2, 2, 2);
317-
dp.roomsize = v3s16(2, 0, 2);
318-
dp.notifytype = GENNOTIFY_DUNGEON;
319-
}
320-
321-
DungeonGen dgen(this, &dp);
322-
dgen.generate(blockseed, full_node_min, full_node_max);
323-
}
269+
if ((flags & MG_DUNGEONS) && node_max.Y < 50)
270+
generateDungeons(stone_surface_max_y, stone_type);
324271

325272
// Generate the registered decorations
326273
if (flags & MG_DECORATIONS)

Diff for: ‎src/mapgen_valleys.h

-5
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,8 @@ class MapgenValleys : public MapgenBasic {
124124
Noise *noise_valley_depth;
125125
Noise *noise_valley_profile;
126126

127-
content_t c_cobble;
128127
content_t c_lava_source;
129-
content_t c_mossycobble;
130128
content_t c_sand;
131-
content_t c_sandstonebrick;
132-
content_t c_stair_cobble;
133-
content_t c_stair_sandstonebrick;
134129

135130
float terrainLevelAtPoint(s16 x, s16 z);
136131

0 commit comments

Comments
 (0)
Please sign in to comment.