OSDN Git Service

Unangband より、view_unsafe_gridsオプション実装。
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 18 May 2002 04:12:10 +0000 (04:12 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 18 May 2002 04:12:10 +0000 (04:12 +0000)
未知の地形でトラップ感知済みで無い場所は灰色の'x'を表示する。
啓蒙や魔法の地図を使うと見えなくなるが、それまでは便利。

12 files changed:
lib/help/joption.txt
lib/help/option.txt
lib/pref/pref-opt.prf
src/cave.c
src/cmd1.c
src/defines.h
src/externs.h
src/generate.c
src/spells2.c
src/tables.c
src/variable.c
src/xtra2.c

index 6c46bb4..eab07bf 100644 (file)
@@ -320,6 +320,11 @@ MP
     ¥Þ¥¹¤È¤ß¤Ê¤µ¤ì¡¢'view_yellow_lite'¥ª¥×¥·¥ç¥ó¤¬ON¤Ë¤Ê¤Ã¤Æ¤¤¤Ê¤¤¸Â¤ê
     ¡ÊON¤Ë¤Ê¤Ã¤Æ¤¤¤ì¤Ð¡¢¤½¤ì¤é¤Ï²«¿§¤Ç¤¹¡ËÇò¿§¤ÇÉÁ²è¤µ¤ì¤Þ¤¹¡£
 
+¥È¥é¥Ã¥×´¶ÃκѤߤǤʤ¤¾ì½ê¤òɽ¼¨¤¹¤ë  [view_unsafe_grids]
+    Ì¤ÃΤÎÃÏ·Á¤Î¤¦¤Á¡¢¥È¥é¥Ã¥×´¶ÃκѤߤǤʤ¤Îΰè¤ò³¥¿§¤Î'x'¤Çɽ¼¨¤·¤Þ
+    ¤¹¡£¥È¥é¥Ã¥×¤ò´¶ÃκѤߤ¬¤É¤¦¤«¤¬¤ï¤«¤ê¤ä¤¹¤¯¤Ê¤ê¤Þ¤¹¤¬¡¢ËâË¡¤ÎÃÏ¿Þ
+    Åù¤ÇÃÏ·Á¤ò´¶ÃκѤߤλþ¤Ï¶èÊ̤Ǥ­¤Þ¤»¤ó¡£
+
 ³¬Ãʤò¤Ä¤Ê¤²¤Æ¥À¥ó¥¸¥ç¥ó¤òÀ¸À®¤¹¤ë  [dungeon_stair]
     ³Æ³¬¤Î³¬ÃʤòʪÍýŪ¤Ë·Ò¤¬¤Ã¤¿°ÌÃÖ¤ËÇÛÃÖ¤·¤Þ¤¹¡£²¼¤ê³¬ÃʤDz¼¤ê¤¿Àè¤Ë
     ¤Ï¾å¤ê³¬Ãʤ¬¡¢¾å¤ê³¬ÃʤǾå¤Ã¤¿Àè¤Ë¤Ï²¼¤ê³¬Ãʤ¬É¬¤ºÂ¸ºß¤¹¤ë¤ï¤±¤Ç
index 64f1323..a903bd9 100644 (file)
@@ -297,6 +297,14 @@ Map remembers all torch-lit grids    [view_torch_grids]
     the "view_yellow_lite" option is set, in which case they are drawn
     in "yellow".
 
+Map marked by detect traps    [view_unsafe_grids]
+    Unknown grids that have not been traversed previously, or had a
+    detect trap spell cast on them are marked with a grey 'x'. This
+    allows you to determine where in the dungeon you have cast detect
+    traps, but does not ensure that grids not marked with a grey 'x'
+    are trap free. This option has no effect on surface grids, but
+    outdoor locations cannot be trapped.
+
 Generate dungeons with connected stairs    [dungeon_stair]
     Always generate a staircase back to the level you came from, if you
     used a staircase to get to the level. This is more "realistic", and
index 8c0d045..6fd2118 100644 (file)
@@ -64,6 +64,7 @@ Y:expand_look
 Y:expand_list
 Y:view_perma_grids
 X:view_torch_grids
+X:view_unsafe_grids
 Y:dungeon_stair
 Y:small_levels
 X:always_small_levels
index 83272d6..f24777a 100644 (file)
@@ -991,6 +991,13 @@ void map_info(int y, int x, byte *ap, char *cp)
                        }
                }
 
