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 */
1240 Term_get_size(&wid, &hgt);
1242 /* Display Item name */
1243 if (!(mode & SCROBJ_FAKE_OBJECT))
1244 object_desc(o_name, o_ptr, 0);
1246 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1250 /* Erase the screen */
1251 for (k = 1; k < hgt; k++) prt("", k, 13);
1253 /* Label the information */
1254 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1256 monster_race *r_ptr = &r_info[o_ptr->pval];
1257 int namelen = strlen(r_name + r_ptr->name);
1258 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1259 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1260 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1264 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1267 /* We will print on top of the map (column 13) */
1268 for (k = 2, j = 0; j < i; j++)
1271 prt(info[j], k++, 15);
1273 /* Every 20 entries (lines 2 to 21), start over */
1274 if ((k == hgt - 2) && (j+1 < i))
1276 prt(_("-- 続く --", "-- more --"), k, 15);
1278 for (; k > 2; k--) prt("", k, 15);
1283 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1287 /* Restore the screen */
1290 /* Gave knowledge */
1297 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1298 * Convert an inventory index into a one character label
1299 * @param i プレイヤーの所持/装備オブジェクトID
1300 * @return 対応するアルファベット
1301 * @details Note that the label does NOT distinguish inven/equip.
1303 char index_to_label(int i)
1305 /* Indexes for "inven" are easy */
1306 if (i < INVEN_RARM) return (I2A(i));
1308 /* Indexes for "equip" are offset */
1309 return (I2A(i - INVEN_RARM));
1313 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1314 * Convert a label into the index of an item in the "inven"
1315 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1316 * @details Note that the label does NOT distinguish inven/equip.
1318 INVENTORY_IDX label_to_inven(int c)
1323 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1325 /* Verify the index */
1326 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1328 /* Empty slots can never be chosen */
1329 if (!inventory[i].k_idx) return (-1);
1331 /* Return the index */
1337 extern bool select_ring_slot;
1341 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1342 * @param i プレイヤーの所持/装備オブジェクトID
1343 * @return 指輪枠ならばTRUEを返す。
1345 static bool is_ring_slot(int i)
1347 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1352 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1353 * Convert a label into the index of a item in the "equip"
1354 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1356 INVENTORY_IDX label_to_equip(int c)
1361 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1363 /* Verify the index */
1364 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1366 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1368 /* Empty slots can never be chosen */
1369 if (!inventory[i].k_idx) return (-1);
1371 /* Return the index */
1378 * @brief オブジェクトの該当装備部位IDを返す /
1379 * Determine which equipment slot (if any) an item likes
1380 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1381 * @return 対応する装備部位ID
1383 s16b wield_slot(object_type *o_ptr)
1385 /* Slot for equipment */
1386 switch (o_ptr->tval)
1393 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1394 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1395 return (INVEN_LARM);
1402 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1403 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1404 return (INVEN_RARM);
1414 /* Use the right hand first */
1415 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1417 /* Use the left hand for swapping (by default) */
1418 return (INVEN_LEFT);
1424 return (INVEN_NECK);
1429 return (INVEN_LITE);
1436 return (INVEN_BODY);
1441 return (INVEN_OUTER);
1447 return (INVEN_HEAD);
1452 return (INVEN_HANDS);
1457 return (INVEN_FEET);
1461 /* No slot available */
1466 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1467 * Return a string mentioning how a given item is carried
1468 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1469 * @return 部位表現の文字列ポインタ
1471 cptr mention_use(int i)
1475 /* Examine the location */
1479 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1481 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1485 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1487 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1491 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "運搬中" : "射撃用"; break;
1493 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "Just holding" : "Shooting"; break;
1497 case INVEN_RIGHT: p = (left_hander ? "左手指" : "右手指"); break;
1499 case INVEN_RIGHT: p = (left_hander ? "On left hand" : "On right hand"); break;
1503 case INVEN_LEFT: p = (left_hander ? "右手指" : "左手指"); break;
1505 case INVEN_LEFT: p = (left_hander ? "On right hand" : "On left hand"); break;
1508 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1509 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1510 case INVEN_BODY: p = _(" 体", "On body"); break;
1511 case INVEN_OUTER: p = _("体の上", "About body"); break;
1512 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1513 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1514 case INVEN_FEET: p = _(" 足", "On feet"); break;
1515 default: p = _("ザック", "In pack"); break;
1518 /* Return the result */
1524 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1525 * Return a string describing how a given item is being worn.
1526 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1527 * @return 状態表現内容の文字列ポインタ
1529 * Currently, only used for items in the equipment, not inventory.
1531 cptr describe_use(int i)
1538 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1540 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1544 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1546 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1550 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "持つだけで精一杯の" : "射撃用に装備している"; break;
1552 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "just holding" : "shooting missiles with"; break;
1556 case INVEN_RIGHT: p = (left_hander ? "左手の指にはめている" : "右手の指にはめている"); break;
1558 case INVEN_RIGHT: p = (left_hander ? "wearing on your left hand" : "wearing on your right hand"); break;
1562 case INVEN_LEFT: p = (left_hander ? "右手の指にはめている" : "左手の指にはめている"); break;
1564 case INVEN_LEFT: p = (left_hander ? "wearing on your right hand" : "wearing on your left hand"); break;
1567 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1568 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1569 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1570 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1571 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1572 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1573 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1574 default: p = _("ザックに入っている", "carrying in your pack"); break;
1577 /* Return the result */
1583 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1584 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1585 * @param book_tval ベースアイテムのtval
1586 * @param book_sval ベースアイテムのsval
1587 * @return 使用可能な魔法書ならばTRUEを返す。
1590 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1592 if (book_tval < TV_LIFE_BOOK) return FALSE;
1593 if (p_ptr->pclass == CLASS_SORCERER)
1595 return is_magic(tval2realm(book_tval));
1597 else if (p_ptr->pclass == CLASS_RED_MAGE)
1599 if (is_magic(tval2realm(book_tval)))
1600 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1602 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1606 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1607 * Check an item against the item tester info
1608 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1609 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1611 bool item_tester_okay(object_type *o_ptr)
1613 /* Hack -- allow listing empty slots */
1614 if (item_tester_full) return (TRUE);
1616 /* Require an item */
1617 if (!o_ptr->k_idx) return (FALSE);
1619 /* Hack -- ignore "gold" */
1620 if (o_ptr->tval == TV_GOLD)
1623 extern bool show_gold_on_floor;
1625 if (!show_gold_on_floor) return (FALSE);
1628 /* Check the tval */
1629 if (item_tester_tval)
1631 /* Is it a spellbook? If so, we need a hack -- TY */
1632 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1633 (item_tester_tval >= TV_LIFE_BOOK))
1634 return check_book_realm(o_ptr->tval, o_ptr->sval);
1636 if (item_tester_tval != o_ptr->tval) return (FALSE);
1639 /* Check the hook */
1640 if (item_tester_hook)
1642 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1651 * @brief 所持アイテム一覧を表示する /
1652 * Choice window "shadow" of the "show_inven()" function
1655 void display_inven(void)
1657 register int i, n, z = 0;
1659 TERM_COLOR attr = TERM_WHITE;
1661 char o_name[MAX_NLEN];
1664 Term_get_size(&wid, &hgt);
1666 /* Find the "final" slot */
1667 for (i = 0; i < INVEN_PACK; i++)
1669 o_ptr = &inventory[i];
1671 /* Skip non-objects */
1672 if (!o_ptr->k_idx) continue;
1678 /* Display the pack */
1679 for (i = 0; i < z; i++)
1681 /* Examine the item */
1682 o_ptr = &inventory[i];
1684 /* Start with an empty "index" */
1685 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1687 /* Is this item "acceptable"? */
1688 if (item_tester_okay(o_ptr))
1690 /* Prepare an "index" */
1691 tmp_val[0] = index_to_label(i);
1693 /* Bracket the "index" --(-- */
1697 /* Display the index (or blank space) */
1698 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1700 /* Obtain an item description */
1701 object_desc(o_name, o_ptr, 0);
1703 /* Obtain the length of the description */
1707 attr = tval_to_attr[o_ptr->tval % 128];
1709 /* Grey out charging items */
1715 /* Display the entry itself */
1716 Term_putstr(3, i, n, attr, o_name);
1718 /* Erase the rest of the line */
1719 Term_erase(3+n, i, 255);
1721 /* Display the weight if needed */
1724 int wgt = o_ptr->weight * o_ptr->number;
1726 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt),lbtokg2(wgt) );
1728 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1731 prt(tmp_val, i, wid - 9);
1735 /* Erase the rest of the window */
1736 for (i = z; i < hgt; i++)
1738 /* Erase the line */
1739 Term_erase(0, i, 255);
1746 * @brief 装備アイテム一覧を表示する /
1747 * Choice window "shadow" of the "show_equip()" function
1750 void display_equip(void)
1754 TERM_COLOR attr = TERM_WHITE;
1756 char o_name[MAX_NLEN];
1759 Term_get_size(&wid, &hgt);
1761 /* Display the equipment */
1762 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1764 /* Examine the item */
1765 o_ptr = &inventory[i];
1767 /* Start with an empty "index" */
1768 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1770 /* Is this item "acceptable"? */
1771 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1773 /* Prepare an "index" */
1774 tmp_val[0] = index_to_label(i);
1776 /* Bracket the "index" --(-- */
1780 /* Display the index (or blank space) */
1781 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1783 /* Obtain an item description */
1784 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1786 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1791 object_desc(o_name, o_ptr, 0);
1792 attr = tval_to_attr[o_ptr->tval % 128];
1795 /* Obtain the length of the description */
1798 /* Grey out charging items */
1804 /* Display the entry itself */
1805 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1807 /* Erase the rest of the line */
1808 Term_erase(3+n, i - INVEN_RARM, 255);
1810 /* Display the weight (if needed) */
1813 int wgt = o_ptr->weight * o_ptr->number;
1815 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1817 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1820 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1823 /* Display the slot description (if needed) */
1826 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1827 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1831 /* Erase the rest of the window */
1832 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1834 /* Clear that line */
1835 Term_erase(0, i, 255);
1841 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1842 * Find the "first" inventory object with the given "tag".
1843 * @param cp 対応するタグIDを与える参照ポインタ
1844 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1845 * @param mode 所持、装備の切り替え
1846 * @return タグに該当するオブジェクトがあるならTRUEを返す
1848 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1849 * inscription of an object. Alphabetical characters don't work as a\n
1850 * tag in this form.\n
1852 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1853 * and "x" is the "current" command_cmd code.\n
1855 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1858 COMMAND_CODE start, end;
1861 /* Extract index from mode */
1866 end = INVEN_TOTAL - 1;
1871 end = INVEN_PACK - 1;
1878 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1880 /* Check every inventory object */
1881 for (i = start; i <= end; i++)
1883 object_type *o_ptr = &inventory[i];
1885 /* Skip non-objects */
1886 if (!o_ptr->k_idx) continue;
1888 /* Skip empty inscriptions */
1889 if (!o_ptr->inscription) continue;
1891 /* Skip non-choice */
1892 if (!item_tester_okay(o_ptr)) continue;
1895 s = my_strchr(quark_str(o_ptr->inscription), '@');
1897 /* Process all tags */
1900 /* Check the special tags */
1901 if ((s[1] == command_cmd) && (s[2] == tag))
1903 /* Save the actual inventory ID */
1910 /* Find another '@' */
1911 s = my_strchr(s + 1, '@');
1916 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1918 /* Don't allow {@#} with '#' being alphabet */
1919 if (tag < '0' || '9' < tag)
1925 /* Check every object */
1926 for (i = start; i <= end; i++)
1928 object_type *o_ptr = &inventory[i];
1930 /* Skip non-objects */
1931 if (!o_ptr->k_idx) continue;
1933 /* Skip empty inscriptions */
1934 if (!o_ptr->inscription) continue;
1936 /* Skip non-choice */
1937 if (!item_tester_okay(o_ptr)) continue;
1940 s = my_strchr(quark_str(o_ptr->inscription), '@');
1942 /* Process all tags */
1945 /* Check the normal tags */
1948 /* Save the actual inventory ID */
1955 /* Find another '@' */
1956 s = my_strchr(s + 1, '@');
1966 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1967 * Find the "first" inventory object with the given "tag".
1968 * @param cp 対応するタグIDを与える参照ポインタ
1969 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1970 * @param floor_list 床上アイテムの配列
1971 * @param floor_num 床上アイテムの配列ID
1972 * @return タグに該当するオブジェクトがあるならTRUEを返す
1974 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1975 * inscription of an object. Alphabetical characters don't work as a\n
1976 * tag in this form.\n
1978 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1979 * and "x" is the "current" command_cmd code.\n
1981 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1986 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1988 /* Check every object in the grid */
1989 for (i = 0; i < floor_num && i < 23; i++)
1991 object_type *o_ptr = &o_list[floor_list[i]];
1993 /* Skip empty inscriptions */
1994 if (!o_ptr->inscription) continue;
1997 s = my_strchr(quark_str(o_ptr->inscription), '@');
1999 /* Process all tags */
2002 /* Check the special tags */
2003 if ((s[1] == command_cmd) && (s[2] == tag))
2005 /* Save the actual floor object ID */
2012 /* Find another '@' */
2013 s = my_strchr(s + 1, '@');
2018 /**** Find a tag in the form of {@#} (allows only numerals) ***/
2020 /* Don't allow {@#} with '#' being alphabet */
2021 if (tag < '0' || '9' < tag)
2027 /* Check every object in the grid */
2028 for (i = 0; i < floor_num && i < 23; i++)
2030 object_type *o_ptr = &o_list[floor_list[i]];
2032 /* Skip empty inscriptions */
2033 if (!o_ptr->inscription) continue;
2036 s = my_strchr(quark_str(o_ptr->inscription), '@');
2038 /* Process all tags */
2041 /* Check the normal tags */
2044 /* Save the floor object ID */
2051 /* Find another '@' */
2052 s = my_strchr(s + 1, '@');
2062 * @brief タグIDにあわせてタグアルファベットのリストを返す /
2063 * Move around label characters with correspond tags
2064 * @param label ラベルリストを取得する文字列参照ポインタ
2065 * @param mode 所持品リストか装備品リストかの切り替え
2068 static void prepare_label_string(char *label, BIT_FLAGS mode)
2070 cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2071 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2074 /* Prepare normal labels */
2075 strcpy(label, alphabet_chars);
2077 /* Move each label */
2078 for (i = 0; i < 52; i++)
2081 char c = alphabet_chars[i];
2083 /* Find a tag with this label */
2084 if (get_tag(&index, c, mode))
2086 /* Delete the overwritten label */
2087 if (label[i] == c) label[i] = ' ';
2089 /* Move the label to the place of corresponding tag */
2090 label[index - offset] = c;
2097 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2098 * Move around label characters with correspond tags (floor version)
2099 * @param label ラベルリストを取得する文字列参照ポインタ
2100 * @param floor_list 床上アイテムの配列
2101 * @param floor_num 床上アイテムの配列ID
2106 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2108 cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2111 /* Prepare normal labels */
2112 strcpy(label, alphabet_chars);
2114 /* Move each label */
2115 for (i = 0; i < 52; i++)
2118 char c = alphabet_chars[i];
2120 /* Find a tag with this label */
2121 if (get_tag_floor(&index, c, floor_list, floor_num))
2123 /* Delete the overwritten label */
2124 if (label[i] == c) label[i] = ' ';
2126 /* Move the label to the place of corresponding tag */
2134 * @brief 所持アイテムの表示を行う /
2135 * Display the inventory.
2136 * @param target_item アイテムの選択処理を行うか否か。
2137 * @return 選択したアイテムのタグ
2139 * Hack -- do not display "trailing" empty slots
2141 COMMAND_CODE show_inven(int target_item)
2145 int col, cur_col, len;
2147 char o_name[MAX_NLEN];
2149 COMMAND_CODE out_index[23];
2150 TERM_COLOR out_color[23];
2151 char out_desc[23][MAX_NLEN];
2152 COMMAND_CODE target_item_label = 0;
2154 char inven_label[52 + 1];
2156 /* Starting column */
2159 Term_get_size(&wid, &hgt);
2161 /* Default "max-length" */
2162 len = wid - col - 1;
2165 /* Find the "final" slot */
2166 for (i = 0; i < INVEN_PACK; i++)
2168 o_ptr = &inventory[i];
2170 /* Skip non-objects */
2171 if (!o_ptr->k_idx) continue;
2177 prepare_label_string(inven_label, USE_INVEN);
2179 /* Display the inventory */
2180 for (k = 0, i = 0; i < z; i++)
2182 o_ptr = &inventory[i];
2184 /* Is this item acceptable? */
2185 if (!item_tester_okay(o_ptr)) continue;
2187 /* Describe the object */
2188 object_desc(o_name, o_ptr, 0);
2190 /* Save the object index, color, and description */
2192 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2194 /* Grey out charging items */
2197 out_color[k] = TERM_L_DARK;
2200 (void)strcpy(out_desc[k], o_name);
2202 /* Find the predicted "line length" */
2203 l = strlen(out_desc[k]) + 5;
2205 /* Be sure to account for the weight */
2206 if (show_weights) l += 9;
2208 /* Account for icon if displayed */
2209 if (show_item_graph)
2212 if (use_bigtile) l++;
2215 /* Maintain the maximum length */
2216 if (l > len) len = l;
2218 /* Advance to next "line" */
2222 /* Find the column to start in */
2223 col = (len > wid - 4) ? 0 : (wid - len - 1);
2225 /* Output each entry */
2226 for (j = 0; j < k; j++)
2232 o_ptr = &inventory[i];
2234 /* Clear the line */
2235 prt("", j + 1, col ? col - 2 : col);
2237 if (use_menu && target_item)
2239 if (j == (target_item-1))
2241 strcpy(tmp_val, _("》", "> "));
2242 target_item_label = i;
2244 else strcpy(tmp_val, " ");
2246 else if (i <= INVEN_PACK)
2248 /* Prepare an index --(-- */
2249 sprintf(tmp_val, "%c)", inven_label[i]);
2253 /* Prepare an index --(-- */
2254 sprintf(tmp_val, "%c)", index_to_label(i));
2257 /* Clear the line with the (possibly indented) index */
2258 put_str(tmp_val, j + 1, col);
2262 /* Display graphics for object, if desired */
2263 if (show_item_graph)
2265 byte a = object_attr(o_ptr);
2266 char c = object_char(o_ptr);
2267 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2268 if (use_bigtile) cur_col++;
2274 /* Display the entry itself */
2275 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2277 /* Display the weight if needed */
2280 int wgt = o_ptr->weight * o_ptr->number;
2282 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2284 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2287 prt(tmp_val, j + 1, wid - 9);
2291 /* Make a "shadow" below the list (only if needed) */
2292 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2294 /* Save the new column */
2297 return target_item_label;
2302 * @brief 装備アイテムの表示を行う /
2303 * Display the equipment.
2304 * @param target_item アイテムの選択処理を行うか否か。
2305 * @return 選択したアイテムのタグ
2307 COMMAND_CODE show_equip(int target_item)
2311 int col, cur_col, len;
2314 char o_name[MAX_NLEN];
2315 COMMAND_CODE out_index[23];
2316 TERM_COLOR out_color[23];
2317 char out_desc[23][MAX_NLEN];
2318 COMMAND_CODE target_item_label = 0;
2320 char equip_label[52 + 1];
2322 /* Starting column */
2325 Term_get_size(&wid, &hgt);
2327 /* Maximal length */
2328 len = wid - col - 1;
2331 /* Scan the equipment list */
2332 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2334 o_ptr = &inventory[i];
2336 /* Is this item acceptable? */
2337 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr)) &&
2338 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2339 item_tester_no_ryoute)) continue;
2342 object_desc(o_name, o_ptr, 0);
2344 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2346 (void)strcpy(out_desc[k],_("(武器を両手持ち)", "(wielding with two-hands)"));
2347 out_color[k] = TERM_WHITE;
2351 (void)strcpy(out_desc[k], o_name);
2352 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2356 /* Grey out charging items */
2359 out_color[k] = TERM_L_DARK;
2362 /* Extract the maximal length (see below) */
2364 l = strlen(out_desc[k]) + (2 + 1);
2366 l = strlen(out_desc[k]) + (2 + 3);
2370 /* Increase length for labels (if needed) */
2372 if (show_labels) l += (7 + 2);
2374 if (show_labels) l += (14 + 2);
2378 /* Increase length for weight (if needed) */
2379 if (show_weights) l += 9;
2381 if (show_item_graph) l += 2;
2383 /* Maintain the max-length */
2384 if (l > len) len = l;
2386 /* Advance the entry */
2390 /* Hack -- Find a column to start in */
2392 col = (len > wid - 6) ? 0 : (wid - len - 1);
2394 col = (len > wid - 4) ? 0 : (wid - len - 1);
2397 prepare_label_string(equip_label, USE_EQUIP);
2399 /* Output each entry */
2400 for (j = 0; j < k; j++)
2406 o_ptr = &inventory[i];
2408 /* Clear the line */
2409 prt("", j + 1, col ? col - 2 : col);
2411 if (use_menu && target_item)
2413 if (j == (target_item-1))
2415 strcpy(tmp_val, _("》", "> "));
2416 target_item_label = i;
2418 else strcpy(tmp_val, " ");
2420 else if (i >= INVEN_RARM)
2422 /* Prepare an index --(-- */
2423 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2427 /* Prepare an index --(-- */
2428 sprintf(tmp_val, "%c)", index_to_label(i));
2431 /* Clear the line with the (possibly indented) index */
2432 put_str(tmp_val, j+1, col);
2436 /* Display graphics for object, if desired */
2437 if (show_item_graph)
2439 byte a = object_attr(o_ptr);
2440 char c = object_char(o_ptr);
2441 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2442 if (use_bigtile) cur_col++;
2450 /* Mention the use */
2451 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2453 put_str(tmp_val, j+1, cur_col);
2455 /* Display the entry itself */
2456 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2462 /* Display the entry itself */
2463 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2466 /* Display the weight if needed */
2469 int wgt = o_ptr->weight * o_ptr->number;
2471 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2473 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2476 prt(tmp_val, j + 1, wid - 9);
2480 /* Make a "shadow" below the list (only if needed) */
2481 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2483 /* Save the new column */
2486 return target_item_label;
2490 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2491 * Flip "inven" and "equip" in any sub-windows
2494 void toggle_inven_equip(void)
2499 for (j = 0; j < 8; j++)
2502 if (!angband_term[j]) continue;
2504 /* Flip inven to equip */
2505 if (window_flag[j] & (PW_INVEN))
2508 window_flag[j] &= ~(PW_INVEN);
2509 window_flag[j] |= (PW_EQUIP);
2511 p_ptr->window |= (PW_EQUIP);
2514 /* Flip inven to equip */
2515 else if (window_flag[j] & (PW_EQUIP))
2518 window_flag[j] &= ~(PW_EQUIP);
2519 window_flag[j] |= (PW_INVEN);
2521 p_ptr->window |= (PW_INVEN);
2527 * @brief 選択したアイテムの確認処理の補助 /
2528 * Verify the choice of an item.
2529 * @param prompt メッセージ表示の一部
2530 * @param item 選択アイテムID
2531 * @return 確認がYesならTRUEを返す。
2532 * @details The item can be negative to mean "item on floor".
2534 static bool verify(cptr prompt, INVENTORY_IDX item)
2536 char o_name[MAX_NLEN];
2537 char out_val[MAX_NLEN+20];
2544 o_ptr = &inventory[item];
2550 o_ptr = &o_list[0 - item];
2554 object_desc(o_name, o_ptr, 0);
2557 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2560 return (get_check(out_val));
2565 * @brief 選択したアイテムの確認処理のメインルーチン /
2566 * @param item 選択アイテムID
2567 * @return 確認がYesならTRUEを返す。
2568 * @details The item can be negative to mean "item on floor".
2569 * Hack -- allow user to "prevent" certain choices
2571 static bool get_item_allow(INVENTORY_IDX item)
2577 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2582 o_ptr = &inventory[item];
2588 o_ptr = &o_list[0 - item];
2591 /* No inscription */
2592 if (!o_ptr->inscription) return (TRUE);
2595 s = my_strchr(quark_str(o_ptr->inscription), '!');
2597 /* Process preventions */
2600 /* Check the "restriction" */
2601 if ((s[1] == command_cmd) || (s[1] == '*'))
2603 /* Verify the choice */
2604 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2607 /* Find another '!' */
2608 s = my_strchr(s + 1, '!');
2617 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2618 * Auxiliary function for "get_item()" -- test an index
2620 * @return 正規のIDならばTRUEを返す。
2622 static bool get_item_okay(OBJECT_IDX i)
2625 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2627 if (select_ring_slot) return is_ring_slot(i);
2629 /* Verify the item */
2630 if (!item_tester_okay(&inventory[i])) return (FALSE);
2637 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2638 * Determine whether get_item() can get some item or not
2639 * @return アイテムを拾えるならばTRUEを返す。
2640 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2642 bool can_get_item(void)
2645 OBJECT_IDX floor_list[23];
2646 ITEM_NUMBER floor_num = 0;
2648 for (j = 0; j < INVEN_TOTAL; j++)
2649 if (item_tester_okay(&inventory[j]))
2652 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2660 * @brief オブジェクト選択の汎用関数 /
2661 * Let the user select an item, save its "index"
2662 * @param cp 選択したオブジェクトのIDを返す。
2663 * @param pmt 選択目的のメッセージ
2664 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2665 * @param mode オプションフラグ
2666 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2667 * Return TRUE only if an acceptable item was chosen by the user.\n
2669 * The selected item must satisfy the "item_tester_hook()" function,\n
2670 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2672 * All "item_tester" restrictions are cleared before this function returns.\n
2674 * The user is allowed to choose acceptable items from the equipment,\n
2675 * inventory, or floor, respectively, if the proper flag was given,\n
2676 * and there are any acceptable items in that location.\n
2678 * The equipment or inventory are displayed (even if no acceptable\n
2679 * items are in that location) if the proper flag was given.\n
2681 * If there are no acceptable items available anywhere, and "str" is\n
2682 * not NULL, then it will be used as the text of a warning message\n
2683 * before the function returns.\n
2685 * Note that the user must press "-" to specify the item on the floor,\n
2686 * and there is no way to "examine" the item on the floor, while the\n
2687 * use of "capital" letters will "examine" an inventory/equipment item,\n
2688 * and prompt for its use.\n
2690 * If a legal item is selected from the inventory, we save it in "cp"\n
2691 * directly (0 to 35), and return TRUE.\n
2693 * If a legal item is selected from the floor, we save it in "cp" as\n
2694 * a negative (-1 to -511), and return TRUE.\n
2696 * If no item is available, we do nothing to "cp", and we display a\n
2697 * warning message, using "str" if available, and return FALSE.\n
2699 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2701 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2702 * to allow the user to enter a command while viewing those screens, and\n
2703 * also to induce "auto-enter" of stores, and other such stuff.\n
2705 * Global "p_ptr->command_see" may be set before calling this function to start\n
2706 * out in "browse" mode. It is cleared before this function returns.\n
2708 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2709 * If it is TRUE then we are viewing inventory, else equipment.\n
2711 * We always erase the prompt when we are done, leaving a blank line,\n
2712 * or a warning message, if appropriate, if no items are available.\n
2714 bool get_item(OBJECT_IDX *cp, cptr pmt, cptr str, BIT_FLAGS mode)
2716 OBJECT_IDX this_o_idx, next_o_idx = 0;
2733 bool allow_floor = FALSE;
2735 bool toggle = FALSE;
2741 extern bool select_the_force;
2743 int menu_line = (use_menu ? 1 : 0);
2747 static char prev_tag = '\0';
2748 char cur_tag = '\0';
2750 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2753 if (mode & USE_EQUIP) equip = TRUE;
2754 if (mode & USE_INVEN) inven = TRUE;
2755 if (mode & USE_FLOOR) floor = TRUE;
2757 /* Get the item index */
2758 if (repeat_pull(cp))
2761 if (select_the_force && (*cp == INVEN_FORCE))
2763 item_tester_tval = 0;
2764 item_tester_hook = NULL;
2765 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2770 else if (floor && (*cp < 0))
2777 /* Acquire object */
2780 /* Validate the item */
2781 if (item_tester_okay(o_ptr))
2783 /* Forget restrictions */
2784 item_tester_tval = 0;
2785 item_tester_hook = NULL;
2786 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2793 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2794 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2796 if (prev_tag && command_cmd)
2798 /* Look up the tag and validate the item */
2799 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2800 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2801 else if (!get_item_okay(k)) /* Reject */;
2804 /* Accept that choice */
2807 /* Forget restrictions */
2808 item_tester_tval = 0;
2809 item_tester_hook = NULL;
2810 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2816 prev_tag = '\0'; /* prev_tag is no longer effective */
2819 /* Verify the item */
2820 else if (get_item_okay(*cp))
2822 /* Forget restrictions */
2823 item_tester_tval = 0;
2824 item_tester_hook = NULL;
2825 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2841 /* No item selected */
2845 /* Full inventory */
2847 i2 = INVEN_PACK - 1;
2849 /* Forbid inventory */
2850 if (!inven) i2 = -1;
2853 for (j = 0; j < INVEN_PACK; j++)
2854 if (item_tester_okay(&inventory[j])) max_inven++;
2857 /* Restrict inventory indexes */
2858 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2859 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2862 /* Full equipment */
2864 e2 = INVEN_TOTAL - 1;
2866 /* Forbid equipment */
2867 if (!equip) e2 = -1;
2870 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2871 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
2872 if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
2875 /* Restrict equipment indexes */
2876 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2877 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2879 if (equip && p_ptr->ryoute && !item_tester_no_ryoute)
2883 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2885 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2889 /* Restrict floor usage */
2892 /* Scan all objects in the grid */
2893 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2897 /* Acquire object */
2898 o_ptr = &o_list[this_o_idx];
2900 /* Acquire next object */
2901 next_o_idx = o_ptr->next_o_idx;
2903 /* Accept the item on the floor if legal */
2904 if (item_tester_okay(o_ptr) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2908 /* Require at least one legal choice */
2909 if (!allow_floor && (i1 > i2) && (e1 > e2))
2911 /* Cancel p_ptr->command_see */
2912 command_see = FALSE;
2918 if (select_the_force) {
2924 /* Analyze choices */
2927 /* Hack -- Start on equipment if requested */
2928 if (command_see && command_wrk && equip)
2933 /* Use inventory if allowed */
2936 command_wrk = FALSE;
2939 /* Use equipment if allowed */
2945 /* Use inventory for floor */
2948 command_wrk = FALSE;
2954 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2956 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2958 /* Hack -- start out in "display" mode */
2966 /* Repeat until done */
2969 COMMAND_CODE get_item_label = 0;
2976 for (j = 0; j < 8; j++)
2979 if (!angband_term[j]) continue;
2981 /* Count windows displaying inven */
2982 if (window_flag[j] & (PW_INVEN)) ni++;
2984 /* Count windows displaying equip */
2985 if (window_flag[j] & (PW_EQUIP)) ne++;
2988 /* Toggle if needed */
2989 if ((command_wrk && ni && !ne) ||
2990 (!command_wrk && !ni && ne))
2993 toggle_inven_equip();
3000 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3002 /* Redraw windows */
3006 /* Inventory screen */
3009 /* Redraw if needed */
3010 if (command_see) get_item_label = show_inven(menu_line);
3013 /* Equipment screen */
3016 /* Redraw if needed */
3017 if (command_see) get_item_label = show_equip(menu_line);
3020 /* Viewing inventory */
3023 /* Begin the prompt */
3024 sprintf(out_val, _("持ち物:", "Inven:"));
3026 /* Some legal items */
3027 if ((i1 <= i2) && !use_menu)
3029 /* Build the prompt */
3030 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3031 index_to_label(i1), index_to_label(i2));
3034 strcat(out_val, tmp_val);
3037 /* Indicate ability to "view" */
3038 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3042 if (equip) strcat(out_val, format(" %s 装備品,", use_menu ? "'4'or'6'" : "'/'"));
3044 if (equip) strcat(out_val, format(" %s for Equip,", use_menu ? "4 or 6" : "/"));
3048 /* Viewing equipment */
3051 /* Begin the prompt */
3052 sprintf(out_val, _("装備品:", "Equip:"));
3054 /* Some legal items */
3055 if ((e1 <= e2) && !use_menu)
3057 /* Build the prompt */
3058 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3059 index_to_label(e1), index_to_label(e2));
3062 strcat(out_val, tmp_val);
3065 /* Indicate ability to "view" */
3066 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3070 if (inven) strcat(out_val, format(" %s 持ち物,", use_menu ? "'4'or'6'" : "'/'"));
3072 if (inven) strcat(out_val, format(" %s for Inven,", use_menu ? "4 or 6" : "'/'"));
3076 /* Indicate legality of the "floor" item */
3077 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
3078 if (select_the_force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
3080 /* Finish the prompt */
3081 strcat(out_val, " ESC");
3083 /* Build the prompt */
3084 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3086 /* Show the prompt */
3094 int max_line = (command_wrk ? max_equip : max_inven);
3110 menu_line += (max_line - 1);
3129 /* Verify legality */
3130 if (!inven || !equip)
3136 /* Hack -- Fix screen */
3146 /* Switch inven/equip */
3147 command_wrk = !command_wrk;
3148 max_line = (command_wrk ? max_equip : max_inven);
3149 if (menu_line > max_line) menu_line = max_line;
3151 /* Need to redraw */
3160 if (command_wrk == USE_FLOOR)
3163 (*cp) = -get_item_label;
3167 /* Validate the item */
3168 if (!get_item_okay(get_item_label))
3174 /* Allow player to "refuse" certain actions */
3175 if (!get_item_allow(get_item_label))
3181 /* Accept that choice */
3182 (*cp) = get_item_label;
3191 if (select_the_force) {
3199 if (menu_line > max_line) menu_line -= max_line;
3220 command_see = FALSE;
3240 /* Verify legality */
3241 if (!inven || !equip)
3247 /* Hack -- Fix screen */
3257 /* Switch inven/equip */
3258 command_wrk = !command_wrk;
3260 /* Need to redraw */
3266 /* Use floor item */
3269 /* Scan all objects in the grid */
3270 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3274 /* Acquire object */
3275 o_ptr = &o_list[this_o_idx];
3277 /* Acquire next object */
3278 next_o_idx = o_ptr->next_o_idx;
3280 /* Validate the item */
3281 if (!item_tester_okay(o_ptr)) continue;
3286 /* Verify the item (if required) */
3287 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3289 /* Allow player to "refuse" certain actions */
3290 if (!get_item_allow(k)) continue;
3292 /* Accept that choice */
3308 case '1': case '2': case '3':
3309 case '4': case '5': case '6':
3310 case '7': case '8': case '9':
3312 /* Look up the tag */
3313 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3319 /* Hack -- Validate the item */
3320 if ((k < INVEN_RARM) ? !inven : !equip)
3326 /* Validate the item */
3327 if (!get_item_okay(k))
3333 /* Allow player to "refuse" certain actions */
3334 if (!get_item_allow(k))
3340 /* Accept that choice */
3352 /* Choose "default" inventory item */
3355 k = ((i1 == i2) ? i1 : -1);
3358 /* Choose "default" equipment item */
3361 k = ((e1 == e2) ? e1 : -1);
3364 /* Validate the item */
3365 if (!get_item_okay(k))
3371 /* Allow player to "refuse" certain actions */
3372 if (!get_item_allow(k))
3378 /* Accept that choice */
3388 if (select_the_force) {
3401 bool not_found = FALSE;
3403 /* Look up the alphabetical tag */
3404 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3409 /* Hack -- Validate the item */
3410 else if ((k < INVEN_RARM) ? !inven : !equip)
3415 /* Validate the item */
3416 else if (!get_item_okay(k))
3423 /* Accept that choice */
3431 /* Extract "query" setting */
3432 ver = isupper(which);
3433 which = (char)tolower(which);
3435 /* Convert letter to inventory index */
3438 if (which == '(') k = i1;
3439 else if (which == ')') k = i2;
3440 else k = label_to_inven(which);
3443 /* Convert letter to equipment index */
3446 if (which == '(') k = e1;
3447 else if (which == ')') k = e2;
3448 else k = label_to_equip(which);
3451 /* Validate the item */
3452 if (!get_item_okay(k))
3458 /* Verify the item */
3459 if (ver && !verify(_("本当に", "Try"), k))
3465 /* Allow player to "refuse" certain actions */
3466 if (!get_item_allow(k))
3472 /* Accept that choice */
3483 /* Fix the screen if necessary */
3489 /* Hack -- Cancel "display" */
3490 command_see = FALSE;
3494 /* Forget the item_tester_tval restriction */
3495 item_tester_tval = 0;
3497 item_tester_no_ryoute = FALSE;
3499 /* Forget the item_tester_hook restriction */
3500 item_tester_hook = NULL;
3503 /* Clean up 'show choices' */
3504 /* Toggle again if needed */
3505 if (toggle) toggle_inven_equip();
3508 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3513 /* Clear the prompt line */
3516 /* Warning if needed */
3517 if (oops && str) msg_print(str);
3522 if (command_cmd) prev_tag = cur_tag;
3523 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3529 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3530 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3531 * @param y 走査するフロアのY座標
3532 * @param x 走査するフロアのX座標
3533 * @param mode オプションフラグ
3534 * @return 対象のマスに落ちているアイテム数
3536 * Return a list of o_list[] indexes of items at the given cave
3537 * location. Valid flags are:
3539 * mode & 0x01 -- Item tester
3540 * mode & 0x02 -- Marked items only
3541 * mode & 0x04 -- Stop after first
3543 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3545 OBJECT_IDX this_o_idx, next_o_idx;
3547 ITEM_NUMBER num = 0;
3550 if (!in_bounds(y, x)) return 0;
3552 /* Scan all objects in the grid */
3553 for (this_o_idx = cave[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3557 /* Acquire object */
3558 o_ptr = &o_list[this_o_idx];
3560 /* Acquire next object */
3561 next_o_idx = o_ptr->next_o_idx;
3564 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3567 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3569 /* Accept this item */
3570 /* XXX Hack -- Enforce limit */
3572 items[num] = this_o_idx;
3577 if (mode & 0x04) break;
3584 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3585 * @param target_item カーソルの初期値
3586 * @param y 走査するフロアのY座標
3587 * @param x 走査するフロアのX座標
3588 * @param min_width 表示の長さ
3589 * @return 選択したアイテムの添え字
3592 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3600 char o_name[MAX_NLEN];
3603 COMMAND_CODE out_index[23];
3604 TERM_COLOR out_color[23];
3605 char out_desc[23][MAX_NLEN];
3606 COMMAND_CODE target_item_label = 0;
3608 OBJECT_IDX floor_list[23];
3609 ITEM_NUMBER floor_num;
3611 char floor_label[52 + 1];
3613 bool dont_need_to_show_weights = TRUE;
3615 Term_get_size(&wid, &hgt);
3617 /* Default length */
3618 len = MAX((*min_width), 20);
3621 /* Scan for objects in the grid, using item_tester_okay() */
3622 floor_num = scan_floor(floor_list, y, x, 0x03);
3624 /* Display the floor objects */
3625 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3627 o_ptr = &o_list[floor_list[i]];
3629 /* Describe the object */
3630 object_desc(o_name, o_ptr, 0);
3632 /* Save the index */
3635 /* Acquire inventory color */
3636 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3638 /* Save the object description */
3639 strcpy(out_desc[k], o_name);
3641 /* Find the predicted "line length" */
3642 l = strlen(out_desc[k]) + 5;
3644 /* Be sure to account for the weight */
3645 if (show_weights) l += 9;
3647 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3649 /* Maintain the maximum length */
3650 if (l > len) len = l;
3652 /* Advance to next "line" */
3656 if (show_weights && dont_need_to_show_weights) len -= 9;
3661 /* Find the column to start in */
3662 col = (len > wid - 4) ? 0 : (wid - len - 1);
3664 prepare_label_string_floor(floor_label, floor_list, floor_num);
3666 /* Output each entry */
3667 for (j = 0; j < k; j++)
3670 m = floor_list[out_index[j]];
3675 /* Clear the line */
3676 prt("", j + 1, col ? col - 2 : col);
3678 if (use_menu && target_item)
3680 if (j == (target_item-1))
3682 strcpy(tmp_val, _("》", "> "));
3683 target_item_label = m;
3685 else strcpy(tmp_val, " ");
3689 /* Prepare an index --(-- */
3690 sprintf(tmp_val, "%c)", floor_label[j]);
3693 /* Clear the line with the (possibly indented) index */
3694 put_str(tmp_val, j + 1, col);
3696 /* Display the entry itself */
3697 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3699 /* Display the weight if needed */
3700 if (show_weights && (o_ptr->tval != TV_GOLD))
3702 int wgt = o_ptr->weight * o_ptr->number;
3704 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3706 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3709 prt(tmp_val, j + 1, wid - 9);
3713 /* Make a "shadow" below the list (only if needed) */
3714 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3716 return target_item_label;
3720 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3721 * Let the user select an item, save its "index"
3722 * @param cp 選択したオブジェクトのIDを返す。
3723 * @param pmt 選択目的のメッセージ
3724 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3725 * @param mode オプションフラグ
3726 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3728 bool get_item_floor(COMMAND_CODE *cp, cptr pmt, cptr str, BIT_FLAGS mode)
3730 char n1 = ' ', n2 = ' ', which = ' ';
3733 COMMAND_CODE i1, i2;
3734 COMMAND_CODE e1, e2;
3742 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3743 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3744 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3746 bool allow_equip = FALSE;
3747 bool allow_inven = FALSE;
3748 bool allow_floor = FALSE;
3750 bool toggle = FALSE;
3755 ITEM_NUMBER floor_num;
3756 OBJECT_IDX floor_list[23];
3758 TERM_LEN min_width = 0;
3760 extern bool select_the_force;
3762 int menu_line = (use_menu ? 1 : 0);
3766 static char prev_tag = '\0';
3767 char cur_tag = '\0';
3769 /* Get the item index */
3770 if (repeat_pull(cp))
3773 if (select_the_force && (*cp == INVEN_FORCE))
3775 item_tester_tval = 0;
3776 item_tester_hook = NULL;
3777 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3782 else if (floor && (*cp < 0))
3784 if (prev_tag && command_cmd)
3786 /* Scan all objects in the grid */
3787 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3789 /* Look up the tag */
3790 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3792 /* Accept that choice */
3793 (*cp) = 0 - floor_list[k];
3795 /* Forget restrictions */
3796 item_tester_tval = 0;
3797 item_tester_hook = NULL;
3798 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3804 prev_tag = '\0'; /* prev_tag is no longer effective */
3807 /* Validate the item */
3808 else if (item_tester_okay(&o_list[0 - (*cp)]))
3810 /* Forget restrictions */
3811 item_tester_tval = 0;
3812 item_tester_hook = NULL;
3813 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3820 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3821 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3823 if (prev_tag && command_cmd)
3825 /* Look up the tag and validate the item */
3826 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3827 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3828 else if (!get_item_okay(k)) /* Reject */;
3831 /* Accept that choice */
3834 /* Forget restrictions */
3835 item_tester_tval = 0;
3836 item_tester_hook = NULL;
3837 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3843 prev_tag = '\0'; /* prev_tag is no longer effective */
3846 /* Verify the item */
3847 else if (get_item_okay(*cp))
3849 /* Forget restrictions */
3850 item_tester_tval = 0;
3851 item_tester_hook = NULL;
3852 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3868 /* No item selected */
3872 /* Full inventory */
3874 i2 = INVEN_PACK - 1;
3876 /* Forbid inventory */
3877 if (!inven) i2 = -1;
3880 for (j = 0; j < INVEN_PACK; j++)
3881 if (item_tester_okay(&inventory[j])) max_inven++;
3884 /* Restrict inventory indexes */
3885 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3886 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3889 /* Full equipment */
3891 e2 = INVEN_TOTAL - 1;
3893 /* Forbid equipment */
3894 if (!equip) e2 = -1;
3897 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3898 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
3899 if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
3902 /* Restrict equipment indexes */
3903 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3904 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3906 if (equip && p_ptr->ryoute && !item_tester_no_ryoute)
3910 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3912 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3916 /* Count "okay" floor items */
3919 /* Restrict floor usage */
3922 /* Scan all objects in the grid */
3923 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3926 /* Accept inventory */
3927 if (i1 <= i2) allow_inven = TRUE;
3929 /* Accept equipment */
3930 if (e1 <= e2) allow_equip = TRUE;
3933 if (floor_num) allow_floor = TRUE;
3935 /* Require at least one legal choice */
3936 if (!allow_inven && !allow_equip && !allow_floor)
3938 /* Cancel p_ptr->command_see */
3939 command_see = FALSE;
3945 if (select_the_force) {
3951 /* Analyze choices */
3954 /* Hack -- Start on equipment if requested */
3955 if (command_see && (command_wrk == (USE_EQUIP))
3958 command_wrk = (USE_EQUIP);
3961 /* Use inventory if allowed */
3962 else if (allow_inven)
3964 command_wrk = (USE_INVEN);
3967 /* Use equipment if allowed */
3968 else if (allow_equip)
3970 command_wrk = (USE_EQUIP);
3973 /* Use floor if allowed */
3974 else if (allow_floor)
3976 command_wrk = (USE_FLOOR);
3981 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
3983 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3985 /* Hack -- start out in "display" mode */
3992 /* Repeat until done */
3995 COMMAND_CODE get_item_label = 0;
4002 for (j = 0; j < 8; j++)
4005 if (!angband_term[j]) continue;
4007 /* Count windows displaying inven */
4008 if (window_flag[j] & (PW_INVEN)) ni++;
4010 /* Count windows displaying equip */
4011 if (window_flag[j] & (PW_EQUIP)) ne++;
4014 /* Toggle if needed */
4015 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
4016 (command_wrk == (USE_INVEN) && !ni && ne))
4019 toggle_inven_equip();
4026 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4028 /* Redraw windows */
4031 /* Inventory screen */
4032 if (command_wrk == (USE_INVEN))
4034 /* Extract the legal requests */
4038 /* Redraw if needed */
4039 if (command_see) get_item_label = show_inven(menu_line);
4042 /* Equipment screen */
4043 else if (command_wrk == (USE_EQUIP))
4045 /* Extract the legal requests */
4046 n1 = I2A(e1 - INVEN_RARM);
4047 n2 = I2A(e2 - INVEN_RARM);
4049 /* Redraw if needed */
4050 if (command_see) get_item_label = show_equip(menu_line);
4054 else if (command_wrk == (USE_FLOOR))
4057 k = MIN(floor_top + 23, floor_num) - 1;
4059 /* Extract the legal requests */
4060 n1 = I2A(j - floor_top);
4061 n2 = I2A(k - floor_top);
4063 /* Redraw if needed */
4064 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
4067 /* Viewing inventory */
4068 if (command_wrk == (USE_INVEN))
4070 /* Begin the prompt */
4071 sprintf(out_val, _("持ち物:", "Inven:"));
4075 /* Build the prompt */
4076 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4077 index_to_label(i1), index_to_label(i2));
4080 strcat(out_val, tmp_val);
4083 /* Indicate ability to "view" */
4084 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4091 strcat(out_val, " '/' 装備品,");
4092 else if (allow_floor)
4093 strcat(out_val, " '6' 装備品,");
4095 strcat(out_val, " '4'or'6' 装備品,");
4098 strcat(out_val, " / for Equip,");
4099 else if (allow_floor)
4100 strcat(out_val, " 6 for Equip,");
4102 strcat(out_val, " 4 or 6 for Equip,");
4111 strcat(out_val, " '-'床上,");
4112 else if (allow_equip)
4113 strcat(out_val, " '4' 床上,");
4115 strcat(out_val, " '4'or'6' 床上,");
4118 strcat(out_val, " - for floor,");
4119 else if (allow_equip)
4120 strcat(out_val, " 4 for floor,");
4122 strcat(out_val, " 4 or 6 for floor,");
4127 /* Viewing equipment */
4128 else if (command_wrk == (USE_EQUIP))
4130 /* Begin the prompt */
4131 sprintf(out_val, _("装備品:", "Equip:"));
4135 /* Build the prompt */
4136 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4137 index_to_label(e1), index_to_label(e2));
4140 strcat(out_val, tmp_val);
4143 /* Indicate ability to "view" */
4144 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4151 strcat(out_val, " '/' 持ち物,");
4152 else if (allow_floor)
4153 strcat(out_val, " '4' 持ち物,");
4155 strcat(out_val, " '4'or'6' 持ち物,");
4158 strcat(out_val, " / for Inven,");
4159 else if (allow_floor)
4160 strcat(out_val, " 4 for Inven,");
4162 strcat(out_val, " 4 or 6 for Inven,");
4171 strcat(out_val, " '-'床上,");
4172 else if (allow_inven)
4173 strcat(out_val, " '6' 床上,");
4175 strcat(out_val, " '4'or'6' 床上,");
4178 strcat(out_val, " - for floor,");
4179 else if (allow_inven)
4180 strcat(out_val, " 6 for floor,");
4182 strcat(out_val, " 4 or 6 for floor,");
4188 else if (command_wrk == (USE_FLOOR))
4190 /* Begin the prompt */
4191 sprintf(out_val, _("床上:", "Floor:"));
4195 /* Build the prompt */
4196 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4199 strcat(out_val, tmp_val);
4202 /* Indicate ability to "view" */
4203 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4207 if (allow_inven && allow_equip)
4209 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4211 else if (allow_inven)
4213 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4215 else if (allow_equip)
4217 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4221 else if (allow_inven)
4223 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4225 else if (allow_equip)
4227 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4231 if (command_see && !use_menu)
4233 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4238 if (select_the_force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4240 /* Finish the prompt */
4241 strcat(out_val, " ESC");
4243 /* Build the prompt */
4244 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4246 /* Show the prompt */
4255 if (command_wrk == USE_INVEN) max_line = max_inven;
4256 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4257 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4273 menu_line += (max_line - 1);
4289 /* Verify legality */
4290 if (command_wrk == (USE_INVEN))
4292 if (allow_floor) command_wrk = USE_FLOOR;
4293 else if (allow_equip) command_wrk = USE_EQUIP;
4300 else if (command_wrk == (USE_EQUIP))
4302 if (allow_inven) command_wrk = USE_INVEN;
4303 else if (allow_floor) command_wrk = USE_FLOOR;
4310 else if (command_wrk == (USE_FLOOR))
4312 if (allow_equip) command_wrk = USE_EQUIP;
4313 else if (allow_inven) command_wrk = USE_INVEN;
4326 /* Hack -- Fix screen */
4336 /* Switch inven/equip */
4337 if (command_wrk == USE_INVEN) max_line = max_inven;
4338 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4339 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4340 if (menu_line > max_line) menu_line = max_line;
4342 /* Need to redraw */
4350 /* Verify legality */
4351 if (command_wrk == (USE_INVEN))
4353 if (allow_equip) command_wrk = USE_EQUIP;
4354 else if (allow_floor) command_wrk = USE_FLOOR;
4361 else if (command_wrk == (USE_EQUIP))
4363 if (allow_floor) command_wrk = USE_FLOOR;
4364 else if (allow_inven) command_wrk = USE_INVEN;
4371 else if (command_wrk == (USE_FLOOR))
4373 if (allow_inven) command_wrk = USE_INVEN;
4374 else if (allow_equip) command_wrk = USE_EQUIP;
4387 /* Hack -- Fix screen */
4397 /* Switch inven/equip */
4398 if (command_wrk == USE_INVEN) max_line = max_inven;
4399 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4400 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4401 if (menu_line > max_line) menu_line = max_line;
4403 /* Need to redraw */
4412 if (command_wrk == USE_FLOOR)
4415 (*cp) = -get_item_label;
4419 /* Validate the item */
4420 if (!get_item_okay(get_item_label))
4426 /* Allow player to "refuse" certain actions */
4427 if (!get_item_allow(get_item_label))
4433 /* Accept that choice */
4434 (*cp) = get_item_label;
4443 if (select_the_force) {
4451 if (menu_line > max_line) menu_line -= max_line;
4472 command_see = FALSE;
4496 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
4498 if (command_wrk != (USE_FLOOR)) break;
4500 /* Get the object being moved. */
4501 o_idx = c_ptr->o_idx;
4503 /* Only rotate a pile of two or more objects. */
4504 if (!(o_idx && o_list[o_idx].next_o_idx)) break;
4506 /* Remove the first object from the list. */
4507 excise_object_idx(o_idx);
4509 /* Find end of the list. */
4511 while (o_list[i].next_o_idx)
4512 i = o_list[i].next_o_idx;
4514 /* Add after the last object. */
4515 o_list[i].next_o_idx = o_idx;
4517 /* Re-scan floor list */
4518 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4520 /* Hack -- Fix screen */
4535 if (command_wrk == (USE_INVEN))
4542 command_wrk = (USE_EQUIP);
4544 else if (command_wrk == (USE_EQUIP))
4551 command_wrk = (USE_INVEN);
4553 else if (command_wrk == (USE_FLOOR))
4557 command_wrk = (USE_INVEN);
4559 else if (allow_equip)
4561 command_wrk = (USE_EQUIP);
4570 /* Hack -- Fix screen */
4580 /* Need to redraw */
4593 * If we are already examining the floor, and there
4594 * is only one item, we will always select it.
4595 * If we aren't examining the floor and there is only
4596 * one item, we will select it if floor_query_flag
4601 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4604 k = 0 - floor_list[0];
4606 /* Allow player to "refuse" certain actions */
4607 if (!get_item_allow(k))
4613 /* Accept that choice */
4622 /* Hack -- Fix screen */
4632 command_wrk = (USE_FLOOR);
4638 case '1': case '2': case '3':
4639 case '4': case '5': case '6':
4640 case '7': case '8': case '9':
4642 if (command_wrk != USE_FLOOR)
4644 /* Look up the tag */
4645 if (!get_tag(&k, which, command_wrk))
4651 /* Hack -- Validate the item */
4652 if ((k < INVEN_RARM) ? !inven : !equip)
4658 /* Validate the item */
4659 if (!get_item_okay(k))
4667 /* Look up the alphabetical tag */
4668 if (get_tag_floor(&k, which, floor_list, floor_num))
4671 k = 0 - floor_list[k];
4680 /* Allow player to "refuse" certain actions */
4681 if (!get_item_allow(k))
4687 /* Accept that choice */
4699 /* Choose "default" inventory item */
4700 if (command_wrk == (USE_INVEN))
4702 k = ((i1 == i2) ? i1 : -1);
4705 /* Choose "default" equipment item */
4706 else if (command_wrk == (USE_EQUIP))
4708 k = ((e1 == e2) ? e1 : -1);
4711 /* Choose "default" floor item */
4712 else if (command_wrk == (USE_FLOOR))
4717 k = 0 - floor_list[0];
4719 /* Allow player to "refuse" certain actions */
4720 if (!get_item_allow(k))
4726 /* Accept that choice */
4734 /* Validate the item */
4735 if (!get_item_okay(k))
4741 /* Allow player to "refuse" certain actions */
4742 if (!get_item_allow(k))
4748 /* Accept that choice */
4758 if (select_the_force) {
4772 if (command_wrk != USE_FLOOR)
4774 bool not_found = FALSE;
4776 /* Look up the alphabetical tag */
4777 if (!get_tag(&k, which, command_wrk))
4782 /* Hack -- Validate the item */
4783 else if ((k < INVEN_RARM) ? !inven : !equip)
4788 /* Validate the item */
4789 else if (!get_item_okay(k))
4796 /* Accept that choice */
4806 /* Look up the alphabetical tag */
4807 if (get_tag_floor(&k, which, floor_list, floor_num))
4810 k = 0 - floor_list[k];
4812 /* Accept that choice */
4821 /* Extract "query" setting */
4822 ver = isupper(which);
4823 which = (char)tolower(which);
4825 /* Convert letter to inventory index */
4826 if (command_wrk == (USE_INVEN))
4828 if (which == '(') k = i1;
4829 else if (which == ')') k = i2;
4830 else k = label_to_inven(which);
4833 /* Convert letter to equipment index */
4834 else if (command_wrk == (USE_EQUIP))
4836 if (which == '(') k = e1;
4837 else if (which == ')') k = e2;
4838 else k = label_to_equip(which);
4841 /* Convert letter to floor index */
4842 else if (command_wrk == USE_FLOOR)
4844 if (which == '(') k = 0;
4845 else if (which == ')') k = floor_num - 1;
4846 else k = islower(which) ? A2I(which) : -1;
4847 if (k < 0 || k >= floor_num || k >= 23)
4854 k = 0 - floor_list[k];
4857 /* Validate the item */
4858 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4864 /* Verify the item */
4865 if (ver && !verify(_("本当に", "Try"), k))
4871 /* Allow player to "refuse" certain actions */
4872 if (!get_item_allow(k))
4878 /* Accept that choice */
4888 /* Fix the screen if necessary */
4894 /* Hack -- Cancel "display" */
4895 command_see = FALSE;
4899 /* Forget the item_tester_tval restriction */
4900 item_tester_tval = 0;
4902 /* Forget the item_tester_hook restriction */
4903 item_tester_hook = NULL;
4906 /* Clean up 'show choices' */
4907 /* Toggle again if needed */
4908 if (toggle) toggle_inven_equip();
4911 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4916 /* Clear the prompt line */
4919 /* Warning if needed */
4920 if (oops && str) msg_print(str);
4925 if (command_cmd) prev_tag = cur_tag;
4926 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4932 * @brief 床上のアイテムを拾う選択用サブルーチン
4933 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4935 static bool py_pickup_floor_aux(void)
4937 OBJECT_IDX this_o_idx;
4943 /* Restrict the choices */
4944 item_tester_hook = inven_carry_okay;
4947 q = _("どれを拾いますか?", "Get which item? ");
4948 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
4950 if (get_item(&item, q, s, (USE_FLOOR)))
4952 this_o_idx = 0 - item;
4959 /* Pick up the object */
4960 py_pickup_aux(this_o_idx);
4966 * @brief 床上のアイテムを拾うメイン処理
4967 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
4970 * This is called by py_pickup() when easy_floor is TRUE.
4972 void py_pickup_floor(bool pickup)
4974 OBJECT_IDX this_o_idx, next_o_idx = 0;
4976 char o_name[MAX_NLEN];
4980 OBJECT_IDX floor_o_idx = 0;
4984 /* Scan the pile of objects */
4985 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
4987 /* Access the object */
4988 o_ptr = &o_list[this_o_idx];
4990 /* Describe the object */
4991 object_desc(o_name, o_ptr, 0);
4993 /* Access the next object */
4994 next_o_idx = o_ptr->next_o_idx;
4996 /* Hack -- disturb */
4997 disturb(FALSE, FALSE);
5000 if (o_ptr->tval == TV_GOLD)
5003 msg_format(" $%ld の価値がある%sを見つけた。",
5004 (long)o_ptr->pval, o_name);
5006 msg_format("You have found %ld gold pieces worth of %s.",
5007 (long)o_ptr->pval, o_name);
5010 /* Collect the gold */
5011 p_ptr->au += o_ptr->pval;
5014 p_ptr->redraw |= (PR_GOLD);
5016 p_ptr->window |= (PW_PLAYER);
5018 /* Delete the gold */
5019 delete_object_idx(this_o_idx);
5021 /* Check the next object */
5024 else if (o_ptr->marked & OM_NOMSG)
5026 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
5027 * ignored. Otherwise, they are included in the prompt. */
5028 o_ptr->marked &= ~(OM_NOMSG);
5032 /* Count non-gold objects that can be picked up. */
5033 if (inven_carry_okay(o_ptr))
5038 /* Count non-gold objects */
5041 /* Remember this index */
5042 floor_o_idx = this_o_idx;
5045 /* There are no non-gold objects */
5049 /* Mention the number of objects */
5055 /* Access the object */
5056 o_ptr = &o_list[floor_o_idx];
5058 #ifdef ALLOW_EASY_SENSE
5060 /* Option: Make object sensing easy */
5063 /* Sense the object */
5064 (void) sense_object(o_ptr);
5067 #endif /* ALLOW_EASY_SENSE */
5069 /* Describe the object */
5070 object_desc(o_name, o_ptr, 0);
5072 msg_format(_("%sがある。", "You see %s."), o_name);
5075 /* Multiple objects */
5078 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
5084 /* The player has no room for anything on the floor. */
5090 /* Access the object */
5091 o_ptr = &o_list[floor_o_idx];
5093 #ifdef ALLOW_EASY_SENSE
5095 /* Option: Make object sensing easy */
5098 /* Sense the object */
5099 (void) sense_object(o_ptr);
5102 #endif /* ALLOW_EASY_SENSE */
5104 /* Describe the object */
5105 object_desc(o_name, o_ptr, 0);
5107 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
5110 /* Multiple objects */
5113 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
5123 /* Hack -- query every object */
5124 if (carry_query_flag)
5126 char out_val[MAX_NLEN+20];
5128 /* Access the object */
5129 o_ptr = &o_list[floor_o_idx];
5131 #ifdef ALLOW_EASY_SENSE
5133 /* Option: Make object sensing easy */
5136 /* Sense the object */
5137 (void) sense_object(o_ptr);
5140 #endif /* ALLOW_EASY_SENSE */
5142 /* Describe the object */
5143 object_desc(o_name, o_ptr, 0);
5145 /* Build a prompt */
5146 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
5148 /* Ask the user to confirm */
5149 if (!get_check(out_val))
5155 /* Access the object */
5156 o_ptr = &o_list[floor_o_idx];
5158 #ifdef ALLOW_EASY_SENSE
5160 /* Option: Make object sensing easy */
5163 /* Sense the object */
5164 (void) sense_object(o_ptr);
5167 #endif /* ALLOW_EASY_SENSE */
5169 /* Pick up the object */
5170 py_pickup_aux(floor_o_idx);
5173 /* Allow the user to choose an object */
5176 while (can_pickup--)
5178 if (!py_pickup_floor_aux()) break;