OSDN Git Service

#37449 (2.2.0.75) ゲームメッセージのログ拡張に伴って発生したセーブデータのトラブルを修正。 / Fix trouble of savedata...
[hengband/hengband.git] / src / load.c
index f8bbd51..11db047 100644 (file)
@@ -1,19 +1,14 @@
-/* File: load.c */
-
-/*
- * Copyright (c) 1997 Ben Harrison, and others
+/*!
+ * @file load.c
+ * @brief セーブファイル読み込み処理 / Purpose: support for loading savefiles -BEN-
+ * @date 2014/07/07
+ * @author
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
  *
  * This software may be copied and distributed for educational, research,
  * and not for profit purposes provided that this copyright and statement
  * are included in all such copies.  Other copyrights may also apply.
- */
-
-/* Purpose: support for loading savefiles -BEN- */
-
-#include "angband.h"
-
-
-/*
+ * @details
  * This file loads savefiles from Angband 2.7.X and 2.8.X
  *
  * Ancient savefiles (pre-2.7.0) are loaded by another file.
@@ -45,6 +40,7 @@
  * XXX XXX XXX
  */
 
+#include "angband.h"
 
 
 /*
@@ -82,9 +78,13 @@ static u32b  x_check = 0L;
  */
 static byte kanji_code = 0;
 
-/*
- * This function determines if the version of the savefile
- * currently being read is older than version "major.minor.patch.extra".
+/*!
+ * @brief 変愚蛮怒のバージョン比較処理 / This function determines if the version of the savefile currently being read is older than version "major.minor.patch.extra".
+ * @param major メジャーバージョン値
+ * @param minor マイナーバージョン値
+ * @param patch パッチバージョン値
+ * @param extra エクストラパージョン値
+ * @return 現在のバージョンより値が古いならtrue
  */
 static bool h_older_than(byte major, byte minor, byte patch, byte extra)
 {
@@ -109,8 +109,12 @@ static bool h_older_than(byte major, byte minor, byte patch, byte extra)
 }
 
 
-/*
- * The above function, adapted for Zangband
+/*!
+ * @brief Zangbandのバージョン比較処理 / The above function, adapted for Zangband
+ * @param x メジャーバージョン値
+ * @param y マイナーバージョン値
+ * @param z パッチバージョン値
+ * @return 現在のバージョンより値が古いならtrue
  */
 static bool z_older_than(byte x, byte y, byte z)
 {
@@ -131,9 +135,11 @@ static bool z_older_than(byte x, byte y, byte z)
 }
 
 
-/*
- * Hack -- Show information on the screen, one line at a time.
- *
+/*!
+ * @brief ゲームスクリーンにメッセージを表示する / Hack -- Show information on the screen, one line at a time.
+ * @param msg 表示文字列
+ * @return なし
+ * @details
  * Avoid the top two lines, to avoid interference with "msg_print()".
  */
 static void note(cptr msg)
@@ -151,11 +157,13 @@ static void note(cptr msg)
 }
 
 
-/*
+/*!
+ * @brief ロードファイルポインタから1バイトを読み込む
+ * @return 読み込んだバイト値
+ * @details
  * The following functions are used to load the basic building blocks
  * of savefiles.  They also maintain the "checksum" info for 2.7.0+
  */
-
 static byte sf_get(void)
 {
        byte c, v;
@@ -173,22 +181,42 @@ static byte sf_get(void)
        return (v);
 }
 
+/*!
+ * @brief ロードファイルポインタから1バイトを読み込んでポインタに渡す
+ * @param ip 読み込みポインタ
+ * @return なし
+ */
 static void rd_byte(byte *ip)
 {
        *ip = sf_get();
 }
 
+/*!
+ * @brief ロードファイルポインタから符号なし16bit値を読み込んでポインタに渡す
+ * @param ip 読み込みポインタ
+ * @return なし
+ */
 static void rd_u16b(u16b *ip)
 {
        (*ip) = sf_get();
        (*ip) |= ((u16b)(sf_get()) << 8);
 }
 
+/*!
+ * @brief ロードファイルポインタから符号つき16bit値を読み込んでポインタに渡す
+ * @param ip 読み込みポインタ
+ * @return なし
+ */
 static void rd_s16b(s16b *ip)
 {
        rd_u16b((u16b*)ip);
 }
 
+/*!
+ * @brief ロードファイルポインタから符号なし32bit値を読み込んでポインタに渡す
+ * @param ip 読み込みポインタ
+ * @return なし
+ */
 static void rd_u32b(u32b *ip)
 {
        (*ip) = sf_get();
@@ -197,14 +225,22 @@ static void rd_u32b(u32b *ip)
        (*ip) |= ((u32b)(sf_get()) << 24);
 }
 
