OSDN Git Service

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