OSDN Git Service

呪文の巻物の効果がスナイパーにも一部付加されていた不具合を修正。
[hengband/hengband.git] / src / init1.c
index 46cda7d..bfcdb7d 100644 (file)
@@ -247,6 +247,7 @@ static cptr f_info_flags[] =
        "UNPERM",
        "TELEPORTABLE",
        "CONVERT",
+       "GLASS",
 };
 
 
@@ -728,7 +729,7 @@ static cptr k_info_flags[] =
        "HIDE_TYPE",
        "SHOW_MODS",
        "XXX1",
-       "FEATHER",
+       "LEVITATION",
        "LITE",
        "SEE_INVIS",
        "TELEPATHY",
@@ -770,6 +771,7 @@ static cptr k_info_flags[] =
        "ESP_NONLIVING",
        "ESP_UNIQUE",
        "FULL_NAME",
+       "FIXED_FLAVOR",
 };
 
 
@@ -823,8 +825,8 @@ static cptr d_info_flags1[] =
        "NO_DOORS",
        "WATER_RIVER",
        "LAVA_RIVER",
-       "XXX",
-       "XXX",
+       "CURTAIN",
+       "GLASS_DOOR",
        "CAVE",
        "CAVERN",
        "XXX",
@@ -839,7 +841,7 @@ static cptr d_info_flags1[] =
        "NO_VAULT",
        "ARENA",
        "DESTROY",
-       "XXX",
+       "GLASS_ROOM",
        "NO_CAVE",
        "NO_MAGIC",
        "NO_MELEE",
@@ -856,7 +858,7 @@ static cptr d_info_flags1[] =
  * Returns FALSE when there isn't enough space available to store
  * the text.
  */
