OSDN Git Service

move_player_effect()の処理をbitフラグで制御するように変更. また, プレ
[hengbandforosx/hengbandosx.git] / src / object1.c
index 72174a7..dd7b325 100644 (file)
@@ -33,7 +33,7 @@
  */
 void reset_visuals(void)
 {
-       int i;
+       int i, j;
 
        /* Extract some info about terrain features */
        for (i = 0; i < max_f_idx; i++)
@@ -41,8 +41,11 @@ void reset_visuals(void)
                feature_type *f_ptr = &f_info[i];
 
                /* Assume we will use the underlying values */
-               f_ptr->x_attr = f_ptr->d_attr;
-               f_ptr->x_char = f_ptr->d_char;
+               for (j = 0; j < F_LIT_MAX; j++)
+               {
+                       f_ptr->x_attr[j] = f_ptr->d_attr[j];
+                       f_ptr->x_char[j] = f_ptr->d_char[j];
+               }
        }
 
        /* Extract default attr/char code for objects */
@@ -328,40 +331,6 @@ void object_flags_known(object_type *o_ptr, u32b flgs[TR_FLAG_SIZE])
 
 
 /*
- * Hack -- describe an item currently in a store's inventory
- * This allows an item to *look* like the player is "aware" of it
- */
-void object_desc_store(char *buf, object_type *o_ptr, int pref, int mode)
-{
-       /* Save the "aware" flag */
-       bool hack_aware = object_aware_p(o_ptr);
-
-       /* Save the "known" flag */
-       bool hack_known = (o_ptr->ident & (IDENT_KNOWN)) ? TRUE : FALSE;
-
-
-       /* Set the "known" flag */
-       o_ptr->ident |= (IDENT_KNOWN);
-
-       /* Force "aware" for description */
-       k_info[o_ptr->k_idx].aware = TRUE;
-
-
-       /* Describe the object */
-       object_desc(buf, o_ptr, pref, mode);
-
-
-       /* Restore "aware" flag */
-       k_info[o_ptr->k_idx].aware = hack_aware;
-
-       /* Clear the known flag */
-       if (!hack_known) o_ptr->ident &= ~(IDENT_KNOWN);
-}
-
-
-
-
-/*
  * Determine the "Activation" (if any) for an artifact
  * Return a string, or NULL for "no activation"
  */
@@ -1242,9 +1211,9 @@ return "
                case ART_GANDALF:
                {
 #ifdef JP
-return "õº÷¡¢Á´´¶ÃΡ¢Á´´ÕÄê : 1000 ¥¿¡¼¥óËè";
+return "Ä´ºº¡¢Á´´¶ÃΡ¢Á´´ÕÄê : 100 ¥¿¡¼¥óËè";
 #else
-                       return "probing, detection and full id every 1000 turns";
+                       return "probing, detection and full id every 100 turns";
 #endif
 
                }
@@ -1856,6 +1825,7 @@ return "
 #endif
                }
                case ART_NIGHT:
+               case ART_HELL:
                {
 #ifdef JP
 return "°Å¹õ¤ÎÍò(250) : 150+d150 ¥¿¡¼¥óËè";
@@ -1864,6 +1834,24 @@ return "
 #endif
 
                }
+               case ART_SACRED_KNIGHTS:
+               {
+#ifdef JP
+return "*²ò¼ö*¤ÈÄ´ºº: ¤¤¤Ä¤Ç¤â";
+#else
+                       return "Dispel Curse and Probing every turn";
+#endif
+
+               }
+               case ART_CHARMED:
+               {
+#ifdef JP
+return "ËâÎÏÉü³è: 777 ¥¿¡¼¥óËè";
+#else
+                       return "Restore Mana every 777 turns";
+#endif
+
+               }
        }
 
 
@@ -2369,6 +2357,8 @@ bool screen_object(object_type *o_ptr, bool real)
        char o_name[MAX_NLEN];
        int wid, hgt;
 
+       int trivial_info = 0;
+
        /* Extract the flags */
        object_flags(o_ptr, flgs);
 
@@ -2383,6 +2373,12 @@ bool screen_object(object_type *o_ptr, bool real)
                { info[i] = &temp[j]; i++;}
        }
 
