OSDN Git Service

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