OSDN Git Service

[Refactor] #37353 floor.c を作成して floor_type 型整理。
[hengband/hengband.git] / src / scores.c
index 0479951..1832acd 100644 (file)
@@ -1,20 +1,27 @@
-/* File: scores.c */
-
-/*
+/*!
+ * @file scores.c
+ * @brief ハイスコア処理 / Highscores handling
+ * @date 2014/07/14
+ * @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.
+ * 2014 Deskull rearranged comment for Doxygen.
  */
 
-/* Purpose: Highscores handling */
-
 #include "angband.h"
+#include "util.h"
 
+#include "player-status.h"
+#include "files.h"
+#include "scores.h"
+#include "floor.h"
 
-/*
- * Seek score 'i' in the highscore file
+/*!
+ * @brief i番目のスコア情報にバッファ位置をシークする / Seek score 'i' in the highscore file
+ * @param i スコア情報ID
+ * @return 問題がなければ0を返す
  */
 static int highscore_seek(int i)
 {
@@ -23,8 +30,10 @@ static int highscore_seek(int i)
 }
 
 
-/*
- * Read one score from the highscore file
+/*!
+ * @brief 所定ポインタからスコア情報を読み取る / Read one score from the highscore file
+ * @param score スコア情報参照ポインタ
+ * @return エラーコード
  */
 static errr highscore_read(high_score *score)
 {
@@ -33,8 +42,10 @@ static errr highscore_read(high_score *score)
 }
 
 
-/*
- * Write one score to the highscore file
+/*!
+ * @brief 所定ポインタへスコア情報を書き込む / Write one score to the highscore file
+ * @param score スコア情報参照ポインタ
+ * @return エラーコード(問題がなければ0を返す)
  */
 static int highscore_write(high_score *score)
 {
@@ -42,10 +53,10 @@ static int highscore_write(high_score *score)
        return (fd_write(highscore_fd, (char*)(score), sizeof(high_score)));
 }
 
-
-/*
- * Just determine where a new score *would* be placed
- * Return the location (0 is best) or -1 on failure
+/*!
+ * @brief スコア情報を全て得るまで繰り返し取得する / Just determine where a new score *would* be placed
+ * @param score スコア情報参照ポインタ
+ * @return 正常ならば(MAX_HISCORES - 1)、問題があれば-1を返す
  */
 static int highscore_where(high_score *score)
 {
@@ -77,9 +88,10 @@ static int highscore_where(high_score *score)
 }
 
 
