OSDN Git Service

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