OSDN Git Service

BCC++ 5.5.1で警告封じオプション -w- を外した場合のコンパイル警告の除去.
[hengband/hengband.git] / src / monster1.c
index f33c6a5..c491d07 100644 (file)
@@ -1,15 +1,15 @@
 /* File: monster1.c */
 
-/* Purpose: describe monsters (using monster memory) */
-
 /*
- * Copyright (c) 1989 James E. Wilson, Christopher J. Stuart
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
  *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies.  Other copyrights may also apply.
  */
 
+/* Purpose: describe monsters (using monster memory) */
+
 #include "angband.h"
 
 
@@ -106,7 +106,19 @@ static bool know_damage(int r_idx, int i)
 
 
 /*
- * Hack -- display monster information using "roff()"
+ * Prepare hook for c_roff(). It will be changed for spoiler generation in wizard1.c.
+ */
+void (*hook_c_roff)(byte attr, cptr str) = c_roff;
+
+static void hooked_roff(cptr str)
+{
+       /* Spawn */
+       hook_c_roff(TERM_WHITE, str);
+}
+
+
+/*
+ * Hack -- display monster information using "hooked_roff()"
  *
  * Note that there is now a compiler option to only read the monster
  * descriptions from the raw file when they are actually needed, which
@@ -117,19 +129,20 @@ static bool know_damage(int r_idx, int i)
  * left edge of the screen, on a cleared line, in which the recall is
  * to take place.  One extra blank line is left after the recall.
  */
