AM_CONFIG_HEADER(src/autoconf.h)
-AM_INIT_AUTOMAKE(hengband, 1.3.0)
+AM_INIT_AUTOMAKE(hengband, 1.3.1)
AC_ARG_WITH(setgid,
[ --with-setgid=NAME install hengband as group NAME],
# N:serial number:terrain name
# G:symbol:color
+# M:mimic
-# N' indicates the beginning of an entry. The serial number must
+# 'N' indicates the beginning of an entry. The serial number must
# increase for each new item.
# 'G' is for graphics - symbol and color. There are 16 colors, as
# follows:
+# 'M' is for fixed mimicing terrain type. Pretend other terrain with
+# all visual effects. No effect on temporal mimic.
+
# D - Black w - White s - Gray o - Orange
# r - Red g - Green b - Blue u - Brown
# d - Dark Gray W - Light Gray v - Violet y - Yellow
N:32:¥É¥¢
E:door
G:+:U
-M:32
# 0x2x --> locked door (power 1)
# 0x34 --> magma vein + treasure
-N:52:ÍÏ´ä¤Î¹ÛÌ®
-E:magma vein
+N:52:ÍÏ´ä¤Î¹ÛÌ®(±£¤µ¤ì¤¿ºâÊõ¤ò´ÞÍ)
+E:magma vein with hidden treasure
G:%:s
M:50
# 0x35 --> quartz vein + treasure
-N:53:ÀбѤιÛÌ®
-E:quartz vein
+N:53:ÀбѤιÛÌ®(±£¤µ¤ì¤¿ºâÊõ¤ò´ÞÍ)
+E:quartz vein hidden treasure
G:%:w
M:51
G:*:W
N:193:¥À¥ó¥¸¥ç¥ó¤Ø¤ÎÆþ¸ý
-E:Entrance to dungeon
+E:entrance to dungeon
G:>:v
N:194:¾ÂÃÏ
-E:Swamp
+E:swamp
G:.:B
N:195:¶À
-E:Mirror
+E:mirror
G:*:v
# Used by view_unsafe_grids option
-
N:196:̤ÃΤÎÃÏ·Á (̤´¶ÃÎ)
E:unknown grid (not detected)
G:x:D
****************************************
- ** Hengband 1.3.0 **
+ ** Hengband 1.3.1 **
****************************************
Based on Moria: Copyright (c) 1985 Robert Alan Koeneke
***************************************
- ** ÊѶòÈÚÅÜ 1.3.0 **
+ ** ÊѶòÈÚÅÜ 1.3.1 **
***************************************
Based on Moria: Copyright (c) 1985 Robert Alan Koeneke
/*
+ * Return TRUE if the given grid is a known trap
+ */
+bool is_known_trap(cave_type *c_ptr)
+{
+ if (!c_ptr->mimic && is_trap(c_ptr->feat)) return TRUE;
+ else return FALSE;
+}
+
+
+/*
+ * Return TRUE if the given grid is a closed door
+ */
+bool is_closed_door(int feat)
+{
+ return (feat >= FEAT_DOOR_HEAD && feat <= FEAT_DOOR_TAIL);
+}
+
+
+/*
+ * Return TRUE if the given grid is a hidden closed door
+ */
+bool is_hidden_door(cave_type *c_ptr)
+{
+ if (c_ptr->mimic &&
+ is_closed_door(c_ptr->feat))
+ return TRUE;
+ else
+ return FALSE;
+}
+
+
+/*
* A simple, fast, integer-based line-of-sight algorithm. By Joseph Hall,
* 4116 Brewster Drive, Raleigh NC 27606. Email to jnh@ecemwl.ncsu.edu.
*
case FEAT_MORE:
case FEAT_LESS_LESS:
case FEAT_MORE_MORE:
- case FEAT_SECRET:
case FEAT_RUBBLE:
case FEAT_MAGMA:
case FEAT_QUARTZ:
/* Get the cave */
c_ptr = &cave[y][x];
- /* Feature code */
- feat = c_ptr->mimic ? c_ptr->mimic : c_ptr->feat;
- feat = (c_ptr->info & CAVE_IN_MIRROR) ? FEAT_MIRROR : feat;
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
/* Floors (etc) */
if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
/* Memorized grids */
if ((c_ptr->info & CAVE_MARK) && (view_granite_lite || new_ascii_graphics))
{
- /* Apply "mimic" field */
- if (c_ptr->mimic)
- feat = c_ptr->mimic;
- else
- feat = f_info[feat].mimic;
-
/* Access feature */
f_ptr = &f_info[feat];
a = lighting_colours[a][0];
}
else if (use_graphics &&
- feat_supports_lighting(c_ptr->feat))
+ feat_supports_lighting(feat))
{
/* Use a brightly lit tile */
c += 2;
/* Special lighting effects */
else if (view_granite_lite && !p_ptr->wild_mode &&
(((a == TERM_WHITE) && !use_graphics) ||
- (use_graphics && feat_supports_lighting(c_ptr->feat))))
+ (use_graphics && feat_supports_lighting(feat))))
{
/* Handle "blind" */
if (p_ptr->blind)
case FEAT_DEEP_GRASS:
case FEAT_SWAMP:
case FEAT_TREES:
- case FEAT_SECRET:
case FEAT_RUBBLE:
case FEAT_MAGMA:
case FEAT_QUARTZ:
(*cp) = c;
/* Hack -- rare random hallucination, except on outer dungeon walls */
- if (p_ptr->image && (c_ptr->feat < FEAT_PERM_SOLID) && !randint0(256))
+ if (p_ptr->image && (feat < FEAT_PERM_SOLID) && !randint0(256))
{
/* Hallucinate */
image_random(ap, cp);
s16b this_o_idx, next_o_idx = 0;
+ byte feat;
+
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* Blind players see nothing */
if (p_ptr->blind) return;
c_ptr->info |= (CAVE_MARK);
}
/* Handle floor grids first */
- if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
+ if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
{
/* Option -- memorize all torch-lit floors */
if (view_torch_grids && (c_ptr->info & (CAVE_LITE | CAVE_MNLT)))
c_ptr = &cave[y][x];
- if ((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_SECRET)) m += 3;
+ if (is_closed_door(c_ptr->feat)) m += 3;
/* Ignore "pre-stamped" entries */
if (c_ptr->dist != 0 && c_ptr->dist <= n && c_ptr->cost <= m) continue;
/* Ignore "walls" and "rubble" */
- if ((c_ptr->feat > FEAT_SECRET) && (c_ptr->feat != FEAT_TREES) && !cave_floor_grid(c_ptr)) continue;
+ if ((c_ptr->feat >= FEAT_RUBBLE) && (c_ptr->feat != FEAT_TREES) && !cave_floor_grid(c_ptr)) continue;
/* Save the flow cost */
if (c_ptr->cost == 0 || c_ptr->cost > m) c_ptr->cost = m;
c_ptr = &cave[y][x];
/* Walls, water, and lava cannot hold scent. */
- if ((c_ptr->feat > FEAT_SECRET) && (c_ptr->feat != FEAT_TREES) && !cave_floor_grid(c_ptr)) continue;
+ if ((c_ptr->feat >= FEAT_RUBBLE) && (c_ptr->feat != FEAT_TREES) && !cave_floor_grid(c_ptr)) continue;
/* Grid must not be blocked by walls from the character */
if (!player_has_los_bold(y, x)) continue;
cave_type *c_ptr;
+ byte feat;
+
if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
/* Scan that area */
c_ptr = &cave[y][x];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* All non-walls are "checked" */
- if ((c_ptr->feat < FEAT_SECRET) ||
- (c_ptr->feat == FEAT_RUBBLE) ||
- ((c_ptr->feat >= FEAT_MINOR_GLYPH) &&
- (c_ptr->feat <= FEAT_TREES)) ||
- (c_ptr->feat >= FEAT_TOWN))
+ if ((feat <= FEAT_DOOR_TAIL) ||
+ (feat == FEAT_RUBBLE) ||
+ ((feat >= FEAT_MINOR_GLYPH) &&
+ (feat <= FEAT_TREES)) ||
+ (feat >= FEAT_TOWN))
{
/* Memorize normal features */
- if ((c_ptr->feat > FEAT_INVIS) && (c_ptr->feat != FEAT_DIRT) && (c_ptr->feat != FEAT_GRASS))
+ if ((feat > FEAT_INVIS) && (feat != FEAT_DIRT) && (feat != FEAT_GRASS))
{
/* Memorize the object */
c_ptr->info |= (CAVE_MARK);
{
c_ptr = &cave[y + ddy_ddd[i]][x + ddx_ddd[i]];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* Memorize walls (etc) */
- if ((c_ptr->feat >= FEAT_SECRET) && (c_ptr->feat != FEAT_DIRT) && (c_ptr->feat != FEAT_GRASS))
+ if ((feat >= FEAT_RUBBLE) && (feat != FEAT_DIRT) && (feat != FEAT_GRASS))
{
/* Memorize the walls */
c_ptr->info |= (CAVE_MARK);
void wiz_lite(bool wizard, bool ninja)
{
int i, y, x;
+ cave_type *c_ptr;
+ byte feat;
/* Memorize objects */
for (i = 1; i < o_max; i++)
{
cave_type *c_ptr = &cave[y][x];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* Process all non-walls */
- if (cave_floor_bold(y, x) || (c_ptr->feat == FEAT_RUBBLE) || (c_ptr->feat == FEAT_TREES) || (c_ptr->feat == FEAT_MOUNTAIN))
+ if (cave_floor_bold(y, x) || (feat == FEAT_RUBBLE) || (feat == FEAT_TREES) || (feat == FEAT_MOUNTAIN))
{
/* Scan all neighbors */
for (i = 0; i < 9; i++)
/* Get the grid */
c_ptr = &cave[yy][xx];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* Memorize normal features */
if (ninja)
{
}
else
{
- if ((c_ptr->feat > FEAT_INVIS))
+ if ((feat > FEAT_INVIS))
{
/* Memorize the grid */
c_ptr->info |= (CAVE_MARK);
{
cave_type *c_ptr = &cave[y][x];
+ /* Clear mimic type */
+ c_ptr->mimic = 0;
+
/* Change the feature */
c_ptr->feat = feat;
void remove_mirror(int y, int x)
{
/* Remove the mirror */
- cave[y][x].info &= ~(CAVE_IN_MIRROR);
+ cave[y][x].info &= ~(CAVE_OBJECT);
+ cave[y][x].mimic = 0;
if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
{
lite_spot(y, x);
}
+
+/*
+ * Return TRUE if there is a mirror on the grid.
+ */
+bool is_mirror_grid(cave_type *c_ptr)
+{
+ if ((c_ptr->info & CAVE_OBJECT) && c_ptr->mimic == FEAT_MIRROR)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+
+/*
+ * Return TRUE if there is a mirror on the grid.
+ */
+bool is_glyph_grid(cave_type *c_ptr)
+{
+ if ((c_ptr->info & CAVE_OBJECT) && c_ptr->mimic == FEAT_GLYPH)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+
+/*
+ * Return TRUE if there is a mirror on the grid.
+ */
+bool is_explosive_rune_grid(cave_type *c_ptr)
+{
+ if ((c_ptr->info & CAVE_OBJECT) && c_ptr->mimic == FEAT_MINOR_GLYPH)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+
/*
* Calculate "incremental motion". Used by project() and shoot().
* Assumes that (*y,*x) lies on the path from (y1,x1) to (y2,x2).
c_ptr = &cave[y][x];
/* Invisible trap */
- if (c_ptr->info & CAVE_TRAP)
+ if (c_ptr->mimic && is_trap(c_ptr->feat))
{
/* Pick a trap */
- pick_trap(y, x);
+ disclose_grid(y, x);
/* Message */
#ifdef JP
disturb(0, 0);
}
- /* Invisible wall opening trap */
- if (c_ptr->feat == FEAT_INVIS)
- {
- /* Activate the trap */
- cave_set_feat(y, x, FEAT_TRAP_OPEN);
-
- /* Message */
-#ifdef JP
- msg_print("¥È¥é¥Ã¥×¤òȯ¸«¤·¤¿¡£");
-#else
- msg_print("You have found a trap.");
-#endif
-
- /* Disturb */
- disturb(0, 0);
- }
-
/* Secret door */
- if (c_ptr->feat == FEAT_SECRET)
+ if (is_hidden_door(c_ptr))
{
/* Message */
#ifdef JP
msg_print("You have found a secret door.");
#endif
-
- /* Pick a door */
- place_closed_door(y, x);
+ /* Disclose */
+ disclose_grid(y, x);
/* Disturb */
disturb(0, 0);
void move_player(int dir, int do_pickup, bool break_trap)
{
int y, x;
+ byte feat;
cave_type *c_ptr;
monster_type *m_ptr;
/* Examine the destination */
c_ptr = &cave[y][x];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
/* Exit the area */
if (!dun_level && !p_ptr->wild_mode &&
#ifdef ALLOW_EASY_DISARM /* TNB */
/* Disarm a visible trap */
- else if ((do_pickup != easy_disarm) && is_trap(c_ptr->feat))
+ else if ((do_pickup != easy_disarm) && is_known_trap(c_ptr))
{
bool ignore = FALSE;
switch (c_ptr->feat)
(p_ptr->blind || !(c_ptr->info & (CAVE_LITE))))
{
/* Rubble */
- if (c_ptr->feat == FEAT_RUBBLE)
+ if (feat == FEAT_RUBBLE)
{
#ifdef JP
msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
}
/* Closed door */
- else if (c_ptr->feat < FEAT_SECRET)
+ else if (is_closed_door(feat))
{
#ifdef JP
msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
else
{
/* Rubble */
- if (c_ptr->feat == FEAT_RUBBLE)
+ if (feat == FEAT_RUBBLE)
{
#ifdef JP
msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
*/
}
/* Closed doors */
- else if (c_ptr->feat < FEAT_SECRET)
+ else if (is_closed_door(feat))
{
#ifdef ALLOW_EASY_OPEN
if (p_ptr->riding && (r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_KILL_WALL))
{
- if (cave[py][px].feat > FEAT_SECRET && cave[py][px].feat < FEAT_PERM_SOLID)
+ if (cave[py][px].feat >= FEAT_RUBBLE && cave[py][px].feat < FEAT_PERM_SOLID)
{
/* Forget the wall */
cave[py][px].info &= ~(CAVE_MARK);
p_ptr->leaving = TRUE;
}
- /* Discover invisible traps */
- else if (c_ptr->info & CAVE_TRAP)
+ /* Set off a trap */
+ else if (is_trap(c_ptr->feat))
{
/* Disturb */
disturb(0, 0);
- /* Message */
+ /* Hidden trap */
+ if (c_ptr->mimic)
+ {
+ /* Message */
#ifdef JP
- msg_print("¥È¥é¥Ã¥×¤À¡ª");
+ msg_print("¥È¥é¥Ã¥×¤À¡ª");
#else
- msg_print("You found a trap!");
+ msg_print("You found a trap!");
#endif
-
- /* Pick a trap */
- pick_trap(py, px);
-
- /* Hit the trap */
- hit_trap(break_trap);
- }
-
- /* Discover invisible wall opening trap */
- else if (c_ptr->feat == FEAT_INVIS)
- {
- c_ptr->feat = FEAT_TRAP_OPEN;
-
- /* Disturb */
- disturb(0, 0);
-
- /* Message */
-#ifdef JP
- msg_print("¥È¥é¥Ã¥×¤À¡ª");
-#else
- msg_print("You found a trap!");
-#endif
-
- /* Hit the trap */
- hit_trap(break_trap);
- }
-
- /* Set off an visible trap */
- else if (is_trap(c_ptr->feat))
- {
- /* Disturb */
- disturb(0, 0);
+ /* Pick a trap */
+ disclose_grid(py, px);
+ }
/* Hit the trap */
hit_trap(break_trap);
if (!in_bounds2(y, x)) return (FALSE);
/* Non-wall grids are not known walls */
- if (cave[y][x].feat < FEAT_SECRET) return (FALSE);
+ if (cave[y][x].feat <= FEAT_DOOR_TAIL) return (FALSE);
if ((cave[y][x].feat >= FEAT_DEEP_WATER) &&
(cave[y][x].feat <= FEAT_GRASS)) return (FALSE);
int i, max, inv;
int option = 0, option2 = 0;
cave_type *c_ptr;
+ byte feat;
/* Where we came from */
prev_dir = find_prevdir;
/* Access grid */
c_ptr = &cave[row][col];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
/* Visible monsters abort running */
if (c_ptr->m_idx)
bool notice = TRUE;
/* Examine the terrain */
- switch (c_ptr->feat)
+ switch (feat)
{
/* Floors */
case FEAT_FLOOR:
/* Invis traps */
case FEAT_INVIS:
- /* Secret doors */
- case FEAT_SECRET:
-
/* Normal veins */
case FEAT_MAGMA:
case FEAT_QUARTZ:
/* Access grid */
c_ptr = &cave[row][col];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
if (!(c_ptr->info & (CAVE_MARK)) ||
- ((c_ptr->feat < FEAT_SECRET) ||
- (c_ptr->feat == FEAT_FLOWER) ||
- (c_ptr->feat == FEAT_DEEP_GRASS) ||
- ((c_ptr->feat >= FEAT_DEEP_WATER) &&
- (c_ptr->feat <= FEAT_GRASS))))
+ ((feat <= FEAT_DOOR_TAIL) ||
+ (feat == FEAT_FLOWER) ||
+ (feat == FEAT_DEEP_GRASS) ||
+ ((feat >= FEAT_DEEP_WATER) &&
+ (feat <= FEAT_GRASS))))
{
/* Looking to break right */
/* Access grid */
c_ptr = &cave[row][col];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
if (!(c_ptr->info & (CAVE_MARK)) ||
- ((c_ptr->feat < FEAT_SECRET) ||
- (c_ptr->feat == FEAT_FLOWER) ||
- (c_ptr->feat == FEAT_DEEP_GRASS) ||
- ((c_ptr->feat >= FEAT_DEEP_WATER) &&
- (c_ptr->feat <= FEAT_GRASS))))
+ ((feat <= FEAT_DOOR_TAIL) ||
+ (feat == FEAT_FLOWER) ||
+ (feat == FEAT_DEEP_GRASS) ||
+ ((feat >= FEAT_DEEP_WATER) &&
+ (feat <= FEAT_GRASS))))
{
/* Looking to break left */
return (feat == FEAT_OPEN);
}
-static bool is_closed(int feat)
-{
- return ((feat >= FEAT_DOOR_HEAD) && (feat <= FEAT_DOOR_TAIL));
-}
/*
* Return the number of features around (or under) the character.
/* Check around (and under) the character */
for (d = 0; d < 9; d++)
{
+ cave_type *c_ptr;
+ byte feat;
+
/* if not searching under player continue */
if ((d == 8) && !under) continue;
yy = py + ddy_ddd[d];
xx = px + ddx_ddd[d];
+ /* Get the cave */
+ c_ptr = &cave[yy][xx];
+
/* Must have knowledge */
- if (!(cave[yy][xx].info & (CAVE_MARK))) continue;
+ if (!(c_ptr->info & (CAVE_MARK))) continue;
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* Not looking for this feature */
- if (!((*test)(cave[yy][xx].feat))) continue;
+ if (!((*test)(feat))) continue;
/* OK */
++count;
int num_doors, num_chests;
/* Count closed doors (locked or jammed) */
- num_doors = count_dt(&y, &x, is_closed, FALSE);
+ num_doors = count_dt(&y, &x, is_closed_door, FALSE);
/* Count chests (locked) */
num_chests = count_chests(&y, &x, FALSE);
o_idx = chest_check(y, x);
/* Nothing useful */
- if (!((c_ptr->feat >= FEAT_DOOR_HEAD) &&
- (c_ptr->feat <= FEAT_DOOR_TAIL)) &&
- !o_idx)
+ if (!(is_closed_door(c_ptr->feat) && !c_ptr->mimic) &&
+ !o_idx)
{
/* Message */
#ifdef JP
static bool do_cmd_tunnel_aux(int y, int x, int dir)
{
cave_type *c_ptr;
+ byte feat;
bool more = FALSE;
/* Get grid */
c_ptr = &cave[y][x];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* Sound */
sound(SOUND_DIG);
/* Titanium */
- if ((c_ptr->feat >= FEAT_PERM_EXTRA) &&
- (c_ptr->feat <= FEAT_PERM_SOLID))
+ if ((feat >= FEAT_PERM_EXTRA) &&
+ (feat <= FEAT_PERM_SOLID))
{
#ifdef JP
msg_print("¤³¤Î´ä¤Ï¹Å¤¹¤®¤Æ·¡¤ì¤Ê¤¤¤è¤¦¤À¡£");
}
/* No tunnelling through mountains */
- else if (c_ptr->feat == FEAT_MOUNTAIN)
+ else if (feat == FEAT_MOUNTAIN)
{
#ifdef JP
msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤!");
}
- else if (c_ptr->feat == FEAT_TREES) /* -KMW- */
+ else if (feat == FEAT_TREES) /* -KMW- */
{
/* Chop Down */
if ((p_ptr->skill_dig > 10 + randint0(400)) && twall(y, x, FEAT_GRASS))
/* Granite */
- else if ((c_ptr->feat >= FEAT_WALL_EXTRA) &&
- (c_ptr->feat <= FEAT_WALL_SOLID))
+ else if ((feat >= FEAT_WALL_EXTRA) &&
+ (feat <= FEAT_WALL_SOLID))
{
/* Tunnel */
if ((p_ptr->skill_dig > 40 + randint0(1600)) && twall(y, x, floor_type[randint0(100)]))
/* Quartz / Magma */
- else if ((c_ptr->feat >= FEAT_MAGMA) &&
- (c_ptr->feat <= FEAT_QUARTZ_K))
+ else if ((feat >= FEAT_MAGMA) &&
+ (feat <= FEAT_QUARTZ_K))
{
bool okay = FALSE;
bool gold = FALSE;
bool hard = FALSE;
/* Found gold */
- if (c_ptr->feat >= FEAT_MAGMA_H) gold = TRUE;
+ if (feat >= FEAT_MAGMA_H) gold = TRUE;
/* Extract "quartz" flag XXX XXX XXX */
- if ((c_ptr->feat - FEAT_MAGMA) & 0x01) hard = TRUE;
+ if ((feat - FEAT_MAGMA) & 0x01) hard = TRUE;
/* Quartz */
if (hard)
}
/* Rubble */
- else if (c_ptr->feat == FEAT_RUBBLE)
+ else if (feat == FEAT_RUBBLE)
{
/* Remove the rubble */
if ((p_ptr->skill_dig > randint0(200)) && twall(y, x, floor_type[randint0(100)]))
}
}
- /* Secret doors */
- else if (c_ptr->feat >= FEAT_SECRET)
- {
- /* Tunnel */
- if ((p_ptr->skill_dig > 30 + randint0(1200)) && twall(y, x, floor_type[randint0(100)]))
- {
-#ifdef JP
- msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
-#else
- msg_print("You have finished the tunnel.");
-#endif
-
- }
-
- /* Keep trying */
- else
- {
- /* We may continue tunelling */
-#ifdef JP
- msg_print("²ÖÖ¾´ä¤ÎÊɤ˷ê¤ò·¡¤Ã¤Æ¤¤¤ë¡£");
-#else
- msg_print("You tunnel into the granite wall.");
-#endif
-
- more = TRUE;
-
- /* Occasional Search XXX XXX */
- if (randint0(100) < 25) search();
- }
- }
-
/* Doors */
else
{
}
}
+ if (is_hidden_door(c_ptr))
+ {
+ /* Occasional Search XXX XXX */
+ if (randint0(100) < 25) search();
+ }
+
/* Notice new floor grids */
if (!cave_floor_bold(y, x))
{
int y, x, dir;
cave_type *c_ptr;
+ byte feat;
bool more = FALSE;
/* Get grid */
c_ptr = &cave[y][x];
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* No tunnelling through doors */
- if (((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_DOOR_TAIL)) ||
- ((c_ptr->feat >= FEAT_BLDG_HEAD) && (c_ptr->feat <= FEAT_BLDG_TAIL)) ||
- ((c_ptr->feat >= FEAT_SHOP_HEAD) && (c_ptr->feat <= FEAT_SHOP_TAIL)) ||
- (c_ptr->feat == FEAT_MUSEUM))
+ if (((feat >= FEAT_DOOR_HEAD) && (feat <= FEAT_DOOR_TAIL)) ||
+ ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) ||
+ ((feat >= FEAT_SHOP_HEAD) && (feat <= FEAT_SHOP_TAIL)) ||
+ (feat == FEAT_MUSEUM))
{
/* Message */
#ifdef JP
}
/* No tunnelling through air */
- else if (cave_floor_grid(c_ptr) || ((c_ptr->feat >= FEAT_MINOR_GLYPH) &&
- (c_ptr->feat <= FEAT_PATTERN_XTRA2)))
+ else if (cave_floor_grid(c_ptr) || ((feat >= FEAT_MINOR_GLYPH) &&
+ (feat <= FEAT_PATTERN_XTRA2)))
{
/* Message */
#ifdef JP
}
/* No tunnelling through mountains */
- else if (c_ptr->feat == FEAT_MOUNTAIN)
+ else if (feat == FEAT_MOUNTAIN)
{
#ifdef JP
msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤¡£");
}
/* Tunnel through walls */
- else if (((c_ptr->feat >= FEAT_SECRET) &&
+ else if (((c_ptr->feat >= FEAT_RUBBLE) &&
(c_ptr->feat < FEAT_MINOR_GLYPH)) ||
((c_ptr->feat == FEAT_TREES) ||
(c_ptr->feat == FEAT_MOUNTAIN)))
{
- /* Tunnel */
more = do_cmd_tunnel_aux(y, x, dir);
}
- /* Bash jammed doors */
- else if ((c_ptr->feat >= FEAT_DOOR_HEAD + 0x08) &&
- (c_ptr->feat < FEAT_MINOR_GLYPH))
- {
- /* Tunnel */
- more = do_cmd_bash_aux(y, x, dir);
- }
-
- /* Open closed doors */
- else if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
- (c_ptr->feat < FEAT_MINOR_GLYPH))
- {
- /* Tunnel */
- more = do_cmd_open_aux(y, x, dir);
- }
+ else if (is_closed_door(c_ptr->feat))
+ {
+ /* Tunnel hidden door */
+ if (c_ptr->mimic)
+ {
+ more = do_cmd_tunnel_aux(y, x, dir);
+ }
+
+ /* Bash jammed doors */
+ else if (c_ptr->feat >= FEAT_DOOR_HEAD + 0x08)
+ {
+ more = do_cmd_bash_aux(y, x, dir);
+ }
+
+ /* Locked doors */
+ else
+ {
+ more = do_cmd_open_aux(y, x, dir);
+ }
+ }
/* Close open doors */
else if ((c_ptr->feat == FEAT_OPEN) ||
(c_ptr->feat == FEAT_BROKEN))
{
- /* Tunnel */
more = do_cmd_close_aux(y, x, dir);
}
/* Disarm traps */
else if (is_trap(c_ptr->feat))
{
- /* Tunnel */
more = do_cmd_disarm_aux(y, x, dir);
}
/* Savefile version for Hengband 1.1.1 and later */
#define H_VER_MAJOR 1
#define H_VER_MINOR 3
-#define H_VER_PATCH 0
-#define H_VER_EXTRA 1
+#define H_VER_PATCH 1
+#define H_VER_EXTRA 0
/* Added for ZAngband */
#define FAKE_VERSION 0
#define FAKE_VER_MAJOR 11
#define FAKE_VER_MINOR 3
-#define FAKE_VER_PATCH 0
+#define FAKE_VER_PATCH 1
#define ANGBAND_2_8_1
#define ZANGBAND
#define CAVE_VIEW 0x0020 /* view flag */
#define CAVE_TEMP 0x0040 /* temp flag */
#define CAVE_XTRA 0x0080 /* misc flag */
-#define CAVE_MNLT 0x0100 /* Illuminated by monster */
+#define CAVE_MNLT 0x0100 /* Illuminated by monster */
-#define CAVE_TRAP 0x8000
+#define CAVE_XXX0 0x8000 /* Now unused */
/* Used only while cave generation */
#define CAVE_FLOOR 0x0200
#define CAVE_XXXX1 0x0200
#define CAVE_XXXX2 0x0400
#define CAVE_XXXX3 0x0800
-#define CAVE_IN_MIRROR 0x1000 /* mirror */
+#define CAVE_OBJECT 0x1000 /* mirror */
#define CAVE_UNSAFE 0x2000 /* Might have trap */
#define CAVE_IN_DETECT 0x4000 /* trap detected area (inner circle only) */
(cave[Y][X].feat == FEAT_FLOWER) || \
(cave[Y][X].feat == FEAT_GRASS) || \
(cave[Y][X].feat == FEAT_DIRT)) && \
- !(cave[Y][X].info & CAVE_TRAP) && \
- !(cave[Y][X].info & CAVE_IN_MIRROR) && \
+ !(cave[Y][X].info & CAVE_OBJECT) && \
(cave[Y][X].o_idx == 0))
(cave[Y][X].feat == FEAT_DEEP_GRASS) || \
(cave[Y][X].feat == FEAT_FLOWER) || \
(cave[Y][X].feat == FEAT_DIRT)) && \
- !(cave[Y][X].info & CAVE_TRAP) && \
+ !(cave[Y][X].info & CAVE_OBJECT) && \
(cave[Y][X].o_idx == 0) && \
(cave[Y][X].m_idx == 0))
(y == 0) || (y == cur_hgt-1))
{
/* Forget the grid */
- if (!(c_ptr->info & CAVE_IN_MIRROR)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
+ if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
/* Hack -- Notice spot */
note_spot(y, x);
/* cave.c */
extern int distance(int y1, int x1, int y2, int x2);
extern bool is_trap(int feat);
+extern bool is_known_trap(cave_type *c_ptr);
+extern bool is_closed_door(int feat);
+extern bool is_hidden_door(cave_type *c_ptr);
extern bool los(int y1, int x1, int y2, int x2);
extern bool player_can_see_bold(int y, int x);
extern bool cave_valid_bold(int y, int x);
extern void wiz_dark(void);
extern void cave_set_feat(int y, int x, int feat);
extern void remove_mirror(int y, int x);
+extern bool is_mirror_grid(cave_type *c_ptr);
+extern bool is_glyph_grid(cave_type *c_ptr);
+extern bool is_explosive_rune_grid(cave_type *c_ptr);
extern void mmove2(int *y, int *x, int y1, int x1, int y2, int x2);
extern bool projectable(int y1, int x1, int y2, int x2);
extern void scatter(int *yp, int *xp, int y, int x, int d, int mode);
extern void place_gold(int y, int x);
extern s16b drop_near(object_type *o_ptr, int chance, int y, int x);
extern void acquirement(int y1, int x1, int num, bool great, bool known);
-extern void pick_trap(int y, int x);
+extern byte choose_random_trap(void);
+extern void disclose_grid(int y, int x);
extern void place_trap(int y, int x);
extern void inven_item_charges(int item);
extern void inven_item_describe(int item);
/* Require a certain number of adjacent walls */
if (next_to_walls(y, x) < walls) continue;
- /* No hidden trap on stairs */
- c_ptr->info &= ~CAVE_TRAP;
+ /* Clear possible garbage of hidden trap */
+ c_ptr->mimic = 0;
/* Clear previous contents, add stairs */
if (i < more_num) c_ptr->feat = feat+0x07;
if (tmp < 300)
{
/* Create open door */
- cave_set_feat(y, x, FEAT_OPEN);
+ set_cave_feat(y, x, FEAT_OPEN);
}
/* Broken doors (100/1000) */
else if (tmp < 400)
{
/* Create broken door */
- cave_set_feat(y, x, FEAT_BROKEN);
+ set_cave_feat(y, x, FEAT_BROKEN);
}
/* Secret doors (200/1000) */
else if (tmp < 600)
{
+ cave_type *c_ptr = &cave[y][x];
+
/* Create secret door */
- cave_set_feat(y, x, FEAT_SECRET);
+ place_closed_door(y, x);
+
+ /* Hide */
+ c_ptr->mimic = fill_type[randint0(100)];
}
/* Closed, locked, or stuck doors (400/1000) */
+/* Old hidden trap flag */
+#define CAVE_TRAP 0x8000
+
/*
* Read the dungeon
*
}
}
- /* Convert cave data */
- if (z_older_than(11, 0, 99))
- {
- for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++)
- {
- /* Wipe old unused flags */
- cave[y][x].info &= ~(CAVE_MASK);
- }
- }
-
- if (h_older_than(1, 1, 1, 0))
- {
- for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++)
- {
- /* Access the cave */
- c_ptr = &cave[y][x];
-
- /* Very old */
- if (c_ptr->feat == FEAT_INVIS)
- {
- c_ptr->feat = FEAT_FLOOR;
- c_ptr->info |= CAVE_TRAP;
- }
-
- /* Older than 1.1.1 */
- if (c_ptr->feat == FEAT_MIRROR)
- {
- c_ptr->feat = FEAT_FLOOR;
- c_ptr->info |= CAVE_IN_MIRROR;
- }
- }
- }
-
/*** Run length decoding ***/
/* Load the dungeon data */
}
}
+ /* Convert cave data */
+ if (z_older_than(11, 0, 99))
+ {
+ for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++)
+ {
+ /* Wipe old unused flags */
+ cave[y][x].info &= ~(CAVE_MASK);
+ }
+ }
+
+ if (h_older_than(1, 1, 1, 0))
+ {
+ for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++)
+ {
+ /* Access the cave */
+ c_ptr = &cave[y][x];
+
+ /* Very old */
+ if (c_ptr->feat == FEAT_INVIS)
+ {
+ c_ptr->feat = FEAT_FLOOR;
+ c_ptr->info |= CAVE_TRAP;
+ }
+
+ /* Older than 1.1.1 */
+ if (c_ptr->feat == FEAT_MIRROR)
+ {
+ c_ptr->feat = FEAT_FLOOR;
+ c_ptr->info |= CAVE_OBJECT;
+ }
+ }
+ }
+
+ if (h_older_than(1, 3, 1, 0))
+ {
+ for (y = 0; y < ymax; y++) for (x = 0; x < xmax; x++)
+ {
+ /* Access the cave */
+ c_ptr = &cave[y][x];
+
+ /* Old CAVE_IN_MIRROR flag */
+ if (c_ptr->info & CAVE_OBJECT)
+ {
+ c_ptr->mimic = FEAT_MIRROR;
+ }
+
+ /* Runes will be mimics and flags */
+ else if (c_ptr->feat == FEAT_MINOR_GLYPH ||
+ c_ptr->feat == FEAT_GLYPH)
+ {
+ c_ptr->info |= CAVE_OBJECT;
+ c_ptr->mimic = c_ptr->feat;
+ c_ptr->feat = FEAT_FLOOR;
+ }
+
+ /* Hidden traps will be trap terrains mimicing floor */
+ else if (c_ptr->info & CAVE_TRAP)
+ {
+ c_ptr->info &= ~CAVE_TRAP;
+ c_ptr->mimic = c_ptr->feat;
+ c_ptr->feat = choose_random_trap();
+ }
+
+ /* Another hidden trap */
+ else if (c_ptr->feat == FEAT_INVIS)
+ {
+ c_ptr->mimic = FEAT_FLOOR;
+ c_ptr->feat = FEAT_TRAP_OPEN;
+ }
+
+ /* Hidden doors will be closed doors mimicing wall */
+ else if (c_ptr->feat == FEAT_SECRET)
+ {
+ place_closed_door(y, x);
+ c_ptr->mimic = FEAT_WALL_EXTRA;
+ }
+ }
+ }
+
/*** Objects ***/
/* Read the item count */
alive = FALSE;
}
}
- if( (cave[py][px].info & CAVE_IN_MIRROR)){
+ if (is_mirror_grid(&cave[py][px])) {
teleport_player(10);
}
}
if (!(((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || p_ptr->pass_wall)) || (r_ptr->flags2 & RF2_KILL_WALL)))
{
if (cost == 0) continue;
- if (!can_open_door && (c_ptr->feat >= FEAT_DOOR_HEAD && c_ptr->feat <= FEAT_SECRET)) continue;
+ if (!can_open_door && is_closed_door(c_ptr->feat)) continue;
}
/* Hack -- for kill or pass wall monster.. */
/* Forget the wall */
c_ptr->info &= ~(CAVE_MARK);
+ /* Clear garbage of hidden trap or door */
+ c_ptr->mimic = 0;
+
/* Notice */
c_ptr->feat = floor_type[randint0(100)];
}
/* Handle doors and secret doors */
- else if (((c_ptr->feat >= FEAT_DOOR_HEAD) &&
- (c_ptr->feat <= FEAT_DOOR_TAIL)) ||
- (c_ptr->feat == FEAT_SECRET))
+ else if (is_closed_door(c_ptr->feat))
{
bool may_bash = TRUE;
if ((r_ptr->flags2 & RF2_OPEN_DOOR) &&
(!is_pet(m_ptr) || (p_ptr->pet_extra_flags & PF_OPEN_DOORS)))
{
- /* Closed doors and secret doors */
- if ((c_ptr->feat == FEAT_DOOR_HEAD) ||
- (c_ptr->feat == FEAT_SECRET))
+ /* Closed doors */
+ if (c_ptr->feat == FEAT_DOOR_HEAD)
{
/* The door is open */
did_open_door = TRUE;
}
/* Hack -- check for Glyph of Warding */
- if (do_move && (c_ptr->feat == FEAT_GLYPH) &&
+ if (do_move && is_glyph_grid(c_ptr) &&
!((r_ptr->flags1 & RF1_NEVER_BLOW) && (py == ny) && (px == nx)))
{
/* Assume no move allowed */
c_ptr->info &= ~(CAVE_MARK);
/* Break the rune */
- c_ptr->feat = floor_type[randint0(100)];
+ c_ptr->info &= ~(CAVE_OBJECT);
+ c_ptr->mimic = 0;
/* Allow movement */
do_move = TRUE;
note_spot(ny, nx);
}
}
- else if (do_move && (c_ptr->feat == FEAT_MINOR_GLYPH) &&
+ else if (do_move && is_explosive_rune_grid(c_ptr) &&
!((r_ptr->flags1 & RF1_NEVER_BLOW) && (py == ny) && (px == nx)))
{
/* Assume no move allowed */
c_ptr->info &= ~(CAVE_MARK);
/* Break the rune */
- c_ptr->feat = floor_type[randint0(100)];
+ c_ptr->info &= ~(CAVE_OBJECT);
+ c_ptr->mimic = 0;
+
note_spot(ny, nx);
lite_spot(ny, nx);
int val=0;
for( x=0 ; x < cur_wid ; x++ ){
for( y=0 ; y < cur_hgt ; y++ ){
- if( (cave[y][x].info & CAVE_IN_MIRROR) )val++;
+ if (is_mirror_grid(&cave[y][x])) val++;
}
}
return val;
{
/* mirror of seeing */
case 0:
- tmp = (cave[py][px].info & CAVE_IN_MIRROR) ? 4 : 0;
+ tmp = is_mirror_grid(&cave[py][px]) ? 4 : 0;
if( plev + tmp > 4)detect_monsters_normal(DETECT_RAD_DEFAULT);
if( plev + tmp > 18 )detect_monsters_invis(DETECT_RAD_DEFAULT);
if( plev + tmp > 28 )set_tim_esp(plev,FALSE);
break;
case 2:
if (!get_aim_dir(&dir)) return FALSE;
- if ( plev > 9 && (cave[py][px].info & CAVE_IN_MIRROR) ){
+ if ( plev > 9 && is_mirror_grid(&cave[py][px]) ) {
fire_beam(GF_LITE, dir,damroll(3+((plev-1)/5),4));
}
else {
case 9:
for(x=0;x<cur_wid;x++){
for(y=0;y<cur_hgt;y++){
- if(cave[y][x].info & CAVE_IN_MIRROR){
+ if (is_mirror_grid(&cave[y][x])) {
project(0,2,y,x,plev,GF_OLD_SLEEP,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_HANGEKI),-1);
}
}
break;
/* illusion light */
case 14:
- tmp = (cave[py][px].feat & CAVE_IN_MIRROR) ? 4 : 3;
+ tmp = is_mirror_grid(&cave[py][px]) ? 4 : 3;
slow_monsters();
stun_monsters(plev*tmp);
confuse_monsters(plev*tmp);
break;
/* mirror shift */
case 15:
- if( !(cave[py][px].info & CAVE_IN_MIRROR) ){
+ if( !is_mirror_grid(&cave[py][px]) ){
#ifdef JP
msg_print("¶À¤Î¹ñ¤Î¾ì½ê¤¬¤ï¤«¤é¤Ê¤¤¡ª");
#else
{
int ny = GRID_Y(path_g[i]);
int nx = GRID_X(path_g[i]);
-
+ cave_type *c_ptr = &cave[ny][nx];
+
if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) &&
- cave[ny][nx].feat != FEAT_GLYPH &&
- cave[ny][nx].feat != FEAT_MINOR_GLYPH &&
- !(cave[ny][nx].feat >= FEAT_PATTERN_START &&
- cave[ny][nx].feat <= FEAT_PATTERN_XTRA2))
+ !(c_ptr->info & CAVE_OBJECT) &&
+ !(c_ptr->feat >= FEAT_PATTERN_START &&
+ c_ptr->feat <= FEAT_PATTERN_XTRA2))
{
ty = ny;
tx = nx;
break;
case MIND_MIRROR_MASTER:
/* Cast the spell */
- if( (cave[py][px].info & CAVE_IN_MIRROR) )on_mirror = TRUE;
+ if( is_mirror_grid(&cave[py][px]) )on_mirror = TRUE;
cast = cast_mirror_spell(n);
break;
case MIND_NINJUTSU:
/* Paranoia */
if (!r_ptr->name) return (FALSE);
-#if 0
- /* Hack -- no creation on glyph of warding */
- if (cave[y][x].feat == FEAT_GLYPH) return (FALSE);
- if (cave[y][x].feat == FEAT_MINOR_GLYPH) return (FALSE);
-#endif
-
/* Nor on the Pattern */
if ((cave[y][x].feat >= FEAT_PATTERN_START)
&& (cave[y][x].feat <= FEAT_PATTERN_XTRA2))
/* Access the location */
c_ptr = &cave[y][x];
- if (c_ptr->feat == FEAT_GLYPH)
+ if (is_glyph_grid(c_ptr))
{
if (randint1(BREAK_GLYPH) < (r_ptr->level+20))
{
c_ptr->info &= ~(CAVE_MARK);
/* Break the rune */
- c_ptr->feat = floor_type[randint0(100)];
+ c_ptr->info &= ~(CAVE_OBJECT);
+ c_ptr->mimic = 0;
/* Notice */
note_spot(y, x);
}
}
- if (c_ptr->feat == FEAT_MINOR_GLYPH)
+ if (is_explosive_rune_grid(c_ptr))
{
/* Break the ward */
if (randint1(BREAK_MINOR_GLYPH) > r_ptr->level)
c_ptr->info &= ~(CAVE_MARK);
/* Break the rune */
- c_ptr->feat = floor_type[randint0(100)];
+ c_ptr->info &= ~(CAVE_OBJECT);
+ c_ptr->mimic = 0;
+
note_spot(y, x);
lite_spot(y, x);
}
if (!cave_empty_bold2(ny, nx)) continue;
if (cave[ny][nx].m_idx) continue;
if ((ny == py) && (nx == px)) continue;
-
-#if 0
- /* Hack -- no summon on glyph of warding */
- if (cave[ny][nx].feat == FEAT_GLYPH) continue;
- if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue;
-#endif
-
+
/* ... nor on the Pattern */
if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
(cave[ny][nx].feat <= FEAT_PATTERN_XTRA2))
/* Only check a circular area */
if (distance(y1, x1, y, x)>2) continue;
-#if 0
- /* Hack: no summon on glyph of warding */
- if (cave[y][x].feat == FEAT_GLYPH) continue;
- if (cave[y][x].feat == FEAT_MINOR_GLYPH) continue;
-#endif
-
/* ...nor on the Pattern */
if ((cave[y][x].feat >= FEAT_PATTERN_START)
&& (cave[y][x].feat <= FEAT_PATTERN_XTRA2)) continue;
(c_ptr->feat != FEAT_FLOWER) &&
(c_ptr->feat != FEAT_DEEP_GRASS) &&
(c_ptr->feat != FEAT_SHAL_LAVA) &&
- (c_ptr->feat != FEAT_TREES)) continue;
- if (c_ptr->info & (CAVE_TRAP | CAVE_IN_MIRROR)) continue;
+ (c_ptr->feat != FEAT_TREES)) continue;
+ if (c_ptr->info & (CAVE_OBJECT)) continue;
/* No objects */
k = 0;
/*
- * Hack -- instantiate a trap
+ * Get random trap
*
* XXX XXX XXX This routine should be redone to reflect trap "level".
* That is, it does not make sense to have spiked pits at 50 feet.
* Actually, it is not this routine, but the "trap instantiation"
* code, which should also check for "trap doors" on quest levels.
*/
-void pick_trap(int y, int x)
+byte choose_random_trap(void)
{
- int feat;
-
- cave_type *c_ptr = &cave[y][x];
-
- /* Paranoia */
- if (!(c_ptr->info & CAVE_TRAP)) return;
- c_ptr->info &= ~(CAVE_TRAP);
+ byte feat;
/* Pick a trap */
while (1)
break;
}
- /* Activate the trap */
- cave_set_feat(y, x, feat);
+ return feat;
+}
+
+/*
+ * Disclose an invisible trap
+ */
+void disclose_grid(int y, int x)
+{
+ cave_type *c_ptr = &cave[y][x];
+
+ /* Paranoia */
+ if (!c_ptr->mimic) return;
+
+ /* No longer hidden */
+ c_ptr->mimic = 0;
+
+ /* Notice */
+ note_spot(y, x);
+
+ /* Redraw */
+ lite_spot(y, x);
}
*/
void place_trap(int y, int x)
{
+ cave_type *c_ptr = &cave[y][x];
+
/* Paranoia -- verify location */
if (!in_bounds(y, x)) return;
if (!cave_naked_bold(y, x)) return;
/* Place an invisible trap */
- cave[y][x].info |= CAVE_TRAP;
+ c_ptr->mimic = c_ptr->feat;
+ c_ptr->feat = choose_random_trap();
}
c_ptr = &cave[yy][xx];
if (((!easy_disarm && (is_trap(c_ptr->feat) || c_ptr->feat == FEAT_INVIS))
- || (c_ptr->info & CAVE_TRAP)) && !one_in_(13))
+ || (c_ptr->mimic && is_trap(c_ptr->feat))) && !one_in_(13))
{
object_type *o_ptr = choose_warning_item();
int x,y;
for( x=0 ; x < cur_wid ;x++){
for( y=0 ; y < cur_hgt ;y++){
- if( (cave[y][x].info & CAVE_IN_MIRROR)){
+ if( is_mirror_grid(&cave[y][x])) {
remove_mirror(y,x);
project(0,2,y,x, p_ptr->lev /2 +5 ,GF_SHARDS,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_HANGEKI),-1);
}
return FALSE;
}
if (racial_aux(30, 0, A_INT, 20)){
- if( (cave[py][px].info & CAVE_IN_MIRROR))
+ if( is_mirror_grid(&cave[py][px]))
{
#ifdef JP
msg_print("¾¯¤·Æ¬¤¬¥Ï¥Ã¥¥ê¤·¤¿¡£");
}
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 */
+ c_ptr->mimic = fill_type[randint0(100)];
+
+ c_ptr->info &= ~(CAVE_FLOOR);
}
}
}
/* Place the wall open trap */
- cave[yval][xval].feat = FEAT_INVIS;
+ cave[yval][xval].mimic = cave[yval][xval].feat;
+ cave[yval][xval].feat = FEAT_TRAP_OPEN;
add_cave_info(yval, xval, CAVE_ROOM);
/* Prepare allocation table */
{
for( y=0 ; y < cur_hgt ; y++ )
{
- if( (cave[y][x].info & CAVE_IN_MIRROR)){
+ if( is_mirror_grid(&cave[y][x])){
mirror_y[mirror_num]=y;
mirror_x[mirror_num]=x;
mirror_num++;
case GF_KILL_TRAP:
{
/* Reveal secret doors */
- if (c_ptr->feat == FEAT_SECRET)
+ if (is_hidden_door(c_ptr))
{
/* Pick a door */
- place_closed_door(y, x);
+ disclose_grid(y, x);
/* Check line of sight */
if (known)
}
/* Destroy traps */
- if ((c_ptr->info & CAVE_TRAP) || is_trap(c_ptr->feat) ||
- c_ptr->feat == FEAT_INVIS)
+ if (is_trap(c_ptr->feat))
{
/* Check line of sight */
if (known)
c_ptr->info &= ~(CAVE_MARK);
/* Destroy the trap */
- if (c_ptr->info & CAVE_TRAP) c_ptr->info &= ~(CAVE_TRAP);
- else
- {
- c_ptr->feat = floor_type[randint0(100)];
- }
+ cave_set_feat(y, x, floor_type[randint0(100)]);
}
/* Locked doors are unlocked */
}
}
- /* Notice */
- note_spot(y, x);
-
break;
}
/* Destroy all doors and traps */
if ((c_ptr->feat == FEAT_OPEN) ||
(c_ptr->feat == FEAT_BROKEN) ||
- (c_ptr->info & CAVE_TRAP) ||
is_trap(c_ptr->feat) ||
- (c_ptr->feat == FEAT_INVIS) ||
((c_ptr->feat >= FEAT_DOOR_HEAD) &&
(c_ptr->feat <= FEAT_DOOR_TAIL)))
{
c_ptr->info &= ~(CAVE_MARK);
/* Destroy the feature */
- if (c_ptr->info & CAVE_TRAP) c_ptr->info &= ~(CAVE_TRAP);
- else
- {
- c_ptr->feat = floor_type[randint0(100)];
- }
+ cave_set_feat(y, x, floor_type[randint0(100)]);
}
/* Notice */
(cave[y][x].feat != FEAT_DIRT) &&
(cave[y][x].o_idx == 0) &&
(cave[y][x].m_idx == 0))
- || (cave[y][x].info & CAVE_IN_MIRROR) )
+ || is_mirror_grid(&cave[y][x]) )
break;
/* Place a trap */
place_trap(y, x);
/* Require a "naked" floor grid */
if (!cave_naked_bold(y, x)) break;
- cave_set_feat(y, x, FEAT_GLYPH);
+ /* Create a glyph */
+ cave[py][px].info |= CAVE_OBJECT;
+ cave[py][px].mimic = FEAT_GLYPH;
+
+ /* Notice */
+ note_spot(py, px);
+
+ /* Redraw */
+ lite_spot(py, px);
break;
}
if (player_can_see_bold(y, x)) obvious = TRUE;
/* Turn off the light. */
- if(!(c_ptr->info & CAVE_IN_MIRROR))c_ptr->info &= ~(CAVE_GLOW);
+ if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW);
/* Hack -- Forget "boring" grids */
if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
case GF_SHARDS:
case GF_ROCKET:
{
- if( (cave[y][x].info & CAVE_IN_MIRROR))
+ if (is_mirror_grid(&cave[y][x]))
{
#ifdef JP
msg_print("¶À¤¬³ä¤ì¤¿¡ª");
}
case GF_SOUND:
{
- if( (cave[y][x].info & CAVE_IN_MIRROR) && p_ptr->lev < 40 )
+ if (is_mirror_grid(&cave[y][x]) && p_ptr->lev < 40 )
{
#ifdef JP
msg_print("¶À¤¬³ä¤ì¤¿¡ª");
monster_target_y=py;
monster_target_x=px;
+ /* Initialize with nul string */
+ who_name[0] = '\0';
+
/* Hack -- Jump to target */
if (flg & (PROJECT_JUMP))
{
}
}
if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
- if( (cave[y][x].info & CAVE_IN_MIRROR))
+ if( is_mirror_grid(&cave[y][x]))
{
/* The target of monsterspell becomes tha mirror(broken) */
monster_target_y=(s16b)y;
if( second_step )continue;
break;
}
- if( (cave[y][x].info & CAVE_IN_MIRROR) && !second_step )
+ if( is_mirror_grid(&cave[y][x]) && !second_step )
{
/* The target of monsterspell becomes tha mirror(broken) */
monster_target_y=(s16b)y;
{
for( y=0 ; y < cur_hgt ; y++ )
{
- if( (cave[y][x].info & CAVE_IN_MIRROR) &&
+ if( is_mirror_grid(&cave[y][x]) &&
distance(py,px,y,x) <= MAX_RANGE &&
distance(py,px,y,x) != 0 &&
player_has_los_bold(y,x)
{
for( y = 0 ; y < cur_hgt ; y++ )
{
- if( (cave[y][x].info & CAVE_IN_MIRROR))
+ if( is_mirror_grid(&cave[y][x]))
{
if(project_m(0,0,y,x,dam,GF_GENOCIDE,
(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP)))
lite_spot(y, x);
}
- /* Detect invisible traps */
- if (c_ptr->info & CAVE_TRAP)
- {
- /* Pick a trap */
- pick_trap(y, x);
- }
-
- /* Detect invisible open traps */
- if (c_ptr->feat == FEAT_INVIS)
- c_ptr->feat = FEAT_TRAP_OPEN;
-
/* Detect traps */
if (is_trap(c_ptr->feat))
{
/* Hack -- Memorize */
c_ptr->info |= (CAVE_MARK);
- /* Redraw */
- lite_spot(y, x);
+ if (c_ptr->mimic)
+ {
+ /* Disclose a hidden trap */
+ disclose_grid(y, x);
+ }
+ else
+ {
+ /* Redraw */
+ lite_spot(y, x);
+ }
/* Obvious */
detect = TRUE;
c_ptr = &cave[y][x];
/* Detect secret doors */
- if (c_ptr->feat == FEAT_SECRET)
+ if (is_hidden_door(c_ptr))
{
/* Pick a door */
- place_closed_door(y, x);
+ disclose_grid(y, x);
}
/* Detect doors */
r_ptr = &r_info[m_ptr->r_idx];
/* Lose room and vault */
- c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_TRAP | CAVE_UNSAFE | CAVE_IN_MIRROR);
+ c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE | CAVE_OBJECT);
+
+ /* Clear mimic type */
+ c_ptr->mimic = 0;
/* Lose light and knowledge */
c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW);
/* Hack -- Skip the epicenter */
if ((y == y1) && (x == x1)) continue;
-#if 0
- if ((r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->flags7 & RF7_GUARDIAN) || ((m_ptr->mflag2 & MFLAG_CHAMELEON) && (r_ptr->flags1 & RF1_UNIQUE)))
-#else
if ((r_ptr->flags1 & RF1_QUESTOR))
-#endif
{
/* Heal the monster */
m_list[c_ptr->m_idx].hp = m_list[c_ptr->m_idx].maxhp;
c_ptr = &cave[yy][xx];
/* Lose room and vault */
- c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_TRAP | CAVE_UNSAFE | CAVE_IN_MIRROR );
+ c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE | CAVE_OBJECT );
+
+ /* Clear mimic type */
+ c_ptr->mimic = 0;
/* Lose light and knowledge */
c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
if (!cave_empty_bold(y, x)) continue;
/* Hack -- no safety on glyph of warding */
- if (cave[y][x].feat == FEAT_GLYPH) continue;
- if (cave[y][x].feat == FEAT_MINOR_GLYPH) continue;
+ if (is_glyph_grid(&cave[y][x])) continue;
+ if (is_explosive_rune_grid(&cave[y][x])) continue;
/* ... nor on the Pattern */
if ((cave[y][x].feat <= FEAT_PATTERN_XTRA2) &&
c_ptr->info &= ~(CAVE_TEMP);
/* Darken the grid */
- if (!(c_ptr->info & CAVE_IN_MIRROR ))c_ptr->info &= ~(CAVE_GLOW);
+ if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW);
/* Hack -- Forget "boring" grids */
if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
if (!cave_empty_bold(ny, nx)) continue;
/* Hack -- no teleport onto glyph of warding */
- if (cave[ny][nx].feat == FEAT_GLYPH) continue;
- if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue;
+ if (is_glyph_grid(&cave[ny][nx])) continue;
+ if (is_explosive_rune_grid(&cave[ny][nx])) continue;
/* ...nor onto the Pattern */
if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
if (!cave_empty_bold(ny, nx)) continue;
/* Hack -- no teleport onto glyph of warding */
- if (cave[ny][nx].feat == FEAT_GLYPH) continue;
- if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue;
+ if (is_glyph_grid(&cave[ny][nx])) continue;
+ if (is_explosive_rune_grid(&cave[ny][nx])) continue;
/* ...nor onto the Pattern */
if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
}
/* Create a glyph */
- cave_set_feat(py, px, FEAT_GLYPH);
+ cave[py][px].info |= CAVE_OBJECT;
+ cave[py][px].mimic = FEAT_GLYPH;
+
+ /* Notice */
+ note_spot(py, px);
+
+ /* Redraw */
+ lite_spot(py, px);
return TRUE;
}
}
/* Create a mirror */
- cave[py][px].info |= CAVE_IN_MIRROR;
+ cave[py][px].info |= CAVE_OBJECT;
+ cave[py][px].mimic = FEAT_MIRROR;
/* Turn on the light */
cave[py][px].info |= CAVE_GLOW;
}
/* Create a glyph */
- cave_set_feat(py, px, FEAT_MINOR_GLYPH);
+ cave[py][px].info |= CAVE_OBJECT;
+ cave[py][px].mimic = FEAT_MINOR_GLYPH;
+
+ /* Notice */
+ note_spot(py, px);
+
+ /* Redraw */
+ lite_spot(py, px);
return TRUE;
}
if ((feat >= FEAT_MAGMA) && (feat <= FEAT_WALL_SOLID))
{
if (!is_extra_grid(c_ptr) && !is_inner_grid(c_ptr) && !is_outer_grid(c_ptr) && !is_solid_grid(c_ptr)) continue;
- if ((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_SECRET)) continue;
+ if (is_closed_door(c_ptr->feat)) continue;
if ((feat == FEAT_MAGMA) || (feat == FEAT_QUARTZ)) treasure = TRUE;
}
else
c_ptr = &cave[j][i];
if (c_ptr->info & CAVE_ICKY) continue;
- if (c_ptr->info & CAVE_TRAP) continue;
if (c_ptr->o_idx) continue;
/* Want square to be in the circle and accessable. */
cave[j][i].feat = FEAT_RUBBLE;
}
+ /* Clear possible garbage of hidden trap or door */
+ c_ptr->mimic = 0;
+
/* Light area since is open above */
cave[j][i].info |= (CAVE_GLOW | CAVE_ROOM);
}
if (create_stairs)
{
/* Stagger around */
- while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_IN_MIRROR) )
+ while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
{
/* Pick a location */
scatter(&ny, &nx, y, x, 1, 0);
/* Create stairs down */
cave_set_feat(y, x, FEAT_MORE);
- /* Delete invisible trap */
- cave[y][x].info &= ~(CAVE_TRAP);
-
/* Remember to update everything */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS);
}
if (c_ptr->info & (CAVE_MARK))
{
/* Notice glyphs */
- if (c_ptr->feat == FEAT_GLYPH) return (TRUE);
- if (c_ptr->feat == FEAT_MINOR_GLYPH) return (TRUE);
- if ((c_ptr->info & CAVE_IN_MIRROR)) return (TRUE);
+ if (c_ptr->info & CAVE_OBJECT) return (TRUE);
/* Notice the Pattern */
if ((c_ptr->feat <= FEAT_PATTERN_XTRA2) &&
bool boring;
- int feat;
+ byte feat;
int query;
/* Double break */
if (this_o_idx) break;
- if (c_ptr->mimic)
- {
- feat = c_ptr->mimic;
- }
- else
- {
- feat = f_info[c_ptr->feat].mimic;
- }
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
/* Require knowledge about grid, or ability to see grid */
if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
}
/* Terrain feature if needed */
- if (boring || (feat > FEAT_INVIS) || (c_ptr->info & CAVE_IN_MIRROR))
+ if (boring || (feat > FEAT_INVIS))
{
cptr name;
name = "road";
#endif
}
- else if ( (c_ptr->info & CAVE_IN_MIRROR) )
- {
-#ifdef JP
- name = "¶À";
-#else
- name = "a mirror";
-#endif
- }
else
{
name = f_name + f_info[feat].name;
#endif
}
- else if ((feat == FEAT_TOWN) || (feat == FEAT_FLOOR) || (feat == FEAT_DIRT) || (feat == FEAT_FLOWER) || (c_ptr->info & CAVE_IN_MIRROR))
+ else if ((feat == FEAT_TOWN) || (feat == FEAT_FLOOR) || (feat == FEAT_DIRT) || (feat == FEAT_FLOWER))
{
#ifndef JP
s3 ="";