OSDN Git Service

広域マップで画面をスクロールすると右端の境界の外までスクロールできてしまうバグ修正。
[hengbandforosx/hengbandosx.git] / src / object1.c
index 53596b4..407f7d3 100644 (file)
@@ -99,23 +99,22 @@ void reset_visuals(void)
 /*
  * Obtain the "flags" for an item
  */
-void object_flags(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3)
+void object_flags(object_type *o_ptr, u32b flgs[TR_FLAG_SIZE])
 {
        object_kind *k_ptr = &k_info[o_ptr->k_idx];
+       int i;
 
        /* Base object */
-       (*f1) = k_ptr->flags1;
-       (*f2) = k_ptr->flags2;
-       (*f3) = k_ptr->flags3;
+       for (i = 0; i < TR_FLAG_SIZE; i++)
+               flgs[i] = k_ptr->flags[i];
 
        /* Artifact */
        if (o_ptr->name1)
        {
                artifact_type *a_ptr = &a_info[o_ptr->name1];
 
-               (*f1) = a_ptr->flags1;
-               (*f2) = a_ptr->flags2;
-               (*f3) = a_ptr->flags3;
+               for (i = 0; i < TR_FLAG_SIZE; i++)
+                       flgs[i] = a_ptr->flags[i];
        }
 
        /* Ego-item */
@@ -123,81 +122,81 @@ void object_flags(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3)
        {
                ego_item_type *e_ptr = &e_info[o_ptr->name2];
 
-               (*f1) |= e_ptr->flags1;
-               (*f2) |= e_ptr->flags2;
-               (*f3) |= e_ptr->flags3;
+               for (i = 0; i < TR_FLAG_SIZE; i++)
+                       flgs[i] |= e_ptr->flags[i];
 
                if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
                {
-                       (*f3) &= ~(TR3_SH_FIRE);
+                       remove_flag(flgs, TR_SH_FIRE);
                }
                else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
                {
-                       (*f1) &= ~(TR1_INFRA);
+                       remove_flag(flgs, TR_INFRA);
                }
                else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
                {
-                       (*f2) &= ~(TR2_RES_BLIND);
-                       (*f3) &= ~(TR3_SEE_INVIS);
+                       remove_flag(flgs, TR_RES_BLIND);
+                       remove_flag(flgs, TR_SEE_INVIS);
                }
        }
 
        /* Random artifact ! */
-       if (o_ptr->art_flags1 || o_ptr->art_flags2 || o_ptr->art_flags3)
-       {
-               (*f1) |= o_ptr->art_flags1;
-               (*f2) |= o_ptr->art_flags2;
-               (*f3) |= o_ptr->art_flags3;
-       }
+       for (i = 0; i < TR_FLAG_SIZE; i++)
+               flgs[i] |= o_ptr->art_flags[i];
 
        if ((o_ptr->tval > TV_CAPTURE) && o_ptr->xtra3)
        {
-               if (o_ptr->xtra3 < 33)
-               {
-                       (*f1) |= (0x00000001 << (o_ptr->xtra3-1));
-               }
-               else if (o_ptr->xtra3 < 65)
+               int add = o_ptr->xtra3 - 1;
+
+               if (add < TR_FLAG_MAX)
                {
-                       (*f2) |= (0x00000001 << (o_ptr->xtra3-33));
+                       add_flag(flgs, add);
                }
-               else if (o_ptr->xtra3 < 97)
+               else if (add == ESSENCE_TMP_RES_ACID)
                {
-                       (*f3) |= (0x00000001 << (o_ptr->xtra3-65));
+                       add_flag(flgs, TR_RES_ACID);
+                       add_flag(flgs, TR_ACTIVATE);
                }
-               else if (o_ptr->xtra3 == ESSENCE_TMP_RES_ACID)
+               else if (add == ESSENCE_TMP_RES_ELEC)
                {
-                       (*f2) |= TR2_RES_ACID;
+                       add_flag(flgs, TR_RES_ELEC);
+                       add_flag(flgs, TR_ACTIVATE);
                }
-               else if (o_ptr->xtra3 == ESSENCE_TMP_RES_ELEC)
+               else if (add == ESSENCE_TMP_RES_FIRE)
                {
-                       (*f2) |= TR2_RES_ELEC;
+                       add_flag(flgs, TR_RES_FIRE);
+                       add_flag(flgs, TR_ACTIVATE);
                }
-               else if (o_ptr->xtra3 == ESSENCE_TMP_RES_FIRE)
+               else if (add == ESSENCE_TMP_RES_COLD)
                {
-                       (*f2) |= TR2_RES_FIRE;
+                       add_flag(flgs, TR_RES_COLD);
+                       add_flag(flgs, TR_ACTIVATE);
                }
-               else if (o_ptr->xtra3 == ESSENCE_TMP_RES_COLD)
+               else if (add == ESSENCE_SH_FIRE)
                {
-                       (*f2) |= TR2_RES_COLD;
+                       add_flag(flgs, TR_RES_FIRE);
+                       add_flag(flgs, TR_SH_FIRE);
                }
-               else if (o_ptr->xtra3 == ESSENCE_SH_FIRE)
+               else if (add == ESSENCE_SH_ELEC)
                {
-                       (*f2) |= TR2_RES_FIRE;
-                       (*f3) |= TR3_SH_FIRE;
+                       add_flag(flgs, TR_RES_ELEC);
+                       add_flag(flgs, TR_SH_ELEC);
                }
-               else if (o_ptr->xtra3 == ESSENCE_SH_ELEC)
+               else if (add == ESSENCE_SH_COLD)
                {
-                       (*f2) |= TR2_RES_ELEC;
-                       (*f3) |= TR3_SH_ELEC;
+                       add_flag(flgs, TR_RES_COLD);
+                       add_flag(flgs, TR_SH_COLD);
                }
-               else if (o_ptr->xtra3 == ESSENCE_SH_COLD)
+               else if (add == ESSENCE_RESISTANCE)
                {
-                       (*f2) |= TR2_RES_COLD;
-                       (*f3) |= TR3_SH_COLD;
+                       add_flag(flgs, TR_RES_ACID);
+                       add_flag(flgs, TR_RES_ELEC);
+                       add_flag(flgs, TR_RES_FIRE);
+                       add_flag(flgs, TR_RES_COLD);
                }
-               else if (o_ptr->xtra3 == ESSENCE_RESISTANCE)
+               else if (add == TR_IMPACT)
                {
-                       (*f2) |= (TR2_RES_ACID | TR2_RES_ELEC | TR2_RES_FIRE | TR2_RES_COLD);;
+                       add_flag(flgs, TR_ACTIVATE);
                }
        }
 }
@@ -207,21 +206,22 @@ void object_flags(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3)
 /*
  * Obtain the "flags" for an item which are known to the player
  */
-void object_flags_known(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3)
+void object_flags_known(object_type *o_ptr, u32b flgs[TR_FLAG_SIZE])
 {
        bool spoil = FALSE;
+       int i;
 
        object_kind *k_ptr = &k_info[o_ptr->k_idx];
 
        /* Clear */
-       (*f1) = (*f2) = (*f3) = 0L;
+       for (i = 0; i < TR_FLAG_SIZE; i++)
+               flgs[i] = 0;
 
        if (!object_aware_p(o_ptr)) return;
 
        /* Base object */
-       (*f1) = k_ptr->flags1;
-       (*f2) = k_ptr->flags2;
-       (*f3) = k_ptr->flags3;
+       for (i = 0; i < TR_FLAG_SIZE; i++)
+               flgs[i] = k_ptr->flags[i];
 
        /* Must be identified */
        if (!object_known_p(o_ptr)) return;
@@ -231,22 +231,21 @@ void object_flags_known(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3)
        {
                ego_item_type *e_ptr = &e_info[o_ptr->name2];
 
-               (*f1) |= e_ptr->flags1;
-               (*f2) |= e_ptr->flags2;
-               (*f3) |= e_ptr->flags3;
+               for (i = 0; i < TR_FLAG_SIZE; i++)
+                       flgs[i] |= e_ptr->flags[i];
 
                if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
                {
-                       (*f3) &= ~(TR3_SH_FIRE);
+                       remove_flag(flgs, TR_SH_FIRE);
                }
                else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
                {
-                       (*f1) &= ~(TR1_INFRA);
+                       remove_flag(flgs, TR_INFRA);
                }
                else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
                {
-                       (*f2) &= ~(TR2_RES_BLIND);
-                       (*f3) &= ~(TR3_SEE_INVIS);
+                       remove_flag(flgs, TR_RES_BLIND);
+                       remove_flag(flgs, TR_SEE_INVIS);
                }
        }
 
@@ -269,68 +268,60 @@ void object_flags_known(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3)
                {
                        artifact_type *a_ptr = &a_info[o_ptr->name1];
 
-                       (*f1) = a_ptr->flags1;
-                       (*f2) = a_ptr->flags2;
-                       (*f3) = a_ptr->flags3;
+                       for (i = 0; i < TR_FLAG_SIZE; i++)
+                               flgs[i] = a_ptr->flags[i];
                }
 
                /* Random artifact ! */
-               if (o_ptr->art_flags1 || o_ptr->art_flags2 || o_ptr->art_flags3)
-               {
-                       (*f1) |= o_ptr->art_flags1;
-                       (*f2) |= o_ptr->art_flags2;
-                       (*f3) |= o_ptr->art_flags3;
-               }
+               for (i = 0; i < TR_FLAG_SIZE; i++)
+                       flgs[i] |= o_ptr->art_flags[i];
        }
 
        if ((o_ptr->tval > TV_CAPTURE) && o_ptr->xtra3)
        {
-               if (o_ptr->xtra3 < 33)
-               {
-                       (*f1) |= (0x00000001 << (o_ptr->xtra3-1));
-               }
-               else if (o_ptr->xtra3 < 65)
-               {
-                       (*f2) |= (0x00000001 << (o_ptr->xtra3-33));
-               }
-               else if (o_ptr->xtra3 < 97)
+               int add = o_ptr->xtra3 - 1;
+
+               if (add < TR_FLAG_MAX)
                {
-                       (*f3) |= (0x00000001 << (o_ptr->xtra3-65));
+                       add_flag(flgs, add);
                }
-               else if (o_ptr->xtra3 == ESSENCE_TMP_RES_ACID)
+               else if (add == ESSENCE_TMP_RES_ACID)
                {
-                       (*f2) |= TR2_RES_ACID;
+                       add_flag(flgs, TR_RES_ACID);
                }
-               else if (o_ptr->xtra3 == ESSENCE_TMP_RES_ELEC)
+               else if (add == ESSENCE_TMP_RES_ELEC)
                {
-                       (*f2) |= TR2_RES_ELEC;
+                       add_flag(flgs, TR_RES_ELEC);
                }
-               else if (o_ptr->xtra3 == ESSENCE_TMP_RES_FIRE)
+               else if (add == ESSENCE_TMP_RES_FIRE)
                {
-                       (*f2) |= TR2_RES_FIRE;
+                       add_flag(flgs, TR_RES_FIRE);
                }
-               else if (o_ptr->xtra3 == ESSENCE_TMP_RES_COLD)
+               else if (add == ESSENCE_TMP_RES_COLD)
                {
-                       (*f2) |= TR2_RES_COLD;
+                       add_flag(flgs, TR_RES_COLD);
                }
-               else if (o_ptr->xtra3 == ESSENCE_SH_FIRE)
+               else if (add == ESSENCE_SH_FIRE)
                {
-                       (*f2) |= TR2_RES_FIRE;
-                       (*f3) |= TR3_SH_FIRE;
+                       add_flag(flgs, TR_RES_FIRE);
+                       add_flag(flgs, TR_SH_FIRE);
                }
-               else if (o_ptr->xtra3 == ESSENCE_SH_ELEC)
+               else if (add == ESSENCE_SH_ELEC)
                {
-                       (*f2) |= TR2_RES_ELEC;
-                       (*f3) |= TR3_SH_ELEC;
+                       add_flag(flgs, TR_RES_ELEC);
+                       add_flag(flgs, TR_SH_ELEC);
                }
-               else if (o_ptr->xtra3 == ESSENCE_SH_COLD)
+               else if (add == ESSENCE_SH_COLD)
                {
-                       (*f2) |= TR2_RES_COLD;
-                       (*f3) |= TR3_SH_COLD;
+                       add_flag(flgs, TR_RES_COLD);
+                       add_flag(flgs, TR_SH_COLD);
                }
-               else if (o_ptr->xtra3 == ESSENCE_RESISTANCE)
+               else if (add == ESSENCE_RESISTANCE)
                {
-                       (*f2) |= (TR2_RES_ACID | TR2_RES_ELEC | TR2_RES_FIRE | TR2_RES_COLD);;
+                       add_flag(flgs, TR_RES_ACID);
+                       add_flag(flgs, TR_RES_ELEC);
+                       add_flag(flgs, TR_RES_FIRE);
+                       add_flag(flgs, TR_RES_COLD);
                }
        }
 }
