OSDN Git Service

Add new option -- show_ammo_detail / show_ammo_no_crit
[hengband/hengband.git] / src / files.c
index 954f8d6..14c734d 100644 (file)
@@ -822,7 +822,7 @@ cptr process_pref_file_expr(char **sp, char *fp)
        char b2 = ']';
 
        char f = ' ';
-       static char tmp[8];
+       static char tmp[10];
 
        /* Initial */
        s = (*sp);
@@ -1074,6 +1074,13 @@ cptr process_pref_file_expr(char **sp, char *fp)
                                else
                                        v = "0";
                        }
+
+                       /* Money */
+                       else if (streq(b+1, "MONEY"))
+                       {
+                               sprintf(tmp, "%09ld", (long int)p_ptr->au);
+                               v = tmp;
+                       }
                }
 
                /* Constant */
@@ -2071,13 +2078,14 @@ static cptr likert(int x, int y)
  */
 static void display_player_various(void)
 {
-       int         tmp, damage[2], blows1, blows2, i, basedam;
+       int         tmp, damage[2], to_h[2], blows1, blows2, i, basedam;
        int                     xthn, xthb, xfos, xsrh;
        int                     xdis, xdev, xsav, xstl;
        cptr            desc;
        int         muta_att = 0;
        u32b flgs[TR_FLAG_SIZE];
        int             shots, shot_frac;
+       bool dokubari;
 
        object_type             *o_ptr;
 
@@ -2152,9 +2160,19 @@ static void display_player_various(void)
                        /* Average damage per round */
                        if (o_ptr->k_idx)
                        {
-                               if (object_is_known(o_ptr)) damage[i] += o_ptr->to_d * 100;
+                               to_h[i] = 0;
+                               dokubari = FALSE;                               
+                               
+                               if((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) dokubari = TRUE;
+                               if (object_is_known(o_ptr))
+                               { 
+                                       damage[i] += o_ptr->to_d * 100;
+                                       to_h[i] += o_ptr->to_h;
+                               }
                                basedam = ((o_ptr->dd + p_ptr->to_dd[i]) * (o_ptr->ds + p_ptr->to_ds[i] + 1)) * 50;
                                object_flags_known(o_ptr, flgs);
+                                                               
+                               basedam = calc_expect_crit(o_ptr->weight, to_h[i], basedam, p_ptr->dis_to_h[i], dokubari);
                                if ((o_ptr->ident & IDENT_MENTAL) && ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)))
                                {
                                        /* vorpal blade */
@@ -2547,7 +2565,7 @@ static void player_flags(u32b flgs[TR_FLAG_SIZE])
        case RACE_S_FAIRY:
                add_flag(flgs, TR_LEVITATION);
                break;
-       case RACE_KUTA:
+       case RACE_KUTAR:
                add_flag(flgs, TR_RES_CONF);
                break;
        case RACE_ANDROID:
@@ -2779,6 +2797,18 @@ static void tim_player_flags(u32b flgs[TR_FLAG_SIZE])
                add_flag(flgs, TR_SUST_CON);
                add_flag(flgs, TR_SUST_CHR);
        }
+
+       /* Hex bonuses */
+       if (p_ptr->realm1 == REALM_HEX)
+       {
+               if (hex_spelling(HEX_DEMON_AURA))
+               {
+                       add_flag(flgs, TR_SH_FIRE);
+                       add_flag(flgs, TR_REGEN);
+               }
+               if (hex_spelling(HEX_ICE_ARMOR)) add_flag(flgs, TR_SH_COLD);
+               if (hex_spelling(HEX_SHOCK_CLOAK)) add_flag(flgs, TR_SH_ELEC);
+       }
 }
 
 