+/*!
+ * @brief ロードファイルポインタから符号つき32bit値を読み込んでポインタに渡す
+ * @param ip 読み込みポインタ
+ * @return なし
+ */
 static void rd_s32b(s32b *ip)
 {
        rd_u32b((u32b*)ip);
 }
 
 
-/*
- * Hack -- read a string
+/*!
+ * @brief ロードファイルポインタから文字列を読み込んでポインタに渡す / Hack -- read a string
+ * @param str 読み込みポインタ
+ * @param max 最大読み取りバイト数
+ * @return なし
  */
 static void rd_string(char *str, int max)
 {
@@ -249,10 +285,10 @@ static void rd_string(char *str, int max)
 
        case 0:
        {
-               /* ÉÔÌÀ¤Î´Á»ú¥³¡¼¥É¤«¤é¥·¥¹¥Æ¥à¤Î´Á»ú¥³¡¼¥É¤ËÊÑ´¹ */
+               /* 不明の漢字コードからシステムの漢字コードに変換 */
                byte code = codeconv(str);
 
-               /* ´Á»ú¥³¡¼¥É¤¬È½ÌÀ¤·¤¿¤é¡¢¤½¤ì¤òµ­Ï¿ */
+               /* 漢字コードが判明したら、それを記録 */
                if (code) kanji_code = code;
 
                break;
@@ -265,8 +301,10 @@ static void rd_string(char *str, int max)
 }
 
 
-/*
- * Hack -- strip some bytes
+/*!
+ * @brief ロードファイルポインタを指定バイト分飛ばして進める / Hack -- strip some bytes
+ * @param n スキップバイト数
+ * @return なし
  */
 static void strip_bytes(int n)
 {
@@ -278,9 +316,11 @@ static void strip_bytes(int n)
 
 #define OLD_MAX_MANE 22
 
-/*
- * Read an object (Old method)
- *
+/*!
+ * @brief アイテムオブジェクト1件を読み込む(変愚ver1.5.0以前) / Read an object (Old method)
+ * @param o_ptr アイテムオブジェクト読み取り先ポインタ
+ * @return なし
+ * @details
  * This function attempts to "repair" old savefiles, and to extract
  * the most up to date values for various object fields.
  *
@@ -543,8 +583,10 @@ static void rd_item_old(object_type *o_ptr)
 }
 
 
-/*
- * Read an object (New method)
+/*!
+ * @brief アイテムオブジェクトを読み込む(現版) / Read an object (New method)
+ * @param o_ptr アイテムオブジェクト保存先ポインタ
+ * @return なし
  */
 static void rd_item(object_type *o_ptr)
 {
@@ -723,8 +765,10 @@ static void rd_item(object_type *o_ptr)
 }
 
 
-/*
- * Read a monster (Old method)
+/*!
+ * @brief モンスターを読み込む(変愚ver1.5.0以前) / Read a monster (Old method)
+ * @param m_ptr モンスター保存先ポインタ
+ * @return なし
  */
 static void rd_monster_old(monster_type *m_ptr)
 {
@@ -865,8 +909,10 @@ static void rd_monster_old(monster_type *m_ptr)
 }
 
 
-/*
- * Read a monster (New method)
+/*!
+ * @brief モンスターを読み込む(現版) / Read a monster (New method)
+ * @param m_ptr モンスター保存先ポインタ
+ * @return なし
  */
 static void rd_monster(monster_type *m_ptr)
 {
@@ -1026,8 +1072,11 @@ static void rd_monster(monster_type *m_ptr)
 #define RF4_BR_GRAV         0x00800000  /* Breathe Gravity */
 #define RF4_BR_SHAR         0x01000000  /* Breathe Shards */
 #define RF4_BR_WALL         0x04000000  /* Breathe Force */
-/*
- * Read the monster lore
+
+/*!
+ * @brief モンスターの思い出を読み込む / Read the monster lore
+ * @param r_idx 読み込み先モンスターID
+ * @return なし
  */
 static void rd_lore(int r_idx)
 {
@@ -1133,17 +1182,17 @@ static void rd_lore(int r_idx)
        r_ptr->r_flags2 &= r_ptr->flags2;
        r_ptr->r_flags3 &= r_ptr->flags3;
        r_ptr->r_flags4 &= r_ptr->flags4;
-       r_ptr->r_flags5 &= r_ptr->flags5;
-       r_ptr->r_flags6 &= r_ptr->flags6;
+       r_ptr->r_flags5 &= r_ptr->a_ability_flags1;
+       r_ptr->r_flags6 &= r_ptr->a_ability_flags2;
        r_ptr->r_flagsr &= r_ptr->flagsr;
 }
 
-
-
-
-/*
- * Add the item "o_ptr" to the inventory of the "Home"
- *
+/*!
+ * @brief 店置きのアイテムオブジェクトを読み込む / Add the item "o_ptr" to the inventory of the "Home"
+ * @param st_ptr 店舗の参照ポインタ
+ * @param o_ptr アイテムオブジェクト参照ポインタ
+ * @return なし
+ * @details
  * In all cases, return the slot (or -1) where the object was placed
  *
  * Note that this is a hacked up version of "inven_carry()".
@@ -1208,9 +1257,11 @@ static void home_carry(store_type *st_ptr, object_type *o_ptr)
        return;
 }
 
-
-/*
- * Read a store
+/*!
+ * @brief 店舗情報を読み込む / Read a store
+ * @param town_number 街ID 
+ * @param store_number 店舗ID
+ * @return エラーID
  */
 static errr rd_store(int town_number, int store_number)
 {
@@ -1294,9 +1345,9 @@ static errr rd_store(int town_number, int store_number)
 }
 
 
-
-/*
- * Read RNG state (added in 2.8.0)
+/*!
+ * @brief 乱数状態を読み込む / Read RNG state (added in 2.8.0)
+ * @return なし
  */
 static void rd_randomizer(void)
 {
@@ -1319,9 +1370,10 @@ static void rd_randomizer(void)
 
 
 
-/*
- * Read options (ignore most pre-2.8.0 options)
- *
+/*!
+ * @brief ゲームオプションを読み込む / Read options (ignore most pre-2.8.0 options)
+ * @return なし
+ * @details
  * Note that the normal options are now stored as a set of 256 bit flags,
  * plus a set of 256 bit masks to indicate which bit flags were defined
  * at the time the savefile was created.  This will allow new options
@@ -1384,6 +1436,7 @@ static void rd_options(void)
        cheat_know = (c & 0x1000) ? TRUE : FALSE;
        cheat_live = (c & 0x2000) ? TRUE : FALSE;
        cheat_save = (c & 0x4000) ? TRUE : FALSE;
+       cheat_diary_output = (c & 0x8000) ? TRUE : FALSE;
 
        rd_byte((byte *)&autosave_l);
        rd_byte((byte *)&autosave_t);
@@ -1495,11 +1548,10 @@ static void rd_options(void)
 
 
 
-
-
-/*
- * Hack -- strip the "ghost" info
- *
+/*!
+ * @brief ダミー情報スキップ / Hack -- strip the "ghost" info
+ * @return なし
+ * @details
  * XXX XXX XXX This is such a nasty hack it hurts.
  */
 static void rd_ghost(void)
@@ -1514,8 +1566,9 @@ static void rd_ghost(void)
 }
 
 
-/*
- * Save quick start data
+/*!
+ * @brief クイックスタート情報を読み込む / Load quick start data
+ * @return なし
  */
 static void load_quick_start(void)
 {
@@ -1559,8 +1612,9 @@ static void load_quick_start(void)
        previous_char.quick_ok = (bool)tmp8u;
 }
 
-/*
- * Read the "extra" information
+/*!
+ * @brief その他の情報を読み込む / Read the "extra" information
+ * @return なし
  */
 static void rd_extra(void)
 {
@@ -1570,7 +1624,7 @@ static void rd_extra(void)
        s16b tmp16s;
        u16b tmp16u;
 
-       rd_string(player_name, sizeof(player_name));
+       rd_string(p_ptr->name, sizeof(p_ptr->name));
 
        rd_string(p_ptr->died_from, sizeof(p_ptr->died_from));
 
@@ -1651,7 +1705,7 @@ static void rd_extra(void)
                for (i = 0; i < 5; i++) for (j = 0; j < 60; j++) rd_s16b(&p_ptr->weapon_exp[i][j]);
        else
                for (i = 0; i < 5; i++) for (j = 0; j < 64; j++) rd_s16b(&p_ptr->weapon_exp[i][j]);
-       for (i = 0; i < 10; i++) rd_s16b(&p_ptr->skill_exp[i]);
+       for (i = 0; i < GINOU_MAX; i++) rd_s16b(&p_ptr->skill_exp[i]);
        if (z_older_than(10, 4, 1))
        {
                if (p_ptr->pclass != CLASS_BEASTMASTER) p_ptr->skill_exp[GINOU_RIDING] /= 2;
@@ -1696,7 +1750,7 @@ static void rd_extra(void)
 
        if (z_older_than(10, 0, 1))
        {
-               for (i = 0; i < OLD_MAX_MANE; i++)
+               for (i = 0; i < MAX_MANE; i++)
                {
                        p_ptr->mane_spell[i] = -1;
                        p_ptr->mane_dam[i] = 0;
@@ -2206,11 +2260,10 @@ static void rd_extra(void)
 }
 
 
-
-
-/*
- * Read the player inventory
- *
+/*!
+ * @brief プレイヤーの所持品情報を読み込む / Read the player inventory
+ * @return なし
+ * @details
  * Note that the inventory changed in Angband 2.7.4.  Two extra
  * pack slots were added and the equipment was rearranged.  Note
  * that these two features combine when parsing old save-files, in
@@ -2276,12 +2329,7 @@ static errr rd_inventory(void)
                else if (inven_cnt == INVEN_PACK)
                {
                        /* Oops */
-#ifdef JP
-note("»ý¤Áʪ¤ÎÃæ¤Î¥¢¥¤¥Æ¥à¤¬Â¿¤¹¤®¤ë¡ª");
-#else
-                       note("Too many items in the inventory!");
-#endif
-
+                       note(_("持ち物の中のアイテムが多すぎる!", "Too many items in the inventory!"));
 
                        /* Fail */
                        return (54);
@@ -2312,29 +2360,49 @@ note("
 }
 
 
-
-/*
- * Read the saved messages
+/*!
+ * @brief メッセージログを読み込む / Read the saved messages
+ * @return なし
  */
 static void rd_messages(void)
 {
        int i;
        char buf[128];
 
-       s16b num;
 
-       /* Total */
-       rd_s16b(&num);
+       if (h_older_than(2, 2, 0, 75))
+       {
+               s16b num;
+               /* Total */
+               rd_s16b(&num);
+
+               /* Read the messages */
+               for (i = 0; i < num; i++)
+               {
+                       /* Read the message */
+                       rd_string(buf, sizeof(buf));
 
-       /* Read the messages */
-       for (i = 0; i < num; i++)
+                       /* Save the message */
+                       message_add(buf);
+               }
+       }
+       else
        {
-               /* Read the message */
-               rd_string(buf, sizeof(buf));
+               u32b num;
+               /* Total */
+               rd_u32b(&num);
 
-               /* Save the message */
-               message_add(buf);
+               /* Read the messages */
+               for (i = 0; i < num; i++)
+               {
+                       /* Read the message */
+                       rd_string(buf, sizeof(buf));
+
+                       /* Save the message */
+                       message_add(buf);
+               }
        }
+
 }
 
 
@@ -2358,9 +2426,10 @@ static void rd_messages(void)
 #define QUEST_OLD_CASTLE  27
 #define QUEST_ROYAL_CRYPT 28
 
-/*
- * Read the dungeon (old method)
- *
+/*!
+ * @brief メッセージログを読み込む / Read the dungeon (old method)
+ * @return なし
+ * @details
  * The monsters/objects must be loaded in the same order
  * that they were stored, since the actual indexes matter.
  */
@@ -2389,17 +2458,17 @@ static errr rd_dungeon_old(void)
 
        rd_s16b(&num_repro);
        rd_s16b(&tmp16s);
-       py = (int)tmp16s;
+       p_ptr->y = (int)tmp16s;
        rd_s16b(&tmp16s);
-       px = (int)tmp16s;
-       if (z_older_than(10, 3, 13) && !dun_level && !p_ptr->inside_arena) {py = 33;px = 131;}
+       p_ptr->x = (int)tmp16s;
+       if (z_older_than(10, 3, 13) && !dun_level && !p_ptr->inside_arena) {p_ptr->y = 33;p_ptr->x = 131;}
        rd_s16b(&cur_hgt);
        rd_s16b(&cur_wid);
        rd_s16b(&tmp16s); /* max_panel_rows */
        rd_s16b(&tmp16s); /* max_panel_cols */
 
 #if 0
-       if (!py || !px) {py = 10;px = 10;}/* ¥À¥ó¥¸¥ç¥óÀ¸À®¤Ë¼ºÇÔ¤·¤Æ¥»¥°¥á¥ó¥Æ¤Ã¤¿¤È¤­¤ÎÉüµìÍÑ */
+       if (!p_ptr->y || !p_ptr->x) {p_ptr->y = 10;p_ptr->x = 10;}/* ダンジョン生成に失敗してセグメンテったときの復旧用 */
 #endif
 
        /* Maximal size */
@@ -2650,12 +2719,7 @@ static errr rd_dungeon_old(void)
        /* Verify maximum */
        if (limit > max_o_idx)
        {
-#ifdef JP
-note(format("¥¢¥¤¥Æ¥à¤ÎÇÛÎó¤¬Â礭¤¹¤®¤ë(%d)¡ª", limit));
-#else
-               note(format("Too many (%d) object entries!", limit));
-#endif
-
+               note(format(_("アイテムの配列が大きすぎる(%d)!", "Too many (%d) object entries!"), limit));
                return (151);
        }
 
@@ -2673,12 +2737,7 @@ note(format("
                /* Oops */
                if (i != o_idx)
                {
-#ifdef JP
-note(format("¥¢¥¤¥Æ¥àÇÛÃÖ¥¨¥é¡¼ (%d <> %d)", i, o_idx));
-#else
-                       note(format("Object allocation error (%d <> %d)", i, o_idx));
-#endif
-
+                       note(format(_("アイテム配置エラー (%d <> %d)", "Object allocation error (%d <> %d)"), i, o_idx));
                        return (152);
                }
 
@@ -2730,12 +2789,7 @@ note(format("
        /* Hack -- verify */
        if (limit > max_m_idx)
        {
-#ifdef JP
-note(format("¥â¥ó¥¹¥¿¡¼¤ÎÇÛÎó¤¬Â礭¤¹¤®¤ë(%d)¡ª", limit));
-#else
-               note(format("Too many (%d) monster entries!", limit));
-#endif
-
+               note(format(_("モンスターの配列が大きすぎる(%d)!", "Too many (%d) monster entries!"), limit));
                return (161);
        }
 
@@ -2751,12 +2805,7 @@ note(format("
                /* Oops */
                if (i != m_idx)
                {
-#ifdef JP
-note(format("¥â¥ó¥¹¥¿¡¼ÇÛÃÖ¥¨¥é¡¼ (%d <> %d)", i, m_idx));
-#else
-                       note(format("Monster allocation error (%d <> %d)", i, m_idx));
-#endif
-
+                       note(format(_("モンスター配置エラー (%d <> %d)", "Monster allocation error (%d <> %d)"), i, m_idx));
                        return (162);
                }
 
@@ -2791,10 +2840,10 @@ note(format("
 }
 
 
-
-/*
- * Read the saved floor
- *
+/*!
+ * @brief 保存されたフロアを読み込む / Read the saved floor
+ * @return なし
+ * @details
  * The monsters/objects must be loaded in the same order
  * that they were stored, since the actual indexes matter.
  */
@@ -2859,10 +2908,10 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
        rd_s16b(&num_repro);
 
        rd_u16b(&tmp16u);
-       py = (int)tmp16u;
+       p_ptr->y = (int)tmp16u;
 
        rd_u16b(&tmp16u);
-       px = (int)tmp16u;
+       p_ptr->x = (int)tmp16u;
 
        rd_s16b(&cur_hgt);
        rd_s16b(&cur_wid);
@@ -3083,9 +3132,10 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
 }
 
 
-/*
- * Read the dungeon (new method)
- *
+/*!
+ * @brief 保存されたフロアを読み込む(現版) / Read the dungeon (new method)
+ * @return なし
+ * @details
  * The monsters/objects must be loaded in the same order
  * that they were stored, since the actual indexes matter.
  */
@@ -3190,59 +3240,31 @@ static errr rd_dungeon(void)
        switch (err)
        {
        case 151:
-#ifdef JP
-               note("¥¢¥¤¥Æ¥à¤ÎÇÛÎó¤¬Â礭¤¹¤®¤ë¡ª");
-#else
-               note("Too many object entries!");
-#endif
+               note(_("アイテムの配列が大きすぎる!", "Too many object entries!"));
                break;
 
        case 152:
-#ifdef JP
-               note("¥¢¥¤¥Æ¥àÇÛÃÖ¥¨¥é¡¼");
-#else
-               note("Object allocation error");
-#endif
+               note(_("アイテム配置エラー", "Object allocation error"));
                break;
 
        case 161:
-#ifdef JP
-               note("¥â¥ó¥¹¥¿¡¼¤ÎÇÛÎó¤¬Â礭¤¹¤®¤ë¡ª");
-#else
-               note("Too many monster entries!");
-#endif
+               note(_("モンスターの配列が大きすぎる!", "Too many monster entries!"));
                break;
 
        case 162:
-#ifdef JP
-               note("¥â¥ó¥¹¥¿¡¼ÇÛÃÖ¥¨¥é¡¼");
-#else
-               note("Monster allocation error");
-#endif
+               note(_("モンスター配置エラー", "Monster allocation error"));
                break;
 
        case 171:
-#ifdef JP
-               note("Êݸ¤µ¤ì¤¿¥Õ¥í¥¢¤Î¥À¥ó¥¸¥ç¥ó¥Ç¡¼¥¿¤¬²õ¤ì¤Æ¤¤¤Þ¤¹¡ª");
-#else
-               note("Dungeon data of saved floors are broken!");
-#endif
+               note(_("保存されたフロアのダンジョンデータが壊れています!", "Dungeon data of saved floors are broken!"));
                break;
 
        case 182:
-#ifdef JP
-               note("¥Æ¥ó¥Ý¥é¥ê¡¦¥Õ¥¡¥¤¥ë¤òºîÀ®¤Ç¤­¤Þ¤»¤ó¡ª");
-#else
-               note("Failed to make temporal files!");
-#endif
+               note(_("テンポラリ・ファイルを作成できません!", "Failed to make temporal files!"));
                break;
 
        case 183:
-#ifdef JP
-               note("Error 183");
-#else
-               note("Error 183");
-#endif
+               note(_("Error 183", "Error 183"));
                break;
        }
 
@@ -3254,8 +3276,9 @@ static errr rd_dungeon(void)
 }
 
 
-/*
- * Actually read the savefile
+/*!
+ * @brief ロード処理全体のサブ関数 / Actually read the savefile
+ * @return エラーコード
  */
 static errr rd_savefile_new_aux(void)
 {
@@ -3277,11 +3300,7 @@ static errr rd_savefile_new_aux(void)
 
        /* Mention the savefile version */
        note(format(
-#ifdef JP
-                    "¥Ð¡¼¥¸¥ç¥ó %d.%d.%d ¤Î¥»¡¼¥Ö¡¦¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥ÉÃæ...",
-#else
-                    "Loading a %d.%d.%d savefile...",
-#endif
+                    _("バージョン %d.%d.%d のセーブ・ファイルをロード中...", "Loading a %d.%d.%d savefile..."),
                     (z_major > 9) ? z_major - 10 : z_major, z_minor, z_patch));
 
 
@@ -3330,31 +3349,15 @@ static errr rd_savefile_new_aux(void)
 
        /* Read RNG state */
        rd_randomizer();
-#ifdef JP
-if (arg_fiddle) note("Íð¿ô¾ðÊó¤ò¥í¡¼¥É¤·¤Þ¤·¤¿");
-#else
-       if (arg_fiddle) note("Loaded Randomizer Info");
-#endif
-
-
+       if (arg_fiddle) note(_("乱数情報をロードしました", "Loaded Randomizer Info"));
 
        /* Then the options */
        rd_options();
-#ifdef JP
-if (arg_fiddle) note("¥ª¥×¥·¥ç¥ó¤ò¥í¡¼¥É¤·¤Þ¤·¤¿");
-#else
-       if (arg_fiddle) note("Loaded Option Flags");
-#endif
+       if (arg_fiddle) note(_("オプションをロードしました", "Loaded Option Flags"));
 
        /* Then the "messages" */
        rd_messages();
-#ifdef JP
-if (arg_fiddle) note("¥á¥Ã¥»¡¼¥¸¤ò¥í¡¼¥É¤·¤Þ¤·¤¿");
-#else
-       if (arg_fiddle) note("Loaded Messages");
-#endif
-
-
+       if (arg_fiddle) note(_("メッセージをロードしました", "Loaded Messages"));
 
        for (i = 0; i < max_r_idx; i++)
        {
@@ -3376,12 +3379,7 @@ if (arg_fiddle) note("
        /* Incompatible save files */
        if (tmp16u > max_r_idx)
        {
-#ifdef JP
-note(format("¥â¥ó¥¹¥¿¡¼¤Î¼ï²¤¬Â¿¤¹¤®¤ë(%u)¡ª", tmp16u));
-#else
-               note(format("Too many (%u) monster races!", tmp16u));
-#endif
-
+               note(format(_("モンスターの種族が多すぎる(%u)!", "Too many (%u) monster races!"), tmp16u));
                return (21);
        }
 
@@ -3392,13 +3390,7 @@ note(format("
                rd_lore(i);
        }
 
-#ifdef JP
-if (arg_fiddle) note("¥â¥ó¥¹¥¿¡¼¤Î»×¤¤½Ð¤ò¥í¡¼¥É¤·¤Þ¤·¤¿");
-#else
-       if (arg_fiddle) note("Loaded Monster Memory");
-#endif
-
-
+       if (arg_fiddle) note(_("モンスターの思い出をロードしました", "Loaded Monster Memory"));
 
        /* Object Memory */
        rd_u16b(&tmp16u);
@@ -3406,19 +3398,13 @@ if (arg_fiddle) note("
        /* Incompatible save files */
        if (tmp16u > max_k_idx)
        {
-#ifdef JP
-note(format("¥¢¥¤¥Æ¥à¤Î¼ïÎब¿¤¹¤®¤ë(%u)¡ª", tmp16u));
-#else
-               note(format("Too many (%u) object kinds!", tmp16u));
-#endif
-
+               note(format(_("アイテムの種類が多すぎる(%u)!", "Too many (%u) object kinds!"), tmp16u));
                return (22);
        }
 
        /* Read the object memory */
        for (i = 0; i < tmp16u; i++)
        {
-               byte tmp8u;
                object_kind *k_ptr = &k_info[i];
 
                rd_byte(&tmp8u);
@@ -3426,21 +3412,7 @@ note(format("
                k_ptr->aware = (tmp8u & 0x01) ? TRUE: FALSE;
                k_ptr->tried = (tmp8u & 0x02) ? TRUE: FALSE;
        }
-#ifdef JP
-if (arg_fiddle) note("¥¢¥¤¥Æ¥à¤Îµ­Ï¿¤ò¥í¡¼¥É¤·¤Þ¤·¤¿");
-#else
-       if (arg_fiddle) note("Loaded Object Memory");
-#endif
-
-
-       /* Init the wilderness seeds */
-       for (i = 0; i < max_wild_x; i++)
-       {
-               for (j = 0; j < max_wild_y; j++)
-               {
-                       wilderness[j][i].seed = randint0(0x10000000);
-               }
-       }
+       if (arg_fiddle) note(_("アイテムの記録をロードしました", "Loaded Object Memory"));
 
        /* 2.1.3 or newer version */
        {
@@ -3455,12 +3427,7 @@ if (arg_fiddle) note("
                /* Incompatible save files */
                if (max_towns_load > max_towns)
                {
-#ifdef JP
-note(format("Ä®¤¬Â¿¤¹¤®¤ë(%u)¡ª", max_towns_load));
-#else
-                       note(format("Too many (%u) towns!", max_towns_load));
-#endif
-
+                       note(format(_("町が多すぎる(%u)!", "Too many (%u) towns!"), max_towns_load));
                        return (23);
                }
 
@@ -3479,12 +3446,7 @@ note(format("Į
                /* Incompatible save files */
                if (max_quests_load > max_quests)
                {
-#ifdef JP
-note(format("¥¯¥¨¥¹¥È¤¬Â¿¤¹¤®¤ë(%u)¡ª", max_quests_load));
-#else
-                       note(format("Too many (%u) quests!", max_quests_load));
-#endif
-
+                       note(format(_("クエストが多すぎる(%u)!", "Too many (%u) quests!"), max_quests_load));
                        return (23);
                }
 
@@ -3608,12 +3570,7 @@ note(format("
                /* Incompatible save files */
                if ((wild_x_size > max_wild_x) || (wild_y_size > max_wild_y))
                {
-#ifdef JP
-note(format("¹ÓÌÂ礭¤¹¤®¤ë(%u/%u)¡ª", wild_x_size, wild_y_size));
-#else
-                       note(format("Wilderness is too big (%u/%u)!", wild_x_size, wild_y_size));
-#endif
-
+                       note(format(_("荒野が大きすぎる(%u/%u)!", "Wilderness is too big (%u/%u)!"), wild_x_size, wild_y_size));
                        return (23);
                }
 
@@ -3627,11 +3584,7 @@ note(format("
                }
        }
 
-#ifdef JP
-if (arg_fiddle) note("¥¯¥¨¥¹¥È¾ðÊó¤ò¥í¡¼¥É¤·¤Þ¤·¤¿");
-#else
-       if (arg_fiddle) note("Loaded Quests");
-#endif
+       if (arg_fiddle) note(_("クエスト情報をロードしました", "Loaded Quests"));
 
        /* Load the Artifacts */
        rd_u16b(&tmp16u);
@@ -3639,12 +3592,7 @@ if (arg_fiddle) note("
        /* Incompatible save files */
        if (tmp16u > max_a_idx)
        {
-#ifdef JP
-note(format("ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤¬Â¿¤¹¤®¤ë(%u)¡ª", tmp16u));
-#else
-               note(format("Too many (%u) artifacts!", tmp16u));
-#endif
-
+               note(format(_("伝説のアイテムが多すぎる(%u)!", "Too many (%u) artifacts!"), tmp16u));
                return (24);
        }
 
@@ -3669,23 +3617,13 @@ note(format("
                        rd_s16b(&a_ptr->floor_id);
                }
        }
-#ifdef JP
-if (arg_fiddle) note("ÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤ò¥í¡¼¥É¤·¤Þ¤·¤¿");
-#else
-       if (arg_fiddle) note("Loaded Artifacts");
-#endif
-
-
+       if (arg_fiddle) note(_("伝説のアイテムをロードしました", "Loaded Artifacts"));
 
        /* Read the extra stuff */
        rd_extra();
        if (p_ptr->energy_need < -999) world_player = TRUE;
 
-#ifdef JP
-if (arg_fiddle) note("ÆÃÊ̾ðÊó¤ò¥í¡¼¥É¤·¤Þ¤·¤¿");
-#else
-       if (arg_fiddle) note("Loaded extra information");
-#endif
+       if (arg_fiddle) note(_("特別情報をロードしました", "Loaded extra information"));
 
 
        /* Read the player_hp array */
@@ -3694,12 +3632,7 @@ if (arg_fiddle) note("
        /* Incompatible save files */
        if (tmp16u > PY_MAX_LEVEL)
        {
-#ifdef JP
-note(format("¥Ò¥Ã¥È¥Ý¥¤¥ó¥ÈÇÛÎó¤¬Â礭¤¹¤®¤ë(%u)¡ª", tmp16u));
-#else
-               note(format("Too many (%u) hitpoint entries!", tmp16u));
-#endif
-
+               note(format(_("ヒットポイント配列が大きすぎる(%u)!", "Too many (%u) hitpoint entries!"), tmp16u));
                return (25);
        }
 
@@ -3782,12 +3715,7 @@ note(format("
        /* Read the inventory */
        if (rd_inventory())
        {
-#ifdef JP
-note("»ý¤Áʪ¾ðÊó¤òÆɤ߹þ¤à¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó");
-#else
-               note("Unable to read inventory");
-#endif
-
+               note(_("持ち物情報を読み込むことができません", "Unable to read inventory"));
                return (21);
        }
 
@@ -3866,20 +3794,11 @@ note("
        if (!p_ptr->is_dead)
        {
                /* Dead players have no dungeon */
-#ifdef JP
-note("¥À¥ó¥¸¥ç¥óÉü¸µÃæ...");
-#else
-               note("Restoring Dungeon...");
-#endif
+               note(_("ダンジョン復元中...", "Restoring Dungeon..."));
 
                if (rd_dungeon())
                {
-#ifdef JP
-note("¥À¥ó¥¸¥ç¥ó¥Ç¡¼¥¿Æɤ߹þ¤ß¼ºÇÔ");
-#else
-                       note("Error reading dungeon data");
-#endif
-
+                       note(_("ダンジョンデータ読み込み失敗", "Error reading dungeon data"));
                        return (34);
                }
 
@@ -3917,12 +3836,7 @@ note("
        /* Verify */
        if (o_v_check != n_v_check)
        {
-#ifdef JP
-note("¥Á¥§¥Ã¥¯¥µ¥à¤¬¤ª¤«¤·¤¤");
-#else
-               note("Invalid checksum");
-#endif
-
+               note(_("チェックサムがおかしい", "Invalid checksum"));
                return (11);
        }
 
@@ -3937,12 +3851,7 @@ note("
        /* Verify */
        if (o_x_check != n_x_check)
        {
-#ifdef JP
-note("¥¨¥ó¥³¡¼¥É¤µ¤ì¤¿¥Á¥§¥Ã¥¯¥µ¥à¤¬¤ª¤«¤·¤¤");
-#else
-               note("Invalid encoded checksum");
-#endif
-
+               note(_("エンコードされたチェックサムがおかしい", "Invalid encoded checksum"));
                return (11);
        }
 
@@ -3952,9 +3861,9 @@ note("
        return (0);
 }
 
-
-/*
- * Actually read the savefile
+/*!
+ * @brief ロード処理全体のメイン関数 / Actually read the savefile
+ * @return エラーコード
  */
 errr rd_savefile_new(void)
 {
@@ -3986,8 +3895,10 @@ errr rd_savefile_new(void)
 }
 
 
-/*
- * Actually load and verify a floor save data
+/*!
+ * @brief 保存フロア読み込みのサブ関数 / Actually load and verify a floor save data
+ * @param sf_ptr 保存フロア読み込み先
+ * @return 成功したらtrue
  */
 static bool load_floor_aux(saved_floor_type *sf_ptr)
 {
@@ -4047,8 +3958,11 @@ static bool load_floor_aux(saved_floor_type *sf_ptr)
 }
 
 
-/*
- * Attempt to load the temporally saved-floor data
+/*!
+ * @brief 一時保存フロア情報を読み込む / Attempt to load the temporally saved-floor data
+ * @param sf_ptr 保存フロア読み込み先
+ * @param mode オプション
+ * @return 成功したらtrue
  */
 bool load_floor(saved_floor_type *sf_ptr, u32b mode)
 {