@@ -376,16 +367,16 @@ void object_desc_store(char *buf, object_type *o_ptr, int pref, int mode)
  */
 cptr item_activation(object_type *o_ptr)
 {
-       u32b f1, f2, f3;
+       u32b flgs[TR_FLAG_SIZE];
 
        /* Extract the flags */
-       object_flags(o_ptr, &f1, &f2, &f3);
+       object_flags(o_ptr, flgs);
 
        /* Require activation ability */
 #ifdef JP
-if (!(f3 & (TR3_ACTIVATE))) return ("¤Ê¤·");
+if (!(have_flag(flgs, TR_ACTIVATE))) return ("¤Ê¤·");
 #else
-       if (!(f3 & (TR3_ACTIVATE))) return ("nothing");
+       if (!(have_flag(flgs, TR_ACTIVATE))) return ("nothing");
 #endif
 
 
@@ -1886,49 +1877,50 @@ return "
 
        }
 
-       if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_ACID))
+       if ((o_ptr->tval > TV_CAPTURE) && o_ptr->xtra3)
        {
+               switch (o_ptr->xtra3 - 1)
+               {
+               case ESSENCE_TMP_RES_ACID:
 #ifdef JP
-return "»À¤Ø¤ÎÂÑÀ­ : 50+d50¥¿¡¼¥óËè";
+                       return "»À¤Ø¤ÎÂÑÀ­ : 50+d50¥¿¡¼¥óËè";
 #else
-                               return "resist acid every 50+d50 turns";
+                       return "resist acid every 50+d50 turns";
 #endif
-       }
+                       break;
 
-       if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_ELEC))
-       {
+               case ESSENCE_TMP_RES_ELEC:
 #ifdef JP
-return "ÅÅ·â¤Ø¤ÎÂÑÀ­ : 50+d50¥¿¡¼¥óËè";
+                       return "ÅÅ·â¤Ø¤ÎÂÑÀ­ : 50+d50¥¿¡¼¥óËè";
 #else
-                               return "resist elec every 50+d50 turns";
+                       return "resist elec every 50+d50 turns";
 #endif
-       }
+                       break;
 
-       if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_FIRE))
-       {
+               case ESSENCE_TMP_RES_FIRE:
 #ifdef JP
-return "²Ð¤Ø¤ÎÂÑÀ­ : 50+d50¥¿¡¼¥óËè";
+                       return "²Ð¤Ø¤ÎÂÑÀ­ : 50+d50¥¿¡¼¥óËè";
 #else
-                               return "resist fire every 50+d50 turns";
+                       return "resist fire every 50+d50 turns";
 #endif
-       }
+                       break;
 
-       if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_COLD))
-       {
+               case ESSENCE_TMP_RES_COLD:
 #ifdef JP
-return "Î䵤¤Ø¤ÎÂÑÀ­ : 50+d50¥¿¡¼¥óËè";
+                       return "Î䵤¤Ø¤ÎÂÑÀ­ : 50+d50¥¿¡¼¥óËè";
 #else
-                               return "resist cold every 50+d50 turns";
+                       return "resist cold every 50+d50 turns";
 #endif
-       }
+                       break;
 
-       if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_EARTHQUAKE))
-       {
+               case TR_IMPACT:
 #ifdef JP
-return "ÃÏ¿Ì : 100+d100 ¥¿¡¼¥óËè";
+                       return "ÃÏ¿Ì : 100+d100 ¥¿¡¼¥óËè";
 #else
-               return "earthquake every 100+d100 turns";
+                       return "earthquake every 100+d100 turns";
 #endif
+                       break;
+               }
        }
 
        if (o_ptr->name2 == EGO_TRUMP)
@@ -2386,29 +2378,28 @@ bool identify_fully_aux(object_type *o_ptr)
 {
        int                     i = 0, j, k;
 
-       u32b f1, f2, f3;
+       u32b flgs[TR_FLAG_SIZE];
 
        cptr            info[128];
-       u32b flag;
        char o_name[MAX_NLEN];
        int wid, hgt;
 
        /* Extract the flags */
-       object_flags(o_ptr, &f1, &f2, &f3);
+       object_flags(o_ptr, flgs);
 
        /* Extract the description */
        {
                char temp[70 * 20];
 
                roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
-                           (k_text + k_info[lookup_kind(o_ptr->tval, o_ptr->sval)].text),
-                           77 - 15, temp);
+                           (k_text + k_info[lookup_kind(o_ptr->tval, o_ptr->sval)].text),
+                           77 - 15, temp);
                for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
                { info[i] = &temp[j]; i++;}
        }
 
        /* Mega-Hack -- describe activation */
-       if (f3 & (TR3_ACTIVATE))
+       if (have_flag(flgs, TR_ACTIVATE))
        {
 #ifdef JP
 info[i++] = "»ÏÆ°¤·¤¿¤È¤­¤Î¸ú²Ì...";
@@ -2452,7 +2443,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÁê¼ê¤ò°ì·â¤ÇÅݤ¹¤³¤È¤¬¤¢¤ë¡£";
 #else
-               info[i++] = "It will attempts to kill a monster instantly.";
+               info[i++] = "It will attempt to kill a monster instantly.";
 #endif
 
        }
@@ -2462,13 +2453,13 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¼«Ê¬¼«¿È¤Ë¹¶·â¤¬Ê֤äƤ¯¤ë¤³¤È¤¬¤¢¤ë¡£";
 #else
-               info[i++] = "It strikes yourself sometimes.";
+               info[i++] = "It causes you to strike yourself sometimes.";
 #endif
 
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï̵Ũ¤Î¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¯¡£";
 #else
-               info[i++] = "It will always penetrates invulnerability barrier.";
+               info[i++] = "It always penetrates invulnerability barriers.";
 #endif
        }
 
@@ -2482,12 +2473,12 @@ info[i++] = "
 
        }
 
-       if (o_ptr->name2 == EGO_RING_WIZARD)
+       if (have_flag(flgs, TR_EASY_SPELL))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏËâË¡¤ÎÆñ°×ÅÙ¤ò²¼¤²¤ë¡£";
 #else
-               info[i++] = "It affects your ability to use magic devices.";
+               info[i++] = "It affects your ability to cast spells.";
 #endif
        }
 
@@ -2496,7 +2487,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏËâË¡¤ÎÆñ°×ÅÙ¤ò¾å¤²¤ë¡£";
 #else
-               info[i++] = "It prevents you from using magic items.";
+               info[i++] = "It interferes with casting spells.";
 #endif
        }
 
