OSDN Git Service

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