*/
/*
- * 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"
/*
* Place a random type of door at the given location
*/
-void place_random_door(int y, int x)
+void place_random_door(int y, int x, bool room)
{
int tmp;
- cave_type *c_ptr = &cave[y][x];
+ cave_type *c_ptr = &cave[y][x];
- /* Initialize mimic info */
- c_ptr->mimic = 0;
-
+ /* Initialize mimic info */
+ c_ptr->mimic = 0;
+
if (d_info[dungeon_type].flags1 & DF1_NO_DOORS)
{
place_floor_bold(y, x);
else if (tmp < 600)
{
/* Create secret door */
- place_closed_door(y, x);
+ place_closed_door(y, x);
- /* Hide */
- c_ptr->mimic = fill_type[randint0(100)];
+ /* Hide. If on the edge of room, use outer wall. */
+ c_ptr->mimic = room ? feat_wall_outer : fill_type[randint0(100)];
+
+ /* Floor type terrain cannot hide a door */
+ if (!(c_ptr->mimic & 0x20))
+ {
+ c_ptr->feat = c_ptr->mimic;
+ c_ptr->mimic = 0;
+ }
}
/* Closed, locked, or stuck doors (400/1000) */
/* Create jammed door */
cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x08 + randint0(8));
}
+
+ /* Now it is not floor */
+ cave[y][x].info &= ~(CAVE_MASK);
}
/* Place an item */
if (randint0(100) < 75)
{
- place_object(j, k, FALSE, FALSE);
+ place_object(j, k, 0L);
}
/* Place gold */
}
}
}
+
+ /* Clear mimic type */
+ cave[*y][*x].mimic = 0;
+
place_floor_bold(*y, *x);
return TRUE;
{
int x3, y3, dx, dy;
int changex, changey;
- int midval;
int length;
int i;
bool retval, firstsuccede;
x3 = (x1 + x2) / 2;
y3 = (y1 + y2) / 2;
}
- /* cache midvalue */
+ /* cache c_ptr */
c_ptr = &cave[y3][x3];
- midval = cave[y3][x3].feat;
if (is_solid_grid(c_ptr))
{
/* move midpoint a bit to avoid problem. */
y3 += dy;
x3 += dx;
c_ptr = &cave[y3][x3];
- midval = cave[y3][x3].feat;
}
if (is_floor_grid(c_ptr))