OSDN Git Service

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