@@ -2950,6 +2980,8 @@ static void display_flag_aux(int row, int col, cptr header,
        int     i;
        bool    vuln = FALSE;
        int max_i;
+       byte header_color = TERM_L_DARK;
+       int header_col = col;
 
        if (have_flag(f->player_vuln, flag1) &&
            !(have_flag(f->known_obj_imm, flag1) ||
@@ -2957,9 +2989,6 @@ static void display_flag_aux(int row, int col, cptr header,
              have_flag(f->tim_player_imm, flag1)))
                vuln = TRUE;
 
-       /* Header */
-       if (!(mode & DP_IMM)) c_put_str(TERM_WHITE, header, row, col);
-
        /* Advance */
        col += strlen(header) + 1;
 
@@ -2986,16 +3015,30 @@ static void display_flag_aux(int row, int col, cptr header,
                /* Check flags */
                if (mode & DP_CURSE)
                {
-                       if ((mode & DP_CURSE) && (o_ptr->curse_flags & (TRC_CURSED | TRC_HEAVY_CURSE)))
+                       if (have_flag(flgs, TR_ADD_L_CURSE) || have_flag(flgs, TR_ADD_H_CURSE))
+                       {
+                               c_put_str(TERM_L_DARK, "+", row, col);
+                               header_color = TERM_WHITE;
+                       }
+                       if (o_ptr->curse_flags & (TRC_CURSED | TRC_HEAVY_CURSE))
+                       {
                                c_put_str(TERM_WHITE, "+", row, col);
-                       if ((mode & DP_CURSE) && (o_ptr->curse_flags & TRC_PERMA_CURSE))
+                               header_color = TERM_WHITE;
+                       }
+                       if (o_ptr->curse_flags & TRC_PERMA_CURSE)
+                       {
                                c_put_str(TERM_WHITE, "*", row, col);
+                               header_color = TERM_WHITE;
+                       }
                }
                else
                {
                        if (have_flag(flgs, flag1))
+                       {
                                c_put_str((byte)(vuln ? TERM_L_RED : TERM_WHITE),
                                          (mode & DP_IMM) ? "*" : "+", row, col);
+                               header_color = TERM_WHITE;
+                       }
                }
 
                /* Advance */
@@ -3003,23 +3046,50 @@ static void display_flag_aux(int row, int col, cptr header,
        }
 
        /* Assume that player flag is already written */
-       if (mode & DP_IMM) return;
+       if (mode & DP_IMM)
+       {
+               if (header_color != TERM_L_DARK)
+               {
+                       /* Overwrite Header Color */
+                       c_put_str(header_color, header, row, header_col);
+               }
+               return;
+       }
 
        /* Default */
        c_put_str((byte)(vuln ? TERM_RED : TERM_SLATE), ".", row, col);
 
        /* Player flags */
-       if (have_flag(f->player_flags, flag1)) c_put_str((byte)(vuln ? TERM_L_RED : TERM_WHITE), "+", row, col);
+       if (have_flag(f->player_flags, flag1))
+       {
+               c_put_str((byte)(vuln ? TERM_L_RED : TERM_WHITE), "+", row, col);
+               header_color = TERM_WHITE;
+       }
 
        /* Timed player flags */
-       if (have_flag(f->tim_player_flags, flag1)) c_put_str((byte)(vuln ? TERM_ORANGE : TERM_YELLOW), "#", row, col);
+       if (have_flag(f->tim_player_flags, flag1))
+       {
+               c_put_str((byte)(vuln ? TERM_ORANGE : TERM_YELLOW), "#", row, col);
+               header_color = TERM_WHITE;
+       }
 
        /* Immunity */
-       if (have_flag(f->tim_player_imm, flag1)) c_put_str(TERM_YELLOW, "*", row, col);
-       if (have_flag(f->player_imm, flag1)) c_put_str(TERM_WHITE, "*", row, col);
+       if (have_flag(f->tim_player_imm, flag1))
+       {
+               c_put_str(TERM_YELLOW, "*", row, col);
+               header_color = TERM_WHITE;
+       }
+       if (have_flag(f->player_imm, flag1))
+       {
+               c_put_str(TERM_WHITE, "*", row, col);
+               header_color = TERM_WHITE;
+       }
 
        /* Vulnerability */
        if (vuln) c_put_str(TERM_RED, "v", row, col + 1);
+
+       /* Header */
+       c_put_str(header_color, header, row, header_col);
 }
 
 
@@ -3245,49 +3315,49 @@ static void display_player_other_flag_info(void)
        row = 3;
        col = col + 12 + 7;
 
-       display_player_equippy(row-2, col+12, 0);
-       c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col+12);
-
-#ifdef JP
-       display_flag_aux(row+ 0, col, "¥Æ¥ì¥Ñ¥·¡¼:", TR_TELEPATHY, &f, 0);
-       display_flag_aux(row+ 1, col, "¼Ù°­ESP   :", TR_ESP_EVIL, &f, 0);
-       display_flag_aux(row+ 2, col, "̵À¸ÊªESP :", TR_ESP_NONLIVING, &f, 0);
-       display_flag_aux(row+ 3, col, "Á±ÎÉESP   :", TR_ESP_GOOD, &f, 0);
-       display_flag_aux(row+ 4, col, "ÉÔ»àESP   :", TR_ESP_UNDEAD, &f, 0);
-       display_flag_aux(row+ 5, col, "°­ËâESP   :", TR_ESP_DEMON, &f, 0);
-       display_flag_aux(row+ 6, col, "ζESP     :", TR_ESP_DRAGON, &f, 0);
-       display_flag_aux(row+ 7, col, "¿Í´ÖESP   :", TR_ESP_HUMAN, &f, 0);
-       display_flag_aux(row+ 8, col, "ưʪESP   :", TR_ESP_ANIMAL, &f, 0);
-       display_flag_aux(row+ 9, col, "¥ª¡¼¥¯ESP :", TR_ESP_ORC, &f, 0);
-       display_flag_aux(row+10, col, "¥È¥í¥ëESP :", TR_ESP_TROLL, &f, 0);
-       display_flag_aux(row+11, col, "µð¿ÍESP   :", TR_ESP_GIANT, &f, 0);
-
-       display_flag_aux(row+13, col, "ÏÓÎÏ°Ý»ý  :", TR_SUST_STR, &f, 0);
-       display_flag_aux(row+14, col, "ÃÎÎÏ°Ý»ý  :", TR_SUST_INT, &f, 0);
-       display_flag_aux(row+15, col, "¸­¤µ°Ý»ý  :", TR_SUST_WIS, &f, 0);
-       display_flag_aux(row+16, col, "´ïÍÑ°Ý»ý  :", TR_SUST_DEX, &f, 0);
-       display_flag_aux(row+17, col, "Âѵװݻý  :", TR_SUST_CON, &f, 0);
-       display_flag_aux(row+18, col, "Ì¥ÎÏ°Ý»ý  :", TR_SUST_CHR, &f, 0);
-#else
-       display_flag_aux(row+ 0, col, "Telepathy :", TR_TELEPATHY, &f, 0);
-       display_flag_aux(row+ 1, col, "ESP Evil  :", TR_ESP_EVIL, &f, 0);
-       display_flag_aux(row+ 2, col, "ESP Noliv.:", TR_ESP_NONLIVING, &f, 0);
-       display_flag_aux(row+ 3, col, "ESP Good  :", TR_ESP_GOOD, &f, 0);
-       display_flag_aux(row+ 4, col, "ESP Undead:", TR_ESP_UNDEAD, &f, 0);
-       display_flag_aux(row+ 5, col, "ESP Demon :", TR_ESP_DEMON, &f, 0);
-       display_flag_aux(row+ 6, col, "ESP Dragon:", TR_ESP_DRAGON, &f, 0);
-       display_flag_aux(row+ 7, col, "ESP Human :", TR_ESP_HUMAN, &f, 0);
-       display_flag_aux(row+ 8, col, "ESP Animal:", TR_ESP_ANIMAL, &f, 0);
-       display_flag_aux(row+ 9, col, "ESP Orc   :", TR_ESP_ORC, &f, 0);
-       display_flag_aux(row+10, col, "ESP Troll :", TR_ESP_TROLL, &f, 0);
-       display_flag_aux(row+11, col, "ESP Giant :", TR_ESP_GIANT, &f, 0);
-
-       display_flag_aux(row+13, col, "Sust Str  :", TR_SUST_STR, &f, 0);
-       display_flag_aux(row+14, col, "Sust Int  :", TR_SUST_INT, &f, 0);
-       display_flag_aux(row+15, col, "Sust Wis  :", TR_SUST_WIS, &f, 0);
-       display_flag_aux(row+16, col, "Sust Dex  :", TR_SUST_DEX, &f, 0);
-       display_flag_aux(row+17, col, "Sust Con  :", TR_SUST_CON, &f, 0);
-       display_flag_aux(row+18, col, "Sust Chr  :", TR_SUST_CHR, &f, 0);
+       display_player_equippy(row-2, col+13, 0);
+       c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col+13);
+
+#ifdef JP
+       display_flag_aux(row+ 0, col, "¥Æ¥ì¥Ñ¥·¡¼ :", TR_TELEPATHY, &f, 0);
+       display_flag_aux(row+ 1, col, "¼Ù°­ESP    :", TR_ESP_EVIL, &f, 0);
+       display_flag_aux(row+ 2, col, "̵À¸ÊªESP  :", TR_ESP_NONLIVING, &f, 0);
+       display_flag_aux(row+ 3, col, "Á±ÎÉESP    :", TR_ESP_GOOD, &f, 0);
+       display_flag_aux(row+ 4, col, "ÉÔ»àESP    :", TR_ESP_UNDEAD, &f, 0);
+       display_flag_aux(row+ 5, col, "°­ËâESP    :", TR_ESP_DEMON, &f, 0);
+       display_flag_aux(row+ 6, col, "ζESP      :", TR_ESP_DRAGON, &f, 0);
+       display_flag_aux(row+ 7, col, "¿Í´ÖESP    :", TR_ESP_HUMAN, &f, 0);
+       display_flag_aux(row+ 8, col, "ưʪESP    :", TR_ESP_ANIMAL, &f, 0);
+       display_flag_aux(row+ 9, col, "¥ª¡¼¥¯ESP  :", TR_ESP_ORC, &f, 0);
+       display_flag_aux(row+10, col, "¥È¥í¥ëESP  :", TR_ESP_TROLL, &f, 0);
+       display_flag_aux(row+11, col, "µð¿ÍESP    :", TR_ESP_GIANT, &f, 0);
+       display_flag_aux(row+12, col, "¥æ¥Ë¡¼¥¯ESP:", TR_ESP_UNIQUE, &f, 0);
+       display_flag_aux(row+13, col, "ÏÓÎÏ°Ý»ý   :", TR_SUST_STR, &f, 0);
+       display_flag_aux(row+14, col, "ÃÎÎÏ°Ý»ý   :", TR_SUST_INT, &f, 0);
+       display_flag_aux(row+15, col, "¸­¤µ°Ý»ý   :", TR_SUST_WIS, &f, 0);
+       display_flag_aux(row+16, col, "´ïÍÑ°Ý»ý   :", TR_SUST_DEX, &f, 0);
+       display_flag_aux(row+17, col, "Âѵװݻý   :", TR_SUST_CON, &f, 0);
+       display_flag_aux(row+18, col, "Ì¥ÎÏ°Ý»ý   :", TR_SUST_CHR, &f, 0);
+#else
+       display_flag_aux(row+ 0, col, "Telepathy  :", TR_TELEPATHY, &f, 0);
+       display_flag_aux(row+ 1, col, "ESP Evil   :", TR_ESP_EVIL, &f, 0);
+       display_flag_aux(row+ 2, col, "ESP Noliv. :", TR_ESP_NONLIVING, &f, 0);
+       display_flag_aux(row+ 3, col, "ESP Good   :", TR_ESP_GOOD, &f, 0);
+       display_flag_aux(row+ 4, col, "ESP Undead :", TR_ESP_UNDEAD, &f, 0);
+       display_flag_aux(row+ 5, col, "ESP Demon  :", TR_ESP_DEMON, &f, 0);
+       display_flag_aux(row+ 6, col, "ESP Dragon :", TR_ESP_DRAGON, &f, 0);
+       display_flag_aux(row+ 7, col, "ESP Human  :", TR_ESP_HUMAN, &f, 0);
+       display_flag_aux(row+ 8, col, "ESP Animal :", TR_ESP_ANIMAL, &f, 0);
+       display_flag_aux(row+ 9, col, "ESP Orc    :", TR_ESP_ORC, &f, 0);
+       display_flag_aux(row+10, col, "ESP Troll  :", TR_ESP_TROLL, &f, 0);
+       display_flag_aux(row+11, col, "ESP Giant  :", TR_ESP_GIANT, &f, 0);
+       display_flag_aux(row+12, col, "ESP Unique :", TR_ESP_UNIQUE, &f, 0);
+       display_flag_aux(row+13, col, "Sust Str   :", TR_SUST_STR, &f, 0);
+       display_flag_aux(row+14, col, "Sust Int   :", TR_SUST_INT, &f, 0);
+       display_flag_aux(row+15, col, "Sust Wis   :", TR_SUST_WIS, &f, 0);
+       display_flag_aux(row+16, col, "Sust Dex   :", TR_SUST_DEX, &f, 0);
+       display_flag_aux(row+17, col, "Sust Con   :", TR_SUST_CON, &f, 0);
+       display_flag_aux(row+18, col, "Sust Chr   :", TR_SUST_CHR, &f, 0);
 #endif
 
 