+       if (TV_EQUIP_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_EQUIP_END)
+       {
+               /* Descriptions of a basic equipment is just a flavor */
+               trivial_info = i;
+       }
+
        /* Mega-Hack -- describe activation */
        if (have_flag(flgs, TR_ACTIVATE))
        {
@@ -2638,12 +2634,15 @@ info[i++] = "
                        info[i++] = "It is made for use while riding.";
 #endif
                else
+               {
 #ifdef JP
-info[i++] = "¤½¤ì¤Ï¾èÇÏÃæ¤Ç¤â»È¤¤¤ä¤¹¤¤¡£";
+                       info[i++] = "¤½¤ì¤Ï¾èÇÏÃæ¤Ç¤â»È¤¤¤ä¤¹¤¤¡£";
 #else
                        info[i++] = "It is suitable for use while riding.";
 #endif
-
+                       /* This information is not important enough */
+                       trivial_info++;
+               }
        }
        if (have_flag(flgs, TR_STR))
        {
@@ -3595,6 +3594,11 @@ info[i++] = "
                        info[i++] = "It is cursed.";
 #endif
 
+                       /*
+                        * It's a trivial infomation since there is
+                        * fake inscription {cursed}
+                        */
+                       trivial_info++;
                }
        }
 
@@ -3851,8 +3855,8 @@ info[i++] = "
                }
        }
 
-       /* No special effects */
-       if (!i) return (FALSE);
+       /* No relevant informations */
+       if (i <= trivial_info) return (FALSE);
 
        /* Save the screen */
        screen_save();
@@ -3862,9 +3866,9 @@ info[i++] = "
 
        /* Display Item name */
        if (real)
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
        else
-               object_desc_store(o_name, o_ptr, TRUE, 0);
+               object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
 
        prt(o_name, 0, 0);
 
@@ -4219,13 +4223,13 @@ cptr describe_use(int i)
        switch (i)
        {
 #ifdef JP
-case INVEN_RARM: p = p_ptr->ryoute ? " Î¾¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : (left_hander ? " º¸¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : " ±¦¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë"); break;
+case INVEN_RARM: p = p_ptr->ryoute ? "ξ¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : (left_hander ? "º¸¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : "±¦¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë"); break;
 #else
                case INVEN_RARM: p = "attacking monsters with"; break;
 #endif
 
 #ifdef JP
-case INVEN_LARM:   p = (left_hander ? " ±¦¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : " º¸¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë"); break;
+case INVEN_LARM:   p = (left_hander ? "±¦¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : "º¸¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë"); break;
 #else
                case INVEN_LARM:   p = "wearing on your arm"; break;
 #endif
@@ -4444,7 +4448,7 @@ void display_inven(void)
                Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
 
                /* Obtain an item description */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
 
                /* Obtain the length of the description */
                n = strlen(o_name);
@@ -4537,7 +4541,7 @@ void display_equip(void)
                }
                else
                {
-                       object_desc(o_name, o_ptr, TRUE, 3);
+                       object_desc(o_name, o_ptr, 0);
                        attr = tval_to_attr[o_ptr->tval % 128];
                }
 
@@ -4586,7 +4590,6 @@ void display_equip(void)
 }
 
 
-
 /*
  * Find the "first" inventory object with the given "tag".
  *
@@ -4597,16 +4600,32 @@ void display_equip(void)
  * Also, the tag "@xn" will work as well, where "n" is a any tag-char,
  * and "x" is the "current" command_cmd code.
  */
-static int get_tag(int *cp, char tag)
+static bool get_tag(int *cp, char tag, int mode)
 {
-       int i;
+       int i, start, end;
        cptr s;
 
+       /* Extract index from mode */
+       switch (mode)
+       {
+       case USE_EQUIP:
+               start = INVEN_RARM;
+               end = INVEN_TOTAL - 1;
+               break;
+
+       case USE_INVEN:
+               start = 0;
+               end = INVEN_PACK - 1;
+               break;
+
+       default:
+               return FALSE;
+       }
 
        /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
 
-       /* Check every object */
-       for (i = 0; i < INVEN_TOTAL; ++i)
+       /* Check every inventory object */
+       for (i = start; i <= end; i++)
        {
                object_type *o_ptr = &inventory[i];
 
@@ -4620,7 +4639,7 @@ static int get_tag(int *cp, char tag)
                if (!item_tester_okay(o_ptr)) continue;
 
                /* Find a '@' */
-               s = strchr(quark_str(o_ptr->inscription), '@');
+               s = my_strchr(quark_str(o_ptr->inscription), '@');
 
                /* Process all tags */
                while (s)
@@ -4636,7 +4655,7 @@ static int get_tag(int *cp, char tag)
                        }
 
                        /* Find another '@' */
-                       s = strchr(s + 1, '@');
+                       s = my_strchr(s + 1, '@');
                }
        }
 