-static bool add_text(u32b *offset, header *head, cptr buf)
+static bool add_text(u32b *offset, header *head, cptr buf, bool normal_text)
 {
        /* Hack -- Verify space */
        if (head->text_size + strlen(buf) + 8 > FAKE_TEXT_SIZE)
@@ -866,7 +868,34 @@ static bool add_text(u32b *offset, header *head, cptr buf)
        if (*offset == 0)
        {
                /* Advance and save the text index */
-               *offset = ++head->text_size;    
+               *offset = ++head->text_size;
+       }
+
+       /* Additional text */
+       else if (normal_text)
+       {
+               /*
+                * If neither the end of the last line nor
+                * the beginning of current line is not a space,
+                * fill up a space as a correct separator of two words.
+                */
+               if (head->text_size > 0 &&
+#ifdef JP
+                   (*(head->text_ptr + head->text_size - 1) != ' ') &&
+                   ((head->text_size == 1) || !iskanji(*(head->text_ptr + head->text_size - 2))) && 
+                   (buf[0] != ' ') && !iskanji(buf[0])
+#else
+                   (*(head->text_ptr + head->text_size - 1) != ' ') &&
+                   (buf[0] != ' ')
+#endif
+                   )
+               {
+                       /* Append a space */
+                       *(head->text_ptr + head->text_size) = ' ';
+
+                       /* Advance the index */
+                       head->text_size++;
+               }
        }
 
        /* Append chars to the text */
@@ -1005,7 +1034,7 @@ errr init_info_txt(FILE *fp, char *buf, header *head,
        /* Prepare the "fake" stuff */
        head->name_size = 0;
        head->text_size = 0;
-       head->tag_size = 1;
+       head->tag_size = 0;
 
        /* Parse */
        while (0 == my_fgets(fp, buf, 1024))
@@ -1108,7 +1137,7 @@ errr parse_v_info(char *buf, header *head)
                s = buf+2;
 
                /* Store the text */
-               if (!add_text(&v_ptr->text, head, s)) return (7);
+               if (!add_text(&v_ptr->text, head, s, FALSE)) return (7);
        }
 
        /* Process 'X' for "Extra info" (one line only) */
@@ -1528,7 +1557,7 @@ errr parse_f_info(char *buf, header *head)
        else if (buf[0] == 'G')
        {
                int j;
-               byte def_attr[F_LIT_MAX];
+               byte s_attr;
                char char_tmp[F_LIT_MAX];
 
                /* Paranoia */
@@ -1541,43 +1570,29 @@ errr parse_f_info(char *buf, header *head)
                char_tmp[F_LIT_STANDARD] = buf[2];
 
                /* Extract the color */
-               def_attr[F_LIT_STANDARD] = color_char_to_attr(buf[4]);
+               s_attr = color_char_to_attr(buf[4]);
 
                /* Paranoia */
-               if (def_attr[F_LIT_STANDARD] > 127) return (1);
+               if (s_attr > 127) return (1);
 
-               /* Save the default values for lighting */
-               for (j = 0; j < F_LIT_MAX; j++)
-               {
-                       f_ptr->d_attr[j] = def_attr[F_LIT_STANDARD];
-                       f_ptr->d_char[j] = char_tmp[F_LIT_STANDARD];
-               }
+               /* Save the standard values */
+               f_ptr->d_attr[F_LIT_STANDARD] = s_attr;
+               f_ptr->d_char[F_LIT_STANDARD] = char_tmp[F_LIT_STANDARD];
 
                /* Is this feature supports lighting? */
                if (buf[5] == ':')
                {
-                       def_attr[F_LIT_LITE] = lighting_colours[def_attr[F_LIT_STANDARD]][0];
-                       def_attr[F_LIT_DARK] = lighting_colours[def_attr[F_LIT_STANDARD]][1];
-                       def_attr[F_LIT_DARKDARK] = lighting_colours[lighting_colours[def_attr[F_LIT_STANDARD]][1]][1];
-
                        /* G:c:a:LIT (default) */
-                       if (streq(buf + 6, "LIT"))
-                       {
-                               for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
-                               {
-                                       f_ptr->d_attr[j] = def_attr[j];
-                               }
-                       }
+                       apply_default_feat_lighting(f_ptr->d_attr, f_ptr->d_char);
 
-                       /* G:c:a:lc:la:dc:da:Dc:Da */
-                       else
+                       /* G:c:a:lc:la:dc:da */
+                       if (!streq(buf + 6, "LIT"))
                        {
                                char attr_lite_tmp[F_LIT_MAX - F_LIT_NS_BEGIN];
 
-                               if ((F_LIT_MAX - F_LIT_NS_BEGIN) * 2 != sscanf(buf + 6, "%c:%c:%c:%c:%c:%c",
+                               if ((F_LIT_MAX - F_LIT_NS_BEGIN) * 2 != sscanf(buf + 6, "%c:%c:%c:%c",
                                        &char_tmp[F_LIT_LITE], &attr_lite_tmp[F_LIT_LITE - F_LIT_NS_BEGIN],
-                                       &char_tmp[F_LIT_DARK], &attr_lite_tmp[F_LIT_DARK - F_LIT_NS_BEGIN],
-                                       &char_tmp[F_LIT_DARKDARK], &attr_lite_tmp[F_LIT_DARKDARK - F_LIT_NS_BEGIN])) return 1;
+                                       &char_tmp[F_LIT_DARK], &attr_lite_tmp[F_LIT_DARK - F_LIT_NS_BEGIN])) return 1;
                                if (buf[F_LIT_MAX * 4 + 1]) return 1;
 
                                for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
@@ -1586,11 +1601,10 @@ errr parse_f_info(char *buf, header *head)
                                        {
                                        case '*':
                                                /* Use default lighting */
-                                               f_ptr->d_attr[j] = def_attr[j];
                                                break;
                                        case '-':
                                                /* No lighting support */
-                                               f_ptr->d_attr[j] = def_attr[F_LIT_STANDARD];
+                                               f_ptr->d_attr[j] = f_ptr->d_attr[F_LIT_STANDARD];
                                                break;
                                        default:
                                                /* Extract the color */
@@ -1602,7 +1616,15 @@ errr parse_f_info(char *buf, header *head)
                                }
                        }
                }
-               else if (buf[5]) return 1;
+               else if (!buf[5])
+               {
+                       for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
+                       {
+                               f_ptr->d_attr[j] = s_attr;
+                               f_ptr->d_char[j] = char_tmp[F_LIT_STANDARD];
+                       }
+               }
+               else return 1;
        }
 
        /* Hack -- Process 'F' for flags */
@@ -1621,6 +1643,19 @@ errr parse_f_info(char *buf, header *head)
                                while (*t == ' ' || *t == '|') t++;
                        }
 
