From c9afbbf08a2276a32339f88ecb8ffea2960e3bd4 Mon Sep 17 00:00:00 2001 From: mogami Date: Fri, 6 Sep 2002 16:54:36 +0000 Subject: [PATCH] =?utf8?q?c=5Fptr->mimic=E3=82=92=E6=B4=BB=E7=94=A8?= =?utf8?q?=E3=81=99=E3=82=8B=E4=B8=80=E9=80=A3=E3=81=AE=E6=94=B9=E9=80=A0?= =?utf8?q?=EF=BC=9A=20*=20=E3=83=88=E3=83=A9=E3=83=83=E3=83=97=E3=81=AF?= =?utf8?q?=E5=90=84=E7=BD=A0=E3=81=AE=E5=9C=B0=E5=BD=A2=E3=82=92mimic?= =?utf8?q?=E3=81=A7=E5=BA=8A=E3=81=AB=E8=A6=8B=E3=81=9B=E3=82=8B=E2=86=92?= =?utf8?q?=E7=89=B9=E5=AE=9A=E3=81=AE=E5=A0=B4=E6=89=80=E3=81=AB=E5=9B=BA?= =?utf8?q?=E6=9C=89=E3=81=AA=E3=83=88=E3=83=A9=E3=83=83=E3=83=97=E3=82=92?= =?utf8?q?=E9=85=8D=E7=BD=AE=E5=8F=AF=E8=83=BD=E3=80=82=20*=20=E9=9A=A0?= =?utf8?q?=E3=81=97=E3=83=89=E3=82=A2=E3=81=AF=E6=99=AE=E9=80=9A=E3=81=AE?= =?utf8?q?=E3=83=89=E3=82=A2=E3=82=92mimic=E3=81=A7=E5=A3=81=E3=81=AB?= =?utf8?q?=E8=A6=8B=E3=81=9B=E3=82=8B=E2=86=92=E5=B1=B1=E8=84=88=E3=82=84?= =?utf8?q?=E6=BA=B6=E5=B2=A9=E7=AD=89=E3=81=AB=E3=82=82=E9=9A=A0=E3=81=97?= =?utf8?q?=E3=83=89=E3=82=A2=E3=81=8C=E5=AD=98=E5=9C=A8=E5=8F=AF=E8=83=BD?= =?utf8?q?=E3=80=82=20*=20=E9=8F=A1=E3=80=81=E5=AE=88=E3=82=8A=E3=81=AE?= =?utf8?q?=E3=83=AB=E3=83=BC=E3=83=B3=E3=80=81=E7=88=86=E7=99=BA=E3=81=AE?= =?utf8?q?=E3=83=AB=E3=83=BC=E3=83=B3=E3=81=AF=E3=80=81CAVE=5FOBJECT?= =?utf8?q?=E3=83=95=E3=83=A9=E3=82=B0+=E3=81=9D=E3=82=8C=E3=81=9E=E3=82=8C?= =?utf8?q?=E3=81=B8=E3=81=AEmimic=E3=81=A7=E8=A1=A8=E7=8F=BE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- configure.in | 2 +- lib/edit/f_info_j.txt | 22 ++++---- lib/file/news.txt | 2 +- lib/file/news_j.txt | 2 +- src/cave.c | 141 ++++++++++++++++++++++++++++++++++++++---------- src/cmd1.c | 127 ++++++++++++++++--------------------------- src/cmd2.c | 145 +++++++++++++++++++++++--------------------------- src/defines.h | 17 +++--- src/dungeon.c | 2 +- src/externs.h | 9 +++- src/generate.c | 4 +- src/grid.c | 11 ++-- src/load.c | 115 +++++++++++++++++++++++++++------------ src/melee1.c | 2 +- src/melee2.c | 25 +++++---- src/mind.c | 24 ++++----- src/monster2.c | 25 +++------ src/mspells1.c | 6 --- src/object2.c | 46 ++++++++++------ src/racial.c | 4 +- src/rooms.c | 14 +++-- src/spells1.c | 55 +++++++++---------- src/spells2.c | 47 ++++++++-------- src/spells3.c | 29 +++++++--- src/streams.c | 6 ++- src/xtra2.c | 33 +++--------- 26 files changed, 511 insertions(+), 404 deletions(-) diff --git a/configure.in b/configure.in index ac68dbcec..b0acd64ed 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_INIT(src/main.c) 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], diff --git a/lib/edit/f_info_j.txt b/lib/edit/f_info_j.txt index bd69443cb..918399952 100644 --- a/lib/edit/f_info_j.txt +++ b/lib/edit/f_info_j.txt @@ -18,13 +18,17 @@ # 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 @@ -219,7 +223,6 @@ G:^:g N:32:¥É¥¢ E:door G:+:U -M:32 # 0x2x --> locked door (power 1) @@ -353,15 +356,15 @@ G:%:w # 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 @@ -720,19 +723,18 @@ E:Town 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 diff --git a/lib/file/news.txt b/lib/file/news.txt index 5c7abea51..f41c5f512 100644 --- a/lib/file/news.txt +++ b/lib/file/news.txt @@ -1,6 +1,6 @@ **************************************** - ** Hengband 1.3.0 ** + ** Hengband 1.3.1 ** **************************************** Based on Moria: Copyright (c) 1985 Robert Alan Koeneke diff --git a/lib/file/news_j.txt b/lib/file/news_j.txt index 83b64d8f6..69b9df3df 100644 --- a/lib/file/news_j.txt +++ b/lib/file/news_j.txt @@ -1,6 +1,6 @@ *************************************** - ** ÊѶòÈÚÅÜ 1.3.0 ** + ** ÊѶòÈÚÅÜ 1.3.1 ** *************************************** Based on Moria: Copyright (c) 1985 Robert Alan Koeneke diff --git a/src/cave.c b/src/cave.c index b31276276..3821b5709 100644 --- a/src/cave.c +++ b/src/cave.c @@ -91,6 +91,38 @@ bool is_trap(int feat) /* + * 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. * @@ -644,7 +676,6 @@ static bool feat_supports_lighting(byte feat) case FEAT_MORE: case FEAT_LESS_LESS: case FEAT_MORE_MORE: - case FEAT_SECRET: case FEAT_RUBBLE: case FEAT_MAGMA: case FEAT_QUARTZ: @@ -877,9 +908,8 @@ void map_info(int y, int x, byte *ap, char *cp) /* 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)) @@ -1019,12 +1049,6 @@ void map_info(int y, int x, byte *ap, char *cp) /* 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]; @@ -1063,7 +1087,7 @@ void map_info(int y, int x, byte *ap, char *cp) 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; @@ -1103,7 +1127,7 @@ void map_info(int y, int x, byte *ap, char *cp) /* 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) @@ -1258,7 +1282,6 @@ void map_info(int y, int x, byte *ap, char *cp) case FEAT_DEEP_GRASS: case FEAT_SWAMP: case FEAT_TREES: - case FEAT_SECRET: case FEAT_RUBBLE: case FEAT_MAGMA: case FEAT_QUARTZ: @@ -1338,7 +1361,7 @@ void map_info(int y, int x, byte *ap, char *cp) (*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); @@ -1899,6 +1922,11 @@ void note_spot(int y, int x) 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; @@ -1938,7 +1966,7 @@ void note_spot(int y, int x) 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))) @@ -4460,13 +4488,13 @@ void update_flow(void) 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; @@ -4557,7 +4585,7 @@ void update_smell(void) 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; @@ -4581,6 +4609,8 @@ void map_area(int range) cave_type *c_ptr; + byte feat; + if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3; /* Scan that area */ @@ -4592,15 +4622,18 @@ void map_area(int range) 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); @@ -4611,8 +4644,11 @@ void map_area(int range) { 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); @@ -4650,6 +4686,8 @@ void map_area(int range) 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++) @@ -4680,8 +4718,11 @@ void wiz_lite(bool wizard, bool ninja) { 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++) @@ -4692,6 +4733,9 @@ void wiz_lite(bool wizard, bool ninja) /* 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) { @@ -4700,7 +4744,7 @@ void wiz_lite(bool wizard, bool ninja) } else { - if ((c_ptr->feat > FEAT_INVIS)) + if ((feat > FEAT_INVIS)) { /* Memorize the grid */ c_ptr->info |= (CAVE_MARK); @@ -4797,6 +4841,9 @@ void cave_set_feat(int y, int x, int feat) { cave_type *c_ptr = &cave[y][x]; + /* Clear mimic type */ + c_ptr->mimic = 0; + /* Change the feature */ c_ptr->feat = feat; @@ -4811,7 +4858,8 @@ void cave_set_feat(int y, int x, int 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) { @@ -4825,6 +4873,43 @@ void remove_mirror(int y, int x) 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). diff --git a/src/cmd1.c b/src/cmd1.c index 172a0cc70..11138a100 100644 --- a/src/cmd1.c +++ b/src/cmd1.c @@ -685,10 +685,10 @@ void search(void) 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 @@ -702,25 +702,8 @@ void search(void) 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 @@ -729,9 +712,8 @@ void search(void) 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); @@ -3477,6 +3459,7 @@ bool player_can_enter(byte feature) void move_player(int dir, int do_pickup, bool break_trap) { int y, x; + byte feat; cave_type *c_ptr; monster_type *m_ptr; @@ -3496,6 +3479,8 @@ void move_player(int dir, int do_pickup, bool break_trap) /* 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 && @@ -3714,7 +3699,7 @@ void move_player(int dir, int do_pickup, bool break_trap) #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) @@ -3866,7 +3851,7 @@ msg_format("%s (p_ptr->blind || !(c_ptr->info & (CAVE_LITE)))) { /* Rubble */ - if (c_ptr->feat == FEAT_RUBBLE) + if (feat == FEAT_RUBBLE) { #ifdef JP msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£"); @@ -3879,7 +3864,7 @@ msg_format("%s } /* Closed door */ - else if (c_ptr->feat < FEAT_SECRET) + else if (is_closed_door(feat)) { #ifdef JP msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£"); @@ -3909,7 +3894,7 @@ msg_format("%s else { /* Rubble */ - if (c_ptr->feat == FEAT_RUBBLE) + if (feat == FEAT_RUBBLE) { #ifdef JP msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£"); @@ -3928,7 +3913,7 @@ msg_format("%s */ } /* Closed doors */ - else if (c_ptr->feat < FEAT_SECRET) + else if (is_closed_door(feat)) { #ifdef ALLOW_EASY_OPEN @@ -4030,7 +4015,7 @@ msg_format("%s 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); @@ -4191,51 +4176,25 @@ msg_format("%s 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); @@ -4292,7 +4251,7 @@ static int see_wall(int dir, int y, int x) 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); @@ -4633,6 +4592,7 @@ static bool run_test(void) int i, max, inv; int option = 0, option2 = 0; cave_type *c_ptr; + byte feat; /* Where we came from */ prev_dir = find_prevdir; @@ -4684,6 +4644,8 @@ static bool run_test(void) /* 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) @@ -4719,7 +4681,7 @@ static bool run_test(void) bool notice = TRUE; /* Examine the terrain */ - switch (c_ptr->feat) + switch (feat) { /* Floors */ case FEAT_FLOOR: @@ -4727,9 +4689,6 @@ static bool run_test(void) /* Invis traps */ case FEAT_INVIS: - /* Secret doors */ - case FEAT_SECRET: - /* Normal veins */ case FEAT_MAGMA: case FEAT_QUARTZ: @@ -4912,13 +4871,16 @@ static bool run_test(void) /* 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 */ @@ -4950,13 +4912,16 @@ static bool run_test(void) /* 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 */ diff --git a/src/cmd2.c b/src/cmd2.c index 74d5ae9cc..d67a4f271 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -949,10 +949,6 @@ static bool is_open(int feat) 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. @@ -968,6 +964,9 @@ static int count_dt(int *y, int *x, bool (*test)(int feat), bool under) /* 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; @@ -975,11 +974,17 @@ static int count_dt(int *y, int *x, bool (*test)(int feat), bool under) 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; @@ -1205,7 +1210,7 @@ void do_cmd_open(void) 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); @@ -1248,9 +1253,8 @@ void do_cmd_open(void) 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 @@ -1533,6 +1537,7 @@ static bool twall(int y, int x, byte feat) static bool do_cmd_tunnel_aux(int y, int x, int dir) { cave_type *c_ptr; + byte feat; bool more = FALSE; @@ -1545,12 +1550,15 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir) /* 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("¤³¤Î´ä¤Ï¹Å¤¹¤®¤Æ·¡¤ì¤Ê¤¤¤è¤¦¤À¡£"); @@ -1561,7 +1569,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir) } /* No tunnelling through mountains */ - else if (c_ptr->feat == FEAT_MOUNTAIN) + else if (feat == FEAT_MOUNTAIN) { #ifdef JP msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤!"); @@ -1571,7 +1579,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir) } - 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)) @@ -1604,8 +1612,8 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir) /* 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)])) @@ -1635,18 +1643,18 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir) /* 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) @@ -1720,7 +1728,7 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir) } /* 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)])) @@ -1764,37 +1772,6 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir) } } - /* 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 { @@ -1823,6 +1800,12 @@ static bool do_cmd_tunnel_aux(int y, int x, int dir) } } + 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)) { @@ -1849,6 +1832,7 @@ void do_cmd_tunnel(void) int y, x, dir; cave_type *c_ptr; + byte feat; bool more = FALSE; @@ -1881,11 +1865,14 @@ void do_cmd_tunnel(void) /* 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 @@ -1897,8 +1884,8 @@ void do_cmd_tunnel(void) } /* 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 @@ -1910,7 +1897,7 @@ void do_cmd_tunnel(void) } /* No tunnelling through mountains */ - else if (c_ptr->feat == FEAT_MOUNTAIN) + else if (feat == FEAT_MOUNTAIN) { #ifdef JP msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤¡£"); @@ -2702,43 +2689,45 @@ void do_cmd_alter(void) } /* 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); } diff --git a/src/defines.h b/src/defines.h index 4e7ef3d25..51e907330 100644 --- a/src/defines.h +++ b/src/defines.h @@ -40,14 +40,14 @@ /* 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 @@ -2348,9 +2348,9 @@ #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 @@ -2365,7 +2365,7 @@ #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) */ @@ -3931,8 +3931,7 @@ (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)) @@ -3977,7 +3976,7 @@ (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)) diff --git a/src/dungeon.c b/src/dungeon.c index 39719567b..f9f45a249 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1779,7 +1779,7 @@ msg_print(" (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); diff --git a/src/externs.h b/src/externs.h index e5e4f5206..3342b7dc0 100644 --- a/src/externs.h +++ b/src/externs.h @@ -537,6 +537,9 @@ extern void dump_yourself(FILE *fff); /* 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); @@ -570,6 +573,9 @@ extern void wiz_lite(bool wizard, bool ninja); 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); @@ -883,7 +889,8 @@ extern bool make_gold(object_type *j_ptr); 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); diff --git a/src/generate.c b/src/generate.c index 49e4d65dc..f976fbba1 100644 --- a/src/generate.c +++ b/src/generate.c @@ -178,8 +178,8 @@ static bool alloc_stairs(int feat, int num, int walls) /* 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; diff --git a/src/grid.c b/src/grid.c index 36cf62159..a782ffca1 100644 --- a/src/grid.c +++ b/src/grid.c @@ -124,21 +124,26 @@ void place_random_door(int y, int x) 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) */ diff --git a/src/load.c b/src/load.c index 4cfc7b919..21ad15a25 100644 --- a/src/load.c +++ b/src/load.c @@ -1841,6 +1841,9 @@ static void rd_messages(void) +/* Old hidden trap flag */ +#define CAVE_TRAP 0x8000 + /* * Read the dungeon * @@ -1956,39 +1959,6 @@ static errr rd_dungeon(void) } } - /* 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 */ @@ -2049,6 +2019,85 @@ static errr rd_dungeon(void) } } + /* 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 */ diff --git a/src/melee1.c b/src/melee1.c index 393471fba..b8d5e9906 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -2148,7 +2148,7 @@ msg_format("%s alive = FALSE; } } - if( (cave[py][px].info & CAVE_IN_MIRROR)){ + if (is_mirror_grid(&cave[py][px])) { teleport_player(10); } } diff --git a/src/melee2.c b/src/melee2.c index 757a94eb3..c3613ee86 100644 --- a/src/melee2.c +++ b/src/melee2.c @@ -551,7 +551,7 @@ static bool get_moves_aux2(int m_idx, int *yp, int *xp) 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.. */ @@ -3165,6 +3165,9 @@ msg_print(" /* 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)]; @@ -3173,9 +3176,7 @@ msg_print(" } /* 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; @@ -3186,9 +3187,8 @@ msg_print(" 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; @@ -3273,7 +3273,7 @@ msg_print(" } /* 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 */ @@ -3297,7 +3297,8 @@ msg_print(" 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; @@ -3306,7 +3307,7 @@ msg_print(" 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 */ @@ -3343,7 +3344,9 @@ msg_print(" 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); diff --git a/src/mind.c b/src/mind.c index 4136da8a9..bd435cc68 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1264,7 +1264,7 @@ static int number_of_mirrors( void ) 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; @@ -1282,7 +1282,7 @@ static bool cast_mirror_spell(int spell) { /* 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); @@ -1310,7 +1310,7 @@ msg_format("There are too many mirrors to control!"); 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 { @@ -1348,7 +1348,7 @@ msg_format("There are too many mirrors to control!"); case 9: for(x=0;x= 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; @@ -2142,7 +2142,7 @@ msg_format("%s 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: diff --git a/src/monster2.c b/src/monster2.c index 9da86ac07..551f4dfe6 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -2865,12 +2865,6 @@ bool place_monster_one(int who, int y, int x, int r_idx, u32b mode) /* 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)) @@ -2939,7 +2933,7 @@ bool place_monster_one(int who, int y, int x, int r_idx, u32b mode) /* 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)) { @@ -2958,7 +2952,8 @@ msg_print(" 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); @@ -3260,7 +3255,7 @@ msg_print(" } } - 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) @@ -3290,7 +3285,9 @@ msg_print(" 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); } @@ -3333,13 +3330,7 @@ static bool mon_scatter(int *yp, int *xp, int y, int x, int max_dist) 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)) diff --git a/src/mspells1.c b/src/mspells1.c index 91a8d2709..5d3328224 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -372,12 +372,6 @@ bool summon_possible(int y1, int x1) /* 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; diff --git a/src/object2.c b/src/object2.c index d65d58aef..f3557182f 100644 --- a/src/object2.c +++ b/src/object2.c @@ -4938,8 +4938,8 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x) (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; @@ -5230,22 +5230,16 @@ static int trap_num[MAX_TRAPS] = /* - * 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) @@ -5265,8 +5259,27 @@ void pick_trap(int y, int x) 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); } @@ -5281,6 +5294,8 @@ void pick_trap(int y, int x) */ void place_trap(int y, int x) { + cave_type *c_ptr = &cave[y][x]; + /* Paranoia -- verify location */ if (!in_bounds(y, x)) return; @@ -5288,7 +5303,8 @@ void place_trap(int y, int x) 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(); } @@ -6476,7 +6492,7 @@ bool process_frakir(int xx, int yy) 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(); diff --git a/src/racial.c b/src/racial.c index 60b65e8cf..c4888681e 100644 --- a/src/racial.c +++ b/src/racial.c @@ -1379,7 +1379,7 @@ msg_print(" 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); } @@ -1399,7 +1399,7 @@ msg_print(" 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("¾¯¤·Æ¬¤¬¥Ï¥Ã¥­¥ê¤·¤¿¡£"); diff --git a/src/rooms.c b/src/rooms.c index 1acdf81a3..94b18a881 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -60,8 +60,15 @@ static void place_secret_door(int y, int x) } 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); } } @@ -5319,7 +5326,8 @@ static void build_type13(int by0, int bx0) } /* 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 */ diff --git a/src/spells1.c b/src/spells1.c index 36b651512..37cad1ee0 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -49,7 +49,7 @@ static void next_mirror( int* next_y , int* next_x , int cury, int curx) { 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++; @@ -718,10 +718,10 @@ static bool project_f(int who, int r, int y, int x, int dam, int typ) 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) @@ -731,8 +731,7 @@ static bool project_f(int who, int r, int y, int x, int dam, int typ) } /* 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) @@ -750,11 +749,7 @@ msg_print(" 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 */ @@ -777,9 +772,6 @@ msg_print(" } } - /* Notice */ - note_spot(y, x); - break; } @@ -789,9 +781,7 @@ msg_print(" /* 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))) { @@ -820,11 +810,7 @@ msg_print(" 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 */ @@ -1042,7 +1028,7 @@ msg_print(" (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); @@ -1076,7 +1062,15 @@ msg_print(" /* 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; } @@ -1184,7 +1178,7 @@ msg_print(" 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)) @@ -1210,7 +1204,7 @@ msg_print(" 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("¶À¤¬³ä¤ì¤¿¡ª"); @@ -1224,7 +1218,7 @@ 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("¶À¤¬³ä¤ì¤¿¡ª"); @@ -8296,6 +8290,9 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons monster_target_y=py; monster_target_x=px; + /* Initialize with nul string */ + who_name[0] = '\0'; + /* Hack -- Jump to target */ if (flg & (PROJECT_JUMP)) { @@ -8467,7 +8464,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons } } 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; @@ -8607,7 +8604,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons 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; @@ -9221,7 +9218,7 @@ bool binding_field( int dam ) { 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) @@ -9354,7 +9351,7 @@ void seal_of_mirror( int dam ) { 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))) diff --git a/src/spells2.c b/src/spells2.c index da79c1602..60593e198 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -3523,25 +3523,22 @@ bool detect_traps(int range, bool known) 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; @@ -3593,10 +3590,10 @@ bool detect_doors(int range) 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 */ @@ -5325,7 +5322,10 @@ bool destroy_area(int y1, int x1, int r, int full) 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); @@ -5343,11 +5343,7 @@ bool destroy_area(int y1, int x1, int r, int full) /* 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; @@ -5540,7 +5536,10 @@ bool earthquake(int cy, int cx, int r) 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); @@ -5775,8 +5774,8 @@ if (damage) take_hit(DAMAGE_ATTACK, damage, " 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) && @@ -6138,7 +6137,7 @@ static void cave_temp_room_unlite(void) 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)) diff --git a/src/spells3.c b/src/spells3.c index 39b64f98a..0988e5b0c 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -81,8 +81,8 @@ bool teleport_away(int m_idx, int dis, bool dec_valour) 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) && @@ -193,8 +193,8 @@ void teleport_to_player(int m_idx, int power) 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) && @@ -1665,7 +1665,14 @@ msg_print(" } /* 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; } @@ -1685,7 +1692,8 @@ msg_print(" } /* 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; @@ -1718,7 +1726,14 @@ msg_print(" } /* 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; } diff --git a/src/streams.c b/src/streams.c index 2218ddabe..d690bc246 100644 --- a/src/streams.c +++ b/src/streams.c @@ -247,7 +247,7 @@ void build_streamer(int feat, int chance) 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 @@ -305,7 +305,6 @@ void place_trees(int x, int y) 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. */ @@ -325,6 +324,9 @@ void place_trees(int x, int y) 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); } diff --git a/src/xtra2.c b/src/xtra2.c index 3a94eaa53..2549d3890 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -572,7 +572,7 @@ msg_print(" 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); @@ -592,9 +592,6 @@ msg_print(" /* 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); } @@ -2814,9 +2811,7 @@ static bool target_set_accept(int y, int x) 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) && @@ -2964,7 +2959,7 @@ static int target_set_aux(int y, int x, int mode, cptr info) bool boring; - int feat; + byte feat; int query; @@ -3505,14 +3500,8 @@ if (o_ptr->number != 1) s1 = " /* 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)) @@ -3522,7 +3511,7 @@ if (o_ptr->number != 1) s1 = " } /* Terrain feature if needed */ - if (boring || (feat > FEAT_INVIS) || (c_ptr->info & CAVE_IN_MIRROR)) + if (boring || (feat > FEAT_INVIS)) { cptr name; @@ -3551,14 +3540,6 @@ if (o_ptr->number != 1) s1 = " 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; @@ -3609,7 +3590,7 @@ s2 = " #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 =""; -- 2.11.0