OSDN Git Service

[Refactor] #37353 snipe_type をグローバル変数から、引数へ置換 / Replace snipe_type from global to...
[hengband/hengband.git] / src / object1.c
index 49246e4..f90a0d0 100644 (file)
  */
 
 #include "angband.h"
+#include "artifact.h"
+#include "cmd-activate.h"
+#include "object-hook.h"
+#include "player-move.h"
 
 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
 #ifdef verify
@@ -29,9 +33,9 @@
  * flag.  This is useful for switching "graphics" on/off.\n
  *\n
  * The features, objects, and monsters, should all be encoded in the\n
- * relevant "font.pref" and/or "graf.prf" files.  XXX XXX XXX\n
+ * relevant "font.pref" and/or "graf.prf" files.  \n
  *\n
- * The "prefs" parameter is no longer meaningful.  XXX XXX XXX\n
+ * The "prefs" parameter is no longer meaningful.  \n
  */
 void reset_visuals(void)
 {
@@ -107,7 +111,7 @@ void reset_visuals(void)
  * @param flgs フラグ情報を受け取る配列
  * @return なし
  */
-void object_flags(object_type *o_ptr, u32b flgs[TR_FLAG_SIZE])
+void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        object_kind *k_ptr = &k_info[o_ptr->k_idx];
        int i;
@@ -216,7 +220,7 @@ void object_flags(object_type *o_ptr, u32b flgs[TR_FLAG_SIZE])
  * @param flgs フラグ情報を受け取る配列
  * @return なし
  */
-void object_flags_known(object_type *o_ptr, u32b flgs[TR_FLAG_SIZE])
+void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        bool spoil = FALSE;
        int i;
@@ -339,12 +343,12 @@ void object_flags_known(object_type *o_ptr, u32b flgs[TR_FLAG_SIZE])
 /*!
  * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
  * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
- * @return cptr 発動名称を返す文字列ポインタ
+ * @return concptr 発動名称を返す文字列ポインタ
  */
-static cptr item_activation_dragon_breath(object_type *o_ptr)
+static concptr item_activation_dragon_breath(object_type *o_ptr)
 {
        static char desc[256];
-       u32b flgs[TR_FLAG_SIZE]; /* for resistance flags */
+       BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
        int i, n = 0;
 
        object_flags(o_ptr, flgs);
@@ -368,12 +372,12 @@ static cptr item_activation_dragon_breath(object_type *o_ptr)
 /*!
  * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
  * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
- * @return cptr 発動名称を返す文字列ポインタ
+ * @return concptr 発動名称を返す文字列ポインタ
  */
-static cptr item_activation_aux(object_type *o_ptr)
+static concptr item_activation_aux(object_type *o_ptr)
 {
        static char activation_detail[256];
-       cptr desc;
+       concptr desc;
        char timeout[32];
        int constant, dice;
        const activation_type* const act_ptr = find_activation_info(o_ptr);
@@ -425,8 +429,8 @@ static cptr item_activation_aux(object_type *o_ptr)
        constant = act_ptr->timeout.constant;
        dice = act_ptr->timeout.dice;
        if (constant == 0 && dice == 0) {
-               /* We can activate it every turn */
-               strcpy(timeout, _("いつでも", "every turn"));
+               /* We can activate it every current_world_ptr->game_turn */
+               strcpy(timeout, _("いつでも", "every current_world_ptr->game_turn"));
        } else if (constant < 0) {
                /* Activations that have special timeout */
                switch (act_ptr->index) {
@@ -469,13 +473,11 @@ static cptr item_activation_aux(object_type *o_ptr)
  * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
  * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
  * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
- * @return cptr 発動名称を返す文字列ポインタ
+ * @return concptr 発動名称を返す文字列ポインタ
  */
-cptr item_activation(object_type *o_ptr)
+concptr item_activation(object_type *o_ptr)
 {
-       u32b flgs[TR_FLAG_SIZE];
-
-       /* Extract the flags */
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
        object_flags(o_ptr, flgs);
 
        /* Require activation ability */
@@ -498,7 +500,6 @@ cptr item_activation(object_type *o_ptr)
                return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
        }
 
-       /* Oops */
        return _("何も起きない", "Nothing");
 }
 
@@ -510,22 +511,20 @@ cptr item_activation(object_type *o_ptr)
  * @param mode 表示オプション
  * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
  */
-bool screen_object(object_type *o_ptr, u32b mode)
+bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
 {
-       int                     i = 0, j, k;
+       int i = 0, j, k;
 
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
 
        char temp[70 * 20];
-       cptr            info[128];
-       char o_name[MAX_NLEN];
+       concptr            info[128];
+       GAME_TEXT o_name[MAX_NLEN];
        int wid, hgt;
-       int rad;
+       POSITION rad;
        char desc[256];
 
        int trivial_info = 0;
-
-       /* Extract the flags */
        object_flags(o_ptr, flgs);
 
        /* Extract the description */
@@ -560,7 +559,7 @@ bool screen_object(object_type *o_ptr, u32b mode)
        /* Figurines, a hack */
        if (o_ptr->name1 == ART_STONEMASK)
        {
-               info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you turn into a vampire permanently.");
+               info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you current_world_ptr->game_turn into a vampire permanently.");
        }
 
        if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
@@ -627,12 +626,12 @@ bool screen_object(object_type *o_ptr, u32b mode)
                
        if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
        {
-               if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), rad);        
+               if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);   
        }
        else
        {
-               if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), rad);        
-               if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), -rad);
+               if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
+               if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
        }
        
        if(rad != 0) info[i++] = desc;
@@ -1234,11 +1233,8 @@ bool screen_object(object_type *o_ptr, u32b mode)
 
        /* No relevant informations */
        if (i <= trivial_info) return (FALSE);
-
-       /* Save the screen */
        screen_save();
 
-       /* Get size */
        Term_get_size(&wid, &hgt);
 
        /* Display Item name */
@@ -1285,8 +1281,6 @@ bool screen_object(object_type *o_ptr, u32b mode)
        prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
 
        inkey();
-
-       /* Restore the screen */
        screen_load();
 
        /* Gave knowledge */
@@ -1317,12 +1311,12 @@ char index_to_label(int i)
  * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
  * @details Note that the label does NOT distinguish inven/equip.
  */
