OSDN Git Service

move_player_effect()の処理をbitフラグで制御するように変更. また, プレ
[hengbandforosx/hengbandosx.git] / src / object1.c
index 396f898..dd7b325 100644 (file)
@@ -33,7 +33,7 @@
  */
 void reset_visuals(void)
 {
-       int i;
+       int i, j;
 
        /* Extract some info about terrain features */
        for (i = 0; i < max_f_idx; i++)
@@ -41,8 +41,11 @@ void reset_visuals(void)
                feature_type *f_ptr = &f_info[i];
 
                /* Assume we will use the underlying values */
-               f_ptr->x_attr = f_ptr->d_attr;
-               f_ptr->x_char = f_ptr->d_char;
+               for (j = 0; j < F_LIT_MAX; j++)
+               {
+                       f_ptr->x_attr[j] = f_ptr->d_attr[j];
+                       f_ptr->x_char[j] = f_ptr->d_char[j];
+               }
        }
 
        /* Extract default attr/char code for objects */
@@ -328,40 +331,6 @@ void object_flags_known(object_type *o_ptr, u32b flgs[TR_FLAG_SIZE])
 
 
 /*
- * Hack -- describe an item currently in a store's inventory
- * This allows an item to *look* like the player is "aware" of it
- */
-void object_desc_store(char *buf, object_type *o_ptr, int pref, int mode)
-{
-       /* Save the "aware" flag */
-       bool hack_aware = object_aware_p(o_ptr);
-
-       /* Save the "known" flag */
-       bool hack_known = (o_ptr->ident & (IDENT_KNOWN)) ? TRUE : FALSE;
-
-
-       /* Set the "known" flag */
-       o_ptr->ident |= (IDENT_KNOWN);
-
-       /* Force "aware" for description */
-       k_info[o_ptr->k_idx].aware = TRUE;
-
-
-       /* Describe the object */
-       object_desc(buf, o_ptr, pref, mode);
-
-
-       /* Restore "aware" flag */
-       k_info[o_ptr->k_idx].aware = hack_aware;
-
-       /* Clear the known flag */
-       if (!hack_known) o_ptr->ident &= ~(IDENT_KNOWN);
-}
-
-
-
-
-/*
  * Determine the "Activation" (if any) for an artifact
  * Return a string, or NULL for "no activation"
  */
@@ -2388,6 +2357,8 @@ bool screen_object(object_type *o_ptr, bool real)
        char o_name[MAX_NLEN];
        int wid, hgt;
 
+       int trivial_info = 0;
+
        /* Extract the flags */
        object_flags(o_ptr, flgs);
 
@@ -2402,6 +2373,12 @@ bool screen_object(object_type *o_ptr, bool real)
                { info[i] = &temp[j]; i++;}
        }
 
+       if (TV_EQUIP_BEGIN <= o_ptr->tval && o_ptr->tval <= TV_EQUIP_END)
+       {
+               /* Descriptions of a basic equipment is just a flavor */
+               trivial_info = i;
+       }
+
        /* Mega-Hack -- describe activation */
        if (have_flag(flgs, TR_ACTIVATE))
        {
@@ -2657,12 +2634,15 @@ info[i++] = "
                        info[i++] = "It is made for use while riding.";
 #endif
                else
+               {
 #ifdef JP
-info[i++] = "¤½¤ì¤Ï¾èÇÏÃæ¤Ç¤â»È¤¤¤ä¤¹¤¤¡£";
+                       info[i++] = "¤½¤ì¤Ï¾èÇÏÃæ¤Ç¤â»È¤¤¤ä¤¹¤¤¡£";
 #else
                        info[i++] = "It is suitable for use while riding.";
 #endif
-
+                       /* This information is not important enough */
+                       trivial_info++;
+               }
        }
        if (have_flag(flgs, TR_STR))
        {
@@ -3614,6 +3594,11 @@ info[i++] = "
                        info[i++] = "It is cursed.";
 #endif
 
+                       /*
+                        * It's a trivial infomation since there is
+                        * fake inscription {cursed}
+                        */
+                       trivial_info++;
                }
        }
 
@@ -3870,8 +3855,8 @@ info[i++] = "
                }
        }
 
-       /* No special effects */
-       if (!i) return (FALSE);
+       /* No relevant informations */
+       if (i <= trivial_info) return (FALSE);
 
        /* Save the screen */
        screen_save();
@@ -3881,9 +3866,9 @@ info[i++] = "
 
        /* Display Item name */
        if (real)
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
        else
-               object_desc_store(o_name, o_ptr, TRUE, 0);
+               object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
 
        prt(o_name, 0, 0);
 