@@ -2548,10 +2539,28 @@ info[i++] = "
                if (o_ptr->name2 == EGO_LITE_DARKNESS)
                {
 #ifdef JP
-info[i++] = "¤½¤ì¤ÏÁ´¤¯¸÷¤é¤Ê¤¤¡£";
+                       info[i++] = "¤½¤ì¤ÏÁ´¤¯¸÷¤é¤Ê¤¤¡£";
+#else
+                       info[i++] = "It provides no light.";
+#endif
+
+                       if (o_ptr->sval == SV_LITE_FEANOR ||
+                           o_ptr->sval == SV_LITE_LANTERN)
+                       {
+#ifdef JP
+                               info[i++] = "¤½¤ì¤ÏÌÀ¤ê¤ÎȾ·Â¤ò¶¹¤á¤ë(Ⱦ·Â¤Ë-2)¡£";
+#else
+                               info[i++] = "It decreases radius of light source by 2.";
+#endif
+                       }
+                       else
+                       {
+#ifdef JP
+                               info[i++] = "¤½¤ì¤ÏÌÀ¤ê¤ÎȾ·Â¤ò¶¹¤á¤ë(Ⱦ·Â¤Ë-1)¡£";
 #else
-                       info[i++] = "It provides no light..";
+                               info[i++] = "It decreases radius of light source by 1.";
 #endif
+                       }
                }
                else if (artifact_p(o_ptr))
                {
@@ -2635,7 +2644,7 @@ info[i++] = "
 
        /* And then describe it fully */
 
-       if (f2 & (TR2_RIDING))
+       if (have_flag(flgs, TR_RIDING))
        {
                if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
 #ifdef JP
@@ -2651,7 +2660,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_STR))
+       if (have_flag(flgs, TR_STR))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÏÓÎϤ˱ƶÁ¤òµÚ¤Ü¤¹";
@@ -2660,7 +2669,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_INT))
+       if (have_flag(flgs, TR_INT))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÃÎǽ¤Ë±Æ¶Á¤òµÚ¤Ü¤¹";
@@ -2669,7 +2678,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_WIS))
+       if (have_flag(flgs, TR_WIS))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¸­¤µ¤Ë±Æ¶Á¤òµÚ¤Ü¤¹";
@@ -2678,7 +2687,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_DEX))
+       if (have_flag(flgs, TR_DEX))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï´ïÍѤµ¤Ë±Æ¶Á¤òµÚ¤Ü¤¹";
@@ -2687,7 +2696,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_CON))
+       if (have_flag(flgs, TR_CON))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÂѵ×ÎϤ˱ƶÁ¤òµÚ¤Ü¤¹";
@@ -2696,7 +2705,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_CHR))
+       if (have_flag(flgs, TR_CHR))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÌ¥ÎϤ˱ƶÁ¤òµÚ¤Ü¤¹";
@@ -2706,7 +2715,7 @@ info[i++] = "
 
        }
 
-       if (f1 & (TR1_MAGIC_MASTERY))
+       if (have_flag(flgs, TR_MAGIC_MASTERY))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏËâË¡Æ»¶ñ»ÈÍÑǽÎϤ˱ƶÁ¤òµÚ¤Ü¤¹";
@@ -2715,7 +2724,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_STEALTH))
+       if (have_flag(flgs, TR_STEALTH))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï±£Ì©¹ÔưǽÎϤ˱ƶÁ¤òµÚ¤Ü¤¹";
@@ -2724,7 +2733,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_SEARCH))
+       if (have_flag(flgs, TR_SEARCH))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ïõº÷ǽÎϤ˱ƶÁ¤òµÚ¤Ü¤¹";
@@ -2733,7 +2742,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_INFRA))
+       if (have_flag(flgs, TR_INFRA))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÀÖ³°Àþ»ëÎϤ˱ƶÁ¤òµÚ¤Ü¤¹";
@@ -2742,7 +2751,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_TUNNEL))
+       if (have_flag(flgs, TR_TUNNEL))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏºÎ·¡Ç½ÎϤ˱ƶÁ¤òµÚ¤Ü¤¹";
@@ -2751,7 +2760,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_SPEED))
+       if (have_flag(flgs, TR_SPEED))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥¹¥Ô¡¼¥É¤Ë±Æ¶Á¤òµÚ¤Ü¤¹";
@@ -2760,7 +2769,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_BLOWS))
+       if (have_flag(flgs, TR_BLOWS))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÂÇ·â²ó¿ô¤Ë±Æ¶Á¤òµÚ¤Ü¤¹";
@@ -2770,7 +2779,7 @@ info[i++] = "
 
        }
 
-       if (f1 & (TR1_BRAND_ACID))
+       if (have_flag(flgs, TR_BRAND_ACID))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï»À¤Ë¤è¤Ã¤ÆÂ礭¤Ê¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë";
@@ -2779,7 +2788,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_BRAND_ELEC))
+       if (have_flag(flgs, TR_BRAND_ELEC))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÅÅ·â¤Ë¤è¤Ã¤ÆÂ礭¤Ê¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë";
@@ -2788,7 +2797,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_BRAND_FIRE))
+       if (have_flag(flgs, TR_BRAND_FIRE))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï²Ð±ê¤Ë¤è¤Ã¤ÆÂ礭¤Ê¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë";
@@ -2797,7 +2806,7 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_BRAND_COLD))
+       if (have_flag(flgs, TR_BRAND_COLD))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÎ䵤¤Ë¤è¤Ã¤ÆÂ礭¤Ê¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë";
@@ -2807,7 +2816,7 @@ info[i++] = "
 
        }
 
-       if (f1 & (TR1_BRAND_POIS))
+       if (have_flag(flgs, TR_BRAND_POIS))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏŨ¤òÆǤ¹¤ë¡£";
@@ -2817,7 +2826,7 @@ info[i++] = "
 
        }
 
-       if (f1 & (TR1_CHAOTIC))
+       if (have_flag(flgs, TR_CHAOTIC))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥«¥ª¥¹Åª¤Ê¸ú²Ì¤òµÚ¤Ü¤¹¡£";
@@ -2827,7 +2836,7 @@ info[i++] = "
 
        }
 
-       if (f1 & (TR1_VAMPIRIC))
+       if (have_flag(flgs, TR_VAMPIRIC))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏŨ¤«¤é¥Ò¥Ã¥È¥Ý¥¤¥ó¥È¤òµÛ¼ý¤¹¤ë¡£";
@@ -2837,7 +2846,7 @@ info[i++] = "
 
        }
 
-       if (f1 & (TR1_IMPACT))
+       if (have_flag(flgs, TR_IMPACT))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÃϿ̤òµ¯¤³¤¹¤³¤È¤¬¤Ç¤­¤ë¡£";
@@ -2847,7 +2856,7 @@ info[i++] = "
 
        }
 
-       if (f1 & (TR1_VORPAL))
+       if (have_flag(flgs, TR_VORPAL))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÈó¾ï¤ËÀÚ¤ìÌ£¤¬±Ô¤¯Å¨¤òÀÚÃǤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£";
@@ -2857,7 +2866,7 @@ info[i++] = "
 
        }
 
-       if (f1 & (TR1_KILL_DRAGON))
+       if (have_flag(flgs, TR_KILL_DRAGON))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥É¥é¥´¥ó¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
@@ -2866,7 +2875,7 @@ info[i++] = "
 #endif
 
        }
-       else if (f1 & (TR1_SLAY_DRAGON))
+       else if (have_flag(flgs, TR_SLAY_DRAGON))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥É¥é¥´¥ó¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
@@ -2875,7 +2884,17 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_SLAY_ORC))
+
+       if (have_flag(flgs, TR_KILL_ORC))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¥ª¡¼¥¯¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
+#else
+               info[i++] = "It is a great bane of orcs.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_SLAY_ORC))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥ª¡¼¥¯¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
@@ -2884,7 +2903,17 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_SLAY_TROLL))
+
+       if (have_flag(flgs, TR_KILL_TROLL))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¥È¥í¥ë¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
+#else
+               info[i++] = "It is a great bane of trolls.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_SLAY_TROLL))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥È¥í¥ë¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
@@ -2893,15 +2922,17 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_SLAY_GIANT))
+
+       if (have_flag(flgs, TR_KILL_GIANT))
        {
-               if (o_ptr->name1 == ART_HRUNTING)
 #ifdef JP
 info[i++] = "¤½¤ì¤Ïµð¿Í¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
 #else
                info[i++] = "It is a great bane of giants.";
 #endif
-               else
+       }
+       else if (have_flag(flgs, TR_SLAY_GIANT))
+       {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥¸¥ã¥¤¥¢¥ó¥È¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
 #else
@@ -2909,7 +2940,17 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_SLAY_DEMON))
+
+       if (have_flag(flgs, TR_KILL_DEMON))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¥Ç¡¼¥â¥ó¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
+#else
+               info[i++] = "It is a great bane of demons.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_SLAY_DEMON))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥Ç¡¼¥â¥ó¤ËÂФ·¤ÆÀ»¤Ê¤ëÎϤòȯ´ø¤¹¤ë¡£";
@@ -2918,7 +2959,17 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_SLAY_UNDEAD))
+
+       if (have_flag(flgs, TR_KILL_UNDEAD))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¥¢¥ó¥Ç¥Ã¥É¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
+#else
+               info[i++] = "It is a great bane of undead.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_SLAY_UNDEAD))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥¢¥ó¥Ç¥Ã¥É¤ËÂФ·¤ÆÀ»¤Ê¤ëÎϤòȯ´ø¤¹¤ë¡£";
@@ -2927,7 +2978,17 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_SLAY_EVIL))
+
+       if (have_flag(flgs, TR_KILL_EVIL))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¼Ù°­¤Ê¤ë¸ºß¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
+#else
+               info[i++] = "It is a great bane of evil monsters.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_SLAY_EVIL))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¼Ù°­¤Ê¤ë¸ºß¤ËÂФ·¤ÆÀ»¤Ê¤ëÎϤǹ¶·â¤¹¤ë¡£";
@@ -2936,7 +2997,17 @@ info[i++] = "
 #endif
 
        }
-       if (f1 & (TR1_SLAY_ANIMAL))
+
+       if (have_flag(flgs, TR_KILL_ANIMAL))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¼«Á³³¦¤Îưʪ¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
+#else
+               info[i++] = "It is a great bane of natural creatures.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_SLAY_ANIMAL))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¼«Á³³¦¤Îưʪ¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
@@ -2945,7 +3016,17 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_SLAY_HUMAN))
+
+       if (have_flag(flgs, TR_KILL_HUMAN))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¿Í´Ö¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
+#else
+               info[i++] = "It is a great bane of humans.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_SLAY_HUMAN))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¿Í´Ö¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
@@ -2955,7 +3036,7 @@ info[i++] = "
 
        }
 
