forked from Mirrorlandia_minetest/minetest
Mapgen: Combine dungeon generation code
This commit is contained in:
parent
0810901766
commit
fd0efb21c3
@ -40,6 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "filesys.h"
|
#include "filesys.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "cavegen.h"
|
#include "cavegen.h"
|
||||||
|
#include "dungeongen.h"
|
||||||
|
|
||||||
FlagDesc flagdesc_mapgen[] = {
|
FlagDesc flagdesc_mapgen[] = {
|
||||||
{"trees", MG_TREES},
|
{"trees", MG_TREES},
|
||||||
@ -414,13 +415,30 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer
|
|||||||
c_sandstone = ndef->getId("mapgen_sandstone");
|
c_sandstone = ndef->getId("mapgen_sandstone");
|
||||||
c_river_water_source = ndef->getId("mapgen_river_water_source");
|
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)
|
if (c_desert_stone == CONTENT_IGNORE)
|
||||||
c_desert_stone = c_stone;
|
c_desert_stone = c_stone;
|
||||||
if (c_sandstone == CONTENT_IGNORE)
|
if (c_sandstone == CONTENT_IGNORE)
|
||||||
c_sandstone = c_stone;
|
c_sandstone = c_stone;
|
||||||
if (c_river_water_source == CONTENT_IGNORE)
|
if (c_river_water_source == CONTENT_IGNORE)
|
||||||
c_river_water_source = c_water_source;
|
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
|
//// GenerateNotifier
|
||||||
////
|
////
|
||||||
|
11
src/mapgen.h
11
src/mapgen.h
@ -219,9 +219,10 @@ public:
|
|||||||
MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emerge);
|
MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emerge);
|
||||||
virtual ~MapgenBasic();
|
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 MgStoneType generateBiomes();
|
||||||
virtual void dustTopNodes();
|
virtual void dustTopNodes();
|
||||||
virtual void generateCaves(s16 max_stone_y, s16 large_cave_depth);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EmergeManager *m_emerge;
|
EmergeManager *m_emerge;
|
||||||
@ -234,12 +235,20 @@ protected:
|
|||||||
v3s16 full_node_min;
|
v3s16 full_node_min;
|
||||||
v3s16 full_node_max;
|
v3s16 full_node_max;
|
||||||
|
|
||||||
|
// Content required for generateBiomes
|
||||||
content_t c_stone;
|
content_t c_stone;
|
||||||
content_t c_water_source;
|
content_t c_water_source;
|
||||||
content_t c_river_water_source;
|
content_t c_river_water_source;
|
||||||
content_t c_desert_stone;
|
content_t c_desert_stone;
|
||||||
content_t c_sandstone;
|
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 ystride;
|
||||||
int zstride;
|
int zstride;
|
||||||
int zstride_1d;
|
int zstride_1d;
|
||||||
|
@ -69,23 +69,6 @@ MapgenFlat::MapgenFlat(int mapgenid, MapgenParams *params, EmergeManager *emerge
|
|||||||
|
|
||||||
MapgenBasic::np_cave1 = sp->np_cave1;
|
MapgenBasic::np_cave1 = sp->np_cave1;
|
||||||
MapgenBasic::np_cave2 = sp->np_cave2;
|
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)
|
if (flags & MG_CAVES)
|
||||||
generateCaves(stone_surface_max_y, large_cave_depth);
|
generateCaves(stone_surface_max_y, large_cave_depth);
|
||||||
|
|
||||||
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
|
if (flags & MG_DUNGEONS)
|
||||||
DungeonParams dp;
|
generateDungeons(stone_surface_max_y, stone_type);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
if (flags & MG_DECORATIONS)
|
if (flags & MG_DECORATIONS)
|
||||||
|
@ -70,12 +70,6 @@ private:
|
|||||||
float hill_threshold;
|
float hill_threshold;
|
||||||
float hill_steepness;
|
float hill_steepness;
|
||||||
Noise *noise_terrain;
|
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 {
|
struct MapgenFactoryFlat : public MapgenFactory {
|
||||||
|
@ -73,23 +73,6 @@ MapgenFractal::MapgenFractal(int mapgenid, MapgenParams *params, EmergeManager *
|
|||||||
|
|
||||||
this->formula = fractal / 2 + fractal % 2;
|
this->formula = fractal / 2 + fractal % 2;
|
||||||
this->julia = fractal % 2 == 0;
|
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)
|
if (flags & MG_CAVES)
|
||||||
generateCaves(stone_surface_max_y, MGFRACTAL_LARGE_CAVE_DEPTH);
|
generateCaves(stone_surface_max_y, MGFRACTAL_LARGE_CAVE_DEPTH);
|
||||||
|
|
||||||
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
|
if (flags & MG_DUNGEONS)
|
||||||
DungeonParams dp;
|
generateDungeons(stone_surface_max_y, stone_type);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
if (flags & MG_DECORATIONS)
|
if (flags & MG_DECORATIONS)
|
||||||
|
@ -81,12 +81,6 @@ private:
|
|||||||
float julia_z;
|
float julia_z;
|
||||||
float julia_w;
|
float julia_w;
|
||||||
Noise *noise_seabed;
|
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 {
|
struct MapgenFactoryFractal : public MapgenFactory {
|
||||||
|
@ -64,23 +64,6 @@ MapgenV5::MapgenV5(int mapgenid, MapgenParams *params, EmergeManager *emerge)
|
|||||||
|
|
||||||
MapgenBasic::np_cave1 = sp->np_cave1;
|
MapgenBasic::np_cave1 = sp->np_cave1;
|
||||||
MapgenBasic::np_cave2 = sp->np_cave2;
|
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);
|
generateCaves(stone_surface_max_y, MGV5_LARGE_CAVE_DEPTH);
|
||||||
|
|
||||||
// Generate dungeons and desert temples
|
// Generate dungeons and desert temples
|
||||||
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
|
if (flags & MG_DUNGEONS)
|
||||||
DungeonParams dp;
|
generateDungeons(stone_surface_max_y, stone_type);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
if (flags & MG_DECORATIONS)
|
if (flags & MG_DECORATIONS)
|
||||||
|
@ -61,12 +61,6 @@ private:
|
|||||||
Noise *noise_factor;
|
Noise *noise_factor;
|
||||||
Noise *noise_height;
|
Noise *noise_height;
|
||||||
Noise *noise_ground;
|
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,23 +74,6 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge)
|
|||||||
|
|
||||||
MapgenBasic::np_cave1 = sp->np_cave1;
|
MapgenBasic::np_cave1 = sp->np_cave1;
|
||||||
MapgenBasic::np_cave2 = sp->np_cave2;
|
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)
|
if (flags & MG_CAVES)
|
||||||
generateCaves(stone_surface_max_y, water_level);
|
generateCaves(stone_surface_max_y, water_level);
|
||||||
|
|
||||||
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
|
if (flags & MG_DUNGEONS)
|
||||||
DungeonParams dp;
|
generateDungeons(stone_surface_max_y, stone_type);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
if (flags & MG_DECORATIONS)
|
if (flags & MG_DECORATIONS)
|
||||||
|
@ -78,12 +78,6 @@ private:
|
|||||||
Noise *noise_ridge_uwater;
|
Noise *noise_ridge_uwater;
|
||||||
Noise *noise_mountain;
|
Noise *noise_mountain;
|
||||||
Noise *noise_ridge;
|
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 {
|
struct MapgenFactoryV7 : public MapgenFactory {
|
||||||
|
@ -113,25 +113,12 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager *
|
|||||||
tcave_cache = new float[csize.Y + 2];
|
tcave_cache = new float[csize.Y + 2];
|
||||||
|
|
||||||
// Resolve content to be used
|
// Resolve content to be used
|
||||||
c_cobble = ndef->getId("mapgen_cobble");
|
|
||||||
c_lava_source = ndef->getId("mapgen_lava_source");
|
c_lava_source = ndef->getId("mapgen_lava_source");
|
||||||
c_mossycobble = ndef->getId("mapgen_mossycobble");
|
|
||||||
c_sand = ndef->getId("mapgen_sand");
|
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");
|
|
||||||
|
|
||||||
// Fall back to more basic content if not defined
|
// Fall back to more basic content if not defined
|
||||||
if (c_mossycobble == CONTENT_IGNORE)
|
|
||||||
c_mossycobble = c_cobble;
|
|
||||||
if (c_sand == CONTENT_IGNORE)
|
if (c_sand == CONTENT_IGNORE)
|
||||||
c_sand = c_stone;
|
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);
|
generateCaves(stone_surface_max_y, large_cave_depth);
|
||||||
|
|
||||||
// Dungeon creation
|
// Dungeon creation
|
||||||
if ((flags & MG_DUNGEONS) && node_max.Y < 50 && (stone_surface_max_y >= node_min.Y)) {
|
if ((flags & MG_DUNGEONS) && node_max.Y < 50)
|
||||||
DungeonParams dp;
|
generateDungeons(stone_surface_max_y, stone_type);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
if (flags & MG_DECORATIONS)
|
if (flags & MG_DECORATIONS)
|
||||||
|
@ -124,13 +124,8 @@ private:
|
|||||||
Noise *noise_valley_depth;
|
Noise *noise_valley_depth;
|
||||||
Noise *noise_valley_profile;
|
Noise *noise_valley_profile;
|
||||||
|
|
||||||
content_t c_cobble;
|
|
||||||
content_t c_lava_source;
|
content_t c_lava_source;
|
||||||
content_t c_mossycobble;
|
|
||||||
content_t c_sand;
|
content_t c_sand;
|
||||||
content_t c_sandstonebrick;
|
|
||||||
content_t c_stair_cobble;
|
|
||||||
content_t c_stair_sandstonebrick;
|
|
||||||
|
|
||||||
float terrainLevelAtPoint(s16 x, s16 z);
|
float terrainLevelAtPoint(s16 x, s16 z);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user