@@ -4238,13 +4223,13 @@ cptr describe_use(int i)
        switch (i)
        {
 #ifdef JP
-case INVEN_RARM: p = p_ptr->ryoute ? " Î¾¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : (left_hander ? " º¸¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : " ±¦¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë"); break;
+case INVEN_RARM: p = p_ptr->ryoute ? "ξ¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : (left_hander ? "º¸¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : "±¦¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë"); break;
 #else
                case INVEN_RARM: p = "attacking monsters with"; break;
 #endif
 
 #ifdef JP
-case INVEN_LARM:   p = (left_hander ? " ±¦¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : " º¸¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë"); break;
+case INVEN_LARM:   p = (left_hander ? "±¦¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë" : "º¸¼ê¤ËÁõÈ÷¤·¤Æ¤¤¤ë"); break;
 #else
                case INVEN_LARM:   p = "wearing on your arm"; break;
 #endif
@@ -4463,7 +4448,7 @@ void display_inven(void)
                Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
 
                /* Obtain an item description */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
 
                /* Obtain the length of the description */
                n = strlen(o_name);
@@ -4556,7 +4541,7 @@ void display_equip(void)
                }
                else
                {
-                       object_desc(o_name, o_ptr, TRUE, 3);
+                       object_desc(o_name, o_ptr, 0);
                        attr = tval_to_attr[o_ptr->tval % 128];
                }
 
@@ -4654,7 +4639,7 @@ static bool get_tag(int *cp, char tag, int mode)
                if (!item_tester_okay(o_ptr)) continue;
 
                /* Find a '@' */
-               s = strchr(quark_str(o_ptr->inscription), '@');
+               s = my_strchr(quark_str(o_ptr->inscription), '@');
 
                /* Process all tags */
                while (s)
@@ -4670,7 +4655,7 @@ static bool get_tag(int *cp, char tag, int mode)
                        }
 
                        /* Find another '@' */
-                       s = strchr(s + 1, '@');
+                       s = my_strchr(s + 1, '@');
                }
        }
 
@@ -4699,7 +4684,7 @@ static bool get_tag(int *cp, char tag, int mode)
                if (!item_tester_okay(o_ptr)) continue;
 
                /* Find a '@' */
-               s = strchr(quark_str(o_ptr->inscription), '@');
+               s = my_strchr(quark_str(o_ptr->inscription), '@');
 
                /* Process all tags */
                while (s)
@@ -4715,7 +4700,7 @@ static bool get_tag(int *cp, char tag, int mode)
                        }
 
                        /* Find another '@' */
-                       s = strchr(s + 1, '@');
+                       s = my_strchr(s + 1, '@');
                }
        }
 
@@ -4750,7 +4735,7 @@ static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
                if (!o_ptr->inscription) continue;
 
                /* Find a '@' */
-               s = strchr(quark_str(o_ptr->inscription), '@');
+               s = my_strchr(quark_str(o_ptr->inscription), '@');
 
                /* Process all tags */
                while (s)
@@ -4766,7 +4751,7 @@ static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
                        }
 
                        /* Find another '@' */
-                       s = strchr(s + 1, '@');
+                       s = my_strchr(s + 1, '@');
                }
        }
 
@@ -4789,7 +4774,7 @@ static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
                if (!o_ptr->inscription) continue;
 
                /* Find a '@' */
-               s = strchr(quark_str(o_ptr->inscription), '@');
+               s = my_strchr(quark_str(o_ptr->inscription), '@');
 
                /* Process all tags */
                while (s)
@@ -4805,7 +4790,7 @@ static bool get_tag_floor(int *cp, char tag, int floor_list[], int floor_num)
                        }
 
                        /* Find another '@' */
-                       s = strchr(s + 1, '@');
+                       s = my_strchr(s + 1, '@');
                }
        }
 
@@ -4927,7 +4912,7 @@ int show_inven(int target_item)
                if (!item_tester_okay(o_ptr)) continue;
 
                /* Describe the object */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
 
                /* Save the object index, color, and description */
                out_index[k] = i;
@@ -5015,13 +5000,9 @@ int show_inven(int target_item)
                        if (a & 0x80) a |= 0x40;
 #endif
 
-                       Term_draw(cur_col, j + 1, a, c);
-                       if (use_bigtile)
-                       {
-                               cur_col++;
-                               if (a & 0x80)
-                                       Term_draw(cur_col, j + 1, 255, -1);
-                       }
+                       Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
+                       if (use_bigtile) cur_col++;
+
                        cur_col += 2;
                }
 