-static void roff_aux(int r_idx, int remem)
+static void roff_aux(int r_idx, int mode)
 {
        monster_race    *r_ptr = &r_info[r_idx];
 
        bool            old = FALSE;
-       bool            sin = FALSE;
 
        int             m, n, r;
 
        cptr            p, q;
 
 #ifdef JP
-        char            jverb_buf[64];
+       char            jverb_buf[64];
+#else
+       bool            sin = FALSE;
 #endif
        int             msex = 0;
 
@@ -146,40 +159,36 @@ static void roff_aux(int r_idx, int remem)
        u32b            flags6;
        u32b            flags7;
 
+       byte drop_gold, drop_item;
+
        int             vn = 0;
        byte            color[64];
        cptr            vp[64];
 
-       monster_race    save_mem;
+       bool know_everything = FALSE;
 
+       /* Obtain a copy of the "known" number of drops */
+       drop_gold = r_ptr->r_drop_gold;
+       drop_item = r_ptr->r_drop_item;
 
-       /* Cheat -- Know everything */
-       if (cheat_know)
-       {
-               /* XXX XXX XXX */
-
-               /* Save the "old" memory */
-               save_mem = *r_ptr;
-
-               /* Hack -- Maximal kills */
-/*             r_ptr->r_tkills = MAX_SHORT; */
+       /* Obtain a copy of the "known" flags */
+       flags1 = (r_ptr->flags1 & r_ptr->r_flags1);
+       flags2 = (r_ptr->flags2 & r_ptr->r_flags2);
+       flags3 = (r_ptr->flags3 & r_ptr->r_flags3);
+       flags4 = (r_ptr->flags4 & r_ptr->r_flags4);
+       flags5 = (r_ptr->flags5 & r_ptr->r_flags5);
+       flags6 = (r_ptr->flags6 & r_ptr->r_flags6);
+       flags7 = (r_ptr->flags7 & r_ptr->flags7);
 
-               /* Hack -- Maximal info */
-               r_ptr->r_wake = r_ptr->r_ignore = MAX_UCHAR;
-
-               /* Observe "maximal" attacks */
-               for (m = 0; m < 4; m++)
-               {
-                       /* Examine "actual" blows */
-                       if (r_ptr->blow[m].effect || r_ptr->blow[m].method)
-                       {
-                               /* Hack -- maximal observations */
-                               r_ptr->r_blows[m] = MAX_UCHAR;
-                       }
-               }
+       /* cheat_know or research_mon() */
+       if (cheat_know || (mode & 0x01))
+               know_everything = TRUE;
 
+       /* Cheat -- Know everything */
+       if (know_everything)
+       {
                /* Hack -- maximal drops */
-               r_ptr->r_drop_gold = r_ptr->r_drop_item =
+               drop_gold = drop_item =
                (((r_ptr->flags1 & RF1_DROP_4D2) ? 8 : 0) +
                 ((r_ptr->flags1 & RF1_DROP_3D2) ? 6 : 0) +
                 ((r_ptr->flags1 & RF1_DROP_2D2) ? 4 : 0) +
@@ -188,22 +197,16 @@ static void roff_aux(int r_idx, int remem)
                 ((r_ptr->flags1 & RF1_DROP_60)  ? 1 : 0));
 
                /* Hack -- but only "valid" drops */
-               if (r_ptr->flags1 & RF1_ONLY_GOLD) r_ptr->r_drop_item = 0;
-               if (r_ptr->flags1 & RF1_ONLY_ITEM) r_ptr->r_drop_gold = 0;
-
-               /* Hack -- observe many spells */
-               r_ptr->r_cast_inate = MAX_UCHAR;
-               r_ptr->r_cast_spell = MAX_UCHAR;
+               if (r_ptr->flags1 & RF1_ONLY_GOLD) drop_item = 0;
+               if (r_ptr->flags1 & RF1_ONLY_ITEM) drop_gold = 0;
 
                /* Hack -- know all the flags */
-               r_ptr->r_flags1 = r_ptr->flags1;
-               r_ptr->r_flags2 = r_ptr->flags2;
-               r_ptr->r_flags3 = r_ptr->flags3;
-               r_ptr->r_flags4 = r_ptr->flags4;
-               r_ptr->r_flags5 = r_ptr->flags5;
-               r_ptr->r_flags6 = r_ptr->flags6;
-
-               r_ptr->r_xtra1 |= MR1_SINKA;
+               flags1 = r_ptr->flags1;
+               flags2 = r_ptr->flags2;
+               flags3 = r_ptr->flags3;
+               flags4 = r_ptr->flags4;
+               flags5 = r_ptr->flags5;
+               flags6 = r_ptr->flags6;
        }
 
 
@@ -211,17 +214,6 @@ static void roff_aux(int r_idx, int remem)
        if (r_ptr->flags1 & RF1_FEMALE) msex = 2;
        else if (r_ptr->flags1 & RF1_MALE) msex = 1;
 
-
-       /* Obtain a copy of the "known" flags */
-       flags1 = (r_ptr->flags1 & r_ptr->r_flags1);
-       flags2 = (r_ptr->flags2 & r_ptr->r_flags2);
-       flags3 = (r_ptr->flags3 & r_ptr->r_flags3);
-       flags4 = (r_ptr->flags4 & r_ptr->r_flags4);
-       flags5 = (r_ptr->flags5 & r_ptr->r_flags5);
-       flags6 = (r_ptr->flags6 & r_ptr->r_flags6);
-       flags7 = (r_ptr->flags7 & r_ptr->flags7);
-
-
        /* Assume some "obvious" flags */
        if (r_ptr->flags1 & RF1_UNIQUE)  flags1 |= (RF1_UNIQUE);
        if (r_ptr->flags1 & RF1_QUESTOR) flags1 |= (RF1_QUESTOR);
@@ -229,13 +221,12 @@ static void roff_aux(int r_idx, int remem)
        if (r_ptr->flags1 & RF1_FEMALE)  flags1 |= (RF1_FEMALE);
 
        /* Assume some "creation" flags */
-       if (r_ptr->flags1 & RF1_FRIEND)  flags1 |= (RF1_FRIEND);
        if (r_ptr->flags1 & RF1_FRIENDS) flags1 |= (RF1_FRIENDS);
        if (r_ptr->flags1 & RF1_ESCORT)  flags1 |= (RF1_ESCORT);
        if (r_ptr->flags1 & RF1_ESCORTS) flags1 |= (RF1_ESCORTS);
 
        /* Killing a monster reveals some properties */
-       if (r_ptr->r_tkills || cheat_know)
+       if (r_ptr->r_tkills || know_everything)
        {
                /* Know "race" flags */
                if (r_ptr->flags3 & RF3_ORC)      flags3 |= (RF3_ORC);
@@ -248,6 +239,7 @@ static void roff_aux(int r_idx, int remem)
                if (r_ptr->flags3 & RF3_GOOD)     flags3 |= (RF3_GOOD);
                if (r_ptr->flags3 & RF3_ANIMAL)   flags3 |= (RF3_ANIMAL);
                if (r_ptr->flags3 & RF3_AMBERITE) flags3 |= (RF3_AMBERITE);
+               if (r_ptr->flags2 & RF2_HUMAN)    flags2 |= (RF2_HUMAN);
 
                /* Know 'quantum' flag */
                if (r_ptr->flags2 & RF2_QUANTUM)  flags2 |= (RF2_QUANTUM);
@@ -257,6 +249,12 @@ static void roff_aux(int r_idx, int remem)
                if (r_ptr->flags1 & RF1_FORCE_MAXHP) flags1 |= (RF1_FORCE_MAXHP);
        }
 
+       /* For output_monster_spoiler() */
+       if (mode & 0x02)
+       {
+               /* Nothing to do */
+       }
+       else
 
        /* Treat uniques differently */
        if (flags1 & RF1_UNIQUE)
@@ -269,21 +267,22 @@ static void roff_aux(int r_idx, int remem)
                {
                        /* Killed ancestors */
 #ifdef JP
-                       roff(format("%^s¤Ï¤¢¤Ê¤¿¤ÎÀèÁĤò %d ¿ÍÁò¤Ã¤Æ¤¤¤ë",
+                       hooked_roff(format("%^s¤Ï¤¢¤Ê¤¿¤ÎÀèÁĤò %d ¿ÍÁò¤Ã¤Æ¤¤¤ë",
+                                          wd_he[msex], r_ptr->r_deaths));
 #else
-                       roff(format("%^s has slain %d of your ancestors",
+                       hooked_roff(format("%^s has slain %d of your ancestors",
+                                          wd_he[msex], r_ptr->r_deaths));
 #endif
 
-                                   wd_he[msex], r_ptr->r_deaths));
 
                        /* But we've also killed it */
                        if (dead)
                        {
 #ifdef JP
-                               roff(format("¤¬¡¢¤¹¤Ç¤ËµØƤ¤Á¤Ï²Ì¤¿¤·¤Æ¤¤¤ë¡ª"));
+                               hooked_roff(format("¤¬¡¢¤¹¤Ç¤ËµØƤ¤Á¤Ï²Ì¤¿¤·¤Æ¤¤¤ë¡ª"));
 #else
-                               roff(format(", but you have avenged %s!  ",
-                                           plural(r_ptr->r_deaths, "him", "them")));
+                               hooked_roff(format(", but you have avenged %s!  ",
+                                           plural(r_ptr->r_deaths, "him", "them")));
 #endif
 
                        }
@@ -292,24 +291,29 @@ static void roff_aux(int r_idx, int remem)
                        else
                        {
 #ifdef JP
-                               roff(format("¤Î¤Ë¡¢¤Þ¤ÀµØƤ¤Á¤ò²Ì¤¿¤·¤Æ¤¤¤Ê¤¤¡£"));
+                               hooked_roff(format("¤Î¤Ë¡¢¤Þ¤ÀµØƤ¤Á¤ò²Ì¤¿¤·¤Æ¤¤¤Ê¤¤¡£"));
 #else
-                               roff(format(", who %s unavenged.  ",
-                                           plural(r_ptr->r_deaths, "remains", "remain")));
+                               hooked_roff(format(", who %s unavenged.  ",
+                                           plural(r_ptr->r_deaths, "remains", "remain")));
 #endif
 
                        }
+
+                       /* Start a new line */
+                       hooked_roff("\n");
                }
 
                /* Dead unique who never hurt us */
                else if (dead)
                {
 #ifdef JP
-                       roff("¤¢¤Ê¤¿¤Ï¤³¤ÎµØŨ¤ò¤¹¤Ç¤ËÁò¤êµî¤Ã¤Æ¤¤¤ë¡£");
+                       hooked_roff("¤¢¤Ê¤¿¤Ï¤³¤ÎµØŨ¤ò¤¹¤Ç¤ËÁò¤êµî¤Ã¤Æ¤¤¤ë¡£");
 #else
-                       roff("You have slain this foe.  ");
+                       hooked_roff("You have slain this foe.  ");
 #endif
 
+                       /* Start a new line */
+                       hooked_roff("\n");
                }
        }
 
@@ -318,11 +322,11 @@ static void roff_aux(int r_idx, int remem)
        {
                /* Dead ancestors */
 #ifdef JP
-               roff(format("¤³¤Î¥â¥ó¥¹¥¿¡¼¤Ï¤¢¤Ê¤¿¤ÎÀèÁĤò %d ¿ÍÁò¤Ã¤Æ¤¤¤ë",
-                           r_ptr->r_deaths ));
+               hooked_roff(format("¤³¤Î¥â¥ó¥¹¥¿¡¼¤Ï¤¢¤Ê¤¿¤ÎÀèÁĤò %d ¿ÍÁò¤Ã¤Æ¤¤¤ë",
+                           r_ptr->r_deaths ));
 #else
-               roff(format("%d of your ancestors %s been killed by this creature, ",
-                           r_ptr->r_deaths, plural(r_ptr->r_deaths, "has", "have")));
+               hooked_roff(format("%d of your ancestors %s been killed by this creature, ",
+                           r_ptr->r_deaths, plural(r_ptr->r_deaths, "has", "have")));
 #endif
 
 
@@ -330,23 +334,22 @@ static void roff_aux(int r_idx, int remem)
                if (r_ptr->r_pkills)
                {
 #ifdef JP
-                       roff(format("¤¬¡¢¤¢¤Ê¤¿¤Ï¤³¤Î¥â¥ó¥¹¥¿¡¼¤ò¾¯¤Ê¤¯¤È¤â %d ÂΤÏÅݤ·¤Æ¤¤¤ë¡£",
+                       hooked_roff(format("¤¬¡¢¤¢¤Ê¤¿¤Ï¤³¤Î¥â¥ó¥¹¥¿¡¼¤ò¾¯¤Ê¤¯¤È¤â %d ÂΤÏÅݤ·¤Æ¤¤¤ë¡£", r_ptr->r_pkills));
 #else
-                       roff(format("and you have exterminated at least %d of the creatures.  ",
+                       hooked_roff(format("and you have exterminated at least %d of the creatures.  ", r_ptr->r_pkills));
 #endif
 
-                                   r_ptr->r_pkills));
                }
 
                /* Some kills past lives */
                else if (r_ptr->r_tkills)
                {
 #ifdef JP
-                       roff(format("¤¬¡¢%s¤Ï¤³¤Î¥â¥ó¥¹¥¿¡¼¤ò¾¯¤Ê¤¯¤È¤â %d ÂΤÏÅݤ·¤Æ¤¤¤ë¡£",
-                                   "¤¢¤Ê¤¿¤ÎÀèÁÄ", r_ptr->r_tkills));
+                       hooked_roff(format("¤¬¡¢%s¤Ï¤³¤Î¥â¥ó¥¹¥¿¡¼¤ò¾¯¤Ê¤¯¤È¤â %d ÂΤÏÅݤ·¤Æ¤¤¤ë¡£",
+                                   "¤¢¤Ê¤¿¤ÎÀèÁÄ", r_ptr->r_tkills));
 #else
-                       roff(format("and %s have exterminated at least %d of the creatures.  ",
-                                   "your ancestors", r_ptr->r_tkills));
+                       hooked_roff(format("and %s have exterminated at least %d of the creatures.  ",
+                                   "your ancestors", r_ptr->r_tkills));
 #endif
 
                }
@@ -355,13 +358,15 @@ static void roff_aux(int r_idx, int remem)
                else
                {
 #ifdef JP
-                       roff(format("¤¬¡¢¤Þ¤À%s¤òÅݤ·¤¿¤³¤È¤Ï¤Ê¤¤¡£",
+                       hooked_roff(format("¤¬¡¢¤Þ¤À%s¤òÅݤ·¤¿¤³¤È¤Ï¤Ê¤¤¡£", wd_he[msex]));
 #else
-                       roff(format("and %s is not ever known to have been defeated.  ",
+                       hooked_roff(format("and %s is not ever known to have been defeated.  ", wd_he[msex]));
 #endif
 
-                                   wd_he[msex]));
                }
+
+               /* Start a new line */
+               hooked_roff("\n");
        }
 
        /* Normal monsters */
@@ -371,41 +376,39 @@ static void roff_aux(int r_idx, int remem)
                if (r_ptr->r_pkills)
                {
 #ifdef JP
-                       roff(format("¤¢¤Ê¤¿¤Ï¤³¤Î¥â¥ó¥¹¥¿¡¼¤ò¾¯¤Ê¤¯¤È¤â %d ÂΤϻ¦¤·¤Æ¤¤¤ë¡£",
+                       hooked_roff(format("¤¢¤Ê¤¿¤Ï¤³¤Î¥â¥ó¥¹¥¿¡¼¤ò¾¯¤Ê¤¯¤È¤â %d ÂΤϻ¦¤·¤Æ¤¤¤ë¡£", r_ptr->r_pkills));
 #else
-                       roff(format("You have killed at least %d of these creatures.  ",
+                       hooked_roff(format("You have killed at least %d of these creatures.  ", r_ptr->r_pkills));
 #endif
 
-                                   r_ptr->r_pkills));
                }
 
                /* Killed some last life */
                else if (r_ptr->r_tkills)
                {
 #ifdef JP
-                       roff(format("¤¢¤Ê¤¿¤ÎÀèÁĤϤ³¤Î¥â¥ó¥¹¥¿¡¼¤ò¾¯¤Ê¤¯¤È¤â %d ÂΤϻ¦¤·¤Æ¤¤¤ë¡£",
+                       hooked_roff(format("¤¢¤Ê¤¿¤ÎÀèÁĤϤ³¤Î¥â¥ó¥¹¥¿¡¼¤ò¾¯¤Ê¤¯¤È¤â %d ÂΤϻ¦¤·¤Æ¤¤¤ë¡£", r_ptr->r_tkills));
 #else
-                       roff(format("Your ancestors have killed at least %d of these creatures.  ",
+                       hooked_roff(format("Your ancestors have killed at least %d of these creatures.  ", r_ptr->r_tkills));
 #endif
 
-                                   r_ptr->r_tkills));
                }
 
                /* Killed none */
                else
                {
 #ifdef JP
-                       roff("¤³¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ·¤¿¤³¤È¤Ï¤Ê¤¤¡£");
+                       hooked_roff("¤³¤Î¥â¥ó¥¹¥¿¡¼¤òÅݤ·¤¿¤³¤È¤Ï¤Ê¤¤¡£");
 #else
-                       roff("No battles to the death are recalled.  ");
+                       hooked_roff("No battles to the death are recalled.  ");
 #endif
-
                }
-       }
 
+               /* Start a new line */
+               hooked_roff("\n");
+       }
 
        /* Descriptions */
-       if (1)
        {
                char buf[2048];
 
@@ -415,9 +418,9 @@ static void roff_aux(int r_idx, int remem)
 
                /* Build the filename */
 #ifdef JP
-path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
+path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, "r_info_j.raw");
 #else
-               path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info.raw");
+               path_build(buf, sizeof(buf), ANGBAND_DIR_DATA, "r_info.raw");
 #endif
 
 
@@ -454,24 +457,21 @@ path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
 
 #endif
 
-               /* Dump it */
-               roff(buf);
-#ifndef JP
-               roff("  ");
-#endif
+               if (buf[0])
+               {
+                       /* Dump it */
+                       hooked_roff(buf);
+
+                       /* Start a new line */
+                       hooked_roff("\n");
+               }
        }
 
        if (r_idx == MON_KAGE)
        {
                /* All done */
-               roff("\n");
+               hooked_roff("\n");
 
-               /* Cheat -- know everything */
-               if ((cheat_know) && (remem == 0))
-               {
-                       /* Hack -- restore memory */
-                       COPY(r_ptr, &save_mem, monster_race);
-               }
                return;
        }
 
@@ -482,34 +482,34 @@ path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
        if (r_ptr->level == 0)
        {
 #ifdef JP
-               roff(format("%^s¤ÏÄ®¤Ë½»¤ß", wd_he[msex]));
+               hooked_roff(format("%^s¤ÏÄ®¤Ë½»¤ß", wd_he[msex]));
 #else
-               roff(format("%^s lives in the town", wd_he[msex]));
+               hooked_roff(format("%^s lives in the town", wd_he[msex]));
 #endif
 
                old = TRUE;
        }
-       else if (r_ptr->r_tkills || cheat_know)
+       else if (r_ptr->r_tkills || know_everything)
        {
                if (depth_in_feet)
                {
 #ifdef JP
-                       roff(format("%^s¤ÏÄ̾ïÃϲ¼ %d ¥Õ¥£¡¼¥È¤Ç½Ð¸½¤·",
+                       hooked_roff(format("%^s¤ÏÄ̾ïÃϲ¼ %d ¥Õ¥£¡¼¥È¤Ç½Ð¸½¤·",
 #else
-                       roff(format("%^s is normally found at depths of %d feet",
+                       hooked_roff(format("%^s is normally found at depths of %d feet",
 #endif
 
-                                   wd_he[msex], r_ptr->level * 50));
+                                   wd_he[msex], r_ptr->level * 50));
                }
                else
                {
 #ifdef JP
-                       roff(format("%^s¤ÏÄ̾ïÃϲ¼ %d ³¬¤Ç½Ð¸½¤·",
+                       hooked_roff(format("%^s¤ÏÄ̾ïÃϲ¼ %d ³¬¤Ç½Ð¸½¤·",
 #else
-                       roff(format("%^s is normally found on dungeon level %d",
+                       hooked_roff(format("%^s is normally found on dungeon level %d",
 #endif
 
-                                   wd_he[msex], r_ptr->level));
+                                   wd_he[msex], r_ptr->level));
                }
                old = TRUE;
        }
@@ -518,7 +518,11 @@ path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
        /* Describe movement */
        if (r_idx == MON_CHAMELEON)
        {
-               roff("¡¢Â¾¤Î¥â¥ó¥¹¥¿¡¼¤Ë²½¤±¤ë¡£");
+#ifdef JP
+               hooked_roff("¡¢Â¾¤Î¥â¥ó¥¹¥¿¡¼¤Ë²½¤±¤ë¡£");
+#else
+               hooked_roff("and can take the shape of other monster.");
+#endif
                return;
        }
        else
@@ -527,24 +531,24 @@ path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
                if (old)
                {
 #ifdef JP
-                       roff("¡¢");
+                       hooked_roff("¡¢");
 #else
-                       roff(", and ");
+                       hooked_roff(", and ");
 #endif
 
                }
                else
                {
 #ifdef JP
-                       roff(format("%^s¤Ï", wd_he[msex]));
+                       hooked_roff(format("%^s¤Ï", wd_he[msex]));
 #else
-                       roff(format("%^s ", wd_he[msex]));
+                       hooked_roff(format("%^s ", wd_he[msex]));
 #endif
 
                        old = TRUE;
                }
 #ifndef JP
-               roff("moves");
+               hooked_roff("moves");
 #endif
 
                /* Random-ness */
@@ -554,44 +558,44 @@ path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
                        if ((flags1 & RF1_RAND_50) && (flags1 & RF1_RAND_25))
                        {
 #ifdef JP
-                               roff("¤«¤Ê¤ê");
+                               hooked_roff("¤«¤Ê¤ê");
 #else
-                               roff(" extremely");
+                               hooked_roff(" extremely");
 #endif
 
                        }
                        else if (flags1 & RF1_RAND_50)
                        {
 #ifdef JP
-                               roff("´öʬ");
+                               hooked_roff("´öʬ");
 #else
-                               roff(" somewhat");
+                               hooked_roff(" somewhat");
 #endif
 
                        }
                        else if (flags1 & RF1_RAND_25)
                        {
 #ifdef JP
-                               roff("¾¯¡¹");
+                               hooked_roff("¾¯¡¹");
 #else
-                               roff(" a bit");
+                               hooked_roff(" a bit");
 #endif
 
                        }
 
                        /* Adjective */
 #ifdef JP
-                       roff("ÉÔµ¬Â§¤Ë");
+                       hooked_roff("ÉÔµ¬Â§¤Ë");
 #else
-                       roff(" erratically");
+                       hooked_roff(" erratically");
 #endif
 
 
                        /* Hack -- Occasional conjunction */
 #ifdef JP
-                       if (speed != 110) roff("¡¢¤«¤Ä");
+                       if (speed != 110) hooked_roff("¡¢¤«¤Ä");
 #else
-                       if (speed != 110) roff(", and");
+                       if (speed != 110) hooked_roff(", and");
 #endif
 
                }
@@ -600,45 +604,50 @@ path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
                if (speed > 110)
                {
 #ifdef JP
-                       if (speed > 139) c_roff(TERM_RED, "¿®¤¸Æñ¤¤¤Û¤É");
-                       else if (speed > 134) c_roff(TERM_ORANGE, "ÌÔÎõ¤Ë");
-                       else if (speed > 129) c_roff(TERM_ORANGE, "Èó¾ï¤Ë");
-                       else if (speed > 124) c_roff(TERM_UMBER, "¤«¤Ê¤ê");
-                       else if (speed < 120) c_roff(TERM_L_UMBER, "¤ä¤ä");
-                       c_roff(TERM_L_RED, "ÁÇÁ᤯");
+                       if (speed > 139) hook_c_roff(TERM_RED, "¿®¤¸Æñ¤¤¤Û¤É");
+                       else if (speed > 134) hook_c_roff(TERM_ORANGE, "ÌÔÎõ¤Ë");
+                       else if (speed > 129) hook_c_roff(TERM_ORANGE, "Èó¾ï¤Ë");
+                       else if (speed > 124) hook_c_roff(TERM_UMBER, "¤«¤Ê¤ê");
+                       else if (speed < 120) hook_c_roff(TERM_L_UMBER, "¤ä¤ä");
+                       hook_c_roff(TERM_L_RED, "ÁÇÁ᤯");
 #else
-                       if (speed > 130) roff(" incredibly");
-                       else if (speed > 120) roff(" very");
-                       roff(" quickly");
+                       if (speed > 139) hook_c_roff(TERM_RED, " incredibly");
+                       else if (speed > 134) hook_c_roff(TERM_ORANGE, " extremely");
+                       else if (speed > 129) hook_c_roff(TERM_ORANGE, " very");
+                       else if (speed > 124) hook_c_roff(TERM_UMBER, " fairly");
+                       else if (speed < 120) hook_c_roff(TERM_L_UMBER, " somewhat");
+                       hook_c_roff(TERM_L_RED, " quickly");
 #endif
 
                }
                else if (speed < 110)
                {
 #ifdef JP
-                       if (speed < 90) c_roff(TERM_L_GREEN, "¿®¤¸Æñ¤¤¤Û¤É");
-                       else if (speed < 95) c_roff(TERM_BLUE, "Èó¾ï¤Ë");
-                       else if (speed < 100) c_roff(TERM_BLUE, "¤«¤Ê¤ê");
-                       else if (speed > 104) c_roff(TERM_GREEN, "¤ä¤ä");
-                       c_roff(TERM_L_BLUE, "¤æ¤Ã¤¯¤ê¤È");
+                       if (speed < 90) hook_c_roff(TERM_L_GREEN, "¿®¤¸Æñ¤¤¤Û¤É");
+                       else if (speed < 95) hook_c_roff(TERM_BLUE, "Èó¾ï¤Ë");
+                       else if (speed < 100) hook_c_roff(TERM_BLUE, "¤«¤Ê¤ê");
+                       else if (speed > 104) hook_c_roff(TERM_GREEN, "¤ä¤ä");
+                       hook_c_roff(TERM_L_BLUE, "¤æ¤Ã¤¯¤ê¤È");
 #else
-                       if (speed < 90) roff(" incredibly");
-                       else if (speed < 100) roff(" very");
-                       roff(" slowly");
+                       if (speed < 90) hook_c_roff(TERM_L_GREEN, " incredibly");
+                       else if (speed < 95) hook_c_roff(TERM_BLUE, " very");
+                       else if (speed < 100) hook_c_roff(TERM_BLUE, " fairly");
+                       else if (speed > 104) hook_c_roff(TERM_GREEN, " somewhat");
+                       hook_c_roff(TERM_L_BLUE, " slowly");
 #endif
 
                }
                else
                {
 #ifdef JP
-                       roff("ÉáÄ̤ή¤µ¤Ç");
+                       hooked_roff("ÉáÄ̤ή¤µ¤Ç");
 #else
-                       roff(" at normal speed");
+                       hooked_roff(" at normal speed");
 #endif
 
                }
 #ifdef JP
-               roff("Æ°¤¤¤Æ¤¤¤ë");
+               hooked_roff("Æ°¤¤¤Æ¤¤¤ë");
 #endif
        }
 
@@ -649,18 +658,18 @@ path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
                if (old)
                {
 #ifdef JP
-                       roff("¡¢¤·¤«¤·");
+                       hooked_roff("¡¢¤·¤«¤·");
 #else
-                       roff(", but ");
+                       hooked_roff(", but ");
 #endif
 
                }
                else
                {
 #ifdef JP
-                       roff(format("%^s¤Ï", wd_he[msex]));
+                       hooked_roff(format("%^s¤Ï", wd_he[msex]));
 #else
-                       roff(format("%^s ", wd_he[msex]));
+                       hooked_roff(format("%^s ", wd_he[msex]));
 #endif
 
                        old = TRUE;
@@ -668,9 +677,9 @@ path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
 
                /* Describe */
 #ifdef JP
-               roff("¿¯Æþ¼Ô¤òÄÉÀפ·¤Ê¤¤");
+               hooked_roff("¿¯Æþ¼Ô¤òÄÉÀפ·¤Ê¤¤");
 #else
-               roff("does not deign to chase intruders");
+               hooked_roff("does not deign to chase intruders");
 #endif
 
        }
@@ -679,9 +688,9 @@ path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
        if (old)
        {
 #ifdef JP
-               roff("¡£");
+               hooked_roff("¡£");
 #else
-               roff(".  ");
+               hooked_roff(".  ");
 #endif
 
                old = FALSE;
@@ -689,126 +698,130 @@ path_build(buf, 1024, ANGBAND_DIR_DATA, "r_info_j.raw");
 
 
        /* Describe experience if known */
-       if (r_ptr->r_tkills || cheat_know)
+       if (r_ptr->r_tkills || know_everything)
        {
                /* Introduction */
 #ifdef JP
-               roff("¤³¤Î");
+               hooked_roff("¤³¤Î");
 #else
                if (flags1 & RF1_UNIQUE)
                {
-                       roff("Killing this");
+                       hooked_roff("Killing this");
                }
                else
                {
-                       roff("A kill of this");
+                       hooked_roff("A kill of this");
                }
 #endif
 
 
                /* Describe the "quality" */
 #ifdef JP
-if (flags2 & RF2_ELDRITCH_HORROR) c_roff(TERM_VIOLET, "¶¸µ¤¤òͶ¤¦");/*nuke me*/
+if (flags2 & RF2_ELDRITCH_HORROR) hook_c_roff(TERM_VIOLET, "¶¸µ¤¤òͶ¤¦");/*nuke me*/
 #else
-               if (flags2 & RF2_ELDRITCH_HORROR) roff(" sanity-blasting");
+               if (flags2 & RF2_ELDRITCH_HORROR) hook_c_roff(TERM_VIOLET, " sanity-blasting");
 #endif
 
 #ifdef JP
-if (flags3 & RF3_ANIMAL)          c_roff(TERM_L_GREEN, "¼«Á³³¦¤Î");
+if (flags3 & RF3_ANIMAL)          hook_c_roff(TERM_L_GREEN, "¼«Á³³¦¤Î");
 #else
-               if (flags3 & RF3_ANIMAL)          roff(" natural");
+               if (flags3 & RF3_ANIMAL)          hook_c_roff(TERM_L_GREEN, " natural");
 #endif
 
 #ifdef JP
-if (flags3 & RF3_EVIL)            c_roff(TERM_L_DARK, "¼Ù°­¤Ê¤ë");
+if (flags3 & RF3_EVIL)            hook_c_roff(TERM_L_DARK, "¼Ù°­¤Ê¤ë");
 #else
-               if (flags3 & RF3_EVIL)            roff(" evil");
+               if (flags3 & RF3_EVIL)            hook_c_roff(TERM_L_DARK, " evil");
 #endif
 
 #ifdef JP
-if (flags3 & RF3_GOOD)            c_roff(TERM_YELLOW, "Á±ÎɤÊ");
+if (flags3 & RF3_GOOD)            hook_c_roff(TERM_YELLOW, "Á±ÎɤÊ");
 #else
-               if (flags3 & RF3_GOOD)            roff(" good");
+               if (flags3 & RF3_GOOD)            hook_c_roff(TERM_YELLOW, " good");
 #endif
 
 #ifdef JP
-if (flags3 & RF3_UNDEAD)          c_roff(TERM_VIOLET, "¥¢¥ó¥Ç¥Ã¥É¤Î");
+if (flags3 & RF3_UNDEAD)          hook_c_roff(TERM_VIOLET, "¥¢¥ó¥Ç¥Ã¥É¤Î");
 #else
-               if (flags3 & RF3_UNDEAD)          roff(" undead");
+               if (flags3 & RF3_UNDEAD)          hook_c_roff(TERM_VIOLET, " undead");
+#endif
+#ifdef JP
+if (flags3 & RF3_AMBERITE)        hook_c_roff(TERM_VIOLET, "¥¢¥ó¥Ð¡¼¤Î²¦Â²¤Î");
+#else
+               if (flags3 & RF3_AMBERITE)        hook_c_roff(TERM_VIOLET, " Amberite");
 #endif
 
 
-       if ((flags3 & (RF3_DRAGON | RF3_DEMON | RF3_GIANT | RF3_TROLL | RF3_ORC | RF3_AMBERITE)) || (flags2 & RF2_QUANTUM))
+       if ((flags3 & (RF3_DRAGON | RF3_DEMON | RF3_GIANT | RF3_TROLL | RF3_ORC)) || (flags2 & (RF2_QUANTUM | RF2_HUMAN)))
        {
        /* Describe the "race" */
 #ifdef JP
-     if (flags3 & RF3_DRAGON)   c_roff(TERM_ORANGE, "¥É¥é¥´¥ó");
+     if (flags3 & RF3_DRAGON)   hook_c_roff(TERM_ORANGE, "¥É¥é¥´¥ó");
 #else
-                    if (flags3 & RF3_DRAGON)   roff(" dragon");
+                    if (flags3 & RF3_DRAGON)   hook_c_roff(TERM_ORANGE, " dragon");
 #endif
 
 #ifdef JP
-if (flags3 & RF3_DEMON)    c_roff(TERM_VIOLET, "¥Ç¡¼¥â¥ó");
+if (flags3 & RF3_DEMON)    hook_c_roff(TERM_VIOLET, "¥Ç¡¼¥â¥ó");
 #else
-               if (flags3 & RF3_DEMON)    roff(" demon");
+               if (flags3 & RF3_DEMON)    hook_c_roff(TERM_VIOLET, " demon");
 #endif
 
 #ifdef JP
-if (flags3 & RF3_GIANT)    c_roff(TERM_L_UMBER, "¥¸¥ã¥¤¥¢¥ó¥È");
+if (flags3 & RF3_GIANT)    hook_c_roff(TERM_L_UMBER, "¥¸¥ã¥¤¥¢¥ó¥È");
 #else
-               if (flags3 & RF3_GIANT)    roff(" giant");
+               if (flags3 & RF3_GIANT)    hook_c_roff(TERM_L_UMBER, " giant");
 #endif
 
 #ifdef JP
-if (flags3 & RF3_TROLL)    c_roff(TERM_BLUE, "¥È¥í¥ë");
+if (flags3 & RF3_TROLL)    hook_c_roff(TERM_BLUE, "¥È¥í¥ë");
 #else
-               if (flags3 & RF3_TROLL)    roff(" troll");
+               if (flags3 & RF3_TROLL)    hook_c_roff(TERM_BLUE, " troll");
 #endif
 
 #ifdef JP
-if (flags3 & RF3_ORC)      c_roff(TERM_UMBER, "¥ª¡¼¥¯");
+if (flags3 & RF3_ORC)      hook_c_roff(TERM_UMBER, "¥ª¡¼¥¯");
 #else
-               if (flags3 & RF3_ORC)      roff(" orc");
+               if (flags3 & RF3_ORC)      hook_c_roff(TERM_UMBER, " orc");
 #endif
 
 #ifdef JP
-if (flags3 & RF3_AMBERITE) c_roff(TERM_L_WHITE, "¥¢¥ó¥Ð¡¼¤Î²¦Â²");
+if (flags2 & RF2_HUMAN) hook_c_roff(TERM_L_WHITE, "¿Í´Ö");
 #else
-               if (flags3 & RF3_AMBERITE) roff(" Amberite");
+               if (flags2 & RF2_HUMAN) hook_c_roff(TERM_L_WHITE, " Human");
 #endif
 
 #ifdef JP
-if (flags2 & RF2_QUANTUM)  c_roff(TERM_VIOLET, "ÎÌ»ÒÀ¸Êª");
+if (flags2 & RF2_QUANTUM)  hook_c_roff(TERM_VIOLET, "ÎÌ»ÒÀ¸Êª");
 #else
-               if (flags2 & RF2_QUANTUM)  roff(" quantum creature");
+               if (flags2 & RF2_QUANTUM)  hook_c_roff(TERM_VIOLET, " quantum creature");
 #endif
 
        }
 #ifdef JP
-else                            roff("¥â¥ó¥¹¥¿¡¼");
+else                            hooked_roff("¥â¥ó¥¹¥¿¡¼");
 #else
-               else                            roff(" creature");
+               else                            hooked_roff(" creature");
 #endif
 
 
 #ifdef JP
-               roff("¤òÅݤ¹¤³¤È¤Ï");
+               hooked_roff("¤òÅݤ¹¤³¤È¤Ï");
 #endif
                /* Group some variables */
-               if (TRUE)
                {
                        long i, j;
 
 #ifdef JP
                        i = p_ptr->lev;
-                       roff(format(" %lu ¥ì¥Ù¥ë¤Î¥­¥ã¥é¥¯¥¿¤Ë¤È¤Ã¤Æ", (long)i));
+                       hooked_roff(format(" %lu ¥ì¥Ù¥ë¤Î¥­¥ã¥é¥¯¥¿¤Ë¤È¤Ã¤Æ", (long)i));
 
                        i = (long)r_ptr->mexp * r_ptr->level / (p_ptr->max_plv+2);
                        j = ((((long)r_ptr->mexp * r_ptr->level % (p_ptr->max_plv+2)) *
                               (long)1000 / (p_ptr->max_plv+2) + 5) / 10);
 
-                       roff(format(" Ìó%ld.%02ld ¥Ý¥¤¥ó¥È¤Î·Ð¸³¤È¤Ê¤ë¡£",
-                               (long)i, (long)j ));
+                       hooked_roff(format(" Ìó%ld.%02ld ¥Ý¥¤¥ó¥È¤Î·Ð¸³¤È¤Ê¤ë¡£",
+                               (long)i, (long)j ));
 #else
                        /* calculate the integer exp part */
                        i = (long)r_ptr->mexp * r_ptr->level / (p_ptr->max_plv+2);
@@ -819,10 +832,9 @@ else                            roff("
                               (long)1000 / (p_ptr->max_plv+2) + 5) / 10);
 
                        /* Mention the experience */
-                       roff(format(" is worth %s%ld.%02ld point%s",
-                                   (r_ptr->flags1 & RF1_UNIQUE) ? "" : "about ", 
-                                   (long)i, (long)j,
-                                   (((i == 1) && (j == 0)) ? "" : "s")));
+                       hooked_roff(format(" is worth about %ld.%02ld point%s",
+                                   (long)i, (long)j,
+                                   (((i == 1) && (j == 0)) ? "" : "s")));
 
                        /* Take account of annoying English */
                        p = "th";
@@ -838,8 +850,8 @@ else                            roff("
                        if ((i == 8) || (i == 11) || (i == 18)) q = "n";
 
                        /* Mention the dependance on the player's level */
-                       roff(format(" for a%s %lu%s level character.  ",
-                                   q, (long)i, p));
+                       hooked_roff(format(" for a%s %lu%s level character.  ",
+                                   q, (long)i, p));
 #endif
 
                }
@@ -848,63 +860,63 @@ else                            roff("
        if ((flags2 & RF2_AURA_FIRE) && (flags2 & RF2_AURA_ELEC) && (flags3 & RF3_AURA_COLD))
        {
 #ifdef JP
-c_roff(TERM_VIOLET, format("%^s¤Ï±ê¤Èɹ¤È¥¹¥Ñ¡¼¥¯¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
+hook_c_roff(TERM_VIOLET, format("%^s¤Ï±ê¤Èɹ¤È¥¹¥Ñ¡¼¥¯¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
 #else
-               roff(format("%^s is surrounded by flames and electricity.  ", wd_he[msex]));
+               hook_c_roff(TERM_VIOLET, format("%^s is surrounded by flames and electricity.  ", wd_he[msex]));
 #endif
 
        }
        else if ((flags2 & RF2_AURA_FIRE) && (flags2 & RF2_AURA_ELEC))
        {
 #ifdef JP
-c_roff(TERM_L_RED, format("%^s¤Ï±ê¤È¥¹¥Ñ¡¼¥¯¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
+hook_c_roff(TERM_L_RED, format("%^s¤Ï±ê¤È¥¹¥Ñ¡¼¥¯¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
 #else
-               roff(format("%^s is surrounded by flames and electricity.  ", wd_he[msex]));
+               hook_c_roff(TERM_L_RED, format("%^s is surrounded by flames and electricity.  ", wd_he[msex]));
 #endif
 
        }
        else if ((flags2 & RF2_AURA_FIRE) && (flags3 & RF3_AURA_COLD))
        {
 #ifdef JP
-c_roff(TERM_BLUE, format("%^s¤Ï±ê¤Èɹ¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
+hook_c_roff(TERM_BLUE, format("%^s¤Ï±ê¤Èɹ¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
 #else
-               roff(format("%^s is surrounded by flames and electricity.  ", wd_he[msex]));
+               hook_c_roff(TERM_BLUE, format("%^s is surrounded by flames and electricity.  ", wd_he[msex]));
 #endif
 
        }
        else if ((flags3 & RF3_AURA_COLD) && (flags2 & RF2_AURA_ELEC))
        {
 #ifdef JP
-c_roff(TERM_L_GREEN, format("%^s¤Ïɹ¤È¥¹¥Ñ¡¼¥¯¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
+hook_c_roff(TERM_L_GREEN, format("%^s¤Ïɹ¤È¥¹¥Ñ¡¼¥¯¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
 #else
-               roff(format("%^s is surrounded by ice and electricity.  ", wd_he[msex]));
+               hook_c_roff(TERM_L_GREEN, format("%^s is surrounded by ice and electricity.  ", wd_he[msex]));
 #endif
 
        }
        else if (flags2 & RF2_AURA_FIRE)
        {
 #ifdef JP
-c_roff(TERM_RED, format("%^s¤Ï±ê¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
+hook_c_roff(TERM_RED, format("%^s¤Ï±ê¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
 #else
-               roff(format("%^s is surrounded by flames.  ", wd_he[msex]));
+               hook_c_roff(TERM_RED, format("%^s is surrounded by flames.  ", wd_he[msex]));
 #endif
 
        }
        else if (flags3 & RF3_AURA_COLD)
        {
 #ifdef JP
-c_roff(TERM_BLUE, format("%^s¤Ïɹ¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
+hook_c_roff(TERM_BLUE, format("%^s¤Ïɹ¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
 #else
-               roff(format("%^s is surrounded by ice.  ", wd_he[msex]));
+               hook_c_roff(TERM_BLUE, format("%^s is surrounded by ice.  ", wd_he[msex]));
 #endif
 
        }
        else if (flags2 & RF2_AURA_ELEC)
        {
 #ifdef JP
-c_roff(TERM_L_BLUE, format("%^s¤Ï¥¹¥Ñ¡¼¥¯¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
+hook_c_roff(TERM_L_BLUE, format("%^s¤Ï¥¹¥Ñ¡¼¥¯¤ËÊñ¤Þ¤ì¤Æ¤¤¤ë¡£", wd_he[msex]));
 #else
-               roff(format("%^s is surrounded by electricity.  ", wd_he[msex]));
+               hook_c_roff(TERM_L_BLUE, format("%^s is surrounded by electricity.  ", wd_he[msex]));
 #endif
 
        }
@@ -912,9 +924,9 @@ c_roff(TERM_L_BLUE, format("%^s
        if (flags2 & RF2_REFLECTING)
        {
 #ifdef JP
-roff(format("%^s¤ÏÌð¤Î¼öʸ¤òÄ·¤ÍÊÖ¤¹¡£", wd_he[msex]));
+hooked_roff(format("%^s¤ÏÌð¤Î¼öʸ¤òÄ·¤ÍÊÖ¤¹¡£", wd_he[msex]));
 #else
-               roff(format("%^s reflects bolt spells.  ", wd_he[msex]));
+               hooked_roff(format("%^s reflects bolt spells.  ", wd_he[msex]));
 #endif
 
        }
@@ -923,24 +935,24 @@ roff(format("%^s
        if ((flags1 & RF1_ESCORT) || (flags1 & RF1_ESCORTS))
        {
 #ifdef JP
-               roff(format("%^s¤ÏÄ̾ï¸î±Ò¤òȼ¤Ã¤Æ¸½¤ì¤ë¡£",
+               hooked_roff(format("%^s¤ÏÄ̾ï¸î±Ò¤òȼ¤Ã¤Æ¸½¤ì¤ë¡£",
 #else
-               roff(format("%^s usually appears with escorts.  ",
+               hooked_roff(format("%^s usually appears with escorts.  ",
 #endif
 
-                           wd_he[msex]));
+                           wd_he[msex]));
        }
 
        /* Describe friends */
-       else if ((flags1 & RF1_FRIEND) || (flags1 & RF1_FRIENDS))
+       else if (flags1 & RF1_FRIENDS)
        {
 #ifdef JP
-               roff(format("%^s¤ÏÄ̾クÃĤǸ½¤ì¤ë¡£",
+               hooked_roff(format("%^s¤ÏÄ̾クÃĤǸ½¤ì¤ë¡£",
 #else
-               roff(format("%^s usually appears in groups.  ",
+               hooked_roff(format("%^s usually appears in groups.  ",
 #endif
 
-                           wd_he[msex]));
+                           wd_he[msex]));
        }
 
 
@@ -959,27 +971,9 @@ roff(format("%^s
 #endif
 
 #ifdef JP
-       if (flags4 & RF4_ARROW_1) {vp[vn] = "Ìð¤ò·â¤Ä";color[vn++] = TERM_L_UMBER;}
-#else
-       if (flags4 & RF4_ARROW_1) {vp[vn] = "fire an arrow";color[vn++] = TERM_L_UMBER;}
-#endif
-
-#ifdef JP
-       if (flags4 & RF4_ARROW_2) {vp[vn] = "¶¯ÎϤÊÌð¤ò·â¤Ä";color[vn++] = TERM_L_UMBER;}
-#else
-       if (flags4 & RF4_ARROW_2) {vp[vn] = "fire arrows";color[vn++] = TERM_L_UMBER;}
-#endif
-
-#ifdef JP
-       if (flags4 & RF4_ARROW_3) {vp[vn] = "¼Í·â¤ò¤¹¤ë";color[vn++] = TERM_UMBER;}
-#else
-       if (flags4 & RF4_ARROW_3) {vp[vn] = "fire a missile";color[vn++] = TERM_UMBER;}
-#endif
-
-#ifdef JP
-       if (flags4 & RF4_ARROW_4) {vp[vn] = "¶¯ÎϤʼͷâ¤ò¤¹¤ë";color[vn++] = TERM_UMBER;}
+       if (flags4 & RF4_SHOOT) {vp[vn] = "¼Í·â¤ò¤¹¤ë";color[vn++] = TERM_UMBER;}
 #else
-       if (flags4 & RF4_ARROW_4) {vp[vn] = "fire missiles";color[vn++] = TERM_UMBER;}
+       if (flags4 & RF4_SHOOT) {vp[vn] = "fire an arrow";color[vn++] = TERM_UMBER;}
 #endif
 
 #ifdef JP
@@ -993,9 +987,9 @@ roff(format("%^s
        {
                /* Intro */
 #ifdef JP
-               roff(format("%^s¤Ï", wd_he[msex]));
+               hooked_roff(format("%^s¤Ï", wd_he[msex]));
 #else
-               roff(format("%^s", wd_he[msex]));
+               hooked_roff(format("%^s", wd_he[msex]));
 #endif
 
 
@@ -1005,27 +999,27 @@ roff(format("%^s
 #ifdef JP
                        if(n!=vn-1){
                          jverb(vp[n],jverb_buf,JVERB_OR);
-                         c_roff(color[n], jverb_buf);
-                         c_roff(color[n], "¤ê¡¢");
+                         hook_c_roff(color[n], jverb_buf);
+                         hook_c_roff(color[n], "¤ê¡¢");
                        }
-                       else  c_roff(color[n], vp[n]);
+                       else  hook_c_roff(color[n], vp[n]);
 #else
                        /* Intro */
-                       if (n == 0) roff(" may ");
-                       else if (n < vn-1) roff(", ");
-                       else roff(" or ");
+                       if (n == 0) hooked_roff(" may ");
+                       else if (n < vn-1) hooked_roff(", ");
+                       else hooked_roff(" or ");
 
                        /* Dump */
-                       roff(vp[n]);
+                       hook_c_roff(color[n], vp[n]);
 #endif
 
                }
 
                /* End */
 #ifdef JP
-               roff("¤³¤È¤¬¤¢¤ë¡£");
+               hooked_roff("¤³¤È¤¬¤¢¤ë¡£");
 #else
-               roff(".  ");
+               hooked_roff(".  ");
 #endif
 
        }
@@ -1174,9 +1168,9 @@ roff(format("%^s
 
                /* Intro */
 #ifdef JP
-               roff(format("%^s¤Ï", wd_he[msex]));
+               hooked_roff(format("%^s¤Ï", wd_he[msex]));
 #else
-               roff(format("%^s", wd_he[msex]));
+               hooked_roff(format("%^s", wd_he[msex]));
 #endif
 
 
@@ -1185,19 +1179,19 @@ roff(format("%^s
                {
                        /* Intro */
 #ifdef JP
-                       if ( n != 0 ) roff("¤ä");
+                       if ( n != 0 ) hooked_roff("¤ä");
 #else
-                       if (n == 0) roff(" may breathe ");
-                       else if (n < vn-1) roff(", ");
-                       else roff(" or ");
+                       if (n == 0) hooked_roff(" may breathe ");
+                       else if (n < vn-1) hooked_roff(", ");
+                       else hooked_roff(" or ");
 #endif
 
 
                        /* Dump */
-                       c_roff(color[n], vp[n]);
+                       hook_c_roff(color[n], vp[n]);
                }
 #ifdef JP
-               roff("¤Î¥Ö¥ì¥¹¤òÅǤ¯¤³¤È¤¬¤¢¤ë");
+               hooked_roff("¤Î¥Ö¥ì¥¹¤òÅǤ¯¤³¤È¤¬¤¢¤ë");
 #endif
        }
 
@@ -1267,7 +1261,7 @@ if (flags5 & (RF5_BA_DARK))         {vp[vn] = "
 #ifdef JP
 if (flags5 & (RF5_BA_LITE))         {vp[vn] = "¥¹¥¿¡¼¥Ð¡¼¥¹¥È";color[vn++] = TERM_YELLOW;}
 #else
-       if (flags4 & (RF5_BA_LITE))         {vp[vn] = "invoke starburst";color[vn++] = TERM_YELLOW;}
+       if (flags5 & (RF5_BA_LITE))         {vp[vn] = "invoke starburst";color[vn++] = TERM_YELLOW;}
 #endif
 
 #ifdef JP
@@ -1433,7 +1427,7 @@ if (flags6 & (RF6_HEAL))            {vp[vn] = "
 #endif
 
 #ifdef JP
-        if (flags6 & (RF6_INVULNER))        {vp[vn] = "̵Ũ²½";color[vn++] = TERM_WHITE;}
+       if (flags6 & (RF6_INVULNER))        {vp[vn] = "̵Ũ²½";color[vn++] = TERM_WHITE;}
 #else
        if (flags6 & (RF6_INVULNER))        {vp[vn] = "make invulnerable";color[vn++] = TERM_WHITE;}
 #endif
@@ -1589,7 +1583,7 @@ if (flags6 & (RF6_S_CYBER))         {vp[vn] = "
 #endif
 
 #ifdef JP
-if (flags6 & (RF6_S_AMBERITES))     {vp[vn] = "¥¢¥ó¥Ð¡¼¤Î²¦¾¤´­";color[vn++] = TERM_VIOLET;}
+if (flags6 & (RF6_S_AMBERITES))     {vp[vn] = "¥¢¥ó¥Ð¡¼¤Î²¦²¾¤´­";color[vn++] = TERM_VIOLET;}
 #else
        if (flags6 & (RF6_S_AMBERITES))     {vp[vn] = "summon Lords of Amber";color[vn++] = TERM_VIOLET;}
 #endif
@@ -1611,34 +1605,34 @@ if (flags6 & (RF6_S_UNIQUE))        {vp[vn] = "
                if (breath)
                {
 #ifdef JP
-                       roff("¡¢¤Ê¤ª¤«¤Ä");
+                       hooked_roff("¡¢¤Ê¤ª¤«¤Ä");
 #else
-                       roff(", and is also");
+                       hooked_roff(", and is also");
 #endif
 
                }
                else
                {
 #ifdef JP
-                       roff(format("%^s¤Ï", wd_he[msex]));
+                       hooked_roff(format("%^s¤Ï", wd_he[msex]));
 #else
-                       roff(format("%^s is", wd_he[msex]));
+                       hooked_roff(format("%^s is", wd_he[msex]));
 #endif
 
                }
 
 #ifdef JP
                /* Adverb */
-               if (flags2 & (RF2_SMART)) c_roff(TERM_YELLOW, "Ū³Î¤Ë");
+               if (flags2 & (RF2_SMART)) hook_c_roff(TERM_YELLOW, "Ū³Î¤Ë");
 
                /* Verb Phrase */
-               roff("ËâË¡¤ò»È¤¦¤³¤È¤¬¤Ç¤­¡¢");
+               hooked_roff("ËâË¡¤ò»È¤¦¤³¤È¤¬¤Ç¤­¡¢");
 #else
                /* Verb Phrase */
-               roff(" magical, casting spells");
+               hooked_roff(" magical, casting spells");
 
                /* Adverb */
-               if (flags2 & RF2_SMART) roff(" intelligently");
+               if (flags2 & RF2_SMART) hook_c_roff(TERM_YELLOW, " intelligently");
 #endif
 
 
@@ -1647,19 +1641,19 @@ if (flags6 & (RF6_S_UNIQUE))        {vp[vn] = "
                {
                        /* Intro */
 #ifdef JP
-                       if ( n != 0 ) roff("¡¢");
+                       if ( n != 0 ) hooked_roff("¡¢");
 #else
-                       if (n == 0) roff(" which ");
-                       else if (n < vn-1) roff(", ");
-                       else roff(" or ");
+                       if (n == 0) hooked_roff(" which ");
+                       else if (n < vn-1) hooked_roff(", ");
+                       else hooked_roff(" or ");
 #endif
 
 
                        /* Dump */
-                       c_roff(color[n], vp[n]);
+                       hook_c_roff(color[n], vp[n]);
                }
 #ifdef JP
-                roff("¤Î¼öʸ¤ò¾§¤¨¤ë¤³¤È¤¬¤¢¤ë");
+               hooked_roff("¤Î¼öʸ¤ò¾§¤¨¤ë¤³¤È¤¬¤¢¤ë");
 #endif
        }
 
@@ -1668,18 +1662,18 @@ if (flags6 & (RF6_S_UNIQUE))        {vp[vn] = "
        if (breath || magic)
        {
                /* Total casting */
-               m = r_ptr->r_cast_inate + r_ptr->r_cast_spell;
+               m = r_ptr->r_cast_spell;
 
                /* Average frequency */
-               n = (r_ptr->freq_inate + r_ptr->freq_spell) / 2;
+               n = r_ptr->freq_spell;
 
                /* Describe the spell frequency */
-               if (m > 100)
+               if (m > 100 || know_everything)
                {
 #ifdef JP
-                       roff(format("(³ÎΨ:1/%d)", 100 / n));
+                       hooked_roff(format("(³ÎΨ:1/%d)", 100 / n));
 #else
-                       roff(format("; 1 time in %d", 100 / n));
+                       hooked_roff(format("; 1 time in %d", 100 / n));
 #endif
 
                }
@@ -1689,18 +1683,18 @@ if (flags6 & (RF6_S_UNIQUE))        {vp[vn] = "
                {
                        n = ((n + 9) / 10) * 10;
 #ifdef JP
-                       roff(format("(³ÎΨ:Ìó1/%d)", 100 / n));
+                       hooked_roff(format("(³ÎΨ:Ìó1/%d)", 100 / n));
 #else
-                       roff(format("; about 1 time in %d", 100 / n));
+                       hooked_roff(format("; about 1 time in %d", 100 / n));
 #endif
 
                }
 
                /* End this sentence */
 #ifdef JP
-               roff("¡£");
+               hooked_roff("¡£");
 #else
-               roff(".  ");
+               hooked_roff(".  ");
 #endif
 
        }
@@ -1710,35 +1704,35 @@ if (flags6 & (RF6_S_UNIQUE))        {vp[vn] = "
        {
                /* Armor */
 #ifdef JP
-               roff(format("%^s¤Ï AC%d ¤ÎËɸæÎϤÈ",
+               hooked_roff(format("%^s¤Ï AC%d ¤ÎËɸæÎϤÈ",
 #else
-               roff(format("%^s has an armor rating of %d",
+               hooked_roff(format("%^s has an armor rating of %d",
 #endif
 
-                           wd_he[msex], r_ptr->ac));
+                           wd_he[msex], r_ptr->ac));
 
                /* Maximized hitpoints */
                if (flags1 & RF1_FORCE_MAXHP)
                {
 #ifdef JP
-                       roff(format(" %d ¤ÎÂÎÎϤ¬¤¢¤ë¡£",
+                       hooked_roff(format(" %d ¤ÎÂÎÎϤ¬¤¢¤ë¡£",
 #else
-                       roff(format(" and a life rating of %d.  ",
+                       hooked_roff(format(" and a life rating of %d.  ",
 #endif
 
-                                   r_ptr->hdice * r_ptr->hside));
+                                   r_ptr->hdice * r_ptr->hside));
                }
 
                /* Variable hitpoints */
                else
                {
 #ifdef JP
-                       roff(format(" %dd%d ¤ÎÂÎÎϤ¬¤¢¤ë¡£",
+                       hooked_roff(format(" %dd%d ¤ÎÂÎÎϤ¬¤¢¤ë¡£",
 #else
-                       roff(format(" and a life rating of %dd%d.  ",
+                       hooked_roff(format(" and a life rating of %dd%d.  ",
 #endif
 
-                                   r_ptr->hdice, r_ptr->hside));
+                                   r_ptr->hdice, r_ptr->hside));
                }
        }
 
@@ -1806,9 +1800,9 @@ if (flags2 & RF2_KILL_ITEM) vp[vn++] = "
        {
                /* Intro */
 #ifdef JP
-               roff(format("%^s¤Ï", wd_he[msex]));
+               hooked_roff(format("%^s¤Ï", wd_he[msex]));
 #else
-               roff(format("%^s", wd_he[msex]));
+               hooked_roff(format("%^s", wd_he[msex]));
 #endif
 
 
@@ -1819,26 +1813,26 @@ if (flags2 & RF2_KILL_ITEM) vp[vn++] = "
 #ifdef JP
                        if(n!=vn-1){
                          jverb(vp[n],jverb_buf,JVERB_AND);
-                         roff(jverb_buf);
-                         roff("¡¢");
+                         hooked_roff(jverb_buf);
+                         hooked_roff("¡¢");
                        }
-                       else  roff(vp[n]);
+                       else  hooked_roff(vp[n]);
 #else
-                       if (n == 0) roff(" can ");
-                       else if (n < vn-1) roff(", ");
-                       else roff(" and ");
+                       if (n == 0) hooked_roff(" can ");
+                       else if (n < vn-1) hooked_roff(", ");
+                       else hooked_roff(" and ");
 
                        /* Dump */
-                       roff(vp[n]);
+                       hooked_roff(vp[n]);
 #endif
 
                }
 
                /* End */
 #ifdef JP
-               roff("¤³¤È¤¬¤Ç¤­¤ë¡£");
+               hooked_roff("¤³¤È¤¬¤Ç¤­¤ë¡£");
 #else
-               roff(".  ");
+               hooked_roff(".  ");
 #endif
 
        }
@@ -1848,72 +1842,72 @@ if (flags2 & RF2_KILL_ITEM) vp[vn++] = "
        if (flags7 & (RF7_SELF_LITE_1 | RF7_SELF_LITE_2))
        {
 #ifdef JP
-               roff(format("%^s¤Ï¸÷¤Ã¤Æ¤¤¤ë¡£", wd_he[msex]));
+               hooked_roff(format("%^s¤Ï¸÷¤Ã¤Æ¤¤¤ë¡£", wd_he[msex]));
 #else
-               roff(format("%^s illuminate the dungeon.  ", wd_he[msex]));
+               hooked_roff(format("%^s illuminate the dungeon.  ", wd_he[msex]));
 #endif
 
        }
        if (flags2 & RF2_INVISIBLE)
        {
 #ifdef JP
-               roff(format("%^s¤ÏÆ©ÌÀ¤ÇÌܤ˸«¤¨¤Ê¤¤¡£", wd_he[msex]));
+               hooked_roff(format("%^s¤ÏÆ©ÌÀ¤ÇÌܤ˸«¤¨¤Ê¤¤¡£", wd_he[msex]));
 #else
-               roff(format("%^s is invisible.  ", wd_he[msex]));
+               hooked_roff(format("%^s is invisible.  ", wd_he[msex]));
 #endif
 
        }
        if (flags2 & RF2_COLD_BLOOD)
        {
 #ifdef JP
-               roff(format("%^s¤ÏÎä·ìưʪ¤Ç¤¢¤ë¡£", wd_he[msex]));
+               hooked_roff(format("%^s¤ÏÎä·ìưʪ¤Ç¤¢¤ë¡£", wd_he[msex]));
 #else
-               roff(format("%^s is cold blooded.  ", wd_he[msex]));
+               hooked_roff(format("%^s is cold blooded.  ", wd_he[msex]));
 #endif
 
        }
        if (flags2 & RF2_EMPTY_MIND)
        {
 #ifdef JP
-               roff(format("%^s¤Ï¥Æ¥ì¥Ñ¥·¡¼¤Ç¤Ï´¶ÃΤǤ­¤Ê¤¤¡£", wd_he[msex]));
+               hooked_roff(format("%^s¤Ï¥Æ¥ì¥Ñ¥·¡¼¤Ç¤Ï´¶ÃΤǤ­¤Ê¤¤¡£", wd_he[msex]));
 #else
-               roff(format("%^s is not detected by telepathy.  ", wd_he[msex]));
+               hooked_roff(format("%^s is not detected by telepathy.  ", wd_he[msex]));
 #endif
 
        }
        else if (flags2 & RF2_WEIRD_MIND)
        {
 #ifdef JP
-               roff(format("%^s¤Ï¤Þ¤ì¤Ë¥Æ¥ì¥Ñ¥·¡¼¤Ç´¶ÃΤǤ­¤ë¡£", wd_he[msex]));
+               hooked_roff(format("%^s¤Ï¤Þ¤ì¤Ë¥Æ¥ì¥Ñ¥·¡¼¤Ç´¶ÃΤǤ­¤ë¡£", wd_he[msex]));
 #else
-               roff(format("%^s is rarely detected by telepathy.  ", wd_he[msex]));
+               hooked_roff(format("%^s is rarely detected by telepathy.  ", wd_he[msex]));
 #endif
 
        }
        if (flags2 & RF2_MULTIPLY)
        {
 #ifdef JP
-               c_roff(TERM_L_UMBER, format("%^s¤ÏÇúȯŪ¤ËÁý¿£¤¹¤ë¡£", wd_he[msex]));
+               hook_c_roff(TERM_L_UMBER, format("%^s¤ÏÇúȯŪ¤ËÁý¿£¤¹¤ë¡£", wd_he[msex]));
 #else
-               c_roff(TERM_L_UMBER, format("%^s breeds explosively.  ", wd_he[msex]));
+               hook_c_roff(TERM_L_UMBER, format("%^s breeds explosively.  ", wd_he[msex]));
 #endif
 
        }
        if (flags2 & RF2_REGENERATE)
        {
 #ifdef JP
-               c_roff(TERM_L_WHITE, format("%^s¤ÏÁÇÁ᤯ÂÎÎϤò²óÉü¤¹¤ë¡£", wd_he[msex]));
+               hook_c_roff(TERM_L_WHITE, format("%^s¤ÏÁÇÁ᤯ÂÎÎϤò²óÉü¤¹¤ë¡£", wd_he[msex]));
 #else
-               c_roff(TERM_L_WHITE, format("%^s regenerates quickly.  ", wd_he[msex]));
+               hook_c_roff(TERM_L_WHITE, format("%^s regenerates quickly.  ", wd_he[msex]));
 #endif
 
        }
        if (flags7 & RF7_RIDING)
        {
 #ifdef JP
-               c_roff(TERM_SLATE, format("%^s¤Ë¾è¤ë¤³¤È¤¬¤Ç¤­¤ë¡£", wd_he[msex]));
+               hook_c_roff(TERM_SLATE, format("%^s¤Ë¾è¤ë¤³¤È¤¬¤Ç¤­¤ë¡£", wd_he[msex]));
 #else
-               c_roff(TERM_SLATE, format("%^s is suitable for riding.  ", wd_he[msex]));
+               hook_c_roff(TERM_SLATE, format("%^s is suitable for riding.  ", wd_he[msex]));
 #endif
 
        }
@@ -1951,9 +1945,9 @@ if (flags2 & RF2_KILL_ITEM) vp[vn++] = "
        {
                /* Intro */
 #ifdef JP
-               roff(format("%^s¤Ë¤Ï", wd_he[msex]));
+               hooked_roff(format("%^s¤Ë¤Ï", wd_he[msex]));
 #else
-               roff(format("%^s", wd_he[msex]));
+               hooked_roff(format("%^s", wd_he[msex]));
 #endif
 
 
@@ -1962,23 +1956,23 @@ if (flags2 & RF2_KILL_ITEM) vp[vn++] = "
                {
                        /* Intro */
 #ifdef JP
-                       if ( n != 0 ) roff("¤ä");
+                       if ( n != 0 ) hooked_roff("¤ä");
 #else
-                       if (n == 0) roff(" is hurt by ");
-                       else if (n < vn-1) roff(", ");
-                       else roff(" and ");
+                       if (n == 0) hooked_roff(" is hurt by ");
+                       else if (n < vn-1) hooked_roff(", ");
+                       else hooked_roff(" and ");
 #endif
 
 
                        /* Dump */
-                       c_roff(color[n], vp[n]);
+                       hook_c_roff(color[n], vp[n]);
                }
 
                /* End */
 #ifdef JP
-               roff("¤Ç¥À¥á¡¼¥¸¤òÍ¿¤¨¤é¤ì¤ë¡£");
+               hooked_roff("¤Ç¥À¥á¡¼¥¸¤òÍ¿¤¨¤é¤ì¤ë¡£");
 #else
-               roff(".  ");
+               hooked_roff(".  ");
 #endif
 
        }
@@ -2022,9 +2016,9 @@ if (flags2 & RF2_KILL_ITEM) vp[vn++] = "
        {
                /* Intro */
 #ifdef JP
-               roff(format("%^s¤Ï", wd_he[msex]));
+               hooked_roff(format("%^s¤Ï", wd_he[msex]));
 #else
-               roff(format("%^s", wd_he[msex]));
+               hooked_roff(format("%^s", wd_he[msex]));
 #endif
 
 
@@ -2033,23 +2027,23 @@ if (flags2 & RF2_KILL_ITEM) vp[vn++] = "
                {
                        /* Intro */
 #ifdef JP
-                       if ( n != 0 ) roff("¤È");
+                       if ( n != 0 ) hooked_roff("¤È");
 #else
-                       if (n == 0) roff(" resists ");
-                       else if (n < vn-1) roff(", ");
-                       else roff(" and ");
+                       if (n == 0) hooked_roff(" resists ");
+                       else if (n < vn-1) hooked_roff(", ");
+                       else hooked_roff(" and ");
 #endif
 
 
                        /* Dump */
-                       c_roff(color[n], vp[n]);
+                       hook_c_roff(color[n], vp[n]);
                }
 
                /* End */
 #ifdef JP
-               roff("¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£");
+               hooked_roff("¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£");
 #else
-               roff(".  ");
+               hooked_roff(".  ");
 #endif
 
        }
@@ -2165,9 +2159,9 @@ if ((flags3 & RF3_RES_TELE) && !(r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
        {
                /* Intro */
 #ifdef JP
-               roff(format("%^s¤Ï", wd_he[msex]));
+               hooked_roff(format("%^s¤Ï", wd_he[msex]));
 #else
-               roff(format("%^s", wd_he[msex]));
+               hooked_roff(format("%^s", wd_he[msex]));
 #endif
 
 
@@ -2176,50 +2170,50 @@ if ((flags3 & RF3_RES_TELE) && !(r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
                {
                        /* Intro */
 #ifdef JP
-                       if ( n != 0 ) roff("¤È");
+                       if ( n != 0 ) hooked_roff("¤È");
 #else
-                       if (n == 0) roff(" resists ");
-                       else if (n < vn-1) roff(", ");
-                       else roff(" and ");
+                       if (n == 0) hooked_roff(" resists ");
+                       else if (n < vn-1) hooked_roff(", ");
+                       else hooked_roff(" and ");
 #endif
 
 
                        /* Dump */
-                       c_roff(color[n], vp[n]);
+                       hook_c_roff(color[n], vp[n]);
                }
 
                /* End */
 #ifdef JP
-               roff("¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£");
+               hooked_roff("¤ÎÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡£");
 #else
-               roff(".  ");
+               hooked_roff(".  ");
 #endif
 
        }
 
 
-       if ((r_ptr->r_xtra1 & MR1_SINKA) || cheat_know)
+       if ((r_ptr->r_xtra1 & MR1_SINKA) || know_everything)
        {
                if (r_ptr->next_r_idx)
                {
 #ifdef JP
-                       roff(format("%^s¤Ï·Ð¸³¤òÀѤà¤È¡¢", wd_he[msex]));
+                       hooked_roff(format("%^s¤Ï·Ð¸³¤òÀѤà¤È¡¢", wd_he[msex]));
 #else
-                       roff(format("%^s will evolve into ", wd_he[msex]));
+                       hooked_roff(format("%^s will evolve into ", wd_he[msex]));
 #endif
-                       c_roff(TERM_YELLOW, format("%s", r_name+r_info[r_ptr->next_r_idx].name));
+                       hook_c_roff(TERM_YELLOW, format("%s", r_name+r_info[r_ptr->next_r_idx].name));
 #ifdef JP
-                       roff(format("¤Ë¿Ê²½¤¹¤ë¡£"));
+                       hooked_roff(format("¤Ë¿Ê²½¤¹¤ë¡£"));
 #else
-                       roff(format(" when %s gets enugh experience.  ", wd_he[msex]));
+                       hooked_roff(format(" when %s gets enugh experience.  ", wd_he[msex]));
 #endif
                }
                else if (!(r_ptr->flags1 & RF1_UNIQUE))
                {
 #ifdef JP
-                       roff(format("%s¤Ï¿Ê²½¤·¤Ê¤¤¡£", wd_he[msex]));
+                       hooked_roff(format("%s¤Ï¿Ê²½¤·¤Ê¤¤¡£", wd_he[msex]));
 #else
-                       roff(format("%s won't evolve.  ", wd_he[msex]));
+                       hooked_roff(format("%s won't evolve.  ", wd_he[msex]));
 #endif
                }
        }
@@ -2261,9 +2255,9 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
        {
                /* Intro */
 #ifdef JP
-               roff(format("%^s¤Ï", wd_he[msex]));
+               hooked_roff(format("%^s¤Ï", wd_he[msex]));
 #else
-               roff(format("%^s", wd_he[msex]));
+               hooked_roff(format("%^s", wd_he[msex]));
 #endif
 
 
@@ -2272,23 +2266,23 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
                {
                        /* Intro */
 #ifdef JP
-                       if ( n != 0 ) roff("¤·¡¢");
+                       if ( n != 0 ) hooked_roff("¤·¡¢");
 #else
-                       if (n == 0) roff(" cannot be ");
-                       else if (n < vn - 1) roff(", ");
-                       else roff(" or ");
+                       if (n == 0) hooked_roff(" cannot be ");
+                       else if (n < vn - 1) hooked_roff(", ");
+                       else hooked_roff(" or ");
 #endif
 
 
                        /* Dump */
-                       c_roff(color[n], vp[n]);
+                       hook_c_roff(color[n], vp[n]);
                }
 
                /* End */
 #ifdef JP
-               roff("¡£");
+               hooked_roff("¡£");
 #else
-               roff(".  ");
+               hooked_roff(".  ");
 #endif
 
        }
@@ -2296,8 +2290,8 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
 
        /* Do we know how aware it is? */
        if ((((int)r_ptr->r_wake * (int)r_ptr->r_wake) > r_ptr->sleep) ||
-                 (r_ptr->r_ignore == MAX_UCHAR) ||
-                ((r_ptr->sleep == 0) && ((r_ptr->r_tkills >= 10) || cheat_know)))
+                 (r_ptr->r_ignore == MAX_UCHAR) ||
+           (r_ptr->sleep == 0 && r_ptr->r_tkills >= 10) || know_everything)
        {
                cptr act;
 
@@ -2402,52 +2396,51 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
                }
 
 #ifdef JP
-               roff(format("%^s¤Ï¿¯Æþ¼Ô%s¡¢ %d ¥Õ¥£¡¼¥ÈÀ褫¤é¿¯Æþ¼Ô¤Ëµ¤ÉÕ¤¯¤³¤È¤¬¤¢¤ë¡£",
+               hooked_roff(format("%^s¤Ï¿¯Æþ¼Ô%s¡¢ %d ¥Õ¥£¡¼¥ÈÀ褫¤é¿¯Æþ¼Ô¤Ëµ¤ÉÕ¤¯¤³¤È¤¬¤¢¤ë¡£",
                     wd_he[msex], act, 10 * r_ptr->aaf));
 #else
-               roff(format("%^s %s intruders, which %s may notice from %d feet.  ",
-                           wd_he[msex], act, wd_he[msex], 10 * r_ptr->aaf));
+               hooked_roff(format("%^s %s intruders, which %s may notice from %d feet.  ",
+                           wd_he[msex], act, wd_he[msex], 10 * r_ptr->aaf));
 #endif
 
        }
 
 
        /* Drops gold and/or items */
-       if (r_ptr->r_drop_gold || r_ptr->r_drop_item)
+       if (drop_gold || drop_item)
        {
-               /* No "n" needed */
-               sin = FALSE;
-
                /* Intro */
 #ifdef JP
-               roff(format("%^s¤Ï", wd_he[msex]));
+               hooked_roff(format("%^s¤Ï", wd_he[msex]));
 #else
-               roff(format("%^s may carry", wd_he[msex]));
+               hooked_roff(format("%^s may carry", wd_he[msex]));
+
+               /* No "n" needed */
+               sin = FALSE;
 #endif
 
 
                /* Count maximum drop */
-               n = MAX(r_ptr->r_drop_gold, r_ptr->r_drop_item);
+               n = MAX(drop_gold, drop_item);
 
                /* One drop (may need an "n") */
                if (n == 1)
                {
 #ifdef JP
-                       roff("°ì¤Ä¤Î");
+                       hooked_roff("°ì¤Ä¤Î");
 #else
-                       roff(" a");
-#endif
-
+                       hooked_roff(" a");
                        sin = TRUE;
+#endif
                }
 
                /* Two drops */
                else if (n == 2)
                {
 #ifdef JP
-                       roff("°ì¤Ä¤«Æó¤Ä¤Î");
+                       hooked_roff("°ì¤Ä¤«Æó¤Ä¤Î");
 #else
-                       roff(" one or two");
+                       hooked_roff(" one or two");
 #endif
 
                }
@@ -2456,9 +2449,9 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
                else
                {
 #ifdef JP
-                       roff(format(" %d ¸Ä¤Þ¤Ç¤Î", n));
+                       hooked_roff(format(" %d ¸Ä¤Þ¤Ç¤Î", n));
 #else
-                       roff(format(" up to %d", n));
+                       hooked_roff(format(" up to %d", n));
 #endif
 
                }
@@ -2482,9 +2475,8 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
                        p = "¾å¼Á¤Ê";
 #else
                        p = " good";
-#endif
-
                        sin = FALSE;
+#endif
                }
 
                /* Okay */
@@ -2495,21 +2487,21 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
 
 
                /* Objects */
-               if (r_ptr->r_drop_item)
+               if (drop_item)
                {
                        /* Handle singular "an" */
 #ifndef JP
-                       if (sin) roff("n");
-#endif
+                       if (sin) hooked_roff("n");
                        sin = FALSE;
+#endif
 
                        /* Dump "object(s)" */
-                       if (p) roff(p);
+                       if (p) hooked_roff(p);
 #ifdef JP
-                       roff("¥¢¥¤¥Æ¥à");
+                       hooked_roff("¥¢¥¤¥Æ¥à");
 #else
-                       roff(" object");
-                       if (n != 1) roff("s");
+                       hooked_roff(" object");
+                       if (n != 1) hooked_roff("s");
 #endif
 
 
@@ -2523,33 +2515,33 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
                }
 
                /* Treasures */
-               if (r_ptr->r_drop_gold)
+               if (drop_gold)
                {
+#ifndef JP
                        /* Cancel prefix */
                        if (!p) sin = FALSE;
 
                        /* Handle singular "an" */
-#ifndef JP
-                       if (sin) roff("n");
-#endif
+                       if (sin) hooked_roff("n");
                        sin = FALSE;
+#endif
 
                        /* Dump "treasure(s)" */
-                       if (p) roff(p);
+                       if (p) hooked_roff(p);
 #ifdef JP
-                       roff("ºâÊõ");
+                       hooked_roff("ºâÊõ");
 #else
-                       roff(" treasure");
-                       if (n != 1) roff("s");
+                       hooked_roff(" treasure");
+                       if (n != 1) hooked_roff("s");
 #endif
 
                }
 
                /* End this sentence */
 #ifdef JP
-               roff("¤ò»ý¤Ã¤Æ¤¤¤ë¤³¤È¤¬¤¢¤ë¡£");
+               hooked_roff("¤ò»ý¤Ã¤Æ¤¤¤ë¤³¤È¤¬¤¢¤ë¡£");
 #else
-               roff(".  ");
+               hooked_roff(".  ");
 #endif
 
        }
@@ -2560,9 +2552,10 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
        {
                /* Skip non-attacks */
                if (!r_ptr->blow[m].method) continue;
+               if (r_ptr->blow[m].method == RBM_SHOOT) continue;
 
                /* Count known attacks */
-               if (r_ptr->r_blows[m]) n++;
+               if (r_ptr->r_blows[m] || know_everything) n++;
        }
 
        /* Examine (and count) the actual attacks */
@@ -2572,10 +2565,10 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
 
                /* Skip non-attacks */
                if (!r_ptr->blow[m].method) continue;
+               if (r_ptr->blow[m].method == RBM_SHOOT) continue;
 
                /* Skip unknown attacks */
-               if (!r_ptr->r_blows[m]) continue;
-
+               if (!r_ptr->r_blows[m] && !know_everything) continue;
 
                /* Extract the attack info */
                method = r_ptr->blow[m].method;
@@ -2583,7 +2576,6 @@ if ((flags3 & RF3_RES_TELE) && (r_ptr->flags1 & RF1_UNIQUE)) {vp[vn] = "
                d1 = r_ptr->blow[m].d_dice;
                d2 = r_ptr->blow[m].d_side;
 
-
                /* No method yet */
                p = NULL;
 
@@ -2936,17 +2928,17 @@ case RBE_DR_MANA:  q = "
 
 
 #ifdef JP
-                if ( r == 0 ) roff( format("%^s¤Ï", wd_he[msex]) );
+               if ( r == 0 ) hooked_roff( format("%^s¤Ï", wd_he[msex]) );
 
                /***¼ã´³É½¸½¤òÊѹ¹ ita ***/
 
-                        /* Describe damage (if known) */
-               if (d1 && d2 && know_damage(r_idx, m))
+                       /* Describe damage (if known) */
+               if (d1 && d2 && (know_everything || know_damage(r_idx, m)))
                  {
                    
                    /* Display the damage */
-                   roff(format(" %dd%d ", d1, d2));
-                   roff("¤Î¥À¥á¡¼¥¸¤Ç");
+                   hooked_roff(format(" %dd%d ", d1, d2));
+                   hooked_roff("¤Î¥À¥á¡¼¥¸¤Ç");
                  }
                /* Hack -- force a method */
                if (!p) p = "²¿¤«´ñ̯¤Ê¤³¤È¤ò¤¹¤ë";
@@ -2957,29 +2949,29 @@ case RBE_DR_MANA:  q = "
                else if(r!=n-1) jverb( p ,jverb_buf, JVERB_AND);
                else strcpy(jverb_buf, p);
 
-               roff(jverb_buf);
+               hooked_roff(jverb_buf);
 
                /* Describe the effect (if any) */
                if (q)
                {
                  if(r!=n-1) jverb( q,jverb_buf, JVERB_AND);
                  else strcpy(jverb_buf,q); 
-                 roff(jverb_buf);
+                 hooked_roff(jverb_buf);
                }
-               if(r!=n-1) roff("¡¢");
+               if(r!=n-1) hooked_roff("¡¢");
 #else
                /* Introduce the attack description */
                if (!r)
                {
-                       roff(format("%^s can ", wd_he[msex]));
+                       hooked_roff(format("%^s can ", wd_he[msex]));
                }
                else if (r < n-1)
                {
-                       roff(", ");
+                       hooked_roff(", ");
                }
                else
                {
-                       roff(", and ");
+                       hooked_roff(", and ");
                }
 
 
@@ -2987,22 +2979,22 @@ case RBE_DR_MANA:  q = "
                if (!p) p = "do something weird";
 
                /* Describe the method */
-               roff(p);
+               hooked_roff(p);
 
 
                /* Describe the effect (if any) */
                if (q)
                {
                        /* Describe the attack type */
-                       roff(" to ");
-                       roff(q);
+                       hooked_roff(" to ");
+                       hooked_roff(q);
 
                        /* Describe damage (if known) */
-                       if (d1 && d2 && know_damage(r_idx, m))
+                       if (d1 && d2 && (know_everything || know_damage(r_idx, m)))
                        {
                                /* Display the damage */
-                               roff(" with damage");
-                               roff(format(" %dd%d", d1, d2));
+                               hooked_roff(" with damage");
+                               hooked_roff(format(" %dd%d", d1, d2));
                        }
                }
 #endif
@@ -3017,9 +3009,9 @@ case RBE_DR_MANA:  q = "
        if (r)
        {
 #ifdef JP
-               roff("¡£");
+               hooked_roff("¡£");
 #else
-               roff(".  ");
+               hooked_roff(".  ");
 #endif
 
        }
@@ -3028,9 +3020,9 @@ case RBE_DR_MANA:  q = "
        else if (flags1 & RF1_NEVER_BLOW)
        {
 #ifdef JP
-               roff(format("%^s¤ÏʪÍýŪ¤Ê¹¶·âÊýË¡¤ò»ý¤¿¤Ê¤¤¡£", wd_he[msex]));
+               hooked_roff(format("%^s¤ÏʪÍýŪ¤Ê¹¶·âÊýË¡¤ò»ý¤¿¤Ê¤¤¡£", wd_he[msex]));
 #else
-               roff(format("%^s has no physical attacks.  ", wd_he[msex]));
+               hooked_roff(format("%^s has no physical attacks.  ", wd_he[msex]));
 #endif
 
        }
@@ -3039,9 +3031,9 @@ case RBE_DR_MANA:  q = "
        else
        {
 #ifdef JP
-               roff(format("%s¹¶·â¤Ë¤Ä¤¤¤Æ¤Ï²¿¤âÃΤé¤Ê¤¤¡£", wd_his[msex]));
+               hooked_roff(format("%s¹¶·â¤Ë¤Ä¤¤¤Æ¤Ï²¿¤âÃΤé¤Ê¤¤¡£", wd_his[msex]));
 #else
-               roff(format("Nothing is known about %s attack.  ", wd_his[msex]));
+               hooked_roff(format("Nothing is known about %s attack.  ", wd_his[msex]));
 #endif
 
        }
@@ -3051,12 +3043,12 @@ case RBE_DR_MANA:  q = "
         * Notice "Quest" monsters, but only if you
         * already encountered the monster.
         */
-       if ((flags1 & RF1_QUESTOR) && (cheat_know || ((r_ptr->r_sights) && (r_ptr->max_num) && ((r_idx == MON_OBERON) || (r_idx == MON_SERPENT)))))
+       if ((flags1 & RF1_QUESTOR) && ((r_ptr->r_sights) && (r_ptr->max_num) && ((r_idx == MON_OBERON) || (r_idx == MON_SERPENT))))
        {
 #ifdef JP
-               c_roff(TERM_VIOLET, "¤¢¤Ê¤¿¤Ï¤³¤Î¥â¥ó¥¹¥¿¡¼¤ò»¦¤·¤¿¤¤¤È¤¤¤¦¶¯¤¤Íß˾¤ò´¶¤¸¤Æ¤¤¤ë...");
+               hook_c_roff(TERM_VIOLET, "¤¢¤Ê¤¿¤Ï¤³¤Î¥â¥ó¥¹¥¿¡¼¤ò»¦¤·¤¿¤¤¤È¤¤¤¦¶¯¤¤Íß˾¤ò´¶¤¸¤Æ¤¤¤ë...");
 #else
-               c_roff(TERM_VIOLET, "You feel an intense desire to kill this monster...  ");
+               hook_c_roff(TERM_VIOLET, "You feel an intense desire to kill this monster...  ");
 #endif
 
        }
@@ -3064,23 +3056,17 @@ case RBE_DR_MANA:  q = "
        else if (flags7 & RF7_GUARDIAN)
        {
 #ifdef JP
-               c_roff(TERM_L_RED, "¤³¤Î¥â¥ó¥¹¥¿¡¼¤Ï¥À¥ó¥¸¥ç¥ó¤Î¼ç¤Ç¤¢¤ë¡£");
+               hook_c_roff(TERM_L_RED, "¤³¤Î¥â¥ó¥¹¥¿¡¼¤Ï¥À¥ó¥¸¥ç¥ó¤Î¼ç¤Ç¤¢¤ë¡£");
 #else
-               c_roff(TERM_L_RED, "This monster is the master of a dungeon.");
+               hook_c_roff(TERM_L_RED, "This monster is the master of a dungeon.");
 #endif
 
        }
 
 
        /* All done */
-       roff("\n");
+       hooked_roff("\n");
 
-       /* Cheat -- know everything */
-       if ((cheat_know) && (remem == 0))
-       {
-               /* Hack -- restore memory */
-               COPY(r_ptr, &save_mem, monster_race);
-       }
 }
 
 
@@ -3088,7 +3074,7 @@ case RBE_DR_MANA:  q = "
 /*
  * Hack -- Display the "name" and "attr/chars" of a monster race
  */
-static void roff_top(int r_idx)
+void roff_top(int r_idx)
 {
        monster_race    *r_ptr = &r_info[r_idx];
 
@@ -3111,16 +3097,13 @@ static void roff_top(int r_idx)
        /* Reset the cursor */
        Term_gotoxy(0, 0);
 
+#ifndef JP
        /* A title (use "The" for non-uniques) */
-#ifdef JP
-        if (0)
-#else
        if (!(r_ptr->flags1 & RF1_UNIQUE))
-#endif
-
        {
                Term_addstr(-1, TERM_WHITE, "The ");
        }
+#endif
 
        /* Dump the name */
        Term_addstr(-1, TERM_WHITE, (r_name + r_ptr->name));
@@ -3128,15 +3111,17 @@ static void roff_top(int r_idx)
        /* Append the "standard" attr/char info */
        Term_addstr(-1, TERM_WHITE, " ('");
        Term_addch(a1, c1);
+       if (use_bigtile && (a1 & 0x80)) Term_addch(255, -1);
        Term_addstr(-1, TERM_WHITE, "')");
 
        /* Append the "optional" attr/char info */
        Term_addstr(-1, TERM_WHITE, "/('");
        Term_addch(a2, c2);
+       if (use_bigtile && (a2 & 0x80)) Term_addch(255, -1);
        Term_addstr(-1, TERM_WHITE, "'):");
 
        /* Wizards get extra info */
-       if (wizard)
+       if (p_ptr->wizard)
        {
                char buf[6];
 
@@ -3153,7 +3138,7 @@ static void roff_top(int r_idx)
 /*
  * Hack -- describe the given monster race at the top of the screen
  */
-void screen_roff(int r_idx, int remember)
+void screen_roff(int r_idx, int mode)
 {
        /* Flush messages */
        msg_print(NULL);
@@ -3161,8 +3146,10 @@ void screen_roff(int r_idx, int remember)
        /* Begin recall */
        Term_erase(0, 1, 255);
 
+       hook_c_roff = c_roff;
+
        /* Recall monster */
-       roff_aux(r_idx, remember);
+       roff_aux(r_idx, mode);
 
        /* Describe monster */
        roff_top(r_idx);
@@ -3188,6 +3175,8 @@ void display_roff(int r_idx)
        /* Begin recall */
        Term_gotoxy(0, 1);
 
+       hook_c_roff = c_roff;
+
        /* Recall monster */
        roff_aux(r_idx, 0);
 
@@ -3196,12 +3185,25 @@ void display_roff(int r_idx)
 }
 
 
+
+/*
+ * Hack -- output description of the given monster race
+ */
+void output_monster_spoiler(int r_idx, void (*roff_func)(byte attr, cptr str))
+{
+       hook_c_roff = roff_func;
+
+       /* Recall monster */
+       roff_aux(r_idx, 0x03);
+}
+
+
 bool monster_quest(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
        /* Random quests are in the dungeon */
-       if (!(r_ptr->flags8 & RF8_DUNGEON)) return FALSE;
+       if (r_ptr->flags8 & RF8_WILD_ONLY) return FALSE;
 
        /* No random quests for aquatic monsters */
        if (r_ptr->flags7 & RF7_AQUATIC) return FALSE;
@@ -3220,10 +3222,15 @@ bool monster_dungeon(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
-       if (r_ptr->flags8 & RF8_DUNGEON)
+       if (!(r_ptr->flags8 & RF8_WILD_ONLY))
                return TRUE;
        else
+       {
+               dungeon_info_type *d_ptr = &d_info[dungeon_type];
+               if ((d_ptr->mflags8 & RF8_WILD_MOUNTAIN) &&
+                   (r_ptr->flags8 & RF8_WILD_MOUNTAIN)) return TRUE;
                return FALSE;
+       }
 }
 
 
@@ -3249,11 +3256,11 @@ bool monster_shore(int r_idx)
 }
 
 
-bool monster_waste(int r_idx)
+static bool monster_waste(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
-       if (r_ptr->flags8 & RF8_WILD_WASTE)
+       if (r_ptr->flags8 & (RF8_WILD_WASTE | RF8_WILD_ALL))
                return TRUE;
        else
                return FALSE;
@@ -3264,7 +3271,7 @@ bool monster_town(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
-       if (r_ptr->flags8 & RF8_WILD_TOWN)
+       if (r_ptr->flags8 & (RF8_WILD_TOWN | RF8_WILD_ALL))
                return TRUE;
        else
                return FALSE;
@@ -3275,7 +3282,7 @@ bool monster_wood(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
-       if (r_ptr->flags8 & RF8_WILD_WOOD)
+       if (r_ptr->flags8 & (RF8_WILD_WOOD | RF8_WILD_ALL))
                return TRUE;
        else
                return FALSE;
@@ -3308,7 +3315,7 @@ bool monster_grass(int r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
-       if (r_ptr->flags8 & RF8_WILD_GRASS)
+       if (r_ptr->flags8 & (RF8_WILD_GRASS | RF8_WILD_ALL))
                return TRUE;
        else
                return FALSE;
@@ -3387,7 +3394,7 @@ monster_hook_type get_monster_hook(void)
        }
        else
        {
-               return monster_dungeon;
+               return (monster_hook_type)monster_dungeon;
        }
 }
 
@@ -3398,12 +3405,12 @@ monster_hook_type get_monster_hook2(int y, int x)
        switch (cave[y][x].feat)
        {
        case FEAT_SHAL_WATER:
-               return monster_shallow_water;
+               return (monster_hook_type)monster_shallow_water;
        case FEAT_DEEP_WATER:
-               return monster_deep_water;
+               return (monster_hook_type)monster_deep_water;
        case FEAT_DEEP_LAVA:
        case FEAT_SHAL_LAVA:
-               return monster_lava;
+               return (monster_hook_type)monster_lava;
        default:
                return NULL;
        }
@@ -3421,6 +3428,8 @@ void set_pet(monster_type *m_ptr)
        check_quest_completion(m_ptr);
 
        m_ptr->smart |= SM_PET;
+       if (!(r_info[m_ptr->r_idx].flags3 & (RF3_EVIL | RF3_GOOD)))
+               m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
 }
 
 /*
@@ -3466,6 +3475,14 @@ msg_format("%^s
  */
 bool monster_can_cross_terrain(byte feat, monster_race *r_ptr)
 {
+       /* Pit */
+       if (feat == FEAT_DARK_PIT)
+       {
+               if (r_ptr->flags7 & RF7_CAN_FLY)
+                       return TRUE;
+               else
+                       return FALSE;
+       }
        /* Deep water */
        if (feat == FEAT_DEEP_WATER)
        {
@@ -3509,6 +3526,99 @@ bool monster_can_cross_terrain(byte feat, monster_race *r_ptr)
 
 
 /*
+ * Strictly check if monster can enter the grid
+ */
+bool monster_can_enter(int y, int x, monster_race *r_ptr)
+{
+       cave_type *c_ptr = &cave[y][x];
+       byte feat = c_ptr->feat;
+
+       /* Player or other monster */
+       if ((y == py) && (x == px)) return FALSE;
+       if (c_ptr->m_idx) return FALSE;
+
+       /* Permanent wall */
+       if ((c_ptr->feat >= FEAT_PERM_EXTRA) &&
+           (c_ptr->feat <= FEAT_PERM_SOLID))
+               return FALSE;
+
+       /* Can fly over the Pattern */
+       if ((c_ptr->feat >= FEAT_PATTERN_START) &&
+           (c_ptr->feat <= FEAT_PATTERN_XTRA2))
+       {
+           if (!(r_ptr->flags7 & RF7_CAN_FLY))
+                   return FALSE;
+           else
+                   return TRUE;
+       }
+
+       /* Can fly over mountain on the surface */
+       if (feat == FEAT_MOUNTAIN)
+       {
+           if (!dun_level && 
+               ((r_ptr->flags7 & RF7_CAN_FLY) ||
+                (r_ptr->flags8 & RF8_WILD_MOUNTAIN)))
+                   return TRUE;
+           else
+                   return FALSE;
+       }
+
+       /* Cannot enter wall without pass wall ability */
+       if (!cave_floor_grid(c_ptr) && !(r_ptr->flags2 & RF2_PASS_WALL))
+               return FALSE;
+
+       /* Pit */
+       if (feat == FEAT_DARK_PIT)
+       {
+               if (r_ptr->flags7 & RF7_CAN_FLY)
+                       return TRUE;
+               else
+                       return FALSE;
+       }
+       /* Deep water */
+       if (feat == FEAT_DEEP_WATER)
+       {
+               if ((r_ptr->flags7 & RF7_AQUATIC) ||
+                   (r_ptr->flags7 & RF7_CAN_FLY) ||
+                   (r_ptr->flags7 & RF7_CAN_SWIM))
+                       return TRUE;
+               else
+                       return FALSE;
+       }
+       /* Shallow water */
+       else if (feat == FEAT_SHAL_WATER)
+       {
+               if (!(r_ptr->flags2 & RF2_AURA_FIRE) ||
+                   (r_ptr->flags7 & RF7_AQUATIC) ||
+                   (r_ptr->flags7 & RF7_CAN_FLY) ||
+                   (r_ptr->flags7 & RF7_CAN_SWIM))
+                       return TRUE;
+               else
+                       return FALSE;
+       }
+       /* Aquatic monster */
+       else if ((r_ptr->flags7 & RF7_AQUATIC) &&
+                   !(r_ptr->flags7 & RF7_CAN_FLY))
+       {
+               return FALSE;
+       }
+       /* Lava */
+       else if ((feat == FEAT_SHAL_LAVA) ||
+           (feat == FEAT_DEEP_LAVA))
+       {
+               if ((r_ptr->flags3 & RF3_IM_FIRE) ||
+                   (r_ptr->flags7 & RF7_CAN_FLY))
+                       return TRUE;
+               else
+                       return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+
+/*
  * Check if two monsters are enemies
  */
 bool are_enemies(monster_type *m_ptr, monster_type *n_ptr)
@@ -3522,18 +3632,22 @@ bool are_enemies(monster_type *m_ptr, monster_type *n_ptr)
                return TRUE;
        }
 
-       if ((r_ptr->flags8 & RF8_WILD_TOWN) && (s_ptr->flags8 & RF8_WILD_TOWN))
+       if ((r_ptr->flags8 & (RF8_WILD_TOWN | RF8_WILD_ALL))
+           && (s_ptr->flags8 & (RF8_WILD_TOWN | RF8_WILD_ALL)))
        {
                if (!is_pet(m_ptr) && !is_pet(n_ptr)) return FALSE;
        }
 
        /* Friendly vs. opposite aligned normal or pet */
-       if (((r_ptr->flags3 & RF3_EVIL) &&
-                 (s_ptr->flags3 & RF3_GOOD)) ||
-                ((r_ptr->flags3 & RF3_GOOD) &&
-                 (s_ptr->flags3 & RF3_EVIL)))
+       if (m_ptr->sub_align != n_ptr->sub_align)
        {
-               if (!(m_ptr->mflag2 & MFLAG_CHAMELEON) || !(n_ptr->mflag2 & MFLAG_CHAMELEON)) return TRUE;
+               if (((m_ptr->sub_align & SUB_ALIGN_EVIL) &&
+                         (n_ptr->sub_align & SUB_ALIGN_GOOD)) ||
+                        ((m_ptr->sub_align & SUB_ALIGN_GOOD) &&
+                         (n_ptr->sub_align & SUB_ALIGN_EVIL)))
+               {
+                       if (!(m_ptr->mflag2 & MFLAG_CHAMELEON) || !(n_ptr->mflag2 & MFLAG_CHAMELEON)) return TRUE;
+               }
        }
 
        /* Hostile vs. non-hostile */
@@ -3561,183 +3675,3 @@ bool monster_living(monster_race *r_ptr)
        else
                return TRUE;
 }
-
-
-
-/* Dwarves */
-static char *dwarf_syllable1[] =
-{
-       "B", "D", "F", "G", "Gl", "H", "K", "L", "M", "N", "R", "S", "T", "Th", "V",
-};
-
-static char *dwarf_syllable2[] =
-{
-       "a", "e", "i", "o", "oi", "u",
-};
-
-static char *dwarf_syllable3[] =
-{
-       "bur", "fur", "gan", "gnus", "gnar", "li", "lin", "lir", "mli", "nar",
-       "nus", "rin", "ran", "sin", "sil", "sur",
-};
-
-/* Elves */
-static char *elf_syllable1[] =
-{
-       "Al", "An", "Bal", "Bel", "Cal", "Cel", "El", "Elr", "Elv", "Eow", "F",
-       "Fal", "Fel", "Fin", "G", "Gal", "Gel", "Gl", "Is", "Lan", "Leg", "N",
-       "Nal", "Nel",  "S", "Sal", "Sel", "T", "Tal", "Tel", "Thr", "Tin",
-};
-
-static char *elf_syllable2[] =
-{
-       "a", "adrie", "ara", "e", "ebri", "ele", "ere", "i", "io", "ithra",
-       "ilma", "il-Ga", "ili", "o", "orfi", "u", "y",
-};
-
-static char *elf_syllable3[] =
-{
-       "l", "las", "lad", "ldor", "ldur", "linde", "lith", "mir", "n", "nd",
-       "ndel", "ndil", "ndir", "nduil", "ng", "mbor", "r", "rith", "ril",
-       "riand", "rion", "s", "thien", "viel", "wen", "wyn",
-};
-
-/* Gnomes */
-static char *gnome_syllable1[] =
-{
-       "Aar", "An", "Ar", "As", "C", "H", "Han", "Har", "Hel", "Iir", "J",
-       "Jan", "Jar", "K", "L", "M", "Mar", "N", "Nik", "Os", "Ol", "P", "R",
-       "S", "Sam", "San", "T", "Ter", "Tom", "Ul", "V", "W", "Y",
-};
-
-static char *gnome_syllable2[] =
-{
-       "a", "aa",  "ai", "e", "ei", "i", "o", "uo", "u", "uu",
-};
-
-static char *gnome_syllable3[] =
-{
-       "ron", "re", "la", "ki", "kseli", "ksi", "ku", "ja", "ta", "na",
-       "namari", "neli", "nika", "nikki", "nu", "nukka", "ka", "ko", "li",
-       "kki", "rik", "po", "to", "pekka", "rjaana", "rjatta", "rjukka", "la",
-       "lla", "lli", "mo", "nni",
-};
-
-/* Hobbit */
-static char *hobbit_syllable1[] =
-{
-       "B", "Ber", "Br", "D", "Der", "Dr", "F", "Fr", "G", "H", "L", "Ler",
-       "M", "Mer", "N", "P", "Pr", "Per", "R", "S", "T", "W",
-};
-
-static char *hobbit_syllable2[] =
-{
-       "a", "e", "i", "ia", "o", "oi", "u",
-};
-
-static char *hobbit_syllable3[] =
-{
-       "bo", "ck", "decan", "degar", "do", "doc", "go", "grin", "lba", "lbo",
-       "lda", "ldo", "lla", "ll", "lo", "m", "mwise", "nac", "noc", "nwise",
-       "p", "ppin", "pper", "tho", "to",
-};
-
-/* Human */
-static char *human_syllable1[] =
-{
-       "Ab", "Ac", "Ad", "Af", "Agr", "Ast", "As", "Al", "Adw", "Adr", "Ar",
-       "B", "Br", "C", "Cr", "Ch", "Cad", "D", "Dr", "Dw", "Ed", "Eth", "Et",
-       "Er", "El", "Eow", "F", "Fr", "G", "Gr", "Gw", "Gal", "Gl", "H", "Ha",
-       "Ib", "Jer", "K", "Ka", "Ked", "L", "Loth", "Lar", "Leg", "M", "Mir",
-       "N", "Nyd", "Ol", "Oc", "On", "P", "Pr", "R", "Rh", "S", "Sev", "T",
-       "Tr", "Th", "V", "Y", "Z", "W", "Wic",
-};
-
-static char *human_syllable2[] =
-{
-       "a", "ae", "au", "ao", "are", "ale", "ali", "ay", "ardo", "e", "ei",
-       "ea", "eri", "era", "ela", "eli", "enda", "erra", "i", "ia", "ie",
-       "ire", "ira", "ila", "ili", "ira", "igo", "o", "oa", "oi", "oe",
-       "ore", "u", "y",
-};
-
-static char *human_syllable3[] =
-{
-       "a", "and", "b", "bwyn", "baen", "bard", "c", "ctred", "cred", "ch",
-       "can", "d", "dan", "don", "der", "dric", "dfrid", "dus", "f", "g",
-       "gord", "gan", "l", "li", "lgrin", "lin", "lith", "lath", "loth", "ld",
-       "ldric", "ldan", "m", "mas", "mos", "mar", "mond", "n", "nydd", "nidd",
-       "nnon", "nwan", "nyth", "nad", "nn", "nnor", "nd", "p", "r", "ron",
-       "rd", "s", "sh", "seth", "sean", "t", "th", "tha", "tlan", "trem",
-       "tram", "v", "vudd", "w", "wan", "win", "wyn", "wyr", "wyr", "wyth",
-};
-
-/* Orc */
-static char *orc_syllable1[] =
-{
-       "B", "Er", "G", "Gr", "H", "P", "Pr", "R", "V", "Vr", "T", "Tr", "M", "Dr",
-};
-
-static char *orc_syllable2[] =
-{
-       "a", "i", "o", "oo", "u", "ui",
-};
-
-static char *orc_syllable3[] =
-{
-       "dash", "dish", "dush", "gar", "gor", "gdush", "lo", "gdish", "k",
-       "lg", "nak", "rag", "rbag", "rg", "rk", "ng", "nk", "rt", "ol", "urk",
-       "shnak", "mog", "mak", "rak",
-};
-
-
-/*
- * Random Name Generator
- * based on a Javascript by Michael Hensley
- * "http://geocities.com/timessquare/castle/6274/"
- */
-void create_name(int type, char *name)
-{
-       /* Paranoia */
-       if (!name) return;
-
-       /* Select the monster type */
-       switch (type)
-       {
-               /* Create the monster name */
-               case NAME_DWARF:
-                       strcpy(name, dwarf_syllable1[rand_int(sizeof(dwarf_syllable1) / sizeof(char*))]);
-                       strcat(name, dwarf_syllable2[rand_int(sizeof(dwarf_syllable2) / sizeof(char*))]);
-                       strcat(name, dwarf_syllable3[rand_int(sizeof(dwarf_syllable3) / sizeof(char*))]);
-                       break;
-               case NAME_ELF:
-                       strcpy(name, elf_syllable1[rand_int(sizeof(elf_syllable1) / sizeof(char*))]);
-                       strcat(name, elf_syllable2[rand_int(sizeof(elf_syllable2) / sizeof(char*))]);
-                       strcat(name, elf_syllable3[rand_int(sizeof(elf_syllable3) / sizeof(char*))]);
-                       break;
-               case NAME_GNOME:
-                       strcpy(name, gnome_syllable1[rand_int(sizeof(gnome_syllable1) / sizeof(char*))]);
-                       strcat(name, gnome_syllable2[rand_int(sizeof(gnome_syllable2) / sizeof(char*))]);
-                       strcat(name, gnome_syllable3[rand_int(sizeof(gnome_syllable3) / sizeof(char*))]);
-                       break;
-               case NAME_HOBBIT:
-                       strcpy(name, hobbit_syllable1[rand_int(sizeof(hobbit_syllable1) / sizeof(char*))]);
-                       strcat(name, hobbit_syllable2[rand_int(sizeof(hobbit_syllable2) / sizeof(char*))]);
-                       strcat(name, hobbit_syllable3[rand_int(sizeof(hobbit_syllable3) / sizeof(char*))]);
-                       break;
-               case NAME_HUMAN:
-                       strcpy(name, human_syllable1[rand_int(sizeof(human_syllable1) / sizeof(char*))]);
-                       strcat(name, human_syllable2[rand_int(sizeof(human_syllable2) / sizeof(char*))]);
-                       strcat(name, human_syllable3[rand_int(sizeof(human_syllable3) / sizeof(char*))]);
-                       break;
-               case NAME_ORC:
-                       strcpy(name, orc_syllable1[rand_int(sizeof(orc_syllable1) / sizeof(char*))]);
-                       strcat(name, orc_syllable2[rand_int(sizeof(orc_syllable2) / sizeof(char*))]);
-                       strcat(name, orc_syllable3[rand_int(sizeof(orc_syllable3) / sizeof(char*))]);
-                       break;
-               /* Create an empty name */
-               default:
-                       name[0] = '\0';
-                       break;
-       }
-}