3 * @brief オブジェクトの実装 / Object code, part 1
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
8 * This software may be copied and distributed for educational, research,\n
9 * and not for profit purposes provided that this copyright and statement\n
10 * are included in all such copies. Other copyrights may also apply.\n
11 * 2014 Deskull rearranged comment for Doxygen.\n
16 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
23 * @brief オブジェクト、地形の表示シンボルなど初期化する / Reset the "visual" lists
25 * This involves resetting various things to their "default" state.\n
27 * If the "prefs" flag is TRUE, then we will also load the appropriate\n
28 * "user pref file" based on the current setting of the "use_graphics"\n
29 * flag. This is useful for switching "graphics" on/off.\n
31 * The features, objects, and monsters, should all be encoded in the\n
32 * relevant "font.pref" and/or "graf.prf" files. \n
34 * The "prefs" parameter is no longer meaningful. \n
36 void reset_visuals(void)
40 /* Extract some info about terrain features */
41 for (i = 0; i < max_f_idx; i++)
43 feature_type *f_ptr = &f_info[i];
45 /* Assume we will use the underlying values */
46 for (j = 0; j < F_LIT_MAX; j++)
48 f_ptr->x_attr[j] = f_ptr->d_attr[j];
49 f_ptr->x_char[j] = f_ptr->d_char[j];
53 /* Extract default attr/char code for objects */
54 for (i = 0; i < max_k_idx; i++)
56 object_kind *k_ptr = &k_info[i];
58 /* Default attr/char */
59 k_ptr->x_attr = k_ptr->d_attr;
60 k_ptr->x_char = k_ptr->d_char;
63 /* Extract default attr/char code for monsters */
64 for (i = 0; i < max_r_idx; i++)
66 monster_race *r_ptr = &r_info[i];
68 /* Default attr/char */
69 r_ptr->x_attr = r_ptr->d_attr;
70 r_ptr->x_char = r_ptr->d_char;
77 /* Process "graf.prf" */
78 process_pref_file("graf.prf");
80 /* Access the "character" pref file */
81 sprintf(buf, "graf-%s.prf", player_base);
83 /* Process "graf-<playername>.prf" */
84 process_pref_file(buf);
92 /* Process "font.prf" */
93 process_pref_file("font.prf");
95 /* Access the "character" pref file */
96 sprintf(buf, "font-%s.prf", player_base);
98 /* Process "font-<playername>.prf" */
99 process_pref_file(buf);
104 * @brief オブジェクトのフラグ類を配列に与える
105 * Obtain the "flags" for an item
106 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
107 * @param flgs フラグ情報を受け取る配列
110 void object_flags(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
112 object_kind *k_ptr = &k_info[o_ptr->k_idx];
116 for (i = 0; i < TR_FLAG_SIZE; i++)
117 flgs[i] = k_ptr->flags[i];
120 if (object_is_fixed_artifact(o_ptr))
122 artifact_type *a_ptr = &a_info[o_ptr->name1];
124 for (i = 0; i < TR_FLAG_SIZE; i++)
125 flgs[i] = a_ptr->flags[i];
129 if (object_is_ego(o_ptr))
131 ego_item_type *e_ptr = &e_info[o_ptr->name2];
133 for (i = 0; i < TR_FLAG_SIZE; i++)
134 flgs[i] |= e_ptr->flags[i];
136 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
138 remove_flag(flgs, TR_SH_FIRE);
140 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
142 remove_flag(flgs, TR_INFRA);
144 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
146 remove_flag(flgs, TR_RES_BLIND);
147 remove_flag(flgs, TR_SEE_INVIS);
151 /* Random artifact ! */
152 for (i = 0; i < TR_FLAG_SIZE; i++)
153 flgs[i] |= o_ptr->art_flags[i];
155 if (object_is_smith(o_ptr))
157 int add = o_ptr->xtra3 - 1;
159 if (add < TR_FLAG_MAX)
163 else if (add == ESSENCE_TMP_RES_ACID)
165 add_flag(flgs, TR_RES_ACID);
166 add_flag(flgs, TR_ACTIVATE);
168 else if (add == ESSENCE_TMP_RES_ELEC)
170 add_flag(flgs, TR_RES_ELEC);
171 add_flag(flgs, TR_ACTIVATE);
173 else if (add == ESSENCE_TMP_RES_FIRE)
175 add_flag(flgs, TR_RES_FIRE);
176 add_flag(flgs, TR_ACTIVATE);
178 else if (add == ESSENCE_TMP_RES_COLD)
180 add_flag(flgs, TR_RES_COLD);
181 add_flag(flgs, TR_ACTIVATE);
183 else if (add == ESSENCE_SH_FIRE)
185 add_flag(flgs, TR_RES_FIRE);
186 add_flag(flgs, TR_SH_FIRE);
188 else if (add == ESSENCE_SH_ELEC)
190 add_flag(flgs, TR_RES_ELEC);
191 add_flag(flgs, TR_SH_ELEC);
193 else if (add == ESSENCE_SH_COLD)
195 add_flag(flgs, TR_RES_COLD);
196 add_flag(flgs, TR_SH_COLD);
198 else if (add == ESSENCE_RESISTANCE)
200 add_flag(flgs, TR_RES_ACID);
201 add_flag(flgs, TR_RES_ELEC);
202 add_flag(flgs, TR_RES_FIRE);
203 add_flag(flgs, TR_RES_COLD);
205 else if (add == TR_IMPACT)
207 add_flag(flgs, TR_ACTIVATE);
213 * @brief オブジェクトの明示されているフラグ類を取得する
214 * Obtain the "flags" for an item which are known to the player
215 * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
216 * @param flgs フラグ情報を受け取る配列
219 void object_flags_known(object_type *o_ptr, BIT_FLAGS flgs[TR_FLAG_SIZE])
224 object_kind *k_ptr = &k_info[o_ptr->k_idx];
227 for (i = 0; i < TR_FLAG_SIZE; i++)
230 if (!object_is_aware(o_ptr)) return;
233 for (i = 0; i < TR_FLAG_SIZE; i++)
234 flgs[i] = k_ptr->flags[i];
236 /* Must be identified */
237 if (!object_is_known(o_ptr)) return;
239 /* Ego-item (known basic flags) */
240 if (object_is_ego(o_ptr))
242 ego_item_type *e_ptr = &e_info[o_ptr->name2];
244 for (i = 0; i < TR_FLAG_SIZE; i++)
245 flgs[i] |= e_ptr->flags[i];
247 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
249 remove_flag(flgs, TR_SH_FIRE);
251 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
253 remove_flag(flgs, TR_INFRA);
255 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
257 remove_flag(flgs, TR_RES_BLIND);
258 remove_flag(flgs, TR_SEE_INVIS);
263 #ifdef SPOIL_ARTIFACTS
264 /* Full knowledge for some artifacts */
265 if (object_is_artifact(o_ptr)) spoil = TRUE;
266 #endif /* SPOIL_ARTIFACTS */
268 #ifdef SPOIL_EGO_ITEMS
269 /* Full knowledge for some ego-items */
270 if (object_is_ego(o_ptr)) spoil = TRUE;
271 #endif /* SPOIL_EGO_ITEMS */
273 /* Need full knowledge or spoilers */
274 if (spoil || (o_ptr->ident & IDENT_MENTAL))
277 if (object_is_fixed_artifact(o_ptr))
279 artifact_type *a_ptr = &a_info[o_ptr->name1];
281 for (i = 0; i < TR_FLAG_SIZE; i++)
282 flgs[i] = a_ptr->flags[i];
285 /* Random artifact ! */
286 for (i = 0; i < TR_FLAG_SIZE; i++)
287 flgs[i] |= o_ptr->art_flags[i];
290 if (object_is_smith(o_ptr))
292 int add = o_ptr->xtra3 - 1;
294 if (add < TR_FLAG_MAX)
298 else if (add == ESSENCE_TMP_RES_ACID)
300 add_flag(flgs, TR_RES_ACID);
302 else if (add == ESSENCE_TMP_RES_ELEC)
304 add_flag(flgs, TR_RES_ELEC);
306 else if (add == ESSENCE_TMP_RES_FIRE)
308 add_flag(flgs, TR_RES_FIRE);
310 else if (add == ESSENCE_TMP_RES_COLD)
312 add_flag(flgs, TR_RES_COLD);
314 else if (add == ESSENCE_SH_FIRE)
316 add_flag(flgs, TR_RES_FIRE);
317 add_flag(flgs, TR_SH_FIRE);
319 else if (add == ESSENCE_SH_ELEC)
321 add_flag(flgs, TR_RES_ELEC);
322 add_flag(flgs, TR_SH_ELEC);
324 else if (add == ESSENCE_SH_COLD)
326 add_flag(flgs, TR_RES_COLD);
327 add_flag(flgs, TR_SH_COLD);
329 else if (add == ESSENCE_RESISTANCE)
331 add_flag(flgs, TR_RES_ACID);
332 add_flag(flgs, TR_RES_ELEC);
333 add_flag(flgs, TR_RES_FIRE);
334 add_flag(flgs, TR_RES_COLD);
340 * @brief オブジェクトの発動効果名称を返す(サブルーチン/ブレス)
341 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
342 * @return concptr 発動名称を返す文字列ポインタ
344 static concptr item_activation_dragon_breath(object_type *o_ptr)
346 static char desc[256];
347 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
350 object_flags(o_ptr, flgs);
351 strcpy(desc, _("", "breath "));
353 for (i = 0; dragonbreath_info[i].flag != 0; i++)
355 if (have_flag(flgs, dragonbreath_info[i].flag))
357 if (n > 0) strcat(desc, _("、", ", "));
358 strcat(desc, dragonbreath_info[i].name);
363 strcat(desc, _("のブレス(250)", ""));
369 * @brief オブジェクトの発動効果名称を返す(サブルーチン/汎用)
370 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
371 * @return concptr 発動名称を返す文字列ポインタ
373 static concptr item_activation_aux(object_type *o_ptr)
375 static char activation_detail[256];
379 const activation_type* const act_ptr = find_activation_info(o_ptr);
381 if (!act_ptr) return _("未定義", "something undefined");
383 desc = act_ptr->desc;
385 /* Overwrite description if it is special */
386 switch (act_ptr->index) {
388 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
389 desc = _("火炎のブレス (200) と火への耐性", "breath of fire (200) and resist fire");
392 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
393 desc = _("冷気のブレス (200) と冷気への耐性", "breath of cold (200) and resist cold");
396 desc = item_activation_dragon_breath(o_ptr);
399 if (o_ptr->name1 == ART_HYOUSIGI)
400 desc = _("拍子木を打ちならす", "beat wooden clappers");
402 case ACT_RESIST_ACID:
403 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID)) || (o_ptr->name2 == EGO_BRAND_ACID))
404 desc = _("アシッド・ボール (100) と酸への耐性", "ball of acid (100) and resist acid");
406 case ACT_RESIST_FIRE:
407 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) || (o_ptr->name2 == EGO_BRAND_FIRE))
408 desc = _("ファイア・ボール (100) と火への耐性", "ball of fire (100) and resist fire");
410 case ACT_RESIST_COLD:
411 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) || (o_ptr->name2 == EGO_BRAND_COLD))
412 desc = _("アイス・ボール (100) と冷気への耐性", "ball of cold (100) and resist cold");
414 case ACT_RESIST_ELEC:
415 if (((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC)) || (o_ptr->name2 == EGO_BRAND_ELEC))
416 desc = _("サンダー・ボール (100) と電撃への耐性", "ball of elec (100) and resist elec");
418 case ACT_RESIST_POIS:
419 if (o_ptr->name2 == EGO_BRAND_POIS)
420 desc = _("悪臭雲 (100) と毒への耐性", "ball of poison (100) and resist elec");
424 /* Timeout description */
425 constant = act_ptr->timeout.constant;
426 dice = act_ptr->timeout.dice;
427 if (constant == 0 && dice == 0) {
428 /* We can activate it every turn */
429 strcpy(timeout, _("いつでも", "every turn"));
430 } else if (constant < 0) {
431 /* Activations that have special timeout */
432 switch (act_ptr->index) {
434 sprintf(timeout, _("%d ターン毎", "every %d turns"),
435 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
438 sprintf(timeout, _("%d ターン毎", "every %d turns"),
439 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
442 strcpy(timeout, _("3*(レベル+10) ターン毎", "every 3 * (level+10) turns"));
445 strcpy(timeout, _("確率50%で壊れる", "(destroyed 50%)"));
448 strcpy(timeout, "undefined");
452 /* Normal timeout activations */
453 char constant_str[16], dice_str[16];
454 sprintf(constant_str, "%d", constant);
455 sprintf(dice_str, "d%d", dice);
456 sprintf(timeout, _("%s%s%s ターン毎", "every %s%s%s turns"),
457 (constant > 0) ? constant_str : "",
458 (constant > 0 && dice > 0) ? "+" : "",
459 (dice > 0) ? dice_str : "");
462 /* Build detail activate description */
463 sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
465 return activation_detail;
469 * @brief オブジェクトの発動効果名称を返す(メインルーチン) /
470 * Determine the "Activation" (if any) for an artifact Return a string, or NULL for "no activation"
471 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
472 * @return concptr 発動名称を返す文字列ポインタ
474 concptr item_activation(object_type *o_ptr)
476 BIT_FLAGS flgs[TR_FLAG_SIZE];
477 object_flags(o_ptr, flgs);
479 /* Require activation ability */
480 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
482 /* Get an explain of an activation */
483 if (activation_index(o_ptr))
485 return item_activation_aux(o_ptr);
489 if (o_ptr->tval == TV_WHISTLE)
491 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
494 if (o_ptr->tval == TV_CAPTURE)
496 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
499 return _("何も起きない", "Nothing");
504 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
505 * Describe a "fully identified" item
506 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
507 * @param mode 表示オプション
508 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
510 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
514 BIT_FLAGS flgs[TR_FLAG_SIZE];
518 GAME_TEXT o_name[MAX_NLEN];
523 int trivial_info = 0;
524 object_flags(o_ptr, flgs);
526 /* Extract the description */
528 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
529 (k_text + k_info[o_ptr->k_idx].text),
530 77 - 15, temp, sizeof(temp));
531 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
532 { info[i] = &temp[j]; i++;}
535 if (object_is_equipment(o_ptr))
537 /* Descriptions of a basic equipment is just a flavor */
541 /* Mega-Hack -- describe activation */
542 if (have_flag(flgs, TR_ACTIVATE))
544 info[i++] = _("始動したときの効果...", "It can be activated for...");
545 info[i++] = item_activation(o_ptr);
546 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
549 /* Figurines, a hack */
550 if (o_ptr->tval == TV_FIGURINE)
552 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
555 /* Figurines, a hack */
556 if (o_ptr->name1 == ART_STONEMASK)
558 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you turn into a vampire permanently.");
561 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
563 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
566 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
568 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
569 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
572 if (o_ptr->name2 == EGO_2WEAPON)
574 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
577 if (have_flag(flgs, TR_EASY_SPELL))
579 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
582 if (o_ptr->name2 == EGO_AMU_FOOL)
584 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
587 if (o_ptr->name2 == EGO_RING_THROW)
589 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
592 if (o_ptr->name2 == EGO_AMU_NAIVETY)
594 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
597 if (o_ptr->tval == TV_STATUE)
599 monster_race *r_ptr = &r_info[o_ptr->pval];
601 if (o_ptr->pval == MON_BULLGATES)
602 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
603 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
604 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
606 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
609 /* Hack -- describe lite's */
611 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
614 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
615 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
616 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
617 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
618 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
619 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
621 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
623 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
625 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
629 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
630 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
633 if(rad != 0) info[i++] = desc;
636 if (o_ptr->name2 == EGO_LITE_LONG)
638 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
641 /* And then describe it fully */
643 if (have_flag(flgs, TR_RIDING))
645 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
646 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
649 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
650 /* This information is not important enough */
654 if (have_flag(flgs, TR_STR))
656 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
658 if (have_flag(flgs, TR_INT))
660 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
662 if (have_flag(flgs, TR_WIS))
664 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
666 if (have_flag(flgs, TR_DEX))
668 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
670 if (have_flag(flgs, TR_CON))
672 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
674 if (have_flag(flgs, TR_CHR))
676 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
679 if (have_flag(flgs, TR_MAGIC_MASTERY))
681 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
684 if (have_flag(flgs, TR_STEALTH))
686 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
688 if (have_flag(flgs, TR_SEARCH))
690 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
692 if (have_flag(flgs, TR_INFRA))
694 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
696 if (have_flag(flgs, TR_TUNNEL))
698 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
700 if (have_flag(flgs, TR_SPEED))
702 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
704 if (have_flag(flgs, TR_BLOWS))
706 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
709 if (have_flag(flgs, TR_BRAND_ACID))
711 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
713 if (have_flag(flgs, TR_BRAND_ELEC))
715 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
717 if (have_flag(flgs, TR_BRAND_FIRE))
719 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
721 if (have_flag(flgs, TR_BRAND_COLD))
723 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
726 if (have_flag(flgs, TR_BRAND_POIS))
728 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
731 if (have_flag(flgs, TR_CHAOTIC))
733 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
736 if (have_flag(flgs, TR_VAMPIRIC))
738 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
741 if (have_flag(flgs, TR_IMPACT))
743 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
746 if (have_flag(flgs, TR_VORPAL))
748 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
751 if (have_flag(flgs, TR_KILL_DRAGON))
753 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
755 else if (have_flag(flgs, TR_SLAY_DRAGON))
757 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
760 if (have_flag(flgs, TR_KILL_ORC))
762 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
764 if (have_flag(flgs, TR_SLAY_ORC))
766 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
769 if (have_flag(flgs, TR_KILL_TROLL))
771 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
773 if (have_flag(flgs, TR_SLAY_TROLL))
775 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
778 if (have_flag(flgs, TR_KILL_GIANT))
780 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
782 else if (have_flag(flgs, TR_SLAY_GIANT))
784 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
787 if (have_flag(flgs, TR_KILL_DEMON))
789 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
791 if (have_flag(flgs, TR_SLAY_DEMON))
793 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
796 if (have_flag(flgs, TR_KILL_UNDEAD))
798 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
800 if (have_flag(flgs, TR_SLAY_UNDEAD))
802 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
805 if (have_flag(flgs, TR_KILL_EVIL))
807 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
809 if (have_flag(flgs, TR_SLAY_EVIL))
811 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
814 if (have_flag(flgs, TR_KILL_ANIMAL))
816 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
818 if (have_flag(flgs, TR_SLAY_ANIMAL))
820 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
823 if (have_flag(flgs, TR_KILL_HUMAN))
825 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
827 if (have_flag(flgs, TR_SLAY_HUMAN))
829 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
832 if (have_flag(flgs, TR_FORCE_WEAPON))
834 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
836 if (have_flag(flgs, TR_DEC_MANA))
838 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
840 if (have_flag(flgs, TR_SUST_STR))
842 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
844 if (have_flag(flgs, TR_SUST_INT))
846 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
848 if (have_flag(flgs, TR_SUST_WIS))
850 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
852 if (have_flag(flgs, TR_SUST_DEX))
854 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
856 if (have_flag(flgs, TR_SUST_CON))
858 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
860 if (have_flag(flgs, TR_SUST_CHR))
862 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
865 if (have_flag(flgs, TR_IM_ACID))
867 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
869 if (have_flag(flgs, TR_IM_ELEC))
871 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
873 if (have_flag(flgs, TR_IM_FIRE))
875 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
877 if (have_flag(flgs, TR_IM_COLD))
879 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
882 if (have_flag(flgs, TR_THROW))
884 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
887 if (have_flag(flgs, TR_FREE_ACT))
889 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
891 if (have_flag(flgs, TR_HOLD_EXP))
893 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
895 if (have_flag(flgs, TR_RES_FEAR))
897 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
899 if (have_flag(flgs, TR_RES_ACID))
901 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
903 if (have_flag(flgs, TR_RES_ELEC))
905 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
907 if (have_flag(flgs, TR_RES_FIRE))
909 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
911 if (have_flag(flgs, TR_RES_COLD))
913 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
915 if (have_flag(flgs, TR_RES_POIS))
917 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
920 if (have_flag(flgs, TR_RES_LITE))
922 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
924 if (have_flag(flgs, TR_RES_DARK))
926 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
929 if (have_flag(flgs, TR_RES_BLIND))
931 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
933 if (have_flag(flgs, TR_RES_CONF))
935 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
937 if (have_flag(flgs, TR_RES_SOUND))
939 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
941 if (have_flag(flgs, TR_RES_SHARDS))
943 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
946 if (have_flag(flgs, TR_RES_NETHER))
948 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
950 if (have_flag(flgs, TR_RES_NEXUS))
952 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
954 if (have_flag(flgs, TR_RES_CHAOS))
956 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
958 if (have_flag(flgs, TR_RES_DISEN))
960 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
963 if (have_flag(flgs, TR_LEVITATION))
965 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
968 if (have_flag(flgs, TR_SEE_INVIS))
970 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
972 if (have_flag(flgs, TR_TELEPATHY))
974 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
976 if (have_flag(flgs, TR_ESP_ANIMAL))
978 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
980 if (have_flag(flgs, TR_ESP_UNDEAD))
982 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
984 if (have_flag(flgs, TR_ESP_DEMON))
986 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
988 if (have_flag(flgs, TR_ESP_ORC))
990 info[i++] = _("それはオークを感知する。", "It senses orcs.");
992 if (have_flag(flgs, TR_ESP_TROLL))
994 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
996 if (have_flag(flgs, TR_ESP_GIANT))
998 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1000 if (have_flag(flgs, TR_ESP_DRAGON))
1002 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1004 if (have_flag(flgs, TR_ESP_HUMAN))
1006 info[i++] = _("それは人間を感知する。", "It senses humans.");
1008 if (have_flag(flgs, TR_ESP_EVIL))
1010 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1012 if (have_flag(flgs, TR_ESP_GOOD))
1014 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1016 if (have_flag(flgs, TR_ESP_NONLIVING))
1018 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1020 if (have_flag(flgs, TR_ESP_UNIQUE))
1022 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1024 if (have_flag(flgs, TR_SLOW_DIGEST))
1026 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1028 if (have_flag(flgs, TR_REGEN))
1030 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1032 if (have_flag(flgs, TR_WARNING))
1034 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1036 if (have_flag(flgs, TR_REFLECT))
1038 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1040 if (have_flag(flgs, TR_SH_FIRE))
1042 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1044 if (have_flag(flgs, TR_SH_ELEC))
1046 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1048 if (have_flag(flgs, TR_SH_COLD))
1050 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1052 if (have_flag(flgs, TR_NO_MAGIC))
1054 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1056 if (have_flag(flgs, TR_NO_TELE))
1058 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1060 if (have_flag(flgs, TR_XTRA_MIGHT))
1062 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1064 if (have_flag(flgs, TR_XTRA_SHOTS))
1066 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1069 if (have_flag(flgs, TR_BLESSED))
1071 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1074 if (object_is_cursed(o_ptr))
1076 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1078 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1080 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1082 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1086 info[i++] = _("それは呪われている。", "It is cursed.");
1089 * It's a trivial infomation since there is
1090 * fake inscription {cursed}
1096 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1098 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1100 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1102 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1104 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1106 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1108 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1110 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1112 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1114 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1116 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1118 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1120 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1122 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1124 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1126 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1128 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1130 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1132 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1134 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1136 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1138 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1140 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1142 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1144 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1146 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1148 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1150 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1152 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1154 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1156 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1158 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1160 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1162 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1164 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1166 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1169 /* Describe about this kind of object instead of THIS fake object */
1170 if (mode & SCROBJ_FAKE_OBJECT)
1172 switch (o_ptr->tval)
1175 switch (o_ptr->sval)
1177 case SV_RING_LORDLY:
1178 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1180 case SV_RING_WARNING:
1181 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1187 switch (o_ptr->sval)
1189 case SV_AMULET_RESISTANCE:
1190 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1191 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1193 case SV_AMULET_THE_MAGI:
1194 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1201 if (have_flag(flgs, TR_IGNORE_ACID) &&
1202 have_flag(flgs, TR_IGNORE_ELEC) &&
1203 have_flag(flgs, TR_IGNORE_FIRE) &&
1204 have_flag(flgs, TR_IGNORE_COLD))
1206 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1210 if (have_flag(flgs, TR_IGNORE_ACID))
1212 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1214 if (have_flag(flgs, TR_IGNORE_ELEC))
1216 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1218 if (have_flag(flgs, TR_IGNORE_FIRE))
1220 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1222 if (have_flag(flgs, TR_IGNORE_COLD))
1224 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1228 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1230 /* No relevant informations */
1231 if (i <= trivial_info) return (FALSE);
1234 Term_get_size(&wid, &hgt);
1236 /* Display Item name */
1237 if (!(mode & SCROBJ_FAKE_OBJECT))
1238 object_desc(o_name, o_ptr, 0);
1240 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1244 /* Erase the screen */
1245 for (k = 1; k < hgt; k++) prt("", k, 13);
1247 /* Label the information */
1248 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1250 monster_race *r_ptr = &r_info[o_ptr->pval];
1251 int namelen = strlen(r_name + r_ptr->name);
1252 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1253 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1254 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1258 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1261 /* We will print on top of the map (column 13) */
1262 for (k = 2, j = 0; j < i; j++)
1265 prt(info[j], k++, 15);
1267 /* Every 20 entries (lines 2 to 21), start over */
1268 if ((k == hgt - 2) && (j+1 < i))
1270 prt(_("-- 続く --", "-- more --"), k, 15);
1272 for (; k > 2; k--) prt("", k, 15);
1277 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1282 /* Gave knowledge */
1289 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1290 * Convert an inventory index into a one character label
1291 * @param i プレイヤーの所持/装備オブジェクトID
1292 * @return 対応するアルファベット
1293 * @details Note that the label does NOT distinguish inven/equip.
1295 char index_to_label(int i)
1297 /* Indexes for "inven" are easy */
1298 if (i < INVEN_RARM) return (I2A(i));
1300 /* Indexes for "equip" are offset */
1301 return (I2A(i - INVEN_RARM));
1305 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1306 * Convert a label into the index of an item in the "inven"
1307 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1308 * @details Note that the label does NOT distinguish inven/equip.
1310 INVENTORY_IDX label_to_inven(int c)
1315 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1317 /* Verify the index */
1318 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1320 /* Empty slots can never be chosen */
1321 if (!inventory[i].k_idx) return (-1);
1323 /* Return the index */
1329 extern bool select_ring_slot;
1333 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1334 * @param i プレイヤーの所持/装備オブジェクトID
1335 * @return 指輪枠ならばTRUEを返す。
1337 static bool is_ring_slot(int i)
1339 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1344 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1345 * Convert a label into the index of a item in the "equip"
1346 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1348 INVENTORY_IDX label_to_equip(int c)
1353 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1355 /* Verify the index */
1356 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1358 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1360 /* Empty slots can never be chosen */
1361 if (!inventory[i].k_idx) return (-1);
1363 /* Return the index */
1370 * @brief オブジェクトの該当装備部位IDを返す /
1371 * Determine which equipment slot (if any) an item likes
1372 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1373 * @return 対応する装備部位ID
1375 s16b wield_slot(object_type *o_ptr)
1377 /* Slot for equipment */
1378 switch (o_ptr->tval)
1385 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1386 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1387 return (INVEN_LARM);
1394 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1395 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1396 return (INVEN_RARM);
1406 /* Use the right hand first */
1407 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1409 /* Use the left hand for swapping (by default) */
1410 return (INVEN_LEFT);
1416 return (INVEN_NECK);
1421 return (INVEN_LITE);
1428 return (INVEN_BODY);
1433 return (INVEN_OUTER);
1439 return (INVEN_HEAD);
1444 return (INVEN_HANDS);
1449 return (INVEN_FEET);
1453 /* No slot available */
1458 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1459 * Return a string mentioning how a given item is carried
1460 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1461 * @return 部位表現の文字列ポインタ
1463 concptr mention_use(int i)
1467 /* Examine the location */
1471 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1473 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1477 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1479 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1482 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("運搬中", "Just holding") : _("射撃用", "Shooting"); break;
1483 case INVEN_RIGHT: p = (left_hander ? _("左手指", "On left hand") : _("右手指", "On right hand")); break;
1484 case INVEN_LEFT: p = (left_hander ? _("右手指", "On right hand") : _("左手指", "On left hand")); break;
1485 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1486 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1487 case INVEN_BODY: p = _(" 体", "On body"); break;
1488 case INVEN_OUTER: p = _("体の上", "About body"); break;
1489 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1490 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1491 case INVEN_FEET: p = _(" 足", "On feet"); break;
1492 default: p = _("ザック", "In pack"); break;
1495 /* Return the result */
1501 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1502 * Return a string describing how a given item is being worn.
1503 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1504 * @return 状態表現内容の文字列ポインタ
1506 * Currently, only used for items in the equipment, not inventory.
1508 concptr describe_use(int i)
1515 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1517 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1521 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1523 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1526 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? _("持つだけで精一杯の", "just holding") : _("射撃用に装備している", "shooting missiles with"); break;
1527 case INVEN_RIGHT: p = (left_hander ? _("左手の指にはめている", "wearing on your left hand") : _("右手の指にはめている", "wearing on your right hand")); break;
1528 case INVEN_LEFT: p = (left_hander ? _("右手の指にはめている", "wearing on your right hand") : _("左手の指にはめている", "wearing on your left hand")); break;
1529 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1530 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1531 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1532 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1533 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1534 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1535 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1536 default: p = _("ザックに入っている", "carrying in your pack"); break;
1539 /* Return the result */
1545 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1546 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1547 * @param book_tval ベースアイテムのtval
1548 * @param book_sval ベースアイテムのsval
1549 * @return 使用可能な魔法書ならばTRUEを返す。
1552 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1554 if (book_tval < TV_LIFE_BOOK) return FALSE;
1555 if (p_ptr->pclass == CLASS_SORCERER)
1557 return is_magic(tval2realm(book_tval));
1559 else if (p_ptr->pclass == CLASS_RED_MAGE)
1561 if (is_magic(tval2realm(book_tval)))
1562 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1564 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1568 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1569 * Check an item against the item tester info
1570 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1571 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1573 bool item_tester_okay(object_type *o_ptr)
1575 /* Hack -- allow listing empty slots */
1576 // if (item_tester_full) return (TRUE); // TODO:DELETE
1578 /* Require an item */
1579 if (!o_ptr->k_idx) return (FALSE);
1581 /* Hack -- ignore "gold" */
1582 if (o_ptr->tval == TV_GOLD)
1585 extern bool show_gold_on_floor;
1587 if (!show_gold_on_floor) return (FALSE);
1590 /* Check the tval */
1591 if (item_tester_tval)
1593 /* Is it a spellbook? If so, we need a hack -- TY */
1594 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1595 (item_tester_tval >= TV_LIFE_BOOK))
1596 return check_book_realm(o_ptr->tval, o_ptr->sval);
1598 if (item_tester_tval != o_ptr->tval) return (FALSE);
1601 /* Check the hook */
1602 if (item_tester_hook)
1604 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1613 * @brief 所持アイテム一覧を表示する /
1614 * Choice window "shadow" of the "show_inven()" function
1617 void display_inven(void)
1619 register int i, n, z = 0;
1621 TERM_COLOR attr = TERM_WHITE;
1623 GAME_TEXT o_name[MAX_NLEN];
1626 Term_get_size(&wid, &hgt);
1628 /* Find the "final" slot */
1629 for (i = 0; i < INVEN_PACK; i++)
1631 o_ptr = &inventory[i];
1633 /* Skip non-objects */
1634 if (!o_ptr->k_idx) continue;
1640 /* Display the pack */
1641 for (i = 0; i < z; i++)
1643 /* Examine the item */
1644 o_ptr = &inventory[i];
1646 /* Start with an empty "index" */
1647 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1649 /* Is this item "acceptable"? */
1650 if (item_tester_okay(o_ptr))
1652 /* Prepare an "index" */
1653 tmp_val[0] = index_to_label(i);
1655 /* Bracket the "index" --(-- */
1659 /* Display the index (or blank space) */
1660 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1662 /* Obtain an item description */
1663 object_desc(o_name, o_ptr, 0);
1665 /* Obtain the length of the description */
1669 attr = tval_to_attr[o_ptr->tval % 128];
1671 /* Grey out charging items */
1677 /* Display the entry itself */
1678 Term_putstr(3, i, n, attr, o_name);
1680 /* Erase the rest of the line */
1681 Term_erase(3+n, i, 255);
1683 /* Display the weight if needed */
1686 int wgt = o_ptr->weight * o_ptr->number;
1688 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1690 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1693 prt(tmp_val, i, wid - 9);
1697 /* Erase the rest of the window */
1698 for (i = z; i < hgt; i++)
1700 /* Erase the line */
1701 Term_erase(0, i, 255);
1708 * @brief 装備アイテム一覧を表示する /
1709 * Choice window "shadow" of the "show_equip()" function
1712 void display_equip(void)
1716 TERM_COLOR attr = TERM_WHITE;
1718 GAME_TEXT o_name[MAX_NLEN];
1721 Term_get_size(&wid, &hgt);
1723 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1725 /* Examine the item */
1726 o_ptr = &inventory[i];
1728 /* Start with an empty "index" */
1729 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1731 /* Is this item "acceptable"? */
1732 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1734 /* Prepare an "index" */
1735 tmp_val[0] = index_to_label(i);
1737 /* Bracket the "index" --(-- */
1741 /* Display the index (or blank space) */
1742 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1744 /* Obtain an item description */
1745 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1747 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1752 object_desc(o_name, o_ptr, 0);
1753 attr = tval_to_attr[o_ptr->tval % 128];
1756 /* Obtain the length of the description */
1759 /* Grey out charging items */
1765 /* Display the entry itself */
1766 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1768 /* Erase the rest of the line */
1769 Term_erase(3+n, i - INVEN_RARM, 255);
1771 /* Display the weight (if needed) */
1774 int wgt = o_ptr->weight * o_ptr->number;
1776 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1778 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1781 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1784 /* Display the slot description (if needed) */
1787 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1788 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1792 /* Erase the rest of the window */
1793 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1795 /* Clear that line */
1796 Term_erase(0, i, 255);
1802 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1803 * Find the "first" inventory object with the given "tag".
1804 * @param cp 対応するタグIDを与える参照ポインタ
1805 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1806 * @param mode 所持、装備の切り替え
1807 * @return タグに該当するオブジェクトがあるならTRUEを返す
1809 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1810 * inscription of an object. Alphabetical characters don't work as a\n
1811 * tag in this form.\n
1813 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1814 * and "x" is the "current" command_cmd code.\n
1816 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1819 COMMAND_CODE start, end;
1822 /* Extract index from mode */
1827 end = INVEN_TOTAL - 1;
1832 end = INVEN_PACK - 1;
1839 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1841 /* Check every inventory object */
1842 for (i = start; i <= end; i++)
1844 object_type *o_ptr = &inventory[i];
1846 /* Skip non-objects */
1847 if (!o_ptr->k_idx) continue;
1849 /* Skip empty inscriptions */
1850 if (!o_ptr->inscription) continue;
1852 /* Skip non-choice */
1853 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1856 s = my_strchr(quark_str(o_ptr->inscription), '@');
1858 /* Process all tags */
1861 /* Check the special tags */
1862 if ((s[1] == command_cmd) && (s[2] == tag))
1864 /* Save the actual inventory ID */
1871 /* Find another '@' */
1872 s = my_strchr(s + 1, '@');
1877 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1879 /* Don't allow {@#} with '#' being alphabet */
1880 if (tag < '0' || '9' < tag)
1886 /* Check every object */
1887 for (i = start; i <= end; i++)
1889 object_type *o_ptr = &inventory[i];
1891 /* Skip non-objects */
1892 if (!o_ptr->k_idx) continue;
1894 /* Skip empty inscriptions */
1895 if (!o_ptr->inscription) continue;
1897 /* Skip non-choice */
1898 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
1901 s = my_strchr(quark_str(o_ptr->inscription), '@');
1903 /* Process all tags */
1906 /* Check the normal tags */
1909 /* Save the actual inventory ID */
1916 /* Find another '@' */
1917 s = my_strchr(s + 1, '@');
1927 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1928 * Find the "first" inventory object with the given "tag".
1929 * @param cp 対応するタグIDを与える参照ポインタ
1930 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1931 * @param floor_list 床上アイテムの配列
1932 * @param floor_num 床上アイテムの配列ID
1933 * @return タグに該当するオブジェクトがあるならTRUEを返す
1935 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1936 * inscription of an object. Alphabetical characters don't work as a\n
1937 * tag in this form.\n
1939 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1940 * and "x" is the "current" command_cmd code.\n
1942 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1947 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1949 /* Check every object in the grid */
1950 for (i = 0; i < floor_num && i < 23; i++)
1952 object_type *o_ptr = &o_list[floor_list[i]];
1954 /* Skip empty inscriptions */
1955 if (!o_ptr->inscription) continue;
1958 s = my_strchr(quark_str(o_ptr->inscription), '@');
1960 /* Process all tags */
1963 /* Check the special tags */
1964 if ((s[1] == command_cmd) && (s[2] == tag))
1966 /* Save the actual floor object ID */
1973 /* Find another '@' */
1974 s = my_strchr(s + 1, '@');
1979 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1981 /* Don't allow {@#} with '#' being alphabet */
1982 if (tag < '0' || '9' < tag)
1988 /* Check every object in the grid */
1989 for (i = 0; i < floor_num && i < 23; i++)
1991 object_type *o_ptr = &o_list[floor_list[i]];
1993 /* Skip empty inscriptions */
1994 if (!o_ptr->inscription) continue;
1997 s = my_strchr(quark_str(o_ptr->inscription), '@');
1999 /* Process all tags */
2002 /* Check the normal tags */
2005 /* Save the floor object ID */
2012 /* Find another '@' */
2013 s = my_strchr(s + 1, '@');
2023 * @brief タグIDにあわせてタグアルファベットのリストを返す /
2024 * Move around label characters with correspond tags
2025 * @param label ラベルリストを取得する文字列参照ポインタ
2026 * @param mode 所持品リストか装備品リストかの切り替え
2029 static void prepare_label_string(char *label, BIT_FLAGS mode)
2031 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2032 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2035 /* Prepare normal labels */
2036 strcpy(label, alphabet_chars);
2038 /* Move each label */
2039 for (i = 0; i < 52; i++)
2042 SYMBOL_CODE c = alphabet_chars[i];
2044 /* Find a tag with this label */
2045 if (get_tag(&index, c, mode))
2047 /* Delete the overwritten label */
2048 if (label[i] == c) label[i] = ' ';
2050 /* Move the label to the place of corresponding tag */
2051 label[index - offset] = c;
2058 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2059 * Move around label characters with correspond tags (floor version)
2060 * @param label ラベルリストを取得する文字列参照ポインタ
2061 * @param floor_list 床上アイテムの配列
2062 * @param floor_num 床上アイテムの配列ID
2067 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2069 concptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2072 /* Prepare normal labels */
2073 strcpy(label, alphabet_chars);
2075 /* Move each label */
2076 for (i = 0; i < 52; i++)
2079 SYMBOL_CODE c = alphabet_chars[i];
2081 /* Find a tag with this label */
2082 if (get_tag_floor(&index, c, floor_list, floor_num))
2084 /* Delete the overwritten label */
2085 if (label[i] == c) label[i] = ' ';
2087 /* Move the label to the place of corresponding tag */
2095 * @brief 所持アイテムの表示を行う /
2096 * Display the inventory.
2097 * @param target_item アイテムの選択処理を行うか否か。
2098 * @return 選択したアイテムのタグ
2100 * Hack -- do not display "trailing" empty slots
2102 COMMAND_CODE show_inven(int target_item, BIT_FLAGS mode)
2106 int col, cur_col, len;
2108 GAME_TEXT o_name[MAX_NLEN];
2110 COMMAND_CODE out_index[23];
2111 TERM_COLOR out_color[23];
2112 char out_desc[23][MAX_NLEN];
2113 COMMAND_CODE target_item_label = 0;
2115 char inven_label[52 + 1];
2117 /* Starting column */
2120 Term_get_size(&wid, &hgt);
2122 /* Default "max-length" */
2123 len = wid - col - 1;
2126 /* Find the "final" slot */
2127 for (i = 0; i < INVEN_PACK; i++)
2129 o_ptr = &inventory[i];
2131 /* Skip non-objects */
2132 if (!o_ptr->k_idx) continue;
2138 prepare_label_string(inven_label, USE_INVEN);
2140 /* Display the inventory */
2141 for (k = 0, i = 0; i < z; i++)
2143 o_ptr = &inventory[i];
2145 /* Is this item acceptable? */
2146 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
2148 object_desc(o_name, o_ptr, 0);
2150 /* Save the object index, color, and description */
2152 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2154 /* Grey out charging items */
2157 out_color[k] = TERM_L_DARK;
2160 (void)strcpy(out_desc[k], o_name);
2162 /* Find the predicted "line length" */
2163 l = strlen(out_desc[k]) + 5;
2165 /* Be sure to account for the weight */
2166 if (show_weights) l += 9;
2168 /* Account for icon if displayed */
2169 if (show_item_graph)
2172 if (use_bigtile) l++;
2175 /* Maintain the maximum length */
2176 if (l > len) len = l;
2178 /* Advance to next "line" */
2182 /* Find the column to start in */
2183 col = (len > wid - 4) ? 0 : (wid - len - 1);
2185 /* Output each entry */
2186 for (j = 0; j < k; j++)
2191 o_ptr = &inventory[i];
2193 /* Clear the line */
2194 prt("", j + 1, col ? col - 2 : col);
2196 if (use_menu && target_item)
2198 if (j == (target_item-1))
2200 strcpy(tmp_val, _("》", "> "));
2201 target_item_label = i;
2203 else strcpy(tmp_val, " ");
2205 else if (i <= INVEN_PACK)
2207 /* Prepare an index --(-- */
2208 sprintf(tmp_val, "%c)", inven_label[i]);
2212 /* Prepare an index --(-- */
2213 sprintf(tmp_val, "%c)", index_to_label(i));
2216 /* Clear the line with the (possibly indented) index */
2217 put_str(tmp_val, j + 1, col);
2221 /* Display graphics for object, if desired */
2222 if (show_item_graph)
2224 TERM_COLOR a = object_attr(o_ptr);
2225 SYMBOL_CODE c = object_char(o_ptr);
2226 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2227 if (use_bigtile) cur_col++;
2233 /* Display the entry itself */
2234 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2236 /* Display the weight if needed */
2239 int wgt = o_ptr->weight * o_ptr->number;
2241 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2243 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2246 prt(tmp_val, j + 1, wid - 9);
2250 /* Make a "shadow" below the list (only if needed) */
2251 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2253 /* Save the new column */
2256 return target_item_label;
2261 * @brief 装備アイテムの表示を行う /
2262 * Display the equipment.
2263 * @param target_item アイテムの選択処理を行うか否か。
2264 * @return 選択したアイテムのタグ
2266 COMMAND_CODE show_equip(int target_item, BIT_FLAGS mode)
2270 int col, cur_col, len;
2273 GAME_TEXT o_name[MAX_NLEN];
2274 COMMAND_CODE out_index[23];
2275 TERM_COLOR out_color[23];
2276 char out_desc[23][MAX_NLEN];
2277 COMMAND_CODE target_item_label = 0;
2279 char equip_label[52 + 1];
2281 /* Starting column */
2284 Term_get_size(&wid, &hgt);
2286 /* Maximal length */
2287 len = wid - col - 1;
2290 /* Scan the equipment list */
2291 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2293 o_ptr = &inventory[i];
2295 /* Is this item acceptable? */
2296 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr) || (mode & USE_FULL)) &&
2297 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2298 (mode & IGNORE_BOTHHAND_SLOT))) continue;
2300 object_desc(o_name, o_ptr, 0);
2302 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2304 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2305 out_color[k] = TERM_WHITE;
2309 (void)strcpy(out_desc[k], o_name);
2310 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2314 /* Grey out charging items */
2317 out_color[k] = TERM_L_DARK;
2320 /* Extract the maximal length (see below) */
2322 l = strlen(out_desc[k]) + (2 + 1);
2324 l = strlen(out_desc[k]) + (2 + 3);
2328 /* Increase length for labels (if needed) */
2330 if (show_labels) l += (7 + 2);
2332 if (show_labels) l += (14 + 2);
2336 /* Increase length for weight (if needed) */
2337 if (show_weights) l += 9;
2339 if (show_item_graph) l += 2;
2341 /* Maintain the max-length */
2342 if (l > len) len = l;
2344 /* Advance the entry */
2348 /* Hack -- Find a column to start in */
2350 col = (len > wid - 6) ? 0 : (wid - len - 1);
2352 col = (len > wid - 4) ? 0 : (wid - len - 1);
2355 prepare_label_string(equip_label, USE_EQUIP);
2357 /* Output each entry */
2358 for (j = 0; j < k; j++)
2363 o_ptr = &inventory[i];
2365 /* Clear the line */
2366 prt("", j + 1, col ? col - 2 : col);
2368 if (use_menu && target_item)
2370 if (j == (target_item-1))
2372 strcpy(tmp_val, _("》", "> "));
2373 target_item_label = i;
2375 else strcpy(tmp_val, " ");
2377 else if (i >= INVEN_RARM)
2379 /* Prepare an index --(-- */
2380 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2384 /* Prepare an index --(-- */
2385 sprintf(tmp_val, "%c)", index_to_label(i));
2388 /* Clear the line with the (possibly indented) index */
2389 put_str(tmp_val, j+1, col);
2393 /* Display graphics for object, if desired */
2394 if (show_item_graph)
2396 TERM_COLOR a = object_attr(o_ptr);
2397 SYMBOL_CODE c = object_char(o_ptr);
2398 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2399 if (use_bigtile) cur_col++;
2407 /* Mention the use */
2408 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2410 put_str(tmp_val, j+1, cur_col);
2412 /* Display the entry itself */
2413 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2419 /* Display the entry itself */
2420 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2423 /* Display the weight if needed */
2426 int wgt = o_ptr->weight * o_ptr->number;
2428 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2430 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2433 prt(tmp_val, j + 1, wid - 9);
2437 /* Make a "shadow" below the list (only if needed) */
2438 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2440 /* Save the new column */
2443 return target_item_label;
2447 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2448 * Flip "inven" and "equip" in any sub-windows
2451 void toggle_inven_equip(void)
2456 for (j = 0; j < 8; j++)
2459 if (!angband_term[j]) continue;
2461 /* Flip inven to equip */
2462 if (window_flag[j] & (PW_INVEN))
2465 window_flag[j] &= ~(PW_INVEN);
2466 window_flag[j] |= (PW_EQUIP);
2468 p_ptr->window |= (PW_EQUIP);
2471 /* Flip inven to equip */
2472 else if (window_flag[j] & (PW_EQUIP))
2475 window_flag[j] &= ~(PW_EQUIP);
2476 window_flag[j] |= (PW_INVEN);
2478 p_ptr->window |= (PW_INVEN);
2484 * @brief 選択したアイテムの確認処理の補助 /
2485 * Verify the choice of an item.
2486 * @param prompt メッセージ表示の一部
2487 * @param item 選択アイテムID
2488 * @return 確認がYesならTRUEを返す。
2489 * @details The item can be negative to mean "item on floor".
2491 static bool verify(concptr prompt, INVENTORY_IDX item)
2493 GAME_TEXT o_name[MAX_NLEN];
2494 char out_val[MAX_NLEN+20];
2501 o_ptr = &inventory[item];
2507 o_ptr = &o_list[0 - item];
2509 object_desc(o_name, o_ptr, 0);
2512 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2515 return (get_check(out_val));
2520 * @brief 選択したアイテムの確認処理のメインルーチン /
2521 * @param item 選択アイテムID
2522 * @return 確認がYesならTRUEを返す。
2523 * @details The item can be negative to mean "item on floor".
2524 * Hack -- allow user to "prevent" certain choices
2526 static bool get_item_allow(INVENTORY_IDX item)
2530 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2535 o_ptr = &inventory[item];
2541 o_ptr = &o_list[0 - item];
2544 /* No inscription */
2545 if (!o_ptr->inscription) return (TRUE);
2548 s = my_strchr(quark_str(o_ptr->inscription), '!');
2550 /* Process preventions */
2553 /* Check the "restriction" */
2554 if ((s[1] == command_cmd) || (s[1] == '*'))
2556 /* Verify the choice */
2557 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2560 /* Find another '!' */
2561 s = my_strchr(s + 1, '!');
2570 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2571 * Auxiliary function for "get_item()" -- test an index
2573 * @return 正規のIDならばTRUEを返す。
2575 static bool get_item_okay(OBJECT_IDX i)
2578 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2580 if (select_ring_slot) return is_ring_slot(i);
2582 /* Verify the item */
2583 if (!item_tester_okay(&inventory[i])) return (FALSE);
2590 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2591 * Determine whether get_item() can get some item or not
2592 * @return アイテムを拾えるならばTRUEを返す。
2593 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2595 bool can_get_item(void)
2598 OBJECT_IDX floor_list[23];
2599 ITEM_NUMBER floor_num = 0;
2601 for (j = 0; j < INVEN_TOTAL; j++)
2602 if (item_tester_okay(&inventory[j]))
2605 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2613 * @brief オブジェクト選択の汎用関数 /
2614 * Let the user select an item, save its "index"
2615 * @param cp 選択したオブジェクトのIDを返す。
2616 * @param pmt 選択目的のメッセージ
2617 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2618 * @param mode オプションフラグ
2619 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2620 * Return TRUE only if an acceptable item was chosen by the user.\n
2622 * The selected item must satisfy the "item_tester_hook()" function,\n
2623 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2625 * All "item_tester" restrictions are cleared before this function returns.\n
2627 * The user is allowed to choose acceptable items from the equipment,\n
2628 * inventory, or floor, respectively, if the proper flag was given,\n
2629 * and there are any acceptable items in that location.\n
2631 * The equipment or inventory are displayed (even if no acceptable\n
2632 * items are in that location) if the proper flag was given.\n
2634 * If there are no acceptable items available anywhere, and "str" is\n
2635 * not NULL, then it will be used as the text of a warning message\n
2636 * before the function returns.\n
2638 * Note that the user must press "-" to specify the item on the floor,\n
2639 * and there is no way to "examine" the item on the floor, while the\n
2640 * use of "capital" letters will "examine" an inventory/equipment item,\n
2641 * and prompt for its use.\n
2643 * If a legal item is selected from the inventory, we save it in "cp"\n
2644 * directly (0 to 35), and return TRUE.\n
2646 * If a legal item is selected from the floor, we save it in "cp" as\n
2647 * a negative (-1 to -511), and return TRUE.\n
2649 * If no item is available, we do nothing to "cp", and we display a\n
2650 * warning message, using "str" if available, and return FALSE.\n
2652 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2654 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2655 * to allow the user to enter a command while viewing those screens, and\n
2656 * also to induce "auto-enter" of stores, and other such stuff.\n
2658 * Global "p_ptr->command_see" may be set before calling this function to start\n
2659 * out in "browse" mode. It is cleared before this function returns.\n
2661 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2662 * If it is TRUE then we are viewing inventory, else equipment.\n
2664 * We always erase the prompt when we are done, leaving a blank line,\n
2665 * or a warning message, if appropriate, if no items are available.\n
2667 bool get_item(OBJECT_IDX *cp, concptr pmt, concptr str, BIT_FLAGS mode)
2669 OBJECT_IDX this_o_idx, next_o_idx = 0;
2686 bool allow_floor = FALSE;
2688 bool toggle = FALSE;
2693 int menu_line = (use_menu ? 1 : 0);
2697 static char prev_tag = '\0';
2698 char cur_tag = '\0';
2700 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2703 if (mode & USE_EQUIP) equip = TRUE;
2704 if (mode & USE_INVEN) inven = TRUE;
2705 if (mode & USE_FLOOR) floor = TRUE;
2707 /* Get the item index */
2708 if (repeat_pull(cp))
2711 if (mode & USE_FORCE && (*cp == INVEN_FORCE))
2713 item_tester_tval = 0;
2714 item_tester_hook = NULL;
2715 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2720 else if (floor && (*cp < 0))
2728 /* Validate the item */
2729 if (item_tester_okay(o_ptr) || (mode & USE_FULL))
2731 /* Forget restrictions */
2732 item_tester_tval = 0;
2733 item_tester_hook = NULL;
2734 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2741 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2742 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2744 if (prev_tag && command_cmd)
2746 /* Look up the tag and validate the item */
2747 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2748 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2749 else if (!get_item_okay(k)) /* Reject */;
2752 /* Accept that choice */
2755 /* Forget restrictions */
2756 item_tester_tval = 0;
2757 item_tester_hook = NULL;
2758 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2764 prev_tag = '\0'; /* prev_tag is no longer effective */
2767 /* Verify the item */
2768 else if (get_item_okay(*cp))
2770 /* Forget restrictions */
2771 item_tester_tval = 0;
2772 item_tester_hook = NULL;
2773 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2787 /* No item selected */
2791 /* Full inventory */
2793 i2 = INVEN_PACK - 1;
2795 /* Forbid inventory */
2796 if (!inven) i2 = -1;
2799 for (j = 0; j < INVEN_PACK; j++)
2800 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
2803 /* Restrict inventory indexes */
2804 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2805 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2808 /* Full equipment */
2810 e2 = INVEN_TOTAL - 1;
2812 /* Forbid equipment */
2813 if (!equip) e2 = -1;
2816 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2817 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
2818 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
2821 /* Restrict equipment indexes */
2822 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2823 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2825 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
2829 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2831 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2835 /* Restrict floor usage */
2838 /* Scan all objects in the grid */
2839 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2842 o_ptr = &o_list[this_o_idx];
2844 /* Acquire next object */
2845 next_o_idx = o_ptr->next_o_idx;
2847 /* Accept the item on the floor if legal */
2848 if ((item_tester_okay(o_ptr) || (mode & USE_FULL)) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2852 /* Require at least one legal choice */
2853 if (!allow_floor && (i1 > i2) && (e1 > e2))
2855 /* Cancel p_ptr->command_see */
2856 command_see = FALSE;
2860 if (mode & USE_FORCE) {
2866 /* Analyze choices */
2869 /* Hack -- Start on equipment if requested */
2870 if (command_see && command_wrk && equip)
2875 /* Use inventory if allowed */
2878 command_wrk = FALSE;
2881 /* Use equipment if allowed */
2887 /* Use inventory for floor */
2890 command_wrk = FALSE;
2896 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2898 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2900 /* Hack -- start out in "display" mode */
2907 /* Repeat until done */
2910 COMMAND_CODE get_item_label = 0;
2917 for (j = 0; j < 8; j++)
2920 if (!angband_term[j]) continue;
2922 /* Count windows displaying inven */
2923 if (window_flag[j] & (PW_INVEN)) ni++;
2925 /* Count windows displaying equip */
2926 if (window_flag[j] & (PW_EQUIP)) ne++;
2929 /* Toggle if needed */
2930 if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne))
2933 toggle_inven_equip();
2939 p_ptr->window |= (PW_INVEN | PW_EQUIP);
2942 /* Inventory screen */
2945 /* Redraw if needed */
2946 if (command_see) get_item_label = show_inven(menu_line, mode);
2949 /* Equipment screen */
2952 /* Redraw if needed */
2953 if (command_see) get_item_label = show_equip(menu_line, mode);
2956 /* Viewing inventory */
2959 /* Begin the prompt */
2960 sprintf(out_val, _("持ち物:", "Inven:"));
2962 /* Some legal items */
2963 if ((i1 <= i2) && !use_menu)
2965 /* Build the prompt */
2966 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2967 index_to_label(i1), index_to_label(i2));
2970 strcat(out_val, tmp_val);
2973 /* Indicate ability to "view" */
2974 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
2977 if (equip) strcat(out_val, format(_(" %s 装備品,", " %s for Equip,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "/")));
2980 /* Viewing equipment */
2983 /* Begin the prompt */
2984 sprintf(out_val, _("装備品:", "Equip:"));
2986 /* Some legal items */
2987 if ((e1 <= e2) && !use_menu)
2989 /* Build the prompt */
2990 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
2991 index_to_label(e1), index_to_label(e2));
2994 strcat(out_val, tmp_val);
2997 /* Indicate ability to "view" */
2998 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3001 if (inven) strcat(out_val, format(_(" %s 持ち物,", " %s for Inven,"), use_menu ? _("'4'or'6'", "4 or 6") : _("'/'", "'/'")));
3004 /* Indicate legality of the "floor" item */
3005 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
3006 if (mode & USE_FORCE) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
3008 /* Finish the prompt */
3009 strcat(out_val, " ESC");
3011 /* Build the prompt */
3012 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3014 /* Show the prompt */
3022 int max_line = (command_wrk ? max_equip : max_inven);
3038 menu_line += (max_line - 1);
3057 /* Verify legality */
3058 if (!inven || !equip)
3064 /* Hack -- Fix screen */
3071 /* Switch inven/equip */
3072 command_wrk = !command_wrk;
3073 max_line = (command_wrk ? max_equip : max_inven);
3074 if (menu_line > max_line) menu_line = max_line;
3076 /* Need to redraw */
3085 if (command_wrk == USE_FLOOR)
3088 (*cp) = -get_item_label;
3092 /* Validate the item */
3093 if (!get_item_okay(get_item_label))
3099 /* Allow player to "refuse" certain actions */
3100 if (!get_item_allow(get_item_label))
3106 /* Accept that choice */
3107 (*cp) = get_item_label;
3116 if (mode & USE_FORCE) {
3124 if (menu_line > max_line) menu_line -= max_line;
3145 command_see = FALSE;
3162 /* Verify legality */
3163 if (!inven || !equip)
3169 /* Hack -- Fix screen */
3176 /* Switch inven/equip */
3177 command_wrk = !command_wrk;
3179 /* Need to redraw */
3185 /* Use floor item */
3188 /* Scan all objects in the grid */
3189 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3192 o_ptr = &o_list[this_o_idx];
3194 /* Acquire next object */
3195 next_o_idx = o_ptr->next_o_idx;
3197 /* Validate the item */
3198 if (!item_tester_okay(o_ptr) && !(mode & USE_FULL)) continue;
3203 /* Verify the item (if required) */
3204 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3206 /* Allow player to "refuse" certain actions */
3207 if (!get_item_allow(k)) continue;
3209 /* Accept that choice */
3225 case '1': case '2': case '3':
3226 case '4': case '5': case '6':
3227 case '7': case '8': case '9':
3229 /* Look up the tag */
3230 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3236 /* Hack -- Validate the item */
3237 if ((k < INVEN_RARM) ? !inven : !equip)
3243 /* Validate the item */
3244 if (!get_item_okay(k))
3250 /* Allow player to "refuse" certain actions */
3251 if (!get_item_allow(k))
3257 /* Accept that choice */
3269 /* Choose "default" inventory item */
3272 k = ((i1 == i2) ? i1 : -1);
3275 /* Choose "default" equipment item */
3278 k = ((e1 == e2) ? e1 : -1);
3281 /* Validate the item */
3282 if (!get_item_okay(k))
3288 /* Allow player to "refuse" certain actions */
3289 if (!get_item_allow(k))
3295 /* Accept that choice */
3305 if (mode & USE_FORCE) {
3318 bool not_found = FALSE;
3320 /* Look up the alphabetical tag */
3321 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3326 /* Hack -- Validate the item */
3327 else if ((k < INVEN_RARM) ? !inven : !equip)
3332 /* Validate the item */
3333 else if (!get_item_okay(k))
3340 /* Accept that choice */
3348 /* Extract "query" setting */
3349 ver = isupper(which);
3350 which = (char)tolower(which);
3352 /* Convert letter to inventory index */
3355 if (which == '(') k = i1;
3356 else if (which == ')') k = i2;
3357 else k = label_to_inven(which);
3360 /* Convert letter to equipment index */
3363 if (which == '(') k = e1;
3364 else if (which == ')') k = e2;
3365 else k = label_to_equip(which);
3368 /* Validate the item */
3369 if (!get_item_okay(k))
3375 /* Verify the item */
3376 if (ver && !verify(_("本当に", "Try"), k))
3382 /* Allow player to "refuse" certain actions */
3383 if (!get_item_allow(k))
3389 /* Accept that choice */
3400 /* Fix the screen if necessary */
3405 /* Hack -- Cancel "display" */
3406 command_see = FALSE;
3410 /* Forget the item_tester_tval restriction */
3411 item_tester_tval = 0;
3413 /* Forget the item_tester_hook restriction */
3414 item_tester_hook = NULL;
3417 /* Clean up 'show choices' */
3418 /* Toggle again if needed */
3419 if (toggle) toggle_inven_equip();
3421 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3424 /* Clear the prompt line */
3427 /* Warning if needed */
3428 if (oops && str) msg_print(str);
3433 if (command_cmd) prev_tag = cur_tag;
3434 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3440 * Choose an item and get auto-picker entry from it.
3442 object_type *choose_object(OBJECT_IDX *idx, concptr q, concptr s, BIT_FLAGS option)
3445 if (!get_item(&item, q, s, option)) return NULL;
3446 if (idx) *idx = item;
3448 if (item == INVEN_FORCE) return NULL;
3450 /* Get the item (in the pack) */
3451 else if (item >= 0) return &inventory[item];
3453 /* Get the item (on the floor) */
3454 else return &o_list[0 - item];
3459 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3460 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3461 * @param y 走査するフロアのY座標
3462 * @param x 走査するフロアのX座標
3463 * @param mode オプションフラグ
3464 * @return 対象のマスに落ちているアイテム数
3466 * Return a list of o_list[] indexes of items at the given cave
3467 * location. Valid flags are:
3469 * mode & 0x01 -- Item tester
3470 * mode & 0x02 -- Marked items only
3471 * mode & 0x04 -- Stop after first
3473 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3475 OBJECT_IDX this_o_idx, next_o_idx;
3477 ITEM_NUMBER num = 0;
3480 if (!in_bounds(y, x)) return 0;
3482 /* Scan all objects in the grid */
3483 for (this_o_idx = cave[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3486 o_ptr = &o_list[this_o_idx];
3488 /* Acquire next object */
3489 next_o_idx = o_ptr->next_o_idx;
3492 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3495 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3497 /* Accept this item */
3498 /* XXX Hack -- Enforce limit */
3500 items[num] = this_o_idx;
3505 if (mode & 0x04) break;
3512 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3513 * @param target_item カーソルの初期値
3514 * @param y 走査するフロアのY座標
3515 * @param x 走査するフロアのX座標
3516 * @param min_width 表示の長さ
3517 * @return 選択したアイテムの添え字
3520 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3528 GAME_TEXT o_name[MAX_NLEN];
3531 COMMAND_CODE out_index[23];
3532 TERM_COLOR out_color[23];
3533 char out_desc[23][MAX_NLEN];
3534 COMMAND_CODE target_item_label = 0;
3536 OBJECT_IDX floor_list[23];
3537 ITEM_NUMBER floor_num;
3539 char floor_label[52 + 1];
3541 bool dont_need_to_show_weights = TRUE;
3543 Term_get_size(&wid, &hgt);
3545 /* Default length */
3546 len = MAX((*min_width), 20);
3548 /* Scan for objects in the grid, using item_tester_okay() */
3549 floor_num = scan_floor(floor_list, y, x, 0x03);
3551 /* Display the floor objects */
3552 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3554 o_ptr = &o_list[floor_list[i]];
3556 object_desc(o_name, o_ptr, 0);
3558 /* Save the index */
3561 /* Acquire inventory color */
3562 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3564 /* Save the object description */
3565 strcpy(out_desc[k], o_name);
3567 /* Find the predicted "line length" */
3568 l = strlen(out_desc[k]) + 5;
3570 /* Be sure to account for the weight */
3571 if (show_weights) l += 9;
3573 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3575 /* Maintain the maximum length */
3576 if (l > len) len = l;
3578 /* Advance to next "line" */
3582 if (show_weights && dont_need_to_show_weights) len -= 9;
3587 /* Find the column to start in */
3588 col = (len > wid - 4) ? 0 : (wid - len - 1);
3590 prepare_label_string_floor(floor_label, floor_list, floor_num);
3592 /* Output each entry */
3593 for (j = 0; j < k; j++)
3596 m = floor_list[out_index[j]];
3600 /* Clear the line */
3601 prt("", j + 1, col ? col - 2 : col);
3603 if (use_menu && target_item)
3605 if (j == (target_item-1))
3607 strcpy(tmp_val, _("》", "> "));
3608 target_item_label = m;
3610 else strcpy(tmp_val, " ");
3614 /* Prepare an index --(-- */
3615 sprintf(tmp_val, "%c)", floor_label[j]);
3618 /* Clear the line with the (possibly indented) index */
3619 put_str(tmp_val, j + 1, col);
3621 /* Display the entry itself */
3622 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3624 /* Display the weight if needed */
3625 if (show_weights && (o_ptr->tval != TV_GOLD))
3627 int wgt = o_ptr->weight * o_ptr->number;
3629 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3631 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3634 prt(tmp_val, j + 1, wid - 9);
3638 /* Make a "shadow" below the list (only if needed) */
3639 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3641 return target_item_label;
3645 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3646 * Let the user select an item, save its "index"
3647 * @param cp 選択したオブジェクトのIDを返す。
3648 * @param pmt 選択目的のメッセージ
3649 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3650 * @param mode オプションフラグ
3651 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3653 bool get_item_floor(COMMAND_CODE *cp, concptr pmt, concptr str, BIT_FLAGS mode)
3655 char n1 = ' ', n2 = ' ', which = ' ';
3658 COMMAND_CODE i1, i2;
3659 COMMAND_CODE e1, e2;
3667 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3668 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3669 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3670 bool force = (mode & USE_FORCE) ? TRUE : FALSE;
3672 bool allow_equip = FALSE;
3673 bool allow_inven = FALSE;
3674 bool allow_floor = FALSE;
3676 bool toggle = FALSE;
3681 ITEM_NUMBER floor_num;
3682 OBJECT_IDX floor_list[23];
3684 TERM_LEN min_width = 0;
3686 int menu_line = (use_menu ? 1 : 0);
3690 static char prev_tag = '\0';
3691 char cur_tag = '\0';
3693 /* Get the item index */
3694 if (repeat_pull(cp))
3697 if (force && (*cp == INVEN_FORCE))
3699 item_tester_tval = 0;
3700 item_tester_hook = NULL;
3701 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3706 else if (floor && (*cp < 0))
3708 if (prev_tag && command_cmd)
3710 /* Scan all objects in the grid */
3711 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3713 /* Look up the tag */
3714 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3716 /* Accept that choice */
3717 (*cp) = 0 - floor_list[k];
3719 /* Forget restrictions */
3720 item_tester_tval = 0;
3721 item_tester_hook = NULL;
3722 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3728 prev_tag = '\0'; /* prev_tag is no longer effective */
3731 /* Validate the item */
3732 else if (item_tester_okay(&o_list[0 - (*cp)]) || (mode & USE_FULL))
3734 /* Forget restrictions */
3735 item_tester_tval = 0;
3736 item_tester_hook = NULL;
3737 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3744 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3745 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3747 if (prev_tag && command_cmd)
3749 /* Look up the tag and validate the item */
3750 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3751 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3752 else if (!get_item_okay(k)) /* Reject */;
3755 /* Accept that choice */
3758 /* Forget restrictions */
3759 item_tester_tval = 0;
3760 item_tester_hook = NULL;
3761 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3767 prev_tag = '\0'; /* prev_tag is no longer effective */
3770 /* Verify the item */
3771 else if (get_item_okay(*cp))
3773 /* Forget restrictions */
3774 item_tester_tval = 0;
3775 item_tester_hook = NULL;
3776 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3792 /* No item selected */
3796 /* Full inventory */
3798 i2 = INVEN_PACK - 1;
3800 /* Forbid inventory */
3801 if (!inven) i2 = -1;
3804 for (j = 0; j < INVEN_PACK; j++)
3805 if (item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_inven++;
3808 /* Restrict inventory indexes */
3809 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3810 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3813 /* Full equipment */
3815 e2 = INVEN_TOTAL - 1;
3817 /* Forbid equipment */
3818 if (!equip) e2 = -1;
3821 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3822 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j]) || (mode & USE_FULL)) max_equip++;
3823 if (p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT)) max_equip++;
3826 /* Restrict equipment indexes */
3827 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3828 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3830 if (equip && p_ptr->ryoute && !(mode & IGNORE_BOTHHAND_SLOT))
3834 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3836 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3840 /* Count "okay" floor items */
3843 /* Restrict floor usage */
3846 /* Scan all objects in the grid */
3847 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3850 /* Accept inventory */
3851 if (i1 <= i2) allow_inven = TRUE;
3853 /* Accept equipment */
3854 if (e1 <= e2) allow_equip = TRUE;
3857 if (floor_num) allow_floor = TRUE;
3859 /* Require at least one legal choice */
3860 if (!allow_inven && !allow_equip && !allow_floor)
3862 /* Cancel p_ptr->command_see */
3863 command_see = FALSE;
3873 /* Analyze choices */
3876 /* Hack -- Start on equipment if requested */
3877 if (command_see && (command_wrk == (USE_EQUIP))
3880 command_wrk = (USE_EQUIP);
3883 /* Use inventory if allowed */
3884 else if (allow_inven)
3886 command_wrk = (USE_INVEN);
3889 /* Use equipment if allowed */
3890 else if (allow_equip)
3892 command_wrk = (USE_EQUIP);
3895 /* Use floor if allowed */
3896 else if (allow_floor)
3898 command_wrk = (USE_FLOOR);
3903 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3905 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3907 /* Hack -- start out in "display" mode */
3913 /* Repeat until done */
3916 COMMAND_CODE get_item_label = 0;
3923 for (j = 0; j < 8; j++)
3926 if (!angband_term[j]) continue;
3928 /* Count windows displaying inven */
3929 if (window_flag[j] & (PW_INVEN)) ni++;
3931 /* Count windows displaying equip */
3932 if (window_flag[j] & (PW_EQUIP)) ne++;
3935 /* Toggle if needed */
3936 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
3937 (command_wrk == (USE_INVEN) && !ni && ne))
3940 toggle_inven_equip();
3946 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3949 /* Inventory screen */
3950 if (command_wrk == (USE_INVEN))
3952 /* Extract the legal requests */
3956 /* Redraw if needed */
3957 if (command_see) get_item_label = show_inven(menu_line, mode);
3960 /* Equipment screen */
3961 else if (command_wrk == (USE_EQUIP))
3963 /* Extract the legal requests */
3964 n1 = I2A(e1 - INVEN_RARM);
3965 n2 = I2A(e2 - INVEN_RARM);
3967 /* Redraw if needed */
3968 if (command_see) get_item_label = show_equip(menu_line, mode);
3972 else if (command_wrk == (USE_FLOOR))
3975 k = MIN(floor_top + 23, floor_num) - 1;
3977 /* Extract the legal requests */
3978 n1 = I2A(j - floor_top);
3979 n2 = I2A(k - floor_top);
3981 /* Redraw if needed */
3982 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
3985 /* Viewing inventory */
3986 if (command_wrk == (USE_INVEN))
3988 /* Begin the prompt */
3989 sprintf(out_val, _("持ち物:", "Inven:"));
3993 /* Build the prompt */
3994 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3995 index_to_label(i1), index_to_label(i2));
3998 strcat(out_val, tmp_val);
4001 /* Indicate ability to "view" */
4002 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4008 strcat(out_val, _(" '/' 装備品,", " / for Equip,"));
4009 else if (allow_floor)
4010 strcat(out_val, _(" '6' 装備品,", " 6 for Equip,"));
4012 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4019 strcat(out_val, _(" '-'床上,", " - for floor,"));
4020 else if (allow_equip)
4021 strcat(out_val, _(" '4' 床上,", " 4 for floor,"));
4023 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4027 /* Viewing equipment */
4028 else if (command_wrk == (USE_EQUIP))
4030 /* Begin the prompt */
4031 sprintf(out_val, _("装備品:", "Equip:"));
4035 /* Build the prompt */
4036 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4037 index_to_label(e1), index_to_label(e2));
4040 strcat(out_val, tmp_val);
4043 /* Indicate ability to "view" */
4044 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4050 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4051 else if (allow_floor)
4052 strcat(out_val, _(" '4' 持ち物,", " 4 for Inven,"));
4054 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4061 strcat(out_val, _(" '-'床上,", " - for floor,"));
4062 else if (allow_inven)
4063 strcat(out_val, _(" '6' 床上,", " 6 for floor,"));
4065 strcat(out_val, _(" '4'or'6' 床上,", " 4 or 6 for floor,"));
4070 else if (command_wrk == (USE_FLOOR))
4072 /* Begin the prompt */
4073 sprintf(out_val, _("床上:", "Floor:"));
4077 /* Build the prompt */
4078 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4081 strcat(out_val, tmp_val);
4084 /* Indicate ability to "view" */
4085 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4089 if (allow_inven && allow_equip)
4091 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4093 else if (allow_inven)
4095 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4097 else if (allow_equip)
4099 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4103 else if (allow_inven)
4105 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4107 else if (allow_equip)
4109 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4113 if (command_see && !use_menu)
4115 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4120 if (force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4122 /* Finish the prompt */
4123 strcat(out_val, " ESC");
4125 /* Build the prompt */
4126 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4128 /* Show the prompt */
4137 if (command_wrk == USE_INVEN) max_line = max_inven;
4138 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4139 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4155 menu_line += (max_line - 1);
4171 /* Verify legality */
4172 if (command_wrk == (USE_INVEN))
4174 if (allow_floor) command_wrk = USE_FLOOR;
4175 else if (allow_equip) command_wrk = USE_EQUIP;
4182 else if (command_wrk == (USE_EQUIP))
4184 if (allow_inven) command_wrk = USE_INVEN;
4185 else if (allow_floor) command_wrk = USE_FLOOR;
4192 else if (command_wrk == (USE_FLOOR))
4194 if (allow_equip) command_wrk = USE_EQUIP;
4195 else if (allow_inven) command_wrk = USE_INVEN;
4208 /* Hack -- Fix screen */
4215 /* Switch inven/equip */
4216 if (command_wrk == USE_INVEN) max_line = max_inven;
4217 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4218 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4219 if (menu_line > max_line) menu_line = max_line;
4221 /* Need to redraw */
4229 /* Verify legality */
4230 if (command_wrk == (USE_INVEN))
4232 if (allow_equip) command_wrk = USE_EQUIP;
4233 else if (allow_floor) command_wrk = USE_FLOOR;
4240 else if (command_wrk == (USE_EQUIP))
4242 if (allow_floor) command_wrk = USE_FLOOR;
4243 else if (allow_inven) command_wrk = USE_INVEN;
4250 else if (command_wrk == (USE_FLOOR))
4252 if (allow_inven) command_wrk = USE_INVEN;
4253 else if (allow_equip) command_wrk = USE_EQUIP;
4266 /* Hack -- Fix screen */
4273 /* Switch inven/equip */
4274 if (command_wrk == USE_INVEN) max_line = max_inven;
4275 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4276 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4277 if (menu_line > max_line) menu_line = max_line;
4279 /* Need to redraw */
4288 if (command_wrk == USE_FLOOR)
4291 (*cp) = -get_item_label;
4295 /* Validate the item */
4296 if (!get_item_okay(get_item_label))
4302 /* Allow player to "refuse" certain actions */
4303 if (!get_item_allow(get_item_label))
4309 /* Accept that choice */
4310 (*cp) = get_item_label;
4327 if (menu_line > max_line) menu_line -= max_line;
4348 command_see = FALSE;
4369 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
4371 if (command_wrk != (USE_FLOOR)) break;
4373 /* Get the object being moved. */
4374 o_idx = c_ptr->o_idx;
4376 /* Only rotate a pile of two or more objects. */
4377 if (!(o_idx && o_list[o_idx].next_o_idx)) break;
4379 /* Remove the first object from the list. */
4380 excise_object_idx(o_idx);
4382 /* Find end of the list. */
4384 while (o_list[i].next_o_idx)
4385 i = o_list[i].next_o_idx;
4387 /* Add after the last object. */
4388 o_list[i].next_o_idx = o_idx;
4390 /* Re-scan floor list */
4391 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4393 /* Hack -- Fix screen */
4405 if (command_wrk == (USE_INVEN))
4412 command_wrk = (USE_EQUIP);
4414 else if (command_wrk == (USE_EQUIP))
4421 command_wrk = (USE_INVEN);
4423 else if (command_wrk == (USE_FLOOR))
4427 command_wrk = (USE_INVEN);
4429 else if (allow_equip)
4431 command_wrk = (USE_EQUIP);
4440 /* Hack -- Fix screen */
4447 /* Need to redraw */
4460 * If we are already examining the floor, and there
4461 * is only one item, we will always select it.
4462 * If we aren't examining the floor and there is only
4463 * one item, we will select it if floor_query_flag
4468 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4471 k = 0 - floor_list[0];
4473 /* Allow player to "refuse" certain actions */
4474 if (!get_item_allow(k))
4480 /* Accept that choice */
4489 /* Hack -- Fix screen */
4496 command_wrk = (USE_FLOOR);
4502 case '1': case '2': case '3':
4503 case '4': case '5': case '6':
4504 case '7': case '8': case '9':
4506 if (command_wrk != USE_FLOOR)
4508 /* Look up the tag */
4509 if (!get_tag(&k, which, command_wrk))
4515 /* Hack -- Validate the item */
4516 if ((k < INVEN_RARM) ? !inven : !equip)
4522 /* Validate the item */
4523 if (!get_item_okay(k))
4531 /* Look up the alphabetical tag */
4532 if (get_tag_floor(&k, which, floor_list, floor_num))
4535 k = 0 - floor_list[k];
4544 /* Allow player to "refuse" certain actions */
4545 if (!get_item_allow(k))
4551 /* Accept that choice */
4563 /* Choose "default" inventory item */
4564 if (command_wrk == (USE_INVEN))
4566 k = ((i1 == i2) ? i1 : -1);
4569 /* Choose "default" equipment item */
4570 else if (command_wrk == (USE_EQUIP))
4572 k = ((e1 == e2) ? e1 : -1);
4575 /* Choose "default" floor item */
4576 else if (command_wrk == (USE_FLOOR))
4581 k = 0 - floor_list[0];
4583 /* Allow player to "refuse" certain actions */
4584 if (!get_item_allow(k))
4590 /* Accept that choice */
4598 /* Validate the item */
4599 if (!get_item_okay(k))
4605 /* Allow player to "refuse" certain actions */
4606 if (!get_item_allow(k))
4612 /* Accept that choice */
4636 if (command_wrk != USE_FLOOR)
4638 bool not_found = FALSE;
4640 /* Look up the alphabetical tag */
4641 if (!get_tag(&k, which, command_wrk))
4646 /* Hack -- Validate the item */
4647 else if ((k < INVEN_RARM) ? !inven : !equip)
4652 /* Validate the item */
4653 else if (!get_item_okay(k))
4660 /* Accept that choice */
4670 /* Look up the alphabetical tag */
4671 if (get_tag_floor(&k, which, floor_list, floor_num))
4674 k = 0 - floor_list[k];
4676 /* Accept that choice */
4685 /* Extract "query" setting */
4686 ver = isupper(which);
4687 which = (char)tolower(which);
4689 /* Convert letter to inventory index */
4690 if (command_wrk == (USE_INVEN))
4692 if (which == '(') k = i1;
4693 else if (which == ')') k = i2;
4694 else k = label_to_inven(which);
4697 /* Convert letter to equipment index */
4698 else if (command_wrk == (USE_EQUIP))
4700 if (which == '(') k = e1;
4701 else if (which == ')') k = e2;
4702 else k = label_to_equip(which);
4705 /* Convert letter to floor index */
4706 else if (command_wrk == USE_FLOOR)
4708 if (which == '(') k = 0;
4709 else if (which == ')') k = floor_num - 1;
4710 else k = islower(which) ? A2I(which) : -1;
4711 if (k < 0 || k >= floor_num || k >= 23)
4718 k = 0 - floor_list[k];
4721 /* Validate the item */
4722 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4728 /* Verify the item */
4729 if (ver && !verify(_("本当に", "Try"), k))
4735 /* Allow player to "refuse" certain actions */
4736 if (!get_item_allow(k))
4742 /* Accept that choice */
4752 /* Fix the screen if necessary */
4757 /* Hack -- Cancel "display" */
4758 command_see = FALSE;
4762 /* Forget the item_tester_tval restriction */
4763 item_tester_tval = 0;
4765 /* Forget the item_tester_hook restriction */
4766 item_tester_hook = NULL;
4769 /* Clean up 'show choices' */
4770 /* Toggle again if needed */
4771 if (toggle) toggle_inven_equip();
4773 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4776 /* Clear the prompt line */
4779 /* Warning if needed */
4780 if (oops && str) msg_print(str);
4785 if (command_cmd) prev_tag = cur_tag;
4786 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4792 * @brief 床上のアイテムを拾う選択用サブルーチン
4793 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4795 static bool py_pickup_floor_aux(void)
4797 OBJECT_IDX this_o_idx;
4801 /* Restrict the choices */
4802 item_tester_hook = inven_carry_okay;
4805 q = _("どれを拾いますか?", "Get which item? ");
4806 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4808 if (choose_object(&item, q, s, (USE_FLOOR)))
4810 this_o_idx = 0 - item;
4817 /* Pick up the object */
4818 py_pickup_aux(this_o_idx);
4824 * @brief 床上のアイテムを拾うメイン処理
4825 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4828 * This is called by py_pickup() when easy_floor is TRUE.
4830 void py_pickup_floor(bool pickup)
4832 OBJECT_IDX this_o_idx, next_o_idx = 0;
4834 GAME_TEXT o_name[MAX_NLEN];
4838 OBJECT_IDX floor_o_idx = 0;
4842 /* Scan the pile of objects */
4843 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
4845 /* Access the object */
4846 o_ptr = &o_list[this_o_idx];
4848 object_desc(o_name, o_ptr, 0);
4850 /* Access the next object */
4851 next_o_idx = o_ptr->next_o_idx;
4853 /* Hack -- disturb */
4854 disturb(FALSE, FALSE);
4857 if (o_ptr->tval == TV_GOLD)
4860 msg_format(" $%ld の価値がある%sを見つけた。",
4861 (long)o_ptr->pval, o_name);
4863 msg_format("You have found %ld gold pieces worth of %s.",
4864 (long)o_ptr->pval, o_name);
4867 /* Collect the gold */
4868 p_ptr->au += o_ptr->pval;
4871 p_ptr->redraw |= (PR_GOLD);
4873 p_ptr->window |= (PW_PLAYER);
4875 /* Delete the gold */
4876 delete_object_idx(this_o_idx);
4878 /* Check the next object */
4881 else if (o_ptr->marked & OM_NOMSG)
4883 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
4884 * ignored. Otherwise, they are included in the prompt. */
4885 o_ptr->marked &= ~(OM_NOMSG);
4889 /* Count non-gold objects that can be picked up. */
4890 if (inven_carry_okay(o_ptr))
4895 /* Count non-gold objects */
4898 /* Remember this index */
4899 floor_o_idx = this_o_idx;
4902 /* There are no non-gold objects */
4906 /* Mention the number of objects */
4912 /* Access the object */
4913 o_ptr = &o_list[floor_o_idx];
4915 #ifdef ALLOW_EASY_SENSE
4917 /* Option: Make object sensing easy */
4920 /* Sense the object */
4921 (void) sense_object(o_ptr);
4924 #endif /* ALLOW_EASY_SENSE */
4926 object_desc(o_name, o_ptr, 0);
4928 msg_format(_("%sがある。", "You see %s."), o_name);
4931 /* Multiple objects */
4934 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
4940 /* The player has no room for anything on the floor. */
4946 /* Access the object */
4947 o_ptr = &o_list[floor_o_idx];
4949 #ifdef ALLOW_EASY_SENSE
4951 /* Option: Make object sensing easy */
4954 /* Sense the object */
4955 (void) sense_object(o_ptr);
4958 #endif /* ALLOW_EASY_SENSE */
4960 object_desc(o_name, o_ptr, 0);
4962 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
4965 /* Multiple objects */
4968 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
4978 /* Hack -- query every object */
4979 if (carry_query_flag)
4981 char out_val[MAX_NLEN+20];
4983 /* Access the object */
4984 o_ptr = &o_list[floor_o_idx];
4986 #ifdef ALLOW_EASY_SENSE
4988 /* Option: Make object sensing easy */
4991 /* Sense the object */
4992 (void) sense_object(o_ptr);
4995 #endif /* ALLOW_EASY_SENSE */
4997 object_desc(o_name, o_ptr, 0);
4999 /* Build a prompt */
5000 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
5002 /* Ask the user to confirm */
5003 if (!get_check(out_val))
5009 /* Access the object */
5010 o_ptr = &o_list[floor_o_idx];
5012 #ifdef ALLOW_EASY_SENSE
5014 /* Option: Make object sensing easy */
5017 /* Sense the object */
5018 (void) sense_object(o_ptr);
5021 #endif /* ALLOW_EASY_SENSE */
5023 /* Pick up the object */
5024 py_pickup_aux(floor_o_idx);
5027 /* Allow the user to choose an object */
5030 while (can_pickup--)
5032 if (!py_pickup_floor_aux()) break;