{{ 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, 2, 2, 3, 4, 5, 6}, 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 */
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)) c_ptr->feat = c_ptr->mimic;
c_ptr->mimic = 0;
}
{
int by1, bx1, by2, bx2, by, bx;
- /* Align dungeon rooms (only in NO_CAVE dungeon (Castle)) */
- if (d_info[dungeon_type].flags1 & DF1_NO_CAVE)
+ /* Itty-bitty rooms must shift about within their rectangle */
+ if (blocks_wide < 3)
{
- /* Itty-bitty rooms must shift about within their rectangle */
- if (blocks_wide < 3)
- {
- if ((blocks_wide == 2) && (block_x % 3) == 2)
- return FALSE;
- }
+ if ((blocks_wide == 2) && (block_x % 3) == 2)
+ return FALSE;
+ }
- /* Rooms with width divisible by 3 must be fitted to a rectangle. */
- else if ((blocks_wide % 3) == 0)
+ /* Rooms with width divisible by 3 must be fitted to a rectangle. */
+ else if ((blocks_wide % 3) == 0)
+ {
+ /* Must be aligned to the left edge of a 11x33 rectangle. */
+ if ((block_x % 3) != 0)
+ return FALSE;
+ }
+
+ /*
+ * Big rooms that do not have a width divisible by 3 must be
+ * aligned towards the edge of the dungeon closest to them.
+ */
+ else
+ {
+ /* Shift towards left edge of dungeon. */
+ if (block_x + (blocks_wide / 2) <= dun->col_rooms / 2)
{
- /* Must be aligned to the left edge of a 11x33 rectangle. */
- if ((block_x % 3) != 0)
+ if (((block_x % 3) == 2) && ((blocks_wide % 3) == 2))
+ return FALSE;
+ if ((block_x % 3) == 1)
return FALSE;
}
- /*
- * Big rooms that do not have a width divisible by 3 must be
- * aligned towards the edge of the dungeon closest to them.
- */
+ /* Shift toward right edge of dungeon. */
else
{
- /* Shift towards left edge of dungeon. */
- if (block_x + (blocks_wide / 2) <= dun->col_rooms / 2)
- {
- if (((block_x % 3) == 2) && ((blocks_wide % 3) == 2))
- return FALSE;
- if ((block_x % 3) == 1)
- return FALSE;
- }
-
- /* Shift toward right edge of dungeon. */
- else
- {
- if (((block_x % 3) == 2) && ((blocks_wide % 3) == 2))
- return FALSE;
- if ((block_x % 3) == 1)
- return FALSE;
- }
+ if (((block_x % 3) == 2) && ((blocks_wide % 3) == 2))
+ return FALSE;
+ if ((block_x % 3) == 1)
+ return FALSE;
}
}
return FALSE;
}
- /* Choose a random one */
- pick = randint1(candidates);
+ /* Normal dungeon */
+ if (!(d_info[dungeon_type].flags1 & DF1_NO_CAVE))
+ {
+ /* Choose a random one */
+ pick = randint1(candidates);
+ }
+
+ /* NO_CAVE dungeon (Castle) */
+ else
+ {
+ /* Always choose the center one */
+ pick = candidates/2 + 1;
+ }
/* Pick up the choosen location */
for (block_y = dun->row_rooms - blocks_high; block_y >= 0; block_y--)
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);
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);
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 */
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 */
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;
/* 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 (have_flag(f_flags_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))
+ (have_flag(f_flags_bold(y, x), FF_PLACE) && have_flag(f_flags_bold(y, x), FF_DROP)))
{
/* The smaller 'value' is, the better the stuff */
if (value < 0)
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 (have_flag(f_ptr->flags, FF_WALL) && have_flag(f_ptr->flags, FF_PERMANENT) && have_flag(f_ptr->flags, FF_OUTER))
{
/* Set bounding walls */
- if (light) cave[y][x].info |= CAVE_GLOW;
+ if (light) c_ptr->info |= CAVE_GLOW;
}
}
bool light;
cave_type *c_ptr;
- byte trap;
+ s16b trap;
/* Pick a room size */
y1 = randint1(4);