@@ -3868,7 +3938,7 @@ void display_player(int mode)
                                {
                                        /* Get the quest text */
                                        /* Bewere that INIT_ASSIGN resets the cur_num. */
-                                       init_flags = INIT_ASSIGN;
+                                       init_flags = INIT_NAME_ONLY;
 
                                        process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
@@ -3908,7 +3978,7 @@ void display_player(int mode)
                                        quest_text_line = 0;
 
                                        /* Get the quest text */
-                                       init_flags = INIT_SHOW_TEXT;
+                                       init_flags = INIT_NAME_ONLY;
 
                                        process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
@@ -3984,7 +4054,7 @@ void display_player(int mode)
  */
 static void dump_aux_display_player(FILE *fff)
 {
-       int x, y, i;
+       int x, y;
        byte a;
        char c;
        char            buf[1024];
@@ -4108,11 +4178,7 @@ static void dump_aux_display_player(FILE *fff)
                fprintf(fff, "%s\n", buf);
        }
 
-       for (i = 0; (unsigned int) i < (p_ptr->count / 80); i++)
-               fprintf(fff, " ");
        fprintf(fff, "\n");
-       for (i = 0; (unsigned int) i < (p_ptr->count % 80); i++)
-               fprintf(fff, " ");
 }
 
 
