OSDN Git Service

Fix Doxygen warning in object1.c.
[hengband/hengband.git] / src / object1.c
1 /*!
2  * @file object1.c
3  * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤Î¼ÂÁõ / Object code, part 1
4  * @date 2014/01/10
5  * @author
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7  *\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
12  */
13
14 #include "angband.h"
15
16 #if defined(MACINTOSH) || defined(MACH_O_CARBON)
17 #ifdef verify
18 #undef verify
19 #endif
20 #endif
21
22 /*!
23  * @brief ¥ª¥Ö¥¸¥§¥¯¥È¡¢ÃÏ·Á¤Îɽ¼¨¥·¥ó¥Ü¥ë¤Ê¤É½é´ü²½¤¹¤ë / Reset the "visual" lists
24  * @return ¤Ê¤·
25  * This involves resetting various things to their "default" state.\n
26  *\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
30  *\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
33  *\n
34  * The "prefs" parameter is no longer meaningful.  XXX XXX XXX\n
35  */
36 void reset_visuals(void)
37 {
38         int i, j;
39
40         /* Extract some info about terrain features */
41         for (i = 0; i < max_f_idx; i++)
42         {
43                 feature_type *f_ptr = &f_info[i];
44
45                 /* Assume we will use the underlying values */
46                 for (j = 0; j < F_LIT_MAX; j++)
47                 {
48                         f_ptr->x_attr[j] = f_ptr->d_attr[j];
49                         f_ptr->x_char[j] = f_ptr->d_char[j];
50                 }
51         }
52
53         /* Extract default attr/char code for objects */
54         for (i = 0; i < max_k_idx; i++)
55         {
56                 object_kind *k_ptr = &k_info[i];
57
58                 /* Default attr/char */
59                 k_ptr->x_attr = k_ptr->d_attr;
60                 k_ptr->x_char = k_ptr->d_char;
61         }
62
63         /* Extract default attr/char code for monsters */
64         for (i = 0; i < max_r_idx; i++)
65         {
66                 monster_race *r_ptr = &r_info[i];
67
68                 /* Default attr/char */
69                 r_ptr->x_attr = r_ptr->d_attr;
70                 r_ptr->x_char = r_ptr->d_char;
71         }
72
73         if (use_graphics)
74         {
75                 char buf[1024];
76
77                 /* Process "graf.prf" */
78                 process_pref_file("graf.prf");
79
80                 /* Access the "character" pref file */
81                 sprintf(buf, "graf-%s.prf", player_base);
82
83                 /* Process "graf-<playername>.prf" */
84                 process_pref_file(buf);
85         }
86
87         /* Normal symbols */
88         else
89         {
90                 char buf[1024];
91
92                 /* Process "font.prf" */
93                 process_pref_file("font.prf");
94
95                 /* Access the "character" pref file */
96                 sprintf(buf, "font-%s.prf", player_base);
97
98                 /* Process "font-<playername>.prf" */
99                 process_pref_file(buf);
100         }
101 }
102
103 /*!
104  * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Õ¥é¥°Îà¤òÇÛÎó¤ËÍ¿¤¨¤ë
105  * Obtain the "flags" for an item
106  * @param o_ptr ¥Õ¥é¥°¼èÆÀ¸µ¤Î¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΥݥ¤¥ó¥¿
107  * @param flgs ¥Õ¥é¥°¾ðÊó¤ò¼õ¤±¼è¤ëÇÛÎó
108  * @return ¤Ê¤·
109  */
110 void object_flags(object_type *o_ptr, u32b flgs[TR_FLAG_SIZE])
111 {
112         object_kind *k_ptr = &k_info[o_ptr->k_idx];
113         int i;
114
115         /* Base object */
116         for (i = 0; i < TR_FLAG_SIZE; i++)
117                 flgs[i] = k_ptr->flags[i];
118
119         /* Artifact */
120         if (object_is_fixed_artifact(o_ptr))
121         {
122                 artifact_type *a_ptr = &a_info[o_ptr->name1];
123
124                 for (i = 0; i < TR_FLAG_SIZE; i++)
125                         flgs[i] = a_ptr->flags[i];
126         }
127
128         /* Ego-item */
129         if (object_is_ego(o_ptr))
130         {
131                 ego_item_type *e_ptr = &e_info[o_ptr->name2];
132
133                 for (i = 0; i < TR_FLAG_SIZE; i++)
134                         flgs[i] |= e_ptr->flags[i];
135
136                 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
137                 {
138                         remove_flag(flgs, TR_SH_FIRE);
139                 }
140                 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
141                 {
142                         remove_flag(flgs, TR_INFRA);
143                 }
144                 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
145                 {
146                         remove_flag(flgs, TR_RES_BLIND);
147                         remove_flag(flgs, TR_SEE_INVIS);
148                 }
149         }
150
151         /* Random artifact ! */
152         for (i = 0; i < TR_FLAG_SIZE; i++)
153                 flgs[i] |= o_ptr->art_flags[i];
154
155         if (object_is_smith(o_ptr))
156         {
157                 int add = o_ptr->xtra3 - 1;
158
159                 if (add < TR_FLAG_MAX)
160                 {
161                         add_flag(flgs, add);
162                 }
163                 else if (add == ESSENCE_TMP_RES_ACID)
164                 {
165                         add_flag(flgs, TR_RES_ACID);
166                         add_flag(flgs, TR_ACTIVATE);
167                 }
168                 else if (add == ESSENCE_TMP_RES_ELEC)
169                 {
170                         add_flag(flgs, TR_RES_ELEC);
171                         add_flag(flgs, TR_ACTIVATE);
172                 }
173                 else if (add == ESSENCE_TMP_RES_FIRE)
174                 {
175                         add_flag(flgs, TR_RES_FIRE);
176                         add_flag(flgs, TR_ACTIVATE);
177                 }
178                 else if (add == ESSENCE_TMP_RES_COLD)
179                 {
180                         add_flag(flgs, TR_RES_COLD);
181                         add_flag(flgs, TR_ACTIVATE);
182                 }
183                 else if (add == ESSENCE_SH_FIRE)
184                 {
185                         add_flag(flgs, TR_RES_FIRE);
186                         add_flag(flgs, TR_SH_FIRE);
187                 }
188                 else if (add == ESSENCE_SH_ELEC)
189                 {
190                         add_flag(flgs, TR_RES_ELEC);
191                         add_flag(flgs, TR_SH_ELEC);
192                 }
193                 else if (add == ESSENCE_SH_COLD)
194                 {
195                         add_flag(flgs, TR_RES_COLD);
196                         add_flag(flgs, TR_SH_COLD);
197                 }
198                 else if (add == ESSENCE_RESISTANCE)
199                 {
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);
204                 }
205                 else if (add == TR_IMPACT)
206                 {
207                         add_flag(flgs, TR_ACTIVATE);
208                 }
209         }
210 }
211
212 /*!
213  * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÌÀ¼¨¤µ¤ì¤Æ¤¤¤ë¥Õ¥é¥°Îà¤ò¼èÆÀ¤¹¤ë
214  * Obtain the "flags" for an item which are known to the player
215  * @param o_ptr ¥Õ¥é¥°¼èÆÀ¸µ¤Î¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤ÂΥݥ¤¥ó¥¿
216  * @param flgs ¥Õ¥é¥°¾ðÊó¤ò¼õ¤±¼è¤ëÇÛÎó
217  * @return ¤Ê¤·
218  */
219 void object_flags_known(object_type *o_ptr, u32b flgs[TR_FLAG_SIZE])
220 {
221         bool spoil = FALSE;
222         int i;
223
224         object_kind *k_ptr = &k_info[o_ptr->k_idx];
225
226         /* Clear */
227         for (i = 0; i < TR_FLAG_SIZE; i++)
228                 flgs[i] = 0;
229
230         if (!object_is_aware(o_ptr)) return;
231
232         /* Base object */
233         for (i = 0; i < TR_FLAG_SIZE; i++)
234                 flgs[i] = k_ptr->flags[i];
235
236         /* Must be identified */
237         if (!object_is_known(o_ptr)) return;
238
239         /* Ego-item (known basic flags) */
240         if (object_is_ego(o_ptr))
241         {
242                 ego_item_type *e_ptr = &e_info[o_ptr->name2];
243
244                 for (i = 0; i < TR_FLAG_SIZE; i++)
245                         flgs[i] |= e_ptr->flags[i];
246
247                 if ((o_ptr->name2 == EGO_LITE_AURA_FIRE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
248                 {
249                         remove_flag(flgs, TR_SH_FIRE);
250                 }
251                 else if ((o_ptr->name2 == EGO_LITE_INFRA) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
252                 {
253                         remove_flag(flgs, TR_INFRA);
254                 }
255                 else if ((o_ptr->name2 == EGO_LITE_EYE) && !o_ptr->xtra4 && (o_ptr->sval <= SV_LITE_LANTERN))
256                 {
257                         remove_flag(flgs, TR_RES_BLIND);
258                         remove_flag(flgs, TR_SEE_INVIS);
259                 }
260         }
261
262
263 #ifdef SPOIL_ARTIFACTS
264         /* Full knowledge for some artifacts */
265         if (object_is_artifact(o_ptr)) spoil = TRUE;
266 #endif /* SPOIL_ARTIFACTS */
267
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 */
272
273         /* Need full knowledge or spoilers */
274         if (spoil || (o_ptr->ident & IDENT_MENTAL))
275         {
276                 /* Artifact */
277                 if (object_is_fixed_artifact(o_ptr))
278                 {
279                         artifact_type *a_ptr = &a_info[o_ptr->name1];
280
281                         for (i = 0; i < TR_FLAG_SIZE; i++)
282                                 flgs[i] = a_ptr->flags[i];
283                 }
284
285                 /* Random artifact ! */
286                 for (i = 0; i < TR_FLAG_SIZE; i++)
287                         flgs[i] |= o_ptr->art_flags[i];
288         }
289
290         if (object_is_smith(o_ptr))
291         {
292                 int add = o_ptr->xtra3 - 1;
293
294                 if (add < TR_FLAG_MAX)
295                 {
296                         add_flag(flgs, add);
297                 }
298                 else if (add == ESSENCE_TMP_RES_ACID)
299                 {
300                         add_flag(flgs, TR_RES_ACID);
301                 }
302                 else if (add == ESSENCE_TMP_RES_ELEC)
303                 {
304                         add_flag(flgs, TR_RES_ELEC);
305                 }
306                 else if (add == ESSENCE_TMP_RES_FIRE)
307                 {
308                         add_flag(flgs, TR_RES_FIRE);
309                 }
310                 else if (add == ESSENCE_TMP_RES_COLD)
311                 {
312                         add_flag(flgs, TR_RES_COLD);
313                 }
314                 else if (add == ESSENCE_SH_FIRE)
315                 {
316                         add_flag(flgs, TR_RES_FIRE);
317                         add_flag(flgs, TR_SH_FIRE);
318                 }
319                 else if (add == ESSENCE_SH_ELEC)
320                 {
321                         add_flag(flgs, TR_RES_ELEC);
322                         add_flag(flgs, TR_SH_ELEC);
323                 }
324                 else if (add == ESSENCE_SH_COLD)
325                 {
326                         add_flag(flgs, TR_RES_COLD);
327                         add_flag(flgs, TR_SH_COLD);
328                 }
329                 else if (add == ESSENCE_RESISTANCE)
330                 {
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);
335                 }
336         }
337 }
338
339 /*!
340  * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤Îȯư¸ú²Ì̾¾Î¤òÊÖ¤¹¡Ê¥µ¥Ö¥ë¡¼¥Á¥ó/¥Ö¥ì¥¹¡Ë
341  * @param o_ptr Ì¾¾Î¤ò¼èÆÀ¤¹¤ë¸µ¤Î¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
342  * @return cptr È¯Æ°Ì¾¾Î¤òÊÖ¤¹Ê¸»úÎó¥Ý¥¤¥ó¥¿
343  */
344 static cptr item_activation_dragon_breath(object_type *o_ptr)
345 {
346         static char desc[256];
347         u32b flgs[TR_FLAG_SIZE]; /* for resistance flags */
348         int i, n = 0;
349
350         object_flags(o_ptr, flgs);
351         strcpy(desc, _("", "breath "));
352
353         for (i = 0; dragonbreath_info[i].flag != 0; i++)
354         {
355                 if (have_flag(flgs, dragonbreath_info[i].flag))
356                 {
357                         if (n > 0) strcat(desc, _("¡¢", ", "));
358                         strcat(desc, dragonbreath_info[i].name);
359                         n++;
360                 }
361         }
362
363         strcat(desc, _("¤Î¥Ö¥ì¥¹(250)", ""));
364
365         return (desc);
366 }
367
368 /*!
369  * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤Îȯư¸ú²Ì̾¾Î¤òÊÖ¤¹¡Ê¥µ¥Ö¥ë¡¼¥Á¥ó/ÈÆÍÑ¡Ë
370  * @param o_ptr Ì¾¾Î¤ò¼èÆÀ¤¹¤ë¸µ¤Î¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
371  * @return cptr È¯Æ°Ì¾¾Î¤òÊÖ¤¹Ê¸»úÎó¥Ý¥¤¥ó¥¿
372  */
373 static cptr item_activation_aux(object_type *o_ptr)
374 {
375         static char activation_detail[256];
376         cptr desc;
377         char timeout[32];
378         int constant, dice;
379         const activation_type* const act_ptr = find_activation_info(o_ptr);
380
381         if (!act_ptr) return _("̤ÄêµÁ", "something undefined");
382
383         desc = act_ptr->desc;
384
385         /* Overwrite description if it is special */
386         switch (act_ptr->index) {
387         case ACT_BR_FIRE:
388                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
389                         desc = _("²Ð±ê¤Î¥Ö¥ì¥¹ (200) ¤È²Ð¤Ø¤ÎÂÑÀ­", "breath of fire (200) and resist fire");
390                 break;
391         case ACT_BR_COLD:
392                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
393                         desc = _("Î䵤¤Î¥Ö¥ì¥¹ (200) ¤ÈÎ䵤¤Ø¤ÎÂÑÀ­", "breath of cold (200) and resist cold");
394                 break;
395         case ACT_BR_DRAGON:
396                 desc = item_activation_dragon_breath(o_ptr);
397                 break;
398         case ACT_AGGRAVATE:
399                 if (o_ptr->name1 == ART_HYOUSIGI)
400                         desc = _("Çï»ÒÌÚ¤òÂǤÁ¤Ê¤é¤¹", "beat wooden clappers");
401                 break;
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");
405                 break;
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");
409                 break;
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");
413                 break;
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");
417                 break;
418         case ACT_RESIST_POIS:
419                 if (o_ptr->name2 == EGO_BRAND_POIS)
420                         desc = _("°­½­±À (100) ¤ÈÆǤؤÎÂÑÀ­", "ball of poison (100) and resist elec");
421                 break;
422         }
423
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) {
433                 case ACT_BR_FIRE:
434                         sprintf(timeout, _("%d ¥¿¡¼¥óËè", "every %d turns"),
435                                 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250);
436                         break;
437                 case ACT_BR_COLD:
438                         sprintf(timeout, _("%d ¥¿¡¼¥óËè", "every %d turns"),
439                                 ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250);
440                         break;
441                 case ACT_TERROR:
442                         strcpy(timeout, _("3*(¥ì¥Ù¥ë+10) ¥¿¡¼¥óËè", "every 3 * (level+10) turns"));
443                         break;
444                 case ACT_MURAMASA:
445                         strcpy(timeout, _("³ÎΨ50%¤Ç²õ¤ì¤ë", "(destroyed 50%)"));
446                         break;
447                 default:
448                         strcpy(timeout, "undefined");
449                         break;
450                 }
451         } else {
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 : "");
460         }
461
462         /* Build detail activate description */
463         sprintf(activation_detail, _("%s : %s", "%s %s"), desc, timeout);
464
465         return activation_detail;
466 }
467
468 /*!
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 È¯Æ°Ì¾¾Î¤òÊÖ¤¹Ê¸»úÎó¥Ý¥¤¥ó¥¿
473  */
474 cptr item_activation(object_type *o_ptr)
475 {
476         u32b flgs[TR_FLAG_SIZE];
477
478         /* Extract the flags */
479         object_flags(o_ptr, flgs);
480
481         /* Require activation ability */
482 #ifdef JP
483         if (!(have_flag(flgs, TR_ACTIVATE))) return ("¤Ê¤·");
484 #else
485         if (!(have_flag(flgs, TR_ACTIVATE))) return ("nothing");
486 #endif
487
488         /* Get an explain of an activation */
489         if (activation_index(o_ptr))
490         {
491                 return item_activation_aux(o_ptr);
492         }
493
494         /* Special items */
495         if (o_ptr->tval == TV_WHISTLE)
496         {
497 #ifdef JP
498 return "¥Ú¥Ã¥È¸Æ¤Ó´ó¤» : 100+d100¥¿¡¼¥óËè";
499 #else
500                 return "call pet every 100+d100 turns";
501 #endif
502         }
503
504         if (o_ptr->tval == TV_CAPTURE)
505         {
506 #ifdef JP
507 return "¥â¥ó¥¹¥¿¡¼¤òÊᤨ¤ë¡¢Ëô¤Ï²òÊü¤¹¤ë¡£";
508 #else
509                 return "captures or releases a monster.";
510 #endif
511         }
512
513         /* Oops */
514 #ifdef JP
515         return "²¿¤âµ¯¤­¤Ê¤¤";
516 #else
517         return "Nothing";
518 #endif
519 }
520
521
522 /*!
523  * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤Î*´ÕÄê*ÆâÍƤò¾Ü½Ò¤·¤Æɽ¼¨¤¹¤ë /
524  * Describe a "fully identified" item
525  * @param o_ptr *´ÕÄê*¾ðÊó¤ò¼èÆÀ¤¹¤ë¸µ¤Î¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
526  * @param mode É½¼¨¥ª¥×¥·¥ç¥ó
527  * @return ÆÃÉ®¤¹¤Ù¤­¾ðÊ󤬰ì¤Ä¤Ç¤â¤¢¤Ã¤¿¾ì¹çTRUE¡¢°ì¤Ä¤â¤Ê¤¯É½¼¨¤¬¥­¥ã¥ó¥»¥ë¤µ¤ì¤¿¾ì¹çFALSE¤òÊÖ¤¹¡£
528  */
529 bool screen_object(object_type *o_ptr, u32b mode)
530 {
531         int                     i = 0, j, k;
532
533         u32b flgs[TR_FLAG_SIZE];
534
535         char temp[70 * 20];
536         cptr            info[128];
537         char o_name[MAX_NLEN];
538         int wid, hgt;
539         int rad;
540         char desc[256];
541
542         int trivial_info = 0;
543
544         /* Extract the flags */
545         object_flags(o_ptr, flgs);
546
547         /* Extract the description */
548         {
549                 roff_to_buf(o_ptr->name1 ? (a_text + a_info[o_ptr->name1].text) :
550                             (k_text + k_info[o_ptr->k_idx].text),
551                             77 - 15, temp, sizeof(temp));
552                 for (j = 0; temp[j]; j += 1 + strlen(&temp[j]))
553                 { info[i] = &temp[j]; i++;}
554         }
555
556         if (object_is_equipment(o_ptr))
557         {
558                 /* Descriptions of a basic equipment is just a flavor */
559                 trivial_info = i;
560         }
561
562         /* Mega-Hack -- describe activation */
563         if (have_flag(flgs, TR_ACTIVATE))
564         {
565 #ifdef JP
566 info[i++] = "»ÏÆ°¤·¤¿¤È¤­¤Î¸ú²Ì...";
567 #else
568                 info[i++] = "It can be activated for...";
569 #endif
570
571                 info[i++] = item_activation(o_ptr);
572 #ifdef JP
573 info[i++] = "...¤¿¤À¤·ÁõÈ÷¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£";
574 #else
575                 info[i++] = "...if it is being worn.";
576 #endif
577
578         }
579
580         /* Figurines, a hack */
581         if (o_ptr->tval == TV_FIGURINE)
582         {
583 #ifdef JP
584 info[i++] = "¤½¤ì¤ÏÅꤲ¤¿»þ¥Ú¥Ã¥È¤ËÊѲ½¤¹¤ë¡£";
585 #else
586                 info[i++] = "It will transform into a pet when thrown.";
587 #endif
588
589         }
590
591         /* Figurines, a hack */
592         if (o_ptr->name1 == ART_STONEMASK)
593         {
594 #ifdef JP
595 info[i++] = "¤½¤ì¤òÁõÈ÷¤·¤¿¼Ô¤ÏµÛ·ìµ´¤Ë¤Ê¤ë¡£";
596 #else
597                 info[i++] = "It makes you turn into a vampire permanently.";
598 #endif
599
600         }
601
602         if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
603         {
604 #ifdef JP
605 info[i++] = "¤½¤ì¤ÏÁê¼ê¤ò°ì·â¤ÇÅݤ¹¤³¤È¤¬¤¢¤ë¡£";
606 #else
607                 info[i++] = "It will attempt to kill a monster instantly.";
608 #endif
609
610         }
611
612         if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
613         {
614 #ifdef JP
615 info[i++] = "¤½¤ì¤Ï¼«Ê¬¼«¿È¤Ë¹¶·â¤¬Ê֤äƤ¯¤ë¤³¤È¤¬¤¢¤ë¡£";
616 #else
617                 info[i++] = "It causes you to strike yourself sometimes.";
618 #endif
619
620 #ifdef JP
621 info[i++] = "¤½¤ì¤Ï̵Ũ¤Î¥Ð¥ê¥¢¤òÀÚ¤êÎö¤¯¡£";
622 #else
623                 info[i++] = "It always penetrates invulnerability barriers.";
624 #endif
625         }
626
627         if (o_ptr->name2 == EGO_2WEAPON)
628         {
629 #ifdef JP
630 info[i++] = "¤½¤ì¤ÏÆóÅáή¤Ç¤ÎÌ¿ÃæΨ¤ò¸þ¾å¤µ¤»¤ë¡£";
631 #else
632                 info[i++] = "It affects your ability to hit when you are wielding two weapons.";
633 #endif
634
635         }
636
637         if (have_flag(flgs, TR_EASY_SPELL))
638         {
639 #ifdef JP
640 info[i++] = "¤½¤ì¤ÏËâË¡¤ÎÆñ°×ÅÙ¤ò²¼¤²¤ë¡£";
641 #else
642                 info[i++] = "It affects your ability to cast spells.";
643 #endif
644         }
645
646         if (o_ptr->name2 == EGO_AMU_FOOL)
647         {
648 #ifdef JP
649 info[i++] = "¤½¤ì¤ÏËâË¡¤ÎÆñ°×ÅÙ¤ò¾å¤²¤ë¡£";
650 #else
651                 info[i++] = "It interferes with casting spells.";
652 #endif
653         }
654
655         if (o_ptr->name2 == EGO_RING_THROW)
656         {
657 #ifdef JP
658 info[i++] = "¤½¤ì¤Ïʪ¤ò¶¯¤¯Åꤲ¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë¡£";
659 #else
660                 info[i++] = "It provides great strength when you throw an item.";
661 #endif
662         }
663
664         if (o_ptr->name2 == EGO_AMU_NAIVETY)
665         {
666 #ifdef JP
667 info[i++] = "¤½¤ì¤ÏËâË¡Äñ¹³ÎϤò²¼¤²¤ë¡£";
668 #else
669                 info[i++] = "It decreases your magic resistance.";
670 #endif
671         }
672
673         if (o_ptr->tval == TV_STATUE)
674         {
675                 monster_race *r_ptr = &r_info[o_ptr->pval];
676
677                 if (o_ptr->pval == MON_BULLGATES)
678 #ifdef JP
679                         info[i++] = "¤½¤ì¤ÏÉô²°¤Ë¾þ¤ë¤ÈÃѤº¤«¤·¤¤¡£";
680 #else
681                         info[i++] = "It is shameful.";
682 #endif
683                 else if ( r_ptr->flags2 & (RF2_ELDRITCH_HORROR))
684 #ifdef JP
685                         info[i++] = "¤½¤ì¤ÏÉô²°¤Ë¾þ¤ë¤È¶²¤¤¡£";
686 #else
687                 info[i++] = "It is fearful.";
688 #endif
689                 else
690 #ifdef JP
691                         info[i++] = "¤½¤ì¤ÏÉô²°¤Ë¾þ¤ë¤È³Ú¤·¤¤¡£";
692 #else
693                 info[i++] = "It is cheerful.";
694 #endif
695         }
696         
697         /* Hack -- describe lite's */
698         
699         if (o_ptr->name2 == EGO_LITE_DARKNESS) info[i++] = _("¤½¤ì¤ÏÁ´¤¯¸÷¤é¤Ê¤¤¡£", "It provides no light.");
700         
701         rad = 0;
702         if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS)  rad += 1;
703         if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS)  rad += 2;
704         if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS)  rad += 3;
705         if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
706         if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
707         if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
708         
709         if(o_ptr->name2 == EGO_LITE_SHINE) rad++;
710                 
711         if (have_flag(flgs, TR_LITE_FUEL) && o_ptr->name2 != EGO_LITE_DARKNESS)
712         {
713                 if(rad > 0) sprintf(desc, _("¤½¤ì¤ÏdzÎÁÊäµë¤Ë¤è¤Ã¤ÆÌÀ¤«¤ê(Ⱦ·Â %d)¤ò¼ø¤±¤ë¡£", "It provides light (radius %d) when fueled."), rad);     
714         }
715         else
716         {
717                 if(rad > 0) sprintf(desc, _("¤½¤ì¤Ï±Ê±ó¤Ê¤ëÌÀ¤«¤ê(Ⱦ·Â %d)¤ò¼ø¤±¤ë¡£", "It provides light (radius %d) forever."), rad); 
718                 if(rad < 0) sprintf(desc, _("¤½¤ì¤ÏÌÀ¤«¤ê¤ÎȾ·Â¤ò¶¹¤á¤ë(Ⱦ·Â¤Ë-%d)¡£", "It decreases radius of light source by %d."), -rad);
719         }
720         
721         if(rad != 0) info[i++] = desc;
722
723         
724         if (o_ptr->name2 == EGO_LITE_LONG)
725         {
726                 info[i++] = _("¤½¤ì¤ÏŤ¤¥¿¡¼¥óÌÀ¤«¤ê¤ò¼ø¤±¤ë¡£", "It provides light for much longer time.");
727         }
728
729         /* And then describe it fully */
730
731         if (have_flag(flgs, TR_RIDING))
732         {
733                 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
734 #ifdef JP
735 info[i++] = "¤½¤ì¤Ï¾èÇÏÃæ¤ÏÈó¾ï¤Ë»È¤¤¤ä¤¹¤¤¡£";
736 #else
737                         info[i++] = "It is made for use while riding.";
738 #endif
739                 else
740                 {
741 #ifdef JP
742                         info[i++] = "¤½¤ì¤Ï¾èÇÏÃæ¤Ç¤â»È¤¤¤ä¤¹¤¤¡£";
743 #else
744                         info[i++] = "It is suitable for use while riding.";
745 #endif
746                         /* This information is not important enough */
747                         trivial_info++;
748                 }
749         }
750         if (have_flag(flgs, TR_STR))
751         {
752 #ifdef JP
753 info[i++] = "¤½¤ì¤ÏÏÓÎϤ˱ƶÁ¤òµÚ¤Ü¤¹¡£";
754 #else
755                 info[i++] = "It affects your strength.";
756 #endif
757
758         }
759         if (have_flag(flgs, TR_INT))
760         {
761 #ifdef JP
762 info[i++] = "¤½¤ì¤ÏÃÎǽ¤Ë±Æ¶Á¤òµÚ¤Ü¤¹¡£";
763 #else
764                 info[i++] = "It affects your intelligence.";
765 #endif
766
767         }
768         if (have_flag(flgs, TR_WIS))
769         {
770 #ifdef JP
771 info[i++] = "¤½¤ì¤Ï¸­¤µ¤Ë±Æ¶Á¤òµÚ¤Ü¤¹¡£";
772 #else
773                 info[i++] = "It affects your wisdom.";
774 #endif
775
776         }
777         if (have_flag(flgs, TR_DEX))
778         {
779 #ifdef JP
780 info[i++] = "¤½¤ì¤Ï´ïÍѤµ¤Ë±Æ¶Á¤òµÚ¤Ü¤¹¡£";
781 #else
782                 info[i++] = "It affects your dexterity.";
783 #endif
784
785         }
786         if (have_flag(flgs, TR_CON))
787         {
788 #ifdef JP
789 info[i++] = "¤½¤ì¤ÏÂѵ×ÎϤ˱ƶÁ¤òµÚ¤Ü¤¹¡£";
790 #else
791                 info[i++] = "It affects your constitution.";
792 #endif
793
794         }
795         if (have_flag(flgs, TR_CHR))
796         {
797 #ifdef JP
798 info[i++] = "¤½¤ì¤ÏÌ¥ÎϤ˱ƶÁ¤òµÚ¤Ü¤¹¡£";
799 #else
800                 info[i++] = "It affects your charisma.";
801 #endif
802
803         }
804
805         if (have_flag(flgs, TR_MAGIC_MASTERY))
806         {
807 #ifdef JP
808 info[i++] = "¤½¤ì¤ÏËâË¡Æ»¶ñ»ÈÍÑǽÎϤ˱ƶÁ¤òµÚ¤Ü¤¹¡£";
809 #else
810                 info[i++] = "It affects your ability to use magic devices.";
811 #endif
812
813         }
814         if (have_flag(flgs, TR_STEALTH))
815         {
816 #ifdef JP
817 info[i++] = "¤½¤ì¤Ï±£Ì©¹ÔưǽÎϤ˱ƶÁ¤òµÚ¤Ü¤¹¡£";
818 #else
819                 info[i++] = "It affects your stealth.";
820 #endif
821
822         }
823         if (have_flag(flgs, TR_SEARCH))
824         {
825 #ifdef JP
826 info[i++] = "¤½¤ì¤Ïõº÷ǽÎϤ˱ƶÁ¤òµÚ¤Ü¤¹¡£";
827 #else
828                 info[i++] = "It affects your searching.";
829 #endif
830
831         }
832         if (have_flag(flgs, TR_INFRA))
833         {
834 #ifdef JP
835 info[i++] = "¤½¤ì¤ÏÀÖ³°Àþ»ëÎϤ˱ƶÁ¤òµÚ¤Ü¤¹¡£";
836 #else
837                 info[i++] = "It affects your infravision.";
838 #endif
839
840         }
841         if (have_flag(flgs, TR_TUNNEL))
842         {
843 #ifdef JP
844 info[i++] = "¤½¤ì¤ÏºÎ·¡Ç½ÎϤ˱ƶÁ¤òµÚ¤Ü¤¹¡£";
845 #else
846                 info[i++] = "It affects your ability to tunnel.";
847 #endif
848
849         }
850         if (have_flag(flgs, TR_SPEED))
851         {
852 #ifdef JP
853 info[i++] = "¤½¤ì¤Ï¥¹¥Ô¡¼¥É¤Ë±Æ¶Á¤òµÚ¤Ü¤¹¡£";
854 #else
855                 info[i++] = "It affects your speed.";
856 #endif
857
858         }
859         if (have_flag(flgs, TR_BLOWS))
860         {
861 #ifdef JP
862 info[i++] = "¤½¤ì¤ÏÂÇ·â²ó¿ô¤Ë±Æ¶Á¤òµÚ¤Ü¤¹¡£";
863 #else
864                 info[i++] = "It affects your attack speed.";
865 #endif
866
867         }
868
869         if (have_flag(flgs, TR_BRAND_ACID))
870         {
871 #ifdef JP
872 info[i++] = "¤½¤ì¤Ï»À¤Ë¤è¤Ã¤ÆÂ礭¤Ê¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë¡£";
873 #else
874                 info[i++] = "It does extra damage from acid.";
875 #endif
876
877         }
878         if (have_flag(flgs, TR_BRAND_ELEC))
879         {
880 #ifdef JP
881 info[i++] = "¤½¤ì¤ÏÅÅ·â¤Ë¤è¤Ã¤ÆÂ礭¤Ê¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë¡£";
882 #else
883                 info[i++] = "It does extra damage from electricity.";
884 #endif
885
886         }
887         if (have_flag(flgs, TR_BRAND_FIRE))
888         {
889 #ifdef JP
890 info[i++] = "¤½¤ì¤Ï²Ð±ê¤Ë¤è¤Ã¤ÆÂ礭¤Ê¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë¡£";
891 #else
892                 info[i++] = "It does extra damage from fire.";
893 #endif
894
895         }
896         if (have_flag(flgs, TR_BRAND_COLD))
897         {
898 #ifdef JP
899 info[i++] = "¤½¤ì¤ÏÎ䵤¤Ë¤è¤Ã¤ÆÂ礭¤Ê¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë¡£";
900 #else
901                 info[i++] = "It does extra damage from frost.";
902 #endif
903
904         }
905
906         if (have_flag(flgs, TR_BRAND_POIS))
907         {
908 #ifdef JP
909 info[i++] = "¤½¤ì¤ÏŨ¤òÆǤ¹¤ë¡£";
910 #else
911                 info[i++] = "It poisons your foes.";
912 #endif
913
914         }
915
916         if (have_flag(flgs, TR_CHAOTIC))
917         {
918 #ifdef JP
919 info[i++] = "¤½¤ì¤Ï¥«¥ª¥¹Åª¤Ê¸ú²Ì¤òµÚ¤Ü¤¹¡£";
920 #else
921                 info[i++] = "It produces chaotic effects.";
922 #endif
923
924         }
925
926         if (have_flag(flgs, TR_VAMPIRIC))
927         {
928 #ifdef JP
929 info[i++] = "¤½¤ì¤ÏŨ¤«¤é¥Ò¥Ã¥È¥Ý¥¤¥ó¥È¤òµÛ¼ý¤¹¤ë¡£";
930 #else
931                 info[i++] = "It drains life from your foes.";
932 #endif
933
934         }
935
936         if (have_flag(flgs, TR_IMPACT))
937         {
938 #ifdef JP
939 info[i++] = "¤½¤ì¤ÏÃϿ̤òµ¯¤³¤¹¤³¤È¤¬¤Ç¤­¤ë¡£";
940 #else
941                 info[i++] = "It can cause earthquakes.";
942 #endif
943
944         }
945
946         if (have_flag(flgs, TR_VORPAL))
947         {
948 #ifdef JP
949 info[i++] = "¤½¤ì¤ÏÈó¾ï¤ËÀÚ¤ìÌ£¤¬±Ô¤¯Å¨¤òÀÚÃǤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£";
950 #else
951                 info[i++] = "It is very sharp and can cut your foes.";
952 #endif
953
954         }
955
956         if (have_flag(flgs, TR_KILL_DRAGON))
957         {
958 #ifdef JP
959 info[i++] = "¤½¤ì¤Ï¥É¥é¥´¥ó¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
960 #else
961                 info[i++] = "It is a great bane of dragons.";
962 #endif
963
964         }
965         else if (have_flag(flgs, TR_SLAY_DRAGON))
966         {
967 #ifdef JP
968 info[i++] = "¤½¤ì¤Ï¥É¥é¥´¥ó¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
969 #else
970                 info[i++] = "It is especially deadly against dragons.";
971 #endif
972
973         }
974
975         if (have_flag(flgs, TR_KILL_ORC))
976         {
977 #ifdef JP
978 info[i++] = "¤½¤ì¤Ï¥ª¡¼¥¯¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
979 #else
980                 info[i++] = "It is a great bane of orcs.";
981 #endif
982
983         }
984         if (have_flag(flgs, TR_SLAY_ORC))
985         {
986 #ifdef JP
987 info[i++] = "¤½¤ì¤Ï¥ª¡¼¥¯¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
988 #else
989                 info[i++] = "It is especially deadly against orcs.";
990 #endif
991
992         }
993
994         if (have_flag(flgs, TR_KILL_TROLL))
995         {
996 #ifdef JP
997 info[i++] = "¤½¤ì¤Ï¥È¥í¥ë¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
998 #else
999                 info[i++] = "It is a great bane of trolls.";
1000 #endif
1001
1002         }
1003         if (have_flag(flgs, TR_SLAY_TROLL))
1004         {
1005 #ifdef JP
1006 info[i++] = "¤½¤ì¤Ï¥È¥í¥ë¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
1007 #else
1008                 info[i++] = "It is especially deadly against trolls.";
1009 #endif
1010
1011         }
1012
1013         if (have_flag(flgs, TR_KILL_GIANT))
1014         {
1015 #ifdef JP
1016 info[i++] = "¤½¤ì¤Ïµð¿Í¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
1017 #else
1018                 info[i++] = "It is a great bane of giants.";
1019 #endif
1020         }
1021         else if (have_flag(flgs, TR_SLAY_GIANT))
1022         {
1023 #ifdef JP
1024 info[i++] = "¤½¤ì¤Ï¥¸¥ã¥¤¥¢¥ó¥È¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
1025 #else
1026                 info[i++] = "It is especially deadly against giants.";
1027 #endif
1028
1029         }
1030
1031         if (have_flag(flgs, TR_KILL_DEMON))
1032         {
1033 #ifdef JP
1034 info[i++] = "¤½¤ì¤Ï¥Ç¡¼¥â¥ó¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
1035 #else
1036                 info[i++] = "It is a great bane of demons.";
1037 #endif
1038
1039         }
1040         if (have_flag(flgs, TR_SLAY_DEMON))
1041         {
1042 #ifdef JP
1043 info[i++] = "¤½¤ì¤Ï¥Ç¡¼¥â¥ó¤ËÂФ·¤ÆÀ»¤Ê¤ëÎϤòȯ´ø¤¹¤ë¡£";
1044 #else
1045                 info[i++] = "It strikes at demons with holy wrath.";
1046 #endif
1047
1048         }
1049
1050         if (have_flag(flgs, TR_KILL_UNDEAD))
1051         {
1052 #ifdef JP
1053 info[i++] = "¤½¤ì¤Ï¥¢¥ó¥Ç¥Ã¥É¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
1054 #else
1055                 info[i++] = "It is a great bane of undead.";
1056 #endif
1057
1058         }
1059         if (have_flag(flgs, TR_SLAY_UNDEAD))
1060         {
1061 #ifdef JP
1062 info[i++] = "¤½¤ì¤Ï¥¢¥ó¥Ç¥Ã¥É¤ËÂФ·¤ÆÀ»¤Ê¤ëÎϤòȯ´ø¤¹¤ë¡£";
1063 #else
1064                 info[i++] = "It strikes at undead with holy wrath.";
1065 #endif
1066
1067         }
1068
1069         if (have_flag(flgs, TR_KILL_EVIL))
1070         {
1071 #ifdef JP
1072 info[i++] = "¤½¤ì¤Ï¼Ù°­¤Ê¤ë¸ºß¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
1073 #else
1074                 info[i++] = "It is a great bane of evil monsters.";
1075 #endif
1076
1077         }
1078         if (have_flag(flgs, TR_SLAY_EVIL))
1079         {
1080 #ifdef JP
1081 info[i++] = "¤½¤ì¤Ï¼Ù°­¤Ê¤ë¸ºß¤ËÂФ·¤ÆÀ»¤Ê¤ëÎϤǹ¶·â¤¹¤ë¡£";
1082 #else
1083                 info[i++] = "It fights against evil with holy fury.";
1084 #endif
1085
1086         }
1087
1088         if (have_flag(flgs, TR_KILL_ANIMAL))
1089         {
1090 #ifdef JP
1091 info[i++] = "¤½¤ì¤Ï¼«Á³³¦¤Îưʪ¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
1092 #else
1093                 info[i++] = "It is a great bane of natural creatures.";
1094 #endif
1095
1096         }
1097         if (have_flag(flgs, TR_SLAY_ANIMAL))
1098         {
1099 #ifdef JP
1100 info[i++] = "¤½¤ì¤Ï¼«Á³³¦¤Îưʪ¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
1101 #else
1102                 info[i++] = "It is especially deadly against natural creatures.";
1103 #endif
1104
1105         }
1106
1107         if (have_flag(flgs, TR_KILL_HUMAN))
1108         {
1109 #ifdef JP
1110 info[i++] = "¤½¤ì¤Ï¿Í´Ö¤Ë¤È¤Ã¤Æ¤ÎŷŨ¤Ç¤¢¤ë¡£";
1111 #else
1112                 info[i++] = "It is a great bane of humans.";
1113 #endif
1114
1115         }
1116         if (have_flag(flgs, TR_SLAY_HUMAN))
1117         {
1118 #ifdef JP
1119 info[i++] = "¤½¤ì¤Ï¿Í´Ö¤ËÂФ·¤ÆÆä˶²¤ë¤Ù¤­ÎϤòȯ´ø¤¹¤ë¡£";
1120 #else
1121                 info[i++] = "It is especially deadly against humans.";
1122 #endif
1123
1124         }
1125
1126         if (have_flag(flgs, TR_FORCE_WEAPON))
1127         {
1128 #ifdef JP
1129 info[i++] = "¤½¤ì¤Ï»ÈÍѼԤÎËâÎϤò»È¤Ã¤Æ¹¶·â¤¹¤ë¡£";
1130 #else
1131                 info[i++] = "It powerfully strikes at a monster using your mana.";
1132 #endif
1133
1134         }
1135         if (have_flag(flgs, TR_DEC_MANA))
1136         {
1137 #ifdef JP
1138 info[i++] = "¤½¤ì¤ÏËâÎϤξÃÈñ¤ò²¡¤µ¤¨¤ë¡£";
1139 #else
1140                 info[i++] = "It decreases your mana consumption.";
1141 #endif
1142
1143         }
1144         if (have_flag(flgs, TR_SUST_STR))
1145         {
1146 #ifdef JP
1147 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤ÎÏÓÎϤò°Ý»ý¤¹¤ë¡£";
1148 #else
1149                 info[i++] = "It sustains your strength.";
1150 #endif
1151
1152         }
1153         if (have_flag(flgs, TR_SUST_INT))
1154         {
1155 #ifdef JP
1156 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤ÎÃÎǽ¤ò°Ý»ý¤¹¤ë¡£";
1157 #else
1158                 info[i++] = "It sustains your intelligence.";
1159 #endif
1160
1161         }
1162         if (have_flag(flgs, TR_SUST_WIS))
1163         {
1164 #ifdef JP
1165 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤Î¸­¤µ¤ò°Ý»ý¤¹¤ë¡£";
1166 #else
1167                 info[i++] = "It sustains your wisdom.";
1168 #endif
1169
1170         }
1171         if (have_flag(flgs, TR_SUST_DEX))
1172         {
1173 #ifdef JP
1174 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤Î´ïÍѤµ¤ò°Ý»ý¤¹¤ë¡£";
1175 #else
1176                 info[i++] = "It sustains your dexterity.";
1177 #endif
1178
1179         }
1180         if (have_flag(flgs, TR_SUST_CON))
1181         {
1182 #ifdef JP
1183 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤ÎÂѵ×ÎϤò°Ý»ý¤¹¤ë¡£";
1184 #else
1185                 info[i++] = "It sustains your constitution.";
1186 #endif
1187
1188         }
1189         if (have_flag(flgs, TR_SUST_CHR))
1190         {
1191 #ifdef JP
1192 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤ÎÌ¥ÎϤò°Ý»ý¤¹¤ë¡£";
1193 #else
1194                 info[i++] = "It sustains your charisma.";
1195 #endif
1196
1197         }
1198
1199         if (have_flag(flgs, TR_IM_ACID))
1200         {
1201 #ifdef JP
1202 info[i++] = "¤½¤ì¤Ï»À¤ËÂФ¹¤ë´°Á´¤ÊÌȱ֤ò¼ø¤±¤ë¡£";
1203 #else
1204                 info[i++] = "It provides immunity to acid.";
1205 #endif
1206
1207         }
1208         if (have_flag(flgs, TR_IM_ELEC))
1209         {
1210 #ifdef JP
1211 info[i++] = "¤½¤ì¤ÏÅÅ·â¤ËÂФ¹¤ë´°Á´¤ÊÌȱ֤ò¼ø¤±¤ë¡£";
1212 #else
1213                 info[i++] = "It provides immunity to electricity.";
1214 #endif
1215
1216         }
1217         if (have_flag(flgs, TR_IM_FIRE))
1218         {
1219 #ifdef JP
1220 info[i++] = "¤½¤ì¤Ï²Ð¤ËÂФ¹¤ë´°Á´¤ÊÌȱ֤ò¼ø¤±¤ë¡£";
1221 #else
1222                 info[i++] = "It provides immunity to fire.";
1223 #endif
1224
1225         }
1226         if (have_flag(flgs, TR_IM_COLD))
1227         {
1228 #ifdef JP
1229 info[i++] = "¤½¤ì¤Ï´¨¤µ¤ËÂФ¹¤ë´°Á´¤ÊÌȱ֤ò¼ø¤±¤ë¡£";
1230 #else
1231                 info[i++] = "It provides immunity to cold.";
1232 #endif
1233
1234         }
1235
1236         if (have_flag(flgs, TR_THROW))
1237         {
1238 #ifdef JP
1239 info[i++] = "¤½¤ì¤ÏŨ¤ËÅꤲ¤ÆÂ礭¤Ê¥À¥á¡¼¥¸¤òÍ¿¤¨¤ë¤³¤È¤¬¤Ç¤­¤ë¡£";
1240 #else
1241                 info[i++] = "It is perfectly balanced for throwing.";
1242 #endif
1243         }
1244
1245         if (have_flag(flgs, TR_FREE_ACT))
1246         {
1247 #ifdef JP
1248 info[i++] = "¤½¤ì¤ÏËãáã¤ËÂФ¹¤ë´°Á´¤ÊÌȱ֤ò¼ø¤±¤ë¡£";
1249 #else
1250                 info[i++] = "It provides immunity to paralysis.";
1251 #endif
1252
1253         }
1254         if (have_flag(flgs, TR_HOLD_LIFE))
1255         {
1256 #ifdef JP
1257 info[i++] = "¤½¤ì¤ÏÀ¸Ì¿Îϵۼý¤ËÂФ¹¤ëÂÑÀ­¤ò¼ø¤±¤ë¡£";
1258 #else
1259                 info[i++] = "It provides resistance to life draining.";
1260 #endif
1261
1262         }
1263         if (have_flag(flgs, TR_RES_FEAR))
1264         {
1265 #ifdef JP
1266 info[i++] = "¤½¤ì¤Ï¶²Éݤؤδ°Á´¤ÊÂÑÀ­¤ò¼ø¤±¤ë¡£";
1267 #else
1268                 info[i++] = "It makes you completely fearless.";
1269 #endif
1270
1271         }
1272         if (have_flag(flgs, TR_RES_ACID))
1273         {
1274 #ifdef JP
1275 info[i++] = "¤½¤ì¤Ï»À¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1276 #else
1277                 info[i++] = "It provides resistance to acid.";
1278 #endif
1279
1280         }
1281         if (have_flag(flgs, TR_RES_ELEC))
1282         {
1283 #ifdef JP
1284 info[i++] = "¤½¤ì¤ÏÅÅ·â¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1285 #else
1286                 info[i++] = "It provides resistance to electricity.";
1287 #endif
1288
1289         }
1290         if (have_flag(flgs, TR_RES_FIRE))
1291         {
1292 #ifdef JP
1293 info[i++] = "¤½¤ì¤Ï²Ð¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1294 #else
1295                 info[i++] = "It provides resistance to fire.";
1296 #endif
1297
1298         }
1299         if (have_flag(flgs, TR_RES_COLD))
1300         {
1301 #ifdef JP
1302 info[i++] = "¤½¤ì¤Ï´¨¤µ¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1303 #else
1304                 info[i++] = "It provides resistance to cold.";
1305 #endif
1306
1307         }
1308         if (have_flag(flgs, TR_RES_POIS))
1309         {
1310 #ifdef JP
1311 info[i++] = "¤½¤ì¤ÏÆǤؤÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1312 #else
1313                 info[i++] = "It provides resistance to poison.";
1314 #endif
1315
1316         }
1317
1318         if (have_flag(flgs, TR_RES_LITE))
1319         {
1320 #ifdef JP
1321 info[i++] = "¤½¤ì¤ÏÁ®¸÷¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1322 #else
1323                 info[i++] = "It provides resistance to light.";
1324 #endif
1325
1326         }
1327         if (have_flag(flgs, TR_RES_DARK))
1328         {
1329 #ifdef JP
1330 info[i++] = "¤½¤ì¤Ï°Å¹õ¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1331 #else
1332                 info[i++] = "It provides resistance to dark.";
1333 #endif
1334
1335         }
1336
1337         if (have_flag(flgs, TR_RES_BLIND))
1338         {
1339 #ifdef JP
1340 info[i++] = "¤½¤ì¤ÏÌÕÌܤؤÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1341 #else
1342                 info[i++] = "It provides resistance to blindness.";
1343 #endif
1344
1345         }
1346         if (have_flag(flgs, TR_RES_CONF))
1347         {
1348 #ifdef JP
1349 info[i++] = "¤½¤ì¤Ïº®Íð¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1350 #else
1351                 info[i++] = "It provides resistance to confusion.";
1352 #endif
1353
1354         }
1355         if (have_flag(flgs, TR_RES_SOUND))
1356         {
1357 #ifdef JP
1358 info[i++] = "¤½¤ì¤Ï¹ì²»¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1359 #else
1360                 info[i++] = "It provides resistance to sound.";
1361 #endif
1362
1363         }
1364         if (have_flag(flgs, TR_RES_SHARDS))
1365         {
1366 #ifdef JP
1367 info[i++] = "¤½¤ì¤ÏÇËÊҤؤÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1368 #else
1369                 info[i++] = "It provides resistance to shards.";
1370 #endif
1371
1372         }
1373
1374         if (have_flag(flgs, TR_RES_NETHER))
1375         {
1376 #ifdef JP
1377 info[i++] = "¤½¤ì¤ÏÃϹö¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1378 #else
1379                 info[i++] = "It provides resistance to nether.";
1380 #endif
1381
1382         }
1383         if (have_flag(flgs, TR_RES_NEXUS))
1384         {
1385 #ifdef JP
1386 info[i++] = "¤½¤ì¤Ï°ø²Ìº®Íð¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1387 #else
1388                 info[i++] = "It provides resistance to nexus.";
1389 #endif
1390
1391         }
1392         if (have_flag(flgs, TR_RES_CHAOS))
1393         {
1394 #ifdef JP
1395 info[i++] = "¤½¤ì¤Ï¥«¥ª¥¹¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1396 #else
1397                 info[i++] = "It provides resistance to chaos.";
1398 #endif
1399
1400         }
1401         if (have_flag(flgs, TR_RES_DISEN))
1402         {
1403 #ifdef JP
1404 info[i++] = "¤½¤ì¤ÏÎô²½¤Ø¤ÎÂÑÀ­¤ò¼ø¤±¤ë¡£";
1405 #else
1406                 info[i++] = "It provides resistance to disenchantment.";
1407 #endif
1408
1409         }
1410
1411         if (have_flag(flgs, TR_LEVITATION))
1412         {
1413 #ifdef JP
1414 info[i++] = "¤½¤ì¤ÏÃè¤ËÉ⤯¤³¤È¤ò²Äǽ¤Ë¤¹¤ë¡£";
1415 #else
1416                 info[i++] = "It allows you to levitate.";
1417 #endif
1418
1419         }
1420                 
1421         if (have_flag(flgs, TR_SEE_INVIS))
1422         {
1423                 info[i++] = _("¤½¤ì¤ÏÆ©ÌÀ¤Ê¥â¥ó¥¹¥¿¡¼¤ò¸«¤ë¤³¤È¤ò²Äǽ¤Ë¤¹¤ë¡£", "It allows you to see invisible monsters.");
1424         }
1425         if (have_flag(flgs, TR_TELEPATHY))
1426         {
1427 #ifdef JP
1428 info[i++] = "¤½¤ì¤Ï¥Æ¥ì¥Ñ¥·¡¼Ç½ÎϤò¼ø¤±¤ë¡£";
1429 #else
1430                 info[i++] = "It gives telepathic powers.";
1431 #endif
1432
1433         }
1434         if (have_flag(flgs, TR_ESP_ANIMAL))
1435         {
1436 #ifdef JP
1437 info[i++] = "¤½¤ì¤Ï¼«Á³³¦¤ÎÀ¸Êª¤ò´¶ÃΤ¹¤ë¡£";
1438 #else
1439                 info[i++] = "It senses natural creatures.";
1440 #endif
1441
1442         }
1443         if (have_flag(flgs, TR_ESP_UNDEAD))
1444         {
1445 #ifdef JP
1446 info[i++] = "¤½¤ì¤Ï¥¢¥ó¥Ç¥Ã¥É¤ò´¶ÃΤ¹¤ë¡£";
1447 #else
1448                 info[i++] = "It senses undead.";
1449 #endif
1450
1451         }
1452         if (have_flag(flgs, TR_ESP_DEMON))
1453         {
1454 #ifdef JP
1455 info[i++] = "¤½¤ì¤Ï°­Ëâ¤ò´¶ÃΤ¹¤ë¡£";
1456 #else
1457                 info[i++] = "It senses demons.";
1458 #endif
1459
1460         }
1461         if (have_flag(flgs, TR_ESP_ORC))
1462         {
1463 #ifdef JP
1464 info[i++] = "¤½¤ì¤Ï¥ª¡¼¥¯¤ò´¶ÃΤ¹¤ë¡£";
1465 #else
1466                 info[i++] = "It senses orcs.";
1467 #endif
1468
1469         }
1470         if (have_flag(flgs, TR_ESP_TROLL))
1471         {
1472 #ifdef JP
1473 info[i++] = "¤½¤ì¤Ï¥È¥í¥ë¤ò´¶ÃΤ¹¤ë¡£";
1474 #else
1475                 info[i++] = "It senses trolls.";
1476 #endif
1477
1478         }
1479         if (have_flag(flgs, TR_ESP_GIANT))
1480         {
1481 #ifdef JP
1482 info[i++] = "¤½¤ì¤Ïµð¿Í¤ò´¶ÃΤ¹¤ë¡£";
1483 #else
1484                 info[i++] = "It senses giants.";
1485 #endif
1486
1487         }
1488         if (have_flag(flgs, TR_ESP_DRAGON))
1489         {
1490 #ifdef JP
1491 info[i++] = "¤½¤ì¤Ï¥É¥é¥´¥ó¤ò´¶ÃΤ¹¤ë¡£";
1492 #else
1493                 info[i++] = "It senses dragons.";
1494 #endif
1495
1496         }
1497         if (have_flag(flgs, TR_ESP_HUMAN))
1498         {
1499 #ifdef JP
1500 info[i++] = "¤½¤ì¤Ï¿Í´Ö¤ò´¶ÃΤ¹¤ë¡£";
1501 #else
1502                 info[i++] = "It senses humans.";
1503 #endif
1504
1505         }
1506         if (have_flag(flgs, TR_ESP_EVIL))
1507         {
1508 #ifdef JP
1509 info[i++] = "¤½¤ì¤Ï¼Ù°­¤Ê¸ºß¤ò´¶ÃΤ¹¤ë¡£";
1510 #else
1511                 info[i++] = "It senses evil creatures.";
1512 #endif
1513
1514         }
1515         if (have_flag(flgs, TR_ESP_GOOD))
1516         {
1517 #ifdef JP
1518 info[i++] = "¤½¤ì¤ÏÁ±Îɤʸºß¤ò´¶ÃΤ¹¤ë¡£";
1519 #else
1520                 info[i++] = "It senses good creatures.";
1521 #endif
1522
1523         }
1524         if (have_flag(flgs, TR_ESP_NONLIVING))
1525         {
1526 #ifdef JP
1527 info[i++] = "¤½¤ì¤Ï³èÆ°¤¹¤ë̵À¸ÊªÂΤò´¶ÃΤ¹¤ë¡£";
1528 #else
1529                 info[i++] = "It senses non-living creatures.";
1530 #endif
1531
1532         }
1533         if (have_flag(flgs, TR_ESP_UNIQUE))
1534         {
1535 #ifdef JP
1536 info[i++] = "¤½¤ì¤ÏÆÃÊ̤ʶ¯Å¨¤ò´¶ÃΤ¹¤ë¡£";
1537 #else
1538                 info[i++] = "It senses unique monsters.";
1539 #endif
1540
1541         }
1542         if (have_flag(flgs, TR_SLOW_DIGEST))
1543         {
1544 #ifdef JP
1545 info[i++] = "¤½¤ì¤Ï¤¢¤Ê¤¿¤Î¿·ÄÄÂå¼Õ¤òÃÙ¤¯¤¹¤ë¡£";
1546 #else
1547                 info[i++] = "It slows your metabolism.";
1548 #endif
1549
1550         }
1551         if (have_flag(flgs, TR_REGEN))
1552         {
1553 #ifdef JP
1554 info[i++] = "¤½¤ì¤ÏÂÎÎϲóÉüÎϤò¶¯²½¤¹¤ë¡£";
1555 #else
1556                 info[i++] = "It speeds your regenerative powers.";
1557 #endif
1558
1559         }
1560         if (have_flag(flgs, TR_WARNING))
1561         {
1562 #ifdef JP
1563 info[i++] = "¤½¤ì¤Ï´í¸±¤ËÂФ·¤Æ·Ù¹ð¤òȯ¤¹¤ë¡£";
1564 #else
1565                 info[i++] = "It warns you of danger";
1566 #endif
1567
1568         }
1569         if (have_flag(flgs, TR_REFLECT))
1570         {
1571                 info[i++] = _("¤½¤ì¤ÏÌð¤Î¼öʸ¤òÈ¿¼Í¤¹¤ë¡£", "It reflects bolt spells.");
1572         }
1573         if (have_flag(flgs, TR_SH_FIRE))
1574         {
1575                 info[i++] = _("¤½¤ì¤Ï±ê¤Î¥Ð¥ê¥¢¤òÄ¥¤ë¡£", "It produces a fiery sheath.");
1576         }
1577         if (have_flag(flgs, TR_SH_ELEC))
1578         {
1579                 info[i++] = _("¤½¤ì¤ÏÅŵ¤¤Î¥Ð¥ê¥¢¤òÄ¥¤ë¡£", "It produces an electric sheath.");
1580         }
1581         if (have_flag(flgs, TR_SH_COLD))
1582         {
1583 #ifdef JP
1584 info[i++] = "¤½¤ì¤ÏÎ䵤¤Î¥Ð¥ê¥¢¤òÄ¥¤ë¡£";
1585 #else
1586                 info[i++] = "It produces a sheath of coldness.";
1587 #endif
1588
1589         }
1590         if (have_flag(flgs, TR_NO_MAGIC))
1591         {
1592 #ifdef JP
1593 info[i++] = "¤½¤ì¤ÏÈ¿ËâË¡¥Ð¥ê¥¢¤òÄ¥¤ë¡£";
1594 #else
1595                 info[i++] = "It produces an anti-magic shell.";
1596 #endif
1597
1598         }
1599         if (have_flag(flgs, TR_NO_TELE))
1600         {
1601 #ifdef JP
1602 info[i++] = "¤½¤ì¤Ï¥Æ¥ì¥Ý¡¼¥È¤ò¼ÙË⤹¤ë¡£";
1603 #else
1604                 info[i++] = "It prevents teleportation.";
1605 #endif
1606
1607         }
1608         if (have_flag(flgs, TR_XTRA_MIGHT))
1609         {
1610 #ifdef JP
1611 info[i++] = "¤½¤ì¤ÏÌ𡿥ܥë¥È¡¿ÃƤò¤è¤ê¶¯ÎϤËȯ¼Í¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£";
1612 #else
1613                 info[i++] = "It fires missiles with extra might.";
1614 #endif
1615
1616         }
1617         if (have_flag(flgs, TR_XTRA_SHOTS))
1618         {
1619 #ifdef JP
1620 info[i++] = "¤½¤ì¤ÏÌ𡿥ܥë¥È¡¿ÃƤòÈó¾ï¤ËÁ᤯ȯ¼Í¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£";
1621 #else
1622                 info[i++] = "It fires missiles excessively fast.";
1623 #endif
1624
1625         }
1626
1627         if (have_flag(flgs, TR_BLESSED))
1628         {
1629 #ifdef JP
1630 info[i++] = "¤½¤ì¤Ï¿À¤Ë½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¡£";
1631 #else
1632                 info[i++] = "It has been blessed by the gods.";
1633 #endif
1634
1635         }
1636
1637         if (object_is_cursed(o_ptr))
1638         {
1639                 if (o_ptr->curse_flags & TRC_PERMA_CURSE)
1640                 {
1641 #ifdef JP
1642 info[i++] = "¤½¤ì¤Ï±Ê±ó¤Î¼ö¤¤¤¬¤«¤±¤é¤ì¤Æ¤¤¤ë¡£";
1643 #else
1644                         info[i++] = "It is permanently cursed.";
1645 #endif
1646
1647                 }
1648                 else if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
1649                 {
1650 #ifdef JP
1651 info[i++] = "¤½¤ì¤Ï¶¯ÎϤʼö¤¤¤¬¤«¤±¤é¤ì¤Æ¤¤¤ë¡£";
1652 #else
1653                         info[i++] = "It is heavily cursed.";
1654 #endif
1655
1656                 }
1657                 else
1658                 {
1659 #ifdef JP
1660 info[i++] = "¤½¤ì¤Ï¼ö¤ï¤ì¤Æ¤¤¤ë¡£";
1661 #else
1662                         info[i++] = "It is cursed.";
1663 #endif
1664
1665                         /*
1666                          * It's a trivial infomation since there is
1667                          * fake inscription {cursed}
1668                          */
1669                         trivial_info++;
1670                 }
1671         }
1672
1673         if ((have_flag(flgs, TR_TY_CURSE)) || (o_ptr->curse_flags & TRC_TY_CURSE))
1674         {
1675                 info[i++] = _("¤½¤ì¤ÏÂÀ¸Å¤Î²Ò¡¹¤·¤¤±åÇ°¤¬½É¤Ã¤Æ¤¤¤ë¡£", "It carries an ancient foul curse.");
1676         }
1677         if ((have_flag(flgs, TR_AGGRAVATE)) || (o_ptr->curse_flags & TRC_AGGRAVATE))
1678         {
1679                 info[i++] = _("¤½¤ì¤ÏÉÕ¶á¤Î¥â¥ó¥¹¥¿¡¼¤òÅܤ餻¤ë¡£", "It aggravates nearby creatures.");
1680         }
1681         if ((have_flag(flgs, TR_DRAIN_EXP)) || (o_ptr->curse_flags & TRC_DRAIN_EXP))
1682         {
1683                 info[i++] = _("¤½¤ì¤Ï·Ð¸³ÃͤòµÛ¤¤¼è¤ë¡£", "It drains experience.");
1684         }
1685         if (o_ptr->curse_flags & TRC_SLOW_REGEN)
1686         {
1687                 info[i++] = _("¤½¤ì¤Ï²óÉüÎϤò¼å¤á¤ë¡£", "It slows your regenerative powers.");
1688         }
1689         if ((o_ptr->curse_flags & TRC_ADD_L_CURSE) || have_flag(flgs, TR_ADD_L_CURSE))
1690         {
1691                 info[i++] = _("¤½¤ì¤Ï¼å¤¤¼ö¤¤¤òÁý¤ä¤¹¡£","It adds weak curses.");
1692         }
1693         if ((o_ptr->curse_flags & TRC_ADD_H_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
1694         {
1695                 info[i++] = _("¤½¤ì¤Ï¶¯ÎϤʼö¤¤¤òÁý¤ä¤¹¡£","It adds heavy curses.");
1696         }
1697         if ((have_flag(flgs, TR_CALL_ANIMAL)) || (o_ptr->curse_flags & TRC_CALL_ANIMAL))
1698         {
1699                 info[i++] = _("¤½¤ì¤Ïưʪ¤ò¸Æ¤Ó´ó¤»¤ë¡£", "It attracts animals.");
1700         }
1701         if ((have_flag(flgs, TR_CALL_DEMON)) || (o_ptr->curse_flags & TRC_CALL_DEMON))
1702         {
1703                 info[i++] = _("¤½¤ì¤Ï°­Ëâ¤ò¸Æ¤Ó´ó¤»¤ë¡£", "It attracts demons.");
1704         }
1705         if ((have_flag(flgs, TR_CALL_DRAGON)) || (o_ptr->curse_flags & TRC_CALL_DRAGON))
1706         {
1707                 info[i++] = _("¤½¤ì¤Ï¥É¥é¥´¥ó¤ò¸Æ¤Ó´ó¤»¤ë¡£", "It attracts dragons.");
1708         }
1709         if ((have_flag(flgs, TR_CALL_UNDEAD)) || (o_ptr->curse_flags & TRC_CALL_UNDEAD))
1710         {
1711                 info[i++] = _("¤½¤ì¤Ï»àÎî¤ò¸Æ¤Ó´ó¤»¤ë¡£", "It attracts undeads.");
1712         }
1713         if ((have_flag(flgs, TR_COWARDICE)) ||  (o_ptr->curse_flags & TRC_COWARDICE))
1714         {
1715                 info[i++] = _("¤½¤ì¤Ï¶²ÉÝ´¶¤ò°ú¤­µ¯¤³¤¹¡£", "It makes you subject to cowardice.");
1716         }
1717         if ((have_flag(flgs, TR_TELEPORT)) || (o_ptr->curse_flags & TRC_TELEPORT))
1718         {
1719                 info[i++] = _("¤½¤ì¤Ï¥é¥ó¥À¥à¤Ê¥Æ¥ì¥Ý¡¼¥È¤ò°ú¤­µ¯¤³¤¹¡£", "It induces random teleportation.");
1720         }
1721         if ((have_flag(flgs, TR_LOW_MELEE)) || o_ptr->curse_flags & TRC_LOW_MELEE)
1722         {
1723                 info[i++] = _("¤½¤ì¤Ï¹¶·â¤ò³°¤·¤ä¤¹¤¤¡£", "It causes you to miss blows.");
1724         }
1725         if ((have_flag(flgs, TR_LOW_AC)) || (o_ptr->curse_flags & TRC_LOW_AC))
1726         {
1727                 info[i++] = _("¤½¤ì¤Ï¹¶·â¤ò¼õ¤±¤ä¤¹¤¤¡£", "It helps your enemies' blows.");
1728         }
1729         if ((have_flag(flgs, TR_LOW_MAGIC)) || (o_ptr->curse_flags & TRC_LOW_MAGIC))
1730         {
1731                 info[i++] = _("¤½¤ì¤ÏËâË¡¤ò¾§¤¨¤Ë¤¯¤¯¤¹¤ë¡£", "It encumbers you while spellcasting.");
1732         }
1733         if ((have_flag(flgs, TR_FAST_DIGEST)) || (o_ptr->curse_flags & TRC_FAST_DIGEST))
1734         {
1735                 info[i++] = _("¤½¤ì¤Ï¤¢¤Ê¤¿¤Î¿·ÄÄÂå¼Õ¤ò®¤¯¤¹¤ë¡£", "It speeds your metabolism.");
1736         }
1737         if ((have_flag(flgs, TR_DRAIN_HP)) || (o_ptr->curse_flags & TRC_DRAIN_HP))
1738         {
1739                 info[i++] = _("¤½¤ì¤Ï¤¢¤Ê¤¿¤ÎÂÎÎϤòµÛ¤¤¼è¤ë¡£", "It drains you.");
1740         }
1741         if ((have_flag(flgs, TR_DRAIN_MANA)) || (o_ptr->curse_flags & TRC_DRAIN_MANA))
1742         {
1743                 info[i++] = _("¤½¤ì¤Ï¤¢¤Ê¤¿¤ÎËâÎϤòµÛ¤¤¼è¤ë¡£", "It drains your mana.");
1744         }
1745
1746         /* Describe about this kind of object instead of THIS fake object */
1747         if (mode & SCROBJ_FAKE_OBJECT)
1748         {
1749                 switch (o_ptr->tval)
1750                 {
1751                 case TV_RING:
1752                         switch (o_ptr->sval)
1753                         {
1754                         case SV_RING_LORDLY:
1755 #ifdef JP
1756                                 info[i++] = "¤½¤ì¤Ï´ö¤Ä¤«¤Î¥é¥ó¥À¥à¤ÊÂÑÀ­¤ò¼ø¤±¤ë¡£";
1757 #else
1758                                 info[i++] = "It provides some random resistances.";
1759 #endif
1760                                 break;
1761                         case SV_RING_WARNING:
1762 #ifdef JP
1763                                 info[i++] = "¤½¤ì¤Ï¤Ò¤È¤Ä¤ÎÄãµé¤ÊESP¤ò¼ø¤±¤ë»ö¤¬¤¢¤ë¡£";
1764 #else
1765                                 info[i++] = "It may provide a low rank ESP.";
1766 #endif
1767                                 break;
1768                         }
1769                         break;
1770
1771                 case TV_AMULET:
1772                         switch (o_ptr->sval)
1773                         {
1774                         case SV_AMULET_RESISTANCE:
1775 #ifdef JP
1776                                 info[i++] = "¤½¤ì¤ÏÆǤؤÎÂÑÀ­¤ò¼ø¤±¤ë»ö¤¬¤¢¤ë¡£";
1777 #else
1778                                 info[i++] = "It may provides resistance to poison.";
1779 #endif
1780 #ifdef JP
1781                                 info[i++] = "¤½¤ì¤Ï¥é¥ó¥À¥à¤ÊÂÑÀ­¤ò¼ø¤±¤ë»ö¤¬¤¢¤ë¡£";
1782 #else
1783                                 info[i++] = "It may provide a random resistances.";
1784 #endif
1785                                 break;
1786                         case SV_AMULET_THE_MAGI:
1787 #ifdef JP
1788                                 info[i++] = "¤½¤ì¤ÏºÇÂç¤Ç£³¤Ä¤Þ¤Ç¤ÎÄãµé¤ÊESP¤ò¼ø¤±¤ë¡£";
1789 #else
1790                                 info[i++] = "It provides up to three low rank ESPs.";
1791 #endif
1792                                 break;
1793                         }
1794                         break;
1795                 }
1796         }
1797
1798         if (have_flag(flgs, TR_IGNORE_ACID) &&
1799             have_flag(flgs, TR_IGNORE_ELEC) &&
1800             have_flag(flgs, TR_IGNORE_FIRE) &&
1801             have_flag(flgs, TR_IGNORE_COLD))
1802         {
1803 #ifdef JP
1804                 info[i++] = "¤½¤ì¤Ï»À¡¦Åŷ⡦²Ð±ê¡¦Î䵤¤Ç¤Ï½ý¤Ä¤«¤Ê¤¤¡£";
1805 #else
1806                 info[i++] = "It cannot be harmed by the elements.";
1807 #endif
1808         }
1809         else
1810         {
1811                 if (have_flag(flgs, TR_IGNORE_ACID))
1812                 {
1813 #ifdef JP
1814                         info[i++] = "¤½¤ì¤Ï»À¤Ç¤Ï½ý¤Ä¤«¤Ê¤¤¡£";
1815 #else
1816                         info[i++] = "It cannot be harmed by acid.";
1817 #endif
1818                 }
1819                 if (have_flag(flgs, TR_IGNORE_ELEC))
1820                 {
1821 #ifdef JP
1822                         info[i++] = "¤½¤ì¤ÏÅÅ·â¤Ç¤Ï½ý¤Ä¤«¤Ê¤¤¡£";
1823 #else
1824                         info[i++] = "It cannot be harmed by electricity.";
1825 #endif
1826                 }
1827                 if (have_flag(flgs, TR_IGNORE_FIRE))
1828                 {
1829 #ifdef JP
1830                         info[i++] = "¤½¤ì¤Ï²Ð±ê¤Ç¤Ï½ý¤Ä¤«¤Ê¤¤¡£";
1831 #else
1832                         info[i++] = "It cannot be harmed by fire.";
1833 #endif
1834                 }
1835                 if (have_flag(flgs, TR_IGNORE_COLD))
1836                 {
1837 #ifdef JP
1838                         info[i++] = "¤½¤ì¤ÏÎ䵤¤Ç¤Ï½ý¤Ä¤«¤Ê¤¤¡£";
1839 #else
1840                         info[i++] = "It cannot be harmed by cold.";
1841 #endif
1842                 }
1843         }
1844
1845         if (mode & SCROBJ_FORCE_DETAIL) trivial_info = 0;
1846
1847         /* No relevant informations */
1848         if (i <= trivial_info) return (FALSE);
1849
1850         /* Save the screen */
1851         screen_save();
1852
1853         /* Get size */
1854         Term_get_size(&wid, &hgt);
1855
1856         /* Display Item name */
1857         if (!(mode & SCROBJ_FAKE_OBJECT))
1858                 object_desc(o_name, o_ptr, 0);
1859         else
1860                 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1861
1862         prt(o_name, 0, 0);
1863
1864         /* Erase the screen */
1865         for (k = 1; k < hgt; k++) prt("", k, 13);
1866
1867         /* Label the information */
1868         if ((o_ptr->tval == TV_STATUE) && (o_ptr->sval == SV_PHOTO))
1869         {
1870                 monster_race *r_ptr = &r_info[o_ptr->pval];
1871                 int namelen = strlen(r_name + r_ptr->name);
1872                 prt(format("%s: '", r_name + r_ptr->name), 1, 15);
1873                 Term_queue_bigchar(18 + namelen, 1, r_ptr->x_attr, r_ptr->x_char, 0, 0);
1874                 prt("'", 1, (use_bigtile ? 20 : 19) + namelen);
1875         }
1876         else
1877 #ifdef JP
1878 prt("     ¥¢¥¤¥Æ¥à¤ÎǽÎÏ:", 1, 15);
1879 #else
1880         prt("     Item Attributes:", 1, 15);
1881 #endif
1882
1883         /* We will print on top of the map (column 13) */
1884         for (k = 2, j = 0; j < i; j++)
1885         {
1886                 /* Show the info */
1887                 prt(info[j], k++, 15);
1888
1889                 /* Every 20 entries (lines 2 to 21), start over */
1890                 if ((k == hgt - 2) && (j+1 < i))
1891                 {
1892 #ifdef JP
1893 prt("-- Â³¤¯ --", k, 15);
1894 #else
1895                         prt("-- more --", k, 15);
1896 #endif
1897                         inkey();
1898                         for (; k > 2; k--) prt("", k, 15);
1899                 }
1900         }
1901
1902         /* Wait for it */
1903 #ifdef JP
1904 prt("[²¿¤«¥­¡¼¤ò²¡¤¹¤È¥²¡¼¥à¤ËÌá¤ê¤Þ¤¹]", k, 15);
1905 #else
1906         prt("[Press any key to continue]", k, 15);
1907 #endif
1908
1909         inkey();
1910
1911         /* Restore the screen */
1912         screen_load();
1913
1914         /* Gave knowledge */
1915         return (TRUE);
1916 }
1917
1918
1919
1920 /*!
1921  * @brief ¥ª¥Ö¥¸¥§¥¯¥ÈÁªÂò»þ¤ÎÁªÂò¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¥é¥Ù¥ë¤òÊÖ¤¹ /
1922  * Convert an inventory index into a one character label
1923  * @param i ¥×¥ì¥¤¥ä¡¼¤Î½ê»ý/ÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥ÈID
1924  * @return Âбþ¤¹¤ë¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È
1925  * @details Note that the label does NOT distinguish inven/equip.
1926  */
1927 char index_to_label(int i)
1928 {
1929         /* Indexes for "inven" are easy */
1930         if (i < INVEN_RARM) return (I2A(i));
1931
1932         /* Indexes for "equip" are offset */
1933         return (I2A(i - INVEN_RARM));
1934 }
1935
1936 /*!
1937  * @brief ÁªÂò¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¥é¥Ù¥ë¤«¤é¥×¥ì¥¤¥ä¡¼¤Î½ê»ý¥ª¥Ö¥¸¥§¥¯¥ÈID¤òÊÖ¤¹ /
1938  * Convert a label into the index of an item in the "inven"
1939  * @return Âбþ¤¹¤ëID¡£³ºÅö¥¹¥í¥Ã¥È¤Ë¥ª¥Ö¥¸¥§¥¯¥È¤¬Â¸ºß¤·¤Ê¤«¤Ã¤¿¾ì¹ç-1¤òÊÖ¤¹ / Return "-1" if the label does not indicate a real item
1940  * @details Note that the label does NOT distinguish inven/equip.
1941  */
1942 s16b label_to_inven(int c)
1943 {
1944         int i;
1945
1946         /* Convert */
1947         i = (islower(c) ? A2I(c) : -1);
1948
1949         /* Verify the index */
1950         if ((i < 0) || (i > INVEN_PACK)) return (-1);
1951
1952         /* Empty slots can never be chosen */
1953         if (!inventory[i].k_idx) return (-1);
1954
1955         /* Return the index */
1956         return (i);
1957 }
1958
1959
1960 /*! See cmd5.c */
1961 extern bool select_ring_slot;
1962
1963
1964 /*!
1965  * @brief ¥×¥ì¥¤¥ä¡¼¤Î½ê»ý/ÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥ÈID¤¬»ØÎØÏȤ«¤òÊÖ¤¹ /
1966  * @param i ¥×¥ì¥¤¥ä¡¼¤Î½ê»ý/ÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥ÈID
1967  * @return »ØÎØÏȤʤé¤ÐTRUE¤òÊÖ¤¹¡£
1968  */
1969 static bool is_ring_slot(int i)
1970 {
1971         return (i == INVEN_RIGHT) || (i == INVEN_LEFT);
1972 }
1973
1974
1975 /*!
1976  * @brief ÁªÂò¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¥é¥Ù¥ë¤«¤é¥×¥ì¥¤¥ä¡¼¤ÎÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥ÈID¤òÊÖ¤¹ /
1977  * Convert a label into the index of a item in the "equip"
1978  * @return Âбþ¤¹¤ëID¡£³ºÅö¥¹¥í¥Ã¥È¤Ë¥ª¥Ö¥¸¥§¥¯¥È¤¬Â¸ºß¤·¤Ê¤«¤Ã¤¿¾ì¹ç-1¤òÊÖ¤¹ / Return "-1" if the label does not indicate a real item
1979  */
1980 s16b label_to_equip(int c)
1981 {
1982         int i;
1983
1984         /* Convert */
1985         i = (islower(c) ? A2I(c) : -1) + INVEN_RARM;
1986
1987         /* Verify the index */
1988         if ((i < INVEN_RARM) || (i >= INVEN_TOTAL)) return (-1);
1989
1990         if (select_ring_slot) return is_ring_slot(i) ? i : -1;
1991
1992         /* Empty slots can never be chosen */
1993         if (!inventory[i].k_idx) return (-1);
1994
1995         /* Return the index */
1996         return (i);
1997 }
1998
1999
2000
2001 /*!
2002  * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤Î³ºÅöÁõÈ÷Éô°ÌID¤òÊÖ¤¹ /
2003  * Determine which equipment slot (if any) an item likes
2004  * @param o_ptr Ì¾¾Î¤ò¼èÆÀ¤¹¤ë¸µ¤Î¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
2005  * @return Âбþ¤¹¤ëÁõÈ÷Éô°ÌID
2006  */
2007 s16b wield_slot(object_type *o_ptr)
2008 {
2009         /* Slot for equipment */
2010         switch (o_ptr->tval)
2011         {
2012                 case TV_DIGGING:
2013                 case TV_HAFTED:
2014                 case TV_POLEARM:
2015                 case TV_SWORD:
2016                 {
2017                         if (!inventory[INVEN_RARM].k_idx) return (INVEN_RARM);
2018                         if (inventory[INVEN_LARM].k_idx) return (INVEN_RARM);
2019                         return (INVEN_LARM);
2020                 }
2021
2022                 case TV_CAPTURE:
2023                 case TV_CARD:
2024                 case TV_SHIELD:
2025                 {
2026                         if (!inventory[INVEN_LARM].k_idx) return (INVEN_LARM);
2027                         if (inventory[INVEN_RARM].k_idx) return (INVEN_LARM);
2028                         return (INVEN_RARM);
2029                 }
2030
2031                 case TV_BOW:
2032                 {
2033                         return (INVEN_BOW);
2034                 }
2035
2036                 case TV_RING:
2037                 {
2038                         /* Use the right hand first */
2039                         if (!inventory[INVEN_RIGHT].k_idx) return (INVEN_RIGHT);
2040
2041                         /* Use the left hand for swapping (by default) */
2042                         return (INVEN_LEFT);
2043                 }
2044
2045                 case TV_AMULET:
2046                 case TV_WHISTLE:
2047                 {
2048                         return (INVEN_NECK);
2049                 }
2050
2051                 case TV_LITE:
2052                 {
2053                         return (INVEN_LITE);
2054                 }
2055
2056                 case TV_DRAG_ARMOR:
2057                 case TV_HARD_ARMOR:
2058                 case TV_SOFT_ARMOR:
2059                 {
2060                         return (INVEN_BODY);
2061                 }
2062
2063                 case TV_CLOAK:
2064                 {
2065                         return (INVEN_OUTER);
2066                 }
2067
2068                 case TV_CROWN:
2069                 case TV_HELM:
2070                 {
2071                         return (INVEN_HEAD);
2072                 }
2073
2074                 case TV_GLOVES:
2075                 {
2076                         return (INVEN_HANDS);
2077                 }
2078
2079                 case TV_BOOTS:
2080                 {
2081                         return (INVEN_FEET);
2082                 }
2083         }
2084
2085         /* No slot available */
2086         return (-1);
2087 }
2088
2089 /*!
2090  * @brief ½ê»ý/ÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥ÈID¤ÎÉô°Ìɽ¸½¤òÊÖ¤¹ /
2091  * Return a string mentioning how a given item is carried
2092  * @param i Éô°Ìɽ¸½¤òµá¤á¤ë¥×¥ì¥¤¥ä¡¼¤Î½ê»ý/ÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥ÈID
2093  * @return Éô°Ìɽ¸½¤Îʸ»úÎó¥Ý¥¤¥ó¥¿
2094  */
2095 cptr mention_use(int i)
2096 {
2097         cptr p;
2098
2099         /* Examine the location */
2100         switch (i)
2101         {
2102 #ifdef JP
2103                 case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "±¿ÈÂÃæ" : ((p_ptr->ryoute && p_ptr->migite) ? " Î¾¼ê" : (left_hander ? " º¸¼ê" : " ±¦¼ê")); break;
2104 #else
2105                 case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "Just lifting" : (p_ptr->migite ? "Wielding" : "On arm"); break;
2106 #endif
2107
2108 #ifdef JP
2109                 case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "±¿ÈÂÃæ" : ((p_ptr->ryoute && p_ptr->hidarite) ? " Î¾¼ê" : (left_hander ? " ±¦¼ê" : " º¸¼ê")); break;
2110 #else
2111                 case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "Just lifting" : (p_ptr->hidarite ? "Wielding" : "On arm"); break;
2112 #endif
2113
2114 #ifdef JP
2115                 case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "±¿ÈÂÃæ" : "¼Í·âÍÑ"; break;
2116 #else
2117                 case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "Just holding" : "Shooting"; break;
2118 #endif
2119
2120 #ifdef JP
2121                 case INVEN_RIGHT: p = (left_hander ? "º¸¼ê»Ø" : "±¦¼ê»Ø"); break;
2122 #else
2123                 case INVEN_RIGHT: p = (left_hander ? "On left hand" : "On right hand"); break;
2124 #endif
2125
2126 #ifdef JP
2127                 case INVEN_LEFT:  p = (left_hander ? "±¦¼ê»Ø" : "º¸¼ê»Ø"); break;
2128 #else
2129                 case INVEN_LEFT:  p = (left_hander ? "On right hand" : "On left hand"); break;
2130 #endif
2131
2132 #ifdef JP
2133                 case INVEN_NECK:  p = "  ¼ó"; break;
2134 #else
2135                 case INVEN_NECK:  p = "Around neck"; break;
2136 #endif
2137
2138 #ifdef JP
2139                 case INVEN_LITE:  p = " ¸÷¸»"; break;
2140 #else
2141                 case INVEN_LITE:  p = "Light source"; break;
2142 #endif
2143
2144 #ifdef JP
2145                 case INVEN_BODY:  p = "  ÂÎ"; break;
2146 #else
2147                 case INVEN_BODY:  p = "On body"; break;
2148 #endif
2149
2150 #ifdef JP
2151                 case INVEN_OUTER: p = "ÂΤξå"; break;
2152 #else
2153                 case INVEN_OUTER: p = "About body"; break;
2154 #endif
2155
2156 #ifdef JP
2157                 case INVEN_HEAD:  p = "  Ƭ"; break;
2158 #else
2159                 case INVEN_HEAD:  p = "On head"; break;
2160 #endif
2161
2162 #ifdef JP
2163                 case INVEN_HANDS: p = "  ¼ê"; break;
2164 #else
2165                 case INVEN_HANDS: p = "On hands"; break;
2166 #endif
2167
2168 #ifdef JP
2169                 case INVEN_FEET:  p = "  ­"; break;
2170 #else
2171                 case INVEN_FEET:  p = "On feet"; break;
2172 #endif
2173
2174 #ifdef JP
2175                 default:          p = "¥¶¥Ã¥¯"; break;
2176 #else
2177                 default:          p = "In pack"; break;
2178 #endif
2179         }
2180
2181         /* Return the result */
2182         return p;
2183 }
2184
2185
2186 /*!
2187  * @brief ½ê»ý/ÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥ÈID¤Î¸½ºß¤Î°·¤¤Êý¤Î¾õÂÖɽ¸½¤òÊÖ¤¹ /
2188  * Return a string describing how a given item is being worn.
2189  * @param i ¾õÂÖɽ¸½¤òµá¤á¤ë¥×¥ì¥¤¥ä¡¼¤Î½ê»ý/ÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥ÈID
2190  * @return ¾õÂÖɽ¸½ÆâÍƤÎʸ»úÎó¥Ý¥¤¥ó¥¿
2191  * @details
2192  * Currently, only used for items in the equipment, not inventory.
2193  */
2194 cptr describe_use(int i)
2195 {
2196         cptr p;
2197
2198         switch (i)
2199         {
2200 #ifdef JP
2201                 case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "±¿ÈÂÃæ¤Î" : ((p_ptr->ryoute && p_ptr->migite) ? "ξ¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : (left_hander ? "º¸¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : "±¦¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë")); break;
2202 #else
2203                 case INVEN_RARM:  p = p_ptr->heavy_wield[0] ? "just lifting" : (p_ptr->migite ? "attacking monsters with" : "wearing on your arm"); break;
2204 #endif
2205
2206 #ifdef JP
2207                 case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "±¿ÈÂÃæ¤Î" : ((p_ptr->ryoute && p_ptr->hidarite) ? "ξ¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : (left_hander ? "±¦¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : "º¸¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë")); break;
2208 #else
2209                 case INVEN_LARM:  p = p_ptr->heavy_wield[1] ? "just lifting" : (p_ptr->hidarite ? "attacking monsters with" : "wearing on your arm"); break;
2210 #endif
2211
2212 #ifdef JP
2213                 case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "»ý¤Ä¤À¤±¤ÇÀº°ìÇÕ¤Î" : "¼Í·âÍѤËÁõÈ÷¤·¤Æ¤¤¤ë"; break;
2214 #else
2215                 case INVEN_BOW:   p = (adj_str_hold[p_ptr->stat_ind[A_STR]] < inventory[i].weight / 10) ? "just holding" : "shooting missiles with"; break;
2216 #endif
2217
2218 #ifdef JP
2219                 case INVEN_RIGHT: p = (left_hander ? "º¸¼ê¤Î»Ø¤Ë¤Ï¤á¤Æ¤¤¤ë" : "±¦¼ê¤Î»Ø¤Ë¤Ï¤á¤Æ¤¤¤ë"); break;
2220 #else
2221                 case INVEN_RIGHT: p = (left_hander ? "wearing on your left hand" : "wearing on your right hand"); break;
2222 #endif
2223
2224 #ifdef JP
2225                 case INVEN_LEFT:  p = (left_hander ? "±¦¼ê¤Î»Ø¤Ë¤Ï¤á¤Æ¤¤¤ë" : "º¸¼ê¤Î»Ø¤Ë¤Ï¤á¤Æ¤¤¤ë"); break;
2226 #else
2227                 case INVEN_LEFT:  p = (left_hander ? "wearing on your right hand" : "wearing on your left hand"); break;
2228 #endif
2229
2230 #ifdef JP
2231                 case INVEN_NECK:  p = "¼ó¤Ë¤«¤±¤Æ¤¤¤ë"; break;
2232 #else
2233                 case INVEN_NECK:  p = "wearing around your neck"; break;
2234 #endif
2235
2236 #ifdef JP
2237                 case INVEN_LITE:  p = "¸÷¸»¤Ë¤·¤Æ¤¤¤ë"; break;
2238 #else
2239                 case INVEN_LITE:  p = "using to light the way"; break;
2240 #endif
2241
2242 #ifdef JP
2243                 case INVEN_BODY:  p = "ÂΤËÃå¤Æ¤¤¤ë"; break;
2244 #else
2245                 case INVEN_BODY:  p = "wearing on your body"; break;
2246 #endif
2247
2248 #ifdef JP
2249                 case INVEN_OUTER: p = "¿È¤Ë¤Þ¤È¤Ã¤Æ¤¤¤ë"; break;
2250 #else
2251                 case INVEN_OUTER: p = "wearing on your back"; break;
2252 #endif
2253
2254 #ifdef JP
2255                 case INVEN_HEAD:  p = "Ƭ¤Ë¤«¤Ö¤Ã¤Æ¤¤¤ë"; break;
2256 #else
2257                 case INVEN_HEAD:  p = "wearing on your head"; break;
2258 #endif
2259
2260 #ifdef JP
2261                 case INVEN_HANDS: p = "¼ê¤Ë¤Ä¤±¤Æ¤¤¤ë"; break;
2262 #else
2263                 case INVEN_HANDS: p = "wearing on your hands"; break;
2264 #endif
2265
2266 #ifdef JP
2267                 case INVEN_FEET:  p = "­¤Ë¤Ï¤¤¤Æ¤¤¤ë"; break;
2268 #else
2269                 case INVEN_FEET:  p = "wearing on your feet"; break;
2270 #endif
2271
2272 #ifdef JP
2273                 default:          p = "¥¶¥Ã¥¯¤ËÆþ¤Ã¤Æ¤¤¤ë"; break;
2274 #else
2275                 default:          p = "carrying in your pack"; break;
2276 #endif
2277         }
2278
2279         /* Return the result */
2280         return p;
2281 }
2282
2283
2284 /*!
2285  * @brief tval/sval»ØÄê¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¤¬¥×¥ì¥¤¥ä¡¼¤Î»ÈÍѲÄǽ¤ÊËâË¡½ñ¤«¤É¤¦¤«¤òÊÖ¤¹ /
2286  * Hack: Check if a spellbook is one of the realms we can use. -- TY
2287  * @param tval ¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¤Îtval
2288  * @param sval ¥Ù¡¼¥¹¥¢¥¤¥Æ¥à¤Îsval
2289  * @return »ÈÍѲÄǽ¤ÊËâË¡½ñ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
2290  */
2291
2292 bool check_book_realm(const byte book_tval, const byte book_sval)
2293 {
2294         if (book_tval < TV_LIFE_BOOK) return FALSE;
2295         if (p_ptr->pclass == CLASS_SORCERER)
2296         {
2297                 return is_magic(tval2realm(book_tval));
2298         }
2299         else if (p_ptr->pclass == CLASS_RED_MAGE)
2300         {
2301                 if (is_magic(tval2realm(book_tval)))
2302                         return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
2303         }
2304         return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
2305 }
2306
2307 /*!
2308  * @brief ¥¢¥¤¥Æ¥à¤¬item_tester_hook¥°¥í¡¼¥Ð¥ë´Ø¿ô¥Ý¥¤¥ó¥¿¤Î¾ò·ï¤òËþ¤¿¤·¤Æ¤¤¤ë¤«¤òÊÖ¤¹ÈÆÍÑ´Ø¿ô
2309  * Check an item against the item tester info
2310  * @param o_ptr È½Äê¤ò¹Ô¤¤¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
2311  * @return item_tester_hook¤Î»²¾ÈÀè¡¢¤½¤Î¾¤¤¤¯¤Ä¤«¤ÎÎã³°¤Ë±þ¤¸¤ÆTRUE/FALSE¤òÊÖ¤¹¡£
2312  */
2313 bool item_tester_okay(object_type *o_ptr)
2314 {
2315         /* Hack -- allow listing empty slots */
2316         if (item_tester_full) return (TRUE);
2317
2318         /* Require an item */
2319         if (!o_ptr->k_idx) return (FALSE);
2320
2321         /* Hack -- ignore "gold" */
2322         if (o_ptr->tval == TV_GOLD)
2323         {
2324                 /* See xtra2.c */
2325                 extern bool show_gold_on_floor;
2326
2327                 if (!show_gold_on_floor) return (FALSE);
2328         }
2329
2330         /* Check the tval */
2331         if (item_tester_tval)
2332         {
2333                 /* Is it a spellbook? If so, we need a hack -- TY */
2334                 if ((item_tester_tval <= TV_DEATH_BOOK) &&
2335                         (item_tester_tval >= TV_LIFE_BOOK))
2336                         return check_book_realm(o_ptr->tval, o_ptr->sval);
2337                 else
2338                         if (item_tester_tval != o_ptr->tval) return (FALSE);
2339         }
2340
2341         /* Check the hook */
2342         if (item_tester_hook)
2343         {
2344                 if (!(*item_tester_hook)(o_ptr)) return (FALSE);
2345         }
2346
2347         /* Assume okay */
2348         return (TRUE);
2349 }
2350
2351
2352 /*!
2353  * @brief ½ê»ý¥¢¥¤¥Æ¥à°ìÍ÷¤òɽ¼¨¤¹¤ë /
2354  * Choice window "shadow" of the "show_inven()" function
2355  * @return ¤Ê¤·
2356  */
2357 void display_inven(void)
2358 {
2359         register        int i, n, z = 0;
2360         object_type     *o_ptr;
2361         byte            attr = TERM_WHITE;
2362         char            tmp_val[80];
2363         char            o_name[MAX_NLEN];
2364         int             wid, hgt;
2365
2366         /* Get size */
2367         Term_get_size(&wid, &hgt);
2368
2369         /* Find the "final" slot */
2370         for (i = 0; i < INVEN_PACK; i++)
2371         {
2372                 o_ptr = &inventory[i];
2373
2374                 /* Skip non-objects */
2375                 if (!o_ptr->k_idx) continue;
2376
2377                 /* Track */
2378                 z = i + 1;
2379         }
2380
2381         /* Display the pack */
2382         for (i = 0; i < z; i++)
2383         {
2384                 /* Examine the item */
2385                 o_ptr = &inventory[i];
2386
2387                 /* Start with an empty "index" */
2388                 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
2389
2390                 /* Is this item "acceptable"? */
2391                 if (item_tester_okay(o_ptr))
2392                 {
2393                         /* Prepare an "index" */
2394                         tmp_val[0] = index_to_label(i);
2395
2396                         /* Bracket the "index" --(-- */
2397                         tmp_val[1] = ')';
2398                 }
2399
2400                 /* Display the index (or blank space) */
2401                 Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
2402
2403                 /* Obtain an item description */
2404                 object_desc(o_name, o_ptr, 0);
2405
2406                 /* Obtain the length of the description */
2407                 n = strlen(o_name);
2408
2409                 /* Get a color */
2410                 attr = tval_to_attr[o_ptr->tval % 128];
2411
2412                 /* Grey out charging items */
2413                 if (o_ptr->timeout)
2414                 {
2415                         attr = TERM_L_DARK;
2416                 }
2417
2418                 /* Display the entry itself */
2419                 Term_putstr(3, i, n, attr, o_name);
2420
2421                 /* Erase the rest of the line */
2422                 Term_erase(3+n, i, 255);
2423
2424                 /* Display the weight if needed */
2425                 if (show_weights)
2426                 {
2427                         int wgt = o_ptr->weight * o_ptr->number;
2428 #ifdef JP
2429                         sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt),lbtokg2(wgt) );
2430 #else
2431                         sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2432 #endif
2433
2434                         prt(tmp_val, i, wid - 9);
2435                 }
2436         }
2437
2438         /* Erase the rest of the window */
2439         for (i = z; i < hgt; i++)
2440         {
2441                 /* Erase the line */
2442                 Term_erase(0, i, 255);
2443         }
2444 }
2445
2446
2447
2448 /*!
2449  * @brief ÁõÈ÷¥¢¥¤¥Æ¥à°ìÍ÷¤òɽ¼¨¤¹¤ë /
2450  * Choice window "shadow" of the "show_equip()" function
2451  * @return ¤Ê¤·
2452  */
2453 void display_equip(void)
2454 {
2455         register        int i, n;
2456         object_type     *o_ptr;
2457         byte            attr = TERM_WHITE;
2458         char            tmp_val[80];
2459         char            o_name[MAX_NLEN];
2460         int             wid, hgt;
2461
2462         /* Get size */
2463         Term_get_size(&wid, &hgt);
2464
2465         /* Display the equipment */
2466         for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2467         {
2468                 /* Examine the item */
2469                 o_ptr = &inventory[i];
2470
2471                 /* Start with an empty "index" */
2472                 tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
2473
2474                 /* Is this item "acceptable"? */
2475                 if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr))
2476                 {
2477                         /* Prepare an "index" */
2478                         tmp_val[0] = index_to_label(i);
2479
2480                         /* Bracket the "index" --(-- */
2481                         tmp_val[1] = ')';
2482                 }
2483
2484                 /* Display the index (or blank space) */
2485                 Term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
2486
2487                 /* Obtain an item description */
2488                 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
2489                 {
2490 #ifdef JP
2491                         strcpy(o_name, "(Éð´ï¤òξ¼ê»ý¤Á)");
2492 #else
2493                         strcpy(o_name, "(wielding with two-hands)");
2494 #endif
2495                         attr = TERM_WHITE;
2496                 }
2497                 else
2498                 {
2499                         object_desc(o_name, o_ptr, 0);
2500                         attr = tval_to_attr[o_ptr->tval % 128];
2501                 }
2502
2503                 /* Obtain the length of the description */
2504                 n = strlen(o_name);
2505
2506                 /* Grey out charging items */
2507                 if (o_ptr->timeout)
2508                 {
2509                         attr = TERM_L_DARK;
2510                 }
2511
2512                 /* Display the entry itself */
2513                 Term_putstr(3, i - INVEN_RARM, n, attr, o_name);
2514
2515                 /* Erase the rest of the line */
2516                 Term_erase(3+n, i - INVEN_RARM, 255);
2517
2518                 /* Display the weight (if needed) */
2519                 if (show_weights)
2520                 {
2521                         int wgt = o_ptr->weight * o_ptr->number;
2522 #ifdef JP
2523                         sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt));
2524 #else
2525                         sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
2526 #endif
2527
2528                         prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
2529                 }
2530
2531                 /* Display the slot description (if needed) */
2532                 if (show_labels)
2533                 {
2534                         Term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
2535                         prt(mention_use(i), i - INVEN_RARM, wid - 15);
2536                 }
2537         }
2538
2539         /* Erase the rest of the window */
2540         for (i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
2541         {
2542                 /* Clear that line */
2543                 Term_erase(0, i, 255);
2544         }
2545 }
2546
2547
2548 /*!
2549  * @brief ½ê»ý/ÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥È¤ËÁªÂò¥¿¥°¤òÍ¿¤¨¤ë/¥¿¥°¤Ë³ºÅö¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤ë¤«¤òÊÖ¤¹ /
2550  * Find the "first" inventory object with the given "tag".
2551  * @param cp Âбþ¤¹¤ë¥¿¥°ID¤òÍ¿¤¨¤ë»²¾È¥Ý¥¤¥ó¥¿
2552  * @param tag ³ºÅö¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤ë¤«¤òÄ´¤Ù¤¿¤¤¥¿¥°
2553  * @param mode ½ê»ý¡¢ÁõÈ÷¤ÎÀÚ¤êÂؤ¨
2554  * @return ¥¿¥°¤Ë³ºÅö¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤ë¤Ê¤éTRUE¤òÊÖ¤¹
2555  * @detail 
2556  * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
2557  * inscription of an object.  Alphabetical characters don't work as a\n
2558  * tag in this form.\n
2559  *\n
2560  * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
2561  * and "x" is the "current" command_cmd code.\n
2562  */
2563 static bool get_tag(int *cp, char tag, int mode)
2564 {
2565         int i, start, end;
2566         cptr s;
2567
2568         /* Extract index from mode */
2569         switch (mode)
2570         {
2571         case USE_EQUIP:
2572                 start = INVEN_RARM;
2573                 end = INVEN_TOTAL - 1;
2574                 break;
2575
2576         case USE_INVEN:
2577                 start = 0;
2578                 end = INVEN_PACK - 1;
2579                 break;
2580
2581         default:
2582                 return FALSE;
2583         }
2584
2585         /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
2586
2587         /* Check every inventory object */
2588         for (i = start; i <= end; i++)
2589         {
2590                 object_type *o_ptr = &inventory[i];
2591
2592                 /* Skip non-objects */
2593                 if (!o_ptr->k_idx) continue;
2594
2595                 /* Skip empty inscriptions */
2596                 if (!o_ptr->inscription) continue;
2597
2598                 /* Skip non-choice */
2599                 if (!item_tester_okay(o_ptr)) continue;
2600
2601                 /* Find a '@' */
2602                 s = my_strchr(quark_str(o_ptr->inscription), '@');
2603
2604                 /* Process all tags */
2605                 while (s)
2606                 {
2607                         /* Check the special tags */
2608                         if ((s[1] == command_cmd) && (s[2] == tag))
2609                         {
2610                                 /* Save the actual inventory ID */
2611                                 *cp = i;
2612
2613                                 /* Success */
2614                                 return (TRUE);
2615                         }
2616
2617                         /* Find another '@' */
2618                         s = my_strchr(s + 1, '@');
2619                 }
2620         }
2621
2622
2623         /**** Find a tag in the form of {@#} (allows only numerals)  ***/
2624
2625         /* Don't allow {@#} with '#' being alphabet */
2626         if (tag < '0' || '9' < tag)
2627         {
2628                 /* No such tag */
2629                 return FALSE;
2630         }
2631
2632         /* Check every object */
2633         for (i = start; i <= end; i++)
2634         {
2635                 object_type *o_ptr = &inventory[i];
2636
2637                 /* Skip non-objects */
2638                 if (!o_ptr->k_idx) continue;
2639
2640                 /* Skip empty inscriptions */
2641                 if (!o_ptr->inscription) continue;
2642
2643                 /* Skip non-choice */
2644                 if (!item_tester_okay(o_ptr)) continue;
2645
2646                 /* Find a '@' */
2647                 s = my_strchr(quark_str(o_ptr->inscription), '@');
2648
2649                 /* Process all tags */
2650                 while (s)
2651                 {
2652                         /* Check the normal tags */
2653                         if (s[1] == tag)
2654                         {
2655                                 /* Save the actual inventory ID */
2656                                 *cp = i;
2657
2658                                 /* Success */
2659                                 return (TRUE);
2660                         }
2661
2662                         /* Find another '@' */
2663                         s = my_strchr(s + 1, '@');
2664                 }
2665         }
2666
2667         /* No such tag */
2668         return (FALSE);
2669 }
2670
2671
2672 /*!
2673  * @brief ¾²¥ª¥Ö¥¸¥§¥¯¥È¤ËÁªÂò¥¿¥°¤òÍ¿¤¨¤ë/¥¿¥°¤Ë³ºÅö¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤ë¤«¤òÊÖ¤¹ /
2674  * Find the "first" inventory object with the given "tag".
2675  * @param cp Âбþ¤¹¤ë¥¿¥°ID¤òÍ¿¤¨¤ë»²¾È¥Ý¥¤¥ó¥¿
2676  * @param tag ³ºÅö¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤ë¤«¤òÄ´¤Ù¤¿¤¤¥¿¥°
2677  * @param floor_list ¾²¾å¥¢¥¤¥Æ¥à¤ÎÇÛÎó
2678  * @param floor_num  ¾²¾å¥¢¥¤¥Æ¥à¤ÎÇÛÎóID
2679  * @return ¥¿¥°¤Ë³ºÅö¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤ë¤Ê¤éTRUE¤òÊÖ¤¹
2680  * @detail 
2681  * A "tag" is a numeral "n" appearing as "@n" anywhere in the\n
2682  * inscription of an object.  Alphabetical characters don't work as a\n
2683  * tag in this form.\n
2684  *\n
2685  * Also, the tag "@xn" will work as well, where "n" is a any tag-char,\n
2686  * and "x" is the "current" command_cmd code.\n
2687  */
2688 static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
2689 {
2690         int i;
2691         cptr s;
2692
2693         /**** Find a tag in the form of {@x#} (allow alphabet tag) ***/
2694
2695         /* Check every object in the grid */
2696         for (i = 0; i < floor_num && i < 23; i++)
2697         {
2698                 object_type *o_ptr = &o_list[floor_list[i]];
2699
2700                 /* Skip empty inscriptions */
2701                 if (!o_ptr->inscription) continue;
2702
2703                 /* Find a '@' */
2704                 s = my_strchr(quark_str(o_ptr->inscription), '@');
2705
2706                 /* Process all tags */
2707                 while (s)
2708                 {
2709                         /* Check the special tags */
2710                         if ((s[1] == command_cmd) && (s[2] == tag))
2711                         {
2712                                 /* Save the actual floor object ID */
2713                                 *cp = i;
2714
2715                                 /* Success */
2716                                 return (TRUE);
2717                         }
2718
2719                         /* Find another '@' */
2720                         s = my_strchr(s + 1, '@');
2721                 }
2722         }
2723
2724
2725         /**** Find a tag in the form of {@#} (allows only numerals)  ***/
2726
2727         /* Don't allow {@#} with '#' being alphabet */
2728         if (tag < '0' || '9' < tag)
2729         {
2730                 /* No such tag */
2731                 return FALSE;
2732         }
2733
2734         /* Check every object in the grid */
2735         for (i = 0; i < floor_num && i < 23; i++)
2736         {
2737                 object_type *o_ptr = &o_list[floor_list[i]];
2738
2739                 /* Skip empty inscriptions */
2740                 if (!o_ptr->inscription) continue;
2741
2742                 /* Find a '@' */
2743                 s = my_strchr(quark_str(o_ptr->inscription), '@');
2744
2745                 /* Process all tags */
2746                 while (s)
2747                 {
2748                         /* Check the normal tags */
2749                         if (s[1] == tag)
2750                         {
2751                                 /* Save the floor object ID */
2752                                 *cp = i;
2753
2754                                 /* Success */
2755                                 return (TRUE);
2756                         }
2757
2758                         /* Find another '@' */
2759                         s = my_strchr(s + 1, '@');
2760                 }
2761         }
2762
2763         /* No such tag */
2764         return (FALSE);
2765 }
2766
2767
2768 /*!
2769  * @brief ¥¿¥°ID¤Ë¤¢¤ï¤»¤Æ¥¿¥°¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¤Î¥ê¥¹¥È¤òÊÖ¤¹ /
2770  * Move around label characters with correspond tags
2771  * @param label ¥é¥Ù¥ë¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ëʸ»úÎ󻲾ȥݥ¤¥ó¥¿
2772  * @param mode ½ê»ýÉʥꥹ¥È¤«ÁõÈ÷Éʥꥹ¥È¤«¤ÎÀÚ¤êÂؤ¨
2773  * @return ¤Ê¤·
2774  */
2775 static void prepare_label_string(char *label, int mode)
2776 {
2777         cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2778         int  offset = (mode == USE_EQUIP) ? INVEN_RARM : 0;
2779         int  i;
2780
2781         /* Prepare normal labels */
2782         strcpy(label, alphabet_chars);
2783
2784         /* Move each label */
2785         for (i = 0; i < 52; i++)
2786         {
2787                 int index;
2788                 char c = alphabet_chars[i];
2789
2790                 /* Find a tag with this label */
2791                 if (get_tag(&index, c, mode))
2792                 {
2793                         /* Delete the overwritten label */
2794                         if (label[i] == c) label[i] = ' ';
2795
2796                         /* Move the label to the place of corresponding tag */
2797                         label[index - offset] = c;
2798                 }
2799         }
2800 }
2801
2802
2803 /*!
2804  * @brief ¥¿¥°ID¤Ë¤¢¤ï¤»¤Æ¥¿¥°¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È¤Î¥ê¥¹¥È¤òÊÖ¤¹(¾²¾å¥¢¥¤¥Æ¥àÍÑ) /
2805  * Move around label characters with correspond tags (floor version)
2806  * @param label ¥é¥Ù¥ë¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ëʸ»úÎ󻲾ȥݥ¤¥ó¥¿
2807  * @param floor_list ¾²¾å¥¢¥¤¥Æ¥à¤ÎÇÛÎó
2808  * @param floor_num  ¾²¾å¥¢¥¤¥Æ¥à¤ÎÇÛÎóID
2809  * @return ¤Ê¤·
2810  */
2811 /*
2812  */
2813 static void prepare_label_string_floor(char *label, int floor_list[], int floor_num)
2814 {
2815         cptr alphabet_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2816         int  i;
2817
2818         /* Prepare normal labels */
2819         strcpy(label, alphabet_chars);
2820
2821         /* Move each label */
2822         for (i = 0; i < 52; i++)
2823         {
2824                 int index;
2825                 char c = alphabet_chars[i];
2826
2827                 /* Find a tag with this label */
2828                 if (get_tag_floor(&index, c, floor_list, floor_num))
2829                 {
2830                         /* Delete the overwritten label */
2831                         if (label[i] == c) label[i] = ' ';
2832
2833                         /* Move the label to the place of corresponding tag */
2834                         label[index] = c;
2835                 }
2836         }
2837 }
2838
2839
2840 /*!
2841  * @brief ½ê»ý¥¢¥¤¥Æ¥à¤Îɽ¼¨¤ò¹Ô¤¦ /
2842  * Display the inventory.
2843  * @param target_item ¥¢¥¤¥Æ¥à¤ÎÁªÂò½èÍý¤ò¹Ô¤¦¤«Èݤ«¡£
2844  * @return ÁªÂò¤·¤¿¥¢¥¤¥Æ¥à¤Î¥¿¥°
2845  * @details
2846  * Hack -- do not display "trailing" empty slots
2847  */
2848 int show_inven(int target_item)
2849 {
2850         int             i, j, k, l, z = 0;
2851         int             col, cur_col, len;
2852         object_type     *o_ptr;
2853         char            o_name[MAX_NLEN];
2854         char            tmp_val[80];
2855         int             out_index[23];
2856         byte            out_color[23];
2857         char            out_desc[23][MAX_NLEN];
2858         int             target_item_label = 0;
2859         int             wid, hgt;
2860         char            inven_label[52 + 1];
2861
2862         /* Starting column */
2863         col = command_gap;
2864
2865         /* Get size */
2866         Term_get_size(&wid, &hgt);
2867
2868         /* Default "max-length" */
2869         len = wid - col - 1;
2870
2871
2872         /* Find the "final" slot */
2873         for (i = 0; i < INVEN_PACK; i++)
2874         {
2875                 o_ptr = &inventory[i];
2876
2877                 /* Skip non-objects */
2878                 if (!o_ptr->k_idx) continue;
2879
2880                 /* Track */
2881                 z = i + 1;
2882         }
2883
2884         prepare_label_string(inven_label, USE_INVEN);
2885
2886         /* Display the inventory */
2887         for (k = 0, i = 0; i < z; i++)
2888         {
2889                 o_ptr = &inventory[i];
2890
2891                 /* Is this item acceptable? */
2892                 if (!item_tester_okay(o_ptr)) continue;
2893
2894                 /* Describe the object */
2895                 object_desc(o_name, o_ptr, 0);
2896
2897                 /* Save the object index, color, and description */
2898                 out_index[k] = i;
2899                 out_color[k] = tval_to_attr[o_ptr->tval % 128];
2900
2901                 /* Grey out charging items */
2902                 if (o_ptr->timeout)
2903                 {
2904                         out_color[k] = TERM_L_DARK;
2905                 }
2906
2907                 (void)strcpy(out_desc[k], o_name);
2908
2909                 /* Find the predicted "line length" */
2910                 l = strlen(out_desc[k]) + 5;
2911
2912                 /* Be sure to account for the weight */
2913                 if (show_weights) l += 9;
2914
2915                 /* Account for icon if displayed */
2916                 if (show_item_graph)
2917                 {
2918                         l += 2;
2919                         if (use_bigtile) l++;
2920                 }
2921
2922                 /* Maintain the maximum length */
2923                 if (l > len) len = l;
2924
2925                 /* Advance to next "line" */
2926                 k++;
2927         }
2928
2929         /* Find the column to start in */
2930         col = (len > wid - 4) ? 0 : (wid - len - 1);
2931
2932         /* Output each entry */
2933         for (j = 0; j < k; j++)
2934         {
2935                 /* Get the index */
2936                 i = out_index[j];
2937
2938                 /* Get the item */
2939                 o_ptr = &inventory[i];
2940
2941                 /* Clear the line */
2942                 prt("", j + 1, col ? col - 2 : col);
2943
2944                 if (use_menu && target_item)
2945                 {
2946                         if (j == (target_item-1))
2947                         {
2948 #ifdef JP
2949                                 strcpy(tmp_val, "¡Õ");
2950 #else
2951                                 strcpy(tmp_val, "> ");
2952 #endif
2953                                 target_item_label = i;
2954                         }
2955                         else strcpy(tmp_val, "  ");
2956                 }
2957                 else if (i <= INVEN_PACK)
2958                 {
2959                         /* Prepare an index --(-- */
2960                         sprintf(tmp_val, "%c)", inven_label[i]);
2961                 }
2962                 else
2963                 {
2964                         /* Prepare an index --(-- */
2965                         sprintf(tmp_val, "%c)", index_to_label(i));
2966                 }
2967
2968                 /* Clear the line with the (possibly indented) index */
2969                 put_str(tmp_val, j + 1, col);
2970
2971                 cur_col = col + 3;
2972
2973                 /* Display graphics for object, if desired */
2974                 if (show_item_graph)
2975                 {
2976                         byte  a = object_attr(o_ptr);
2977                         char c = object_char(o_ptr);
2978
2979 #ifdef AMIGA
2980                         if (a & 0x80) a |= 0x40;
2981 #endif
2982
2983                         Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
2984                         if (use_bigtile) cur_col++;
2985
2986                         cur_col += 2;
2987                 }
2988
2989
2990                 /* Display the entry itself */
2991                 c_put_str(out_color[j], out_desc[j], j + 1, cur_col);
2992
2993                 /* Display the weight if needed */
2994                 if (show_weights)
2995                 {
2996                         int wgt = o_ptr->weight * o_ptr->number;
2997 #ifdef JP
2998                         (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
2999 #else
3000                         (void)sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3001 #endif
3002
3003                         prt(tmp_val, j + 1, wid - 9);
3004                 }
3005         }
3006
3007         /* Make a "shadow" below the list (only if needed) */
3008         if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3009
3010         /* Save the new column */
3011         command_gap = col;
3012
3013         return target_item_label;
3014 }
3015
3016
3017 /*!
3018  * @brief ÁõÈ÷¥¢¥¤¥Æ¥à¤Îɽ¼¨¤ò¹Ô¤¦ /
3019  * Display the equipment.
3020  * @param target_item ¥¢¥¤¥Æ¥à¤ÎÁªÂò½èÍý¤ò¹Ô¤¦¤«Èݤ«¡£
3021  * @return ÁªÂò¤·¤¿¥¢¥¤¥Æ¥à¤Î¥¿¥°
3022  */
3023 int show_equip(int target_item)
3024 {
3025         int             i, j, k, l;
3026         int             col, cur_col, len;
3027         object_type     *o_ptr;
3028         char            tmp_val[80];
3029         char            o_name[MAX_NLEN];
3030         int             out_index[23];
3031         byte            out_color[23];
3032         char            out_desc[23][MAX_NLEN];
3033         int             target_item_label = 0;
3034         int             wid, hgt;
3035         char            equip_label[52 + 1];
3036
3037         /* Starting column */
3038         col = command_gap;
3039
3040         /* Get size */
3041         Term_get_size(&wid, &hgt);
3042
3043         /* Maximal length */
3044         len = wid - col - 1;
3045
3046
3047         /* Scan the equipment list */
3048         for (k = 0, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3049         {
3050                 o_ptr = &inventory[i];
3051
3052                 /* Is this item acceptable? */
3053                 if (!(select_ring_slot ? is_ring_slot(i) : item_tester_okay(o_ptr)) &&
3054                     (!((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute) ||
3055                      item_tester_no_ryoute)) continue;
3056
3057                 /* Description */
3058                 object_desc(o_name, o_ptr, 0);
3059
3060                 if ((((i == INVEN_RARM) && p_ptr->hidarite) || ((i == INVEN_LARM) && p_ptr->migite)) && p_ptr->ryoute)
3061                 {
3062 #ifdef JP
3063                         (void)strcpy(out_desc[k],"(Éð´ï¤òξ¼ê»ý¤Á)");
3064 #else
3065                         (void)strcpy(out_desc[k],"(wielding with two-hands)");
3066 #endif
3067                         out_color[k] = TERM_WHITE;
3068                 }
3069                 else
3070                 {
3071                         (void)strcpy(out_desc[k], o_name);
3072                         out_color[k] = tval_to_attr[o_ptr->tval % 128];
3073                 }
3074
3075                 out_index[k] = i;
3076                 /* Grey out charging items */
3077                 if (o_ptr->timeout)
3078                 {
3079                         out_color[k] = TERM_L_DARK;
3080                 }
3081
3082                 /* Extract the maximal length (see below) */
3083 #ifdef JP
3084                 l = strlen(out_desc[k]) + (2 + 1);
3085 #else
3086                 l = strlen(out_desc[k]) + (2 + 3);
3087 #endif
3088
3089
3090                 /* Increase length for labels (if needed) */
3091 #ifdef JP
3092                 if (show_labels) l += (7 + 2);
3093 #else
3094                 if (show_labels) l += (14 + 2);
3095 #endif
3096
3097
3098                 /* Increase length for weight (if needed) */
3099                 if (show_weights) l += 9;
3100
3101                 if (show_item_graph) l += 2;
3102
3103                 /* Maintain the max-length */
3104                 if (l > len) len = l;
3105
3106                 /* Advance the entry */
3107                 k++;
3108         }
3109
3110         /* Hack -- Find a column to start in */
3111 #ifdef JP
3112         col = (len > wid - 6) ? 0 : (wid - len - 1);
3113 #else
3114         col = (len > wid - 4) ? 0 : (wid - len - 1);
3115 #endif
3116
3117         prepare_label_string(equip_label, USE_EQUIP);
3118
3119         /* Output each entry */
3120         for (j = 0; j < k; j++)
3121         {
3122                 /* Get the index */
3123                 i = out_index[j];
3124
3125                 /* Get the item */
3126                 o_ptr = &inventory[i];
3127
3128                 /* Clear the line */
3129                 prt("", j + 1, col ? col - 2 : col);
3130
3131                 if (use_menu && target_item)
3132                 {
3133                         if (j == (target_item-1))
3134                         {
3135 #ifdef JP
3136                                 strcpy(tmp_val, "¡Õ");
3137 #else
3138                                 strcpy(tmp_val, "> ");
3139 #endif
3140                                 target_item_label = i;
3141                         }
3142                         else strcpy(tmp_val, "  ");
3143                 }
3144                 else if (i >= INVEN_RARM)
3145                 {
3146                         /* Prepare an index --(-- */
3147                         sprintf(tmp_val, "%c)", equip_label[i - INVEN_RARM]);
3148                 }
3149                 else /* Paranoia */
3150                 {
3151                         /* Prepare an index --(-- */
3152                         sprintf(tmp_val, "%c)", index_to_label(i));
3153                 }
3154
3155                 /* Clear the line with the (possibly indented) index */
3156                 put_str(tmp_val, j+1, col);
3157
3158                 cur_col = col + 3;
3159
3160                 /* Display graphics for object, if desired */
3161                 if (show_item_graph)
3162                 {
3163                         byte a = object_attr(o_ptr);
3164                         char c = object_char(o_ptr);
3165
3166 #ifdef AMIGA
3167                         if (a & 0x80) a |= 0x40;
3168 #endif
3169
3170                         Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
3171                         if (use_bigtile) cur_col++;
3172
3173                         cur_col += 2;
3174                 }
3175
3176                 /* Use labels */
3177                 if (show_labels)
3178                 {
3179                         /* Mention the use */
3180 #ifdef JP
3181                         (void)sprintf(tmp_val, "%-7s: ", mention_use(i));
3182 #else
3183                         (void)sprintf(tmp_val, "%-14s: ", mention_use(i));
3184 #endif
3185
3186                         put_str(tmp_val, j+1, cur_col);
3187
3188                         /* Display the entry itself */
3189 #ifdef JP
3190                         c_put_str(out_color[j], out_desc[j], j+1, cur_col + 9);
3191 #else
3192                         c_put_str(out_color[j], out_desc[j], j+1, cur_col + 16);
3193 #endif
3194                 }
3195
3196                 /* No labels */
3197                 else
3198                 {
3199                         /* Display the entry itself */
3200                         c_put_str(out_color[j], out_desc[j], j+1, cur_col);
3201                 }
3202
3203                 /* Display the weight if needed */
3204                 if (show_weights)
3205                 {
3206                         int wgt = o_ptr->weight * o_ptr->number;
3207 #ifdef JP
3208                         (void)sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
3209 #else
3210                         (void)sprintf(tmp_val, "%3d.%d lb", wgt / 10, wgt % 10);
3211 #endif
3212
3213                         prt(tmp_val, j + 1, wid - 9);
3214                 }
3215         }
3216
3217         /* Make a "shadow" below the list (only if needed) */
3218         if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
3219
3220         /* Save the new column */
3221         command_gap = col;
3222
3223         return target_item_label;
3224 }
3225
3226 /*!
3227  * @brief ¥µ¥Ö¥¦¥£¥ó¥É¥¦¤Ë½ê»ýÉÊ¡¢ÁõÈ÷Éʥꥹ¥È¤Îɽ¼¨¤ò¹Ô¤¦ /
3228  * Flip "inven" and "equip" in any sub-windows
3229  * @return ¤Ê¤·
3230  */
3231 void toggle_inven_equip(void)
3232 {
3233         int j;
3234
3235         /* Scan windows */
3236         for (j = 0; j < 8; j++)
3237         {
3238                 /* Unused */
3239                 if (!angband_term[j]) continue;
3240
3241                 /* Flip inven to equip */
3242                 if (window_flag[j] & (PW_INVEN))
3243                 {
3244                         /* Flip flags */
3245                         window_flag[j] &= ~(PW_INVEN);
3246                         window_flag[j] |= (PW_EQUIP);
3247
3248                         /* Window stuff */
3249                         p_ptr->window |= (PW_EQUIP);
3250                 }
3251
3252                 /* Flip inven to equip */
3253                 else if (window_flag[j] & (PW_EQUIP))
3254                 {
3255                         /* Flip flags */
3256                         window_flag[j] &= ~(PW_EQUIP);
3257                         window_flag[j] |= (PW_INVEN);
3258
3259                         /* Window stuff */
3260                         p_ptr->window |= (PW_INVEN);
3261                 }
3262         }
3263 }
3264
3265 /*!
3266  * @brief ÁªÂò¤·¤¿¥¢¥¤¥Æ¥à¤Î³Îǧ½èÍý¤ÎÊä½õ /
3267  * Verify the choice of an item.
3268  * @param item ÁªÂò¥¢¥¤¥Æ¥àID
3269  * @return ³Îǧ¤¬Yes¤Ê¤éTRUE¤òÊÖ¤¹¡£
3270  * @details The item can be negative to mean "item on floor".
3271  */
3272 static bool verify(cptr prompt, int item)
3273 {
3274         char        o_name[MAX_NLEN];
3275         char        out_val[MAX_NLEN+20];
3276         object_type *o_ptr;
3277
3278
3279         /* Inventory */
3280         if (item >= 0)
3281         {
3282                 o_ptr = &inventory[item];
3283         }
3284
3285         /* Floor */
3286         else
3287         {
3288                 o_ptr = &o_list[0 - item];
3289         }
3290
3291         /* Describe */
3292         object_desc(o_name, o_ptr, 0);
3293
3294         /* Prompt */
3295 #ifdef JP
3296 (void)sprintf(out_val, "%s%s¤Ç¤¹¤«? ", prompt, o_name);
3297 #else
3298         (void)sprintf(out_val, "%s %s? ", prompt, o_name);
3299 #endif
3300
3301
3302         /* Query */
3303         return (get_check(out_val));
3304 }
3305
3306
3307 /*!
3308  * @brief ÁªÂò¤·¤¿¥¢¥¤¥Æ¥à¤Î³Îǧ½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
3309  * @praram item ÁªÂò¥¢¥¤¥Æ¥àID
3310  * @return ³Îǧ¤¬Yes¤Ê¤éTRUE¤òÊÖ¤¹¡£
3311  * @details The item can be negative to mean "item on floor".
3312  * Hack -- allow user to "prevent" certain choices
3313  */
3314 static bool get_item_allow(int item)
3315 {
3316         cptr s;
3317
3318         object_type *o_ptr;
3319
3320         if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
3321
3322         /* Inventory */
3323         if (item >= 0)
3324         {
3325                 o_ptr = &inventory[item];
3326         }
3327
3328         /* Floor */
3329         else
3330         {
3331                 o_ptr = &o_list[0 - item];
3332         }
3333
3334         /* No inscription */
3335         if (!o_ptr->inscription) return (TRUE);
3336
3337         /* Find a '!' */
3338         s = my_strchr(quark_str(o_ptr->inscription), '!');
3339
3340         /* Process preventions */
3341         while (s)
3342         {
3343                 /* Check the "restriction" */
3344                 if ((s[1] == command_cmd) || (s[1] == '*'))
3345                 {
3346                         /* Verify the choice */
3347 #ifdef JP
3348 if (!verify("ËÜÅö¤Ë", item)) return (FALSE);
3349 #else
3350                         if (!verify("Really try", item)) return (FALSE);
3351 #endif
3352
3353                 }
3354
3355                 /* Find another '!' */
3356                 s = my_strchr(s + 1, '!');
3357         }
3358
3359         /* Allow it */
3360         return (TRUE);
3361 }
3362
3363
3364 /*!
3365  * @brief ¥×¥ì¥¤¥ä¡¼¤Î½ê»ý/ÁõÈ÷¥ª¥Ö¥¸¥§¥¯¥È¤¬Àµµ¬¤Î¤â¤Î¤«¤òÊÖ¤¹ /
3366  * Auxiliary function for "get_item()" -- test an index
3367  * @param item ÁªÂò¥¢¥¤¥Æ¥àID
3368  * @return Àµµ¬¤ÎID¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
3369  */
3370 static bool get_item_okay(int i)
3371 {
3372         /* Illegal items */
3373         if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE);
3374
3375         if (select_ring_slot) return is_ring_slot(i);
3376
3377         /* Verify the item */
3378         if (!item_tester_okay(&inventory[i])) return (FALSE);
3379
3380         /* Assume okay */
3381         return (TRUE);
3382 }
3383
3384 /*!
3385  * @brief ¥×¥ì¥¤¥ä¡¼¤¬¥ª¥Ö¥¸¥§¥¯¥È¤ò½¦¤¦¤³¤È¤¬¤Ç¤­¤ë¾õÂÖ¤«¤òÊÖ¤¹ /
3386  * Determine whether get_item() can get some item or not
3387  * @param item ÁªÂò¥¢¥¤¥Æ¥àID
3388  * @return ¥¢¥¤¥Æ¥à¤ò½¦¤¨¤ë¤Ê¤é¤ÐTRUE¤òÊÖ¤¹¡£
3389  * @details assuming mode = (USE_EQUIP | USE_INVEN | USE_FLOOR).
3390  */
3391 bool can_get_item(void)
3392 {
3393         int j, floor_list[23], floor_num = 0;
3394
3395         for (j = 0; j < INVEN_TOTAL; j++)
3396                 if (item_tester_okay(&inventory[j]))
3397                         return TRUE;
3398
3399         floor_num = scan_floor(floor_list, py, px, 0x03);
3400         if (floor_num)
3401                 return TRUE;
3402
3403         return FALSE;
3404 }
3405
3406 /*!
3407  * @brief ¥ª¥Ö¥¸¥§¥¯¥ÈÁªÂò¤ÎÈÆÍÑ´Ø¿ô /
3408  * Let the user select an item, save its "index"
3409  * @param cp ÁªÂò¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È¤ÎID¤òÊÖ¤¹¡£
3410  * @param pmt ÁªÂòÌÜŪ¤Î¥á¥Ã¥»¡¼¥¸
3411  * @param str ÁªÂò¤Ç¤­¤ë¥ª¥Ö¥¸¥§¥¯¥È¤¬¤Ê¤¤¾ì¹ç¤Î¥­¥ã¥ó¥»¥ë¥á¥Ã¥»¡¼¥¸
3412  * @praram mode ¥ª¥×¥·¥ç¥ó¥Õ¥é¥°
3413  * @return ¥×¥ì¥¤¥ä¡¼¤Ë¤è¤ê¥¢¥¤¥Æ¥à¤¬ÁªÂò¤µ¤ì¤¿¤Ê¤éTRUE¤òÊÖ¤¹¡£/
3414  * Return TRUE only if an acceptable item was chosen by the user.\n
3415  * @details
3416  * The selected item must satisfy the "item_tester_hook()" function,\n
3417  * if that hook is set, and the "item_tester_tval", if that value is set.\n
3418  *\n
3419  * All "item_tester" restrictions are cleared before this function returns.\n
3420  *\n
3421  * The user is allowed to choose acceptable items from the equipment,\n
3422  * inventory, or floor, respectively, if the proper flag was given,\n
3423  * and there are any acceptable items in that location.\n
3424  *\n
3425  * The equipment or inventory are displayed (even if no acceptable\n
3426  * items are in that location) if the proper flag was given.\n
3427  *\n
3428  * If there are no acceptable items available anywhere, and "str" is\n
3429  * not NULL, then it will be used as the text of a warning message\n
3430  * before the function returns.\n
3431  *\n
3432  * Note that the user must press "-" to specify the item on the floor,\n
3433  * and there is no way to "examine" the item on the floor, while the\n
3434  * use of "capital" letters will "examine" an inventory/equipment item,\n
3435  * and prompt for its use.\n
3436  *\n
3437  * If a legal item is selected from the inventory, we save it in "cp"\n
3438  * directly (0 to 35), and return TRUE.\n
3439  *\n
3440  * If a legal item is selected from the floor, we save it in "cp" as\n
3441  * a negative (-1 to -511), and return TRUE.\n
3442  *\n
3443  * If no item is available, we do nothing to "cp", and we display a\n
3444  * warning message, using "str" if available, and return FALSE.\n
3445  *\n
3446  * If no item is selected, we do nothing to "cp", and return FALSE.\n
3447  *\n
3448  * Global "p_ptr->command_new" is used when viewing the inventory or equipment\n
3449  * to allow the user to enter a command while viewing those screens, and\n
3450  * also to induce "auto-enter" of stores, and other such stuff.\n
3451  *\n
3452  * Global "p_ptr->command_see" may be set before calling this function to start\n
3453  * out in "browse" mode.  It is cleared before this function returns.\n
3454  *\n
3455  * Global "p_ptr->command_wrk" is used to choose between equip/inven listings.\n
3456  * If it is TRUE then we are viewing inventory, else equipment.\n
3457  *\n
3458  * We always erase the prompt when we are done, leaving a blank line,\n
3459  * or a warning message, if appropriate, if no items are available.\n
3460  */
3461 bool get_item(int *cp, cptr pmt, cptr str, int mode)
3462 {
3463         s16b this_o_idx, next_o_idx = 0;
3464
3465         char which = ' ';
3466
3467         int j, k, i1, i2, e1, e2;
3468
3469         bool done, item;
3470
3471         bool oops = FALSE;
3472
3473         bool equip = FALSE;
3474         bool inven = FALSE;
3475         bool floor = FALSE;
3476
3477         bool allow_floor = FALSE;
3478
3479         bool toggle = FALSE;
3480
3481         char tmp_val[160];
3482         char out_val[160];
3483
3484         /* See cmd5.c */
3485         extern bool select_the_force;
3486
3487         int menu_line = (use_menu ? 1 : 0);
3488         int max_inven = 0;
3489         int max_equip = 0;
3490
3491 #ifdef ALLOW_REPEAT
3492
3493         static char prev_tag = '\0';
3494         char cur_tag = '\0';
3495
3496 #endif /* ALLOW_REPEAT */
3497
3498 #ifdef ALLOW_EASY_FLOOR /* TNB */
3499
3500         if (easy_floor || use_menu) return get_item_floor(cp, pmt, str, mode);
3501
3502 #endif /* ALLOW_EASY_FLOOR -- TNB */
3503
3504         /* Extract args */
3505         if (mode & USE_EQUIP) equip = TRUE;
3506         if (mode & USE_INVEN) inven = TRUE;
3507         if (mode & USE_FLOOR) floor = TRUE;
3508
3509 #ifdef ALLOW_REPEAT
3510
3511         /* Get the item index */
3512         if (repeat_pull(cp))
3513         {
3514                 /* the_force */
3515                 if (select_the_force && (*cp == INVEN_FORCE))
3516                 {
3517                         item_tester_tval = 0;
3518                         item_tester_hook = NULL;
3519                         command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3520                         return (TRUE);
3521                 }
3522
3523                 /* Floor item? */
3524                 else if (floor && (*cp < 0))
3525                 {
3526                         object_type *o_ptr;
3527
3528                         /* Special index */
3529                         k = 0 - (*cp);
3530
3531                         /* Acquire object */
3532                         o_ptr = &o_list[k];
3533
3534                         /* Validate the item */
3535                         if (item_tester_okay(o_ptr))
3536                         {
3537                                 /* Forget restrictions */
3538                                 item_tester_tval = 0;
3539                                 item_tester_hook = NULL;
3540                                 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3541
3542                                 /* Success */
3543                                 return TRUE;
3544                         }
3545                 }
3546
3547                 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
3548                          (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
3549                 {
3550                         if (prev_tag && command_cmd)
3551                         {
3552                                 /* Look up the tag and validate the item */
3553                                 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
3554                                 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
3555                                 else if (!get_item_okay(k)) /* Reject */;
3556                                 else
3557                                 {
3558                                         /* Accept that choice */
3559                                         (*cp) = k;
3560
3561                                         /* Forget restrictions */
3562                                         item_tester_tval = 0;
3563                                         item_tester_hook = NULL;
3564                                         command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3565
3566                                         /* Success */
3567                                         return TRUE;
3568                                 }
3569
3570                                 prev_tag = '\0'; /* prev_tag is no longer effective */
3571                         }
3572
3573                         /* Verify the item */
3574                         else if (get_item_okay(*cp))
3575                         {
3576                                 /* Forget restrictions */
3577                                 item_tester_tval = 0;
3578                                 item_tester_hook = NULL;
3579                                 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
3580
3581                                 /* Success */
3582                                 return TRUE;
3583                         }
3584                 }
3585         }
3586
3587 #endif /* ALLOW_REPEAT */
3588
3589
3590         /* Paranoia XXX XXX XXX */
3591         msg_print(NULL);
3592
3593
3594         /* Not done */
3595         done = FALSE;
3596
3597         /* No item selected */
3598         item = FALSE;
3599
3600
3601         /* Full inventory */
3602         i1 = 0;
3603         i2 = INVEN_PACK - 1;
3604
3605         /* Forbid inventory */
3606         if (!inven) i2 = -1;
3607         else if (use_menu)
3608         {
3609                 for (j = 0; j < INVEN_PACK; j++)
3610                         if (item_tester_okay(&inventory[j])) max_inven++;
3611         }
3612
3613         /* Restrict inventory indexes */
3614         while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
3615         while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
3616
3617
3618         /* Full equipment */
3619         e1 = INVEN_RARM;
3620         e2 = INVEN_TOTAL - 1;
3621
3622         /* Forbid equipment */
3623         if (!equip) e2 = -1;
3624         else if (use_menu)
3625         {
3626                 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
3627                         if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
3628                 if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
3629         }
3630
3631         /* Restrict equipment indexes */
3632         while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
3633         while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
3634
3635         if (equip && p_ptr->ryoute && !item_tester_no_ryoute)
3636         {
3637                 if (p_ptr->migite)
3638                 {
3639                         if (e2 < INVEN_LARM) e2 = INVEN_LARM;
3640                 }
3641                 else if (p_ptr->hidarite) e1 = INVEN_RARM;
3642         }
3643
3644
3645         /* Restrict floor usage */
3646         if (floor)
3647         {
3648                 /* Scan all objects in the grid */
3649                 for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
3650                 {
3651                         object_type *o_ptr;
3652
3653                         /* Acquire object */
3654                         o_ptr = &o_list[this_o_idx];
3655
3656                         /* Acquire next object */
3657                         next_o_idx = o_ptr->next_o_idx;
3658
3659                         /* Accept the item on the floor if legal */
3660                         if (item_tester_okay(o_ptr) && (o_ptr->marked & OM_FOUND)) allow_floor = TRUE;
3661                 }
3662         }
3663
3664         /* Require at least one legal choice */
3665         if (!allow_floor && (i1 > i2) && (e1 > e2))
3666         {
3667                 /* Cancel p_ptr->command_see */
3668                 command_see = FALSE;
3669
3670                 /* Oops */
3671                 oops = TRUE;
3672
3673                 /* Done */
3674                 done = TRUE;
3675
3676                 if (select_the_force) {
3677                     *cp = INVEN_FORCE;
3678                     item = TRUE;
3679                 }
3680         }
3681
3682         /* Analyze choices */
3683         else
3684         {
3685                 /* Hack -- Start on equipment if requested */
3686                 if (command_see && command_wrk && equip)
3687                 {
3688                         command_wrk = TRUE;
3689                 }
3690
3691                 /* Use inventory if allowed */
3692                 else if (inven)
3693                 {
3694                         command_wrk = FALSE;
3695                 }
3696
3697                 /* Use equipment if allowed */
3698                 else if (equip)
3699                 {
3700                         command_wrk = TRUE;
3701                 }
3702
3703                 /* Use inventory for floor */
3704                 else
3705                 {
3706                         command_wrk = FALSE;
3707                 }
3708         }
3709
3710
3711         /*
3712          * Äɲ媥ץ·¥ç¥ó(always_show_list)¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¾ï¤Ë°ìÍ÷¤òɽ¼¨¤¹¤ë
3713          */
3714         if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
3715
3716         /* Hack -- start out in "display" mode */
3717         if (command_see)
3718         {
3719                 /* Save screen */
3720                 screen_save();
3721         }
3722
3723
3724         /* Repeat until done */
3725         while (!done)
3726         {
3727                 int get_item_label = 0;
3728
3729                 /* Show choices */
3730                 int ni = 0;
3731                 int ne = 0;
3732
3733                 /* Scan windows */
3734                 for (j = 0; j < 8; j++)
3735                 {
3736                         /* Unused */
3737                         if (!angband_term[j]) continue;
3738
3739                         /* Count windows displaying inven */
3740                         if (window_flag[j] & (PW_INVEN)) ni++;
3741
3742                         /* Count windows displaying equip */
3743                         if (window_flag[j] & (PW_EQUIP)) ne++;
3744                 }
3745
3746                 /* Toggle if needed */
3747                 if ((command_wrk && ni && !ne) ||
3748                     (!command_wrk && !ni && ne))
3749                 {
3750                         /* Toggle */
3751                         toggle_inven_equip();
3752
3753                         /* Track toggles */
3754                         toggle = !toggle;
3755                 }
3756
3757                 /* Update */
3758                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
3759
3760                 /* Redraw windows */
3761                 window_stuff();
3762
3763
3764                 /* Inventory screen */
3765                 if (!command_wrk)
3766                 {
3767                         /* Redraw if needed */
3768                         if (command_see) get_item_label = show_inven(menu_line);
3769                 }
3770
3771                 /* Equipment screen */
3772                 else
3773                 {
3774                         /* Redraw if needed */
3775                         if (command_see) get_item_label = show_equip(menu_line);
3776                 }
3777
3778                 /* Viewing inventory */
3779                 if (!command_wrk)
3780                 {
3781                         /* Begin the prompt */
3782 #ifdef JP
3783                         sprintf(out_val, "»ý¤Áʪ:");
3784 #else
3785                         sprintf(out_val, "Inven:");
3786 #endif
3787
3788                         /* Some legal items */
3789                         if ((i1 <= i2) && !use_menu)
3790                         {
3791                                 /* Build the prompt */
3792 #ifdef JP
3793                                 sprintf(tmp_val, "%c-%c,'(',')',",
3794 #else
3795                                 sprintf(tmp_val, " %c-%c,'(',')',",
3796 #endif
3797                                         index_to_label(i1), index_to_label(i2));
3798
3799                                 /* Append */
3800                                 strcat(out_val, tmp_val);
3801                         }
3802
3803                         /* Indicate ability to "view" */
3804 #ifdef JP
3805                         if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
3806 #else
3807                         if (!command_see && !use_menu) strcat(out_val, " * to see,");
3808 #endif
3809
3810                         /* Append */
3811 #ifdef JP
3812                         if (equip) strcat(out_val, format(" %s ÁõÈ÷ÉÊ,", use_menu ? "'4'or'6'" : "'/'"));
3813 #else
3814                         if (equip) strcat(out_val, format(" %s for Equip,", use_menu ? "4 or 6" : "/"));
3815 #endif
3816                 }
3817
3818                 /* Viewing equipment */
3819                 else
3820                 {
3821                         /* Begin the prompt */
3822 #ifdef JP
3823                         sprintf(out_val, "ÁõÈ÷ÉÊ:");
3824 #else
3825                         sprintf(out_val, "Equip:");
3826 #endif
3827
3828                         /* Some legal items */
3829                         if ((e1 <= e2) && !use_menu)
3830                         {
3831                                 /* Build the prompt */
3832 #ifdef JP
3833                                 sprintf(tmp_val, "%c-%c,'(',')',",
3834 #else
3835                                 sprintf(tmp_val, " %c-%c,'(',')',",
3836 #endif
3837                                         index_to_label(e1), index_to_label(e2));
3838
3839                                 /* Append */
3840                                 strcat(out_val, tmp_val);
3841                         }
3842
3843                         /* Indicate ability to "view" */
3844 #ifdef JP
3845                         if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
3846 #else
3847                         if (!command_see) strcat(out_val, " * to see,");
3848 #endif
3849
3850                         /* Append */
3851 #ifdef JP
3852                         if (inven) strcat(out_val, format(" %s »ý¤Áʪ,", use_menu ? "'4'or'6'" : "'/'"));
3853 #else
3854                         if (inven) strcat(out_val, format(" %s for Inven,", use_menu ? "4 or 6" : "'/'"));
3855 #endif
3856                 }
3857
3858                 /* Indicate legality of the "floor" item */
3859 #ifdef JP
3860                 if (allow_floor) strcat(out_val, " '-'¾²¾å,");
3861                 if (select_the_force) strcat(out_val, " 'w'Îýµ¤½Ñ,");
3862 #else
3863                 if (allow_floor) strcat(out_val, " - for floor,");
3864                 if (select_the_force) strcat(out_val, " w for the Force,");
3865 #endif
3866
3867                 /* Finish the prompt */
3868                 strcat(out_val, " ESC");
3869
3870                 /* Build the prompt */
3871                 sprintf(tmp_val, "(%s) %s", out_val, pmt);
3872
3873                 /* Show the prompt */
3874                 prt(tmp_val, 0, 0);
3875
3876                 /* Get a key */
3877                 which = inkey();
3878
3879                 if (use_menu)
3880                 {
3881                 int max_line = (command_wrk ? max_equip : max_inven);
3882                 switch (which)
3883                 {
3884                         case ESCAPE:
3885                         case 'z':
3886                         case 'Z':
3887                         case '0':
3888                         {
3889                                 done = TRUE;
3890                                 break;
3891                         }
3892
3893                         case '8':
3894                         case 'k':
3895                         case 'K':
3896                         {
3897                                 menu_line += (max_line - 1);
3898                                 break;
3899                         }
3900
3901                         case '2':
3902                         case 'j':
3903                         case 'J':
3904                         {
3905                                 menu_line++;
3906                                 break;
3907                         }
3908
3909                         case '4':
3910                         case '6':
3911                         case 'h':
3912                         case 'H':
3913                         case 'l':
3914                         case 'L':
3915                         {
3916                                 /* Verify legality */
3917                                 if (!inven || !equip)
3918                                 {
3919                                         bell();
3920                                         break;
3921                                 }
3922
3923                                 /* Hack -- Fix screen */
3924                                 if (command_see)
3925                                 {
3926                                         /* Load screen */
3927                                         screen_load();
3928
3929                                         /* Save screen */
3930                                         screen_save();
3931                                 }
3932
3933                                 /* Switch inven/equip */
3934                                 command_wrk = !command_wrk;
3935                                 max_line = (command_wrk ? max_equip : max_inven);
3936                                 if (menu_line > max_line) menu_line = max_line;
3937
3938                                 /* Need to redraw */
3939                                 break;
3940                         }
3941
3942                         case 'x':
3943                         case 'X':
3944                         case '\r':
3945                         case '\n':
3946                         {
3947                                 if (command_wrk == USE_FLOOR)
3948                                 {
3949                                         /* Special index */
3950                                         (*cp) = -get_item_label;
3951                                 }
3952                                 else
3953                                 {
3954                                         /* Validate the item */
3955                                         if (!get_item_okay(get_item_label))
3956                                         {
3957                                                 bell();
3958                                                 break;
3959                                         }
3960
3961                                         /* Allow player to "refuse" certain actions */
3962                                         if (!get_item_allow(get_item_label))
3963                                         {
3964                                                 done = TRUE;
3965                                                 break;
3966                                         }
3967
3968                                         /* Accept that choice */
3969                                         (*cp) = get_item_label;
3970                                 }
3971
3972                                 item = TRUE;
3973                                 done = TRUE;
3974                                 break;
3975                         }
3976                         case 'w':
3977                         {
3978                                 if (select_the_force) {
3979                                         *cp = INVEN_FORCE;
3980                                         item = TRUE;
3981                                         done = TRUE;
3982                                         break;
3983                                 }
3984                         }
3985                 }
3986                 if (menu_line > max_line) menu_line -= max_line;
3987                 }
3988                 else
3989                 {
3990                 /* Parse it */
3991                 switch (which)
3992                 {
3993                         case ESCAPE:
3994                         {
3995                                 done = TRUE;
3996                                 break;
3997                         }
3998
3999                         case '*':
4000                         case '?':
4001                         case ' ':
4002                         {
4003                                 /* Hide the list */
4004                                 if (command_see)
4005                                 {
4006                                         /* Flip flag */
4007                                         command_see = FALSE;
4008
4009                                         /* Load screen */
4010                                         screen_load();
4011                                 }
4012
4013                                 /* Show the list */
4014                                 else
4015                                 {
4016                                         /* Save screen */
4017                                         screen_save();
4018
4019                                         /* Flip flag */
4020                                         command_see = TRUE;
4021                                 }
4022                                 break;
4023                         }
4024
4025                         case '/':
4026                         {
4027                                 /* Verify legality */
4028                                 if (!inven || !equip)
4029                                 {
4030                                         bell();
4031                                         break;
4032                                 }
4033
4034                                 /* Hack -- Fix screen */
4035                                 if (command_see)
4036                                 {
4037                                         /* Load screen */
4038                                         screen_load();
4039
4040                                         /* Save screen */
4041                                         screen_save();
4042                                 }
4043
4044                                 /* Switch inven/equip */
4045                                 command_wrk = !command_wrk;
4046
4047                                 /* Need to redraw */
4048                                 break;
4049                         }
4050
4051                         case '-':
4052                         {
4053                                 /* Use floor item */
4054                                 if (allow_floor)
4055                                 {
4056                                         /* Scan all objects in the grid */
4057                                         for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
4058                                         {
4059                                                 object_type *o_ptr;
4060
4061                                                 /* Acquire object */
4062                                                 o_ptr = &o_list[this_o_idx];
4063
4064                                                 /* Acquire next object */
4065                                                 next_o_idx = o_ptr->next_o_idx;
4066
4067                                                 /* Validate the item */
4068                                                 if (!item_tester_okay(o_ptr)) continue;
4069
4070                                                 /* Special index */
4071                                                 k = 0 - this_o_idx;
4072
4073                                                 /* Verify the item (if required) */
4074 #ifdef JP
4075 if (other_query_flag && !verify("ËÜÅö¤Ë", k)) continue;
4076 #else
4077                                                 if (other_query_flag && !verify("Try", k)) continue;
4078 #endif
4079
4080
4081                                                 /* Allow player to "refuse" certain actions */
4082                                                 if (!get_item_allow(k)) continue;
4083
4084                                                 /* Accept that choice */
4085                                                 (*cp) = k;
4086                                                 item = TRUE;
4087                                                 done = TRUE;
4088                                                 break;
4089                                         }
4090
4091                                         /* Outer break */
4092                                         if (done) break;
4093                                 }
4094
4095                                 /* Oops */
4096                                 bell();
4097                                 break;
4098                         }
4099
4100                         case '0':
4101                         case '1': case '2': case '3':
4102                         case '4': case '5': case '6':
4103                         case '7': case '8': case '9':
4104                         {
4105                                 /* Look up the tag */
4106                                 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
4107                                 {
4108                                         bell();
4109                                         break;
4110                                 }
4111
4112                                 /* Hack -- Validate the item */
4113                                 if ((k < INVEN_RARM) ? !inven : !equip)
4114                                 {
4115                                         bell();
4116                                         break;
4117                                 }
4118
4119                                 /* Validate the item */
4120                                 if (!get_item_okay(k))
4121                                 {
4122                                         bell();
4123                                         break;
4124                                 }
4125
4126                                 /* Allow player to "refuse" certain actions */
4127                                 if (!get_item_allow(k))
4128                                 {
4129                                         done = TRUE;
4130                                         break;
4131                                 }
4132
4133                                 /* Accept that choice */
4134                                 (*cp) = k;
4135                                 item = TRUE;
4136                                 done = TRUE;
4137 #ifdef ALLOW_REPEAT
4138                                 cur_tag = which;
4139 #endif /* ALLOW_REPEAT */
4140                                 break;
4141                         }
4142
4143 #if 0
4144                         case '\n':
4145                         case '\r':
4146                         {
4147                                 /* Choose "default" inventory item */
4148                                 if (!command_wrk)
4149                                 {
4150                                         k = ((i1 == i2) ? i1 : -1);
4151                                 }
4152
4153                                 /* Choose "default" equipment item */
4154                                 else
4155                                 {
4156                                         k = ((e1 == e2) ? e1 : -1);
4157                                 }
4158
4159                                 /* Validate the item */
4160                                 if (!get_item_okay(k))
4161                                 {
4162                                         bell();
4163                                         break;
4164                                 }
4165
4166                                 /* Allow player to "refuse" certain actions */
4167                                 if (!get_item_allow(k))
4168                                 {
4169                                         done = TRUE;
4170                                         break;
4171                                 }
4172
4173                                 /* Accept that choice */
4174                                 (*cp) = k;
4175                                 item = TRUE;
4176                                 done = TRUE;
4177                                 break;
4178                         }
4179 #endif
4180
4181                         case 'w':
4182                         {
4183                                 if (select_the_force) {
4184                                         *cp = INVEN_FORCE;
4185                                         item = TRUE;
4186                                         done = TRUE;
4187                                         break;
4188                                 }
4189
4190                                 /* Fall through */
4191                         }
4192
4193                         default:
4194                         {
4195                                 int ver;
4196                                 bool not_found = FALSE;
4197
4198                                 /* Look up the alphabetical tag */
4199                                 if (!get_tag(&k, which, command_wrk ? USE_EQUIP : USE_INVEN))
4200                                 {
4201                                         not_found = TRUE;
4202                                 }
4203
4204                                 /* Hack -- Validate the item */
4205                                 else if ((k < INVEN_RARM) ? !inven : !equip)
4206                                 {
4207                                         not_found = TRUE;
4208                                 }
4209
4210                                 /* Validate the item */
4211                                 else if (!get_item_okay(k))
4212                                 {
4213                                         not_found = TRUE;
4214                                 }
4215
4216                                 if (!not_found)
4217                                 {
4218                                         /* Accept that choice */
4219                                         (*cp) = k;
4220                                         item = TRUE;
4221                                         done = TRUE;
4222 #ifdef ALLOW_REPEAT
4223                                         cur_tag = which;
4224 #endif /* ALLOW_REPEAT */
4225                                         break;
4226                                 }
4227
4228                                 /* Extract "query" setting */
4229                                 ver = isupper(which);
4230                                 which = tolower(which);
4231
4232                                 /* Convert letter to inventory index */
4233                                 if (!command_wrk)
4234                                 {
4235                                         if (which == '(') k = i1;
4236                                         else if (which == ')') k = i2;
4237                                         else k = label_to_inven(which);
4238                                 }
4239
4240                                 /* Convert letter to equipment index */
4241                                 else
4242                                 {
4243                                         if (which == '(') k = e1;
4244                                         else if (which == ')') k = e2;
4245                                         else k = label_to_equip(which);
4246                                 }
4247
4248                                 /* Validate the item */
4249                                 if (!get_item_okay(k))
4250                                 {
4251                                         bell();
4252                                         break;
4253                                 }
4254
4255                                 /* Verify the item */
4256 #ifdef JP
4257 if (ver && !verify("ËÜÅö¤Ë", k))
4258 #else
4259                                 if (ver && !verify("Try", k))
4260 #endif
4261
4262                                 {
4263                                         done = TRUE;
4264                                         break;
4265                                 }
4266
4267                                 /* Allow player to "refuse" certain actions */
4268                                 if (!get_item_allow(k))
4269                                 {
4270                                         done = TRUE;
4271                                         break;
4272                                 }
4273
4274                                 /* Accept that choice */
4275                                 (*cp) = k;
4276                                 item = TRUE;
4277                                 done = TRUE;
4278                                 break;
4279                         }
4280                 }
4281                 }
4282         }
4283
4284
4285         /* Fix the screen if necessary */
4286         if (command_see)
4287         {
4288                 /* Load screen */
4289                 screen_load();
4290
4291                 /* Hack -- Cancel "display" */
4292                 command_see = FALSE;
4293         }
4294
4295
4296         /* Forget the item_tester_tval restriction */
4297         item_tester_tval = 0;
4298
4299         item_tester_no_ryoute = FALSE;
4300
4301         /* Forget the item_tester_hook restriction */
4302         item_tester_hook = NULL;
4303
4304
4305         /* Clean up  'show choices' */
4306         /* Toggle again if needed */
4307         if (toggle) toggle_inven_equip();
4308
4309         /* Update */
4310         p_ptr->window |= (PW_INVEN | PW_EQUIP);
4311
4312         /* Window stuff */
4313         window_stuff();
4314
4315
4316         /* Clear the prompt line */
4317         prt("", 0, 0);
4318
4319         /* Warning if needed */
4320         if (oops && str) msg_print(str);
4321
4322         if (item)
4323         {
4324 #ifdef ALLOW_REPEAT
4325                 repeat_push(*cp);
4326                 if (command_cmd) prev_tag = cur_tag;
4327 #endif /* ALLOW_REPEAT */
4328
4329                 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4330         }
4331
4332         /* Result */
4333         return (item);
4334 }
4335
4336
4337 #ifdef ALLOW_EASY_FLOOR
4338
4339 /*
4340  * scan_floor --
4341  *
4342  * Return a list of o_list[] indexes of items at the given cave
4343  * location. Valid flags are:
4344  *
4345  *              mode & 0x01 -- Item tester
4346  *              mode & 0x02 -- Marked items only
4347  *              mode & 0x04 -- Stop after first
4348  */
4349 int scan_floor(int *items, int y, int x, int mode)
4350 {
4351         int this_o_idx, next_o_idx;
4352
4353         int num = 0;
4354
4355         /* Sanity */
4356         if (!in_bounds(y, x)) return 0;
4357
4358         /* Scan all objects in the grid */
4359         for (this_o_idx = cave[y][x].o_idx; this_o_idx; this_o_idx = next_o_idx)
4360         {
4361                 object_type *o_ptr;
4362
4363                 /* Acquire object */
4364                 o_ptr = &o_list[this_o_idx];
4365
4366                 /* Acquire next object */
4367                 next_o_idx = o_ptr->next_o_idx;
4368
4369                 /* Item tester */
4370                 if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue;
4371
4372                 /* Marked */
4373                 if ((mode & 0x02) && !(o_ptr->marked & OM_FOUND)) continue;
4374
4375                 /* Accept this item */
4376                 /* XXX Hack -- Enforce limit */
4377                 if (num < 23)
4378                         items[num] = this_o_idx;
4379
4380                 num++;
4381
4382                 /* Only one */
4383                 if (mode & 0x04) break;
4384         }
4385
4386         /* Result */
4387         return num;
4388 }
4389
4390
4391 /*
4392  * Display a list of the items on the floor at the given location.
4393  */
4394 int show_floor(int target_item, int y, int x, int *min_width)
4395 {
4396         int i, j, k, l;
4397         int col, len;
4398
4399         object_type *o_ptr;
4400
4401         char o_name[MAX_NLEN];
4402
4403         char tmp_val[80];
4404
4405         int out_index[23];
4406         byte out_color[23];
4407         char out_desc[23][MAX_NLEN];
4408         int target_item_label = 0;
4409
4410         int floor_list[23], floor_num;
4411         int wid, hgt;
4412         char floor_label[52 + 1];
4413
4414         bool dont_need_to_show_weights = TRUE;
4415
4416         /* Get size */
4417         Term_get_size(&wid, &hgt);
4418
4419         /* Default length */
4420         len = MAX((*min_width), 20);
4421
4422
4423         /* Scan for objects in the grid, using item_tester_okay() */
4424         floor_num = scan_floor(floor_list, y, x, 0x03);
4425
4426         /* Display the floor objects */
4427         for (k = 0, i = 0; i < floor_num && i < 23; i++)
4428         {
4429                 o_ptr = &o_list[floor_list[i]];
4430
4431                 /* Describe the object */
4432                 object_desc(o_name, o_ptr, 0);
4433
4434                 /* Save the index */
4435                 out_index[k] = i;
4436
4437                 /* Acquire inventory color */
4438                 out_color[k] = tval_to_attr[o_ptr->tval & 0x7F];
4439
4440                 /* Save the object description */
4441                 strcpy(out_desc[k], o_name);
4442
4443                 /* Find the predicted "line length" */
4444                 l = strlen(out_desc[k]) + 5;
4445
4446                 /* Be sure to account for the weight */
4447                 if (show_weights) l += 9;
4448
4449                 if (o_ptr->tval != TV_GOLD) dont_need_to_show_weights = FALSE;
4450
4451                 /* Maintain the maximum length */
4452                 if (l > len) len = l;
4453
4454                 /* Advance to next "line" */
4455                 k++;
4456         }
4457
4458         if (show_weights && dont_need_to_show_weights) len -= 9;
4459
4460         /* Save width */
4461         *min_width = len;
4462
4463         /* Find the column to start in */
4464         col = (len > wid - 4) ? 0 : (wid - len - 1);
4465
4466         prepare_label_string_floor(floor_label, floor_list, floor_num);
4467
4468         /* Output each entry */
4469         for (j = 0; j < k; j++)
4470         {
4471                 /* Get the index */
4472                 i = floor_list[out_index[j]];
4473
4474                 /* Get the item */
4475                 o_ptr = &o_list[i];
4476
4477                 /* Clear the line */
4478                 prt("", j + 1, col ? col - 2 : col);
4479
4480                 if (use_menu && target_item)
4481                 {
4482                         if (j == (target_item-1))
4483                         {
4484 #ifdef JP
4485                                 strcpy(tmp_val, "¡Õ");
4486 #else
4487                                 strcpy(tmp_val, "> ");
4488 #endif
4489                                 target_item_label = i;
4490                         }
4491                         else strcpy(tmp_val, "   ");
4492                 }
4493                 else
4494                 {
4495                         /* Prepare an index --(-- */
4496                         sprintf(tmp_val, "%c)", floor_label[j]);
4497                 }
4498
4499                 /* Clear the line with the (possibly indented) index */
4500                 put_str(tmp_val, j + 1, col);
4501
4502                 /* Display the entry itself */
4503                 c_put_str(out_color[j], out_desc[j], j + 1, col + 3);
4504
4505                 /* Display the weight if needed */
4506                 if (show_weights && (o_ptr->tval != TV_GOLD))
4507                 {
4508                         int wgt = o_ptr->weight * o_ptr->number;
4509 #ifdef JP
4510                         sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt) , lbtokg2(wgt) );
4511 #else
4512                         sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
4513 #endif
4514
4515                         prt(tmp_val, j + 1, wid - 9);
4516                 }
4517         }
4518
4519         /* Make a "shadow" below the list (only if needed) */
4520         if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col);
4521
4522         return target_item_label;
4523 }
4524
4525 /*
4526  * This version of get_item() is called by get_item() when
4527  * the easy_floor is on.
4528  */
4529 bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
4530 {
4531         char n1 = ' ', n2 = ' ', which = ' ';
4532
4533         int j, k, i1, i2, e1, e2;
4534
4535         bool done, item;
4536
4537         bool oops = FALSE;
4538
4539         /* Extract args */
4540         bool equip = (mode & USE_EQUIP) ? TRUE : FALSE;
4541         bool inven = (mode & USE_INVEN) ? TRUE : FALSE;
4542         bool floor = (mode & USE_FLOOR) ? TRUE : FALSE;
4543
4544         bool allow_equip = FALSE;
4545         bool allow_inven = FALSE;
4546         bool allow_floor = FALSE;
4547
4548         bool toggle = FALSE;
4549
4550         char tmp_val[160];
4551         char out_val[160];
4552
4553         int floor_num, floor_list[23], floor_top = 0;
4554         int min_width = 0;
4555
4556         extern bool select_the_force;
4557
4558         int menu_line = (use_menu ? 1 : 0);
4559         int max_inven = 0;
4560         int max_equip = 0;
4561
4562 #ifdef ALLOW_REPEAT
4563
4564         static char prev_tag = '\0';
4565         char cur_tag = '\0';
4566
4567         /* Get the item index */
4568         if (repeat_pull(cp))
4569         {
4570                 /* the_force */
4571                 if (select_the_force && (*cp == INVEN_FORCE))
4572                 {
4573                         item_tester_tval = 0;
4574                         item_tester_hook = NULL;
4575                         command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4576                         return (TRUE);
4577                 }
4578
4579                 /* Floor item? */
4580                 else if (floor && (*cp < 0))
4581                 {
4582                         if (prev_tag && command_cmd)
4583                         {
4584                                 /* Scan all objects in the grid */
4585                                 floor_num = scan_floor(floor_list, py, px, 0x03);
4586
4587                                 /* Look up the tag */
4588                                 if (get_tag_floor(&k, prev_tag, floor_list, floor_num))
4589                                 {
4590                                         /* Accept that choice */
4591                                         (*cp) = 0 - floor_list[k];
4592
4593                                         /* Forget restrictions */
4594                                         item_tester_tval = 0;
4595                                         item_tester_hook = NULL;
4596                                         command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4597
4598                                         /* Success */
4599                                         return TRUE;
4600                                 }
4601
4602                                 prev_tag = '\0'; /* prev_tag is no longer effective */
4603                         }
4604
4605                         /* Validate the item */
4606                         else if (item_tester_okay(&o_list[0 - (*cp)]))
4607                         {
4608                                 /* Forget restrictions */
4609                                 item_tester_tval = 0;
4610                                 item_tester_hook = NULL;
4611                                 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4612
4613                                 /* Success */
4614                                 return TRUE;
4615                         }
4616                 }
4617
4618                 else if ((inven && (*cp >= 0) && (*cp < INVEN_PACK)) ||
4619                          (equip && (*cp >= INVEN_RARM) && (*cp < INVEN_TOTAL)))
4620                 {
4621                         if (prev_tag && command_cmd)
4622                         {
4623                                 /* Look up the tag and validate the item */
4624                                 if (!get_tag(&k, prev_tag, (*cp >= INVEN_RARM) ? USE_EQUIP : USE_INVEN)) /* Reject */;
4625                                 else if ((k < INVEN_RARM) ? !inven : !equip) /* Reject */;
4626                                 else if (!get_item_okay(k)) /* Reject */;
4627                                 else
4628                                 {
4629                                         /* Accept that choice */
4630                                         (*cp) = k;
4631
4632                                         /* Forget restrictions */
4633                                         item_tester_tval = 0;
4634                                         item_tester_hook = NULL;
4635                                         command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4636
4637                                         /* Success */
4638                                         return TRUE;
4639                                 }
4640
4641                                 prev_tag = '\0'; /* prev_tag is no longer effective */
4642                         }
4643
4644                         /* Verify the item */
4645                         else if (get_item_okay(*cp))
4646                         {
4647                                 /* Forget restrictions */
4648                                 item_tester_tval = 0;
4649                                 item_tester_hook = NULL;
4650                                 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
4651
4652                                 /* Success */
4653                                 return TRUE;
4654                         }
4655                 }
4656         }
4657
4658 #endif /* ALLOW_REPEAT */
4659
4660
4661         /* Paranoia XXX XXX XXX */
4662         msg_print(NULL);
4663
4664
4665         /* Not done */
4666         done = FALSE;
4667
4668         /* No item selected */
4669         item = FALSE;
4670
4671
4672         /* Full inventory */
4673         i1 = 0;
4674         i2 = INVEN_PACK - 1;
4675
4676         /* Forbid inventory */
4677         if (!inven) i2 = -1;
4678         else if (use_menu)
4679         {
4680                 for (j = 0; j < INVEN_PACK; j++)
4681                         if (item_tester_okay(&inventory[j])) max_inven++;
4682         }
4683
4684         /* Restrict inventory indexes */
4685         while ((i1 <= i2) && (!get_item_okay(i1))) i1++;
4686         while ((i1 <= i2) && (!get_item_okay(i2))) i2--;
4687
4688
4689         /* Full equipment */
4690         e1 = INVEN_RARM;
4691         e2 = INVEN_TOTAL - 1;
4692
4693         /* Forbid equipment */
4694         if (!equip) e2 = -1;
4695         else if (use_menu)
4696         {
4697                 for (j = INVEN_RARM; j < INVEN_TOTAL; j++)
4698                         if (select_ring_slot ? is_ring_slot(j) : item_tester_okay(&inventory[j])) max_equip++;
4699                 if (p_ptr->ryoute && !item_tester_no_ryoute) max_equip++;
4700         }
4701
4702         /* Restrict equipment indexes */
4703         while ((e1 <= e2) && (!get_item_okay(e1))) e1++;
4704         while ((e1 <= e2) && (!get_item_okay(e2))) e2--;
4705
4706         if (equip && p_ptr->ryoute && !item_tester_no_ryoute)
4707         {
4708                 if (p_ptr->migite)
4709                 {
4710                         if (e2 < INVEN_LARM) e2 = INVEN_LARM;
4711                 }
4712                 else if (p_ptr->hidarite) e1 = INVEN_RARM;
4713         }
4714
4715
4716         /* Count "okay" floor items */
4717         floor_num = 0;
4718
4719         /* Restrict floor usage */
4720         if (floor)
4721         {
4722                 /* Scan all objects in the grid */
4723                 floor_num = scan_floor(floor_list, py, px, 0x03);
4724         }
4725
4726         /* Accept inventory */
4727         if (i1 <= i2) allow_inven = TRUE;
4728
4729         /* Accept equipment */
4730         if (e1 <= e2) allow_equip = TRUE;
4731
4732         /* Accept floor */
4733         if (floor_num) allow_floor = TRUE;
4734
4735         /* Require at least one legal choice */
4736         if (!allow_inven && !allow_equip && !allow_floor)
4737         {
4738                 /* Cancel p_ptr->command_see */
4739                 command_see = FALSE;
4740
4741                 /* Oops */
4742                 oops = TRUE;
4743
4744                 /* Done */
4745                 done = TRUE;
4746
4747                 if (select_the_force) {
4748                     *cp = INVEN_FORCE;
4749                     item = TRUE;
4750                 }
4751         }
4752
4753         /* Analyze choices */
4754         else
4755         {
4756                 /* Hack -- Start on equipment if requested */
4757                 if (command_see && (command_wrk == (USE_EQUIP))
4758                         && allow_equip)
4759                 {
4760                         command_wrk = (USE_EQUIP);
4761                 }
4762
4763                 /* Use inventory if allowed */
4764                 else if (allow_inven)
4765                 {
4766                         command_wrk = (USE_INVEN);
4767                 }
4768
4769                 /* Use equipment if allowed */
4770                 else if (allow_equip)
4771                 {
4772                         command_wrk = (USE_EQUIP);
4773                 }
4774
4775                 /* Use floor if allowed */
4776                 else if (allow_floor)
4777                 {
4778                         command_wrk = (USE_FLOOR);
4779                 }
4780         }
4781
4782         /*
4783          * Äɲ媥ץ·¥ç¥ó(always_show_list)¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¾ï¤Ë°ìÍ÷¤òɽ¼¨¤¹¤ë
4784          */
4785         if ((always_show_list == TRUE) || use_menu) command_see = TRUE;
4786
4787         /* Hack -- start out in "display" mode */
4788         if (command_see)
4789         {
4790                 /* Save screen */
4791                 screen_save();
4792         }
4793
4794         /* Repeat until done */
4795         while (!done)
4796         {
4797                 int get_item_label = 0;
4798
4799                 /* Show choices */
4800                 int ni = 0;
4801                 int ne = 0;
4802
4803                 /* Scan windows */
4804                 for (j = 0; j < 8; j++)
4805                 {
4806                         /* Unused */
4807                         if (!angband_term[j]) continue;
4808
4809                         /* Count windows displaying inven */
4810                         if (window_flag[j] & (PW_INVEN)) ni++;
4811
4812                         /* Count windows displaying equip */
4813                         if (window_flag[j] & (PW_EQUIP)) ne++;
4814                 }
4815
4816                 /* Toggle if needed */
4817                 if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
4818                     (command_wrk == (USE_INVEN) && !ni && ne))
4819                 {
4820                         /* Toggle */
4821                         toggle_inven_equip();
4822
4823                         /* Track toggles */
4824                         toggle = !toggle;
4825                 }
4826
4827                 /* Update */
4828                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
4829
4830                 /* Redraw windows */
4831                 window_stuff();
4832
4833                 /* Inventory screen */
4834                 if (command_wrk == (USE_INVEN))
4835                 {
4836                         /* Extract the legal requests */
4837                         n1 = I2A(i1);
4838                         n2 = I2A(i2);
4839
4840                         /* Redraw if needed */
4841                         if (command_see) get_item_label = show_inven(menu_line);
4842                 }
4843
4844                 /* Equipment screen */
4845                 else if (command_wrk == (USE_EQUIP))
4846                 {
4847                         /* Extract the legal requests */
4848                         n1 = I2A(e1 - INVEN_RARM);
4849                         n2 = I2A(e2 - INVEN_RARM);
4850
4851                         /* Redraw if needed */
4852                         if (command_see) get_item_label = show_equip(menu_line);
4853                 }
4854
4855                 /* Floor screen */
4856                 else if (command_wrk == (USE_FLOOR))
4857                 {
4858                         j = floor_top;
4859                         k = MIN(floor_top + 23, floor_num) - 1;
4860
4861                         /* Extract the legal requests */
4862                         n1 = I2A(j - floor_top);
4863                         n2 = I2A(k - floor_top);
4864
4865                         /* Redraw if needed */
4866                         if (command_see) get_item_label = show_floor(menu_line, py, px, &min_width);
4867                 }
4868
4869                 /* Viewing inventory */
4870                 if (command_wrk == (USE_INVEN))
4871                 {
4872                         /* Begin the prompt */
4873 #ifdef JP
4874                         sprintf(out_val, "»ý¤Áʪ:");
4875 #else
4876                         sprintf(out_val, "Inven:");
4877 #endif
4878
4879                         if (!use_menu)
4880                         {
4881                                 /* Build the prompt */
4882 #ifdef JP
4883                                 sprintf(tmp_val, "%c-%c,'(',')',",
4884 #else
4885                                 sprintf(tmp_val, " %c-%c,'(',')',",
4886 #endif
4887                                         index_to_label(i1), index_to_label(i2));
4888
4889                                 /* Append */
4890                                 strcat(out_val, tmp_val);
4891                         }
4892
4893                         /* Indicate ability to "view" */
4894 #ifdef JP
4895                         if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
4896 #else
4897                         if (!command_see && !use_menu) strcat(out_val, " * to see,");
4898 #endif
4899
4900                         /* Append */
4901                         if (allow_equip)
4902                         {
4903 #ifdef JP
4904                                 if (!use_menu)
4905                                         strcat(out_val, " '/' ÁõÈ÷ÉÊ,");
4906                                 else if (allow_floor)
4907                                         strcat(out_val, " '6' ÁõÈ÷ÉÊ,");
4908                                 else
4909                                         strcat(out_val, " '4'or'6' ÁõÈ÷ÉÊ,");
4910 #else
4911                                 if (!use_menu)
4912                                         strcat(out_val, " / for Equip,");
4913                                 else if (allow_floor)
4914                                         strcat(out_val, " 6 for Equip,");
4915                                 else
4916                                         strcat(out_val, " 4 or 6 for Equip,");
4917 #endif
4918                         }
4919
4920                         /* Append */
4921                         if (allow_floor)
4922                         {
4923 #ifdef JP
4924                                 if (!use_menu)
4925                                         strcat(out_val, " '-'¾²¾å,");
4926                                 else if (allow_equip)
4927                                         strcat(out_val, " '4' ¾²¾å,");
4928                                 else
4929                                         strcat(out_val, " '4'or'6' ¾²¾å,");
4930 #else
4931                                 if (!use_menu)
4932                                         strcat(out_val, " - for floor,");
4933                                 else if (allow_equip)
4934                                         strcat(out_val, " 4 for floor,");
4935                                 else
4936                                         strcat(out_val, " 4 or 6 for floor,");
4937 #endif
4938                         }
4939                 }
4940
4941                 /* Viewing equipment */
4942                 else if (command_wrk == (USE_EQUIP))
4943                 {
4944                         /* Begin the prompt */
4945 #ifdef JP
4946                         sprintf(out_val, "ÁõÈ÷ÉÊ:");
4947 #else
4948                         sprintf(out_val, "Equip:");
4949 #endif
4950
4951                         if (!use_menu)
4952                         {
4953                                 /* Build the prompt */
4954 #ifdef JP
4955                                 sprintf(tmp_val, "%c-%c,'(',')',",
4956 #else
4957                                 sprintf(tmp_val, " %c-%c,'(',')',",
4958 #endif
4959                                         index_to_label(e1), index_to_label(e2));
4960
4961                                 /* Append */
4962                                 strcat(out_val, tmp_val);
4963                         }
4964
4965                         /* Indicate ability to "view" */
4966 #ifdef JP
4967                         if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
4968 #else
4969                         if (!command_see && !use_menu) strcat(out_val, " * to see,");
4970 #endif
4971
4972                         /* Append */
4973                         if (allow_inven)
4974                         {
4975 #ifdef JP
4976                                 if (!use_menu)
4977                                         strcat(out_val, " '/' »ý¤Áʪ,");
4978                                 else if (allow_floor)
4979                                         strcat(out_val, " '4' »ý¤Áʪ,");
4980                                 else
4981                                         strcat(out_val, " '4'or'6' »ý¤Áʪ,");
4982 #else
4983                                 if (!use_menu)
4984                                         strcat(out_val, " / for Inven,");
4985                                 else if (allow_floor)
4986                                         strcat(out_val, " 4 for Inven,");
4987                                 else
4988                                         strcat(out_val, " 4 or 6 for Inven,");
4989 #endif
4990                         }
4991
4992                         /* Append */
4993                         if (allow_floor)
4994                         {
4995 #ifdef JP
4996                                 if (!use_menu)
4997                                         strcat(out_val, " '-'¾²¾å,");
4998                                 else if (allow_inven)
4999                                         strcat(out_val, " '6' ¾²¾å,");
5000                                 else
5001                                         strcat(out_val, " '4'or'6' ¾²¾å,");
5002 #else
5003                                 if (!use_menu)
5004                                         strcat(out_val, " - for floor,");
5005                                 else if (allow_inven)
5006                                         strcat(out_val, " 6 for floor,");
5007                                 else
5008                                         strcat(out_val, " 4 or 6 for floor,");
5009 #endif
5010                         }
5011                 }
5012
5013                 /* Viewing floor */
5014                 else if (command_wrk == (USE_FLOOR))
5015                 {
5016                         /* Begin the prompt */
5017 #ifdef JP
5018                         sprintf(out_val, "¾²¾å:");
5019 #else
5020                         sprintf(out_val, "Floor:");
5021 #endif
5022
5023                         if (!use_menu)
5024                         {
5025                                 /* Build the prompt */
5026 #ifdef JP
5027                                 sprintf(tmp_val, "%c-%c,'(',')',", n1, n2);
5028 #else
5029                                 sprintf(tmp_val, " %c-%c,'(',')',", n1, n2);
5030 #endif
5031
5032                                 /* Append */
5033                                 strcat(out_val, tmp_val);
5034                         }
5035
5036                         /* Indicate ability to "view" */
5037 #ifdef JP
5038                         if (!command_see && !use_menu) strcat(out_val, " '*'°ìÍ÷,");
5039 #else
5040                         if (!command_see && !use_menu) strcat(out_val, " * to see,");
5041 #endif
5042
5043                         if (use_menu)
5044                         {
5045                                 if (allow_inven && allow_equip)
5046                                 {
5047 #ifdef JP
5048                                         strcat(out_val, " '4' ÁõÈ÷ÉÊ, '6' »ý¤Áʪ,");
5049 #else
5050                                         strcat(out_val, " 4 for Equip, 6 for Inven,");
5051 #endif
5052                                 }
5053                                 else if (allow_inven)
5054                                 {
5055 #ifdef JP
5056                                         strcat(out_val, " '4'or'6' »ý¤Áʪ,");
5057 #else
5058                                         strcat(out_val, " 4 or 6 for Inven,");
5059 #endif
5060                                 }
5061                                 else if (allow_equip)
5062                                 {
5063 #ifdef JP
5064                                         strcat(out_val, " '4'or'6' ÁõÈ÷ÉÊ,");
5065 #else
5066                                         strcat(out_val, " 4 or 6 for Equip,");
5067 #endif
5068                                 }
5069                         }
5070                         /* Append */
5071                         else if (allow_inven)
5072                         {
5073 #ifdef JP
5074                                 strcat(out_val, " '/' »ý¤Áʪ,");
5075 #else
5076                                 strcat(out_val, " / for Inven,");
5077 #endif
5078                         }
5079                         else if (allow_equip)
5080                         {
5081 #ifdef JP
5082                                 strcat(out_val, " '/'ÁõÈ÷ÉÊ,");
5083 #else
5084                                 strcat(out_val, " / for Equip,");
5085 #endif
5086                         }
5087
5088                         /* Append */
5089                         if (command_see && !use_menu)
5090                         {
5091 #ifdef JP
5092                                 strcat(out_val, " Enter ¼¡,");
5093 #else
5094                                 strcat(out_val, " Enter for scroll down,");
5095 #endif
5096                         }
5097                 }
5098
5099                 /* Append */
5100 #ifdef JP
5101                 if (select_the_force) strcat(out_val, " 'w'Îýµ¤½Ñ,");
5102 #else
5103                 if (select_the_force) strcat(out_val, " w for the Force,");
5104 #endif
5105
5106                 /* Finish the prompt */
5107                 strcat(out_val, " ESC");
5108
5109                 /* Build the prompt */
5110                 sprintf(tmp_val, "(%s) %s", out_val, pmt);
5111
5112                 /* Show the prompt */
5113                 prt(tmp_val, 0, 0);
5114
5115                 /* Get a key */
5116                 which = inkey();
5117
5118                 if (use_menu)
5119                 {
5120                 int max_line = 1;
5121                 if (command_wrk == USE_INVEN) max_line = max_inven;
5122                 else if (command_wrk == USE_EQUIP) max_line = max_equip;
5123                 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
5124                 switch (which)
5125                 {
5126                         case ESCAPE:
5127                         case 'z':
5128                         case 'Z':
5129                         case '0':
5130                         {
5131                                 done = TRUE;
5132                                 break;
5133                         }
5134
5135                         case '8':
5136                         case 'k':
5137                         case 'K':
5138                         {
5139                                 menu_line += (max_line - 1);
5140                                 break;
5141                         }
5142
5143                         case '2':
5144                         case 'j':
5145                         case 'J':
5146                         {
5147                                 menu_line++;
5148                                 break;
5149                         }
5150
5151                         case '4':
5152                         case 'h':
5153                         case 'H':
5154                         {
5155                                 /* Verify legality */
5156                                 if (command_wrk == (USE_INVEN))
5157                                 {
5158                                         if (allow_floor) command_wrk = USE_FLOOR;
5159                                         else if (allow_equip) command_wrk = USE_EQUIP;
5160                                         else
5161                                         {
5162                                                 bell();
5163                                                 break;
5164                                         }
5165                                 }
5166                                 else if (command_wrk == (USE_EQUIP))
5167                                 {
5168                                         if (allow_inven) command_wrk = USE_INVEN;
5169                                         else if (allow_floor) command_wrk = USE_FLOOR;
5170                                         else
5171                                         {
5172                                                 bell();
5173                                                 break;
5174                                         }
5175                                 }
5176                                 else if (command_wrk == (USE_FLOOR))
5177                                 {
5178                                         if (allow_equip) command_wrk = USE_EQUIP;
5179                                         else if (allow_inven) command_wrk = USE_INVEN;
5180                                         else
5181                                         {
5182                                                 bell();
5183                                                 break;
5184                                         }
5185                                 }
5186                                 else
5187                                 {
5188                                         bell();
5189                                         break;
5190                                 }
5191
5192                                 /* Hack -- Fix screen */
5193                                 if (command_see)
5194                                 {
5195                                         /* Load screen */
5196                                         screen_load();
5197
5198                                         /* Save screen */
5199                                         screen_save();
5200                                 }
5201
5202                                 /* Switch inven/equip */
5203                                 if (command_wrk == USE_INVEN) max_line = max_inven;
5204                                 else if (command_wrk == USE_EQUIP) max_line = max_equip;
5205                                 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
5206                                 if (menu_line > max_line) menu_line = max_line;
5207
5208                                 /* Need to redraw */
5209                                 break;
5210                         }
5211
5212                         case '6':
5213                         case 'l':
5214                         case 'L':
5215                         {
5216                                 /* Verify legality */
5217                                 if (command_wrk == (USE_INVEN))
5218                                 {
5219                                         if (allow_equip) command_wrk = USE_EQUIP;
5220                                         else if (allow_floor) command_wrk = USE_FLOOR;
5221                                         else
5222                                         {
5223                                                 bell();
5224                                                 break;
5225                                         }
5226                                 }
5227                                 else if (command_wrk == (USE_EQUIP))
5228                                 {
5229                                         if (allow_floor) command_wrk = USE_FLOOR;
5230                                         else if (allow_inven) command_wrk = USE_INVEN;
5231                                         else
5232                                         {
5233                                                 bell();
5234                                                 break;
5235                                         }
5236                                 }
5237                                 else if (command_wrk == (USE_FLOOR))
5238                                 {
5239                                         if (allow_inven) command_wrk = USE_INVEN;
5240                                         else if (allow_equip) command_wrk = USE_EQUIP;
5241                                         else
5242                                         {
5243                                                 bell();
5244                                                 break;
5245                                         }
5246                                 }
5247                                 else
5248                                 {
5249                                         bell();
5250                                         break;
5251                                 }
5252
5253                                 /* Hack -- Fix screen */
5254                                 if (command_see)
5255                                 {
5256                                         /* Load screen */
5257                                         screen_load();
5258
5259                                         /* Save screen */
5260                                         screen_save();
5261                                 }
5262
5263                                 /* Switch inven/equip */
5264                                 if (command_wrk == USE_INVEN) max_line = max_inven;
5265                                 else if (command_wrk == USE_EQUIP) max_line = max_equip;
5266                                 else if (command_wrk == USE_FLOOR) max_line = MIN(23, floor_num);
5267                                 if (menu_line > max_line) menu_line = max_line;
5268
5269                                 /* Need to redraw */
5270                                 break;
5271                         }
5272
5273                         case 'x':
5274                         case 'X':
5275                         case '\r':
5276                         case '\n':
5277                         {
5278                                 if (command_wrk == USE_FLOOR)
5279                                 {
5280                                         /* Special index */
5281                                         (*cp) = -get_item_label;
5282                                 }
5283                                 else
5284                                 {
5285                                         /* Validate the item */
5286                                         if (!get_item_okay(get_item_label))
5287                                         {
5288                                                 bell();
5289                                                 break;
5290                                         }
5291
5292                                         /* Allow player to "refuse" certain actions */
5293                                         if (!get_item_allow(get_item_label))
5294                                         {
5295                                                 done = TRUE;
5296                                                 break;
5297                                         }
5298
5299                                         /* Accept that choice */
5300                                         (*cp) = get_item_label;
5301                                 }
5302
5303                                 item = TRUE;
5304                                 done = TRUE;
5305                                 break;
5306                         }
5307                         case 'w':
5308                         {
5309                                 if (select_the_force) {
5310                                         *cp = INVEN_FORCE;
5311                                         item = TRUE;
5312                                         done = TRUE;
5313                                         break;
5314                                 }
5315                         }
5316                 }
5317                 if (menu_line > max_line) menu_line -= max_line;
5318                 }
5319                 else
5320                 {
5321                 /* Parse it */
5322                 switch (which)
5323                 {
5324                         case ESCAPE:
5325                         {
5326                                 done = TRUE;
5327                                 break;
5328                         }
5329
5330                         case '*':
5331                         case '?':
5332                         case ' ':
5333                         {
5334                                 /* Hide the list */
5335                                 if (command_see)
5336                                 {
5337                                         /* Flip flag */
5338                                         command_see = FALSE;
5339
5340                                         /* Load screen */
5341                                         screen_load();
5342                                 }
5343
5344                                 /* Show the list */
5345                                 else
5346                                 {
5347                                         /* Save screen */
5348                                         screen_save();
5349
5350                                         /* Flip flag */
5351                                         command_see = TRUE;
5352                                 }
5353                                 break;
5354                         }
5355
5356                         case '\n':
5357                         case '\r':
5358                         case '+':
5359                         {
5360                                 int i, o_idx;
5361                                 cave_type *c_ptr = &cave[py][px];
5362
5363                                 if (command_wrk != (USE_FLOOR)) break;
5364
5365                                 /* Get the object being moved. */
5366                                 o_idx = c_ptr->o_idx;
5367
5368                                 /* Only rotate a pile of two or more objects. */
5369                                 if (!(o_idx && o_list[o_idx].next_o_idx)) break;
5370
5371                                 /* Remove the first object from the list. */
5372                                 excise_object_idx(o_idx);
5373
5374                                 /* Find end of the list. */
5375                                 i = c_ptr->o_idx;
5376                                 while (o_list[i].next_o_idx)
5377                                         i = o_list[i].next_o_idx;
5378
5379                                 /* Add after the last object. */
5380                                 o_list[i].next_o_idx = o_idx;
5381
5382                                 /* Re-scan floor list */ 
5383                                 floor_num = scan_floor(floor_list, py, px, 0x03);
5384
5385                                 /* Hack -- Fix screen */
5386                                 if (command_see)
5387                                 {
5388                                         /* Load screen */
5389                                         screen_load();
5390
5391                                         /* Save screen */
5392                                         screen_save();
5393                                 }
5394
5395                                 break;
5396                         }
5397
5398                         case '/':
5399                         {
5400                                 if (command_wrk == (USE_INVEN))
5401                                 {
5402                                         if (!allow_equip)
5403                                         {
5404                                                 bell();
5405                                                 break;
5406                                         }
5407                                         command_wrk = (USE_EQUIP);
5408                                 }
5409                                 else if (command_wrk == (USE_EQUIP))
5410                                 {
5411                                         if (!allow_inven)
5412                                         {
5413                                                 bell();
5414                                                 break;
5415                                         }
5416                                         command_wrk = (USE_INVEN);
5417                                 }
5418                                 else if (command_wrk == (USE_FLOOR))
5419                                 {
5420                                         if (allow_inven)
5421                                         {
5422                                                 command_wrk = (USE_INVEN);
5423                                         }
5424                                         else if (allow_equip)
5425                                         {
5426                                                 command_wrk = (USE_EQUIP);
5427                                         }
5428                                         else
5429                                         {
5430                                                 bell();
5431                                                 break;
5432                                         }
5433                                 }
5434
5435                                 /* Hack -- Fix screen */
5436                                 if (command_see)
5437                                 {
5438                                         /* Load screen */
5439                                         screen_load();
5440
5441                                         /* Save screen */
5442                                         screen_save();
5443                                 }
5444
5445                                 /* Need to redraw */
5446                                 break;
5447                         }
5448
5449                         case '-':
5450                         {
5451                                 if (!allow_floor)
5452                                 {
5453                                         bell();
5454                                         break;
5455                                 }
5456
5457                                 /*
5458                                  * If we are already examining the floor, and there
5459                                  * is only one item, we will always select it.
5460                                  * If we aren't examining the floor and there is only
5461                                  * one item, we will select it if floor_query_flag
5462                                  * is FALSE.
5463                                  */
5464                                 if (floor_num == 1)
5465                                 {
5466                                         if ((command_wrk == (USE_FLOOR)) || (!carry_query_flag))
5467                                         {
5468                                                 /* Special index */
5469                                                 k = 0 - floor_list[0];
5470
5471                                                 /* Allow player to "refuse" certain actions */
5472                                                 if (!get_item_allow(k))
5473                                                 {
5474                                                         done = TRUE;
5475                                                         break;
5476                                                 }
5477
5478                                                 /* Accept that choice */
5479                                                 (*cp) = k;
5480                                                 item = TRUE;
5481                                                 done = TRUE;
5482
5483                                                 break;
5484                                         }
5485                                 }
5486
5487                                 /* Hack -- Fix screen */
5488                                 if (command_see)
5489                                 {
5490                                         /* Load screen */
5491                                         screen_load();
5492
5493                                         /* Save screen */
5494                                         screen_save();
5495                                 }
5496
5497                                 command_wrk = (USE_FLOOR);
5498
5499                                 break;
5500                         }
5501
5502                         case '0':
5503                         case '1': case '2': case '3':
5504                         case '4': case '5': case '6':
5505                         case '7': case '8': case '9':
5506                         {
5507                                 if (command_wrk != USE_FLOOR)
5508                                 {
5509                                         /* Look up the tag */
5510                                         if (!get_tag(&k, which, command_wrk))
5511                                         {
5512                                                 bell();
5513                                                 break;
5514                                         }
5515
5516                                         /* Hack -- Validate the item */
5517                                         if ((k < INVEN_RARM) ? !inven : !equip)
5518                                         {
5519                                                 bell();
5520                                                 break;
5521                                         }
5522
5523                                         /* Validate the item */
5524                                         if (!get_item_okay(k))
5525                                         {
5526                                                 bell();
5527                                                 break;
5528                                         }
5529                                 }
5530                                 else
5531                                 {
5532                                         /* Look up the alphabetical tag */
5533                                         if (get_tag_floor(&k, which, floor_list, floor_num))
5534                                         {
5535                                                 /* Special index */
5536                                                 k = 0 - floor_list[k];
5537                                         }
5538                                         else
5539                                         {
5540                                                 bell();
5541                                                 break;
5542                                         }
5543                                 }
5544
5545                                 /* Allow player to "refuse" certain actions */
5546                                 if (!get_item_allow(k))
5547                                 {
5548                                         done = TRUE;
5549                                         break;
5550                                 }
5551
5552                                 /* Accept that choice */
5553                                 (*cp) = k;
5554                                 item = TRUE;
5555                                 done = TRUE;
5556 #ifdef ALLOW_REPEAT
5557                                 cur_tag = which;
5558 #endif /* ALLOW_REPEAT */
5559                                 break;
5560                         }
5561
5562 #if 0
5563                         case '\n':
5564                         case '\r':
5565                         {
5566                                 /* Choose "default" inventory item */
5567                                 if (command_wrk == (USE_INVEN))
5568                                 {
5569                                         k = ((i1 == i2) ? i1 : -1);
5570                                 }
5571
5572                                 /* Choose "default" equipment item */
5573                                 else if (command_wrk == (USE_EQUIP))
5574                                 {
5575                                         k = ((e1 == e2) ? e1 : -1);
5576                                 }
5577
5578                                 /* Choose "default" floor item */
5579                                 else if (command_wrk == (USE_FLOOR))
5580                                 {
5581                                         if (floor_num == 1)
5582                                         {
5583                                                 /* Special index */
5584                                                 k = 0 - floor_list[0];
5585
5586                                                 /* Allow player to "refuse" certain actions */
5587                                                 if (!get_item_allow(k))
5588                                                 {
5589                                                         done = TRUE;
5590                                                         break;
5591                                                 }
5592
5593                                                 /* Accept that choice */
5594                                                 (*cp) = k;
5595                                                 item = TRUE;
5596                                                 done = TRUE;
5597                                         }
5598                                         break;
5599                                 }
5600
5601                                 /* Validate the item */
5602                                 if (!get_item_okay(k))
5603                                 {
5604                                         bell();
5605                                         break;
5606                                 }
5607
5608                                 /* Allow player to "refuse" certain actions */
5609                                 if (!get_item_allow(k))
5610                                 {
5611                                         done = TRUE;
5612                                         break;
5613                                 }
5614
5615                                 /* Accept that choice */
5616                                 (*cp) = k;
5617                                 item = TRUE;
5618                                 done = TRUE;
5619                                 break;
5620                         }
5621 #endif
5622
5623                         case 'w':
5624                         {
5625                                 if (select_the_force) {
5626                                         *cp = INVEN_FORCE;
5627                                         item = TRUE;
5628                                         done = TRUE;
5629                                         break;
5630                                 }
5631
5632                                 /* Fall through */
5633                         }
5634
5635                         default:
5636                         {
5637                                 int ver;
5638
5639                                 if (command_wrk != USE_FLOOR)
5640                                 {
5641                                         bool not_found = FALSE;
5642
5643                                         /* Look up the alphabetical tag */
5644                                         if (!get_tag(&k, which, command_wrk))
5645                                         {
5646                                                 not_found = TRUE;
5647                                         }
5648
5649                                         /* Hack -- Validate the item */
5650                                         else if ((k < INVEN_RARM) ? !inven : !equip)
5651                                         {
5652                                                 not_found = TRUE;
5653                                         }
5654
5655                                         /* Validate the item */
5656                                         else if (!get_item_okay(k))
5657                                         {
5658                                                 not_found = TRUE;
5659                                         }
5660
5661                                         if (!not_found)
5662                                         {
5663                                                 /* Accept that choice */
5664                                                 (*cp) = k;
5665                                                 item = TRUE;
5666                                                 done = TRUE;
5667 #ifdef ALLOW_REPEAT
5668                                                 cur_tag = which;
5669 #endif /* ALLOW_REPEAT */
5670                                                 break;
5671                                         }
5672                                 }
5673                                 else
5674                                 {
5675                                         /* Look up the alphabetical tag */
5676                                         if (get_tag_floor(&k, which, floor_list, floor_num))
5677                                         {
5678                                                 /* Special index */
5679                                                 k = 0 - floor_list[k];
5680
5681                                                 /* Accept that choice */
5682                                                 (*cp) = k;
5683                                                 item = TRUE;
5684                                                 done = TRUE;
5685 #ifdef ALLOW_REPEAT
5686                                                 cur_tag = which;
5687 #endif /* ALLOW_REPEAT */
5688                                                 break;
5689                                         }
5690                                 }
5691
5692                                 /* Extract "query" setting */
5693                                 ver = isupper(which);
5694                                 which = tolower(which);
5695
5696                                 /* Convert letter to inventory index */
5697                                 if (command_wrk == (USE_INVEN))
5698                                 {
5699                                         if (which == '(') k = i1;
5700                                         else if (which == ')') k = i2;
5701                                         else k = label_to_inven(which);
5702                                 }
5703
5704                                 /* Convert letter to equipment index */
5705                                 else if (command_wrk == (USE_EQUIP))
5706                                 {
5707                                         if (which == '(') k = e1;
5708                                         else if (which == ')') k = e2;
5709                                         else k = label_to_equip(which);
5710                                 }
5711
5712                                 /* Convert letter to floor index */
5713                                 else if (command_wrk == USE_FLOOR)
5714                                 {
5715                                         if (which == '(') k = 0;
5716                                         else if (which == ')') k = floor_num - 1;
5717                                         else k = islower(which) ? A2I(which) : -1;
5718                                         if (k < 0 || k >= floor_num || k >= 23)
5719                                         {
5720                                                 bell();
5721                                                 break;
5722                                         }
5723
5724                                         /* Special index */
5725                                         k = 0 - floor_list[k];
5726                                 }
5727
5728                                 /* Validate the item */
5729                                 if ((command_wrk != USE_FLOOR) && !get_item_okay(k))
5730                                 {
5731                                         bell();
5732                                         break;
5733                                 }
5734
5735                                 /* Verify the item */
5736 #ifdef JP
5737 if (ver && !verify("ËÜÅö¤Ë", k))
5738 #else
5739                                 if (ver && !verify("Try", k))
5740 #endif
5741
5742                                 {
5743                                         done = TRUE;
5744                                         break;
5745                                 }
5746
5747                                 /* Allow player to "refuse" certain actions */
5748                                 if (!get_item_allow(k))
5749                                 {
5750                                         done = TRUE;
5751                                         break;
5752                                 }
5753
5754                                 /* Accept that choice */
5755                                 (*cp) = k;
5756                                 item = TRUE;
5757                                 done = TRUE;
5758                                 break;
5759                         }
5760                 }
5761                 }
5762         }
5763
5764         /* Fix the screen if necessary */
5765         if (command_see)
5766         {
5767                 /* Load screen */
5768                 screen_load();
5769
5770                 /* Hack -- Cancel "display" */
5771                 command_see = FALSE;
5772         }
5773
5774
5775         /* Forget the item_tester_tval restriction */
5776         item_tester_tval = 0;
5777
5778         /* Forget the item_tester_hook restriction */
5779         item_tester_hook = NULL;
5780
5781
5782         /* Clean up  'show choices' */
5783         /* Toggle again if needed */
5784         if (toggle) toggle_inven_equip();
5785
5786         /* Update */
5787         p_ptr->window |= (PW_INVEN | PW_EQUIP);
5788
5789         /* Window stuff */
5790         window_stuff();
5791
5792
5793         /* Clear the prompt line */
5794         prt("", 0, 0);
5795
5796         /* Warning if needed */
5797         if (oops && str) msg_print(str);
5798
5799         if (item)
5800         {
5801 #ifdef ALLOW_REPEAT
5802                 repeat_push(*cp);
5803                 if (command_cmd) prev_tag = cur_tag;
5804 #endif /* ALLOW_REPEAT */
5805
5806                 command_cmd = 0; /* Hack -- command_cmd is no longer effective */
5807         }
5808
5809         /* Result */
5810         return (item);
5811 }
5812
5813
5814 static bool py_pickup_floor_aux(void)
5815 {
5816         s16b this_o_idx;
5817
5818         cptr q, s;
5819
5820         int item;
5821
5822         /* Restrict the choices */
5823         item_tester_hook = inven_carry_okay;
5824
5825         /* Get an object */
5826 #ifdef JP
5827         q = "¤É¤ì¤ò½¦¤¤¤Þ¤¹¤«¡©";
5828         s = "¤â¤¦¥¶¥Ã¥¯¤Ë¤Ï¾²¤Ë¤¢¤ë¤É¤Î¥¢¥¤¥Æ¥à¤âÆþ¤é¤Ê¤¤¡£";
5829 #else
5830         q = "Get which item? ";
5831         s = "You no longer have any room for the objects on the floor.";
5832 #endif
5833
5834         if (get_item(&item, q, s, (USE_FLOOR)))
5835         {
5836                 this_o_idx = 0 - item;
5837         }
5838         else
5839         {
5840                 return (FALSE);
5841         }
5842
5843         /* Pick up the object */
5844         py_pickup_aux(this_o_idx);
5845
5846         return (TRUE);
5847 }
5848
5849
5850 /*
5851  * Make the player carry everything in a grid
5852  *
5853  * If "pickup" is FALSE then only gold will be picked up
5854  *
5855  * This is called by py_pickup() when easy_floor is TRUE.
5856  */
5857 void py_pickup_floor(bool pickup)
5858 {
5859         s16b this_o_idx, next_o_idx = 0;
5860
5861         char o_name[MAX_NLEN];
5862         object_type *o_ptr;
5863
5864         int floor_num = 0, floor_o_idx = 0;
5865
5866         int can_pickup = 0;
5867
5868         /* Scan the pile of objects */
5869         for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
5870         {
5871                 object_type *o_ptr;
5872
5873                 /* Access the object */
5874                 o_ptr = &o_list[this_o_idx];
5875
5876                 /* Describe the object */
5877                 object_desc(o_name, o_ptr, 0);
5878
5879                 /* Access the next object */
5880                 next_o_idx = o_ptr->next_o_idx;
5881
5882                 /* Hack -- disturb */
5883                 disturb(0, 0);
5884
5885                 /* Pick up gold */
5886                 if (o_ptr->tval == TV_GOLD)
5887                 {
5888                         /* Message */
5889 #ifdef JP
5890                 msg_format(" $%ld ¤Î²ÁÃͤ¬¤¢¤ë%s¤ò¸«¤Ä¤±¤¿¡£",
5891                            (long)o_ptr->pval, o_name);
5892 #else
5893                         msg_format("You have found %ld gold pieces worth of %s.",
5894                                 (long) o_ptr->pval, o_name);
5895 #endif
5896
5897
5898                         /* Collect the gold */
5899                         p_ptr->au += o_ptr->pval;
5900
5901                         /* Redraw gold */
5902                         p_ptr->redraw |= (PR_GOLD);
5903
5904                         /* Window stuff */
5905                         p_ptr->window |= (PW_PLAYER);
5906
5907                         /* Delete the gold */
5908                         delete_object_idx(this_o_idx);
5909
5910                         /* Check the next object */
5911                         continue;
5912                 }
5913                 else if (o_ptr->marked & OM_NOMSG)
5914                 {
5915                         /* If 0 or 1 non-NOMSG items are in the pile, the NOMSG ones are
5916                          * ignored. Otherwise, they are included in the prompt. */
5917                         o_ptr->marked &= ~(OM_NOMSG);
5918                         continue;
5919                 }
5920
5921                 /* Count non-gold objects that can be picked up. */
5922                 if (inven_carry_okay(o_ptr))
5923                 {
5924                         can_pickup++;
5925                 }
5926
5927                 /* Count non-gold objects */
5928                 floor_num++;
5929
5930                 /* Remember this index */
5931                 floor_o_idx = this_o_idx;
5932         }
5933
5934         /* There are no non-gold objects */
5935         if (!floor_num)
5936                 return;
5937
5938         /* Mention the number of objects */
5939         if (!pickup)
5940         {
5941                 /* One object */
5942                 if (floor_num == 1)
5943                 {
5944                         /* Access the object */
5945                         o_ptr = &o_list[floor_o_idx];
5946
5947 #ifdef ALLOW_EASY_SENSE
5948
5949                         /* Option: Make object sensing easy */
5950                         if (easy_sense)
5951                         {
5952                                 /* Sense the object */
5953                                 (void) sense_object(o_ptr);
5954                         }
5955
5956 #endif /* ALLOW_EASY_SENSE */
5957
5958                         /* Describe the object */
5959                         object_desc(o_name, o_ptr, 0);
5960
5961                         /* Message */
5962 #ifdef JP
5963                                 msg_format("%s¤¬¤¢¤ë¡£", o_name);
5964 #else
5965                         msg_format("You see %s.", o_name);
5966 #endif
5967
5968                 }
5969
5970                 /* Multiple objects */
5971                 else
5972                 {
5973                         /* Message */
5974 #ifdef JP
5975                         msg_format("%d ¸Ä¤Î¥¢¥¤¥Æ¥à¤Î»³¤¬¤¢¤ë¡£", floor_num);
5976 #else
5977                         msg_format("You see a pile of %d items.", floor_num);
5978 #endif
5979
5980                 }
5981
5982                 /* Done */
5983                 return;
5984         }
5985
5986         /* The player has no room for anything on the floor. */
5987         if (!can_pickup)
5988         {
5989                 /* One object */
5990                 if (floor_num == 1)
5991                 {
5992                         /* Access the object */
5993                         o_ptr = &o_list[floor_o_idx];
5994
5995 #ifdef ALLOW_EASY_SENSE
5996
5997                         /* Option: Make object sensing easy */
5998                         if (easy_sense)
5999                         {
6000                                 /* Sense the object */
6001                                 (void) sense_object(o_ptr);
6002                         }
6003
6004 #endif /* ALLOW_EASY_SENSE */
6005
6006                         /* Describe the object */
6007                         object_desc(o_name, o_ptr, 0);
6008
6009                         /* Message */
6010 #ifdef JP
6011                                 msg_format("¥¶¥Ã¥¯¤Ë¤Ï%s¤òÆþ¤ì¤ë·ä´Ö¤¬¤Ê¤¤¡£", o_name);
6012 #else
6013                         msg_format("You have no room for %s.", o_name);
6014 #endif
6015
6016                 }
6017
6018                 /* Multiple objects */
6019                 else
6020                 {
6021                         /* Message */
6022 #ifdef JP
6023                         msg_format("¥¶¥Ã¥¯¤Ë¤Ï¾²¤Ë¤¢¤ë¤É¤Î¥¢¥¤¥Æ¥à¤âÆþ¤é¤Ê¤¤¡£", o_name);
6024 #else
6025                         msg_print("You have no room for any of the objects on the floor.");
6026 #endif
6027
6028                 }
6029
6030                 /* Done */
6031                 return;
6032         }
6033
6034         /* One object */
6035         if (floor_num == 1)
6036         {
6037                 /* Hack -- query every object */
6038                 if (carry_query_flag)
6039                 {
6040                         char out_val[MAX_NLEN+20];
6041
6042                         /* Access the object */
6043                         o_ptr = &o_list[floor_o_idx];
6044
6045 #ifdef ALLOW_EASY_SENSE
6046
6047                         /* Option: Make object sensing easy */
6048                         if (easy_sense)
6049                         {
6050                                 /* Sense the object */
6051                                 (void) sense_object(o_ptr);
6052                         }
6053
6054 #endif /* ALLOW_EASY_SENSE */
6055
6056                         /* Describe the object */
6057                         object_desc(o_name, o_ptr, 0);
6058
6059                         /* Build a prompt */
6060 #ifdef JP
6061                         (void) sprintf(out_val, "%s¤ò½¦¤¤¤Þ¤¹¤«? ", o_name);
6062 #else
6063                         (void) sprintf(out_val, "Pick up %s? ", o_name);
6064 #endif
6065
6066
6067                         /* Ask the user to confirm */
6068                         if (!get_check(out_val))
6069                         {
6070                                 /* Done */
6071                                 return;
6072                         }
6073                 }
6074
6075                 /* Access the object */
6076                 o_ptr = &o_list[floor_o_idx];
6077
6078 #ifdef ALLOW_EASY_SENSE
6079
6080                 /* Option: Make object sensing easy */
6081                 if (easy_sense)
6082                 {
6083                         /* Sense the object */
6084                         (void) sense_object(o_ptr);
6085                 }
6086
6087 #endif /* ALLOW_EASY_SENSE */
6088
6089                 /* Pick up the object */
6090                 py_pickup_aux(floor_o_idx);
6091         }
6092
6093         /* Allow the user to choose an object */
6094         else
6095         {
6096                 while (can_pickup--)
6097                 {
6098                         if (!py_pickup_floor_aux()) break;
6099                 }
6100         }
6101 }
6102
6103 #endif /* ALLOW_EASY_FLOOR */