OSDN Git Service

ダンジョンフラグGLASS_DOORを実装. 通常のドアがガラスのドアになる. ガ
[hengband/hengband.git] / src / files.c
index cd0cab8..5a21023 100644 (file)
@@ -433,7 +433,7 @@ errr process_pref_file_command(char *buf)
                        n2 = strtol(zz[2], NULL, 0);
                        if (i >= max_r_idx) return 1;
                        r_ptr = &r_info[i];
-                       if (n1 || (!(n2 & 0x80) && n2)) r_ptr->x_attr = n1; /* Allow ATTR_DARK text */
+                       if (n1 || (!(n2 & 0x80) && n2)) r_ptr->x_attr = n1; /* Allow TERM_DARK text */
                        if (n2) r_ptr->x_char = n2;
                        return 0;
                }
@@ -449,7 +449,7 @@ errr process_pref_file_command(char *buf)
                        n2 = strtol(zz[2], NULL, 0);
                        if (i >= max_k_idx) return 1;
                        k_ptr = &k_info[i];
-                       if (n1 || (!(n2 & 0x80) && n2)) k_ptr->x_attr = n1; /* Allow ATTR_DARK text */
+                       if (n1 || (!(n2 & 0x80) && n2)) k_ptr->x_attr = n1; /* Allow TERM_DARK text */
                        if (n2) k_ptr->x_char = n2;
                        return 0;
                }
@@ -473,7 +473,7 @@ errr process_pref_file_command(char *buf)
 
                        n1 = strtol(zz[1], NULL, 0);
                        n2 = strtol(zz[2], NULL, 0);
-                       if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[F_LIT_STANDARD] = n1; /* Allow ATTR_DARK text */
+                       if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[F_LIT_STANDARD] = n1; /* Allow TERM_DARK text */
                        if (n2) f_ptr->x_char[F_LIT_STANDARD] = n2;
 
                        /* Mega-hack -- feat supports lighting */
@@ -501,7 +501,7 @@ errr process_pref_file_command(char *buf)
                                {
                                        n1 = strtol(zz[j * 2 + 1], NULL, 0);
                                        n2 = strtol(zz[j * 2 + 2], NULL, 0);
-                                       if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[j] = n1; /* Allow ATTR_DARK text */
+                                       if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[j] = n1; /* Allow TERM_DARK text */
                                        if (n2) f_ptr->x_char[j] = n2;
                                }
                                break;
@@ -3826,17 +3826,17 @@ void display_player(int mode)
 
                        *statmsg = '\0';
 
-                       if (p_ptr->is_dead && p_ptr->total_winner)
+                       if (p_ptr->is_dead)
                        {
+                               if (p_ptr->total_winner)
+                               {
 #ifdef JP
-                               strcpy(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï¾¡Íø¤Î¸å°úÂष¤¿¡£");
+                                       sprintf(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï¾¡Íø¤Î¸å%s¤·¤¿¡£", streq(p_ptr->died_from, "Seppuku") ? "ÀÚÊ¢" : "°úÂà");
 #else
-                               strcpy(statmsg, "...You retired from the adventure after the winning.");
+                                       sprintf(statmsg, "...You %s after the winning.", streq(p_ptr->died_from, "Seppuku") ? "did Seppuku" : "retired from the adventure");
 #endif
-                       }
-                       else if (p_ptr->is_dead)
-                       {
-                               if (!dun_level)
+                               }
+                               else if (!dun_level)
                                {
 #ifdef JP
                                        sprintf(statmsg, "¡Ä¤¢¤Ê¤¿¤Ï%s¤Ç%s¤Ë»¦¤µ¤ì¤¿¡£", map_name(), p_ptr->died_from);
@@ -5764,7 +5764,7 @@ msg_print("
                                break;
                        }
 
-                       sprintf(xtmp, "%s: %s", player_name, what);
+                       sprintf(xtmp, "%s: %s", player_name, what ? what : caption);
                        my_fputs(ffp, xtmp, 80);
                        my_fputs(ffp, "\n", 80);
 
@@ -6334,9 +6334,10 @@ long total_points(void)
 }
 
 
+#define GRAVE_LINE_WIDTH 31
 
 /*
- * Centers a string within a 31 character string               -JWT-
+ * Centers a string within a GRAVE_LINE_WIDTH character string         -JWT-
  */
 static void center_string(char *buf, cptr str)
 {
@@ -6346,10 +6347,10 @@ static void center_string(char *buf, cptr str)
        i = strlen(str);
 
        /* Necessary border */
-       j = 15 - i / 2;
+       j = GRAVE_LINE_WIDTH / 2 - i / 2;
 
        /* Mega-Hack */
-       (void)sprintf(buf, "%*s%s%*s", j, "", str, 31 - i - j, "");
+       (void)sprintf(buf, "%*s%s%*s", j, "", str, GRAVE_LINE_WIDTH - i - j, "");
 }
 
 
@@ -6444,20 +6445,17 @@ static void print_tomb(void)
        /* Print the text-tombstone */
        if (!done)
        {
-               cptr    p;
-
-               char    tmp[160];
-
-               char    buf[1024];
-#ifndef JP
-               char    dummy[80];
+               cptr   p;
+               char   tmp[160];
+               char   buf[1024];
+               char   dummy[80];
+               char   *t;
+               FILE   *fp;
+               time_t ct = time((time_t)0);
+#ifdef JP
+               int    extra_line = 0;
 #endif
 
-               FILE        *fp;
-
-               time_t  ct = time((time_t)0);
-
-
                /* Clear screen */
                Term_clear();
 
@@ -6468,7 +6466,6 @@ static void print_tomb(void)
                path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "dead.txt");
 #endif
 
-
                /* Open the News file */
                fp = my_fopen(buf, "r");
 
@@ -6488,17 +6485,15 @@ static void print_tomb(void)
                        my_fclose(fp);
                }
 
-
                /* King or Queen */
                if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL))
                {
 #ifdef JP
-               /* ±ÑÆüÀÚ¤êÂؤ¨ */
-                 p= "°ÎÂç¤Ê¤ë¼Ô";
+                       /* ±ÑÆüÀÚ¤êÂؤ¨ */
+                       p= "°ÎÂç¤Ê¤ë¼Ô";
 #else
                        p = "Magnificent";
 #endif
-
                }
 
                /* Normal */