+               /* Hack -- Safe cave grid -- idea borrowed from Unangband */
+               else if (view_unsafe_grids && !(c_ptr->info & (CAVE_DETECT)))
+               {
+                       a = TERM_L_DARK;
+                       c = 'x';
+               }
+
                /* Unknown */
                else
                {
@@ -1192,6 +1199,13 @@ void map_info(int y, int x, byte *ap, char *cp)
                        }
                }
 
+               /* Hack -- Safe cave grid -- idea borrowed from Unangband */
+               else if (view_unsafe_grids && !(c_ptr->info & (CAVE_DETECT)))
+               {
+                       a = TERM_L_DARK;
+                       c = 'x';
+               }
+
                 /* "Simple Lighting" */
                 else
                 {
index 646ecc8..0373394 100644 (file)
@@ -4101,23 +4101,27 @@ msg_format("%s
 
                /* Warn when leaving trap detected region */
                if ((disturb_trap_detect || alert_trap_detect)
-                   && p_ptr->dtrap && !(cave[py][px].info & CAVE_DETECT))
+                   && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
                {
                        /* No duplicate warning */
                        p_ptr->dtrap = FALSE;
 
-                       if (alert_trap_detect)
+                       /* You are just on the edge */
+                       if (cave[py][px].info & CAVE_DETECT)
                        {
+                               if (alert_trap_detect)
+                               {
 #ifdef JP
-                               msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
+                                       msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
 #else
-                               msg_print("*Leaving trap detect region!*");
+                                       msg_print("*Leaving trap detect region!*");
 #endif
-                       }
-
-                       if (disturb_trap_detect)
-                       {
-                               disturb(0, 0);
+                               }
+                               
+                               if (disturb_trap_detect)
+                               {
+                                       disturb(0, 0);
+                               }
                        }
                }
        }
@@ -4497,24 +4501,28 @@ static bool run_test(void)
 
        /* break run when leaving trap detected region */
        if ((disturb_trap_detect || alert_trap_detect)
-           && p_ptr->dtrap && !(cave[py][px].info & CAVE_DETECT))
+           && p_ptr->dtrap && !(cave[py][px].info & CAVE_IN_DETECT))
        {
                /* No duplicate warning */
                p_ptr->dtrap = FALSE;
 
-               if (alert_trap_detect)
+               /* You are just on the edge */
+               if (cave[py][px].info & CAVE_DETECT)
                {
+                       if (alert_trap_detect)
+                       {
 #ifdef JP
-                       msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
+                               msg_print("* Ãí°Õ:¤³¤ÎÀè¤Ï¥È¥é¥Ã¥×¤Î´¶ÃÎÈϰϳ°¤Ç¤¹¡ª *");
 #else
-                       msg_print("*Leaving trap detect region!*");
+                               msg_print("*Leaving trap detect region!*");
 #endif
-               }
+                       }
 
-               if (disturb_trap_detect)
-               {
-                       /* Break Run */
-                       return(TRUE);
+                       if (disturb_trap_detect)
+                       {
+                               /* Break Run */
+                               return(TRUE);
+                       }
                }
        }
 
index 1935112..0b00def 100644 (file)
 #define CAVE_MASK (CAVE_FLOOR | CAVE_EXTRA | CAVE_INNER | CAVE_OUTER | CAVE_SOLID | CAVE_VAULT)
 
 /* Used only after cave generation */
