OSDN Git Service

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