*/
/*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
*
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies. Other copyrights may also apply.
*/
#include "angband.h"
10, /* 10 = Random vault (44x22) */
3, /* 11 = Circular rooms (22x22) */
10, /* 12 = Crypts (22x22) */
+ 20, /* 13 = Trapped monster pit */
+ 20, /* 14 = Piranha/Armageddon trap room */
};
}
else
{
- set_cave_feat(y, x, FEAT_DOOR_HEAD+randint(7));
+ set_cave_feat(y, x, FEAT_DOOR_HEAD+randint1(7));
cave[y][x].info &= ~(CAVE_FLOOR);
}
}
}
else
{
- set_cave_feat(y, x, FEAT_SECRET);
- cave[y][x].info &= ~(CAVE_FLOOR);
+ cave_type *c_ptr = &cave[y][x];
+
+ /* Create secret door */
+ place_closed_door(y, x);
+
+ /* Hide by inner wall because this is used in rooms only */
+ c_ptr->mimic = f_info[feat_wall_inner].mimic;
+
+ /* Floor type terrain cannot hide a door */
+ if (feat_floor(c_ptr->mimic))
+ {
+ c_ptr->feat = c_ptr->mimic;
+ c_ptr->mimic = 0;
+ }
+
+ c_ptr->info &= ~(CAVE_FLOOR);
}
}
}
/* Place a secret door on one side */
- switch (rand_int(4))
+ switch (randint0(4))
{
case 0: place_secret_door(y0, x0 - 1); break;
case 1: place_secret_door(y0, x0 + 1); break;
case 3: place_secret_door(y0 + 1, x0); break;
}
+ /* Clear mimic type */
+ cave[y0][x0].mimic = 0;
+
/* Add inner open space */
place_floor_bold(y0, x0);
}
* If so, fix by tunneling outside the room in such a way as to connect the caves.
*/
check_room_boundary(*xx - x / 2 - 1, *yy - y / 2 - 1,
- *xx + (x - 1) / 2 + 1, *yy + (y - 1) / 2 + 1);
+ *xx + (x - 1) / 2 + 1, *yy + (y - 1) / 2 + 1);
/* Success */
return (TRUE);
* 10 -- random vaults
* 11 -- circular rooms
* 12 -- crypts
+ * 13 -- trapped monster pits
+ * 14 -- trapped room
*/
cave_type *c_ptr;
/* Pick a room size */
- y1 = randint(4);
- x1 = randint(11);
- y2 = randint(3);
- x2 = randint(11);
+ y1 = randint1(4);
+ x1 = randint1(11);
+ y2 = randint1(3);
+ x2 = randint1(11);
xsize = x1 + x2 + 1;
ysize = y1 + y2 + 1;
if (!room_alloc(xsize + 2, ysize + 2, FALSE, by0, bx0, &xval, &yval)) return;
/* Choose lite or dark */
- light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+ light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
/* Get corner values */
/* Hack -- Occasional pillar room */
- if (rand_int(20) == 0)
+ if (one_in_(20))
{
for (y = y1; y <= y2; y += 2)
{
}
/* Hack -- Occasional room with four pillars */
- else if (rand_int(20) == 0)
+ else if (one_in_(20))
{
if ((y1 + 4 < y2) && (x1 + 4 < x2))
{
}
/* Hack -- Occasional ragged-edge room */
- else if (rand_int(50) == 0)
+ else if (one_in_(50))
{
for (y = y1 + 2; y <= y2 - 2; y += 2)
{
}
}
/* Hack -- Occasional divided room */
- else if (rand_int(50) == 0)
+ else if (one_in_(50))
{
- if (randint(100) < 50)
+ if (randint1(100) < 50)
{
/* Horizontal wall */
for (x = x1; x <= x2; x++)
place_solid_bold(y2 + 1, xval);
}
- place_random_door(yval, xval);
+ place_random_door(yval, xval, TRUE);
}
}
if (!room_alloc(25, 11, FALSE, by0, bx0, &xval, &yval)) return;
/* Choose lite or dark */
- light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+ light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
/* Determine extents of the first room */
- y1a = yval - randint(4);
- y2a = yval + randint(3);
- x1a = xval - randint(11);
- x2a = xval + randint(10);
+ y1a = yval - randint1(4);
+ y2a = yval + randint1(3);
+ x1a = xval - randint1(11);
+ x2a = xval + randint1(10);
/* Determine extents of the second room */
- y1b = yval - randint(3);
- y2b = yval + randint(4);
- x1b = xval - randint(10);
- x2b = xval + randint(11);
+ y1b = yval - randint1(3);
+ y2b = yval + randint1(4);
+ x1b = xval - randint1(10);
+ x2b = xval + randint1(11);
/* Place a full floor for room "a" */
if (!room_alloc(25, 11, FALSE, by0, bx0, &xval, &yval)) return;
/* Choose lite or dark */
- light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+ light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
/* For now, always 3x3 */
wx = wy = 1;
/* Special features (3/4) */
- switch (rand_int(4))
+ switch (randint0(4))
{
/* Large solid middle pillar */
case 1:
}
/* Place a secret door on the inner room */
- switch (rand_int(4))
+ switch (randint0(4))
{
case 0: place_secret_door(y1b, xval); break;
case 1: place_secret_door(y2b, xval); break;
}
/* Place a treasure in the vault */
- place_object(yval, xval, FALSE, FALSE);
+ place_object(yval, xval, 0L);
/* Let's guard the treasure well */
- vault_monsters(yval, xval, rand_int(2) + 3);
+ vault_monsters(yval, xval, randint0(2) + 3);
/* Traps naturally */
- vault_traps(yval, xval, 4, 4, rand_int(3) + 2);
+ vault_traps(yval, xval, 4, 4, randint0(3) + 2);
break;
}
case 3:
{
/* Occasionally pinch the center shut */
- if (rand_int(3) == 0)
+ if (one_in_(3))
{
/* Pinch the east/west sides */
for (y = y1b; y <= y2b; y++)
}
/* Sometimes shut using secret doors */
- if (rand_int(3) == 0)
+ if (one_in_(3))
{
place_secret_door(yval, x1a - 1);
place_secret_door(yval, x2a + 1);
}
/* Occasionally put a "plus" in the center */
- else if (rand_int(3) == 0)
+ else if (one_in_(3))
{
c_ptr = &cave[yval][xval];
place_inner_grid(c_ptr);
}
/* Occasionally put a pillar in the center */
- else if (rand_int(3) == 0)
+ else if (one_in_(3))
{
c_ptr = &cave[yval][xval];
place_inner_grid(c_ptr);
if (!room_alloc(25, 11, FALSE, by0, bx0, &xval, &yval)) return;
/* Choose lite or dark */
- light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+ light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
/* Large room */
y1 = yval - 4;
/* Inner room variations */
- switch (randint(5))
+ switch (randint1(5))
{
/* Just an inner room with a monster */
case 1:
{
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
case 2:
{
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
}
/* Place a locked door on the inner room */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_locked_door(yval - 1, xval); break;
case 2: place_locked_door(yval + 1, xval); break;
}
/* Monsters to guard the "treasure" */
- vault_monsters(yval, xval, randint(3) + 2);
+ vault_monsters(yval, xval, randint1(3) + 2);
/* Object (80%) */
- if (rand_int(100) < 80)
+ if (randint0(100) < 80)
{
- place_object(yval, xval, FALSE, FALSE);
+ place_object(yval, xval, 0L);
}
/* Stairs (20%) */
}
/* Traps to protect the treasure */
- vault_traps(yval, xval, 4, 10, 2 + randint(3));
+ vault_traps(yval, xval, 4, 10, 2 + randint1(3));
break;
}
case 3:
{
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
}
/* Occasionally, two more Large Inner Pillars */
- if (rand_int(2) == 0)
+ if (one_in_(2))
{
- tmp = randint(2);
+ tmp = randint1(2);
for (y = yval - 1; y <= yval + 1; y++)
{
for (x = xval - 5 - tmp; x <= xval - 3 - tmp; x++)
}
/* Occasionally, some Inner rooms */
- if (rand_int(3) == 0)
+ if (one_in_(3))
{
/* Long horizontal walls */
for (x = xval - 5; x <= xval + 5; x++)
place_inner_grid(c_ptr);
/* Secret doors (random top/bottom) */
- place_secret_door(yval - 3 + (randint(2) * 2), xval - 3);
- place_secret_door(yval - 3 + (randint(2) * 2), xval + 3);
+ place_secret_door(yval - 3 + (randint1(2) * 2), xval - 3);
+ place_secret_door(yval - 3 + (randint1(2) * 2), xval + 3);
/* Monsters */
- vault_monsters(yval, xval - 2, randint(2));
- vault_monsters(yval, xval + 2, randint(2));
+ vault_monsters(yval, xval - 2, randint1(2));
+ vault_monsters(yval, xval + 2, randint1(2));
/* Objects */
- if (rand_int(3) == 0) place_object(yval, xval - 2, FALSE, FALSE);
- if (rand_int(3) == 0) place_object(yval, xval + 2, FALSE, FALSE);
+ if (one_in_(3)) place_object(yval, xval - 2, 0L);
+ if (one_in_(3)) place_object(yval, xval + 2, 0L);
}
break;
case 4:
{
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
}
/* Monsters just love mazes. */
- vault_monsters(yval, xval - 5, randint(3));
- vault_monsters(yval, xval + 5, randint(3));
+ vault_monsters(yval, xval - 5, randint1(3));
+ vault_monsters(yval, xval + 5, randint1(3));
/* Traps make them entertaining. */
- vault_traps(yval, xval - 3, 2, 8, randint(3));
- vault_traps(yval, xval + 3, 2, 8, randint(3));
+ vault_traps(yval, xval - 3, 2, 8, randint1(3));
+ vault_traps(yval, xval + 3, 2, 8, randint1(3));
/* Mazes should have some treasure too. */
vault_objects(yval, xval, 3);
}
/* Doors into the rooms */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
- int i = randint(10);
+ int i = randint1(10);
place_secret_door(y1 - 1, xval - i);
place_secret_door(y1 - 1, xval + i);
place_secret_door(y2 + 1, xval - i);
}
else
{
- int i = randint(3);
+ int i = randint1(3);
place_secret_door(yval + i, x1 - 1);
place_secret_door(yval - i, x1 - 1);
place_secret_door(yval + i, x2 + 1);
}
/* Treasure, centered at the center of the cross */
- vault_objects(yval, xval, 2 + randint(2));
+ vault_objects(yval, xval, 2 + randint1(2));
/* Gotta have some monsters. */
- vault_monsters(yval + 1, xval - 4, randint(4));
- vault_monsters(yval + 1, xval + 4, randint(4));
- vault_monsters(yval - 1, xval - 4, randint(4));
- vault_monsters(yval - 1, xval + 4, randint(4));
+ vault_monsters(yval + 1, xval - 4, randint1(4));
+ vault_monsters(yval + 1, xval + 4, randint1(4));
+ vault_monsters(yval - 1, xval - 4, randint1(4));
+ vault_monsters(yval - 1, xval + 4, randint1(4));
break;
}
(monster_dungeon(I) && \
!(r_info[I].flags1 & RF1_UNIQUE) && \
!(r_info[I].flags7 & RF7_UNIQUE2) && \
- !(r_info[I].flags3 & RF3_RES_ALL) && \
+ !(r_info[I].flagsr & RFR_RES_ALL) && \
!(r_info[I].flags7 & RF7_AQUATIC))
/* Validate the monster */
if (!vault_monster_okay(r_idx)) return (FALSE);
- if (r_ptr->flags2 & (RF2_KILL_BODY)) return (FALSE);
+ if ((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW)) return (FALSE);
/* Also decline evil jellies (like death molds and shoggoths) */
if (r_ptr->flags3 & (RF3_EVIL)) return (FALSE);
*/
static bool vault_aux_chapel_g(int r_idx)
{
+ static int chapel_list[] = {
+ MON_NOV_PRIEST, MON_NOV_PALADIN, MON_NOV_PRIEST_G, MON_NOV_PALADIN_G,
+ MON_PRIEST, MON_JADE_MONK, MON_IVORY_MONK, MON_ULTRA_PALADIN,
+ MON_EBONY_MONK, MON_W_KNIGHT, MON_KNI_TEMPLAR, MON_PALADIN,
+ MON_TOPAZ_MONK, 0};
+
+ int i;
+
monster_race *r_ptr = &r_info[r_idx];
/* Validate the monster */
if ((r_idx == MON_A_GOLD) || (r_idx == MON_A_SILVER)) return (FALSE);
/* Require "priest" or Angel */
- if (!((r_ptr->d_char == 'A') ||
-#ifdef JP
-strstr((r_name + r_ptr->E_name),"aladin") ||
-#else
- strstr((r_name + r_ptr->name),"aladin") ||
-#endif
-#ifdef JP
-strstr((r_name + r_ptr->E_name),"Monk") ||
-#else
- strstr((r_name + r_ptr->name),"Monk") ||
-#endif
-#ifdef JP
-strstr((r_name + r_ptr->E_name),"riest")))
-#else
- strstr((r_name + r_ptr->name),"riest")))
-#endif
- {
- return (FALSE);
- }
+ if (r_ptr->d_char == 'A') return TRUE;
- /* Okay */
- return (TRUE);
+ for (i = 0; chapel_list[i]; i++)
+ if (r_idx == chapel_list[i]) return TRUE;
+
+ return FALSE;
}
if (!vault_monster_okay(r_idx)) return (FALSE);
/* Require mimic */
- if (!strchr("!|$?=`", r_ptr->d_char)) return (FALSE);
+ if (!strchr("!|$?=", r_ptr->d_char)) return (FALSE);
/* Okay */
return (TRUE);
/* Validate the monster */
if (!vault_monster_okay(r_idx)) return (FALSE);
- if (r_ptr->flags2 & (RF2_KILL_BODY)) return (FALSE);
+ if ((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW)) return (FALSE);
if (r_ptr->flags3 & (RF3_GOOD)) return (FALSE);
/* Validate the monster */
if (!vault_monster_okay(r_idx)) return (FALSE);
- if (r_ptr->flags2 & (RF2_KILL_BODY)) return (FALSE);
+ if ((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW)) return (FALSE);
if (r_ptr->flags3 & (RF3_EVIL)) return (FALSE);
/* Validate the monster */
if (!vault_monster_okay(r_idx)) return (FALSE);
- if (r_ptr->flags2 & (RF2_KILL_BODY)) return (FALSE);
+ if ((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW)) return (FALSE);
/* Require demon */
if (!(r_ptr->flags3 & RF3_DEMON)) return (FALSE);
/* Validate the monster */
if (!vault_monster_okay(r_idx)) return (FALSE);
- if (r_ptr->flags2 & (RF2_KILL_BODY)) return (FALSE);
+ if ((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW)) return (FALSE);
/* Require eldritch horror */
if (!(r_ptr->flags2 & (RF2_ELDRITCH_HORROR))) return (FALSE);
static void vault_prep_dragon(void)
{
/* Pick dragon type */
- switch (rand_int(6))
+ switch (randint0(6))
{
/* Black */
case 0:
}
-#define ROOM_PIT 0
-#define ROOM_NEST 1
+/*
+ * Helper function for "monster pit (dark elf)"
+ */
+static bool vault_aux_dark_elf(int r_idx)
+{
+ int i;
+ static int dark_elf_list[] =
+ {
+ MON_D_ELF, MON_D_ELF_MAGE, MON_D_ELF_WARRIOR, MON_D_ELF_PRIEST,
+ MON_D_ELF_LORD, MON_D_ELF_WARLOCK, MON_D_ELF_DRUID, MON_NIGHTBLADE,
+ MON_D_ELF_SORC, MON_D_ELF_SHADE, 0,
+ };
+
+ /* Validate the monster */
+ if (!vault_monster_okay(r_idx)) return FALSE;
+
+ /* Require dark elves */
+ for (i = 0; dark_elf_list[i]; i++)
+ if (r_idx == dark_elf_list[i]) return TRUE;
+
+ /* Assume not */
+ return FALSE;
+}
+
typedef struct vault_aux_type vault_aux_type;
};
-static vault_aux_type *pick_vault_type(vault_aux_type *l_ptr, int room)
+static int pick_vault_type(vault_aux_type *l_ptr, s16b allow_flag_mask)
{
int tmp, total, count;
/* Ignore excessive depth */
if (n_ptr->level > dun_level) continue;
- if (room == ROOM_PIT)
- {
- if (!(d_info[dungeon_type].pit & (1L << count))) continue;
- }
- else if (room == ROOM_NEST)
- {
- if(!(d_info[dungeon_type].nest & (1L << count))) continue;
- }
+ /* Not matched with pit/nest flag */
+ if (!(allow_flag_mask & (1L << count))) continue;
/* Count this possibility */
total += n_ptr->chance * MAX_DEPTH / (MIN(dun_level, MAX_DEPTH - 1) - n_ptr->level + 5);
}
/* Pick a random type */
- tmp = rand_int(total);
+ tmp = randint0(total);
/* Find this type */
for (n_ptr = l_ptr, total = 0, count = 0; TRUE; n_ptr++, count++)
/* Ignore excessive depth */
if (n_ptr->level > dun_level) continue;
- if (room == ROOM_PIT)
- {
- if (!(d_info[dungeon_type].pit & (1L << count))) continue;
- }
- else if (room == ROOM_NEST)
- {
- if(!(d_info[dungeon_type].nest & (1L << count))) continue;
- }
+ /* Not matched with pit/nest flag */
+ if (!(allow_flag_mask & (1L << count))) continue;
/* Count this possibility */
total += n_ptr->chance * MAX_DEPTH / (MIN(dun_level, MAX_DEPTH - 1) - n_ptr->level + 5);
if (tmp < total) break;
}
- return (n_ptr->name ? n_ptr : NULL);
+ return n_ptr->name ? count : -1;
}
-void build_type6(int by0, int bx0, bool nest);
-void build_type5(int by0, int bx0, bool nest);
+static void build_type6(int by0, int bx0, bool nest);
+static void build_type5(int by0, int bx0, bool nest);
static vault_aux_type nest_types[] =
{
#ifdef JP
- {"¥¯¥í¡¼¥ó", vault_aux_clone, vault_prep_clone, 5, 3},
- {"¥¼¥ê¡¼", vault_aux_jelly, NULL, 5, 6},
- {"¥·¥ó¥Ü¥ë(Á±)",vault_aux_symbol_g, vault_prep_symbol, 25, 2},
- {"¥·¥ó¥Ü¥ë(°)",vault_aux_symbol_e, vault_prep_symbol, 25, 2},
- {"¥ß¥ß¥Ã¥¯", vault_aux_mimic, NULL, 30, 4},
- {"¶¸µ¤", vault_aux_cthulhu, NULL, 70, 2},
- {"¸¤¾®²°", vault_aux_kennel, NULL, 45, 4},
- {"ưʪ±à", vault_aux_animal, NULL, 35, 5},
- {"¶µ²ñ", vault_aux_chapel_g, NULL, 75, 4},
- {"¥¢¥ó¥Ç¥Ã¥É", vault_aux_undead, NULL, 75, 5},
- {NULL, NULL, NULL, 0, 0},
+ {"¥¯¥í¡¼¥ó", vault_aux_clone, vault_prep_clone, 5, 3},
+ {"¥¼¥ê¡¼", vault_aux_jelly, NULL, 5, 6},
+ {"¥·¥ó¥Ü¥ë(Á±)", vault_aux_symbol_g, vault_prep_symbol, 25, 2},
+ {"¥·¥ó¥Ü¥ë(°)", vault_aux_symbol_e, vault_prep_symbol, 25, 2},
+ {"¥ß¥ß¥Ã¥¯", vault_aux_mimic, NULL, 30, 4},
+ {"¶¸µ¤", vault_aux_cthulhu, NULL, 70, 2},
+ {"¸¤¾®²°", vault_aux_kennel, NULL, 45, 4},
+ {"ưʪ±à", vault_aux_animal, NULL, 35, 5},
+ {"¶µ²ñ", vault_aux_chapel_g, NULL, 75, 4},
+ {"¥¢¥ó¥Ç¥Ã¥É", vault_aux_undead, NULL, 75, 5},
+ {NULL, NULL, NULL, 0, 0},
+#else
+ {"clone", vault_aux_clone, vault_prep_clone, 5, 3},
+ {"jelly", vault_aux_jelly, NULL, 5, 6},
+ {"symbol good", vault_aux_symbol_g, vault_prep_symbol, 25, 2},
+ {"symbol evil", vault_aux_symbol_e, vault_prep_symbol, 25, 2},
+ {"mimic", vault_aux_mimic, NULL, 30, 4},
+ {"lovecraftian", vault_aux_cthulhu, NULL, 70, 2},
+ {"kennel", vault_aux_kennel, NULL, 45, 4},
+ {"animal", vault_aux_animal, NULL, 35, 5},
+ {"chapel", vault_aux_chapel_g, NULL, 75, 4},
+ {"undead", vault_aux_undead, NULL, 75, 5},
+ {NULL, NULL, NULL, 0, 0},
+#endif
+};
+
+static vault_aux_type pit_types[] =
+{
+#ifdef JP
+ {"¥ª¡¼¥¯", vault_aux_orc, NULL, 5, 6},
+ {"¥È¥í¥ë", vault_aux_troll, NULL, 20, 6},
+ {"¥¸¥ã¥¤¥¢¥ó¥È", vault_aux_giant, NULL, 50, 6},
+ {"¶¸µ¤", vault_aux_cthulhu, NULL, 80, 2},
+ {"¥·¥ó¥Ü¥ë(Á±)", vault_aux_symbol_g, vault_prep_symbol, 70, 1},
+ {"¥·¥ó¥Ü¥ë(°)", vault_aux_symbol_e, vault_prep_symbol, 70, 1},
+ {"¶µ²ñ", vault_aux_chapel_g, NULL, 65, 2},
+ {"¥É¥é¥´¥ó", vault_aux_dragon, vault_prep_dragon, 70, 6},
+ {"¥Ç¡¼¥â¥ó", vault_aux_demon, NULL, 80, 6},
+ {"¥À¡¼¥¯¥¨¥ë¥Õ", vault_aux_dark_elf, NULL, 45, 4},
+ {NULL, NULL, NULL, 0, 0},
#else
- {"clone", vault_aux_clone, vault_prep_clone, 7, 3},
- {"jelly", vault_aux_jelly, NULL, 7, 6},
- {"symbol good",vault_aux_symbol_g, vault_prep_symbol, 25, 2},
- {"symbol evil",vault_aux_symbol_e, vault_prep_symbol, 25, 2},
- {"mimic", vault_aux_mimic, NULL, 45, 6},
- {"lovecraftian",vault_aux_cthulhu, NULL, 80, 2},
- {"kennel", vault_aux_kennel, NULL, 50, 2},
- {"animal", vault_aux_animal, NULL, 50, 4},
- {"chapel", vault_aux_chapel_g, NULL, 90, 2},
- {"undead", vault_aux_undead, NULL, 90, 4},
- {NULL, NULL, NULL, 0, 0},
+ {"orc", vault_aux_orc, NULL, 5, 6},
+ {"troll", vault_aux_troll, NULL, 20, 6},
+ {"giant", vault_aux_giant, NULL, 50, 6},
+ {"lovecraftian", vault_aux_cthulhu, NULL, 80, 2},
+ {"symbol good", vault_aux_symbol_g, vault_prep_symbol, 70, 1},
+ {"symbol evil", vault_aux_symbol_e, vault_prep_symbol, 70, 1},
+ {"chapel", vault_aux_chapel_g, NULL, 65, 2},
+ {"dragon", vault_aux_dragon, vault_prep_dragon, 70, 6},
+ {"demon", vault_aux_demon, NULL, 80, 6},
+ {"dark elf", vault_aux_dark_elf, NULL, 45, 4},
+ {NULL, NULL, NULL, 0, 0},
#endif
};
+/* Nest types code */
+#define NEST_TYPE_CLONE 0
+#define NEST_TYPE_JELLY 1
+#define NEST_TYPE_SYMBOL_GOOD 2
+#define NEST_TYPE_SYMBOL_EVIL 3
+#define NEST_TYPE_MIMIC 4
+#define NEST_TYPE_LOVECRAFTIAN 5
+#define NEST_TYPE_KENNEL 6
+#define NEST_TYPE_ANIMAL 7
+#define NEST_TYPE_CHAPEL 8
+#define NEST_TYPE_UNDEAD 9
+
+/* Pit types code */
+#define PIT_TYPE_ORC 0
+#define PIT_TYPE_TROLL 1
+#define PIT_TYPE_GIANT 2
+#define PIT_TYPE_LOVECRAFTIAN 3
+#define PIT_TYPE_SYMBOL_GOOD 4
+#define PIT_TYPE_SYMBOL_EVIL 5
+#define PIT_TYPE_CHAPEL 6
+#define PIT_TYPE_DRAGON 7
+#define PIT_TYPE_DEMON 8
+#define PIT_TYPE_DARK_ELF 9
+
+
+/*
+ * Hack -- Get the string describing subtype of pit/nest
+ * Determined in prepare function (some pit/nest only)
+ */
+static cptr pit_subtype_string(int type, bool nest)
+{
+ static char inner_buf[256] = "";
+
+ inner_buf[0] = '\0'; /* Init string */
+
+ if (nest) /* Nests */
+ {
+ switch (type)
+ {
+ case NEST_TYPE_CLONE:
+ sprintf(inner_buf, "(%s)", r_name + r_info[vault_aux_race].name);
+ break;
+ case NEST_TYPE_SYMBOL_GOOD:
+ case NEST_TYPE_SYMBOL_EVIL:
+ sprintf(inner_buf, "(%c)", vault_aux_char);
+ break;
+ }
+ }
+ else /* Pits */
+ {
+ switch (type)
+ {
+ case PIT_TYPE_SYMBOL_GOOD:
+ case PIT_TYPE_SYMBOL_EVIL:
+ sprintf(inner_buf, "(%c)", vault_aux_char);
+ break;
+ case PIT_TYPE_DRAGON:
+ switch (vault_aux_dragon_mask4)
+ {
+#ifdef JP
+ case RF4_BR_ACID: strcpy(inner_buf, "(»À)"); break;
+ case RF4_BR_ELEC: strcpy(inner_buf, "(°ðºÊ)"); break;
+ case RF4_BR_FIRE: strcpy(inner_buf, "(²Ð±ê)"); break;
+ case RF4_BR_COLD: strcpy(inner_buf, "(Î䵤)"); break;
+ case RF4_BR_POIS: strcpy(inner_buf, "(ÆÇ)"); break;
+ case (RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS):
+ strcpy(inner_buf, "(Ëü¿§)"); break;
+ default: strcpy(inner_buf, "(̤ÄêµÁ)"); break;
+#else
+ case RF4_BR_ACID: strcpy(inner_buf, "(acid)"); break;
+ case RF4_BR_ELEC: strcpy(inner_buf, "(lightning)"); break;
+ case RF4_BR_FIRE: strcpy(inner_buf, "(fire)"); break;
+ case RF4_BR_COLD: strcpy(inner_buf, "(frost)"); break;
+ case RF4_BR_POIS: strcpy(inner_buf, "(poison)"); break;
+ case (RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS):
+ strcpy(inner_buf, "(multi-hued)"); break;
+ default: strcpy(inner_buf, "(undefined)"); break;
+#endif
+ }
+ break;
+ }
+ }
+
+ return inner_buf;
+}
+
+
+/* A struct for nest monster information with cheat_hear */
+typedef struct
+{
+ s16b r_idx;
+ bool used;
+}
+nest_mon_info_type;
+
+
+/*
+ * Comp function for sorting nest monster information
+ */
+static bool ang_sort_comp_nest_mon_info(vptr u, vptr v, int a, int b)
+{
+ nest_mon_info_type *nest_mon_info = (nest_mon_info_type *)u;
+ int w1 = nest_mon_info[a].r_idx;
+ int w2 = nest_mon_info[b].r_idx;
+ monster_race *r1_ptr = &r_info[w1];
+ monster_race *r2_ptr = &r_info[w2];
+ int z1, z2;
+
+ /* Unused */
+ (void)v;
+
+ /* Extract used info */
+ z1 = nest_mon_info[a].used;
+ z2 = nest_mon_info[b].used;
+
+ /* Compare used status */
+ if (z1 < z2) return FALSE;
+ if (z1 > z2) return TRUE;
+
+ /* Compare levels */
+ if (r1_ptr->level < r2_ptr->level) return TRUE;
+ if (r1_ptr->level > r2_ptr->level) return FALSE;
+
+ /* Compare experience */
+ if (r1_ptr->mexp < r2_ptr->mexp) return TRUE;
+ if (r1_ptr->mexp > r2_ptr->mexp) return FALSE;
+
+ /* Compare indexes */
+ return w1 <= w2;
+}
+
+
+/*
+ * Swap function for sorting nest monster information
+ */
+static void ang_sort_swap_nest_mon_info(vptr u, vptr v, int a, int b)
+{
+ nest_mon_info_type *nest_mon_info = (nest_mon_info_type *)u;
+ nest_mon_info_type holder;
+
+ /* Unused */
+ (void)v;
+
+ /* Swap */
+ holder = nest_mon_info[a];
+ nest_mon_info[a] = nest_mon_info[b];
+ nest_mon_info[b] = holder;
+}
+
+
+#define NUM_NEST_MON_TYPE 64
+
/*
* Type 5 -- Monster nests
*
*
* Note that "monster nests" will never contain "unique" monsters.
*/
-void build_type5(int by0, int bx0, bool pit)
+static void build_type5(int by0, int bx0, bool pit)
{
int y, x, y1, x1, y2, x2, xval, yval;
int i;
- int what[64];
+ nest_mon_info_type nest_mon_info[NUM_NEST_MON_TYPE];
- int align = 0;
+ monster_type align;
cave_type *c_ptr;
- vault_aux_type *n_ptr = pick_vault_type(nest_types, ROOM_NEST);
+ int cur_nest_type = pick_vault_type(nest_types, d_info[dungeon_type].nest);
+ vault_aux_type *n_ptr;
/* Try to allocate space for room. */
if (!room_alloc(25, 11, TRUE, by0, bx0, &xval, &yval)) return;
/* No type available */
- if (!n_ptr)
+ if (cur_nest_type < 0)
{
if (pit) return;
- else {build_type6(by0, bx0, TRUE);return;}
+ else
+ {
+ build_type6(by0, bx0, TRUE);
+ return;
+ }
}
+ n_ptr = &nest_types[cur_nest_type];
+
/* Process a preparation function if necessary */
if (n_ptr->prep_func) (*(n_ptr->prep_func))();
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
/* Prepare allocation table */
get_mon_num_prep(n_ptr->hook_func, NULL);
+ align.sub_align = SUB_ALIGN_NEUTRAL;
+
/* Pick some monster types */
- for (i = 0; i < 64; i++)
- {
+ for (i = 0; i < NUM_NEST_MON_TYPE; i++)
+ {
int r_idx = 0, attempts = 100;
+ monster_race *r_ptr = NULL;
while (attempts--)
- {
+ {
/* Get a (hard) monster type */
r_idx = get_mon_num(dun_level + 10);
+ r_ptr = &r_info[r_idx];
/* Decline incorrect alignment */
- if (((align < 0) && (r_info[r_idx].flags3 & RF3_GOOD)) ||
- ((align > 0) && (r_info[r_idx].flags3 & RF3_EVIL)))
- {
- continue;
- }
+ if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;
/* Accept this monster */
break;
if (!r_idx || !attempts) return;
/* Note the alignment */
- if (r_info[r_idx].flags3 & RF3_GOOD) align++;
- else if (r_info[r_idx].flags3 & RF3_EVIL) align--;
+ if (r_ptr->flags3 & RF3_EVIL) align.sub_align |= SUB_ALIGN_EVIL;
+ if (r_ptr->flags3 & RF3_GOOD) align.sub_align |= SUB_ALIGN_GOOD;
- what[i] = r_idx;
+ nest_mon_info[i].r_idx = r_idx;
+ nest_mon_info[i].used = FALSE;
}
/* Describe */
{
/* Room type */
#ifdef JP
-msg_format("¥â¥ó¥¹¥¿¡¼Éô²°(%s)", n_ptr->name);
+ msg_format("¥â¥ó¥¹¥¿¡¼Éô²°(nest)(%s%s)", n_ptr->name, pit_subtype_string(cur_nest_type, TRUE));
#else
- msg_format("Monster nest (%s)", n_ptr->name);
+ msg_format("Monster nest (%s%s)", n_ptr->name, pit_subtype_string(cur_nest_type, TRUE));
#endif
-
}
-
/* Increase the level rating */
rating += 10;
/* (Sometimes) Cause a "special feeling" (for "Monster Nests") */
- if ((dun_level <= 40) && (randint(dun_level * dun_level + 50) < 300))
+ if ((dun_level <= 40) && (randint1(dun_level * dun_level + 50) < 300))
{
good_item_flag = TRUE;
}
{
for (x = xval - 9; x <= xval + 9; x++)
{
- int r_idx = what[rand_int(64)];
+ int r_idx;
+
+ i = randint0(NUM_NEST_MON_TYPE);
+ r_idx = nest_mon_info[i].r_idx;
/* Place that "random" monster (no groups) */
- (void)place_monster_aux(y, x, r_idx, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
+ (void)place_monster_aux(0, y, x, r_idx, 0L);
+
+ nest_mon_info[i].used = TRUE;
}
}
-}
+ if (cheat_room && cheat_hear)
+ {
+ ang_sort_comp = ang_sort_comp_nest_mon_info;
+ ang_sort_swap = ang_sort_swap_nest_mon_info;
+ ang_sort(nest_mon_info, NULL, NUM_NEST_MON_TYPE);
-static vault_aux_type pit_types[] =
-{
-#ifdef JP
- {"¥ª¡¼¥¯", vault_aux_orc, NULL, 5, 6},
- {"¥È¥í¥ë", vault_aux_troll, NULL, 20, 6},
- {"¥¸¥ã¥¤¥¢¥ó¥È",vault_aux_giant, NULL, 50, 6},
- {"¶¸µ¤", vault_aux_cthulhu, NULL, 80, 2},
- {"¥·¥ó¥Ü¥ë(Á±)",vault_aux_symbol_g, vault_prep_symbol, 70, 1},
- {"¥·¥ó¥Ü¥ë(°)",vault_aux_symbol_e, vault_prep_symbol, 70, 1},
- {"¶µ²ñ", vault_aux_chapel_g, NULL, 65, 2},
- {"¥É¥é¥´¥ó", vault_aux_dragon, vault_prep_dragon, 70, 6},
- {"¥Ç¡¼¥â¥ó", vault_aux_demon, NULL, 80, 6},
- {NULL, NULL, NULL, 0, 0},
-#else
- {"orc", vault_aux_orc, NULL, 7, 4},
- {"troll", vault_aux_troll, NULL, 35, 4},
- {"giant", vault_aux_giant, NULL, 70, 4},
- {"lovecraftian",vault_aux_cthulhu, NULL, 90, 4},
- {"symbol good",vault_aux_symbol_g, vault_prep_symbol, 25, 2},
- {"symbol evil",vault_aux_symbol_e, vault_prep_symbol, 25, 2},
- {"chapel", vault_aux_chapel_g, NULL, 85, 1},
- {"dragon", vault_aux_dragon, vault_prep_dragon, 80, 4},
- {"demon", vault_aux_demon, NULL, 90, 4},
- {NULL, NULL, NULL, 0, 0},
-#endif
-};
+ /* Dump the entries (prevent multi-printing) */
+ for (i = 0; i < NUM_NEST_MON_TYPE; i++)
+ {
+ if (!nest_mon_info[i].used) break;
+ for (; i < NUM_NEST_MON_TYPE - 1; i++)
+ {
+ if (nest_mon_info[i].r_idx != nest_mon_info[i + 1].r_idx) break;
+ if (!nest_mon_info[i + 1].used) break;
+ }
+ msg_print(r_name + r_info[nest_mon_info[i].r_idx].name);
+ }
+ }
+}
/*
*
* Note that "monster pits" will never contain "unique" monsters.
*/
-void build_type6(int by0, int bx0, bool nest)
+static void build_type6(int by0, int bx0, bool nest)
{
int y, x, y1, x1, y2, x2, xval, yval;
int i, j;
int what[16];
- int align = 0;
+ monster_type align;
cave_type *c_ptr;
- vault_aux_type *n_ptr = pick_vault_type(pit_types, ROOM_PIT);
+ int cur_pit_type = pick_vault_type(pit_types, d_info[dungeon_type].pit);
+ vault_aux_type *n_ptr;
/* Try to allocate space for room. */
if (!room_alloc(25, 11, TRUE, by0, bx0, &xval, &yval)) return;
/* No type available */
- if (!n_ptr)
+ if (cur_pit_type < 0)
{
if (nest) return;
- else {build_type5(by0, bx0, TRUE);return;}
+ else
+ {
+ build_type5(by0, bx0, TRUE);
+ return;
+ }
}
+ n_ptr = &pit_types[cur_pit_type];
+
/* Process a preparation function if necessary */
if (n_ptr->prep_func) (*(n_ptr->prep_func))();
}
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
/* Prepare allocation table */
get_mon_num_prep(n_ptr->hook_func, NULL);
+ align.sub_align = SUB_ALIGN_NEUTRAL;
+
/* Pick some monster types */
for (i = 0; i < 16; i++)
{
int r_idx = 0, attempts = 100;
+ monster_race *r_ptr = NULL;
while (attempts--)
{
/* Get a (hard) monster type */
r_idx = get_mon_num(dun_level + 10);
+ r_ptr = &r_info[r_idx];
/* Decline incorrect alignment */
- if (((align < 0) && (r_info[r_idx].flags3 & RF3_GOOD)) ||
- ((align > 0) && (r_info[r_idx].flags3 & RF3_EVIL)))
- {
- continue;
- }
+ if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;
/* Accept this monster */
break;
if (!r_idx || !attempts) return;
/* Note the alignment */
- if (r_info[r_idx].flags3 & RF3_GOOD) align++;
- else if (r_info[r_idx].flags3 & RF3_EVIL) align--;
+ if (r_ptr->flags3 & RF3_EVIL) align.sub_align |= SUB_ALIGN_EVIL;
+ if (r_ptr->flags3 & RF3_GOOD) align.sub_align |= SUB_ALIGN_GOOD;
what[i] = r_idx;
}
/* Message */
if (cheat_room)
{
+ /* Room type */
#ifdef JP
-msg_format("%s¤ÎÁã", n_ptr->name);
+ msg_format("¥â¥ó¥¹¥¿¡¼Éô²°(pit)(%s%s)", n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
#else
- /* Room type */
- msg_format("Monster pit (%s)", n_ptr->name);
+ msg_format("Monster pit (%s%s)", n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
#endif
}
rating += 10;
/* (Sometimes) Cause a "special feeling" (for "Monster Pits") */
- if ((dun_level <= 40) && (randint(dun_level * dun_level + 50) < 300))
+ if ((dun_level <= 40) && (randint1(dun_level * dun_level + 50) < 300))
{
good_item_flag = TRUE;
}
/* Top and bottom rows */
for (x = xval - 9; x <= xval + 9; x++)
{
- place_monster_aux(yval - 2, x, what[0], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(yval + 2, x, what[0], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, yval - 2, x, what[0], PM_NO_KAGE);
+ place_monster_aux(0, yval + 2, x, what[0], PM_NO_KAGE);
}
/* Middle columns */
for (y = yval - 1; y <= yval + 1; y++)
{
- place_monster_aux(y, xval - 9, what[0], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(y, xval + 9, what[0], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, y, xval - 9, what[0], PM_NO_KAGE);
+ place_monster_aux(0, y, xval + 9, what[0], PM_NO_KAGE);
- place_monster_aux(y, xval - 8, what[1], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(y, xval + 8, what[1], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, y, xval - 8, what[1], PM_NO_KAGE);
+ place_monster_aux(0, y, xval + 8, what[1], PM_NO_KAGE);
- place_monster_aux(y, xval - 7, what[1], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(y, xval + 7, what[1], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, y, xval - 7, what[1], PM_NO_KAGE);
+ place_monster_aux(0, y, xval + 7, what[1], PM_NO_KAGE);
- place_monster_aux(y, xval - 6, what[2], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(y, xval + 6, what[2], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, y, xval - 6, what[2], PM_NO_KAGE);
+ place_monster_aux(0, y, xval + 6, what[2], PM_NO_KAGE);
- place_monster_aux(y, xval - 5, what[2], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(y, xval + 5, what[2], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, y, xval - 5, what[2], PM_NO_KAGE);
+ place_monster_aux(0, y, xval + 5, what[2], PM_NO_KAGE);
- place_monster_aux(y, xval - 4, what[3], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(y, xval + 4, what[3], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, y, xval - 4, what[3], PM_NO_KAGE);
+ place_monster_aux(0, y, xval + 4, what[3], PM_NO_KAGE);
- place_monster_aux(y, xval - 3, what[3], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(y, xval + 3, what[3], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, y, xval - 3, what[3], PM_NO_KAGE);
+ place_monster_aux(0, y, xval + 3, what[3], PM_NO_KAGE);
- place_monster_aux(y, xval - 2, what[4], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(y, xval + 2, what[4], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, y, xval - 2, what[4], PM_NO_KAGE);
+ place_monster_aux(0, y, xval + 2, what[4], PM_NO_KAGE);
}
/* Above/Below the center monster */
for (x = xval - 1; x <= xval + 1; x++)
{
- place_monster_aux(yval + 1, x, what[5], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(yval - 1, x, what[5], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, yval + 1, x, what[5], PM_NO_KAGE);
+ place_monster_aux(0, yval - 1, x, what[5], PM_NO_KAGE);
}
/* Next to the center monster */
- place_monster_aux(yval, xval + 1, what[6], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
- place_monster_aux(yval, xval - 1, what[6], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, yval, xval + 1, what[6], PM_NO_KAGE);
+ place_monster_aux(0, yval, xval - 1, what[6], PM_NO_KAGE);
/* Center monster */
- place_monster_aux(yval, xval, what[7], FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
+ place_monster_aux(0, yval, xval, what[7], PM_NO_KAGE);
}
/* Lay down a floor */
place_floor_grid(c_ptr);
+ /* Remove any mimic */
+ c_ptr->mimic = 0;
+
/* Part of a vault */
c_ptr->info |= (CAVE_ROOM | CAVE_ICKY);
/* Treasure/trap */
case '*':
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
- place_object(y, x, FALSE, FALSE);
+ place_object(y, x, 0L);
}
else
{
case '^':
place_trap(y, x);
break;
+
+ /* Black market in a dungeon */
+ case 'S':
+ set_cave_feat(y, x, FEAT_SHOP_HEAD + STORE_BLACK);
+ store_init(NO_TOWN, STORE_BLACK);
+ break;
+
+ /* The Pattern */
+ case 'p':
+ set_cave_feat(y, x, FEAT_PATTERN_START);
+ break;
+
+ case 'a':
+ set_cave_feat(y, x, FEAT_PATTERN_1);
+ break;
+
+ case 'b':
+ set_cave_feat(y, x, FEAT_PATTERN_2);
+ break;
+
+ case 'c':
+ set_cave_feat(y, x, FEAT_PATTERN_3);
+ break;
+
+ case 'd':
+ set_cave_feat(y, x, FEAT_PATTERN_4);
+ break;
+
+ case 'P':
+ set_cave_feat(y, x, FEAT_PATTERN_END);
+ break;
+
+ case 'B':
+ set_cave_feat(y, x, FEAT_PATTERN_XTRA1);
+ break;
+
+ case 'A':
+ /* Reward for Pattern walk */
+ object_level = base_level + 12;
+ place_object(y, x, AM_GOOD | AM_GREAT);
+ object_level = base_level;
+ break;
}
}
}
case '&':
{
monster_level = base_level + 5;
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
monster_level = base_level;
break;
}
case '@':
{
monster_level = base_level + 11;
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
monster_level = base_level;
break;
}
case '9':
{
monster_level = base_level + 9;
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, PM_ALLOW_SLEEP);
monster_level = base_level;
object_level = base_level + 7;
- place_object(y, x, TRUE, FALSE);
+ place_object(y, x, AM_GOOD);
object_level = base_level;
break;
}
case '8':
{
monster_level = base_level + 40;
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, PM_ALLOW_SLEEP);
monster_level = base_level;
object_level = base_level + 20;
- place_object(y, x, TRUE, TRUE);
+ place_object(y, x, AM_GOOD | AM_GREAT);
object_level = base_level;
break;
}
/* Monster and/or object */
case ',':
{
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
monster_level = base_level + 3;
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
monster_level = base_level;
}
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
object_level = base_level + 7;
- place_object(y, x, FALSE, FALSE);
+ place_object(y, x, 0L);
object_level = base_level;
}
break;
}
- case 'S':
- cave_set_feat(y, x, FEAT_SHOP_HEAD + STORE_BLACK);
- store_init(NO_TOWN, STORE_BLACK);
- break;
-
- case 'p':
- cave_set_feat(y, x, FEAT_PATTERN_START);
- break;
-
- case 'a':
- cave_set_feat(y, x, FEAT_PATTERN_1);
- break;
-
- case 'b':
- cave_set_feat(y, x, FEAT_PATTERN_2);
- break;
-
- case 'c':
- cave_set_feat(y, x, FEAT_PATTERN_3);
- break;
-
- case 'd':
- cave_set_feat(y, x, FEAT_PATTERN_4);
- break;
-
- case 'P':
- cave_set_feat(y, x, FEAT_PATTERN_END);
- break;
-
- case 'B':
- cave_set_feat(y, x, FEAT_PATTERN_XTRA1);
- break;
-
- case 'A':
- {
- object_level = base_level + 12;
- place_object(y, x, TRUE, FALSE);
- object_level = base_level;
- }
- break;
}
}
}
dummy++;
/* Access a random vault record */
- v_ptr = &v_info[rand_int(max_v_idx)];
+ v_ptr = &v_info[randint0(max_v_idx)];
/* Accept the first lesser vault */
if (v_ptr->typ == 7) break;
if (!v_ptr) return;
/* pick type of transformation (0-7) */
- transno = rand_int(8);
+ transno = randint0(8);
/* calculate offsets */
x = v_ptr->wid;
/* (Sometimes) Cause a special feeling */
if ((dun_level <= 50) ||
- (randint((dun_level - 40) * (dun_level - 40) + 50) < 400))
+ (randint1((dun_level - 40) * (dun_level - 40) + 50) < 400))
{
good_item_flag = TRUE;
}
/* Hack -- Build the vault */
build_vault(yval, xval, v_ptr->hgt, v_ptr->wid,
- v_text + v_ptr->text, xoffset, yoffset, transno);
+ v_text + v_ptr->text, xoffset, yoffset, transno);
}
dummy++;
/* Access a random vault record */
- v_ptr = &v_info[rand_int(max_v_idx)];
+ v_ptr = &v_info[randint0(max_v_idx)];
/* Accept the first greater vault */
if (v_ptr->typ == 8) break;
if (!v_ptr) return;
/* pick type of transformation (0-7) */
- transno = rand_int(8);
+ transno = randint0(8);
/* calculate offsets */
x = v_ptr->wid;
yoffset = 0;
}
- /* Try to allocate space for room. If fails, exit */
- if (!room_alloc(abs(x), abs(y), FALSE, by0, bx0, &xval, &yval)) return;
+ /*
+ * Try to allocate space for room. If fails, exit
+ *
+ * Hack -- Prepare a bit larger space (+2, +2) to
+ * prevent generation of vaults with no-entrance.
+ */
+ if (!room_alloc(abs(x) + 2, abs(y) + 2, FALSE, by0, bx0, &xval, &yval)) return;
if (dummy >= SAFE_MAX_ATTEMPTS)
{
#ifdef FORCE_V_IDX
- v_ptr = &v_info[76 + randint(3)];
+ v_ptr = &v_info[76 + randint1(3)];
#endif
/* Message */
/* (Sometimes) Cause a special feeling */
if ((dun_level <= 50) ||
- (randint((dun_level - 40) * (dun_level - 40) + 50) < 400))
+ (randint1((dun_level - 40) * (dun_level - 40) + 50) < 400))
{
good_item_flag = TRUE;
}
/* Hack -- Build the vault */
build_vault(yval, xval, v_ptr->hgt, v_ptr->wid,
- v_text + v_ptr->text, xoffset, yoffset, transno);
+ v_text + v_ptr->text, xoffset, yoffset, transno);
}
/*
if (xhstep2 > grd)
{
/* If greater than 'grid' level then is random */
- store_height(ii, jj, randint(maxsize));
+ store_height(ii, jj, randint1(maxsize));
}
- else
+ else
{
/* Average of left and right points +random bit */
store_height(ii, jj,
(cave[jj][fill_data.xmin + (i - xhstep) / 256].feat
+ cave[jj][fill_data.xmin + (i + xhstep) / 256].feat) / 2
- + (randint(xstep2) - xhstep2) * roug / 16);
+ + (randint1(xstep2) - xhstep2) * roug / 16);
}
}
}
for (j = yhstep; j <= yysize - yhstep; j += ystep)
{
for (i = 0; i <= xxsize; i += xstep)
- {
+ {
/* cache often used values */
ii = i / 256 + fill_data.xmin;
jj = j / 256 + fill_data.ymin;
if (xhstep2 > grd)
{
/* If greater than 'grid' level then is random */
- store_height(ii, jj, randint(maxsize));
+ store_height(ii, jj, randint1(maxsize));
}
- else
+ else
{
/* Average of up and down points +random bit */
store_height(ii, jj,
(cave[fill_data.ymin + (j - yhstep) / 256][ii].feat
+ cave[fill_data.ymin + (j + yhstep) / 256][ii].feat) / 2
- + (randint(ystep2) - yhstep2) * roug / 16);
+ + (randint1(ystep2) - yhstep2) * roug / 16);
}
}
}
{
for (j = yhstep; j <= yysize - yhstep; j += ystep)
{
- /* cache often used values */
+ /* cache often used values */
ii = i / 256 + fill_data.xmin;
jj = j / 256 + fill_data.ymin;
if (xhstep2 > grd)
{
/* If greater than 'grid' level then is random */
- store_height(ii, jj, randint(maxsize));
+ store_height(ii, jj, randint1(maxsize));
}
- else
+ else
{
/* Cache reused values. */
xm = fill_data.xmin + (i - xhstep) / 256;
store_height(ii, jj,
(cave[ym][xm].feat + cave[yp][xm].feat
+ cave[ym][xp].feat + cave[yp][xp].feat) / 4
- + (randint(xstep2) - xhstep2) * (diagsize / 16) / 256 * roug);
+ + (randint1(xstep2) - xhstep2) * (diagsize / 16) / 256 * roug);
}
}
}
if (cave[y][x].feat <= c1)
{
/* 25% of the time use the other tile : it looks better this way */
- if (randint(100) < 75)
+ if (randint1(100) < 75)
{
cave[y][x].feat = feat1;
cave[y][x].info &= ~(CAVE_MASK);
else if (cave[y][x].feat <= c2)
{
/* 25% of the time use the other tile : it looks better this way */
- if (randint(100) < 75)
+ if (randint1(100) < 75)
{
cave[y][x].feat = feat2;
cave[y][x].info &= ~(CAVE_MASK);
fill_data.c1, fill_data.c2, fill_data.c3,
fill_data.feat1, fill_data.feat2, fill_data.feat3,
fill_data.info1, fill_data.info2, fill_data.info3))
- {
+ {
/* Enqueue that entry */
temp_y[flow_tail] = j;
temp_x[flow_tail] = i;
fill_data.c3 = 0;
/* features to fill with */
- fill_data.feat1 = floor_type[rand_int(100)];
- fill_data.feat2 = floor_type[rand_int(100)];
- fill_data.feat3 = floor_type[rand_int(100)];
+ fill_data.feat1 = floor_type[randint0(100)];
+ fill_data.feat2 = floor_type[randint0(100)];
+ fill_data.feat3 = floor_type[randint0(100)];
fill_data.info1 = CAVE_FLOOR;
fill_data.info2 = CAVE_FLOOR;
if (room) cave[y0 + y - yhsize][x0 + x - xhsize].info |= (CAVE_ROOM);
}
else if (is_outer_bold(y0 + y - yhsize, x0 + x - xhsize) &&
- (cave[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY))
+ (cave[y0 + y - yhsize][x0 + x - xhsize].info & CAVE_ICKY))
{
/* Walls */
cave[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY);
bool done, light, room;
/* get size: note 'Evenness'*/
- xsize = randint(22) * 2 + 6;
- ysize = randint(15) * 2 + 6;
+ xsize = randint1(22) * 2 + 6;
+ ysize = randint1(15) * 2 + 6;
/* Try to allocate space for room. If fails, exit */
if (!room_alloc(xsize + 1, ysize + 1, FALSE, by0, bx0, &x0, &y0)) return;
light = done = FALSE;
room = TRUE;
- if ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+ if ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
while (!done)
{
* This causes the tunnels not to connect properly to the room */
/* testing values for these parameters feel free to adjust */
- grd = 1 << (rand_int(4));
+ grd = 1 << (randint0(4));
/* want average of about 16 */
- roug = randint(8) * randint(4);
+ roug = randint1(8) * randint1(4);
/* about size/2 */
- cutoff = randint(xsize / 4) + randint(ysize / 4) +
- randint(xsize / 4) + randint(ysize / 4);
+ cutoff = randint1(xsize / 4) + randint1(ysize / 4) +
+ randint1(xsize / 4) + randint1(ysize / 4);
/* make it */
generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);
bool done, light;
light = done = FALSE;
- if ((dun_level <= randint(50)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+ if ((dun_level <= randint1(50)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
/* Make a cave the size of the dungeon */
xsize = cur_wid - 1;
while (!done)
{
/* testing values for these parameters: feel free to adjust */
- grd = randint(4) + 4;
+ grd = randint1(4) + 4;
/* want average of about 16 */
- roug = randint(8) * randint(4);
+ roug = randint1(8) * randint1(4);
/* about size/2 */
cutoff = xsize / 2;
/* Get features based on type */
switch (type)
{
- case 1: {
- /* Lava */
- feat1 = FEAT_DEEP_LAVA;
- feat2 = FEAT_SHAL_LAVA;
- feat3 = floor_type[rand_int(100)];
- }; break;
- case 2:{
- /* Water */
- feat1 = FEAT_DEEP_WATER;
- feat2 = FEAT_SHAL_WATER;
- feat3 = floor_type[rand_int(100)];
- }; break;
- case 3: {
- /* Collapsed cave */
- feat1 = floor_type[rand_int(100)];
- feat2 = floor_type[rand_int(100)];
- feat3 = FEAT_RUBBLE;
- }; break;
- case 4: {
- /* Earth vault */
- feat1 = FEAT_RUBBLE;
- feat2 = floor_type[rand_int(100)];
- feat3 = FEAT_RUBBLE;
- }; break;
- case 5: {
- /* Air vault */
- feat1 = FEAT_GRASS;
- feat2 = FEAT_TREES;
- feat3 = FEAT_GRASS;
- }; break;
- case 6: {
- /* Water vault */
- feat1 = FEAT_SHAL_WATER;
- feat2 = FEAT_DEEP_WATER;
- feat3 = FEAT_SHAL_WATER;
- }; break;
- case 7: {
- /* Fire Vault */
- feat1 = FEAT_SHAL_LAVA;
- feat2 = FEAT_DEEP_LAVA;
- feat3 = FEAT_SHAL_LAVA;
- }; break;
-
- /* Paranoia */
- default: return FALSE;
+ case GEN_LAKE_TYPE_LAVA: /* Lava */
+ feat1 = FEAT_DEEP_LAVA;
+ feat2 = FEAT_SHAL_LAVA;
+ feat3 = floor_type[randint0(100)];
+ break;
+ case GEN_LAKE_TYPE_WATER: /* Water */
+ feat1 = FEAT_DEEP_WATER;
+ feat2 = FEAT_SHAL_WATER;
+ feat3 = floor_type[randint0(100)];
+ break;
+ case GEN_LAKE_TYPE_CAVE: /* Collapsed cave */
+ feat1 = floor_type[randint0(100)];
+ feat2 = floor_type[randint0(100)];
+ feat3 = FEAT_RUBBLE;
+ break;
+ case GEN_LAKE_TYPE_EARTH_VAULT: /* Earth vault */
+ feat1 = FEAT_RUBBLE;
+ feat2 = floor_type[randint0(100)];
+ feat3 = FEAT_RUBBLE;
+ break;
+ case GEN_LAKE_TYPE_AIR_VAULT: /* Air vault */
+ feat1 = FEAT_GRASS;
+ feat2 = FEAT_TREES;
+ feat3 = FEAT_GRASS;
+ break;
+ case GEN_LAKE_TYPE_WATER_VAULT: /* Water vault */
+ feat1 = FEAT_SHAL_WATER;
+ feat2 = FEAT_DEEP_WATER;
+ feat3 = FEAT_SHAL_WATER;
+ break;
+ case GEN_LAKE_TYPE_FIRE_VAULT: /* Fire Vault */
+ feat1 = FEAT_SHAL_LAVA;
+ feat2 = FEAT_DEEP_LAVA;
+ feat3 = FEAT_SHAL_LAVA;
+ break;
+
+ /* Paranoia */
+ default: return FALSE;
}
/*
* this gets rid of alot of isolated one-sqaures that
* can make teleport traps instadeaths...
*/
-
+
/* cutoffs */
fill_data.c1 = c1;
fill_data.c2 = c2;
if ((cave[y0 + y - yhsize][x0 + x - xhsize].feat == FEAT_DEEP_LAVA) ||
(cave[y0 + y - yhsize][x0 + x - xhsize].feat == FEAT_SHAL_LAVA))
{
- cave[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW;
+ if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) cave[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW;
}
}
}
int c1, c2, c3;
/* paranoia - exit if lake type out of range. */
- if ((type < 1) || (type > 7))
+ if ((type < GEN_LAKE_TYPE_LAVA) || (type > GEN_LAKE_TYPE_FIRE_VAULT))
{
msg_format("Invalid lake type (%d)", type);
return;
while (!done)
{
/* testing values for these parameters: feel free to adjust */
- grd = randint(3) + 4;
+ grd = randint1(3) + 4;
/* want average of about 16 */
- roug = randint(8) * randint(4);
+ roug = randint1(8) * randint1(4);
/* Make up size of various componants */
/* Floor */
c3 = 3 * xsize / 4;
/* Deep water/lava */
- c1 = rand_int(c3 / 2) + rand_int(c3 / 2) - 5;
+ c1 = randint0(c3 / 2) + randint0(c3 / 2) - 5;
/* Shallow boundary */
c2 = (c1 + c3) / 2;
{
/* Thing added based on distance to center of vault
* Difficulty is 1-easy to 10-hard */
- value = ((((s32b)(distance(cx, cy, x, y))) * 100) / size) + randint(10) - difficulty;
+ value = ((((s32b)(distance(cx, cy, x, y))) * 100) / size) + randint1(10) - difficulty;
/* hack- empty square part of the time */
- if ((randint(100) - difficulty * 3) > 50) value = 20;
+ if ((randint1(100) - difficulty * 3) > 50) value = 20;
/* if floor, shallow water and lava */
if (is_floor_bold(y, x) ||
{
/* Meanest monster + treasure */
monster_level = base_level + 40;
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
monster_level = base_level;
object_level = base_level + 20;
- place_object(y, x, TRUE, FALSE);
+ place_object(y, x, AM_GOOD);
object_level = base_level;
}
else if (value < 5)
{
/* Mean monster +treasure */
monster_level = base_level + 20;
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
monster_level = base_level;
object_level = base_level + 10;
- place_object(y, x, TRUE, FALSE);
+ place_object(y, x, AM_GOOD);
object_level = base_level;
}
else if (value < 10)
{
/* Monster */
monster_level = base_level + 9;
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
monster_level = base_level;
}
else if (value < 17)
else if (value < 23)
{
/* Object or trap */
- if (rand_int(100) < 25)
+ if (randint0(100) < 25)
{
- place_object(y, x, FALSE, FALSE);
+ place_object(y, x, 0L);
}
else
{
{
/* Monster and trap */
monster_level = base_level + 5;
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
monster_level = base_level;
place_trap(y, x);
}
else if (value < 40)
{
/* Monster or object */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
monster_level = base_level + 3;
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
monster_level = base_level;
}
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
object_level = base_level + 7;
- place_object(y, x, FALSE, FALSE);
+ place_object(y, x, 0L);
object_level = base_level;
}
}
/* Various Stuff */
/* 20% monster, 40% trap, 20% object, 20% blank space */
- if (rand_int(100) < 20)
+ if (randint0(100) < 20)
{
- place_monster(y, x, TRUE, TRUE);
+ place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
}
- else if (rand_int(100) < 50)
+ else if (randint0(100) < 50)
{
place_trap(y, x);
}
- else if (rand_int(100) < 50)
+ else if (randint0(100) < 50)
{
- place_object(y, x, FALSE, FALSE);
+ place_object(y, x, 0L);
}
}
if (cheat_room) msg_print("Bubble Vault");
/* Allocate center of bubbles */
- center[0].x = randint(xsize - 3) + 1;
- center[0].y = randint(ysize - 3) + 1;
+ center[0].x = randint1(xsize - 3) + 1;
+ center[0].y = randint1(ysize - 3) + 1;
for (i = 1; i < BUBBLENUM; i++)
{
{
done = TRUE;
- x = randint(xsize - 3) + 1;
- y = randint(ysize - 3) + 1;
+ x = randint1(xsize - 3) + 1;
+ y = randint1(ysize - 3) + 1;
for (j = 0; j < i; j++)
{
else if (temp < min2)
{
/* second smallest */
- min2 = temp;
+ min2 = temp;
}
}
if (((min2 - min1) <= 2) && (!(min1 < 3)))
/* Try to add some random doors */
for (i = 0; i < 500; i++)
{
- x = randint(xsize - 3) - xhsize + x0 + 1;
- y = randint(ysize - 3) - yhsize + y0 + 1;
+ x = randint1(xsize - 3) - xhsize + x0 + 1;
+ y = randint1(ysize - 3) - yhsize + y0 + 1;
add_door(x, y);
}
/* Fill with monsters and treasure, low difficulty */
- fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint(5));
+ fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5));
}
/* add ten random rooms */
for (i = 0; i < 10; i++)
{
- x1 = randint(xhsize) * 2 + x0 - xhsize;
- x2 = randint(xhsize) * 2 + x0 - xhsize;
- y1 = randint(yhsize) * 2 + y0 - yhsize;
- y2 = randint(yhsize) * 2 + y0 - yhsize;
+ x1 = randint1(xhsize) * 2 + x0 - xhsize;
+ x2 = randint1(xhsize) * 2 + x0 - xhsize;
+ y1 = randint1(yhsize) * 2 + y0 - yhsize;
+ y2 = randint1(yhsize) * 2 + y0 - yhsize;
build_room(x1, x2, y1, y2);
}
/* Add some random doors */
for (i = 0; i < 500; i++)
{
- x1 = randint(xsize - 3) - xhsize + x0 + 1;
- y1 = randint(ysize - 3) - yhsize + y0 + 1;
+ x1 = randint1(xsize - 3) - xhsize + x0 + 1;
+ y1 = randint1(ysize - 3) - yhsize + y0 + 1;
add_door(x1, y1);
}
/* Fill with monsters and treasure, high difficulty */
- fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint(5) + 5);
+ fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5);
}
while (!done)
{
/* testing values for these parameters feel free to adjust */
- grd = 1 << rand_int(4);
+ grd = 1 << randint0(4);
/* want average of about 16 */
- roug = randint(8) * randint(4);
+ roug = randint1(8) * randint1(4);
/* about size/2 */
- cutoff = randint(xsize / 4) + randint(ysize / 4) +
- randint(xsize / 4) + randint(ysize / 4);
+ cutoff = randint1(xsize / 4) + randint1(ysize / 4) +
+ randint1(xsize / 4) + randint1(ysize / 4);
/* make it */
generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);
}
/* Fill with monsters and treasure, low difficulty */
- fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint(5));
+ fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
}
/*
*
* The spanning tree is created by performing a suitably randomized
* depth-first traversal of the graph. The only adjustable parameter
- * is the rand_int(3) below; it governs the relative density of
+ * is the randint0(3) below; it governs the relative density of
* twists and turns in the labyrinth: smaller number, more twists.
*/
static void r_visit(int y1, int x1, int y2, int x2,
- int node, int dir, int *visited)
+ int node, int dir, int *visited)
{
int i, j, m, n, temp, x, y, adj[4];
place_floor_bold(y, x);
/* setup order of adjacent node visits */
- if (rand_int(3) == 0)
+ if (one_in_(3))
{
/* pick a random ordering */
for (i = 0; i < 4; i++)
adj[i] = i;
for (i = 0; i < 4; i++)
{
- j = rand_int(4);
+ j = randint0(4);
temp = adj[i];
adj[i] = adj[j];
adj[j] = temp;
adj[i] = i;
for (i = 1; i < 4; i++)
{
- j = 1 + rand_int(3);
+ j = 1 + randint0(3);
temp = adj[i];
adj[i] = adj[j];
adj[j] = temp;
{
int y, x, dy, dx;
int y1, x1, y2, x2;
- int i, m, n, num_vertices, *visited;
+ int m, n, num_vertices, *visited;
bool light;
cave_type *c_ptr;
if (cheat_room && is_vault) msg_print("Maze Vault");
/* Choose lite or dark */
- light = ((dun_level <= randint(25)) && is_vault && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+ light = ((dun_level <= randint1(25)) && is_vault && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
/* Pick a random room size - randomized by calling routine */
dy = ysize / 2 - 1;
num_vertices = m * n;
/* initialize array of visited vertices */
- /* use ralloc here ? */
- visited = (int *)malloc(num_vertices * sizeof(int));
- for (i = 0; i < num_vertices; i++)
- visited[i] = 0;
+ C_MAKE(visited, num_vertices, int);
/* traverse the graph to create a spaning tree, pick a random root */
- r_visit(y1, x1, y2, x2, rand_int(num_vertices), 0, visited);
+ r_visit(y1, x1, y2, x2, randint0(num_vertices), 0, visited);
/* Fill with monsters and treasure, low difficulty */
- if (is_vault) fill_treasure(x1, x2, y1, y2, randint(5));
+ if (is_vault) fill_treasure(x1, x2, y1, y2, randint1(5));
- free(visited);
+ C_KILL(visited, num_vertices, int);
}
*/
static void build_mini_c_vault(int x0, int y0, int xsize, int ysize)
{
- int dy, dx;
- int y1, x1, y2, x2, y, x, total;
- int i, m, n, num_vertices;
+ int dy, dx;
+ int y1, x1, y2, x2, y, x, total;
+ int m, n, num_vertices;
int *visited;
- if (cheat_room) msg_print("Mini Checker Board Vault");
+ if (cheat_room) msg_print("Mini Checker Board Vault");
- /* Pick a random room size */
+ /* Pick a random room size */
dy = ysize / 2 - 1;
dx = xsize / 2 - 1;
y1 = y0 - dy;
- x1 = x0 - dx;
- y2 = y0 + dy;
- x2 = x0 + dx;
+ x1 = x0 - dx;
+ y2 = y0 + dy;
+ x2 = x0 + dx;
/* generate the room */
num_vertices = m * n;
/* initialize array of visited vertices */
- /* use ralloc here ? */
- visited = (int *) malloc(num_vertices * sizeof(int));
- for (i = 0; i < num_vertices; i++)
- visited[i] = 0;
+ C_MAKE(visited, num_vertices, int);
/* traverse the graph to create a spannng tree, pick a random root */
- r_visit(y1, x1, y2, x2, rand_int(num_vertices), 0, visited);
+ r_visit(y1, x1, y2, x2, randint0(num_vertices), 0, visited);
/* Make it look like a checker board vault */
for (x = x1; x <= x2; x++)
}
/* Make a couple of entrances */
- if (randint(2) == 1)
+ if (one_in_(2))
{
/* left and right */
- y = randint(dy) + dy / 2;
+ y = randint1(dy) + dy / 2;
place_outer_noperm_bold(y1 + y, x1 - 1);
place_outer_noperm_bold(y1 + y, x2 + 1);
}
else
{
/* top and bottom */
- x = randint(dx) + dx / 2;
+ x = randint1(dx) + dx / 2;
place_outer_noperm_bold(y1 - 1, x1 + x);
place_outer_noperm_bold(y2 + 1, x1 + x);
}
/* Fill with monsters and treasure, highest difficulty */
fill_treasure(x1, x2, y1, y2, 10);
- /* rnfree(visited, num_vertices * sizeof(int)); */
- free(visited);
+ C_KILL(visited, num_vertices, int);
}
if (power < 10)
{
/* Make rooms + subdivide */
- if ((randint(10) > 2) && (xsize < 8) && (ysize < 8))
+ if ((randint1(10) > 2) && (xsize < 8) && (ysize < 8))
{
choice = 4;
}
else
{
- choice = randint(2) + 1;
+ choice = randint1(2) + 1;
}
}
else
{
/* Mostly subdivide */
- choice = randint(3) + 1;
+ choice = randint1(3) + 1;
}
}
}
/* Make a couple of entrances */
- if (randint(2) == 1)
+ if (one_in_(2))
{
/* left and right */
- y = randint(ysize) + y1;
+ y = randint1(ysize) + y1;
place_floor_bold(y, x1);
place_floor_bold(y, x2);
}
else
{
/* top and bottom */
- x = randint(xsize) + x1;
+ x = randint1(xsize) + x1;
place_floor_bold(y1, x);
place_floor_bold(y2, x);
}
/* Select size of keep */
- t1 = randint(ysize / 3) + y1;
- t2 = y2 - randint(ysize / 3);
- t3 = randint(xsize / 3) + x1;
- t4 = x2 - randint(xsize / 3);
+ t1 = randint1(ysize / 3) + y1;
+ t2 = y2 - randint1(ysize / 3);
+ t3 = randint1(xsize / 3) + x1;
+ t4 = x2 - randint1(xsize / 3);
/* Do outside areas */
}
/* Make a door */
- y = randint(ysize - 3) + y1 + 1;
+ y = randint1(ysize - 3) + y1 + 1;
- if (randint(2) == 1)
+ if (one_in_(2))
{
/* left */
place_floor_bold(y, x1 + 1);
return;
}
- t1 = randint(xsize - 2) + x1 + 1;
+ t1 = randint1(xsize - 2) + x1 + 1;
build_recursive_room(x1, y1, t1, y2, power - 2);
build_recursive_room(t1 + 1, y1, x2, y2, power - 2);
break;
return;
}
- t1 = randint(ysize - 2) + y1 + 1;
+ t1 = randint1(ysize - 2) + y1 + 1;
build_recursive_room(x1, y1, x2, t1, power - 2);
build_recursive_room(x1, t1 + 1, x2, y2, power - 2);
break;
dx = xsize / 2 - 1;
y1 = y0 - dy;
- x1 = x0 - dx;
- y2 = y0 + dy;
- x2 = x0 + dx;
+ x1 = x0 - dx;
+ y2 = y0 + dy;
+ x2 = x0 + dx;
if (cheat_room) msg_print("Castle Vault");
}
/* Make the castle */
- build_recursive_room(x1, y1, x2, y2, randint(5));
+ build_recursive_room(x1, y1, x2, y2, randint1(5));
/* Fill with monsters and treasure, low difficulty */
- fill_treasure(x1, x2, y1, y2, randint(3));
+ fill_treasure(x1, x2, y1, y2, randint1(3));
}
{
/* Set bounding walls */
place_outer_bold(y, x);
- if (light == TRUE) cave[y][x].info |= CAVE_GLOW;
+ if (light) cave[y][x].info |= CAVE_GLOW;
}
else if (cave[y][x].feat == FEAT_PERM_OUTER)
{
/* Set bounding walls */
- if (light == TRUE) cave[y][x].info |= CAVE_GLOW;
+ if (light) cave[y][x].info |= CAVE_GLOW;
}
}
* Used to build crypts
*/
static int dist2(int x1, int y1, int x2, int y2,
- int h1, int h2, int h3, int h4)
+ int h1, int h2, int h3, int h4)
{
int dx, dy;
dx = abs(x2 - x1);
if (dx >= 2 * dy) return (dx + (dy * h1) / h2);
if (dy >= 2 * dx) return (dy + (dx * h1) / h2);
return (((dx + dy) * 128) / 181 +
- (dx * dx / (dy * h3) + dy * dy / (dx * h3)) * h4);
+ (dx * dx / (dy * h3) + dy * dy / (dx * h3)) * h4);
/* 128/181 is approx. 1/sqrt(2) */
}
/* Make a random metric */
int h1, h2, h3, h4;
- h1 = randint(32) - 16;
- h2 = randint(16);
- h3 = randint(32);
- h4 = randint(32) - 16;
+ h1 = randint1(32) - 16;
+ h2 = randint1(16);
+ h3 = randint1(32);
+ h4 = randint1(32) - 16;
if (cheat_room) msg_print("Target Vault");
/* Find visible outer walls and set to be FEAT_OUTER */
add_outer_wall(x0, y0, FALSE, x0 - rad - 1, y0 - rad - 1,
- x0 + rad + 1, y0 + rad + 1);
+ x0 + rad + 1, y0 + rad + 1);
/* Add inner wall */
for (x = x0 - rad / 2; x <= x0 + rad / 2; x++)
add_door(x0, y0 - y);
/* Fill with stuff - medium difficulty */
- fill_treasure(x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint(3) + 3);
+ fill_treasure(x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3);
}
if (dun_level < 25)
{
/* Earth vault (Rubble) */
- type = 4;
+ type = GEN_LAKE_TYPE_EARTH_VAULT;
}
else if (dun_level < 50)
{
/* Air vault (Trees) */
- type = 5;
+ type = GEN_LAKE_TYPE_AIR_VAULT;
}
else if (dun_level < 75)
{
/* Water vault (shallow water) */
- type = 6;
+ type = GEN_LAKE_TYPE_WATER_VAULT;
}
else
{
/* Fire vault (shallow lava) */
- type = 7;
+ type = GEN_LAKE_TYPE_FIRE_VAULT;
}
while (!done)
{
/* testing values for these parameters: feel free to adjust */
- grd = 1 << (rand_int(3));
+ grd = 1 << (randint0(3));
/* want average of about 16 */
- roug = randint(8) * randint(4);
+ roug = randint1(8) * randint1(4);
/* Make up size of various componants */
/* Floor */
c3 = 2 * xsize / 3;
/* Deep water/lava */
- c1 = rand_int(c3 / 2) + rand_int(c3 / 2) - 5;
+ c1 = randint0(c3 / 2) + randint0(c3 / 2) - 5;
/* Shallow boundary */
c2 = (c1 + c3) / 2;
/* make a few rooms in the vault */
for (i = 1; i <= (xsize * ysize) / 50; i++)
{
- build_small_room(x0 + rand_int(xsize - 4) - xsize / 2 + 2,
- y0 + rand_int(ysize - 4) - ysize / 2 + 2);
+ build_small_room(x0 + randint0(xsize - 4) - xsize / 2 + 2,
+ y0 + randint0(ysize - 4) - ysize / 2 + 2);
}
/* Fill with monsters and treasure, low difficulty */
fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1,
- y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint(5));
+ y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
}
#endif /* ALLOW_CAVERNS_AND_LAKES */
/* Get size */
/* big enough to look good, small enough to be fairly common. */
- xsize = randint(22) + 22;
- ysize = randint(11) + 11;
+ xsize = randint1(22) + 22;
+ ysize = randint1(11) + 11;
/* Allocate in room_map. If will not fit, exit */
if (!room_alloc(xsize + 1, ysize + 1, FALSE, by0, bx0, &x0, &y0)) return;
/* (Sometimes) Cause a special feeling */
if ((dun_level <= 50) ||
- (randint((dun_level - 40) * (dun_level - 40) + 1) < 400))
+ (randint1((dun_level - 40) * (dun_level - 40) + 1) < 400))
{
good_item_flag = TRUE;
}
/* Select type of vault */
#ifdef ALLOW_CAVERNS_AND_LAKES
- vtype = randint(15);
+ vtype = randint1(15);
#else /* ALLOW_CAVERNS_AND_LAKES */
- vtype = randint(7);
+ vtype = randint1(7);
#endif /* ALLOW_CAVERNS_AND_LAKES */
switch (vtype)
int light = FALSE;
/* Occasional light */
- if ((randint(dun_level) <= 15) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+ if ((randint1(dun_level) <= 15) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
- rad = rand_int(9);
+ rad = randint0(9);
/* Allocate in room_map. If will not fit, exit */
if (!room_alloc(rad * 2 + 1, rad * 2 + 1, FALSE, by0, bx0, &x0, &y0)) return;
/* Make a random metric */
int h1, h2, h3, h4;
- h1 = randint(32) - 16;
- h2 = randint(16);
- h3 = randint(32);
- h4 = randint(32) - 16;
+ h1 = randint1(32) - 16;
+ h2 = randint1(16);
+ h3 = randint1(32);
+ h4 = randint1(32) - 16;
/* Occasional light */
- if ((randint(dun_level) <= 5) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+ if ((randint1(dun_level) <= 5) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
- rad = randint(9);
+ rad = randint1(9);
/* Allocate in room_map. If will not fit, exit */
if (!room_alloc(rad * 2 + 3, rad * 2 + 3, FALSE, by0, bx0, &x0, &y0)) return;
/* Find visible outer walls and set to be FEAT_OUTER */
add_outer_wall(x0, y0, light, x0 - rad - 1, y0 - rad - 1,
- x0 + rad + 1, y0 + rad + 1);
+ x0 + rad + 1, y0 + rad + 1);
/* Check to see if there is room for an inner vault */
for (x = x0 - 2; x <= x0 + 2; x++)
}
}
- if (emptyflag && (randint(2) == 1))
+ if (emptyflag && one_in_(2))
{
/* Build the vault */
build_small_room(x0, y0);
/* Place a treasure in the vault */
- place_object(y0, x0, FALSE, FALSE);
+ place_object(y0, x0, 0L);
/* Let's guard the treasure well */
- vault_monsters(y0, x0, rand_int(2) + 3);
+ vault_monsters(y0, x0, randint0(2) + 3);
/* Traps naturally */
- vault_traps(y0, x0, 4, 4, rand_int(3) + 2);
+ vault_traps(y0, x0, 4, 4, randint0(3) + 2);
+ }
+}
+
+
+/*
+ * Helper function for "trapped monster pit"
+ */
+static bool vault_aux_trapped_pit(int r_idx)
+{
+ monster_race *r_ptr = &r_info[r_idx];
+
+ /* Validate the monster */
+ if (!vault_monster_okay(r_idx)) return (FALSE);
+
+ /* No wall passing monster */
+ if (r_ptr->flags2 & (RF2_PASS_WALL | RF2_KILL_WALL)) return (FALSE);
+
+ /* Okay */
+ return (TRUE);
+}
+
+
+/*
+ * Type 12 -- Trapped monster pits
+ *
+ * A trapped monster pit is a "big" room with a straight corridor in
+ * which wall opening traps are placed, and with two "inner" rooms
+ * containing a "collection" of monsters of a given type organized in
+ * the room.
+ *
+ * The trapped monster pit appears as shown below, where the actual
+ * monsters in each location depend on the type of the pit
+ *
+ * #########################
+ * # #
+ * ####################### #
+ * #####001123454321100### #
+ * ###0012234567654322100# #
+ * ####################### #
+ * # ^ #
+ * # #######################
+ * # #0012234567654322100###
+ * # ###001123454321100#####
+ * # #######################
+ * # #
+ * #########################
+ *
+ * Note that the monsters in the pit are now chosen by using "get_mon_num()"
+ * to request 16 "appropriate" monsters, sorting them by level, and using
+ * the "even" entries in this sorted list for the contents of the pit.
+ *
+ * Hack -- all of the "dragons" in a "dragon" pit must be the same "color",
+ * which is handled by requiring a specific "breath" attack for all of the
+ * dragons. This may include "multi-hued" breath. Note that "wyrms" may
+ * be present in many of the dragon pits, if they have the proper breath.
+ *
+ * Note the use of the "get_mon_num_prep()" function, and the special
+ * "get_mon_num_hook()" restriction function, to prepare the "monster
+ * allocation table" in such a way as to optimize the selection of
+ * "appropriate" non-unique monsters for the pit.
+ *
+ * Note that the "get_mon_num()" function may (rarely) fail, in which case
+ * the pit will be empty, and will not effect the level rating.
+ *
+ * Note that "monster pits" will never contain "unique" monsters.
+ */
+static void build_type13(int by0, int bx0)
+{
+ static int placing[][3] = {
+ {-2, -9, 0}, {-2, -8, 0}, {-3, -7, 0}, {-3, -6, 0},
+ {+2, -9, 0}, {+2, -8, 0}, {+3, -7, 0}, {+3, -6, 0},
+ {-2, +9, 0}, {-2, +8, 0}, {-3, +7, 0}, {-3, +6, 0},
+ {+2, +9, 0}, {+2, +8, 0}, {+3, +7, 0}, {+3, +6, 0},
+ {-2, -7, 1}, {-3, -5, 1}, {-3, -4, 1},
+ {+2, -7, 1}, {+3, -5, 1}, {+3, -4, 1},
+ {-2, +7, 1}, {-3, +5, 1}, {-3, +4, 1},
+ {+2, +7, 1}, {+3, +5, 1}, {+3, +4, 1},
+ {-2, -6, 2}, {-2, -5, 2}, {-3, -3, 2},
+ {+2, -6, 2}, {+2, -5, 2}, {+3, -3, 2},
+ {-2, +6, 2}, {-2, +5, 2}, {-3, +3, 2},
+ {+2, +6, 2}, {+2, +5, 2}, {+3, +3, 2},
+ {-2, -4, 3}, {-3, -2, 3},
+ {+2, -4, 3}, {+3, -2, 3},
+ {-2, +4, 3}, {-3, +2, 3},
+ {+2, +4, 3}, {+3, +2, 3},
+ {-2, -3, 4}, {-3, -1, 4},
+ {+2, -3, 4}, {+3, -1, 4},
+ {-2, +3, 4}, {-3, +1, 4},
+ {+2, +3, 4}, {+3, +1, 4},
+ {-2, -2, 5}, {-3, 0, 5}, {-2, +2, 5},
+ {+2, -2, 5}, {+3, 0, 5}, {+2, +2, 5},
+ {-2, -1, 6}, {-2, +1, 6},
+ {+2, -1, 6}, {+2, +1, 6},
+ {-2, 0, 7}, {+2, 0, 7},
+ {0, 0, -1}
+ };
+
+ int y, x, y1, x1, y2, x2, xval, yval;
+ int i, j;
+
+ int what[16];
+
+ monster_type align;
+
+ cave_type *c_ptr;
+
+ int cur_pit_type = pick_vault_type(pit_types, d_info[dungeon_type].pit);
+ vault_aux_type *n_ptr;
+
+ /* Only in Angband */
+ if (dungeon_type != 1) return;
+
+ /* Try to allocate space for room. */
+ if (!room_alloc(25, 13, TRUE, by0, bx0, &xval, &yval)) return;
+
+ /* No type available */
+ if (cur_pit_type < 0) return;
+
+ n_ptr = &pit_types[cur_pit_type];
+
+ /* Process a preparation function if necessary */
+ if (n_ptr->prep_func) (*(n_ptr->prep_func))();
+
+ /* Large room */
+ y1 = yval - 5;
+ y2 = yval + 5;
+ x1 = xval - 11;
+ x2 = xval + 11;
+
+ /* Fill with inner walls */
+ for (y = y1 - 1; y <= y2 + 1; y++)
+ {
+ for (x = x1 - 1; x <= x2 + 1; x++)
+ {
+ c_ptr = &cave[y][x];
+ place_inner_grid(c_ptr);
+ c_ptr->info |= (CAVE_ROOM);
+ }
+ }
+
+ /* Place the floor area 1 */
+ for (x = x1 + 3; x <= x2 - 3; x++)
+ {
+ c_ptr = &cave[yval-2][x];
+ place_floor_grid(c_ptr);
+ add_cave_info(yval-2, x, CAVE_ICKY);
+
+ c_ptr = &cave[yval+2][x];
+ place_floor_grid(c_ptr);
+ add_cave_info(yval+2, x, CAVE_ICKY);
+ }
+
+ /* Place the floor area 2 */
+ for (x = x1 + 5; x <= x2 - 5; x++)
+ {
+ c_ptr = &cave[yval-3][x];
+ place_floor_grid(c_ptr);
+ add_cave_info(yval-3, x, CAVE_ICKY);
+
+ c_ptr = &cave[yval+3][x];
+ place_floor_grid(c_ptr);
+ add_cave_info(yval+3, x, CAVE_ICKY);
+ }
+
+ /* Corridor */
+ for (x = x1; x <= x2; x++)
+ {
+ c_ptr = &cave[yval][x];
+ place_floor_grid(c_ptr);
+ c_ptr = &cave[y1][x];
+ place_floor_grid(c_ptr);
+ c_ptr = &cave[y2][x];
+ place_floor_grid(c_ptr);
+ }
+
+ /* Place the outer walls */
+ for (y = y1 - 1; y <= y2 + 1; y++)
+ {
+ c_ptr = &cave[y][x1 - 1];
+ place_outer_grid(c_ptr);
+ c_ptr = &cave[y][x2 + 1];
+ place_outer_grid(c_ptr);
+ }
+ for (x = x1 - 1; x <= x2 + 1; x++)
+ {
+ c_ptr = &cave[y1 - 1][x];
+ place_outer_grid(c_ptr);
+ c_ptr = &cave[y2 + 1][x];
+ place_outer_grid(c_ptr);
+ }
+
+ /* Random corridor */
+ if (one_in_(2))
+ {
+ for (y = y1; y <= yval; y++)
+ {
+ place_floor_bold(y, x2);
+ place_solid_bold(y, x1-1);
+ }
+ for (y = yval; y <= y2 + 1; y++)
+ {
+ place_floor_bold(y, x1);
+ place_solid_bold(y, x2+1);
+ }
+ }
+ else
+ {
+ for (y = yval; y <= y2 + 1; y++)
+ {
+ place_floor_bold(y, x1);
+ place_solid_bold(y, x2+1);
+ }
+ for (y = y1; y <= yval; y++)
+ {
+ place_floor_bold(y, x2);
+ place_solid_bold(y, x1-1);
+ }
+ }
+
+ /* Pre-apply default mimic field */
+ cave[yval][xval].mimic = f_info[cave[yval][xval].feat].mimic;
+
+ /* Place the wall open trap */
+ cave[yval][xval].feat = FEAT_TRAP_OPEN;
+
+ /* Prepare allocation table */
+ get_mon_num_prep(n_ptr->hook_func, vault_aux_trapped_pit);
+
+ align.sub_align = SUB_ALIGN_NEUTRAL;
+
+ /* Pick some monster types */
+ for (i = 0; i < 16; i++)
+ {
+ int r_idx = 0, attempts = 100;
+ monster_race *r_ptr = NULL;
+
+ while (attempts--)
+ {
+ /* Get a (hard) monster type */
+ r_idx = get_mon_num(dun_level + 0);
+ r_ptr = &r_info[r_idx];
+
+ /* Decline incorrect alignment */
+ if (monster_has_hostile_align(&align, 0, 0, r_ptr)) continue;
+
+ /* Accept this monster */
+ break;
+ }
+
+ /* Notice failure */
+ if (!r_idx || !attempts) return;
+
+ /* Note the alignment */
+ if (r_ptr->flags3 & RF3_EVIL) align.sub_align |= SUB_ALIGN_EVIL;
+ if (r_ptr->flags3 & RF3_GOOD) align.sub_align |= SUB_ALIGN_GOOD;
+
+ what[i] = r_idx;
+ }
+
+ /* Sort the entries */
+ for (i = 0; i < 16 - 1; i++)
+ {
+ /* Sort the entries */
+ for (j = 0; j < 16 - 1; j++)
+ {
+ int i1 = j;
+ int i2 = j + 1;
+
+ int p1 = r_info[what[i1]].level;
+ int p2 = r_info[what[i2]].level;
+
+ /* Bubble */
+ if (p1 > p2)
+ {
+ int tmp = what[i1];
+ what[i1] = what[i2];
+ what[i2] = tmp;
+ }
+ }
+ }
+
+ /* Message */
+ if (cheat_room)
+ {
+ /* Room type */
+#ifdef JP
+ msg_format("%s%s¤Î櫥ԥåÈ", n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
+#else
+ msg_format("Trapped monster pit (%s%s)", n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
+#endif
+ }
+
+ /* Select the entries */
+ for (i = 0; i < 8; i++)
+ {
+ /* Every other entry */
+ what[i] = what[i * 2];
+
+ if (cheat_hear)
+ {
+ /* Message */
+ msg_print(r_name + r_info[what[i]].name);
+ }
+ }
+
+ /* Increase the level rating */
+ rating += 20;
+
+ /* (Sometimes) Cause a "special feeling" (for "Monster Pits") */
+ if ((dun_level <= 40) && (randint1(dun_level * dun_level + 50) < 300))
+ {
+ good_item_flag = TRUE;
+ }
+
+
+ for (i = 0; placing[i][2] >= 0; i++)
+ {
+ y = yval + placing[i][0];
+ x = xval + placing[i][1];
+ place_monster_aux(0, y, x, what[placing[i][2]], PM_NO_KAGE);
+ }
+}
+
+
+/*
+ * Type 14 -- trapped rooms
+ *
+ * A special trap is placed at center of the room
+ */
+static void build_type14(int by0, int bx0)
+{
+ int y, x, y2, x2, yval, xval;
+ int y1, x1, xsize, ysize;
+
+ bool light;
+
+ cave_type *c_ptr;
+ byte trap;
+
+ /* Pick a room size */
+ y1 = randint1(4);
+ x1 = randint1(11);
+ y2 = randint1(3);
+ x2 = randint1(11);
+
+ xsize = x1 + x2 + 1;
+ ysize = y1 + y2 + 1;
+
+ /* Try to allocate space for room. If fails, exit */
+ if (!room_alloc(xsize + 2, ysize + 2, FALSE, by0, bx0, &xval, &yval)) return;
+
+ /* Choose lite or dark */
+ light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+
+
+ /* Get corner values */
+ y1 = yval - ysize / 2;
+ x1 = xval - xsize / 2;
+ y2 = yval + (ysize - 1) / 2;
+ x2 = xval + (xsize - 1) / 2;
+
+
+ /* Place a full floor under the room */
+ for (y = y1 - 1; y <= y2 + 1; y++)
+ {
+ for (x = x1 - 1; x <= x2 + 1; x++)
+ {
+ c_ptr = &cave[y][x];
+ place_floor_grid(c_ptr);
+ c_ptr->info |= (CAVE_ROOM);
+ if (light) c_ptr->info |= (CAVE_GLOW);
+ }
+ }
+
+ /* Walls around the room */
+ for (y = y1 - 1; y <= y2 + 1; y++)
+ {
+ c_ptr = &cave[y][x1 - 1];
+ place_outer_grid(c_ptr);
+ c_ptr = &cave[y][x2 + 1];
+ place_outer_grid(c_ptr);
+ }
+ for (x = x1 - 1; x <= x2 + 1; x++)
+ {
+ c_ptr = &cave[y1 - 1][x];
+ place_outer_grid(c_ptr);
+ c_ptr = &cave[y2 + 1][x];
+ place_outer_grid(c_ptr);
+ }
+
+ if (dun_level < 30 + randint1(30))
+ trap = FEAT_TRAP_PIRANHA;
+ else
+ trap = FEAT_TRAP_ARMAGEDDON;
+
+ /* Place a special trap */
+ c_ptr = &cave[rand_spread(yval, ysize/4)][rand_spread(xval, xsize/4)];
+ c_ptr->mimic = f_info[c_ptr->feat].mimic;
+ c_ptr->feat = trap;
+
+ /* Message */
+ if (cheat_room)
+ {
+#ifdef JP
+ msg_format("%s¤ÎÉô²°", f_name + f_info[trap].name);
+#else
+ msg_format("Room of %s", f_name + f_info[trap].name);
+#endif
}
}
bool room_build(int by0, int bx0, int typ)
{
/* Restrict level */
- if ((dun_level < roomdep[typ]) && !ironman_rooms) return (FALSE);
+ if ((dun_level < roomdep[typ]) && !ironman_rooms) return FALSE;
/* Restrict "crowded" rooms */
- if ((dun->crowded >= 2) && ((typ == 5) || (typ == 6))) return (FALSE);
+ if ((dun->crowded >= 2) && ((typ == ROOM_BUILD_TYPE_NEST) ||
+ (typ == ROOM_BUILD_TYPE_PIT) || (typ == ROOM_BUILD_TYPE_TRAP_PIT))) return FALSE;
/* Build a room */
switch (typ)
{
- /* Build an appropriate room */
- case 12: build_type12(by0, bx0); break;
- case 11: build_type11(by0, bx0); break;
- case 10: build_type10(by0, bx0); break;
- case 9: build_type9(by0, bx0); break;
- case 8: build_type8(by0, bx0); break;
- case 7: build_type7(by0, bx0); break;
- case 6: build_type6(by0, bx0, FALSE); break;
- case 5: build_type5(by0, bx0, FALSE); break;
- case 4: build_type4(by0, bx0); break;
- case 3: build_type3(by0, bx0); break;
- case 2: build_type2(by0, bx0); break;
- case 1: build_type1(by0, bx0); break;
-
- /* Paranoia */
- default: return (FALSE);
+ /* Build an appropriate room */
+ case ROOM_BUILD_TYPE_NORMAL: build_type1(by0, bx0); break;
+ case ROOM_BUILD_TYPE_OVERLAP: build_type2(by0, bx0); break;
+ case ROOM_BUILD_TYPE_CROSS: build_type3(by0, bx0); break;
+ case ROOM_BUILD_TYPE_INNER_FEAT: build_type4(by0, bx0); break;
+ case ROOM_BUILD_TYPE_NEST: build_type5(by0, bx0, FALSE); break;
+ case ROOM_BUILD_TYPE_PIT: build_type6(by0, bx0, FALSE); break;
+ case ROOM_BUILD_TYPE_LESSER_VAULT: build_type7(by0, bx0); break;
+ case ROOM_BUILD_TYPE_GREATER_VAULT: build_type8(by0, bx0); break;
+ case ROOM_BUILD_TYPE_FRACAVE: build_type9(by0, bx0); break;
+ case ROOM_BUILD_TYPE_RANDOM_VAULT: build_type10(by0, bx0); break;
+ case ROOM_BUILD_TYPE_OVAL: build_type11(by0, bx0); break;
+ case ROOM_BUILD_TYPE_CRYPT: build_type12(by0, bx0); break;
+ case ROOM_BUILD_TYPE_TRAP_PIT: build_type13(by0, bx0); break;
+ case ROOM_BUILD_TYPE_TRAP: build_type14(by0, bx0); break;
+
+ /* Paranoia */
+ default: return FALSE;
}
- return (TRUE);
+ return TRUE;
}