OSDN Git Service

#37287 #37353 (2.2.0.89) QUEST_TYPE, QUEST_STATUS型を定義し、型の置換を継続中。 / Define QUEST_TYPE...
[hengband/hengband.git] / src / object2.c
index 65b687f..fca25a6 100644 (file)
 
 #include "angband.h"
 
-#include "kajitips.h"
+static cptr const kaji_tips[5] =
+{
+#ifdef JP
+       "現在持っているエッセンスの一覧を表示する。",
+       "アイテムからエッセンスを取り出す。エッセンスを取られたアイテムは全く魔法がかかっていない初期状態に戻る。",
+       "既にエッセンスが付加されたアイテムからエッセンスのみ消し去る。エッセンスは手に入らない。",
+       "アイテムにエッセンスを付加する。既にエッセンスが付加されたアイテムやアーティファクトには付加できない。",
+       "武器や防具を強化したり、攻撃で傷つかないようにしたりする。エッセンスが付加されたアイテムやアーティファクトに対しても使用できる。",
+#else
+       "Display essences you have.",
+       "Extract essences from an item. The item become non magical.",
+       "Remove added essences from an equipment which was improved before. The removed essence will be ruined.",
+       "Add essences to an item. The improved items or artifacts cannot be reimprove.",
+       "Enchant an equipment or make an equiment element-proofed. The improved items and artifacts can be enchanted too.",
+#endif
+};
 
 /*!
  * @brief 床上、モンスター所持でスタックされたアイテムを削除しスタックを補完する / Excise a dungeon object from any stacks
@@ -235,15 +250,12 @@ void delete_object(int y, int x)
  * @param i2 整理したい配列の終点
  * @return なし
  */