-/*
- * Actually place an entry into the high score file
- * Return the location (0 is best) or -1 on "failure"
+/*!
+ * @brief スコア情報をバッファの末尾に追加する / Actually place an entry into the high score file
+ * @param score スコア情報参照ポインタ
+ * @return 正常ならば書き込んだスロット位置、問題があれば-1を返す / Return the location (0 is best) or -1 on "failure"
  */
 static int highscore_add(high_score *score)
 {
@@ -122,24 +134,32 @@ static int highscore_add(high_score *score)
 
 
 
-/*
- * Display the scores in a given range.
+/*!
+ * @brief 指定された順位範囲でスコアを並べて表示する / Display the scores in a given range.
+ * @param from 順位先頭
+ * @param to 順位末尾
+ * @param note 黄色表示でハイライトする順位
+ * @param score スコア配列参照ポインタ
+ * @return なし
+ * @details
+ * <pre>
  * Assumes the high score list is already open.
  * Only five entries per line, too much info.
  *
  * Mega-Hack -- allow "fake" entry at the given position.
+ * </pre>
  */
 void display_scores_aux(int from, int to, int note, high_score *score)
 {
-       int             i, j, k, n, place;
-       byte attr;
+       int i, j, k, n, place;
+       TERM_COLOR attr;
 
-       high_score      the_score;
+       high_score the_score;
 
-       char    out_val[256];
-       char    tmp_val[160];
+       GAME_TEXT out_val[256];
+       GAME_TEXT tmp_val[160];
 
-       int wid, hgt, per_screen;
+       TERM_LEN wid, hgt, per_screen;
 
        Term_get_size(&wid, &hgt);
        per_screen = (hgt - 4) / 4;
@@ -173,26 +193,15 @@ void display_scores_aux(int from, int to, int note, high_score *score)
        /* Show per_screen per page, until "done" */
        for (k = from, place = k+1; k < i; k += per_screen)
        {
-               /* Clear screen */
                Term_clear();
 
                /* Title */
-#ifdef JP
-put_str("                ÊѶòÈÚÅÜ: Í¦¼Ô¤ÎÅÂƲ", 0, 0);
-#else
-               put_str("                Hengband Hall of Fame", 0, 0);
-#endif
-
+               put_str(_("                変愚蛮怒: 勇者の殿堂", "                Hengband Hall of Fame"), 0, 0);
 
                /* Indicate non-top scores */
                if (k > 0)
                {
-#ifdef JP
-sprintf(tmp_val, "( %d °Ì°Ê²¼ )", k + 1);
-#else
-                       sprintf(tmp_val, "(from position %d)", k + 1);
-#endif
-
+                       sprintf(tmp_val, _("( %d 位以下 )", "(from position %d)"), k + 1);
                        put_str(tmp_val, 0, 40);
                }
 
@@ -201,7 +210,7 @@ sprintf(tmp_val, "( %d 
                {
                        int pr, pc, pa, clev, mlev, cdun, mdun;
 
-                       cptr user, gold, when, aged;
+                       concptr user, gold, when, aged;
 
 
                        /* Hack -- indicate death in yellow */
@@ -238,10 +247,10 @@ sprintf(tmp_val, "( %d 
                        mdun = atoi(the_score.max_dun);
 
                        /* Hack -- extract the gold and such */
-                       for (user = the_score.uid; isspace(*user); user++) /* loop */;
-                       for (when = the_score.day; isspace(*when); when++) /* loop */;
-                       for (gold = the_score.gold; isspace(*gold); gold++) /* loop */;
-                       for (aged = the_score.turns; isspace(*aged); aged++) /* loop */;
+                       for (user = the_score.uid; iswspace(*user); user++) /* loop */;
+                       for (when = the_score.day; iswspace(*when); when++) /* loop */;
+                       for (gold = the_score.gold; iswspace(*gold); gold++) /* loop */;
+                       for (aged = the_score.turns; iswspace(*aged); aged++) /* loop */;
 
                        /* Clean up standard encoded form of "when" */
                        if ((*when == '@') && strlen(when) == 9)
@@ -253,10 +262,10 @@ sprintf(tmp_val, "( %d 
 
                        /* Dump some info */
 #ifdef JP
-/*sprintf(out_val, "%3d.%9s  %s%s%s¤È¤¤¤¦Ì¾¤Î%s¤Î%s (¥ì¥Ù¥ë %d)", */
-                       sprintf(out_val, "%3d.%9s  %s%s%s - %s%s (¥ì¥Ù¥ë %d)",
+/*sprintf(out_val, "%3d.%9s  %s%s%sという名の%sの%s (レベル %d)", */
+                       sprintf(out_val, "%3d.%9s  %s%s%s - %s%s (レベル %d)",
                                place, the_score.pts,
-                               seikaku_info[pa].title, (seikaku_info[pa].no ? "¤Î" : ""),
+                               seikaku_info[pa].title, (seikaku_info[pa].no ? "" : ""),
                                the_score.who,
                                race_info[pr].title, class_info[pc].title,
                                clev);
@@ -271,12 +280,7 @@ sprintf(tmp_val, "( %d 
 
 
                        /* Append a "maximum level" */
-#ifdef JP
-if (mlev > clev) strcat(out_val, format(" (ºÇ¹â%d)", mlev));
-#else
-                       if (mlev > clev) strcat(out_val, format(" (Max %d)", mlev));
-#endif
-
+                       if (mlev > clev) strcat(out_val, format(_(" (最高%d)", " (Max %d)"), mlev));
 
                        /* Dump the first line */
                        c_put_str(attr, out_val, n*4 + 2, 0);
@@ -284,27 +288,27 @@ if (mlev > clev) strcat(out_val, format(" (
                        /* Another line of info */
 #ifdef JP
                        if (mdun != 0)
-                               sprintf(out_val, "    ºÇ¹â%3d³¬", mdun);
+                               sprintf(out_val, "    最高%3d階", mdun);
                        else
                                sprintf(out_val, "             ");
 
 
-                       /* »àË´¸¶°ø¤ò¥ª¥ê¥¸¥Ê¥ë¤è¤êºÙ¤«¤¯É½¼¨ */
+                       /* 死亡原因をオリジナルより細かく表示 */
                        if (streq(the_score.how, "yet"))
                        {
-                               sprintf(out_val+13, "  ¤Þ¤ÀÀ¸¤­¤Æ¤¤¤ë (%d%s)",
-                                      cdun, "³¬");
+                               sprintf(out_val+13, "  まだ生きている (%d%s)",
+                                      cdun, "");
                        }
                        else
                        if (streq(the_score.how, "ripe"))
                        {
-                               sprintf(out_val+13, "  ¾¡Íø¤Î¸å¤Ë°úÂà (%d%s)",
-                                       cdun, "³¬");
+                               sprintf(out_val+13, "  勝利の後に引退 (%d%s)",
+                                       cdun, "");
                        }
                        else if (streq(the_score.how, "Seppuku"))
                        {
-                               sprintf(out_val+13, "  ¾¡Íø¤Î¸å¤ËÀÚÊ¢ (%d%s)",
-                                       cdun, "³¬");
+                               sprintf(out_val+13, "  勝利の後に切腹 (%d%s)",
+                                       cdun, "");
                        }
                        else
                        {
@@ -312,9 +316,9 @@ if (mlev > clev) strcat(out_val, format(" (
 
                                /* Some people die outside of the dungeon */
                                if (!cdun)
-                                       sprintf(out_val+13, "  ÃϾå¤Ç%s¤Ë»¦¤µ¤ì¤¿", the_score.how);
+                                       sprintf(out_val+13, "  地上で%sに殺された", the_score.how);
                                else
-                                       sprintf(out_val+13, "  %d³¬¤Ç%s¤Ë»¦¤µ¤ì¤¿",
+                                       sprintf(out_val+13, "  %d階で%sに殺された",
                                                cdun, the_score.how);
                        }
 
@@ -341,13 +345,13 @@ if (mlev > clev) strcat(out_val, format(" (
                        {
                                char buf[11];
 
-                               /* ÆüÉÕ¤ò 19yy/mm/dd ¤Î·Á¼°¤ËÊѹ¹¤¹¤ë */
+                               /* 日付を 19yy/mm/dd の形式に変更する */
                                if (strlen(when) == 8 && when[2] == '/' && when[5] == '/') {
                                        sprintf(buf, "%d%s/%.5s", 19 + (when[6] < '8'), when + 6, when);
                                        when = buf;
                                }
                                sprintf(out_val,
-                                               "        (¥æ¡¼¥¶¡¼:%s, ÆüÉÕ:%s, ½ê»ý¶â:%s, ¥¿¡¼¥ó:%s)",
+                                               "        (ユーザー:%s, 日付:%s, 所持金:%s, ターン:%s)",
                                                user, when, gold, aged);
                        }
 
@@ -362,11 +366,7 @@ if (mlev > clev) strcat(out_val, format(" (
 
 
                /* Wait for response */
-#ifdef JP
-prt("[ ESC¤ÇÃæÃÇ, ¤½¤Î¾¤Î¥­¡¼¤Ç³¤±¤Þ¤¹ ]", hgt - 1, 21);
-#else
-               prt("[Press ESC to quit, any other key to continue.]", hgt - 1, 17);
-#endif
+               prt(_("[ ESCで中断, その他のキーで続けます ]", "[Press ESC to quit, any other key to continue.]"), hgt - 1, _(21, 17));
 
                j = inkey();
                prt("", hgt - 1, 0);
@@ -377,11 +377,16 @@ prt("[ ESC
 }
 
 
-/*
- * Hack -- Display the scores in a given range and quit.
- *
+/*!
+ * @brief スコア表示処理メインルーチン / Hack -- Display the scores in a given range and quit.
+ * @param from 順位先頭
+ * @param to 順位末尾
+ * @return なし
+ * @details
+ * <pre>
  * This function is only called from "main.c" when the user asks
  * to see the "high scores".
+ * </pre>
  */
 void display_scores(int from, int to)
 {
@@ -394,14 +399,7 @@ void display_scores(int from, int to)
        highscore_fd = fd_open(buf, O_RDONLY);
 
        /* Paranoia -- No score file */
-#ifdef JP
-if (highscore_fd < 0) quit("¥¹¥³¥¢¡¦¥Õ¥¡¥¤¥ë¤¬»ÈÍѤǤ­¤Þ¤»¤ó¡£");
-#else
-       if (highscore_fd < 0) quit("Score file unavailable.");
-#endif
-
-
-       /* Clear screen */
+       if (highscore_fd < 0) quit(_("スコア・ファイルが使用できません。", "Score file unavailable."));
        Term_clear();
 
        /* Display the scores */
@@ -418,7 +416,11 @@ if (highscore_fd < 0) quit("
 }
 
 
-
+/*!
+ * @brief スコアサーバへの転送処理
+ * @param do_send 実際に転送ア処置を行うか否か
+ * @return 転送が成功したらTRUEを返す
+ */
 bool send_world_score(bool do_send)
 {
 #ifdef WORLD_SCORE
@@ -426,25 +428,15 @@ bool send_world_score(bool do_send)
        {
                if(easy_band)
                {
-#ifdef JP
-                       msg_print("½é¿´¼Ô¥â¡¼¥É¤Ç¤Ï¥ï¡¼¥ë¥É¥¹¥³¥¢¤ËÅÐÏ¿¤Ç¤­¤Þ¤»¤ó¡£");
-#else
-                       msg_print("Since you are in the Easy Mode, you cannot send score to world score server.");
-#endif
+                       msg_print(_("初心者モードではワールドスコアに登録できません。",
+                       "Since you are in the Easy Mode, you cannot send score to world score server."));
                }
-#ifdef JP
-               else if(get_check_strict("¥¹¥³¥¢¤ò¥¹¥³¥¢¡¦¥µ¡¼¥Ð¤ËÅÐÏ¿¤·¤Þ¤¹¤«? ", (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
-#else
-               else if(get_check_strict("Do you send score to the world score sever? ", (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
-#endif
+               else if(get_check_strict(_("スコアをスコア・サーバに登録しますか? ", "Do you send score to the world score sever? "), 
+                               (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
                {
                        errr err;
                        prt("",0,0);
-#ifdef JP
-                       prt("Á÷¿®Ãæ¡¥¡¥",0,0);
-#else
-                       prt("Sending...",0,0);
-#endif
+                       prt(_("送信中..", "Sending..."),0,0);
                        Term_fresh();
                        screen_save();
                        err = report_score();
@@ -453,11 +445,7 @@ bool send_world_score(bool do_send)
                        {
                                return FALSE;
                        }
-#ifdef JP
-                       prt("´°Î»¡£²¿¤«¥­¡¼¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£", 0, 0);
-#else
-                       prt("Completed.  Hit any key.", 0, 0);
-#endif
+                       prt(_("完了。何かキーを押してください。", "Completed.  Hit any key."), 0, 0);
                        (void)inkey();
                }
                else return FALSE;
@@ -466,10 +454,12 @@ bool send_world_score(bool do_send)
        return TRUE;
 }
 
-/*
+/*!
+ * @brief スコアの過去二十位内ランキングを表示する
  * Enters a players name on a hi-score table, if "legal", and in any
  * case, displays some relevant portion of the high score list.
- *
+ * @return エラーコード
+ * @details
  * Assumes "signals_ignore_tstp()" has been called.
  */
 errr top_twenty(void)
@@ -490,15 +480,15 @@ errr top_twenty(void)
                FAKE_VER_MAJOR, FAKE_VER_MINOR, FAKE_VER_PATCH);
 
        /* Calculate and save the points */
-       sprintf(the_score.pts, "%9ld", (long)total_points());
+       sprintf(the_score.pts, "%9ld", (long)calc_score());
        the_score.pts[9] = '\0';
 
        /* Save the current gold */
        sprintf(the_score.gold, "%9lu", (long)p_ptr->au);
        the_score.gold[9] = '\0';
 
-       /* Save the current turn */
-       sprintf(the_score.turns, "%9lu", (long)turn_real(turn));
+       /* Save the current current_world_ptr->game_turn */
+       sprintf(the_score.turns, "%9lu", (long)turn_real(current_world_ptr->game_turn));
        the_score.turns[9] = '\0';
 
 #ifdef HIGHSCORE_DATE_HACK
@@ -512,27 +502,27 @@ errr top_twenty(void)
 #endif
 
        /* Save the player name (15 chars) */
-       sprintf(the_score.who, "%-.15s", player_name);
+       sprintf(the_score.who, "%-.15s", p_ptr->name);
 
-       /* Save the player info XXX XXX XXX */
+       /* Save the player info */
        sprintf(the_score.uid, "%7u", player_uid);
        sprintf(the_score.sex, "%c", (p_ptr->psex ? 'm' : 'f'));
-       sprintf(the_score.p_r, "%2d", p_ptr->prace);
-       sprintf(the_score.p_c, "%2d", p_ptr->pclass);
-       sprintf(the_score.p_a, "%2d", p_ptr->pseikaku);
+       sprintf(the_score.p_r, "%2d", MIN(p_ptr->prace, MAX_RACES));
+       sprintf(the_score.p_c, "%2d", MIN(p_ptr->pclass, MAX_CLASS));
+       sprintf(the_score.p_a, "%2d", MIN(p_ptr->pseikaku, MAX_SEIKAKU));
 
        /* Save the level and such */
-       sprintf(the_score.cur_lev, "%3d", p_ptr->lev);
-       sprintf(the_score.cur_dun, "%3d", dun_level);
-       sprintf(the_score.max_lev, "%3d", p_ptr->max_plv);
-       sprintf(the_score.max_dun, "%3d", max_dlv[dungeon_type]);
+       sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999));
+       sprintf(the_score.cur_dun, "%3d", (int)current_floor_ptr->dun_level);
+       sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999));
+       sprintf(the_score.max_dun, "%3d", (int)max_dlv[p_ptr->dungeon_idx]);
 
        /* Save the cause of death (31 chars) */
        if (strlen(p_ptr->died_from) >= sizeof(the_score.how))
        {
 #ifdef JP
                my_strcpy(the_score.how, p_ptr->died_from, sizeof(the_score.how) - 2);
-               strcat(the_score.how, "¡Ä");
+               strcat(the_score.how, "");
 #else
                my_strcpy(the_score.how, p_ptr->died_from, sizeof(the_score.how) - 3);
                strcat(the_score.how, "...");
@@ -587,9 +577,10 @@ errr top_twenty(void)
        return (0);
 }
 
-
-/*
+/*!
+ * @brief プレイヤーの現在のスコアをランキングに挟む /
  * Predict the players location, and display it.
+ * @return エラーコード
  */
 errr predict_score(void)
 {
@@ -601,12 +592,7 @@ errr predict_score(void)
        /* No score file */
        if (highscore_fd < 0)
        {
-#ifdef JP
-msg_print("¥¹¥³¥¢¡¦¥Õ¥¡¥¤¥ë¤¬»ÈÍѤǤ­¤Þ¤»¤ó¡£");
-#else
-               msg_print("Score file unavailable.");
-#endif
-
+               msg_print(_("スコア・ファイルが使用できません。", "Score file unavailable."));
                msg_print(NULL);
                return (0);
        }
@@ -617,47 +603,36 @@ msg_print("
                FAKE_VER_MAJOR, FAKE_VER_MINOR, FAKE_VER_PATCH);
 
        /* Calculate and save the points */
-       sprintf(the_score.pts, "%9ld", (long)total_points());
+       sprintf(the_score.pts, "%9ld", (long)calc_score());
 
        /* Save the current gold */
        sprintf(the_score.gold, "%9lu", (long)p_ptr->au);
 
-       /* Save the current turn */
-       sprintf(the_score.turns, "%9lu", (long)turn_real(turn));
+       /* Save the current current_world_ptr->game_turn */
+       sprintf(the_score.turns, "%9lu", (long)turn_real(current_world_ptr->game_turn));
 
        /* Hack -- no time needed */
-#ifdef JP
-strcpy(the_score.day, "º£Æü");
-#else
-       strcpy(the_score.day, "TODAY");
-#endif
-
+       strcpy(the_score.day, _("今日", "TODAY"));
 
        /* Save the player name (15 chars) */
-       sprintf(the_score.who, "%-.15s", player_name);
+       sprintf(the_score.who, "%-.15s", p_ptr->name);
 
-       /* Save the player info XXX XXX XXX */
+       /* Save the player info */
        sprintf(the_score.uid, "%7u", player_uid);
        sprintf(the_score.sex, "%c", (p_ptr->psex ? 'm' : 'f'));
-       sprintf(the_score.p_r, "%2d", p_ptr->prace);
-       sprintf(the_score.p_c, "%2d", p_ptr->pclass);
-       sprintf(the_score.p_a, "%2d", p_ptr->pseikaku);
+       sprintf(the_score.p_r, "%2d", MIN(p_ptr->prace, MAX_RACES));
+       sprintf(the_score.p_c, "%2d", MIN(p_ptr->pclass, MAX_CLASS));
+       sprintf(the_score.p_a, "%2d", MIN(p_ptr->pseikaku, MAX_SEIKAKU));
 
        /* Save the level and such */
-       sprintf(the_score.cur_lev, "%3d", p_ptr->lev);
-       sprintf(the_score.cur_dun, "%3d", dun_level);
-       sprintf(the_score.max_lev, "%3d", p_ptr->max_plv);
-       sprintf(the_score.max_dun, "%3d", max_dlv[dungeon_type]);
+       sprintf(the_score.cur_lev, "%3d", MIN((u16b)p_ptr->lev, 999));
+       sprintf(the_score.cur_dun, "%3d", (int)current_floor_ptr->dun_level);
+       sprintf(the_score.max_lev, "%3d", MIN((u16b)p_ptr->max_plv, 999));
+       sprintf(the_score.max_dun, "%3d", (int)max_dlv[p_ptr->dungeon_idx]);
 
        /* Hack -- no cause of death */
-#ifdef JP
-       /* ¤Þ¤À»à¤ó¤Ç¤¤¤Ê¤¤¤È¤­¤Î¼±ÊÌʸ»ú */
-       strcpy(the_score.how, "yet");
-#else
-       strcpy(the_score.how, "nobody (yet!)");
-#endif
-
-
+       /* まだ死んでいないときの識別文字 */
+       strcpy(the_score.how, _("yet", "nobody (yet!)"));
 
        /* See where the entry would be placed */
        j = highscore_where(&the_score);
@@ -682,16 +657,17 @@ strcpy(the_score.day, "
 }
 
 
-
-/*
- * show_highclass - selectively list highscores based on class
- * -KMW-
+/*!
+ * @brief スコアランキングの簡易表示 /
+ * show_highclass - selectively list highscores based on class -KMW-
+ * @return なし
  */
 void show_highclass(void)
 {
 
        register int i = 0, j, m = 0;
-       int pr, clev/*, al*/;
+       int pr;
+       PLAYER_LEVEL clev/*, al*/;
        high_score the_score;
        char buf[1024], out_val[256];
 
@@ -704,12 +680,7 @@ void show_highclass(void)
 
        if (highscore_fd < 0)
        {
-#ifdef JP
-msg_print("¥¹¥³¥¢¡¦¥Õ¥¡¥¤¥ë¤¬»ÈÍѤǤ­¤Þ¤»¤ó¡£");
-#else
-               msg_print("Score file unavailable.");
-#endif
-
+               msg_print(_("スコア・ファイルが使用できません。", "Score file unavailable."));
                msg_print(NULL);
                return;
        }
@@ -728,10 +699,10 @@ msg_print("
                if (highscore_seek(j)) break;
                if (highscore_read(&the_score)) break;
                pr = atoi(the_score.p_r);
-               clev = atoi(the_score.cur_lev);
+               clev = (PLAYER_LEVEL)atoi(the_score.cur_lev);
 
 #ifdef JP
-               sprintf(out_val, "   %3d) %s¤Î%s (¥ì¥Ù¥ë %2d)",
+               sprintf(out_val, "   %3d) %sの%s (レベル %2d)",
                    (m + 1), race_info[pr].title,the_score.who, clev);
 #else
                sprintf(out_val, "%3d) %s the %s (Level %2d)",
@@ -744,22 +715,18 @@ msg_print("
        }
 
 #ifdef JP
-       sprintf(out_val, "¤¢¤Ê¤¿) %s¤Î%s (¥ì¥Ù¥ë %2d)",
-           race_info[p_ptr->prace].title,player_name, p_ptr->lev);
+       sprintf(out_val, "あなた) %sの%s (レベル %2d)",
+           race_info[p_ptr->prace].title,p_ptr->name, p_ptr->lev);
 #else
        sprintf(out_val, "You) %s the %s (Level %2d)",
-           player_name, race_info[p_ptr->prace].title, p_ptr->lev);
+           p_ptr->name, race_info[p_ptr->prace].title, p_ptr->lev);
 #endif
 
        prt(out_val, (m + 8), 0);
 
        (void)fd_close(highscore_fd);
        highscore_fd = -1;
-#ifdef JP
-       prt("²¿¤«¥­¡¼¤ò²¡¤¹¤È¥²¡¼¥à¤ËÌá¤ê¤Þ¤¹",0,0);
-#else
-       prt("Hit any key to continue",0,0);
-#endif
+       prt(_("何かキーを押すとゲームに戻ります", "Hit any key to continue"),0,0);
 
        (void)inkey();
 
@@ -767,10 +734,11 @@ msg_print("
        screen_load();
 }
 
-
-/*
- * Race Legends
- * -KMW-
+/*!
+ * @brief スコアランキングの簡易表示(種族毎)サブルーチン /
+ * Race Legends -KMW-
+ * @param race_num 種族ID
+ * @return なし
  */
 void race_score(int race_num)
 {
@@ -782,11 +750,7 @@ void race_score(int race_num)
        lastlev = 0;
 
        /* rr9: TODO - pluralize the race */
-#ifdef JP
-sprintf(tmp_str,"ºÇ¹â¤Î%s", race_info[race_num].title);
-#else
-       sprintf(tmp_str,"The Greatest of all the %s", race_info[race_num].title);
-#endif
+       sprintf(tmp_str,_("最高の%s", "The Greatest of all the %s"), race_info[race_num].title);
 
        prt(tmp_str, 5, 15);
 
@@ -797,12 +761,7 @@ sprintf(tmp_str,"
 
        if (highscore_fd < 0)
        {
-#ifdef JP
-msg_print("¥¹¥³¥¢¡¦¥Õ¥¡¥¤¥ë¤¬»ÈÍѤǤ­¤Þ¤»¤ó¡£");
-#else
-               msg_print("Score file unavailable.");
-#endif
-
+               msg_print(_("スコア・ファイルが使用できません。", "Score file unavailable."));
                msg_print(NULL);
                return;
        }
@@ -827,7 +786,7 @@ msg_print("
                if (pr == race_num)
                {
 #ifdef JP
-               sprintf(out_val, "   %3d) %s¤Î%s (¥ì¥Ù¥ë %2d)",
+               sprintf(out_val, "   %3d) %sの%s (レベル %2d)",
                            (m + 1), race_info[pr].title, 
                                the_score.who,clev);
 #else
@@ -847,11 +806,11 @@ msg_print("
        if ((p_ptr->prace == race_num) && (p_ptr->lev >= lastlev))
        {
 #ifdef JP
-       sprintf(out_val, "¤¢¤Ê¤¿) %s¤Î%s (¥ì¥Ù¥ë %2d)",
-                    race_info[p_ptr->prace].title,player_name, p_ptr->lev);
+       sprintf(out_val, "あなた) %sの%s (レベル %2d)",
+                    race_info[p_ptr->prace].title,p_ptr->name, p_ptr->lev);
 #else
                sprintf(out_val, "You) %s the %s (Level %3d)",
-                   player_name, race_info[p_ptr->prace].title, p_ptr->lev);
+                   p_ptr->name, race_info[p_ptr->prace].title, p_ptr->lev);
 #endif
 
                prt(out_val, (m + 8), 0);
@@ -862,9 +821,10 @@ msg_print("
 }
 
 
-/*
- * Race Legends
- * -KMW-
+/*!
+ * @brief スコアランキングの簡易表示(種族毎)メインルーチン /
+ * Race Legends -KMW-
+ * @return なし
  */
 void race_legends(void)
 {
@@ -873,39 +833,31 @@ void race_legends(void)
        for (i = 0; i < MAX_RACES; i++)
        {
                race_score(i);
-#ifdef JP
-msg_print("²¿¤«¥­¡¼¤ò²¡¤¹¤È¥²¡¼¥à¤ËÌá¤ê¤Þ¤¹");
-#else
-               msg_print("Hit any key to continue");
-#endif
-
+               msg_print(_("何かキーを押すとゲームに戻ります", "Hit any key to continue"));
                msg_print(NULL);
                for (j = 5; j < 19; j++)
                        prt("", j, 0);
        }
 }
 
-
-/*
- * Change the player into a King!                      -RAK-
+/*!
+ * @brief 勝利者用の引退演出処理 /
+ * Change the player into a King! -RAK-
+ * @return なし
  */
 void kingly(void)
 {
-       int wid, hgt;
-       int cx, cy;
+       TERM_LEN wid, hgt;
+       TERM_LEN cx, cy;
+       bool seppuku = streq(p_ptr->died_from, "Seppuku");
 
        /* Hack -- retire in town */
-       dun_level = 0;
+       current_floor_ptr->dun_level = 0;
 
        /* Fake death */
-       if (!streq(p_ptr->died_from, "Seppuku"))
-#ifdef JP
-               /* °úÂष¤¿¤È¤­¤Î¼±ÊÌʸ»ú */
-               (void)strcpy(p_ptr->died_from, "ripe");
-#else
-               (void)strcpy(p_ptr->died_from, "Ripe Old Age");
-#endif
-
+       if (!seppuku)
+               /* 引退したときの識別文字 */
+               (void)strcpy(p_ptr->died_from, _("ripe", "Ripe Old Age"));
 
        /* Restore the experience */
        p_ptr->exp = p_ptr->max_exp;
@@ -919,8 +871,6 @@ void kingly(void)
 
        /* Hack -- Instant Gold */
        p_ptr->au += 10000000L;
-
-       /* Clear screen */
        Term_clear();
 
        /* Display a crown */
@@ -940,22 +890,21 @@ void kingly(void)
        /* Display a message */
 #ifdef JP
        put_str("Veni, Vidi, Vici!", cy + 3, cx - 9);
-       put_str("Í褿¡¢¸«¤¿¡¢¾¡¤Ã¤¿¡ª", cy + 4, cx - 10);
-       put_str(format("°ÎÂç¤Ê¤ë%sËüºÐ¡ª", sp_ptr->winner), cy + 5, cx - 11);
+       put_str("来た、見た、勝った!", cy + 4, cx - 10);
+       put_str(format("偉大なる%s万歳!", sp_ptr->winner), cy + 5, cx - 11);
 #else
        put_str("Veni, Vidi, Vici!", cy + 3, cx - 9);
        put_str("I came, I saw, I conquered!", cy + 4, cx - 14);
        put_str(format("All Hail the Mighty %s!", sp_ptr->winner), cy + 5, cx - 13);
 #endif
 
-#ifdef JP
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¥À¥ó¥¸¥ç¥ó¤Îõº÷¤«¤é°úÂष¤¿¡£");
-       do_cmd_write_nikki(NIKKI_GAMESTART, 1, "-------- ¥²¡¼¥à¥ª¡¼¥Ð¡¼ --------");
-#else
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "retire exploring dungeons.");
-       do_cmd_write_nikki(NIKKI_GAMESTART, 1, "--------   Game  Over   --------");
-#endif
-       do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
+       /* If player did Seppuku, that is already written in playrecord */
+       if (!seppuku)
+       {
+               do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ダンジョンの探索から引退した。", "retired exploring dungeons."));
+               do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "--------   Game  Over   --------"));
+               do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
+       }
 
        /* Flush input */
        flush();