OSDN Git Service

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