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 cptr 発動名称を返す文字列ポインタ
344 static cptr 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 cptr 発動名称を返す文字列ポインタ
373 static cptr 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 cptr 発動名称を返す文字列ポインタ
474 cptr item_activation(object_type *o_ptr)
476 BIT_FLAGS flgs[TR_FLAG_SIZE];
478 /* Extract the flags */
479 object_flags(o_ptr, flgs);
481 /* Require activation ability */
482 if (!(have_flag(flgs, TR_ACTIVATE))) return (_("なし", "nothing"));
484 /* Get an explain of an activation */
485 if (activation_index(o_ptr))
487 return item_activation_aux(o_ptr);
491 if (o_ptr->tval == TV_WHISTLE)
493 return _("ペット呼び寄せ : 100+d100ターン毎", "call pet every 100+d100 turns");
496 if (o_ptr->tval == TV_CAPTURE)
498 return _("モンスターを捕える、又は解放する。", "captures or releases a monster.");
501 return _("何も起きない", "Nothing");
506 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
507 * Describe a "fully identified" item
508 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
509 * @param mode 表示オプション
510 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
512 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
516 BIT_FLAGS flgs[TR_FLAG_SIZE];
520 char o_name[MAX_NLEN];
525 int trivial_info = 0;
527 /* Extract the flags */
528 object_flags(o_ptr, flgs);
530 /* Extract the description */
532 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
533 (k_text + k_info[o_ptr->k_idx].text),
534 77 - 15, temp, sizeof(temp));
535 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
536 { info[i] = &temp[j]; i++;}
539 if (object_is_equipment(o_ptr))
541 /* Descriptions of a basic equipment is just a flavor */
545 /* Mega-Hack -- describe activation */
546 if (have_flag(flgs, TR_ACTIVATE))
548 info[i++] = _("始動したときの効果...", "It can be activated for...");
549 info[i++] = item_activation(o_ptr);
550 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
553 /* Figurines, a hack */
554 if (o_ptr->tval == TV_FIGURINE)
556 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
559 /* Figurines, a hack */
560 if (o_ptr->name1 == ART_STONEMASK)
562 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you turn into a vampire permanently.");
565 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
567 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
570 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
572 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
573 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
576 if (o_ptr->name2 == EGO_2WEAPON)
578 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
581 if (have_flag(flgs, TR_EASY_SPELL))
583 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
586 if (o_ptr->name2 == EGO_AMU_FOOL)
588 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
591 if (o_ptr->name2 == EGO_RING_THROW)
593 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
596 if (o_ptr->name2 == EGO_AMU_NAIVETY)
598 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
601 if (o_ptr->tval == TV_STATUE)
603 monster_race *r_ptr = &r_info[o_ptr->pval];
605 if (o_ptr->pval == MON_BULLGATES)
606 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
607 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
608 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
610 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
613 /* Hack -- describe lite's */
615 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
618 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
619 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
620 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
621 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
622 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
623 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
625 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
627 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
629 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
633 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
634 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
637 if(rad != 0) info[i++] = desc;
640 if (o_ptr->name2 == EGO_LITE_LONG)
642 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
645 /* And then describe it fully */
647 if (have_flag(flgs, TR_RIDING))
649 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
650 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
653 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
654 /* This information is not important enough */
658 if (have_flag(flgs, TR_STR))
660 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
662 if (have_flag(flgs, TR_INT))
664 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
666 if (have_flag(flgs, TR_WIS))
668 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
670 if (have_flag(flgs, TR_DEX))
672 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
674 if (have_flag(flgs, TR_CON))
676 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
678 if (have_flag(flgs, TR_CHR))
680 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
683 if (have_flag(flgs, TR_MAGIC_MASTERY))
685 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
688 if (have_flag(flgs, TR_STEALTH))
690 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
692 if (have_flag(flgs, TR_SEARCH))
694 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
696 if (have_flag(flgs, TR_INFRA))
698 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
700 if (have_flag(flgs, TR_TUNNEL))
702 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
704 if (have_flag(flgs, TR_SPEED))
706 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
708 if (have_flag(flgs, TR_BLOWS))
710 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
713 if (have_flag(flgs, TR_BRAND_ACID))
715 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
717 if (have_flag(flgs, TR_BRAND_ELEC))
719 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
721 if (have_flag(flgs, TR_BRAND_FIRE))
723 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
725 if (have_flag(flgs, TR_BRAND_COLD))
727 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
730 if (have_flag(flgs, TR_BRAND_POIS))
732 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
735 if (have_flag(flgs, TR_CHAOTIC))
737 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
740 if (have_flag(flgs, TR_VAMPIRIC))
742 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
745 if (have_flag(flgs, TR_IMPACT))
747 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
750 if (have_flag(flgs, TR_VORPAL))
752 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
755 if (have_flag(flgs, TR_KILL_DRAGON))
757 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
759 else if (have_flag(flgs, TR_SLAY_DRAGON))
761 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
764 if (have_flag(flgs, TR_KILL_ORC))
766 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
768 if (have_flag(flgs, TR_SLAY_ORC))
770 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
773 if (have_flag(flgs, TR_KILL_TROLL))
775 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
777 if (have_flag(flgs, TR_SLAY_TROLL))
779 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
782 if (have_flag(flgs, TR_KILL_GIANT))
784 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
786 else if (have_flag(flgs, TR_SLAY_GIANT))
788 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
791 if (have_flag(flgs, TR_KILL_DEMON))
793 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
795 if (have_flag(flgs, TR_SLAY_DEMON))
797 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
800 if (have_flag(flgs, TR_KILL_UNDEAD))
802 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
804 if (have_flag(flgs, TR_SLAY_UNDEAD))
806 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
809 if (have_flag(flgs, TR_KILL_EVIL))
811 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
813 if (have_flag(flgs, TR_SLAY_EVIL))
815 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
818 if (have_flag(flgs, TR_KILL_ANIMAL))
820 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
822 if (have_flag(flgs, TR_SLAY_ANIMAL))
824 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
827 if (have_flag(flgs, TR_KILL_HUMAN))
829 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
831 if (have_flag(flgs, TR_SLAY_HUMAN))
833 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
836 if (have_flag(flgs, TR_FORCE_WEAPON))
838 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
840 if (have_flag(flgs, TR_DEC_MANA))
842 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
844 if (have_flag(flgs, TR_SUST_STR))
846 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
848 if (have_flag(flgs, TR_SUST_INT))
850 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
852 if (have_flag(flgs, TR_SUST_WIS))
854 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
856 if (have_flag(flgs, TR_SUST_DEX))
858 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
860 if (have_flag(flgs, TR_SUST_CON))
862 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
864 if (have_flag(flgs, TR_SUST_CHR))
866 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
869 if (have_flag(flgs, TR_IM_ACID))
871 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
873 if (have_flag(flgs, TR_IM_ELEC))
875 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
877 if (have_flag(flgs, TR_IM_FIRE))
879 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
881 if (have_flag(flgs, TR_IM_COLD))
883 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
886 if (have_flag(flgs, TR_THROW))
888 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
891 if (have_flag(flgs, TR_FREE_ACT))
893 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
895 if (have_flag(flgs, TR_HOLD_EXP))
897 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
899 if (have_flag(flgs, TR_RES_FEAR))
901 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
903 if (have_flag(flgs, TR_RES_ACID))
905 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
907 if (have_flag(flgs, TR_RES_ELEC))
909 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
911 if (have_flag(flgs, TR_RES_FIRE))
913 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
915 if (have_flag(flgs, TR_RES_COLD))
917 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
919 if (have_flag(flgs, TR_RES_POIS))
921 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
924 if (have_flag(flgs, TR_RES_LITE))
926 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
928 if (have_flag(flgs, TR_RES_DARK))
930 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
933 if (have_flag(flgs, TR_RES_BLIND))
935 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
937 if (have_flag(flgs, TR_RES_CONF))
939 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
941 if (have_flag(flgs, TR_RES_SOUND))
943 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
945 if (have_flag(flgs, TR_RES_SHARDS))
947 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
950 if (have_flag(flgs, TR_RES_NETHER))
952 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
954 if (have_flag(flgs, TR_RES_NEXUS))
956 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
958 if (have_flag(flgs, TR_RES_CHAOS))
960 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
962 if (have_flag(flgs, TR_RES_DISEN))
964 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
967 if (have_flag(flgs, TR_LEVITATION))
969 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
972 if (have_flag(flgs, TR_SEE_INVIS))
974 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
976 if (have_flag(flgs, TR_TELEPATHY))
978 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
980 if (have_flag(flgs, TR_ESP_ANIMAL))
982 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
984 if (have_flag(flgs, TR_ESP_UNDEAD))
986 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
988 if (have_flag(flgs, TR_ESP_DEMON))
990 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
992 if (have_flag(flgs, TR_ESP_ORC))
994 info[i++] = _("それはオークを感知する。", "It senses orcs.");
996 if (have_flag(flgs, TR_ESP_TROLL))
998 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1000 if (have_flag(flgs, TR_ESP_GIANT))
1002 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1004 if (have_flag(flgs, TR_ESP_DRAGON))
1006 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1008 if (have_flag(flgs, TR_ESP_HUMAN))
1010 info[i++] = _("それは人間を感知する。", "It senses humans.");
1012 if (have_flag(flgs, TR_ESP_EVIL))
1014 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1016 if (have_flag(flgs, TR_ESP_GOOD))
1018 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1020 if (have_flag(flgs, TR_ESP_NONLIVING))
1022 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1024 if (have_flag(flgs, TR_ESP_UNIQUE))
1026 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1028 if (have_flag(flgs, TR_SLOW_DIGEST))
1030 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1032 if (have_flag(flgs, TR_REGEN))
1034 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1036 if (have_flag(flgs, TR_WARNING))
1038 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1040 if (have_flag(flgs, TR_REFLECT))
1042 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1044 if (have_flag(flgs, TR_SH_FIRE))
1046 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1048 if (have_flag(flgs, TR_SH_ELEC))
1050 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1052 if (have_flag(flgs, TR_SH_COLD))
1054 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1056 if (have_flag(flgs, TR_NO_MAGIC))
1058 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1060 if (have_flag(flgs, TR_NO_TELE))
1062 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1064 if (have_flag(flgs, TR_XTRA_MIGHT))
1066 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1068 if (have_flag(flgs, TR_XTRA_SHOTS))
1070 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1073 if (have_flag(flgs, TR_BLESSED))
1075 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1078 if (object_is_cursed(o_ptr))
1080 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1082 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1084 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1086 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1090 info[i++] = _("それは呪われている。", "It is cursed.");
1093 * It's a trivial infomation since there is
1094 * fake inscription {cursed}
1100 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1102 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1104 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1106 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1108 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1110 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1112 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1114 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1116 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1118 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1120 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1122 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1124 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1126 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1128 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1130 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1132 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1134 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1136 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1138 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1140 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1142 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1144 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1146 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1148 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1150 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1152 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1154 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1156 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1158 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1160 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1162 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1164 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1166 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1168 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1170 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1173 /* Describe about this kind of object instead of THIS fake object */
1174 if (mode & SCROBJ_FAKE_OBJECT)
1176 switch (o_ptr->tval)
1179 switch (o_ptr->sval)
1181 case SV_RING_LORDLY:
1182 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1184 case SV_RING_WARNING:
1185 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1191 switch (o_ptr->sval)
1193 case SV_AMULET_RESISTANCE:
1194 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1195 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1197 case SV_AMULET_THE_MAGI:
1198 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1205 if (have_flag(flgs, TR_IGNORE_ACID) &&
1206 have_flag(flgs, TR_IGNORE_ELEC) &&
1207 have_flag(flgs, TR_IGNORE_FIRE) &&
1208 have_flag(flgs, TR_IGNORE_COLD))
1210 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1214 if (have_flag(flgs, TR_IGNORE_ACID))
1216 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1218 if (have_flag(flgs, TR_IGNORE_ELEC))
1220 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1222 if (have_flag(flgs, TR_IGNORE_FIRE))
1224 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1226 if (have_flag(flgs, TR_IGNORE_COLD))
1228 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1232 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1234 /* No relevant informations */
1235 if (i <= trivial_info) return (FALSE);
1237 /* Save the screen */
1241 Term_get_size(&wid, &hgt);
1243 /* Display Item name */
1244 if (!(mode & SCROBJ_FAKE_OBJECT))
1245 object_desc(o_name, o_ptr, 0);
1247 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1251 /* Erase the screen */
1252 for (k = 1; k < hgt; k++) prt("", k, 13);
1254 /* Label the information */
1255 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1257 monster_race *r_ptr = &r_info[o_ptr->pval];
1258 int namelen = strlen(r_name + r_ptr->name);
1259 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1260 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1261 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1265 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1268 /* We will print on top of the map (column 13) */
1269 for (k = 2, j = 0; j < i; j++)
1272 prt(info[j], k++, 15);
1274 /* Every 20 entries (lines 2 to 21), start over */
1275 if ((k == hgt - 2) && (j+1 < i))
1277 prt(_("-- 続く --", "-- more --"), k, 15);
1279 for (; k > 2; k--) prt("", k, 15);
1284 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1288 /* Restore the screen */
1291 /* Gave knowledge */
1298 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1299 * Convert an inventory index into a one character label
1300 * @param i プレイヤーの所持/装備オブジェクトID
1301 * @return 対応するアルファベット
1302 * @details Note that the label does NOT distinguish inven/equip.
1304 char index_to_label(int i)
1306 /* Indexes for "inven" are easy */
1307 if (i < INVEN_RARM) return (I2A(i));
1309 /* Indexes for "equip" are offset */
1310 return (I2A(i - INVEN_RARM));
1314 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1315 * Convert a label into the index of an item in the "inven"
1316 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1317 * @details Note that the label does NOT distinguish inven/equip.
1319 INVENTORY_IDX label_to_inven(int c)
1324 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1326 /* Verify the index */
1327 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1329 /* Empty slots can never be chosen */
1330 if (!inventory[i].k_idx) return (-1);
1332 /* Return the index */
1338 extern bool select_ring_slot;
1342 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1343 * @param i プレイヤーの所持/装備オブジェクトID
1344 * @return 指輪枠ならばTRUEを返す。
1346 static bool is_ring_slot(int i)
1348 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1353 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1354 * Convert a label into the index of a item in the "equip"
1355 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1357 INVENTORY_IDX label_to_equip(int c)
1362 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1364 /* Verify the index */
1365 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1367 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1369 /* Empty slots can never be chosen */
1370 if (!inventory[i].k_idx) return (-1);
1372 /* Return the index */
1379 * @brief オブジェクトの該当装備部位IDを返す /
1380 * Determine which equipment slot (if any) an item likes
1381 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1382 * @return 対応する装備部位ID
1384 s16b wield_slot(object_type *o_ptr)
1386 /* Slot for equipment */
1387 switch (o_ptr->tval)
1394 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1395 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1396 return (INVEN_LARM);
1403 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1404 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1405 return (INVEN_RARM);
1415 /* Use the right hand first */
1416 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1418 /* Use the left hand for swapping (by default) */
1419 return (INVEN_LEFT);
1425 return (INVEN_NECK);
1430 return (INVEN_LITE);
1437 return (INVEN_BODY);
1442 return (INVEN_OUTER);
1448 return (INVEN_HEAD);
1453 return (INVEN_HANDS);
1458 return (INVEN_FEET);
1462 /* No slot available */
1467 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1468 * Return a string mentioning how a given item is carried
1469 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1470 * @return 部位表現の文字列ポインタ
1472 cptr mention_use(int i)
1476 /* Examine the location */
1480 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1482 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1486 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1488 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1492 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "運搬中" : "射撃用"; break;
1494 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "Just holding" : "Shooting"; break;
1498 case INVEN_RIGHT: p = (left_hander ? "左手指" : "右手指"); break;
1500 case INVEN_RIGHT: p = (left_hander ? "On left hand" : "On right hand"); break;
1504 case INVEN_LEFT: p = (left_hander ? "右手指" : "左手指"); break;
1506 case INVEN_LEFT: p = (left_hander ? "On right hand" : "On left hand"); break;
1509 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1510 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1511 case INVEN_BODY: p = _(" 体", "On body"); break;
1512 case INVEN_OUTER: p = _("体の上", "About body"); break;
1513 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1514 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1515 case INVEN_FEET: p = _(" 足", "On feet"); break;
1516 default: p = _("ザック", "In pack"); break;
1519 /* Return the result */
1525 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1526 * Return a string describing how a given item is being worn.
1527 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1528 * @return 状態表現内容の文字列ポインタ
1530 * Currently, only used for items in the equipment, not inventory.
1532 cptr describe_use(int i)
1539 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1541 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1545 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1547 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1551 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "持つだけで精一杯の" : "射撃用に装備している"; break;
1553 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "just holding" : "shooting missiles with"; break;
1557 case INVEN_RIGHT: p = (left_hander ? "左手の指にはめている" : "右手の指にはめている"); break;
1559 case INVEN_RIGHT: p = (left_hander ? "wearing on your left hand" : "wearing on your right hand"); break;
1563 case INVEN_LEFT: p = (left_hander ? "右手の指にはめている" : "左手の指にはめている"); break;
1565 case INVEN_LEFT: p = (left_hander ? "wearing on your right hand" : "wearing on your left hand"); break;
1568 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1569 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1570 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1571 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1572 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1573 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1574 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1575 default: p = _("ザックに入っている", "carrying in your pack"); break;
1578 /* Return the result */
1584 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1585 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1586 * @param book_tval ベースアイテムのtval
1587 * @param book_sval ベースアイテムのsval
1588 * @return 使用可能な魔法書ならばTRUEを返す。
1591 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1593 if (book_tval < TV_LIFE_BOOK) return FALSE;
1594 if (p_ptr->pclass == CLASS_SORCERER)
1596 return is_magic(tval2realm(book_tval));
1598 else if (p_ptr->pclass == CLASS_RED_MAGE)
1600 if (is_magic(tval2realm(book_tval)))
1601 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1603 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1607 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1608 * Check an item against the item tester info
1609 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1610 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1612 bool item_tester_okay(object_type *o_ptr)
1614 /* Hack -- allow listing empty slots */
1615 if (item_tester_full) return (TRUE);
1617 /* Require an item */
1618 if (!o_ptr->k_idx) return (FALSE);
1620 /* Hack -- ignore "gold" */
1621 if (o_ptr->tval == TV_GOLD)
1624 extern bool show_gold_on_floor;
1626 if (!show_gold_on_floor) return (FALSE);
1629 /* Check the tval */
1630 if (item_tester_tval)
1632 /* Is it a spellbook? If so, we need a hack -- TY */
1633 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1634 (item_tester_tval >= TV_LIFE_BOOK))
1635 return check_book_realm(o_ptr->tval, o_ptr->sval);
1637 if (item_tester_tval != o_ptr->tval) return (FALSE);
1640 /* Check the hook */
1641 if (item_tester_hook)
1643 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1652 * @brief 所持アイテム一覧を表示する /
1653 * Choice window "shadow" of the "show_inven()" function
1656 void display_inven(void)
1658 register int i, n, z = 0;
1660 TERM_COLOR attr = TERM_WHITE;
1662 char o_name[MAX_NLEN];
1666 Term_get_size(&wid, &hgt);
1668 /* Find the "final" slot */
1669 for (i = 0; i < INVEN_PACK; i++)
1671 o_ptr = &inventory[i];
1673 /* Skip non-objects */
1674 if (!o_ptr->k_idx) continue;
1680 /* Display the pack */
1681 for (i = 0; i < z; i++)
1683 /* Examine the item */
1684 o_ptr = &inventory[i];
1686 /* Start with an empty "index" */
1687 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1689 /* Is this item "acceptable"? */
1690 if (item_tester_okay(o_ptr))
1692 /* Prepare an "index" */
1693 tmp_val[0] = index_to_label(i);
1695 /* Bracket the "index" --(-- */
1699 /* Display the index (or blank space) */
1700 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1702 /* Obtain an item description */
1703 object_desc(o_name, o_ptr, 0);
1705 /* Obtain the length of the description */
1709 attr = tval_to_attr[o_ptr->tval % 128];
1711 /* Grey out charging items */
1717 /* Display the entry itself */
1718 Term_putstr(3, i, n, attr, o_name);
1720 /* Erase the rest of the line */
1721 Term_erase(3+n, i, 255);
1723 /* Display the weight if needed */
1726 int wgt = o_ptr->weight * o_ptr->number;
1728 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt),lbtokg2(wgt) );
1730 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1733 prt(tmp_val, i, wid - 9);
1737 /* Erase the rest of the window */
1738 for (i = z; i < hgt; i++)
1740 /* Erase the line */
1741 Term_erase(0, i, 255);
1748 * @brief 装備アイテム一覧を表示する /
1749 * Choice window "shadow" of the "show_equip()" function
1752 void display_equip(void)
1756 TERM_COLOR attr = TERM_WHITE;
1758 char o_name[MAX_NLEN];
1762 Term_get_size(&wid, &hgt);
1764 /* Display the equipment */
1765 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1767 /* Examine the item */
1768 o_ptr = &inventory[i];
1770 /* Start with an empty "index" */
1771 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1773 /* Is this item "acceptable"? */
1774 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1776 /* Prepare an "index" */
1777 tmp_val[0] = index_to_label(i);
1779 /* Bracket the "index" --(-- */
1783 /* Display the index (or blank space) */
1784 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1786 /* Obtain an item description */
1787 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1789 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1794 object_desc(o_name, o_ptr, 0);
1795 attr = tval_to_attr[o_ptr->tval % 128];
1798 /* Obtain the length of the description */
1801 /* Grey out charging items */
1807 /* Display the entry itself */
1808 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1810 /* Erase the rest of the line */
1811 Term_erase(3+n, i - INVEN_RARM, 255);
1813 /* Display the weight (if needed) */
1816 int wgt = o_ptr->weight * o_ptr->number;
1818 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1820 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1823 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1826 /* Display the slot description (if needed) */
1829 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1830 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1834 /* Erase the rest of the window */
1835 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1837 /* Clear that line */
1838 Term_erase(0, i, 255);
1844 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1845 * Find the "first" inventory object with the given "tag".
1846 * @param cp 対応するタグIDを与える参照ポインタ
1847 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1848 * @param mode 所持、装備の切り替え
1849 * @return タグに該当するオブジェクトがあるならTRUEを返す
1851 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1852 * inscription of an object. Alphabetical characters don't work as a\n
1853 * tag in this form.\n
1855 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1856 * and "x" is the "current" command_cmd code.\n
1858 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1861 COMMAND_CODE start, end;
1864 /* Extract index from mode */
1869 end = INVEN_TOTAL - 1;
1874 end = INVEN_PACK - 1;
1881 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1883 /* Check every inventory object */
1884 for (i = start; i <= end; i++)
1886 object_type *o_ptr = &inventory[i];
1888 /* Skip non-objects */
1889 if (!o_ptr->k_idx) continue;
1891 /* Skip empty inscriptions */
1892 if (!o_ptr->inscription) continue;
1894 /* Skip non-choice */
1895 if (!item_tester_okay(o_ptr)) continue;
1898 s = my_strchr(quark_str(o_ptr->inscription), '@');
1900 /* Process all tags */
1903 /* Check the special tags */
1904 if ((s[1] == command_cmd) && (s[2] == tag))
1906 /* Save the actual inventory ID */
1913 /* Find another '@' */
1914 s = my_strchr(s + 1, '@');
1919 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1921 /* Don't allow {@#} with '#' being alphabet */
1922 if (tag < '0' || '9' < tag)
1928 /* Check every object */
1929 for (i = start; i <= end; i++)
1931 object_type *o_ptr = &inventory[i];
1933 /* Skip non-objects */
1934 if (!o_ptr->k_idx) continue;
1936 /* Skip empty inscriptions */
1937 if (!o_ptr->inscription) continue;
1939 /* Skip non-choice */
1940 if (!item_tester_okay(o_ptr)) continue;
1943 s = my_strchr(quark_str(o_ptr->inscription), '@');
1945 /* Process all tags */
1948 /* Check the normal tags */
1951 /* Save the actual inventory ID */
1958 /* Find another '@' */
1959 s = my_strchr(s + 1, '@');
1969 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1970 * Find the "first" inventory object with the given "tag".
1971 * @param cp 対応するタグIDを与える参照ポインタ
1972 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1973 * @param floor_list 床上アイテムの配列
1974 * @param floor_num 床上アイテムの配列ID
1975 * @return タグに該当するオブジェクトがあるならTRUEを返す
1977 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1978 * inscription of an object. Alphabetical characters don't work as a\n
1979 * tag in this form.\n
1981 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1982 * and "x" is the "current" command_cmd code.\n
1984 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1989 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1991 /* Check every object in the grid */
1992 for (i = 0; i < floor_num && i < 23; i++)
1994 object_type *o_ptr = &o_list[floor_list[i]];
1996 /* Skip empty inscriptions */
1997 if (!o_ptr->inscription) continue;
2000 s = my_strchr(quark_str(o_ptr->inscription), '@');
2002 /* Process all tags */
2005 /* Check the special tags */
2006 if ((s[1] == command_cmd) && (s[2] == tag))
2008 /* Save the actual floor object ID */
2015 /* Find another '@' */
2016 s = my_strchr(s + 1, '@');
2021 /**** Find a tag in the form of {@#} (allows only numerals) ***/
2023 /* Don't allow {@#} with '#' being alphabet */
2024 if (tag < '0' || '9' < tag)
2030 /* Check every object in the grid */
2031 for (i = 0; i < floor_num && i < 23; i++)
2033 object_type *o_ptr = &o_list[floor_list[i]];
2035 /* Skip empty inscriptions */
2036 if (!o_ptr->inscription) continue;
2039 s = my_strchr(quark_str(o_ptr->inscription), '@');
2041 /* Process all tags */
2044 /* Check the normal tags */
2047 /* Save the floor object ID */
2054 /* Find another '@' */
2055 s = my_strchr(s + 1, '@');
2065 * @brief タグIDにあわせてタグアルファベットのリストを返す /
2066 * Move around label characters with correspond tags
2067 * @param label ラベルリストを取得する文字列参照ポインタ
2068 * @param mode 所持品リストか装備品リストかの切り替え
2071 static void prepare_label_string(char *label, BIT_FLAGS mode)
2073 cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2074 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2077 /* Prepare normal labels */
2078 strcpy(label, alphabet_chars);
2080 /* Move each label */
2081 for (i = 0; i < 52; i++)
2084 char c = alphabet_chars[i];
2086 /* Find a tag with this label */
2087 if (get_tag(&index, c, mode))
2089 /* Delete the overwritten label */
2090 if (label[i] == c) label[i] = ' ';
2092 /* Move the label to the place of corresponding tag */
2093 label[index - offset] = c;
2100 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2101 * Move around label characters with correspond tags (floor version)
2102 * @param label ラベルリストを取得する文字列参照ポインタ
2103 * @param floor_list 床上アイテムの配列
2104 * @param floor_num 床上アイテムの配列ID
2109 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2111 cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2114 /* Prepare normal labels */
2115 strcpy(label, alphabet_chars);
2117 /* Move each label */
2118 for (i = 0; i < 52; i++)
2121 char c = alphabet_chars[i];
2123 /* Find a tag with this label */
2124 if (get_tag_floor(&index, c, floor_list, floor_num))
2126 /* Delete the overwritten label */
2127 if (label[i] == c) label[i] = ' ';
2129 /* Move the label to the place of corresponding tag */
2137 * @brief 所持アイテムの表示を行う /
2138 * Display the inventory.
2139 * @param target_item アイテムの選択処理を行うか否か。
2140 * @return 選択したアイテムのタグ
2142 * Hack -- do not display "trailing" empty slots
2144 COMMAND_CODE show_inven(int target_item)
2148 int col, cur_col, len;
2150 char o_name[MAX_NLEN];
2152 COMMAND_CODE out_index[23];
2153 TERM_COLOR out_color[23];
2154 char out_desc[23][MAX_NLEN];
2155 COMMAND_CODE target_item_label = 0;
2157 char inven_label[52 + 1];
2159 /* Starting column */
2163 Term_get_size(&wid, &hgt);
2165 /* Default "max-length" */
2166 len = wid - col - 1;
2169 /* Find the "final" slot */
2170 for (i = 0; i < INVEN_PACK; i++)
2172 o_ptr = &inventory[i];
2174 /* Skip non-objects */
2175 if (!o_ptr->k_idx) continue;
2181 prepare_label_string(inven_label, USE_INVEN);
2183 /* Display the inventory */
2184 for (k = 0, i = 0; i < z; i++)
2186 o_ptr = &inventory[i];
2188 /* Is this item acceptable? */
2189 if (!item_tester_okay(o_ptr)) continue;
2191 /* Describe the object */
2192 object_desc(o_name, o_ptr, 0);
2194 /* Save the object index, color, and description */
2196 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2198 /* Grey out charging items */
2201 out_color[k] = TERM_L_DARK;
2204 (void)strcpy(out_desc[k], o_name);
2206 /* Find the predicted "line length" */
2207 l = strlen(out_desc[k]) + 5;
2209 /* Be sure to account for the weight */
2210 if (show_weights) l += 9;
2212 /* Account for icon if displayed */
2213 if (show_item_graph)
2216 if (use_bigtile) l++;
2219 /* Maintain the maximum length */
2220 if (l > len) len = l;
2222 /* Advance to next "line" */
2226 /* Find the column to start in */
2227 col = (len > wid - 4) ? 0 : (wid - len - 1);
2229 /* Output each entry */
2230 for (j = 0; j < k; j++)
2236 o_ptr = &inventory[i];
2238 /* Clear the line */
2239 prt("", j + 1, col ? col - 2 : col);
2241 if (use_menu && target_item)
2243 if (j == (target_item-1))
2245 strcpy(tmp_val, _("》", "> "));
2246 target_item_label = i;
2248 else strcpy(tmp_val, " ");
2250 else if (i <= INVEN_PACK)
2252 /* Prepare an index --(-- */
2253 sprintf(tmp_val, "%c)", inven_label[i]);
2257 /* Prepare an index --(-- */
2258 sprintf(tmp_val, "%c)", index_to_label(i));
2261 /* Clear the line with the (possibly indented) index */
2262 put_str(tmp_val, j + 1, col);
2266 /* Display graphics for object, if desired */
2267 if (show_item_graph)
2269 byte a = object_attr(o_ptr);
2270 char c = object_char(o_ptr);
2271 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2272 if (use_bigtile) cur_col++;
2278 /* Display the entry itself */
2279 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2281 /* Display the weight if needed */
2284 int wgt = o_ptr->weight * o_ptr->number;
2286 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2288 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2291 prt(tmp_val, j + 1, wid - 9);
2295 /* Make a "shadow" below the list (only if needed) */
2296 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2298 /* Save the new column */
2301 return target_item_label;
2306 * @brief 装備アイテムの表示を行う /
2307 * Display the equipment.
2308 * @param target_item アイテムの選択処理を行うか否か。
2309 * @return 選択したアイテムのタグ
2311 COMMAND_CODE show_equip(int target_item)
2315 int col, cur_col, len;
2318 char o_name[MAX_NLEN];
2319 COMMAND_CODE out_index[23];
2320 TERM_COLOR out_color[23];
2321 char out_desc[23][MAX_NLEN];
2322 COMMAND_CODE target_item_label = 0;
2324 char equip_label[52 + 1];
2326 /* Starting column */
2330 Term_get_size(&wid, &hgt);
2332 /* Maximal length */
2333 len = wid - col - 1;
2336 /* Scan the equipment list */
2337 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2339 o_ptr = &inventory[i];
2341 /* Is this item acceptable? */
2342 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr)) &&
2343 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2344 item_tester_no_ryoute)) continue;
2347 object_desc(o_name, o_ptr, 0);
2349 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2351 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2352 out_color[k] = TERM_WHITE;
2356 (void)strcpy(out_desc[k], o_name);
2357 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2361 /* Grey out charging items */
2364 out_color[k] = TERM_L_DARK;
2367 /* Extract the maximal length (see below) */
2369 l = strlen(out_desc[k]) + (2 + 1);
2371 l = strlen(out_desc[k]) + (2 + 3);
2375 /* Increase length for labels (if needed) */
2377 if (show_labels) l += (7 + 2);
2379 if (show_labels) l += (14 + 2);
2383 /* Increase length for weight (if needed) */
2384 if (show_weights) l += 9;
2386 if (show_item_graph) l += 2;
2388 /* Maintain the max-length */
2389 if (l > len) len = l;
2391 /* Advance the entry */
2395 /* Hack -- Find a column to start in */
2397 col = (len > wid - 6) ? 0 : (wid - len - 1);
2399 col = (len > wid - 4) ? 0 : (wid - len - 1);
2402 prepare_label_string(equip_label, USE_EQUIP);
2404 /* Output each entry */
2405 for (j = 0; j < k; j++)
2411 o_ptr = &inventory[i];
2413 /* Clear the line */
2414 prt("", j + 1, col ? col - 2 : col);
2416 if (use_menu && target_item)
2418 if (j == (target_item-1))
2420 strcpy(tmp_val, _("》", "> "));
2421 target_item_label = i;
2423 else strcpy(tmp_val, " ");
2425 else if (i >= INVEN_RARM)
2427 /* Prepare an index --(-- */
2428 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2432 /* Prepare an index --(-- */
2433 sprintf(tmp_val, "%c)", index_to_label(i));
2436 /* Clear the line with the (possibly indented) index */
2437 put_str(tmp_val, j+1, col);
2441 /* Display graphics for object, if desired */
2442 if (show_item_graph)
2444 byte a = object_attr(o_ptr);
2445 char c = object_char(o_ptr);
2446 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2447 if (use_bigtile) cur_col++;
2455 /* Mention the use */
2456 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2458 put_str(tmp_val, j+1, cur_col);
2460 /* Display the entry itself */
2461 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2467 /* Display the entry itself */
2468 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2471 /* Display the weight if needed */
2474 int wgt = o_ptr->weight * o_ptr->number;
2476 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2478 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2481 prt(tmp_val, j + 1, wid - 9);
2485 /* Make a "shadow" below the list (only if needed) */
2486 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2488 /* Save the new column */
2491 return target_item_label;
2495 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2496 * Flip "inven" and "equip" in any sub-windows
2499 void toggle_inven_equip(void)
2504 for (j = 0; j < 8; j++)
2507 if (!angband_term[j]) continue;
2509 /* Flip inven to equip */
2510 if (window_flag[j] & (PW_INVEN))
2513 window_flag[j] &= ~(PW_INVEN);
2514 window_flag[j] |= (PW_EQUIP);
2516 p_ptr->window |= (PW_EQUIP);
2519 /* Flip inven to equip */
2520 else if (window_flag[j] & (PW_EQUIP))
2523 window_flag[j] &= ~(PW_EQUIP);
2524 window_flag[j] |= (PW_INVEN);
2526 p_ptr->window |= (PW_INVEN);
2532 * @brief 選択したアイテムの確認処理の補助 /
2533 * Verify the choice of an item.
2534 * @param prompt メッセージ表示の一部
2535 * @param item 選択アイテムID
2536 * @return 確認がYesならTRUEを返す。
2537 * @details The item can be negative to mean "item on floor".
2539 static bool verify(cptr prompt, INVENTORY_IDX item)
2541 char o_name[MAX_NLEN];
2542 char out_val[MAX_NLEN+20];
2549 o_ptr = &inventory[item];
2555 o_ptr = &o_list[0 - item];
2559 object_desc(o_name, o_ptr, 0);
2562 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2565 return (get_check(out_val));
2570 * @brief 選択したアイテムの確認処理のメインルーチン /
2571 * @param item 選択アイテムID
2572 * @return 確認がYesならTRUEを返す。
2573 * @details The item can be negative to mean "item on floor".
2574 * Hack -- allow user to "prevent" certain choices
2576 static bool get_item_allow(INVENTORY_IDX item)
2582 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2587 o_ptr = &inventory[item];
2593 o_ptr = &o_list[0 - item];
2596 /* No inscription */
2597 if (!o_ptr->inscription) return (TRUE);
2600 s = my_strchr(quark_str(o_ptr->inscription), '!');
2602 /* Process preventions */
2605 /* Check the "restriction" */
2606 if ((s[1] == command_cmd) || (s[1] == '*'))
2608 /* Verify the choice */
2609 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2612 /* Find another '!' */
2613 s = my_strchr(s + 1, '!');
2622 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2623 * Auxiliary function for "get_item()" -- test an index
2625 * @return 正規のIDならばTRUEを返す。
2627 static bool get_item_okay(OBJECT_IDX i)
2630 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2632 if (select_ring_slot) return is_ring_slot(i);
2634 /* Verify the item */
2635 if (!item_tester_okay(&inventory[i])) return (FALSE);
2642 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2643 * Determine whether get_item() can get some item or not
2644 * @return アイテムを拾えるならばTRUEを返す。
2645 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2647 bool can_get_item(void)
2650 OBJECT_IDX floor_list[23];
2651 ITEM_NUMBER floor_num = 0;
2653 for (j = 0; j < INVEN_TOTAL; j++)
2654 if (item_tester_okay(&inventory[j]))
2657 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2665 * @brief オブジェクト選択の汎用関数 /
2666 * Let the user select an item, save its "index"
2667 * @param cp 選択したオブジェクトのIDを返す。
2668 * @param pmt 選択目的のメッセージ
2669 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2670 * @param mode オプションフラグ
2671 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2672 * Return TRUE only if an acceptable item was chosen by the user.\n
2674 * The selected item must satisfy the "item_tester_hook()" function,\n
2675 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2677 * All "item_tester" restrictions are cleared before this function returns.\n
2679 * The user is allowed to choose acceptable items from the equipment,\n
2680 * inventory, or floor, respectively, if the proper flag was given,\n
2681 * and there are any acceptable items in that location.\n
2683 * The equipment or inventory are displayed (even if no acceptable\n
2684 * items are in that location) if the proper flag was given.\n
2686 * If there are no acceptable items available anywhere, and "str" is\n
2687 * not NULL, then it will be used as the text of a warning message\n
2688 * before the function returns.\n
2690 * Note that the user must press "-" to specify the item on the floor,\n
2691 * and there is no way to "examine" the item on the floor, while the\n
2692 * use of "capital" letters will "examine" an inventory/equipment item,\n
2693 * and prompt for its use.\n
2695 * If a legal item is selected from the inventory, we save it in "cp"\n
2696 * directly (0 to 35), and return TRUE.\n
2698 * If a legal item is selected from the floor, we save it in "cp" as\n
2699 * a negative (-1 to -511), and return TRUE.\n
2701 * If no item is available, we do nothing to "cp", and we display a\n
2702 * warning message, using "str" if available, and return FALSE.\n
2704 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2706 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2707 * to allow the user to enter a command while viewing those screens, and\n
2708 * also to induce "auto-enter" of stores, and other such stuff.\n
2710 * Global "p_ptr->command_see" may be set before calling this function to start\n
2711 * out in "browse" mode. It is cleared before this function returns.\n
2713 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2714 * If it is TRUE then we are viewing inventory, else equipment.\n
2716 * We always erase the prompt when we are done, leaving a blank line,\n
2717 * or a warning message, if appropriate, if no items are available.\n
2719 bool get_item(OBJECT_IDX *cp, cptr pmt, cptr str, BIT_FLAGS mode)
2721 OBJECT_IDX this_o_idx, next_o_idx = 0;
2738 bool allow_floor = FALSE;
2740 bool toggle = FALSE;
2746 extern bool select_the_force;
2748 int menu_line = (use_menu ? 1 : 0);
2752 static char prev_tag = '\0';
2753 char cur_tag = '\0';
2755 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2758 if (mode & USE_EQUIP) equip = TRUE;
2759 if (mode & USE_INVEN) inven = TRUE;
2760 if (mode & USE_FLOOR) floor = TRUE;
2762 /* Get the item index */
2763 if (repeat_pull(cp))
2766 if (select_the_force && (*cp == INVEN_FORCE))
2768 item_tester_tval = 0;
2769 item_tester_hook = NULL;
2770 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2775 else if (floor && (*cp < 0))
2782 /* Acquire object */
2785 /* Validate the item */
2786 if (item_tester_okay(o_ptr))
2788 /* Forget restrictions */
2789 item_tester_tval = 0;
2790 item_tester_hook = NULL;
2791 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2798 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2799 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2801 if (prev_tag && command_cmd)
2803 /* Look up the tag and validate the item */
2804 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2805 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2806 else if (!get_item_okay(k)) /* Reject */;
2809 /* Accept that choice */
2812 /* Forget restrictions */
2813 item_tester_tval = 0;
2814 item_tester_hook = NULL;
2815 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2821 prev_tag = '\0'; /* prev_tag is no longer effective */
2824 /* Verify the item */
2825 else if (get_item_okay(*cp))
2827 /* Forget restrictions */
2828 item_tester_tval = 0;
2829 item_tester_hook = NULL;
2830 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2846 /* No item selected */
2850 /* Full inventory */
2852 i2 = INVEN_PACK - 1;
2854 /* Forbid inventory */
2855 if (!inven) i2 = -1;
2858 for (j = 0; j < INVEN_PACK; j++)
2859 if (item_tester_okay(&inventory[j])) max_inven++;
2862 /* Restrict inventory indexes */
2863 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2864 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2867 /* Full equipment */
2869 e2 = INVEN_TOTAL - 1;
2871 /* Forbid equipment */
2872 if (!equip) e2 = -1;
2875 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2876 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
2877 if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
2880 /* Restrict equipment indexes */
2881 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2882 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2884 if (equip && p_ptr->ryoute && !item_tester_no_ryoute)
2888 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2890 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2894 /* Restrict floor usage */
2897 /* Scan all objects in the grid */
2898 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2902 /* Acquire object */
2903 o_ptr = &o_list[this_o_idx];
2905 /* Acquire next object */
2906 next_o_idx = o_ptr->next_o_idx;
2908 /* Accept the item on the floor if legal */
2909 if (item_tester_okay(o_ptr) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2913 /* Require at least one legal choice */
2914 if (!allow_floor && (i1 > i2) && (e1 > e2))
2916 /* Cancel p_ptr->command_see */
2917 command_see = FALSE;
2923 if (select_the_force) {
2929 /* Analyze choices */
2932 /* Hack -- Start on equipment if requested */
2933 if (command_see && command_wrk && equip)
2938 /* Use inventory if allowed */
2941 command_wrk = FALSE;
2944 /* Use equipment if allowed */
2950 /* Use inventory for floor */
2953 command_wrk = FALSE;
2959 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2961 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2963 /* Hack -- start out in "display" mode */
2971 /* Repeat until done */
2974 COMMAND_CODE get_item_label = 0;
2981 for (j = 0; j < 8; j++)
2984 if (!angband_term[j]) continue;
2986 /* Count windows displaying inven */
2987 if (window_flag[j] & (PW_INVEN)) ni++;
2989 /* Count windows displaying equip */
2990 if (window_flag[j] & (PW_EQUIP)) ne++;
2993 /* Toggle if needed */
2994 if ((command_wrk && ni && !ne) ||
2995 (!command_wrk && !ni && ne))
2998 toggle_inven_equip();
3005 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3007 /* Redraw windows */
3011 /* Inventory screen */
3014 /* Redraw if needed */
3015 if (command_see) get_item_label = show_inven(menu_line);
3018 /* Equipment screen */
3021 /* Redraw if needed */
3022 if (command_see) get_item_label = show_equip(menu_line);
3025 /* Viewing inventory */
3028 /* Begin the prompt */
3029 sprintf(out_val, _("持ち物:", "Inven:"));
3031 /* Some legal items */
3032 if ((i1 <= i2) && !use_menu)
3034 /* Build the prompt */
3035 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3036 index_to_label(i1), index_to_label(i2));
3039 strcat(out_val, tmp_val);
3042 /* Indicate ability to "view" */
3043 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3047 if (equip) strcat(out_val, format(" %s 装備品,", use_menu ? "'4'or'6'" : "'/'"));
3049 if (equip) strcat(out_val, format(" %s for Equip,", use_menu ? "4 or 6" : "/"));
3053 /* Viewing equipment */
3056 /* Begin the prompt */
3057 sprintf(out_val, _("装備品:", "Equip:"));
3059 /* Some legal items */
3060 if ((e1 <= e2) && !use_menu)
3062 /* Build the prompt */
3063 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3064 index_to_label(e1), index_to_label(e2));
3067 strcat(out_val, tmp_val);
3070 /* Indicate ability to "view" */
3071 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3075 if (inven) strcat(out_val, format(" %s 持ち物,", use_menu ? "'4'or'6'" : "'/'"));
3077 if (inven) strcat(out_val, format(" %s for Inven,", use_menu ? "4 or 6" : "'/'"));
3081 /* Indicate legality of the "floor" item */
3082 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
3083 if (select_the_force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
3085 /* Finish the prompt */
3086 strcat(out_val, " ESC");
3088 /* Build the prompt */
3089 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3091 /* Show the prompt */
3099 int max_line = (command_wrk ? max_equip : max_inven);
3115 menu_line += (max_line - 1);
3134 /* Verify legality */
3135 if (!inven || !equip)
3141 /* Hack -- Fix screen */
3151 /* Switch inven/equip */
3152 command_wrk = !command_wrk;
3153 max_line = (command_wrk ? max_equip : max_inven);
3154 if (menu_line > max_line) menu_line = max_line;
3156 /* Need to redraw */
3165 if (command_wrk == USE_FLOOR)
3168 (*cp) = -get_item_label;
3172 /* Validate the item */
3173 if (!get_item_okay(get_item_label))
3179 /* Allow player to "refuse" certain actions */
3180 if (!get_item_allow(get_item_label))
3186 /* Accept that choice */
3187 (*cp) = get_item_label;
3196 if (select_the_force) {
3204 if (menu_line > max_line) menu_line -= max_line;
3225 command_see = FALSE;
3245 /* Verify legality */
3246 if (!inven || !equip)
3252 /* Hack -- Fix screen */
3262 /* Switch inven/equip */
3263 command_wrk = !command_wrk;
3265 /* Need to redraw */
3271 /* Use floor item */
3274 /* Scan all objects in the grid */
3275 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3279 /* Acquire object */
3280 o_ptr = &o_list[this_o_idx];
3282 /* Acquire next object */
3283 next_o_idx = o_ptr->next_o_idx;
3285 /* Validate the item */
3286 if (!item_tester_okay(o_ptr)) continue;
3291 /* Verify the item (if required) */
3292 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3294 /* Allow player to "refuse" certain actions */
3295 if (!get_item_allow(k)) continue;
3297 /* Accept that choice */
3313 case '1': case '2': case '3':
3314 case '4': case '5': case '6':
3315 case '7': case '8': case '9':
3317 /* Look up the tag */
3318 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3324 /* Hack -- Validate the item */
3325 if ((k < INVEN_RARM) ? !inven : !equip)
3331 /* Validate the item */
3332 if (!get_item_okay(k))
3338 /* Allow player to "refuse" certain actions */
3339 if (!get_item_allow(k))
3345 /* Accept that choice */
3357 /* Choose "default" inventory item */
3360 k = ((i1 == i2) ? i1 : -1);
3363 /* Choose "default" equipment item */
3366 k = ((e1 == e2) ? e1 : -1);
3369 /* Validate the item */
3370 if (!get_item_okay(k))
3376 /* Allow player to "refuse" certain actions */
3377 if (!get_item_allow(k))
3383 /* Accept that choice */
3393 if (select_the_force) {
3406 bool not_found = FALSE;
3408 /* Look up the alphabetical tag */
3409 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3414 /* Hack -- Validate the item */
3415 else if ((k < INVEN_RARM) ? !inven : !equip)
3420 /* Validate the item */
3421 else if (!get_item_okay(k))
3428 /* Accept that choice */
3436 /* Extract "query" setting */
3437 ver = isupper(which);
3438 which = (char)tolower(which);
3440 /* Convert letter to inventory index */
3443 if (which == '(') k = i1;
3444 else if (which == ')') k = i2;
3445 else k = label_to_inven(which);
3448 /* Convert letter to equipment index */
3451 if (which == '(') k = e1;
3452 else if (which == ')') k = e2;
3453 else k = label_to_equip(which);
3456 /* Validate the item */
3457 if (!get_item_okay(k))
3463 /* Verify the item */
3464 if (ver && !verify(_("本当に", "Try"), k))
3470 /* Allow player to "refuse" certain actions */
3471 if (!get_item_allow(k))
3477 /* Accept that choice */
3488 /* Fix the screen if necessary */
3494 /* Hack -- Cancel "display" */
3495 command_see = FALSE;
3499 /* Forget the item_tester_tval restriction */
3500 item_tester_tval = 0;
3502 item_tester_no_ryoute = FALSE;
3504 /* Forget the item_tester_hook restriction */
3505 item_tester_hook = NULL;
3508 /* Clean up 'show choices' */
3509 /* Toggle again if needed */
3510 if (toggle) toggle_inven_equip();
3513 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3518 /* Clear the prompt line */
3521 /* Warning if needed */
3522 if (oops && str) msg_print(str);
3527 if (command_cmd) prev_tag = cur_tag;
3528 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3536 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3537 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3538 * @param y 走査するフロアのY座標
3539 * @param x 走査するフロアのX座標
3540 * @param mode オプションフラグ
3541 * @return 対象のマスに落ちているアイテム数
3543 * Return a list of o_list[] indexes of items at the given cave
3544 * location. Valid flags are:
3546 * mode & 0x01 -- Item tester
3547 * mode & 0x02 -- Marked items only
3548 * mode & 0x04 -- Stop after first
3550 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3552 OBJECT_IDX this_o_idx, next_o_idx;
3554 ITEM_NUMBER num = 0;
3557 if (!in_bounds(y, x)) return 0;
3559 /* Scan all objects in the grid */
3560 for (this_o_idx = cave[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3564 /* Acquire object */
3565 o_ptr = &o_list[this_o_idx];
3567 /* Acquire next object */
3568 next_o_idx = o_ptr->next_o_idx;
3571 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3574 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3576 /* Accept this item */
3577 /* XXX Hack -- Enforce limit */
3579 items[num] = this_o_idx;
3584 if (mode & 0x04) break;
3593 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3594 * @param target_item カーソルの初期値
3595 * @param y 走査するフロアのY座標
3596 * @param x 走査するフロアのX座標
3597 * @param min_width 表示の長さ
3598 * @return 選択したアイテムの添え字
3601 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3609 char o_name[MAX_NLEN];
3612 COMMAND_CODE out_index[23];
3613 TERM_COLOR out_color[23];
3614 char out_desc[23][MAX_NLEN];
3615 COMMAND_CODE target_item_label = 0;
3617 OBJECT_IDX floor_list[23];
3618 ITEM_NUMBER floor_num;
3620 char floor_label[52 + 1];
3622 bool dont_need_to_show_weights = TRUE;
3625 Term_get_size(&wid, &hgt);
3627 /* Default length */
3628 len = MAX((*min_width), 20);
3631 /* Scan for objects in the grid, using item_tester_okay() */
3632 floor_num = scan_floor(floor_list, y, x, 0x03);
3634 /* Display the floor objects */
3635 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3637 o_ptr = &o_list[floor_list[i]];
3639 /* Describe the object */
3640 object_desc(o_name, o_ptr, 0);
3642 /* Save the index */
3645 /* Acquire inventory color */
3646 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3648 /* Save the object description */
3649 strcpy(out_desc[k], o_name);
3651 /* Find the predicted "line length" */
3652 l = strlen(out_desc[k]) + 5;
3654 /* Be sure to account for the weight */
3655 if (show_weights) l += 9;
3657 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3659 /* Maintain the maximum length */
3660 if (l > len) len = l;
3662 /* Advance to next "line" */
3666 if (show_weights && dont_need_to_show_weights) len -= 9;
3671 /* Find the column to start in */
3672 col = (len > wid - 4) ? 0 : (wid - len - 1);
3674 prepare_label_string_floor(floor_label, floor_list, floor_num);
3676 /* Output each entry */
3677 for (j = 0; j < k; j++)
3680 m = floor_list[out_index[j]];
3685 /* Clear the line */
3686 prt("", j + 1, col ? col - 2 : col);
3688 if (use_menu && target_item)
3690 if (j == (target_item-1))
3692 strcpy(tmp_val, _("》", "> "));
3693 target_item_label = m;
3695 else strcpy(tmp_val, " ");
3699 /* Prepare an index --(-- */
3700 sprintf(tmp_val, "%c)", floor_label[j]);
3703 /* Clear the line with the (possibly indented) index */
3704 put_str(tmp_val, j + 1, col);
3706 /* Display the entry itself */
3707 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3709 /* Display the weight if needed */
3710 if (show_weights && (o_ptr->tval != TV_GOLD))
3712 int wgt = o_ptr->weight * o_ptr->number;
3714 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3716 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3719 prt(tmp_val, j + 1, wid - 9);
3723 /* Make a "shadow" below the list (only if needed) */
3724 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3726 return target_item_label;
3730 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3731 * Let the user select an item, save its "index"
3732 * @param cp 選択したオブジェクトのIDを返す。
3733 * @param pmt 選択目的のメッセージ
3734 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3735 * @param mode オプションフラグ
3736 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3738 bool get_item_floor(COMMAND_CODE *cp, cptr pmt, cptr str, BIT_FLAGS mode)
3740 char n1 = ' ', n2 = ' ', which = ' ';
3743 COMMAND_CODE i1, i2;
3744 COMMAND_CODE e1, e2;
3752 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3753 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3754 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3756 bool allow_equip = FALSE;
3757 bool allow_inven = FALSE;
3758 bool allow_floor = FALSE;
3760 bool toggle = FALSE;
3765 ITEM_NUMBER floor_num;
3766 OBJECT_IDX floor_list[23];
3768 TERM_LEN min_width = 0;
3770 extern bool select_the_force;
3772 int menu_line = (use_menu ? 1 : 0);
3776 static char prev_tag = '\0';
3777 char cur_tag = '\0';
3779 /* Get the item index */
3780 if (repeat_pull(cp))
3783 if (select_the_force && (*cp == INVEN_FORCE))
3785 item_tester_tval = 0;
3786 item_tester_hook = NULL;
3787 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3792 else if (floor && (*cp < 0))
3794 if (prev_tag && command_cmd)
3796 /* Scan all objects in the grid */
3797 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3799 /* Look up the tag */
3800 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3802 /* Accept that choice */
3803 (*cp) = 0 - floor_list[k];
3805 /* Forget restrictions */
3806 item_tester_tval = 0;
3807 item_tester_hook = NULL;
3808 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3814 prev_tag = '\0'; /* prev_tag is no longer effective */
3817 /* Validate the item */
3818 else if (item_tester_okay(&o_list[0 - (*cp)]))
3820 /* Forget restrictions */
3821 item_tester_tval = 0;
3822 item_tester_hook = NULL;
3823 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3830 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3831 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3833 if (prev_tag && command_cmd)
3835 /* Look up the tag and validate the item */
3836 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3837 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3838 else if (!get_item_okay(k)) /* Reject */;
3841 /* Accept that choice */
3844 /* Forget restrictions */
3845 item_tester_tval = 0;
3846 item_tester_hook = NULL;
3847 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3853 prev_tag = '\0'; /* prev_tag is no longer effective */
3856 /* Verify the item */
3857 else if (get_item_okay(*cp))
3859 /* Forget restrictions */
3860 item_tester_tval = 0;
3861 item_tester_hook = NULL;
3862 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3878 /* No item selected */
3882 /* Full inventory */
3884 i2 = INVEN_PACK - 1;
3886 /* Forbid inventory */
3887 if (!inven) i2 = -1;
3890 for (j = 0; j < INVEN_PACK; j++)
3891 if (item_tester_okay(&inventory[j])) max_inven++;
3894 /* Restrict inventory indexes */
3895 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3896 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3899 /* Full equipment */
3901 e2 = INVEN_TOTAL - 1;
3903 /* Forbid equipment */
3904 if (!equip) e2 = -1;
3907 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3908 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
3909 if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
3912 /* Restrict equipment indexes */
3913 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3914 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3916 if (equip && p_ptr->ryoute && !item_tester_no_ryoute)
3920 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3922 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3926 /* Count "okay" floor items */
3929 /* Restrict floor usage */
3932 /* Scan all objects in the grid */
3933 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3936 /* Accept inventory */
3937 if (i1 <= i2) allow_inven = TRUE;
3939 /* Accept equipment */
3940 if (e1 <= e2) allow_equip = TRUE;
3943 if (floor_num) allow_floor = TRUE;
3945 /* Require at least one legal choice */
3946 if (!allow_inven && !allow_equip && !allow_floor)
3948 /* Cancel p_ptr->command_see */
3949 command_see = FALSE;
3955 if (select_the_force) {
3961 /* Analyze choices */
3964 /* Hack -- Start on equipment if requested */
3965 if (command_see && (command_wrk == (USE_EQUIP))
3968 command_wrk = (USE_EQUIP);
3971 /* Use inventory if allowed */
3972 else if (allow_inven)
3974 command_wrk = (USE_INVEN);
3977 /* Use equipment if allowed */
3978 else if (allow_equip)
3980 command_wrk = (USE_EQUIP);
3983 /* Use floor if allowed */
3984 else if (allow_floor)
3986 command_wrk = (USE_FLOOR);
3991 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3993 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3995 /* Hack -- start out in "display" mode */
4002 /* Repeat until done */
4005 COMMAND_CODE get_item_label = 0;
4012 for (j = 0; j < 8; j++)
4015 if (!angband_term[j]) continue;
4017 /* Count windows displaying inven */
4018 if (window_flag[j] & (PW_INVEN)) ni++;
4020 /* Count windows displaying equip */
4021 if (window_flag[j] & (PW_EQUIP)) ne++;
4024 /* Toggle if needed */
4025 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
4026 (command_wrk == (USE_INVEN) && !ni && ne))
4029 toggle_inven_equip();
4036 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4038 /* Redraw windows */
4041 /* Inventory screen */
4042 if (command_wrk == (USE_INVEN))
4044 /* Extract the legal requests */
4048 /* Redraw if needed */
4049 if (command_see) get_item_label = show_inven(menu_line);
4052 /* Equipment screen */
4053 else if (command_wrk == (USE_EQUIP))
4055 /* Extract the legal requests */
4056 n1 = I2A(e1 - INVEN_RARM);
4057 n2 = I2A(e2 - INVEN_RARM);
4059 /* Redraw if needed */
4060 if (command_see) get_item_label = show_equip(menu_line);
4064 else if (command_wrk == (USE_FLOOR))
4067 k = MIN(floor_top + 23, floor_num) - 1;
4069 /* Extract the legal requests */
4070 n1 = I2A(j - floor_top);
4071 n2 = I2A(k - floor_top);
4073 /* Redraw if needed */
4074 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
4077 /* Viewing inventory */
4078 if (command_wrk == (USE_INVEN))
4080 /* Begin the prompt */
4081 sprintf(out_val, _("持ち物:", "Inven:"));
4085 /* Build the prompt */
4086 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4087 index_to_label(i1), index_to_label(i2));
4090 strcat(out_val, tmp_val);
4093 /* Indicate ability to "view" */
4094 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4101 strcat(out_val, " '/' 装備品,");
4102 else if (allow_floor)
4103 strcat(out_val, " '6' 装備品,");
4105 strcat(out_val, " '4'or'6' 装備品,");
4108 strcat(out_val, " / for Equip,");
4109 else if (allow_floor)
4110 strcat(out_val, " 6 for Equip,");
4112 strcat(out_val, " 4 or 6 for Equip,");
4121 strcat(out_val, " '-'床上,");
4122 else if (allow_equip)
4123 strcat(out_val, " '4' 床上,");
4125 strcat(out_val, " '4'or'6' 床上,");
4128 strcat(out_val, " - for floor,");
4129 else if (allow_equip)
4130 strcat(out_val, " 4 for floor,");
4132 strcat(out_val, " 4 or 6 for floor,");
4137 /* Viewing equipment */
4138 else if (command_wrk == (USE_EQUIP))
4140 /* Begin the prompt */
4141 sprintf(out_val, _("装備品:", "Equip:"));
4145 /* Build the prompt */
4146 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4147 index_to_label(e1), index_to_label(e2));
4150 strcat(out_val, tmp_val);
4153 /* Indicate ability to "view" */
4154 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4161 strcat(out_val, " '/' 持ち物,");
4162 else if (allow_floor)
4163 strcat(out_val, " '4' 持ち物,");
4165 strcat(out_val, " '4'or'6' 持ち物,");
4168 strcat(out_val, " / for Inven,");
4169 else if (allow_floor)
4170 strcat(out_val, " 4 for Inven,");
4172 strcat(out_val, " 4 or 6 for Inven,");
4181 strcat(out_val, " '-'床上,");
4182 else if (allow_inven)
4183 strcat(out_val, " '6' 床上,");
4185 strcat(out_val, " '4'or'6' 床上,");
4188 strcat(out_val, " - for floor,");
4189 else if (allow_inven)
4190 strcat(out_val, " 6 for floor,");
4192 strcat(out_val, " 4 or 6 for floor,");
4198 else if (command_wrk == (USE_FLOOR))
4200 /* Begin the prompt */
4201 sprintf(out_val, _("床上:", "Floor:"));
4205 /* Build the prompt */
4206 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4209 strcat(out_val, tmp_val);
4212 /* Indicate ability to "view" */
4213 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4217 if (allow_inven && allow_equip)
4219 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4221 else if (allow_inven)
4223 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4225 else if (allow_equip)
4227 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4231 else if (allow_inven)
4233 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4235 else if (allow_equip)
4237 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4241 if (command_see && !use_menu)
4243 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4248 if (select_the_force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4250 /* Finish the prompt */
4251 strcat(out_val, " ESC");
4253 /* Build the prompt */
4254 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4256 /* Show the prompt */
4265 if (command_wrk == USE_INVEN) max_line = max_inven;
4266 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4267 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4283 menu_line += (max_line - 1);
4299 /* Verify legality */
4300 if (command_wrk == (USE_INVEN))
4302 if (allow_floor) command_wrk = USE_FLOOR;
4303 else if (allow_equip) command_wrk = USE_EQUIP;
4310 else if (command_wrk == (USE_EQUIP))
4312 if (allow_inven) command_wrk = USE_INVEN;
4313 else if (allow_floor) command_wrk = USE_FLOOR;
4320 else if (command_wrk == (USE_FLOOR))
4322 if (allow_equip) command_wrk = USE_EQUIP;
4323 else if (allow_inven) command_wrk = USE_INVEN;
4336 /* Hack -- Fix screen */
4346 /* Switch inven/equip */
4347 if (command_wrk == USE_INVEN) max_line = max_inven;
4348 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4349 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4350 if (menu_line > max_line) menu_line = max_line;
4352 /* Need to redraw */
4360 /* Verify legality */
4361 if (command_wrk == (USE_INVEN))
4363 if (allow_equip) command_wrk = USE_EQUIP;
4364 else if (allow_floor) command_wrk = USE_FLOOR;
4371 else if (command_wrk == (USE_EQUIP))
4373 if (allow_floor) command_wrk = USE_FLOOR;
4374 else if (allow_inven) command_wrk = USE_INVEN;
4381 else if (command_wrk == (USE_FLOOR))
4383 if (allow_inven) command_wrk = USE_INVEN;
4384 else if (allow_equip) command_wrk = USE_EQUIP;
4397 /* Hack -- Fix screen */
4407 /* Switch inven/equip */
4408 if (command_wrk == USE_INVEN) max_line = max_inven;
4409 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4410 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4411 if (menu_line > max_line) menu_line = max_line;
4413 /* Need to redraw */
4422 if (command_wrk == USE_FLOOR)
4425 (*cp) = -get_item_label;
4429 /* Validate the item */
4430 if (!get_item_okay(get_item_label))
4436 /* Allow player to "refuse" certain actions */
4437 if (!get_item_allow(get_item_label))
4443 /* Accept that choice */
4444 (*cp) = get_item_label;
4453 if (select_the_force) {
4461 if (menu_line > max_line) menu_line -= max_line;
4482 command_see = FALSE;
4506 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
4508 if (command_wrk != (USE_FLOOR)) break;
4510 /* Get the object being moved. */
4511 o_idx = c_ptr->o_idx;
4513 /* Only rotate a pile of two or more objects. */
4514 if (!(o_idx && o_list[o_idx].next_o_idx)) break;
4516 /* Remove the first object from the list. */
4517 excise_object_idx(o_idx);
4519 /* Find end of the list. */
4521 while (o_list[i].next_o_idx)
4522 i = o_list[i].next_o_idx;
4524 /* Add after the last object. */
4525 o_list[i].next_o_idx = o_idx;
4527 /* Re-scan floor list */
4528 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4530 /* Hack -- Fix screen */
4545 if (command_wrk == (USE_INVEN))
4552 command_wrk = (USE_EQUIP);
4554 else if (command_wrk == (USE_EQUIP))
4561 command_wrk = (USE_INVEN);
4563 else if (command_wrk == (USE_FLOOR))
4567 command_wrk = (USE_INVEN);
4569 else if (allow_equip)
4571 command_wrk = (USE_EQUIP);
4580 /* Hack -- Fix screen */
4590 /* Need to redraw */
4603 * If we are already examining the floor, and there
4604 * is only one item, we will always select it.
4605 * If we aren't examining the floor and there is only
4606 * one item, we will select it if floor_query_flag
4611 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4614 k = 0 - floor_list[0];
4616 /* Allow player to "refuse" certain actions */
4617 if (!get_item_allow(k))
4623 /* Accept that choice */
4632 /* Hack -- Fix screen */
4642 command_wrk = (USE_FLOOR);
4648 case '1': case '2': case '3':
4649 case '4': case '5': case '6':
4650 case '7': case '8': case '9':
4652 if (command_wrk != USE_FLOOR)
4654 /* Look up the tag */
4655 if (!get_tag(&k, which, command_wrk))
4661 /* Hack -- Validate the item */
4662 if ((k < INVEN_RARM) ? !inven : !equip)
4668 /* Validate the item */
4669 if (!get_item_okay(k))
4677 /* Look up the alphabetical tag */
4678 if (get_tag_floor(&k, which, floor_list, floor_num))
4681 k = 0 - floor_list[k];
4690 /* Allow player to "refuse" certain actions */
4691 if (!get_item_allow(k))
4697 /* Accept that choice */
4709 /* Choose "default" inventory item */
4710 if (command_wrk == (USE_INVEN))
4712 k = ((i1 == i2) ? i1 : -1);
4715 /* Choose "default" equipment item */
4716 else if (command_wrk == (USE_EQUIP))
4718 k = ((e1 == e2) ? e1 : -1);
4721 /* Choose "default" floor item */
4722 else if (command_wrk == (USE_FLOOR))
4727 k = 0 - floor_list[0];
4729 /* Allow player to "refuse" certain actions */
4730 if (!get_item_allow(k))
4736 /* Accept that choice */
4744 /* Validate the item */
4745 if (!get_item_okay(k))
4751 /* Allow player to "refuse" certain actions */
4752 if (!get_item_allow(k))
4758 /* Accept that choice */
4768 if (select_the_force) {
4782 if (command_wrk != USE_FLOOR)
4784 bool not_found = FALSE;
4786 /* Look up the alphabetical tag */
4787 if (!get_tag(&k, which, command_wrk))
4792 /* Hack -- Validate the item */
4793 else if ((k < INVEN_RARM) ? !inven : !equip)
4798 /* Validate the item */
4799 else if (!get_item_okay(k))
4806 /* Accept that choice */
4816 /* Look up the alphabetical tag */
4817 if (get_tag_floor(&k, which, floor_list, floor_num))
4820 k = 0 - floor_list[k];
4822 /* Accept that choice */
4831 /* Extract "query" setting */
4832 ver = isupper(which);
4833 which = (char)tolower(which);
4835 /* Convert letter to inventory index */
4836 if (command_wrk == (USE_INVEN))
4838 if (which == '(') k = i1;
4839 else if (which == ')') k = i2;
4840 else k = label_to_inven(which);
4843 /* Convert letter to equipment index */
4844 else if (command_wrk == (USE_EQUIP))
4846 if (which == '(') k = e1;
4847 else if (which == ')') k = e2;
4848 else k = label_to_equip(which);
4851 /* Convert letter to floor index */
4852 else if (command_wrk == USE_FLOOR)
4854 if (which == '(') k = 0;
4855 else if (which == ')') k = floor_num - 1;
4856 else k = islower(which) ? A2I(which) : -1;
4857 if (k < 0 || k >= floor_num || k >= 23)
4864 k = 0 - floor_list[k];
4867 /* Validate the item */
4868 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4874 /* Verify the item */
4875 if (ver && !verify(_("本当に", "Try"), k))
4881 /* Allow player to "refuse" certain actions */
4882 if (!get_item_allow(k))
4888 /* Accept that choice */
4898 /* Fix the screen if necessary */
4904 /* Hack -- Cancel "display" */
4905 command_see = FALSE;
4909 /* Forget the item_tester_tval restriction */
4910 item_tester_tval = 0;
4912 /* Forget the item_tester_hook restriction */
4913 item_tester_hook = NULL;
4916 /* Clean up 'show choices' */
4917 /* Toggle again if needed */
4918 if (toggle) toggle_inven_equip();
4921 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4926 /* Clear the prompt line */
4929 /* Warning if needed */
4930 if (oops && str) msg_print(str);
4935 if (command_cmd) prev_tag = cur_tag;
4936 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4944 * @brief 床上のアイテムを拾う選択用サブルーチン
4945 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4947 static bool py_pickup_floor_aux(void)
4949 OBJECT_IDX this_o_idx;
4955 /* Restrict the choices */
4956 item_tester_hook = inven_carry_okay;
4959 q = _("どれを拾いますか?", "Get which item? ");
4960 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4962 if (get_item(&item, q, s, (USE_FLOOR)))
4964 this_o_idx = 0 - item;
4971 /* Pick up the object */
4972 py_pickup_aux(this_o_idx);
4978 * @brief 床上のアイテムを拾うメイン処理
4979 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4982 * This is called by py_pickup() when easy_floor is TRUE.
4984 void py_pickup_floor(bool pickup)
4986 OBJECT_IDX this_o_idx, next_o_idx = 0;
4988 char o_name[MAX_NLEN];
4992 OBJECT_IDX floor_o_idx = 0;
4996 /* Scan the pile of objects */
4997 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
4999 /* Access the object */
5000 o_ptr = &o_list[this_o_idx];
5002 /* Describe the object */
5003 object_desc(o_name, o_ptr, 0);
5005 /* Access the next object */
5006 next_o_idx = o_ptr->next_o_idx;
5008 /* Hack -- disturb */
5009 disturb(FALSE, FALSE);
5012 if (o_ptr->tval == TV_GOLD)
5015 msg_format(" $%ld の価値がある%sを見つけた。",
5016 (long)o_ptr->pval, o_name);
5018 msg_format("You have found %ld gold pieces worth of %s.",
5019 (long)o_ptr->pval, o_name);
5022 /* Collect the gold */
5023 p_ptr->au += o_ptr->pval;
5026 p_ptr->redraw |= (PR_GOLD);
5028 p_ptr->window |= (PW_PLAYER);
5030 /* Delete the gold */
5031 delete_object_idx(this_o_idx);
5033 /* Check the next object */
5036 else if (o_ptr->marked & OM_NOMSG)
5038 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
5039 * ignored. Otherwise, they are included in the prompt. */
5040 o_ptr->marked &= ~(OM_NOMSG);
5044 /* Count non-gold objects that can be picked up. */
5045 if (inven_carry_okay(o_ptr))
5050 /* Count non-gold objects */
5053 /* Remember this index */
5054 floor_o_idx = this_o_idx;
5057 /* There are no non-gold objects */
5061 /* Mention the number of objects */
5067 /* Access the object */
5068 o_ptr = &o_list[floor_o_idx];
5070 #ifdef ALLOW_EASY_SENSE
5072 /* Option: Make object sensing easy */
5075 /* Sense the object */
5076 (void) sense_object(o_ptr);
5079 #endif /* ALLOW_EASY_SENSE */
5081 /* Describe the object */
5082 object_desc(o_name, o_ptr, 0);
5084 msg_format(_("%sがある。", "You see %s."), o_name);
5087 /* Multiple objects */
5090 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
5096 /* The player has no room for anything on the floor. */
5102 /* Access the object */
5103 o_ptr = &o_list[floor_o_idx];
5105 #ifdef ALLOW_EASY_SENSE
5107 /* Option: Make object sensing easy */
5110 /* Sense the object */
5111 (void) sense_object(o_ptr);
5114 #endif /* ALLOW_EASY_SENSE */
5116 /* Describe the object */
5117 object_desc(o_name, o_ptr, 0);
5119 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
5122 /* Multiple objects */
5125 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
5135 /* Hack -- query every object */
5136 if (carry_query_flag)
5138 char out_val[MAX_NLEN+20];
5140 /* Access the object */
5141 o_ptr = &o_list[floor_o_idx];
5143 #ifdef ALLOW_EASY_SENSE
5145 /* Option: Make object sensing easy */
5148 /* Sense the object */
5149 (void) sense_object(o_ptr);
5152 #endif /* ALLOW_EASY_SENSE */
5154 /* Describe the object */
5155 object_desc(o_name, o_ptr, 0);
5157 /* Build a prompt */
5158 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
5160 /* Ask the user to confirm */
5161 if (!get_check(out_val))
5167 /* Access the object */
5168 o_ptr = &o_list[floor_o_idx];
5170 #ifdef ALLOW_EASY_SENSE
5172 /* Option: Make object sensing easy */
5175 /* Sense the object */
5176 (void) sense_object(o_ptr);
5179 #endif /* ALLOW_EASY_SENSE */
5181 /* Pick up the object */
5182 py_pickup_aux(floor_o_idx);
5185 /* Allow the user to choose an object */
5188 while (can_pickup--)
5190 if (!py_pickup_floor_aux()) break;