-s16b label_to_inven(int c)
+INVENTORY_IDX label_to_inven(int c)
 {
-       int i;
+       INVENTORY_IDX i;
 
        /* Convert */
-       i = (islower(c) ? A2I(c) : -1);
+       i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
 
        /* Verify the index */
        if ((i < 0) || (i > INVEN_PACK)) return (-1);
@@ -1355,12 +1349,12 @@ static bool is_ring_slot(int i)
  * Convert a label into the index of a item in the "equip"
  * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
  */
-s16b label_to_equip(int c)
+INVENTORY_IDX label_to_equip(int c)
 {
-       int i;
+       INVENTORY_IDX i;
 
        /* Convert */
-       i = (islower(c) ? A2I(c) : -1) + INVEN_RARM;
+       i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
 
        /* Verify the index */
        if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
@@ -1470,9 +1464,9 @@ s16b wield_slot(object_type *o_ptr)
  * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
  * @return 部位表現の文字列ポインタ
  */
-cptr mention_use(int i)
+concptr mention_use(int i)
 {
-       cptr p;
+       concptr p;
 
        /* Examine the location */
        switch (i)
@@ -1489,24 +1483,9 @@ cptr mention_use(int i)
                case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
 #endif
 
-#ifdef JP
-               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "運搬中" : "射撃用"; break;
-#else
-               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "Just holding" : "Shooting"; break;
-#endif
-
-#ifdef JP
-               case INVEN_RIGHT: p = (left_hander ? "左手指" : "右手指"); break;
-#else
-               case INVEN_RIGHT: p = (left_hander ? "On left hand" : "On right hand"); break;
-#endif
-
-#ifdef JP
-               case INVEN_LEFT:  p = (left_hander ? "右手指" : "左手指"); break;
-#else
-               case INVEN_LEFT:  p = (left_hander ? "On right hand" : "On left hand"); break;
-#endif
-
+               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
+               case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
+               case INVEN_LEFT:  p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
                case INVEN_NECK:  p = _("  首", "Around neck"); break;
                case INVEN_LITE:  p = _(" 光源", "Light source"); break;
                case INVEN_BODY:  p = _("  体", "On body"); break;
@@ -1530,9 +1509,9 @@ cptr mention_use(int i)
  * @details
  * Currently, only used for items in the equipment, not inventory.
  */
-cptr describe_use(int i)
+concptr describe_use(int i)
 {
-       cptr p;
+       concptr p;
 
        switch (i)
        {
@@ -1548,24 +1527,9 @@ cptr describe_use(int i)
                case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
 #endif
 
-#ifdef JP
-               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "持つだけで精一杯の" : "射撃用に装備している"; break;
-#else
-               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "just holding" : "shooting missiles with"; break;
-#endif
-
-#ifdef JP
-               case INVEN_RIGHT: p = (left_hander ? "左手の指にはめている" : "右手の指にはめている"); break;
-#else
-               case INVEN_RIGHT: p = (left_hander ? "wearing on your left hand" : "wearing on your right hand"); break;
-#endif
-
-#ifdef JP
-               case INVEN_LEFT:  p = (left_hander ? "右手の指にはめている" : "左手の指にはめている"); break;
-#else
-               case INVEN_LEFT:  p = (left_hander ? "wearing on your right hand" : "wearing on your left hand"); break;
-#endif
-
+               case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
+               case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
+               case INVEN_LEFT:  p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
                case INVEN_NECK:  p = _("首にかけている", "wearing around your neck"); break;
                case INVEN_LITE:  p = _("光源にしている", "using to light the way"); break;
                case INVEN_BODY:  p = _("体に着ている", "wearing on your body"); break;
@@ -1589,7 +1553,7 @@ cptr describe_use(int i)
  * @return 使用可能な魔法書ならばTRUEを返す。
  */
 
-bool check_book_realm(const byte book_tval, const byte book_sval)
+bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
 {
        if (book_tval < TV_LIFE_BOOK) return FALSE;
        if (p_ptr->pclass == CLASS_SORCERER)
@@ -1613,7 +1577,7 @@ bool check_book_realm(const byte book_tval, const byte book_sval)
 bool item_tester_okay(object_type *o_ptr)
 {
        /* Hack -- allow listing empty slots */
-       if (item_tester_full) return (TRUE);
+       // if (item_tester_full) return (TRUE); // TODO:DELETE
 
        /* Require an item */
        if (!o_ptr->k_idx) return (FALSE);
@@ -1656,14 +1620,13 @@ bool item_tester_okay(object_type *o_ptr)
  */
 void display_inven(void)
 {
-       register        int i, n, z = 0;
-       object_type     *o_ptr;
-       byte            attr = TERM_WHITE;
-       char            tmp_val[80];
-       char            o_name[MAX_NLEN];
-       int             wid, hgt;
+       register int i, n, z = 0;
+       object_type *o_ptr;
+       TERM_COLOR attr = TERM_WHITE;
+       char tmp_val[80];
+       GAME_TEXT o_name[MAX_NLEN];
+       TERM_LEN wid, hgt;
 
-       /* Get size */
        Term_get_size(&wid, &hgt);
 
        /* Find the "final" slot */
@@ -1726,7 +1689,7 @@ void display_inven(void)
                {
                        int wgt = o_ptr->weight * o_ptr->number;
 #ifdef JP
-                       sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt),lbtokg2(wgt) );
+                       sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
 #else
                        sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
 #endif
@@ -1752,17 +1715,15 @@ void display_inven(void)
  */
 void display_equip(void)
 {
-       register        int i, n;
-       object_type     *o_ptr;
-       byte            attr = TERM_WHITE;
-       char            tmp_val[80];
-       char            o_name[MAX_NLEN];
-       int             wid, hgt;
+       register int i, n;
+       object_type *o_ptr;
+       TERM_COLOR attr = TERM_WHITE;
+       char tmp_val[80];
+       GAME_TEXT o_name[MAX_NLEN];
+       TERM_LEN wid, hgt;
 
-       /* Get size */
        Term_get_size(&wid, &hgt);
 
-       /* Display the equipment */
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
                /* Examine the item */
@@ -1856,10 +1817,11 @@ void display_equip(void)
  * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
  * and "x" is the "current" command_cmd code.\n
  */
-static bool get_tag(int *cp, char tag, int mode)
+static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
 {
-       int i, start, end;
-       cptr s;
+       COMMAND_CODE i;
+       COMMAND_CODE start, end;
+       concptr s;
 
        /* Extract index from mode */
        switch (mode)
@@ -1892,7 +1854,7 @@ static bool get_tag(int *cp, char tag, int mode)
                if (!o_ptr->inscription) continue;
 
                /* Skip non-choice */
-               if (!item_tester_okay(o_ptr)) continue;
+               if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
 
                /* Find a '@' */
                s = my_strchr(quark_str(o_ptr->inscription), '@');
@@ -1937,7 +1899,7 @@ static bool get_tag(int *cp, char tag, int mode)
                if (!o_ptr->inscription) continue;
 
                /* Skip non-choice */
-               if (!item_tester_okay(o_ptr)) continue;
+               if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
 
                /* Find a '@' */
                s = my_strchr(quark_str(o_ptr->inscription), '@');
@@ -1981,17 +1943,17 @@ static bool get_tag(int *cp, char tag, int mode)
  * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
  * and "x" is the "current" command_cmd code.\n
  */
-static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
+static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
 {
-       int i;
-       cptr s;
+       COMMAND_CODE i;
+       concptr 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]];
+               object_type *o_ptr = &current_floor_ptr->o_list[floor_list[i]];
 
                /* Skip empty inscriptions */
                if (!o_ptr->inscription) continue;
@@ -2030,7 +1992,7 @@ static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
        /* Check every object in the grid */
        for (i = 0; i < floor_num && i < 23; i++)
        {
-               object_type *o_ptr = &o_list[floor_list[i]];
+               object_type *o_ptr = &current_floor_ptr->o_list[floor_list[i]];
 
                /* Skip empty inscriptions */
                if (!o_ptr->inscription) continue;
@@ -2068,9 +2030,9 @@ static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
  * @param mode 所持品リストか装備品リストかの切り替え
  * @return なし
  */
-static void prepare_label_string(char *label, int mode)
+static void prepare_label_string(char *label, BIT_FLAGS mode)
 {
-       cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+       concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        int  offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
        int  i;
 
@@ -2080,8 +2042,8 @@ static void prepare_label_string(char *label, int mode)
        /* Move each label */
        for (i = 0; i < 52; i++)
        {
-               int index;
-               char c = alphabet_chars[i];
+               COMMAND_CODE index;
+               SYMBOL_CODE c = alphabet_chars[i];
 
                /* Find a tag with this label */
                if (get_tag(&index, c, mode))
@@ -2106,9 +2068,9 @@ static void prepare_label_string(char *label, int mode)
  */
 /*
  */
-static void prepare_label_string_floor(char *label, int floor_list[], int floor_num)
+static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
 {
-       cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+       concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        int  i;
 
        /* Prepare normal labels */
@@ -2117,8 +2079,8 @@ static void prepare_label_string_floor(char *label, int floor_list[], int floor_
        /* Move each label */
        for (i = 0; i < 52; i++)
        {
-               int index;
-               char c = alphabet_chars[i];
+               COMMAND_CODE index;
+               SYMBOL_CODE c = alphabet_chars[i];
 
                /* Find a tag with this label */
                if (get_tag_floor(&index, c, floor_list, floor_num))
@@ -2141,24 +2103,24 @@ static void prepare_label_string_floor(char *label, int floor_list[], int floor_
  * @details
  * Hack -- do not display "trailing" empty slots
  */
-int show_inven(int target_item)
+COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
 {
-       int             i, j, k, l, z = 0;
+       COMMAND_CODE i;
+       int j, k, l, z = 0;
        int             col, cur_col, len;
-       object_type     *o_ptr;
-       char            o_name[MAX_NLEN];
+       object_type *o_ptr;
+       GAME_TEXT o_name[MAX_NLEN];
        char            tmp_val[80];
-       int             out_index[23];
-       byte            out_color[23];
+       COMMAND_CODE    out_index[23];
+       TERM_COLOR      out_color[23];
        char            out_desc[23][MAX_NLEN];
-       int             target_item_label = 0;
-       int             wid, hgt;
-       char            inven_label[52 + 1];
+       COMMAND_CODE target_item_label = 0;
+       TERM_LEN wid, hgt;
+       char inven_label[52 + 1];
 
        /* Starting column */
        col = command_gap;
 
-       /* Get size */
        Term_get_size(&wid, &hgt);
 
        /* Default "max-length" */
@@ -2185,9 +2147,8 @@ int show_inven(int target_item)
                o_ptr = &inventory[i];
 
                /* Is this item acceptable? */
-               if (!item_tester_okay(o_ptr)) continue;
+               if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
 
-               /* Describe the object */
                object_desc(o_name, o_ptr, 0);
 
                /* Save the object index, color, and description */
@@ -2231,7 +2192,6 @@ int show_inven(int target_item)
                /* Get the index */
                i = out_index[j];
 
-               /* Get the item */
                o_ptr = &inventory[i];
 
                /* Clear the line */
@@ -2265,8 +2225,8 @@ int show_inven(int target_item)
                /* Display graphics for object, if desired */
                if (show_item_graph)
                {
-                       byte  a = object_attr(o_ptr);
-                       char c = object_char(o_ptr);
+                       TERM_COLOR a = object_attr(o_ptr);
+                       SYMBOL_CODE c = object_char(o_ptr);
                        Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
                        if (use_bigtile) cur_col++;
 
@@ -2307,24 +2267,24 @@ int show_inven(int target_item)
  * @param target_item アイテムの選択処理を行うか否か。
  * @return 選択したアイテムのタグ
  */
-int show_equip(int target_item)
+COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
 {
-       int             i, j, k, l;
+       COMMAND_CODE i;
+       int j, k, l;
        int             col, cur_col, len;
-       object_type     *o_ptr;
+       object_type *o_ptr;
        char            tmp_val[80];
-       char            o_name[MAX_NLEN];
-       int             out_index[23];
-       byte            out_color[23];
+       GAME_TEXT o_name[MAX_NLEN];
+       COMMAND_CODE    out_index[23];
+       TERM_COLOR      out_color[23];
        char            out_desc[23][MAX_NLEN];
-       int             target_item_label = 0;
-       int             wid, hgt;
+       COMMAND_CODE target_item_label = 0;
+       TERM_LEN wid, hgt;
        char            equip_label[52 + 1];
 
        /* Starting column */
        col = command_gap;
 
-       /* Get size */
        Term_get_size(&wid, &hgt);
 
        /* Maximal length */
@@ -2337,20 +2297,15 @@ int show_equip(int target_item)
                o_ptr = &inventory[i];
 
                /* Is this item acceptable? */
-               if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr)) &&
+               if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
                    (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
-                    item_tester_no_ryoute)) continue;
+                               (mode & IGNORE_BOTHHAND_SLOT))) continue;
 
-               /* Description */
                object_desc(o_name, o_ptr, 0);
 
                if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
                {
-#ifdef JP
-                       (void)strcpy(out_desc[k],"(武器を両手持ち)");
-#else
-                       (void)strcpy(out_desc[k],"(wielding with two-hands)");
-#endif
+                       (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
                        out_color[k] = TERM_WHITE;
                }
                else
@@ -2409,7 +2364,6 @@ int show_equip(int target_item)
                /* Get the index */
                i = out_index[j];
 
-               /* Get the item */
                o_ptr = &inventory[i];
 
                /* Clear the line */
@@ -2443,8 +2397,8 @@ int show_equip(int target_item)
                /* Display graphics for object, if desired */
                if (show_item_graph)
                {
-                       byte a = object_attr(o_ptr);
-                       char c = object_char(o_ptr);
+                       TERM_COLOR a = object_attr(o_ptr);
+                       SYMBOL_CODE c = object_char(o_ptr);
                        Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
                        if (use_bigtile) cur_col++;
 
@@ -2515,7 +2469,6 @@ void toggle_inven_equip(void)
                        window_flag[j] &= ~(PW_INVEN);
                        window_flag[j] |= (PW_EQUIP);
 
-                       /* Window stuff */
                        p_ptr->window |= (PW_EQUIP);
                }
 
@@ -2526,7 +2479,6 @@ void toggle_inven_equip(void)
                        window_flag[j] &= ~(PW_EQUIP);
                        window_flag[j] |= (PW_INVEN);
 
-                       /* Window stuff */
                        p_ptr->window |= (PW_INVEN);
                }
        }
@@ -2540,9 +2492,9 @@ void toggle_inven_equip(void)
  * @return 確認がYesならTRUEを返す。
  * @details The item can be negative to mean "item on floor".
  */
-static bool verify(cptr prompt, int item)
+static bool verify(concptr prompt, INVENTORY_IDX item)
 {
-       char        o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
        char        out_val[MAX_NLEN+20];
        object_type *o_ptr;
 
@@ -2556,10 +2508,8 @@ static bool verify(cptr prompt, int item)
        /* Floor */
        else
        {
-               o_ptr = &o_list[0 - item];
+               o_ptr = &current_floor_ptr->o_list[0 - item];
        }
-
-       /* Describe */
        object_desc(o_name, o_ptr, 0);
 
        /* Prompt */
@@ -2577,12 +2527,10 @@ static bool verify(cptr prompt, int item)
  * @details The item can be negative to mean "item on floor".
  * Hack -- allow user to "prevent" certain choices
  */
-static bool get_item_allow(int item)
+static bool get_item_allow(INVENTORY_IDX item)
 {
-       cptr s;
-
+       concptr s;
        object_type *o_ptr;
-
        if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
 
        /* Inventory */
@@ -2594,7 +2542,7 @@ static bool get_item_allow(int item)
        /* Floor */
        else
        {
-               o_ptr = &o_list[0 - item];
+               o_ptr = &current_floor_ptr->o_list[0 - item];
        }
 
        /* No inscription */
@@ -2628,7 +2576,7 @@ static bool get_item_allow(int item)
  * @param i 選択アイテムID
  * @return 正規のIDならばTRUEを返す。
  */
-static bool get_item_okay(int i)
+static bool get_item_okay(OBJECT_IDX i)
 {
        /* Illegal items */
        if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
@@ -2650,7 +2598,9 @@ static bool get_item_okay(int i)
  */
 bool can_get_item(void)
 {
-       int j, floor_list[23], floor_num = 0;
+       int j;
+       OBJECT_IDX floor_list[23];
+       ITEM_NUMBER floor_num = 0;
 
        for (j = 0; j < INVEN_TOTAL; j++)
                if (item_tester_okay(&inventory[j]))
@@ -2718,13 +2668,16 @@ bool can_get_item(void)
  * We always erase the prompt when we are done, leaving a blank line,\n
  * or a warning message, if appropriate, if no items are available.\n
  */
-bool get_item(int *cp, cptr pmt, cptr str, int mode)
+bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
 {
-       s16b this_o_idx, next_o_idx = 0;
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
        char which = ' ';
 
-       int j, k, i1, i2, e1, e2;
+       int j;
+       OBJECT_IDX k;
+       OBJECT_IDX i1, i2;
+       OBJECT_IDX e1, e2;
 
        bool done, item;
 
@@ -2741,38 +2694,25 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        char tmp_val[160];
        char out_val[160];
 
-       /* See cmd5.c */
-       extern bool select_the_force;
-
        int menu_line = (use_menu ? 1 : 0);
        int max_inven = 0;
        int max_equip = 0;
 
-#ifdef ALLOW_REPEAT
-
        static char prev_tag = '\0';
        char cur_tag = '\0';
 
-#endif /* ALLOW_REPEAT */
-
-#ifdef ALLOW_EASY_FLOOR /* TNB */
-
        if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
 
-#endif /* ALLOW_EASY_FLOOR -- TNB */
-
        /* Extract args */
        if (mode & USE_EQUIP) equip = TRUE;
        if (mode & USE_INVEN) inven = TRUE;
        if (mode & USE_FLOOR) floor = TRUE;
 
-#ifdef ALLOW_REPEAT
-
        /* Get the item index */
        if (repeat_pull(cp))
        {
                /* the_force */
-               if (select_the_force && (*cp == INVEN_FORCE))
+               if (mode & USE_FORCE && (*cp == INVEN_FORCE))
                {
                        item_tester_tval = 0;
                        item_tester_hook = NULL;
@@ -2787,12 +2727,10 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
 
                        /* Special index */
                        k = 0 - (*cp);
-
-                       /* Acquire object */
-                       o_ptr = &o_list[k];
+                       o_ptr = &current_floor_ptr->o_list[k];
 
                        /* Validate the item */
-                       if (item_tester_okay(o_ptr))
+                       if (item_tester_okay(o_ptr) || (mode & USE_FULL))
                        {
                                /* Forget restrictions */
                                item_tester_tval = 0;
@@ -2844,13 +2782,9 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                }
        }
 
-#endif /* ALLOW_REPEAT */
-
-
-       /* Paranoia XXX XXX XXX */
+       /* Paranoia */
        msg_print(NULL);
 
-
        /* Not done */
        done = FALSE;
 
@@ -2867,7 +2801,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        else if (use_menu)
        {
                for (j = 0; j < INVEN_PACK; j++)
-                       if (item_tester_okay(&inventory[j])) max_inven++;
+                       if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
        }
 
        /* Restrict inventory indexes */
@@ -2884,15 +2818,15 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        else if (use_menu)
        {
                for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
-                       if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
-               if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
+                       if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
+               if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
        }
 
        /* Restrict equipment indexes */
        while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
        while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
 
-       if (equip && p_ptr->ryoute && !item_tester_no_ryoute)
+       if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
        {
                if (p_ptr->migite)
                {
@@ -2906,18 +2840,14 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        if (floor)
        {
                /* Scan all objects in the grid */
-               for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
+               for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
                {
                        object_type *o_ptr;
-
-                       /* Acquire object */
-                       o_ptr = &o_list[this_o_idx];
-
-                       /* Acquire next object */
+                       o_ptr = &current_floor_ptr->o_list[this_o_idx];
                        next_o_idx = o_ptr->next_o_idx;
 
                        /* Accept the item on the floor if legal */
-                       if (item_tester_okay(o_ptr) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
+                       if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
                }
        }
 
@@ -2926,14 +2856,10 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        {
                /* Cancel p_ptr->command_see */
                command_see = FALSE;
-
-               /* Oops */
                oops = TRUE;
-
-               /* Done */
                done = TRUE;
 
-               if (select_the_force) {
+               if (mode & USE_FORCE) {
                    *cp = INVEN_FORCE;
                    item = TRUE;
                }
@@ -2976,7 +2902,6 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        /* Hack -- start out in "display" mode */
        if (command_see)
        {
-               /* Save screen */
                screen_save();
        }
 
@@ -2984,7 +2909,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        /* Repeat until done */
        while (!done)
        {
-               int get_item_label = 0;
+               COMMAND_CODE get_item_label = 0;
 
                /* Show choices */
                int ni = 0;
@@ -3004,8 +2929,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                }
 
                /* Toggle if needed */
-               if ((command_wrk && ni && !ne) ||
-                   (!command_wrk && !ni && ne))
+               if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
                {
                        /* Toggle */
                        toggle_inven_equip();
@@ -3014,25 +2938,21 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                        toggle = !toggle;
                }
 
-               /* Update */
                p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
-               /* Redraw windows */
-               window_stuff();
-
+               handle_stuff();
 
                /* Inventory screen */
                if (!command_wrk)
                {
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_inven(menu_line);
+                       if (command_see) get_item_label = show_inven(menu_line, mode);
                }
 
                /* Equipment screen */
                else
                {
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_equip(menu_line);
+                       if (command_see) get_item_label = show_equip(menu_line, mode);
                }
 
                /* Viewing inventory */
@@ -3056,11 +2976,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                        if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
 
                        /* Append */
-#ifdef JP
-                       if (equip) strcat(out_val, format(" %s 装備品,", use_menu ? "'4'or'6'" : "'/'"));
-#else
-                       if (equip) strcat(out_val, format(" %s for Equip,", use_menu ? "4 or 6" : "/"));
-#endif
+                       if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
                }
 
                /* Viewing equipment */
@@ -3084,16 +3000,12 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                        if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
 
                        /* Append */
-#ifdef JP
-                       if (inven) strcat(out_val, format(" %s 持ち物,", use_menu ? "'4'or'6'" : "'/'"));
-#else
-                       if (inven) strcat(out_val, format(" %s for Inven,", use_menu ? "4 or 6" : "'/'"));
-#endif
+                       if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
                }
 
                /* Indicate legality of the "floor" item */
                if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
-               if (select_the_force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
+               if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
 
                /* Finish the prompt */
                strcat(out_val, " ESC");
@@ -3154,10 +3066,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                                /* Hack -- Fix screen */
                                if (command_see)
                                {
-                                       /* Load screen */
                                        screen_load();
-
-                                       /* Save screen */
                                        screen_save();
                                }
 
@@ -3206,7 +3115,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                        }
                        case 'w':
                        {
-                               if (select_the_force) {
+                               if (mode & USE_FORCE) {
                                        *cp = INVEN_FORCE;
                                        item = TRUE;
                                        done = TRUE;
@@ -3236,15 +3145,12 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                                {
                                        /* Flip flag */
                                        command_see = FALSE;
-
-                                       /* Load screen */
                                        screen_load();
                                }
 
                                /* Show the list */
                                else
                                {
-                                       /* Save screen */
                                        screen_save();
 
                                        /* Flip flag */
@@ -3265,10 +3171,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                                /* Hack -- Fix screen */
                                if (command_see)
                                {
-                                       /* Load screen */
                                        screen_load();
-
-                                       /* Save screen */
                                        screen_save();
                                }
 
@@ -3285,18 +3188,14 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                                if (allow_floor)
                                {
                                        /* Scan all objects in the grid */
-                                       for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
+                                       for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
                                        {
                                                object_type *o_ptr;
-
-                                               /* Acquire object */
-                                               o_ptr = &o_list[this_o_idx];
-
-                                               /* Acquire next object */
+                                               o_ptr = &current_floor_ptr->o_list[this_o_idx];
                                                next_o_idx = o_ptr->next_o_idx;
 
                                                /* Validate the item */
-                                               if (!item_tester_okay(o_ptr)) continue;
+                                               if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
 
                                                /* Special index */
                                                k = 0 - this_o_idx;
@@ -3318,7 +3217,6 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                                        if (done) break;
                                }
 
-                               /* Oops */
                                bell();
                                break;
                        }
@@ -3360,9 +3258,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                                (*cp) = k;
                                item = TRUE;
                                done = TRUE;
-#ifdef ALLOW_REPEAT
                                cur_tag = which;
-#endif /* ALLOW_REPEAT */
                                break;
                        }
 
@@ -3406,7 +3302,7 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
 
                        case 'w':
                        {
-                               if (select_the_force) {
+                               if (mode & USE_FORCE) {
                                        *cp = INVEN_FORCE;
                                        item = TRUE;
                                        done = TRUE;
@@ -3445,15 +3341,13 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                                        (*cp) = k;
                                        item = TRUE;
                                        done = TRUE;
-#ifdef ALLOW_REPEAT
                                        cur_tag = which;
-#endif /* ALLOW_REPEAT */
                                        break;
                                }
 
                                /* Extract "query" setting */
                                ver = isupper(which);
-                               which = tolower(which);
+                               which = (char)tolower(which);
 
                                /* Convert letter to inventory index */
                                if (!command_wrk)
@@ -3506,7 +3400,6 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        /* Fix the screen if necessary */
        if (command_see)
        {
-               /* Load screen */
                screen_load();
 
                /* Hack -- Cancel "display" */
@@ -3517,8 +3410,6 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        /* Forget the item_tester_tval restriction */
        item_tester_tval = 0;
 
-       item_tester_no_ryoute = FALSE;
-
        /* Forget the item_tester_hook restriction */
        item_tester_hook = NULL;
 
@@ -3527,12 +3418,8 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
        /* Toggle again if needed */
        if (toggle) toggle_inven_equip();
 
-       /* Update */
        p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
-       /* Window stuff */
-       window_stuff();
-
+       handle_stuff();
 
        /* Clear the prompt line */
        prt("", 0, 0);
@@ -3542,20 +3429,31 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
 
        if (item)
        {
-#ifdef ALLOW_REPEAT
                repeat_push(*cp);
                if (command_cmd) prev_tag = cur_tag;
-#endif /* ALLOW_REPEAT */
-
                command_cmd = 0; /* Hack -- command_cmd is no longer effective */
        }
-
-       /* Result */
        return (item);
 }
 
+/*
+ * Choose an item and get auto-picker entry from it.
+ */
+object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
+{
+       OBJECT_IDX item;
+       if (!get_item(&item, q, s, option)) return NULL;
+       if (idx) *idx = item;
+
+       if (item == INVEN_FORCE) return NULL;
+
+       /* Get the item (in the pack) */
+       else if (item >= 0) return &inventory[item];
+
+       /* Get the item (on the floor) */
+       else return &current_floor_ptr->o_list[0 - item];
+}
 
-#ifdef ALLOW_EASY_FLOOR
 
 /*!
  * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
@@ -3565,31 +3463,27 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
  * @param mode オプションフラグ
  * @return 対象のマスに落ちているアイテム数
  * @details
- * Return a list of o_list[] indexes of items at the given cave
+ * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array
  * location. Valid flags are:
  *
  *             mode & 0x01 -- Item tester
  *             mode & 0x02 -- Marked items only
  *             mode & 0x04 -- Stop after first
  */
-int scan_floor(int *items, int y, int x, int mode)
+ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
 {
-       int this_o_idx, next_o_idx;
+       OBJECT_IDX this_o_idx, next_o_idx;
 
-       int num = 0;
+       ITEM_NUMBER num = 0;
 
        /* Sanity */
        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)
+       for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
-
-               /* Acquire object */
-               o_ptr = &o_list[this_o_idx];
-
-               /* Acquire next object */
+               o_ptr = &current_floor_ptr->o_list[this_o_idx];
                next_o_idx = o_ptr->next_o_idx;
 
                /* Item tester */
@@ -3608,8 +3502,6 @@ int scan_floor(int *items, int y, int x, int mode)
                /* Only one */
                if (mode & 0x04) break;
        }
-
-       /* Result */
        return num;
 }
 
@@ -3620,47 +3512,45 @@ int scan_floor(int *items, int y, int x, int mode)
  * @param y 走査するフロアのY座標
  * @param x 走査するフロアのX座標
  * @param min_width 表示の長さ
- * @return 選択したアイテムのID
+ * @return 選択したアイテムの添え字
  * @details
  */
-int show_floor(int target_item, int y, int x, int *min_width)
+COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
 {
-       int i, j, k, l;
+       COMMAND_CODE i, m;
+       int j, k, l;
        int col, len;
 
        object_type *o_ptr;
 
-       char o_name[MAX_NLEN];
-
+       GAME_TEXT o_name[MAX_NLEN];
        char tmp_val[80];
 
-       int out_index[23];
-       byte out_color[23];
+       COMMAND_CODE out_index[23];
+       TERM_COLOR out_color[23];
        char out_desc[23][MAX_NLEN];
-       int target_item_label = 0;
+       COMMAND_CODE target_item_label = 0;
 
-       int floor_list[23], floor_num;
-       int wid, hgt;
+       OBJECT_IDX floor_list[23];
+       ITEM_NUMBER floor_num;
+       TERM_LEN wid, hgt;
        char floor_label[52 + 1];
 
        bool dont_need_to_show_weights = TRUE;
 
-       /* Get size */
        Term_get_size(&wid, &hgt);
 
        /* Default length */
        len = MAX((*min_width), 20);
 
-
        /* Scan for objects in the grid, using item_tester_okay() */
        floor_num = scan_floor(floor_list, y, x, 0x03);
 
        /* Display the floor objects */
        for (k = 0, i = 0; i < floor_num && i < 23; i++)
        {
-               o_ptr = &o_list[floor_list[i]];
+               o_ptr = &current_floor_ptr->o_list[floor_list[i]];
 
-               /* Describe the object */
                object_desc(o_name, o_ptr, 0);
 
                /* Save the index */
@@ -3701,10 +3591,9 @@ int show_floor(int target_item, int y, int x, int *min_width)
        for (j = 0; j < k; j++)
        {
                /* Get the index */
-               i = floor_list[out_index[j]];
+               m = floor_list[out_index[j]];
 
-               /* Get the item */
-               o_ptr = &o_list[i];
+               o_ptr = &current_floor_ptr->o_list[m];
 
                /* Clear the line */
                prt("", j + 1, col ? col - 2 : col);
@@ -3714,7 +3603,7 @@ int show_floor(int target_item, int y, int x, int *min_width)
                        if (j == (target_item-1))
                        {
                                strcpy(tmp_val, _("》", "> "));
-                               target_item_label = i;
+                               target_item_label = m;
                        }
                        else strcpy(tmp_val, "   ");
                }
@@ -3759,11 +3648,14 @@ int show_floor(int target_item, int y, int x, int *min_width)
  * @param mode オプションフラグ
  * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
  */
-bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
+bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
 {
        char n1 = ' ', n2 = ' ', which = ' ';
 
-       int j, k, i1, i2, e1, e2;
+       int j;
+       COMMAND_CODE i1, i2;
+       COMMAND_CODE e1, e2;
+       COMMAND_CODE k;
 
        bool done, item;
 
@@ -3773,6 +3665,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
        bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
        bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
+       bool force = (mode & USE_FORCE) ? TRUE : FALSE;
 
        bool allow_equip = FALSE;
        bool allow_inven = FALSE;
@@ -3783,17 +3676,15 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        char tmp_val[160];
        char out_val[160];
 
-       int floor_num, floor_list[23], floor_top = 0;
-       int min_width = 0;
-
-       extern bool select_the_force;
+       ITEM_NUMBER floor_num;
+       OBJECT_IDX floor_list[23];
+       int floor_top = 0;
+       TERM_LEN min_width = 0;
 
        int menu_line = (use_menu ? 1 : 0);
        int max_inven = 0;
        int max_equip = 0;
 
-#ifdef ALLOW_REPEAT
-
        static char prev_tag = '\0';
        char cur_tag = '\0';
 
@@ -3801,7 +3692,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        if (repeat_pull(cp))
        {
                /* the_force */
-               if (select_the_force && (*cp == INVEN_FORCE))
+               if (force && (*cp == INVEN_FORCE))
                {
                        item_tester_tval = 0;
                        item_tester_hook = NULL;
@@ -3836,7 +3727,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        }
 
                        /* Validate the item */
-                       else if (item_tester_okay(&o_list[0 - (*cp)]))
+                       else if (item_tester_okay(&current_floor_ptr->o_list[0 - (*cp)]) || (mode & USE_FULL))
                        {
                                /* Forget restrictions */
                                item_tester_tval = 0;
@@ -3888,10 +3779,8 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                }
        }
 
-#endif /* ALLOW_REPEAT */
-
 
-       /* Paranoia XXX XXX XXX */
+       /* Paranoia */
        msg_print(NULL);
 
 
@@ -3911,7 +3800,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        else if (use_menu)
        {
                for (j = 0; j < INVEN_PACK; j++)
-                       if (item_tester_okay(&inventory[j])) max_inven++;
+                       if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
        }
 
        /* Restrict inventory indexes */
@@ -3928,15 +3817,15 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        else if (use_menu)
        {
                for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
-                       if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
-               if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
+                       if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
+               if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
        }
 
        /* Restrict equipment indexes */
        while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
        while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
 
-       if (equip && p_ptr->ryoute && !item_tester_no_ryoute)
+       if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
        {
                if (p_ptr->migite)
                {
@@ -3970,14 +3859,10 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        {
                /* Cancel p_ptr->command_see */
                command_see = FALSE;
-
-               /* Oops */
                oops = TRUE;
-
-               /* Done */
                done = TRUE;
 
-               if (select_the_force) {
+               if (force) {
                    *cp = INVEN_FORCE;
                    item = TRUE;
                }
@@ -4020,14 +3905,13 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        /* Hack -- start out in "display" mode */
        if (command_see)
        {
-               /* Save screen */
                screen_save();
        }
 
        /* Repeat until done */
        while (!done)
        {
-               int get_item_label = 0;
+               COMMAND_CODE get_item_label = 0;
 
                /* Show choices */
                int ni = 0;
@@ -4057,11 +3941,8 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        toggle = !toggle;
                }
 
-               /* Update */
                p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
-               /* Redraw windows */
-               window_stuff();
+               handle_stuff();
 
                /* Inventory screen */
                if (command_wrk == (USE_INVEN))
@@ -4071,7 +3952,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        n2 = I2A(i2);
 
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_inven(menu_line);
+                       if (command_see) get_item_label = show_inven(menu_line, mode);
                }
 
                /* Equipment screen */
@@ -4082,7 +3963,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        n2 = I2A(e2 - INVEN_RARM);
 
                        /* Redraw if needed */
-                       if (command_see) get_item_label = show_equip(menu_line);
+                       if (command_see) get_item_label = show_equip(menu_line, mode);
                }
 
                /* Floor screen */
@@ -4121,41 +4002,23 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        /* Append */
                        if (allow_equip)
                        {
-#ifdef JP
-                               if (!use_menu)
-                                       strcat(out_val, " '/' 装備品,");
-                               else if (allow_floor)
-                                       strcat(out_val, " '6' 装備品,");
-                               else
-                                       strcat(out_val, " '4'or'6' 装備品,");
-#else
                                if (!use_menu)
-                                       strcat(out_val, " / for Equip,");
+                                       strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
                                else if (allow_floor)
-                                       strcat(out_val, " 6 for Equip,");
+                                       strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
                                else
-                                       strcat(out_val, " 4 or 6 for Equip,");
-#endif
+                                       strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
                        }
 
                        /* Append */
                        if (allow_floor)
                        {
-#ifdef JP
                                if (!use_menu)
-                                       strcat(out_val, " '-'床上,");
+                                       strcat(out_val, _(" '-'床上,", " - for floor,"));
                                else if (allow_equip)
-                                       strcat(out_val, " '4' 床上,");
+                                       strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
                                else
-                                       strcat(out_val, " '4'or'6' 床上,");
-#else
-                               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
+                                       strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
                        }
                }
 
@@ -4181,41 +4044,23 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        /* Append */
                        if (allow_inven)
                        {
-#ifdef JP
                                if (!use_menu)
-                                       strcat(out_val, " '/' 持ち物,");
+                                       strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
                                else if (allow_floor)
-                                       strcat(out_val, " '4' 持ち物,");
+                                       strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
                                else
-                                       strcat(out_val, " '4'or'6' 持ち物,");
-#else
-                               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
+                                       strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
                        }
 
                        /* Append */
                        if (allow_floor)
                        {
-#ifdef JP
                                if (!use_menu)
-                                       strcat(out_val, " '-'床上,");
+                                       strcat(out_val, _(" '-'床上,", " - for floor,"));
                                else if (allow_inven)
-                                       strcat(out_val, " '6' 床上,");
+                                       strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
                                else
-                                       strcat(out_val, " '4'or'6' 床上,");
-#else
-                               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
+                                       strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
                        }
                }
 
@@ -4270,7 +4115,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                }
 
                /* Append */
-               if (select_the_force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
+               if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
 
                /* Finish the prompt */
                strcat(out_val, " ESC");
@@ -4361,10 +4206,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                /* Hack -- Fix screen */
                                if (command_see)
                                {
-                                       /* Load screen */
                                        screen_load();
-
-                                       /* Save screen */
                                        screen_save();
                                }
 
@@ -4422,10 +4264,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                /* Hack -- Fix screen */
                                if (command_see)
                                {
-                                       /* Load screen */
                                        screen_load();
-
-                                       /* Save screen */
                                        screen_save();
                                }
 
@@ -4475,7 +4314,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        }
                        case 'w':
                        {
-                               if (select_the_force) {
+                               if (force) {
                                        *cp = INVEN_FORCE;
                                        item = TRUE;
                                        done = TRUE;
@@ -4505,15 +4344,12 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                {
                                        /* Flip flag */
                                        command_see = FALSE;
-
-                                       /* Load screen */
                                        screen_load();
                                }
 
                                /* Show the list */
                                else
                                {
-                                       /* Save screen */
                                        screen_save();
 
                                        /* Flip flag */
@@ -4527,27 +4363,27 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                        case '+':
                        {
                                int i;
-                               IDX o_idx;
-                               cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
+                               OBJECT_IDX o_idx;
+                               grid_type *g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
 
                                if (command_wrk != (USE_FLOOR)) break;
 
                                /* Get the object being moved. */
-                               o_idx = c_ptr->o_idx;
+                               o_idx = g_ptr->o_idx;
 
                                /* Only rotate a pile of two or more objects. */
-                               if (!(o_idx && o_list[o_idx].next_o_idx)) break;
+                               if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break;
 
                                /* 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;
+                               i = g_ptr->o_idx;
+                               while (current_floor_ptr->o_list[i].next_o_idx)
+                                       i = current_floor_ptr->o_list[i].next_o_idx;
 
                                /* Add after the last object. */
-                               o_list[i].next_o_idx = o_idx;
+                               current_floor_ptr->o_list[i].next_o_idx = o_idx;
 
                                /* Re-scan floor list */ 
                                floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
@@ -4555,10 +4391,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                /* Hack -- Fix screen */
                                if (command_see)
                                {
-                                       /* Load screen */
                                        screen_load();
-
-                                       /* Save screen */
                                        screen_save();
                                }
 
@@ -4605,10 +4438,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                /* Hack -- Fix screen */
                                if (command_see)
                                {
-                                       /* Load screen */
                                        screen_load();
-
-                                       /* Save screen */
                                        screen_save();
                                }
 
@@ -4657,10 +4487,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                /* Hack -- Fix screen */
                                if (command_see)
                                {
-                                       /* Load screen */
                                        screen_load();
-
-                                       /* Save screen */
                                        screen_save();
                                }
 
@@ -4723,9 +4550,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                (*cp) = k;
                                item = TRUE;
                                done = TRUE;
-#ifdef ALLOW_REPEAT
                                cur_tag = which;
-#endif /* ALLOW_REPEAT */
                                break;
                        }
 
@@ -4792,7 +4617,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
 
                        case 'w':
                        {
-                               if (select_the_force) {
+                               if (force) {
                                        *cp = INVEN_FORCE;
                                        item = TRUE;
                                        done = TRUE;
@@ -4834,9 +4659,7 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                                (*cp) = k;
                                                item = TRUE;
                                                done = TRUE;
-#ifdef ALLOW_REPEAT
                                                cur_tag = which;
-#endif /* ALLOW_REPEAT */
                                                break;
                                        }
                                }
@@ -4852,16 +4675,14 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                                                (*cp) = k;
                                                item = TRUE;
                                                done = TRUE;
-#ifdef ALLOW_REPEAT
                                                cur_tag = which;
-#endif /* ALLOW_REPEAT */
                                                break;
                                        }
                                }
 
                                /* Extract "query" setting */
                                ver = isupper(which);
-                               which = tolower(which);
+                               which = (char)tolower(which);
 
                                /* Convert letter to inventory index */
                                if (command_wrk == (USE_INVEN))
@@ -4929,7 +4750,6 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        /* Fix the screen if necessary */
        if (command_see)
        {
-               /* Load screen */
                screen_load();
 
                /* Hack -- Cancel "display" */
@@ -4948,12 +4768,8 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
        /* Toggle again if needed */
        if (toggle) toggle_inven_equip();
 
-       /* Update */
        p_ptr->window |= (PW_INVEN | PW_EQUIP);
-
-       /* Window stuff */
-       window_stuff();
-
+       handle_stuff();
 
        /* Clear the prompt line */
        prt("", 0, 0);
@@ -4963,15 +4779,10 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
 
        if (item)
        {
-#ifdef ALLOW_REPEAT
                repeat_push(*cp);
                if (command_cmd) prev_tag = cur_tag;
-#endif /* ALLOW_REPEAT */
-
                command_cmd = 0; /* Hack -- command_cmd is no longer effective */
        }
-
-       /* Result */
        return (item);
 }
 
@@ -4981,11 +4792,9 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
  */
 static bool py_pickup_floor_aux(void)
 {
-       s16b this_o_idx;
-
-       cptr q, s;
-
-       int item;
+       OBJECT_IDX this_o_idx;
+       concptr q, s;
+       OBJECT_IDX item;
 
        /* Restrict the choices */
        item_tester_hook = inven_carry_okay;
@@ -4994,7 +4803,7 @@ static bool py_pickup_floor_aux(void)
        q = _("どれを拾いますか?", "Get which item? ");
        s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
 
-       if (get_item(&item, q, s, (USE_FLOOR)))
+       if (choose_object(&item, q, s, (USE_FLOOR)))
        {
                this_o_idx = 0 - item;
        }
@@ -5018,34 +4827,32 @@ static bool py_pickup_floor_aux(void)
  */
 void py_pickup_floor(bool pickup)
 {
-       s16b this_o_idx, next_o_idx = 0;
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
        object_type *o_ptr;
 
-       int floor_num = 0, floor_o_idx = 0;
+       int floor_num = 0;
+       OBJECT_IDX floor_o_idx = 0;
 
        int can_pickup = 0;
 
        /* Scan the pile of objects */
-       for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
+       for (this_o_idx = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                /* Access the object */
-               o_ptr = &o_list[this_o_idx];
+               o_ptr = &current_floor_ptr->o_list[this_o_idx];
 
-               /* Describe the object */
                object_desc(o_name, o_ptr, 0);
 
                /* Access the next object */
                next_o_idx = o_ptr->next_o_idx;
 
-               /* Hack -- disturb */
-               disturb(0, 0);
+               disturb(FALSE, FALSE);
 
                /* Pick up gold */
                if (o_ptr->tval == TV_GOLD)
                {
-                       /* Message */
 #ifdef JP
                        msg_format(" $%ld の価値がある%sを見つけた。",
                                (long)o_ptr->pval, o_name);
@@ -5060,7 +4867,6 @@ void py_pickup_floor(bool pickup)
                        /* Redraw gold */
                        p_ptr->redraw |= (PR_GOLD);
 
-                       /* Window stuff */
                        p_ptr->window |= (PW_PLAYER);
 
                        /* Delete the gold */
@@ -5101,7 +4907,7 @@ void py_pickup_floor(bool pickup)
                if (floor_num == 1)
                {
                        /* Access the object */
-                       o_ptr = &o_list[floor_o_idx];
+                       o_ptr = &current_floor_ptr->o_list[floor_o_idx];
 
 #ifdef ALLOW_EASY_SENSE
 
@@ -5114,21 +4920,17 @@ void py_pickup_floor(bool pickup)
 
 #endif /* ALLOW_EASY_SENSE */
 
-                       /* Describe the object */
                        object_desc(o_name, o_ptr, 0);
 
-                       /* Message */
                        msg_format(_("%sがある。", "You see %s."), o_name);
                }
 
                /* Multiple objects */
                else
                {
-                       /* Message */
                        msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
                }
 
-               /* Done */
                return;
        }
 
@@ -5139,7 +4941,7 @@ void py_pickup_floor(bool pickup)
                if (floor_num == 1)
                {
                        /* Access the object */
-                       o_ptr = &o_list[floor_o_idx];
+                       o_ptr = &current_floor_ptr->o_list[floor_o_idx];
 
 #ifdef ALLOW_EASY_SENSE
 
@@ -5152,22 +4954,18 @@ void py_pickup_floor(bool pickup)
 
 #endif /* ALLOW_EASY_SENSE */
 
-                       /* Describe the object */
                        object_desc(o_name, o_ptr, 0);
 
-                       /* Message */
                        msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
                }
 
                /* Multiple objects */
                else
                {
-                       /* Message */
                        msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
 
                }
 
-               /* Done */
                return;
        }
 
@@ -5180,7 +4978,7 @@ void py_pickup_floor(bool pickup)
                        char out_val[MAX_NLEN+20];
 
                        /* Access the object */
-                       o_ptr = &o_list[floor_o_idx];
+                       o_ptr = &current_floor_ptr->o_list[floor_o_idx];
 
 #ifdef ALLOW_EASY_SENSE
 
@@ -5193,7 +4991,6 @@ void py_pickup_floor(bool pickup)
 
 #endif /* ALLOW_EASY_SENSE */
 
-                       /* Describe the object */
                        object_desc(o_name, o_ptr, 0);
 
                        /* Build a prompt */
@@ -5202,13 +4999,12 @@ void py_pickup_floor(bool pickup)
                        /* Ask the user to confirm */
                        if (!get_check(out_val))
                        {
-                               /* Done */
                                return;
                        }
                }
 
                /* Access the object */
-               o_ptr = &o_list[floor_o_idx];
+               o_ptr = &current_floor_ptr->o_list[floor_o_idx];
 
 #ifdef ALLOW_EASY_SENSE
 
@@ -5235,4 +5031,60 @@ void py_pickup_floor(bool pickup)
        }
 }
 
-#endif /* ALLOW_EASY_FLOOR */
+
+/*!
+ * @brief 矢弾を射撃した場合の破損確率を返す /
+ * Determines the odds of an object breaking when thrown at a monster
+ * @param o_ptr 矢弾のオブジェクト構造体参照ポインタ
+ * @return 破損確率(%)
+ * @details
+ * Note that artifacts never break, see the "drop_near()" function.
+ */
+PERCENTAGE breakage_chance(object_type *o_ptr, SPELL_IDX snipe_type)
+{
+       PERCENTAGE archer_bonus = (p_ptr->pclass == CLASS_ARCHER ? (PERCENTAGE)(p_ptr->lev - 1) / 7 + 4 : 0);
+
+       /* Examine the snipe type */
+       if (snipe_type)
+       {
+               if (snipe_type == SP_KILL_WALL) return (100);
+               if (snipe_type == SP_EXPLODE) return (100);
+               if (snipe_type == SP_PIERCE) return (100);
+               if (snipe_type == SP_FINAL) return (100);
+               if (snipe_type == SP_NEEDLE) return (100);
+               if (snipe_type == SP_EVILNESS) return (40);
+               if (snipe_type == SP_HOLYNESS) return (40);
+       }
+
+       /* Examine the item type */
+       switch (o_ptr->tval)
+       {
+               /* Always break */
+       case TV_FLASK:
+       case TV_POTION:
+       case TV_BOTTLE:
+       case TV_FOOD:
+       case TV_JUNK:
+               return (100);
+
+               /* Often break */
+       case TV_LITE:
+       case TV_SCROLL:
+       case TV_SKELETON:
+               return (50);
+
+               /* Sometimes break */
+       case TV_WAND:
+       case TV_SPIKE:
+               return (25);
+       case TV_ARROW:
+               return (20 - archer_bonus * 2);
+
+               /* Rarely break */
+       case TV_SHOT:
+       case TV_BOLT:
+               return (10 - archer_bonus);
+       default:
+               return (10);
+       }
+}