@@ -6518,47 +6513,40 @@ static void print_tomb(void)
                center_string(buf, p);
                put_str(buf, 8, 11);
 
-
                center_string(buf, cp_ptr->title);
-
                put_str(buf, 10, 11);
 
 #ifdef JP
-(void)sprintf(tmp, "¥ì¥Ù¥ë: %d", (int)p_ptr->lev);
+               (void)sprintf(tmp, "¥ì¥Ù¥ë: %d", (int)p_ptr->lev);
 #else
                (void)sprintf(tmp, "Level: %d", (int)p_ptr->lev);
 #endif
-
                center_string(buf, tmp);
                put_str(buf, 11, 11);
 
 #ifdef JP
-(void)sprintf(tmp, "·Ð¸³ÃÍ: %ld", (long)p_ptr->exp);
+               (void)sprintf(tmp, "·Ð¸³ÃÍ: %ld", (long)p_ptr->exp);
 #else
                (void)sprintf(tmp, "Exp: %ld", (long)p_ptr->exp);
 #endif
-
                center_string(buf, tmp);
                put_str(buf, 12, 11);
 
 #ifdef JP
-(void)sprintf(tmp, "½ê»ý¶â: %ld", (long)p_ptr->au);
+               (void)sprintf(tmp, "½ê»ý¶â: %ld", (long)p_ptr->au);
 #else
                (void)sprintf(tmp, "AU: %ld", (long)p_ptr->au);
 #endif
-
                center_string(buf, tmp);
                put_str(buf, 13, 11);
 
 #ifdef JP
