OSDN Git Service

Merge branch 'master' of git.sourceforge.jp:/gitroot/hengband/hengband
[hengband/hengband.git] / src / avatar.c
index 5bfa4a5..f9c95e1 100644 (file)
@@ -1,6 +1,6 @@
-/*!
+/*!
     @file avatar.c
-    @brief ¥¦¥ë¥Æ¥£¥Þ£´¤ò»²¹Í¤Ë¤·¤¿ÆÁ¤Î¥·¥¹¥Æ¥à¤Î¼ÂÁõ / Enable an Ultima IV style "avatar" game where you try to achieve perfection in various virtues.
+    @brief ウルティマ4を参考にした徳のシステムの実装 / Enable an Ultima IV style "avatar" game where you try to achieve perfection in various virtues.
     @date 2013/12/23
     @author
     Topi Ylinen 1998\n
 #include "angband.h"
 
 /*!
- * ÆÁ¤Î̾¾Î / The names of the virtues
+ * 徳の名称 / The names of the virtues
  */
 cptr virtue[MAX_VIRTUE] =
 {
-#ifdef JP
-       "¾ð",
-       "ÍÀ",
-       "Àµ",
-       "µ¾",
-       "¼±",
-       "À¿",
-       "·¼",
-       "Èë",
-       "±¿",
-       "Á³",
-       "Ĵ",
-       "³è",
-       "»à",
-       "Ǧ",
-       "Àá",
-       "¶Ð",
-       "ͦ",
-       "¸Ä",
-#else
-       "Compassion",
-       "Honour",
-       "Justice",
-       "Sacrifice",
-       "Knowledge",
-       "Faith",
-       "Enlightenment",
-       "Mysticism",
-       "Chance",
-       "Nature",
-       "Harmony",
-       "Vitality",
-       "Unlife",
-       "Patience",
-       "Temperance",
-       "Diligence",
-       "Valour",
-       "Individualism",
-#endif
+       _("情", "Compassion"),
+       _("誉", "Honour"),
+       _("正", "Justice"),
+       _("犠", "Sacrifice"),
+       _("識", "Knowledge"),
+       _("誠", "Faith"),
+       _("啓", "Enlightenment"),
+       _("秘", "Mysticism"),
+       _("運", "Chance"),
+       _("然", "Nature"),
+       _("調", "Harmony"),
+       _("活", "Vitality"),
+       _("死", "Unlife"),
+       _("忍", "Patience"),
+       _("節", "Temperance"),
+       _("勤", "Diligence"),
+       _("勇", "Valour"),
+       _("個", "Individualism"),
 };
 
 /*!
- * @brief ³ºÅö¤ÎÆÁ¤¬¥×¥ì¥¤¥ä¡¼¤Ë»ØÄꤵ¤ì¤Æ¤¤¤ë¤«Èݤ«¤Ë±þ¤¸¤Ä¤Ä¡¢Âç¾®¤òÈæ³Ó¤¹¤ë¡£
- * @details ÆÁ¤¬¤Ê¤¤¾ì¹ç¤ÏÃÍ0¤È¤·¤ÆÈæ³Ó¤¹¤ë¡£
- * @param type Èæ³Ó¤·¤¿¤¤ÆÁ¤ÎID
- * @param num Èæ³Ó´ð½àÃÍ
- * @param tekitou VIRTUE_LARGE = ´ð½àÃͤè¤êÂ礭¤¤¤« / VIRTUE_SMALL = ´ð½àÃͤè¤ê¾®¤µ¤¤¤«
- * @return Èæ³Ó¤Î¿¿µ¶ÃͤòÊÖ¤¹
- * @todo °ú¿ô̾¤òľ¤·¤Æ¤ª¤¯
+ * @brief 該当の徳がプレイヤーに指定されているか否かに応じつつ、大小を比較する。
+ * @details 徳がない場合は値0として比較する。
+ * @param type 比較したい徳のID
+ * @param num 比較基準値
+ * @param tekitou VIRTUE_LARGE = 基準値より大きいか / VIRTUE_SMALL = 基準値より小さいか
+ * @return 比較の真偽値を返す
+ * @todo 引数名を直しておく
  */
 bool compare_virtue(int type, int num, int tekitou)
 {
@@ -93,9 +72,9 @@ bool compare_virtue(int type, int num, int tekitou)
 }
 
 /*!
- * @brief ¥×¥ì¥¤¥ä¡¼¤Î»ØÄê¤ÎÆÁ¤¬²¿ÈÖÌܤΥ¹¥í¥Ã¥È¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¤«¤òÊÖ¤¹¡£ / Aux function
- * @param type ³Îǧ¤·¤¿¤¤ÆÁ¤ÎID
- * @return ¥¹¥í¥Ã¥È¤¬¤¢¤ë¤Ê¤é¤Ð¥¹¥í¥Ã¥È¤ÎID(0¡Á7)+1¡¢¤Ê¤¤¾ì¹ç¤Ï0¤òÊÖ¤¹¡£
+ * @brief プレイヤーの指定の徳が何番目のスロットに登録されているかを返す。 / Aux function
+ * @param type 確認したい徳のID
+ * @return スロットがあるならばスロットのID(0~7)+1、ない場合は0を返す。
  */
 int virtue_number(int type)
 {
@@ -112,9 +91,9 @@ int virtue_number(int type)
 }
 
 /*!
- * @brief ¥×¥ì¥¤¥ä¡¼¤Î¿¦¶È¤ä¼ï²¤Ë°Í¸¤·¤Ê¤¤¥é¥ó¥À¥à¤ÊÆÁ¤ò¼èÆÀ¤¹¤ë / Aux function
- * @param which ³Îǧ¤·¤¿¤¤ÆÁ¤ÎID
- * @return ¤Ê¤·
+ * @brief プレイヤーの職業や種族に依存しないランダムな徳を取得する / Aux function
+ * @param which 確認したい徳のID
+ * @return なし
  */
 static void get_random_virtue(int which)
 {
@@ -156,15 +135,15 @@ static void get_random_virtue(int which)
        }
 
        /* Chosen */
