OSDN Git Service

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