OSDN Git Service

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