OSDN Git Service

[Refactor] #38862 gameterm.c/h and z-* to term/
[hengband/hengband.git] / src / view / status-first-page.c
index 0796cac..a8a36a8 100644 (file)
@@ -1,27 +1,29 @@
-/*!
+/*!
  * @file status-first-page.c
- * @brief \83L\83\83\83\89\8aî\96{\8fî\95ñ\8by\82Ñ\8bZ\94\\92l\82Ì\95\\8e¦
+ * @brief キャラ基本情報及び技能値の表示
  * @date 2020/02/23
  * @author Hourier
  */
 
-#include "angband.h"
+#include "system/angband.h"
+#include "term/gameterm.h"
 #include "status-first-page.h"
-#include "artifact.h"
+#include "display-util.h"
+#include "object/artifact.h"
 #include "combat/melee.h"
 #include "combat/shoot.h"
-#include "object-hook.h"
-#include "objectkind.h"
+#include "object/object-hook.h"
+#include "object/object-kind.h"
 
 static TERM_COLOR likert_color = TERM_WHITE;
 
 /*!
  * @brief 
- * @param creature_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
- * @param o_ptr \91\95\94õ\92\86\82Ì\8b|\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
- * @param shots \8eË\8c\82\89ñ\90\94
- * @param shot_frac \8eË\8c\82\91¬\93x
- * @return \82È\82µ
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param o_ptr 装備中の弓への参照ポインタ
+ * @param shots 射撃回数
+ * @param shot_frac 射撃速度
+ * @return なし
  */
 static void calc_shot_params(player_type *creature_ptr, object_type *o_ptr, int *shots, int *shot_frac)
 {
@@ -44,13 +46,13 @@ static void calc_shot_params(player_type *creature_ptr, object_type *o_ptr, int
 
 
 /*!
- * @brief \95\90\8aí\91\95\94õ\82É\90§\8cÀ\82Ì\82 \82é\83N\83\89\83X\82Å\81A\92¼\90Ú\8dU\8c\82\82Ì\83_\83\81\81[\83W\82ð\8cv\8eZ\82·\82é
- * @param creature_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
- * @param hand \8eè (\97\98\82«\8eè\82ª0\81A\94½\91Î\82Ì\8eè\82ª1\81c\82Ì\82Í\82¸)
- * @param damage \92¼\90Ú\8dU\8c\82\82Ì\83_\83\81\81[\83W
- * @param basedam \91f\8eè\82É\82¨\82¯\82é\92¼\90Ú\8dU\8c\82\82Ì\83_\83\81\81[\83W
- * @param o_ptr \91\95\94õ\92\86\82Ì\95\90\8aí\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
- * @return \97\98\82«\8eè\82È\82çTRUE\81A\94½\91Î\82Ì\8eè\82È\82çFALSE
+ * @brief 武器装備に制限のあるクラスで、直接攻撃のダメージを計算する
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param hand 手 (利き手が0、反対の手が1…のはず)
+ * @param damage 直接攻撃のダメージ
+ * @param basedam 素手における直接攻撃のダメージ
+ * @param o_ptr 装備中の武器への参照ポインタ
+ * @return 利き手ならTRUE、反対の手ならFALSE
  */
 static bool calc_weapon_damage_limit(player_type *creature_ptr, int hand, int *damage, int *basedam, object_type *o_ptr)
 {
@@ -78,12 +80,12 @@ static bool calc_weapon_damage_limit(player_type *creature_ptr, int hand, int *d
 
 
 /*!
- * @brief \95Ð\8eè\82 \82½\82è\82Ì\83_\83\81\81[\83W\97Ê\82ð\8cv\8eZ\82·\82é
- * @param o_ptr \91\95\94õ\92\86\82Ì\95\90\8aí\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
- * @param hand \8eè
- * @param damage \92¼\90Ú\8dU\8c\82\82Ì\83_\83\81\81[\83W
- * @param basedam \91f\8eè\82É\82¨\82¯\82é\92¼\90Ú\8dU\8c\82\82Ì\83_\83\81\81[\83W
- * @return \91f\8eè\82È\82çFALSE\81A\95\90\8aí\82ð\8e\9d\82Á\82Ä\82¢\82ê\82ÎTRUE
+ * @brief 片手あたりのダメージ量を計算する
+ * @param o_ptr 装備中の武器への参照ポインタ
+ * @param hand 
+ * @param damage 直接攻撃のダメージ
+ * @param basedam 素手における直接攻撃のダメージ
+ * @return 素手ならFALSE、武器を持っていればTRUE
  */
 static bool calc_weapon_one_hand(object_type *o_ptr, int hand, int *damage, int *basedam)
 {
@@ -102,12 +104,12 @@ static bool calc_weapon_one_hand(object_type *o_ptr, int hand, int *damage, int
 
 
 /*!
- * @brief \83\94\83H\81[\83p\83\8b\95\90\8aí\93\99\82É\82æ\82é\83_\83\81\81[\83W\8b­\89»
- * @param creature_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
- * @param o_ptr \91\95\94õ\92\86\82Ì\95\90\8aí\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
- * @param basedam \91f\8eè\82É\82¨\82¯\82é\92¼\90Ú\8dU\8c\82\82Ì\83_\83\81\81[\83W
- * @param flgs \83I\83u\83W\83F\83N\83g\83t\83\89\83O\8cQ
- * @return \8b­\89»\8cã\82Ì\91f\8eè\83_\83\81\81[\83W
+ * @brief ヴォーパル武器等によるダメージ強化
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param o_ptr 装備中の武器への参照ポインタ
+ * @param basedam 素手における直接攻撃のダメージ
+ * @param flgs オブジェクトフラグ群
+ * @return 強化後の素手ダメージ
  */
 static int strengthen_basedam(player_type *creature_ptr, object_type *o_ptr, int basedam, BIT_FLAGS *flgs)
 {
@@ -124,7 +126,7 @@ static int strengthen_basedam(player_type *creature_ptr, object_type *o_ptr, int
                basedam /= 9;
        }
 
-       // \97\9d\97Í
+       // 理力
        bool is_force = creature_ptr->pclass != CLASS_SAMURAI;
        is_force &= have_flag(flgs, TR_FORCE_WEAPON);
        is_force &= creature_ptr->csp > (o_ptr->dd * o_ptr->ds / 5);
@@ -135,11 +137,11 @@ static int strengthen_basedam(player_type *creature_ptr, object_type *o_ptr, int
 
 
 /*!
- * @brief \8bZ\94\\83\89\83\93\83N\82Ì\95\\8e¦\8aî\8f\80\82ð\92è\82ß\82é
+ * @brief 技能ランクの表示基準を定める
  * Returns a "rating" of x depending on y
- * @param x \8bZ\94\\92l
- * @param y \8bZ\94\\92l\82É\91Î\82·\82é\83\89\83\93\83N\8aî\8f\80\94ä
- * @return \82È\82µ
+ * @param x 技能値
+ * @param y 技能値に対するランク基準比
+ * @return なし
  */
 static concptr likert(int x, int y)
 {
@@ -154,7 +156,7 @@ static concptr likert(int x, int y)
        if (x < 0)
        {
                likert_color = TERM_L_DARK;
-               strcat(dummy, _("\8dÅ\92á", "Very Bad"));
+               strcat(dummy, _("最低", "Very Bad"));
                return dummy;
        }
 
@@ -164,40 +166,40 @@ static concptr likert(int x, int y)
        case 1:
        {
                likert_color = TERM_RED;
-               strcat(dummy, _("\88«\82¢", "Bad"));
+               strcat(dummy, _("悪い", "Bad"));
                break;
 
        }
        case 2:
        {
                likert_color = TERM_L_RED;
-               strcat(dummy, _("\97ò\82é", "Poor"));
+               strcat(dummy, _("劣る", "Poor"));
                break;
        }
        case 3:
        case 4:
        {
                likert_color = TERM_ORANGE;
-               strcat(dummy, _("\95\81\92Ê", "Fair"));
+               strcat(dummy, _("普通", "Fair"));
                break;
        }
        case 5:
        {
                likert_color = TERM_YELLOW;
-               strcat(dummy, _("\97Ç\82¢", "Good"));
+               strcat(dummy, _("良い", "Good"));
                break;
        }
        case 6:
        {
                likert_color = TERM_YELLOW;
-               strcat(dummy, _("\91å\95Ï\97Ç\82¢", "Very Good"));
+               strcat(dummy, _("大変良い", "Very Good"));
                break;
        }
        case 7:
        case 8:
        {
                likert_color = TERM_L_GREEN;
-               strcat(dummy, _("\91ì\89z", "Excellent"));
+               strcat(dummy, _("卓越", "Excellent"));
                break;
        }
        case 9:
@@ -207,7 +209,7 @@ static concptr likert(int x, int y)
        case 13:
        {
                likert_color = TERM_GREEN;
-               strcat(dummy, _("\92´\89z", "Superb"));
+               strcat(dummy, _("超越", "Superb"));
                break;
        }
        case 14:
@@ -216,13 +218,13 @@ static concptr likert(int x, int y)
        case 17:
        {
                likert_color = TERM_BLUE;
-               strcat(dummy, _("\89p\97Y\93I", "Heroic"));
+               strcat(dummy, _("英雄的", "Heroic"));
                break;
        }
        default:
        {
                likert_color = TERM_VIOLET;
-               sprintf(dummy2, _("\93`\90à\93I[%d]", "Legendary[%d]"), (int)((((x / y) - 17) * 5) / 2));
+               sprintf(dummy2, _("伝説的[%d]", "Legendary[%d]"), (int)((((x / y) - 17) * 5) / 2));
                strcat(dummy, dummy2);
                break;
        }
@@ -233,11 +235,11 @@ static concptr likert(int x, int y)
 
 
 /*!
- * @brief \8b|\81{\97¼\8eè\82Ì\95\90\8aí\82»\82ê\82¼\82ê\82É\82Â\82¢\82Ä\83_\83\81\81[\83W\82ð\8cv\8eZ\82·\82é
- * @param creature_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
- * @param damage \92¼\90Ú\8dU\8c\82\82Ì\83_\83\81\81[\83W
- * @param to_h \96½\92\86\95â\90³
- * @return \82È\82µ
+ * @brief 弓+両手の武器それぞれについてダメージを計算する
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param damage 直接攻撃のダメージ
+ * @param to_h 命中補正
+ * @return なし
  */
 static void calc_two_hands(player_type *creature_ptr, int *damage, int *to_h)
 {
@@ -281,16 +283,16 @@ static void calc_two_hands(player_type *creature_ptr, int *damage, int *to_h)
 
 
 /*!
- * @brief \83L\83\83\83\89\8aî\96{\8fî\95ñ\8by\82Ñ\8bZ\94\\92l\82ð\83\81\83C\83\93\83E\83B\83\93\83h\83E\82É\95\\8e¦\82·\82é
- * @param creature_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
- * @param xthb \95\90\8aí\93\99\82ð\8aÜ\82ß\82½\8dÅ\8fI\96½\92\86\97¦
- * @param damage \91Å\8c\82\8fC\90³
- * @param shots \8eË\8c\82\89ñ\90\94
- * @param shot_frac \8eË\8c\82\91¬\93x
- * @param display_player_one_line 1\8ds\95\\8e¦\97p\82Ì\83R\81[\83\8b\83o\83b\83N\8aÖ\90\94
- * @return \82È\82µ
+ * @brief キャラ基本情報及び技能値をメインウィンドウに表示する
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param xthb 武器等を含めた最終命中率
+ * @param damage 打撃修正
+ * @param shots 射撃回数
+ * @param shot_frac 射撃速度
+ * @param display_player_one_line 1行表示用のコールバック関数
+ * @return なし
  */
-static void display_first_page(player_type *creature_ptr, int xthb, int *damage, int shots, int shot_frac, void(*display_player_one_line)(int, concptr, TERM_COLOR))
+static void display_first_page(player_type *creature_ptr, int xthb, int *damage, int shots, int shot_frac)
 {
        int xthn = creature_ptr->skill_thn + (creature_ptr->to_h_m * BTH_PLUS_ADJ);
 
@@ -312,62 +314,62 @@ static void display_first_page(player_type *creature_ptr, int xthb, int *damage,
        int xdig = creature_ptr->skill_dig;
 
        concptr desc = likert(xthn, 12);
-       (*display_player_one_line)(ENTRY_SKILL_FIGHT, desc, likert_color);
+       display_player_one_line(ENTRY_SKILL_FIGHT, desc, likert_color);
 
        desc = likert(xthb, 12);
-       (*display_player_one_line)(ENTRY_SKILL_SHOOT, desc, likert_color);
+       display_player_one_line(ENTRY_SKILL_SHOOT, desc, likert_color);
 
        desc = likert(xsav, 7);
-       (*display_player_one_line)(ENTRY_SKILL_SAVING, desc, likert_color);
+       display_player_one_line(ENTRY_SKILL_SAVING, desc, likert_color);
 
        desc = likert((xstl > 0) ? xstl : -1, 1);
-       (*display_player_one_line)(ENTRY_SKILL_STEALTH, desc, likert_color);
+       display_player_one_line(ENTRY_SKILL_STEALTH, desc, likert_color);
 
        desc = likert(xfos, 6);
-       (*display_player_one_line)(ENTRY_SKILL_PERCEP, desc, likert_color);
+       display_player_one_line(ENTRY_SKILL_PERCEP, desc, likert_color);
 
        desc = likert(xsrh, 6);
-       (*display_player_one_line)(ENTRY_SKILL_SEARCH, desc, likert_color);
+       display_player_one_line(ENTRY_SKILL_SEARCH, desc, likert_color);
 
        desc = likert(xdis, 8);
-       (*display_player_one_line)(ENTRY_SKILL_DISARM, desc, likert_color);
+       display_player_one_line(ENTRY_SKILL_DISARM, desc, likert_color);
 
        desc = likert(xdev, 6);
-       (*display_player_one_line)(ENTRY_SKILL_DEVICE, desc, likert_color);
+       display_player_one_line(ENTRY_SKILL_DEVICE, desc, likert_color);
 
        desc = likert(xdev, 6);
-       (*display_player_one_line)(ENTRY_SKILL_DEVICE, desc, likert_color);
+       display_player_one_line(ENTRY_SKILL_DEVICE, desc, likert_color);
 
        desc = likert(xdig, 4);
-       (*display_player_one_line)(ENTRY_SKILL_DIG, desc, likert_color);
+       display_player_one_line(ENTRY_SKILL_DIG, desc, likert_color);
 
        if (!muta_att)
-               (*display_player_one_line)(ENTRY_BLOWS, format("%d+%d", blows1, blows2), TERM_L_BLUE);
+               display_player_one_line(ENTRY_BLOWS, format("%d+%d", blows1, blows2), TERM_L_BLUE);
        else
-               (*display_player_one_line)(ENTRY_BLOWS, format("%d+%d+%d", blows1, blows2, muta_att), TERM_L_BLUE);
+               display_player_one_line(ENTRY_BLOWS, format("%d+%d+%d", blows1, blows2, muta_att), TERM_L_BLUE);
 
-       (*display_player_one_line)(ENTRY_SHOTS, format("%d.%02d", shots, shot_frac), TERM_L_BLUE);
+       display_player_one_line(ENTRY_SHOTS, format("%d.%02d", shots, shot_frac), TERM_L_BLUE);
 
        if ((damage[0] + damage[1]) == 0)
                desc = "nil!";
        else
                desc = format("%d+%d", blows1 * damage[0] / 100, blows2 * damage[1] / 100);
 
-       (*display_player_one_line)(ENTRY_AVG_DMG, desc, TERM_L_BLUE);
-       (*display_player_one_line)(ENTRY_INFRA, format("%d feet", creature_ptr->see_infra * 10), TERM_WHITE);
+       display_player_one_line(ENTRY_AVG_DMG, desc, TERM_L_BLUE);
+       display_player_one_line(ENTRY_INFRA, format("%d feet", creature_ptr->see_infra * 10), TERM_WHITE);
 }
 
 
 /*!
- * @brief \83v\83\8c\83C\83\84\81[\83X\83e\81[\83^\83X\82Ì1\83y\81[\83W\96Ú\8ae\8eí\8fÚ\8d×\82ð\82Ü\82Æ\82ß\82Ä\95\\8e¦\82·\82é
+ * @brief プレイヤーステータスの1ページ目各種詳細をまとめて表示する
  * Prints ratings on certain abilities
- * @param creature_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
- * @param display_player_one_line 1\8ds\95\\8e¦\97p\82Ì\83R\81[\83\8b\83o\83b\83N\8aÖ\90\94
- * @return \82È\82µ
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param display_player_one_line 1行表示用のコールバック関数
+ * @return なし
  * @details
  * This code is "imitated" elsewhere to "dump" a character sheet.
  */
-void display_player_various(player_type *creature_ptr, void(*display_player_one_line)(int, concptr, TERM_COLOR))
+void display_player_various(player_type *creature_ptr)
 {
        object_type *o_ptr;
        o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
@@ -380,5 +382,5 @@ void display_player_various(player_type *creature_ptr, void(*display_player_one_
        int damage[2];
        int to_h[2];
        calc_two_hands(creature_ptr, damage, to_h);
-       display_first_page(creature_ptr, xthb, damage, shots, shot_frac, display_player_one_line);
+       display_first_page(creature_ptr, xthb, damage, shots, shot_frac);
 }