@@ -4651,7 +4670,7 @@ static int get_tag(int *cp, char tag)
        }
 
        /* Check every object */
-       for (i = 0; i < INVEN_TOTAL; ++i)
+       for (i = start; i <= end; i++)
        {
                object_type *o_ptr = &inventory[i];
 
@@ -4665,7 +4684,7 @@ static int get_tag(int *cp, char tag)
                if (!item_tester_okay(o_ptr)) continue;
 
                /* Find a '@' */
-               s = strchr(quark_str(o_ptr->inscription), '@');
+               s = my_strchr(quark_str(o_ptr->inscription), '@');
 
                /* Process all tags */
                while (s)
@@ -4681,7 +4700,7 @@ static int get_tag(int *cp, char tag)
                        }
 
                        /* Find another '@' */
-                       s = strchr(s + 1, '@');
+                       s = my_strchr(s + 1, '@');
                }
        }
 
@@ -4690,6 +4709,156 @@ static int get_tag(int *cp, char tag)
 }
 
 
+/*
+ * Find the "first" floor object with the given "tag".
+ *
+ * A "tag" is a numeral "n" appearing as "@n" anywhere in the
+ * inscription of an object.  Alphabetical characters don't work as a
+ * tag in this form.
+ *
+ * Also, the tag "@xn" will work as well, where "n" is a any tag-char,
+ * and "x" is the "current" command_cmd code.
+ */
+static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
+{
+       int i;
+       cptr s;
+
+       /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
+
+       /* Check every object in the grid */
+       for (i = 0; i < floor_num && i < 23; i++)
+       {
+               object_type *o_ptr = &o_list[floor_list[i]];
+
+               /* Skip empty inscriptions */
+               if (!o_ptr->inscription) continue;
+
+               /* Find a '@' */
+               s = my_strchr(quark_str(o_ptr->inscription), '@');
+
+               /* Process all tags */
+               while (s)
+               {
+                       /* Check the special tags */
+                       if ((s[1] == command_cmd) && (s[2] == tag))
+                       {
+                               /* Save the actual floor object ID */
+                               *cp = i;
+
+                               /* Success */
+                               return (TRUE);
+                       }
+
+                       /* Find another '@' */
+                       s = my_strchr(s + 1, '@');
+               }
+       }
+
+
+       /**** Find a tag in the form of {@#} (allows only numerals)  ***/
+
+       /* Don't allow {@#} with '#' being alphabet */
+       if (tag < '0' || '9' < tag)
+       {
+               /* No such tag */
+               return FALSE;
+       }
+
+       /* Check every object in the grid */
+       for (i = 0; i < floor_num && i < 23; i++)
+       {
+               object_type *o_ptr = &o_list[floor_list[i]];
+
+               /* Skip empty inscriptions */
+               if (!o_ptr->inscription) continue;
+
+               /* Find a '@' */
+               s = my_strchr(quark_str(o_ptr->inscription), '@');
+
+               /* Process all tags */
+               while (s)
+               {
+                       /* Check the normal tags */
+                       if (s[1] == tag)
+                       {
+                               /* Save the floor object ID */
+                               *cp = i;
+
+                               /* Success */
+                               return (TRUE);
+                       }
+
+                       /* Find another '@' */
+                       s = my_strchr(s + 1, '@');
+               }
+       }
+
+       /* No such tag */
+       return (FALSE);
+}
+
+
+/*
+ * Move around label characters with correspond tags
+ */
+static void prepare_label_string(char *label, int mode)
+{
+       cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+       int  offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
+       int  i;
+
+       /* Prepare normal labels */
+       strcpy(label, alphabet_chars);
+
+       /* Move each label */
+       for (i = 0; i < 52; i++)
+       {
+               int index;
+               char c = alphabet_chars[i];
+
+               /* Find a tag with this label */
+               if (get_tag(&index, c, mode))
+               {
+                       /* Delete the overwritten label */
+                       if (label[i] == c) label[i] = ' ';
+
+                       /* Move the label to the place of corresponding tag */
+                       label[index - offset] = c;
+               }
+       }
+}
+
+
+/*
+ * Move around label characters with correspond tags (floor version)
+ */
+static void prepare_label_string_floor(char *label, int floor_list[], int floor_num)
+{
+       cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+       int  i;
+
+       /* Prepare normal labels */
+       strcpy(label, alphabet_chars);
+
+       /* Move each label */
+       for (i = 0; i < 52; i++)
+       {
+               int index;
+               char c = alphabet_chars[i];
+
+               /* Find a tag with this label */
+               if (get_tag_floor(&index, c, floor_list, floor_num))
+               {
+                       /* Delete the overwritten label */
+                       if (label[i] == c) label[i] = ' ';
+
+                       /* Move the label to the place of corresponding tag */
+                       label[index] = c;
+               }
+       }
+}
+
 
 /*
  * Display the inventory.
@@ -4698,7 +4867,6 @@ static int get_tag(int *cp, char tag)
  */
 int show_inven(int target_item)
 {
-       cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        int             i, j, k, l, z = 0;
        int             col, cur_col, len;
        object_type     *o_ptr;
@@ -4709,9 +4877,7 @@ 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 */
+       char            inven_label[52 + 1];
 
        /* Starting column */
        col = command_gap;
@@ -4735,28 +4901,7 @@ int show_inven(int target_item)
                z = i + 1;
        }
 
