OSDN Git Service

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