-       if (f1 & (TR1_FORCE_WEAPON))
+       if (have_flag(flgs, TR_FORCE_WEAPON))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï»ÈÍѼԤÎËâÎϤò»È¤Ã¤Æ¹¶·â¤¹¤ë¡£";
@@ -2964,7 +3045,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_DEC_MANA))
+       if (have_flag(flgs, TR_DEC_MANA))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏËâÎϤξÃÈñ¤ò²¡¤µ¤¨¤ë¡£";
@@ -2973,7 +3054,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_SUST_STR))
+       if (have_flag(flgs, TR_SUST_STR))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤ÎÏÓÎϤò°Ý»ý¤¹¤ë¡£";
@@ -2982,7 +3063,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_SUST_INT))
+       if (have_flag(flgs, TR_SUST_INT))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤ÎÃÎǽ¤ò°Ý»ý¤¹¤ë¡£";
@@ -2991,7 +3072,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_SUST_WIS))
+       if (have_flag(flgs, TR_SUST_WIS))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤Î¸­¤µ¤ò°Ý»ý¤¹¤ë¡£";
@@ -3000,7 +3081,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_SUST_DEX))
+       if (have_flag(flgs, TR_SUST_DEX))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤Î´ïÍѤµ¤ò°Ý»ý¤¹¤ë¡£";
@@ -3009,7 +3090,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_SUST_CON))
+       if (have_flag(flgs, TR_SUST_CON))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤ÎÂѵ×ÎϤò°Ý»ý¤¹¤ë¡£";
@@ -3018,7 +3099,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_SUST_CHR))
+       if (have_flag(flgs, TR_SUST_CHR))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤ÎÌ¥ÎϤò°Ý»ý¤¹¤ë¡£";
@@ -3028,7 +3109,7 @@ info[i++] = "
 
        }
 
-       if (f2 & (TR2_IM_ACID))
+       if (have_flag(flgs, TR_IM_ACID))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï»À¤ËÂФ¹¤ë´°Á´¤ÊÌȱ֤ò¼ø¤±¤ë¡£";
@@ -3037,7 +3118,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_IM_ELEC))
+       if (have_flag(flgs, TR_IM_ELEC))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÅÅ·â¤ËÂФ¹¤ë´°Á´¤ÊÌȱ֤ò¼ø¤±¤ë¡£";
@@ -3046,7 +3127,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_IM_FIRE))
+       if (have_flag(flgs, TR_IM_FIRE))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï²Ð¤ËÂФ¹¤ë´°Á´¤ÊÌȱ֤ò¼ø¤±¤ë¡£";
@@ -3055,7 +3136,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_IM_COLD))
+       if (have_flag(flgs, TR_IM_COLD))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï´¨¤µ¤ËÂФ¹¤ë´°Á´¤ÊÌȱ֤ò¼ø¤±¤ë¡£";
@@ -3065,7 +3146,7 @@ info[i++] = "
 
        }
 
-       if (f2 & (TR2_THROW))
+       if (have_flag(flgs, TR_THROW))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏŨ¤ËÅꤲ¤ÆÂ礭¤Ê¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë¤³¤È¤¬¤Ç¤­¤ë¡£";
@@ -3074,7 +3155,7 @@ info[i++] = "
 #endif
        }
 
-       if (f2 & (TR2_FREE_ACT))
+       if (have_flag(flgs, TR_FREE_ACT))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏËãáã¤ËÂФ¹¤ë´°Á´¤ÊÌȱ֤ò¼ø¤±¤ë¡£";
@@ -3083,7 +3164,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_HOLD_LIFE))
+       if (have_flag(flgs, TR_HOLD_LIFE))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÀ¸Ì¿Îϵۼý¤ËÂФ¹¤ëÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3092,7 +3173,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_FEAR))
+       if (have_flag(flgs, TR_RES_FEAR))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¶²Éݤؤδ°Á´¤ÊÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3101,7 +3182,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_ACID))
+       if (have_flag(flgs, TR_RES_ACID))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï»À¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3110,7 +3191,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_ELEC))
+       if (have_flag(flgs, TR_RES_ELEC))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÅÅ·â¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3119,7 +3200,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_FIRE))
+       if (have_flag(flgs, TR_RES_FIRE))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï²Ð¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3128,7 +3209,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_COLD))
+       if (have_flag(flgs, TR_RES_COLD))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï´¨¤µ¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3137,7 +3218,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_POIS))
+       if (have_flag(flgs, TR_RES_POIS))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÆǤؤÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3147,7 +3228,7 @@ info[i++] = "
 
        }
 
-       if (f2 & (TR2_RES_LITE))
+       if (have_flag(flgs, TR_RES_LITE))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÁ®¸÷¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3156,7 +3237,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_DARK))
+       if (have_flag(flgs, TR_RES_DARK))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï°Å¹õ¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3166,7 +3247,7 @@ info[i++] = "
 
        }
 
-       if (f2 & (TR2_RES_BLIND))
+       if (have_flag(flgs, TR_RES_BLIND))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÌÕÌܤؤÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3175,7 +3256,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_CONF))
+       if (have_flag(flgs, TR_RES_CONF))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ïº®Íð¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3184,7 +3265,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_SOUND))
+       if (have_flag(flgs, TR_RES_SOUND))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¹ì²»¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3193,7 +3274,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_SHARDS))
+       if (have_flag(flgs, TR_RES_SHARDS))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÇËÊҤؤÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3203,7 +3284,7 @@ info[i++] = "
 
        }
 
-       if (f2 & (TR2_RES_NETHER))
+       if (have_flag(flgs, TR_RES_NETHER))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÃϹö¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3212,7 +3293,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_NEXUS))
+       if (have_flag(flgs, TR_RES_NEXUS))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï°ø²Ìº®Íð¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3221,7 +3302,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_CHAOS))
+       if (have_flag(flgs, TR_RES_CHAOS))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥«¥ª¥¹¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3230,7 +3311,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_RES_DISEN))
+       if (have_flag(flgs, TR_RES_DISEN))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÎô²½¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
@@ -3240,7 +3321,7 @@ info[i++] = "
 
        }
 
-       if (f3 & (TR3_FEATHER))
+       if (have_flag(flgs, TR_FEATHER))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÃè¤ËÉ⤯¤³¤È¤ò²Äǽ¤Ë¤¹¤ë¡£";
@@ -3249,23 +3330,23 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_LITE))
+       if (have_flag(flgs, TR_LITE))
        {
                if ((o_ptr->name2 == EGO_DARK) || (o_ptr->name1 == ART_NIGHT))
 #ifdef JP
-info[i++] = "¤½¤ì¤ÏÌÀ¤«¤ê¤ÎȾ·Â¤ò¶¹¤á¤ë¡£";
+info[i++] = "¤½¤ì¤ÏÌÀ¤«¤ê¤ÎȾ·Â¤ò¶¹¤á¤ë(Ⱦ·Â¤Ë-1)¡£";
 #else
-                       info[i++] = "It decreases radius of your light source.";
+                       info[i++] = "It decreases radius of your light source by 1.";
 #endif
                else
 #ifdef JP
-info[i++] = "¤½¤ì¤Ï±Ê±ó¤ÎÌÀ¤«¤ê¤ò¼ø¤±¤ë¡£";
+info[i++] = "¤½¤ì¤Ï±Ê±ó¤ÎÌÀ¤«¤ê¤ò¼ø¤±¤ë(Ⱦ·Â¤Ë+1)¡£";
 #else
-                       info[i++] = "It provides permanent light.";
+                       info[i++] = "It provides permanent light. (radius +1)";
 #endif
 
        }
-       if (f3 & (TR3_SEE_INVIS))
+       if (have_flag(flgs, TR_SEE_INVIS))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÆ©ÌÀ¤Ê¥â¥ó¥¹¥¿¡¼¤ò¸«¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë¡£";
@@ -3274,7 +3355,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_TELEPATHY))
+       if (have_flag(flgs, TR_TELEPATHY))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥Æ¥ì¥Ñ¥·¡¼Ç½ÎϤò¼ø¤±¤ë¡£";
@@ -3283,7 +3364,115 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_SLOW_DIGEST))
+       if (have_flag(flgs, TR_ESP_ANIMAL))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¼«Á³³¦¤ÎÀ¸Êª¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses natural creatures.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_UNDEAD))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¥¢¥ó¥Ç¥Ã¥É¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses undead.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_DEMON))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï°­Ëâ¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses demons.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_ORC))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¥ª¡¼¥¯¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses orcs.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_TROLL))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¥È¥í¥ë¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses trolls.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_GIANT))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ïµð¿Í¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses giants.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_DRAGON))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¥É¥é¥´¥ó¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses dragons.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_HUMAN))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¿Í´Ö¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses humans.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_EVIL))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï¼Ù°­¤Ê¸ºß¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses evil creatures.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_GOOD))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤ÏÁ±Îɤʸºß¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses good creatures.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_NONLIVING))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤Ï³èÆ°¤¹¤ë̵À¸ÊªÂΤò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses non-living creatures.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_ESP_UNIQUE))
+       {
+#ifdef JP
+info[i++] = "¤½¤ì¤ÏÆÃÊ̤ʶ¯Å¨¤ò´¶ÃΤ¹¤ë¡£";
+#else
+               info[i++] = "It senses unique monsters.";
+#endif
+
+       }
+       if (have_flag(flgs, TR_SLOW_DIGEST))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤Î¿·ÄÄÂå¼Õ¤òÃÙ¤¯¤¹¤ë¡£";
@@ -3292,7 +3481,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_REGEN))
+       if (have_flag(flgs, TR_REGEN))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÂÎÎϲóÉüÎϤò¶¯²½¤¹¤ë¡£";
@@ -3301,7 +3490,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_WARNING))
+       if (have_flag(flgs, TR_WARNING))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï´í¸±¤ËÂФ·¤Æ·Ù¹ð¤òȯ¤¹¤ë¡£";
@@ -3310,7 +3499,7 @@ info[i++] = "
 #endif
 
        }
-       if (f2 & (TR2_REFLECT))
+       if (have_flag(flgs, TR_REFLECT))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÌð¤ä¥Ü¥ë¥È¤òÈ¿¼Í¤¹¤ë¡£";
@@ -3319,7 +3508,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_SH_FIRE))
+       if (have_flag(flgs, TR_SH_FIRE))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï±ê¤Î¥Ð¥ê¥¢¤òÄ¥¤ë¡£";
@@ -3328,7 +3517,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_SH_ELEC))
+       if (have_flag(flgs, TR_SH_ELEC))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÅŵ¤¤Î¥Ð¥ê¥¢¤òÄ¥¤ë¡£";
@@ -3337,16 +3526,16 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_SH_COLD))
+       if (have_flag(flgs, TR_SH_COLD))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÎ䵤¤Î¥Ð¥ê¥¢¤òÄ¥¤ë¡£";
 #else