@@ -5090,7 +5071,7 @@ int show_equip(int target_item)
                if (!item_tester_okay(o_ptr) && (!((i == INVEN_LARM) && p_ptr->ryoute) || item_tester_no_ryoute)) continue;
 
                /* Description */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
 
                if ((i == INVEN_LARM) && p_ptr->ryoute)
                {
@@ -5202,13 +5183,9 @@ int show_equip(int target_item)
                        if (a & 0x80) a |= 0x40;
 #endif
 
-                       Term_draw(cur_col, j + 1, a, c);
-                       if (use_bigtile)
-                       {
-                               cur_col++;
-                               if (a & 0x80)
-                                       Term_draw(cur_col, j + 1, 255, -1);
-                       }
+                       Term_queue_bigchar(cur_col, j + 1, a, c, 0, 0);
+                       if (use_bigtile) cur_col++;
+
                        cur_col += 2;
                }
 
@@ -5329,7 +5306,7 @@ static bool verify(cptr prompt, int item)
        }
 
        /* Describe */
-       object_desc(o_name, o_ptr, TRUE, 3);
+       object_desc(o_name, o_ptr, 0);
 
        /* Prompt */
 #ifdef JP
@@ -5355,6 +5332,8 @@ static bool get_item_allow(int item)
 
        object_type *o_ptr;
 
