OSDN Git Service

b66b8d6c4f0b703b28b6682d7a434772e84282b7
[hengband/hengband.git] / src / view-mainwindow.c
1 /*!
2  * @file xtra1.c
3  * @brief プレイヤーのステータス処理 / status
4  * @date 2018/09/25
5  * @author
6  * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7  * This software may be copied and distributed for educational, research, and\n
8  * not for profit purposes provided that this copyright and statement are\n
9  * included in all such copies.\n
10  * 2014 Deskull rearranged comment for Doxygen.
11  */
12
13 #include "angband.h"
14 #include "util.h"
15 #include "autopick.h"
16 #include "term.h"
17
18 #include "core.h"
19 #include "files.h"
20 #include "world.h"
21 #include "quest.h"
22 #include "artifact.h"
23 #include "avatar.h"
24 #include "player-status.h"
25 #include "player-class.h"
26 #include "player-race.h"
27 #include "player-effects.h"
28 #include "monster.h"
29 #include "view-mainwindow.h"
30
31 #include "spells.h"
32 #include "realm-hex.h"
33
34 #include "object-flavor.h"
35
36 #include "grid.h"
37 #include "dungeon.h"
38 #include "floor.h"
39 #include "floor-town.h"
40 #include "feature.h"
41 #include "objectkind.h"
42 #include "targeting.h"
43
44 static int feat_priority; /*!< マップ縮小表示時に表示すべき地形の優先度を保管する */
45 static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
46 static int match_autopick;
47 static object_type *autopick_obj; /*!< 各種自動拾い処理時に使うオブジェクトポインタ */
48
49  /*
50   * Some screen locations for various display routines
51   * Currently, row 8 and 15 are the only "blank" rows.
52   * That leaves a "border" around the "stat" values.
53   */
54
55 #define ROW_RACE                1
56 #define COL_RACE                0       /* <race name> */
57
58   /*#define ROW_CLASS               2 */
59   /*#define COL_CLASS               0 */      /* <class name> */
60
61 #define ROW_TITLE               2
62 #define COL_TITLE               0       /* <title> or <mode> */
63
64 /*#define ROW_SEIKAKU           4 */
65 /*#define COL_SEIKAKU           0*/     /* <seikaku> */
66
67 #define ROW_DAY                 21
68 #define COL_DAY                 0       /* day */
69
70 #define ROW_DUNGEON             22
71 #define COL_DUNGEON             0       /* dungeon */
72
73 #define ROW_LEVEL               3
74 #define COL_LEVEL               0       /* "LEVEL xxxxxx" */
75
76 #define ROW_EXP                 4
77 #define COL_EXP                 0       /* "EXP xxxxxxxx" */
78
79 #define ROW_GOLD                5
80 #define COL_GOLD                0       /* "AU xxxxxxxxx" */
81
82 #define ROW_EQUIPPY             6
83 #define COL_EQUIPPY             0       /* equippy chars */
84
85 #define ROW_STAT                7
86 #define COL_STAT                0       /* "xxx   xxxxxx" */
87
88 #define ROW_AC                  13
89 #define COL_AC                  0       /* "Cur AC xxxxx" */
90
91 #define ROW_HPMP                14
92 #define COL_HPMP                0
93
94 #define ROW_CURHP               14
95 #define COL_CURHP               0       /* "Cur HP xxxxx" */
96
97 #define ROW_CURSP               15
98 #define COL_CURSP               0       /* "Cur SP xxxxx" */
99
100 #define ROW_RIDING_INFO         16
101 #define COL_RIDING_INFO         0       /* "xxxxxxxxxxxx" */
102
103 #define ROW_INFO                17
104 #define COL_INFO                0       /* "xxxxxxxxxxxx" */
105
106 #define ROW_CUT                 18
107 #define COL_CUT                 0       /* <cut> */
108
109 #define ROW_STUN                19
110 #define COL_STUN                0       /* <stun> */
111
112 #define ROW_HUNGRY              20
113 #define COL_HUNGRY              0       /* "Weak" / "Hungry" / "Full" / "Gorged" */
114
115 #define ROW_STATE               20
116 #define COL_STATE                7      /* <state> */
117
118 #define ROW_SPEED               (-1)
119 #define COL_SPEED               (-24)      /* "Slow (-NN)" or "Fast (+NN)" */
120
121 #define ROW_STUDY               (-1)
122 #define COL_STUDY               (-13)      /* "Study" */
123
124 #define ROW_DEPTH               (-1)
125 #define COL_DEPTH               (-8)      /* "Lev NNN" / "NNNN ft" */
126
127 #define ROW_STATBAR             (-1)
128 #define COL_STATBAR              0
129 #define MAX_COL_STATBAR         (-26)
130
131
132
133 /*!
134  * @brief 画面左の能力値表示を行うために指定位置から13キャラ分を空白消去後指定のメッセージを明るい青で描画する /
135  * Print character info at given row, column in a 13 char field
136  * @param info 表示文字列
137  * @param row 描画列
138  * @param col 描画行
139  * @return なし
140  */
141 static void prt_field(concptr info, TERM_LEN row, TERM_LEN col)
142 {
143         /* Dump 13 spaces to clear */
144         c_put_str(TERM_WHITE, "             ", row, col);
145
146         /* Dump the info itself */
147         c_put_str(TERM_L_BLUE, info, row, col);
148 }
149
150 /*!
151  * @brief ゲーム時刻を表示する /
152  * Print time
153  * @return なし
154  */
155 void prt_time(void)
156 {
157         int day, hour, min;
158
159         /* Dump 13 spaces to clear */
160         c_put_str(TERM_WHITE, "             ", ROW_DAY, COL_DAY);
161
162         extract_day_hour_min(&day, &hour, &min);
163
164         /* Dump the info itself */
165         if (day < 1000) c_put_str(TERM_WHITE, format(_("%2d日目", "Day%3d"), day), ROW_DAY, COL_DAY);
166         else c_put_str(TERM_WHITE, _("***日目", "Day***"), ROW_DAY, COL_DAY);
167
168         c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
169 }
170
171 /*!
172  * @brief 現在のマップ名を返す /
173  * @return マップ名の文字列参照ポインタ
174  */
175 concptr map_name(void)
176 {
177         if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)
178             && (quest[p_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
179                 return _("クエスト", "Quest");
180         else if (p_ptr->wild_mode)
181                 return _("地上", "Surface");
182         else if (p_ptr->inside_arena)
183                 return _("アリーナ", "Arena");
184         else if (p_ptr->inside_battle)
185                 return _("闘技場", "Monster Arena");
186         else if (!current_floor_ptr->dun_level && p_ptr->town_num)
187                 return town_info[p_ptr->town_num].name;
188         else
189                 return d_name+d_info[p_ptr->dungeon_idx].name;
190 }
191
192 /*!
193  * @brief 現在のマップ名を描画する / Print dungeon
194  * @return なし
195  */
196 static void prt_dungeon(void)
197 {
198         concptr dungeon_name;
199         TERM_LEN col;
200
201         /* Dump 13 spaces to clear */
202         c_put_str(TERM_WHITE, "             ", ROW_DUNGEON, COL_DUNGEON);
203
204         dungeon_name = map_name();
205
206         col = COL_DUNGEON + 6 - strlen(dungeon_name)/2;
207         if (col < 0) col = 0;
208
209         /* Dump the info itself */
210         c_put_str(TERM_L_UMBER, format("%s",dungeon_name),
211                   ROW_DUNGEON, col);
212 }
213
214
215 /*!
216  * @brief プレイヤー能力値を描画する / Print character stat in given row, column
217  * @param stat 描画するステータスのID
218  * @return なし
219  */
220 static void prt_stat(int stat)
221 {
222         GAME_TEXT tmp[32];
223
224         /* Display "injured" stat */
225         if (p_ptr->stat_cur[stat] < p_ptr->stat_max[stat])
226         {
227                 put_str(stat_names_reduced[stat], ROW_STAT + stat, 0);
228                 cnv_stat(p_ptr->stat_use[stat], tmp);
229                 c_put_str(TERM_YELLOW, tmp, ROW_STAT + stat, COL_STAT + 6);
230         }
231
232         /* Display "healthy" stat */
233         else
234         {
235                 put_str(stat_names[stat], ROW_STAT + stat, 0);
236                 cnv_stat(p_ptr->stat_use[stat], tmp);
237                 c_put_str(TERM_L_GREEN, tmp, ROW_STAT + stat, COL_STAT + 6);
238         }
239
240         /* Indicate natural maximum */
241         if (p_ptr->stat_max[stat] == p_ptr->stat_max_max[stat])
242         {
243 #ifdef JP
244                 /* 日本語にかぶらないように表示位置を変更 */
245                 put_str("!", ROW_STAT + stat, 5);
246 #else
247                 put_str("!", ROW_STAT + stat, 3);
248 #endif
249
250         }
251 }
252
253
254 /*
255  * 画面下部に表示する状態表示定義ID / Data structure for status bar
256  */
257 #define BAR_TSUYOSHI 0      /*!< 下部ステータス表示: オクレ兄さん状態 */
258 #define BAR_HALLUCINATION 1 /*!< 下部ステータス表示: 幻覚 */
259 #define BAR_BLINDNESS 2     /*!< 下部ステータス表示: 盲目 */
260 #define BAR_PARALYZE 3      /*!< 下部ステータス表示: 麻痺 */
261 #define BAR_CONFUSE 4       /*!< 下部ステータス表示: 混乱 */
262 #define BAR_POISONED 5      /*!< 下部ステータス表示: 毒 */
263 #define BAR_AFRAID 6        /*!< 下部ステータス表示: 恐怖 */
264 #define BAR_LEVITATE 7      /*!< 下部ステータス表示: 浮遊 */
265 #define BAR_REFLECTION 8    /*!< 下部ステータス表示: 反射 */
266 #define BAR_PASSWALL 9      /*!< 下部ステータス表示: 壁抜け */
267 #define BAR_WRAITH 10       /*!< 下部ステータス表示: 幽体化 */
268 #define BAR_PROTEVIL 11     /*!< 下部ステータス表示: 対邪悪結界 */
269 #define BAR_KAWARIMI 12     /*!< 下部ステータス表示: 変わり身 */
270 #define BAR_MAGICDEFENSE 13 /*!< 下部ステータス表示: 魔法の鎧 */
271 #define BAR_EXPAND 14       /*!< 下部ステータス表示: 横伸び */
272 #define BAR_STONESKIN 15    /*!< 下部ステータス表示: 石肌化 */
273 #define BAR_MULTISHADOW 16  /*!< 下部ステータス表示: 影分身 */
274 #define BAR_REGMAGIC 17     /*!< 下部ステータス表示: 魔法防御 */
275 #define BAR_ULTIMATE 18     /*!< 下部ステータス表示: 究極の耐性 */
276 #define BAR_INVULN 19       /*!< 下部ステータス表示: 無敵化 */
277 #define BAR_IMMACID 20      /*!< 下部ステータス表示: 酸免疫 */
278 #define BAR_RESACID 21      /*!< 下部ステータス表示: 酸耐性 */
279 #define BAR_IMMELEC 22      /*!< 下部ステータス表示: 電撃免疫 */
280 #define BAR_RESELEC 23      /*!< 下部ステータス表示: 電撃耐性 */
281 #define BAR_IMMFIRE 24      /*!< 下部ステータス表示: 火炎免疫 */
282 #define BAR_RESFIRE 25      /*!< 下部ステータス表示: 火炎耐性 */
283 #define BAR_IMMCOLD 26      /*!< 下部ステータス表示: 冷気免疫 */
284 #define BAR_RESCOLD 27      /*!< 下部ステータス表示: 冷気耐性 */
285 #define BAR_RESPOIS 28      /*!< 下部ステータス表示: 毒耐性 */
286 #define BAR_RESNETH 29      /*!< 下部ステータス表示: 地獄耐性 */
287 #define BAR_RESTIME 30      /*!< 下部ステータス表示: 時間逆転耐性 */
288 #define BAR_DUSTROBE 31     /*!< 下部ステータス表示: 破片オーラ */
289 #define BAR_SHFIRE 32       /*!< 下部ステータス表示: 火炎オーラ */
290 #define BAR_TOUKI 33        /*!< 下部ステータス表示: 闘気 */
291 #define BAR_SHHOLY 34       /*!< 下部ステータス表示: 聖なるオーラ */
292 #define BAR_EYEEYE 35       /*!< 下部ステータス表示: 目には目を */
293 #define BAR_BLESSED 36      /*!< 下部ステータス表示: 祝福 */
294 #define BAR_HEROISM 37      /*!< 下部ステータス表示: 士気高揚 */
295 #define BAR_BERSERK 38      /*!< 下部ステータス表示: 狂戦士化 */
296 #define BAR_ATTKFIRE 39     /*!< 下部ステータス表示: 焼棄スレイ */
297 #define BAR_ATTKCOLD 40     /*!< 下部ステータス表示: 冷凍スレイ */
298 #define BAR_ATTKELEC 41     /*!< 下部ステータス表示: 電撃スレイ */
299 #define BAR_ATTKACID 42     /*!< 下部ステータス表示: 溶解スレイ */
300 #define BAR_ATTKPOIS 43     /*!< 下部ステータス表示: 毒殺スレイ */
301 #define BAR_ATTKCONF 44     /*!< 下部ステータス表示: 混乱打撃 */
302 #define BAR_SENSEUNSEEN 45  /*!< 下部ステータス表示: 透明視 */
303 #define BAR_TELEPATHY 46    /*!< 下部ステータス表示: テレパシー */
304 #define BAR_REGENERATION 47 /*!< 下部ステータス表示: 急回復 */
305 #define BAR_INFRAVISION 48  /*!< 下部ステータス表示: 赤外線視力 */
306 #define BAR_STEALTH 49      /*!< 下部ステータス表示: 隠密 */
307 #define BAR_SUPERSTEALTH 50 /*!< 下部ステータス表示: 超隠密 */
308 #define BAR_RECALL 51       /*!< 下部ステータス表示: 帰還待ち */
309 #define BAR_ALTER 52        /*!< 下部ステータス表示: 現実変容待ち */
310 #define BAR_SHCOLD 53       /*!< 下部ステータス表示: 冷気オーラ */
311 #define BAR_SHELEC 54       /*!< 下部ステータス表示: 電撃オーラ */
312 #define BAR_SHSHADOW 55     /*!< 下部ステータス表示: 影のオーラ */
313 #define BAR_MIGHT 56        /*!< 下部ステータス表示: 腕力強化 */
314 #define BAR_BUILD 57        /*!< 下部ステータス表示: 肉体強化 */
315 #define BAR_ANTIMULTI 58    /*!< 下部ステータス表示: 反増殖 */
316 #define BAR_ANTITELE 59     /*!< 下部ステータス表示: 反テレポート */
317 #define BAR_ANTIMAGIC 60    /*!< 下部ステータス表示: 反魔法 */
318 #define BAR_PATIENCE 61     /*!< 下部ステータス表示: 我慢 */
319 #define BAR_REVENGE 62      /*!< 下部ステータス表示: 宣告 */
320 #define BAR_RUNESWORD 63    /*!< 下部ステータス表示: 魔剣化 */
321 #define BAR_VAMPILIC 64     /*!< 下部ステータス表示: 吸血 */
322 #define BAR_CURE 65         /*!< 下部ステータス表示: 回復 */
323 #define BAR_ESP_EVIL 66     /*!< 下部ステータス表示: 邪悪感知 */
324
325 static struct {
326         TERM_COLOR attr;
327         concptr sstr;
328         concptr lstr;
329 } bar[]
330 #ifdef JP
331 = {
332         {TERM_YELLOW, "つ", "つよし"},
333         {TERM_VIOLET, "幻", "幻覚"},
334         {TERM_L_DARK, "盲", "盲目"},
335         {TERM_RED, "痺", "麻痺"},
336         {TERM_VIOLET, "乱", "混乱"},
337         {TERM_GREEN, "毒", "毒"},
338         {TERM_BLUE, "恐", "恐怖"},
339         {TERM_L_BLUE, "浮", "浮遊"},
340         {TERM_SLATE, "反", "反射"},
341         {TERM_SLATE, "壁", "壁抜け"},
342         {TERM_L_DARK, "幽", "幽体"},
343         {TERM_SLATE, "邪", "防邪"},
344         {TERM_VIOLET, "変", "変わり身"},
345         {TERM_YELLOW, "魔", "魔法鎧"},
346         {TERM_L_UMBER, "伸", "伸び"},
347         {TERM_WHITE, "石", "石肌"},
348         {TERM_L_BLUE, "分", "分身"},
349         {TERM_SLATE, "防", "魔法防御"},
350         {TERM_YELLOW, "究", "究極"},
351         {TERM_YELLOW, "無", "無敵"},
352         {TERM_L_GREEN, "酸", "酸免疫"},
353         {TERM_GREEN, "酸", "耐酸"},
354         {TERM_L_BLUE, "電", "電免疫"},
355         {TERM_BLUE, "電", "耐電"},
356         {TERM_L_RED, "火", "火免疫"},
357         {TERM_RED, "火", "耐火"},
358         {TERM_WHITE, "冷", "冷免疫"},
359         {TERM_SLATE, "冷", "耐冷"},
360         {TERM_GREEN, "毒", "耐毒"},
361         {TERM_L_DARK, "獄", "耐地獄"},
362         {TERM_L_BLUE, "時", "耐時間"},
363         {TERM_L_DARK, "鏡", "鏡オーラ"},
364         {TERM_L_RED, "オ", "火オーラ"},
365         {TERM_WHITE, "闘", "闘気"},
366         {TERM_WHITE, "聖", "聖オーラ"},
367         {TERM_VIOLET, "目", "目には目"},
368         {TERM_WHITE, "祝", "祝福"},
369         {TERM_WHITE, "勇", "勇"},
370         {TERM_RED, "狂", "狂乱"},
371         {TERM_L_RED, "火", "魔剣火"},
372         {TERM_WHITE, "冷", "魔剣冷"},
373         {TERM_L_BLUE, "電", "魔剣電"},
374         {TERM_SLATE, "酸", "魔剣酸"},
375         {TERM_L_GREEN, "毒", "魔剣毒"},
376         {TERM_RED, "乱", "混乱打撃"},
377         {TERM_L_BLUE, "視", "透明視"},
378         {TERM_ORANGE, "テ", "テレパシ"},
379         {TERM_L_BLUE, "回", "回復"},
380         {TERM_L_RED, "赤", "赤外"},
381         {TERM_UMBER, "隠", "隠密"},
382         {TERM_YELLOW, "隠", "超隠密"},
383         {TERM_WHITE, "帰", "帰還"},
384         {TERM_WHITE, "現", "現実変容"},
385         /* Hex */
386         {TERM_WHITE, "オ", "氷オーラ"},
387         {TERM_BLUE, "オ", "電オーラ"},
388         {TERM_L_DARK, "オ", "影オーラ"},
389         {TERM_YELLOW, "腕", "腕力強化"},
390         {TERM_RED, "肉", "肉体強化"},
391         {TERM_L_DARK, "殖", "反増殖"},
392         {TERM_ORANGE, "テ", "反テレポ"},
393         {TERM_RED, "魔", "反魔法"},
394         {TERM_SLATE, "我", "我慢"},
395         {TERM_SLATE, "宣", "宣告"},
396         {TERM_L_DARK, "剣", "魔剣化"},
397         {TERM_RED, "吸", "吸血打撃"},
398         {TERM_WHITE, "回", "回復"},
399         {TERM_L_DARK, "感", "邪悪感知"},
400         {0, NULL, NULL}
401 };
402 #else
403 = {
404         {TERM_YELLOW, "Ts", "Tsuyoshi"},
405         {TERM_VIOLET, "Ha", "Halluc"},
406         {TERM_L_DARK, "Bl", "Blind"},
407         {TERM_RED, "Pa", "Paralyzed"},
408         {TERM_VIOLET, "Cf", "Confused"},
409         {TERM_GREEN, "Po", "Poisoned"},
410         {TERM_BLUE, "Af", "Afraid"},
411         {TERM_L_BLUE, "Lv", "Levit"},
412         {TERM_SLATE, "Rf", "Reflect"},
413         {TERM_SLATE, "Pw", "PassWall"},
414         {TERM_L_DARK, "Wr", "Wraith"},
415         {TERM_SLATE, "Ev", "PrtEvl"},
416         {TERM_VIOLET, "Kw", "Kawarimi"},
417         {TERM_YELLOW, "Md", "MgcArm"},
418         {TERM_L_UMBER, "Eh", "Expand"},
419         {TERM_WHITE, "Ss", "StnSkn"},
420         {TERM_L_BLUE, "Ms", "MltShdw"},
421         {TERM_SLATE, "Rm", "ResMag"},
422         {TERM_YELLOW, "Ul", "Ultima"},
423         {TERM_YELLOW, "Iv", "Invuln"},
424         {TERM_L_GREEN, "IAc", "ImmAcid"},
425         {TERM_GREEN, "Ac", "Acid"},
426         {TERM_L_BLUE, "IEl", "ImmElec"},
427         {TERM_BLUE, "El", "Elec"},
428         {TERM_L_RED, "IFi", "ImmFire"},
429         {TERM_RED, "Fi", "Fire"},
430         {TERM_WHITE, "ICo", "ImmCold"},
431         {TERM_SLATE, "Co", "Cold"},
432         {TERM_GREEN, "Po", "Pois"},
433         {TERM_L_DARK, "Nt", "Nthr"},
434         {TERM_L_BLUE, "Ti", "Time"},
435         {TERM_L_DARK, "Mr", "Mirr"},
436         {TERM_L_RED, "SFi", "SFire"},
437         {TERM_WHITE, "Fo", "Force"},
438         {TERM_WHITE, "Ho", "Holy"},
439         {TERM_VIOLET, "Ee", "EyeEye"},
440         {TERM_WHITE, "Bs", "Bless"},
441         {TERM_WHITE, "He", "Hero"},
442         {TERM_RED, "Br", "Berserk"},
443         {TERM_L_RED, "BFi", "BFire"},
444         {TERM_WHITE, "BCo", "BCold"},
445         {TERM_L_BLUE, "BEl", "BElec"},
446         {TERM_SLATE, "BAc", "BAcid"},
447         {TERM_L_GREEN, "BPo", "BPois"},
448         {TERM_RED, "TCf", "TchCnf"},
449         {TERM_L_BLUE, "Se", "SInv"},
450         {TERM_ORANGE, "Te", "Telepa"},
451         {TERM_L_BLUE, "Rg", "Regen"},
452         {TERM_L_RED, "If", "Infr"},
453         {TERM_UMBER, "Sl", "Stealth"},
454         {TERM_YELLOW, "Stlt", "Stealth"},
455         {TERM_WHITE, "Rc", "Recall"},
456         {TERM_WHITE, "Al", "Alter"},
457         /* Hex */
458         {TERM_WHITE, "SCo", "SCold"},
459         {TERM_BLUE, "SEl", "SElec"},
460         {TERM_L_DARK, "SSh", "SShadow"},
461         {TERM_YELLOW, "EMi", "ExMight"},
462         {TERM_RED, "Bu", "BuildUp"},
463         {TERM_L_DARK, "AMl", "AntiMulti"},
464         {TERM_ORANGE, "AT", "AntiTele"},
465         {TERM_RED, "AM", "AntiMagic"},
466         {TERM_SLATE, "Pa", "Patience"},
467         {TERM_SLATE, "Rv", "Revenge"},
468         {TERM_L_DARK, "Rs", "RuneSword"},
469         {TERM_RED, "Vm", "Vampiric"},
470         {TERM_WHITE, "Cu", "Cure"},
471         {TERM_L_DARK, "ET", "EvilTele"},
472         {0, NULL, NULL}
473 };
474 #endif
475
476 /*!
477  * @brief 32ビット変数配列の指定位置のビットフラグを1にする。
478  * @param FLG フラグ位置(ビット)
479  * @return なし
480  */
481 #define ADD_FLG(FLG) (bar_flags[FLG / 32] |= (1L << (FLG % 32)))
482
483 /*!
484  * @brief 32ビット変数配列の指定位置のビットフラグが1かどうかを返す。
485  * @param FLG フラグ位置(ビット)
486  * @return 1ならば0以外を返す
487  */
488 #define IS_FLG(FLG) (bar_flags[FLG / 32] & (1L << (FLG % 32)))
489
490
491 /*!
492  * @brief 下部に状態表示を行う / Show status bar
493  * @return なし
494  */
495 static void prt_status(void)
496 {
497         BIT_FLAGS bar_flags[3];
498         TERM_LEN wid, hgt, row_statbar, max_col_statbar;
499         int i;
500         TERM_LEN col = 0, num = 0;
501         int space = 2;
502
503         Term_get_size(&wid, &hgt);
504         row_statbar = hgt + ROW_STATBAR;
505         max_col_statbar = wid + MAX_COL_STATBAR;
506
507         Term_erase(0, row_statbar, max_col_statbar);
508
509         bar_flags[0] = bar_flags[1] = bar_flags[2] = 0L;
510
511         /* Tsuyoshi  */
512         if (p_ptr->tsuyoshi) ADD_FLG(BAR_TSUYOSHI);
513
514         /* Hallucinating */
515         if (p_ptr->image) ADD_FLG(BAR_HALLUCINATION);
516
517         /* Blindness */
518         if (p_ptr->blind) ADD_FLG(BAR_BLINDNESS);
519
520         /* Paralysis */
521         if (p_ptr->paralyzed) ADD_FLG(BAR_PARALYZE);
522
523         /* Confusion */
524         if (p_ptr->confused) ADD_FLG(BAR_CONFUSE);
525
526         /* Posioned */
527         if (p_ptr->poisoned) ADD_FLG(BAR_POISONED);
528
529         /* Times see-invisible */
530         if (p_ptr->tim_invis) ADD_FLG(BAR_SENSEUNSEEN);
531
532         /* Timed esp */
533         if (IS_TIM_ESP()) ADD_FLG(BAR_TELEPATHY);
534
535         /* Timed regenerate */
536         if (p_ptr->tim_regen) ADD_FLG(BAR_REGENERATION);
537
538         /* Timed infra-vision */
539         if (p_ptr->tim_infra) ADD_FLG(BAR_INFRAVISION);
540
541         /* Protection from evil */
542         if (p_ptr->protevil) ADD_FLG(BAR_PROTEVIL);
543
544         /* Invulnerability */
545         if (IS_INVULN()) ADD_FLG(BAR_INVULN);
546
547         /* Wraith form */
548         if (p_ptr->wraith_form) ADD_FLG(BAR_WRAITH);
549
550         /* Kabenuke */
551         if (p_ptr->kabenuke) ADD_FLG(BAR_PASSWALL);
552
553         if (p_ptr->tim_reflect) ADD_FLG(BAR_REFLECTION);
554
555         /* Heroism */
556         if (IS_HERO()) ADD_FLG(BAR_HEROISM);
557
558         /* Super Heroism / berserk */
559         if (p_ptr->shero) ADD_FLG(BAR_BERSERK);
560
561         /* Blessed */
562         if (IS_BLESSED()) ADD_FLG(BAR_BLESSED);
563
564         /* Shield */
565         if (p_ptr->magicdef) ADD_FLG(BAR_MAGICDEFENSE);
566
567         if (p_ptr->tsubureru) ADD_FLG(BAR_EXPAND);
568
569         if (p_ptr->shield) ADD_FLG(BAR_STONESKIN);
570         
571         if (p_ptr->special_defense & NINJA_KAWARIMI) ADD_FLG(BAR_KAWARIMI);
572
573         /* Oppose Acid */
574         if (p_ptr->special_defense & DEFENSE_ACID) ADD_FLG(BAR_IMMACID);
575         if (IS_OPPOSE_ACID()) ADD_FLG(BAR_RESACID);
576
577         /* Oppose Lightning */
578         if (p_ptr->special_defense & DEFENSE_ELEC) ADD_FLG(BAR_IMMELEC);
579         if (IS_OPPOSE_ELEC()) ADD_FLG(BAR_RESELEC);
580
581         /* Oppose Fire */
582         if (p_ptr->special_defense & DEFENSE_FIRE) ADD_FLG(BAR_IMMFIRE);
583         if (IS_OPPOSE_FIRE()) ADD_FLG(BAR_RESFIRE);
584
585         /* Oppose Cold */
586         if (p_ptr->special_defense & DEFENSE_COLD) ADD_FLG(BAR_IMMCOLD);
587         if (IS_OPPOSE_COLD()) ADD_FLG(BAR_RESCOLD);
588
589         /* Oppose Poison */
590         if (IS_OPPOSE_POIS()) ADD_FLG(BAR_RESPOIS);
591
592         /* Word of Recall */
593         if (p_ptr->word_recall) ADD_FLG(BAR_RECALL);
594
595         /* Alter realiry */
596         if (p_ptr->alter_reality) ADD_FLG(BAR_ALTER);
597
598         /* Afraid */
599         if (p_ptr->afraid) ADD_FLG(BAR_AFRAID);
600
601         /* Resist time */
602         if (p_ptr->tim_res_time) ADD_FLG(BAR_RESTIME);
603
604         if (p_ptr->multishadow) ADD_FLG(BAR_MULTISHADOW);
605
606         /* Confusing Hands */
607         if (p_ptr->special_attack & ATTACK_CONFUSE) ADD_FLG(BAR_ATTKCONF);
608
609         if (p_ptr->resist_magic) ADD_FLG(BAR_REGMAGIC);
610
611         /* Ultimate-resistance */
612         if (p_ptr->ult_res) ADD_FLG(BAR_ULTIMATE);
613
614         /* tim levitation */
615         if (p_ptr->tim_levitation) ADD_FLG(BAR_LEVITATE);
616
617         if (p_ptr->tim_res_nether) ADD_FLG(BAR_RESNETH);
618
619         if (p_ptr->dustrobe) ADD_FLG(BAR_DUSTROBE);
620
621         /* Mahouken */
622         if (p_ptr->special_attack & ATTACK_FIRE) ADD_FLG(BAR_ATTKFIRE);
623         if (p_ptr->special_attack & ATTACK_COLD) ADD_FLG(BAR_ATTKCOLD);
624         if (p_ptr->special_attack & ATTACK_ELEC) ADD_FLG(BAR_ATTKELEC);
625         if (p_ptr->special_attack & ATTACK_ACID) ADD_FLG(BAR_ATTKACID);
626         if (p_ptr->special_attack & ATTACK_POIS) ADD_FLG(BAR_ATTKPOIS);
627         if (p_ptr->special_defense & NINJA_S_STEALTH) ADD_FLG(BAR_SUPERSTEALTH);
628
629         if (p_ptr->tim_sh_fire) ADD_FLG(BAR_SHFIRE);
630
631         /* tim stealth */
632         if (IS_TIM_STEALTH()) ADD_FLG(BAR_STEALTH);
633
634         if (p_ptr->tim_sh_touki) ADD_FLG(BAR_TOUKI);
635
636         /* Holy aura */
637         if (p_ptr->tim_sh_holy) ADD_FLG(BAR_SHHOLY);
638
639         /* An Eye for an Eye */
640         if (p_ptr->tim_eyeeye) ADD_FLG(BAR_EYEEYE);
641
642         /* Hex spells */
643         if (p_ptr->realm1 == REALM_HEX)
644         {
645                 if (hex_spelling(HEX_BLESS)) ADD_FLG(BAR_BLESSED);
646                 if (hex_spelling(HEX_DEMON_AURA)) { ADD_FLG(BAR_SHFIRE); ADD_FLG(BAR_REGENERATION); }
647                 if (hex_spelling(HEX_XTRA_MIGHT)) ADD_FLG(BAR_MIGHT);
648                 if (hex_spelling(HEX_DETECT_EVIL)) ADD_FLG(BAR_ESP_EVIL);
649                 if (hex_spelling(HEX_ICE_ARMOR)) ADD_FLG(BAR_SHCOLD);
650                 if (hex_spelling(HEX_RUNESWORD)) ADD_FLG(BAR_RUNESWORD);
651                 if (hex_spelling(HEX_BUILDING)) ADD_FLG(BAR_BUILD);
652                 if (hex_spelling(HEX_ANTI_TELE)) ADD_FLG(BAR_ANTITELE);
653                 if (hex_spelling(HEX_SHOCK_CLOAK)) ADD_FLG(BAR_SHELEC);
654                 if (hex_spelling(HEX_SHADOW_CLOAK)) ADD_FLG(BAR_SHSHADOW);
655                 if (hex_spelling(HEX_CONFUSION)) ADD_FLG(BAR_ATTKCONF);
656                 if (hex_spelling(HEX_EYE_FOR_EYE)) ADD_FLG(BAR_EYEEYE);
657                 if (hex_spelling(HEX_ANTI_MULTI)) ADD_FLG(BAR_ANTIMULTI);
658                 if (hex_spelling(HEX_VAMP_BLADE)) ADD_FLG(BAR_VAMPILIC);
659                 if (hex_spelling(HEX_ANTI_MAGIC)) ADD_FLG(BAR_ANTIMAGIC);
660                 if (hex_spelling(HEX_CURE_LIGHT) ||
661                         hex_spelling(HEX_CURE_SERIOUS) ||
662                         hex_spelling(HEX_CURE_CRITICAL)) ADD_FLG(BAR_CURE);
663
664                 if (HEX_REVENGE_TURN(p_ptr))
665                 {
666                         if (HEX_REVENGE_TYPE(p_ptr) == 1) ADD_FLG(BAR_PATIENCE);
667                         if (HEX_REVENGE_TYPE(p_ptr) == 2) ADD_FLG(BAR_REVENGE);
668                 }
669         }
670
671         /* Calcurate length */
672         for (i = 0; bar[i].sstr; i++)
673         {
674                 if (IS_FLG(i))
675                 {
676                         col += strlen(bar[i].lstr) + 1;
677                         num++;
678                 }
679         }
680
681         /* If there are not excess spaces for long strings, use short one */
682         if (col - 1 > max_col_statbar)
683         {
684                 space = 0;
685                 col = 0;
686
687                 for (i = 0; bar[i].sstr; i++)
688                 {
689                         if (IS_FLG(i))
690                         {
691                                 col += strlen(bar[i].sstr);
692                         }
693                 }
694
695                 /* If there are excess spaces for short string, use more */
696                 if (col - 1 <= max_col_statbar - (num-1))
697                 {
698                         space = 1;
699                         col += num - 1;
700                 }
701         }
702
703
704         /* Centering display column */
705         col = (max_col_statbar - col) / 2;
706
707         /* Display status bar */
708         for (i = 0; bar[i].sstr; i++)
709         {
710                 if (IS_FLG(i))
711                 {
712                         concptr str;
713                         if (space == 2) str = bar[i].lstr;
714                         else str = bar[i].sstr;
715
716                         c_put_str(bar[i].attr, str, row_statbar, col);
717                         col += strlen(str);
718                         if (space > 0) col++;
719                         if (col > max_col_statbar) break;
720                 }
721         }
722 }
723
724
725 /*!
726  * @brief プレイヤーの称号を表示する / Prints "title", including "wizard" or "winner" as needed.
727  * @return なし
728  */
729 static void prt_title(void)
730 {
731         concptr p = "";
732         GAME_TEXT str[14];
733
734         if (p_ptr->wizard)
735         {
736                 p = _("[ウィザード]", "[=-WIZARD-=]");
737         }
738         else if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL))
739         {
740                 if (p_ptr->arena_number > MAX_ARENA_MONS + 2)
741                 {
742                         p = _("*真・勝利者*", "*TRUEWINNER*");
743                 }
744                 else
745                 {
746                         p = _("***勝利者***", "***WINNER***");
747                 }
748         }
749
750         /* Normal */
751         else
752         {
753                 my_strcpy(str, player_title[p_ptr->pclass][(p_ptr->lev - 1) / 5], sizeof(str));
754                 p = str;
755         }
756
757         prt_field(p, ROW_TITLE, COL_TITLE);
758 }
759
760
761 /*!
762  * @brief プレイヤーのレベルを表示する / Prints level
763  * @return なし
764  */
765 static void prt_level(void)
766 {
767         char tmp[32];
768
769         sprintf(tmp, _("%5d", "%6d"), p_ptr->lev);
770
771         if (p_ptr->lev >= p_ptr->max_plv)
772         {
773                 put_str(_("レベル ", "LEVEL "), ROW_LEVEL, 0);
774                 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 7);
775         }
776         else
777         {
778                 put_str(_("xレベル", "Level "), ROW_LEVEL, 0);
779                 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 7);
780         }
781 }
782
783
784 /*!
785  * @brief プレイヤーの経験値を表示する / Display the experience
786  * @return なし
787  */
788 static void prt_exp(void)
789 {
790         char out_val[32];
791
792         if ((!exp_need)||(p_ptr->prace == RACE_ANDROID))
793         {
794                 (void)sprintf(out_val, "%8ld", (long)p_ptr->exp);
795         }
796         else
797         {
798                 if (p_ptr->lev >= PY_MAX_LEVEL)
799                 {
800                         (void)sprintf(out_val, "********");
801                 }
802                 else
803                 {
804                         (void)sprintf(out_val, "%8ld", (long)(player_exp [p_ptr->lev - 1] * p_ptr->expfact / 100L) - p_ptr->exp);
805                 }
806         }
807
808         if (p_ptr->exp >= p_ptr->max_exp)
809         {
810                 if (p_ptr->prace == RACE_ANDROID) put_str(_("強化 ", "Cst "), ROW_EXP, 0);
811                 else put_str(_("経験 ", "EXP "), ROW_EXP, 0);
812                 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 4);
813         }
814         else
815         {
816                 put_str(_("x経験", "Exp "), ROW_EXP, 0);
817                 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 4);
818         }
819 }
820
821 /*!
822  * @brief プレイヤーの所持金を表示する / Prints current gold
823  * @return なし
824  */
825 static void prt_gold(void)
826 {
827         char tmp[32];
828         put_str(_("$ ", "AU "), ROW_GOLD, COL_GOLD);
829         sprintf(tmp, "%9ld", (long)p_ptr->au);
830         c_put_str(TERM_L_GREEN, tmp, ROW_GOLD, COL_GOLD + 3);
831 }
832
833
834 /*!
835  * @brief プレイヤーのACを表示する / Prints current AC
836  * @return なし
837  */
838 static void prt_ac(void)
839 {
840         char tmp[32];
841
842 #ifdef JP
843 /* AC の表示方式を変更している */
844         put_str(" AC(     )", ROW_AC, COL_AC);
845         sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
846         c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 6);
847 #else
848         put_str("Cur AC ", ROW_AC, COL_AC);
849         sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
850         c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 7);
851 #endif
852
853 }
854
855
856 /*!
857  * @brief プレイヤーのHPを表示する / Prints Cur/Max hit points
858  * @return なし
859  */
860 static void prt_hp(void)
861 {
862         /* ヒットポイントの表示方法を変更 */
863         char tmp[32];
864   
865         TERM_COLOR color;
866   
867         /* タイトル */
868         put_str("HP", ROW_CURHP, COL_CURHP);
869
870         /* 現在のヒットポイント */
871         sprintf(tmp, "%4ld", (long int)p_ptr->chp);
872
873         if (p_ptr->chp >= p_ptr->mhp)
874         {
875                 color = TERM_L_GREEN;
876         }
877         else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
878         {
879                 color = TERM_YELLOW;
880         }
881         else
882         {
883                 color = TERM_RED;
884         }
885
886         c_put_str(color, tmp, ROW_CURHP, COL_CURHP+3);
887
888         /* 区切り */
889         put_str( "/", ROW_CURHP, COL_CURHP + 7 );
890
891         /* 最大ヒットポイント */
892         sprintf(tmp, "%4ld", (long int)p_ptr->mhp);
893         color = TERM_L_GREEN;
894
895         c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
896 }
897
898
899 /*!
900  * @brief プレイヤーのMPを表示する / Prints players max/cur spell points
901  * @return なし
902  */
903 static void prt_sp(void)
904 {
905 /* マジックポイントの表示方法を変更している */
906         char tmp[32];
907         byte color;
908
909
910         /* Do not show mana unless it matters */
911         if (!mp_ptr->spell_book) return;
912
913         /* タイトル */
914         put_str(_("MP", "SP"), ROW_CURSP, COL_CURSP);
915
916         /* 現在のマジックポイント */
917         sprintf(tmp, "%4ld", (long int)p_ptr->csp);
918
919         if (p_ptr->csp >= p_ptr->msp)
920         {
921                 color = TERM_L_GREEN;
922         }
923         else if (p_ptr->csp > (p_ptr->msp * mana_warn) / 10)
924         {
925                 color = TERM_YELLOW;
926         }
927         else
928         {
929                 color = TERM_RED;
930         }
931
932         c_put_str(color, tmp, ROW_CURSP, COL_CURSP+3);
933
934         /* 区切り */
935         put_str( "/", ROW_CURSP, COL_CURSP + 7 );
936
937         /* 最大マジックポイント */
938         sprintf(tmp, "%4ld", (long int)p_ptr->msp);
939         color = TERM_L_GREEN;
940
941         c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
942 }
943
944
945 /*!
946  * @brief 現在のフロアの深さを表示する / Prints depth in stat area
947  * @return なし
948  */
949 static void prt_depth(void)
950 {
951         char depths[32];
952         TERM_LEN wid, hgt, row_depth, col_depth;
953         TERM_COLOR attr = TERM_WHITE;
954
955         Term_get_size(&wid, &hgt);
956         col_depth = wid + COL_DEPTH;
957         row_depth = hgt + ROW_DEPTH;
958
959         if (!current_floor_ptr->dun_level)
960         {
961                 strcpy(depths, _("地上", "Surf."));
962         }
963         else if (p_ptr->inside_quest && !p_ptr->dungeon_idx)
964         {
965                 strcpy(depths, _("地上", "Quest"));
966         }
967         else
968         {
969                 if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)current_floor_ptr->dun_level * 50);
970                 else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)current_floor_ptr->dun_level);
971
972                 /* Get color of level based on feeling  -JSV- */
973                 switch (p_ptr->feeling)
974                 {
975                 case  0: attr = TERM_SLATE;   break; /* Unknown */
976                 case  1: attr = TERM_L_BLUE;  break; /* Special */
977                 case  2: attr = TERM_VIOLET;  break; /* Horrible visions */
978                 case  3: attr = TERM_RED;     break; /* Very dangerous */
979                 case  4: attr = TERM_L_RED;   break; /* Very bad feeling */
980                 case  5: attr = TERM_ORANGE;  break; /* Bad feeling */
981                 case  6: attr = TERM_YELLOW;  break; /* Nervous */
982                 case  7: attr = TERM_L_UMBER; break; /* Luck is turning */
983                 case  8: attr = TERM_L_WHITE; break; /* Don't like */
984                 case  9: attr = TERM_WHITE;   break; /* Reasonably safe */
985                 case 10: attr = TERM_WHITE;   break; /* Boring place */
986                 }
987         }
988
989         /* Right-Adjust the "depth", and clear old values */
990         c_prt(attr, format("%7s", depths), row_depth, col_depth);
991 }
992
993
994 /*!
995  * @brief プレイヤーの空腹状態を表示する / Prints status of hunger
996  * @return なし
997  */
998 static void prt_hunger(void)
999 {
1000         if(p_ptr->wizard && p_ptr->inside_arena) return;
1001
1002         /* Fainting / Starving */
1003         if (p_ptr->food < PY_FOOD_FAINT)
1004         {
1005                 c_put_str(TERM_RED, _("衰弱  ", "Weak  "), ROW_HUNGRY, COL_HUNGRY);
1006         }
1007
1008         /* Weak */
1009         else if (p_ptr->food < PY_FOOD_WEAK)
1010         {
1011                 c_put_str(TERM_ORANGE, _("衰弱  ", "Weak  "), ROW_HUNGRY, COL_HUNGRY);
1012         }
1013
1014         /* Hungry */
1015         else if (p_ptr->food < PY_FOOD_ALERT)
1016         {
1017                 c_put_str(TERM_YELLOW, _("空腹  ", "Hungry"), ROW_HUNGRY, COL_HUNGRY);
1018         }
1019
1020         /* Normal */
1021         else if (p_ptr->food < PY_FOOD_FULL)
1022         {
1023                 c_put_str(TERM_L_GREEN, "      ", ROW_HUNGRY, COL_HUNGRY);
1024         }
1025
1026         /* Full */
1027         else if (p_ptr->food < PY_FOOD_MAX)
1028         {
1029                 c_put_str(TERM_L_GREEN, _("満腹  ", "Full  "), ROW_HUNGRY, COL_HUNGRY);
1030         }
1031
1032         /* Gorged */
1033         else
1034         {
1035                 c_put_str(TERM_GREEN, _("食過ぎ", "Gorged"), ROW_HUNGRY, COL_HUNGRY);
1036         }
1037 }
1038
1039
1040 /*!
1041  * @brief プレイヤーの行動状態を表示する / Prints Searching, Resting, Paralysis, or 'count' status
1042  * @return なし
1043  * @details
1044  * Display is always exactly 10 characters wide (see below)
1045  * This function was a major bottleneck when resting, so a lot of
1046  * the text formatting code was optimized in place below.
1047  */
1048 static void prt_state(void)
1049 {
1050         TERM_COLOR attr = TERM_WHITE;
1051         GAME_TEXT text[16];
1052
1053         /* Repeating */
1054         if (command_rep)
1055         {
1056                 if (command_rep > 999)
1057                 {
1058                         (void)sprintf(text, "%2d00", command_rep / 100);
1059                 }
1060                 else
1061                 {
1062                         (void)sprintf(text, "  %2d", command_rep);
1063                 }
1064         }
1065
1066         /* Action */
1067         else
1068         {
1069                 switch(p_ptr->action)
1070                 {
1071                         case ACTION_SEARCH:
1072                         {
1073                                 strcpy(text, _("探索", "Sear"));
1074                                 break;
1075                         }
1076                         case ACTION_REST:
1077                                 /* Start with "Rest" */
1078                                 strcpy(text, _("    ", "    "));
1079
1080                                 if (p_ptr->resting > 0)
1081                                 {
1082                                         sprintf(text, "%4d", p_ptr->resting);
1083                                 }
1084                                 else if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
1085                                 {
1086                                         text[0] = text[1] = text[2] = text[3] = '*';
1087                                 }
1088                                 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
1089                                 {
1090                                         text[0] = text[1] = text[2] = text[3] = '&';
1091                                 }
1092                                 break;
1093
1094                         case ACTION_LEARN:
1095                         {
1096                                 strcpy(text, _("学習", "lear"));
1097                                 if (new_mane) attr = TERM_L_RED;
1098                                 break;
1099                         }
1100                         case ACTION_FISH:
1101                         {
1102                                 strcpy(text, _("釣り", "fish"));
1103                                 break;
1104                         }
1105                         case ACTION_KAMAE:
1106                         {
1107                                 int i;
1108                                 for (i = 0; i < MAX_KAMAE; i++)
1109                                         if (p_ptr->special_defense & (KAMAE_GENBU << i)) break;
1110                                 switch (i)
1111                                 {
1112                                         case 0: attr = TERM_GREEN;break;
1113                                         case 1: attr = TERM_WHITE;break;
1114                                         case 2: attr = TERM_L_BLUE;break;
1115                                         case 3: attr = TERM_L_RED;break;
1116                                 }
1117                                 strcpy(text, kamae_shurui[i].desc);
1118                                 break;
1119                         }
1120                         case ACTION_KATA:
1121                         {
1122                                 int i;
1123                                 for (i = 0; i < MAX_KATA; i++)
1124                                         if (p_ptr->special_defense & (KATA_IAI << i)) break;
1125                                 strcpy(text, kata_shurui[i].desc);
1126                                 break;
1127                         }
1128                         case ACTION_SING:
1129                         {
1130                                 strcpy(text, _("歌  ", "Sing"));
1131                                 break;
1132                         }
1133                         case ACTION_HAYAGAKE:
1134                         {
1135                                 strcpy(text, _("速駆", "Fast"));
1136                                 break;
1137                         }
1138                         case ACTION_SPELL:
1139                         {
1140                                 strcpy(text, _("詠唱", "Spel"));
1141                                 break;
1142                         }
1143                         default:
1144                         {
1145                                 strcpy(text, "    ");
1146                                 break;
1147                         }
1148                 }
1149         }
1150
1151         /* Display the info (or blanks) */
1152         c_put_str(attr, format("%5.5s",text), ROW_STATE, COL_STATE);
1153 }
1154
1155
1156 /*!
1157  * @brief プレイヤーの行動速度を表示する / Prints the speed of a character.                      -CJS-
1158  * @return なし
1159  */
1160 static void prt_speed(void)
1161 {
1162         int i = p_ptr->pspeed;
1163         bool is_fast = IS_FAST();
1164
1165         TERM_COLOR attr = TERM_WHITE;
1166         char buf[32] = "";
1167         TERM_LEN wid, hgt, row_speed, col_speed;
1168
1169         Term_get_size(&wid, &hgt);
1170         col_speed = wid + COL_SPEED;
1171         row_speed = hgt + ROW_SPEED;
1172
1173         /* Hack -- Visually "undo" the Search Mode Slowdown */
1174         if (p_ptr->action == ACTION_SEARCH && !p_ptr->lightspeed) i += 10;
1175
1176         /* Fast */
1177         if (i > 110)
1178         {
1179                 if (p_ptr->riding)
1180                 {
1181                         monster_type *m_ptr = &current_floor_ptr->m_list[p_ptr->riding];
1182                         if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1183                         else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1184                         else attr = TERM_GREEN;
1185                 }
1186                 else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
1187                 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1188                 else attr = TERM_L_GREEN;
1189                 sprintf(buf, "%s(+%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("加速", "Fast")), (i - 110));
1190         }
1191
1192         /* Slow */
1193         else if (i < 110)
1194         {
1195                 if (p_ptr->riding)
1196                 {
1197                         monster_type *m_ptr = &current_floor_ptr->m_list[p_ptr->riding];
1198                         if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1199                         else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1200                         else attr = TERM_RED;
1201                 }
1202                 else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
1203                 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1204                 else attr = TERM_L_UMBER;
1205                 sprintf(buf, "%s(-%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("減速", "Slow")), (110 - i));
1206         }
1207         else if (p_ptr->riding)
1208         {
1209                 attr = TERM_GREEN;
1210                 strcpy(buf, _("乗馬中", "Riding"));
1211         }
1212
1213         /* Display the speed */
1214         c_put_str(attr, format("%-9s", buf), row_speed, col_speed);
1215 }
1216
1217
1218 /*!
1219  * @brief プレイヤーの呪文学習可能状態を表示する
1220  * @return なし
1221  */
1222 static void prt_study(void)
1223 {
1224         TERM_LEN wid, hgt, row_study, col_study;
1225
1226         Term_get_size(&wid, &hgt);
1227         col_study = wid + COL_STUDY;
1228         row_study = hgt + ROW_STUDY;
1229
1230         if (p_ptr->new_spells)
1231         {
1232                 put_str(_("学習", "Stud"), row_study, col_study);
1233         }
1234         else
1235         {
1236                 put_str("    ", row_study, col_study);
1237         }
1238 }
1239
1240
1241 /*!
1242  * @brief プレイヤーのものまね可能状態を表示する
1243  * @return なし
1244  */
1245 static void prt_imitation(void)
1246 {
1247         TERM_LEN wid, hgt, row_study, col_study;
1248
1249         Term_get_size(&wid, &hgt);
1250         col_study = wid + COL_STUDY;
1251         row_study = hgt + ROW_STUDY;
1252
1253         if (p_ptr->pclass == CLASS_IMITATOR)
1254         {
1255                 if (p_ptr->mane_num)
1256                 {
1257                         TERM_COLOR attr;
1258                         if (new_mane) attr = TERM_L_RED;
1259                         else attr = TERM_WHITE;
1260                         c_put_str(attr, _("まね", "Imit"), row_study, col_study);
1261                 }
1262                 else
1263                 {
1264                         put_str("    ", row_study, col_study);
1265                 }
1266         }
1267 }
1268
1269 /*!
1270  * @brief プレイヤーの負傷状態を表示する
1271  * @return なし
1272  */
1273 static void prt_cut(void)
1274 {
1275         int c = p_ptr->cut;
1276
1277         if (c > 1000)
1278         {
1279                 c_put_str(TERM_L_RED, _("致命傷      ", "Mortal wound"), ROW_CUT, COL_CUT);
1280         }
1281         else if (c > 200)
1282         {
1283                 c_put_str(TERM_RED, _("ひどい深手  ", "Deep gash   "), ROW_CUT, COL_CUT);
1284         }
1285         else if (c > 100)
1286         {
1287                 c_put_str(TERM_RED, _("重傷        ", "Severe cut  "), ROW_CUT, COL_CUT);
1288         }
1289         else if (c > 50)
1290         {
1291                 c_put_str(TERM_ORANGE, _("大変な傷    ", "Nasty cut   "), ROW_CUT, COL_CUT);
1292         }
1293         else if (c > 25)
1294         {
1295                 c_put_str(TERM_ORANGE, _("ひどい傷    ", "Bad cut     "), ROW_CUT, COL_CUT);
1296         }
1297         else if (c > 10)
1298         {
1299                 c_put_str(TERM_YELLOW, _("軽傷        ", "Light cut   "), ROW_CUT, COL_CUT);
1300         }
1301         else if (c)
1302         {
1303                 c_put_str(TERM_YELLOW, _("かすり傷    ", "Graze       "), ROW_CUT, COL_CUT);
1304         }
1305         else
1306         {
1307                 put_str("            ", ROW_CUT, COL_CUT);
1308         }
1309 }
1310
1311
1312 /*!
1313  * @brief プレイヤーの朦朧状態を表示する
1314  * @return なし
1315  */
1316 static void prt_stun(void)
1317 {
1318         int s = p_ptr->stun;
1319
1320         if (s > 100)
1321         {
1322                 c_put_str(TERM_RED, _("意識不明瞭  ", "Knocked out "), ROW_STUN, COL_STUN);
1323         }
1324         else if (s > 50)
1325         {
1326                 c_put_str(TERM_ORANGE, _("ひどく朦朧  ", "Heavy stun  "), ROW_STUN, COL_STUN);
1327         }
1328         else if (s)
1329         {
1330                 c_put_str(TERM_ORANGE, _("朦朧        ", "Stun        "), ROW_STUN, COL_STUN);
1331         }
1332         else
1333         {
1334                 put_str("            ", ROW_STUN, COL_STUN);
1335         }
1336 }
1337
1338
1339
1340 /*!
1341  * @brief モンスターの体力ゲージを表示する
1342  * @param riding TRUEならば騎乗中のモンスターの体力、FALSEならターゲットモンスターの体力を表示する。表示位置は固定。
1343  * @return なし
1344  * @details
1345  * <pre>
1346  * Redraw the "monster health bar"      -DRS-
1347  * Rather extensive modifications by    -BEN-
1348  *
1349  * The "monster health bar" provides visual feedback on the "health"
1350  * of the monster currently being "tracked".  There are several ways
1351  * to "track" a monster, including targetting it, attacking it, and
1352  * affecting it (and nobody else) with a ranged attack.
1353  *
1354  * Display the monster health bar (affectionately known as the
1355  * "health-o-meter").  Clear health bar if nothing is being tracked.
1356  * Auto-track current target monster when bored.  Note that the
1357  * health-bar stops tracking any monster that "disappears".
1358  * </pre>
1359  */
1360 static void health_redraw(bool riding)
1361 {
1362         s16b health_who;
1363         int row, col;
1364         monster_type *m_ptr;
1365
1366         if (riding)
1367         {
1368                 health_who = p_ptr->riding;
1369                 row = ROW_RIDING_INFO;
1370                 col = COL_RIDING_INFO;
1371         }
1372         else
1373         {
1374                 health_who = p_ptr->health_who;
1375                 row = ROW_INFO;
1376                 col = COL_INFO;
1377         }
1378
1379         m_ptr = &current_floor_ptr->m_list[health_who];
1380
1381         if (p_ptr->wizard && p_ptr->inside_battle)
1382         {
1383                 row = ROW_INFO - 2;
1384                 col = COL_INFO + 2;
1385
1386                 Term_putstr(col - 2, row, 12, TERM_WHITE, "      /     ");
1387                 Term_putstr(col - 2, row + 1, 12, TERM_WHITE, "      /     ");
1388                 Term_putstr(col - 2, row + 2, 12, TERM_WHITE, "      /     ");
1389                 Term_putstr(col - 2, row + 3, 12, TERM_WHITE, "      /     ");
1390
1391                 if(current_floor_ptr->m_list[1].r_idx)
1392                 {
1393                         Term_putstr(col - 2, row, 2, r_info[current_floor_ptr->m_list[1].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[1].r_idx].x_char));
1394                         Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].hp));
1395                         Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].max_maxhp));
1396                 }
1397
1398                 if(current_floor_ptr->m_list[2].r_idx)
1399                 {
1400                         Term_putstr(col - 2, row + 1, 2, r_info[current_floor_ptr->m_list[2].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[2].r_idx].x_char));
1401                         Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].hp));
1402                         Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].max_maxhp));
1403                 }
1404
1405                 if(current_floor_ptr->m_list[3].r_idx)
1406                 {
1407                         Term_putstr(col - 2, row + 2, 2, r_info[current_floor_ptr->m_list[3].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[3].r_idx].x_char));
1408                         Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].hp));
1409                         Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].max_maxhp));
1410                 }
1411
1412                 if(current_floor_ptr->m_list[4].r_idx)
1413                 {
1414                         Term_putstr(col - 2, row + 3, 2, r_info[current_floor_ptr->m_list[4].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[4].r_idx].x_char));
1415                         Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].hp));
1416                         Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].max_maxhp));
1417                 }
1418         }
1419         else
1420         {
1421
1422                 /* Not tracking */
1423                 if (!health_who)
1424                 {
1425                         /* Erase the health bar */
1426                         Term_erase(col, row, 12);
1427                 }
1428
1429                 /* Tracking an unseen monster */
1430                 else if (!m_ptr->ml)
1431                 {
1432                         /* Indicate that the monster health is "unknown" */
1433                         Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1434                 }
1435
1436                 /* Tracking a hallucinatory monster */
1437                 else if (p_ptr->image)
1438                 {
1439                         /* Indicate that the monster health is "unknown" */
1440                         Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1441                 }
1442
1443                 /* Tracking a dead monster (???) */
1444                 else if (m_ptr->hp < 0)
1445                 {
1446                         /* Indicate that the monster health is "unknown" */
1447                         Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1448                 }
1449
1450                 /* Tracking a visible monster */
1451                 else
1452                 {
1453                         /* Extract the "percent" of health */
1454                         int pct = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->maxhp : 0;
1455                         int pct2 = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->max_maxhp: 0;
1456
1457                         /* Convert percent into "health" */
1458                         int len = (pct2 < 10) ? 1 : (pct2 < 90) ? (pct2 / 10 + 1) : 10;
1459
1460                         /* Default to almost dead */
1461                         TERM_COLOR attr = TERM_RED;
1462
1463                         /* Invulnerable */
1464                         if (MON_INVULNER(m_ptr)) attr = TERM_WHITE;
1465
1466                         /* Asleep */
1467                         else if (MON_CSLEEP(m_ptr)) attr = TERM_BLUE;
1468
1469                         /* Afraid */
1470                         else if (MON_MONFEAR(m_ptr)) attr = TERM_VIOLET;
1471
1472                         /* Healthy */
1473                         else if (pct >= 100) attr = TERM_L_GREEN;
1474
1475                         /* Somewhat Wounded */
1476                         else if (pct >= 60) attr = TERM_YELLOW;
1477
1478                         /* Wounded */
1479                         else if (pct >= 25) attr = TERM_ORANGE;
1480
1481                         /* Badly wounded */
1482                         else if (pct >= 10) attr = TERM_L_RED;
1483
1484                         /* Default to "unknown" */
1485                         Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1486
1487                         /* Dump the current "health" (use '*' symbols) */
1488                         Term_putstr(col + 1, row, len, attr, "**********");
1489                 }
1490         }
1491 }
1492
1493
1494
1495 /*!
1496  * @brief プレイヤーのステータスを一括表示する(左側部分) / Display basic info (mostly left of map)
1497  * @return なし
1498  */
1499 static void prt_frame_basic(void)
1500 {
1501         int i;
1502         if (p_ptr->mimic_form)
1503                 prt_field(mimic_info[p_ptr->mimic_form].title, ROW_RACE, COL_RACE);
1504         else
1505         {
1506                 char str[14];
1507                 my_strcpy(str, rp_ptr->title, sizeof(str));
1508                 prt_field(str, ROW_RACE, COL_RACE);
1509         }
1510
1511         prt_title();
1512         prt_level();
1513         prt_exp();
1514         for (i = 0; i < A_MAX; i++) prt_stat(i);
1515         prt_ac();
1516         prt_hp();
1517         prt_sp();
1518         prt_gold();
1519         prt_depth();
1520         health_redraw(FALSE);
1521         health_redraw(TRUE);
1522 }
1523
1524
1525 /*!
1526  * @brief プレイヤーのステータスを一括表示する(下部分) / Display extra info (mostly below map)
1527  * @return なし
1528  */
1529 static void prt_frame_extra(void)
1530 {
1531         prt_cut();
1532         prt_stun();
1533         prt_hunger();
1534         prt_state();
1535         prt_speed();
1536         prt_study();
1537         prt_imitation();
1538         prt_status();
1539 }
1540
1541
1542 /*!
1543  * @brief サブウィンドウに所持品一覧を表示する / Hack -- display p_ptr->inventory_list in sub-windows
1544  * @return なし
1545  */
1546 static void fix_inven(void)
1547 {
1548         int j;
1549
1550         /* Scan windows */
1551         for (j = 0; j < 8; j++)
1552         {
1553                 term *old = Term;
1554
1555                 /* No window */
1556                 if (!angband_term[j]) continue;
1557
1558                 /* No relevant flags */
1559                 if (!(window_flag[j] & (PW_INVEN))) continue;
1560
1561                 /* Activate */
1562                 Term_activate(angband_term[j]);
1563
1564                 /* Display p_ptr->inventory_list */
1565                 display_inven();
1566                 Term_fresh();
1567                 Term_activate(old);
1568         }
1569 }
1570
1571
1572 /*!
1573  * @brief モンスターの現在数を一行で表現する / Print monster info in line
1574  * @param x 表示列
1575  * @param y 表示行
1576  * @param m_ptr 思い出を表示するモンスター情報の参照ポインタ
1577  * @param n_same モンスターの数の現在数
1578  * @details
1579  * <pre>
1580  * nnn X LV name
1581  *  nnn : number or unique(U) or wanted unique(W)
1582  *  X   : symbol of monster
1583  *  LV  : monster lv if known
1584  *  name: name of monster
1585  * @return なし
1586  * </pre>
1587  */
1588 static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type* m_ptr, int n_same){
1589         char buf[256];
1590         int i;
1591         MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1592         monster_race* r_ptr = &r_info[r_idx];
1593  
1594         Term_gotoxy(x, y);
1595         if(!r_ptr)return;
1596         //Number of 'U'nique
1597         if(r_ptr->flags1&RF1_UNIQUE){//unique
1598                 bool is_kubi = FALSE;
1599                 for(i=0;i<MAX_KUBI;i++){
1600                         if(current_world_ptr->bounty_r_idx[i] == r_idx){
1601                                 is_kubi = TRUE;
1602                                 break;
1603                         }
1604                 }
1605                 Term_addstr(-1, TERM_WHITE, is_kubi?"  W":"  U");
1606         }else{
1607                 sprintf(buf, "%3d", n_same);
1608                 Term_addstr(-1, TERM_WHITE, buf);
1609         }
1610         //symbol
1611         Term_addstr(-1, TERM_WHITE, " ");
1612         //Term_add_bigch(r_ptr->d_attr, r_ptr->d_char);
1613         //Term_addstr(-1, TERM_WHITE, "/");
1614         Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
1615         //LV
1616         if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){
1617                 sprintf(buf, " %2d", (int)r_ptr->level);
1618         }else{
1619                 strcpy(buf, " ??");
1620         }
1621         Term_addstr(-1, TERM_WHITE, buf);
1622         //name
1623         sprintf(buf, " %s ", r_name+r_ptr->name);
1624         Term_addstr(-1, TERM_WHITE, buf);
1625  
1626         //Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0));
1627 }
1628
1629 /*!
1630  * @brief モンスターの出現リストを表示する / Print monster info in line
1631  * @param x 表示列
1632  * @param y 表示行
1633  * @param max_lines 最大何行描画するか
1634  */
1635 void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
1636         TERM_LEN line = y;
1637         monster_type* last_mons = NULL;
1638         monster_type* m_ptr = NULL;
1639         int n_same = 0;
1640         int i;
1641
1642         for(i=0;i<tmp_pos.n;i++){
1643                 grid_type* g_ptr = &current_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]];
1644                 if(!g_ptr->m_idx || !current_floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look
1645                 m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
1646                 if(is_pet(m_ptr))continue;//pet
1647                 if(!m_ptr->r_idx)continue;//dead?
1648                 {
1649                         /*
1650                         MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1651                         monster_race* r_ptr = &r_info[r_idx];
1652                         concptr name = (r_name + r_ptr->name);
1653                         concptr ename = (r_name + r_ptr->name);
1654                         //ミミック類や「それ」等は、一覧に出てはいけない
1655                         if(r_ptr->flags1&RF1_CHAR_CLEAR)continue;
1656                         if((r_ptr->flags1&RF1_NEVER_MOVE)&&(r_ptr->flags2&RF2_CHAR_MULTI))continue;
1657                         //『ヌル』は、一覧に出てはいけない
1658                         if((strcmp(name, "生ける虚無『ヌル』")==0)||
1659                            (strcmp(ename, "Null the Living Void")==0))continue;
1660                         //"金無垢の指輪"は、一覧に出てはいけない
1661                         if((strcmp(name, "金無垢の指輪")==0)||
1662                                 (strcmp(ename, "Plain Gold Ring")==0))continue;
1663                         */
1664                 }
1665
1666                 //ソート済みなので同じモンスターは連続する.これを利用して同じモンスターをカウント,まとめて表示する.
1667                 if(!last_mons){//先頭モンスター
1668                         last_mons = m_ptr;
1669                         n_same = 1;
1670                         continue;
1671                 }
1672                 //same race?
1673                 if(last_mons->ap_r_idx == m_ptr->ap_r_idx){
1674                         n_same++;
1675                         continue;//表示処理を次に回す
1676                 }
1677                 //print last mons info
1678                 print_monster_line(x, line++, last_mons, n_same);
1679                 n_same = 1;
1680                 last_mons = m_ptr;
1681                 if(line-y-1==max_lines){//残り1行
1682                         break;
1683                 }
1684         }
1685         if(line-y-1==max_lines && i!=tmp_pos.n){
1686                 Term_gotoxy(x, line);
1687                 Term_addstr(-1, TERM_WHITE, "-- and more --");
1688         }else{
1689                 if(last_mons)print_monster_line(x, line++, last_mons, n_same);
1690         }
1691 }
1692
1693 /*!
1694  * @brief 出現中モンスターのリストをサブウィンドウに表示する / Hack -- display monster list in sub-windows
1695  * @return なし
1696  */
1697 static void fix_monster_list(void)
1698 {
1699         int j;
1700         int w, h;
1701
1702         /* Scan windows */
1703         for (j = 0; j < 8; j++)
1704         {
1705                 term *old = Term;
1706
1707                 /* No window */
1708                 if (!angband_term[j]) continue;
1709
1710                 /* No relevant flags */
1711                 if (!(window_flag[j] & (PW_MONSTER_LIST))) continue;
1712
1713                 /* Activate */
1714                 Term_activate(angband_term[j]);
1715                 Term_get_size(&w, &h);
1716
1717                 Term_clear();
1718
1719                 target_set_prepare_look();//モンスター一覧を生成,ソート
1720                 print_monster_list(0, 0, h);
1721                 Term_fresh();
1722                 Term_activate(old);
1723         }
1724 }
1725
1726
1727
1728 /*!
1729  * @brief 現在の装備品をサブウィンドウに表示する / 
1730  * Hack -- display equipment in sub-windows
1731  * @return なし
1732  */
1733 static void fix_equip(void)
1734 {
1735         int j;
1736
1737         /* Scan windows */
1738         for (j = 0; j < 8; j++)
1739         {
1740                 term *old = Term;
1741
1742                 /* No window */
1743                 if (!angband_term[j]) continue;
1744
1745                 /* No relevant flags */
1746                 if (!(window_flag[j] & (PW_EQUIP))) continue;
1747
1748                 /* Activate */
1749                 Term_activate(angband_term[j]);
1750
1751                 /* Display equipment */
1752                 display_equip();
1753                 Term_fresh();
1754                 Term_activate(old);
1755         }
1756 }
1757
1758
1759 /*!
1760  * @brief 現在の習得済魔法をサブウィンドウに表示する / 
1761  * Hack -- display spells in sub-windows
1762  * @return なし
1763  */
1764 static void fix_spell(void)
1765 {
1766         int j;
1767
1768         /* Scan windows */
1769         for (j = 0; j < 8; j++)
1770         {
1771                 term *old = Term;
1772
1773                 /* No window */
1774                 if (!angband_term[j]) continue;
1775
1776                 /* No relevant flags */
1777                 if (!(window_flag[j] & (PW_SPELL))) continue;
1778
1779                 /* Activate */
1780                 Term_activate(angband_term[j]);
1781
1782                 /* Display spell list */
1783                 display_spell_list();
1784                 Term_fresh();
1785                 Term_activate(old);
1786         }
1787 }
1788
1789
1790 /*!
1791  * @brief 現在のプレイヤーステータスをサブウィンドウに表示する / 
1792  * Hack -- display character in sub-windows
1793  * @return なし
1794  */
1795 static void fix_player(void)
1796 {
1797         int j;
1798
1799         /* Scan windows */
1800         for (j = 0; j < 8; j++)
1801         {
1802                 term *old = Term;
1803
1804                 /* No window */
1805                 if (!angband_term[j]) continue;
1806
1807                 /* No relevant flags */
1808                 if (!(window_flag[j] & (PW_PLAYER))) continue;
1809
1810                 /* Activate */
1811                 Term_activate(angband_term[j]);
1812
1813                 update_playtime();
1814                 display_player(0);
1815                 Term_fresh();
1816                 Term_activate(old);
1817         }
1818 }
1819
1820 /*!
1821  * @brief ゲームメッセージ履歴をサブウィンドウに表示する / 
1822  * Hack -- display recent messages in sub-windows
1823  * Adjust for width and split messages
1824  * @return なし
1825  */
1826 static void fix_message(void)
1827 {
1828         int j, i;
1829         TERM_LEN w, h;
1830         TERM_LEN x, y;
1831
1832         /* Scan windows */
1833         for (j = 0; j < 8; j++)
1834         {
1835                 term *old = Term;
1836
1837                 /* No window */
1838                 if (!angband_term[j]) continue;
1839
1840                 /* No relevant flags */
1841                 if (!(window_flag[j] & (PW_MESSAGE))) continue;
1842
1843                 /* Activate */
1844                 Term_activate(angband_term[j]);
1845
1846                 Term_get_size(&w, &h);
1847
1848                 /* Dump messages */
1849                 for (i = 0; i < h; i++)
1850                 {
1851                         /* Dump the message on the appropriate line */
1852                         Term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
1853
1854                         /* Cursor */
1855                         Term_locate(&x, &y);
1856
1857                         /* Clear to end of line */
1858                         Term_erase(x, y, 255);
1859                 }
1860                 Term_fresh();
1861                 Term_activate(old);
1862         }
1863 }
1864
1865
1866 /*!
1867  * @brief 簡易マップをサブウィンドウに表示する / 
1868  * Hack -- display overhead view in sub-windows
1869  * Adjust for width and split messages
1870  * @return なし
1871  * @details
1872  * Note that the "player" symbol does NOT appear on the map.
1873  */
1874 static void fix_overhead(void)
1875 {
1876         int j;
1877         int cy, cx;
1878
1879         /* Scan windows */
1880         for (j = 0; j < 8; j++)
1881         {
1882                 term *old = Term;
1883                 TERM_LEN wid, hgt;
1884
1885                 /* No window */
1886                 if (!angband_term[j]) continue;
1887
1888                 /* No relevant flags */
1889                 if (!(window_flag[j] & (PW_OVERHEAD))) continue;
1890
1891                 /* Activate */
1892                 Term_activate(angband_term[j]);
1893
1894                 /* Full map in too small window is useless  */
1895                 Term_get_size(&wid, &hgt);
1896                 if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2)
1897                 {
1898
1899                         display_map(&cy, &cx);
1900                         Term_fresh();
1901                 }
1902                 Term_activate(old);
1903         }
1904 }
1905
1906 static void display_dungeon(void)
1907 {
1908         TERM_LEN x, y;
1909         TERM_COLOR a;
1910         SYMBOL_CODE c;
1911
1912         TERM_COLOR ta = 0;
1913         SYMBOL_CODE tc = '\0';
1914
1915         for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++)
1916         {
1917                 for (y = p_ptr->y - Term->hgt / 2 + 1; y <= p_ptr->y + Term->hgt / 2; y++)
1918                 {
1919                         if (in_bounds2(y, x))
1920                         {
1921                                 map_info(y, x, &a, &c, &ta, &tc);
1922
1923                                 /* Hack -- fake monochrome */
1924                                 if (!use_graphics)
1925                                 {
1926                                         if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
1927                                         else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
1928                                         else if (p_ptr->wraith_form) a = TERM_L_DARK;
1929                                 }
1930
1931                                 /* Hack -- Queue it */
1932                                 Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
1933                         }
1934                         else
1935                         {
1936                                 /* Clear out-of-bound tiles */
1937
1938                                 /* Access darkness */
1939                                 feature_type *f_ptr = &f_info[feat_none];
1940
1941                                 /* Normal attr */
1942                                 a = f_ptr->x_attr[F_LIT_STANDARD];
1943
1944                                 /* Normal char */
1945                                 c = f_ptr->x_char[F_LIT_STANDARD];
1946
1947                                 /* Hack -- Queue it */
1948                                 Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
1949                         }
1950                 }
1951         }
1952 }
1953
1954 /*!
1955  * @brief ダンジョンの地形をサブウィンドウに表示する / 
1956  * Hack -- display dungeon view in sub-windows
1957  * @return なし
1958  */
1959 static void fix_dungeon(void)
1960 {
1961         int j;
1962
1963         /* Scan windows */
1964         for (j = 0; j < 8; j++)
1965         {
1966                 term *old = Term;
1967
1968                 /* No window */
1969                 if (!angband_term[j]) continue;
1970
1971                 /* No relevant flags */
1972                 if (!(window_flag[j] & (PW_DUNGEON))) continue;
1973
1974                 /* Activate */
1975                 Term_activate(angband_term[j]);
1976
1977                 /* Redraw dungeon view */
1978                 display_dungeon();
1979                 Term_fresh();
1980                 Term_activate(old);
1981         }
1982 }
1983
1984
1985 /*!
1986  * @brief モンスターの思い出をサブウィンドウに表示する / 
1987  * Hack -- display dungeon view in sub-windows
1988  * @return なし
1989  */
1990 static void fix_monster(void)
1991 {
1992         int j;
1993
1994         /* Scan windows */
1995         for (j = 0; j < 8; j++)
1996         {
1997                 term *old = Term;
1998
1999                 /* No window */
2000                 if (!angband_term[j]) continue;
2001
2002                 /* No relevant flags */
2003                 if (!(window_flag[j] & (PW_MONSTER))) continue;
2004
2005                 /* Activate */
2006                 Term_activate(angband_term[j]);
2007
2008                 /* Display monster race info */
2009                 if (p_ptr->monster_race_idx) display_roff(p_ptr->monster_race_idx);
2010                 Term_fresh();
2011                 Term_activate(old);
2012         }
2013 }
2014
2015
2016 /*!
2017  * @brief ベースアイテム情報をサブウィンドウに表示する / 
2018  * Hack -- display object recall in sub-windows
2019  * @return なし
2020  */
2021 static void fix_object(void)
2022 {
2023         int j;
2024
2025         /* Scan windows */
2026         for (j = 0; j < 8; j++)
2027         {
2028                 term *old = Term;
2029
2030                 /* No window */
2031                 if (!angband_term[j]) continue;
2032
2033                 /* No relevant flags */
2034                 if (!(window_flag[j] & (PW_OBJECT))) continue;
2035
2036                 /* Activate */
2037                 Term_activate(angband_term[j]);
2038
2039                 /* Display monster race info */
2040                 if (p_ptr->object_kind_idx) display_koff(p_ptr->object_kind_idx);
2041                 Term_fresh();
2042                 Term_activate(old);
2043         }
2044 }
2045
2046
2047
2048 /*!
2049  * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 /
2050  * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
2051  * @return 重すぎるならばTRUE
2052  */
2053 bool is_heavy_shoot(object_type *o_ptr)
2054 {
2055         int hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
2056         /* It is hard to carholdry a heavy bow */
2057         return (hold < o_ptr->weight / 10);
2058 }
2059
2060
2061 /*! 
2062  * @brief p_ptr->redraw のフラグに応じた更新をまとめて行う / Handle "p_ptr->redraw"
2063  * @return なし
2064  * @details 更新処理の対象はゲーム中の全描画処理
2065  */
2066 static void redraw_stuff(void)
2067 {
2068         if (!p_ptr->redraw) return;
2069
2070         /* Character is not ready yet, no screen updates */
2071         if (!current_world_ptr->character_generated) return;
2072
2073         /* Character is in "icky" mode, no screen updates */
2074         if (current_world_ptr->character_icky) return;
2075
2076         /* Hack -- clear the screen */
2077         if (p_ptr->redraw & (PR_WIPE))
2078         {
2079                 p_ptr->redraw &= ~(PR_WIPE);
2080                 msg_print(NULL);
2081                 Term_clear();
2082         }
2083
2084         if (p_ptr->redraw & (PR_MAP))
2085         {
2086                 p_ptr->redraw &= ~(PR_MAP);
2087                 prt_map();
2088         }
2089
2090         if (p_ptr->redraw & (PR_BASIC))
2091         {
2092                 p_ptr->redraw &= ~(PR_BASIC);
2093                 p_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
2094                 p_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
2095                 p_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
2096                 p_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
2097                 prt_frame_basic();
2098                 prt_time();
2099                 prt_dungeon();
2100         }
2101
2102         if (p_ptr->redraw & (PR_EQUIPPY))
2103         {
2104                 p_ptr->redraw &= ~(PR_EQUIPPY);
2105                 print_equippy(); /* To draw / delete equippy chars */
2106         }
2107
2108         if (p_ptr->redraw & (PR_MISC))
2109         {
2110                 p_ptr->redraw &= ~(PR_MISC);
2111                 prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
2112 /*              prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
2113         }
2114
2115         if (p_ptr->redraw & (PR_TITLE))
2116         {
2117                 p_ptr->redraw &= ~(PR_TITLE);
2118                 prt_title();
2119         }
2120
2121         if (p_ptr->redraw & (PR_LEV))
2122         {
2123                 p_ptr->redraw &= ~(PR_LEV);
2124                 prt_level();
2125         }
2126
2127         if (p_ptr->redraw & (PR_EXP))
2128         {
2129                 p_ptr->redraw &= ~(PR_EXP);
2130                 prt_exp();
2131         }
2132
2133         if (p_ptr->redraw & (PR_STATS))
2134         {
2135                 p_ptr->redraw &= ~(PR_STATS);
2136                 prt_stat(A_STR);
2137                 prt_stat(A_INT);
2138                 prt_stat(A_WIS);
2139                 prt_stat(A_DEX);
2140                 prt_stat(A_CON);
2141                 prt_stat(A_CHR);
2142         }
2143
2144         if (p_ptr->redraw & (PR_STATUS))
2145         {
2146                 p_ptr->redraw &= ~(PR_STATUS);
2147                 prt_status();
2148         }
2149
2150         if (p_ptr->redraw & (PR_ARMOR))
2151         {
2152                 p_ptr->redraw &= ~(PR_ARMOR);
2153                 prt_ac();
2154         }
2155
2156         if (p_ptr->redraw & (PR_HP))
2157         {
2158                 p_ptr->redraw &= ~(PR_HP);
2159                 prt_hp();
2160         }
2161
2162         if (p_ptr->redraw & (PR_MANA))
2163         {
2164                 p_ptr->redraw &= ~(PR_MANA);
2165                 prt_sp();
2166         }
2167
2168         if (p_ptr->redraw & (PR_GOLD))
2169         {
2170                 p_ptr->redraw &= ~(PR_GOLD);
2171                 prt_gold();
2172         }
2173
2174         if (p_ptr->redraw & (PR_DEPTH))
2175         {
2176                 p_ptr->redraw &= ~(PR_DEPTH);
2177                 prt_depth();
2178         }
2179
2180         if (p_ptr->redraw & (PR_HEALTH))
2181         {
2182                 p_ptr->redraw &= ~(PR_HEALTH);
2183                 health_redraw(FALSE);
2184         }
2185
2186         if (p_ptr->redraw & (PR_UHEALTH))
2187         {
2188                 p_ptr->redraw &= ~(PR_UHEALTH);
2189                 health_redraw(TRUE);
2190         }
2191
2192         if (p_ptr->redraw & (PR_EXTRA))
2193         {
2194                 p_ptr->redraw &= ~(PR_EXTRA);
2195                 p_ptr->redraw &= ~(PR_CUT | PR_STUN);
2196                 p_ptr->redraw &= ~(PR_HUNGER);
2197                 p_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
2198                 prt_frame_extra();
2199         }
2200
2201         if (p_ptr->redraw & (PR_CUT))
2202         {
2203                 p_ptr->redraw &= ~(PR_CUT);
2204                 prt_cut();
2205         }
2206
2207         if (p_ptr->redraw & (PR_STUN))
2208         {
2209                 p_ptr->redraw &= ~(PR_STUN);
2210                 prt_stun();
2211         }
2212
2213         if (p_ptr->redraw & (PR_HUNGER))
2214         {
2215                 p_ptr->redraw &= ~(PR_HUNGER);
2216                 prt_hunger();
2217         }
2218
2219         if (p_ptr->redraw & (PR_STATE))
2220         {
2221                 p_ptr->redraw &= ~(PR_STATE);
2222                 prt_state();
2223         }
2224
2225         if (p_ptr->redraw & (PR_SPEED))
2226         {
2227                 p_ptr->redraw &= ~(PR_SPEED);
2228                 prt_speed();
2229         }
2230
2231         if (p_ptr->pclass == CLASS_IMITATOR)
2232         {
2233                 if (p_ptr->redraw & (PR_IMITATION))
2234                 {
2235                         p_ptr->redraw &= ~(PR_IMITATION);
2236                         prt_imitation();
2237                 }
2238         }
2239         else if (p_ptr->redraw & (PR_STUDY))
2240         {
2241                 p_ptr->redraw &= ~(PR_STUDY);
2242                 prt_study();
2243         }
2244 }
2245
2246 /*! 
2247  * @brief p_ptr->window のフラグに応じた更新をまとめて行う / Handle "p_ptr->window"
2248  * @return なし
2249  * @details 更新処理の対象はサブウィンドウ全般
2250  */
2251 static void window_stuff(void)
2252 {
2253         int j;
2254         BIT_FLAGS mask = 0L;
2255
2256         /* Nothing to do */
2257         if (!p_ptr->window) return;
2258
2259         /* Scan windows */
2260         for (j = 0; j < 8; j++)
2261         {
2262                 /* Save usable flags */
2263                 if (angband_term[j]) mask |= window_flag[j];
2264         }
2265
2266         /* Apply usable flags */
2267         p_ptr->window &= mask;
2268
2269         /* Nothing to do */
2270         if (!p_ptr->window) return;
2271
2272         /* Display p_ptr->inventory_list */
2273         if (p_ptr->window & (PW_INVEN))
2274         {
2275                 p_ptr->window &= ~(PW_INVEN);
2276                 fix_inven();
2277         }
2278
2279         /* Display equipment */
2280         if (p_ptr->window & (PW_EQUIP))
2281         {
2282                 p_ptr->window &= ~(PW_EQUIP);
2283                 fix_equip();
2284         }
2285
2286         /* Display spell list */
2287         if (p_ptr->window & (PW_SPELL))
2288         {
2289                 p_ptr->window &= ~(PW_SPELL);
2290                 fix_spell();
2291         }
2292
2293         /* Display player */
2294         if (p_ptr->window & (PW_PLAYER))
2295         {
2296                 p_ptr->window &= ~(PW_PLAYER);
2297                 fix_player();
2298         }
2299         
2300         /* Display monster list */
2301         if (p_ptr->window & (PW_MONSTER_LIST))
2302         {
2303                 p_ptr->window &= ~(PW_MONSTER_LIST);
2304                 fix_monster_list();
2305         }
2306         
2307         /* Display overhead view */
2308         if (p_ptr->window & (PW_MESSAGE))
2309         {
2310                 p_ptr->window &= ~(PW_MESSAGE);
2311                 fix_message();
2312         }
2313
2314         /* Display overhead view */
2315         if (p_ptr->window & (PW_OVERHEAD))
2316         {
2317                 p_ptr->window &= ~(PW_OVERHEAD);
2318                 fix_overhead();
2319         }
2320
2321         /* Display overhead view */
2322         if (p_ptr->window & (PW_DUNGEON))
2323         {
2324                 p_ptr->window &= ~(PW_DUNGEON);
2325                 fix_dungeon();
2326         }
2327
2328         /* Display monster recall */
2329         if (p_ptr->window & (PW_MONSTER))
2330         {
2331                 p_ptr->window &= ~(PW_MONSTER);
2332                 fix_monster();
2333         }
2334
2335         /* Display object recall */
2336         if (p_ptr->window & (PW_OBJECT))
2337         {
2338                 p_ptr->window &= ~(PW_OBJECT);
2339                 fix_object();
2340         }
2341 }
2342
2343
2344 /*!
2345  * @brief 全更新処理をチェックして処理していく
2346  * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
2347  * @return なし
2348  */
2349 void handle_stuff(void)
2350 {
2351         if (p_ptr->update) update_creature(p_ptr);
2352         if (p_ptr->redraw) redraw_stuff();
2353         if (p_ptr->window) window_stuff();
2354 }
2355
2356 void update_output(void)
2357 {
2358         if (p_ptr->redraw) redraw_stuff();
2359         if (p_ptr->window) window_stuff();
2360 }
2361
2362 /*!
2363  * @brief コンソールのリサイズに合わせてマップを再描画する /
2364  * Map resizing whenever the main term changes size
2365  * @return なし
2366  */
2367 void resize_map(void)
2368 {
2369         /* Only if the dungeon exists */
2370         if (!current_world_ptr->character_dungeon) return;
2371
2372         /* Mega-Hack -- no panel yet */
2373         panel_row_max = 0;
2374         panel_col_max = 0;
2375
2376         /* Reset the panels */
2377         panel_row_min = current_floor_ptr->height;
2378         panel_col_min = current_floor_ptr->width;
2379
2380         verify_panel();
2381
2382         p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2383         p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2384         p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2385         p_ptr->update |= (PU_MONSTERS);
2386         p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2387
2388         handle_stuff();
2389         Term_redraw();
2390
2391         /*
2392          * Waiting command;
2393          * Place the cursor on the player
2394          */
2395         if (can_save) move_cursor_relative(p_ptr->y, p_ptr->x);
2396
2397         Term_fresh();
2398 }
2399
2400 /*!
2401  * @brief コンソールを再描画する /
2402  * Redraw a term when it is resized
2403  * @return なし
2404  */
2405 void redraw_window(void)
2406 {
2407         /* Only if the dungeon exists */
2408         if (!current_world_ptr->character_dungeon) return;
2409
2410         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2411         p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2412
2413         handle_stuff();
2414         Term_redraw();
2415 }
2416
2417
2418 /*!
2419  * @brief フォーカスを当てるべきマップ描画の基準座標を指定する(サブルーチン)
2420  * @param dy 変更先のフロアY座標
2421  * @param dx 変更先のフロアX座標
2422  * Handle a request to change the current panel
2423  * Return TRUE if the panel was changed.
2424  * Also used in do_cmd_locate
2425  * @return 実際に再描画が必要だった場合TRUEを返す
2426  */
2427 bool change_panel(POSITION dy, POSITION dx)
2428 {
2429         POSITION y, x;
2430         TERM_LEN wid, hgt;
2431
2432         get_screen_size(&wid, &hgt);
2433
2434         /* Apply the motion */
2435         y = panel_row_min + dy * hgt / 2;
2436         x = panel_col_min + dx * wid / 2;
2437
2438         /* Verify the row */
2439         if (y > current_floor_ptr->height - hgt) y = current_floor_ptr->height - hgt;
2440         if (y < 0) y = 0;
2441
2442         /* Verify the col */
2443         if (x > current_floor_ptr->width - wid) x = current_floor_ptr->width - wid;
2444         if (x < 0) x = 0;
2445
2446         /* Handle "changes" */
2447         if ((y != panel_row_min) || (x != panel_col_min))
2448         {
2449                 /* Save the new panel info */
2450                 panel_row_min = y;
2451                 panel_col_min = x;
2452
2453                 panel_bounds_center();
2454
2455                 p_ptr->update |= (PU_MONSTERS);
2456                 p_ptr->redraw |= (PR_MAP);
2457                 handle_stuff();
2458
2459                 /* Success */
2460                 return (TRUE);
2461         }
2462
2463         /* No change */
2464         return (FALSE);
2465 }
2466
2467 /*!
2468  * @brief プレイヤーの装備一覧シンボルを固定位置に表示する
2469  * @return なし
2470  */
2471 void print_equippy(void)
2472 {
2473         display_player_equippy(ROW_EQUIPPY, COL_EQUIPPY, 0);
2474 }
2475
2476 /*!
2477  * @brief 現在のコンソール表示の縦横を返す。 /
2478  * Get term size and calculate screen size
2479  * @param wid_p コンソールの表示幅文字数を返す
2480  * @param hgt_p コンソールの表示行数を返す
2481  * @return なし
2482  */
2483 void get_screen_size(TERM_LEN *wid_p, TERM_LEN *hgt_p)
2484 {
2485         Term_get_size(wid_p, hgt_p);
2486         *hgt_p -= ROW_MAP + 2;
2487         *wid_p -= COL_MAP + 2;
2488         if (use_bigtile) *wid_p /= 2;
2489 }
2490
2491 /*
2492  * Calculate panel colum of a location in the map
2493  */
2494 int panel_col_of(int col)
2495 {
2496         col -= panel_col_min;
2497         if (use_bigtile) col *= 2;
2498         return col + 13;
2499 }
2500
2501 /*
2502  * Prints the map of the dungeon
2503  *
2504  * Note that, for efficiency, we contain an "optimized" version
2505  * of both "lite_spot()" and "print_rel()", and that we use the
2506  * "lite_spot()" function to display the player grid, if needed.
2507  */
2508 void prt_map(void)
2509 {
2510         POSITION x, y;
2511         int v;
2512
2513         /* map bounds */
2514         POSITION xmin, xmax, ymin, ymax;
2515
2516         TERM_LEN wid, hgt;
2517
2518         Term_get_size(&wid, &hgt);
2519
2520         /* Remove map offset */
2521         wid -= COL_MAP + 2;
2522         hgt -= ROW_MAP + 2;
2523
2524         /* Access the cursor state */
2525         (void)Term_get_cursor(&v);
2526
2527         /* Hide the cursor */
2528         (void)Term_set_cursor(0);
2529
2530         /* Get bounds */
2531         xmin = (0 < panel_col_min) ? panel_col_min : 0;
2532         xmax = (current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : current_floor_ptr->width - 1;
2533         ymin = (0 < panel_row_min) ? panel_row_min : 0;
2534         ymax = (current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : current_floor_ptr->height - 1;
2535
2536         /* Bottom section of screen */
2537         for (y = 1; y <= ymin - panel_row_prt; y++)
2538         {
2539                 /* Erase the section */
2540                 Term_erase(COL_MAP, y, wid);
2541         }
2542
2543         /* Top section of screen */
2544         for (y = ymax - panel_row_prt; y <= hgt; y++)
2545         {
2546                 /* Erase the section */
2547                 Term_erase(COL_MAP, y, wid);
2548         }
2549
2550         /* Dump the map */
2551         for (y = ymin; y <= ymax; y++)
2552         {
2553                 /* Scan the columns of row "y" */
2554                 for (x = xmin; x <= xmax; x++)
2555                 {
2556                         TERM_COLOR a;
2557                         SYMBOL_CODE c;
2558
2559                         TERM_COLOR ta;
2560                         SYMBOL_CODE tc;
2561
2562                         /* Determine what is there */
2563                         map_info(y, x, &a, &c, &ta, &tc);
2564
2565                         /* Hack -- fake monochrome */
2566                         if (!use_graphics)
2567                         {
2568                                 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
2569                                 else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
2570                                 else if (p_ptr->wraith_form) a = TERM_L_DARK;
2571                         }
2572
2573                         /* Efficiency -- Redraw that grid of the map */
2574                         Term_queue_bigchar(panel_col_of(x), y - panel_row_prt, a, c, ta, tc);
2575                 }
2576         }
2577
2578         /* Display player */
2579         lite_spot(p_ptr->y, p_ptr->x);
2580
2581         /* Restore the cursor */
2582         (void)Term_set_cursor(v);
2583 }
2584
2585
2586
2587 /*!
2588  * 一般的にモンスターシンボルとして扱われる記号を定義する(幻覚処理向け) / Hack -- Legal monster codes
2589  */
2590 static char image_monster_hack[] = \
2591 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2592
2593 /*!
2594  * 一般的にオブジェクトシンボルとして扱われる記号を定義する(幻覚処理向け) /  Hack -- Legal object codes
2595  */
2596 static char image_object_hack[] = "?/|\\\"!$()_-=[]{},~";
2597
2598 /*!
2599  * @brief モンスターの表示を幻覚状態に差し替える / Mega-Hack -- Hallucinatory monster
2600  * @param ap 本来の色
2601  * @param cp 本来のシンボル
2602  * @return なし
2603  */
2604 static void image_monster(TERM_COLOR *ap, SYMBOL_CODE *cp)
2605 {
2606         /* Random symbol from set above */
2607         if (use_graphics)
2608         {
2609                 monster_race *r_ptr = &r_info[randint1(max_r_idx - 1)];
2610
2611                 *cp = r_ptr->x_char;
2612                 *ap = r_ptr->x_attr;
2613         }
2614         else
2615                 /* Text mode */
2616         {
2617                 *cp = (one_in_(25) ?
2618                         image_object_hack[randint0(sizeof(image_object_hack) - 1)] :
2619                         image_monster_hack[randint0(sizeof(image_monster_hack) - 1)]);
2620
2621                 /* Random color */
2622                 *ap = randint1(15);
2623         }
2624 }
2625
2626 /*!
2627  * @brief オブジェクトの表示を幻覚状態に差し替える / Hallucinatory object
2628  * @param ap 本来の色
2629  * @param cp 本来のシンボル
2630  * @return なし
2631  */
2632 static void image_object(TERM_COLOR *ap, SYMBOL_CODE *cp)
2633 {
2634         if (use_graphics)
2635         {
2636                 object_kind *k_ptr = &k_info[randint1(max_k_idx - 1)];
2637
2638                 *cp = k_ptr->x_char;
2639                 *ap = k_ptr->x_attr;
2640         }
2641         else
2642         {
2643                 int n = sizeof(image_object_hack) - 1;
2644
2645                 *cp = image_object_hack[randint0(n)];
2646
2647                 /* Random color */
2648                 *ap = randint1(15);
2649         }
2650 }
2651
2652
2653 /*!
2654  * @brief オブジェクト&モンスターの表示を幻覚状態に差し替える / Hack -- Random hallucination
2655  * @param ap 本来の色
2656  * @param cp 本来のシンボル
2657  * @return なし
2658  */
2659 static void image_random(TERM_COLOR *ap, SYMBOL_CODE *cp)
2660 {
2661         /* Normally, assume monsters */
2662         if (randint0(100) < 75)
2663         {
2664                 image_monster(ap, cp);
2665         }
2666
2667         /* Otherwise, assume objects */
2668         else
2669         {
2670                 image_object(ap, cp);
2671         }
2672 }
2673
2674 /*!
2675  * 照明の表現を行うための色合いの関係を{暗闇時, 照明時} で定義する /
2676  * This array lists the effects of "brightness" on various "base" colours.\n
2677  *\n
2678  * This is used to do dynamic lighting effects in ascii :-)\n
2679  * At the moment, only the various "floor" tiles are affected.\n
2680  *\n
2681  * The layout of the array is [x][0] = light and [x][1] = dark.\n
2682  */
2683 static TERM_COLOR lighting_colours[16][2] =
2684 {
2685         /* TERM_DARK */
2686         {TERM_L_DARK, TERM_DARK},
2687
2688         /* TERM_WHITE */
2689         {TERM_YELLOW, TERM_SLATE},
2690
2691         /* TERM_SLATE */
2692         {TERM_WHITE, TERM_L_DARK},
2693
2694         /* TERM_ORANGE */
2695         {TERM_L_UMBER, TERM_UMBER},
2696
2697         /* TERM_RED */
2698         {TERM_RED, TERM_RED},
2699
2700         /* TERM_GREEN */
2701         {TERM_L_GREEN, TERM_GREEN},
2702
2703         /* TERM_BLUE */
2704         {TERM_BLUE, TERM_BLUE},
2705
2706         /* TERM_UMBER */
2707         {TERM_L_UMBER, TERM_RED},
2708
2709         /* TERM_L_DARK */
2710         {TERM_SLATE, TERM_L_DARK},
2711
2712         /* TERM_L_WHITE */
2713         {TERM_WHITE, TERM_SLATE},
2714
2715         /* TERM_VIOLET */
2716         {TERM_L_RED, TERM_BLUE},
2717
2718         /* TERM_YELLOW */
2719         {TERM_YELLOW, TERM_ORANGE},
2720
2721         /* TERM_L_RED */
2722         {TERM_L_RED, TERM_L_RED},
2723
2724         /* TERM_L_GREEN */
2725         {TERM_L_GREEN, TERM_GREEN},
2726
2727         /* TERM_L_BLUE */
2728         {TERM_L_BLUE, TERM_L_BLUE},
2729
2730         /* TERM_L_UMBER */
2731         {TERM_L_UMBER, TERM_UMBER}
2732 };
2733
2734
2735 /*!
2736  * @brief 調査中
2737  * @todo コメントを付加すること
2738  */
2739 void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE f_char[F_LIT_MAX])
2740 {
2741         TERM_COLOR s_attr = f_attr[F_LIT_STANDARD];
2742         SYMBOL_CODE s_char = f_char[F_LIT_STANDARD];
2743         int i;
2744
2745         if (is_ascii_graphics(s_attr)) /* For ASCII */
2746         {
2747                 f_attr[F_LIT_LITE] = lighting_colours[s_attr & 0x0f][0];
2748                 f_attr[F_LIT_DARK] = lighting_colours[s_attr & 0x0f][1];
2749                 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++) f_char[i] = s_char;
2750         }
2751         else /* For tile graphics */
2752         {
2753                 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++) f_attr[i] = s_attr;
2754                 f_char[F_LIT_LITE] = s_char + 2;
2755                 f_char[F_LIT_DARK] = s_char + 1;
2756         }
2757 }
2758
2759
2760 /*!
2761  * @brief Mコマンドによる縮小マップの表示を行う / Extract the attr/char to display at the given (legal) map location
2762  * @details
2763  * Basically, we "paint" the chosen attr/char in several passes, starting\n
2764  * with any known "terrain features" (defaulting to darkness), then adding\n
2765  * any known "objects", and finally, adding any known "monsters".  This\n
2766  * is not the fastest method but since most of the calls to this function\n
2767  * are made for grids with no monsters or objects, it is fast enough.\n
2768  *\n
2769  * Note that this function, if used on the grid containing the "player",\n
2770  * will return the attr/char of the grid underneath the player, and not\n
2771  * the actual player attr/char itself, allowing a lot of optimization\n
2772  * in various "display" functions.\n
2773  *\n
2774  * Note that the "zero" entry in the feature/object/monster arrays are\n
2775  * used to provide "special" attr/char codes, with "monster zero" being\n
2776  * used for the player attr/char, "object zero" being used for the "stack"\n
2777  * attr/char, and "feature zero" being used for the "nothing" attr/char,\n
2778  * though this function makes use of only "feature zero".\n
2779  *\n
2780  * Note that monsters can have some "special" flags, including "ATTR_MULTI",\n
2781  * which means their color changes, and "ATTR_CLEAR", which means they take\n
2782  * the color of whatever is under them, and "CHAR_CLEAR", which means that\n
2783  * they take the symbol of whatever is under them.  Technically, the flag\n
2784  * "CHAR_MULTI" is supposed to indicate that a monster looks strange when\n
2785  * examined, but this flag is currently ignored.\n
2786  *\n
2787  * Currently, we do nothing with multi-hued objects, because there are\n
2788  * not any.  If there were, they would have to set "shimmer_objects"\n
2789  * when they were created, and then new "shimmer" code in "dungeon.c"\n
2790  * would have to be created handle the "shimmer" effect, and the code\n
2791  * in "current_floor_ptr->grid_array.c" would have to be updated to create the shimmer effect.\n
2792  *\n
2793  * Note the effects of hallucination.  Objects always appear as random\n
2794  * "objects", monsters as random "monsters", and normal grids occasionally\n
2795  * appear as random "monsters" or "objects", but note that these random\n
2796  * "monsters" and "objects" are really just "colored ascii symbols".\n
2797  *\n
2798  * Note that "floors" and "invisible traps" (and "zero" features) are\n
2799  * drawn as "floors" using a special check for optimization purposes,\n
2800  * and these are the only features which get drawn using the special\n
2801  * lighting effects activated by "view_special_lite".\n
2802  *\n
2803  * Note the use of the "mimic" field in the "terrain feature" processing,\n
2804  * which allows any feature to "pretend" to be another feature.  This is\n
2805  * used to "hide" secret doors, and to make all "doors" appear the same,\n
2806  * and all "walls" appear the same, and "hidden" treasure stay hidden.\n
2807  * It is possible to use this field to make a feature "look" like a floor,\n
2808  * but the "special lighting effects" for floors will not be used.\n
2809  *\n
2810  * Note the use of the new "terrain feature" information.  Note that the\n
2811  * assumption that all interesting "objects" and "terrain features" are\n
2812  * memorized allows extremely optimized processing below.  Note the use\n
2813  * of separate flags on objects to mark them as memorized allows a grid\n
2814  * to have memorized "terrain" without granting knowledge of any object\n
2815  * which may appear in that grid.\n
2816  *\n
2817  * Note the efficient code used to determine if a "floor" grid is\n
2818  * "memorized" or "viewable" by the player, where the test for the\n
2819  * grid being "viewable" is based on the facts that (1) the grid\n
2820  * must be "lit" (torch-lit or perma-lit), (2) the grid must be in\n
2821  * line of sight, and (3) the player must not be blind, and uses the\n
2822  * assumption that all torch-lit grids are in line of sight.\n
2823  *\n
2824  * Note that floors (and invisible traps) are the only grids which are\n
2825  * not memorized when seen, so only these grids need to check to see if\n
2826  * the grid is "viewable" to the player (if it is not memorized).  Since\n
2827  * most non-memorized grids are in fact walls, this induces *massive*\n
2828  * efficiency, at the cost of *forcing* the memorization of non-floor\n
2829  * grids when they are first seen.  Note that "invisible traps" are\n
2830  * always treated exactly like "floors", which prevents "cheating".\n
2831  *\n
2832  * Note the "special lighting effects" which can be activated for floor\n
2833  * grids using the "view_special_lite" option (for "white" floor grids),\n
2834  * causing certain grids to be displayed using special colors.  If the\n
2835  * player is "blind", we will use "dark gray", else if the grid is lit\n
2836  * by the torch, and the "view_yellow_lite" option is set, we will use\n
2837  * "yellow", else if the grid is "dark", we will use "dark gray", else\n
2838  * if the grid is not "viewable", and the "view_bright_lite" option is\n
2839  * set, and the we will use "slate" (gray).  We will use "white" for all\n
2840  * other cases, in particular, for illuminated viewable floor grids.\n
2841  *\n
2842  * Note the "special lighting effects" which can be activated for wall\n
2843  * grids using the "view_granite_lite" option (for "white" wall grids),\n
2844  * causing certain grids to be displayed using special colors.  If the\n
2845  * player is "blind", we will use "dark gray", else if the grid is lit\n
2846  * by the torch, and the "view_yellow_lite" option is set, we will use\n
2847  * "yellow", else if the "view_bright_lite" option is set, and the grid\n
2848  * is not "viewable", or is "dark", or is glowing, but not when viewed\n
2849  * from the player's current location, we will use "slate" (gray).  We\n
2850  * will use "white" for all other cases, in particular, for correctly\n
2851  * illuminated viewable wall grids.\n
2852  *\n
2853  * Note that, when "view_granite_lite" is set, we use an inline version\n
2854  * of the "player_can_see_bold()" function to check the "viewability" of\n
2855  * grids when the "view_bright_lite" option is set, and we do NOT use\n
2856  * any special colors for "dark" wall grids, since this would allow the\n
2857  * player to notice the walls of illuminated rooms from a hallway that\n
2858  * happened to run beside the room.  The alternative, by the way, would\n
2859  * be to prevent the generation of hallways next to rooms, but this\n
2860  * would still allow problems when digging towards a room.\n
2861  *\n
2862  * Note that bizarre things must be done when the "attr" and/or "char"\n
2863  * codes have the "high-bit" set, since these values are used to encode\n
2864  * various "special" pictures in some versions, and certain situations,\n
2865  * such as "multi-hued" or "clear" monsters, cause the attr/char codes\n
2866  * to be "scrambled" in various ways.\n
2867  *\n
2868  * Note that eventually we may use the "&" symbol for embedded treasure,\n
2869  * and use the "*" symbol to indicate multiple objects, though this will\n
2870  * have to wait for Angband 2.8.0 or later.  Note that currently, this\n
2871  * is not important, since only one object or terrain feature is allowed\n
2872  * in each grid.  If needed, "k_info[0]" will hold the "stack" attr/char.\n
2873  *\n
2874  * Note the assumption that doing "x_ptr = &x_info[x]" plus a few of\n
2875  * "x_ptr->xxx", is quicker than "x_info[x].xxx", if this is incorrect\n
2876  * then a whole lot of code should be changed...  XXX XXX\n
2877  */
2878 void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLOR *tap, SYMBOL_CODE *tcp)
2879 {
2880         /* Get the current_floor_ptr->grid_array */
2881         grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
2882
2883         OBJECT_IDX this_o_idx, next_o_idx = 0;
2884
2885         /* Feature code (applying "mimic" field) */
2886         FEAT_IDX feat = get_feat_mimic(g_ptr);
2887
2888         /* Access floor */
2889         feature_type *f_ptr = &f_info[feat];
2890
2891         TERM_COLOR a;
2892         SYMBOL_CODE c;
2893
2894         /* Boring grids (floors, etc) */
2895         if (!have_flag(f_ptr->flags, FF_REMEMBER))
2896         {
2897                 /*
2898                  * Handle Memorized or visible floor
2899                  *
2900                  * No visual when blinded.
2901                  *   (to prevent strange effects on darkness breath)
2902                  * otherwise,
2903                  * - Can see grids with CAVE_MARK.
2904                  * - Can see grids with CAVE_LITE or CAVE_MNLT.
2905                  *   (Such grids also have CAVE_VIEW)
2906                  * - Can see grids with CAVE_VIEW unless darkened by monsters.
2907                  */
2908                 if (!p_ptr->blind &&
2909                         ((g_ptr->info & (CAVE_MARK | CAVE_LITE | CAVE_MNLT)) ||
2910                         ((g_ptr->info & CAVE_VIEW) && (((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) || p_ptr->see_nocto))))
2911                 {
2912                         /* Normal attr/char */
2913                         a = f_ptr->x_attr[F_LIT_STANDARD];
2914                         c = f_ptr->x_char[F_LIT_STANDARD];
2915
2916                         if (p_ptr->wild_mode)
2917                         {
2918                                 /* Special lighting effects */
2919                                 /* Handle "night" */
2920                                 if (view_special_lite && !is_daytime())
2921                                 {
2922                                         /* Use a darkened colour/tile */
2923                                         a = f_ptr->x_attr[F_LIT_DARK];
2924                                         c = f_ptr->x_char[F_LIT_DARK];
2925                                 }
2926                         }
2927
2928                         /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
2929                         else if (darkened_grid(g_ptr))
2930                         {
2931                                 /* Unsafe grid -- idea borrowed from Unangband */
2932                                 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
2933
2934                                 /* Access darkness */
2935                                 f_ptr = &f_info[feat];
2936
2937                                 /* Char and attr of darkness */
2938                                 a = f_ptr->x_attr[F_LIT_STANDARD];
2939                                 c = f_ptr->x_char[F_LIT_STANDARD];
2940                         }
2941
2942                         /* Special lighting effects */
2943                         else if (view_special_lite)
2944                         {
2945                                 /* Handle "torch-lit" grids */
2946                                 if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
2947                                 {
2948                                         /* Torch lite */
2949                                         if (view_yellow_lite)
2950                                         {
2951                                                 /* Use a brightly lit colour/tile */
2952                                                 a = f_ptr->x_attr[F_LIT_LITE];
2953                                                 c = f_ptr->x_char[F_LIT_LITE];
2954                                         }
2955                                 }
2956
2957                                 /* Handle "dark" grids */
2958                                 else if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
2959                                 {
2960                                         /* Use a darkened colour/tile */
2961                                         a = f_ptr->x_attr[F_LIT_DARK];
2962                                         c = f_ptr->x_char[F_LIT_DARK];
2963                                 }
2964
2965                                 /* Handle "out-of-sight" grids */
2966                                 else if (!(g_ptr->info & CAVE_VIEW))
2967                                 {
2968                                         /* Special flag */
2969                                         if (view_bright_lite)
2970                                         {
2971                                                 /* Use a darkened colour/tile */
2972                                                 a = f_ptr->x_attr[F_LIT_DARK];
2973                                                 c = f_ptr->x_char[F_LIT_DARK];
2974                                         }
2975                                 }
2976                         }
2977                 }
2978
2979                 /* Unknown */
2980                 else
2981                 {
2982                         /* Unsafe grid -- idea borrowed from Unangband */
2983                         feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
2984
2985                         /* Access darkness */
2986                         f_ptr = &f_info[feat];
2987
2988                         /* Normal attr/char */
2989                         a = f_ptr->x_attr[F_LIT_STANDARD];
2990                         c = f_ptr->x_char[F_LIT_STANDARD];
2991                 }
2992         }
2993
2994         /* Interesting grids (non-floors) */
2995         else
2996         {
2997                 /* Memorized grids */
2998                 if (g_ptr->info & CAVE_MARK)
2999                 {
3000                         /* Normal attr/char */
3001                         a = f_ptr->x_attr[F_LIT_STANDARD];
3002                         c = f_ptr->x_char[F_LIT_STANDARD];
3003
3004                         if (p_ptr->wild_mode)
3005                         {
3006                                 /* Special lighting effects */
3007                                 /* Handle "blind" or "night" */
3008                                 if (view_granite_lite && (p_ptr->blind || !is_daytime()))
3009                                 {
3010                                         /* Use a darkened colour/tile */
3011                                         a = f_ptr->x_attr[F_LIT_DARK];
3012                                         c = f_ptr->x_char[F_LIT_DARK];
3013                                 }
3014                         }
3015
3016                         /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
3017                         else if (darkened_grid(g_ptr) && !p_ptr->blind)
3018                         {
3019                                 if (have_flag(f_ptr->flags, FF_LOS) && have_flag(f_ptr->flags, FF_PROJECT))
3020                                 {
3021                                         /* Unsafe grid -- idea borrowed from Unangband */
3022                                         feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
3023
3024                                         /* Access darkness */
3025                                         f_ptr = &f_info[feat];
3026
3027                                         /* Char and attr of darkness */
3028                                         a = f_ptr->x_attr[F_LIT_STANDARD];
3029                                         c = f_ptr->x_char[F_LIT_STANDARD];
3030                                 }
3031                                 else if (view_granite_lite && view_bright_lite)
3032                                 {
3033                                         /* Use a darkened colour/tile */
3034                                         a = f_ptr->x_attr[F_LIT_DARK];
3035                                         c = f_ptr->x_char[F_LIT_DARK];
3036                                 }
3037                         }
3038
3039                         /* Special lighting effects */
3040                         else if (view_granite_lite)
3041                         {
3042                                 /* Handle "blind" */
3043                                 if (p_ptr->blind)
3044                                 {
3045                                         /* Use a darkened colour/tile */
3046                                         a = f_ptr->x_attr[F_LIT_DARK];
3047                                         c = f_ptr->x_char[F_LIT_DARK];
3048                                 }
3049
3050                                 /* Handle "torch-lit" grids */
3051                                 else if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
3052                                 {
3053                                         /* Torch lite */
3054                                         if (view_yellow_lite)
3055                                         {
3056                                                 /* Use a brightly lit colour/tile */
3057                                                 a = f_ptr->x_attr[F_LIT_LITE];
3058                                                 c = f_ptr->x_char[F_LIT_LITE];
3059                                         }
3060                                 }
3061
3062                                 /* Handle "view_bright_lite" */
3063                                 else if (view_bright_lite)
3064                                 {
3065                                         /* Not viewable */
3066                                         if (!(g_ptr->info & CAVE_VIEW))
3067                                         {
3068                                                 /* Use a darkened colour/tile */
3069                                                 a = f_ptr->x_attr[F_LIT_DARK];
3070                                                 c = f_ptr->x_char[F_LIT_DARK];
3071                                         }
3072
3073                                         /* Not glowing */
3074                                         else if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
3075                                         {
3076                                                 /* Use a darkened colour/tile */
3077                                                 a = f_ptr->x_attr[F_LIT_DARK];
3078                                                 c = f_ptr->x_char[F_LIT_DARK];
3079                                         }
3080
3081                                         /* Not glowing correctly */
3082                                         else if (!have_flag(f_ptr->flags, FF_LOS) && !check_local_illumination(y, x))
3083                                         {
3084                                                 /* Use a darkened colour/tile */
3085                                                 a = f_ptr->x_attr[F_LIT_DARK];
3086                                                 c = f_ptr->x_char[F_LIT_DARK];
3087                                         }
3088                                 }
3089                         }
3090                 }
3091
3092                 /* Unknown */
3093                 else
3094                 {
3095                         /* Unsafe grid -- idea borrowed from Unangband */
3096                         feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
3097
3098                         /* Access feature */
3099                         f_ptr = &f_info[feat];
3100
3101                         /* Normal attr/char */
3102                         a = f_ptr->x_attr[F_LIT_STANDARD];
3103                         c = f_ptr->x_char[F_LIT_STANDARD];
3104                 }
3105         }
3106
3107         if (feat_priority == -1) feat_priority = f_ptr->priority;
3108
3109         /* Save the terrain info for the transparency effects */
3110         (*tap) = a;
3111         (*tcp) = c;
3112
3113         /* Save the info */
3114         (*ap) = a;
3115         (*cp) = c;
3116
3117         /* Hack -- rare random hallucination, except on outer dungeon walls */
3118         if (p_ptr->image)
3119         {
3120                 if (one_in_(256))
3121                 {
3122                         image_random(ap, cp);
3123                 }
3124         }
3125
3126         /* Objects */
3127         for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3128         {
3129                 object_type *o_ptr;
3130                 o_ptr = &current_floor_ptr->o_list[this_o_idx];
3131                 next_o_idx = o_ptr->next_o_idx;
3132
3133                 /* Memorized objects */
3134                 if (o_ptr->marked & OM_FOUND)
3135                 {
3136                         if (display_autopick)
3137                         {
3138                                 byte act;
3139
3140                                 match_autopick = is_autopick(o_ptr);
3141                                 if (match_autopick == -1)
3142                                         continue;
3143
3144                                 act = autopick_list[match_autopick].action;
3145
3146                                 if ((act & DO_DISPLAY) && (act & display_autopick))
3147                                 {
3148                                         autopick_obj = o_ptr;
3149                                 }
3150                                 else
3151                                 {
3152                                         match_autopick = -1;
3153                                         continue;
3154                                 }
3155                         }
3156                         /* Normal char */
3157                         (*cp) = object_char(o_ptr);
3158
3159                         /* Normal attr */
3160                         (*ap) = object_attr(o_ptr);
3161
3162                         feat_priority = 20;
3163
3164                         /* Hack -- hallucination */
3165                         if (p_ptr->image) image_object(ap, cp);
3166
3167                         break;
3168                 }
3169         }
3170
3171
3172         /* Handle monsters */
3173         if (g_ptr->m_idx && display_autopick == 0)
3174         {
3175                 monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
3176
3177                 /* Visible monster */
3178                 if (m_ptr->ml)
3179                 {
3180                         monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
3181
3182                         feat_priority = 30;
3183
3184                         /* Hallucination */
3185                         if (p_ptr->image)
3186                         {
3187                                 /*
3188                                  * Monsters with both CHAR_CLEAR and ATTR_CLEAR
3189                                  * flags are always unseen.
3190                                  */
3191                                 if ((r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR)) == (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR))
3192                                 {
3193                                         /* Do nothing */
3194                                 }
3195                                 else
3196                                 {
3197                                         image_monster(ap, cp);
3198                                 }
3199                         }
3200                         else
3201                         {
3202                                 /* Monster attr/char */
3203                                 a = r_ptr->x_attr;
3204                                 c = r_ptr->x_char;
3205
3206                                 if (!(r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_SHAPECHANGER | RF1_ATTR_CLEAR
3207                                         | RF1_ATTR_MULTI | RF1_ATTR_SEMIRAND)))
3208                                 {
3209                                         /* Desired monster attr/char */
3210                                         *ap = a;
3211                                         *cp = c;
3212                                 }
3213
3214                                 /*
3215                                  * Monsters with both CHAR_CLEAR and ATTR_CLEAR
3216                                  * flags are always unseen.
3217                                  */
3218                                 else if ((r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR)) == (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR))
3219                                 {
3220                                         /* Do nothing */
3221                                 }
3222
3223                                 else
3224                                 {
3225                                         /***  Monster's attr  ***/
3226                                         if ((r_ptr->flags1 & RF1_ATTR_CLEAR) && (*ap != TERM_DARK) && !use_graphics)
3227                                         {
3228                                                 /* Clear-attr */
3229                                                 /* Do nothing */
3230                                         }
3231                                         else if ((r_ptr->flags1 & RF1_ATTR_MULTI) && !use_graphics)
3232                                         {
3233                                                 /* Multi-hued attr */
3234                                                 if (r_ptr->flags2 & RF2_ATTR_ANY) *ap = randint1(15);
3235                                                 else switch (randint1(7))
3236                                                 {
3237                                                 case 1: *ap = TERM_RED;     break;
3238                                                 case 2: *ap = TERM_L_RED;   break;
3239                                                 case 3: *ap = TERM_WHITE;   break;
3240                                                 case 4: *ap = TERM_L_GREEN; break;
3241                                                 case 5: *ap = TERM_BLUE;    break;
3242                                                 case 6: *ap = TERM_L_DARK;  break;
3243                                                 case 7: *ap = TERM_GREEN;   break;
3244                                                 }
3245                                         }
3246                                         else if ((r_ptr->flags1 & RF1_ATTR_SEMIRAND) && !use_graphics)
3247                                         {
3248                                                 /* Use semi-random attr (usually mimics' colors vary) */
3249                                                 *ap = g_ptr->m_idx % 15 + 1;
3250                                         }
3251                                         else
3252                                         {
3253                                                 /* Normal case */
3254                                                 *ap = a;
3255                                         }
3256
3257                                         /***  Monster's char  ***/
3258                                         if ((r_ptr->flags1 & RF1_CHAR_CLEAR) && (*cp != ' ') && !use_graphics)
3259                                         {
3260                                                 /* Clear-char */
3261                                                 /* Do nothing */
3262                                         }
3263                                         else if (r_ptr->flags1 & RF1_SHAPECHANGER)
3264                                         {
3265                                                 if (use_graphics)
3266                                                 {
3267                                                         monster_race *tmp_r_ptr = &r_info[randint1(max_r_idx - 1)];
3268                                                         *cp = tmp_r_ptr->x_char;
3269                                                         *ap = tmp_r_ptr->x_attr;
3270                                                 }
3271                                                 else
3272                                                 {
3273                                                         *cp = (one_in_(25) ?
3274                                                                 image_object_hack[randint0(sizeof(image_object_hack) - 1)] :
3275                                                                 image_monster_hack[randint0(sizeof(image_monster_hack) - 1)]);
3276                                                 }
3277                                         }
3278                                         else
3279                                         {
3280                                                 /* Normal case */
3281                                                 *cp = c;
3282                                         }
3283                                 }
3284                         }
3285                 }
3286         }
3287
3288         /* Handle "player" */
3289         if (player_bold(y, x))
3290         {
3291                 monster_race *r_ptr = &r_info[0];
3292                 *ap = r_ptr->x_attr;
3293                 *cp = r_ptr->x_char;
3294                 feat_priority = 31;
3295         }
3296 }
3297
3298
3299 static concptr simplify_list[][2] =
3300 {
3301 #ifdef JP
3302         {"の魔法書", ""},
3303         {NULL, NULL}
3304 #else
3305         {"^Ring of ",   "="},
3306         {"^Amulet of ", "\""},
3307         {"^Scroll of ", "?"},
3308         {"^Scroll titled ", "?"},
3309         {"^Wand of "  , "-"},
3310         {"^Rod of "   , "-"},
3311         {"^Staff of " , "_"},
3312         {"^Potion of ", "!"},
3313         {" Spellbook ",""},
3314         {"^Book of ",   ""},
3315         {" Magic [",   "["},
3316         {" Book [",    "["},
3317         {" Arts [",    "["},
3318         {"^Set of ",    ""},
3319         {"^Pair of ",   ""},
3320         {NULL, NULL}
3321 #endif
3322 };
3323
3324
3325 static void display_shortened_item_name(object_type *o_ptr, int y)
3326 {
3327         char buf[MAX_NLEN];
3328         char *c = buf;
3329         int len = 0;
3330         TERM_COLOR attr;
3331
3332         object_desc(buf, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NAME_ONLY));
3333         attr = tval_to_attr[o_ptr->tval % 128];
3334
3335         if (p_ptr->image)
3336         {
3337                 attr = TERM_WHITE;
3338                 strcpy(buf, _("何か奇妙な物", "something strange"));
3339         }
3340
3341         for (c = buf; *c; c++)
3342         {
3343                 int i;
3344                 for (i = 0; simplify_list[i][1]; i++)
3345                 {
3346                         concptr org_w = simplify_list[i][0];
3347
3348                         if (*org_w == '^')
3349                         {
3350                                 if (c == buf)
3351                                         org_w++;
3352                                 else
3353                                         continue;
3354                         }
3355
3356                         if (!strncmp(c, org_w, strlen(org_w)))
3357                         {
3358                                 char *s = c;
3359                                 concptr tmp = simplify_list[i][1];
3360                                 while (*tmp)
3361                                         *s++ = *tmp++;
3362                                 tmp = c + strlen(org_w);
3363                                 while (*tmp)
3364                                         *s++ = *tmp++;
3365                                 *s = '\0';
3366                         }
3367                 }
3368         }
3369
3370         c = buf;
3371         len = 0;
3372         /* 半角 12 文字分で切る */
3373         while (*c)
3374         {
3375 #ifdef JP
3376                 if (iskanji(*c))
3377                 {
3378                         if (len + 2 > 12) break;
3379                         c += 2;
3380                         len += 2;
3381                 }
3382                 else
3383 #endif
3384                 {
3385                         if (len + 1 > 12) break;
3386                         c++;
3387                         len++;
3388                 }
3389         }
3390         *c = '\0';
3391         Term_putstr(0, y, 12, attr, buf);
3392 }
3393
3394 /*
3395  * Display a "small-scale" map of the dungeon in the active Term
3396  */
3397 void display_map(int *cy, int *cx)
3398 {
3399         int i, j, x, y;
3400
3401         TERM_COLOR ta;
3402         SYMBOL_CODE tc;
3403
3404         byte tp;
3405
3406         TERM_COLOR **bigma;
3407         SYMBOL_CODE **bigmc;
3408         byte **bigmp;
3409
3410         TERM_COLOR **ma;
3411         SYMBOL_CODE **mc;
3412         byte **mp;
3413
3414         /* Save lighting effects */
3415         bool old_view_special_lite = view_special_lite;
3416         bool old_view_granite_lite = view_granite_lite;
3417
3418         TERM_LEN hgt, wid, yrat, xrat;
3419
3420         int **match_autopick_yx;
3421         object_type ***object_autopick_yx;
3422
3423         Term_get_size(&wid, &hgt);
3424         hgt -= 2;
3425         wid -= 14;
3426         if (use_bigtile) wid /= 2;
3427
3428         yrat = (current_floor_ptr->height + hgt - 1) / hgt;
3429         xrat = (current_floor_ptr->width + wid - 1) / wid;
3430
3431         /* Disable lighting effects */
3432         view_special_lite = FALSE;
3433         view_granite_lite = FALSE;
3434
3435         /* Allocate the maps */
3436         C_MAKE(ma, (hgt + 2), TERM_COLOR *);
3437         C_MAKE(mc, (hgt + 2), char_ptr);
3438         C_MAKE(mp, (hgt + 2), byte_ptr);
3439         C_MAKE(match_autopick_yx, (hgt + 2), sint_ptr);
3440         C_MAKE(object_autopick_yx, (hgt + 2), object_type **);
3441
3442         /* Allocate and wipe each line map */
3443         for (y = 0; y < (hgt + 2); y++)
3444         {
3445                 /* Allocate one row each array */
3446                 C_MAKE(ma[y], (wid + 2), TERM_COLOR);
3447                 C_MAKE(mc[y], (wid + 2), char);
3448                 C_MAKE(mp[y], (wid + 2), byte);
3449                 C_MAKE(match_autopick_yx[y], (wid + 2), int);
3450                 C_MAKE(object_autopick_yx[y], (wid + 2), object_type *);
3451
3452                 for (x = 0; x < wid + 2; ++x)
3453                 {
3454                         match_autopick_yx[y][x] = -1;
3455                         object_autopick_yx[y][x] = NULL;
3456
3457                         /* Nothing here */
3458                         ma[y][x] = TERM_WHITE;
3459                         mc[y][x] = ' ';
3460
3461                         /* No priority */
3462                         mp[y][x] = 0;
3463                 }
3464         }
3465
3466         /* Allocate the maps */
3467         C_MAKE(bigma, (current_floor_ptr->height + 2), TERM_COLOR *);
3468         C_MAKE(bigmc, (current_floor_ptr->height + 2), char_ptr);
3469         C_MAKE(bigmp, (current_floor_ptr->height + 2), byte_ptr);
3470
3471         /* Allocate and wipe each line map */
3472         for (y = 0; y < (current_floor_ptr->height + 2); y++)
3473         {
3474                 /* Allocate one row each array */
3475                 C_MAKE(bigma[y], (current_floor_ptr->width + 2), TERM_COLOR);
3476                 C_MAKE(bigmc[y], (current_floor_ptr->width + 2), char);
3477                 C_MAKE(bigmp[y], (current_floor_ptr->width + 2), byte);
3478
3479                 for (x = 0; x < current_floor_ptr->width + 2; ++x)
3480                 {
3481                         /* Nothing here */
3482                         bigma[y][x] = TERM_WHITE;
3483                         bigmc[y][x] = ' ';
3484
3485                         /* No priority */
3486                         bigmp[y][x] = 0;
3487                 }
3488         }
3489
3490         /* Fill in the map */
3491         for (i = 0; i < current_floor_ptr->width; ++i)
3492         {
3493                 for (j = 0; j < current_floor_ptr->height; ++j)
3494                 {
3495                         x = i / xrat + 1;
3496                         y = j / yrat + 1;
3497
3498                         match_autopick = -1;
3499                         autopick_obj = NULL;
3500                         feat_priority = -1;
3501
3502                         /* Extract the current attr/char at that map location */
3503                         map_info(j, i, &ta, &tc, &ta, &tc);
3504
3505                         /* Extract the priority */
3506                         tp = (byte_hack)feat_priority;
3507
3508                         if (match_autopick != -1
3509                                 && (match_autopick_yx[y][x] == -1
3510                                         || match_autopick_yx[y][x] > match_autopick))
3511                         {
3512                                 match_autopick_yx[y][x] = match_autopick;
3513                                 object_autopick_yx[y][x] = autopick_obj;
3514                                 tp = 0x7f;
3515                         }
3516
3517                         /* Save the char, attr and priority */
3518                         bigmc[j + 1][i + 1] = tc;
3519                         bigma[j + 1][i + 1] = ta;
3520                         bigmp[j + 1][i + 1] = tp;
3521                 }
3522         }
3523
3524         for (j = 0; j < current_floor_ptr->height; ++j)
3525         {
3526                 for (i = 0; i < current_floor_ptr->width; ++i)
3527                 {
3528                         x = i / xrat + 1;
3529                         y = j / yrat + 1;
3530
3531                         tc = bigmc[j + 1][i + 1];
3532                         ta = bigma[j + 1][i + 1];
3533                         tp = bigmp[j + 1][i + 1];
3534
3535                         /* rare feature has more priority */
3536                         if (mp[y][x] == tp)
3537                         {
3538                                 int t;
3539                                 int cnt = 0;
3540
3541                                 for (t = 0; t < 8; t++)
3542                                 {
3543                                         if (tc == bigmc[j + 1 + ddy_cdd[t]][i + 1 + ddx_cdd[t]] &&
3544                                                 ta == bigma[j + 1 + ddy_cdd[t]][i + 1 + ddx_cdd[t]])
3545                                                 cnt++;
3546                                 }
3547                                 if (cnt <= 4)
3548                                         tp++;
3549                         }
3550
3551                         /* Save "best" */
3552                         if (mp[y][x] < tp)
3553                         {
3554                                 /* Save the char, attr and priority */
3555                                 mc[y][x] = tc;
3556                                 ma[y][x] = ta;
3557                                 mp[y][x] = tp;
3558                         }
3559                 }
3560         }
3561
3562
3563         /* Corners */
3564         x = wid + 1;
3565         y = hgt + 1;
3566
3567         /* Draw the corners */
3568         mc[0][0] = mc[0][x] = mc[y][0] = mc[y][x] = '+';
3569
3570         /* Draw the horizontal edges */
3571         for (x = 1; x <= wid; x++) mc[0][x] = mc[y][x] = '-';
3572
3573         /* Draw the vertical edges */
3574         for (y = 1; y <= hgt; y++) mc[y][0] = mc[y][x] = '|';
3575
3576
3577         /* Display each map line in order */
3578         for (y = 0; y < hgt + 2; ++y)
3579         {
3580                 /* Start a new line */
3581                 Term_gotoxy(COL_MAP, y);
3582
3583                 /* Display the line */
3584                 for (x = 0; x < wid + 2; ++x)
3585                 {
3586                         ta = ma[y][x];
3587                         tc = mc[y][x];
3588
3589                         /* Hack -- fake monochrome */
3590                         if (!use_graphics)
3591                         {
3592                                 if (current_world_ptr->timewalk_m_idx) ta = TERM_DARK;
3593                                 else if (IS_INVULN() || p_ptr->timewalk) ta = TERM_WHITE;
3594                                 else if (p_ptr->wraith_form) ta = TERM_L_DARK;
3595                         }
3596
3597                         /* Add the character */
3598                         Term_add_bigch(ta, tc);
3599                 }
3600         }
3601
3602
3603         for (y = 1; y < hgt + 1; ++y)
3604         {
3605                 match_autopick = -1;
3606                 for (x = 1; x <= wid; x++) {
3607                         if (match_autopick_yx[y][x] != -1 &&
3608                                 (match_autopick > match_autopick_yx[y][x] ||
3609                                         match_autopick == -1)) {
3610                                 match_autopick = match_autopick_yx[y][x];
3611                                 autopick_obj = object_autopick_yx[y][x];
3612                         }
3613                 }
3614
3615                 /* Clear old display */
3616                 Term_putstr(0, y, 12, 0, "            ");
3617
3618                 if (match_autopick != -1)
3619 #if 1
3620                         display_shortened_item_name(autopick_obj, y);
3621 #else
3622                 {
3623                         char buf[13] = "\0";
3624                         strncpy(buf, autopick_list[match_autopick].name, 12);
3625                         buf[12] = '\0';
3626                         put_str(buf, y, 0);
3627                 }
3628 #endif
3629
3630         }
3631
3632         /* Player location */
3633         (*cy) = p_ptr->y / yrat + 1 + ROW_MAP;
3634         if (!use_bigtile)
3635                 (*cx) = p_ptr->x / xrat + 1 + COL_MAP;
3636         else
3637                 (*cx) = (p_ptr->x / xrat + 1) * 2 + COL_MAP;
3638
3639         /* Restore lighting effects */
3640         view_special_lite = old_view_special_lite;
3641         view_granite_lite = old_view_granite_lite;
3642
3643         /* Free each line map */
3644         for (y = 0; y < (hgt + 2); y++)
3645         {
3646                 /* Free one row each array */
3647                 C_KILL(ma[y], (wid + 2), TERM_COLOR);
3648                 C_KILL(mc[y], (wid + 2), SYMBOL_CODE);
3649                 C_KILL(mp[y], (wid + 2), byte);
3650                 C_KILL(match_autopick_yx[y], (wid + 2), int);
3651                 C_KILL(object_autopick_yx[y], (wid + 2), object_type *);
3652         }
3653
3654         /* Free each line map */
3655         C_KILL(ma, (hgt + 2), TERM_COLOR *);
3656         C_KILL(mc, (hgt + 2), char_ptr);
3657         C_KILL(mp, (hgt + 2), byte_ptr);
3658         C_KILL(match_autopick_yx, (hgt + 2), sint_ptr);
3659         C_KILL(object_autopick_yx, (hgt + 2), object_type **);
3660
3661         /* Free each line map */
3662         for (y = 0; y < (current_floor_ptr->height + 2); y++)
3663         {
3664                 /* Free one row each array */
3665                 C_KILL(bigma[y], (current_floor_ptr->width + 2), TERM_COLOR);
3666                 C_KILL(bigmc[y], (current_floor_ptr->width + 2), SYMBOL_CODE);
3667                 C_KILL(bigmp[y], (current_floor_ptr->width + 2), byte);
3668         }
3669
3670         /* Free each line map */
3671         C_KILL(bigma, (current_floor_ptr->height + 2), TERM_COLOR *);
3672         C_KILL(bigmc, (current_floor_ptr->height + 2), char_ptr);
3673         C_KILL(bigmp, (current_floor_ptr->height + 2), byte_ptr);
3674 }
3675
3676
3677 /*
3678  * Display a "small-scale" map of the dungeon for the player
3679  *
3680  * Currently, the "player" is displayed on the map.
3681  */
3682 void do_cmd_view_map(void)
3683 {
3684         int cy, cx;
3685
3686         screen_save();
3687
3688         prt(_("お待ち下さい...", "Please wait..."), 0, 0);
3689
3690         Term_fresh();
3691         Term_clear();
3692
3693         display_autopick = 0;
3694
3695         /* Display the map */
3696         display_map(&cy, &cx);
3697
3698         /* Wait for it */
3699         if (max_autopick && !p_ptr->wild_mode)
3700         {
3701                 display_autopick = ITEM_DISPLAY;
3702
3703                 while (1)
3704                 {
3705                         int i;
3706                         byte flag;
3707
3708                         int wid, hgt, row_message;
3709
3710                         Term_get_size(&wid, &hgt);
3711                         row_message = hgt - 1;
3712
3713                         put_str(_("何かキーを押してください('M':拾う 'N':放置 'D':M+N 'K':壊すアイテムを表示)",
3714                                 " Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items."), row_message, 1);
3715
3716                         /* Hilite the player */
3717                         move_cursor(cy, cx);
3718
3719                         i = inkey();
3720
3721                         if ('M' == i)
3722                                 flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK);
3723                         else if ('N' == i)
3724                                 flag = DONT_AUTOPICK;
3725                         else if ('K' == i)
3726                                 flag = DO_AUTODESTROY;
3727                         else if ('D' == i)
3728                                 flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK | DONT_AUTOPICK);
3729                         else
3730                                 break;
3731
3732                         Term_fresh();
3733
3734                         if (~display_autopick & flag)
3735                                 display_autopick |= flag;
3736                         else
3737                                 display_autopick &= ~flag;
3738                         /* Display the map */
3739                         display_map(&cy, &cx);
3740                 }
3741
3742                 display_autopick = 0;
3743
3744         }
3745         else
3746         {
3747                 put_str(_("何かキーを押すとゲームに戻ります", "Hit any key to continue"), 23, 30);
3748                 /* Hilite the player */
3749                 move_cursor(cy, cx);
3750                 /* Get any key */
3751                 inkey();
3752         }
3753         screen_load();
3754 }
3755
3756 /*
3757  * Track a new monster
3758  */
3759 void health_track(MONSTER_IDX m_idx)
3760 {
3761         /* Mount monster is already tracked */
3762         if (m_idx && m_idx == p_ptr->riding) return;
3763
3764         /* Track a new guy */
3765         p_ptr->health_who = m_idx;
3766
3767         /* Redraw (later) */
3768         p_ptr->redraw |= (PR_HEALTH);
3769 }
3770
3771
3772 /*
3773  * Moves the cursor to a given MAP (y,x) location
3774  */
3775 void move_cursor_relative(int row, int col)
3776 {
3777         /* Real co-ords convert to screen positions */
3778         row -= panel_row_prt;
3779
3780         /* Go there */
3781         Term_gotoxy(panel_col_of(col), row);
3782 }
3783
3784
3785 /*
3786  * print project path
3787  */
3788 void prt_path(POSITION y, POSITION x)
3789 {
3790         int i;
3791         int path_n;
3792         u16b path_g[512];
3793         byte_hack default_color = TERM_SLATE;
3794
3795         if (!display_path) return;
3796         if (-1 == project_length)
3797                 return;
3798
3799         /* Get projection path */
3800         path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), p_ptr->y, p_ptr->x, y, x, PROJECT_PATH | PROJECT_THRU);
3801
3802         p_ptr->redraw |= (PR_MAP);
3803         handle_stuff();
3804
3805         /* Draw path */
3806         for (i = 0; i < path_n; i++)
3807         {
3808                 POSITION ny = GRID_Y(path_g[i]);
3809                 POSITION nx = GRID_X(path_g[i]);
3810                 grid_type *g_ptr = &current_floor_ptr->grid_array[ny][nx];
3811
3812                 if (panel_contains(ny, nx))
3813                 {
3814                         TERM_COLOR a = default_color;
3815                         char c;
3816
3817                         TERM_COLOR ta = default_color;
3818                         char tc = '*';
3819
3820                         if (g_ptr->m_idx && current_floor_ptr->m_list[g_ptr->m_idx].ml)
3821                         {
3822                                 /* Determine what is there */
3823                                 map_info(ny, nx, &a, &c, &ta, &tc);
3824
3825                                 if (!is_ascii_graphics(a))
3826                                         a = default_color;
3827                                 else if (c == '.' && (a == TERM_WHITE || a == TERM_L_WHITE))
3828                                         a = default_color;
3829                                 else if (a == default_color)
3830                                         a = TERM_WHITE;
3831                         }
3832
3833                         if (!use_graphics)
3834                         {
3835                                 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
3836                                 else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
3837                                 else if (p_ptr->wraith_form) a = TERM_L_DARK;
3838                         }
3839
3840                         c = '*';
3841
3842                         /* Hack -- Queue it */
3843                         Term_queue_bigchar(panel_col_of(nx), ny - panel_row_prt, a, c, ta, tc);
3844                 }
3845
3846                 /* Known Wall */
3847                 if ((g_ptr->info & CAVE_MARK) && !cave_have_flag_grid(g_ptr, FF_PROJECT)) break;
3848
3849                 /* Change color */
3850                 if (nx == x && ny == y) default_color = TERM_L_DARK;
3851         }
3852 }
3853
3854
3855 /*
3856  * Hack -- track the given monster race
3857  */
3858 void monster_race_track(MONRACE_IDX r_idx)
3859 {
3860         /* Save this monster ID */
3861         p_ptr->monster_race_idx = r_idx;
3862
3863         p_ptr->window |= (PW_MONSTER);
3864 }
3865
3866 /*
3867  * Hack -- track the given object kind
3868  */
3869 void object_kind_track(KIND_OBJECT_IDX k_idx)
3870 {
3871         /* Save this monster ID */
3872         p_ptr->object_kind_idx = k_idx;
3873
3874         p_ptr->window |= (PW_OBJECT);
3875 }
3876
3877
3878 /*!
3879  * @brief 実ゲームプレイ時間を更新する
3880  */
3881 void update_playtime(void)
3882 {
3883         /* Check if the game has started */
3884         if (current_world_ptr->start_time != 0)
3885         {
3886                 u32b tmp = (u32b)time(NULL);
3887                 current_world_ptr->play_time += (tmp - current_world_ptr->start_time);
3888                 current_world_ptr->start_time = tmp;
3889         }
3890 }
3891