diff options
-rw-r--r-- | crawl-ref/source/dat/vaults.des | 64 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.cc | 37 |
2 files changed, 90 insertions, 11 deletions
diff --git a/crawl-ref/source/dat/vaults.des b/crawl-ref/source/dat/vaults.des index 7b4a7cd4d1..95c2b7bb61 100644 --- a/crawl-ref/source/dat/vaults.des +++ b/crawl-ref/source/dat/vaults.des @@ -2343,7 +2343,7 @@ MAP ENDMAP ############################################################################# -# Labyrinth minivaults +# Labyrinth (minotaur) minivaults ############################################################################# # One layer of floor space *must* surround the minivault, or the player could # be trapped in the labyrinth (the dummy is exempt from this requirement). @@ -2355,11 +2355,14 @@ ENDMAP # disappointed. # # You *must* place the minotaur(s) yourself! +# +# Minivaults tagged "minotaur" will be used for the labyrinth finale (exit). +# Minivaults tagged "lab" will be used randomly in the labyrinth. ############################################################################# # Dummy balancer NAME: labyrinth_0 -TAGS: lab dummy +TAGS: minotaur dummy CHANCE: 20 MAP @@ -2370,7 +2373,7 @@ ENDMAP # A simple lair. NAME: labyrinth_1 -TAGS: lab generate_loot no_pool_fixup +TAGS: minotaur generate_loot no_pool_fixup MONS: minotaur SHUFFLE: def SUBST: d=^, e=^, f=. @@ -2388,6 +2391,61 @@ MAP ENDMAP ############################################################################ +# Labyrinth dummy decorator +NAME: lab_dummy +TAGS: lab dummy +CHANCE: 90 +MAP +x +ENDMAP + +############################################################################ +# Labyrinth furniture + +NAME: lab_furniture_1 +TAGS: lab +MAP +..... +.xxx. +.xxx. +.xxx. +..... +ENDMAP + +############################################################################ +# Labyrinth furniture II + +NAME: lab_furniture_2 +TAGS: lab +MAP +....... +..b.b.. +.bb.bb. +...F... +.bb.bb. +..b.b.. +....... +ENDMAP + +############################################################################ +# Labyrinth hedge + +NAME: lab_furniture_3 +TAGS: lab +MONS: plant +MAP +....... +.11111. +.1ccc1. +..1c1.. +..1c1.. +..1c1.. +.1ccc1. +.11111. +....... +ENDMAP + +############################################################################ # Minivaults specific to particular branches ############################################################################ # Orcish mines minivaults: diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 0ed4cfc8aa..8ed6a9b652 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -202,9 +202,10 @@ static dgn_region_list no_monster_zones; static dgn_region_list no_item_zones; static dgn_region_list no_pool_fixup_zones; static dgn_region_list no_door_fixup_zones; +static dgn_region_list vault_zones; +static std::vector<vault_placement> level_vaults; static int minivault_chance = 3; -static std::vector<vault_placement> level_vaults; static std::string level_name(int subdepth) { @@ -367,6 +368,7 @@ static void reset_level() no_item_zones.clear(); no_pool_fixup_zones.clear(); no_door_fixup_zones.clear(); + vault_zones.clear(); minivault_chance = 3; // blank level with DNGN_ROCK_WALL @@ -2562,6 +2564,9 @@ static void beehive(spec_room &sr) static bool safe_minivault_place(int v1x, int v1y, const vault_placement &place) { + dgn_region reg(v1x, v1y, place.width, place.height); + if (reg.overlaps_any(vault_zones)) + return (false); for (int vx = v1x; vx < v1x + place.width; vx++) { for (int vy = v1y; vy < v1y + place.height; vy++) @@ -2651,6 +2656,8 @@ static bool build_minivaults(int level_number, int force_vault) place.y = v1y; level_vaults.push_back(place); + vault_zones.push_back( + dgn_region(place.x, place.y, place.width, place.height)); for (vx = v1x; vx < v1x + place.width; vx++) { @@ -3077,6 +3084,8 @@ static bool build_vaults(int level_number, int force_vault, int rune_subst, // Must do this only after target_connections is finalised, or the vault // exits will not be correctly set. level_vaults.push_back(place); + vault_zones.push_back( + dgn_region(place.x, place.y, place.width, place.height)); // If the map takes the whole screen or we were only requested to // build, our work is done. @@ -4926,6 +4935,21 @@ static void change_walls_from_centre(const dgn_region ®ion, change_walls_from_centre(region, c, rectangular, forbidden, wall, ldist); } +static void place_extra_lab_minivaults(int level_number) +{ + std::set<int> vaults_used; + while (true) + { + const int vault = random_map_for_tag("lab", true, false); + if (vault == -1 || vaults_used.find(vault) != vaults_used.end()) + break; + + vaults_used.insert(vault); + if (!build_minivaults(level_number, vault)) + break; + } +} + static void labyrinth_level(int level_number) { dgn_region lab = @@ -4934,7 +4958,7 @@ static void labyrinth_level(int level_number) GYM - MAPGEN_BORDER * 5 / 2 - 1 ); // First decide if we're going to use a Lab minivault. - int vault = random_map_for_tag("lab", true, false); + int vault = random_map_for_tag("minotaur", true, false); vault_placement place; if (vault != -1) { @@ -4980,16 +5004,13 @@ static void labyrinth_level(int level_number) 1, DNGN_FLOOR); } - dgn_region_list vaults; if (vault != -1) - { - vaults.push_back( - dgn_region(place.x, place.y, place.width, place.height)); end = coord_def(place.x + place.width / 2, place.y + place.height / 2); - } - change_walls_from_centre(lab, end, false, vaults, DNGN_ROCK_WALL, + place_extra_lab_minivaults(level_number); + + change_walls_from_centre(lab, end, false, vault_zones, DNGN_ROCK_WALL, 15 * 15, DNGN_METAL_WALL, 34 * 34, DNGN_STONE_WALL, 0); |