summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-26 22:28:03 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-26 22:28:03 +0000
commitccaab92e8a9f1696ab38d4e08f33ed3b4ace5578 (patch)
tree1dc4aa89a24b6164a9cace94f1e2bef427b67490
parentb81f40c68c5ede137cd966e332d1cb7315ceff5a (diff)
downloadcrawl-ref-ccaab92e8a9f1696ab38d4e08f33ed3b4ace5578.tar.gz
crawl-ref-ccaab92e8a9f1696ab38d4e08f33ed3b4ace5578.zip
Placeholders for the various types of special rooms now occur at
approximations of the frequency they did in 0.4 (see end of dat/rooms.des for the 0.4 frequencies). Only bee-hives and jelly pits appear in the Lair, and only morgues appear in the Crypt. The depths at which special rooms appear is now entirely controlled by the DEPTH lines in dat/rooms.des, so they can appear at any depth except for D:1, since D:1 is constructed by differnt code than the other levels. With the current set of depths this means that special rooms on roguey levels can start appearing 3 levels earlier than in crawl 0.4 git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7643 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/dat/rooms.des230
-rw-r--r--crawl-ref/source/dungeon.cc62
2 files changed, 245 insertions, 47 deletions
diff --git a/crawl-ref/source/dat/rooms.des b/crawl-ref/source/dat/rooms.des
index 960426f671..1c95a9d8d9 100644
--- a/crawl-ref/source/dat/rooms.des
+++ b/crawl-ref/source/dat/rooms.des
@@ -1,7 +1,6 @@
-NAME: special_room_test
-TAGS: special_room allow_dup
+lua {{
-{{
+function fill_special_room(mon)
local level, tl_x, tl_y, br_x, br_y = dgn.get_special_room_info()
-- Return early if we're being called during map validation.
@@ -9,11 +8,234 @@ TAGS: special_room allow_dup
return
end
+ crawl.mpr("mon = " .. mon .. ", level = " .. level)
+
for x = tl_x, br_x do
for y = tl_y, br_y do
- dgn.create_monster(x, y, "rat")
+ dgn.create_monster(x, y, mon)
end
end
+return
+end
+
}}
+
+##########################
+
+NAME: special_room_kobold
+DEPTH: 6-14, !Lair, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 11
+: fill_special_room("kobold")
+MAP
+ENDMAP
+
+NAME: special_room_orc_a
+DEPTH: 8-14, !Lair, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 59
+: fill_special_room("orc")
+MAP
+ENDMAP
+
+NAME: special_room_bee_a
+DEPTH: 8-14, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 30
+: fill_special_room("killer bee")
+MAP
+ENDMAP
+################################
+NAME: special_room_orc_b
+DEPTH: 15-16, !Lair, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 50
+: fill_special_room("orc")
+MAP
+ENDMAP
+
+NAME: special_room_bee_b
+DEPTH: 15-16, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 25
+: fill_special_room("killer bee")
+MAP
+ENDMAP
+
+NAME: special_room_morgue_b
+DEPTH: 15-16, !Lair
+TAGS: special_room allow_dup
+WEIGHT: 25
+: fill_special_room("rat zombie")
+MAP
+ENDMAP
+#################################
+NAME: special_room_orc_c
+DEPTH: 17, !Lair, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 40
+: fill_special_room("orc")
+MAP
+ENDMAP
+
+NAME: special_room_bee_c
+DEPTH: 17, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 25
+: fill_special_room("killer bee")
+MAP
+ENDMAP
+
+NAME: special_room_morgue_c
+DEPTH: 17, !Lair
+TAGS: special_room allow_dup
+WEIGHT: 27
+: fill_special_room("rat zombie")
+MAP
+ENDMAP
+
+NAME: special_room_jelly_c
+DEPTH: 17, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 9
+: fill_special_room("jelly")
MAP
ENDMAP
+#################################
+NAME: special_room_orc_d
+DEPTH: 18-20, !Lair, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 25
+: fill_special_room("orc")
+MAP
+ENDMAP
+
+NAME: special_room_bee_d
+DEPTH: 18-20, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 33
+: fill_special_room("killer bee")
+MAP
+ENDMAP
+
+NAME: special_room_morgue_d
+DEPTH: 18-20, !Lair
+TAGS: special_room allow_dup
+WEIGHT: 29
+: fill_special_room("rat zombie")
+MAP
+ENDMAP
+
+NAME: special_room_jelly_d
+DEPTH: 18-20, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 13
+: fill_special_room("jelly")
+MAP
+ENDMAP
+#################################
+NAME: special_room_orc_e
+DEPTH: 21-, !Lair, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 15
+: fill_special_room("orc")
+MAP
+ENDMAP
+
+NAME: special_room_bee_e
+DEPTH: 21-, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 8
+: fill_special_room("killer bee")
+MAP
+ENDMAP
+
+NAME: special_room_morgue_e
+DEPTH: 21-, !Lair
+TAGS: special_room allow_dup
+WEIGHT: 32
+: fill_special_room("rat zombie")
+MAP
+ENDMAP
+
+NAME: special_room_jelly_e
+DEPTH: 21-, !Crypt
+TAGS: special_room allow_dup
+WEIGHT: 45
+: fill_special_room("jelly")
+MAP
+ENDMAP
+
+#########################################################################
+#########################################################################
+
+# 0.4 crawl C code for randomly determining which special room type to
+# use
+
+# if (level_number < 7)
+# spec_room_type = SROOM_LAIR_KOBOLD;
+# else
+# {
+# spec_room_type = random2(NUM_SPECIAL_ROOMS);
+#
+# if (level_number < 23 && one_chance_in(4))
+# spec_room_type = SROOM_BEEHIVE;
+#
+# // Replace overly dangerous special rooms with a room full of orcs.
+# if (level_number > 13 && spec_room_type == SROOM_LAIR_KOBOLD
+# || level_number < 16 && spec_room_type == SROOM_MORGUE
+# || level_number < 14 && spec_room_type == SROOM_JELLY_PIT
+# || level_number < 17 && one_chance_in(4))
+# {
+# spec_room_type = SROOM_LAIR_ORC;
+# }
+#
+# if (level_number > 19 && coinflip())
+# spec_room_type = SROOM_MORGUE;
+#
+# if (level_number > 13 &&
+# one_chance_in(6 - (level_number > 23) - (level_number > 18)))
+# {
+# spec_room_type = SROOM_JELLY_PIT;
+# }
+# }
+#
+
+####################################
+
+# 0.4 crawl percentages for each room type generated per level (for 10,000
+# randomly generated vaults per level)
+
+# | K | O | B | M | J |
+#-----------------------------------------------
+# 0| 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
+# 1| 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
+# 2| 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
+# 3| 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
+# 4| 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
+# 5| 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
+# 6|100.00 | 0.00 | 0.00 | 0.00 | 0.00 |
+# 7| 11.39 | 59.25 | 29.36 | 0.00 | 0.00 |
+# 8| 11.07 | 58.43 | 30.50 | 0.00 | 0.00 |
+# 9| 11.23 | 57.98 | 30.79 | 0.00 | 0.00 |
+#10| 11.46 | 58.39 | 30.15 | 0.00 | 0.00 |
+#11| 11.30 | 58.78 | 29.92 | 0.00 | 0.00 |
+#12| 11.21 | 58.65 | 30.14 | 0.00 | 0.00 |
+#13| 10.92 | 58.96 | 30.12 | 0.00 | 0.00 |
+#14| 0.00 | 49.58 | 24.99 | 25.43 | 0.00 |
+#15| 0.00 | 49.74 | 24.56 | 25.70 | 0.00 |
+#16| 0.00 | 39.51 | 24.77 | 27.04 | 8.68 |
+#17| 0.00 | 24.23 | 33.07 | 29.57 | 13.13 |
+#18| 0.00 | 25.31 | 32.99 | 29.06 | 12.64 |
+#19| 0.00 | 24.52 | 32.53 | 31.09 | 11.86 |
+#20| 0.00 | 11.63 | 15.84 | 25.52 | 47.01 |
+#21| 0.00 | 12.06 | 17.33 | 25.60 | 45.01 |
+#22| 0.00 | 12.12 | 15.97 | 25.50 | 46.41 |
+#23| 0.00 | 14.94 | 8.64 | 27.63 | 48.79 |
+#24| 0.00 | 15.20 | 7.29 | 32.14 | 45.37 |
+#25| 0.00 | 14.82 | 7.88 | 33.04 | 44.26 |
+#26| 0.00 | 14.99 | 7.91 | 31.94 | 45.16 |
+#27| 0.00 | 14.96 | 7.28 | 32.06 | 45.70 |
+#28| 0.00 | 15.12 | 7.88 | 32.11 | 44.89 |
+#29| 0.00 | 15.48 | 7.40 | 33.17 | 43.95 |
+#30| 0.00 | 15.08 | 7.84 | 31.97 | 45.11 |
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 68e4bfd606..9fccc8fa7d 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -177,7 +177,8 @@ static bool _treasure_area(int level_number, unsigned char ta1_x,
unsigned char ta2_y);
// SPECIAL ROOM BUILDERS
-static void _special_room(int level_number, spec_room &sr);
+static void _special_room(int level_number, spec_room &sr,
+ const map_def *vault);
static void _specr_2(spec_room &sr);
static void _big_room(int level_number);
static void _chequerboard(spec_room &sr, dungeon_feature_type target,
@@ -2540,8 +2541,15 @@ static builder_rc_type _builder_normal(int level_number, char level_type,
// maybe create a special room, if roguey_level hasn't done it
// already.
- if (!sr.created && level_number > 5 && one_chance_in(5))
- _special_room(level_number, sr);
+ if (!sr.created && one_chance_in(5))
+ {
+ const map_def *sroom = random_map_for_tag("special_room", true, true);
+
+ // Might not be any special room definitions appropriate for
+ // this branch and depth.
+ if (sroom != NULL)
+ _special_room(level_number, sr, sroom);
+ }
return BUILD_CONTINUE;
}
@@ -3520,8 +3528,10 @@ static void _specr_2(spec_room &sr)
sr.hooked_up = true;
}
-static void _special_room(int level_number, spec_room &sr)
+static void _special_room(int level_number, spec_room &sr,
+ const map_def *vault)
{
+ ASSERT(vault);
#if 0 // MATT
char spec_room_type = SROOM_LAIR_KOBOLD;
int lev_mons;
@@ -3552,15 +3562,6 @@ static void _special_room(int level_number, spec_room &sr)
sr.tl.set(room_x1 + 1, room_y1 + 1);
sr.br.set(room_x2 - 1, room_y2 - 1);
- const map_def *vault = random_map_for_tag("special_room", true, true);
-
- ASSERT(vault);
- if (!vault)
- {
- mpr("ERROR: failed to create special room.", MSGCH_ERROR);
- return;
- }
-
lua_special_room_spec = sr;
lua_special_room_level = level_number;
@@ -3571,34 +3572,6 @@ static void _special_room(int level_number, spec_room &sr)
lua_special_room_level = -1;
#if 0 // MATT
- if (level_number < 7)
- spec_room_type = SROOM_LAIR_KOBOLD;
- else
- {
- spec_room_type = random2(NUM_SPECIAL_ROOMS);
-
- if (level_number < 23 && one_chance_in(4))
- spec_room_type = SROOM_BEEHIVE;
-
- // Replace overly dangerous special rooms with a room full of orcs.
- if (level_number > 13 && spec_room_type == SROOM_LAIR_KOBOLD
- || level_number < 16 && spec_room_type == SROOM_MORGUE
- || level_number < 14 && spec_room_type == SROOM_JELLY_PIT
- || level_number < 17 && one_chance_in(4))
- {
- spec_room_type = SROOM_LAIR_ORC;
- }
-
- if (level_number > 19 && coinflip())
- spec_room_type = SROOM_MORGUE;
-
- if (level_number > 13 &&
- one_chance_in(6 - (level_number > 23) - (level_number > 18)))
- {
- spec_room_type = SROOM_JELLY_PIT;
- }
- }
-
switch (spec_room_type)
{
case SROOM_LAIR_ORC:
@@ -7506,7 +7479,10 @@ static void _roguey_level(int level_number, spec_room &sr, bool make_stairs)
} // end "for bp, for i"
// Is one of them a special room?
- if (level_number > 8 && one_chance_in(10))
+ const map_def *sroom;
+
+ if (one_chance_in(10)
+ && (sroom = random_map_for_tag("special_room", true, true)) != NULL)
{
int spec_room_done = random2(25);
@@ -7514,7 +7490,7 @@ static void _roguey_level(int level_number, spec_room &sr, bool make_stairs)
sr.hooked_up = true;
sr.tl.set( rox1[spec_room_done], roy1[spec_room_done] );
sr.br.set( rox2[spec_room_done], roy2[spec_room_done] );
- _special_room( level_number, sr );
+ _special_room( level_number, sr, sroom );
// Make the room 'special' so it doesn't get overwritten
// by something else (or put monsters in walls, etc...)