-       /*** Move around label characters with correspond tags ***/
-
-       /* Prepare normal labels */
-       strcpy(inven_spellbook_label, alphabet_chars);
-
-       /* Move each label */
-       for (i = 0; i < 52; i++)
-       {
-               int index;
-               char c = alphabet_chars[i];
-
-               /* Find a tag with this label */
-               if (get_tag(&index, c))
-               {
-                       /* Delete the over writen label */
-                       if (inven_spellbook_label[i] == c)
-                               inven_spellbook_label[i] = ' ';
-
-                       /* Move the label to the place of correspond tag */
-                       inven_spellbook_label[index] = c;
-               }
-       }
+       prepare_label_string(inven_label, USE_INVEN);
 
        /* Display the inventory */
        for (k = 0, i = 0; i < z; i++)
@@ -4767,7 +4912,7 @@ int show_inven(int target_item)
                if (!item_tester_okay(o_ptr)) continue;
 
                /* Describe the object */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
 
                /* Save the object index, color, and description */
                out_index[k] = i;
@@ -4831,7 +4976,8 @@ int show_inven(int target_item)
                }
                else if (i <= INVEN_PACK)
                {
-                       sprintf(tmp_val, "%c)", inven_spellbook_label[i]);
+                       /* Prepare an index --(-- */
+                       sprintf(tmp_val, "%c)", inven_label[i]);
                }
                else
                {
@@ -4854,13 +5000,9 @@ int show_inven(int target_item)
                        if (a & 0x80) a |= 0x40;
 #endif
 
-                       Term_draw(cur_col, j + 1, a, c);
-                       if (use_bigtile)
-                       {
-                               cur_col++;
-                               if (a & 0x80)
-                                       Term_draw(cur_col, j + 1, 255, -1);
-                       }
+                       Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
+                       if (use_bigtile) cur_col++;
+
                        cur_col += 2;
                }
 
@@ -4908,7 +5050,7 @@ int show_equip(int target_item)
        char            out_desc[23][MAX_NLEN];
        int             target_item_label = 0;
        int             wid, hgt;
-
+       char            equip_label[52 + 1];
 
        /* Starting column */
        col = command_gap;
@@ -4929,7 +5071,7 @@ int show_equip(int target_item)
                if (!item_tester_okay(o_ptr) && (!((i == INVEN_LARM) && p_ptr->ryoute) || item_tester_no_ryoute)) continue;
 
                /* Description */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
 
                if ((i == INVEN_LARM) && p_ptr->ryoute)
                {
@@ -4988,6 +5130,7 @@ int show_equip(int target_item)
        col = (len > wid - 4) ? 0 : (wid - len - 1);
 #endif
 
+       prepare_label_string(equip_label, USE_EQUIP);
 
        /* Output each entry */
        for (j = 0; j < k; j++)
@@ -5014,9 +5157,16 @@ int show_equip(int target_item)
                        }
                        else strcpy(tmp_val, "  ");
                }