+       if (!command_cmd) return TRUE; /* command_cmd is no longer effective */
+
        /* Inventory */
        if (item >= 0)
        {
@@ -5371,16 +5350,13 @@ static bool get_item_allow(int item)
        if (!o_ptr->inscription) return (TRUE);
 
        /* Find a '!' */
-       s = strchr(quark_str(o_ptr->inscription), '!');
+       s = my_strchr(quark_str(o_ptr->inscription), '!');
 
        /* Process preventions */
        while (s)
        {
-               /* Ignore the "!!" inscription */
-               if (s[1] == '!') s++;
-
                /* Check the "restriction" */
-               else if ((s[1] == command_cmd) || (s[1] == '*'))
+               if ((s[1] == command_cmd) || (s[1] == '*'))
                {
                        /* Verify the choice */
 #ifdef JP
@@ -5392,7 +5368,7 @@ if (!verify("
                }
 
                /* Find another '!' */
-               s = strchr(s + 1, '!');
+               s = my_strchr(s + 1, '!');
        }
 
        /* Allow it */
@@ -5720,41 +5696,39 @@ bool get_item(int *cp, cptr pmt, cptr str, int mode)
                int get_item_label = 0;
 
                /* Show choices */
-               if (show_choices)
+               int ni = 0;
+               int ne = 0;
+
+               /* Scan windows */
+               for (j = 0; j < 8; j++)
                {
-                       int ni = 0;
-                       int ne = 0;
+                       /* Unused */
+                       if (!angband_term[j]) continue;
 
-                       /* Scan windows */
-                       for (j = 0; j < 8; j++)
-                       {
-                               /* Unused */
-                               if (!angband_term[j]) continue;
+                       /* Count windows displaying inven */
+                       if (window_flag[j] & (PW_INVEN)) ni++;
 
-                               /* Count windows displaying inven */
-                               if (window_flag[j] & (PW_INVEN)) ni++;
+                       /* Count windows displaying equip */
+                       if (window_flag[j] & (PW_EQUIP)) ne++;
+               }
 
-                               /* Count windows displaying equip */
-                               if (window_flag[j] & (PW_EQUIP)) ne++;
-                       }
+               /* Toggle if needed */
+               if ((command_wrk && ni && !ne) ||
+                   (!command_wrk && !ni && ne))
+               {
+                       /* Toggle */
+                       toggle_inven_equip();
 
-                       /* Toggle if needed */
-                       if ((command_wrk && ni && !ne) ||
-                           (!command_wrk && !ni && ne))
-                       {
-                               /* Toggle */
-                               toggle_inven_equip();
+                       /* Track toggles */
+                       toggle = !toggle;
+               }
 
-                               /* Track toggles */
-                               toggle = !toggle;
-                       }
+               /* Update */
+               p_ptr->window |= (PW_INVEN | PW_EQUIP);
 
-                       /* Update */
-                       p_ptr->window |= (PW_INVEN | PW_EQUIP);
+               /* Redraw windows */
+               window_stuff();
 
-                       /* Redraw windows */
-                       window_stuff();
-               }
 
                /* Inventory screen */
                if (!command_wrk)
@@ -6303,18 +6277,15 @@ if (ver && !verify("
        item_tester_hook = NULL;
 
 
-       /* Clean up */
-       if (show_choices)
-       {
-               /* Toggle again if needed */
-               if (toggle) toggle_inven_equip();
+       /* Clean up  'show choices' */
+       /* Toggle again if needed */
+       if (toggle) toggle_inven_equip();
 
-               /* Update */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
+       /* Update */
+       p_ptr->window |= (PW_INVEN | PW_EQUIP);
 
-               /* Window stuff */
-               window_stuff();
-       }
+       /* Window stuff */
+       window_stuff();
 
 
        /* Clear the prompt line */
@@ -6430,7 +6401,7 @@ int show_floor(int target_item, int y, int x, int *min_width)
                o_ptr = &o_list[floor_list[i]];
 
                /* Describe the object */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
 
                /* Save the index */
                out_index[k] = i;
@@ -6750,41 +6721,38 @@ bool get_item_floor(int *cp, cptr pmt, cptr str, int mode)
                int get_item_label = 0;
 
                /* Show choices */
-               if (show_choices)
-               {
-                       int ni = 0;
-                       int ne = 0;
+               int ni = 0;
+               int ne = 0;
 
-                       /* Scan windows */
-                       for (j = 0; j < 8; j++)
-                       {
-                               /* Unused */
-                               if (!angband_term[j]) continue;
+               /* Scan windows */
+               for (j = 0; j < 8; j++)
+               {
+                       /* Unused */
+                       if (!angband_term[j]) continue;
 
-                               /* Count windows displaying inven */
-                               if (window_flag[j] & (PW_INVEN)) ni++;
+                       /* Count windows displaying inven */
+                       if (window_flag[j] & (PW_INVEN)) ni++;
 
-                               /* Count windows displaying equip */
-                               if (window_flag[j] & (PW_EQUIP)) ne++;
-                       }
+                       /* Count windows displaying equip */
+                       if (window_flag[j] & (PW_EQUIP)) ne++;
+               }
 
-                       /* Toggle if needed */
-                       if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
-                               (command_wrk == (USE_INVEN) && !ni && ne))
-                       {
-                               /* Toggle */
-                               toggle_inven_equip();
+               /* Toggle if needed */
+               if ((command_wrk == (USE_EQUIP) && ni && !ne) ||
+                   (command_wrk == (USE_INVEN) && !ni && ne))
+               {
+                       /* Toggle */
+                       toggle_inven_equip();
 
-                               /* Track toggles */
-                               toggle = !toggle;
-                       }
+                       /* Track toggles */
+                       toggle = !toggle;
+               }
 
-                       /* Update */
-                       p_ptr->window |= (PW_INVEN | PW_EQUIP);
+               /* Update */
+               p_ptr->window |= (PW_INVEN | PW_EQUIP);
 
-                       /* Redraw windows */
-                       window_stuff();
-               }
+               /* Redraw windows */
+               window_stuff();
 
                /* Inventory screen */
                if (command_wrk == (USE_INVEN))
@@ -7741,18 +7709,15 @@ if (ver && !verify("
        item_tester_hook = NULL;
 
 
-       /* Clean up */
-       if (show_choices)
-       {
-               /* Toggle again if needed */
-               if (toggle) toggle_inven_equip();
+       /* Clean up  'show choices' */
+       /* Toggle again if needed */
+       if (toggle) toggle_inven_equip();
 
-               /* Update */
-               p_ptr->window |= (PW_INVEN | PW_EQUIP);
+       /* Update */
+       p_ptr->window |= (PW_INVEN | PW_EQUIP);
 
-               /* Window stuff */
-               window_stuff();
-       }
+       /* Window stuff */
+       window_stuff();
 
 
        /* Clear the prompt line */
@@ -7818,7 +7783,7 @@ static bool py_pickup_floor_aux(void)
  *
  * This is called by py_pickup() when easy_floor is TRUE.
  */
-void py_pickup_floor(int pickup)
+void py_pickup_floor(bool pickup)
 {
        s16b this_o_idx, next_o_idx = 0;
 
@@ -7838,7 +7803,7 @@ void py_pickup_floor(int pickup)
                o_ptr = &o_list[this_o_idx];
 
                /* Describe the object */
-               object_desc(o_name, o_ptr, TRUE, 3);
+               object_desc(o_name, o_ptr, 0);
 
                /* Access the next object */
                next_o_idx = o_ptr->next_o_idx;
@@ -7924,7 +7889,7 @@ void py_pickup_floor(int pickup)
 #endif /* ALLOW_EASY_SENSE */
 
                        /* Describe the object */
-                       object_desc(o_name, o_ptr, TRUE, 3);
+                       object_desc(o_name, o_ptr, 0);
 
                        /* Message */
 #ifdef JP
@@ -7972,7 +7937,7 @@ void py_pickup_floor(int pickup)
 #endif /* ALLOW_EASY_SENSE */
 
                        /* Describe the object */
-                       object_desc(o_name, o_ptr, TRUE, 3);
+                       object_desc(o_name, o_ptr, 0);
 
                        /* Message */
 #ifdef JP
@@ -8022,7 +7987,7 @@ void py_pickup_floor(int pickup)
 #endif /* ALLOW_EASY_SENSE */
 
                        /* Describe the object */
-                       object_desc(o_name, o_ptr, TRUE, 3);
+                       object_desc(o_name, o_ptr, 0);
 
                        /* Build a prompt */
 #ifdef JP