diff options
Diffstat (limited to 'src/mapgen/mapgen.cpp')
-rw-r--r-- | src/mapgen/mapgen.cpp | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index 67dbee3f5..9562482c8 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -640,8 +640,7 @@ MapgenBasic::~MapgenBasic() } -void MapgenBasic::generateBiomes(MgStoneType *mgstone_type, - content_t *biome_stone) +void MapgenBasic::generateBiomes() { // can't generate biomes without a biome generator! assert(biomegen); @@ -649,8 +648,6 @@ void MapgenBasic::generateBiomes(MgStoneType *mgstone_type, const v3s16 &em = vm->m_area.getExtent(); u32 index = 0; - MgStoneType stone_type = MGSTONE_OTHER; - content_t c_biome_stone = c_stone; noise_filler_depth->perlinMap2D(node_min.X, node_min.Z); @@ -705,17 +702,6 @@ void MapgenBasic::generateBiomes(MgStoneType *mgstone_type, depth_water_top = biome->depth_water_top; depth_riverbed = biome->depth_riverbed; biome_y_min = biome->min_pos.Y; - - // Detect stone type for dungeons during every biome calculation. - // If none detected the last selected biome stone is chosen. - if (biome->c_stone == c_stone) - stone_type = MGSTONE_STONE; - else if (biome->c_stone == c_desert_stone) - stone_type = MGSTONE_DESERT_STONE; - else if (biome->c_stone == c_sandstone) - stone_type = MGSTONE_SANDSTONE; - - c_biome_stone = biome->c_stone; } if (c == c_stone) { @@ -776,9 +762,6 @@ void MapgenBasic::generateBiomes(MgStoneType *mgstone_type, VoxelArea::add_y(em, vi, -1); } } - - *mgstone_type = stone_type; - *biome_stone = c_biome_stone; } @@ -878,16 +861,18 @@ bool MapgenBasic::generateCaverns(s16 max_stone_y) } -void MapgenBasic::generateDungeons(s16 max_stone_y, - MgStoneType stone_type, content_t biome_stone) +void MapgenBasic::generateDungeons(s16 max_stone_y) { if (max_stone_y < node_min.Y) return; + // Get biome at mapchunk midpoint + v3s16 chunk_mid = node_min + (node_max - node_min) / v3s16(2, 2, 2); + Biome *biome = (Biome *)biomegen->calcBiomeAtPoint(chunk_mid); + DungeonParams dp; dp.seed = seed; - dp.only_in_ground = true; dp.corridor_len_min = 1; dp.corridor_len_max = 13; @@ -899,9 +884,27 @@ void MapgenBasic::generateDungeons(s16 max_stone_y, dp.np_density = nparams_dungeon_density; dp.np_alt_wall = nparams_dungeon_alt_wall; - switch (stone_type) { - default: - case MGSTONE_STONE: + // Biome-defined dungeon nodes + if (biome->c_dungeon != CONTENT_IGNORE) { + dp.c_wall = biome->c_dungeon; + // If 'node_dungeon_alt' is not defined by biome, it and dp.c_alt_wall + // become CONTENT_IGNORE which skips the alt wall node placement loop in + // dungeongen.cpp. + dp.c_alt_wall = biome->c_dungeon_alt; + // Stairs fall back to 'c_dungeon' if not defined by biome + dp.c_stair = (biome->c_dungeon_stair != CONTENT_IGNORE) ? + biome->c_dungeon_stair : biome->c_dungeon; + + dp.diagonal_dirs = false; + dp.holesize = v3s16(2, 2, 2); + dp.room_size_min = v3s16(6, 4, 6); + dp.room_size_max = v3s16(10, 6, 10); + dp.room_size_large_min = v3s16(10, 8, 10); + dp.room_size_large_max = v3s16(18, 16, 18); + dp.notifytype = GENNOTIFY_DUNGEON; + + // Otherwise classic behaviour + } else if (biome->c_stone == c_stone) { dp.c_wall = c_cobble; dp.c_alt_wall = c_mossycobble; dp.c_stair = c_stair_cobble; @@ -913,8 +916,8 @@ void MapgenBasic::generateDungeons(s16 max_stone_y, dp.room_size_large_min = v3s16(8, 8, 8); dp.room_size_large_max = v3s16(16, 16, 16); dp.notifytype = GENNOTIFY_DUNGEON; - break; - case MGSTONE_DESERT_STONE: + + } else if (biome->c_stone == c_desert_stone) { dp.c_wall = c_desert_stone; dp.c_alt_wall = CONTENT_IGNORE; dp.c_stair = c_stair_desert_stone; @@ -926,8 +929,8 @@ void MapgenBasic::generateDungeons(s16 max_stone_y, dp.room_size_large_min = v3s16(10, 13, 10); dp.room_size_large_max = v3s16(18, 21, 18); dp.notifytype = GENNOTIFY_TEMPLE; - break; - case MGSTONE_SANDSTONE: + + } else if (biome->c_stone == c_sandstone) { dp.c_wall = c_sandstonebrick; dp.c_alt_wall = CONTENT_IGNORE; dp.c_stair = c_stair_sandstone_block; @@ -939,20 +942,20 @@ void MapgenBasic::generateDungeons(s16 max_stone_y, dp.room_size_large_min = v3s16(10, 8, 10); dp.room_size_large_max = v3s16(18, 16, 18); dp.notifytype = GENNOTIFY_DUNGEON; - break; - case MGSTONE_OTHER: - dp.c_wall = biome_stone; - dp.c_alt_wall = biome_stone; - dp.c_stair = biome_stone; + + // Fallback to using biome 'node_stone' + } else { + dp.c_wall = biome->c_stone; + dp.c_alt_wall = CONTENT_IGNORE; + dp.c_stair = biome->c_stone; dp.diagonal_dirs = false; - dp.holesize = v3s16(1, 2, 1); - dp.room_size_min = v3s16(4, 4, 4); - dp.room_size_max = v3s16(8, 6, 8); - dp.room_size_large_min = v3s16(8, 8, 8); - dp.room_size_large_max = v3s16(16, 16, 16); + dp.holesize = v3s16(2, 2, 2); + dp.room_size_min = v3s16(6, 4, 6); + dp.room_size_max = v3s16(10, 6, 10); + dp.room_size_large_min = v3s16(10, 8, 10); + dp.room_size_large_max = v3s16(18, 16, 18); dp.notifytype = GENNOTIFY_DUNGEON; - break; } DungeonGen dgen(ndef, &gennotify, &dp); |