OSDN Git Service

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