@@ -4331,7 +4397,88 @@ static void dump_aux_class_special(FILE *fff)
 
                for (i=0;i<=col;i++)
                {
-                       fprintf(fff, p[i]);
+                       fputs(p[i], fff);
+               }
+       }
+       else if (p_ptr->pclass == CLASS_MAGIC_EATER)
+       {
+               char s[EATER_EXT][MAX_NLEN];
+               int tval, ext, k_idx;
+               int i, magic_num;
+
+#ifdef JP
+               fprintf(fff, "\n\n  [¼è¤ê¹þ¤ó¤ÀËâË¡Æ»¶ñ]\n");
+#else
+               fprintf(fff, "\n\n  [Magic devices eaten]\n");
+#endif
+
+               for (ext = 0; ext < 3; ext++)
+               {
+                       int eat_num = 0;
+
+                       /* Dump an extent name */
+                       switch (ext)
+                       {
+                       case 0:
+                               tval = TV_STAFF;
+#ifdef JP
+                               fprintf(fff, "\n[¾ó]\n");
+#else
+                               fprintf(fff, "\n[Staffs]\n");
+#endif
+                               break;
+                       case 1:
+                               tval = TV_WAND;
+#ifdef JP
+                               fprintf(fff, "\n[ËâË¡ËÀ]\n");
+#else
+                               fprintf(fff, "\n[Wands]\n");
+#endif
+                               break;
+                       case 2:
+                               tval = TV_ROD;
+#ifdef JP
+                               fprintf(fff, "\n[¥í¥Ã¥É]\n");
+#else
+                               fprintf(fff, "\n[Rods]\n");
+#endif
+                               break;
+                       }
+
+                       /* Get magic device names that were eaten */
+                       for (i = 0; i < EATER_EXT; i++)
+                       {
+                               int idx = EATER_EXT * ext + i;
+
+                               magic_num = p_ptr->magic_num2[idx];
+                               if (!magic_num) continue;
+
+                               k_idx = lookup_kind(tval, i);
+                               if (!k_idx) continue;
+                               sprintf(s[eat_num], "%23s (%2d)", (k_name + k_info[k_idx].name), magic_num);
+                               eat_num++;
+                       }
+
+                       /* Dump magic devices in this extent */
+                       if (eat_num > 0)
+                       {
+                               for (i = 0; i < eat_num; i++)
+                               {
+                                       fputs(s[i], fff);
+                                       if (i % 3 < 2) fputs("    ", fff);
+                                       else fputs("\n", fff);
+                               }
+
+                               if (i % 3 > 0) fputs("\n", fff);
+                       }
+                       else /* Not found */
+                       {
+#ifdef JP
+                               fputs("  (¤Ê¤·)\n", fff);
+#else
+                               fputs("  (none)\n", fff);
+#endif
+                       }
                }
        }
 }
@@ -6261,7 +6408,7 @@ msg_print("
        else
        {
                /* Disturb the player */
-               disturb(1, 0);
+               disturb(1, 1);
        }
 
        /* Clear messages */
@@ -7202,7 +7349,7 @@ void exit_game_panic(void)
        prt("", 0, 0);
 
        /* Hack -- turn off some things */
-       disturb(1, 0);
+       disturb(1, 1);
 
        /* Mega-Hack -- Delay death */
        if (p_ptr->chp < 0) p_ptr->is_dead = FALSE;