-#define CAVE_DETECT     0x4000    /* trap detected area */
+#define CAVE_DETECT     0x3000    /* trap detected area (include edge) */
+#define CAVE_IN_DETECT  0x4000    /* trap detected area (inner circle only) */
 
 
 /*
index 944da84..e4f8a94 100644 (file)
@@ -258,6 +258,7 @@ extern bool confirm_stairs;
 extern bool disturb_pets;
 extern bool view_perma_grids;
 extern bool view_torch_grids;
+extern bool view_unsafe_grids;
 extern bool track_follow;
 extern bool track_target;
 extern bool stack_allow_items;
index 01ff3a2..99b73dd 100644 (file)
@@ -1563,15 +1563,41 @@ static void wipe_generate_cave_flags(void)
 {
        int x, y;
 
-       for (y = 0; y < MAX_HGT; y++)
+       for (y = 0; y < cur_hgt; y++)
        {
-               for (x = 0; x < MAX_WID; x++)
+               for (x = 0; x < cur_wid; x++)
                {
                        /* Wipe unused flags */
                        cave[y][x].info &= ~(CAVE_MASK);
                }
        }
 
+       if (!dun_level)
+       {
+               for (y = 0; y < cur_hgt; y++)
+               {
+                       for (x = 0; x < cur_wid; x++)
+                       {
+                               /* There are no traps on the surface */
+                               cave[y][x].info |= CAVE_DETECT;
+                       }
+               }
+       }
+       else
+       {
+               /* There are no traps on map edge */
+               for (y = 0; y < cur_hgt; y++)
+               {
+                       cave[y][0].info |= CAVE_DETECT;
+                       cave[y][cur_wid-1].info |= CAVE_DETECT;
+               }
+               
+               for (x = 0; x < cur_wid; x++)
+               {
+                       cave[0][x].info |= CAVE_DETECT;
+                       cave[cur_hgt-1][x].info |= CAVE_DETECT;
+               }
+       }
 }
 
 /*
index 6d133eb..1a61e74 100644 (file)
@@ -3330,9 +3330,17 @@ bool detect_traps(int range)
                        c_ptr = &cave[y][x];
 
                        /* Mark as detected */
-                       if (dist <= range - 1)
+                       if (dist <= range)
+                       {
+                               if (dist <= range - 1)
+                                       c_ptr->info |= (CAVE_IN_DETECT);
+
                                c_ptr->info |= (CAVE_DETECT);
 
+                               /* Redraw */
+                               lite_spot(y, x);
+                       }
+
                        /* Detect invisible traps */
                        if (c_ptr->info & CAVE_TRAP)
                        {
index 5a3c8da..aa1ca07 100644 (file)
@@ -6817,6 +6817,15 @@ option_type option_info[] =
 
 
 #ifdef JP
+       { &view_unsafe_grids,            FALSE, 3, 1, 8,
+        "view_unsafe_grids",             "¥È¥é¥Ã¥×´¶ÃκѤߤǤʤ¤¾ì½ê¤òɽ¼¨¤¹¤ë" },
+#else
+       { &view_unsafe_grids,            FALSE, 3, 1, 8,
+       "view_unsafe_grids",             "Map marked by detect traps" },
+#endif
+
+
+#ifdef JP
        { &dungeon_stair,               TRUE,  3, 1, 9,
         "dungeon_stair",                "³¬Ãʤò¤Ä¤Ê¤²¤Æ¥À¥ó¥¸¥ç¥ó¤òÀ¸À®¤¹¤ë" },
 #else
index 697f178..fb54f0f 100644 (file)
@@ -269,6 +269,7 @@ bool expand_list;                   /* Expand the power of the list commands */
 
 bool view_perma_grids;         /* Map remembers all perma-lit grids */
 bool view_torch_grids;         /* Map remembers all torch-lit grids */
+bool view_unsafe_grids;                /* Map marked by detect traps */
 
 bool dungeon_align;                    /* Generate dungeons with aligned rooms */
 bool dungeon_stair;                    /* Generate dungeons with connected stairs */
index 6e36a23..5bb2b4e 100644 (file)
@@ -2488,7 +2488,7 @@ cptr look_mon_desc(int m_idx)
 #endif
        }
 
-       /* Display monster's level --- idea bolowed from ToME */
+       /* Display monster's level --- idea borrowed from ToME */
        if (r_ptr->r_tkills)
        {
 #ifdef JP