OSDN Git Service

[Fix] #37285 ティボルトのUNIQUE属性付加忘れを修正。
[hengband/hengband.git] / src / files.c
index 3eb6b3d..49b6dd0 100644 (file)
 
 
 #include "angband.h"
+#include "world.h"
+#include "player-status.h"
+#include "sort.h"
+#include "mutation.h"
+#include "quest.h"
+#include "store.h"
+#include "artifact.h"
+#include "avatar.h"
+#include "shoot.h"
+#include "player-move.h"
+#include "patron.h"
+#include "monster.h"
+#include "monster-status.h"
 
 
 /*
@@ -189,7 +202,7 @@ typedef struct named_num named_num;
 
 struct named_num
 {
-       cptr name;              /* The name of this thing */
+       concptr name;           /* The name of this thing */
        int num;                        /* A number associated with it */
 };
 
@@ -555,8 +568,8 @@ errr process_pref_file_command(char *buf)
                        }
                        break;
 
-               /* Process "X:<str>" -- turn option off */
-               /* Process "Y:<str>" -- turn option on */
+               /* Process "X:<str>" -- current_world_ptr->game_turn option off */
+               /* Process "Y:<str>" -- current_world_ptr->game_turn option on */
                case 'X':
                case 'Y':
                        for (i = 0; option_info[i].o_desc; i++)
@@ -603,7 +616,6 @@ errr process_pref_file_command(char *buf)
                        /* Find the colon */
                        char *t = my_strchr(buf + 2, ':');
 
-                       /* Oops */
                        if (!t) return 1;
 
                        /* Nuke the colon */
@@ -615,7 +627,7 @@ errr process_pref_file_command(char *buf)
                                if (streq(gf_desc[i].name, buf + 2))
                                {
                                        /* Remember this color set */
-                                       gf_color[gf_desc[i].num] = quark_add(t);
+                                       gf_color[gf_desc[i].num] = (TERM_COLOR)quark_add(t);
 
                                        /* Success */
                                        return 0;
@@ -755,9 +767,9 @@ errr process_pref_file_command(char *buf)
  *   result
  * </pre>
  */
-cptr process_pref_file_expr(char **sp, char *fp)
+concptr process_pref_file_expr(char **sp, char *fp)
 {
-       cptr v;
+       concptr v;
 
        char *b;
        char *s;
@@ -783,8 +795,8 @@ cptr process_pref_file_expr(char **sp, char *fp)
        /* Analyze */
        if (*s == b1)
        {
-               const char *p;
-               const char *t;
+               concptr p;
+               concptr t;
 
                /* Skip b1 */
                s++;
@@ -792,7 +804,6 @@ cptr process_pref_file_expr(char **sp, char *fp)
                /* First */
                t = process_pref_file_expr(&s, &f);
 
-               /* Oops */
                if (!*t)
                {
                        /* Nothing */
@@ -880,7 +891,6 @@ cptr process_pref_file_expr(char **sp, char *fp)
                        }
                }
 
-               /* Oops */
                else
                {
                        while (*s && (f != b2))
@@ -1036,11 +1046,7 @@ cptr process_pref_file_expr(char **sp, char *fp)
 
        /* Save */
        (*fp) = f;
-
-       /* Save */
        (*sp) = s;
-
-       /* Result */
        return (v);
 }
 
@@ -1064,7 +1070,7 @@ cptr process_pref_file_expr(char **sp, char *fp)
  *   result
  * </pre>
  */
-static errr process_pref_file_aux(cptr name, int preftype)
+static errr process_pref_file_aux(concptr name, int preftype)
 {
        FILE *fp;
 
@@ -1112,7 +1118,7 @@ static errr process_pref_file_aux(cptr name, int preftype)
                if ((buf[0] == '?') && (buf[1] == ':'))
                {
                        char f;
-                       cptr v;
+                       concptr v;
                        char *s;
 
                        /* Start */
@@ -1123,8 +1129,6 @@ static errr process_pref_file_aux(cptr name, int preftype)
 
                        /* Set flag */
                        bypass = (streq(v, "0") ? TRUE : FALSE);
-
-                       /* Continue */
                        continue;
                }
 
@@ -1159,8 +1163,6 @@ static errr process_pref_file_aux(cptr name, int preftype)
 
                        /* Set back depth level */
                        depth_count--;
-
-                       /* Continue */
                        continue;
                }
 
@@ -1188,11 +1190,7 @@ static errr process_pref_file_aux(cptr name, int preftype)
                msg_format(_("('%s'を解析中)", "Parsing '%s'"), old);
                msg_print(NULL);
        }
-
-       /* Close the file */
        my_fclose(fp);
-
-       /* Result */
        return (err);
 }
 
@@ -1209,7 +1207,7 @@ static errr process_pref_file_aux(cptr name, int preftype)
  * allow conditional evaluation and filename inclusion.
  * </pre>
  */
-errr process_pref_file(cptr name)
+errr process_pref_file(concptr name)
 {
        char buf[1024];
 
@@ -1341,8 +1339,6 @@ errr check_time_init(void)
                if (prefix(buf, "FRI:")) strcpy(days[5], buf);
                if (prefix(buf, "SAT:")) strcpy(days[6], buf);
        }
-
-       /* Close it */
        my_fclose(fp);
 
 #endif
@@ -1472,11 +1468,8 @@ errr check_load_init(void)
                /* Use that value */
                check_load_value = value;
 
-               /* Done */
                break;
        }
-
-       /* Close the file */
        my_fclose(fp);
 
 #endif
@@ -1652,14 +1645,14 @@ static struct
  * @param attr 項目表示の色
  * @return なし
  */
-static void display_player_one_line(int entry, cptr val, byte attr)
+static void display_player_one_line(int entry, concptr val, TERM_COLOR attr)
 {
        char buf[40];
 
        int row = disp_player_line[entry].row;
        int col = disp_player_line[entry].col;
        int len = disp_player_line[entry].len;
-       cptr head = disp_player_line[entry].header;
+       concptr head = disp_player_line[entry].header;
 
        int head_len = strlen(head);
 
@@ -1691,8 +1684,8 @@ static void display_player_one_line(int entry, cptr val, byte attr)
 static void display_player_melee_bonus(int hand, int hand_entry)
 {
        char buf[160];
-       int show_tohit = p_ptr->dis_to_h[hand];
-       int show_todam = p_ptr->dis_to_d[hand];
+       HIT_PROB show_tohit = p_ptr->dis_to_h[hand];
+       HIT_POINT show_todam = p_ptr->dis_to_d[hand];
        object_type *o_ptr = &inventory[INVEN_RARM + hand];
 
        /* Hack -- add in weapon info if known */
@@ -1702,10 +1695,10 @@ static void display_player_melee_bonus(int hand, int hand_entry)
        show_tohit += p_ptr->skill_thn / BTH_PLUS_ADJ;
        
        /* Melee attacks */
-       sprintf(buf, "(%+d,%+d)", show_tohit, show_todam);
+       sprintf(buf, "(%+d,%+d)", (int)show_tohit, (int)show_todam);
 
        /* Dump the bonuses to hit/dam */
-       if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
+       if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM))
                display_player_one_line(ENTRY_BARE_HAND, buf, TERM_L_BLUE);
        else if (p_ptr->ryoute)
                display_player_one_line(ENTRY_TWO_HANDS, buf, TERM_L_BLUE);
@@ -1724,8 +1717,8 @@ static void display_player_middle(void)
        char buf[160];
 
        /* Base skill */
-       int show_tohit = p_ptr->dis_to_h_b;
-       int show_todam = 0;
+       HIT_PROB show_tohit = p_ptr->dis_to_h_b;
+       HIT_POINT show_todam = 0;
 
        /* Range weapon */
        object_type *o_ptr = &inventory[INVEN_BOW];