-       /* Êè¤Ë¹ï¤à¸ÀÍÕ¤ò¥ª¥ê¥¸¥Ê¥ë¤è¤êºÙ¤«¤¯É½¼¨ */
-       if (streq(p_ptr->died_from, "ÅÓÃ潪λ"))
-       {
-               strcpy(tmp, "<¼«»¦>");
-       }
-       else
-       {
-               if (streq(p_ptr->died_from, "ripe"))
+               /* Êè¤Ë¹ï¤à¸ÀÍÕ¤ò¥ª¥ê¥¸¥Ê¥ë¤è¤êºÙ¤«¤¯É½¼¨ */
+               if (streq(p_ptr->died_from, "ÅÓÃ潪λ"))
+               {
+                       strcpy(tmp, "<¼«»¦>");
+               }
+               else if (streq(p_ptr->died_from, "ripe"))
                {
                        strcpy(tmp, "°úÂà¸å¤ËÅ·¼÷¤òÁ´¤¦");
                }
@@ -6568,71 +6556,105 @@ static void print_tomb(void)
                }
                else
                {
-                       strcpy(tmp, p_ptr->died_from);
-               }
-       }
-       center_string(buf, tmp);
-       put_str(buf, 14, 11);
-
-       if(!streq(p_ptr->died_from, "ripe") && !streq(p_ptr->died_from, "Seppuku"))
-       {
-               if( dun_level == 0 )
-               {
-                       cptr town = (p_ptr->town_num ? "³¹" : "¹ÓÌî");
-                       if(streq(p_ptr->died_from, "ÅÓÃ潪λ"))
+                       roff_to_buf(p_ptr->died_from, GRAVE_LINE_WIDTH + 1, tmp, sizeof tmp);
+                       t = tmp + strlen(tmp) + 1;
+                       if (*t)
                        {
-                               sprintf(tmp, "%s¤Ç»à¤ó¤À", town);
-                       }
-                       else
-                       {
-                               sprintf(tmp, "¤Ë%s¤Ç»¦¤µ¤ì¤¿", town);
+                               strcpy(dummy, t); /* 2nd line */
+                               if (*(t + strlen(t) + 1)) /* Does 3rd line exist? */
+                               {
+                                       for (t = dummy + strlen(dummy) - 2; iskanji(*(t - 1)); t--) /* Loop */;
+                                       strcpy(t, "¡Ä");
+                               }
+                               else if (my_strstr(tmp, "¡Ø") && suffix(dummy, "¡Ù"))
+                               {
+                                       char dummy2[80];
+                                       char *name_head = my_strstr(tmp, "¡Ø");
+                                       sprintf(dummy2, "%s%s", name_head, dummy);
+                                       if (strlen(dummy2) <= GRAVE_LINE_WIDTH)
+                                       {
+                                               strcpy(dummy, dummy2);
+                                               *name_head = '\0';
+                                       }
+                               }
+                               else if (my_strstr(tmp, "¡Ö") && suffix(dummy, "¡×"))
+                               {
+                                       char dummy2[80];
+                                       char *name_head = my_strstr(tmp, "¡Ö");
+                                       sprintf(dummy2, "%s%s", name_head, dummy);
+                                       if (strlen(dummy2) <= GRAVE_LINE_WIDTH)
+                                       {
+                                               strcpy(dummy, dummy2);
+                                               *name_head = '\0';
+                                       }
+                               }
+                               center_string(buf, dummy);
+                               put_str(buf, 15, 11);
+                               extra_line = 1;
                        }
                }
-               else
+               center_string(buf, tmp);
+               put_str(buf, 14, 11);
+
+               if (!streq(p_ptr->died_from, "ripe") && !streq(p_ptr->died_from, "Seppuku"))
                {
-                       if(streq(p_ptr->died_from, "ÅÓÃ潪λ"))
+                       if (dun_level == 0)
                        {
-                               sprintf(tmp, "Ãϲ¼ %d ³¬¤Ç»à¤ó¤À", dun_level);
+                               cptr town = p_ptr->town_num ? "³¹" : "¹ÓÌî";
+                               if (streq(p_ptr->died_from, "ÅÓÃ潪λ"))
+                               {
+                                       sprintf(tmp, "%s¤Ç»à¤ó¤À", town);
+                               }
+                               else
+                               {
+                                       sprintf(tmp, "¤Ë%s¤Ç»¦¤µ¤ì¤¿", town);
+                               }
                        }
                        else
                        {
-                               sprintf(tmp, "¤ËÃϲ¼ %d ³¬¤Ç»¦¤µ¤ì¤¿", dun_level);
+                               if (streq(p_ptr->died_from, "ÅÓÃ潪λ"))
+                               {
+                                       sprintf(tmp, "Ãϲ¼ %d ³¬¤Ç»à¤ó¤À", dun_level);
+                               }
+                               else
+                               {
+                                       sprintf(tmp, "¤ËÃϲ¼ %d ³¬¤Ç»¦¤µ¤ì¤¿", dun_level);
+                               }
                        }
+                       center_string(buf, tmp);
+                       put_str(buf, 15 + extra_line, 11);
                }
-               center_string(buf, tmp);
-               put_str(buf, 15, 11);
-       }
 #else
                (void)sprintf(tmp, "Killed on Level %d", dun_level);
                center_string(buf, tmp);
                put_str(buf, 14, 11);
 
-
-               if (strlen(p_ptr->died_from) > 24)
-               {
-                       strncpy(dummy, p_ptr->died_from, 24);
-                       dummy[24] = '\0';
-                       (void)sprintf(tmp, "by %s.", dummy);
-               }
-               else
-                       (void)sprintf(tmp, "by %s.", p_ptr->died_from);
-
+               roff_to_buf(format("by %s.", p_ptr->died_from), GRAVE_LINE_WIDTH + 1, tmp, sizeof tmp);
                center_string(buf, tmp);
                put_str(buf, 15, 11);
+               t = tmp + strlen(tmp) + 1;
+               if (*t)
+               {
+                       strcpy(dummy, t); /* 2nd line */
+                       if (*(t + strlen(t) + 1)) /* Does 3rd line exist? */
+                       {
+                               int dummy_len = strlen(dummy);
+                               strcpy(dummy + MIN(dummy_len, GRAVE_LINE_WIDTH - 3), "...");
+                       }
+                       center_string(buf, dummy);
+                       put_str(buf, 16, 11);
+               }
 #endif
 
-
-
                (void)sprintf(tmp, "%-.24s", ctime(&ct));
                center_string(buf, tmp);
                put_str(buf, 17, 11);
 
 #ifdef JP
-msg_format("¤µ¤è¤¦¤Ê¤é¡¢%s!", player_name);
+               msg_format("¤µ¤è¤¦¤Ê¤é¡¢%s!", player_name);
 #else
                msg_format("Goodbye, %s!", player_name);
 #endif
-
        }
 }