+                       /* XXX XXX XXX Hack -- Read feature subtype */
+                       if (1 == sscanf(s, "SUBTYPE_%d", &i))
+                       {
+                               /* Extract a "subtype" */
+                               f_ptr->subtype =  i;
+
+                               /* Start at next entry */
+                               s = t;
+
+                               /* Continue */
+                               continue;
+                       }
+
                        /* XXX XXX XXX Hack -- Read feature power */
                        if (1 == sscanf(s, "POWER_%d", &i))
                        {
@@ -1825,19 +1860,19 @@ errr parse_k_info(char *buf, header *head)
        /* Process 'N' for "New/Number/Name" */
        if (buf[0] == 'N')
        {
+#ifdef JP
+               char *flavor;
+#endif
+
                /* Find the colon before the name */
                s = my_strchr(buf+2, ':');
 
-                       /* Verify that colon */
+               /* Verify that colon */
                if (!s) return (1);
 
                /* Nuke the colon, advance to the name */
                *s++ = '\0';
 
-#ifdef JP
-               /* Paranoia -- require a name */
-               if (!*s) return (1);
-#endif
                /* Get the index */
                i = atoi(buf+2);
 
@@ -1854,6 +1889,22 @@ errr parse_k_info(char *buf, header *head)
                k_ptr = &k_info[i];
 
 #ifdef JP
+               /* Paranoia -- require a name */
+               if (!*s) return (1);
+
+               /* Find the colon before the flavor */
+               flavor = my_strchr(s, ':');
+
+               /* Verify that colon */
+               if (flavor)
+               {
+                       /* Nuke the colon, advance to the flavor */
+                       *flavor++ = '\0';
+
+                       /* Store the flavor */
+                       if (!add_name(&k_ptr->flavor_name, head, flavor)) return (7);
+               }
+
                /* Store the name */
                if (!add_name(&k_ptr->name, head, s)) return (7);
 #endif
@@ -1873,9 +1924,24 @@ errr parse_k_info(char *buf, header *head)
 #else
        else if (buf[0] == 'E')
        {
-               /* Acquire the Text */
+               char *flavor;
+
+               /* Acquire the name */
                s = buf+2;
 
+               /* Find the colon before the flavor */
+               flavor = my_strchr(s, ':');
+
+               /* Verify that colon */
+               if (flavor)
+               {
+                       /* Nuke the colon, advance to the flavor */
+                       *flavor++ = '\0';
+
+                       /* Store the flavor */
+                       if (!add_name(&k_ptr->flavor_name, head, flavor)) return (7);
+               }
+
                /* Store the name */
                if (!add_name(&k_ptr->name, head, s)) return (7);
        }
@@ -1897,7 +1963,7 @@ errr parse_k_info(char *buf, header *head)
 #endif
 
                /* Store the text */
-               if (!add_text(&k_ptr->text, head, s)) return (7);
+               if (!add_text(&k_ptr->text, head, s, TRUE)) return (7);
        }
 
        /* Process 'G' for "Graphics" (one line only) */
@@ -2165,7 +2231,7 @@ errr parse_a_info(char *buf, header *head)
 #endif
 
                /* Store the text */
-               if (!add_text(&a_ptr->text, head, s)) return (7);
+               if (!add_text(&a_ptr->text, head, s, TRUE)) return (7);
        }
 
 
