aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2015-03-11 06:48:06 +0000
committerparamat <mat.gregory@virginmedia.com>2015-03-12 02:33:16 +0000
commit6ce0985f47b874839947e3be503c302bec532206 (patch)
tree51c161783301e5995cfdeb45da79060d88043202
parent140245a76f9b73b1f981176ce4a77d45b1edc933 (diff)
downloadminetest-6ce0985f47b874839947e3be503c302bec532206.tar.gz
minetest-6ce0985f47b874839947e3be503c302bec532206.tar.bz2
minetest-6ce0985f47b874839947e3be503c302bec532206.zip
Mgv5/mgv7: Add desert temples if desert stone detected in mapchunk
-rw-r--r--src/mapgen_v5.cpp45
-rw-r--r--src/mapgen_v5.h2
-rw-r--r--src/mapgen_v7.cpp58
-rw-r--r--src/mapgen_v7.h6
4 files changed, 99 insertions, 12 deletions
diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp
index 561b8a410..6adfac55b 100644
--- a/src/mapgen_v5.cpp
+++ b/src/mapgen_v5.cpp
@@ -89,6 +89,7 @@ MapgenV5::MapgenV5(int mapgenid, MapgenParams *params, EmergeManager *emerge)
c_gravel = ndef->getId("mapgen_gravel");
c_cobble = ndef->getId("mapgen_cobble");
c_ice = ndef->getId("default:ice");
+ c_desert_stone = ndef->getId("mapgen_desert_stone");
c_mossycobble = ndef->getId("mapgen_mossycobble");
c_sandbrick = ndef->getId("mapgen_sandstonebrick");
c_stair_cobble = ndef->getId("mapgen_stair_cobble");
@@ -238,7 +239,7 @@ void MapgenV5::makeChunk(BlockMakeData *data)
noise_humidity->result, heightmap, biomemap);
// Actually place the biome-specific nodes
- generateBiomes(noise_heat->result, noise_humidity->result);
+ bool desert_stone = generateBiomes(noise_heat->result, noise_humidity->result);
// Generate caves
if ((flags & MG_CAVES) && (stone_surface_max_y >= node_min.Y))
@@ -246,7 +247,35 @@ void MapgenV5::makeChunk(BlockMakeData *data)
// Generate dungeons and desert temples
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
- DungeonGen dgen(this, NULL);
+ 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 (desert_stone) {
+ dp.c_cobble = c_sandbrick;
+ dp.c_moss = c_sandbrick; // should make this 'cracked sandstone' later
+ dp.c_stair = c_stair_sandstone;
+
+ 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 {
+ 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;
+ }
+
+ DungeonGen dgen(this, &dp);
dgen.generate(blockseed, full_node_min, full_node_max);
}
@@ -357,10 +386,10 @@ int MapgenV5::generateBaseTerrain()
}
-void MapgenV5::generateBiomes(float *heat_map, float *humidity_map)
+bool MapgenV5::generateBiomes(float *heat_map, float *humidity_map)
{
if (node_max.Y < water_level)
- return;
+ return false;
MapNode n_air(CONTENT_AIR);
MapNode n_stone(c_stone);
@@ -368,6 +397,7 @@ void MapgenV5::generateBiomes(float *heat_map, float *humidity_map)
v3s16 em = vm->m_area.getExtent();
u32 index = 0;
+ bool desert_stone = false;
for (s16 z = node_min.Z; z <= node_max.Z; z++)
for (s16 x = node_min.X; x <= node_max.X; x++, index++) {
@@ -392,6 +422,9 @@ void MapgenV5::generateBiomes(float *heat_map, float *humidity_map)
y0_top = biome->depth_top;
y0_filler = biome->depth_top + dfiller;
depth_water_top = biome->depth_water_top;
+
+ if (biome->c_stone == c_desert_stone)
+ desert_stone = true;
}
if (c == c_stone && have_air) {
@@ -424,7 +457,7 @@ void MapgenV5::generateBiomes(float *heat_map, float *humidity_map)
} else if (c == c_water_source) {
have_air = true;
nplaced = 0;
- if(y > water_level - depth_water_top)
+ if (y > water_level - depth_water_top)
vm->m_data[i] = MapNode(biome->c_water_top);
else
vm->m_data[i] = MapNode(biome->c_water);
@@ -436,6 +469,8 @@ void MapgenV5::generateBiomes(float *heat_map, float *humidity_map)
vm->m_area.add_y(em, i, -1);
}
}
+
+ return desert_stone;
}
diff --git a/src/mapgen_v5.h b/src/mapgen_v5.h
index 28bc37f92..8dd52cc9e 100644
--- a/src/mapgen_v5.h
+++ b/src/mapgen_v5.h
@@ -93,7 +93,7 @@ public:
int getGroundLevelAtPoint(v2s16 p);
void calculateNoise();
int generateBaseTerrain();
- void generateBiomes(float *heat_map, float *humidity_map);
+ bool generateBiomes(float *heat_map, float *humidity_map);
void generateCaves(int max_stone_y);
void dustTopNodes();
};
diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp
index 09e6e54c2..65e43decb 100644
--- a/src/mapgen_v7.cpp
+++ b/src/mapgen_v7.cpp
@@ -96,8 +96,22 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge)
c_water_source = ndef->getId("mapgen_water_source");
c_lava_source = ndef->getId("mapgen_lava_source");
c_ice = ndef->getId("default:ice");
+ c_cobble = ndef->getId("mapgen_cobble");
+ c_desert_stone = ndef->getId("mapgen_desert_stone");
+ c_mossycobble = ndef->getId("mapgen_mossycobble");
+ c_sandbrick = ndef->getId("mapgen_sandstonebrick");
+ c_stair_cobble = ndef->getId("mapgen_stair_cobble");
+ c_stair_sandstone = ndef->getId("mapgen_stair_sandstone");
if (c_ice == CONTENT_IGNORE)
c_ice = CONTENT_AIR;
+ if (c_mossycobble == CONTENT_IGNORE)
+ c_mossycobble = c_cobble;
+ if (c_sandbrick == CONTENT_IGNORE)
+ c_sandbrick = c_desert_stone;
+ if (c_stair_cobble == CONTENT_IGNORE)
+ c_stair_cobble = c_cobble;
+ if (c_stair_sandstone == CONTENT_IGNORE)
+ c_stair_sandstone = c_sandbrick;
}
@@ -248,13 +262,41 @@ void MapgenV7::makeChunk(BlockMakeData *data)
noise_humidity->result, heightmap, biomemap);
// Actually place the biome-specific nodes
- generateBiomes(noise_heat->result, noise_humidity->result);
+ bool desert_stone = generateBiomes(noise_heat->result, noise_humidity->result);
if (flags & MG_CAVES)
generateCaves(stone_surface_max_y);
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
- DungeonGen dgen(this, NULL);
+ 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 (desert_stone) {
+ dp.c_cobble = c_sandbrick;
+ dp.c_moss = c_sandbrick; // should make this 'cracked sandstone' later
+ dp.c_stair = c_stair_sandstone;
+
+ 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 {
+ 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;
+ }
+
+ DungeonGen dgen(this, &dp);
dgen.generate(blockseed, full_node_min, full_node_max);
}
@@ -536,10 +578,10 @@ void MapgenV7::generateRidgeTerrain()
}
-void MapgenV7::generateBiomes(float *heat_map, float *humidity_map)
+bool MapgenV7::generateBiomes(float *heat_map, float *humidity_map)
{
if (node_max.Y < water_level)
- return;
+ return false;
MapNode n_air(CONTENT_AIR);
MapNode n_stone(c_stone);
@@ -547,6 +589,7 @@ void MapgenV7::generateBiomes(float *heat_map, float *humidity_map)
v3s16 em = vm->m_area.getExtent();
u32 index = 0;
+ bool desert_stone = false;
for (s16 z = node_min.Z; z <= node_max.Z; z++)
for (s16 x = node_min.X; x <= node_max.X; x++, index++) {
@@ -581,6 +624,9 @@ void MapgenV7::generateBiomes(float *heat_map, float *humidity_map)
y0_top = biome->depth_top;
y0_filler = biome->depth_top + dfiller;
depth_water_top = biome->depth_water_top;
+
+ if (biome->c_stone == c_desert_stone)
+ desert_stone = true;
}
if (c == c_stone && have_air) {
@@ -613,7 +659,7 @@ void MapgenV7::generateBiomes(float *heat_map, float *humidity_map)
} else if (c == c_water_source) {
have_air = true;
nplaced = 0;
- if(y > water_level - depth_water_top)
+ if (y > water_level - depth_water_top)
vm->m_data[i] = MapNode(biome->c_water_top);
else
vm->m_data[i] = MapNode(biome->c_water);
@@ -625,6 +671,8 @@ void MapgenV7::generateBiomes(float *heat_map, float *humidity_map)
vm->m_area.add_y(em, i, -1);
}
}
+
+ return desert_stone;
}
diff --git a/src/mapgen_v7.h b/src/mapgen_v7.h
index 87d67da9a..f5dc4ff2b 100644
--- a/src/mapgen_v7.h
+++ b/src/mapgen_v7.h
@@ -94,6 +94,10 @@ public:
content_t c_cobble;
content_t c_desert_sand;
content_t c_desert_stone;
+ content_t c_mossycobble;
+ content_t c_sandbrick;
+ content_t c_stair_cobble;
+ content_t c_stair_sandstone;
MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge);
~MapgenV7();
@@ -114,7 +118,7 @@ public:
int generateMountainTerrain(int ymax);
void generateRidgeTerrain();
- void generateBiomes(float *heat_map, float *humidity_map);
+ bool generateBiomes(float *heat_map, float *humidity_map);
void dustTopNodes();
//void addTopNodes();