@@ -1791,7 +1784,7 @@ static void display_player_middle(void)
        /* Dump speed */
        {
                int tmp_speed = 0;
-               byte attr;
+               TERM_COLOR attr;
                int i;
 
                i = p_ptr->pspeed-110;
@@ -1829,8 +1822,8 @@ static void display_player_middle(void)
                }
                else
                {
-                       if (MON_FAST(&m_list[p_ptr->riding])) tmp_speed += 10;
-                       if (MON_SLOW(&m_list[p_ptr->riding])) tmp_speed -= 10;
+                       if (MON_FAST(&current_floor_ptr->m_list[p_ptr->riding])) tmp_speed += 10;
+                       if (MON_SLOW(&current_floor_ptr->m_list[p_ptr->riding])) tmp_speed -= 10;
                }
 
                if (tmp_speed)
@@ -1915,14 +1908,14 @@ static void display_player_middle(void)
                display_player_one_line(ENTRY_SP, format("%4d/%4d", p_ptr->csp , p_ptr->msp), TERM_RED);
 
        /* Dump play time */
-       display_player_one_line(ENTRY_PLAY_TIME, format("%.2lu:%.2lu:%.2lu", playtime/(60*60), (playtime/60)%60, playtime%60), TERM_L_GREEN);
+       display_player_one_line(ENTRY_PLAY_TIME, format("%.2lu:%.2lu:%.2lu", current_world_ptr->play_time/(60*60), (current_world_ptr->play_time/60)%60, current_world_ptr->play_time%60), TERM_L_GREEN);
 }
 
 
 /*
  * Hack -- pass color info around this file
  */
-static byte likert_color = TERM_WHITE;
+static TERM_COLOR likert_color = TERM_WHITE;
 
 
 /*!
@@ -1932,13 +1925,11 @@ static byte likert_color = TERM_WHITE;
  * @param y 技能値に対するランク基準比
  * @return なし
  */
-static cptr likert(int x, int y)
+static concptr likert(int x, int y)
 {
        static char dummy[20] = "", dummy2[20] = "";
        memset(dummy, 0, strlen(dummy));
        memset(dummy2, 0, strlen(dummy2));
-
-       /* Paranoia */
        if (y <= 0) y = 1;
 
        if(show_actual_value)
@@ -1952,68 +1943,70 @@ static cptr likert(int x, int y)
                likert_color = TERM_L_DARK;
                strcat(dummy, _("最低", "Very Bad"));
        }
-
-       /* Analyze the value */
-       switch ((x / y))
+       else
        {
-       case 0:
-       case 1:
-               likert_color = TERM_RED;
-               strcat(dummy, _("悪い", "Bad"));
-               break;
-       case 2:
-               likert_color = TERM_L_RED;
-               strcat(dummy, _("劣る", "Poor"));
-               break;
 
-       case 3:
-       case 4:
-               likert_color = TERM_ORANGE;
-               strcat(dummy, _("普通", "Fair"));
-               break;
+               /* Analyze the value */
+               switch ((x / y))
+               {
+               case 0:
+               case 1:
+                       likert_color = TERM_RED;
+                       strcat(dummy, _("悪い", "Bad"));
+                       break;
+               case 2:
+                       likert_color = TERM_L_RED;
+                       strcat(dummy, _("劣る", "Poor"));
+                       break;
 
-       case 5:
-               likert_color = TERM_YELLOW;
-               strcat(dummy, _("良い", "Good"));
-               break;
+               case 3:
+               case 4:
+                       likert_color = TERM_ORANGE;
+                       strcat(dummy, _("普通", "Fair"));
+                       break;
 
-       case 6:
-               likert_color = TERM_YELLOW;
-               strcat(dummy, _("大変良い", "Very Good"));
-               break;
+               case 5:
+                       likert_color = TERM_YELLOW;
+                       strcat(dummy, _("良い", "Good"));
+                       break;
 
-       case 7:
-       case 8:
-               likert_color = TERM_L_GREEN;
-               strcat(dummy, _("卓越", "Excellent"));
-               break;
+               case 6:
+                       likert_color = TERM_YELLOW;
+                       strcat(dummy, _("大変良い", "Very Good"));
+                       break;
 
-       case 9:
-       case 10:
-       case 11:
-       case 12:
-       case 13:
-               likert_color = TERM_GREEN;
-               strcat(dummy, _("超越", "Superb"));
-               break;
+               case 7:
+               case 8:
+                       likert_color = TERM_L_GREEN;
+                       strcat(dummy, _("卓越", "Excellent"));
+                       break;
 
-       case 14:
-       case 15:
-       case 16:
-       case 17:
-               likert_color = TERM_BLUE;
-               strcat(dummy, _("英雄的", "Heroic"));
-               break;
+               case 9:
+               case 10:
+               case 11:
+               case 12:
+               case 13:
+                       likert_color = TERM_GREEN;
+                       strcat(dummy, _("超越", "Superb"));
+                       break;
 
-       default:
-               likert_color = TERM_VIOLET;
-               sprintf(dummy2, _("伝説的[%d]", "Legendary[%d]"),
-                       (int)((((x / y) - 17) * 5) / 2));
-               strcat(dummy, dummy2);
+               case 14:
+               case 15:
+               case 16:
+               case 17:
+                       likert_color = TERM_BLUE;
+                       strcat(dummy, _("英雄的", "Heroic"));
+                       break;
 
-               break;
-       }
+               default:
+                       likert_color = TERM_VIOLET;
+                       sprintf(dummy2, _("伝説的[%d]", "Legendary[%d]"),
+                               (int)((((x / y) - 17) * 5) / 2));
+                       strcat(dummy, dummy2);
 
+                       break;
+               }
+       }
        return dummy;
 
 }
@@ -2032,13 +2025,13 @@ static void display_player_various(void)
        int                     xthn, xthb, xfos, xsrh;
        int                     xdis, xdev, xsav, xstl;
        int                     xdig;
-       cptr            desc;
+       concptr         desc;
        int         muta_att = 0;
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
        int             shots, shot_frac;
        bool dokubari;
 
-       object_type             *o_ptr;
+       object_type *o_ptr;
 
        if (p_ptr->muta2 & MUT2_HORNS)     muta_att++;
        if (p_ptr->muta2 & MUT2_SCOR_TAIL) muta_att++;
@@ -2220,7 +2213,7 @@ static void display_player_various(void)
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void player_flags(u32b flgs[TR_FLAG_SIZE])
+static void player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2598,6 +2591,8 @@ static void player_flags(u32b flgs[TR_FLAG_SIZE])
 
        if (p_ptr->pseikaku == SEIKAKU_SEXY)
                add_flag(flgs, TR_AGGRAVATE);
