OSDN Git Service

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