diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dungeongen.cpp | 5 | ||||
-rw-r--r-- | src/mapgen_v5.cpp | 12 | ||||
-rw-r--r-- | src/mapgen_v5.h | 2 | ||||
-rw-r--r-- | src/mapgen_v6.cpp | 2 | ||||
-rw-r--r-- | src/mapgen_v7.cpp | 17 | ||||
-rw-r--r-- | src/mapgen_v7.h | 2 |
6 files changed, 25 insertions, 15 deletions
diff --git a/src/dungeongen.cpp b/src/dungeongen.cpp index 7462c275e..eb452a196 100644 --- a/src/dungeongen.cpp +++ b/src/dungeongen.cpp @@ -70,10 +70,7 @@ DungeonGen::DungeonGen(Mapgen *mapgen, DungeonParams *dparams) { void DungeonGen::generate(u32 bseed, v3s16 nmin, v3s16 nmax) { //TimeTaker t("gen dungeons"); - int approx_groundlevel = 10 + mg->water_level; - - if ((nmin.Y + nmax.Y) / 2 >= approx_groundlevel || - NoisePerlin3D(&dp.np_rarity, nmin.X, nmin.Y, nmin.Z, mg->seed) < 0.2) + if (NoisePerlin3D(&dp.np_rarity, nmin.X, nmin.Y, nmin.Z, mg->seed) < 0.2) return; this->blockseed = bseed; diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp index 64879b0bb..24c81e56d 100644 --- a/src/mapgen_v5.cpp +++ b/src/mapgen_v5.cpp @@ -252,7 +252,8 @@ void MapgenV5::makeChunk(BlockMakeData *data) calculateNoise(); // Generate base terrain - generateBaseTerrain(); + s16 stone_surface_max_y = generateBaseTerrain(); + updateHeightmap(node_min, node_max); // Generate underground dirt, sand, gravel and lava blobs @@ -268,7 +269,7 @@ void MapgenV5::makeChunk(BlockMakeData *data) generateBiomes(); // Generate dungeons and desert temples - if (flags & MG_DUNGEONS) { + if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) { DungeonGen dgen(this, NULL); dgen.generate(blockseed, full_node_min, full_node_max); } @@ -342,10 +343,11 @@ void MapgenV5::calculateNoise() // Make base ground level -void MapgenV5::generateBaseTerrain() +int MapgenV5::generateBaseTerrain() { u32 index = 0; u32 index2d = 0; + int stone_surface_max_y = -MAP_GENERATION_LIMIT; for(s16 z=node_min.Z; z<=node_max.Z; z++) { for(s16 y=node_min.Y - 1; y<=node_max.Y + 1; y++) { @@ -372,12 +374,16 @@ void MapgenV5::generateBaseTerrain() vm->m_data[i] = MapNode(CONTENT_AIR); } else { vm->m_data[i] = MapNode(c_stone); + if (y > stone_surface_max_y) + stone_surface_max_y = y; } } index2d = index2d - ystride; } index2d = index2d + ystride; } + + return stone_surface_max_y; } diff --git a/src/mapgen_v5.h b/src/mapgen_v5.h index 06be1ed5f..18f0ffa03 100644 --- a/src/mapgen_v5.h +++ b/src/mapgen_v5.h @@ -94,7 +94,7 @@ public: virtual void makeChunk(BlockMakeData *data); int getGroundLevelAtPoint(v2s16 p); void calculateNoise(); - void generateBaseTerrain(); + int generateBaseTerrain(); void generateBlobs(); void generateBiomes(); void dustTopNodes(); diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index 5c989a773..b97512535 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -500,7 +500,7 @@ void MapgenV6::makeChunk(BlockMakeData *data) } // Add dungeons - if (flags & MG_DUNGEONS) { + if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) { DungeonParams dp; dp.np_rarity = nparams_dungeon_rarity; diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp index d9e928006..3b7c20b96 100644 --- a/src/mapgen_v7.cpp +++ b/src/mapgen_v7.cpp @@ -241,7 +241,7 @@ void MapgenV7::makeChunk(BlockMakeData *data) if (flags & MG_CAVES) generateCaves(stone_surface_max_y); - if (flags & MG_DUNGEONS) { + if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) { DungeonGen dgen(this, NULL); dgen.generate(blockseed, full_node_min, full_node_max); } @@ -405,7 +405,7 @@ int MapgenV7::generateTerrain() int ymax = generateBaseTerrain(); if (spflags & MGV7_MOUNTAINS) - generateMountainTerrain(); + ymax = generateMountainTerrain(ymax); if (spflags & MGV7_RIDGES) generateRidgeTerrain(); @@ -453,10 +453,10 @@ int MapgenV7::generateBaseTerrain() } -void MapgenV7::generateMountainTerrain() +int MapgenV7::generateMountainTerrain(int ymax) { if (node_max.Y <= water_level) - return; + return ymax; MapNode n_stone(c_stone); u32 j = 0; @@ -466,14 +466,21 @@ void MapgenV7::generateMountainTerrain() u32 vi = vm->m_area.index(node_min.X, y, z); for (s16 x = node_min.X; x <= node_max.X; x++) { int index = (z - node_min.Z) * csize.X + (x - node_min.X); + content_t c = vm->m_data[vi].getContent(); - if (getMountainTerrainFromMap(j, index, y)) + if (getMountainTerrainFromMap(j, index, y) + && (c == CONTENT_AIR || c == c_water_source)) { vm->m_data[vi] = n_stone; + if (y > ymax) + ymax = y; + } vi++; j++; } } + + return ymax; } diff --git a/src/mapgen_v7.h b/src/mapgen_v7.h index 7b08971bb..b297770d5 100644 --- a/src/mapgen_v7.h +++ b/src/mapgen_v7.h @@ -107,7 +107,7 @@ public: virtual int generateTerrain(); int generateBaseTerrain(); - void generateMountainTerrain(); + int generateMountainTerrain(int ymax); void generateRidgeTerrain(); void generateBiomes(); |