OSDN Git Service

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