@@ -2372,7 +2438,7 @@ errr parse_e_info(char *buf, header *head)
                s = buf+2;
 
                /* Store the text */
-               if (!add_text(&e_ptr->text, head, s)) return (7);
+               if (!add_text(&e_ptr->text, head, s, TRUE)) return (7);
        }
 
 #endif
@@ -2612,7 +2678,7 @@ errr parse_r_info(char *buf, header *head)
 #endif
 
                /* Store the text */
-               if (!add_text(&r_ptr->text, head, s)) return (7);
+               if (!add_text(&r_ptr->text, head, s, TRUE)) return (7);
        }
 
        /* Process 'G' for "Graphics" (one line only) */
@@ -2652,8 +2718,8 @@ errr parse_r_info(char *buf, header *head)
 
                /* Save the values */
                r_ptr->speed = spd;
-               r_ptr->hdice = hp1;
-               r_ptr->hside = hp2;
+               r_ptr->hdice = MAX(hp1, 1);
+               r_ptr->hside = MAX(hp2, 1);
                r_ptr->aaf = aaf;
                r_ptr->ac = ac;
                r_ptr->sleep = slp;
@@ -2966,7 +3032,7 @@ errr parse_d_info(char *buf, header *head)
 #endif
 
                /* Store the text */
-               if (!add_text(&d_ptr->text, head, s)) return (7);
+               if (!add_text(&d_ptr->text, head, s, TRUE)) return (7);
        }
 
        /* Process 'W' for "More Info" (one line only) */
@@ -3273,12 +3339,12 @@ static errr parse_line_feature(char *buf)
                int index = zz[0][0];
 
                /* Reset the info for the letter */
-               letter[index].feature = FEAT_NONE;
+               letter[index].feature = feat_none;
                letter[index].monster = 0;
                letter[index].object = 0;
                letter[index].ego = 0;
                letter[index].artifact = 0;
-               letter[index].trap = FEAT_NONE;
+               letter[index].trap = feat_none;
                letter[index].cave_info = 0;
                letter[index].special = 0;
                letter[index].random = RANDOM_NONE;
@@ -3770,9 +3836,8 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                else
                                {
                                        /* Create the artifact */
-                                       create_named_art(artifact_index, *y, *x);
-
-                                       a_info[artifact_index].cur_num = 1;
+                                       if (create_named_art(artifact_index, *y, *x))
+                                               a_info[artifact_index].cur_num = 1;
                                }
                        }
 
@@ -4165,7 +4230,15 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
        else
        {
                /* Accept all printables except spaces and brackets */
+#ifdef JP
+               while (iskanji(*s) || (isprint(*s) && !my_strchr(" []", *s)))
+               {
+                       if (iskanji(*s)) s++;
+                       s++;
+               }
+#else
                while (isprint(*s) && !my_strchr(" []", *s)) ++s;
+#endif
 
                /* Extract final and Terminate */
                if ((f = *s) != '\0') *s++ = '\0';
@@ -4236,7 +4309,22 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
                        /* Player name */
                        else if (streq(b+1, "PLAYER"))
                        {
-                               v = player_base;
+                               static char tmp_player_name[32];
+                               char *pn, *tpn;
+                               for (pn = player_name, tpn = tmp_player_name; *pn; pn++, tpn++)
+                               {
+#ifdef JP
+                                       if (iskanji(*pn))
+                                       {
+                                               *(tpn++) = *(pn++);
+                                               *tpn = *pn;
+                                               continue;
+                                       }
+#endif
+                                       *tpn = my_strchr(" []", *pn) ? '_' : *pn;
+                               }
+                               *tpn = '\0';
+                               v = tmp_player_name;
                        }
 
                        /* Town */