-       p_ptr->vir_types[which] = type;
+       p_ptr->vir_types[which] = (s16b)type;
 }
 
 /*!
- * @brief ¥×¥ì¥¤¥ä¡¼¤ÎÁª¤ó¤ÀËâË¡Îΰè¤Ë±þ¤¸¤ÆÂбþ¤¹¤ëÆÁ¤òÊÖ¤¹¡£
- * @param realm ËâË¡Îΰè¤ÎID
- * @return Âбþ¤¹¤ëÆÁ¤ÎID
+ * @brief プレイヤーの選んだ魔法領域に応じて対応する徳を返す。
+ * @param realm 魔法領域のID
+ * @return 対応する徳のID
  */
-static s16b get_realm_virtues(byte realm)
+static VIRTUES_IDX get_realm_virtues(REALM_IDX realm)
 {
        switch (realm)
        {
@@ -205,9 +184,9 @@ static s16b get_realm_virtues(byte realm)
 
 
 /*!
- * @brief ºîÀ®Ãæ¤Î¥×¥ì¥¤¥ä¡¼¥­¥ã¥é¥¯¥¿¡¼¤ËÆÁ8¼ïÎà¤òÍ¿¤¨¤ë¡£ / Select virtues & reset values for a new character
- * @details ¿¦¶È¤Ë±þ¤¸¤Æ1¡Á4¼ï¤¬¸ÇÄê¡¢¼ï²¤Ë±þ¤¸¤Æ1¼ïÎबͿ¤¨¤é¤ì¡¢¸å¤Ï½ÅÊ£¤Ê¤¯¥é¥ó¥À¥à¤ËÁªÂò¤µ¤ì¤ë¡£
- * @return ¤Ê¤·
+ * @brief 作成中のプレイヤーキャラクターに徳8種類を与える。 / Select virtues & reset values for a new character
+ * @details 職業に応じて1~4種が固定、種族に応じて1種類が与えられ、後は重複なくランダムに選択される。
+ * @return なし
  */
 void get_virtues(void)
 {
@@ -414,19 +393,19 @@ void get_virtues(void)
 }
 
 /*!
- * @brief Âбþ¤¹¤ëÆÁ¤ò¥×¥ì¥¤¥ä¡¼¤¬¥¹¥í¥Ã¥È¤ËÅÐÏ¿¤·¤Æ¤¤¤ë¾ì¹ç¤Ë²Ã¸º¤ò¹Ô¤¦¡£
- * @details ÈϰϤÏ-125¡Á125¡¢´ðËÜŪ¤ËÀäÂÐÃͤ¬Â礭¤¤¤Û¤ÉÀäÂÐÃͤ¬¾å¤¬¤ê¿É¤¯¤Ê¤ë¡£
- * @param virtue ÆÁ¤ÎID
- * @param amount ²Ã¸ºÎÌ
- * @return ¤Ê¤·
+ * @brief 対応する徳をプレイヤーがスロットに登録している場合に加減を行う。
+ * @details 範囲は-125~125、基本的に絶対値が大きいほど絶対値が上がり辛くなる。
+ * @param virtue 徳のID
+ * @param amount 加減量
+ * @return なし
  */
-void chg_virtue(int virtue, int amount)
+void chg_virtue(int virtue_id, int amount)
 {
        int i = 0;
 
        for (i = 0; i < 8; i++)
        {
-               if (p_ptr->vir_types[i] == virtue)
+               if (p_ptr->vir_types[i] == virtue_id)
                {
                        if (amount > 0)
                        {
@@ -479,29 +458,29 @@ void chg_virtue(int virtue, int amount)
 }
 
 /*!
- * @brief Âбþ¤¹¤ëÆÁ¤ò¥×¥ì¥¤¥ä¡¼¤¬¥¹¥í¥Ã¥È¤ËÅÐÏ¿¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¸ÇÄêÃͤò¥»¥Ã¥È¤¹¤ë¡£
- * @param virtue ÆÁ¤ÎID
- * @param amount ¥»¥Ã¥È¤·¤¿¤¤ÃÍ¡£
- * @return ¤Ê¤·
+ * @brief 対応する徳をプレイヤーがスロットに登録している場合に固定値をセットする。
+ * @param virtue 徳のID
+ * @param amount セットしたい値。
+ * @return なし
  */
-void set_virtue(int virtue, int amount)
+void set_virtue(int virtue_id, int amount)
 {
        int i = 0;
 
        for (i = 0; i < 8; i++)
        {
-               if (p_ptr->vir_types[i] == virtue)
+               if (p_ptr->vir_types[i] == virtue_id)
                {
-                       p_ptr->virtues[i] = amount;
+                       p_ptr->virtues[i] = (s16b)amount;
                        return;
                }
        }
 }
 
 /*!
- * @brief ÆÁ¤Î¥À¥ó¥×ɽ¼¨¤ò¹Ô¤¦¡£
- * @param OutFile ¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿¡£
- * @return ¤Ê¤·
+ * @brief 徳のダンプ表示を行う。
+ * @param OutFile ファイルポインタ。
+ * @return なし
  */
 void dump_virtues(FILE *OutFile)
 {
@@ -511,122 +490,40 @@ void dump_virtues(FILE *OutFile)
 
        for (v_nr = 0; v_nr < 8; v_nr++)
        {
-               char v_name [20];
+               char vir_name [20];
                int tester = p_ptr->virtues[v_nr];
 
-               strcpy(v_name, virtue[(p_ptr->vir_types[v_nr])-1]);
+               strcpy(vir_name, virtue[(p_ptr->vir_types[v_nr])-1]);
 
                if (p_ptr->vir_types[v_nr] == 0 || p_ptr->vir_types[v_nr] > MAX_VIRTUE)
-#ifdef JP
-                       fprintf(OutFile, "¤ª¤Ã¤È¡£%s¤Î¾ðÊó¤Ê¤·¡£", v_name);
-#else
-                       fprintf(OutFile, "Oops. No info about %s.", v_name);
-#endif
+                       fprintf(OutFile, _("おっと。%sの情報なし。", "Oops. No info about %s."), vir_name);
 
                else if (tester < -100)
-#ifdef JP
-                       fprintf(OutFile, "[%s]¤ÎÂжË",
-#else
-                       fprintf(OutFile, "You are the polar opposite of %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile, _("[%s]の対極", "You are the polar opposite of %s."), vir_name);
                else if (tester < -80)
-#ifdef JP
-                       fprintf(OutFile, "[%s]¤ÎÂçŨ",
-#else
-                       fprintf(OutFile, "You are an arch-enemy of %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile, _("[%s]の大敵", "You are an arch-enemy of %s."), vir_name);
                else if (tester < -60)
-#ifdef JP
-                       fprintf(OutFile, "[%s]¤Î¶¯Å¨",
-#else
-                       fprintf(OutFile, "You are a bitter enemy of %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile, _("[%s]の強敵", "You are a bitter enemy of %s."), vir_name);
                else if (tester < -40)
-#ifdef JP
-                       fprintf(OutFile, "[%s]¤ÎŨ",
-#else
-                       fprintf(OutFile, "You are an enemy of %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile, _("[%s]の敵", "You are an enemy of %s."), vir_name);
                else if (tester < -20)
-#ifdef JP
-                       fprintf(OutFile, "[%s]¤Îºá¼Ô",
-#else
-                       fprintf(OutFile, "You have sinned against %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile, _("[%s]の罪者", "You have sinned against %s."), vir_name);
                else if (tester < 0)
-#ifdef JP
-                       fprintf(OutFile, "[%s]¤ÎÌÂÆ»¼Ô",
-#else
-                       fprintf(OutFile, "You have strayed from the path of %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile, _("[%s]の迷道者", "You have strayed from the path of %s."), vir_name);
                else if (tester == 0)
-#ifdef JP
-                       fprintf(OutFile,"[%s]¤ÎÃæΩ¼Ô",
-#else
-                       fprintf(OutFile,"You are neutral to %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile,_("[%s]の中立者", "You are neutral to %s."), vir_name);
                else if (tester < 20)
-#ifdef JP
-                       fprintf(OutFile,"[%s]¤Î¾®ÆÁ¼Ô",
-#else
-                       fprintf(OutFile,"You are somewhat virtuous in %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile,_("[%s]の小徳者", "You are somewhat virtuous in %s."), vir_name);
                else if (tester < 40)
-#ifdef JP
-                       fprintf(OutFile,"[%s]¤ÎÃæÆÁ¼Ô",
-#else
-                       fprintf(OutFile,"You are virtuous in %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile,_("[%s]の中徳者", "You are virtuous in %s."), vir_name);
                else if (tester < 60)
-#ifdef JP
-                       fprintf(OutFile,"[%s]¤Î¹âÆÁ¼Ô",
-#else
-                       fprintf(OutFile,"You are very virtuous in %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile,_("[%s]の高徳者", "You are very virtuous in %s."), vir_name);
                else if (tester < 80)
-#ifdef JP
-                       fprintf(OutFile,"[%s]¤ÎÇƼÔ",
-#else
-                       fprintf(OutFile,"You are a champion of %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile,_("[%s]の覇者", "You are a champion of %s."), vir_name);
                else if (tester < 100)
-#ifdef JP
-                       fprintf(OutFile,"[%s]¤Î°ÎÂç¤ÊÇƼÔ",
-#else
-                       fprintf(OutFile,"You are a great champion of %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile,_("[%s]の偉大な覇者", "You are a great champion of %s."), vir_name);
                else
-#ifdef JP
-                       fprintf(OutFile,"[%s]¤Î¶ñ¸½¼Ô",
-#else
-                       fprintf(OutFile,"You are the living embodiment of %s.",
-#endif
-
-                               v_name);
+                       fprintf(OutFile,_("[%s]の具現者", "You are the living embodiment of %s."), vir_name);
 
            fprintf(OutFile, "\n");
        }