OSDN Git Service

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