OSDN Git Service

Merge remote-tracking branch 'remotes/hengbandosx/english-knowledge-edits' into featu...
[hengband/hengband.git] / src / view / display-util.c
1 #include "display-util.h"
2 #include "term/term-color-types.h"
3
4 static struct
5 {
6         int col;
7         int row;
8         int len;
9         char header[20];
10 } disp_player_line[]
11 #ifdef JP
12 = {
13         { 1, 10, 25, "打撃修正(格闘)"},
14         { 1, 10, 25, "打撃修正(両手)"},
15         { 1, 10, 25, "打撃修正(右手)"},
16         { 1, 10, 25, "打撃修正(左手)"},
17         { 1, 11, 25, "打撃修正(左手)"},
18         { 1, 11, 25, "打撃修正(右手)"},
19         { 1, 11, 25, ""},
20         { 1, 15, 25, "射撃攻撃修正"},
21         { 1, 16, 25, "射撃武器倍率"},
22         { 1, 20, 25, "加速"},
23         { 1, 19, 25, "AC"},
24         {29, 13, 21, "レベル"},
25         {29, 14, 21, "経験値"},
26         {29, 15, 21, "最大経験"},
27         {29, 16, 21, "次レベル"},
28         {29, 17, 21, "所持金"},
29         {29, 19, 21, "日付"},
30         {29, 10, 21, "HP"},
31         {29, 11, 21, "MP"},
32         {29, 20, 21, "プレイ時間"},
33         {53, 10, -1, "打撃命中  :"},
34         {53, 11, -1, "射撃命中  :"},
35         {53, 12, -1, "魔法防御  :"},
36         {53, 13, -1, "隠密行動  :"},
37         {53, 15, -1, "知覚      :"},
38         {53, 16, -1, "探索      :"},
39         {53, 17, -1, "解除      :"},
40         {53, 18, -1, "魔法道具  :"},
41         { 1, 12, 25, "打撃回数"},
42         { 1, 17, 25, "射撃回数"},
43         { 1, 13, 25, "平均ダメージ"},
44         {53, 20, -1, "赤外線視力:"},
45         {26,  1, -1, "名前  : "},
46         { 1,  3, -1, "性別     : "},
47         { 1,  4, -1, "種族     : "},
48         { 1,  5, -1, "職業     : "},
49         { 1,  6, -1, "魔法     : "},
50         { 1,  7, -1, "守護魔神 : "},
51         {29,  3, 21, "年齢"},
52         {29,  4, 21, "身長"},
53         {29,  5, 21, "体重"},
54         {29,  6, 21, "社会的地位"},
55         {29,  7, 21, "属性"},
56         {29, 14, 21, "強化度"},
57         {29, 16, 21, "次レベル"},
58         {53, 19, -1, "掘削      :" },
59 };
60 #else
61 = {
62         { 1, 10, 25, "Bare hand"},
63         { 1, 10, 25, "Two hands"},
64         { 1, 10, 25, "Right hand"},
65         { 1, 10, 25, "Left hand"},
66         { 1, 11, 25, "Left hand"},
67         { 1, 11, 25, "Right hand"},
68         { 1, 11, 25, "Posture"},
69         { 1, 15, 25, "Shooting"},
70         { 1, 16, 25, "Multiplier"},
71         { 1, 20, 25, "Speed"},
72         { 1, 19, 25, "AC"},
73         {29, 13, 21, "Level"},
74         {29, 14, 21, "Experience"},
75         {29, 15, 21, "Max Exp"},
76         {29, 16, 21, "Exp to Adv"},
77         {29, 17, 21, "Gold"},
78         {29, 19, 21, "Time"},
79         {29, 10, 21, "Hit point"},
80         {29, 11, 21, "SP (Mana)"},
81         {29, 20, 21, "Play time"},
82         {53, 10, -1, "Fighting   : "},
83         {53, 11, -1, "Bows/Throw : "},
84         {53, 12, -1, "SavingThrow: "},
85         {53, 13, -1, "Stealth    : "},
86         {53, 15, -1, "Perception : "},
87         {53, 16, -1, "Searching  : "},
88         {53, 17, -1, "Disarming  : "},
89         {53, 18, -1, "MagicDevice: "},
90         { 1, 12, 25, "Blows/Round"},
91         { 1, 17, 25, "Shots/Round"},
92         { 1, 13, 25, "AverageDmg/Rnd"},
93         {53, 20, -1, "Infravision: "},
94         {26,  1, -1, "Name  : "},
95         { 1,  3, -1, "Sex      : "},
96         { 1,  4, -1, "Race     : "},
97         { 1,  5, -1, "Class    : "},
98         { 1,  6, -1, "Magic    : "},
99         { 1,  7, -1, "Patron   : "},
100         {29,  3, 21, "Age"},
101         {29,  4, 21, "Height"},
102         {29,  5, 21, "Weight"},
103         {29,  6, 21, "Social Class"},
104         {29,  7, 21, "Align"},
105         {29, 14, 21, "Construction"},
106         {29, 16, 21, "Const to Adv"},
107         {53, 19, -1, "Digging    : " },
108 };
109 #endif
110
111
112 /*!
113  * @brief プレイヤーのステータス1種を出力する
114  * @param entry 項目ID
115  * @param val 値を保管した文字列ポインタ
116  * @param attr 項目表示の色
117  * @return なし
118  */
119 void display_player_one_line(int entry, concptr val, TERM_COLOR attr)
120 {
121         concptr head = disp_player_line[entry].header;
122         int head_len = strlen(head);
123         int row = disp_player_line[entry].row;
124         int col = disp_player_line[entry].col;
125         int len = disp_player_line[entry].len;
126         term_putstr(col, row, -1, TERM_WHITE, head);
127
128         if (!val) return;
129
130         if (len <= 0)
131         {
132                 term_putstr(col + head_len, row, -1, attr, val);
133                 return;
134         }
135
136         int val_len = len - head_len;
137         char buf[40];
138         sprintf(buf, "%*.*s", val_len, val_len, val);
139         term_putstr(col + head_len, row, -1, attr, buf);
140 }