-               info[i++] = "It produces a coldly sheath.";
+               info[i++] = "It produces a sheath of coldness.";
 #endif
 
        }
-       if (f3 & (TR3_NO_MAGIC))
+       if (have_flag(flgs, TR_NO_MAGIC))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÈ¿ËâË¡¥Ð¥ê¥¢¤òÄ¥¤ë¡£";
@@ -3355,7 +3544,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_NO_TELE))
+       if (have_flag(flgs, TR_NO_TELE))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥Æ¥ì¥Ý¡¼¥È¤ò¼ÙË⤹¤ë¡£";
@@ -3364,7 +3553,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_XTRA_MIGHT))
+       if (have_flag(flgs, TR_XTRA_MIGHT))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÌ𡿥ܥë¥È¡¿ÃƤò¤è¤ê¶¯ÎϤËȯ¼Í¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£";
@@ -3373,7 +3562,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_XTRA_SHOTS))
+       if (have_flag(flgs, TR_XTRA_SHOTS))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÌ𡿥ܥë¥È¡¿ÃƤòÈó¾ï¤ËÁ᤯ȯ¼Í¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£";
@@ -3383,7 +3572,7 @@ info[i++] = "
 
        }
 
-       if (f3 & TR3_BLESSED)
+       if (have_flag(flgs, TR_BLESSED))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¿À¤Ë½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¡£";
@@ -3424,7 +3613,7 @@ info[i++] = "
                }
        }
 
-       if ((f3 & TR3_TY_CURSE) || (o_ptr->curse_flags & TRC_TY_CURSE))
+       if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÂÀ¸Å¤Î²Ò¡¹¤·¤¤±åÇ°¤¬½É¤Ã¤Æ¤¤¤ë¡£";
@@ -3433,7 +3622,7 @@ info[i++] = "
 #endif
 
        }
-       if ((f3 & TR3_AGGRAVATE) || (o_ptr->curse_flags & TRC_AGGRAVATE))
+       if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÉÕ¶á¤Î¥â¥ó¥¹¥¿¡¼¤òÅܤ餻¤ë¡£";
@@ -3442,7 +3631,7 @@ info[i++] = "
 #endif
 
        }
-       if ((f3 & (TR3_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
+       if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï·Ð¸³ÃͤòµÛ¤¤¼è¤ë¡£";
@@ -3514,7 +3703,7 @@ info[i++] = "
 #endif
 
        }
-       if ((f3 & (TR3_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
+       if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¥é¥ó¥À¥à¤Ê¥Æ¥ì¥Ý¡¼¥È¤ò°ú¤­µ¯¤³¤¹¡£";
@@ -3528,7 +3717,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¹¶·â¤ò³°¤·¤ä¤¹¤¤¡£";
 #else
-               info[i++] = "It causes you miss blows.";
+               info[i++] = "It causes you to miss blows.";
 #endif
 
        }
@@ -3537,7 +3726,7 @@ info[i++] = "
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï¹¶·â¤ò¼õ¤±¤ä¤¹¤¤¡£";
 #else
-               info[i++] = "It helps your enemys' blows.";
+               info[i++] = "It helps your enemies' blows.";
 #endif
 
        }
@@ -3579,8 +3768,10 @@ info[i++] = "
        }
 
        /* XTRA HACK ARTDESC */
-       flag = TR3_IGNORE_ACID | TR3_IGNORE_ELEC | TR3_IGNORE_FIRE | TR3_IGNORE_COLD ;
-       if ((f3 & flag) == flag)
+       if (have_flag(flgs, TR_IGNORE_ACID) &&
+           have_flag(flgs, TR_IGNORE_ELEC) &&
+           have_flag(flgs, TR_IGNORE_FIRE) &&
+           have_flag(flgs, TR_IGNORE_COLD))
        {
 #ifdef JP
          info[i++] = "¤½¤ì¤Ï»À¡¦Åŷ⡦²Ð±ê¡¦Î䵤¤Ç¤Ï½ý¤Ä¤«¤Ê¤¤¡£";
@@ -3588,7 +3779,7 @@ info[i++] = "
          info[i++] = "It cannot be harmed by the elements.";
 #endif
        } else {
-       if (f3 & (TR3_IGNORE_ACID))
+       if (have_flag(flgs, TR_IGNORE_ACID))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï»À¤Ç¤Ï½ý¤Ä¤«¤Ê¤¤¡£";
@@ -3597,7 +3788,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_IGNORE_ELEC))
+       if (have_flag(flgs, TR_IGNORE_ELEC))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÅÅ·â¤Ç¤Ï½ý¤Ä¤«¤Ê¤¤¡£";
@@ -3606,7 +3797,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_IGNORE_FIRE))
+       if (have_flag(flgs, TR_IGNORE_FIRE))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤Ï²Ð±ê¤Ç¤Ï½ý¤Ä¤«¤Ê¤¤¡£";
@@ -3615,7 +3806,7 @@ info[i++] = "
 #endif
 
        }
-       if (f3 & (TR3_IGNORE_COLD))
+       if (have_flag(flgs, TR_IGNORE_COLD))
        {
 #ifdef JP
 info[i++] = "¤½¤ì¤ÏÎ䵤¤Ç¤Ï½ý¤Ä¤«¤Ê¤¤¡£";
@@ -4366,7 +4557,7 @@ void display_equip(void)
 int show_inven(int target_item)
 {
        int             i, j, k, l, z = 0;
-       int             col, cur_col, len, lim;
+       int             col, cur_col, len;
        object_type     *o_ptr;
        char            o_name[MAX_NLEN];
        char            tmp_val[80];
@@ -4375,7 +4566,10 @@ int show_inven(int target_item)
        char            out_desc[23][MAX_NLEN];
        int             target_item_label = 0;
        int             wid, hgt;
+       char inven_spellbook_label[52+1];
 
+       /* See cmd5.c */
+       extern bool select_spellbook;
 
        /* Starting column */
        col = command_gap;
@@ -4386,18 +4580,6 @@ int show_inven(int target_item)
        /* Default "max-length" */
        len = wid - col - 1;
 
-       /* Maximum space allowed for descriptions */
-       lim = wid - 4;
-
-       /* Require space for weight (if needed) */
-       if (show_weights) lim -= 9;
-
-       /* Require space for icon */
-       if (show_item_graph)
-       {
-               lim -= 2;
-               if (use_bigtile) lim--;
-       }
 
        /* Find the "final" slot */
        for (i = 0; i < INVEN_PACK; i++)
@@ -4411,6 +4593,26 @@ int show_inven(int target_item)
                z = i + 1;
        }
 
+       if (select_spellbook)
+       {
+               int index;
+
+               strcpy(inven_spellbook_label, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
+               for (i = 0; i < 52; i++)
+               {
+                       char c;
+                       if (i < 26) c = (char)('a' + i);
+                       else c = (char)('A' + i - 26);
+
+                       if (get_tag(&index, c))
+                       {
+                               if (inven_spellbook_label[i] == c)
+                                       inven_spellbook_label[i] = ' ';
+                               inven_spellbook_label[index] = c;
+                       }
+               }
+       }
+
        /* Display the inventory */
        for (k = 0, i = 0; i < z; i++)
        {
@@ -4422,9 +4624,6 @@ int show_inven(int target_item)
                /* Describe the object */
                object_desc(o_name, o_ptr, TRUE, 3);
 
-               /* Hack -- enforce max length */
-               o_name[lim] = '\0';
-
                /* Save the object index, color, and description */
                out_index[k] = i;
                out_color[k] = tval_to_attr[o_ptr->tval % 128];
@@ -4485,9 +4684,15 @@ int show_inven(int target_item)
                        }
                        else strcpy(tmp_val, "  ");
                }
+               else if (i <= INVEN_PACK && select_spellbook)
+               {
+                       sprintf(tmp_val, "%c)", inven_spellbook_label[i]);
+               }
                else
+               {
                        /* Prepare an index --(-- */
                        sprintf(tmp_val, "%c)", index_to_label(i));
+               }
 
                /* Clear the line with the (possibly indented) index */
                put_str(tmp_val, j + 1, col);
@@ -4509,7 +4714,7 @@ int show_inven(int target_item)
                        {
                                cur_col++;
                                if (a & 0x80)
-                                       Term_draw(cur_col, j + 1, 255, 255);
+                                       Term_draw(cur_col, j + 1, 255, -1);
                        }
                        cur_col += 2;
                }
