{{ 0, 1, 1, 1, 2, 3, 5, 6, 8, 10, 13}, 10}, /*NEST */
{{ 0, 1, 1, 2, 3, 4, 6, 8, 10, 13, 16}, 10}, /*PIT */
{{ 0, 1, 1, 1, 2, 2, 3, 5, 6, 8, 10}, 10}, /*LESSER_V */
- {{ 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 3}, 20}, /*GREATER_V*/
+ {{ 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4}, 20}, /*GREATER_V*/
{{ 0,100,200,300,400,500,600,700,800,900,999}, 10}, /*FRACAVE */
- {{ 0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3}, 10}, /*RANDOM_V */
+ {{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2}, 10}, /*RANDOM_V */
{{ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40}, 3}, /*OVAL */
{{ 1, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60}, 10}, /*CRYPT */
{{ 0, 0, 1, 1, 1, 2, 3, 4, 5, 6, 8}, 20}, /*TRAP_PIT */
{
set_cave_feat(y, x, FEAT_DOOR_HEAD+randint1(7));
cave[y][x].info &= ~(CAVE_FLOOR);
+ delete_monster(y, x);
}
}
c_ptr->mimic = feat_wall_inner;
/* Floor type terrain cannot hide a door */
- if (feat_floor(c_ptr->mimic))
+ if (feat_supports_los(c_ptr->mimic) && !feat_supports_los(c_ptr->feat))
{
- c_ptr->feat = c_ptr->mimic;
+ if (have_flag(f_info[c_ptr->mimic].flags, FF_MOVE) || have_flag(f_info[c_ptr->mimic].flags, FF_CAN_FLY))
+ {
+ c_ptr->feat = one_in_(2) ? c_ptr->mimic : floor_type[randint0(100)];
+ }
c_ptr->mimic = 0;
}
c_ptr->info &= ~(CAVE_FLOOR);
+ delete_monster(y, x);
}
}
if (dun->row_rooms < blocks_high) return FALSE;
if (dun->col_rooms < blocks_wide) return FALSE;
-#if 0
- /* Sometimes, little rooms like to have more space. */
- if (blocks_wide == 2)
- {
- if (one_in_(3)) blocks_wide = 3;
- }
- else if (blocks_wide == 1)
- {
- if (one_in_(2)) blocks_wide = rand_range(2, 3);
- }
-#endif
-
/* Initiallize */
candidates = 0;
ysize = y1 + y2 + 1;
/* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;
+ if (!find_space(&yval, &xval, ysize + 2, xsize + 2))
+ {
+ /* Limit to the minimum room size, and retry */
+ y1 = 1;
+ x1 = 1;
+ y2 = 1;
+ x2 = 1;
+
+ xsize = x1 + x2 + 1;
+ ysize = y1 + y2 + 1;
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ if (!find_space(&yval, &xval, ysize + 2, xsize + 2)) return FALSE;
+ }
/* Choose lite or dark */
light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
if (r_ptr->flags3 & (RF3_EVIL)) return (FALSE);
/* Require icky thing, jelly, mold, or mushroom */
- if (!strchr("ijm,", r_ptr->d_char)) return (FALSE);
+ if (!my_strchr("ijm,", r_ptr->d_char)) return (FALSE);
/* Okay */
return (TRUE);
if (!vault_monster_okay(r_idx)) return (FALSE);
/* Require a Zephyr Hound or a dog */
- if (!strchr("CZ", r_ptr->d_char)) return (FALSE);
+ if (!my_strchr("CZ", r_ptr->d_char)) return (FALSE);
/* Okay */
return (TRUE);
/* Validate the monster */
if (!vault_monster_okay(r_idx)) return (FALSE);
-
+
/* Require mimic */
- if (!strchr("!|$?=", r_ptr->d_char)) return (FALSE);
+ if (!my_strchr("!$&(/=?[\\|", r_ptr->d_char)) return (FALSE);
/* Okay */
return (TRUE);
* "appropriate" non-unique monsters for the nest.
*
* Note that the "get_mon_num()" function may (rarely) fail, in which
- * case the nest will be empty, and will not affect the level rating.
+ * case the nest will be empty.
*
* Note that "monster nests" will never contain "unique" monsters.
*/
while (attempts--)
{
/* Get a (hard) monster type */
- r_idx = get_mon_num(dun_level + 10);
+ r_idx = get_mon_num(dun_level + 11);
r_ptr = &r_info[r_idx];
/* Decline incorrect alignment */
#endif
}
- /* Increase the level rating */
- rating += 10;
-
- /* (Sometimes) Cause a "special feeling" (for "Monster Nests") */
- if ((dun_level <= 40) && (randint1(dun_level * dun_level + 50) < 300))
- {
- good_item_flag = TRUE;
- }
-
/* Place some monsters */
for (y = yval - 2; y <= yval + 2; y++)
{
* "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.
+ * the pit will be empty.
*
* Note that "monster pits" will never contain "unique" monsters.
*/
while (attempts--)
{
/* Get a (hard) monster type */
- r_idx = get_mon_num(dun_level + 10);
+ r_idx = get_mon_num(dun_level + 11);
r_ptr = &r_info[r_idx];
/* Decline incorrect alignment */
}
}
- /* Increase the level rating */
- rating += 10;
-
- /* (Sometimes) Cause a "special feeling" (for "Monster Pits") */
- 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++)
{
/* Permanent wall (inner) */
case 'X':
- c_ptr->feat = FEAT_PERM_INNER;
- c_ptr->info &= ~(CAVE_MASK);
- c_ptr->info |= CAVE_INNER;
+ place_inner_perm_grid(c_ptr);
break;
/* Treasure/trap */
if (cheat_room) msg_format("Lesser vault (%s)", v_name + v_ptr->name);
#endif
- /* Boost the rating */
- rating += v_ptr->rat;
-
- /* (Sometimes) Cause a special feeling */
- if ((dun_level <= 50) ||
- (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);
if (cheat_room) msg_format("Greater vault (%s)", v_name + v_ptr->name);
#endif
- /* Boost the rating */
- rating += v_ptr->rat;
-
- /* (Sometimes) Cause a special feeling */
- if ((dun_level <= 50) ||
- (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);
* The tricky part is making sure the created cave is connected. This
* is done by 'filling' from the inside and only keeping the 'filled'
* floor. Walls bounding the 'filled' floor are also kept. Everything
-* else is converted to the normal granite FEAT_WALL_EXTRA.
+* else is converted to the normal _extra_.
*/
fill_data.ymin = y0 - yhsize;
fill_data.xmax = x0 + xhsize;
fill_data.ymax = y0 + yhsize;
-
+
/* Store cutoff in global for quick access */
fill_data.c1 = cutoff;
-
+
/*
* Scale factor for middle points:
* About sqrt(2) * 256 - correct for a square lattice
{
for (j = 0; j <= ysize; j++)
{
- /* 255 is a flag for "not done yet" */
- cave[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = 255;
+ /* -1 is a flag for "not done yet" */
+ cave[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = -1;
/* Clear icky flag because may be redoing the cave */
cave[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].info &= ~(CAVE_ICKY);
}
xhstep /= 2;
ystep = yhstep;
yhstep /= 2;
-
+
/* cache well used values */
xstep2 = xstep / 256;
ystep2 = ystep / 256;
-
+
xhstep2 = xhstep / 256;
yhstep2 = yhstep / 256;
/* cache often used values */
ii = i / 256 + fill_data.xmin;
jj = j / 256 + fill_data.ymin;
-
+
/* Test square */
- if (cave[jj][ii].feat == 255)
- {
+ if (cave[jj][ii].feat == -1)
+ {
if (xhstep2 > grd)
{
/* If greater than 'grid' level then is random */
/* cache often used values */
ii = i / 256 + fill_data.xmin;
jj = j / 256 + fill_data.ymin;
-
+
/* Test square */
- if (cave[jj][ii].feat == 255)
+ if (cave[jj][ii].feat == -1)
{
if (xhstep2 > grd)
{
/* cache often used values */
ii = i / 256 + fill_data.xmin;
jj = j / 256 + fill_data.ymin;
-
+
/* Test square */
- if (cave[jj][ii].feat == 255)
- {
+ if (cave[jj][ii].feat == -1)
+ {
if (xhstep2 > grd)
{
/* If greater than 'grid' level then is random */
xm = fill_data.xmin + (i - xhstep) / 256;
xp = fill_data.xmin + (i + xhstep) / 256;
ym = fill_data.ymin + (j - yhstep) / 256;
- yp = fill_data.ymin + (j + yhstep) / 256;
-
+ yp = fill_data.ymin + (j + yhstep) / 256;
+
/*
* Average over all four corners + scale by diagsize to
* reduce the effect of the square grid on the shape of the fractal
- */
+ */
store_height(ii, jj,
(cave[ym][xm].feat + cave[yp][xm].feat
+ cave[ym][xp].feat + cave[yp][xp].feat) / 4
static bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, bool light, bool room)
{
int x, y, i, xhsize, yhsize;
-
/* offsets to middle from corner */
xhsize = xsize / 2;
* XXX XXX XXX There is a slight problem when tunnels pierce the caves:
* Extra doors appear inside the system. (Its not very noticeable though.)
* This can be removed by "filling" from the outside in. This allows a separation
- * from FEAT_WALL_OUTER with FEAT_WALL_INNER. (Internal walls are F.W.OUTER instead.)
+ * from _outer_ with _inner_. (Internal walls are _outer_ instead.)
* The extra effort for what seems to be only a minor thing (even non-existant if you
* think of the caves not as normal rooms, but as holes in the dungeon), doesn't seem
* worth it.
ysize = randint1(15) * 2 + 6;
/* Find and reserve some space in the dungeon. Get center of room. */
- if (!find_space(&y0, &x0, ysize + 1, xsize + 1)) return FALSE;
+ if (!find_space(&y0, &x0, ysize + 1, xsize + 1))
+ {
+ /* Limit to the minimum room size, and retry */
+ xsize = 8;
+ ysize = 8;
+
+ /* Find and reserve some space in the dungeon. Get center of room. */
+ if (!find_space(&y0, &x0, ysize + 1, xsize + 1))
+ {
+ /*
+ * Still no space?!
+ * Try normal room
+ */
+ return build_type1();
+ }
+ }
light = done = FALSE;
room = TRUE;
/* turn off icky flag (no longer needed.) */
cave[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM);
- /* Light lava and trees */
- if ((cave[y0 + y - yhsize][x0 + x - xhsize].feat == FEAT_DEEP_LAVA) ||
- (cave[y0 + y - yhsize][x0 + x - xhsize].feat == FEAT_SHAL_LAVA))
+ /* Light lava */
+ if (cave_have_flag_bold(y0 + y - yhsize, x0 + x - xhsize, FF_LAVA))
{
if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) cave[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW;
}
/* if floor, shallow water and lava */
if (is_floor_bold(y, x) ||
- (cave[y][x].feat == FEAT_SHAL_WATER) ||
- (cave[y][x].feat == FEAT_SHAL_LAVA))
+ (cave_have_flag_bold(y, x, FF_PLACE) && cave_have_flag_bold(y, x, FF_DROP)))
{
/* The smaller 'value' is, the better the stuff */
if (value < 0)
c_ptr->info |= (CAVE_ROOM | CAVE_ICKY);
/* Permanent walls */
- c_ptr->feat = FEAT_PERM_INNER;
- c_ptr->info &= ~(CAVE_MASK);
- c_ptr->info |= CAVE_INNER;
+ place_inner_perm_grid(c_ptr);
}
}
* Note: no range checking is done so must be inside dungeon
* This routine also stomps on doors
*/
-static void add_outer_wall(int x, int y, int light,
- int x1, int y1, int x2, int y2)
+static void add_outer_wall(int x, int y, int light, int x1, int y1, int x2, int y2)
{
+ cave_type *c_ptr;
+ feature_type *f_ptr;
int i, j;
if (!in_bounds(y, x)) return;
+ c_ptr = &cave[y][x];
+
/* hack- check to see if square has been visited before
* if so, then exit (use room flag to do this) */
- if (cave[y][x].info & CAVE_ROOM) return;
+ if (c_ptr->info & CAVE_ROOM) return;
/* set room flag */
- cave[y][x].info |= CAVE_ROOM;
+ c_ptr->info |= CAVE_ROOM;
+
+ f_ptr = &f_info[c_ptr->feat];
if (is_floor_bold(y, x))
{
(y + j >= y1) && (y + j <= y2))
{
add_outer_wall(x + i, y + j, light, x1, y1, x2, y2);
- if (light) cave[y][x].info |= CAVE_GLOW;
+ if (light) c_ptr->info |= CAVE_GLOW;
}
}
}
{
/* Set bounding walls */
place_outer_bold(y, x);
- if (light) cave[y][x].info |= CAVE_GLOW;
+ if (light) c_ptr->info |= CAVE_GLOW;
}
- else if (cave[y][x].feat == FEAT_PERM_OUTER)
+ else if (permanent_wall(f_ptr))
{
/* Set bounding walls */
- if (light) cave[y][x].info |= CAVE_GLOW;
+ if (light) c_ptr->info |= CAVE_GLOW;
}
}
/* Find and reserve some space in the dungeon. Get center of room. */
if (!find_space(&y0, &x0, ysize + 1, xsize + 1)) return FALSE;
- /* Boost the rating- higher than lesser vaults and lower than greater vaults */
- rating += 10;
-
- /* (Sometimes) Cause a special feeling */
- if ((dun_level <= 50) ||
- (randint1((dun_level - 40) * (dun_level - 40) + 1) < 400))
- {
- good_item_flag = TRUE;
- }
-
/* Select type of vault */
#ifdef ALLOW_CAVERNS_AND_LAKES
vtype = randint1(15);
* "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.
+ * the pit will be empty.
*
* Note that "monster pits" will never contain "unique" monsters.
*/
}
}
- /* 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];
bool light;
cave_type *c_ptr;
- byte trap;
+ s16b trap;
/* Pick a room size */
y1 = randint1(4);
* Note that we restrict the number of "crowded" rooms to reduce
* the chance of overflowing the monster list during level creation.
*/
-bool room_build(int typ)
+static bool room_build(int typ)
{
/* Build a room */
switch (typ)
*
* Generate rooms in dungeon. Build bigger rooms at first.
*/
-void generate_rooms(void)
+bool generate_rooms(void)
{
int i;
bool remain;
/* Assume normal cave */
room_info_type *room_info_ptr = room_info_normal;
-
/*
* Initialize probability list.
*/
*/
/* Ironman sees only Greater Vaults */
- if (ironman_rooms && !((d_info[dungeon_type].flags1 & (DF1_BEGINNER | DF1_CHAMELEON))))
+ if (ironman_rooms && !((d_info[dungeon_type].flags1 & (DF1_BEGINNER | DF1_CHAMELEON | DF1_SMALLEST))))
{
for (i = 0; i < ROOM_T_MAX; i++)
{
}
}
}
-
- /* Stop building this type on failure. */
- else
- {
- room_num[room_type] = 0;
- }
}
/* End loop if no room remain */
if (!remain) break;
}
+ if (rooms_built < 1) return FALSE;
+
if (cheat_room)
{
#ifdef JP
msg_format("Number of Rooms: %d", rooms_built);
#endif
}
+
+ return TRUE;
}