-               else
+               else if (i >= INVEN_RARM)
+               {
+                       /* Prepare an index --(-- */
+                       sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
+               }
+               else /* Paranoia */
+               {
                        /* 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);
@@ -5033,13 +5183,9 @@ int show_equip(int target_item)
                        if (a & 0x80) a |= 0x40;
 #endif
 
-                       Term_draw(cur_col, j + 1, a, c);
-                       if (use_bigtile)
-                       {
-                               cur_col++;
-                               if (a & 0x80)
-                                       Term_draw(cur_col, j + 1, 255, -1);
-                       }
+                       Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
+                       if (use_bigtile) cur_col++;
+
                        cur_col += 2;
                }
 
@@ -5160,7 +5306,7 @@ static bool verify(cptr prompt, int item)
        }
 
        /* Describe */
-       object_desc(o_name, o_ptr, TRUE, 3);
+       object_desc(o_name, o_ptr, 0);
 
        /* Prompt */
 #ifdef JP
@@ -5186,6 +5332,8 @@ static bool get_item_allow(int item)
 
        object_type *o_ptr;
 
+       if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
+
        /* Inventory */
        if (item >= 0)
        {
@@ -5202,7 +5350,7 @@ static bool get_item_allow(int item)
        if (!o_ptr->inscription) return (TRUE);
 
        /* Find a '!' */
-       s = strchr(quark_str(o_ptr->inscription), '!');
+       s = my_strchr(quark_str(o_ptr->inscription), '!');
 
        /* Process preventions */
        while (s)
@@ -5220,7 +5368,7 @@ if (!verify("
                }
 
                /* Find another '!' */
-               s = strchr(s + 1, '!');
+               s = my_strchr(s + 1, '!');
        }
 
        /* Allow it */
@@ -5356,13 +5504,17 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        /* Get the item index */
        if (repeat_pull(cp))
        {
-               if (*cp == INVEN_FORCE) { /* the_force */
-                   item_tester_tval = 0;
-                   item_tester_hook = NULL;
-                   return (TRUE);
-               } else
+               /* the_force */
+               if (*cp == INVEN_FORCE)
+               {
+                       item_tester_tval = 0;
+                       item_tester_hook = NULL;
+                       command_cmd = 0; /* Hack -- command_cmd is no longer effective */
+                       return (TRUE);
+               }
+
                /* Floor item? */
-               if (*cp < 0)
+               else if (*cp < 0)
                {
                        object_type *o_ptr;
 
@@ -5381,6 +5533,8 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                                /* Forget the item_tester_hook restriction */
                                item_tester_hook = NULL;
 
+                               command_cmd = 0; /* Hack -- command_cmd is no longer effective */
+
                                /* Success */
                                return (TRUE);
                        }
@@ -5395,6 +5549,8 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                        /* Forget the item_tester_hook restriction */
                        item_tester_hook = NULL;
 
+                       command_cmd = 0; /* Hack -- command_cmd is no longer effective */
+
                        /* Success */
                        return (TRUE);
                }
@@ -5497,7 +5653,6 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        {
                /* Hack -- Start on equipment if requested */
                if (command_see && command_wrk && equip)
-
                {
                        command_wrk = TRUE;
                }
@@ -5541,41 +5696,39 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                int get_item_label = 0;
 
                /* Show choices */
-               if (show_choices)
+               int ni = 0;
+               int ne = 0;
+
+               /* Scan windows */
+               for (j = 0; j < 8; j++)
                {
-                       int ni = 0;
-                       int ne = 0;
+                       /* Unused */
+                       if (!angband_term[j]) continue;
 
-                       /* Scan windows */
-                       for (j = 0; j < 8; j++)
-                       {
-                               /* Unused */
-                               if (!angband_term[j]) continue;
+                       /* Count windows displaying inven */
+                       if (window_flag[j] & (PW_INVEN)) ni++;
 
-                               /* Count windows displaying inven */
-                               if (window_flag[j] & (PW_INVEN)) ni++;
+                       /* Count windows displaying equip */
+                       if (window_flag[j] & (PW_EQUIP)) ne++;
+               }
 
-                               /* Count windows displaying equip */
-                               if (window_flag[j] & (PW_EQUIP)) ne++;
-                       }
+               /* Toggle if needed */
+               if ((command_wrk && ni && !ne) ||
+                   (!command_wrk && !ni && ne))
+               {
+                       /* Toggle */
+                       toggle_inven_equip();
 
-                       /* Toggle if needed */
-                       if ((command_wrk && ni && !ne) ||
-                           (!command_wrk && !ni && ne))
-                       {
-                               /* Toggle */
-                               toggle_inven_equip();
+                       /* Track toggles */
+                       toggle = !toggle;
+               }
 
-                               /* Track toggles */
-                               toggle = !toggle;
-                       }
+               /* Update */
+               p_ptr->window |= (PW_INVEN | PW_EQUIP);
 
-                       /* Update */
-                       p_ptr->window |= (PW_INVEN | PW_EQUIP);
+               /* Redraw windows */
+               window_stuff();
 
-                       /* Redraw windows */
-                       window_stuff();
-               }
 
                /* Inventory screen */
                if (!command_wrk)
@@ -5931,7 +6084,7 @@ if (other_query_flag && !verify("
                        case '7': case '8': case '9':
                        {
                                /* Look up the tag */
-                               if (!get_tag(&k, which))
+                               if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
                                {
                                        bell();
                                        break;
@@ -6021,19 +6174,19 @@ if (other_query_flag && !verify("
                                bool not_found = FALSE;
 
                                /* Look up the alphabetical tag */
-                               if (!get_tag(&k, which))
+                               if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
                                {
                                        not_found = TRUE;
                                }
 
                                /* Hack -- Validate the item */
-                               if ((k < INVEN_RARM) ? !inven : !equip)
+                               else if ((k < INVEN_RARM) ? !inven : !equip)
                                {
                                        not_found = TRUE;
                                }
 
                                /* Validate the item */
-                               if (!get_item_okay(k))
+                               else if (!get_item_okay(k))
                                {
                                        not_found = TRUE;
                                }
@@ -6124,18 +6277,15 @@ if (ver && !verify("
        item_tester_hook = NULL;
 
 
-       /* Clean up */
-       if (show_choices)
-       {
-               /* Toggle again if needed */
-               if (toggle) toggle_inven_equip();
+       /* Clean up  'show choices' */
+       /* Toggle again if needed */
+       if (toggle) toggle_inven_equip();
 
-               /* Update */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
+       /* Update */
+       p_ptr->window |= (PW_INVEN | PW_EQUIP);
 
-               /* Window stuff */
-               window_stuff();
-       }
+       /* Window stuff */
+       window_stuff();
 
 
        /* Clear the prompt line */
@@ -6144,10 +6294,15 @@ if (ver && !verify("
        /* Warning if needed */
        if (oops && str) msg_print(str);
 
+       if (item)
+       {
 #ifdef ALLOW_REPEAT
-       if (item) repeat_push(*cp);
+               repeat_push(*cp);
 #endif /* ALLOW_REPEAT */
 
+               command_cmd = 0; /* Hack -- command_cmd is no longer effective */
+       }
+
        /* Result */
        return (item);
 }
@@ -6206,6 +6361,7 @@ int scan_floor(int *items, int y, int x, int mode)
        return num;
 }
 
+
 /*
  * Display a list of the items on the floor at the given location.
  */
@@ -6227,6 +6383,7 @@ int show_floor(int target_item, int y, int x, int *min_width)
 
        int floor_list[23], floor_num;
        int wid, hgt;
+       char floor_label[52 + 1];
 
        /* Get size */
        Term_get_size(&wid, &hgt);
@@ -6238,13 +6395,13 @@ int show_floor(int target_item, int y, int x, int *min_width)
        /* Scan for objects in the grid, using item_tester_okay() */
        floor_num = scan_floor(floor_list, y, x, 0x01);
 
-       /* Display the inventory */
+       /* Display the floor objects */
        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);
+               object_desc(o_name, o_ptr, 0);
 
                /* Save the index */
                out_index[k] = i;
@@ -6274,6 +6431,8 @@ int show_floor(int target_item, int y, int x, int *min_width)
        /* Find the column to start in */
        col = (len > wid - 4) ? 0 : (wid - len - 1);
 
+       prepare_label_string_floor(floor_label, floor_list, floor_num);
+
        /* Output each entry */
        for (j = 0; j < k; j++)
        {
@@ -6300,8 +6459,10 @@ int show_floor(int target_item, int y, int x, int *min_width)
                        else strcpy(tmp_val, "   ");
                }
                else
+               {
                        /* Prepare an index --(-- */
-                       sprintf(tmp_val, "%c)", index_to_label(j));
+                       sprintf(tmp_val, "%c)", floor_label[j]);
+               }
 
                /* Clear the line with the (possibly indented) index */
                put_str(tmp_val, j + 1, col);
@@ -6370,13 +6531,17 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        /* Get the item index */
        if (repeat_pull(cp))
        {
-               if (*cp == INVEN_FORCE) { /* the_force */
-                   item_tester_tval = 0;
-                   item_tester_hook = NULL;
-                   return (TRUE);
-               } else
+               /* the_force */
+               if (*cp == INVEN_FORCE)
+               {
+                       item_tester_tval = 0;
+                       item_tester_hook = NULL;
+                       command_cmd = 0; /* Hack -- command_cmd is no longer effective */
+                       return (TRUE);
+               }
+
                /* Floor item? */
-               if (*cp < 0)
+               else if (*cp < 0)
                {
                        object_type *o_ptr;
 
@@ -6395,6 +6560,8 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                /* Forget the item_tester_hook restriction */
                                item_tester_hook = NULL;
 
+                               command_cmd = 0; /* Hack -- command_cmd is no longer effective */
+
                                /* Success */
                                return (TRUE);
                        }
@@ -6409,6 +6576,8 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        /* Forget the item_tester_hook restriction */
                        item_tester_hook = NULL;
 
+                       command_cmd = 0; /* Hack -- command_cmd is no longer effective */
+
                        /* Success */
                        return (TRUE);
                }
@@ -6552,41 +6721,38 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                int get_item_label = 0;
 
                /* Show choices */
-               if (show_choices)
-               {
-                       int ni = 0;
-                       int ne = 0;
+               int ni = 0;
+               int ne = 0;
 
-                       /* Scan windows */
-                       for (j = 0; j < 8; j++)
-                       {
-                               /* Unused */
-                               if (!angband_term[j]) continue;
+               /* Scan windows */
+               for (j = 0; j < 8; j++)
+               {
+                       /* Unused */
+                       if (!angband_term[j]) continue;
 
-                               /* Count windows displaying inven */
-                               if (window_flag[j] & (PW_INVEN)) ni++;
+                       /* Count windows displaying inven */
+                       if (window_flag[j] & (PW_INVEN)) ni++;
 
-                               /* Count windows displaying equip */
-                               if (window_flag[j] & (PW_EQUIP)) ne++;
-                       }
+                       /* Count windows displaying equip */
+                       if (window_flag[j] & (PW_EQUIP)) ne++;
+               }
 
-                       /* Toggle if needed */
-                       if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
-                               (command_wrk == (USE_INVEN) && !ni && ne))
-                       {
-                               /* Toggle */
-                               toggle_inven_equip();
+               /* Toggle if needed */
+               if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
+                   (command_wrk == (USE_INVEN) && !ni && ne))
+               {
+                       /* Toggle */
+                       toggle_inven_equip();
 
-                               /* Track toggles */
-                               toggle = !toggle;
-                       }
+                       /* Track toggles */
+                       toggle = !toggle;
+               }
 
-                       /* Update */
-                       p_ptr->window |= (PW_INVEN | PW_EQUIP);
+               /* Update */
+               p_ptr->window |= (PW_INVEN | PW_EQUIP);
 
-                       /* Redraw windows */
-                       window_stuff();
-               }
+               /* Redraw windows */
+               window_stuff();
 
                /* Inventory screen */
                if (command_wrk == (USE_INVEN))
@@ -7277,25 +7443,42 @@ if (!command_see && !use_menu) strcat(out_val, " '*'
                        case '4': case '5': case '6':
                        case '7': case '8': case '9':
                        {
-                               /* Look up the tag */
-                               if (!get_tag(&k, which))
+                               if (command_wrk != USE_FLOOR)
                                {
-                                       bell();
-                                       break;
-                               }
+                                       /* Look up the tag */
+                                       if (!get_tag(&k, which, command_wrk))
+                                       {
+                                               bell();
+                                               break;
+                                       }
 
-                               /* Hack -- Validate the item */
-                               if ((k < INVEN_RARM) ? !inven : !equip)
-                               {
-                                       bell();
-                                       break;
-                               }
+                                       /* Hack -- Validate the item */
+                                       if ((k < INVEN_RARM) ? !inven : !equip)
+                                       {
+                                               bell();
+                                               break;
+                                       }
 
-                               /* Validate the item */
-                               if (!get_item_okay(k))
+                                       /* Validate the item */
+                                       if (!get_item_okay(k))
+                                       {
+                                               bell();
+                                               break;
+                                       }
+                               }
+                               else
                                {
-                                       bell();
-                                       break;
+                                       /* Look up the alphabetical tag */
+                                       if (get_tag_floor(&k, which, floor_list, floor_num))
+                                       {
+                                               /* Special index */
+                                               k = 0 - floor_list[k];
+                                       }
+                                       else
+                                       {
+                                               bell();
+                                               break;
+                                       }
                                }
 
                                /* Allow player to "refuse" certain actions */
@@ -7381,38 +7564,59 @@ if (!command_see && !use_menu) strcat(out_val, " '*'
                                        done = TRUE;
                                        break;
                                }
+
+                               /* Fall through */
                        }
 
                        default:
                        {
                                int ver;
-                               bool not_found = FALSE;
 
-                               /* Look up the alphabetical tag */
-                               if (!get_tag(&k, which))
+                               if (command_wrk != USE_FLOOR)
                                {
-                                       not_found = TRUE;
-                               }
+                                       bool not_found = FALSE;
 
-                               /* Hack -- Validate the item */
-                               if ((k < INVEN_RARM) ? !inven : !equip)
-                               {
-                                       not_found = TRUE;
-                               }
+                                       /* Look up the alphabetical tag */
+                                       if (!get_tag(&k, which, command_wrk))
+                                       {
+                                               not_found = TRUE;
+                                       }
 
-                               /* Validate the item */
-                               if (!get_item_okay(k))
-                               {
-                                       not_found = TRUE;
-                               }
+                                       /* Hack -- Validate the item */
+                                       else if ((k < INVEN_RARM) ? !inven : !equip)
+                                       {
+                                               not_found = TRUE;
+                                       }
 
-                               if (!not_found)
+                                       /* Validate the item */
+                                       else if (!get_item_okay(k))
+                                       {
+                                               not_found = TRUE;
+                                       }
+
+                                       if (!not_found)
+                                       {
+                                               /* Accept that choice */
+                                               (*cp) = k;
+                                               item = TRUE;
+                                               done = TRUE;
+                                               break;
+                                       }
+                               }
+                               else
                                {
-                                       /* Accept that choice */
-                                       (*cp) = k;
-                                       item = TRUE;
-                                       done = TRUE;
-                                       break;
+                                       /* Look up the alphabetical tag */
+                                       if (get_tag_floor(&k, which, floor_list, floor_num))
+                                       {
+                                               /* Special index */
+                                               k = 0 - floor_list[k];
+
+                                               /* Accept that choice */
+                                               (*cp) = k;
+                                               item = TRUE;
+                                               done = TRUE;
+                                               break;
+                                       }
                                }
 
                                /* Extract "query" setting */
@@ -7505,18 +7709,15 @@ if (ver && !verify("
        item_tester_hook = NULL;
 
 
-       /* Clean up */
-       if (show_choices)
-       {
-               /* Toggle again if needed */
-               if (toggle) toggle_inven_equip();
+       /* Clean up  'show choices' */
+       /* Toggle again if needed */
+       if (toggle) toggle_inven_equip();
 
-               /* Update */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
+       /* Update */
+       p_ptr->window |= (PW_INVEN | PW_EQUIP);
 
-               /* Window stuff */
-               window_stuff();
-       }
+       /* Window stuff */
+       window_stuff();
 
 
        /* Clear the prompt line */
@@ -7525,10 +7726,15 @@ if (ver && !verify("
        /* Warning if needed */
        if (oops && str) msg_print(str);
 
+       if (item)
+       {
 #ifdef ALLOW_REPEAT
-       if (item) repeat_push(*cp);
+               repeat_push(*cp);
 #endif /* ALLOW_REPEAT */
 
+               command_cmd = 0; /* Hack -- command_cmd is no longer effective */
+       }
+
        /* Result */
        return (item);
 }
@@ -7577,7 +7783,7 @@ static bool py_pickup_floor_aux(void)
  *
  * This is called by py_pickup() when easy_floor is TRUE.
  */
-void py_pickup_floor(int pickup)
+void py_pickup_floor(bool pickup)
 {
        s16b this_o_idx, next_o_idx = 0;
 
@@ -7597,7 +7803,7 @@ void py_pickup_floor(int pickup)
                o_ptr = &o_list[this_o_idx];
 
                /* Describe the object */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
 
                /* Access the next object */
                next_o_idx = o_ptr->next_o_idx;
@@ -7683,7 +7889,7 @@ void py_pickup_floor(int pickup)
 #endif /* ALLOW_EASY_SENSE */
 
                        /* Describe the object */
-                       object_desc(o_name, o_ptr, TRUE, 3);
+                       object_desc(o_name, o_ptr, 0);
 
                        /* Message */
 #ifdef JP
@@ -7731,7 +7937,7 @@ void py_pickup_floor(int pickup)
 #endif /* ALLOW_EASY_SENSE */
 
                        /* Describe the object */
-                       object_desc(o_name, o_ptr, TRUE, 3);
+                       object_desc(o_name, o_ptr, 0);
 
                        /* Message */
 #ifdef JP
@@ -7781,7 +7987,7 @@ void py_pickup_floor(int pickup)
 #endif /* ALLOW_EASY_SENSE */
 
                        /* Describe the object */
-                       object_desc(o_name, o_ptr, TRUE, 3);
+                       object_desc(o_name, o_ptr, 0);
 
                        /* Build a prompt */
 #ifdef JP