OSDN Git Service

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