@@ -4549,7 +4754,7 @@ int show_inven(int target_item)
 int show_equip(int target_item)
 {
        int             i, j, k, l;
-       int             col, cur_col, len, lim;
+       int             col, cur_col, len;
        object_type     *o_ptr;
        char            tmp_val[80];
        char            o_name[MAX_NLEN];
@@ -4569,26 +4774,6 @@ int show_equip(int target_item)
        /* Maximal length */
        len = wid - col - 1;
 
-       /* Maximum space allowed for descriptions */
-       lim = wid - 4;
-
-       /* Require space for labels (if needed) */
-#ifdef JP
-        if (show_labels) lim -= (7 + 2);
-#else
-       if (show_labels) lim -= (14 + 2);
-#endif
-
-
-       /* Require space for weight (if needed) */
-#ifdef JP
-        if (show_weights) lim -= 10;
-#else
-       if (show_weights) lim -= 9;
-#endif
-
-
-       if (show_item_graph) lim -= 2;
 
        /* Scan the equipment list */
        for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
@@ -4601,9 +4786,6 @@ int show_equip(int target_item)
                /* Description */
                object_desc(o_name, o_ptr, TRUE, 3);
 
-               /* Truncate the description */
-               o_name[lim] = 0;
-
                if ((i == INVEN_LARM) && p_ptr->ryoute)
                {
 #ifdef JP
@@ -4628,7 +4810,7 @@ int show_equip(int target_item)
 
                /* Extract the maximal length (see below) */
 #ifdef JP
-                l = strlen(out_desc[k]) + (2 + 1);
+               l = strlen(out_desc[k]) + (2 + 1);
 #else
                l = strlen(out_desc[k]) + (2 + 3);
 #endif
@@ -4636,7 +4818,7 @@ int show_equip(int target_item)
 
                /* Increase length for labels (if needed) */
 #ifdef JP
-                if (show_labels) l += (7 + 2);
+               if (show_labels) l += (7 + 2);
 #else
                if (show_labels) l += (14 + 2);
 #endif
@@ -4656,7 +4838,7 @@ int show_equip(int target_item)
 
        /* Hack -- Find a column to start in */
 #ifdef JP
-        col = (len > wid - 6) ? 0 : (wid - len - 1);
+       col = (len > wid - 6) ? 0 : (wid - len - 1);
 #else
        col = (len > wid - 4) ? 0 : (wid - len - 1);
 #endif
@@ -4711,7 +4893,7 @@ int show_equip(int target_item)
                        {
                                cur_col++;
                                if (a & 0x80)
-                                       Term_draw(cur_col, j + 1, 255, 255);
+                                       Term_draw(cur_col, j + 1, 255, -1);
                        }
                        cur_col += 2;
                }
@@ -4748,7 +4930,7 @@ int show_equip(int target_item)
                {
                        int wgt = o_ptr->weight * o_ptr->number;
 #ifdef JP
-                        (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
+                       (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
 #else
                        (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
 #endif
@@ -4928,7 +5110,7 @@ static bool get_item_okay(int i)
  * Also, the tag "@xn" will work as well, where "n" is a tag-char,
  * and "x" is the "current" command_cmd code.
  */
-static int get_tag(int *cp, char tag)
+int get_tag(int *cp, char tag)
 {
        int i;
        cptr s;
@@ -5019,7 +5201,7 @@ bool can_get_item(void)
                if (item_tester_okay(&inventory[j]))
                        return TRUE;
 
-       (void)scan_floor(floor_list, &floor_num, py, px, 0x01);
+       floor_num = scan_floor(floor_list, py, px, 0x01);
        if (floor_num)
                return TRUE;
 
@@ -5109,7 +5291,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
 
 #ifdef ALLOW_EASY_FLOOR /* TNB */
 
-       if (easy_floor) return get_item_floor(cp, pmt, str, mode);
+       if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
 
 #endif /* ALLOW_EASY_FLOOR -- TNB */
 
@@ -5118,7 +5300,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        /* Get the item index */
        if (repeat_pull(cp))
        {
-               if (*cp == 1111) { /* the_force */
+               if (*cp == 1111) { /* the_force */
                    item_tester_tval = 0;
                    item_tester_hook = NULL;
                    return (TRUE);
@@ -5236,7 +5418,6 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                }
        }
 
-
        /* Require at least one legal choice */
        if (!allow_floor && (i1 > i2) && (e1 > e2))
        {
@@ -5285,10 +5466,10 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        }
 
 
-        /*
-         * Äɲ媥ץ·¥ç¥ó(always_show_list)¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¾ï¤Ë°ìÍ÷¤òɽ¼¨¤¹¤ë
-         */
-        if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
+       /*
+        * Äɲ媥ץ·¥ç¥ó(always_show_list)¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¾ï¤Ë°ìÍ÷¤òɽ¼¨¤¹¤ë
+        */
+       if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
 
        /* Hack -- start out in "display" mode */
        if (command_see)
@@ -5378,12 +5559,12 @@ sprintf(out_val, "
                        {
                                /* Build the prompt */
 #ifdef JP
-sprintf(tmp_val, "%c-%c,",
+sprintf(tmp_val, "%c-%c,'(',')',",
 #else
-                               sprintf(tmp_val, " %c-%c,",
+                               sprintf(tmp_val, " %c-%c,'(',')',",
 #endif
 
-                                       index_to_label(i1), index_to_label(i2));
+                                       index_to_label(i1), index_to_label(i2));
 
                                /* Append */
                                strcat(out_val, tmp_val);
@@ -5426,12 +5607,12 @@ sprintf(out_val, "
                        {
                                /* Build the prompt */
 #ifdef JP
-sprintf(tmp_val, "%c-%c,",
+sprintf(tmp_val, "%c-%c,'(',')',",
 #else
-                               sprintf(tmp_val, " %c-%c,",
+                               sprintf(tmp_val, " %c-%c,'(',')',",
 #endif
 
-                                       index_to_label(e1), index_to_label(e2));
+                                       index_to_label(e1), index_to_label(e2));
 
                                /* Append */
                                strcat(out_val, tmp_val);
@@ -5543,27 +5724,36 @@ if (allow_floor) strcat(out_val, " '-'
                        case '\r':
                        case '\n':
                        {
-                               /* Validate the item */
-                               if (!get_item_okay(get_item_label))
+                               if (command_wrk == USE_FLOOR)
                                {
-                                       bell();
-                                       break;
+                                       /* Special index */
+                                       (*cp) = -get_item_label;
                                }
-
-                               /* Allow player to "refuse" certain actions */
-                               if (!get_item_allow(get_item_label))
+                               else
                                {
-                                       done = TRUE;
-                                       break;
+                                       /* Validate the item */
+                                       if (!get_item_okay(get_item_label))
+                                       {
+                                               bell();
+                                               break;
+                                       }
+
+                                       /* Allow player to "refuse" certain actions */
+                                       if (!get_item_allow(get_item_label))
+                                       {
+                                               done = TRUE;
+                                               break;
+                                       }
+
+                                       /* Accept that choice */
+                                       (*cp) = get_item_label;
                                }
 
-                               /* Accept that choice */
-                               (*cp) = get_item_label;
                                item = TRUE;
                                done = TRUE;
                                break;
                        }
-                       case 'w':
+                       case 'w':
                        {
                                if (select_the_force) {
                                        *cp = 1111;
@@ -5765,7 +5955,7 @@ if (other_query_flag && !verify("
                                break;
                        }
 
-                       case 'w':
+                       case 'w':
                        {
                                if (select_the_force) {
                                        *cp = 1111;
@@ -5778,34 +5968,33 @@ if (other_query_flag && !verify("
                        default:
                        {
                                int ver;
-
                                if(select_spellbook){
-                                    bool not_found = FALSE;
-                                    /* Look up the tag */
-                                    if (!get_tag(&k, which))
-                                    {
+                                   bool not_found = FALSE;
+                                   /* Look up the tag */
+                                   if (!get_tag(&k, which))
+                                   {
                                        not_found = TRUE;
-                                    }
+                                   }
 
-                                    /* Hack -- Validate the item */
-                                    if ((k < INVEN_RARM) ? !inven : !equip)
-                                    {
+                                   /* Hack -- Validate the item */
+                                   if ((k < INVEN_RARM) ? !inven : !equip)
+                                   {
                                        not_found = TRUE;
-                                    }
+                                   }
 
-                                    /* Validate the item */
-                                    if (!get_item_okay(k))
-                                    {
+                                   /* Validate the item */
+                                   if (!get_item_okay(k))
+                                   {
                                        not_found = TRUE;
-                                    }
-
-                                    if( !not_found ){
-                                        /* Accept that choice */
-                                        (*cp) = k;
-                                        item = TRUE;
-                                        done = TRUE;
-                                        break;
-                                    }
+                                   }
+
+                                   if( !not_found ){
+                                       /* Accept that choice */
+                                       (*cp) = k;
+                                       item = TRUE;
+                                       done = TRUE;
+                                       break;
+                                   }
                                }                               
 
                                /* Extract "query" setting */
@@ -5815,13 +6004,17 @@ if (other_query_flag && !verify("
                                /* Convert letter to inventory index */
                                if (!command_wrk)
                                {
-                                       k = label_to_inven(which);
+                                       if (which == '(') k = i1;
+                                       else if (which == ')') k = i2;
+                                       else k = label_to_inven(which);
                                }
 
                                /* Convert letter to equipment index */
                                else
                                {
-                                       k = label_to_equip(which);
+                                       if (which == '(') k = e1;
+                                       else if (which == ')') k = e2;
+                                       else k = label_to_equip(which);
                                }
 
                                /* Validate the item */
@@ -5922,16 +6115,14 @@ if (ver && !verify("
  *             mode & 0x02 -- Marked items only
  *             mode & 0x04 -- Stop after first
  */
-bool scan_floor(int *items, int *item_num, int y, int x, int mode)
+int scan_floor(int *items, int y, int x, int mode)
 {
        int this_o_idx, next_o_idx;
 
        int num = 0;
 
-       (*item_num) = 0;
-
        /* Sanity */
-       if (!in_bounds(y, x)) return (FALSE);
+       if (!in_bounds(y, x)) return 0;
 
        /* Scan all objects in the grid */
        for (this_o_idx = cave[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
@@ -5951,29 +6142,27 @@ bool scan_floor(int *items, int *item_num, int y, int x, int mode)
                if ((mode & 0x02) && !o_ptr->marked) continue;
 
                /* Accept this item */
-               items[num++] = this_o_idx;
+               /* XXX Hack -- Enforce limit */
+               if (num < 23)
+                       items[num] = this_o_idx;
+
+               num++;
 
                /* Only one */
                if (mode & 0x04) break;
-
-               /* XXX Hack -- Enforce limit */
-               if (num == 23) break;
        }
 
-       /* Number of items */
-       (*item_num) = num;
-
        /* Result */
-       return (num != 0);
+       return num;
 }
 
 /*
  * Display a list of the items on the floor at the given location.
  */
-int show_floor(int target_item, int y, int x)
+int show_floor(int target_item, int y, int x, int *min_width)
 {
        int i, j, k, l;
-       int col, len, lim;
+       int col, len;
 
        object_type *o_ptr;
 
@@ -5993,28 +6182,20 @@ int show_floor(int target_item, int y, int x)
        Term_get_size(&wid, &hgt);
 
        /* Default length */
-       len = 20;
+       len = MAX((*min_width), 20);
 
-       /* Maximum space allowed for descriptions */
-       lim = wid - 4;
-
-       /* Require space for weight (if needed) */
-       if (show_weights) lim -= 9;
 
        /* Scan for objects in the grid, using item_tester_okay() */
-       (void) scan_floor(floor_list, &floor_num, y, x, 0x01);
+       floor_num = scan_floor(floor_list, y, x, 0x01);
 
        /* Display the inventory */
-       for (k = 0, i = 0; i < floor_num; i++)
+       for (k = 0, i = 0; i < floor_num && i < 23; i++)
        {
                o_ptr = &o_list[floor_list[i]];
 
                /* Describe the object */
                object_desc(o_name, o_ptr, TRUE, 3);
 
-               /* Hack -- enforce max length */
-               o_name[lim] = '\0';
-
                /* Save the index */
                out_index[k] = i;
 
@@ -6037,6 +6218,9 @@ int show_floor(int target_item, int y, int x)
                k++;
        }
 
+       /* Save width */
+       *min_width = len;
+
        /* Find the column to start in */
        col = (len > wid - 4) ? 0 : (wid - len - 1);
 
@@ -6123,6 +6307,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        char out_val[160];
 
        int floor_num, floor_list[23], floor_top = 0;
+       int min_width = 0;
 
        extern bool select_spellbook;
        extern bool select_the_force;
@@ -6136,7 +6321,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        /* Get the item index */
        if (repeat_pull(cp))
        {
-               if (*cp == 1111) { /* the_force */
+               if (*cp == 1111) { /* the_force */
                    item_tester_tval = 0;
                    item_tester_hook = NULL;
                    return (TRUE);
@@ -6241,7 +6426,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        if (floor)
        {
                /* Scan all objects in the grid */
-               (void) scan_floor(floor_list, &floor_num, py, px, 0x01);
+               floor_num = scan_floor(floor_list, py, px, 0x01);
        }
 
        /* Accept inventory */
@@ -6300,10 +6485,10 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                }
        }
 
-        /*
-         * Äɲ媥ץ·¥ç¥ó(always_show_list)¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¾ï¤Ë°ìÍ÷¤òɽ¼¨¤¹¤ë
-         */
-        if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
+       /*
+        * Äɲ媥ץ·¥ç¥ó(always_show_list)¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¾ï¤Ë°ìÍ÷¤òɽ¼¨¤¹¤ë
+        */
+       if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
 
        /* Hack -- start out in "display" mode */
        if (command_see)
@@ -6387,7 +6572,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        n2 = I2A(k - floor_top);
 
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_floor(menu_line, py, px);
+                       if (command_see) get_item_label = show_floor(menu_line, py, px, &min_width);
                }
 
                /* Viewing inventory */
@@ -6404,12 +6589,12 @@ sprintf(out_val, "
                        {
                                /* Build the prompt */
 #ifdef JP
-sprintf(tmp_val, "%c-%c,",
+sprintf(tmp_val, "%c-%c,'(',')',",
 #else
-                               sprintf(tmp_val, " %c-%c,",
+                               sprintf(tmp_val, " %c-%c,'(',')',",
 #endif
 
-                                       index_to_label(i1), index_to_label(i2));
+                                       index_to_label(i1), index_to_label(i2));
 
                                /* Append */
                                strcat(out_val, tmp_val);
@@ -6425,51 +6610,50 @@ if (!command_see && !use_menu) strcat(out_val, " '*'
 
                        /* Append */
 #ifdef JP
-if (allow_equip)
-{
-       if (use_menu)
-       {
-               if (allow_floor)
-                       strcat(out_val, " '6' ÁõÈ÷ÉÊ,");
-               else
-                       strcat(out_val, " '4'or'6' ÁõÈ÷ÉÊ,");
-       }
-       else strcat(out_val, " '/' ÁõÈ÷ÉÊ,");
-}
-else if (select_the_force)
-       strcat(out_val, " 'w'Îýµ¤½Ñ,");
+                       if (allow_equip)
+                       {
+                               if (!use_menu)
+                                       strcat(out_val, " '/' ÁõÈ÷ÉÊ,");
+                               else if (allow_floor)
+                                       strcat(out_val, " '6' ÁõÈ÷ÉÊ,");
+                               else
+                                       strcat(out_val, " '4'or'6' ÁõÈ÷ÉÊ,");
+                       }
+                       else if (select_the_force)
+                               strcat(out_val, " 'w'Îýµ¤½Ñ,");
 #else
-if (allow_equip)
-{
-       if (use_menu)
-       {
-               if (allow_floor)
-                       strcat(out_val, " 6 for Equip,");
-               else
-                       strcat(out_val, " 4 or 6 for Equip,");
-       }
-       else strcat(out_val, " / for Equip,");
-}
-else if (select_the_force)
-       strcat(out_val, " w for the Force,");
+                       if (allow_equip)
+                       {
+                               if (!use_menu)
+                                       strcat(out_val, " / for Equip,");
+                               else if (allow_floor)
+                                       strcat(out_val, " 6 for Equip,");
+                               else
+                                       strcat(out_val, " 4 or 6 for Equip,");
+                       }
+                       else if (select_the_force)
+                               strcat(out_val, " w for the Force,");
 #endif
 
                        /* Append */
+                       if (allow_floor)
+                       {
 #ifdef JP
-if (allow_floor)
-{
-       if (use_menu)
-       {
-               if (allow_equip)
-                       strcat(out_val, " '4' ¾²¾å,");
-               else
-                       strcat(out_val, " '4'or'6' ¾²¾å,");
-       }
-       else strcat(out_val, " '-'¾²¾å,");
-}
+                               if (!use_menu)
+                                       strcat(out_val, " '-'¾²¾å,");
+                               else if (allow_equip)
+                                       strcat(out_val, " '4' ¾²¾å,");
+                               else
+                                       strcat(out_val, " '4'or'6' ¾²¾å,");
 #else
-                       if (allow_floor) strcat(out_val, " - for floor,");
+                               if (!use_menu)
+                                       strcat(out_val, " - for floor,");
+                               else if (allow_equip)
+                                       strcat(out_val, " 4 for floor,");
+                               else
+                                       strcat(out_val, " 4 or 6 for floor,");
 #endif
+                       }
 
                }
 
@@ -6488,12 +6672,12 @@ sprintf(out_val, "
                        {
                                /* Build the prompt */
 #ifdef JP
-sprintf(tmp_val, "%c-%c,",
+sprintf(tmp_val, "%c-%c,'(',')',",
 #else
-                               sprintf(tmp_val, " %c-%c,",
+                               sprintf(tmp_val, " %c-%c,'(',')',",
 #endif
 
-                                       index_to_label(e1), index_to_label(e2));
+                                       index_to_label(e1), index_to_label(e2));
 
                                /* Append */
                                strcat(out_val, tmp_val);
@@ -6508,40 +6692,45 @@ if (!command_see && !use_menu) strcat(out_val, " '*'
 
 
                        /* Append */
+                       if (allow_inven)
+                       {
 #ifdef JP
-if (allow_inven)
-{
-       if (use_menu)
-       {
-               if (allow_floor)
-                       strcat(out_val, " '4' »ý¤Áʪ,");
-               else
-                       strcat(out_val, " '4'or'6' »ý¤Áʪ,");
-       }
-       else strcat(out_val, " '/' »ý¤Áʪ,");
-}
+                               if (!use_menu)
+                                       strcat(out_val, " '/' »ý¤Áʪ,");
+                               else if (allow_floor)
+                                       strcat(out_val, " '4' »ý¤Áʪ,");
+                               else
+                                       strcat(out_val, " '4'or'6' »ý¤Áʪ,");
 #else
-                       if (allow_inven) strcat(out_val, " / for Inven,");
-#endif
 
+                               if (!use_menu)
+                                       strcat(out_val, " / for Inven,");
+                               else if (allow_floor)
+                                       strcat(out_val, " 4 for Inven,");
+                               else
+                                       strcat(out_val, " 4 or 6 for Inven,");
+#endif
+                       }
 
                        /* Append */
+                       if (allow_floor)
+                       {
 #ifdef JP
-if (allow_floor)
-{
-       if (use_menu)
-       {
-               if (allow_floor)
-                       strcat(out_val, " '6' ¾²¾å,");
-               else
-                       strcat(out_val, " '4'or'6' ¾²¾å,");
-       }
-       else strcat(out_val, " '-'¾²¾å,");
-}
+                               if (!use_menu)
+                                       strcat(out_val, " '-'¾²¾å,");
+                               else if (allow_inven)
+                                       strcat(out_val, " '6' ¾²¾å,");
+                               else
+                                       strcat(out_val, " '4'or'6' ¾²¾å,");
 #else
-                       if (allow_floor) strcat(out_val, " - for floor,");
+                               if (!use_menu)
+                                       strcat(out_val, " - for floor,");
+                               else if (allow_inven)
+                                       strcat(out_val, " 6 for floor,");
+                               else
+                                       strcat(out_val, " 4 or 6 for floor,");
 #endif
-
+                       }
                }
 
                /* Viewing floor */
@@ -6559,9 +6748,9 @@ if (allow_floor)
                        {
                                /* Build the prompt */
 #ifdef JP
-sprintf(tmp_val, "%c-%c,", n1, n2);
+sprintf(tmp_val, "%c-%c,'(',')',", n1, n2);
 #else
-                               sprintf(tmp_val, " %c-%c,", n1, n2);
+                               sprintf(tmp_val, " %c-%c,'(',')',", n1, n2);
 #endif
 
 
@@ -6582,27 +6771,27 @@ if (!command_see && !use_menu) strcat(out_val, " '*'
                                if (allow_inven && allow_equip)
                                {
 #ifdef JP
-strcat(out_val, " '4' ÁõÈ÷ÉÊ,  '6' »ý¤Áʪ,");
+                                       strcat(out_val, " '4' ÁõÈ÷ÉÊ, '6' »ý¤Áʪ,");
 #else
-                                       strcat(out_val, " / for Inven,");
+                                       strcat(out_val, " 4 for Equip, 6 for Inven,");
 #endif
 
                                }
                                else if (allow_inven)
                                {
 #ifdef JP
-strcat(out_val, " '4'or'6' »ý¤Áʪ,");
+                                       strcat(out_val, " '4'or'6' »ý¤Áʪ,");
 #else
-                                       strcat(out_val, " / for Inven,");
+                                       strcat(out_val, " 4 or 6 for Inven,");
 #endif
 
                                }
                                else if (allow_equip)
                                {
 #ifdef JP
-strcat(out_val, " '4'or'6' ÁõÈ÷ÉÊ,");
+                                       strcat(out_val, " '4'or'6' ÁõÈ÷ÉÊ,");
 #else
-                                       strcat(out_val, " / for Equip,");
+                                       strcat(out_val, " 4 or 6 for Equip,");
 #endif
 
                                }
@@ -6611,7 +6800,7 @@ strcat(out_val, " '4'or'6' 
                        else if (allow_inven)
                        {
 #ifdef JP
-strcat(out_val, " '/' »ý¤Áʪ,");
+                               strcat(out_val, " '/' »ý¤Áʪ,");
 #else
                                strcat(out_val, " / for Inven,");
 #endif
@@ -6620,7 +6809,7 @@ strcat(out_val, " '/' 
                        else if (allow_equip)
                        {
 #ifdef JP
-strcat(out_val, " '/'ÁõÈ÷ÉÊ,");
+                               strcat(out_val, " '/'ÁõÈ÷ÉÊ,");
 #else
                                strcat(out_val, " / for Equip,");
 #endif
@@ -6631,7 +6820,7 @@ strcat(out_val, " '/'
                        if (command_see && !use_menu)
                        {
 #ifdef JP
-                               strcat(out_val, " RET ¼¡,");
+                               strcat(out_val, " Enter ¼¡,");
 #else
                                strcat(out_val, " Enter for scroll down,");
 #endif
@@ -6655,7 +6844,7 @@ strcat(out_val, " '/'
                int max_line = 1;
                if (command_wrk == USE_INVEN) max_line = max_inven;
                else if (command_wrk == USE_EQUIP) max_line = max_equip;
-               else if (command_wrk == USE_FLOOR) max_line = floor_num;
+               else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
                switch (which)
                {
                        case ESCAPE:
@@ -6737,7 +6926,7 @@ strcat(out_val, " '/'
                                /* Switch inven/equip */
                                if (command_wrk == USE_INVEN) max_line = max_inven;
                                else if (command_wrk == USE_EQUIP) max_line = max_equip;
-                               else if (command_wrk == USE_FLOOR) max_line = floor_num;
+                               else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
                                if (menu_line > max_line) menu_line = max_line;
 
                                /* Need to redraw */
@@ -6798,7 +6987,7 @@ strcat(out_val, " '/'
                                /* Switch inven/equip */
                                if (command_wrk == USE_INVEN) max_line = max_inven;
                                else if (command_wrk == USE_EQUIP) max_line = max_equip;
-                               else if (command_wrk == USE_FLOOR) max_line = floor_num;
+                               else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
                                if (menu_line > max_line) menu_line = max_line;
 
                                /* Need to redraw */
@@ -6810,27 +6999,36 @@ strcat(out_val, " '/'
                        case '\r':
                        case '\n':
                        {
-                               /* Validate the item */
-                               if (!get_item_okay(get_item_label))
+                               if (command_wrk == USE_FLOOR)
                                {
-                                       bell();
-                                       break;
+                                       /* Special index */
+                                       (*cp) = -get_item_label;
                                }
-
-                               /* Allow player to "refuse" certain actions */
-                               if (!get_item_allow(get_item_label))
+                               else
                                {
-                                       done = TRUE;
-                                       break;
+                                       /* Validate the item */
+                                       if (!get_item_okay(get_item_label))
+                                       {
+                                               bell();
+                                               break;
+                                       }
+
+                                       /* Allow player to "refuse" certain actions */
+                                       if (!get_item_allow(get_item_label))
+                                       {
+                                               done = TRUE;
+                                               break;
+                                       }
+
+                                       /* Accept that choice */
+                                       (*cp) = get_item_label;
                                }
 
-                               /* Accept that choice */
-                               (*cp) = get_item_label;
                                item = TRUE;
                                done = TRUE;
                                break;
                        }
-                       case 'w':
+                       case 'w':
                        {
                                if (select_the_force) {
                                        *cp = 1111;
@@ -6896,17 +7094,17 @@ strcat(out_val, " '/'
 
                                /* Remove the first object from the list. */
                                excise_object_idx(o_idx);
-       
+       
                                /* Find end of the list. */
                                i = c_ptr->o_idx;
                                while (o_list[i].next_o_idx)
                                        i = o_list[i].next_o_idx;
-       
+       
                                /* Add after the last object. */
                                o_list[i].next_o_idx = o_idx;
-       
+       
                                /* Re-scan floor list */ 
-                               scan_floor(floor_list, &floor_num, py, px, 0x01);
+                               floor_num = scan_floor(floor_list, py, px, 0x01);
 
                                /* Hack -- Fix screen */
                                if (command_see)
@@ -7126,7 +7324,7 @@ strcat(out_val, " '/'
                        }
 #endif
 
-                       case 'w':
+                       case 'w':
                        {
                                if (select_the_force) {
                                        *cp = 1111;
@@ -7141,32 +7339,32 @@ strcat(out_val, " '/'
                                int ver;
 
                                if(select_spellbook){
-                                    bool not_found = FALSE;
-                                    /* Look up the tag */
-                                    if (!get_tag(&k, which))
-                                    {
+                                   bool not_found = FALSE;
+                                   /* Look up the tag */
+                                   if (!get_tag(&k, which))
+                                   {
                                        not_found = TRUE;
-                                    }
+                                   }
 
-                                    /* Hack -- Validate the item */
-                                    if ((k < INVEN_RARM) ? !inven : !equip)
-                                    {
+                                   /* Hack -- Validate the item */
+                                   if ((k < INVEN_RARM) ? !inven : !equip)
+                                   {
                                        not_found = TRUE;
-                                    }
+                                   }
 
-                                    /* Validate the item */
-                                    if (!get_item_okay(k))
-                                    {
+                                   /* Validate the item */
+                                   if (!get_item_okay(k))
+                                   {
                                        not_found = TRUE;
-                                    }
-
-                                    if( !not_found ){
-                                        /* Accept that choice */
-                                        (*cp) = k;
-                                        item = TRUE;
-                                        done = TRUE;
-                                        break;
-                                    }
+                                   }
+
+                                   if( !not_found ){
+                                       /* Accept that choice */
+                                       (*cp) = k;
+                                       item = TRUE;
+                                       done = TRUE;
+                                       break;
+                                   }
                                }                               
 
                                /* Extract "query" setting */
@@ -7176,20 +7374,26 @@ strcat(out_val, " '/'
                                /* Convert letter to inventory index */
                                if (command_wrk == (USE_INVEN))
                                {
-                                       k = label_to_inven(which);
+                                       if (which == '(') k = i1;
+                                       else if (which == ')') k = i2;
+                                       else k = label_to_inven(which);
                                }
 
                                /* Convert letter to equipment index */
                                else if (command_wrk == (USE_EQUIP))
                                {
-                                       k = label_to_equip(which);
+                                       if (which == '(') k = e1;
+                                       else if (which == ')') k = e2;
+                                       else k = label_to_equip(which);
                                }
 
                                /* Convert letter to floor index */
                                else if (command_wrk == USE_FLOOR)
                                {
-                                       k = islower(which) ? A2I(which) : -1;
-                                       if (k < 0 || k >= floor_num)
+                                       if (which == '(') k = 0;
+                                       else if (which == ')') k = floor_num - 1;
+                                       else k = islower(which) ? A2I(which) : -1;
+                                       if (k < 0 || k >= floor_num || k >= 23)
                                        {
                                                bell();
                                                break;
@@ -7282,7 +7486,7 @@ if (ver && !verify("
 }
 
 
-bool py_pickup_floor_aux(void)
+static bool py_pickup_floor_aux(void)
 {
        s16b this_o_idx;
 
@@ -7363,8 +7567,8 @@ void py_pickup_floor(int pickup)
                {
                        /* Message */
 #ifdef JP
-                msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
-                           (long)o_ptr->pval, o_name);
+               msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
+                          (long)o_ptr->pval, o_name);
 #else
                        msg_format("You have found %ld gold pieces worth of %s.",
                                (long) o_ptr->pval, o_name);
@@ -7386,6 +7590,13 @@ void py_pickup_floor(int pickup)
                        /* Check the next object */
                        continue;
                }
+               else if (o_ptr->marked & OM_NOMSG)
+               {
+                       /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
+                        * ignored. Otherwise, they are included in the prompt. */
+                       o_ptr->marked &= ~(OM_NOMSG);
+                       continue;
+               }
 
                /* Count non-gold objects that can be picked up. */
                if (inven_carry_okay(o_ptr))
@@ -7394,13 +7605,12 @@ void py_pickup_floor(int pickup)
                }
 
                /* Remember this object index */
-               floor_list[floor_num] = this_o_idx;
+               if (floor_num < 23)
+                       floor_list[floor_num] = this_o_idx;
 
                /* Count non-gold objects */
                floor_num++;
 
-               if (floor_num == 23) break;
-
                /* Remember this index */
                floor_o_idx = this_o_idx;
        }
@@ -7434,7 +7644,7 @@ void py_pickup_floor(int pickup)
 
                        /* Message */
 #ifdef JP
-                                msg_format("%s¤¬¤¢¤ë¡£", o_name);
+                               msg_format("%s¤¬¤¢¤ë¡£", o_name);
 #else
                        msg_format("You see %s.", o_name);
 #endif
@@ -7482,7 +7692,7 @@ void py_pickup_floor(int pickup)
 
                        /* Message */
 #ifdef JP
-                                msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
+                               msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
 #else
                        msg_format("You have no room for %s.", o_name);
 #endif
@@ -7494,7 +7704,7 @@ void py_pickup_floor(int pickup)
                {
                        /* Message */
 #ifdef JP
-                        msg_format("¥¶¥Ã¥¯¤Ë¤Ï¾²¤Ë¤¢¤ë¤É¤Î¥¢¥¤¥Æ¥à¤âÆþ¤é¤Ê¤¤¡£", o_name);
+                       msg_format("¥¶¥Ã¥¯¤Ë¤Ï¾²¤Ë¤¢¤ë¤É¤Î¥¢¥¤¥Æ¥à¤âÆþ¤é¤Ê¤¤¡£", o_name);
 #else
                        msg_print("You have no room for any of the objects on the floor.");
 #endif