1 #include "window/main-window-equipments.h"
2 #include "flavor/flavor-describer.h"
3 #include "game-option/special-options.h"
4 #include "game-option/text-display-options.h"
5 #include "inventory/inventory-describer.h"
6 #include "inventory/inventory-slot-types.h"
7 #include "inventory/inventory-util.h"
8 #include "io/input-key-requester.h"
9 #include "object/item-tester-hooker.h"
10 #include "object/item-use-flags.h"
11 #include "object/object-info.h"
12 #include "object/object-kind.h"
13 #include "system/object-type-definition.h"
14 #include "term/gameterm.h"
15 #include "term/screen-processor.h"
16 #include "term/term-color-types.h"
17 #include "player/player-status-flags.h"
20 * @brief メインウィンドウの右上に装備アイテムの表示させる
21 * Display the equipment.
22 * @param target_item アイテムの選択処理を行うか否か。
25 COMMAND_CODE show_equipment(player_type *owner_ptr, int target_item, BIT_FLAGS mode, tval_type tval)
31 GAME_TEXT o_name[MAX_NLEN];
32 COMMAND_CODE out_index[23];
33 TERM_COLOR out_color[23];
34 char out_desc[23][MAX_NLEN];
35 COMMAND_CODE target_item_label = 0;
37 char equip_label[52 + 1];
38 int col = command_gap;
39 term_get_size(&wid, &hgt);
40 int len = wid - col - 1;
41 for (k = 0, i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
42 o_ptr = &owner_ptr->inventory_list[i];
43 if (!(owner_ptr->select_ring_slot ? is_ring_slot(i) : item_tester_okay(owner_ptr, o_ptr, tval) || (mode & USE_FULL))
44 && (!((((i == INVEN_MAIN_HAND) && can_attack_with_sub_hand(owner_ptr)) || ((i == INVEN_SUB_HAND) && can_attack_with_main_hand(owner_ptr)))
45 && has_two_handed_weapons(owner_ptr))
46 || (mode & IGNORE_BOTHHAND_SLOT)))
49 describe_flavor(owner_ptr, o_name, o_ptr, 0);
50 if ((((i == INVEN_MAIN_HAND) && can_attack_with_sub_hand(owner_ptr)) || ((i == INVEN_SUB_HAND) && can_attack_with_main_hand(owner_ptr)))
51 && has_two_handed_weapons(owner_ptr)) {
52 (void)strcpy(out_desc[k], _("(武器を両手持ち)", "(wielding with two-hands)"));
53 out_color[k] = TERM_WHITE;
55 (void)strcpy(out_desc[k], o_name);
56 out_color[k] = tval_to_attr[o_ptr->tval % 128];
61 out_color[k] = TERM_L_DARK;
62 l = strlen(out_desc[k]) + (2 + _(1, 3));
79 col = (len > wid - _(6, 4)) ? 0 : (wid - len - 1);
80 prepare_label_string(owner_ptr, equip_label, USE_EQUIP, tval);
81 for (j = 0; j < k; j++) {
83 o_ptr = &owner_ptr->inventory_list[i];
84 prt("", j + 1, col ? col - 2 : col);
85 if (use_menu && target_item) {
86 if (j == (target_item - 1)) {
87 strcpy(tmp_val, _("》", "> "));
88 target_item_label = i;
91 } else if (i >= INVEN_MAIN_HAND)
92 sprintf(tmp_val, "%c)", equip_label[i - INVEN_MAIN_HAND]);
94 sprintf(tmp_val, "%c)", index_to_label(i));
96 put_str(tmp_val, j + 1, col);
97 int cur_col = col + 3;
98 if (show_item_graph) {
99 TERM_COLOR a = object_attr(o_ptr);
100 SYMBOL_CODE c = object_char(o_ptr);
101 term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
109 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(owner_ptr, i));
110 put_str(tmp_val, j + 1, cur_col);
111 c_put_str(out_color[j], out_desc[j], j + 1, _(cur_col + 9, cur_col + 16));
113 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
118 int wgt = o_ptr->weight * o_ptr->number;
119 (void)sprintf(tmp_val, _("%3d.%1d kg", "%3d.%d lb"), _(lbtokg1(wgt), wgt / 10), _(lbtokg2(wgt), wgt % 10));
120 prt(tmp_val, j + 1, wid - 9);
124 prt("", j + 1, col ? col - 2 : col);
127 return target_item_label;