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(player_type *creature_ptr, OBJECT_TYPE_VALUE tval)
128 TERM_COLOR attr = TERM_WHITE;
130 GAME_TEXT o_name[MAX_NLEN];
133 if (!creature_ptr || !creature_ptr->inventory_list) return;
135 Term_get_size(&wid, &hgt);
137 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
139 o_ptr = &creature_ptr->inventory_list[i];
140 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
141 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr, tval))
143 tmp_val[0] = index_to_label(i);
147 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
148 if ((((i == INVEN_RARM) && creature_ptr->hidarite) || ((i == INVEN_LARM) && creature_ptr->migite)) && creature_ptr->ryoute)
150 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
155 object_desc(o_name, o_ptr, 0);
156 attr = tval_to_attr[o_ptr->tval % 128];
164 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
166 Term_erase(3 + n, i - INVEN_RARM, 255);
170 int wgt = o_ptr->weight * o_ptr->number;
172 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
174 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
177 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
182 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
183 prt(mention_use(creature_ptr, i), i - INVEN_RARM, wid - 15);
187 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
189 Term_erase(0, i, 255);
194 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
195 * Flip "inven" and "equip" in any sub-windows
198 void toggle_inven_equip(player_type *creature_ptr)
203 for (j = 0; j < 8; j++)
206 if (!angband_term[j]) continue;
208 /* Flip inven to equip */
209 if (window_flag[j] & (PW_INVEN))
212 window_flag[j] &= ~(PW_INVEN);
213 window_flag[j] |= (PW_EQUIP);
215 creature_ptr->window |= (PW_EQUIP);
218 /* Flip inven to equip */
219 else if (window_flag[j] & (PW_EQUIP))
222 window_flag[j] &= ~(PW_EQUIP);
223 window_flag[j] |= (PW_INVEN);
225 creature_ptr->window |= (PW_INVEN);
232 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
233 * Auxiliary function for "get_item()" -- test an index
235 * @return 正規のIDならばTRUEを返す。
237 bool get_item_okay(OBJECT_IDX i)
240 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
242 if (select_ring_slot) return is_ring_slot(i);
244 /* Verify the item */
245 if (!item_tester_okay(&p_ptr->inventory_list[i], item_tester_tval)) return (FALSE);
252 * @brief 規定の処理にできるアイテムがプレイヤーの利用可能範囲内にあるかどうかを返す /
253 * Determine whether get_item() can get some item or not
254 * @return アイテムを拾えるならばTRUEを返す。
255 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
257 bool can_get_item(OBJECT_TYPE_VALUE tval)
260 OBJECT_IDX floor_list[23];
261 ITEM_NUMBER floor_num = 0;
263 for (j = 0; j < INVEN_TOTAL; j++)
264 if (item_tester_okay(&p_ptr->inventory_list[j], tval))
267 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
276 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
277 * Find the "first" p_ptr->inventory_list object with the given "tag".
278 * @param cp 対応するタグIDを与える参照ポインタ
279 * @param tag 該当するオブジェクトがあるかを調べたいタグ
280 * @param floor_list 床上アイテムの配列
281 * @param floor_num 床上アイテムの配列ID
282 * @return タグに該当するオブジェクトがあるならTRUEを返す
284 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
285 * inscription of an object. Alphabetical characters don't work as a\n
286 * tag in this form.\n
288 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
289 * and "x" is the "current" command_cmd code.\n
291 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
296 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
298 /* Check every object in the grid */
299 for (i = 0; i < floor_num && i < 23; i++)
301 object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[floor_list[i]];
303 /* Skip empty inscriptions */
304 if (!o_ptr->inscription) continue;
307 s = my_strchr(quark_str(o_ptr->inscription), '@');
309 /* Process all tags */
312 /* Check the special tags */
313 if ((s[1] == command_cmd) && (s[2] == tag))
315 /* Save the actual floor object ID */
322 /* Find another '@' */
323 s = my_strchr(s + 1, '@');
328 /**** Find a tag in the form of {@#} (allows only numerals) ***/
330 /* Don't allow {@#} with '#' being alphabet */
331 if (tag < '0' || '9' < tag)
337 /* Check every object in the grid */
338 for (i = 0; i < floor_num && i < 23; i++)
340 object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[floor_list[i]];
342 /* Skip empty inscriptions */
343 if (!o_ptr->inscription) continue;
346 s = my_strchr(quark_str(o_ptr->inscription), '@');
348 /* Process all tags */
351 /* Check the normal tags */
354 /* Save the floor object ID */
361 /* Find another '@' */
362 s = my_strchr(s + 1, '@');
372 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
373 * Find the "first" p_ptr->inventory_list object with the given "tag".
374 * @param cp 対応するタグIDを与える参照ポインタ
375 * @param tag 該当するオブジェクトがあるかを調べたいタグ
376 * @param mode 所持、装備の切り替え
377 * @return タグに該当するオブジェクトがあるならTRUEを返す
379 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
380 * inscription of an object. Alphabetical characters don't work as a\n
381 * tag in this form.\n
383 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
384 * and "x" is the "current" command_cmd code.\n
386 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
389 COMMAND_CODE start, end;
392 /* Extract index from mode */
397 end = INVEN_TOTAL - 1;
402 end = INVEN_PACK - 1;
409 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
411 /* Check every p_ptr->inventory_list object */
412 for (i = start; i <= end; i++)
414 object_type *o_ptr = &p_ptr->inventory_list[i];
415 if (!o_ptr->k_idx) continue;
417 /* Skip empty inscriptions */
418 if (!o_ptr->inscription) continue;
420 /* Skip non-choice */
421 if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue;
424 s = my_strchr(quark_str(o_ptr->inscription), '@');
426 /* Process all tags */
429 /* Check the special tags */
430 if ((s[1] == command_cmd) && (s[2] == tag))
432 /* Save the actual p_ptr->inventory_list ID */
439 /* Find another '@' */
440 s = my_strchr(s + 1, '@');
445 /**** Find a tag in the form of {@#} (allows only numerals) ***/
447 /* Don't allow {@#} with '#' being alphabet */
448 if (tag < '0' || '9' < tag)
454 /* Check every object */
455 for (i = start; i <= end; i++)
457 object_type *o_ptr = &p_ptr->inventory_list[i];
458 if (!o_ptr->k_idx) continue;
460 /* Skip empty inscriptions */
461 if (!o_ptr->inscription) continue;
463 /* Skip non-choice */
464 if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue;
467 s = my_strchr(quark_str(o_ptr->inscription), '@');
469 /* Process all tags */
472 /* Check the normal tags */
475 /* Save the actual p_ptr->inventory_list ID */
482 /* Find another '@' */
483 s = my_strchr(s + 1, '@');
492 * @brief タグIDにあわせてタグアルファベットのリストを返す /
493 * Move around label characters with correspond tags
494 * @param label ラベルリストを取得する文字列参照ポインタ
495 * @param mode 所持品リストか装備品リストかの切り替え
498 void prepare_label_string(char *label, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
500 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
501 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
504 /* Prepare normal labels */
505 strcpy(label, alphabet_chars);
507 /* Move each label */
508 for (i = 0; i < 52; i++)
511 SYMBOL_CODE c = alphabet_chars[i];
513 /* Find a tag with this label */
514 if (get_tag(&index, c, mode, tval))
516 /* Delete the overwritten label */
517 if (label[i] == c) label[i] = ' ';
519 /* Move the label to the place of corresponding tag */
520 label[index - offset] = c;
527 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
528 * Move around label characters with correspond tags (floor version)
529 * @param label ラベルリストを取得する文字列参照ポインタ
530 * @param floor_list 床上アイテムの配列
531 * @param floor_num 床上アイテムの配列ID
536 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
538 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
541 /* Prepare normal labels */
542 strcpy(label, alphabet_chars);
544 /* Move each label */
545 for (i = 0; i < 52; i++)
548 SYMBOL_CODE c = alphabet_chars[i];
550 /* Find a tag with this label */
551 if (get_tag_floor(&index, c, floor_list, floor_num))
553 /* Delete the overwritten label */
554 if (label[i] == c) label[i] = ' ';
556 /* Move the label to the place of corresponding tag */
563 * @brief 所持アイテムの表示を行う /
564 * Display the p_ptr->inventory_list.
565 * @param target_item アイテムの選択処理を行うか否か。
566 * @return 選択したアイテムのタグ
568 * Hack -- do not display "trailing" empty slots
570 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
574 int col, cur_col, len;
576 GAME_TEXT o_name[MAX_NLEN];
578 COMMAND_CODE out_index[23];
579 TERM_COLOR out_color[23];
580 char out_desc[23][MAX_NLEN];
581 COMMAND_CODE target_item_label = 0;
583 char inven_label[52 + 1];
585 /* Starting column */
588 Term_get_size(&wid, &hgt);
590 /* Default "max-length" */
594 /* Find the "final" slot */
595 for (i = 0; i < INVEN_PACK; i++)
597 o_ptr = &p_ptr->inventory_list[i];
598 if (!o_ptr->k_idx) continue;
604 prepare_label_string(inven_label, USE_INVEN, tval);
606 /* Display the p_ptr->inventory_list */
607 for (k = 0, i = 0; i < z; i++)
609 o_ptr = &p_ptr->inventory_list[i];
611 /* Is this item acceptable? */
612 if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue;
614 object_desc(o_name, o_ptr, 0);
616 /* Save the object index, color, and description */
618 out_color[k] = tval_to_attr[o_ptr->tval % 128];
620 /* Grey out charging items */
623 out_color[k] = TERM_L_DARK;
626 (void)strcpy(out_desc[k], o_name);
628 /* Find the predicted "line length" */
629 l = strlen(out_desc[k]) + 5;
631 /* Be sure to account for the weight */
632 if (show_weights) l += 9;
634 /* Account for icon if displayed */
638 if (use_bigtile) l++;
641 /* Maintain the maximum length */
642 if (l > len) len = l;
644 /* Advance to next "line" */
648 /* Find the column to start in */
649 col = (len > wid - 4) ? 0 : (wid - len - 1);
651 /* Output each entry */
652 for (j = 0; j < k; j++)
655 o_ptr = &p_ptr->inventory_list[i];
658 prt("", j + 1, col ? col - 2 : col);
660 if (use_menu && target_item)
662 if (j == (target_item - 1))
664 strcpy(tmp_val, _("》", "> "));
665 target_item_label = i;
667 else strcpy(tmp_val, " ");
669 else if (i <= INVEN_PACK)
671 /* Prepare an index --(-- */
672 sprintf(tmp_val, "%c)", inven_label[i]);
676 /* Prepare an index --(-- */
677 sprintf(tmp_val, "%c)", index_to_label(i));
680 /* Clear the line with the (possibly indented) index */
681 put_str(tmp_val, j + 1, col);
685 /* Display graphics for object, if desired */
688 TERM_COLOR a = object_attr(o_ptr);
689 SYMBOL_CODE c = object_char(o_ptr);
690 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
691 if (use_bigtile) cur_col++;
697 /* Display the entry itself */
698 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
700 /* Display the weight if needed */
703 int wgt = o_ptr->weight * o_ptr->number;
705 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
707 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
710 prt(tmp_val, j + 1, wid - 9);
714 /* Make a "shadow" below the list (only if needed) */
715 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
717 /* Save the new column */
720 return target_item_label;
725 * @brief 選択したアイテムの確認処理の補助 /
726 * Verify the choice of an item.
727 * @param prompt メッセージ表示の一部
728 * @param item 選択アイテムID
729 * @return 確認がYesならTRUEを返す。
730 * @details The item can be negative to mean "item on floor".
732 static bool verify(concptr prompt, INVENTORY_IDX item)
734 GAME_TEXT o_name[MAX_NLEN];
735 char out_val[MAX_NLEN + 20];
742 o_ptr = &p_ptr->inventory_list[item];
748 o_ptr = &p_ptr->current_floor_ptr->o_list[0 - item];
750 object_desc(o_name, o_ptr, 0);
753 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
756 return (get_check(out_val));
761 * @brief 選択したアイテムの確認処理のメインルーチン /
762 * @param item 選択アイテムID
763 * @return 確認がYesならTRUEを返す。
764 * @details The item can be negative to mean "item on floor".
765 * Hack -- allow user to "prevent" certain choices
767 static bool get_item_allow(INVENTORY_IDX item)
771 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
776 o_ptr = &p_ptr->inventory_list[item];
782 o_ptr = &p_ptr->current_floor_ptr->o_list[0 - item];
786 if (!o_ptr->inscription) return (TRUE);
789 s = my_strchr(quark_str(o_ptr->inscription), '!');
791 /* Process preventions */
794 /* Check the "restriction" */
795 if ((s[1] == command_cmd) || (s[1] == '*'))
797 /* Verify the choice */
798 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
801 /* Find another '!' */
802 s = my_strchr(s + 1, '!');
811 * @brief オブジェクト選択の汎用関数 /
812 * Let the user select an item, save its "index"
813 * @param cp 選択したオブジェクトのIDを返す。
814 * @param pmt 選択目的のメッセージ
815 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
816 * @param mode オプションフラグ
817 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
818 * Return TRUE only if an acceptable item was chosen by the user.\n
820 * The selected item must satisfy the "item_tester_hook()" function,\n
821 * if that hook is set, and the "item_tester_tval", if that value is set.\n
823 * All "item_tester" restrictions are cleared before this function returns.\n
825 * The user is allowed to choose acceptable items from the equipment,\n
826 * p_ptr->inventory_list, or floor, respectively, if the proper flag was given,\n
827 * and there are any acceptable items in that location.\n
829 * The equipment or p_ptr->inventory_list are displayed (even if no acceptable\n
830 * items are in that location) if the proper flag was given.\n
832 * If there are no acceptable items available anywhere, and "str" is\n
833 * not NULL, then it will be used as the text of a warning message\n
834 * before the function returns.\n
836 * Note that the user must press "-" to specify the item on the floor,\n
837 * and there is no way to "examine" the item on the floor, while the\n
838 * use of "capital" letters will "examine" an p_ptr->inventory_list/equipment item,\n
839 * and prompt for its use.\n
841 * If a legal item is selected from the p_ptr->inventory_list, we save it in "cp"\n
842 * directly (0 to 35), and return TRUE.\n
844 * If a legal item is selected from the floor, we save it in "cp" as\n
845 * a negative (-1 to -511), and return TRUE.\n
847 * If no item is available, we do nothing to "cp", and we display a\n
848 * warning message, using "str" if available, and return FALSE.\n
850 * If no item is selected, we do nothing to "cp", and return FALSE.\n
852 * Global "p_ptr->command_new" is used when viewing the p_ptr->inventory_list or equipment\n
853 * to allow the user to enter a command while viewing those screens, and\n
854 * also to induce "auto-enter" of stores, and other such stuff.\n
856 * Global "p_ptr->command_see" may be set before calling this function to start\n
857 * out in "browse" mode. It is cleared before this function returns.\n
859 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
860 * If it is TRUE then we are viewing p_ptr->inventory_list, else equipment.\n
862 * We always erase the prompt when we are done, leaving a blank line,\n
863 * or a warning message, if appropriate, if no items are available.\n
865 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
867 OBJECT_IDX this_o_idx, next_o_idx = 0;
884 bool allow_floor = FALSE;
891 int menu_line = (use_menu ? 1 : 0);
895 static char prev_tag = '\0';
898 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode, tval);
901 if (mode & USE_EQUIP) equip = TRUE;
902 if (mode & USE_INVEN) inven = TRUE;
903 if (mode & USE_FLOOR) floor = TRUE;
905 /* Get the item index */
909 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
912 item_tester_hook = NULL;
913 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
918 else if (floor && (*cp < 0))
924 o_ptr = &p_ptr->current_floor_ptr->o_list[k];
926 /* Validate the item */
927 if (item_tester_okay(o_ptr, tval) || (mode & USE_FULL))
929 /* Forget restrictions */
931 item_tester_hook = NULL;
932 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
939 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
940 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
942 if (prev_tag && command_cmd)
944 /* Look up the tag and validate the item */
945 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, tval)) /* Reject */;
946 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
947 else if (!get_item_okay(k)) /* Reject */;
950 /* Accept that choice */
953 /* Forget restrictions */
955 item_tester_hook = NULL;
956 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
962 prev_tag = '\0'; /* prev_tag is no longer effective */
965 /* Verify the item */
966 else if (get_item_okay(*cp))
968 /* Forget restrictions */
970 item_tester_hook = NULL;
971 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
983 /* No item selected */
987 /* Full p_ptr->inventory_list */
991 /* Forbid p_ptr->inventory_list */
995 for (j = 0; j < INVEN_PACK; j++)
996 if (item_tester_okay(&p_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_inven++;
999 /* Restrict p_ptr->inventory_list indexes */
1000 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
1001 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
1004 /* Full equipment */
1006 e2 = INVEN_TOTAL - 1;
1008 /* Forbid equipment */
1009 if (!equip) e2 = -1;
1012 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
1013 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_equip++;
1014 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
1017 /* Restrict equipment indexes */
1018 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
1019 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
1021 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
1025 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
1027 else if (p_ptr->hidarite) e1 = INVEN_RARM;
1031 /* Restrict floor usage */
1034 /* Scan all objects in the grid */
1035 for (this_o_idx = p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
1038 o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
1039 next_o_idx = o_ptr->next_o_idx;
1041 /* Accept the item on the floor if legal */
1042 if ((item_tester_okay(o_ptr, tval) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
1046 /* Require at least one legal choice */
1047 if (!allow_floor && (i1 > i2) && (e1 > e2))
1049 /* Cancel p_ptr->command_see */
1050 command_see = FALSE;
1054 if (mode & USE_FORCE) {
1060 /* Analyze choices */
1063 /* Hack -- Start on equipment if requested */
1064 if (command_see && command_wrk && equip)
1069 /* Use p_ptr->inventory_list if allowed */
1072 command_wrk = FALSE;
1075 /* Use equipment if allowed */
1081 /* Use p_ptr->inventory_list for floor */
1084 command_wrk = FALSE;
1090 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
1092 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
1094 /* Hack -- start out in "display" mode */
1101 /* Repeat until done */
1104 COMMAND_CODE get_item_label = 0;
1111 for (j = 0; j < 8; j++)
1114 if (!angband_term[j]) continue;
1116 /* Count windows displaying inven */
1117 if (window_flag[j] & (PW_INVEN)) ni++;
1119 /* Count windows displaying equip */
1120 if (window_flag[j] & (PW_EQUIP)) ne++;
1123 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
1125 toggle_inven_equip(p_ptr);
1129 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1132 /* Inventory screen */
1135 /* Redraw if needed */
1136 if (command_see) get_item_label = show_inven(menu_line, mode, tval);
1139 /* Equipment screen */
1142 /* Redraw if needed */
1143 if (command_see) get_item_label = show_equip(menu_line, mode, tval);
1146 /* Viewing p_ptr->inventory_list */
1149 /* Begin the prompt */
1150 sprintf(out_val, _("持ち物:", "Inven:"));
1152 /* Some legal items */
1153 if ((i1 <= i2) && !use_menu)
1155 /* Build the prompt */
1156 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
1157 index_to_label(i1), index_to_label(i2));
1160 strcat(out_val, tmp_val);
1163 /* Indicate ability to "view" */
1164 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
1167 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
1170 /* Viewing equipment */
1173 /* Begin the prompt */
1174 sprintf(out_val, _("装備品:", "Equip:"));
1176 /* Some legal items */
1177 if ((e1 <= e2) && !use_menu)
1179 /* Build the prompt */
1180 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
1181 index_to_label(e1), index_to_label(e2));
1184 strcat(out_val, tmp_val);
1187 /* Indicate ability to "view" */
1188 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
1191 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
1194 /* Indicate legality of the "floor" item */
1195 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
1196 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
1198 /* Finish the prompt */
1199 strcat(out_val, " ESC");
1201 /* Build the prompt */
1202 sprintf(tmp_val, "(%s) %s", out_val, pmt);
1204 /* Show the prompt */
1212 int max_line = (command_wrk ? max_equip : max_inven);
1228 menu_line += (max_line - 1);
1247 /* Verify legality */
1248 if (!inven || !equip)
1254 /* Hack -- Fix screen */
1261 /* Switch inven/equip */
1262 command_wrk = !command_wrk;
1263 max_line = (command_wrk ? max_equip : max_inven);
1264 if (menu_line > max_line) menu_line = max_line;
1266 /* Need to redraw */
1275 if (command_wrk == USE_FLOOR)
1278 (*cp) = -get_item_label;
1282 /* Validate the item */
1283 if (!get_item_okay(get_item_label))
1289 /* Allow player to "refuse" certain actions */
1290 if (!get_item_allow(get_item_label))
1296 /* Accept that choice */
1297 (*cp) = get_item_label;
1306 if (mode & USE_FORCE) {
1314 if (menu_line > max_line) menu_line -= max_line;
1335 command_see = FALSE;
1352 /* Verify legality */
1353 if (!inven || !equip)
1359 /* Hack -- Fix screen */
1366 /* Switch inven/equip */
1367 command_wrk = !command_wrk;
1369 /* Need to redraw */
1375 /* Use floor item */
1378 /* Scan all objects in the grid */
1379 for (this_o_idx = p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
1382 o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
1383 next_o_idx = o_ptr->next_o_idx;
1385 /* Validate the item */
1386 if (!item_tester_okay(o_ptr, tval) && !(mode & USE_FULL)) continue;
1391 /* Verify the item (if required) */
1392 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
1394 /* Allow player to "refuse" certain actions */
1395 if (!get_item_allow(k)) continue;
1397 /* Accept that choice */
1413 case '1': case '2': case '3':
1414 case '4': case '5': case '6':
1415 case '7': case '8': case '9':
1417 /* Look up the tag */
1418 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN, tval))
1424 /* Hack -- Validate the item */
1425 if ((k < INVEN_RARM) ? !inven : !equip)
1431 /* Validate the item */
1432 if (!get_item_okay(k))
1438 /* Allow player to "refuse" certain actions */
1439 if (!get_item_allow(k))
1445 /* Accept that choice */
1457 /* Choose "default" p_ptr->inventory_list item */
1460 k = ((i1 == i2) ? i1 : -1);
1463 /* Choose "default" equipment item */
1466 k = ((e1 == e2) ? e1 : -1);
1469 /* Validate the item */
1470 if (!get_item_okay(k))
1476 /* Allow player to "refuse" certain actions */
1477 if (!get_item_allow(k))
1483 /* Accept that choice */
1493 if (mode & USE_FORCE) {
1506 bool not_found = FALSE;
1508 /* Look up the alphabetical tag */
1509 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN, tval))
1514 /* Hack -- Validate the item */
1515 else if ((k < INVEN_RARM) ? !inven : !equip)
1520 /* Validate the item */
1521 else if (!get_item_okay(k))
1528 /* Accept that choice */
1536 /* Extract "query" setting */
1537 ver = isupper(which);
1538 which = (char)tolower(which);
1540 /* Convert letter to p_ptr->inventory_list index */
1543 if (which == '(') k = i1;
1544 else if (which == ')') k = i2;
1545 else k = label_to_inven(which);
1548 /* Convert letter to equipment index */
1551 if (which == '(') k = e1;
1552 else if (which == ')') k = e2;
1553 else k = label_to_equip(which);
1556 /* Validate the item */
1557 if (!get_item_okay(k))
1563 /* Verify the item */
1564 if (ver && !verify(_("本当に", "Try"), k))
1570 /* Allow player to "refuse" certain actions */
1571 if (!get_item_allow(k))
1577 /* Accept that choice */
1588 /* Fix the screen if necessary */
1593 /* Hack -- Cancel "display" */
1594 command_see = FALSE;
1598 /* Forget the tval restriction */
1601 /* Forget the item_tester_hook restriction */
1602 item_tester_hook = NULL;
1605 /* Clean up 'show choices' */
1606 if (toggle) toggle_inven_equip(p_ptr);
1608 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1611 /* Clear the prompt line */
1614 /* Warning if needed */
1615 if (oops && str) msg_print(str);
1620 if (command_cmd) prev_tag = cur_tag;
1621 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1627 * Choose an item and get auto-picker entry from it.
1629 object_type *choose_object(player_type *creature_ptr, OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option, OBJECT_TYPE_VALUE tval)
1632 if (!get_item(&item, q, s, option, tval)) return NULL;
1633 if (idx) *idx = item;
1634 if (item == INVEN_FORCE) return NULL;
1635 return REF_ITEM(creature_ptr, p_ptr->current_floor_ptr, item);
1640 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
1641 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
1642 * @param y 走査するフロアのY座標
1643 * @param x 走査するフロアのX座標
1644 * @param mode オプションフラグ
1645 * @return 対象のマスに落ちているアイテム数
1647 * Return a list of o_list[] indexes of items at the given floor
1648 * location. Valid flags are:
1650 * mode & 0x01 -- Item tester
1651 * mode & 0x02 -- Marked items only
1652 * mode & 0x04 -- Stop after first
1654 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
1656 OBJECT_IDX this_o_idx, next_o_idx;
1658 ITEM_NUMBER num = 0;
1661 if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return 0;
1663 /* Scan all objects in the grid */
1664 for (this_o_idx = p_ptr->current_floor_ptr->grid_array[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
1667 o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
1668 next_o_idx = o_ptr->next_o_idx;
1671 if ((mode & 0x01) && !item_tester_okay(o_ptr, item_tester_tval)) continue;
1674 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
1676 /* Accept this item */
1677 /* XXX Hack -- Enforce limit */
1679 items[num] = this_o_idx;
1684 if (mode & 0x04) break;
1691 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
1692 * @param target_item カーソルの初期値
1693 * @param y 走査するフロアのY座標
1694 * @param x 走査するフロアのX座標
1695 * @param min_width 表示の長さ
1696 * @return 選択したアイテムの添え字
1699 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
1707 GAME_TEXT o_name[MAX_NLEN];
1710 COMMAND_CODE out_index[23];
1711 TERM_COLOR out_color[23];
1712 char out_desc[23][MAX_NLEN];
1713 COMMAND_CODE target_item_label = 0;
1715 OBJECT_IDX floor_list[23];
1716 ITEM_NUMBER floor_num;
1718 char floor_label[52 + 1];
1720 bool dont_need_to_show_weights = TRUE;
1722 Term_get_size(&wid, &hgt);
1724 /* Default length */
1725 len = MAX((*min_width), 20);
1727 /* Scan for objects in the grid, using item_tester_okay() */
1728 floor_num = scan_floor(floor_list, y, x, 0x03);
1730 /* Display the floor objects */
1731 for (k = 0, i = 0; i < floor_num && i < 23; i++)
1733 o_ptr = &p_ptr->current_floor_ptr->o_list[floor_list[i]];
1735 object_desc(o_name, o_ptr, 0);
1737 /* Save the index */
1740 /* Acquire p_ptr->inventory_list color */
1741 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
1743 /* Save the object description */
1744 strcpy(out_desc[k], o_name);
1746 /* Find the predicted "line length" */
1747 l = strlen(out_desc[k]) + 5;
1749 /* Be sure to account for the weight */
1750 if (show_weights) l += 9;
1752 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
1754 /* Maintain the maximum length */
1755 if (l > len) len = l;
1757 /* Advance to next "line" */
1761 if (show_weights && dont_need_to_show_weights) len -= 9;
1766 /* Find the column to start in */
1767 col = (len > wid - 4) ? 0 : (wid - len - 1);
1769 prepare_label_string_floor(floor_label, floor_list, floor_num);
1771 /* Output each entry */
1772 for (j = 0; j < k; j++)
1774 m = floor_list[out_index[j]];
1775 o_ptr = &p_ptr->current_floor_ptr->o_list[m];
1777 /* Clear the line */
1778 prt("", j + 1, col ? col - 2 : col);
1780 if (use_menu && target_item)
1782 if (j == (target_item - 1))
1784 strcpy(tmp_val, _("》", "> "));
1785 target_item_label = m;
1787 else strcpy(tmp_val, " ");
1791 /* Prepare an index --(-- */
1792 sprintf(tmp_val, "%c)", floor_label[j]);
1795 /* Clear the line with the (possibly indented) index */
1796 put_str(tmp_val, j + 1, col);
1798 /* Display the entry itself */
1799 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
1801 /* Display the weight if needed */
1802 if (show_weights && (o_ptr->tval != TV_GOLD))
1804 int wgt = o_ptr->weight * o_ptr->number;
1806 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1808 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1811 prt(tmp_val, j + 1, wid - 9);
1815 /* Make a "shadow" below the list (only if needed) */
1816 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
1818 return target_item_label;
1822 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
1823 * Let the user select an item, save its "index"
1824 * @param cp 選択したオブジェクトのIDを返す。
1825 * @param pmt 選択目的のメッセージ
1826 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
1827 * @param mode オプションフラグ
1828 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
1830 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
1832 char n1 = ' ', n2 = ' ', which = ' ';
1835 COMMAND_CODE i1, i2;
1836 COMMAND_CODE e1, e2;
1844 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
1845 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
1846 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
1847 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
1849 bool allow_equip = FALSE;
1850 bool allow_inven = FALSE;
1851 bool allow_floor = FALSE;
1853 bool toggle = FALSE;
1858 ITEM_NUMBER floor_num;
1859 OBJECT_IDX floor_list[23];
1861 TERM_LEN min_width = 0;
1863 int menu_line = (use_menu ? 1 : 0);
1867 static char prev_tag = '\0';
1868 char cur_tag = '\0';
1870 /* Get the item index */
1871 if (repeat_pull(cp))
1874 if (force && (*cp == INVEN_FORCE))
1877 item_tester_hook = NULL;
1878 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1883 else if (floor && (*cp < 0))
1885 if (prev_tag && command_cmd)
1887 /* Scan all objects in the grid */
1888 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
1890 /* Look up the tag */
1891 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
1893 /* Accept that choice */
1894 (*cp) = 0 - floor_list[k];
1896 /* Forget restrictions */
1898 item_tester_hook = NULL;
1899 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1905 prev_tag = '\0'; /* prev_tag is no longer effective */
1908 /* Validate the item */
1909 else if (item_tester_okay(&p_ptr->current_floor_ptr->o_list[0 - (*cp)], tval) || (mode & USE_FULL))
1911 /* Forget restrictions */
1913 item_tester_hook = NULL;
1914 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1921 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
1922 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
1924 if (prev_tag && command_cmd)
1926 /* Look up the tag and validate the item */
1927 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN, tval)) /* Reject */;
1928 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
1929 else if (!get_item_okay(k)) /* Reject */;
1932 /* Accept that choice */
1935 /* Forget restrictions */
1937 item_tester_hook = NULL;
1938 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1944 prev_tag = '\0'; /* prev_tag is no longer effective */
1947 /* Verify the item */
1948 else if (get_item_okay(*cp))
1950 /* Forget restrictions */
1952 item_tester_hook = NULL;
1953 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
1967 /* No item selected */
1971 /* Full p_ptr->inventory_list */
1973 i2 = INVEN_PACK - 1;
1975 /* Forbid p_ptr->inventory_list */
1976 if (!inven) i2 = -1;
1979 for (j = 0; j < INVEN_PACK; j++)
1980 if (item_tester_okay(&p_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_inven++;
1983 /* Restrict p_ptr->inventory_list indexes */
1984 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
1985 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
1988 /* Full equipment */
1990 e2 = INVEN_TOTAL - 1;
1992 /* Forbid equipment */
1993 if (!equip) e2 = -1;
1996 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
1997 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&p_ptr->inventory_list[j], tval) || (mode & USE_FULL)) max_equip++;
1998 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2001 /* Restrict equipment indexes */
2002 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2003 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2005 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2009 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2011 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2015 /* Count "okay" floor items */
2018 /* Restrict floor usage */
2021 /* Scan all objects in the grid */
2022 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2025 /* Accept p_ptr->inventory_list */
2026 if (i1 <= i2) allow_inven = TRUE;
2028 /* Accept equipment */
2029 if (e1 <= e2) allow_equip = TRUE;
2032 if (floor_num) allow_floor = TRUE;
2034 /* Require at least one legal choice */
2035 if (!allow_inven && !allow_equip && !allow_floor)
2037 /* Cancel p_ptr->command_see */
2038 command_see = FALSE;
2048 /* Analyze choices */
2051 /* Hack -- Start on equipment if requested */
2052 if (command_see && (command_wrk == (USE_EQUIP))
2055 command_wrk = (USE_EQUIP);
2058 /* Use p_ptr->inventory_list if allowed */
2059 else if (allow_inven)
2061 command_wrk = (USE_INVEN);
2064 /* Use equipment if allowed */
2065 else if (allow_equip)
2067 command_wrk = (USE_EQUIP);
2070 /* Use floor if allowed */
2071 else if (allow_floor)
2073 command_wrk = (USE_FLOOR);
2078 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2080 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2082 /* Hack -- start out in "display" mode */
2088 /* Repeat until done */
2091 COMMAND_CODE get_item_label = 0;
2098 for (j = 0; j < 8; j++)
2101 if (!angband_term[j]) continue;
2103 /* Count windows displaying inven */
2104 if (window_flag[j] & (PW_INVEN)) ni++;
2106 /* Count windows displaying equip */
2107 if (window_flag[j] & (PW_EQUIP)) ne++;
2110 /* Toggle if needed */
2111 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
2112 (command_wrk == (USE_INVEN) && !ni && ne))
2114 toggle_inven_equip(p_ptr);
2118 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2121 /* Inventory screen */
2122 if (command_wrk == (USE_INVEN))
2124 /* Extract the legal requests */
2128 /* Redraw if needed */
2129 if (command_see) get_item_label = show_inven(menu_line, mode, tval);
2132 /* Equipment screen */
2133 else if (command_wrk == (USE_EQUIP))
2135 /* Extract the legal requests */
2136 n1 = I2A(e1 - INVEN_RARM);
2137 n2 = I2A(e2 - INVEN_RARM);
2139 /* Redraw if needed */
2140 if (command_see) get_item_label = show_equip(menu_line, mode, tval);
2144 else if (command_wrk == (USE_FLOOR))
2147 k = MIN(floor_top + 23, floor_num) - 1;
2149 /* Extract the legal requests */
2150 n1 = I2A(j - floor_top);
2151 n2 = I2A(k - floor_top);
2153 /* Redraw if needed */
2154 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
2157 /* Viewing p_ptr->inventory_list */
2158 if (command_wrk == (USE_INVEN))
2160 /* Begin the prompt */
2161 sprintf(out_val, _("持ち物:", "Inven:"));
2165 /* Build the prompt */
2166 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2167 index_to_label(i1), index_to_label(i2));
2170 strcat(out_val, tmp_val);
2173 /* Indicate ability to "view" */
2174 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2180 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
2181 else if (allow_floor)
2182 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
2184 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
2191 strcat(out_val, _(" '-'床上,", " - for floor,"));
2192 else if (allow_equip)
2193 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
2195 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
2199 /* Viewing equipment */
2200 else if (command_wrk == (USE_EQUIP))
2202 /* Begin the prompt */
2203 sprintf(out_val, _("装備品:", "Equip:"));
2207 /* Build the prompt */
2208 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2209 index_to_label(e1), index_to_label(e2));
2212 strcat(out_val, tmp_val);
2215 /* Indicate ability to "view" */
2216 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2222 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
2223 else if (allow_floor)
2224 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
2226 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
2233 strcat(out_val, _(" '-'床上,", " - for floor,"));
2234 else if (allow_inven)
2235 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
2237 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
2242 else if (command_wrk == (USE_FLOOR))
2244 /* Begin the prompt */
2245 sprintf(out_val, _("床上:", "Floor:"));
2249 /* Build the prompt */
2250 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
2253 strcat(out_val, tmp_val);
2256 /* Indicate ability to "view" */
2257 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2261 if (allow_inven && allow_equip)
2263 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
2265 else if (allow_inven)
2267 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
2269 else if (allow_equip)
2271 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
2275 else if (allow_inven)
2277 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
2279 else if (allow_equip)
2281 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
2285 if (command_see && !use_menu)
2287 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
2292 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
2294 /* Finish the prompt */
2295 strcat(out_val, " ESC");
2297 /* Build the prompt */
2298 sprintf(tmp_val, "(%s) %s", out_val, pmt);
2300 /* Show the prompt */
2309 if (command_wrk == USE_INVEN) max_line = max_inven;
2310 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2311 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2327 menu_line += (max_line - 1);
2343 /* Verify legality */
2344 if (command_wrk == (USE_INVEN))
2346 if (allow_floor) command_wrk = USE_FLOOR;
2347 else if (allow_equip) command_wrk = USE_EQUIP;
2354 else if (command_wrk == (USE_EQUIP))
2356 if (allow_inven) command_wrk = USE_INVEN;
2357 else if (allow_floor) command_wrk = USE_FLOOR;
2364 else if (command_wrk == (USE_FLOOR))
2366 if (allow_equip) command_wrk = USE_EQUIP;
2367 else if (allow_inven) command_wrk = USE_INVEN;
2380 /* Hack -- Fix screen */
2387 /* Switch inven/equip */
2388 if (command_wrk == USE_INVEN) max_line = max_inven;
2389 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2390 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2391 if (menu_line > max_line) menu_line = max_line;
2393 /* Need to redraw */
2401 /* Verify legality */
2402 if (command_wrk == (USE_INVEN))
2404 if (allow_equip) command_wrk = USE_EQUIP;
2405 else if (allow_floor) command_wrk = USE_FLOOR;
2412 else if (command_wrk == (USE_EQUIP))
2414 if (allow_floor) command_wrk = USE_FLOOR;
2415 else if (allow_inven) command_wrk = USE_INVEN;
2422 else if (command_wrk == (USE_FLOOR))
2424 if (allow_inven) command_wrk = USE_INVEN;
2425 else if (allow_equip) command_wrk = USE_EQUIP;
2438 /* Hack -- Fix screen */
2445 /* Switch inven/equip */
2446 if (command_wrk == USE_INVEN) max_line = max_inven;
2447 else if (command_wrk == USE_EQUIP) max_line = max_equip;
2448 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
2449 if (menu_line > max_line) menu_line = max_line;
2451 /* Need to redraw */
2460 if (command_wrk == USE_FLOOR)
2463 (*cp) = -get_item_label;
2467 /* Validate the item */
2468 if (!get_item_okay(get_item_label))
2474 /* Allow player to "refuse" certain actions */
2475 if (!get_item_allow(get_item_label))
2481 /* Accept that choice */
2482 (*cp) = get_item_label;
2499 if (menu_line > max_line) menu_line -= max_line;
2520 command_see = FALSE;
2541 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
2543 if (command_wrk != (USE_FLOOR)) break;
2545 /* Get the object being moved. */
2546 o_idx = g_ptr->o_idx;
2548 /* Only rotate a pile of two or more objects. */
2549 if (!(o_idx && p_ptr->current_floor_ptr->o_list[o_idx].next_o_idx)) break;
2551 /* Remove the first object from the list. */
2552 excise_object_idx(o_idx);
2554 /* Find end of the list. */
2556 while (p_ptr->current_floor_ptr->o_list[i].next_o_idx)
2557 i = p_ptr->current_floor_ptr->o_list[i].next_o_idx;
2559 /* Add after the last object. */
2560 p_ptr->current_floor_ptr->o_list[i].next_o_idx = o_idx;
2562 /* Re-scan floor list */
2563 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2565 /* Hack -- Fix screen */
2577 if (command_wrk == (USE_INVEN))
2584 command_wrk = (USE_EQUIP);
2586 else if (command_wrk == (USE_EQUIP))
2593 command_wrk = (USE_INVEN);
2595 else if (command_wrk == (USE_FLOOR))
2599 command_wrk = (USE_INVEN);
2601 else if (allow_equip)
2603 command_wrk = (USE_EQUIP);
2612 /* Hack -- Fix screen */
2619 /* Need to redraw */
2632 * If we are already examining the floor, and there
2633 * is only one item, we will always select it.
2634 * If we aren't examining the floor and there is only
2635 * one item, we will select it if floor_query_flag
2640 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
2643 k = 0 - floor_list[0];
2645 /* Allow player to "refuse" certain actions */
2646 if (!get_item_allow(k))
2652 /* Accept that choice */
2661 /* Hack -- Fix screen */
2668 command_wrk = (USE_FLOOR);
2674 case '1': case '2': case '3':
2675 case '4': case '5': case '6':
2676 case '7': case '8': case '9':
2678 if (command_wrk != USE_FLOOR)
2680 /* Look up the tag */
2681 if (!get_tag(&k, which, command_wrk, tval))
2687 /* Hack -- Validate the item */
2688 if ((k < INVEN_RARM) ? !inven : !equip)
2694 /* Validate the item */
2695 if (!get_item_okay(k))
2703 /* Look up the alphabetical tag */
2704 if (get_tag_floor(&k, which, floor_list, floor_num))
2707 k = 0 - floor_list[k];
2716 /* Allow player to "refuse" certain actions */
2717 if (!get_item_allow(k))
2723 /* Accept that choice */
2735 /* Choose "default" p_ptr->inventory_list item */
2736 if (command_wrk == (USE_INVEN))
2738 k = ((i1 == i2) ? i1 : -1);
2741 /* Choose "default" equipment item */
2742 else if (command_wrk == (USE_EQUIP))
2744 k = ((e1 == e2) ? e1 : -1);
2747 /* Choose "default" floor item */
2748 else if (command_wrk == (USE_FLOOR))
2753 k = 0 - floor_list[0];
2755 /* Allow player to "refuse" certain actions */
2756 if (!get_item_allow(k))
2762 /* Accept that choice */
2770 /* Validate the item */
2771 if (!get_item_okay(k))
2777 /* Allow player to "refuse" certain actions */
2778 if (!get_item_allow(k))
2784 /* Accept that choice */
2808 if (command_wrk != USE_FLOOR)
2810 bool not_found = FALSE;
2812 /* Look up the alphabetical tag */
2813 if (!get_tag(&k, which, command_wrk, tval))
2818 /* Hack -- Validate the item */
2819 else if ((k < INVEN_RARM) ? !inven : !equip)
2824 /* Validate the item */
2825 else if (!get_item_okay(k))
2832 /* Accept that choice */
2842 /* Look up the alphabetical tag */
2843 if (get_tag_floor(&k, which, floor_list, floor_num))
2846 k = 0 - floor_list[k];
2848 /* Accept that choice */
2857 /* Extract "query" setting */
2858 ver = isupper(which);
2859 which = (char)tolower(which);
2861 /* Convert letter to p_ptr->inventory_list index */
2862 if (command_wrk == (USE_INVEN))
2864 if (which == '(') k = i1;
2865 else if (which == ')') k = i2;
2866 else k = label_to_inven(which);
2869 /* Convert letter to equipment index */
2870 else if (command_wrk == (USE_EQUIP))
2872 if (which == '(') k = e1;
2873 else if (which == ')') k = e2;
2874 else k = label_to_equip(which);
2877 /* Convert letter to floor index */
2878 else if (command_wrk == USE_FLOOR)
2880 if (which == '(') k = 0;
2881 else if (which == ')') k = floor_num - 1;
2882 else k = islower(which) ? A2I(which) : -1;
2883 if (k < 0 || k >= floor_num || k >= 23)
2890 k = 0 - floor_list[k];
2893 /* Validate the item */
2894 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
2900 /* Verify the item */
2901 if (ver && !verify(_("本当に", "Try"), k))
2907 /* Allow player to "refuse" certain actions */
2908 if (!get_item_allow(k))
2914 /* Accept that choice */
2924 /* Fix the screen if necessary */
2929 /* Hack -- Cancel "display" */
2930 command_see = FALSE;
2934 /* Forget the tval restriction */
2937 /* Forget the item_tester_hook restriction */
2938 item_tester_hook = NULL;
2941 /* Clean up 'show choices' */
2942 if (toggle) toggle_inven_equip(p_ptr);
2944 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2947 /* Clear the prompt line */
2950 /* Warning if needed */
2951 if (oops && str) msg_print(str);
2956 if (command_cmd) prev_tag = cur_tag;
2957 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2963 * @brief 床上のアイテムを拾う選択用サブルーチン
2964 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
2966 static bool py_pickup_floor_aux(void)
2968 OBJECT_IDX this_o_idx;
2972 /* Restrict the choices */
2973 item_tester_hook = inven_carry_okay;
2976 q = _("どれを拾いますか?", "Get which item? ");
2977 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
2979 if (choose_object(p_ptr, &item, q, s, (USE_FLOOR), 0))
2981 this_o_idx = 0 - item;
2988 /* Pick up the object */
2989 py_pickup_aux(this_o_idx);
2995 * @brief 床上のアイテムを拾うメイン処理
2996 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
2999 * This is called by py_pickup() when easy_floor is TRUE.
3001 void py_pickup_floor(player_type *creature_ptr, bool pickup)
3003 OBJECT_IDX this_o_idx, next_o_idx = 0;
3005 GAME_TEXT o_name[MAX_NLEN];
3009 OBJECT_IDX floor_o_idx = 0;
3013 /* Scan the pile of objects */
3014 for (this_o_idx = creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3016 /* Access the object */
3017 o_ptr = &creature_ptr->current_floor_ptr->o_list[this_o_idx];
3019 object_desc(o_name, o_ptr, 0);
3021 /* Access the next object */
3022 next_o_idx = o_ptr->next_o_idx;
3024 disturb(creature_ptr, FALSE, FALSE);
3027 if (o_ptr->tval == TV_GOLD)
3030 msg_format(" $%ld の価値がある%sを見つけた。",
3031 (long)o_ptr->pval, o_name);
3033 msg_format("You have found %ld gold pieces worth of %s.",
3034 (long)o_ptr->pval, o_name);
3037 /* Collect the gold */
3038 creature_ptr->au += o_ptr->pval;
3041 creature_ptr->redraw |= (PR_GOLD);
3043 creature_ptr->window |= (PW_PLAYER);
3045 /* Delete the gold */
3046 delete_object_idx(this_o_idx);
3048 /* Check the next object */
3051 else if (o_ptr->marked & OM_NOMSG)
3053 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
3054 * ignored. Otherwise, they are included in the prompt. */
3055 o_ptr->marked &= ~(OM_NOMSG);
3059 /* Count non-gold objects that can be picked up. */
3060 if (inven_carry_okay(o_ptr))
3065 /* Count non-gold objects */
3068 /* Remember this index */
3069 floor_o_idx = this_o_idx;
3072 /* There are no non-gold objects */
3076 /* Mention the number of objects */
3082 /* Access the object */
3083 o_ptr = &creature_ptr->current_floor_ptr->o_list[floor_o_idx];
3085 #ifdef ALLOW_EASY_SENSE
3087 /* Option: Make object sensing easy */
3090 /* Sense the object */
3091 (void)sense_object(o_ptr);
3094 #endif /* ALLOW_EASY_SENSE */
3096 object_desc(o_name, o_ptr, 0);
3098 msg_format(_("%sがある。", "You see %s."), o_name);
3101 /* Multiple objects */
3104 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
3110 /* The player has no room for anything on the floor. */
3116 /* Access the object */
3117 o_ptr = &creature_ptr->current_floor_ptr->o_list[floor_o_idx];
3119 #ifdef ALLOW_EASY_SENSE
3121 /* Option: Make object sensing easy */
3124 /* Sense the object */
3125 (void)sense_object(o_ptr);
3128 #endif /* ALLOW_EASY_SENSE */
3130 object_desc(o_name, o_ptr, 0);
3132 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
3135 /* Multiple objects */
3138 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
3148 /* Hack -- query every object */
3149 if (carry_query_flag)
3151 char out_val[MAX_NLEN + 20];
3153 /* Access the object */
3154 o_ptr = &creature_ptr->current_floor_ptr->o_list[floor_o_idx];
3156 #ifdef ALLOW_EASY_SENSE
3158 /* Option: Make object sensing easy */
3161 /* Sense the object */
3162 (void)sense_object(o_ptr);
3165 #endif /* ALLOW_EASY_SENSE */
3167 object_desc(o_name, o_ptr, 0);
3169 (void)sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
3171 /* Ask the user to confirm */
3172 if (!get_check(out_val))
3178 /* Access the object */
3179 o_ptr = &creature_ptr->current_floor_ptr->o_list[floor_o_idx];
3181 #ifdef ALLOW_EASY_SENSE
3183 /* Option: Make object sensing easy */
3186 /* Sense the object */
3187 (void)sense_object(o_ptr);
3190 #endif /* ALLOW_EASY_SENSE */
3192 /* Pick up the object */
3193 py_pickup_aux(floor_o_idx);
3196 /* Allow the user to choose an object */
3199 while (can_pickup--)
3201 if (!py_pickup_floor_aux()) break;
3209 * @brief 所持アイテム一覧を表示する /
3210 * Choice window "shadow" of the "show_inven()" function
3213 void display_inven(player_type *creature_ptr, OBJECT_TYPE_VALUE tval)
3215 register int i, n, z = 0;
3217 TERM_COLOR attr = TERM_WHITE;
3219 GAME_TEXT o_name[MAX_NLEN];
3222 if (!creature_ptr || !creature_ptr->inventory_list) return;
3224 Term_get_size(&wid, &hgt);
3226 for (i = 0; i < INVEN_PACK; i++)
3228 o_ptr = &creature_ptr->inventory_list[i];
3229 if (!o_ptr->k_idx) continue;
3233 for (i = 0; i < z; i++)
3235 o_ptr = &creature_ptr->inventory_list[i];
3236 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
3237 if (item_tester_okay(o_ptr, tval))
3239 tmp_val[0] = index_to_label(i);
3243 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
3244 object_desc(o_name, o_ptr, 0);
3246 attr = tval_to_attr[o_ptr->tval % 128];
3252 Term_putstr(3, i, n, attr, o_name);
3253 Term_erase(3 + n, i, 255);
3257 int wgt = o_ptr->weight * o_ptr->number;
3259 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
3261 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3263 prt(tmp_val, i, wid - 9);
3267 for (i = z; i < hgt; i++)
3269 Term_erase(0, i, 255);
3275 * @brief 装備アイテムの表示を行う /
3276 * Display the equipment.
3277 * @param target_item アイテムの選択処理を行うか否か。
3278 * @return 選択したアイテムのタグ
3280 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode, OBJECT_TYPE_VALUE tval)
3284 int col, cur_col, len;
3287 GAME_TEXT o_name[MAX_NLEN];
3288 COMMAND_CODE out_index[23];
3289 TERM_COLOR out_color[23];
3290 char out_desc[23][MAX_NLEN];
3291 COMMAND_CODE target_item_label = 0;
3293 char equip_label[52 + 1];
3295 /* Starting column */
3298 Term_get_size(&wid, &hgt);
3300 /* Maximal length */
3301 len = wid - col - 1;
3304 /* Scan the equipment list */
3305 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3307 o_ptr = &p_ptr->inventory_list[i];
3309 /* Is this item acceptable? */
3310 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr, tval) || (mode & USE_FULL)) &&
3311 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
3312 (mode & IGNORE_BOTHHAND_SLOT))) continue;
3314 object_desc(o_name, o_ptr, 0);
3316 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
3318 (void)strcpy(out_desc[k], _("(武器を両手持ち)", "(wielding with two-hands)"));
3319 out_color[k] = TERM_WHITE;
3323 (void)strcpy(out_desc[k], o_name);
3324 out_color[k] = tval_to_attr[o_ptr->tval % 128];
3328 /* Grey out charging items */
3331 out_color[k] = TERM_L_DARK;
3334 /* Extract the maximal length (see below) */
3336 l = strlen(out_desc[k]) + (2 + 1);
3338 l = strlen(out_desc[k]) + (2 + 3);
3342 /* Increase length for labels (if needed) */
3344 if (show_labels) l += (7 + 2);
3346 if (show_labels) l += (14 + 2);
3350 /* Increase length for weight (if needed) */
3351 if (show_weights) l += 9;
3353 if (show_item_graph) l += 2;
3355 /* Maintain the max-length */
3356 if (l > len) len = l;
3358 /* Advance the entry */
3362 /* Hack -- Find a column to start in */
3364 col = (len > wid - 6) ? 0 : (wid - len - 1);
3366 col = (len > wid - 4) ? 0 : (wid - len - 1);
3369 prepare_label_string(equip_label, USE_EQUIP, tval);
3371 /* Output each entry */
3372 for (j = 0; j < k; j++)
3375 o_ptr = &p_ptr->inventory_list[i];
3377 /* Clear the line */
3378 prt("", j + 1, col ? col - 2 : col);
3380 if (use_menu && target_item)
3382 if (j == (target_item - 1))
3384 strcpy(tmp_val, _("》", "> "));
3385 target_item_label = i;
3387 else strcpy(tmp_val, " ");
3389 else if (i >= INVEN_RARM)
3391 /* Prepare an index --(-- */
3392 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
3396 /* Prepare an index --(-- */
3397 sprintf(tmp_val, "%c)", index_to_label(i));
3400 /* Clear the line with the (possibly indented) index */
3401 put_str(tmp_val, j + 1, col);
3405 /* Display graphics for object, if desired */
3406 if (show_item_graph)
3408 TERM_COLOR a = object_attr(o_ptr);
3409 SYMBOL_CODE c = object_char(o_ptr);
3410 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
3411 if (use_bigtile) cur_col++;
3419 /* Mention the use */
3420 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(p_ptr, i));
3422 put_str(tmp_val, j + 1, cur_col);
3424 /* Display the entry itself */
3425 c_put_str(out_color[j], out_desc[j], j + 1, _(cur_col + 9, cur_col + 16));
3431 /* Display the entry itself */
3432 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
3435 /* Display the weight if needed */
3438 int wgt = o_ptr->weight * o_ptr->number;
3440 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
3442 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
3445 prt(tmp_val, j + 1, wid - 9);
3449 /* Make a "shadow" below the list (only if needed) */
3450 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3452 /* Save the new column */
3455 return target_item_label;
3460 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
3461 * Return a string describing how a given item is being worn.
3462 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
3463 * @return 状態表現内容の文字列ポインタ
3465 * Currently, only used for items in the equipment, not p_ptr->inventory_list.
3467 concptr describe_use(int i)
3474 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
3476 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
3480 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
3482 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
3485 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;
3486 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
3487 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
3488 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
3489 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
3490 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
3491 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
3492 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
3493 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
3494 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
3495 default: p = _("ザックに入っている", "carrying in your pack"); break;
3498 /* Return the result */