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. XXX XXX XXX\n
34 * The "prefs" parameter is no longer meaningful. XXX XXX XXX\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, u32b 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, u32b 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 u32b 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 u32b 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.");
502 return _("何も起きない", "Nothing");
507 * @brief オブジェクトの*鑑定*内容を詳述して表示する /
508 * Describe a "fully identified" item
509 * @param o_ptr *鑑定*情報を取得する元のオブジェクト構造体参照ポインタ
510 * @param mode 表示オプション
511 * @return 特筆すべき情報が一つでもあった場合TRUE、一つもなく表示がキャンセルされた場合FALSEを返す。
513 bool screen_object(object_type *o_ptr, BIT_FLAGS mode)
517 u32b flgs[TR_FLAG_SIZE];
521 char o_name[MAX_NLEN];
526 int trivial_info = 0;
528 /* Extract the flags */
529 object_flags(o_ptr, flgs);
531 /* Extract the description */
533 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
534 (k_text + k_info[o_ptr->k_idx].text),
535 77 - 15, temp, sizeof(temp));
536 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
537 { info[i] = &temp[j]; i++;}
540 if (object_is_equipment(o_ptr))
542 /* Descriptions of a basic equipment is just a flavor */
546 /* Mega-Hack -- describe activation */
547 if (have_flag(flgs, TR_ACTIVATE))
549 info[i++] = _("始動したときの効果...", "It can be activated for...");
550 info[i++] = item_activation(o_ptr);
551 info[i++] = _("...ただし装備していなければならない。", "...if it is being worn.");
554 /* Figurines, a hack */
555 if (o_ptr->tval == TV_FIGURINE)
557 info[i++] = _("それは投げた時ペットに変化する。", "It will transform into a pet when thrown.");
560 /* Figurines, a hack */
561 if (o_ptr->name1 == ART_STONEMASK)
563 info[i++] = _("それを装備した者は吸血鬼になる。", "It makes you turn into a vampire permanently.");
566 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
568 info[i++] = _("それは相手を一撃で倒すことがある。", "It will attempt to kill a monster instantly.");
571 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
573 info[i++] = _("それは自分自身に攻撃が返ってくることがある。", "It causes you to strike yourself sometimes.");
574 info[i++] = _("それは無敵のバリアを切り裂く。", "It always penetrates invulnerability barriers.");
577 if (o_ptr->name2 == EGO_2WEAPON)
579 info[i++] = _("それは二刀流での命中率を向上させる。", "It affects your ability to hit when you are wielding two weapons.");
582 if (have_flag(flgs, TR_EASY_SPELL))
584 info[i++] = _("それは魔法の難易度を下げる。", "It affects your ability to cast spells.");
587 if (o_ptr->name2 == EGO_AMU_FOOL)
589 info[i++] = _("それは魔法の難易度を上げる。", "It interferes with casting spells.");
592 if (o_ptr->name2 == EGO_RING_THROW)
594 info[i++] = _("それは物を強く投げることを可能にする。", "It provides great strength when you throw an item.");
597 if (o_ptr->name2 == EGO_AMU_NAIVETY)
599 info[i++] = _("それは魔法抵抗力を下げる。", "It decreases your magic resistance.");
602 if (o_ptr->tval == TV_STATUE)
604 monster_race *r_ptr = &r_info[o_ptr->pval];
606 if (o_ptr->pval == MON_BULLGATES)
607 info[i++] = _("それは部屋に飾ると恥ずかしい。", "It is shameful.");
608 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
609 info[i++] = _("それは部屋に飾ると恐い。", "It is fearful.");
611 info[i++] = _("それは部屋に飾ると楽しい。", "It is cheerful.");
614 /* Hack -- describe lite's */
616 if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("それは全く光らない。", "It provides no light.");
619 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
620 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
621 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
622 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
623 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
624 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
626 if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
628 if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
630 if(rad > 0) sprintf(desc, _("それは燃料補給によって明かり(半径 %d)を授ける。", "It provides light (radius %d) when fueled."), (int)rad);
634 if(rad > 0) sprintf(desc, _("それは永遠なる明かり(半径 %d)を授ける。", "It provides light (radius %d) forever."), (int)rad);
635 if(rad < 0) sprintf(desc, _("それは明かりの半径を狭める(半径に-%d)。", "It decreases radius of light source by %d."), (int)-rad);
638 if(rad != 0) info[i++] = desc;
641 if (o_ptr->name2 == EGO_LITE_LONG)
643 info[i++] = _("それは長いターン明かりを授ける。", "It provides light for much longer time.");
646 /* And then describe it fully */
648 if (have_flag(flgs, TR_RIDING))
650 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
651 info[i++] = _("それは乗馬中は非常に使いやすい。", "It is made for use while riding.");
654 info[i++] = _("それは乗馬中でも使いやすい。", "It is suitable for use while riding.");
655 /* This information is not important enough */
659 if (have_flag(flgs, TR_STR))
661 info[i++] = _("それは腕力に影響を及ぼす。", "It affects your strength.");
663 if (have_flag(flgs, TR_INT))
665 info[i++] = _("それは知能に影響を及ぼす。", "It affects your intelligence.");
667 if (have_flag(flgs, TR_WIS))
669 info[i++] = _("それは賢さに影響を及ぼす。", "It affects your wisdom.");
671 if (have_flag(flgs, TR_DEX))
673 info[i++] = _("それは器用さに影響を及ぼす。", "It affects your dexterity.");
675 if (have_flag(flgs, TR_CON))
677 info[i++] = _("それは耐久力に影響を及ぼす。", "It affects your constitution.");
679 if (have_flag(flgs, TR_CHR))
681 info[i++] = _("それは魅力に影響を及ぼす。", "It affects your charisma.");
684 if (have_flag(flgs, TR_MAGIC_MASTERY))
686 info[i++] = _("それは魔法道具使用能力に影響を及ぼす。", "It affects your ability to use magic devices.");
689 if (have_flag(flgs, TR_STEALTH))
691 info[i++] = _("それは隠密行動能力に影響を及ぼす。", "It affects your stealth.");
693 if (have_flag(flgs, TR_SEARCH))
695 info[i++] = _("それは探索能力に影響を及ぼす。", "It affects your searching.");
697 if (have_flag(flgs, TR_INFRA))
699 info[i++] = _("それは赤外線視力に影響を及ぼす。", "It affects your infravision.");
701 if (have_flag(flgs, TR_TUNNEL))
703 info[i++] = _("それは採掘能力に影響を及ぼす。", "It affects your ability to tunnel.");
705 if (have_flag(flgs, TR_SPEED))
707 info[i++] = _("それはスピードに影響を及ぼす。", "It affects your speed.");
709 if (have_flag(flgs, TR_BLOWS))
711 info[i++] = _("それは打撃回数に影響を及ぼす。", "It affects your attack speed.");
714 if (have_flag(flgs, TR_BRAND_ACID))
716 info[i++] = _("それは酸によって大きなダメージを与える。", "It does extra damage from acid.");
718 if (have_flag(flgs, TR_BRAND_ELEC))
720 info[i++] = _("それは電撃によって大きなダメージを与える。", "It does extra damage from electricity.");
722 if (have_flag(flgs, TR_BRAND_FIRE))
724 info[i++] = _("それは火炎によって大きなダメージを与える。", "It does extra damage from fire.");
726 if (have_flag(flgs, TR_BRAND_COLD))
728 info[i++] = _("それは冷気によって大きなダメージを与える。", "It does extra damage from frost.");
731 if (have_flag(flgs, TR_BRAND_POIS))
733 info[i++] = _("それは敵を毒する。", "It poisons your foes.");
736 if (have_flag(flgs, TR_CHAOTIC))
738 info[i++] = _("それはカオス的な効果を及ぼす。", "It produces chaotic effects.");
741 if (have_flag(flgs, TR_VAMPIRIC))
743 info[i++] = _("それは敵から生命力を吸収する。", "It drains life from your foes.");
746 if (have_flag(flgs, TR_IMPACT))
748 info[i++] = _("それは地震を起こすことができる。", "It can cause earthquakes.");
751 if (have_flag(flgs, TR_VORPAL))
753 info[i++] = _("それは非常に切れ味が鋭く敵を切断することができる。", "It is very sharp and can cut your foes.");
756 if (have_flag(flgs, TR_KILL_DRAGON))
758 info[i++] = _("それはドラゴンにとっての天敵である。", "It is a great bane of dragons.");
760 else if (have_flag(flgs, TR_SLAY_DRAGON))
762 info[i++] = _("それはドラゴンに対して特に恐るべき力を発揮する。", "It is especially deadly against dragons.");
765 if (have_flag(flgs, TR_KILL_ORC))
767 info[i++] = _("それはオークにとっての天敵である。", "It is a great bane of orcs.");
769 if (have_flag(flgs, TR_SLAY_ORC))
771 info[i++] = _("それはオークに対して特に恐るべき力を発揮する。", "It is especially deadly against orcs.");
774 if (have_flag(flgs, TR_KILL_TROLL))
776 info[i++] = _("それはトロルにとっての天敵である。", "It is a great bane of trolls.");
778 if (have_flag(flgs, TR_SLAY_TROLL))
780 info[i++] = _("それはトロルに対して特に恐るべき力を発揮する。", "It is especially deadly against trolls.");
783 if (have_flag(flgs, TR_KILL_GIANT))
785 info[i++] = _("それは巨人にとっての天敵である。", "It is a great bane of giants.");
787 else if (have_flag(flgs, TR_SLAY_GIANT))
789 info[i++] = _("それはジャイアントに対して特に恐るべき力を発揮する。", "It is especially deadly against giants.");
792 if (have_flag(flgs, TR_KILL_DEMON))
794 info[i++] = _("それはデーモンにとっての天敵である。", "It is a great bane of demons.");
796 if (have_flag(flgs, TR_SLAY_DEMON))
798 info[i++] = _("それはデーモンに対して聖なる力を発揮する。", "It strikes at demons with holy wrath.");
801 if (have_flag(flgs, TR_KILL_UNDEAD))
803 info[i++] = _("それはアンデッドにとっての天敵である。", "It is a great bane of undead.");
805 if (have_flag(flgs, TR_SLAY_UNDEAD))
807 info[i++] = _("それはアンデッドに対して聖なる力を発揮する。", "It strikes at undead with holy wrath.");
810 if (have_flag(flgs, TR_KILL_EVIL))
812 info[i++] = _("それは邪悪なる存在にとっての天敵である。", "It is a great bane of evil monsters.");
814 if (have_flag(flgs, TR_SLAY_EVIL))
816 info[i++] = _("それは邪悪なる存在に対して聖なる力で攻撃する。", "It fights against evil with holy fury.");
819 if (have_flag(flgs, TR_KILL_ANIMAL))
821 info[i++] = _("それは自然界の動物にとっての天敵である。", "It is a great bane of natural creatures.");
823 if (have_flag(flgs, TR_SLAY_ANIMAL))
825 info[i++] = _("それは自然界の動物に対して特に恐るべき力を発揮する。", "It is especially deadly against natural creatures.");
828 if (have_flag(flgs, TR_KILL_HUMAN))
830 info[i++] = _("それは人間にとっての天敵である。", "It is a great bane of humans.");
832 if (have_flag(flgs, TR_SLAY_HUMAN))
834 info[i++] = _("それは人間に対して特に恐るべき力を発揮する。", "It is especially deadly against humans.");
837 if (have_flag(flgs, TR_FORCE_WEAPON))
839 info[i++] = _("それは使用者の魔力を使って攻撃する。", "It powerfully strikes at a monster using your mana.");
841 if (have_flag(flgs, TR_DEC_MANA))
843 info[i++] = _("それは魔力の消費を押さえる。", "It decreases your mana consumption.");
845 if (have_flag(flgs, TR_SUST_STR))
847 info[i++] = _("それはあなたの腕力を維持する。", "It sustains your strength.");
849 if (have_flag(flgs, TR_SUST_INT))
851 info[i++] = _("それはあなたの知能を維持する。", "It sustains your intelligence.");
853 if (have_flag(flgs, TR_SUST_WIS))
855 info[i++] = _("それはあなたの賢さを維持する。", "It sustains your wisdom.");
857 if (have_flag(flgs, TR_SUST_DEX))
859 info[i++] = _("それはあなたの器用さを維持する。", "It sustains your dexterity.");
861 if (have_flag(flgs, TR_SUST_CON))
863 info[i++] = _("それはあなたの耐久力を維持する。", "It sustains your constitution.");
865 if (have_flag(flgs, TR_SUST_CHR))
867 info[i++] = _("それはあなたの魅力を維持する。", "It sustains your charisma.");
870 if (have_flag(flgs, TR_IM_ACID))
872 info[i++] = _("それは酸に対する完全な免疫を授ける。", "It provides immunity to acid.");
874 if (have_flag(flgs, TR_IM_ELEC))
876 info[i++] = _("それは電撃に対する完全な免疫を授ける。", "It provides immunity to electricity.");
878 if (have_flag(flgs, TR_IM_FIRE))
880 info[i++] = _("それは火に対する完全な免疫を授ける。", "It provides immunity to fire.");
882 if (have_flag(flgs, TR_IM_COLD))
884 info[i++] = _("それは寒さに対する完全な免疫を授ける。", "It provides immunity to cold.");
887 if (have_flag(flgs, TR_THROW))
889 info[i++] = _("それは敵に投げて大きなダメージを与えることができる。", "It is perfectly balanced for throwing.");
892 if (have_flag(flgs, TR_FREE_ACT))
894 info[i++] = _("それは麻痺に対する完全な免疫を授ける。", "It provides immunity to paralysis.");
896 if (have_flag(flgs, TR_HOLD_EXP))
898 info[i++] = _("それは経験値吸収に対する耐性を授ける。", "It provides resistance to experience draining.");
900 if (have_flag(flgs, TR_RES_FEAR))
902 info[i++] = _("それは恐怖への完全な耐性を授ける。", "It makes you completely fearless.");
904 if (have_flag(flgs, TR_RES_ACID))
906 info[i++] = _("それは酸への耐性を授ける。", "It provides resistance to acid.");
908 if (have_flag(flgs, TR_RES_ELEC))
910 info[i++] = _("それは電撃への耐性を授ける。", "It provides resistance to electricity.");
912 if (have_flag(flgs, TR_RES_FIRE))
914 info[i++] = _("それは火への耐性を授ける。", "It provides resistance to fire.");
916 if (have_flag(flgs, TR_RES_COLD))
918 info[i++] = _("それは寒さへの耐性を授ける。", "It provides resistance to cold.");
920 if (have_flag(flgs, TR_RES_POIS))
922 info[i++] = _("それは毒への耐性を授ける。", "It provides resistance to poison.");
925 if (have_flag(flgs, TR_RES_LITE))
927 info[i++] = _("それは閃光への耐性を授ける。", "It provides resistance to light.");
929 if (have_flag(flgs, TR_RES_DARK))
931 info[i++] = _("それは暗黒への耐性を授ける。", "It provides resistance to dark.");
934 if (have_flag(flgs, TR_RES_BLIND))
936 info[i++] = _("それは盲目への耐性を授ける。", "It provides resistance to blindness.");
938 if (have_flag(flgs, TR_RES_CONF))
940 info[i++] = _("それは混乱への耐性を授ける。", "It provides resistance to confusion.");
942 if (have_flag(flgs, TR_RES_SOUND))
944 info[i++] = _("それは轟音への耐性を授ける。", "It provides resistance to sound.");
946 if (have_flag(flgs, TR_RES_SHARDS))
948 info[i++] = _("それは破片への耐性を授ける。", "It provides resistance to shards.");
951 if (have_flag(flgs, TR_RES_NETHER))
953 info[i++] = _("それは地獄への耐性を授ける。", "It provides resistance to nether.");
955 if (have_flag(flgs, TR_RES_NEXUS))
957 info[i++] = _("それは因果混乱への耐性を授ける。", "It provides resistance to nexus.");
959 if (have_flag(flgs, TR_RES_CHAOS))
961 info[i++] = _("それはカオスへの耐性を授ける。", "It provides resistance to chaos.");
963 if (have_flag(flgs, TR_RES_DISEN))
965 info[i++] = _("それは劣化への耐性を授ける。", "It provides resistance to disenchantment.");
968 if (have_flag(flgs, TR_LEVITATION))
970 info[i++] = _("それは宙に浮くことを可能にする。", "It allows you to levitate.");
973 if (have_flag(flgs, TR_SEE_INVIS))
975 info[i++] = _("それは透明なモンスターを見ることを可能にする。", "It allows you to see invisible monsters.");
977 if (have_flag(flgs, TR_TELEPATHY))
979 info[i++] = _("それはテレパシー能力を授ける。", "It gives telepathic powers.");
981 if (have_flag(flgs, TR_ESP_ANIMAL))
983 info[i++] = _("それは自然界の生物を感知する。", "It senses natural creatures.");
985 if (have_flag(flgs, TR_ESP_UNDEAD))
987 info[i++] = _("それはアンデッドを感知する。", "It senses undead.");
989 if (have_flag(flgs, TR_ESP_DEMON))
991 info[i++] = _("それは悪魔を感知する。", "It senses demons.");
993 if (have_flag(flgs, TR_ESP_ORC))
995 info[i++] = _("それはオークを感知する。", "It senses orcs.");
997 if (have_flag(flgs, TR_ESP_TROLL))
999 info[i++] = _("それはトロルを感知する。", "It senses trolls.");
1001 if (have_flag(flgs, TR_ESP_GIANT))
1003 info[i++] = _("それは巨人を感知する。", "It senses giants.");
1005 if (have_flag(flgs, TR_ESP_DRAGON))
1007 info[i++] = _("それはドラゴンを感知する。", "It senses dragons.");
1009 if (have_flag(flgs, TR_ESP_HUMAN))
1011 info[i++] = _("それは人間を感知する。", "It senses humans.");
1013 if (have_flag(flgs, TR_ESP_EVIL))
1015 info[i++] = _("それは邪悪な存在を感知する。", "It senses evil creatures.");
1017 if (have_flag(flgs, TR_ESP_GOOD))
1019 info[i++] = _("それは善良な存在を感知する。", "It senses good creatures.");
1021 if (have_flag(flgs, TR_ESP_NONLIVING))
1023 info[i++] = _("それは活動する無生物体を感知する。", "It senses non-living creatures.");
1025 if (have_flag(flgs, TR_ESP_UNIQUE))
1027 info[i++] = _("それは特別な強敵を感知する。", "It senses unique monsters.");
1029 if (have_flag(flgs, TR_SLOW_DIGEST))
1031 info[i++] = _("それはあなたの新陳代謝を遅くする。", "It slows your metabolism.");
1033 if (have_flag(flgs, TR_REGEN))
1035 info[i++] = _("それは体力回復力を強化する。", "It speeds your regenerative powers.");
1037 if (have_flag(flgs, TR_WARNING))
1039 info[i++] = _("それは危険に対して警告を発する。", "It warns you of danger");
1041 if (have_flag(flgs, TR_REFLECT))
1043 info[i++] = _("それは矢の呪文を反射する。", "It reflects bolt spells.");
1045 if (have_flag(flgs, TR_SH_FIRE))
1047 info[i++] = _("それは炎のバリアを張る。", "It produces a fiery sheath.");
1049 if (have_flag(flgs, TR_SH_ELEC))
1051 info[i++] = _("それは電気のバリアを張る。", "It produces an electric sheath.");
1053 if (have_flag(flgs, TR_SH_COLD))
1055 info[i++] = _("それは冷気のバリアを張る。", "It produces a sheath of coldness.");
1057 if (have_flag(flgs, TR_NO_MAGIC))
1059 info[i++] = _("それは反魔法バリアを張る。", "It produces an anti-magic shell.");
1061 if (have_flag(flgs, TR_NO_TELE))
1063 info[i++] = _("それはテレポートを邪魔する。", "It prevents teleportation.");
1065 if (have_flag(flgs, TR_XTRA_MIGHT))
1067 info[i++] = _("それは矢/ボルト/弾をより強力に発射することができる。", "It fires missiles with extra might.");
1069 if (have_flag(flgs, TR_XTRA_SHOTS))
1071 info[i++] = _("それは矢/ボルト/弾を非常に早く発射することができる。", "It fires missiles excessively fast.");
1074 if (have_flag(flgs, TR_BLESSED))
1076 info[i++] = _("それは神に祝福されている。", "It has been blessed by the gods.");
1079 if (object_is_cursed(o_ptr))
1081 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1083 info[i++] = _("それは永遠の呪いがかけられている。", "It is permanently cursed.");
1085 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1087 info[i++] = _("それは強力な呪いがかけられている。", "It is heavily cursed.");
1091 info[i++] = _("それは呪われている。", "It is cursed.");
1094 * It's a trivial infomation since there is
1095 * fake inscription {cursed}
1101 if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1103 info[i++] = _("それは太古の禍々しい怨念が宿っている。", "It carries an ancient foul curse.");
1105 if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1107 info[i++] = _("それは付近のモンスターを怒らせる。", "It aggravates nearby creatures.");
1109 if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1111 info[i++] = _("それは経験値を吸い取る。", "It drains experience.");
1113 if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1115 info[i++] = _("それは回復力を弱める。", "It slows your regenerative powers.");
1117 if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1119 info[i++] = _("それは弱い呪いを増やす。","It adds weak curses.");
1121 if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1123 info[i++] = _("それは強力な呪いを増やす。","It adds heavy curses.");
1125 if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1127 info[i++] = _("それは動物を呼び寄せる。", "It attracts animals.");
1129 if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1131 info[i++] = _("それは悪魔を呼び寄せる。", "It attracts demons.");
1133 if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1135 info[i++] = _("それはドラゴンを呼び寄せる。", "It attracts dragons.");
1137 if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1139 info[i++] = _("それは死霊を呼び寄せる。", "It attracts undeads.");
1141 if ((have_flag(flgs, TR_COWARDICE)) || (o_ptr->curse_flags & TRC_COWARDICE))
1143 info[i++] = _("それは恐怖感を引き起こす。", "It makes you subject to cowardice.");
1145 if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1147 info[i++] = _("それはランダムなテレポートを引き起こす。", "It induces random teleportation.");
1149 if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1151 info[i++] = _("それは攻撃を外しやすい。", "It causes you to miss blows.");
1153 if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1155 info[i++] = _("それは攻撃を受けやすい。", "It helps your enemies' blows.");
1157 if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1159 info[i++] = _("それは魔法を唱えにくくする。", "It encumbers you while spellcasting.");
1161 if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1163 info[i++] = _("それはあなたの新陳代謝を速くする。", "It speeds your metabolism.");
1165 if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1167 info[i++] = _("それはあなたの体力を吸い取る。", "It drains you.");
1169 if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1171 info[i++] = _("それはあなたの魔力を吸い取る。", "It drains your mana.");
1174 /* Describe about this kind of object instead of THIS fake object */
1175 if (mode & SCROBJ_FAKE_OBJECT)
1177 switch (o_ptr->tval)
1180 switch (o_ptr->sval)
1182 case SV_RING_LORDLY:
1183 info[i++] = _("それは幾つかのランダムな耐性を授ける。", "It provides some random resistances.");
1185 case SV_RING_WARNING:
1186 info[i++] = _("それはひとつの低級なESPを授ける事がある。", "It may provide a low rank ESP.");
1192 switch (o_ptr->sval)
1194 case SV_AMULET_RESISTANCE:
1195 info[i++] = _("それは毒への耐性を授ける事がある。", "It may provides resistance to poison.");
1196 info[i++] = _("それはランダムな耐性を授ける事がある。", "It may provide a random resistances.");
1198 case SV_AMULET_THE_MAGI:
1199 info[i++] = _("それは最大で3つまでの低級なESPを授ける。", "It provides up to three low rank ESPs.");
1206 if (have_flag(flgs, TR_IGNORE_ACID) &&
1207 have_flag(flgs, TR_IGNORE_ELEC) &&
1208 have_flag(flgs, TR_IGNORE_FIRE) &&
1209 have_flag(flgs, TR_IGNORE_COLD))
1211 info[i++] = _("それは酸・電撃・火炎・冷気では傷つかない。", "It cannot be harmed by the elements.");
1215 if (have_flag(flgs, TR_IGNORE_ACID))
1217 info[i++] = _("それは酸では傷つかない。", "It cannot be harmed by acid.");
1219 if (have_flag(flgs, TR_IGNORE_ELEC))
1221 info[i++] = _("それは電撃では傷つかない。", "It cannot be harmed by electricity.");
1223 if (have_flag(flgs, TR_IGNORE_FIRE))
1225 info[i++] = _("それは火炎では傷つかない。", "It cannot be harmed by fire.");
1227 if (have_flag(flgs, TR_IGNORE_COLD))
1229 info[i++] = _("それは冷気では傷つかない。", "It cannot be harmed by cold.");
1233 if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1235 /* No relevant informations */
1236 if (i <= trivial_info) return (FALSE);
1238 /* Save the screen */
1242 Term_get_size(&wid, &hgt);
1244 /* Display Item name */
1245 if (!(mode & SCROBJ_FAKE_OBJECT))
1246 object_desc(o_name, o_ptr, 0);
1248 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1252 /* Erase the screen */
1253 for (k = 1; k < hgt; k++) prt("", k, 13);
1255 /* Label the information */
1256 if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1258 monster_race *r_ptr = &r_info[o_ptr->pval];
1259 int namelen = strlen(r_name + r_ptr->name);
1260 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1261 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1262 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1266 prt(_(" アイテムの能力:", " Item Attributes:"), 1, 15);
1269 /* We will print on top of the map (column 13) */
1270 for (k = 2, j = 0; j < i; j++)
1273 prt(info[j], k++, 15);
1275 /* Every 20 entries (lines 2 to 21), start over */
1276 if ((k == hgt - 2) && (j+1 < i))
1278 prt(_("-- 続く --", "-- more --"), k, 15);
1280 for (; k > 2; k--) prt("", k, 15);
1285 prt(_("[何かキーを押すとゲームに戻ります]", "[Press any key to continue]"), k, 15);
1289 /* Restore the screen */
1292 /* Gave knowledge */
1299 * @brief オブジェクト選択時の選択アルファベットラベルを返す /
1300 * Convert an inventory index into a one character label
1301 * @param i プレイヤーの所持/装備オブジェクトID
1302 * @return 対応するアルファベット
1303 * @details Note that the label does NOT distinguish inven/equip.
1305 char index_to_label(int i)
1307 /* Indexes for "inven" are easy */
1308 if (i < INVEN_RARM) return (I2A(i));
1310 /* Indexes for "equip" are offset */
1311 return (I2A(i - INVEN_RARM));
1315 * @brief 選択アルファベットラベルからプレイヤーの所持オブジェクトIDを返す /
1316 * Convert a label into the index of an item in the "inven"
1317 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1318 * @details Note that the label does NOT distinguish inven/equip.
1320 INVENTORY_IDX label_to_inven(int c)
1325 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1);
1327 /* Verify the index */
1328 if ((i < 0) || (i > INVEN_PACK)) return (-1);
1330 /* Empty slots can never be chosen */
1331 if (!inventory[i].k_idx) return (-1);
1333 /* Return the index */
1339 extern bool select_ring_slot;
1343 * @brief プレイヤーの所持/装備オブジェクトIDが指輪枠かを返す /
1344 * @param i プレイヤーの所持/装備オブジェクトID
1345 * @return 指輪枠ならばTRUEを返す。
1347 static bool is_ring_slot(int i)
1349 return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1354 * @brief 選択アルファベットラベルからプレイヤーの装備オブジェクトIDを返す /
1355 * Convert a label into the index of a item in the "equip"
1356 * @return 対応するID。該当スロットにオブジェクトが存在しなかった場合-1を返す / Return "-1" if the label does not indicate a real item
1358 INVENTORY_IDX label_to_equip(int c)
1363 i = (INVENTORY_IDX)(islower(c) ? A2I(c) : -1) + INVEN_RARM;
1365 /* Verify the index */
1366 if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1368 if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1370 /* Empty slots can never be chosen */
1371 if (!inventory[i].k_idx) return (-1);
1373 /* Return the index */
1380 * @brief オブジェクトの該当装備部位IDを返す /
1381 * Determine which equipment slot (if any) an item likes
1382 * @param o_ptr 名称を取得する元のオブジェクト構造体参照ポインタ
1383 * @return 対応する装備部位ID
1385 s16b wield_slot(object_type *o_ptr)
1387 /* Slot for equipment */
1388 switch (o_ptr->tval)
1395 if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
1396 if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
1397 return (INVEN_LARM);
1404 if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
1405 if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
1406 return (INVEN_RARM);
1416 /* Use the right hand first */
1417 if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
1419 /* Use the left hand for swapping (by default) */
1420 return (INVEN_LEFT);
1426 return (INVEN_NECK);
1431 return (INVEN_LITE);
1438 return (INVEN_BODY);
1443 return (INVEN_OUTER);
1449 return (INVEN_HEAD);
1454 return (INVEN_HANDS);
1459 return (INVEN_FEET);
1463 /* No slot available */
1468 * @brief 所持/装備オブジェクトIDの部位表現を返す /
1469 * Return a string mentioning how a given item is carried
1470 * @param i 部位表現を求めるプレイヤーの所持/装備オブジェクトID
1471 * @return 部位表現の文字列ポインタ
1473 cptr mention_use(int i)
1477 /* Examine the location */
1481 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中" : ((p_ptr->ryoute && p_ptr->migite) ? " 両手" : (left_hander ? " 左手" : " 右手")); break;
1483 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
1487 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中" : ((p_ptr->ryoute && p_ptr->hidarite) ? " 両手" : (left_hander ? " 右手" : " 左手")); break;
1489 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
1493 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "運搬中" : "射撃用"; break;
1495 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "Just holding" : "Shooting"; break;
1499 case INVEN_RIGHT: p = (left_hander ? "左手指" : "右手指"); break;
1501 case INVEN_RIGHT: p = (left_hander ? "On left hand" : "On right hand"); break;
1505 case INVEN_LEFT: p = (left_hander ? "右手指" : "左手指"); break;
1507 case INVEN_LEFT: p = (left_hander ? "On right hand" : "On left hand"); break;
1510 case INVEN_NECK: p = _(" 首", "Around neck"); break;
1511 case INVEN_LITE: p = _(" 光源", "Light source"); break;
1512 case INVEN_BODY: p = _(" 体", "On body"); break;
1513 case INVEN_OUTER: p = _("体の上", "About body"); break;
1514 case INVEN_HEAD: p = _(" 頭", "On head"); break;
1515 case INVEN_HANDS: p = _(" 手", "On hands"); break;
1516 case INVEN_FEET: p = _(" 足", "On feet"); break;
1517 default: p = _("ザック", "In pack"); break;
1520 /* Return the result */
1526 * @brief 所持/装備オブジェクトIDの現在の扱い方の状態表現を返す /
1527 * Return a string describing how a given item is being worn.
1528 * @param i 状態表現を求めるプレイヤーの所持/装備オブジェクトID
1529 * @return 状態表現内容の文字列ポインタ
1531 * Currently, only used for items in the equipment, not inventory.
1533 cptr describe_use(int i)
1540 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->migite) ? "両手に装備している" : (left_hander ? "左手に装備している" : "右手に装備している")); break;
1542 case INVEN_RARM: p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
1546 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "運搬中の" : ((p_ptr->ryoute && p_ptr->hidarite) ? "両手に装備している" : (left_hander ? "右手に装備している" : "左手に装備している")); break;
1548 case INVEN_LARM: p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
1552 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "持つだけで精一杯の" : "射撃用に装備している"; break;
1554 case INVEN_BOW: p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "just holding" : "shooting missiles with"; break;
1558 case INVEN_RIGHT: p = (left_hander ? "左手の指にはめている" : "右手の指にはめている"); break;
1560 case INVEN_RIGHT: p = (left_hander ? "wearing on your left hand" : "wearing on your right hand"); break;
1564 case INVEN_LEFT: p = (left_hander ? "右手の指にはめている" : "左手の指にはめている"); break;
1566 case INVEN_LEFT: p = (left_hander ? "wearing on your right hand" : "wearing on your left hand"); break;
1569 case INVEN_NECK: p = _("首にかけている", "wearing around your neck"); break;
1570 case INVEN_LITE: p = _("光源にしている", "using to light the way"); break;
1571 case INVEN_BODY: p = _("体に着ている", "wearing on your body"); break;
1572 case INVEN_OUTER: p = _("身にまとっている", "wearing on your back"); break;
1573 case INVEN_HEAD: p = _("頭にかぶっている", "wearing on your head"); break;
1574 case INVEN_HANDS: p = _("手につけている", "wearing on your hands"); break;
1575 case INVEN_FEET: p = _("足にはいている", "wearing on your feet"); break;
1576 default: p = _("ザックに入っている", "carrying in your pack"); break;
1579 /* Return the result */
1585 * @brief tval/sval指定のベースアイテムがプレイヤーの使用可能な魔法書かどうかを返す /
1586 * Hack: Check if a spellbook is one of the realms we can use. -- TY
1587 * @param book_tval ベースアイテムのtval
1588 * @param book_sval ベースアイテムのsval
1589 * @return 使用可能な魔法書ならばTRUEを返す。
1592 bool check_book_realm(const OBJECT_TYPE_VALUE book_tval, const OBJECT_SUBTYPE_VALUE book_sval)
1594 if (book_tval < TV_LIFE_BOOK) return FALSE;
1595 if (p_ptr->pclass == CLASS_SORCERER)
1597 return is_magic(tval2realm(book_tval));
1599 else if (p_ptr->pclass == CLASS_RED_MAGE)
1601 if (is_magic(tval2realm(book_tval)))
1602 return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
1604 return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
1608 * @brief アイテムがitem_tester_hookグローバル関数ポインタの条件を満たしているかを返す汎用関数
1609 * Check an item against the item tester info
1610 * @param o_ptr 判定を行いたいオブジェクト構造体参照ポインタ
1611 * @return item_tester_hookの参照先、その他いくつかの例外に応じてTRUE/FALSEを返す。
1613 bool item_tester_okay(object_type *o_ptr)
1615 /* Hack -- allow listing empty slots */
1616 if (item_tester_full) return (TRUE);
1618 /* Require an item */
1619 if (!o_ptr->k_idx) return (FALSE);
1621 /* Hack -- ignore "gold" */
1622 if (o_ptr->tval == TV_GOLD)
1625 extern bool show_gold_on_floor;
1627 if (!show_gold_on_floor) return (FALSE);
1630 /* Check the tval */
1631 if (item_tester_tval)
1633 /* Is it a spellbook? If so, we need a hack -- TY */
1634 if ((item_tester_tval <= TV_DEATH_BOOK) &&
1635 (item_tester_tval >= TV_LIFE_BOOK))
1636 return check_book_realm(o_ptr->tval, o_ptr->sval);
1638 if (item_tester_tval != o_ptr->tval) return (FALSE);
1641 /* Check the hook */
1642 if (item_tester_hook)
1644 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
1653 * @brief 所持アイテム一覧を表示する /
1654 * Choice window "shadow" of the "show_inven()" function
1657 void display_inven(void)
1659 register int i, n, z = 0;
1661 byte attr = TERM_WHITE;
1663 char o_name[MAX_NLEN];
1667 Term_get_size(&wid, &hgt);
1669 /* Find the "final" slot */
1670 for (i = 0; i < INVEN_PACK; i++)
1672 o_ptr = &inventory[i];
1674 /* Skip non-objects */
1675 if (!o_ptr->k_idx) continue;
1681 /* Display the pack */
1682 for (i = 0; i < z; i++)
1684 /* Examine the item */
1685 o_ptr = &inventory[i];
1687 /* Start with an empty "index" */
1688 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1690 /* Is this item "acceptable"? */
1691 if (item_tester_okay(o_ptr))
1693 /* Prepare an "index" */
1694 tmp_val[0] = index_to_label(i);
1696 /* Bracket the "index" --(-- */
1700 /* Display the index (or blank space) */
1701 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1703 /* Obtain an item description */
1704 object_desc(o_name, o_ptr, 0);
1706 /* Obtain the length of the description */
1710 attr = tval_to_attr[o_ptr->tval % 128];
1712 /* Grey out charging items */
1718 /* Display the entry itself */
1719 Term_putstr(3, i, n, attr, o_name);
1721 /* Erase the rest of the line */
1722 Term_erase(3+n, i, 255);
1724 /* Display the weight if needed */
1727 int wgt = o_ptr->weight * o_ptr->number;
1729 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt),lbtokg2(wgt) );
1731 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1734 prt(tmp_val, i, wid - 9);
1738 /* Erase the rest of the window */
1739 for (i = z; i < hgt; i++)
1741 /* Erase the line */
1742 Term_erase(0, i, 255);
1749 * @brief 装備アイテム一覧を表示する /
1750 * Choice window "shadow" of the "show_equip()" function
1753 void display_equip(void)
1757 byte attr = TERM_WHITE;
1759 char o_name[MAX_NLEN];
1763 Term_get_size(&wid, &hgt);
1765 /* Display the equipment */
1766 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1768 /* Examine the item */
1769 o_ptr = &inventory[i];
1771 /* Start with an empty "index" */
1772 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1774 /* Is this item "acceptable"? */
1775 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
1777 /* Prepare an "index" */
1778 tmp_val[0] = index_to_label(i);
1780 /* Bracket the "index" --(-- */
1784 /* Display the index (or blank space) */
1785 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
1787 /* Obtain an item description */
1788 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
1790 strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
1795 object_desc(o_name, o_ptr, 0);
1796 attr = tval_to_attr[o_ptr->tval % 128];
1799 /* Obtain the length of the description */
1802 /* Grey out charging items */
1808 /* Display the entry itself */
1809 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
1811 /* Erase the rest of the line */
1812 Term_erase(3+n, i - INVEN_RARM, 255);
1814 /* Display the weight (if needed) */
1817 int wgt = o_ptr->weight * o_ptr->number;
1819 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
1821 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1824 prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
1827 /* Display the slot description (if needed) */
1830 Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
1831 prt(mention_use(i), i - INVEN_RARM, wid - 15);
1835 /* Erase the rest of the window */
1836 for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
1838 /* Clear that line */
1839 Term_erase(0, i, 255);
1845 * @brief 所持/装備オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1846 * Find the "first" inventory object with the given "tag".
1847 * @param cp 対応するタグIDを与える参照ポインタ
1848 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1849 * @param mode 所持、装備の切り替え
1850 * @return タグに該当するオブジェクトがあるならTRUEを返す
1852 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1853 * inscription of an object. Alphabetical characters don't work as a\n
1854 * tag in this form.\n
1856 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1857 * and "x" is the "current" command_cmd code.\n
1859 static bool get_tag(COMMAND_CODE *cp, char tag, BIT_FLAGS mode)
1862 COMMAND_CODE start, end;
1865 /* Extract index from mode */
1870 end = INVEN_TOTAL - 1;
1875 end = INVEN_PACK - 1;
1882 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1884 /* Check every inventory object */
1885 for (i = start; i <= end; i++)
1887 object_type *o_ptr = &inventory[i];
1889 /* Skip non-objects */
1890 if (!o_ptr->k_idx) continue;
1892 /* Skip empty inscriptions */
1893 if (!o_ptr->inscription) continue;
1895 /* Skip non-choice */
1896 if (!item_tester_okay(o_ptr)) continue;
1899 s = my_strchr(quark_str(o_ptr->inscription), '@');
1901 /* Process all tags */
1904 /* Check the special tags */
1905 if ((s[1] == command_cmd) && (s[2] == tag))
1907 /* Save the actual inventory ID */
1914 /* Find another '@' */
1915 s = my_strchr(s + 1, '@');
1920 /**** Find a tag in the form of {@#} (allows only numerals) ***/
1922 /* Don't allow {@#} with '#' being alphabet */
1923 if (tag < '0' || '9' < tag)
1929 /* Check every object */
1930 for (i = start; i <= end; i++)
1932 object_type *o_ptr = &inventory[i];
1934 /* Skip non-objects */
1935 if (!o_ptr->k_idx) continue;
1937 /* Skip empty inscriptions */
1938 if (!o_ptr->inscription) continue;
1940 /* Skip non-choice */
1941 if (!item_tester_okay(o_ptr)) continue;
1944 s = my_strchr(quark_str(o_ptr->inscription), '@');
1946 /* Process all tags */
1949 /* Check the normal tags */
1952 /* Save the actual inventory ID */
1959 /* Find another '@' */
1960 s = my_strchr(s + 1, '@');
1970 * @brief 床オブジェクトに選択タグを与える/タグに該当するオブジェクトがあるかを返す /
1971 * Find the "first" inventory object with the given "tag".
1972 * @param cp 対応するタグIDを与える参照ポインタ
1973 * @param tag 該当するオブジェクトがあるかを調べたいタグ
1974 * @param floor_list 床上アイテムの配列
1975 * @param floor_num 床上アイテムの配列ID
1976 * @return タグに該当するオブジェクトがあるならTRUEを返す
1978 * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
1979 * inscription of an object. Alphabetical characters don't work as a\n
1980 * tag in this form.\n
1982 * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
1983 * and "x" is the "current" command_cmd code.\n
1985 static bool get_tag_floor(COMMAND_CODE *cp, char tag, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
1990 /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
1992 /* Check every object in the grid */
1993 for (i = 0; i < floor_num && i < 23; i++)
1995 object_type *o_ptr = &o_list[floor_list[i]];
1997 /* Skip empty inscriptions */
1998 if (!o_ptr->inscription) continue;
2001 s = my_strchr(quark_str(o_ptr->inscription), '@');
2003 /* Process all tags */
2006 /* Check the special tags */
2007 if ((s[1] == command_cmd) && (s[2] == tag))
2009 /* Save the actual floor object ID */
2016 /* Find another '@' */
2017 s = my_strchr(s + 1, '@');
2022 /**** Find a tag in the form of {@#} (allows only numerals) ***/
2024 /* Don't allow {@#} with '#' being alphabet */
2025 if (tag < '0' || '9' < tag)
2031 /* Check every object in the grid */
2032 for (i = 0; i < floor_num && i < 23; i++)
2034 object_type *o_ptr = &o_list[floor_list[i]];
2036 /* Skip empty inscriptions */
2037 if (!o_ptr->inscription) continue;
2040 s = my_strchr(quark_str(o_ptr->inscription), '@');
2042 /* Process all tags */
2045 /* Check the normal tags */
2048 /* Save the floor object ID */
2055 /* Find another '@' */
2056 s = my_strchr(s + 1, '@');
2066 * @brief タグIDにあわせてタグアルファベットのリストを返す /
2067 * Move around label characters with correspond tags
2068 * @param label ラベルリストを取得する文字列参照ポインタ
2069 * @param mode 所持品リストか装備品リストかの切り替え
2072 static void prepare_label_string(char *label, BIT_FLAGS mode)
2074 cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2075 int offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2078 /* Prepare normal labels */
2079 strcpy(label, alphabet_chars);
2081 /* Move each label */
2082 for (i = 0; i < 52; i++)
2085 char c = alphabet_chars[i];
2087 /* Find a tag with this label */
2088 if (get_tag(&index, c, mode))
2090 /* Delete the overwritten label */
2091 if (label[i] == c) label[i] = ' ';
2093 /* Move the label to the place of corresponding tag */
2094 label[index - offset] = c;
2101 * @brief タグIDにあわせてタグアルファベットのリストを返す(床上アイテム用) /
2102 * Move around label characters with correspond tags (floor version)
2103 * @param label ラベルリストを取得する文字列参照ポインタ
2104 * @param floor_list 床上アイテムの配列
2105 * @param floor_num 床上アイテムの配列ID
2110 static void prepare_label_string_floor(char *label, FLOOR_IDX floor_list[], ITEM_NUMBER floor_num)
2112 cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2115 /* Prepare normal labels */
2116 strcpy(label, alphabet_chars);
2118 /* Move each label */
2119 for (i = 0; i < 52; i++)
2122 char c = alphabet_chars[i];
2124 /* Find a tag with this label */
2125 if (get_tag_floor(&index, c, floor_list, floor_num))
2127 /* Delete the overwritten label */
2128 if (label[i] == c) label[i] = ' ';
2130 /* Move the label to the place of corresponding tag */
2138 * @brief 所持アイテムの表示を行う /
2139 * Display the inventory.
2140 * @param target_item アイテムの選択処理を行うか否か。
2141 * @return 選択したアイテムのタグ
2143 * Hack -- do not display "trailing" empty slots
2145 COMMAND_CODE show_inven(int target_item)
2149 int col, cur_col, len;
2151 char o_name[MAX_NLEN];
2153 COMMAND_CODE out_index[23];
2155 char out_desc[23][MAX_NLEN];
2156 COMMAND_CODE target_item_label = 0;
2158 char inven_label[52 + 1];
2160 /* Starting column */
2164 Term_get_size(&wid, &hgt);
2166 /* Default "max-length" */
2167 len = wid - col - 1;
2170 /* Find the "final" slot */
2171 for (i = 0; i < INVEN_PACK; i++)
2173 o_ptr = &inventory[i];
2175 /* Skip non-objects */
2176 if (!o_ptr->k_idx) continue;
2182 prepare_label_string(inven_label, USE_INVEN);
2184 /* Display the inventory */
2185 for (k = 0, i = 0; i < z; i++)
2187 o_ptr = &inventory[i];
2189 /* Is this item acceptable? */
2190 if (!item_tester_okay(o_ptr)) continue;
2192 /* Describe the object */
2193 object_desc(o_name, o_ptr, 0);
2195 /* Save the object index, color, and description */
2197 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2199 /* Grey out charging items */
2202 out_color[k] = TERM_L_DARK;
2205 (void)strcpy(out_desc[k], o_name);
2207 /* Find the predicted "line length" */
2208 l = strlen(out_desc[k]) + 5;
2210 /* Be sure to account for the weight */
2211 if (show_weights) l += 9;
2213 /* Account for icon if displayed */
2214 if (show_item_graph)
2217 if (use_bigtile) l++;
2220 /* Maintain the maximum length */
2221 if (l > len) len = l;
2223 /* Advance to next "line" */
2227 /* Find the column to start in */
2228 col = (len > wid - 4) ? 0 : (wid - len - 1);
2230 /* Output each entry */
2231 for (j = 0; j < k; j++)
2237 o_ptr = &inventory[i];
2239 /* Clear the line */
2240 prt("", j + 1, col ? col - 2 : col);
2242 if (use_menu && target_item)
2244 if (j == (target_item-1))
2246 strcpy(tmp_val, _("》", "> "));
2247 target_item_label = i;
2249 else strcpy(tmp_val, " ");
2251 else if (i <= INVEN_PACK)
2253 /* Prepare an index --(-- */
2254 sprintf(tmp_val, "%c)", inven_label[i]);
2258 /* Prepare an index --(-- */
2259 sprintf(tmp_val, "%c)", index_to_label(i));
2262 /* Clear the line with the (possibly indented) index */
2263 put_str(tmp_val, j + 1, col);
2267 /* Display graphics for object, if desired */
2268 if (show_item_graph)
2270 byte a = object_attr(o_ptr);
2271 char c = object_char(o_ptr);
2272 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2273 if (use_bigtile) cur_col++;
2279 /* Display the entry itself */
2280 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2282 /* Display the weight if needed */
2285 int wgt = o_ptr->weight * o_ptr->number;
2287 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2289 (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2292 prt(tmp_val, j + 1, wid - 9);
2296 /* Make a "shadow" below the list (only if needed) */
2297 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2299 /* Save the new column */
2302 return target_item_label;
2307 * @brief 装備アイテムの表示を行う /
2308 * Display the equipment.
2309 * @param target_item アイテムの選択処理を行うか否か。
2310 * @return 選択したアイテムのタグ
2312 COMMAND_CODE show_equip(int target_item)
2316 int col, cur_col, len;
2319 char o_name[MAX_NLEN];
2320 COMMAND_CODE out_index[23];
2322 char out_desc[23][MAX_NLEN];
2323 COMMAND_CODE target_item_label = 0;
2325 char equip_label[52 + 1];
2327 /* Starting column */
2331 Term_get_size(&wid, &hgt);
2333 /* Maximal length */
2334 len = wid - col - 1;
2337 /* Scan the equipment list */
2338 for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2340 o_ptr = &inventory[i];
2342 /* Is this item acceptable? */
2343 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr)) &&
2344 (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
2345 item_tester_no_ryoute)) continue;
2348 object_desc(o_name, o_ptr, 0);
2350 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2353 (void)strcpy(out_desc[k],"(武器を両手持ち)");
2355 (void)strcpy(out_desc[k],"(wielding with two-hands)");
2357 out_color[k] = TERM_WHITE;
2361 (void)strcpy(out_desc[k], o_name);
2362 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2366 /* Grey out charging items */
2369 out_color[k] = TERM_L_DARK;
2372 /* Extract the maximal length (see below) */
2374 l = strlen(out_desc[k]) + (2 + 1);
2376 l = strlen(out_desc[k]) + (2 + 3);
2380 /* Increase length for labels (if needed) */
2382 if (show_labels) l += (7 + 2);
2384 if (show_labels) l += (14 + 2);
2388 /* Increase length for weight (if needed) */
2389 if (show_weights) l += 9;
2391 if (show_item_graph) l += 2;
2393 /* Maintain the max-length */
2394 if (l > len) len = l;
2396 /* Advance the entry */
2400 /* Hack -- Find a column to start in */
2402 col = (len > wid - 6) ? 0 : (wid - len - 1);
2404 col = (len > wid - 4) ? 0 : (wid - len - 1);
2407 prepare_label_string(equip_label, USE_EQUIP);
2409 /* Output each entry */
2410 for (j = 0; j < k; j++)
2416 o_ptr = &inventory[i];
2418 /* Clear the line */
2419 prt("", j + 1, col ? col - 2 : col);
2421 if (use_menu && target_item)
2423 if (j == (target_item-1))
2425 strcpy(tmp_val, _("》", "> "));
2426 target_item_label = i;
2428 else strcpy(tmp_val, " ");
2430 else if (i >= INVEN_RARM)
2432 /* Prepare an index --(-- */
2433 sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
2437 /* Prepare an index --(-- */
2438 sprintf(tmp_val, "%c)", index_to_label(i));
2441 /* Clear the line with the (possibly indented) index */
2442 put_str(tmp_val, j+1, col);
2446 /* Display graphics for object, if desired */
2447 if (show_item_graph)
2449 byte a = object_attr(o_ptr);
2450 char c = object_char(o_ptr);
2451 Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2452 if (use_bigtile) cur_col++;
2460 /* Mention the use */
2461 (void)sprintf(tmp_val, _("%-7s: ", "%-14s: "), mention_use(i));
2463 put_str(tmp_val, j+1, cur_col);
2465 /* Display the entry itself */
2466 c_put_str(out_color[j], out_desc[j], j+1, _(cur_col + 9, cur_col + 16));
2472 /* Display the entry itself */
2473 c_put_str(out_color[j], out_desc[j], j+1, cur_col);
2476 /* Display the weight if needed */
2479 int wgt = o_ptr->weight * o_ptr->number;
2481 (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2483 (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
2486 prt(tmp_val, j + 1, wid - 9);
2490 /* Make a "shadow" below the list (only if needed) */
2491 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
2493 /* Save the new column */
2496 return target_item_label;
2500 * @brief サブウィンドウに所持品、装備品リストの表示を行う /
2501 * Flip "inven" and "equip" in any sub-windows
2504 void toggle_inven_equip(void)
2509 for (j = 0; j < 8; j++)
2512 if (!angband_term[j]) continue;
2514 /* Flip inven to equip */
2515 if (window_flag[j] & (PW_INVEN))
2518 window_flag[j] &= ~(PW_INVEN);
2519 window_flag[j] |= (PW_EQUIP);
2522 p_ptr->window |= (PW_EQUIP);
2525 /* Flip inven to equip */
2526 else if (window_flag[j] & (PW_EQUIP))
2529 window_flag[j] &= ~(PW_EQUIP);
2530 window_flag[j] |= (PW_INVEN);
2533 p_ptr->window |= (PW_INVEN);
2539 * @brief 選択したアイテムの確認処理の補助 /
2540 * Verify the choice of an item.
2541 * @param prompt メッセージ表示の一部
2542 * @param item 選択アイテムID
2543 * @return 確認がYesならTRUEを返す。
2544 * @details The item can be negative to mean "item on floor".
2546 static bool verify(cptr prompt, INVENTORY_IDX item)
2548 char o_name[MAX_NLEN];
2549 char out_val[MAX_NLEN+20];
2556 o_ptr = &inventory[item];
2562 o_ptr = &o_list[0 - item];
2566 object_desc(o_name, o_ptr, 0);
2569 (void)sprintf(out_val, _("%s%sですか? ", "%s %s? "), prompt, o_name);
2572 return (get_check(out_val));
2577 * @brief 選択したアイテムの確認処理のメインルーチン /
2578 * @param item 選択アイテムID
2579 * @return 確認がYesならTRUEを返す。
2580 * @details The item can be negative to mean "item on floor".
2581 * Hack -- allow user to "prevent" certain choices
2583 static bool get_item_allow(INVENTORY_IDX item)
2589 if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
2594 o_ptr = &inventory[item];
2600 o_ptr = &o_list[0 - item];
2603 /* No inscription */
2604 if (!o_ptr->inscription) return (TRUE);
2607 s = my_strchr(quark_str(o_ptr->inscription), '!');
2609 /* Process preventions */
2612 /* Check the "restriction" */
2613 if ((s[1] == command_cmd) || (s[1] == '*'))
2615 /* Verify the choice */
2616 if (!verify(_("本当に", "Really try"), item)) return (FALSE);
2619 /* Find another '!' */
2620 s = my_strchr(s + 1, '!');
2629 * @brief プレイヤーの所持/装備オブジェクトが正規のものかを返す /
2630 * Auxiliary function for "get_item()" -- test an index
2632 * @return 正規のIDならばTRUEを返す。
2634 static bool get_item_okay(OBJECT_IDX i)
2637 if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
2639 if (select_ring_slot) return is_ring_slot(i);
2641 /* Verify the item */
2642 if (!item_tester_okay(&inventory[i])) return (FALSE);
2649 * @brief プレイヤーがオブジェクトを拾うことができる状態かを返す /
2650 * Determine whether get_item() can get some item or not
2651 * @return アイテムを拾えるならばTRUEを返す。
2652 * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
2654 bool can_get_item(void)
2657 OBJECT_IDX floor_list[23];
2658 ITEM_NUMBER floor_num = 0;
2660 for (j = 0; j < INVEN_TOTAL; j++)
2661 if (item_tester_okay(&inventory[j]))
2664 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
2672 * @brief オブジェクト選択の汎用関数 /
2673 * Let the user select an item, save its "index"
2674 * @param cp 選択したオブジェクトのIDを返す。
2675 * @param pmt 選択目的のメッセージ
2676 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
2677 * @param mode オプションフラグ
2678 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
2679 * Return TRUE only if an acceptable item was chosen by the user.\n
2681 * The selected item must satisfy the "item_tester_hook()" function,\n
2682 * if that hook is set, and the "item_tester_tval", if that value is set.\n
2684 * All "item_tester" restrictions are cleared before this function returns.\n
2686 * The user is allowed to choose acceptable items from the equipment,\n
2687 * inventory, or floor, respectively, if the proper flag was given,\n
2688 * and there are any acceptable items in that location.\n
2690 * The equipment or inventory are displayed (even if no acceptable\n
2691 * items are in that location) if the proper flag was given.\n
2693 * If there are no acceptable items available anywhere, and "str" is\n
2694 * not NULL, then it will be used as the text of a warning message\n
2695 * before the function returns.\n
2697 * Note that the user must press "-" to specify the item on the floor,\n
2698 * and there is no way to "examine" the item on the floor, while the\n
2699 * use of "capital" letters will "examine" an inventory/equipment item,\n
2700 * and prompt for its use.\n
2702 * If a legal item is selected from the inventory, we save it in "cp"\n
2703 * directly (0 to 35), and return TRUE.\n
2705 * If a legal item is selected from the floor, we save it in "cp" as\n
2706 * a negative (-1 to -511), and return TRUE.\n
2708 * If no item is available, we do nothing to "cp", and we display a\n
2709 * warning message, using "str" if available, and return FALSE.\n
2711 * If no item is selected, we do nothing to "cp", and return FALSE.\n
2713 * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
2714 * to allow the user to enter a command while viewing those screens, and\n
2715 * also to induce "auto-enter" of stores, and other such stuff.\n
2717 * Global "p_ptr->command_see" may be set before calling this function to start\n
2718 * out in "browse" mode. It is cleared before this function returns.\n
2720 * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
2721 * If it is TRUE then we are viewing inventory, else equipment.\n
2723 * We always erase the prompt when we are done, leaving a blank line,\n
2724 * or a warning message, if appropriate, if no items are available.\n
2726 bool get_item(OBJECT_IDX *cp, cptr pmt, cptr str, BIT_FLAGS mode)
2728 OBJECT_IDX this_o_idx, next_o_idx = 0;
2745 bool allow_floor = FALSE;
2747 bool toggle = FALSE;
2753 extern bool select_the_force;
2755 int menu_line = (use_menu ? 1 : 0);
2761 static char prev_tag = '\0';
2762 char cur_tag = '\0';
2764 #endif /* ALLOW_REPEAT */
2766 #ifdef ALLOW_EASY_FLOOR /* TNB */
2768 if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
2770 #endif /* ALLOW_EASY_FLOOR -- TNB */
2773 if (mode & USE_EQUIP) equip = TRUE;
2774 if (mode & USE_INVEN) inven = TRUE;
2775 if (mode & USE_FLOOR) floor = TRUE;
2779 /* Get the item index */
2780 if (repeat_pull(cp))
2783 if (select_the_force && (*cp == INVEN_FORCE))
2785 item_tester_tval = 0;
2786 item_tester_hook = NULL;
2787 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2792 else if (floor && (*cp < 0))
2799 /* Acquire object */
2802 /* Validate the item */
2803 if (item_tester_okay(o_ptr))
2805 /* Forget restrictions */
2806 item_tester_tval = 0;
2807 item_tester_hook = NULL;
2808 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2815 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
2816 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
2818 if (prev_tag && command_cmd)
2820 /* Look up the tag and validate the item */
2821 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
2822 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
2823 else if (!get_item_okay(k)) /* Reject */;
2826 /* Accept that choice */
2829 /* Forget restrictions */
2830 item_tester_tval = 0;
2831 item_tester_hook = NULL;
2832 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2838 prev_tag = '\0'; /* prev_tag is no longer effective */
2841 /* Verify the item */
2842 else if (get_item_okay(*cp))
2844 /* Forget restrictions */
2845 item_tester_tval = 0;
2846 item_tester_hook = NULL;
2847 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
2855 #endif /* ALLOW_REPEAT */
2858 /* Paranoia XXX XXX XXX */
2865 /* No item selected */
2869 /* Full inventory */
2871 i2 = INVEN_PACK - 1;
2873 /* Forbid inventory */
2874 if (!inven) i2 = -1;
2877 for (j = 0; j < INVEN_PACK; j++)
2878 if (item_tester_okay(&inventory[j])) max_inven++;
2881 /* Restrict inventory indexes */
2882 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
2883 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
2886 /* Full equipment */
2888 e2 = INVEN_TOTAL - 1;
2890 /* Forbid equipment */
2891 if (!equip) e2 = -1;
2894 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
2895 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
2896 if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
2899 /* Restrict equipment indexes */
2900 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
2901 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
2903 if (equip && p_ptr->ryoute && !item_tester_no_ryoute)
2907 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
2909 else if (p_ptr->hidarite) e1 = INVEN_RARM;
2913 /* Restrict floor usage */
2916 /* Scan all objects in the grid */
2917 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
2921 /* Acquire object */
2922 o_ptr = &o_list[this_o_idx];
2924 /* Acquire next object */
2925 next_o_idx = o_ptr->next_o_idx;
2927 /* Accept the item on the floor if legal */
2928 if (item_tester_okay(o_ptr) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
2932 /* Require at least one legal choice */
2933 if (!allow_floor && (i1 > i2) && (e1 > e2))
2935 /* Cancel p_ptr->command_see */
2936 command_see = FALSE;
2944 if (select_the_force) {
2950 /* Analyze choices */
2953 /* Hack -- Start on equipment if requested */
2954 if (command_see && command_wrk && equip)
2959 /* Use inventory if allowed */
2962 command_wrk = FALSE;
2965 /* Use equipment if allowed */
2971 /* Use inventory for floor */
2974 command_wrk = FALSE;
2980 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
2982 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
2984 /* Hack -- start out in "display" mode */
2992 /* Repeat until done */
2995 COMMAND_CODE get_item_label = 0;
3002 for (j = 0; j < 8; j++)
3005 if (!angband_term[j]) continue;
3007 /* Count windows displaying inven */
3008 if (window_flag[j] & (PW_INVEN)) ni++;
3010 /* Count windows displaying equip */
3011 if (window_flag[j] & (PW_EQUIP)) ne++;
3014 /* Toggle if needed */
3015 if ((command_wrk && ni && !ne) ||
3016 (!command_wrk && !ni && ne))
3019 toggle_inven_equip();
3026 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3028 /* Redraw windows */
3032 /* Inventory screen */
3035 /* Redraw if needed */
3036 if (command_see) get_item_label = show_inven(menu_line);
3039 /* Equipment screen */
3042 /* Redraw if needed */
3043 if (command_see) get_item_label = show_equip(menu_line);
3046 /* Viewing inventory */
3049 /* Begin the prompt */
3050 sprintf(out_val, _("持ち物:", "Inven:"));
3052 /* Some legal items */
3053 if ((i1 <= i2) && !use_menu)
3055 /* Build the prompt */
3056 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3057 index_to_label(i1), index_to_label(i2));
3060 strcat(out_val, tmp_val);
3063 /* Indicate ability to "view" */
3064 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3068 if (equip) strcat(out_val, format(" %s 装備品,", use_menu ? "'4'or'6'" : "'/'"));
3070 if (equip) strcat(out_val, format(" %s for Equip,", use_menu ? "4 or 6" : "/"));
3074 /* Viewing equipment */
3077 /* Begin the prompt */
3078 sprintf(out_val, _("装備品:", "Equip:"));
3080 /* Some legal items */
3081 if ((e1 <= e2) && !use_menu)
3083 /* Build the prompt */
3084 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
3085 index_to_label(e1), index_to_label(e2));
3088 strcat(out_val, tmp_val);
3091 /* Indicate ability to "view" */
3092 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
3096 if (inven) strcat(out_val, format(" %s 持ち物,", use_menu ? "'4'or'6'" : "'/'"));
3098 if (inven) strcat(out_val, format(" %s for Inven,", use_menu ? "4 or 6" : "'/'"));
3102 /* Indicate legality of the "floor" item */
3103 if (allow_floor) strcat(out_val, _(" '-'床上,", " - for floor,"));
3104 if (select_the_force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
3106 /* Finish the prompt */
3107 strcat(out_val, " ESC");
3109 /* Build the prompt */
3110 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3112 /* Show the prompt */
3120 int max_line = (command_wrk ? max_equip : max_inven);
3136 menu_line += (max_line - 1);
3155 /* Verify legality */
3156 if (!inven || !equip)
3162 /* Hack -- Fix screen */
3172 /* Switch inven/equip */
3173 command_wrk = !command_wrk;
3174 max_line = (command_wrk ? max_equip : max_inven);
3175 if (menu_line > max_line) menu_line = max_line;
3177 /* Need to redraw */
3186 if (command_wrk == USE_FLOOR)
3189 (*cp) = -get_item_label;
3193 /* Validate the item */
3194 if (!get_item_okay(get_item_label))
3200 /* Allow player to "refuse" certain actions */
3201 if (!get_item_allow(get_item_label))
3207 /* Accept that choice */
3208 (*cp) = get_item_label;
3217 if (select_the_force) {
3225 if (menu_line > max_line) menu_line -= max_line;
3246 command_see = FALSE;
3266 /* Verify legality */
3267 if (!inven || !equip)
3273 /* Hack -- Fix screen */
3283 /* Switch inven/equip */
3284 command_wrk = !command_wrk;
3286 /* Need to redraw */
3292 /* Use floor item */
3295 /* Scan all objects in the grid */
3296 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3300 /* Acquire object */
3301 o_ptr = &o_list[this_o_idx];
3303 /* Acquire next object */
3304 next_o_idx = o_ptr->next_o_idx;
3306 /* Validate the item */
3307 if (!item_tester_okay(o_ptr)) continue;
3312 /* Verify the item (if required) */
3313 if (other_query_flag && !verify(_("本当に", "Try"), k)) continue;
3315 /* Allow player to "refuse" certain actions */
3316 if (!get_item_allow(k)) continue;
3318 /* Accept that choice */
3335 case '1': case '2': case '3':
3336 case '4': case '5': case '6':
3337 case '7': case '8': case '9':
3339 /* Look up the tag */
3340 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3346 /* Hack -- Validate the item */
3347 if ((k < INVEN_RARM) ? !inven : !equip)
3353 /* Validate the item */
3354 if (!get_item_okay(k))
3360 /* Allow player to "refuse" certain actions */
3361 if (!get_item_allow(k))
3367 /* Accept that choice */
3373 #endif /* ALLOW_REPEAT */
3381 /* Choose "default" inventory item */
3384 k = ((i1 == i2) ? i1 : -1);
3387 /* Choose "default" equipment item */
3390 k = ((e1 == e2) ? e1 : -1);
3393 /* Validate the item */
3394 if (!get_item_okay(k))
3400 /* Allow player to "refuse" certain actions */
3401 if (!get_item_allow(k))
3407 /* Accept that choice */
3417 if (select_the_force) {
3430 bool not_found = FALSE;
3432 /* Look up the alphabetical tag */
3433 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
3438 /* Hack -- Validate the item */
3439 else if ((k < INVEN_RARM) ? !inven : !equip)
3444 /* Validate the item */
3445 else if (!get_item_okay(k))
3452 /* Accept that choice */
3458 #endif /* ALLOW_REPEAT */
3462 /* Extract "query" setting */
3463 ver = isupper(which);
3464 which = (char)tolower(which);
3466 /* Convert letter to inventory index */
3469 if (which == '(') k = i1;
3470 else if (which == ')') k = i2;
3471 else k = label_to_inven(which);
3474 /* Convert letter to equipment index */
3477 if (which == '(') k = e1;
3478 else if (which == ')') k = e2;
3479 else k = label_to_equip(which);
3482 /* Validate the item */
3483 if (!get_item_okay(k))
3489 /* Verify the item */
3490 if (ver && !verify(_("本当に", "Try"), k))
3496 /* Allow player to "refuse" certain actions */
3497 if (!get_item_allow(k))
3503 /* Accept that choice */
3514 /* Fix the screen if necessary */
3520 /* Hack -- Cancel "display" */
3521 command_see = FALSE;
3525 /* Forget the item_tester_tval restriction */
3526 item_tester_tval = 0;
3528 item_tester_no_ryoute = FALSE;
3530 /* Forget the item_tester_hook restriction */
3531 item_tester_hook = NULL;
3534 /* Clean up 'show choices' */
3535 /* Toggle again if needed */
3536 if (toggle) toggle_inven_equip();
3539 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3545 /* Clear the prompt line */
3548 /* Warning if needed */
3549 if (oops && str) msg_print(str);
3555 if (command_cmd) prev_tag = cur_tag;
3556 #endif /* ALLOW_REPEAT */
3558 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3566 #ifdef ALLOW_EASY_FLOOR
3569 * @brief 床下に落ちているオブジェクトの数を返す / scan_floor
3570 * @param items オブジェクトのIDリストを返すための配列参照ポインタ
3571 * @param y 走査するフロアのY座標
3572 * @param x 走査するフロアのX座標
3573 * @param mode オプションフラグ
3574 * @return 対象のマスに落ちているアイテム数
3576 * Return a list of o_list[] indexes of items at the given cave
3577 * location. Valid flags are:
3579 * mode & 0x01 -- Item tester
3580 * mode & 0x02 -- Marked items only
3581 * mode & 0x04 -- Stop after first
3583 ITEM_NUMBER scan_floor(OBJECT_IDX *items, POSITION y, POSITION x, BIT_FLAGS mode)
3585 OBJECT_IDX this_o_idx, next_o_idx;
3587 ITEM_NUMBER num = 0;
3590 if (!in_bounds(y, x)) return 0;
3592 /* Scan all objects in the grid */
3593 for (this_o_idx = cave[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
3597 /* Acquire object */
3598 o_ptr = &o_list[this_o_idx];
3600 /* Acquire next object */
3601 next_o_idx = o_ptr->next_o_idx;
3604 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
3607 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
3609 /* Accept this item */
3610 /* XXX Hack -- Enforce limit */
3612 items[num] = this_o_idx;
3617 if (mode & 0x04) break;
3626 * @brief 床下に落ちているアイテムの一覧を返す / Display a list of the items on the floor at the given location.
3627 * @param target_item カーソルの初期値
3628 * @param y 走査するフロアのY座標
3629 * @param x 走査するフロアのX座標
3630 * @param min_width 表示の長さ
3631 * @return 選択したアイテムの添え字
3634 COMMAND_CODE show_floor(int target_item, POSITION y, POSITION x, TERM_LEN *min_width)
3642 char o_name[MAX_NLEN];
3645 COMMAND_CODE out_index[23];
3647 char out_desc[23][MAX_NLEN];
3648 COMMAND_CODE target_item_label = 0;
3650 OBJECT_IDX floor_list[23];
3651 ITEM_NUMBER floor_num;
3653 char floor_label[52 + 1];
3655 bool dont_need_to_show_weights = TRUE;
3658 Term_get_size(&wid, &hgt);
3660 /* Default length */
3661 len = MAX((*min_width), 20);
3664 /* Scan for objects in the grid, using item_tester_okay() */
3665 floor_num = scan_floor(floor_list, y, x, 0x03);
3667 /* Display the floor objects */
3668 for (k = 0, i = 0; i < floor_num && i < 23; i++)
3670 o_ptr = &o_list[floor_list[i]];
3672 /* Describe the object */
3673 object_desc(o_name, o_ptr, 0);
3675 /* Save the index */
3678 /* Acquire inventory color */
3679 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
3681 /* Save the object description */
3682 strcpy(out_desc[k], o_name);
3684 /* Find the predicted "line length" */
3685 l = strlen(out_desc[k]) + 5;
3687 /* Be sure to account for the weight */
3688 if (show_weights) l += 9;
3690 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
3692 /* Maintain the maximum length */
3693 if (l > len) len = l;
3695 /* Advance to next "line" */
3699 if (show_weights && dont_need_to_show_weights) len -= 9;
3704 /* Find the column to start in */
3705 col = (len > wid - 4) ? 0 : (wid - len - 1);
3707 prepare_label_string_floor(floor_label, floor_list, floor_num);
3709 /* Output each entry */
3710 for (j = 0; j < k; j++)
3713 m = floor_list[out_index[j]];
3718 /* Clear the line */
3719 prt("", j + 1, col ? col - 2 : col);
3721 if (use_menu && target_item)
3723 if (j == (target_item-1))
3725 strcpy(tmp_val, _("》", "> "));
3726 target_item_label = m;
3728 else strcpy(tmp_val, " ");
3732 /* Prepare an index --(-- */
3733 sprintf(tmp_val, "%c)", floor_label[j]);
3736 /* Clear the line with the (possibly indented) index */
3737 put_str(tmp_val, j + 1, col);
3739 /* Display the entry itself */
3740 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
3742 /* Display the weight if needed */
3743 if (show_weights && (o_ptr->tval != TV_GOLD))
3745 int wgt = o_ptr->weight * o_ptr->number;
3747 sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3749 sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3752 prt(tmp_val, j + 1, wid - 9);
3756 /* Make a "shadow" below the list (only if needed) */
3757 if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3759 return target_item_label;
3763 * @brief オブジェクト選択の汎用関数(床上アイテム用) /
3764 * Let the user select an item, save its "index"
3765 * @param cp 選択したオブジェクトのIDを返す。
3766 * @param pmt 選択目的のメッセージ
3767 * @param str 選択できるオブジェクトがない場合のキャンセルメッセージ
3768 * @param mode オプションフラグ
3769 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。/
3771 bool get_item_floor(COMMAND_CODE *cp, cptr pmt, cptr str, BIT_FLAGS mode)
3773 char n1 = ' ', n2 = ' ', which = ' ';
3776 COMMAND_CODE i1, i2;
3777 COMMAND_CODE e1, e2;
3785 bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
3786 bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
3787 bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
3789 bool allow_equip = FALSE;
3790 bool allow_inven = FALSE;
3791 bool allow_floor = FALSE;
3793 bool toggle = FALSE;
3798 ITEM_NUMBER floor_num;
3799 OBJECT_IDX floor_list[23];
3801 TERM_LEN min_width = 0;
3803 extern bool select_the_force;
3805 int menu_line = (use_menu ? 1 : 0);
3811 static char prev_tag = '\0';
3812 char cur_tag = '\0';
3814 /* Get the item index */
3815 if (repeat_pull(cp))
3818 if (select_the_force && (*cp == INVEN_FORCE))
3820 item_tester_tval = 0;
3821 item_tester_hook = NULL;
3822 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3827 else if (floor && (*cp < 0))
3829 if (prev_tag && command_cmd)
3831 /* Scan all objects in the grid */
3832 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3834 /* Look up the tag */
3835 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
3837 /* Accept that choice */
3838 (*cp) = 0 - floor_list[k];
3840 /* Forget restrictions */
3841 item_tester_tval = 0;
3842 item_tester_hook = NULL;
3843 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3849 prev_tag = '\0'; /* prev_tag is no longer effective */
3852 /* Validate the item */
3853 else if (item_tester_okay(&o_list[0 - (*cp)]))
3855 /* Forget restrictions */
3856 item_tester_tval = 0;
3857 item_tester_hook = NULL;
3858 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3865 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3866 (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3868 if (prev_tag && command_cmd)
3870 /* Look up the tag and validate the item */
3871 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3872 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3873 else if (!get_item_okay(k)) /* Reject */;
3876 /* Accept that choice */
3879 /* Forget restrictions */
3880 item_tester_tval = 0;
3881 item_tester_hook = NULL;
3882 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3888 prev_tag = '\0'; /* prev_tag is no longer effective */
3891 /* Verify the item */
3892 else if (get_item_okay(*cp))
3894 /* Forget restrictions */
3895 item_tester_tval = 0;
3896 item_tester_hook = NULL;
3897 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3905 #endif /* ALLOW_REPEAT */
3908 /* Paranoia XXX XXX XXX */
3915 /* No item selected */
3919 /* Full inventory */
3921 i2 = INVEN_PACK - 1;
3923 /* Forbid inventory */
3924 if (!inven) i2 = -1;
3927 for (j = 0; j < INVEN_PACK; j++)
3928 if (item_tester_okay(&inventory[j])) max_inven++;
3931 /* Restrict inventory indexes */
3932 while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3933 while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3936 /* Full equipment */
3938 e2 = INVEN_TOTAL - 1;
3940 /* Forbid equipment */
3941 if (!equip) e2 = -1;
3944 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3945 if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
3946 if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
3949 /* Restrict equipment indexes */
3950 while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3951 while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3953 if (equip && p_ptr->ryoute && !item_tester_no_ryoute)
3957 if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3959 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3963 /* Count "okay" floor items */
3966 /* Restrict floor usage */
3969 /* Scan all objects in the grid */
3970 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
3973 /* Accept inventory */
3974 if (i1 <= i2) allow_inven = TRUE;
3976 /* Accept equipment */
3977 if (e1 <= e2) allow_equip = TRUE;
3980 if (floor_num) allow_floor = TRUE;
3982 /* Require at least one legal choice */
3983 if (!allow_inven && !allow_equip && !allow_floor)
3985 /* Cancel p_ptr->command_see */
3986 command_see = FALSE;
3994 if (select_the_force) {
4000 /* Analyze choices */
4003 /* Hack -- Start on equipment if requested */
4004 if (command_see && (command_wrk == (USE_EQUIP))
4007 command_wrk = (USE_EQUIP);
4010 /* Use inventory if allowed */
4011 else if (allow_inven)
4013 command_wrk = (USE_INVEN);
4016 /* Use equipment if allowed */
4017 else if (allow_equip)
4019 command_wrk = (USE_EQUIP);
4022 /* Use floor if allowed */
4023 else if (allow_floor)
4025 command_wrk = (USE_FLOOR);
4030 * 追加オプション(always_show_list)が設定されている場合は常に一覧を表示する
4032 if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
4034 /* Hack -- start out in "display" mode */
4041 /* Repeat until done */
4044 COMMAND_CODE get_item_label = 0;
4051 for (j = 0; j < 8; j++)
4054 if (!angband_term[j]) continue;
4056 /* Count windows displaying inven */
4057 if (window_flag[j] & (PW_INVEN)) ni++;
4059 /* Count windows displaying equip */
4060 if (window_flag[j] & (PW_EQUIP)) ne++;
4063 /* Toggle if needed */
4064 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
4065 (command_wrk == (USE_INVEN) && !ni && ne))
4068 toggle_inven_equip();
4075 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4077 /* Redraw windows */
4080 /* Inventory screen */
4081 if (command_wrk == (USE_INVEN))
4083 /* Extract the legal requests */
4087 /* Redraw if needed */
4088 if (command_see) get_item_label = show_inven(menu_line);
4091 /* Equipment screen */
4092 else if (command_wrk == (USE_EQUIP))
4094 /* Extract the legal requests */
4095 n1 = I2A(e1 - INVEN_RARM);
4096 n2 = I2A(e2 - INVEN_RARM);
4098 /* Redraw if needed */
4099 if (command_see) get_item_label = show_equip(menu_line);
4103 else if (command_wrk == (USE_FLOOR))
4106 k = MIN(floor_top + 23, floor_num) - 1;
4108 /* Extract the legal requests */
4109 n1 = I2A(j - floor_top);
4110 n2 = I2A(k - floor_top);
4112 /* Redraw if needed */
4113 if (command_see) get_item_label = show_floor(menu_line, p_ptr->y, p_ptr->x, &min_width);
4116 /* Viewing inventory */
4117 if (command_wrk == (USE_INVEN))
4119 /* Begin the prompt */
4120 sprintf(out_val, _("持ち物:", "Inven:"));
4124 /* Build the prompt */
4125 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4126 index_to_label(i1), index_to_label(i2));
4129 strcat(out_val, tmp_val);
4132 /* Indicate ability to "view" */
4133 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4140 strcat(out_val, " '/' 装備品,");
4141 else if (allow_floor)
4142 strcat(out_val, " '6' 装備品,");
4144 strcat(out_val, " '4'or'6' 装備品,");
4147 strcat(out_val, " / for Equip,");
4148 else if (allow_floor)
4149 strcat(out_val, " 6 for Equip,");
4151 strcat(out_val, " 4 or 6 for Equip,");
4160 strcat(out_val, " '-'床上,");
4161 else if (allow_equip)
4162 strcat(out_val, " '4' 床上,");
4164 strcat(out_val, " '4'or'6' 床上,");
4167 strcat(out_val, " - for floor,");
4168 else if (allow_equip)
4169 strcat(out_val, " 4 for floor,");
4171 strcat(out_val, " 4 or 6 for floor,");
4176 /* Viewing equipment */
4177 else if (command_wrk == (USE_EQUIP))
4179 /* Begin the prompt */
4180 sprintf(out_val, _("装備品:", "Equip:"));
4184 /* Build the prompt */
4185 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"),
4186 index_to_label(e1), index_to_label(e2));
4189 strcat(out_val, tmp_val);
4192 /* Indicate ability to "view" */
4193 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4200 strcat(out_val, " '/' 持ち物,");
4201 else if (allow_floor)
4202 strcat(out_val, " '4' 持ち物,");
4204 strcat(out_val, " '4'or'6' 持ち物,");
4207 strcat(out_val, " / for Inven,");
4208 else if (allow_floor)
4209 strcat(out_val, " 4 for Inven,");
4211 strcat(out_val, " 4 or 6 for Inven,");
4220 strcat(out_val, " '-'床上,");
4221 else if (allow_inven)
4222 strcat(out_val, " '6' 床上,");
4224 strcat(out_val, " '4'or'6' 床上,");
4227 strcat(out_val, " - for floor,");
4228 else if (allow_inven)
4229 strcat(out_val, " 6 for floor,");
4231 strcat(out_val, " 4 or 6 for floor,");
4237 else if (command_wrk == (USE_FLOOR))
4239 /* Begin the prompt */
4240 sprintf(out_val, _("床上:", "Floor:"));
4244 /* Build the prompt */
4245 sprintf(tmp_val, _("%c-%c,'(',')',", " %c-%c,'(',')',"), n1, n2);
4248 strcat(out_val, tmp_val);
4251 /* Indicate ability to "view" */
4252 if (!command_see && !use_menu) strcat(out_val, _(" '*'一覧,", " * to see,"));
4256 if (allow_inven && allow_equip)
4258 strcat(out_val, _(" '4' 装備品, '6' 持ち物,", " 4 for Equip, 6 for Inven,"));
4260 else if (allow_inven)
4262 strcat(out_val, _(" '4'or'6' 持ち物,", " 4 or 6 for Inven,"));
4264 else if (allow_equip)
4266 strcat(out_val, _(" '4'or'6' 装備品,", " 4 or 6 for Equip,"));
4270 else if (allow_inven)
4272 strcat(out_val, _(" '/' 持ち物,", " / for Inven,"));
4274 else if (allow_equip)
4276 strcat(out_val, _(" '/'装備品,", " / for Equip,"));
4280 if (command_see && !use_menu)
4282 strcat(out_val, _(" Enter 次,", " Enter for scroll down,"));
4287 if (select_the_force) strcat(out_val, _(" 'w'練気術,", " w for the Force,"));
4289 /* Finish the prompt */
4290 strcat(out_val, " ESC");
4292 /* Build the prompt */
4293 sprintf(tmp_val, "(%s) %s", out_val, pmt);
4295 /* Show the prompt */
4304 if (command_wrk == USE_INVEN) max_line = max_inven;
4305 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4306 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4322 menu_line += (max_line - 1);
4338 /* Verify legality */
4339 if (command_wrk == (USE_INVEN))
4341 if (allow_floor) command_wrk = USE_FLOOR;
4342 else if (allow_equip) command_wrk = USE_EQUIP;
4349 else if (command_wrk == (USE_EQUIP))
4351 if (allow_inven) command_wrk = USE_INVEN;
4352 else if (allow_floor) command_wrk = USE_FLOOR;
4359 else if (command_wrk == (USE_FLOOR))
4361 if (allow_equip) command_wrk = USE_EQUIP;
4362 else if (allow_inven) command_wrk = USE_INVEN;
4375 /* Hack -- Fix screen */
4385 /* Switch inven/equip */
4386 if (command_wrk == USE_INVEN) max_line = max_inven;
4387 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4388 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4389 if (menu_line > max_line) menu_line = max_line;
4391 /* Need to redraw */
4399 /* Verify legality */
4400 if (command_wrk == (USE_INVEN))
4402 if (allow_equip) command_wrk = USE_EQUIP;
4403 else if (allow_floor) command_wrk = USE_FLOOR;
4410 else if (command_wrk == (USE_EQUIP))
4412 if (allow_floor) command_wrk = USE_FLOOR;
4413 else if (allow_inven) command_wrk = USE_INVEN;
4420 else if (command_wrk == (USE_FLOOR))
4422 if (allow_inven) command_wrk = USE_INVEN;
4423 else if (allow_equip) command_wrk = USE_EQUIP;
4436 /* Hack -- Fix screen */
4446 /* Switch inven/equip */
4447 if (command_wrk == USE_INVEN) max_line = max_inven;
4448 else if (command_wrk == USE_EQUIP) max_line = max_equip;
4449 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
4450 if (menu_line > max_line) menu_line = max_line;
4452 /* Need to redraw */
4461 if (command_wrk == USE_FLOOR)
4464 (*cp) = -get_item_label;
4468 /* Validate the item */
4469 if (!get_item_okay(get_item_label))
4475 /* Allow player to "refuse" certain actions */
4476 if (!get_item_allow(get_item_label))
4482 /* Accept that choice */
4483 (*cp) = get_item_label;
4492 if (select_the_force) {
4500 if (menu_line > max_line) menu_line -= max_line;
4521 command_see = FALSE;
4545 cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
4547 if (command_wrk != (USE_FLOOR)) break;
4549 /* Get the object being moved. */
4550 o_idx = c_ptr->o_idx;
4552 /* Only rotate a pile of two or more objects. */
4553 if (!(o_idx && o_list[o_idx].next_o_idx)) break;
4555 /* Remove the first object from the list. */
4556 excise_object_idx(o_idx);
4558 /* Find end of the list. */
4560 while (o_list[i].next_o_idx)
4561 i = o_list[i].next_o_idx;
4563 /* Add after the last object. */
4564 o_list[i].next_o_idx = o_idx;
4566 /* Re-scan floor list */
4567 floor_num = scan_floor(floor_list, p_ptr->y, p_ptr->x, 0x03);
4569 /* Hack -- Fix screen */
4584 if (command_wrk == (USE_INVEN))
4591 command_wrk = (USE_EQUIP);
4593 else if (command_wrk == (USE_EQUIP))
4600 command_wrk = (USE_INVEN);
4602 else if (command_wrk == (USE_FLOOR))
4606 command_wrk = (USE_INVEN);
4608 else if (allow_equip)
4610 command_wrk = (USE_EQUIP);
4619 /* Hack -- Fix screen */
4629 /* Need to redraw */
4642 * If we are already examining the floor, and there
4643 * is only one item, we will always select it.
4644 * If we aren't examining the floor and there is only
4645 * one item, we will select it if floor_query_flag
4650 if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
4653 k = 0 - floor_list[0];
4655 /* Allow player to "refuse" certain actions */
4656 if (!get_item_allow(k))
4662 /* Accept that choice */
4671 /* Hack -- Fix screen */
4681 command_wrk = (USE_FLOOR);
4687 case '1': case '2': case '3':
4688 case '4': case '5': case '6':
4689 case '7': case '8': case '9':
4691 if (command_wrk != USE_FLOOR)
4693 /* Look up the tag */
4694 if (!get_tag(&k, which, command_wrk))
4700 /* Hack -- Validate the item */
4701 if ((k < INVEN_RARM) ? !inven : !equip)
4707 /* Validate the item */
4708 if (!get_item_okay(k))
4716 /* Look up the alphabetical tag */
4717 if (get_tag_floor(&k, which, floor_list, floor_num))
4720 k = 0 - floor_list[k];
4729 /* Allow player to "refuse" certain actions */
4730 if (!get_item_allow(k))
4736 /* Accept that choice */
4742 #endif /* ALLOW_REPEAT */
4750 /* Choose "default" inventory item */
4751 if (command_wrk == (USE_INVEN))
4753 k = ((i1 == i2) ? i1 : -1);
4756 /* Choose "default" equipment item */
4757 else if (command_wrk == (USE_EQUIP))
4759 k = ((e1 == e2) ? e1 : -1);
4762 /* Choose "default" floor item */
4763 else if (command_wrk == (USE_FLOOR))
4768 k = 0 - floor_list[0];
4770 /* Allow player to "refuse" certain actions */
4771 if (!get_item_allow(k))
4777 /* Accept that choice */
4785 /* Validate the item */
4786 if (!get_item_okay(k))
4792 /* Allow player to "refuse" certain actions */
4793 if (!get_item_allow(k))
4799 /* Accept that choice */
4809 if (select_the_force) {
4823 if (command_wrk != USE_FLOOR)
4825 bool not_found = FALSE;
4827 /* Look up the alphabetical tag */
4828 if (!get_tag(&k, which, command_wrk))
4833 /* Hack -- Validate the item */
4834 else if ((k < INVEN_RARM) ? !inven : !equip)
4839 /* Validate the item */
4840 else if (!get_item_okay(k))
4847 /* Accept that choice */
4853 #endif /* ALLOW_REPEAT */
4859 /* Look up the alphabetical tag */
4860 if (get_tag_floor(&k, which, floor_list, floor_num))
4863 k = 0 - floor_list[k];
4865 /* Accept that choice */
4871 #endif /* ALLOW_REPEAT */
4876 /* Extract "query" setting */
4877 ver = isupper(which);
4878 which = (char)tolower(which);
4880 /* Convert letter to inventory index */
4881 if (command_wrk == (USE_INVEN))
4883 if (which == '(') k = i1;
4884 else if (which == ')') k = i2;
4885 else k = label_to_inven(which);
4888 /* Convert letter to equipment index */
4889 else if (command_wrk == (USE_EQUIP))
4891 if (which == '(') k = e1;
4892 else if (which == ')') k = e2;
4893 else k = label_to_equip(which);
4896 /* Convert letter to floor index */
4897 else if (command_wrk == USE_FLOOR)
4899 if (which == '(') k = 0;
4900 else if (which == ')') k = floor_num - 1;
4901 else k = islower(which) ? A2I(which) : -1;
4902 if (k < 0 || k >= floor_num || k >= 23)
4909 k = 0 - floor_list[k];
4912 /* Validate the item */
4913 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
4919 /* Verify the item */
4920 if (ver && !verify(_("本当に", "Try"), k))
4926 /* Allow player to "refuse" certain actions */
4927 if (!get_item_allow(k))
4933 /* Accept that choice */
4943 /* Fix the screen if necessary */
4949 /* Hack -- Cancel "display" */
4950 command_see = FALSE;
4954 /* Forget the item_tester_tval restriction */
4955 item_tester_tval = 0;
4957 /* Forget the item_tester_hook restriction */
4958 item_tester_hook = NULL;
4961 /* Clean up 'show choices' */
4962 /* Toggle again if needed */
4963 if (toggle) toggle_inven_equip();
4966 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4972 /* Clear the prompt line */
4975 /* Warning if needed */
4976 if (oops && str) msg_print(str);
4982 if (command_cmd) prev_tag = cur_tag;
4983 #endif /* ALLOW_REPEAT */
4985 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4993 * @brief 床上のアイテムを拾う選択用サブルーチン
4994 * @return プレイヤーによりアイテムが選択されたならTRUEを返す。
4996 static bool py_pickup_floor_aux(void)
4998 OBJECT_IDX this_o_idx;
5004 /* Restrict the choices */
5005 item_tester_hook = inven_carry_okay;
5008 q = _("どれを拾いますか?", "Get which item? ");
5009 s = _("もうザックには床にあるどのアイテムも入らない。", "You no longer have any room for the objects on the floor.");
5011 if (get_item(&item, q, s, (USE_FLOOR)))
5013 this_o_idx = 0 - item;
5020 /* Pick up the object */
5021 py_pickup_aux(this_o_idx);
5027 * @brief 床上のアイテムを拾うメイン処理
5028 * @param pickup FALSEなら金銭の自動拾いのみを行う/ FALSE then only gold will be picked up
5031 * This is called by py_pickup() when easy_floor is TRUE.
5033 void py_pickup_floor(bool pickup)
5035 OBJECT_IDX this_o_idx, next_o_idx = 0;
5037 char o_name[MAX_NLEN];
5041 OBJECT_IDX floor_o_idx = 0;
5045 /* Scan the pile of objects */
5046 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
5048 /* Access the object */
5049 o_ptr = &o_list[this_o_idx];
5051 /* Describe the object */
5052 object_desc(o_name, o_ptr, 0);
5054 /* Access the next object */
5055 next_o_idx = o_ptr->next_o_idx;
5057 /* Hack -- disturb */
5061 if (o_ptr->tval == TV_GOLD)
5065 msg_format(" $%ld の価値がある%sを見つけた。",
5066 (long)o_ptr->pval, o_name);
5068 msg_format("You have found %ld gold pieces worth of %s.",
5069 (long)o_ptr->pval, o_name);
5072 /* Collect the gold */
5073 p_ptr->au += o_ptr->pval;
5076 p_ptr->redraw |= (PR_GOLD);
5079 p_ptr->window |= (PW_PLAYER);
5081 /* Delete the gold */
5082 delete_object_idx(this_o_idx);
5084 /* Check the next object */
5087 else if (o_ptr->marked & OM_NOMSG)
5089 /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
5090 * ignored. Otherwise, they are included in the prompt. */
5091 o_ptr->marked &= ~(OM_NOMSG);
5095 /* Count non-gold objects that can be picked up. */
5096 if (inven_carry_okay(o_ptr))
5101 /* Count non-gold objects */
5104 /* Remember this index */
5105 floor_o_idx = this_o_idx;
5108 /* There are no non-gold objects */
5112 /* Mention the number of objects */
5118 /* Access the object */
5119 o_ptr = &o_list[floor_o_idx];
5121 #ifdef ALLOW_EASY_SENSE
5123 /* Option: Make object sensing easy */
5126 /* Sense the object */
5127 (void) sense_object(o_ptr);
5130 #endif /* ALLOW_EASY_SENSE */
5132 /* Describe the object */
5133 object_desc(o_name, o_ptr, 0);
5136 msg_format(_("%sがある。", "You see %s."), o_name);
5139 /* Multiple objects */
5143 msg_format(_("%d 個のアイテムの山がある。", "You see a pile of %d items."), floor_num);
5150 /* The player has no room for anything on the floor. */
5156 /* Access the object */
5157 o_ptr = &o_list[floor_o_idx];
5159 #ifdef ALLOW_EASY_SENSE
5161 /* Option: Make object sensing easy */
5164 /* Sense the object */
5165 (void) sense_object(o_ptr);
5168 #endif /* ALLOW_EASY_SENSE */
5170 /* Describe the object */
5171 object_desc(o_name, o_ptr, 0);
5174 msg_format(_("ザックには%sを入れる隙間がない。", "You have no room for %s."), o_name);
5177 /* Multiple objects */
5181 msg_print(_("ザックには床にあるどのアイテムも入らない。", "You have no room for any of the objects on the floor."));
5192 /* Hack -- query every object */
5193 if (carry_query_flag)
5195 char out_val[MAX_NLEN+20];
5197 /* Access the object */
5198 o_ptr = &o_list[floor_o_idx];
5200 #ifdef ALLOW_EASY_SENSE
5202 /* Option: Make object sensing easy */
5205 /* Sense the object */
5206 (void) sense_object(o_ptr);
5209 #endif /* ALLOW_EASY_SENSE */
5211 /* Describe the object */
5212 object_desc(o_name, o_ptr, 0);
5214 /* Build a prompt */
5215 (void) sprintf(out_val, _("%sを拾いますか? ", "Pick up %s? "), o_name);
5217 /* Ask the user to confirm */
5218 if (!get_check(out_val))
5225 /* Access the object */
5226 o_ptr = &o_list[floor_o_idx];
5228 #ifdef ALLOW_EASY_SENSE
5230 /* Option: Make object sensing easy */
5233 /* Sense the object */
5234 (void) sense_object(o_ptr);
5237 #endif /* ALLOW_EASY_SENSE */
5239 /* Pick up the object */
5240 py_pickup_aux(floor_o_idx);
5243 /* Allow the user to choose an object */
5246 while (can_pickup--)
5248 if (!py_pickup_floor_aux()) break;
5253 #endif /* ALLOW_EASY_FLOOR */