-static void compact_objects_aux(int i1, int i2)
+static void compact_objects_aux(IDX i1, IDX i2)
 {
-       int i;
-
+       IDX i;
        cave_type *c_ptr;
-
        object_type *o_ptr;
 
-
        /* Do nothing */
        if (i1 == i2) return;
 
@@ -333,7 +345,8 @@ static void compact_objects_aux(int i1, int i2)
  */
 void compact_objects(int size)
 {
-       int i, y, x, num, cnt;
+       IDX i;
+       int y, x, num, cnt;
        int cur_lev, cur_dis, chance;
        object_type *o_ptr;
 
@@ -342,12 +355,7 @@ void compact_objects(int size)
        if (size)
        {
                /* Message */
-#ifdef JP
-               msg_print("アイテム情報を圧縮しています...");
-#else
-               msg_print("Compacting objects...");
-#endif
-
+               msg_print(_("アイテム情報を圧縮しています...", "Compacting objects..."));
 
                /* Redraw map */
                p_ptr->redraw |= (PR_MAP);
@@ -402,7 +410,7 @@ void compact_objects(int size)
                        }
 
                        /* Nearby objects start out "immune" */
-                       if ((cur_dis > 0) && (distance(py, px, y, x) < cur_dis)) continue;
+                       if ((cur_dis > 0) && (distance(p_ptr->y, p_ptr->x, y, x) < cur_dis)) continue;
 
                        /* Saving throw */
                        chance = 90;
@@ -523,9 +531,9 @@ void wipe_o_list(void)
  * This routine should almost never fail, but in case it does,
  * we must be sure to handle "failure" of this routine.
  */
-s16b o_pop(void)
+IDX o_pop(void)
 {
-       int i;
+       IDX i;
 
 
        /* Initial allocation */
@@ -565,12 +573,7 @@ s16b o_pop(void)
 
 
        /* Warn the player (except during dungeon creation) */
-#ifdef JP
-       if (character_dungeon) msg_print("アイテムが多すぎる!");
-#else
-       if (character_dungeon) msg_print("Too many objects!");
-#endif
-
+       if (character_dungeon) msg_print(_("アイテムが多すぎる!", "Too many objects!"));
 
        /* Oops */
        return (0);
@@ -1852,11 +1855,11 @@ void object_absorb(object_type *o_ptr, object_type *j_ptr)
  * @param sval 検索したいベースアイテムのsval
  * @return なし
  */
-s16b lookup_kind(int tval, int sval)
+IDX lookup_kind(OBJECT_TYPE_VALUE tval, OBJECT_SUBTYPE_VALUE sval)
 {
-       int k;
+       IDX k;
        int num = 0;
-       int bk = 0;
+       IDX bk = 0;
 
        /* Look for it */
        for (k = 1; k < max_k_idx; k++)
@@ -1887,11 +1890,7 @@ s16b lookup_kind(int tval, int sval)
 
 #if 0
        /* Oops */
-#ifdef JP
-       msg_format("アイテムがない (%d,%d)", tval, sval);
-#else
-       msg_format("No object (%d,%d)", tval, sval);
-#endif
+       msg_format(_("アイテムがない (%d,%d)", "No object (%d,%d)"), tval, sval);
 #endif
 
 
@@ -1934,7 +1933,7 @@ void object_copy(object_type *o_ptr, object_type *j_ptr)
  * @param k_idx 新たに作成したいベースアイテム情報のID
  * @return なし
  */
-void object_prep(object_type *o_ptr, int k_idx)
+void object_prep(object_type *o_ptr, KIND_OBJECT_IDX k_idx)
 {
        object_kind *k_ptr = &k_info[k_idx];
 
@@ -2026,7 +2025,7 @@ void object_prep(object_type *o_ptr, int k_idx)
  * 120    0.03  0.11  0.31  0.46  1.31  2.48  4.60  7.78 11.67 25.53 45.72\n
  * 128    0.02  0.01  0.13  0.33  0.83  1.41  3.24  6.17  9.57 14.22 64.07\n
  */
-s16b m_bonus(int max, int level)
+int m_bonus(int max, DEPTH level)
 {
        int bonus, stand, extra, value;
 
@@ -2078,55 +2077,15 @@ static void object_mention(object_type *o_ptr)
 {
        char o_name[MAX_NLEN];
 
-       /* Describe */
-       object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
-
-       /* Artifact */
-       if (object_is_fixed_artifact(o_ptr))
-       {
-               /* Silly message */
-#ifdef JP
-               msg_format("伝説のアイテム (%s)", o_name);
-#else
-               msg_format("Artifact (%s)", o_name);
-#endif
-
-       }
-
-       /* Random Artifact */
-       else if (o_ptr->art_name)
-       {
-#ifdef JP
-               msg_print("ランダム・アーティファクト");
-#else
-               msg_print("Random artifact");
-#endif
-
-       }
-
-       /* Ego-item */
-       else if (object_is_ego(o_ptr))
-       {
-               /* Silly message */
-#ifdef JP
-               msg_format("名のあるアイテム (%s)", o_name);
-#else
-               msg_format("Ego-item (%s)", o_name);
-#endif
-
-       }
+       object_aware(o_ptr);
+       object_known(o_ptr);
 
-       /* Normal item */
-       else
-       {
-               /* Silly message */
-#ifdef JP
-               msg_format("アイテム (%s)", o_name);
-#else
-               msg_format("Object (%s)", o_name);
-#endif
+       /* Mark the item as fully known */
+       o_ptr->ident |= (IDENT_MENTAL);
 
-       }
+       /* Description */
+       object_desc(o_name, o_ptr, 0);
+       msg_format_wizard(CHEAT_OBJECT, _("%sを生成しました。", "%s was generated."), o_name);
 }
 
 /*!
@@ -2142,70 +2101,59 @@ static void object_mention(object_type *o_ptr)
  */
 static bool make_artifact_special(object_type *o_ptr)
 {
-       int i;
-       int k_idx = 0;
-
+       IDX i;
+       IDX k_idx = 0;
 
-       /* No artifacts in the town */
+       /*! @note 地上ではキャンセルする / No artifacts in the town */
        if (!dun_level) return (FALSE);
 
-       /* Themed object */
+       /*! @note get_obj_num_hookによる指定がある場合は生成をキャンセルする / Themed object */
        if (get_obj_num_hook) return (FALSE);
 
-       /* Check the artifact list (just the "specials") */
+       /*! @note 全固定アーティファクト中からIDの若い順に生成対象とその確率を走査する / Check the artifact list (just the "specials") */
        for (i = 0; i < max_a_idx; i++)
        {
                artifact_type *a_ptr = &a_info[i];
 
-               /* Skip "empty" artifacts */
+               /*! @note アーティファクト名が空の不正なデータは除外する / Skip "empty" artifacts */
                if (!a_ptr->name) continue;
 
-               /* Cannot make an artifact twice */
+               /*! @note 既に生成回数がカウントされたアーティファクト、QUESTITEMと非INSTA_ARTは除外 / Cannot make an artifact twice */
                if (a_ptr->cur_num) continue;
-
                if (a_ptr->gen_flags & TRG_QUESTITEM) continue;
                if (!(a_ptr->gen_flags & TRG_INSTA_ART)) continue;
 
-               /* XXX XXX Enforce minimum "depth" (loosely) */
-               if (a_ptr->level > dun_level)
+               /*! @note アーティファクト生成階が現在に対して足りない場合は高確率で1/(不足階層*2)を満たさないと生成リストに加えられない /
+                *  XXX XXX Enforce minimum "depth" (loosely) */
+               if (a_ptr->level > object_level)
                {
-                       /* Acquire the "out-of-depth factor" */
-                       int d = (a_ptr->level - dun_level) * 2;
-
-                       /* Roll for out-of-depth creation */
+                       /* @note  / Acquire the "out-of-depth factor". Roll for out-of-depth creation. */
+                       int d = (a_ptr->level - object_level) * 2;
                        if (!one_in_(d)) continue;
                }
 
-               /* Artifact "rarity roll" */
+               /*! @note 1/(レア度)の確率を満たさないと除外される / Artifact "rarity roll" */
                if (!one_in_(a_ptr->rarity)) continue;
 
-               /* Find the base object */
+               /*! @note INSTA_ART型固定アーティファクトのベースアイテムもチェック対象とする。ベースアイテムの生成階層が足りない場合1/(不足階層*5) を満たさないと除外される。 /
+                *  Find the base object. XXX XXX Enforce minimum "object" level (loosely). Acquire the "out-of-depth factor". Roll for out-of-depth creation. */
                k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
-
-               /* XXX XXX Enforce minimum "object" level (loosely) */
                if (k_info[k_idx].level > object_level)
                {
-                       /* Acquire the "out-of-depth factor" */
                        int d = (k_info[k_idx].level - object_level) * 5;
-
-                       /* Roll for out-of-depth creation */
                        if (!one_in_(d)) continue;
                }
 
-               /* Assign the template */
+               /*! @note 前述の条件を満たしたら、後のIDのアーティファクトはチェックせずすぐ確定し生成処理に移す /
+                * Assign the template. Mega-Hack -- mark the item as an artifact. Hack: Some artifacts get random extra powers. Success. */
                object_prep(o_ptr, k_idx);
 
-               /* Mega-Hack -- mark the item as an artifact */
                o_ptr->name1 = i;
-
-               /* Hack: Some artifacts get random extra powers */
                random_artifact_resistance(o_ptr, a_ptr);
-
-               /* Success */
                return (TRUE);
        }
 
-       /* Failure */
+       /*! @note 全INSTA_ART固定アーティファクトを試行しても決まらなかった場合 FALSEを返す / Failure */
        return (FALSE);
 }
 
@@ -2222,7 +2170,7 @@ static bool make_artifact_special(object_type *o_ptr)
  */
 static bool make_artifact(object_type *o_ptr)
 {
-       int i;
+       IDX i;
 
 
        /* No artifacts in the town */
@@ -2333,13 +2281,13 @@ static byte get_random_ego(byte slot, bool good)
  * Hack -- note special base damage dice boosting\n
  * Hack -- note special processing for weapon/digger\n
  */
-static void a_m_aux_1(object_type *o_ptr, int level, int power)
+static void a_m_aux_1(object_type *o_ptr, DEPTH level, int power)
 {
-       int tohit1 = randint1(5) + m_bonus(5, level);
-       int todam1 = randint1(5) + m_bonus(5, level);
+       HIT_PROB tohit1 = randint1(5) + (HIT_PROB)m_bonus(5, level);
+       HIT_POINT todam1 = randint1(5) + (HIT_POINT)m_bonus(5, level);
 
-       int tohit2 = m_bonus(10, level);
-       int todam2 = m_bonus(10, level);
+       HIT_PROB tohit2 = (HIT_PROB)m_bonus(10, level);
+       HIT_POINT todam2 = (HIT_POINT)m_bonus(10, level);
 
        if ((o_ptr->tval == TV_BOLT) || (o_ptr->tval == TV_ARROW) || (o_ptr->tval == TV_SHOT))
        {
@@ -2504,13 +2452,13 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                                                add_flag(o_ptr->art_flags, TR_RES_FEAR);
                                        break;
                                case EGO_SHARPNESS:
-                                       o_ptr->pval = m_bonus(5, level) + 1;
+                                       o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, level) + 1;
                                        break;
                                case EGO_EARTHQUAKES:
                                        if (one_in_(3) && (level > 60))
                                                add_flag(o_ptr->art_flags, TR_BLOWS);
                                        else
-                                               o_ptr->pval = m_bonus(3, level);
+                                               o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, level);
                                        break;
                                case EGO_VAMPIRIC:
                                        if (one_in_(5))
@@ -2723,9 +2671,8 @@ static void add_esp_weak(object_type *o_ptr, bool extra)
  */
 static void a_m_aux_2(object_type *o_ptr, int level, int power)
 {
-       int toac1 = randint1(5) + m_bonus(5, level);
-
-       int toac2 = m_bonus(10, level);
+       ARMOUR_CLASS toac1 = (ARMOUR_CLASS)randint1(5) + m_bonus(5, level);
+       ARMOUR_CLASS toac2 = (ARMOUR_CLASS)m_bonus(10, level);
 
        /* Good */
        if (power > 0)
@@ -2766,10 +2713,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                {
                        if (one_in_(50) || (power > 2)) /* power > 2 is debug only */
                                create_artifact(o_ptr, FALSE);
-
-                       /* Mention the item */
-                       if (cheat_peek) object_mention(o_ptr);
-
                        break;
                }
 
@@ -2813,24 +2756,23 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
 
                                        switch (o_ptr->name2)
                                        {
-                                         case EGO_DWARVEN:
-                                               if (o_ptr->tval != TV_HARD_ARMOR)
-                                               {
-                                                       okay_flag = FALSE;
-                                                       break;
-                                               }
-                                         case EGO_DRUID:
-                                               if (o_ptr->tval != TV_SOFT_ARMOR)
-                                               {
-                                                       okay_flag = FALSE;
-                                                       break;
-                                               }
-                                         default:
+                                               case EGO_DWARVEN:
+                                                       if (o_ptr->tval != TV_HARD_ARMOR)
+                                                       {
+                                                               okay_flag = FALSE;
+                                                       }
+                                               break;
+                                               case EGO_DRUID:
+                                                       if (o_ptr->tval != TV_SOFT_ARMOR)
+                                                       {
+                                                               okay_flag = FALSE;
+                                                       }
+                                               break;
+                                               default:
                                                break;
                                        }
 
-                                       if (okay_flag)
-                                               break;
+                                       if (okay_flag) break;
                                }
                                switch (o_ptr->name2)
                                {
@@ -2881,8 +2823,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
 
                        if (o_ptr->sval == SV_DRAGON_SHIELD)
                        {
-                               /* Mention the item */
-                               if (cheat_peek) object_mention(o_ptr);
                                dragon_resist(o_ptr);
                                if (!one_in_(3)) break;
                        }
@@ -2931,8 +2871,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                {
                        if (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)
                        {
-                               /* Mention the item */
-                               if (cheat_peek) object_mention(o_ptr);
                                dragon_resist(o_ptr);
                                if (!one_in_(3)) break;
                        }
@@ -2959,8 +2897,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                {
                        if (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)
                        {
-                               /* Mention the item */
-                               if (cheat_peek) object_mention(o_ptr);
                                dragon_resist(o_ptr);
                                if (!one_in_(3)) break;
                        }
@@ -3067,8 +3003,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                {
                        if (o_ptr->sval == SV_DRAGON_HELM)
                        {
-                               /* Mention the item */
-                               if (cheat_peek) object_mention(o_ptr);
                                dragon_resist(o_ptr);
                                if (!one_in_(3)) break;
                        }
@@ -3188,6 +3122,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                        break;
                }
        }
+
 }
 
 
@@ -3215,7 +3150,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_ATTACKS:
                                {
                                        /* Stat bonus */
-                                       o_ptr->pval = m_bonus(2, level);
+                                       o_ptr->pval = (PARAMETER_VALUE)m_bonus(2, level);
                                        if (one_in_(15)) o_ptr->pval++;
                                        if (o_ptr->pval < 1) o_ptr->pval = 1;
 
@@ -3246,7 +3181,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_DEX:
                                {
                                        /* Stat bonus */
-                                       o_ptr->pval = 1 + m_bonus(5, level);
+                                       o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(5, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3268,7 +3203,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_SPEED:
                                {
                                        /* Base speed (1 to 10) */
-                                       o_ptr->pval = randint1(5) + m_bonus(5, level);
+                                       o_ptr->pval = randint1(5) + (PARAMETER_VALUE)m_bonus(5, level);
 
                                        /* Super-charge the ring */
                                        while (randint0(100) < 50) o_ptr->pval++;
@@ -3288,9 +3223,6 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                                break;
                                        }
 
-                                       /* Mention the item */
-                                       if (cheat_peek) object_mention(o_ptr);
-
                                        break;
                                }
 
@@ -3303,7 +3235,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                        while (one_in_(4));
 
                                        /* Bonus to armor class */
-                                       o_ptr->to_a = 10 + randint1(5) + m_bonus(10, level);
+                                       o_ptr->to_a = 10 + randint1(5) + (ARMOUR_CLASS)m_bonus(10, level);
                                }
                                break;
 
@@ -3317,7 +3249,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_SEARCHING:
                                {
                                        /* Bonus to searching */
-                                       o_ptr->pval = 1 + m_bonus(5, level);
+                                       o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(5, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3342,7 +3274,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_ELEC:
                                {
                                        /* Bonus to armor class */
-                                       o_ptr->to_a = 5 + randint1(5) + m_bonus(10, level);
+                                       o_ptr->to_a = 5 + randint1(5) + (ARMOUR_CLASS)m_bonus(10, level);
                                        break;
                                }
 
@@ -3357,7 +3289,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                        o_ptr->curse_flags |= TRC_CURSED;
 
                                        /* Penalize */
-                                       o_ptr->pval = 0 - (1 + m_bonus(5, level));
+                                       o_ptr->pval = 0 - (1 + (PARAMETER_VALUE)m_bonus(5, level));
                                        if (power > 0) power = 0 - power;
 
                                        break;
@@ -3373,8 +3305,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                        o_ptr->curse_flags |= TRC_CURSED;
 
                                        /* Penalize */
-                                       o_ptr->to_a = 0 - (5 + m_bonus(10, level));
-                                       o_ptr->pval = 0 - (1 + m_bonus(5, level));
+                                       o_ptr->to_a = 0 - (5 + (ARMOUR_CLASS)m_bonus(10, level));
+                                       o_ptr->pval = 0 - (1 + (PARAMETER_VALUE)m_bonus(5, level));
                                        if (power > 0) power = 0 - power;
 
                                        break;
@@ -3384,7 +3316,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_DAMAGE:
                                {
                                        /* Bonus to damage */
-                                       o_ptr->to_d = 1 + randint1(5) + m_bonus(16, level);
+                                       o_ptr->to_d = 1 + randint1(5) + (HIT_POINT)m_bonus(16, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3406,7 +3338,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_ACCURACY:
                                {
                                        /* Bonus to hit */
-                                       o_ptr->to_h = 1 + randint1(5) + m_bonus(16, level);
+                                       o_ptr->to_h = 1 + randint1(5) + (HIT_PROB)m_bonus(16, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3428,7 +3360,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_PROTECTION:
                                {
                                        /* Bonus to armor class */
-                                       o_ptr->to_a = 5 + randint1(8) + m_bonus(10, level);
+                                       o_ptr->to_a = 5 + randint1(8) + (ARMOUR_CLASS)m_bonus(10, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3450,8 +3382,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_RING_SLAYING:
                                {
                                        /* Bonus to damage and to hit */
-                                       o_ptr->to_d = randint1(5) + m_bonus(12, level);
-                                       o_ptr->to_h = randint1(5) + m_bonus(12, level);
+                                       o_ptr->to_d = randint1(5) + (HIT_POINT)m_bonus(12, level);
+                                       o_ptr->to_h = randint1(5) + (HIT_PROB)m_bonus(12, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3472,7 +3404,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
 
                                case SV_RING_MUSCLE:
                                {
-                                       o_ptr->pval = 1 + m_bonus(3, level);
+                                       o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(3, level);
                                        if (one_in_(4)) o_ptr->pval++;
 
                                        /* Cursed */
@@ -3709,7 +3641,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                case SV_AMULET_WISDOM:
                                case SV_AMULET_CHARISMA:
                                {
-                                       o_ptr->pval = 1 + m_bonus(5, level);
+                                       o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(5, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3768,7 +3700,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                /* Amulet of searching */
                                case SV_AMULET_SEARCHING:
                                {
-                                       o_ptr->pval = randint1(2) + m_bonus(4, level);
+                                       o_ptr->pval = randint1(2) + (PARAMETER_VALUE)m_bonus(4, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3789,15 +3721,12 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                /* Amulet of the Magi -- never cursed */
                                case SV_AMULET_THE_MAGI:
                                {
-                                       o_ptr->pval = randint1(5) + m_bonus(5, level);
-                                       o_ptr->to_a = randint1(5) + m_bonus(5, level);
+                                       o_ptr->pval = randint1(5) + (PARAMETER_VALUE)m_bonus(5, level);
+                                       o_ptr->to_a = randint1(5) + (ARMOUR_CLASS)m_bonus(5, level);
 
                                        /* gain one low ESP */
                                        add_esp_weak(o_ptr, FALSE);
 
-                                       /* Mention the item */
-                                       if (cheat_peek) object_mention(o_ptr);
-
                                        break;
                                }
 
@@ -3811,8 +3740,8 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                        o_ptr->curse_flags |= (TRC_CURSED);
 
                                        /* Penalize */
-                                       o_ptr->pval = 0 - (randint1(5) + m_bonus(5, level));
-                                       o_ptr->to_a = 0 - (randint1(5) + m_bonus(5, level));
+                                       o_ptr->pval = 0 - (randint1(5) + (PARAMETER_VALUE)m_bonus(5, level));
+                                       o_ptr->to_a = 0 - (randint1(5) + (ARMOUR_CLASS)m_bonus(5, level));
                                        if (power > 0) power = 0 - power;
 
                                        break;
@@ -3820,7 +3749,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
 
                                case SV_AMULET_MAGIC_MASTERY:
                                {
-                                       o_ptr->pval = 1 + m_bonus(4, level);
+                                       o_ptr->pval = 1 + (PARAMETER_VALUE)m_bonus(4, level);
 
                                        /* Cursed */
                                        if (power < 0)
@@ -3992,7 +3921,7 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
  * @param r_idx チェックしたいモンスター種族のID
  * @return 人形にできるならTRUEを返す
  */
-static bool item_monster_okay(int r_idx)
+static bool item_monster_okay(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -4146,7 +4075,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
 
                case TV_FIGURINE:
                {
-                       int i = 1;
+                       PARAMETER_VALUE i = 1;
                        int check;
 
                        monster_race *r_ptr;
@@ -4180,24 +4109,12 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
                        /* Some figurines are cursed */
                        if (one_in_(6)) o_ptr->curse_flags |= TRC_CURSED;
 
-                       if (cheat_peek)
-                       {
-#ifdef JP
-                               msg_format("%sの人形, 深さ +%d%s",
-#else
-                               msg_format("Figurine of %s, depth +%d%s",
-#endif
-
-                                                         r_name + r_ptr->name, check - 1,
-                                                         !object_is_cursed(o_ptr) ? "" : " {cursed}");
-                       }
-
                        break;
                }
 
                case TV_CORPSE:
                {
-                       int i = 1;
+                       PARAMETER_VALUE i = 1;
                        int check;
 
                        u32b match = 0;
@@ -4239,16 +4156,6 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
 
                        o_ptr->pval = i;
 
-                       if (cheat_peek)
-                       {
-#ifdef JP
-                               msg_format("%sの死体, 深さ +%d",
-#else
-                               msg_format("Corpse of %s, depth +%d",
-#endif
-
-                                                         r_name + r_ptr->name, check - 1);
-                       }
 
                        object_aware(o_ptr);
                        object_known(o_ptr);
@@ -4257,7 +4164,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
 
                case TV_STATUE:
                {
-                       int i = 1;
+                       PARAMETER_VALUE i = 1;
 
                        monster_race *r_ptr;
 
@@ -4278,12 +4185,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
 
                        if (cheat_peek)
                        {
-#ifdef JP
-                               msg_format("%sの像", r_name + r_ptr->name);
-#else
-                               msg_format("Statue of %s", r_name + r_ptr->name);
-#endif
-
+                               msg_format(_("%sの像", "Statue of %s"), r_name + r_ptr->name);
                        }
                        object_aware(o_ptr);
                        object_known(o_ptr);
@@ -4293,7 +4195,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
 
                case TV_CHEST:
                {
-                       byte obj_level = k_info[o_ptr->k_idx].level;
+                       DEPTH obj_level = k_info[o_ptr->k_idx].level;
 
                        /* Hack -- skip ruined chests */
                        if (obj_level <= 0) break;
@@ -4348,7 +4250,7 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
  * "good" and "great" arguments are false.  As a total hack, if "great" is\n
  * true, then the item gets 3 extra "attempts" to become an artifact.\n
  */
-void apply_magic(object_type *o_ptr, int lev, u32b mode)
+void apply_magic(object_type *o_ptr, DEPTH lev, BIT_FLAGS mode)
 {
        int i, rolls, f1, f2, power;
 
@@ -4491,10 +4393,6 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode)
                if (a_ptr->gen_flags & (TRG_RANDOM_CURSE1)) o_ptr->curse_flags |= get_curse(1, o_ptr);
                if (a_ptr->gen_flags & (TRG_RANDOM_CURSE2)) o_ptr->curse_flags |= get_curse(2, o_ptr);
 
-
-               /* Cheat -- peek at the item */
-               if (cheat_peek) object_mention(o_ptr);
-
                /* Done */
                return;
        }
@@ -4731,9 +4629,6 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode)
                        if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2) && (o_ptr->name2 != EGO_ATTACKS))
                                o_ptr->pval = 2;
                }
-
-               /* Cheat -- describe the item */
-               if (cheat_peek) object_mention(o_ptr);
                
                /* Done */
                return;
@@ -4755,6 +4650,8 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode)
                if (k_ptr->gen_flags & (TRG_RANDOM_CURSE1)) o_ptr->curse_flags |= get_curse(1, o_ptr);
                if (k_ptr->gen_flags & (TRG_RANDOM_CURSE2)) o_ptr->curse_flags |= get_curse(2, o_ptr);
        }
+
+       
 }
 
 
@@ -4764,7 +4661,7 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode)
  * @param k_idx 判定したいベースアイテムのID
  * @return ベースアイテムが上質ならばTRUEを返す。
  */
-static bool kind_is_good(int k_idx)
+static bool kind_is_good(KIND_OBJECT_IDX k_idx)
 {
        object_kind *k_ptr = &k_info[k_idx];
 
@@ -4855,10 +4752,10 @@ static bool kind_is_good(int k_idx)
  * This routine uses "object_level" for the "generation level".\n
  * We assume that the given object has been "wiped".\n
  */
-bool make_object(object_type *j_ptr, u32b mode)
+bool make_object(object_type *j_ptr, BIT_FLAGS mode)
 {
        int prob, base;
-       byte obj_level;
+       DEPTH obj_level;
 
 
        /* Chance of "special object" */
@@ -4871,7 +4768,7 @@ bool make_object(object_type *j_ptr, u32b mode)
        /* Generate a special object, or a normal object */
        if (!one_in_(prob) || !make_artifact_special(j_ptr))
        {
-               int k_idx;
+               IDX k_idx;
 
                /* Good objects */
                if ((mode & AM_GOOD) && !get_obj_num_hook)
@@ -4922,13 +4819,7 @@ bool make_object(object_type *j_ptr, u32b mode)
        obj_level = k_info[j_ptr->k_idx].level;
        if (object_is_fixed_artifact(j_ptr)) obj_level = a_info[j_ptr->name1].level;
 
-       /* Notice "okay" out-of-depth objects */
-       if (!object_is_cursed(j_ptr) && !object_is_broken(j_ptr) &&
-           (obj_level > dun_level))
-       {
-               /* Cheat -- peek at items */
-               if (cheat_peek) object_mention(j_ptr);
-       }
+       if (cheat_peek) object_mention(j_ptr);
 
        /* Success */
        return (TRUE);
@@ -4947,9 +4838,9 @@ bool make_object(object_type *j_ptr, u32b mode)
  * This routine uses "object_level" for the "generation level".\n
  * This routine requires a clean floor grid destination.\n
  */
-void place_object(int y, int x, u32b mode)
+void place_object(POSITION y, POSITION x, BIT_FLAGS mode)
 {
-       s16b o_idx;
+       IDX o_idx;
 
        /* Acquire grid */
        cave_type *c_ptr = &cave[y][x];
@@ -5072,7 +4963,7 @@ bool make_gold(object_type *j_ptr)
  * @details
  * The location must be a legal, clean, floor grid.
  */
-void place_gold(int y, int x)
+void place_gold(POSITION y, POSITION x)
 {
        s16b o_idx;
 
@@ -5201,12 +5092,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
 
 
                /* Debug */
-#ifdef JP
-               if (p_ptr->wizard) msg_print("(破損)");
-#else
-               if (p_ptr->wizard) msg_print("(breakage)");
-#endif
-
+               if (p_ptr->wizard) msg_print(_("(破損)", "(breakage)"));
 
                /* Failure */
                return (0);
@@ -5318,12 +5204,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
 
 
                /* Debug */
-#ifdef JP
-               if (p_ptr->wizard) msg_print("(床スペースがない)");
-#else
-               if (p_ptr->wizard) msg_print("(no floor space)");
-#endif
-
+               if (p_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
 
                /* Failure */
                return (0);
@@ -5376,11 +5257,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
 #endif
 
                        /* Debug */
-#ifdef JP
-                       if (p_ptr->wizard) msg_print("(床スペースがない)");
-#else
-                       if (p_ptr->wizard) msg_print("(no floor space)");
-#endif
+                       if (p_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
 
                        /* Mega-Hack -- preserve artifacts */
                        if (preserve_mode)
@@ -5465,12 +5342,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
 
 
                /* Debug */
-#ifdef JP
-               if (p_ptr->wizard) msg_print("(アイテムが多過ぎる)");
-#else
-               if (p_ptr->wizard) msg_print("(too many objects)");
-#endif
-
+               if (p_ptr->wizard) msg_print(_("(アイテムが多過ぎる)", "(too many objects)"));
 
                /* Hack -- Preserve artifacts */
                if (object_is_fixed_artifact(j_ptr))
@@ -5521,12 +5393,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
        /* Message when an object falls under the player */
        if (chance && player_bold(by, bx))
        {
-#ifdef JP
-               msg_print("何かが足下に転がってきた。");
-#else
-               msg_print("You feel something roll beneath your feet.");
-#endif
-
+               msg_print(_("何かが足下に転がってきた。", "You feel something roll beneath your feet."));
        }
 
        /* XXX XXX XXX */
@@ -5588,8 +5455,8 @@ void acquirement(int y1, int x1, int num, bool great, bool special, bool known)
 
 typedef struct
 {
-       int tval;
-       int sval;
+       OBJECT_TYPE_VALUE tval;
+       OBJECT_SUBTYPE_VALUE sval;
        int prob;
        byte flag;
 } amuse_type;
@@ -5635,7 +5502,8 @@ void amusement(int y1, int x1, int num, bool known)
        /* Acquirement */
        while (num)
        {
-               int i, k_idx, a_idx = 0;
+               int i;
+               IDX k_idx, a_idx = 0;
                int r = randint0(t);
                bool insta_art, fixed_art;
 
@@ -5922,7 +5790,7 @@ void inven_item_increase(int item, int num)
        else if (num < 0) num = 0;
 
        /* Un-apply */
-       num -= o_ptr->number;
+       num -= (ITEM_NUMBER)o_ptr->number;
 
        /* Change the number and weight */
        if (num)
@@ -6118,10 +5986,10 @@ void floor_item_increase(int item, int num)
        else if (num < 0) num = 0;
 
        /* Un-apply */
-       num -= o_ptr->number;
+       num -= (int)o_ptr->number;
 
        /* Change the number */
-       o_ptr->number += num;
+       o_ptr->number += (ITEM_NUMBER)num;
 }
 
 
@@ -6286,8 +6154,8 @@ bool object_sort_comp(object_type *o_ptr, s32b o_value, object_type *j_ptr)
  */
 s16b inven_carry(object_type *o_ptr)
 {
-       int i, j, k;
-       int n = -1;
+       INVENTORY_IDX i, j, k;
+       INVENTORY_IDX n = -1;
 
        object_type *j_ptr;
 
@@ -6456,45 +6324,25 @@ s16b inven_takeoff(int item, int amt)
        if (((item == INVEN_RARM) || (item == INVEN_LARM)) &&
            object_is_melee_weapon(o_ptr))
        {
-#ifdef JP
-               act = "を装備からはずした";
-#else
-               act = "You were wielding";
-#endif
-
+               act = _("を装備からはずした", "You were wielding");
        }
 
        /* Took off bow */
        else if (item == INVEN_BOW)
        {
-#ifdef JP
-               act = "を装備からはずした";
-#else
-               act = "You were holding";
-#endif
-
+               act = _("を装備からはずした", "You were holding");
        }
 
        /* Took off light */
        else if (item == INVEN_LITE)
        {
-#ifdef JP
-               act = "を光源からはずした";
-#else
-               act = "You were holding";
-#endif
-
+               act = _("を光源からはずした", "You were holding");
        }
 
        /* Took off something */
        else
        {
-#ifdef JP
-               act = "を装備からはずした";
-#else
-               act = "You were wearing";
-#endif
-
+               act = _("を装備からはずした", "You were wearing");
        }
 
        /* Modify, Optimize */
@@ -6573,15 +6421,10 @@ void inven_drop(int item, int amt)
        object_desc(o_name, q_ptr, 0);
 
        /* Message */
-#ifdef JP
-       msg_format("%s(%c)を落とした。", o_name, index_to_label(item));
-#else
-       msg_format("You drop %s (%c).", o_name, index_to_label(item));
-#endif
-
+       msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(item));
 
        /* Drop it near the player */
-       (void)drop_near(q_ptr, 0, py, px);
+       (void)drop_near(q_ptr, 0, p_ptr->y, p_ptr->x);
 
        /* Modify, Describe, Optimize */
        inven_item_increase(item, -amt);
@@ -6699,11 +6542,7 @@ void combine_pack(void)
        while (combined);
 
        /* Message */
-#ifdef JP
-       if (flag) msg_print("ザックの中のアイテムをまとめ直した。");
-#else
-       if (flag) msg_print("You combine some items in your pack.");
-#endif
+       if (flag) msg_print(_("ザックの中のアイテムをまとめ直した。", "You combine some items in your pack."));
 }
 
 /*!
@@ -6771,12 +6610,7 @@ void reorder_pack(void)
        }
 
        /* Message */
-#ifdef JP
-       if (flag) msg_print("ザックの中のアイテムを並べ直した。");
-#else
-       if (flag) msg_print("You reorder some items in your pack.");
-#endif
-
+       if (flag) msg_print(_("ザックの中のアイテムを並べ直した。", "You reorder some items in your pack."));
 }
 
 /*!
@@ -6787,14 +6621,14 @@ void reorder_pack(void)
  * @details
  * Include list of usable spells for readible books
  */
-void display_koff(int k_idx)
+void display_koff(IDX k_idx)
 {
        int y;
 
        object_type forge;
        object_type *q_ptr;
        int         sval;
-       int         use_realm;
+       REALM_IDX   use_realm;
 
        char o_name[MAX_NLEN];
 
@@ -6841,7 +6675,7 @@ void display_koff(int k_idx)
        {
                int     spell = -1;
                int     num = 0;
-               byte    spells[64];
+               SPELL_IDX    spells[64];
 
                /* Extract spells */
                for (spell = 0; spell < 32; spell++)
@@ -6901,7 +6735,7 @@ object_type *choose_warning_item(void)
  * @param max 算出した最大ダメージを返すポインタ
  * @return なし
  */
-static void spell_damcalc(monster_type *m_ptr, int typ, int dam, int *max)
+static void spell_damcalc(monster_type *m_ptr, int typ, HIT_POINT dam, int *max)
 {
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
        int          rlev = r_ptr->level;
@@ -7141,16 +6975,15 @@ static void spell_damcalc(monster_type *m_ptr, int typ, int dam, int *max)
 * @brief 警告基準を定めるために魔法の効果属性に基づいて最大魔法ダメージを計算する。 /
 * Calculate spell damages
 * @param spell_num RF4ならRF4_SPELL_STARTのように32区切りのベースとなる数値
-* @param spell_flag RF4_SHRIEKなどのスペルフラグ
 * @param typ 効果属性のID
 * @param m_idx 魔法を行使するモンスターのID
 * @param max 算出した最大ダメージを返すポインタ
 * @return なし
 */
-void spell_damcalc_by_spellnum(int spell_num, int typ, int m_idx, int *max)
+void spell_damcalc_by_spellnum(int spell_num, int typ, MONSTER_IDX m_idx, int *max)
 {
     monster_type *m_ptr = &m_list[m_idx];
-    int dam = monspell_damage((spell_num), m_idx, DAM_MAX);
+    HIT_POINT dam = monspell_damage((spell_num), m_idx, DAM_MAX);
     spell_damcalc(m_ptr, typ, dam, max);
 }
 
@@ -7273,8 +7106,8 @@ bool process_warning(int xx, int yy)
                        if (projectable(my, mx, yy, xx))
             {
                                u32b f4 = r_ptr->flags4;
-                               u32b f5 = r_ptr->flags5;
-                               u32b f6 = r_ptr->flags6;
+                               u32b f5 = r_ptr->a_ability_flags1;
+                               u32b f6 = r_ptr->a_ability_flags2;
 
                                if (!(d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
                                {
@@ -7300,7 +7133,7 @@ bool process_warning(int xx, int yy)
                 if (f4 & RF4_BR_DISE) spell_damcalc_by_spellnum(MS_BR_DISEN, GF_DISENCHANT, c_ptr->m_idx, &dam_max0);
                 if (f4 & RF4_BR_NEXU) spell_damcalc_by_spellnum(MS_BR_NEXUS, GF_NEXUS, c_ptr->m_idx, &dam_max0);
                 if (f4 & RF4_BR_TIME) spell_damcalc_by_spellnum(MS_BR_TIME, GF_TIME, c_ptr->m_idx, &dam_max0);
-                if (f4 & RF4_BR_INER) spell_damcalc_by_spellnum(MS_BR_INERTIA, GF_INERTIA, c_ptr->m_idx, &dam_max0);
+                if (f4 & RF4_BR_INER) spell_damcalc_by_spellnum(MS_BR_INERTIA, GF_INERTIAL, c_ptr->m_idx, &dam_max0);
                 if (f4 & RF4_BR_GRAV) spell_damcalc_by_spellnum(MS_BR_GRAVITY, GF_GRAVITY, c_ptr->m_idx, &dam_max0);
                 if (f4 & RF4_BR_SHAR) spell_damcalc_by_spellnum(MS_BR_SHARDS, GF_SHARDS, c_ptr->m_idx, &dam_max0);
                 if (f4 & RF4_BR_PLAS) spell_damcalc_by_spellnum(MS_BR_PLASMA, GF_PLASMA, c_ptr->m_idx, &dam_max0);
@@ -7749,7 +7582,7 @@ cptr essence_name[] =
 
 #else
 
-static cptr essence_name[] = 
+cptr essence_name[] = 
 {
        "strength",
        "intelligen.",
@@ -7864,22 +7697,15 @@ static void display_essence(void)
        {
                prt("",i,0);
        }
-#ifdef JP
-       prt("エッセンス   個数     エッセンス   個数     エッセンス   個数", 1, 8);
-#else
-       prt("Essence      Num      Essence      Num      Essence      Num ", 1, 8);
-#endif
+       prt(_("エッセンス   個数     エッセンス   個数     エッセンス   個数", 
+                 "Essence      Num      Essence      Num      Essence      Num "), 1, 8);
        for (i = 0; essence_name[i]; i++)
        {
                if (!essence_name[i][0]) continue;
                prt(format("%-11s %5d", essence_name[i], p_ptr->magic_num1[i]), 2+num%21, 8+num/21*22);
                num++;
        }
-#ifdef JP
-       prt("現在所持しているエッセンス", 0, 0);
-#else
-       prt("List of all essences you have.", 0, 0);
-#endif
+       prt(_("現在所持しているエッセンス", "List of all essences you have."), 0, 0);
        (void)inkey();
        screen_load();
        return;
@@ -7892,14 +7718,18 @@ static void display_essence(void)
 static void drain_essence(void)
 {
        int drain_value[sizeof(p_ptr->magic_num1) / sizeof(s32b)];
-       int i, item;
+       int i;
+       OBJECT_IDX item;
        int dec = 4;
        bool observe = FALSE;
-       int old_ds, old_dd, old_to_h, old_to_d, old_ac, old_to_a, old_pval, old_name2, old_timeout;
+       int old_ds, old_dd, old_to_h, old_to_d, old_ac, old_to_a, old_pval, old_name2;
+       TIME_EFFECT old_timeout;
        u32b old_flgs[TR_FLAG_SIZE], new_flgs[TR_FLAG_SIZE];
        object_type *o_ptr;
-       cptr            q, s;
-       byte iy, ix, marked, number;
+       cptr q, s;
+       POSITION iy, ix;
+       byte_hack marked;
+       ITEM_NUMBER number;
        s16b next_o_idx, weight;
 
        for (i = 0; i < sizeof(drain_value) / sizeof(int); i++)
@@ -7909,13 +7739,8 @@ static void drain_essence(void)
        item_tester_no_ryoute = TRUE;
 
        /* Get an item */
-#ifdef JP
-       q = "どのアイテムから抽出しますか?";
-       s = "抽出できるアイテムがありません。";
-#else
-       q = "Extract from which item? ";
-       s = "You have nothing you can extract from.";
-#endif
+       q = _("どのアイテムから抽出しますか?", "Extract from which item? ");
+       s = _("抽出できるアイテムがありません。", "You have nothing you can extract from.");
 
        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
 
@@ -7935,14 +7760,10 @@ static void drain_essence(void)
        {
                char o_name[MAX_NLEN];
                object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-#ifdef JP
-               if (!get_check(format("本当に%sから抽出してよろしいですか?", o_name))) return;
-#else
-               if (!get_check(format("Really extract from %s? ", o_name))) return;
-#endif
+               if (!get_check(format(_("本当に%sから抽出してよろしいですか?", "Really extract from %s? "), o_name))) return;
        }
 
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        object_flags(o_ptr, old_flgs);
        if (have_flag(old_flgs, TR_KILL_DRAGON)) add_flag(old_flgs, TR_SLAY_DRAGON);
@@ -8009,7 +7830,7 @@ static void drain_essence(void)
        for (i = 0; essence_info[i].add_name; i++)
        {
                essence_type *es_ptr = &essence_info[i];
-               int pval = 0;
+               PARAMETER_VALUE pval = 0;
 
                if (es_ptr->add < TR_FLAG_MAX && is_pval_flag(es_ptr->add) && old_pval)
                        pval = (have_flag(new_flgs, es_ptr->add)) ? old_pval - o_ptr->pval : old_pval;
@@ -8139,9 +7960,9 @@ static void drain_essence(void)
  */
 static int choose_essence(void)
 {
-       int mode = 0;
+       COMMAND_CODE mode = 0;
        char choice;
-       int menu_line = (use_menu ? 1 : 0);
+       COMMAND_CODE menu_line = (use_menu ? 1 : 0);
 
 #ifdef JP
        cptr menu_name[] = {
@@ -8227,17 +8048,13 @@ static int choose_essence(void)
                        for (i = 0; i < mode_max; i++)
                                prt(format("  %c) %s", 'a' + i, menu_name[i]), 2 + i, 14);
 
-#ifdef JP
-                       if (!get_com("何を付加しますか:", &choice, TRUE))
-#else
-                       if (!get_com("Command :", &choice, TRUE))
-#endif
+                       if (!get_com(_("何を付加しますか:", "Command :"), &choice, TRUE))
                        {
                                screen_load();
                                return 0;
                        }
 
-                       if (isupper(choice)) choice = tolower(choice);
+                       if (isupper(choice)) choice = (char)tolower(choice);
 
                        if ('a' <= choice && choice <= 'a' + (char)mode_max - 1)
                                mode = (int)choice - 'a' + 1;
@@ -8258,8 +8075,9 @@ static int choose_essence(void)
  */
 static void add_essence(int mode)
 {
-       int item, max_num = 0;
-       int i;
+       OBJECT_IDX item;
+       int max_num = 0;
+       COMMAND_CODE i;
        bool flag,redraw;
        char choice;
        cptr            q, s;
@@ -8294,11 +8112,7 @@ static void add_essence(int mode)
        redraw = FALSE;
 
        /* Build a prompt */
-#ifdef JP
-       (void) strnfmt(out_val, 78, "('*'で一覧, ESCで中断) どの能力を付加しますか?");
-#else
-       (void)strnfmt(out_val, 78, "(*=List, ESC=exit) Add which ability? ");
-#endif
+       (void) strnfmt(out_val, 78, _("('*'で一覧, ESCで中断) どの能力を付加しますか?", "(*=List, ESC=exit) Add which ability? "));
        if (use_menu) screen_save();
 
        /* Get a spell from the user */
@@ -8400,11 +8214,7 @@ static void add_essence(int mode)
                                        if (use_menu)
                                        {
                                                if (ctr == (menu_line-1))
-#ifdef JP
-                                                       strcpy(dummy, "》 ");
-#else
-                                                       strcpy(dummy, ">  ");
-#endif
+                                                       strcpy(dummy, _("》 ", ">  "));
                                                else strcpy(dummy, "   ");
                                                
                                        }
@@ -8429,49 +8239,29 @@ static void add_essence(int mode)
                                                switch(es_ptr->add)
                                                {
                                                case ESSENCE_SH_FIRE:
-#ifdef JP
-                                                       strcat(dummy, "(焼棄+耐火炎)");
-#else
-                                                       strcat(dummy, "(brand fire + res.fire)");
-#endif
+                                                       strcat(dummy, _("(焼棄+耐火炎)", "(brand fire + res.fire)"));
                                                        if (p_ptr->magic_num1[TR_BRAND_FIRE] < es_ptr->value) able[ctr] = FALSE;
                                                        if (p_ptr->magic_num1[TR_RES_FIRE] < es_ptr->value) able[ctr] = FALSE;
                                                        break;
                                                case ESSENCE_SH_ELEC:
-#ifdef JP
-                                                       strcat(dummy, "(電撃+耐電撃)");
-#else
-                                                       strcat(dummy, "(brand elec. + res. elec.)");
-#endif
+                                                       strcat(dummy, _("(電撃+耐電撃)", "(brand elec. + res. elec.)"));
                                                        if (p_ptr->magic_num1[TR_BRAND_ELEC] < es_ptr->value) able[ctr] = FALSE;
                                                        if (p_ptr->magic_num1[TR_RES_ELEC] < es_ptr->value) able[ctr] = FALSE;
                                                        break;
                                                case ESSENCE_SH_COLD:
-#ifdef JP
-                                                       strcat(dummy, "(凍結+耐冷気)");
-#else
-                                                       strcat(dummy, "(brand cold + res. cold)");
-#endif
+                                                       strcat(dummy, _("(凍結+耐冷気)", "(brand cold + res. cold)"));
                                                        if (p_ptr->magic_num1[TR_BRAND_COLD] < es_ptr->value) able[ctr] = FALSE;
                                                        if (p_ptr->magic_num1[TR_RES_COLD] < es_ptr->value) able[ctr] = FALSE;
                                                        break;
                                                case ESSENCE_RESISTANCE:
-#ifdef JP
-                                                       strcat(dummy, "(耐火炎+耐冷気+耐電撃+耐酸)");
-#else
-                                                       strcat(dummy, "(r.fire+r.cold+r.elec+r.acid)");
-#endif
+                                                       strcat(dummy, _("(耐火炎+耐冷気+耐電撃+耐酸)", "(r.fire+r.cold+r.elec+r.acid)"));
                                                        if (p_ptr->magic_num1[TR_RES_FIRE] < es_ptr->value) able[ctr] = FALSE;
                                                        if (p_ptr->magic_num1[TR_RES_COLD] < es_ptr->value) able[ctr] = FALSE;
                                                        if (p_ptr->magic_num1[TR_RES_ELEC] < es_ptr->value) able[ctr] = FALSE;
                                                        if (p_ptr->magic_num1[TR_RES_ACID] < es_ptr->value) able[ctr] = FALSE;
                                                        break;
                                                case ESSENCE_SUSTAIN:
-#ifdef JP
-                                                       strcat(dummy, "(耐火炎+耐冷気+耐電撃+耐酸)");
-#else
-                                                       strcat(dummy, "(r.fire+r.cold+r.elec+r.acid)");
-#endif
+                                                       strcat(dummy, _("(耐火炎+耐冷気+耐電撃+耐酸)", "(r.fire+r.cold+r.elec+r.acid)"));
                                                        if (p_ptr->magic_num1[TR_RES_FIRE] < es_ptr->value) able[ctr] = FALSE;
                                                        if (p_ptr->magic_num1[TR_RES_COLD] < es_ptr->value) able[ctr] = FALSE;
                                                        if (p_ptr->magic_num1[TR_RES_ELEC] < es_ptr->value) able[ctr] = FALSE;
@@ -8515,7 +8305,7 @@ static void add_essence(int mode)
                        ask = (isupper(choice));
 
                        /* Lowercase */
-                       if (ask) choice = tolower(choice);
+                       if (ask) choice = (char)tolower(choice);
 
                        /* Extract request */
                        i = (islower(choice) ? A2I(choice) : -1);
@@ -8534,11 +8324,7 @@ static void add_essence(int mode)
                        char tmp_val[160];
 
                        /* Prompt */
-#ifdef JP
-                       (void) strnfmt(tmp_val, 78, "%sを付加しますか? ", essence_info[num[i]].add_name);
-#else
-                       (void) strnfmt(tmp_val, 78, "Add the abilitiy of %s? ", essence_info[num[i]].add_name);
-#endif
+                       (void) strnfmt(tmp_val, 78, _("%sを付加しますか? ", "Add the abilitiy of %s? "), essence_info[num[i]].add_name);
 
                        /* Belay that order */
                        if (!get_check(tmp_val)) continue;
@@ -8573,13 +8359,8 @@ static void add_essence(int mode)
        item_tester_no_ryoute = TRUE;
 
        /* Get an item */
-#ifdef JP
-       q = "どのアイテムを改良しますか?";
-       s = "改良できるアイテムがありません。";
-#else
-       q = "Improve which item? ";
-       s = "You have nothing to improve.";
-#endif
+       q = _("どのアイテムを改良しますか?", "Improve which item? ");
+       s = _("改良できるアイテムがありません。", "You have nothing to improve.");
 
        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
 
@@ -8597,11 +8378,7 @@ static void add_essence(int mode)
 
        if ((mode != 10) && (object_is_artifact(o_ptr) || object_is_smith(o_ptr)))
        {
-#ifdef JP
-               msg_print("そのアイテムはこれ以上改良できない。");
-#else
-               msg_print("This item is no more able to be improved.");
-#endif
+               msg_print(_("そのアイテムはこれ以上改良できない。", "This item is no more able to be improved."));
                return;
        }
 
@@ -8612,97 +8389,60 @@ static void add_essence(int mode)
        if (o_ptr->number > 1)
        {
                use_essence *= o_ptr->number;
-#ifdef JP
-               msg_format("%d個あるのでエッセンスは%d必要です。", o_ptr->number, use_essence);
-#else
-               msg_format("It will take %d essences.",use_essence);
-#endif
-
+               msg_format(_("%d個あるのでエッセンスは%d必要です。", "It will take %d essences."), o_ptr->number, use_essence);
        }
 
        if (es_ptr->essence != -1)
        {
                if (p_ptr->magic_num1[es_ptr->essence] < use_essence)
                {
-#ifdef JP
-                       msg_print("エッセンスが足りない。");
-#else
-                       msg_print("You don't have enough essences.");
-#endif
+                       msg_print(_("エッセンスが足りない。", "You don't have enough essences."));
                        return;
                }
                if (is_pval_flag(es_ptr->add))
                {
                        if (o_ptr->pval < 0)
                        {
-#ifdef JP
-                               msg_print("このアイテムの能力修正を強化することはできない。");
-#else
-                               msg_print("You cannot increase magic number of this item.");
-#endif
+                               msg_print(_("このアイテムの能力修正を強化することはできない。", "You cannot increase magic number of this item."));
                                return;
                        }
                        else if (es_ptr->add == TR_BLOWS)
                        {
                                if (o_ptr->pval > 1)
                                {
-#ifdef JP
-                                       if (!get_check("修正値は1になります。よろしいですか?")) return;
-#else
-                                       if (!get_check("The magic number of this weapon will become 1. Are you sure? ")) return;
-#endif
+                                       if (!get_check(_("修正値は1になります。よろしいですか?", "The magic number of this weapon will become 1. Are you sure? "))) return;
                                }
 
                                o_ptr->pval = 1;
-#ifdef JP
-                               msg_format("エッセンスを%d個使用します。", use_essence);
-#else
-                               msg_format("It will take %d essences.", use_essence);
-#endif
+                               msg_format(_("エッセンスを%d個使用します。", "It will take %d essences."), use_essence);
                        }
                        else if (o_ptr->pval > 0)
                        {
                                use_essence *= o_ptr->pval;
-#ifdef JP
-                               msg_format("エッセンスを%d個使用します。", use_essence);
-#else
-                               msg_format("It will take %d essences.", use_essence);
-#endif
+                               msg_format(_("エッセンスを%d個使用します。", "It will take %d essences."), use_essence);
                        }
                        else
                        {
                                char tmp[80];
                                char tmp_val[160];
-                               int pval;
-                               int limit = MIN(5, p_ptr->magic_num1[es_ptr->essence]/es_ptr->value);
+                               PARAMETER_VALUE pval;
+                               PARAMETER_VALUE limit = MIN(5, p_ptr->magic_num1[es_ptr->essence]/es_ptr->value);
 
-#ifdef JP
-                               sprintf(tmp, "いくつ付加しますか? (1-%d): ", limit);
-#else
-                               sprintf(tmp, "Enchant how many? (1-%d): ", limit);
-#endif
+                               sprintf(tmp, _("いくつ付加しますか? (1-%d): ", "Enchant how many? (1-%d): "), limit);
                                strcpy(tmp_val, "1");
 
                                if (!get_string(tmp, tmp_val, 1)) return;
-                               pval = atoi(tmp_val);
+                               pval = (PARAMETER_VALUE)atoi(tmp_val);
                                if (pval > limit) pval = limit;
                                else if (pval < 1) pval = 1;
                                o_ptr->pval += pval;
                                use_essence *= pval;
-#ifdef JP
-                               msg_format("エッセンスを%d個使用します。", use_essence);
-#else
-                               msg_format("It will take %d essences.", use_essence);
-#endif
+                               msg_format(_("エッセンスを%d個使用します。", "It will take %d essences."), use_essence);
                        }
 
                        if (p_ptr->magic_num1[es_ptr->essence] < use_essence)
                        {
-#ifdef JP
-                               msg_print("エッセンスが足りない。");
-#else
-                               msg_print("You don't have enough essences.");
-#endif
+                               msg_print(_("エッセンスが足りない。", "You don't have enough essences."));
                                return;
                        }
                }
@@ -8710,30 +8450,19 @@ static void add_essence(int mode)
                {
                        char tmp_val[160];
                        int val;
-                       int get_to_h, get_to_d;
+                       HIT_PROB get_to_h;
+                       HIT_POINT get_to_d;
 
                        strcpy(tmp_val, "1");
-#ifdef JP
-                       if (!get_string(format("いくつ付加しますか? (1-%d):", p_ptr->lev/7+3), tmp_val, 2)) return;
-#else
-                       if (!get_string(format("Enchant how many? (1-%d):", p_ptr->lev/7+3), tmp_val, 2)) return;
-#endif
+                       if (!get_string(format(_("いくつ付加しますか? (1-%d):", "Enchant how many? (1-%d):"), p_ptr->lev/7+3), tmp_val, 2)) return;
                        val = atoi(tmp_val);
                        if (val > p_ptr->lev/7+3) val = p_ptr->lev/7+3;
                        else if (val < 1) val = 1;
                        use_essence *= val;
-#ifdef JP
-                       msg_format("エッセンスを%d個使用します。", use_essence);
-#else
-                       msg_format("It will take %d essences.", use_essence);
-#endif
+                       msg_format(_("エッセンスを%d個使用します。", "It will take %d essences."), use_essence);
                        if (p_ptr->magic_num1[es_ptr->essence] < use_essence)
                        {
-#ifdef JP
-                               msg_print("エッセンスが足りない。");
-#else
-                               msg_print("You don't have enough essences.");
-#endif
+                               msg_print(_("エッセンスが足りない。", "You don't have enough essences."));
                                return;
                        }
                        get_to_h = ((val+1)/2+randint0(val/2+1));
@@ -8747,12 +8476,8 @@ static void add_essence(int mode)
                {
                        if ((o_ptr->to_h >= p_ptr->lev/5+5) && (o_ptr->to_d >= p_ptr->lev/5+5))
                        {
-#ifdef JP
-                               msg_print("改良に失敗した。");
-#else
-                               msg_print("You failed to enchant.");
-#endif
-                               energy_use = 100;
+                               msg_print(_("改良に失敗した。", "You failed to enchant."));
+                               p_ptr->energy_use = 100;
                                return;
                        }
                        else
@@ -8765,12 +8490,8 @@ static void add_essence(int mode)
                {
                        if (o_ptr->to_a >= p_ptr->lev/5+5)
                        {
-#ifdef JP
-                               msg_print("改良に失敗した。");
-#else
-                               msg_print("You failed to enchant.");
-#endif
-                               energy_use = 100;
+                               msg_print(_("改良に失敗した。", "You failed to enchant."));
+                               p_ptr->energy_use = 100;
                                return;
                        }
                        else
@@ -8831,11 +8552,7 @@ static void add_essence(int mode)
                }
                if (!success)
                {
-#ifdef JP
-                       msg_print("エッセンスが足りない。");
-#else
-                       msg_print("You don't have enough essences.");
-#endif
+                       msg_print(_("エッセンスが足りない。", "You don't have enough essences."));
                        return;
                }
                if (es_ptr->add == ESSENCE_SUSTAIN)
@@ -8851,7 +8568,7 @@ static void add_essence(int mode)
                }
        }
 
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
 #ifdef JP
        msg_format("%sに%sの能力を付加しました。", o_name, es_ptr->add_name);
@@ -8872,22 +8589,17 @@ static void add_essence(int mode)
  */
 static void erase_essence(void)
 {
-       int item;
+       OBJECT_IDX item;
        cptr q, s;
        object_type *o_ptr;
        char o_name[MAX_NLEN];
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
 
        item_tester_hook = object_is_smith;
 
        /* Get an item */
-#ifdef JP
-       q = "どのアイテムのエッセンスを消去しますか?";
-       s = "エッセンスを付加したアイテムがありません。";
-#else
-       q = "Remove from which item? ";
-       s = "You have nothing to remove essence.";
-#endif
+       q = _("どのアイテムのエッセンスを消去しますか?", "Remove from which item? ");
+       s = _("エッセンスを付加したアイテムがありません。", "You have nothing to remove essence.");
 
        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
 
@@ -8904,13 +8616,9 @@ static void erase_essence(void)
        }
 
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-#ifdef JP
-       if (!get_check(format("よろしいですか? [%s]", o_name))) return;
-#else
-       if (!get_check(format("Are you sure? [%s]", o_name))) return;
-#endif
+       if (!get_check(format(_("よろしいですか? [%s]", "Are you sure? [%s]"), o_name))) return;
 
-       energy_use = 100;
+       p_ptr->energy_use = 100;
 
        if (o_ptr->xtra3 == 1+ESSENCE_SLAY_GLOVE)
        {
@@ -8923,11 +8631,7 @@ static void erase_essence(void)
        o_ptr->xtra3 = 0;
        object_flags(o_ptr, flgs);
        if (!(have_pval_flags(flgs))) o_ptr->pval = 0;
-#ifdef JP
-       msg_print("エッセンスを取り去った。");
-#else
-       msg_print("You removed all essence you have added.");
-#endif
+       msg_print(_("エッセンスを取り去った。", "You removed all essence you have added."));
 
        /* Combine the pack */
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
@@ -8943,7 +8647,7 @@ static void erase_essence(void)
  */
 void do_cmd_kaji(bool only_browse)
 {
-       int mode = 0;
+       IDX mode = 0;
        char choice;
 
        int menu_line = (use_menu ? 1 : 0);
@@ -8952,32 +8656,17 @@ void do_cmd_kaji(bool only_browse)
        {
                if (p_ptr->confused)
                {
-#ifdef JP
-                       msg_print("混乱していて作業できない!");
-#else
-                       msg_print("You are too confused!");
-#endif
-
+                       msg_print(_("混乱していて作業できない!", "You are too confused!"));
                        return;
                }
                if (p_ptr->blind)
                {
-#ifdef JP
-                       msg_print("目が見えなくて作業できない!");
-#else
-                       msg_print("You are blind!");
-#endif
-
+                       msg_print(_("目が見えなくて作業できない!", "You are blind!"));
                        return;
                }
                if (p_ptr->image)
                {
-#ifdef JP
-                       msg_print("うまく見えなくて作業できない!");
-#else
-                       msg_print("You are hallucinating!");
-#endif
-
+                       msg_print(_("うまく見えなくて作業できない!", "You are hallucinating!"));
                        return;
                }
        }