4 #include "player-inventory.h"
8 #include "objectkind.h"
9 #include "object-flavor.h"
10 #include "object-hook.h"
12 #include "player-move.h"
14 #include "view-mainwindow.h"
16 bool select_ring_slot;
19 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
20 * @param i プレイヤーの所持/装備オブジェクトID
21 * @return 指輪枠ならばTRUEを返す。
23 bool is_ring_slot(int i)
25 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
30 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
31 * Convert a label into the index of a item in the "equip"
32 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
34 static INVENTORY_IDX label_to_equip(int c)
39 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
41 /* Verify the index */
42 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
44 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
46 /* Empty slots can never be chosen */
47 if (!p_ptr->inventory_list[i].k_idx) return (-1);
49 /* Return the index */
54 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
55 * Convert a label into the index of an item in the "inven"
56 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
57 * @details Note that the label does NOT distinguish inven/equip.
59 static INVENTORY_IDX label_to_inven(int c)
64 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
66 /* Verify the index */
67 if ((i < 0) || (i > INVEN_PACK)) return (-1);
69 /* Empty slots can never be chosen */
70 if (!p_ptr->inventory_list[i].k_idx) return (-1);
72 /* Return the index */
78 * @brief 所持/装備オブジェクトIDの部位表現を返す /
79 * Return a string mentioning how a given item is carried
80 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
81 * @return 部位表現の文字列ポインタ
83 static concptr mention_use(player_type *creature_ptr, int i)
87 /* Examine the location */
91 case INVEN_RARM: p = creature_ptr->heavy_wield[0] ? "運搬中" : ((creature_ptr->ryoute && creature_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
93 case INVEN_RARM: p = creature_ptr->heavy_wield[0] ? "Just lifting" : (creature_ptr->migite ? "Wielding" : "On arm"); break;
97 case INVEN_LARM: p = creature_ptr->heavy_wield[1] ? "運搬中" : ((creature_ptr->ryoute && creature_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
99 case INVEN_LARM: p = creature_ptr->heavy_wield[1] ? "Just lifting" : (creature_ptr->hidarite ? "Wielding" : "On arm"); break;
102 case INVEN_BOW: p = (adj_str_hold[creature_ptr->stat_ind[A_STR]] < creature_ptr->inventory_list[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
103 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
104 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
105 case INVEN_NECK: p = _(" 首", "Around neck"); break;
106 case INVEN_LITE: p = _(" 光源", "Light source"); break;
107 case INVEN_BODY: p = _(" 体", "On body"); break;
108 case INVEN_OUTER: p = _("体の上", "About body"); break;
109 case INVEN_HEAD: p = _(" 頭", "On head"); break;
110 case INVEN_HANDS: p = _(" 手", "On hands"); break;
111 case INVEN_FEET: p = _(" 足", "On feet"); break;
112 default: p = _("ザック", "In pack"); break;
115 /* Return the result */
120 * @brief 装備アイテム一覧を表示する /
121 * Choice window "shadow" of the "show_equip()" function
124 void display_equip(OBJECT_TYPE_VALUE tval)
128 TERM_COLOR attr = TERM_WHITE;
130 GAME_TEXT o_name[MAX_NLEN];
133 Term_get_size(&wid, &hgt);
135 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
137 o_ptr = &p_ptr->inventory_list[i];
138 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
139 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr, tval))
141 tmp_val[0] = index_to_label(i);
145 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
146 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
148 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
153 object_desc(o_name, o_ptr, 0);
154 attr = tval_to_attr[o_ptr->tval % 128];
162 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
164 Term_erase(3 + n, i - INVEN_RARM, 255);
168 int wgt = o_ptr->weight * o_ptr->number;
170 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
172 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
175 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
180 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
181 prt(mention_use(p_ptr, i), i - INVEN_RARM, wid - 15);
185 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
187 Term_erase(0, i, 255);
192 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
193 * Flip "inven" and "equip" in any sub-windows
196 void toggle_inven_equip(player_type *creature_ptr)
201 for (j = 0; j < 8; j++)
204 if (!angband_term[j]) continue;
206 /* Flip inven to equip */
207 if (window_flag[j] & (PW_INVEN))
210 window_flag[j] &= ~(PW_INVEN);
211 window_flag[j] |= (PW_EQUIP);
213 creature_ptr->window |= (PW_EQUIP);
216 /* Flip inven to equip */
217 else if (window_flag[j] & (PW_EQUIP))
220 window_flag[j] &= ~(PW_EQUIP);
221 window_flag[j] |= (PW_INVEN);
223 creature_ptr->window |= (PW_INVEN);
230 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
231 * Auxiliary function for "get_item()" -- test an index
233 * @return 正規のIDならばTRUEを返す。
235 bool get_item_okay(OBJECT_IDX i)
238 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
240 if (select_ring_slot) return is_ring_slot(i);
242 /* Verify the item */
243 if (!item_tester_okay(&p_ptr->inventory_list[i], item_tester_tval)) return (FALSE);
250 * @brief 規定の処理にできるアイテムがプレイヤーの利用可能範囲内にあるかどうかを返す /
251 * Determine whether get_item() can get some item or not
252 * @return アイテムを拾えるならばTRUEを返す。
253 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
255 bool can_get_item(OBJECT_TYPE_VALUE tval)
258 OBJECT_IDX floor_list[23];
259 ITEM_NUMBER floor_num = 0;
261 for (j = 0; j < INVEN_TOTAL; j++)
262 if (item_tester_okay(&p_ptr->inventory_list[j], tval))
265 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
274 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
275 * Find the "first" p_ptr->inventory_list object with the given "tag".
276 * @param cp 対応するタグIDを与える参照ポインタ
277 * @param tag 該当するオブジェクトがあるかを調べたいタグ
278 * @param floor_list 床上アイテムの配列
279 * @param floor_num 床上アイテムの配列ID
280 * @return タグに該当するオブジェクトがあるならTRUEを返す
282 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
283 * inscription of an object. Alphabetical characters don't work as a\n
284 * tag in this form.\n
286 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
287 * and "x" is the "current" command_cmd code.\n
289 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
294 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
296 /* Check every object in the grid */
297 for (i = 0; i < floor_num && i < 23; i++)
299 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
301 /* Skip empty inscriptions */
302 if (!o_ptr->inscription) continue;
305 s = my_strchr(quark_str(o_ptr->inscription), '@');
307 /* Process all tags */
310 /* Check the special tags */
311 if ((s[1] == command_cmd) && (s[2] == tag))
313 /* Save the actual floor object ID */
320 /* Find another '@' */
321 s = my_strchr(s + 1, '@');
326 /**** Find a tag in the form of {@#} (allows only numerals) ***/
328 /* Don't allow {@#} with '#' being alphabet */
329 if (tag < '0' || '9' < tag)
335 /* Check every object in the grid */
336 for (i = 0; i < floor_num && i < 23; i++)
338 object_type *o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
340 /* Skip empty inscriptions */
341 if (!o_ptr->inscription) continue;
344 s = my_strchr(quark_str(o_ptr->inscription), '@');
346 /* Process all tags */
349 /* Check the normal tags */
352 /* Save the floor object ID */
359 /* Find another '@' */
360 s = my_strchr(s + 1, '@');
370 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
371 * Find the "first" p_ptr->inventory_list object with the given "tag".
372 * @param cp 対応するタグIDを与える参照ポインタ
373 * @param tag 該当するオブジェクトがあるかを調べたいタグ
374 * @param mode 所持、装備の切り替え
375 * @return タグに該当するオブジェクトがあるならTRUEを返す
377 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
378 * inscription of an object. Alphabetical characters don't work as a\n
379 * tag in this form.\n
381 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
382 * and "x" is the "current" command_cmd code.\n
384 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
387 COMMAND_CODE start, end;
390 /* Extract index from mode */
395 end = INVEN_TOTAL - 1;
400 end = INVEN_PACK - 1;
407 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
409 /* Check every p_ptr->inventory_list object */
410 for (i = start; i <= end; i++)
412 object_type *o_ptr = &p_ptr->inventory_list[i];
413 if (!o_ptr->k_idx) continue;
415 /* Skip empty inscriptions */
416 if (!o_ptr->inscription) continue;
418 /* Skip non-choice */
419 if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue;
422 s = my_strchr(quark_str(o_ptr->inscription), '@');
424 /* Process all tags */
427 /* Check the special tags */
428 if ((s[1] == command_cmd) && (s[2] == tag))
430 /* Save the actual p_ptr->inventory_list ID */
437 /* Find another '@' */
438 s = my_strchr(s + 1, '@');
443 /**** Find a tag in the form of {@#} (allows only numerals) ***/
445 /* Don't allow {@#} with '#' being alphabet */
446 if (tag < '0' || '9' < tag)
452 /* Check every object */
453 for (i = start; i <= end; i++)
455 object_type *o_ptr = &p_ptr->inventory_list[i];
456 if (!o_ptr->k_idx) continue;
458 /* Skip empty inscriptions */
459 if (!o_ptr->inscription) continue;
461 /* Skip non-choice */
462 if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue;
465 s = my_strchr(quark_str(o_ptr->inscription), '@');
467 /* Process all tags */
470 /* Check the normal tags */
473 /* Save the actual p_ptr->inventory_list ID */
480 /* Find another '@' */
481 s = my_strchr(s + 1, '@');
490 * @brief タグIDにあわせてタグアルファベットのリストを返す /
491 * Move around label characters with correspond tags
492 * @param label ラベルリストを取得する文字列参照ポインタ
493 * @param mode 所持品リストか装備品リストかの切り替え
496 void prepare_label_string(char *label, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
498 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
499 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
502 /* Prepare normal labels */
503 strcpy(label, alphabet_chars);
505 /* Move each label */
506 for (i = 0; i < 52; i++)
509 SYMBOL_CODE c = alphabet_chars[i];
511 /* Find a tag with this label */
512 if (get_tag(&index, c, mode, tval))
514 /* Delete the overwritten label */
515 if (label[i] == c) label[i] = ' ';
517 /* Move the label to the place of corresponding tag */
518 label[index - offset] = c;
525 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
526 * Move around label characters with correspond tags (floor version)
527 * @param label ラベルリストを取得する文字列参照ポインタ
528 * @param floor_list 床上アイテムの配列
529 * @param floor_num 床上アイテムの配列ID
534 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
536 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
539 /* Prepare normal labels */
540 strcpy(label, alphabet_chars);
542 /* Move each label */
543 for (i = 0; i < 52; i++)
546 SYMBOL_CODE c = alphabet_chars[i];
548 /* Find a tag with this label */
549 if (get_tag_floor(&index, c, floor_list, floor_num))
551 /* Delete the overwritten label */
552 if (label[i] == c) label[i] = ' ';
554 /* Move the label to the place of corresponding tag */
561 * @brief 所持アイテムの表示を行う /
562 * Display the p_ptr->inventory_list.
563 * @param target_item アイテムの選択処理を行うか否か。
564 * @return 選択したアイテムのタグ
566 * Hack -- do not display "trailing" empty slots
568 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
572 int col, cur_col, len;
574 GAME_TEXT o_name[MAX_NLEN];
576 COMMAND_CODE out_index[23];
577 TERM_COLOR out_color[23];
578 char out_desc[23][MAX_NLEN];
579 COMMAND_CODE target_item_label = 0;
581 char inven_label[52 + 1];
583 /* Starting column */
586 Term_get_size(&wid, &hgt);
588 /* Default "max-length" */
592 /* Find the "final" slot */
593 for (i = 0; i < INVEN_PACK; i++)
595 o_ptr = &p_ptr->inventory_list[i];
596 if (!o_ptr->k_idx) continue;
602 prepare_label_string(inven_label, USE_INVEN, tval);
604 /* Display the p_ptr->inventory_list */
605 for (k = 0, i = 0; i < z; i++)
607 o_ptr = &p_ptr->inventory_list[i];
609 /* Is this item acceptable? */
610 if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue;
612 object_desc(o_name, o_ptr, 0);
614 /* Save the object index, color, and description */
616 out_color[k] = tval_to_attr[o_ptr->tval % 128];
618 /* Grey out charging items */
621 out_color[k] = TERM_L_DARK;
624 (void)strcpy(out_desc[k], o_name);
626 /* Find the predicted "line length" */
627 l = strlen(out_desc[k]) + 5;
629 /* Be sure to account for the weight */
630 if (show_weights) l += 9;
632 /* Account for icon if displayed */
636 if (use_bigtile) l++;
639 /* Maintain the maximum length */
640 if (l > len) len = l;
642 /* Advance to next "line" */
646 /* Find the column to start in */
647 col = (len > wid - 4) ? 0 : (wid - len - 1);
649 /* Output each entry */
650 for (j = 0; j < k; j++)
653 o_ptr = &p_ptr->inventory_list[i];
656 prt("", j + 1, col ? col - 2 : col);
658 if (use_menu && target_item)
660 if (j == (target_item - 1))
662 strcpy(tmp_val, _("》", "> "));
663 target_item_label = i;
665 else strcpy(tmp_val, " ");
667 else if (i <= INVEN_PACK)
669 /* Prepare an index --(-- */
670 sprintf(tmp_val, "%c)", inven_label[i]);
674 /* Prepare an index --(-- */
675 sprintf(tmp_val, "%c)", index_to_label(i));
678 /* Clear the line with the (possibly indented) index */
679 put_str(tmp_val, j + 1, col);
683 /* Display graphics for object, if desired */
686 TERM_COLOR a = object_attr(o_ptr);
687 SYMBOL_CODE c = object_char(o_ptr);
688 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
689 if (use_bigtile) cur_col++;
695 /* Display the entry itself */
696 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
698 /* Display the weight if needed */
701 int wgt = o_ptr->weight * o_ptr->number;
703 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
705 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
708 prt(tmp_val, j + 1, wid - 9);
712 /* Make a "shadow" below the list (only if needed) */
713 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
715 /* Save the new column */
718 return target_item_label;
723 * @brief 選択したアイテムの確認処理の補助 /
724 * Verify the choice of an item.
725 * @param prompt メッセージ表示の一部
726 * @param item 選択アイテムID
727 * @return 確認がYesならTRUEを返す。
728 * @details The item can be negative to mean "item on floor".
730 static bool verify(concptr prompt, INVENTORY_IDX item)
732 GAME_TEXT o_name[MAX_NLEN];
733 char out_val[MAX_NLEN + 20];
740 o_ptr = &p_ptr->inventory_list[item];
746 o_ptr = ¤t_floor_ptr->o_list[0 - item];
748 object_desc(o_name, o_ptr, 0);
751 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
754 return (get_check(out_val));
759 * @brief 選択したアイテムの確認処理のメインルーチン /
760 * @param item 選択アイテムID
761 * @return 確認がYesならTRUEを返す。
762 * @details The item can be negative to mean "item on floor".
763 * Hack -- allow user to "prevent" certain choices
765 static bool get_item_allow(INVENTORY_IDX item)
769 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
774 o_ptr = &p_ptr->inventory_list[item];
780 o_ptr = ¤t_floor_ptr->o_list[0 - item];
784 if (!o_ptr->inscription) return (TRUE);
787 s = my_strchr(quark_str(o_ptr->inscription), '!');
789 /* Process preventions */
792 /* Check the "restriction" */
793 if ((s[1] == command_cmd) || (s[1] == '*'))
795 /* Verify the choice */
796 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
799 /* Find another '!' */
800 s = my_strchr(s + 1, '!');
809 * @brief オブジェクト選択の汎用関数 /
810 * Let the user select an item, save its "index"
811 * @param cp 選択したオブジェクトのIDを返す。
812 * @param pmt 選択目的のメッセージ
813 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
814 * @param mode オプションフラグ
815 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
816 * Return TRUE only if an acceptable item was chosen by the user.\n
818 * The selected item must satisfy the "item_tester_hook()" function,\n
819 * if that hook is set, and the "item_tester_tval", if that value is set.\n
821 * All "item_tester" restrictions are cleared before this function returns.\n
823 * The user is allowed to choose acceptable items from the equipment,\n
824 * p_ptr->inventory_list, or floor, respectively, if the proper flag was given,\n
825 * and there are any acceptable items in that location.\n
827 * The equipment or p_ptr->inventory_list are displayed (even if no acceptable\n
828 * items are in that location) if the proper flag was given.\n
830 * If there are no acceptable items available anywhere, and "str" is\n
831 * not NULL, then it will be used as the text of a warning message\n
832 * before the function returns.\n
834 * Note that the user must press "-" to specify the item on the floor,\n
835 * and there is no way to "examine" the item on the floor, while the\n
836 * use of "capital" letters will "examine" an p_ptr->inventory_list/equipment item,\n
837 * and prompt for its use.\n
839 * If a legal item is selected from the p_ptr->inventory_list, we save it in "cp"\n
840 * directly (0 to 35), and return TRUE.\n
842 * If a legal item is selected from the floor, we save it in "cp" as\n
843 * a negative (-1 to -511), and return TRUE.\n
845 * If no item is available, we do nothing to "cp", and we display a\n
846 * warning message, using "str" if available, and return FALSE.\n
848 * If no item is selected, we do nothing to "cp", and return FALSE.\n
850 * Global "p_ptr->command_new" is used when viewing the p_ptr->inventory_list or equipment\n
851 * to allow the user to enter a command while viewing those screens, and\n
852 * also to induce "auto-enter" of stores, and other such stuff.\n
854 * Global "p_ptr->command_see" may be set before calling this function to start\n
855 * out in "browse" mode. It is cleared before this function returns.\n
857 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
858 * If it is TRUE then we are viewing p_ptr->inventory_list, else equipment.\n
860 * We always erase the prompt when we are done, leaving a blank line,\n
861 * or a warning message, if appropriate, if no items are available.\n
863 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
865 OBJECT_IDX this_o_idx, next_o_idx = 0;
882 bool allow_floor = FALSE;
889 int menu_line = (use_menu ? 1 : 0);
893 static char prev_tag = '\0';
896 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode, tval);
899 if (mode & USE_EQUIP) equip = TRUE;
900 if (mode & USE_INVEN) inven = TRUE;
901 if (mode & USE_FLOOR) floor = TRUE;
903 /* Get the item index */
907 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
910 item_tester_hook = NULL;
911 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
916 else if (floor && (*cp < 0))
922 o_ptr = ¤t_floor_ptr->o_list[k];
924 /* Validate the item */
925 if (item_tester_okay(o_ptr, tval) || (mode & USE_FULL))
927 /* Forget restrictions */
929 item_tester_hook = NULL;
930 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
937 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
938 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
940 if (prev_tag && command_cmd)
942 /* Look up the tag and validate the item */
943 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, tval)) /* Reject */;
944 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
945 else if (!get_item_okay(k)) /* Reject */;
948 /* Accept that choice */
951 /* Forget restrictions */
953 item_tester_hook = NULL;
954 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
960 prev_tag = '\0'; /* prev_tag is no longer effective */
963 /* Verify the item */
964 else if (get_item_okay(*cp))
966 /* Forget restrictions */
968 item_tester_hook = NULL;
969 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
981 /* No item selected */
985 /* Full p_ptr->inventory_list */
989 /* Forbid p_ptr->inventory_list */
993 for (j = 0; j < INVEN_PACK; j++)
994 if (item_tester_okay(&p_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_inven++;
997 /* Restrict p_ptr->inventory_list indexes */
998 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
999 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
1002 /* Full equipment */
1004 e2 = INVEN_TOTAL - 1;
1006 /* Forbid equipment */
1007 if (!equip) e2 = -1;
1010 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
1011 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_equip++;
1012 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
1015 /* Restrict equipment indexes */
1016 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
1017 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
1019 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
1023 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
1025 else if (p_ptr->hidarite) e1 = INVEN_RARM;
1029 /* Restrict floor usage */
1032 /* Scan all objects in the grid */
1033 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)
1036 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
1037 next_o_idx = o_ptr->next_o_idx;
1039 /* Accept the item on the floor if legal */
1040 if ((item_tester_okay(o_ptr, tval) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
1044 /* Require at least one legal choice */
1045 if (!allow_floor && (i1 > i2) && (e1 > e2))
1047 /* Cancel p_ptr->command_see */
1048 command_see = FALSE;
1052 if (mode & USE_FORCE) {
1058 /* Analyze choices */
1061 /* Hack -- Start on equipment if requested */
1062 if (command_see && command_wrk && equip)
1067 /* Use p_ptr->inventory_list if allowed */
1070 command_wrk = FALSE;
1073 /* Use equipment if allowed */
1079 /* Use p_ptr->inventory_list for floor */
1082 command_wrk = FALSE;
1088 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
1090 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
1092 /* Hack -- start out in "display" mode */
1099 /* Repeat until done */
1102 COMMAND_CODE get_item_label = 0;
1109 for (j = 0; j < 8; j++)
1112 if (!angband_term[j]) continue;
1114 /* Count windows displaying inven */
1115 if (window_flag[j] & (PW_INVEN)) ni++;
1117 /* Count windows displaying equip */
1118 if (window_flag[j] & (PW_EQUIP)) ne++;
1121 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
1123 toggle_inven_equip(p_ptr);
1127 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1130 /* Inventory screen */
1133 /* Redraw if needed */
1134 if (command_see) get_item_label = show_inven(menu_line, mode, tval);
1137 /* Equipment screen */
1140 /* Redraw if needed */
1141 if (command_see) get_item_label = show_equip(menu_line, mode, tval);
1144 /* Viewing p_ptr->inventory_list */
1147 /* Begin the prompt */
1148 sprintf(out_val, _("持ち物:", "Inven:"));
1150 /* Some legal items */
1151 if ((i1 <= i2) && !use_menu)
1153 /* Build the prompt */
1154 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
1155 index_to_label(i1), index_to_label(i2));
1158 strcat(out_val, tmp_val);
1161 /* Indicate ability to "view" */
1162 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
1165 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
1168 /* Viewing equipment */
1171 /* Begin the prompt */
1172 sprintf(out_val, _("装備品:", "Equip:"));
1174 /* Some legal items */
1175 if ((e1 <= e2) && !use_menu)
1177 /* Build the prompt */
1178 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
1179 index_to_label(e1), index_to_label(e2));
1182 strcat(out_val, tmp_val);
1185 /* Indicate ability to "view" */
1186 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
1189 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
1192 /* Indicate legality of the "floor" item */
1193 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
1194 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
1196 /* Finish the prompt */
1197 strcat(out_val, " ESC");
1199 /* Build the prompt */
1200 sprintf(tmp_val, "(%s) %s", out_val, pmt);
1202 /* Show the prompt */
1210 int max_line = (command_wrk ? max_equip : max_inven);
1226 menu_line += (max_line - 1);
1245 /* Verify legality */
1246 if (!inven || !equip)
1252 /* Hack -- Fix screen */
1259 /* Switch inven/equip */
1260 command_wrk = !command_wrk;
1261 max_line = (command_wrk ? max_equip : max_inven);
1262 if (menu_line > max_line) menu_line = max_line;
1264 /* Need to redraw */
1273 if (command_wrk == USE_FLOOR)
1276 (*cp) = -get_item_label;
1280 /* Validate the item */
1281 if (!get_item_okay(get_item_label))
1287 /* Allow player to "refuse" certain actions */
1288 if (!get_item_allow(get_item_label))
1294 /* Accept that choice */
1295 (*cp) = get_item_label;
1304 if (mode & USE_FORCE) {
1312 if (menu_line > max_line) menu_line -= max_line;
1333 command_see = FALSE;
1350 /* Verify legality */
1351 if (!inven || !equip)
1357 /* Hack -- Fix screen */
1364 /* Switch inven/equip */
1365 command_wrk = !command_wrk;
1367 /* Need to redraw */
1373 /* Use floor item */
1376 /* Scan all objects in the grid */
1377 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)
1380 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
1381 next_o_idx = o_ptr->next_o_idx;
1383 /* Validate the item */
1384 if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue;
1389 /* Verify the item (if required) */
1390 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
1392 /* Allow player to "refuse" certain actions */
1393 if (!get_item_allow(k)) continue;
1395 /* Accept that choice */
1411 case '1': case '2': case '3':
1412 case '4': case '5': case '6':
1413 case '7': case '8': case '9':
1415 /* Look up the tag */
1416 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN, tval))
1422 /* Hack -- Validate the item */
1423 if ((k < INVEN_RARM) ? !inven : !equip)
1429 /* Validate the item */
1430 if (!get_item_okay(k))
1436 /* Allow player to "refuse" certain actions */
1437 if (!get_item_allow(k))
1443 /* Accept that choice */
1455 /* Choose "default" p_ptr->inventory_list item */
1458 k = ((i1 == i2) ? i1 : -1);
1461 /* Choose "default" equipment item */
1464 k = ((e1 == e2) ? e1 : -1);
1467 /* Validate the item */
1468 if (!get_item_okay(k))
1474 /* Allow player to "refuse" certain actions */
1475 if (!get_item_allow(k))
1481 /* Accept that choice */
1491 if (mode & USE_FORCE) {
1504 bool not_found = FALSE;
1506 /* Look up the alphabetical tag */
1507 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN, tval))
1512 /* Hack -- Validate the item */
1513 else if ((k < INVEN_RARM) ? !inven : !equip)
1518 /* Validate the item */
1519 else if (!get_item_okay(k))
1526 /* Accept that choice */
1534 /* Extract "query" setting */
1535 ver = isupper(which);
1536 which = (char)tolower(which);
1538 /* Convert letter to p_ptr->inventory_list index */
1541 if (which == '(') k = i1;
1542 else if (which == ')') k = i2;
1543 else k = label_to_inven(which);
1546 /* Convert letter to equipment index */
1549 if (which == '(') k = e1;
1550 else if (which == ')') k = e2;
1551 else k = label_to_equip(which);
1554 /* Validate the item */
1555 if (!get_item_okay(k))
1561 /* Verify the item */
1562 if (ver && !verify(_("本当に", "Try"), k))
1568 /* Allow player to "refuse" certain actions */
1569 if (!get_item_allow(k))
1575 /* Accept that choice */
1586 /* Fix the screen if necessary */
1591 /* Hack -- Cancel "display" */
1592 command_see = FALSE;
1596 /* Forget the tval restriction */
1599 /* Forget the item_tester_hook restriction */
1600 item_tester_hook = NULL;
1603 /* Clean up 'show choices' */
1604 if (toggle) toggle_inven_equip(p_ptr);
1606 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1609 /* Clear the prompt line */
1612 /* Warning if needed */
1613 if (oops && str) msg_print(str);
1618 if (command_cmd) prev_tag = cur_tag;
1619 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1625 * Choose an item and get auto-picker entry from it.
1627 object_type *choose_object(player_type *creature_ptr, OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option, OBJECT_TYPE_VALUE tval)
1630 if (!get_item(&item, q, s, option, tval)) return NULL;
1631 if (idx) *idx = item;
1632 if (item == INVEN_FORCE) return NULL;
1633 return REF_ITEM(creature_ptr, current_floor_ptr, item);
1638 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
1639 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
1640 * @param y 走査するフロアのY座標
1641 * @param x 走査するフロアのX座標
1642 * @param mode オプションフラグ
1643 * @return 対象のマスに落ちているアイテム数
1645 * Return a list of o_list[] indexes of items at the given current_floor_ptr->grid_array
1646 * location. Valid flags are:
1648 * mode & 0x01 -- Item tester
1649 * mode & 0x02 -- Marked items only
1650 * mode & 0x04 -- Stop after first
1652 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
1654 OBJECT_IDX this_o_idx, next_o_idx;
1656 ITEM_NUMBER num = 0;
1659 if (!in_bounds(y, x)) return 0;
1661 /* Scan all objects in the grid */
1662 for (this_o_idx = current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
1665 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
1666 next_o_idx = o_ptr->next_o_idx;
1669 if ((mode & 0x01) && !item_tester_okay(o_ptr, item_tester_tval)) continue;
1672 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
1674 /* Accept this item */
1675 /* XXX Hack -- Enforce limit */
1677 items[num] = this_o_idx;
1682 if (mode & 0x04) break;
1689 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
1690 * @param target_item カーソルの初期値
1691 * @param y 走査するフロアのY座標
1692 * @param x 走査するフロアのX座標
1693 * @param min_width 表示の長さ
1694 * @return 選択したアイテムの添え字
1697 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
1705 GAME_TEXT o_name[MAX_NLEN];
1708 COMMAND_CODE out_index[23];
1709 TERM_COLOR out_color[23];
1710 char out_desc[23][MAX_NLEN];
1711 COMMAND_CODE target_item_label = 0;
1713 OBJECT_IDX floor_list[23];
1714 ITEM_NUMBER floor_num;
1716 char floor_label[52 + 1];
1718 bool dont_need_to_show_weights = TRUE;
1720 Term_get_size(&wid, &hgt);
1722 /* Default length */
1723 len = MAX((*min_width), 20);
1725 /* Scan for objects in the grid, using item_tester_okay() */
1726 floor_num = scan_floor(floor_list, y, x, 0x03);
1728 /* Display the floor objects */
1729 for (k = 0, i = 0; i < floor_num && i < 23; i++)
1731 o_ptr = ¤t_floor_ptr->o_list[floor_list[i]];
1733 object_desc(o_name, o_ptr, 0);
1735 /* Save the index */
1738 /* Acquire p_ptr->inventory_list color */
1739 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
1741 /* Save the object description */
1742 strcpy(out_desc[k], o_name);
1744 /* Find the predicted "line length" */
1745 l = strlen(out_desc[k]) + 5;
1747 /* Be sure to account for the weight */
1748 if (show_weights) l += 9;
1750 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
1752 /* Maintain the maximum length */
1753 if (l > len) len = l;
1755 /* Advance to next "line" */
1759 if (show_weights && dont_need_to_show_weights) len -= 9;
1764 /* Find the column to start in */
1765 col = (len > wid - 4) ? 0 : (wid - len - 1);
1767 prepare_label_string_floor(floor_label, floor_list, floor_num);
1769 /* Output each entry */
1770 for (j = 0; j < k; j++)
1772 m = floor_list[out_index[j]];
1773 o_ptr = ¤t_floor_ptr->o_list[m];
1775 /* Clear the line */
1776 prt("", j + 1, col ? col - 2 : col);
1778 if (use_menu && target_item)
1780 if (j == (target_item - 1))
1782 strcpy(tmp_val, _("》", "> "));
1783 target_item_label = m;
1785 else strcpy(tmp_val, " ");
1789 /* Prepare an index --(-- */
1790 sprintf(tmp_val, "%c)", floor_label[j]);
1793 /* Clear the line with the (possibly indented) index */
1794 put_str(tmp_val, j + 1, col);
1796 /* Display the entry itself */
1797 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
1799 /* Display the weight if needed */
1800 if (show_weights && (o_ptr->tval != TV_GOLD))
1802 int wgt = o_ptr->weight * o_ptr->number;
1804 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1806 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1809 prt(tmp_val, j + 1, wid - 9);
1813 /* Make a "shadow" below the list (only if needed) */
1814 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
1816 return target_item_label;
1820 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
1821 * Let the user select an item, save its "index"
1822 * @param cp 選択したオブジェクトのIDを返す。
1823 * @param pmt 選択目的のメッセージ
1824 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
1825 * @param mode オプションフラグ
1826 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
1828 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
1830 char n1 = ' ', n2 = ' ', which = ' ';
1833 COMMAND_CODE i1, i2;
1834 COMMAND_CODE e1, e2;
1842 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
1843 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
1844 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
1845 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
1847 bool allow_equip = FALSE;
1848 bool allow_inven = FALSE;
1849 bool allow_floor = FALSE;
1851 bool toggle = FALSE;
1856 ITEM_NUMBER floor_num;
1857 OBJECT_IDX floor_list[23];
1859 TERM_LEN min_width = 0;
1861 int menu_line = (use_menu ? 1 : 0);
1865 static char prev_tag = '\0';
1866 char cur_tag = '\0';
1868 /* Get the item index */
1869 if (repeat_pull(cp))
1872 if (force && (*cp == INVEN_FORCE))
1875 item_tester_hook = NULL;
1876 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1881 else if (floor && (*cp < 0))
1883 if (prev_tag && command_cmd)
1885 /* Scan all objects in the grid */
1886 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
1888 /* Look up the tag */
1889 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
1891 /* Accept that choice */
1892 (*cp) = 0 - floor_list[k];
1894 /* Forget restrictions */
1896 item_tester_hook = NULL;
1897 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1903 prev_tag = '\0'; /* prev_tag is no longer effective */
1906 /* Validate the item */
1907 else if (item_tester_okay(¤t_floor_ptr->o_list[0 - (*cp)], tval) || (mode & USE_FULL))
1909 /* Forget restrictions */
1911 item_tester_hook = NULL;
1912 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1919 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
1920 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
1922 if (prev_tag && command_cmd)
1924 /* Look up the tag and validate the item */
1925 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, tval)) /* Reject */;
1926 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
1927 else if (!get_item_okay(k)) /* Reject */;
1930 /* Accept that choice */
1933 /* Forget restrictions */
1935 item_tester_hook = NULL;
1936 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1942 prev_tag = '\0'; /* prev_tag is no longer effective */
1945 /* Verify the item */
1946 else if (get_item_okay(*cp))
1948 /* Forget restrictions */
1950 item_tester_hook = NULL;
1951 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1965 /* No item selected */
1969 /* Full p_ptr->inventory_list */
1971 i2 = INVEN_PACK - 1;
1973 /* Forbid p_ptr->inventory_list */
1974 if (!inven) i2 = -1;
1977 for (j = 0; j < INVEN_PACK; j++)
1978 if (item_tester_okay(&p_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_inven++;
1981 /* Restrict p_ptr->inventory_list indexes */
1982 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
1983 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
1986 /* Full equipment */
1988 e2 = INVEN_TOTAL - 1;
1990 /* Forbid equipment */
1991 if (!equip) e2 = -1;
1994 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
1995 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_equip++;
1996 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
1999 /* Restrict equipment indexes */
2000 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2001 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2003 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2007 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2009 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2013 /* Count "okay" floor items */
2016 /* Restrict floor usage */
2019 /* Scan all objects in the grid */
2020 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2023 /* Accept p_ptr->inventory_list */
2024 if (i1 <= i2) allow_inven = TRUE;
2026 /* Accept equipment */
2027 if (e1 <= e2) allow_equip = TRUE;
2030 if (floor_num) allow_floor = TRUE;
2032 /* Require at least one legal choice */
2033 if (!allow_inven && !allow_equip && !allow_floor)
2035 /* Cancel p_ptr->command_see */
2036 command_see = FALSE;
2046 /* Analyze choices */
2049 /* Hack -- Start on equipment if requested */
2050 if (command_see && (command_wrk == (USE_EQUIP))
2053 command_wrk = (USE_EQUIP);
2056 /* Use p_ptr->inventory_list if allowed */
2057 else if (allow_inven)
2059 command_wrk = (USE_INVEN);
2062 /* Use equipment if allowed */
2063 else if (allow_equip)
2065 command_wrk = (USE_EQUIP);
2068 /* Use floor if allowed */
2069 else if (allow_floor)
2071 command_wrk = (USE_FLOOR);
2076 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2078 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2080 /* Hack -- start out in "display" mode */
2086 /* Repeat until done */
2089 COMMAND_CODE get_item_label = 0;
2096 for (j = 0; j < 8; j++)
2099 if (!angband_term[j]) continue;
2101 /* Count windows displaying inven */
2102 if (window_flag[j] & (PW_INVEN)) ni++;
2104 /* Count windows displaying equip */
2105 if (window_flag[j] & (PW_EQUIP)) ne++;
2108 /* Toggle if needed */
2109 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
2110 (command_wrk == (USE_INVEN) && !ni && ne))
2112 toggle_inven_equip(p_ptr);
2116 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2119 /* Inventory screen */
2120 if (command_wrk == (USE_INVEN))
2122 /* Extract the legal requests */
2126 /* Redraw if needed */
2127 if (command_see) get_item_label = show_inven(menu_line, mode, tval);
2130 /* Equipment screen */
2131 else if (command_wrk == (USE_EQUIP))
2133 /* Extract the legal requests */
2134 n1 = I2A(e1 - INVEN_RARM);
2135 n2 = I2A(e2 - INVEN_RARM);
2137 /* Redraw if needed */
2138 if (command_see) get_item_label = show_equip(menu_line, mode, tval);
2142 else if (command_wrk == (USE_FLOOR))
2145 k = MIN(floor_top + 23, floor_num) - 1;
2147 /* Extract the legal requests */
2148 n1 = I2A(j - floor_top);
2149 n2 = I2A(k - floor_top);
2151 /* Redraw if needed */
2152 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
2155 /* Viewing p_ptr->inventory_list */
2156 if (command_wrk == (USE_INVEN))
2158 /* Begin the prompt */
2159 sprintf(out_val, _("持ち物:", "Inven:"));
2163 /* Build the prompt */
2164 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2165 index_to_label(i1), index_to_label(i2));
2168 strcat(out_val, tmp_val);
2171 /* Indicate ability to "view" */
2172 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2178 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
2179 else if (allow_floor)
2180 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
2182 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
2189 strcat(out_val, _(" '-'床上,", " - for floor,"));
2190 else if (allow_equip)
2191 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
2193 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
2197 /* Viewing equipment */
2198 else if (command_wrk == (USE_EQUIP))
2200 /* Begin the prompt */
2201 sprintf(out_val, _("装備品:", "Equip:"));
2205 /* Build the prompt */
2206 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2207 index_to_label(e1), index_to_label(e2));
2210 strcat(out_val, tmp_val);
2213 /* Indicate ability to "view" */
2214 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2220 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
2221 else if (allow_floor)
2222 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
2224 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
2231 strcat(out_val, _(" '-'床上,", " - for floor,"));
2232 else if (allow_inven)
2233 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
2235 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
2240 else if (command_wrk == (USE_FLOOR))
2242 /* Begin the prompt */
2243 sprintf(out_val, _("床上:", "Floor:"));
2247 /* Build the prompt */
2248 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
2251 strcat(out_val, tmp_val);
2254 /* Indicate ability to "view" */
2255 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2259 if (allow_inven && allow_equip)
2261 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
2263 else if (allow_inven)
2265 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
2267 else if (allow_equip)
2269 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
2273 else if (allow_inven)
2275 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
2277 else if (allow_equip)
2279 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
2283 if (command_see && !use_menu)
2285 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
2290 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
2292 /* Finish the prompt */
2293 strcat(out_val, " ESC");
2295 /* Build the prompt */
2296 sprintf(tmp_val, "(%s) %s", out_val, pmt);
2298 /* Show the prompt */
2307 if (command_wrk == USE_INVEN) max_line = max_inven;
2308 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2309 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2325 menu_line += (max_line - 1);
2341 /* Verify legality */
2342 if (command_wrk == (USE_INVEN))
2344 if (allow_floor) command_wrk = USE_FLOOR;
2345 else if (allow_equip) command_wrk = USE_EQUIP;
2352 else if (command_wrk == (USE_EQUIP))
2354 if (allow_inven) command_wrk = USE_INVEN;
2355 else if (allow_floor) command_wrk = USE_FLOOR;
2362 else if (command_wrk == (USE_FLOOR))
2364 if (allow_equip) command_wrk = USE_EQUIP;
2365 else if (allow_inven) command_wrk = USE_INVEN;
2378 /* Hack -- Fix screen */
2385 /* Switch inven/equip */
2386 if (command_wrk == USE_INVEN) max_line = max_inven;
2387 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2388 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2389 if (menu_line > max_line) menu_line = max_line;
2391 /* Need to redraw */
2399 /* Verify legality */
2400 if (command_wrk == (USE_INVEN))
2402 if (allow_equip) command_wrk = USE_EQUIP;
2403 else if (allow_floor) command_wrk = USE_FLOOR;
2410 else if (command_wrk == (USE_EQUIP))
2412 if (allow_floor) command_wrk = USE_FLOOR;
2413 else if (allow_inven) command_wrk = USE_INVEN;
2420 else if (command_wrk == (USE_FLOOR))
2422 if (allow_inven) command_wrk = USE_INVEN;
2423 else if (allow_equip) command_wrk = USE_EQUIP;
2436 /* Hack -- Fix screen */
2443 /* Switch inven/equip */
2444 if (command_wrk == USE_INVEN) max_line = max_inven;
2445 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2446 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2447 if (menu_line > max_line) menu_line = max_line;
2449 /* Need to redraw */
2458 if (command_wrk == USE_FLOOR)
2461 (*cp) = -get_item_label;
2465 /* Validate the item */
2466 if (!get_item_okay(get_item_label))
2472 /* Allow player to "refuse" certain actions */
2473 if (!get_item_allow(get_item_label))
2479 /* Accept that choice */
2480 (*cp) = get_item_label;
2497 if (menu_line > max_line) menu_line -= max_line;
2518 command_see = FALSE;
2539 grid_type *g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
2541 if (command_wrk != (USE_FLOOR)) break;
2543 /* Get the object being moved. */
2544 o_idx = g_ptr->o_idx;
2546 /* Only rotate a pile of two or more objects. */
2547 if (!(o_idx && current_floor_ptr->o_list[o_idx].next_o_idx)) break;
2549 /* Remove the first object from the list. */
2550 excise_object_idx(o_idx);
2552 /* Find end of the list. */
2554 while (current_floor_ptr->o_list[i].next_o_idx)
2555 i = current_floor_ptr->o_list[i].next_o_idx;
2557 /* Add after the last object. */
2558 current_floor_ptr->o_list[i].next_o_idx = o_idx;
2560 /* Re-scan floor list */
2561 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2563 /* Hack -- Fix screen */
2575 if (command_wrk == (USE_INVEN))
2582 command_wrk = (USE_EQUIP);
2584 else if (command_wrk == (USE_EQUIP))
2591 command_wrk = (USE_INVEN);
2593 else if (command_wrk == (USE_FLOOR))
2597 command_wrk = (USE_INVEN);
2599 else if (allow_equip)
2601 command_wrk = (USE_EQUIP);
2610 /* Hack -- Fix screen */
2617 /* Need to redraw */
2630 * If we are already examining the floor, and there
2631 * is only one item, we will always select it.
2632 * If we aren't examining the floor and there is only
2633 * one item, we will select it if floor_query_flag
2638 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
2641 k = 0 - floor_list[0];
2643 /* Allow player to "refuse" certain actions */
2644 if (!get_item_allow(k))
2650 /* Accept that choice */
2659 /* Hack -- Fix screen */
2666 command_wrk = (USE_FLOOR);
2672 case '1': case '2': case '3':
2673 case '4': case '5': case '6':
2674 case '7': case '8': case '9':
2676 if (command_wrk != USE_FLOOR)
2678 /* Look up the tag */
2679 if (!get_tag(&k, which, command_wrk, tval))
2685 /* Hack -- Validate the item */
2686 if ((k < INVEN_RARM) ? !inven : !equip)
2692 /* Validate the item */
2693 if (!get_item_okay(k))
2701 /* Look up the alphabetical tag */
2702 if (get_tag_floor(&k, which, floor_list, floor_num))
2705 k = 0 - floor_list[k];
2714 /* Allow player to "refuse" certain actions */
2715 if (!get_item_allow(k))
2721 /* Accept that choice */
2733 /* Choose "default" p_ptr->inventory_list item */
2734 if (command_wrk == (USE_INVEN))
2736 k = ((i1 == i2) ? i1 : -1);
2739 /* Choose "default" equipment item */
2740 else if (command_wrk == (USE_EQUIP))
2742 k = ((e1 == e2) ? e1 : -1);
2745 /* Choose "default" floor item */
2746 else if (command_wrk == (USE_FLOOR))
2751 k = 0 - floor_list[0];
2753 /* Allow player to "refuse" certain actions */
2754 if (!get_item_allow(k))
2760 /* Accept that choice */
2768 /* Validate the item */
2769 if (!get_item_okay(k))
2775 /* Allow player to "refuse" certain actions */
2776 if (!get_item_allow(k))
2782 /* Accept that choice */
2806 if (command_wrk != USE_FLOOR)
2808 bool not_found = FALSE;
2810 /* Look up the alphabetical tag */
2811 if (!get_tag(&k, which, command_wrk, tval))
2816 /* Hack -- Validate the item */
2817 else if ((k < INVEN_RARM) ? !inven : !equip)
2822 /* Validate the item */
2823 else if (!get_item_okay(k))
2830 /* Accept that choice */
2840 /* Look up the alphabetical tag */
2841 if (get_tag_floor(&k, which, floor_list, floor_num))
2844 k = 0 - floor_list[k];
2846 /* Accept that choice */
2855 /* Extract "query" setting */
2856 ver = isupper(which);
2857 which = (char)tolower(which);
2859 /* Convert letter to p_ptr->inventory_list index */
2860 if (command_wrk == (USE_INVEN))
2862 if (which == '(') k = i1;
2863 else if (which == ')') k = i2;
2864 else k = label_to_inven(which);
2867 /* Convert letter to equipment index */
2868 else if (command_wrk == (USE_EQUIP))
2870 if (which == '(') k = e1;
2871 else if (which == ')') k = e2;
2872 else k = label_to_equip(which);
2875 /* Convert letter to floor index */
2876 else if (command_wrk == USE_FLOOR)
2878 if (which == '(') k = 0;
2879 else if (which == ')') k = floor_num - 1;
2880 else k = islower(which) ? A2I(which) : -1;
2881 if (k < 0 || k >= floor_num || k >= 23)
2888 k = 0 - floor_list[k];
2891 /* Validate the item */
2892 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
2898 /* Verify the item */
2899 if (ver && !verify(_("本当に", "Try"), k))
2905 /* Allow player to "refuse" certain actions */
2906 if (!get_item_allow(k))
2912 /* Accept that choice */
2922 /* Fix the screen if necessary */
2927 /* Hack -- Cancel "display" */
2928 command_see = FALSE;
2932 /* Forget the tval restriction */
2935 /* Forget the item_tester_hook restriction */
2936 item_tester_hook = NULL;
2939 /* Clean up 'show choices' */
2940 if (toggle) toggle_inven_equip(p_ptr);
2942 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2945 /* Clear the prompt line */
2948 /* Warning if needed */
2949 if (oops && str) msg_print(str);
2954 if (command_cmd) prev_tag = cur_tag;
2955 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2961 * @brief 床上のアイテムを拾う選択用サブルーチン
2962 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
2964 static bool py_pickup_floor_aux(void)
2966 OBJECT_IDX this_o_idx;
2970 /* Restrict the choices */
2971 item_tester_hook = inven_carry_okay;
2974 q = _("どれを拾いますか?", "Get which item? ");
2975 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
2977 if (choose_object(p_ptr, &item, q, s, (USE_FLOOR), 0))
2979 this_o_idx = 0 - item;
2986 /* Pick up the object */
2987 py_pickup_aux(this_o_idx);
2993 * @brief 床上のアイテムを拾うメイン処理
2994 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
2997 * This is called by py_pickup() when easy_floor is TRUE.
2999 void py_pickup_floor(bool pickup)
3001 OBJECT_IDX this_o_idx, next_o_idx = 0;
3003 GAME_TEXT o_name[MAX_NLEN];
3007 OBJECT_IDX floor_o_idx = 0;
3011 /* Scan the pile of objects */
3012 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)
3014 /* Access the object */
3015 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3017 object_desc(o_name, o_ptr, 0);
3019 /* Access the next object */
3020 next_o_idx = o_ptr->next_o_idx;
3022 disturb(p_ptr, FALSE, FALSE);
3025 if (o_ptr->tval == TV_GOLD)
3028 msg_format(" $%ld の価値がある%sを見つけた。",
3029 (long)o_ptr->pval, o_name);
3031 msg_format("You have found %ld gold pieces worth of %s.",
3032 (long)o_ptr->pval, o_name);
3035 /* Collect the gold */
3036 p_ptr->au += o_ptr->pval;
3039 p_ptr->redraw |= (PR_GOLD);
3041 p_ptr->window |= (PW_PLAYER);
3043 /* Delete the gold */
3044 delete_object_idx(this_o_idx);
3046 /* Check the next object */
3049 else if (o_ptr->marked & OM_NOMSG)
3051 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
3052 * ignored. Otherwise, they are included in the prompt. */
3053 o_ptr->marked &= ~(OM_NOMSG);
3057 /* Count non-gold objects that can be picked up. */
3058 if (inven_carry_okay(o_ptr))
3063 /* Count non-gold objects */
3066 /* Remember this index */
3067 floor_o_idx = this_o_idx;
3070 /* There are no non-gold objects */
3074 /* Mention the number of objects */
3080 /* Access the object */
3081 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
3083 #ifdef ALLOW_EASY_SENSE
3085 /* Option: Make object sensing easy */
3088 /* Sense the object */
3089 (void)sense_object(o_ptr);
3092 #endif /* ALLOW_EASY_SENSE */
3094 object_desc(o_name, o_ptr, 0);
3096 msg_format(_("%sがある。", "You see %s."), o_name);
3099 /* Multiple objects */
3102 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
3108 /* The player has no room for anything on the floor. */
3114 /* Access the object */
3115 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
3117 #ifdef ALLOW_EASY_SENSE
3119 /* Option: Make object sensing easy */
3122 /* Sense the object */
3123 (void)sense_object(o_ptr);
3126 #endif /* ALLOW_EASY_SENSE */
3128 object_desc(o_name, o_ptr, 0);
3130 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
3133 /* Multiple objects */
3136 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
3146 /* Hack -- query every object */
3147 if (carry_query_flag)
3149 char out_val[MAX_NLEN + 20];
3151 /* Access the object */
3152 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
3154 #ifdef ALLOW_EASY_SENSE
3156 /* Option: Make object sensing easy */
3159 /* Sense the object */
3160 (void)sense_object(o_ptr);
3163 #endif /* ALLOW_EASY_SENSE */
3165 object_desc(o_name, o_ptr, 0);
3167 (void)sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
3169 /* Ask the user to confirm */
3170 if (!get_check(out_val))
3176 /* Access the object */
3177 o_ptr = ¤t_floor_ptr->o_list[floor_o_idx];
3179 #ifdef ALLOW_EASY_SENSE
3181 /* Option: Make object sensing easy */
3184 /* Sense the object */
3185 (void)sense_object(o_ptr);
3188 #endif /* ALLOW_EASY_SENSE */
3190 /* Pick up the object */
3191 py_pickup_aux(floor_o_idx);
3194 /* Allow the user to choose an object */
3197 while (can_pickup--)
3199 if (!py_pickup_floor_aux()) break;
3207 * @brief 所持アイテム一覧を表示する /
3208 * Choice window "shadow" of the "show_inven()" function
3211 void display_inven(OBJECT_TYPE_VALUE tval)
3213 register int i, n, z = 0;
3215 TERM_COLOR attr = TERM_WHITE;
3217 GAME_TEXT o_name[MAX_NLEN];
3220 Term_get_size(&wid, &hgt);
3222 for (i = 0; i < INVEN_PACK; i++)
3224 o_ptr = &p_ptr->inventory_list[i];
3225 if (!o_ptr->k_idx) continue;
3229 for (i = 0; i < z; i++)
3231 o_ptr = &p_ptr->inventory_list[i];
3232 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
3233 if (item_tester_okay(o_ptr, tval))
3235 tmp_val[0] = index_to_label(i);
3239 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
3240 object_desc(o_name, o_ptr, 0);
3242 attr = tval_to_attr[o_ptr->tval % 128];
3248 Term_putstr(3, i, n, attr, o_name);
3249 Term_erase(3 + n, i, 255);
3253 int wgt = o_ptr->weight * o_ptr->number;
3255 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
3257 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3259 prt(tmp_val, i, wid - 9);
3263 for (i = z; i < hgt; i++)
3265 Term_erase(0, i, 255);
3271 * @brief 装備アイテムの表示を行う /
3272 * Display the equipment.
3273 * @param target_item アイテムの選択処理を行うか否か。
3274 * @return 選択したアイテムのタグ
3276 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
3280 int col, cur_col, len;
3283 GAME_TEXT o_name[MAX_NLEN];
3284 COMMAND_CODE out_index[23];
3285 TERM_COLOR out_color[23];
3286 char out_desc[23][MAX_NLEN];
3287 COMMAND_CODE target_item_label = 0;
3289 char equip_label[52 + 1];
3291 /* Starting column */
3294 Term_get_size(&wid, &hgt);
3296 /* Maximal length */
3297 len = wid - col - 1;
3300 /* Scan the equipment list */
3301 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3303 o_ptr = &p_ptr->inventory_list[i];
3305 /* Is this item acceptable? */
3306 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr, tval) || (mode & USE_FULL)) &&
3307 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
3308 (mode & IGNORE_BOTHHAND_SLOT))) continue;
3310 object_desc(o_name, o_ptr, 0);
3312 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
3314 (void)strcpy(out_desc[k], _("(武器を両手持ち)", "(wielding with two-hands)"));
3315 out_color[k] = TERM_WHITE;
3319 (void)strcpy(out_desc[k], o_name);
3320 out_color[k] = tval_to_attr[o_ptr->tval % 128];
3324 /* Grey out charging items */
3327 out_color[k] = TERM_L_DARK;
3330 /* Extract the maximal length (see below) */
3332 l = strlen(out_desc[k]) + (2 + 1);
3334 l = strlen(out_desc[k]) + (2 + 3);
3338 /* Increase length for labels (if needed) */
3340 if (show_labels) l += (7 + 2);
3342 if (show_labels) l += (14 + 2);
3346 /* Increase length for weight (if needed) */
3347 if (show_weights) l += 9;
3349 if (show_item_graph) l += 2;
3351 /* Maintain the max-length */
3352 if (l > len) len = l;
3354 /* Advance the entry */
3358 /* Hack -- Find a column to start in */
3360 col = (len > wid - 6) ? 0 : (wid - len - 1);
3362 col = (len > wid - 4) ? 0 : (wid - len - 1);
3365 prepare_label_string(equip_label, USE_EQUIP, tval);
3367 /* Output each entry */
3368 for (j = 0; j < k; j++)
3371 o_ptr = &p_ptr->inventory_list[i];
3373 /* Clear the line */
3374 prt("", j + 1, col ? col - 2 : col);
3376 if (use_menu && target_item)
3378 if (j == (target_item - 1))
3380 strcpy(tmp_val, _("》", "> "));
3381 target_item_label = i;
3383 else strcpy(tmp_val, " ");
3385 else if (i >= INVEN_RARM)
3387 /* Prepare an index --(-- */
3388 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
3392 /* Prepare an index --(-- */
3393 sprintf(tmp_val, "%c)", index_to_label(i));
3396 /* Clear the line with the (possibly indented) index */
3397 put_str(tmp_val, j + 1, col);
3401 /* Display graphics for object, if desired */
3402 if (show_item_graph)
3404 TERM_COLOR a = object_attr(o_ptr);
3405 SYMBOL_CODE c = object_char(o_ptr);
3406 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
3407 if (use_bigtile) cur_col++;
3415 /* Mention the use */
3416 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(p_ptr, i));
3418 put_str(tmp_val, j + 1, cur_col);
3420 /* Display the entry itself */
3421 c_put_str(out_color[j], out_desc[j], j + 1, _(cur_col + 9, cur_col + 16));
3427 /* Display the entry itself */
3428 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
3431 /* Display the weight if needed */
3434 int wgt = o_ptr->weight * o_ptr->number;
3436 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
3438 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
3441 prt(tmp_val, j + 1, wid - 9);
3445 /* Make a "shadow" below the list (only if needed) */
3446 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3448 /* Save the new column */
3451 return target_item_label;
3456 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
3457 * Return a string describing how a given item is being worn.
3458 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
3459 * @return 状態表現内容の文字列ポインタ
3461 * Currently, only used for items in the equipment, not p_ptr->inventory_list.
3463 concptr describe_use(int i)
3470 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
3472 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
3476 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
3478 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
3481 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < p_ptr->inventory_list[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
3482 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
3483 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
3484 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
3485 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
3486 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
3487 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
3488 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
3489 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
3490 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
3491 default: p = _("ザックに入っている", "carrying in your pack"); break;
3494 /* Return the result */