OSDN Git Service

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