+       if (p_ptr->pseikaku == SEIKAKU_CHARGEMAN)
+               add_flag(flgs, TR_RES_CONF);
        if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
        {
                add_flag(flgs, TR_RES_BLIND);
@@ -2667,7 +2662,7 @@ static void player_flags(u32b flgs[TR_FLAG_SIZE])
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void tim_player_flags(u32b flgs[TR_FLAG_SIZE])
+static void tim_player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2798,11 +2793,11 @@ static void tim_player_flags(u32b flgs[TR_FLAG_SIZE])
  * @param mode オプション
  * @return なし
  */
-static void display_player_equippy(TERM_LEN y, TERM_LEN x, u16b mode)
+void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
 {
        int i, max_i;
 
-       byte a;
+       TERM_COLOR a;
        char c;
 
        object_type *o_ptr;
@@ -2834,22 +2829,13 @@ static void display_player_equippy(TERM_LEN y, TERM_LEN x, u16b mode)
 
 
 /*!
- * @brief プレイヤーの装備一覧シンボルを固定位置に表示する
- * @return なし
- */
-void print_equippy(void)
-{
-       display_player_equippy(ROW_EQUIPPY, COL_EQUIPPY, 0);
-}
-
-/*!
  * @brief プレイヤーの装備による免疫フラグを返す
  * @param flgs フラグを保管する配列
  * @return なし
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void known_obj_immunity(u32b flgs[TR_FLAG_SIZE])
+static void known_obj_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2886,7 +2872,7 @@ static void known_obj_immunity(u32b flgs[TR_FLAG_SIZE])
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void player_immunity(u32b flgs[TR_FLAG_SIZE])
+static void player_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2911,7 +2897,7 @@ static void player_immunity(u32b flgs[TR_FLAG_SIZE])
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void tim_player_immunity(u32b flgs[TR_FLAG_SIZE])
+static void tim_player_immunity(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2938,7 +2924,7 @@ static void tim_player_immunity(u32b flgs[TR_FLAG_SIZE])
  * @todo
  * xtra1.c周りと多重実装になっているのを何とかする
  */
-static void player_vuln_flags(u32b flgs[TR_FLAG_SIZE])
+static void player_vuln_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
 {
        int i;
 
@@ -2967,12 +2953,12 @@ static void player_vuln_flags(u32b flgs[TR_FLAG_SIZE])
  * A struct for storing misc. flags
  */
 typedef struct {
-       u32b player_flags[TR_FLAG_SIZE];
-       u32b tim_player_flags[TR_FLAG_SIZE];
-       u32b player_imm[TR_FLAG_SIZE];
-       u32b tim_player_imm[TR_FLAG_SIZE];
-       u32b player_vuln[TR_FLAG_SIZE];
-       u32b known_obj_imm[TR_FLAG_SIZE];
+       BIT_FLAGS player_flags[TR_FLAG_SIZE];
+       BIT_FLAGS tim_player_flags[TR_FLAG_SIZE];
+       BIT_FLAGS player_imm[TR_FLAG_SIZE];
+       BIT_FLAGS tim_player_imm[TR_FLAG_SIZE];
+       BIT_FLAGS player_vuln[TR_FLAG_SIZE];
+       BIT_FLAGS known_obj_imm[TR_FLAG_SIZE];
 } all_player_flags;
 
 
@@ -2987,7 +2973,7 @@ typedef struct {
  * @param mode 表示オプション
  * @return なし
  */
-static void display_flag_aux(int row, int col, cptr header,
+static void display_flag_aux(TERM_LEN row, TERM_LEN col, concptr header,
                                    int flag1, all_player_flags *f, u16b mode)
 {
        int     i;
@@ -3012,7 +2998,7 @@ static void display_flag_aux(int row, int col, cptr header,
        /* Check equipment */
        for (i = INVEN_RARM; i < max_i; i++)
        {
-               u32b flgs[TR_FLAG_SIZE];
+               BIT_FLAGS flgs[TR_FLAG_SIZE];
                object_type *o_ptr;
 
                /* Object */
@@ -3126,8 +3112,8 @@ static void display_flag_aux(int row, int col, cptr header,
  */
 static void display_player_flag_info(void)
 {
-       int row;
-       int col;
+       TERM_LEN row;
+       TERM_LEN col;
 
        all_player_flags f;
 
@@ -3148,20 +3134,20 @@ static void display_player_flag_info(void)
        c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col+8);
 
 #ifdef JP
-display_flag_aux(row+0, col, "耐酸  :", TR_RES_ACID, &f, 0);
-display_flag_aux(row+0, col, "耐酸  :", TR_IM_ACID, &f, DP_IMM);
-display_flag_aux(row+1, col, "耐電撃:", TR_RES_ELEC, &f, 0);
-display_flag_aux(row+1, col, "耐電撃:", TR_IM_ELEC, &f, DP_IMM);
-display_flag_aux(row+2, col, "耐火炎:", TR_RES_FIRE, &f, 0);
-display_flag_aux(row+2, col, "耐火炎:", TR_IM_FIRE, &f, DP_IMM);
-display_flag_aux(row+3, col, "耐冷気:", TR_RES_COLD, &f, 0);
-display_flag_aux(row+3, col, "耐冷気:", TR_IM_COLD, &f, DP_IMM);
-display_flag_aux(row+4, col, "耐毒  :", TR_RES_POIS, &f, 0);
-display_flag_aux(row+5, col, "耐閃光:", TR_RES_LITE, &f, 0);
-display_flag_aux(row+6, col, "耐暗黒:", TR_RES_DARK, &f, 0);
-display_flag_aux(row+7, col, "耐破片:", TR_RES_SHARDS, &f, 0);
-display_flag_aux(row+8, col, "耐盲目:", TR_RES_BLIND, &f, 0);
-display_flag_aux(row+9, col, "耐混乱:", TR_RES_CONF, &f, 0);
+       display_flag_aux(row+0, col, "耐酸  :", TR_RES_ACID, &f, 0);
+       display_flag_aux(row+0, col, "耐酸  :", TR_IM_ACID, &f, DP_IMM);
+       display_flag_aux(row+1, col, "耐電撃:", TR_RES_ELEC, &f, 0);
+       display_flag_aux(row+1, col, "耐電撃:", TR_IM_ELEC, &f, DP_IMM);
+       display_flag_aux(row+2, col, "耐火炎:", TR_RES_FIRE, &f, 0);
+       display_flag_aux(row+2, col, "耐火炎:", TR_IM_FIRE, &f, DP_IMM);
+       display_flag_aux(row+3, col, "耐冷気:", TR_RES_COLD, &f, 0);
+       display_flag_aux(row+3, col, "耐冷気:", TR_IM_COLD, &f, DP_IMM);
+       display_flag_aux(row+4, col, "耐毒  :", TR_RES_POIS, &f, 0);
+       display_flag_aux(row+5, col, "耐閃光:", TR_RES_LITE, &f, 0);
+       display_flag_aux(row+6, col, "耐暗黒:", TR_RES_DARK, &f, 0);
+       display_flag_aux(row+7, col, "耐破片:", TR_RES_SHARDS, &f, 0);
+       display_flag_aux(row+8, col, "耐盲目:", TR_RES_BLIND, &f, 0);
+       display_flag_aux(row+9, col, "耐混乱:", TR_RES_CONF, &f, 0);
 #else
        display_flag_aux(row+0, col, "Acid  :", TR_RES_ACID, &f, 0);
        display_flag_aux(row+0, col, "Acid  :", TR_IM_ACID, &f, DP_IMM);
@@ -3190,16 +3176,16 @@ display_flag_aux(row+9, col, "耐混乱:", TR_RES_CONF, &f, 0);
        c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col+8);
 
 #ifdef JP
-display_flag_aux(row+0, col, "耐轟音:", TR_RES_SOUND, &f, 0);
-display_flag_aux(row+1, col, "耐地獄:", TR_RES_NETHER, &f, 0);
-display_flag_aux(row+2, col, "耐因混:", TR_RES_NEXUS, &f, 0);
-display_flag_aux(row+3, col, "耐カオ:", TR_RES_CHAOS, &f, 0);
-display_flag_aux(row+4, col, "耐劣化:", TR_RES_DISEN, &f, 0);
-display_flag_aux(row+5, col, "耐恐怖:", TR_RES_FEAR, &f, 0);
-display_flag_aux(row+6, col, "反射  :", TR_REFLECT, &f, 0);
-display_flag_aux(row+7, col, "火炎オ:", TR_SH_FIRE, &f, 0);
-display_flag_aux(row+8, col, "電気オ:", TR_SH_ELEC, &f, 0);
-display_flag_aux(row+9, col, "冷気オ:", TR_SH_COLD, &f, 0);
+       display_flag_aux(row+0, col, "耐轟音:", TR_RES_SOUND, &f, 0);
+       display_flag_aux(row+1, col, "耐地獄:", TR_RES_NETHER, &f, 0);
+       display_flag_aux(row+2, col, "耐因混:", TR_RES_NEXUS, &f, 0);
+       display_flag_aux(row+3, col, "耐カオ:", TR_RES_CHAOS, &f, 0);
+       display_flag_aux(row+4, col, "耐劣化:", TR_RES_DISEN, &f, 0);
+       display_flag_aux(row+5, col, "耐恐怖:", TR_RES_FEAR, &f, 0);
+       display_flag_aux(row+6, col, "反射  :", TR_REFLECT, &f, 0);
+       display_flag_aux(row+7, col, "火炎オ:", TR_SH_FIRE, &f, 0);
+       display_flag_aux(row+8, col, "電気オ:", TR_SH_ELEC, &f, 0);
+       display_flag_aux(row+9, col, "冷気オ:", TR_SH_COLD, &f, 0);
 #else
        display_flag_aux(row+0, col, "Sound :", TR_RES_SOUND, &f, 0);
        display_flag_aux(row+1, col, "Nether:", TR_RES_NETHER, &f, 0);
@@ -3224,16 +3210,16 @@ display_flag_aux(row+9, col, "冷気オ:", TR_SH_COLD, &f, 0);
        c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col+12);
 
 #ifdef JP
-display_flag_aux(row+0, col, "加速      :", TR_SPEED, &f, 0);
-display_flag_aux(row+1, col, "耐麻痺    :", TR_FREE_ACT, &f, 0);
-display_flag_aux(row+2, col, "透明体視認:", TR_SEE_INVIS, &f, 0);
-display_flag_aux(row+3, col, "経験値保持:", TR_HOLD_EXP, &f, 0);
-display_flag_aux(row+4, col, "警告      :", TR_WARNING, &f, 0);
-display_flag_aux(row+5, col, "遅消化    :", TR_SLOW_DIGEST, &f, 0);
-display_flag_aux(row+6, col, "急回復    :", TR_REGEN, &f, 0);
-display_flag_aux(row+7, col, "浮遊      :", TR_LEVITATION, &f, 0);
-display_flag_aux(row+8, col, "永遠光源  :", TR_LITE_1, &f, 0);
-display_flag_aux(row+9, col, "呪い      :", 0, &f, DP_CURSE);
+       display_flag_aux(row+0, col, "加速      :", TR_SPEED, &f, 0);
+       display_flag_aux(row+1, col, "耐麻痺    :", TR_FREE_ACT, &f, 0);
+       display_flag_aux(row+2, col, "透明体視認:", TR_SEE_INVIS, &f, 0);
+       display_flag_aux(row+3, col, "経験値保持:", TR_HOLD_EXP, &f, 0);
+       display_flag_aux(row+4, col, "警告      :", TR_WARNING, &f, 0);
+       display_flag_aux(row+5, col, "遅消化    :", TR_SLOW_DIGEST, &f, 0);
+       display_flag_aux(row+6, col, "急回復    :", TR_REGEN, &f, 0);
+       display_flag_aux(row+7, col, "浮遊      :", TR_LEVITATION, &f, 0);
+       display_flag_aux(row+8, col, "永遠光源  :", TR_LITE_1, &f, 0);
+       display_flag_aux(row+9, col, "呪い      :", 0, &f, DP_CURSE);
 #else
        display_flag_aux(row+0, col, "Speed     :", TR_SPEED, &f, 0);
        display_flag_aux(row+1, col, "FreeAction:", TR_FREE_ACT, &f, 0);
@@ -3257,8 +3243,8 @@ display_flag_aux(row+9, col, "呪い      :", 0, &f, DP_CURSE);
  */
 static void display_player_other_flag_info(void)
 {
-       int row;
-       int col;
+       TERM_LEN row;
+       TERM_LEN col;
 
        all_player_flags f;
 
@@ -3523,7 +3509,7 @@ static void display_player_stat_info(void)
        int row, col;
 
        object_type *o_ptr;
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
 
        byte a;
        char c;
@@ -3538,23 +3524,14 @@ static void display_player_stat_info(void)
        row = 3;
 
        /* Print out the labels for the columns */
-#ifdef JP
-c_put_str(TERM_WHITE, "能力", row, stat_col+1);
-c_put_str(TERM_BLUE, "  基本", row, stat_col+7);
-c_put_str(TERM_L_BLUE, " 種 職 性 装 ", row, stat_col+13);
-c_put_str(TERM_L_GREEN, "合計", row, stat_col+28);
-c_put_str(TERM_YELLOW, "現在", row, stat_col+35);
-#else
-       c_put_str(TERM_WHITE, "Stat", row, stat_col+1);
-       c_put_str(TERM_BLUE, "  Base", row, stat_col+7);
-       c_put_str(TERM_L_BLUE, "RacClaPerMod", row, stat_col+13);
-       c_put_str(TERM_L_GREEN, "Actual", row, stat_col+26);
-       c_put_str(TERM_YELLOW, "Current", row, stat_col+32);
-#endif
-
+       c_put_str(TERM_WHITE, _("能力", "Stat"), row, stat_col+1);
+       c_put_str(TERM_BLUE, _("  基本", "  Base"), row, stat_col+7);
+       c_put_str(TERM_L_BLUE, _(" 種 職 性 装 ", "RacClaPerMod"), row, stat_col+13);
+       c_put_str(TERM_L_GREEN, _("合計", "Actual"), row, stat_col+28);
+       c_put_str(TERM_YELLOW, _("現在", "Current"), row, stat_col+35);
 
        /* Display the stats */
-       for (i = 0; i < 6; i++)
+       for (i = 0; i < A_MAX; i++)
        {
                int r_adj;
 
@@ -3645,14 +3622,13 @@ c_put_str(TERM_YELLOW, "現在", row, stat_col+35);
        /* Process equipment */
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               /* Access object */
                o_ptr = &inventory[i];
 
                /* Acquire "known" flags */
                object_flags_known(o_ptr, flgs);
 
                /* Initialize color based of sign of pval. */
-               for (stat = 0; stat < 6; stat++)
+               for (stat = 0; stat < A_MAX; stat++)
                {
                        /* Default */
                        a = TERM_SLATE;
@@ -3711,7 +3687,7 @@ c_put_str(TERM_YELLOW, "現在", row, stat_col+35);
        player_flags(flgs);
 
        /* Check stats */
-       for (stat = 0; stat < 6; stat++)
+       for (stat = 0; stat < A_MAX; stat++)
        {
                /* Default */
                a = TERM_SLATE;
@@ -3816,15 +3792,12 @@ c_put_str(TERM_YELLOW, "現在", row, stat_col+35);
  * Mode 4 = mutations
  * </pre>
  */
-void display_player(BIT_FLAGS mode)
+void display_player(int mode)
 {
        int i;
+       char buf[80];
+       char tmp[64];
 
-       char    buf[80];
-       char    tmp[64];
-
-
-       /* XXX XXX XXX */
        if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && display_mutations)
                mode = (mode % 5);
        else
@@ -3877,7 +3850,7 @@ void display_player(BIT_FLAGS mode)
 
 
                /* Display the stats */
-               for (i = 0; i < 6; i++)
+               for (i = 0; i < A_MAX; i++)
                {
                        /* Special treatment of "injured" stats */
                        if (p_ptr->stat_cur[i] < p_ptr->stat_max[i])
@@ -3948,7 +3921,7 @@ void display_player(BIT_FLAGS mode)
                                        sprintf(statmsg, "...You %s after the winning.", streq(p_ptr->died_from, "Seppuku") ? "did Seppuku" : "retired from the adventure");
 #endif
                                }
-                               else if (!dun_level)
+                               else if (!current_floor_ptr->dun_level)
                                {
 #ifdef JP
                                        sprintf(statmsg, "…あなたは%sで%sに殺された。", map_name(), p_ptr->died_from);
@@ -3973,15 +3946,15 @@ void display_player(BIT_FLAGS mode)
                                else
                                {
 #ifdef JP
-                                       sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", map_name(), (int)dun_level, p_ptr->died_from);
+                                       sprintf(statmsg, "…あなたは、%sの%d階で%sに殺された。", map_name(), (int)current_floor_ptr->dun_level, p_ptr->died_from);
 #else
-                                       sprintf(statmsg, "...You were killed by %s on level %d of %s.", p_ptr->died_from, dun_level, map_name());
+                                       sprintf(statmsg, "...You were killed by %s on level %d of %s.", p_ptr->died_from, current_floor_ptr->dun_level, map_name());
 #endif
                                }
                        }
                        else if (character_dungeon)
                        {
-                               if (!dun_level)
+                               if (!current_floor_ptr->dun_level)
                                {
                                        sprintf(statmsg, _("…あなたは現在、 %s にいる。", "...Now, you are in %s."), map_name());
                                }
@@ -4005,9 +3978,9 @@ void display_player(BIT_FLAGS mode)
                                else
                                {
 #ifdef JP
-                                       sprintf(statmsg, "…あなたは現在、 %s の %d 階で探索している。", map_name(), (int)dun_level);
+                                       sprintf(statmsg, "…あなたは現在、 %s の %d 階で探索している。", map_name(), (int)current_floor_ptr->dun_level);
 #else
-                                       sprintf(statmsg, "...Now, you are exploring level %d of %s.", dun_level, map_name());
+                                       sprintf(statmsg, "...Now, you are exploring level %d of %s.", current_floor_ptr->dun_level, map_name());
 #endif
                                }
                        }
@@ -4070,11 +4043,10 @@ void display_player(BIT_FLAGS mode)
 static void dump_aux_display_player(FILE *fff)
 {
        TERM_LEN x, y;
-       byte a;
+       TERM_COLOR a;
        char c;
        char buf[1024];
 
-       /* Display player */
        display_player(0);
 
        /* Dump part of the screen */
@@ -4202,13 +4174,13 @@ static void dump_aux_pet(FILE *fff)
        int i;
        bool pet = FALSE;
        bool pet_settings = FALSE;
-       char pet_name[80];
+       GAME_TEXT pet_name[MAX_NLEN];
 
        for (i = m_max - 1; i >= 1; i--)
        {
-               monster_type *m_ptr = &m_list[i];
+               monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
                if (!is_pet(m_ptr)) continue;
                pet_settings = TRUE;
                if (!m_ptr->nickname && (p_ptr->riding != i)) continue;
@@ -4263,7 +4235,7 @@ static void dump_aux_class_special(FILE *fff)
                int l2 = 0;
                int num = 0;
                int spellnum[MAX_MONSPELLS];
-               s32b f4 = 0, f5 = 0, f6 = 0;
+               BIT_FLAGS f4 = 0, f5 = 0, f6 = 0;
                char p[60][80];
                int col = 0;
                bool pcol = FALSE;
@@ -4362,9 +4334,9 @@ static void dump_aux_class_special(FILE *fff)
        else if (p_ptr->pclass == CLASS_MAGIC_EATER)
        {
                char s[EATER_EXT][MAX_NLEN];
-               OBJECT_TYPE_VALUE tval;
+               OBJECT_TYPE_VALUE tval = 0;
                int ext;
-               IDX k_idx;
+               KIND_OBJECT_IDX k_idx;
                OBJECT_SUBTYPE_VALUE i;
                int magic_num;
 
@@ -4460,20 +4432,18 @@ static void dump_aux_class_special(FILE *fff)
  */
 static void dump_aux_quest(FILE *fff)
 {
-       IDX i;
-       IDX *quest_num;
+       QUEST_IDX i;
+       QUEST_IDX *quest_num;
        int dummy;
 
        fprintf(fff, _("\n\n  [クエスト情報]\n", "\n\n  [Quest Information]\n"));
 
        /* Allocate Memory */
-       C_MAKE(quest_num, max_q_idx, IDX);
+       C_MAKE(quest_num, max_q_idx, QUEST_IDX);
 
        /* Sort by compete level */
        for (i = 1; i < max_q_idx; i++) quest_num[i] = i;
-       ang_sort_comp = ang_sort_comp_quest_num;
-       ang_sort_swap = ang_sort_swap_quest_num;
-       ang_sort(quest_num, &dummy, max_q_idx);
+       ang_sort(quest_num, &dummy, max_q_idx, ang_sort_comp_quest_num, ang_sort_swap_quest_num);
 
        /* Dump Quest Information */
        fputc('\n', fff);
@@ -4483,7 +4453,7 @@ static void dump_aux_quest(FILE *fff)
        fputc('\n', fff);
 
        /* Free Memory */
-       C_KILL(quest_num, max_q_idx, IDX);
+       C_KILL(quest_num, max_q_idx, QUEST_IDX);
 }
 
 
@@ -4666,7 +4636,7 @@ static void dump_aux_monsters(FILE *fff)
        IDX k;
        long uniq_total = 0;
        long norm_total = 0;
-       IDX *who;
+       MONRACE_IDX *who;
 
        /* Sort by monster level */
        u16b why = 2;
@@ -4674,7 +4644,7 @@ static void dump_aux_monsters(FILE *fff)
        fprintf(fff, _("\n  [倒したモンスター]\n\n", "\n  [Defeated Monsters]\n\n"));
 
        /* Allocate the "who" array */
-       C_MAKE(who, max_r_idx, s16b);
+       C_MAKE(who, max_r_idx, MONRACE_IDX);
 
        /* Count monster kills */
        for (k = 1; k < max_r_idx; k++)
@@ -4733,13 +4703,8 @@ static void dump_aux_monsters(FILE *fff)
                fprintf(fff, "You have defeated %ld %s including %ld unique monster%s in total.\n", norm_total, norm_total == 1 ? "enemy" : "enemies", uniq_total, (uniq_total == 1 ? "" : "s"));
 #endif
 
-
-               /* Select the sort method */
-               ang_sort_comp = ang_sort_comp_hook;
-               ang_sort_swap = ang_sort_swap_hook;
-
                /* Sort the array by dungeon depth of monsters */
-               ang_sort(who, &why, uniq_total);
+               ang_sort(who, &why, uniq_total, ang_sort_comp_hook, ang_sort_swap_hook);
                fprintf(fff, _("\n《上位%ld体のユニーク・モンスター》\n", "\n< Unique monsters top %ld >\n"), MIN(uniq_total, 10));
 
                /* Print top 10 */
@@ -4833,7 +4798,7 @@ static void dump_aux_virtues(FILE *fff)
                else fprintf(fff, "Your current Life Rating is ???.\n\n");
                fprintf(fff, "Limits of maximum stats\n");
 #endif
-               for (v_nr = 0; v_nr < 6; v_nr++)
+               for (v_nr = 0; v_nr < A_MAX; v_nr++)
                {
                        if ((p_ptr->knowledge & KNOW_STAT) || p_ptr->stat_max[v_nr] == p_ptr->stat_max_max[v_nr]) fprintf(fff, "%s 18/%d\n", stat_names[v_nr], p_ptr->stat_max_max[v_nr]-18);
                        else fprintf(fff, "%s ???\n", stat_names[v_nr]);
@@ -4868,7 +4833,7 @@ static void dump_aux_mutations(FILE *fff)
 static void dump_aux_equipment_inventory(FILE *fff)
 {
        int i;
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
 
        /* Dump the equipment */
        if (equip_cnt)
@@ -4911,14 +4876,14 @@ static void dump_aux_equipment_inventory(FILE *fff)
  */
 static void dump_aux_home_museum(FILE *fff)
 {
-       char o_name[MAX_NLEN];
+       GAME_TEXT o_name[MAX_NLEN];
        store_type  *st_ptr;
 
        /* Do we need it?? */
-       /* process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x); */
+       /* process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x); */
 
        /* Print the home */
-       st_ptr = &town[1].store[STORE_HOME];
+       st_ptr = &town_info[1].store[STORE_HOME];
 
        /* Home -- if anything there */
        if (st_ptr->stock_num)
@@ -4943,7 +4908,7 @@ static void dump_aux_home_museum(FILE *fff)
 
 
        /* Print the home */
-       st_ptr = &town[1].store[STORE_MUSEUM];
+       st_ptr = &town_info[1].store[STORE_MUSEUM];
 
        /* Home -- if anything there */
        if (st_ptr->stock_num)
@@ -5019,10 +4984,10 @@ errr make_character_dump(FILE *fff)
  * @param name 出力ファイル名
  * @return エラーコード
  * @details
- * XXX XXX XXX Allow the "full" flag to dump additional info,
+ * Allow the "full" flag to dump additional info,
  * and trigger its usage from various places in the code.
  */
-errr file_character(cptr name)
+errr file_character(concptr name)
 {
        int             fd = -1;
        FILE            *fff = NULL;
@@ -5041,8 +5006,6 @@ errr file_character(cptr name)
        if (fd >= 0)
        {
                char out_val[160];
-
-               /* Close the file */
                (void)fd_close(fd);
 
                /* Build query */
@@ -5058,7 +5021,6 @@ errr file_character(cptr name)
        /* Invalid file */
        if (!fff)
        {
-               /* Message */
                prt(_("キャラクタ情報のファイルへの書き出しに失敗しました!", "Character dump failed!"), 0, 0);
 
                (void)inkey();
@@ -5068,12 +5030,9 @@ errr file_character(cptr name)
        }
 
        (void)make_character_dump(fff);
-
-       /* Close it */
        my_fclose(fff);
 
 
-       /* Message */
        msg_print(_("キャラクタ情報のファイルへの書き出しに成功しました。", "Character dump successful."));
        msg_print(NULL);
 
@@ -5098,7 +5057,7 @@ errr file_character(cptr name)
  * You can use any single character in place of the "|".
  * </pre>
  */
-static void show_file_aux_line(cptr str, int cy, cptr shower)
+static void show_file_aux_line(concptr str, int cy, concptr shower)
 {
        static const char tag_str[] = "[[[[";
        byte color = TERM_WHITE;
@@ -5123,7 +5082,7 @@ static void show_file_aux_line(cptr str, int cy, cptr shower)
                int showercol = len + 1;
                int bracketcol = len + 1;
                int endcol = len;
-               cptr ptr;
+               concptr ptr;
 
                /* Search for a shower string in the line */
                if (shower)
@@ -5227,7 +5186,7 @@ static void show_file_aux_line(cptr str, int cy, cptr shower)
  * Return FALSE on 'q' to exit from a deep, otherwise TRUE.
  * </pre>
  */
-bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode)
+bool show_file(bool show_version, concptr name, concptr what, int line, BIT_FLAGS mode)
 {
        int i, n, skey;
 
@@ -5247,10 +5206,10 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
        FILE *fff = NULL;
 
        /* Find this string (if any) */
-       cptr find = NULL;
+       concptr find = NULL;
 
        /* Jump to this tag */
-       cptr tag = NULL;
+       concptr tag = NULL;
 
        /* Hold strings to find/show */
        char finder_str[81];
@@ -5258,7 +5217,7 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
        char back_str[81];
 
        /* String to show */
-       cptr shower = NULL;
+       concptr shower = NULL;
 
        /* Filename */
        char filename[1024];
@@ -5316,7 +5275,7 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
        /* Redirect the name */
        name = filename;
 
-       /* Hack XXX XXX XXX */
+       /* Hack */
        if (what)
        {
                /* Caption */
@@ -5372,14 +5331,11 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
                fff = my_fopen(path, "r");
        }
 
-       /* Oops */
        if (!fff)
        {
-               /* Message */
                msg_format(_("'%s'をオープンできません。", "Cannot open '%s'."), name);
                msg_print(NULL);
 
-               /* Oops */
                return (TRUE);
        }
 
@@ -5438,8 +5394,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
 
        /* start from bottom when reverse mode */
        if (line == -1) line = ((size-1)/rows)*rows;
-
-       /* Clear screen */
        Term_clear();
 
        /* Display the file */
@@ -5452,13 +5406,11 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
                /* Re-open the file if needed */
                if (next > line)
                {
-                       /* Close it */
                        my_fclose(fff);
 
                        /* Hack -- Re-Open the file */
                        fff = my_fopen(path, "r");
 
-                       /* Oops */
                        if (!fff) return (FALSE);
 
                        /* File has been restarted */
@@ -5481,7 +5433,7 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
                /* Dump the next 20, or rows, lines of the file */
                for (i = 0; i < rows; )
                {
-                       cptr str = buf;
+                       concptr str = buf;
 
                        /* Hack -- track the "first" line */
                        if (!i) line = next;
@@ -5732,8 +5684,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
                        strcpy (xtmp, "");
 
                        if (!get_string(_("ファイル名: ", "File name: "), xtmp, 80)) continue;
-
-                       /* Close it */
                        my_fclose(fff);
 
                        /* Build the filename */
@@ -5744,7 +5694,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
 
                        ffp = my_fopen(buff, "w");
 
-                       /* Oops */
                        if (!(fff && ffp))
                        {
                                msg_print(_("ファイルを開けません。", "Failed to open file."));
@@ -5758,8 +5707,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
 
                        while (!my_fgets(fff, buff, sizeof(buff)))
                                my_fputs(ffp, buff, 80);
-
-                       /* Close it */
                        my_fclose(fff);
                        my_fclose(ffp);
 
@@ -5776,8 +5723,6 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
                /* Exit on the q key */
                if (skey == 'q') break;
        }
-
-       /* Close the file */
        my_fclose(fff);
 
        /* Escape */
@@ -5796,13 +5741,10 @@ bool show_file(bool show_version, cptr name, cptr what, int line, BIT_FLAGS mode
  */
 void do_cmd_help(void)
 {
-       /* Save screen */
        screen_save();
 
        /* Peruse the main help file */
        (void)show_file(TRUE, _("jhelp.hlp", "help.hlp"), NULL, 0, 0);
-
-       /* Load screen */
        screen_load();
 }
 
@@ -5922,11 +5864,11 @@ void process_player_name(bool sf)
 #endif
        if (!savefile_base[0] && savefile[0])
        {
-               cptr s;
+               concptr s;
                s = savefile;
                while (1)
                {
-                       cptr t;
+                       concptr t;
                        t = my_strstr(s, PATH_SEP);
                        if (!t)
                                break;
@@ -5974,7 +5916,7 @@ void process_player_name(bool sf)
  * Assumes that "display_player(0)" has just been called
  * Perhaps we should NOT ask for a name (at "birth()") on
  * Unix machines?  XXX XXX
- * What a horrible name for a global function.  XXX XXX XXX
+ * What a horrible name for a global function.  
  * </pre>
  */
 void get_name(void)
@@ -6017,90 +5959,6 @@ void get_name(void)
 
 
 /*!
- * @brief 自殺するコマンドのメインルーチン
- * Hack -- commit suicide
- * @return なし
- * @details
- */
-void do_cmd_suicide(void)
-{
-       int i;
-
-       /* Flush input */
-       flush();
-
-       /* Verify Retirement */
-       if (p_ptr->total_winner)
-       {
-               /* Verify */
-               if (!get_check_strict(_("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return;
-       }
-
-       /* Verify Suicide */
-       else
-       {
-               /* Verify */
-               if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return;
-       }
-
-
-       if (!p_ptr->noscore)
-       {
-               /* Special Verification for suicide */
-               prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
-
-               flush();
-               i = inkey();
-               prt("", 0, 0);
-               if (i != '@') return;
-
-               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
-       }
-
-       /* Initialize "last message" buffer */
-       if (p_ptr->last_message) string_free(p_ptr->last_message);
-       p_ptr->last_message = NULL;
-
-       /* Hack -- Note *winning* message */
-       if (p_ptr->total_winner && last_words)
-       {
-               char buf[1024] = "";
-               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
-               do
-               {
-                       while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof buf)) ;
-               }
-               while (!get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
-
-               if (buf[0])
-               {
-                       p_ptr->last_message = string_make(buf);
-                       msg_print(p_ptr->last_message);
-               }
-       }
-
-       /* Stop playing */
-       p_ptr->playing = FALSE;
-
-       /* Kill the player */
-       p_ptr->is_dead = TRUE;
-
-       /* Leaving */
-       p_ptr->leaving = TRUE;
-
-       if (!p_ptr->total_winner)
-       {
-               do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ダンジョンの探索に絶望して自殺した。", "give up all hope to commit suicide."));
-               do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "--------   Game  Over   --------"));
-               do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
-       }
-
-       /* Cause of death */
-       (void)strcpy(p_ptr->died_from, _("途中終了", "Quitting"));
-}
-
-
-/*!
  * @brief セーブするコマンドのメインルーチン
  * Save the game
  * @param is_autosave オートセーブ中の処理ならばTRUE
@@ -6116,20 +5974,15 @@ void do_cmd_save_game(int is_autosave)
        }
        else
        {
-               /* Disturb the player */
-               disturb(1, 1);
+               disturb(TRUE, TRUE);
        }
 
        /* Clear messages */
        msg_print(NULL);
-
-       /* Handle stuff */
        handle_stuff();
 
-       /* Message */
        prt(_("ゲームをセーブしています...", "Saving game..."), 0, 0);
 
-       /* Refresh */
        Term_fresh();
 
        /* The player is not dead */
@@ -6153,7 +6006,6 @@ void do_cmd_save_game(int is_autosave)
        /* Allow suspend again */
        signals_handle_tstp();
 
-       /* Refresh */
        Term_fresh();
 
        /* Note that the player is not dead */
@@ -6162,8 +6014,7 @@ void do_cmd_save_game(int is_autosave)
        /* HACK -- don't get sanity blast on updating view */
        is_loading_now = FALSE;
 
-       /* Update stuff */
-       update_stuff();
+       update_creature(p_ptr);
 
        /* Initialize monster process */
        mproc_init();
@@ -6182,8 +6033,6 @@ void do_cmd_save_game(int is_autosave)
 void do_cmd_save_and_exit(void)
 {
        p_ptr->playing = FALSE;
-
-       /* Leaving */
        p_ptr->leaving = TRUE;
        do_cmd_write_nikki(NIKKI_GAMESTART, 0, _("----ゲーム中断----", "---- Save and Exit Game ----"));
 }
@@ -6261,7 +6110,7 @@ long total_points(void)
  * @return なし
  * @details
  */
-static void center_string(char *buf, cptr str)
+static void center_string(char *buf, concptr str)
 {
        int i, j;
 
@@ -6298,12 +6147,12 @@ static void make_bones(void)
        if (!(p_ptr->noscore & 0x00FF))
        {
                /* Ignore people who die in town */
-               if (dun_level)
+               if (current_floor_ptr->dun_level)
                {
                        char tmp[128];
 
-                       /* XXX XXX XXX "Bones" name */
-                       sprintf(tmp, "bone.%03d", dun_level);
+                       /* "Bones" name */
+                       sprintf(tmp, "bone.%03d", current_floor_ptr->dun_level);
 
                        /* Build the filename */
                        path_build(str, sizeof(str), ANGBAND_DIR_BONE, tmp);
@@ -6357,7 +6206,7 @@ bool (*tombstone_aux)(void) = NULL;
  * Display a "tomb-stone"
  * @return なし
  */
-static void print_tomb(void)
+void print_tomb(void)
 {
        bool done = FALSE;
 
@@ -6371,7 +6220,7 @@ static void print_tomb(void)
        /* Print the text-tombstone */
        if (!done)
        {
-               cptr   p;
+               concptr   p;
                char   tmp[160];
                char   buf[1024];
                char   dummy[80];
@@ -6381,8 +6230,6 @@ static void print_tomb(void)
 #ifdef JP
                int    extra_line = 0;
 #endif
-
-               /* Clear screen */
                Term_clear();
 
                /* Build the filename */
@@ -6508,9 +6355,9 @@ static void print_tomb(void)
 
                if (!streq(p_ptr->died_from, "ripe") && !streq(p_ptr->died_from, "Seppuku"))
                {
-                       if (dun_level == 0)
+                       if (current_floor_ptr->dun_level == 0)
                        {
-                               cptr field_name = p_ptr->town_num ? "街" : "荒野";
+                               concptr field_name = p_ptr->town_num ? "街" : "荒野";
                                if (streq(p_ptr->died_from, "途中終了"))
                                {
                                        sprintf(tmp, "%sで死んだ", field_name);
@@ -6524,18 +6371,18 @@ static void print_tomb(void)
                        {
                                if (streq(p_ptr->died_from, "途中終了"))
                                {
-                                       sprintf(tmp, "地下 %d 階で死んだ", (int)dun_level);
+                                       sprintf(tmp, "地下 %d 階で死んだ", (int)current_floor_ptr->dun_level);
                                }
                                else
                                {
-                                       sprintf(tmp, "に地下 %d 階で殺された", (int)dun_level);
+                                       sprintf(tmp, "に地下 %d 階で殺された", (int)current_floor_ptr->dun_level);
                                }
                        }
                        center_string(buf, tmp);
                        put_str(buf, 15 + extra_line, 11);
                }
 #else
-               (void)sprintf(tmp, "Killed on Level %d", dun_level);
+               (void)sprintf(tmp, "Killed on Level %d", current_floor_ptr->dun_level);
                center_string(buf, tmp);
                put_str(buf, 14, 11);
 
@@ -6569,10 +6416,10 @@ static void print_tomb(void)
  * Display some character info
  * @return なし
  */
-static void show_info(void)
+void show_info(void)
 {
        int             i, j, k, l;
-       object_type             *o_ptr;
+       object_type *o_ptr;
        store_type              *st_ptr;
 
        /* Hack -- Know everything in the inven/equip */
@@ -6590,7 +6437,7 @@ static void show_info(void)
 
        for (i = 1; i < max_towns; i++)
        {
-               st_ptr = &town[i].store[STORE_HOME];
+               st_ptr = &town_info[i].store[STORE_HOME];
 
                /* Hack -- Know everything in the home */
                for (j = 0; j < st_ptr->stock_num; j++)
@@ -6608,15 +6455,12 @@ static void show_info(void)
 
        /* Hack -- Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
-
-       /* Handle stuff */
        handle_stuff();
 
        /* Flush all input keys */
        flush();
 
-       /* Flush messages */
-       msg_print(NULL);
+       msg_erase();
 
 
        /* Describe options */
@@ -6639,20 +6483,14 @@ static void show_info(void)
 
                /* Return means "show on screen" */
                if (!out_val[0]) break;
-
-               /* Save screen */
                screen_save();
 
                /* Dump a character file */
                (void)file_character(out_val);
-
-               /* Load screen */
                screen_load();
        }
 
        update_playtime();
-
-       /* Display player */
        display_player(0);
 
        /* Prompt for inventory */
@@ -6668,8 +6506,7 @@ static void show_info(void)
        if (equip_cnt)
        {
                Term_clear();
-               item_tester_full = TRUE;
-               (void)show_equip(0);
+               (void)show_equip(0, USE_FULL);
                prt(_("装備していたアイテム: -続く-", "You are using: -more-"), 0, 0);
 
                if (inkey() == ESCAPE) return;
@@ -6679,8 +6516,7 @@ static void show_info(void)
        if (inven_cnt)
        {
                Term_clear();
-               item_tester_full = TRUE;
-               (void)show_inven(0);
+               (void)show_inven(0, USE_FULL);
                prt(_("持っていたアイテム: -続く-", "You are carrying: -more-"), 0, 0);
 
                if (inkey() == ESCAPE) return;
@@ -6689,7 +6525,7 @@ static void show_info(void)
        /* Homes in the different towns */
        for (l = 1; l < max_towns; l++)
        {
-               st_ptr = &town[l].store[STORE_HOME];
+               st_ptr = &town_info[l].store[STORE_HOME];
 
                /* Home -- if anything there */
                if (st_ptr->stock_num)
@@ -6697,13 +6533,12 @@ static void show_info(void)
                        /* Display contents of the home */
                        for (k = 0, i = 0; i < st_ptr->stock_num; k++)
                        {
-                               /* Clear screen */
                                Term_clear();
 
                                /* Show 12 items */
                                for (j = 0; (j < 12) && (i < st_ptr->stock_num); j++, i++)
                                {
-                                       char o_name[MAX_NLEN];
+                                       GAME_TEXT o_name[MAX_NLEN];
                                        char tmp_val[80];
 
                                        /* Acquire item */
@@ -6733,9 +6568,8 @@ static void show_info(void)
  * Display some character info
  * @return なし
  */
-static bool check_score(void)
+bool check_score(void)
 {
-       /* Clear screen */
        Term_clear();
 
        /* No score file */
@@ -6794,129 +6628,6 @@ static bool check_score(void)
        return TRUE;
 }
 
-/*!
- * @brief ゲーム終了処理 /
- * Close up the current game (player may or may not be dead)
- * @return なし
- * @details
- * <pre>
- * This function is called only from "main.c" and "signals.c".
- * </pre>
- */
-void close_game(void)
-{
-       char buf[1024];
-       bool do_send = TRUE;
-
-/*     cptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
-
-       /* Handle stuff */
-       handle_stuff();
-
-       /* Flush the messages */
-       msg_print(NULL);
-
-       /* Flush the input */
-       flush();
-
-
-       /* No suspending now */
-       signals_ignore_tstp();
-
-
-       /* Hack -- Character is now "icky" */
-       character_icky = TRUE;
-
-
-       /* Build the filename */
-       path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
-
-       /* Grab permissions */
-       safe_setuid_grab();
-
-       /* Open the high score file, for reading/writing */
-       highscore_fd = fd_open(buf, O_RDWR);
-
-       /* Drop permissions */
-       safe_setuid_drop();
-
-       /* Handle death */
-       if (p_ptr->is_dead)
-       {
-               /* Handle retirement */
-               if (p_ptr->total_winner) kingly();
-
-               /* Save memories */
-               if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
-               {
-                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
-               }
-               else do_send = FALSE;
-
-               /* You are dead */
-               print_tomb();
-
-               flush();
-
-               /* Show more info */
-               show_info();
-
-               /* Clear screen */
-               Term_clear();
-
-               if (check_score())
-               {
-                       if ((!send_world_score(do_send)))
-                       {
-                               if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
-                                                               (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
-                               {
-                                       p_ptr->wait_report_score = TRUE;
-                                       p_ptr->is_dead = FALSE;
-                                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
-                               }
-                       }
-                       if (!p_ptr->wait_report_score)
-                               (void)top_twenty();
-               }
-               else if (highscore_fd >= 0)
-               {
-                       display_scores_aux(0, 10, -1, NULL);
-               }
-#if 0
-               /* Dump bones file */
-               make_bones();
-#endif
-       }
-
-       /* Still alive */
-       else
-       {
-               /* Save the game */
-               do_cmd_save_game(FALSE);
-
-               /* Prompt for scores XXX XXX XXX */
-               prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
-               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
-
-               /* Predict score (or ESCAPE) */
-               if (inkey() != ESCAPE) predict_score();
-       }
-
-
-       /* Shut the high score file */
-       (void)fd_close(highscore_fd);
-
-       /* Forget the high score fd */
-       highscore_fd = -1;
-
-       /* Kill all temporal files */
-       clear_saved_floor_files();
-
-       /* Allow suspending now */
-       signals_handle_tstp();
-}
-
 
 /*!
  * @brief 異常発生時のゲーム緊急終了処理 /
@@ -6941,8 +6652,8 @@ void exit_game_panic(void)
        /* Clear the top line */
        prt("", 0, 0);
 
-       /* Hack -- turn off some things */
-       disturb(1, 1);
+       /* Hack -- current_world_ptr->game_turn off some things */
+       disturb(TRUE, TRUE);
 
        /* Mega-Hack -- Delay death */
        if (p_ptr->chp < 0) p_ptr->is_dead = FALSE;
@@ -6976,7 +6687,7 @@ void exit_game_panic(void)
  * Based on the monster speech patch by Matt Graham,
  * </pre>
  */
-errr get_rnd_line(cptr file_name, int entry, char *output)
+errr get_rnd_line(concptr file_name, int entry, char *output)
 {
        FILE    *fp;
        char    buf[1024];
@@ -7068,8 +6779,6 @@ errr get_rnd_line(cptr file_name, int entry, char *output)
                /* Copy the line */
                if (one_in_(counter + 1)) strcpy(output, buf);
        }
-
-       /* Close the file */
        my_fclose(fp);
 
        /* Success */
@@ -7087,7 +6796,7 @@ errr get_rnd_line(cptr file_name, int entry, char *output)
  * @return エラーコード
  * @details
  */
-errr get_rnd_line_jonly(cptr file_name, int entry, char *output, int count)
+errr get_rnd_line_jonly(concptr file_name, int entry, char *output, int count)
 {
        int  i, j, kanji;
        errr result = 1;
@@ -7109,7 +6818,7 @@ errr get_rnd_line_jonly(cptr file_name, int entry, char *output, int count)
  * @param name ファイル名
  * @details
  */
-errr process_autopick_file(cptr name)
+errr process_autopick_file(concptr name)
 {
        char buf[1024];
 
@@ -7119,8 +6828,6 @@ errr process_autopick_file(cptr name)
        path_build(buf, sizeof(buf), ANGBAND_DIR_USER, name);
 
        err = process_pref_file_aux(buf, PREF_TYPE_AUTOPICK);
-
-       /* Result */
        return (err);
 }
 
@@ -7132,7 +6839,7 @@ errr process_autopick_file(cptr name)
  * @return エラーコード
  * @details
  */
-errr process_histpref_file(cptr name)
+errr process_histpref_file(concptr name)
 {
        char buf[1024];
        errr err = 0;
@@ -7147,8 +6854,6 @@ errr process_histpref_file(cptr name)
        err = process_pref_file_aux(buf, PREF_TYPE_HISTPREF);
 
        character_xtra = old_character_xtra;
-
-       /* Result */
        return (err);
 }
 
@@ -7398,8 +7103,6 @@ static void handle_signal_simple(int sig)
 
                /* Suicide */
                p_ptr->is_dead = TRUE;
-
-               /* Leaving */
                p_ptr->leaving = TRUE;
 
                /* Close stuff */
@@ -7421,7 +7124,6 @@ static void handle_signal_simple(int sig)
                /* Display the cause */
                Term_putstr(0, 0, -1, TERM_WHITE, _("熟慮の上の自殺!", "Contemplating suicide!"));
 
-               /* Flush */
                Term_fresh();
        }
 
@@ -7480,7 +7182,6 @@ static void handle_signal_abort(int sig)
        _("恐ろしいソフトのバグが飛びかかってきた!", "A gruesome software bug LEAPS out at you!"));
 
 
-       /* Message */
        Term_putstr(45, hgt - 1, -1, TERM_RED, _("緊急セーブ...", "Panic save..."));
 
        do_cmd_write_nikki(NIKKI_GAMESTART, 0, _("----ゲーム異常終了----", "---- Panic Save and Abort Game ----"));