3 * @brief プレイヤーのステータス処理 / status
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.
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"
31 #include "view-mainwindow.h"
34 #include "realm-hex.h"
35 #include "realm-song.h"
37 #include "object-flavor.h"
42 #include "floor-town.h"
44 #include "objectkind.h"
45 #include "targeting.h"
48 * Not using graphical tiles for this feature?
50 #define IS_ASCII_GRAPHICS(A) (!((A) & 0x80))
52 static int feat_priority; /*!< マップ縮小表示時に表示すべき地形の優先度を保管する */
53 static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
54 static int match_autopick;
55 static object_type *autopick_obj; /*!< 各種自動拾い処理時に使うオブジェクトポインタ */
60 POSITION panel_row_min, panel_row_max;
61 POSITION panel_col_min, panel_col_max;
62 POSITION panel_col_prt, panel_row_prt;
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.
71 #define COL_RACE 0 /* <race name> */
73 /*#define ROW_CLASS 2 */
74 /*#define COL_CLASS 0 */ /* <class name> */
77 #define COL_TITLE 0 /* <title> or <mode> */
79 /*#define ROW_SEIKAKU 4 */
80 /*#define COL_SEIKAKU 0*/ /* <seikaku> */
83 #define COL_DAY 0 /* day */
85 #define ROW_DUNGEON 22
86 #define COL_DUNGEON 0 /* dungeon */
89 #define COL_LEVEL 0 /* "LEVEL xxxxxx" */
92 #define COL_EXP 0 /* "EXP xxxxxxxx" */
95 #define COL_GOLD 0 /* "AU xxxxxxxxx" */
98 #define COL_EQUIPPY 0 /* equippy chars */
101 #define COL_STAT 0 /* "xxx xxxxxx" */
104 #define COL_AC 0 /* "Cur AC xxxxx" */
110 #define COL_CURHP 0 /* "Cur HP xxxxx" */
113 #define COL_CURSP 0 /* "Cur SP xxxxx" */
115 #define ROW_RIDING_INFO 16
116 #define COL_RIDING_INFO 0 /* "xxxxxxxxxxxx" */
119 #define COL_INFO 0 /* "xxxxxxxxxxxx" */
122 #define COL_CUT 0 /* <cut> */
125 #define COL_STUN 0 /* <stun> */
127 #define ROW_HUNGRY 20
128 #define COL_HUNGRY 0 /* "Weak" / "Hungry" / "Full" / "Gorged" */
131 #define COL_STATE 7 /* <state> */
133 #define ROW_SPEED (-1)
134 #define COL_SPEED (-24) /* "Slow (-NN)" or "Fast (+NN)" */
136 #define ROW_STUDY (-1)
137 #define COL_STUDY (-13) /* "Study" */
139 #define ROW_DEPTH (-1)
140 #define COL_DEPTH (-8) /* "Lev NNN" / "NNNN ft" */
142 #define ROW_STATBAR (-1)
143 #define COL_STATBAR 0
144 #define MAX_COL_STATBAR (-26)
146 void print_equippy(player_type *creature_ptr);
149 * @brief 画面左の能力値表示を行うために指定位置から13キャラ分を空白消去後指定のメッセージを明るい青で描画する /
150 * Print character info at given row, column in a 13 char field
156 static void prt_field(concptr info, TERM_LEN row, TERM_LEN col)
158 /* Dump 13 spaces to clear */
159 c_put_str(TERM_WHITE, " ", row, col);
161 /* Dump the info itself */
162 c_put_str(TERM_L_BLUE, info, row, col);
166 * @brief ゲーム時刻を表示する /
174 /* Dump 13 spaces to clear */
175 c_put_str(TERM_WHITE, " ", ROW_DAY, COL_DAY);
177 extract_day_hour_min(&day, &hour, &min);
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);
183 c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
187 * @brief 現在のマップ名を返す /
188 * @param creature_ptr プレーヤーへの参照ポインタ
189 * @return マップ名の文字列参照ポインタ
191 concptr map_name(player_type *creature_ptr)
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;
206 return d_name+d_info[creature_ptr->dungeon_idx].name;
210 * @brief 現在のマップ名を描画する / Print dungeon
211 * @param creature_ptr プレーヤーへの参照ポインタ
214 static void print_dungeon(player_type *creature_ptr)
216 concptr dungeon_name;
219 /* Dump 13 spaces to clear */
220 c_put_str(TERM_WHITE, " ", ROW_DUNGEON, COL_DUNGEON);
222 dungeon_name = map_name(creature_ptr);
224 col = COL_DUNGEON + 6 - strlen(dungeon_name)/2;
225 if (col < 0) col = 0;
227 /* Dump the info itself */
228 c_put_str(TERM_L_UMBER, format("%s",dungeon_name),
234 * @brief プレイヤー能力値を描画する / Print character stat in given row, column
235 * @param stat 描画するステータスのID
238 static void prt_stat(player_type *creature_ptr, int stat)
242 /* Display "injured" stat */
243 if (creature_ptr->stat_cur[stat] < creature_ptr->stat_max[stat])
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);
250 /* Display "healthy" stat */
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);
258 /* Indicate natural maximum */
259 if (creature_ptr->stat_max[stat] == creature_ptr->stat_max_max[stat])
262 /* 日本語にかぶらないように表示位置を変更 */
263 put_str("!", ROW_STAT + stat, 5);
265 put_str("!", ROW_STAT + stat, 3);
273 * 画面下部に表示する状態表示定義ID / Data structure for status bar
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 /*!< 下部ステータス表示: 邪悪感知 */
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, "感", "邪悪感知"},
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"},
493 * @brief 32ビット変数配列の指定位置のビットフラグを1にする。
494 * @param FLG フラグ位置(ビット)
497 #define ADD_FLG(FLG) (bar_flags[FLG / 32] |= (1L << (FLG % 32)))
500 * @brief 32ビット変数配列の指定位置のビットフラグが1かどうかを返す。
501 * @param FLG フラグ位置(ビット)
504 #define IS_FLG(FLG) (bar_flags[FLG / 32] & (1L << (FLG % 32)))
508 * @brief 下部に状態表示を行う / Show status bar
511 static void prt_status(player_type *creature_ptr)
513 BIT_FLAGS bar_flags[3];
514 TERM_LEN wid, hgt, row_statbar, max_col_statbar;
516 TERM_LEN col = 0, num = 0;
519 Term_get_size(&wid, &hgt);
520 row_statbar = hgt + ROW_STATBAR;
521 max_col_statbar = wid + MAX_COL_STATBAR;
523 Term_erase(0, row_statbar, max_col_statbar);
525 bar_flags[0] = bar_flags[1] = bar_flags[2] = 0L;
528 if (creature_ptr->tsuyoshi) ADD_FLG(BAR_TSUYOSHI);
531 if (creature_ptr->image) ADD_FLG(BAR_HALLUCINATION);
534 if (creature_ptr->blind) ADD_FLG(BAR_BLINDNESS);
537 if (creature_ptr->paralyzed) ADD_FLG(BAR_PARALYZE);
540 if (creature_ptr->confused) ADD_FLG(BAR_CONFUSE);
543 if (creature_ptr->poisoned) ADD_FLG(BAR_POISONED);
545 /* Times see-invisible */
546 if (creature_ptr->tim_invis) ADD_FLG(BAR_SENSEUNSEEN);
549 if (is_time_limit_esp(creature_ptr)) ADD_FLG(BAR_TELEPATHY);
551 /* Timed regenerate */
552 if (creature_ptr->tim_regen) ADD_FLG(BAR_REGENERATION);
554 /* Timed infra-vision */
555 if (creature_ptr->tim_infra) ADD_FLG(BAR_INFRAVISION);
557 /* Protection from evil */
558 if (creature_ptr->protevil) ADD_FLG(BAR_PROTEVIL);
560 /* Invulnerability */
561 if (IS_INVULN(creature_ptr)) ADD_FLG(BAR_INVULN);
564 if (creature_ptr->wraith_form) ADD_FLG(BAR_WRAITH);
567 if (creature_ptr->kabenuke) ADD_FLG(BAR_PASSWALL);
569 if (creature_ptr->tim_reflect) ADD_FLG(BAR_REFLECTION);
572 if (IS_HERO(creature_ptr)) ADD_FLG(BAR_HEROISM);
574 /* Super Heroism / berserk */
575 if (creature_ptr->shero) ADD_FLG(BAR_BERSERK);
578 if (is_blessed(creature_ptr)) ADD_FLG(BAR_BLESSED);
581 if (creature_ptr->magicdef) ADD_FLG(BAR_MAGICDEFENSE);
583 if (creature_ptr->tsubureru) ADD_FLG(BAR_EXPAND);
585 if (creature_ptr->shield) ADD_FLG(BAR_STONESKIN);
587 if (creature_ptr->special_defense & NINJA_KAWARIMI) ADD_FLG(BAR_KAWARIMI);
590 if (creature_ptr->special_defense & DEFENSE_ACID) ADD_FLG(BAR_IMMACID);
591 if (is_oppose_acid(creature_ptr)) ADD_FLG(BAR_RESACID);
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);
598 if (creature_ptr->special_defense & DEFENSE_FIRE) ADD_FLG(BAR_IMMFIRE);
599 if (is_oppose_fire(creature_ptr)) ADD_FLG(BAR_RESFIRE);
602 if (creature_ptr->special_defense & DEFENSE_COLD) ADD_FLG(BAR_IMMCOLD);
603 if (is_oppose_cold(creature_ptr)) ADD_FLG(BAR_RESCOLD);
606 if (is_oppose_pois(creature_ptr)) ADD_FLG(BAR_RESPOIS);
609 if (creature_ptr->word_recall) ADD_FLG(BAR_RECALL);
612 if (creature_ptr->alter_reality) ADD_FLG(BAR_ALTER);
615 if (creature_ptr->afraid) ADD_FLG(BAR_AFRAID);
618 if (creature_ptr->tim_res_time) ADD_FLG(BAR_RESTIME);
620 if (creature_ptr->multishadow) ADD_FLG(BAR_MULTISHADOW);
622 /* Confusing Hands */
623 if (creature_ptr->special_attack & ATTACK_CONFUSE) ADD_FLG(BAR_ATTKCONF);
625 if (creature_ptr->resist_magic) ADD_FLG(BAR_REGMAGIC);
627 /* Ultimate-resistance */
628 if (creature_ptr->ult_res) ADD_FLG(BAR_ULTIMATE);
631 if (creature_ptr->tim_levitation) ADD_FLG(BAR_LEVITATE);
633 if (creature_ptr->tim_res_nether) ADD_FLG(BAR_RESNETH);
635 if (creature_ptr->dustrobe) ADD_FLG(BAR_DUSTROBE);
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);
645 if (creature_ptr->tim_sh_fire) ADD_FLG(BAR_SHFIRE);
648 if (is_time_limit_stealth(creature_ptr)) ADD_FLG(BAR_STEALTH);
650 if (creature_ptr->tim_sh_touki) ADD_FLG(BAR_TOUKI);
653 if (creature_ptr->tim_sh_holy) ADD_FLG(BAR_SHHOLY);
655 /* An Eye for an Eye */
656 if (creature_ptr->tim_eyeeye) ADD_FLG(BAR_EYEEYE);
659 if (creature_ptr->realm1 == REALM_HEX)
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);
680 if (HEX_REVENGE_TURN(creature_ptr))
682 if (HEX_REVENGE_TYPE(creature_ptr) == 1) ADD_FLG(BAR_PATIENCE);
683 if (HEX_REVENGE_TYPE(creature_ptr) == 2) ADD_FLG(BAR_REVENGE);
687 /* Calcurate length */
688 for (i = 0; bar[i].sstr; i++)
692 col += strlen(bar[i].lstr) + 1;
697 /* If there are not excess spaces for long strings, use short one */
698 if (col - 1 > max_col_statbar)
703 for (i = 0; bar[i].sstr; i++)
707 col += strlen(bar[i].sstr);
711 /* If there are excess spaces for short string, use more */
712 if (col - 1 <= max_col_statbar - (num-1))
720 /* Centering display column */
721 col = (max_col_statbar - col) / 2;
723 /* Display status bar */
724 for (i = 0; bar[i].sstr; i++)
729 if (space == 2) str = bar[i].lstr;
730 else str = bar[i].sstr;
732 c_put_str(bar[i].attr, str, row_statbar, col);
734 if (space > 0) col++;
735 if (col > max_col_statbar) break;
742 * @brief プレイヤーの称号を表示する / Prints "title", including "wizard" or "winner" as needed.
745 static void prt_title(player_type *creature_ptr)
750 if (current_world_ptr->wizard)
752 p = _("[ウィザード]", "[=-WIZARD-=]");
754 else if (current_world_ptr->total_winner || (creature_ptr->lev > PY_MAX_LEVEL))
756 if (creature_ptr->arena_number > MAX_ARENA_MONS + 2)
758 p = _("*真・勝利者*", "*TRUEWINNER*");
762 p = _("***勝利者***", "***WINNER***");
769 my_strcpy(str, player_title[creature_ptr->pclass][(creature_ptr->lev - 1) / 5], sizeof(str));
773 prt_field(p, ROW_TITLE, COL_TITLE);
778 * @brief プレイヤーのレベルを表示する / Prints level
781 static void prt_level(player_type *creature_ptr)
784 sprintf(tmp, "%5d", creature_ptr->lev);
785 if (creature_ptr->lev >= creature_ptr->max_plv)
787 put_str(_("レベル ", "LEVEL "), ROW_LEVEL, 0);
788 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 7);
792 put_str(_("xレベル", "Level "), ROW_LEVEL, 0);
793 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 7);
799 * @brief プレイヤーの経験値を表示する / Display the experience
802 static void prt_exp(player_type *creature_ptr)
806 if ((!exp_need)||(creature_ptr->prace == RACE_ANDROID))
808 (void)sprintf(out_val, "%8ld", (long)creature_ptr->exp);
812 if (creature_ptr->lev >= PY_MAX_LEVEL)
814 (void)sprintf(out_val, "********");
818 (void)sprintf(out_val, "%8ld", (long)(player_exp [creature_ptr->lev - 1] * creature_ptr->expfact / 100L) - creature_ptr->exp);
822 if (creature_ptr->exp >= creature_ptr->max_exp)
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);
830 put_str(_("x経験", "Exp "), ROW_EXP, 0);
831 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 4);
836 * @brief プレイヤーの所持金を表示する / Prints current gold
839 static void prt_gold(void)
842 put_str(_("$ ", "AU "), ROW_GOLD, COL_GOLD);
843 sprintf(tmp, "%9ld", (long)p_ptr->au);
844 c_put_str(TERM_L_GREEN, tmp, ROW_GOLD, COL_GOLD + 3);
849 * @brief プレイヤーのACを表示する / Prints current AC
852 static void prt_ac(player_type *creature_ptr)
857 /* AC の表示方式を変更している */
858 put_str(" AC( )", ROW_AC, COL_AC);
859 sprintf(tmp, "%5d", creature_ptr->dis_ac + creature_ptr->dis_to_a);
860 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 6);
862 put_str("Cur AC ", ROW_AC, COL_AC);
863 sprintf(tmp, "%5d", creature_ptr->dis_ac + creature_ptr->dis_to_a);
864 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 7);
871 * @brief プレイヤーのHPを表示する / Prints Cur/Max hit points
874 static void prt_hp(player_type *creature_ptr)
876 /* ヒットポイントの表示方法を変更 */
882 put_str("HP", ROW_CURHP, COL_CURHP);
885 sprintf(tmp, "%4ld", (long int)creature_ptr->chp);
887 if (creature_ptr->chp >= creature_ptr->mhp)
889 color = TERM_L_GREEN;
891 else if (creature_ptr->chp > (creature_ptr->mhp * hitpoint_warn) / 10)
900 c_put_str(color, tmp, ROW_CURHP, COL_CURHP+3);
903 put_str( "/", ROW_CURHP, COL_CURHP + 7 );
906 sprintf(tmp, "%4ld", (long int)creature_ptr->mhp);
907 color = TERM_L_GREEN;
909 c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
914 * @brief プレイヤーのMPを表示する / Prints players max/cur spell points
917 static void prt_sp(player_type *creature_ptr)
919 /* マジックポイントの表示方法を変更している */
924 /* Do not show mana unless it matters */
925 if (!mp_ptr->spell_book) return;
928 put_str(_("MP", "SP"), ROW_CURSP, COL_CURSP);
931 sprintf(tmp, "%4ld", (long int)creature_ptr->csp);
933 if (creature_ptr->csp >= creature_ptr->msp)
935 color = TERM_L_GREEN;
937 else if (creature_ptr->csp > (creature_ptr->msp * mana_warn) / 10)
946 c_put_str(color, tmp, ROW_CURSP, COL_CURSP+3);
949 put_str( "/", ROW_CURSP, COL_CURSP + 7 );
952 sprintf(tmp, "%4ld", (long int)creature_ptr->msp);
953 color = TERM_L_GREEN;
955 c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
960 * @brief 現在のフロアの深さを表示する / Prints depth in stat area
963 static void prt_depth(void)
966 TERM_LEN wid, hgt, row_depth, col_depth;
967 TERM_COLOR attr = TERM_WHITE;
969 Term_get_size(&wid, &hgt);
970 col_depth = wid + COL_DEPTH;
971 row_depth = hgt + ROW_DEPTH;
973 if (!p_ptr->current_floor_ptr->dun_level)
975 strcpy(depths, _("地上", "Surf."));
977 else if (p_ptr->current_floor_ptr->inside_quest && !p_ptr->dungeon_idx)
979 strcpy(depths, _("地上", "Quest"));
983 if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)p_ptr->current_floor_ptr->dun_level * 50);
984 else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)p_ptr->current_floor_ptr->dun_level);
986 /* Get color of level based on feeling -JSV- */
987 switch (p_ptr->feeling)
989 case 0: attr = TERM_SLATE; break; /* Unknown */
990 case 1: attr = TERM_L_BLUE; break; /* Special */
991 case 2: attr = TERM_VIOLET; break; /* Horrible visions */
992 case 3: attr = TERM_RED; break; /* Very dangerous */
993 case 4: attr = TERM_L_RED; break; /* Very bad feeling */
994 case 5: attr = TERM_ORANGE; break; /* Bad feeling */
995 case 6: attr = TERM_YELLOW; break; /* Nervous */
996 case 7: attr = TERM_L_UMBER; break; /* Luck is turning */
997 case 8: attr = TERM_L_WHITE; break; /* Don't like */
998 case 9: attr = TERM_WHITE; break; /* Reasonably safe */
999 case 10: attr = TERM_WHITE; break; /* Boring place */
1003 /* Right-Adjust the "depth", and clear old values */
1004 c_prt(attr, format("%7s", depths), row_depth, col_depth);
1009 * @brief プレイヤーの空腹状態を表示する / Prints status of hunger
1012 static void prt_hunger(void)
1014 if(current_world_ptr->wizard && p_ptr->current_floor_ptr->inside_arena) return;
1016 /* Fainting / Starving */
1017 if (p_ptr->food < PY_FOOD_FAINT)
1019 c_put_str(TERM_RED, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
1023 else if (p_ptr->food < PY_FOOD_WEAK)
1025 c_put_str(TERM_ORANGE, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
1029 else if (p_ptr->food < PY_FOOD_ALERT)
1031 c_put_str(TERM_YELLOW, _("空腹 ", "Hungry"), ROW_HUNGRY, COL_HUNGRY);
1035 else if (p_ptr->food < PY_FOOD_FULL)
1037 c_put_str(TERM_L_GREEN, " ", ROW_HUNGRY, COL_HUNGRY);
1041 else if (p_ptr->food < PY_FOOD_MAX)
1043 c_put_str(TERM_L_GREEN, _("満腹 ", "Full "), ROW_HUNGRY, COL_HUNGRY);
1049 c_put_str(TERM_GREEN, _("食過ぎ", "Gorged"), ROW_HUNGRY, COL_HUNGRY);
1055 * @brief プレイヤーの行動状態を表示する / Prints Searching, Resting, Paralysis, or 'count' status
1058 * Display is always exactly 10 characters wide (see below)
1059 * This function was a major bottleneck when resting, so a lot of
1060 * the text formatting code was optimized in place below.
1062 static void prt_state(void)
1064 TERM_COLOR attr = TERM_WHITE;
1070 if (command_rep > 999)
1072 (void)sprintf(text, "%2d00", command_rep / 100);
1076 (void)sprintf(text, " %2d", command_rep);
1083 switch(p_ptr->action)
1087 strcpy(text, _("探索", "Sear"));
1091 /* Start with "Rest" */
1092 strcpy(text, _(" ", " "));
1094 if (p_ptr->resting > 0)
1096 sprintf(text, "%4d", p_ptr->resting);
1098 else if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
1100 text[0] = text[1] = text[2] = text[3] = '*';
1102 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
1104 text[0] = text[1] = text[2] = text[3] = '&';
1110 strcpy(text, _("学習", "lear"));
1111 if (p_ptr->new_mane) attr = TERM_L_RED;
1116 strcpy(text, _("釣り", "fish"));
1122 for (i = 0; i < MAX_KAMAE; i++)
1123 if (p_ptr->special_defense & (KAMAE_GENBU << i)) break;
1126 case 0: attr = TERM_GREEN;break;
1127 case 1: attr = TERM_WHITE;break;
1128 case 2: attr = TERM_L_BLUE;break;
1129 case 3: attr = TERM_L_RED;break;
1131 strcpy(text, kamae_shurui[i].desc);
1137 for (i = 0; i < MAX_KATA; i++)
1138 if (p_ptr->special_defense & (KATA_IAI << i)) break;
1139 strcpy(text, kata_shurui[i].desc);
1144 strcpy(text, _("歌 ", "Sing"));
1147 case ACTION_HAYAGAKE:
1149 strcpy(text, _("速駆", "Fast"));
1154 strcpy(text, _("詠唱", "Spel"));
1165 /* Display the info (or blanks) */
1166 c_put_str(attr, format("%5.5s",text), ROW_STATE, COL_STATE);
1171 * @brief プレイヤーの行動速度を表示する / Prints the speed of a character. -CJS-
1174 static void prt_speed(void)
1176 int i = p_ptr->pspeed;
1177 bool is_fast = IS_FAST(p_ptr);
1179 TERM_COLOR attr = TERM_WHITE;
1181 TERM_LEN wid, hgt, row_speed, col_speed;
1183 Term_get_size(&wid, &hgt);
1184 col_speed = wid + COL_SPEED;
1185 row_speed = hgt + ROW_SPEED;
1187 /* Hack -- Visually "undo" the Search Mode Slowdown */
1188 if (p_ptr->action == ACTION_SEARCH && !p_ptr->lightspeed) i += 10;
1195 monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding];
1196 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1197 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1198 else attr = TERM_GREEN;
1200 else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
1201 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1202 else attr = TERM_L_GREEN;
1203 sprintf(buf, "%s(+%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("加速", "Fast")), (i - 110));
1211 monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding];
1212 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1213 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1214 else attr = TERM_RED;
1216 else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
1217 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1218 else attr = TERM_L_UMBER;
1219 sprintf(buf, "%s(-%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("減速", "Slow")), (110 - i));
1221 else if (p_ptr->riding)
1224 strcpy(buf, _("乗馬中", "Riding"));
1227 /* Display the speed */
1228 c_put_str(attr, format("%-9s", buf), row_speed, col_speed);
1233 * @brief プレイヤーの呪文学習可能状態を表示する
1236 static void prt_study(void)
1238 TERM_LEN wid, hgt, row_study, col_study;
1240 Term_get_size(&wid, &hgt);
1241 col_study = wid + COL_STUDY;
1242 row_study = hgt + ROW_STUDY;
1244 if (p_ptr->new_spells)
1246 put_str(_("学習", "Stud"), row_study, col_study);
1250 put_str(" ", row_study, col_study);
1256 * @brief プレイヤーのものまね可能状態を表示する
1259 static void prt_imitation(void)
1261 TERM_LEN wid, hgt, row_study, col_study;
1263 Term_get_size(&wid, &hgt);
1264 col_study = wid + COL_STUDY;
1265 row_study = hgt + ROW_STUDY;
1267 if (p_ptr->pclass == CLASS_IMITATOR)
1269 if (p_ptr->mane_num)
1272 if (p_ptr->new_mane) attr = TERM_L_RED;
1273 else attr = TERM_WHITE;
1274 c_put_str(attr, _("まね", "Imit"), row_study, col_study);
1278 put_str(" ", row_study, col_study);
1284 * @brief プレイヤーの負傷状態を表示する
1287 static void prt_cut(player_type *creature_ptr)
1289 int c = creature_ptr->cut;
1293 c_put_str(TERM_L_RED, _("致命傷 ", "Mortal wound"), ROW_CUT, COL_CUT);
1297 c_put_str(TERM_RED, _("ひどい深手 ", "Deep gash "), ROW_CUT, COL_CUT);
1301 c_put_str(TERM_RED, _("重傷 ", "Severe cut "), ROW_CUT, COL_CUT);
1305 c_put_str(TERM_ORANGE, _("大変な傷 ", "Nasty cut "), ROW_CUT, COL_CUT);
1309 c_put_str(TERM_ORANGE, _("ひどい傷 ", "Bad cut "), ROW_CUT, COL_CUT);
1313 c_put_str(TERM_YELLOW, _("軽傷 ", "Light cut "), ROW_CUT, COL_CUT);
1317 c_put_str(TERM_YELLOW, _("かすり傷 ", "Graze "), ROW_CUT, COL_CUT);
1321 put_str(" ", ROW_CUT, COL_CUT);
1327 * @brief プレイヤーの朦朧状態を表示する
1330 static void prt_stun(player_type *creature_ptr)
1332 int s = creature_ptr->stun;
1336 c_put_str(TERM_RED, _("意識不明瞭 ", "Knocked out "), ROW_STUN, COL_STUN);
1340 c_put_str(TERM_ORANGE, _("ひどく朦朧 ", "Heavy stun "), ROW_STUN, COL_STUN);
1344 c_put_str(TERM_ORANGE, _("朦朧 ", "Stun "), ROW_STUN, COL_STUN);
1348 put_str(" ", ROW_STUN, COL_STUN);
1355 * @brief モンスターの体力ゲージを表示する
1356 * @param riding TRUEならば騎乗中のモンスターの体力、FALSEならターゲットモンスターの体力を表示する。表示位置は固定。
1360 * Redraw the "monster health bar" -DRS-
1361 * Rather extensive modifications by -BEN-
1363 * The "monster health bar" provides visual feedback on the "health"
1364 * of the monster currently being "tracked". There are several ways
1365 * to "track" a monster, including targetting it, attacking it, and
1366 * affecting it (and nobody else) with a ranged attack.
1368 * Display the monster health bar (affectionately known as the
1369 * "health-o-meter"). Clear health bar if nothing is being tracked.
1370 * Auto-track current target monster when bored. Note that the
1371 * health-bar stops tracking any monster that "disappears".
1374 static void health_redraw(player_type *creature_ptr, bool riding)
1378 monster_type *m_ptr;
1382 health_who = creature_ptr->riding;
1383 row = ROW_RIDING_INFO;
1384 col = COL_RIDING_INFO;
1388 health_who = creature_ptr->health_who;
1393 m_ptr = &creature_ptr->current_floor_ptr->m_list[health_who];
1395 if (current_world_ptr->wizard && creature_ptr->phase_out)
1400 Term_putstr(col - 2, row, 12, TERM_WHITE, " / ");
1401 Term_putstr(col - 2, row + 1, 12, TERM_WHITE, " / ");
1402 Term_putstr(col - 2, row + 2, 12, TERM_WHITE, " / ");
1403 Term_putstr(col - 2, row + 3, 12, TERM_WHITE, " / ");
1405 if(creature_ptr->current_floor_ptr->m_list[1].r_idx)
1407 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));
1408 Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[1].hp));
1409 Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[1].max_maxhp));
1412 if(creature_ptr->current_floor_ptr->m_list[2].r_idx)
1414 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));
1415 Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[2].hp));
1416 Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[2].max_maxhp));
1419 if(creature_ptr->current_floor_ptr->m_list[3].r_idx)
1421 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));
1422 Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[3].hp));
1423 Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[3].max_maxhp));
1426 if(creature_ptr->current_floor_ptr->m_list[4].r_idx)
1428 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));
1429 Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[4].hp));
1430 Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[4].max_maxhp));
1439 /* Erase the health bar */
1440 Term_erase(col, row, 12);
1443 /* Tracking an unseen monster */
1444 else if (!m_ptr->ml)
1446 /* Indicate that the monster health is "unknown" */
1447 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1450 /* Tracking a hallucinatory monster */
1451 else if (creature_ptr->image)
1453 /* Indicate that the monster health is "unknown" */
1454 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1457 /* Tracking a dead monster (???) */
1458 else if (m_ptr->hp < 0)
1460 /* Indicate that the monster health is "unknown" */
1461 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1464 /* Tracking a visible monster */
1467 /* Extract the "percent" of health */
1468 int pct = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->maxhp : 0;
1469 int pct2 = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->max_maxhp: 0;
1471 /* Convert percent into "health" */
1472 int len = (pct2 < 10) ? 1 : (pct2 < 90) ? (pct2 / 10 + 1) : 10;
1474 /* Default to almost dead */
1475 TERM_COLOR attr = TERM_RED;
1478 if (MON_INVULNER(m_ptr)) attr = TERM_WHITE;
1481 else if (MON_CSLEEP(m_ptr)) attr = TERM_BLUE;
1484 else if (MON_MONFEAR(m_ptr)) attr = TERM_VIOLET;
1487 else if (pct >= 100) attr = TERM_L_GREEN;
1489 /* Somewhat Wounded */
1490 else if (pct >= 60) attr = TERM_YELLOW;
1493 else if (pct >= 25) attr = TERM_ORANGE;
1496 else if (pct >= 10) attr = TERM_L_RED;
1498 /* Default to "unknown" */
1499 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1501 /* Dump the current "health" (use '*' symbols) */
1502 Term_putstr(col + 1, row, len, attr, "**********");
1510 * @brief プレイヤーのステータスを一括表示する(左側部分) / Display basic info (mostly left of map)
1513 static void prt_frame_basic(void)
1516 if (p_ptr->mimic_form)
1517 prt_field(mimic_info[p_ptr->mimic_form].title, ROW_RACE, COL_RACE);
1521 my_strcpy(str, rp_ptr->title, sizeof(str));
1522 prt_field(str, ROW_RACE, COL_RACE);
1528 for (i = 0; i < A_MAX; i++) prt_stat(p_ptr, i);
1534 health_redraw(p_ptr, FALSE);
1535 health_redraw(p_ptr, TRUE);
1540 * @brief プレイヤーのステータスを一括表示する(下部分) / Display extra info (mostly below map)
1543 static void prt_frame_extra(void)
1557 * @brief サブウィンドウに所持品一覧を表示する / Hack -- display inventory in sub-windows
1560 static void fix_inven(void)
1565 for (j = 0; j < 8; j++)
1570 if (!angband_term[j]) continue;
1572 /* No relevant flags */
1573 if (!(window_flag[j] & (PW_INVEN))) continue;
1576 Term_activate(angband_term[j]);
1578 display_inven(p_ptr, item_tester_tval);
1586 * @brief モンスターの現在数を一行で表現する / Print monster info in line
1589 * @param m_ptr 思い出を表示するモンスター情報の参照ポインタ
1590 * @param n_same モンスターの数の現在数
1594 * nnn : number or unique(U) or wanted unique(W)
1595 * X : symbol of monster
1596 * LV : monster lv if known
1597 * name: name of monster
1601 static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type* m_ptr, int n_same){
1604 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1605 monster_race* r_ptr = &r_info[r_idx];
1609 //Number of 'U'nique
1610 if(r_ptr->flags1&RF1_UNIQUE){//unique
1611 bool is_bounty = FALSE;
1612 for(i=0;i<MAX_BOUNTY;i++){
1613 if(current_world_ptr->bounty_r_idx[i] == r_idx){
1618 Term_addstr(-1, TERM_WHITE, is_bounty?" W":" U");
1620 sprintf(buf, "%3d", n_same);
1621 Term_addstr(-1, TERM_WHITE, buf);
1624 Term_addstr(-1, TERM_WHITE, " ");
1625 //Term_add_bigch(r_ptr->d_attr, r_ptr->d_char);
1626 //Term_addstr(-1, TERM_WHITE, "/");
1627 Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
1629 if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){
1630 sprintf(buf, " %2d", (int)r_ptr->level);
1634 Term_addstr(-1, TERM_WHITE, buf);
1636 sprintf(buf, " %s ", r_name+r_ptr->name);
1637 Term_addstr(-1, TERM_WHITE, buf);
1639 //Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0));
1643 * @brief モンスターの出現リストを表示する / Print monster info in line
1646 * @param max_lines 最大何行描画するか
1648 void print_monster_list(floor_type *floor_ptr, TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
1650 monster_type* last_mons = NULL;
1651 monster_type* m_ptr = NULL;
1655 for(i=0;i<tmp_pos.n;i++){
1656 grid_type* g_ptr = &floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]];
1657 if(!g_ptr->m_idx || !floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look
1658 m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
1659 if(is_pet(m_ptr))continue;//pet
1660 if(!m_ptr->r_idx)continue;//dead?
1663 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1664 monster_race* r_ptr = &r_info[r_idx];
1665 concptr name = (r_name + r_ptr->name);
1666 concptr ename = (r_name + r_ptr->name);
1667 //ミミック類や「それ」等は、一覧に出てはいけない
1668 if(r_ptr->flags1&RF1_CHAR_CLEAR)continue;
1669 if((r_ptr->flags1&RF1_NEVER_MOVE)&&(r_ptr->flags2&RF2_CHAR_MULTI))continue;
1671 if((strcmp(name, "生ける虚無『ヌル』")==0)||
1672 (strcmp(ename, "Null the Living Void")==0))continue;
1673 //"金無垢の指輪"は、一覧に出てはいけない
1674 if((strcmp(name, "金無垢の指輪")==0)||
1675 (strcmp(ename, "Plain Gold Ring")==0))continue;
1679 //ソート済みなので同じモンスターは連続する.これを利用して同じモンスターをカウント,まとめて表示する.
1680 if(!last_mons){//先頭モンスター
1686 if(last_mons->ap_r_idx == m_ptr->ap_r_idx){
1688 continue;//表示処理を次に回す
1690 //print last mons info
1691 print_monster_line(x, line++, last_mons, n_same);
1694 if(line-y-1==max_lines){//残り1行
1698 if(line-y-1==max_lines && i!=tmp_pos.n){
1699 Term_gotoxy(x, line);
1700 Term_addstr(-1, TERM_WHITE, "-- and more --");
1702 if(last_mons)print_monster_line(x, line++, last_mons, n_same);
1707 * @brief 出現中モンスターのリストをサブウィンドウに表示する / Hack -- display monster list in sub-windows
1710 static void fix_monster_list(void)
1716 for (j = 0; j < 8; j++)
1721 if (!angband_term[j]) continue;
1723 /* No relevant flags */
1724 if (!(window_flag[j] & (PW_MONSTER_LIST))) continue;
1727 Term_activate(angband_term[j]);
1728 Term_get_size(&w, &h);
1732 target_set_prepare_look();//モンスター一覧を生成,ソート
1733 print_monster_list(p_ptr->current_floor_ptr, 0, 0, h);
1742 * @brief 現在の装備品をサブウィンドウに表示する /
1743 * Hack -- display equipment in sub-windows
1746 static void fix_equip(void)
1751 for (j = 0; j < 8; j++)
1756 if (!angband_term[j]) continue;
1758 /* No relevant flags */
1759 if (!(window_flag[j] & (PW_EQUIP))) continue;
1762 Term_activate(angband_term[j]);
1764 /* Display equipment */
1765 display_equip(p_ptr, item_tester_tval);
1773 * @brief 現在の習得済魔法をサブウィンドウに表示する /
1774 * Hack -- display spells in sub-windows
1777 static void fix_spell(void)
1782 for (j = 0; j < 8; j++)
1787 if (!angband_term[j]) continue;
1789 /* No relevant flags */
1790 if (!(window_flag[j] & (PW_SPELL))) continue;
1793 Term_activate(angband_term[j]);
1795 /* Display spell list */
1796 display_spell_list(p_ptr);
1804 * @brief 現在のプレイヤーステータスをサブウィンドウに表示する /
1805 * Hack -- display character in sub-windows
1808 static void fix_player(void)
1813 for (j = 0; j < 8; j++)
1818 if (!angband_term[j]) continue;
1820 /* No relevant flags */
1821 if (!(window_flag[j] & (PW_PLAYER))) continue;
1824 Term_activate(angband_term[j]);
1827 display_player(p_ptr, 0);
1834 * @brief ゲームメッセージ履歴をサブウィンドウに表示する /
1835 * Hack -- display recent messages in sub-windows
1836 * Adjust for width and split messages
1839 static void fix_message(void)
1846 for (j = 0; j < 8; j++)
1851 if (!angband_term[j]) continue;
1853 /* No relevant flags */
1854 if (!(window_flag[j] & (PW_MESSAGE))) continue;
1857 Term_activate(angband_term[j]);
1859 Term_get_size(&w, &h);
1862 for (i = 0; i < h; i++)
1864 /* Dump the message on the appropriate line */
1865 Term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
1868 Term_locate(&x, &y);
1870 /* Clear to end of line */
1871 Term_erase(x, y, 255);
1880 * @brief 簡易マップをサブウィンドウに表示する /
1881 * Hack -- display overhead view in sub-windows
1882 * Adjust for width and split messages
1885 * Note that the "player" symbol does NOT appear on the map.
1887 static void fix_overhead(void)
1893 for (j = 0; j < 8; j++)
1899 if (!angband_term[j]) continue;
1901 /* No relevant flags */
1902 if (!(window_flag[j] & (PW_OVERHEAD))) continue;
1905 Term_activate(angband_term[j]);
1907 /* Full map in too small window is useless */
1908 Term_get_size(&wid, &hgt);
1909 if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2)
1912 display_map(p_ptr->current_floor_ptr, &cy, &cx);
1919 static void display_dungeon(void)
1926 SYMBOL_CODE tc = '\0';
1928 for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++)
1930 for (y = p_ptr->y - Term->hgt / 2 + 1; y <= p_ptr->y + Term->hgt / 2; y++)
1932 if (in_bounds2(p_ptr->current_floor_ptr, y, x))
1934 map_info(y, x, &a, &c, &ta, &tc);
1936 /* Hack -- fake monochrome */
1939 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
1940 else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
1941 else if (p_ptr->wraith_form) a = TERM_L_DARK;
1944 /* Hack -- Queue it */
1945 Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
1949 /* Clear out-of-bound tiles */
1951 /* Access darkness */
1952 feature_type *f_ptr = &f_info[feat_none];
1955 a = f_ptr->x_attr[F_LIT_STANDARD];
1958 c = f_ptr->x_char[F_LIT_STANDARD];
1960 /* Hack -- Queue it */
1961 Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
1968 * @brief ダンジョンの地形をサブウィンドウに表示する /
1969 * Hack -- display dungeon view in sub-windows
1972 static void fix_dungeon(void)
1977 for (j = 0; j < 8; j++)
1982 if (!angband_term[j]) continue;
1984 /* No relevant flags */
1985 if (!(window_flag[j] & (PW_DUNGEON))) continue;
1988 Term_activate(angband_term[j]);
1990 /* Redraw dungeon view */
1999 * @brief モンスターの思い出をサブウィンドウに表示する /
2000 * Hack -- display dungeon view in sub-windows
2003 static void fix_monster(void)
2008 for (j = 0; j < 8; j++)
2013 if (!angband_term[j]) continue;
2015 /* No relevant flags */
2016 if (!(window_flag[j] & (PW_MONSTER))) continue;
2019 Term_activate(angband_term[j]);
2021 /* Display monster race info */
2022 if (p_ptr->monster_race_idx) display_roff(p_ptr->monster_race_idx);
2030 * @brief ベースアイテム情報をサブウィンドウに表示する /
2031 * Hack -- display object recall in sub-windows
2032 * @param player_ptr プレーヤーへの参照ポインタ
2035 static void fix_object(player_type *player_ptr)
2040 for (j = 0; j < 8; j++)
2045 if (!angband_term[j]) continue;
2047 /* No relevant flags */
2048 if (!(window_flag[j] & (PW_OBJECT))) continue;
2051 Term_activate(angband_term[j]);
2053 /* Display monster race info */
2054 if (player_ptr->object_kind_idx) display_koff(player_ptr, player_ptr->object_kind_idx);
2063 * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 /
2064 * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
2065 * @return 重すぎるならばTRUE
2067 bool is_heavy_shoot(player_type *creature_ptr, object_type *o_ptr)
2069 int hold = adj_str_hold[creature_ptr->stat_ind[A_STR]];
2070 /* It is hard to carholdry a heavy bow */
2071 return (hold < o_ptr->weight / 10);
2076 * @brief redraw のフラグに応じた更新をまとめて行う / Handle "redraw"
2078 * @details 更新処理の対象はゲーム中の全描画処理
2080 void redraw_stuff(player_type *creature_ptr)
2082 if (!creature_ptr->redraw) return;
2084 /* Character is not ready yet, no screen updates */
2085 if (!current_world_ptr->character_generated) return;
2087 /* Character is in "icky" mode, no screen updates */
2088 if (current_world_ptr->character_icky) return;
2090 /* Hack -- clear the screen */
2091 if (creature_ptr->redraw & (PR_WIPE))
2093 creature_ptr->redraw &= ~(PR_WIPE);
2098 if (creature_ptr->redraw & (PR_MAP))
2100 creature_ptr->redraw &= ~(PR_MAP);
2104 if (creature_ptr->redraw & (PR_BASIC))
2106 creature_ptr->redraw &= ~(PR_BASIC);
2107 creature_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
2108 creature_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
2109 creature_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
2110 creature_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
2113 print_dungeon(creature_ptr);
2116 if (creature_ptr->redraw & (PR_EQUIPPY))
2118 creature_ptr->redraw &= ~(PR_EQUIPPY);
2119 print_equippy(creature_ptr); /* To draw / delete equippy chars */
2122 if (creature_ptr->redraw & (PR_MISC))
2124 creature_ptr->redraw &= ~(PR_MISC);
2125 prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
2126 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
2129 if (creature_ptr->redraw & (PR_TITLE))
2131 creature_ptr->redraw &= ~(PR_TITLE);
2132 prt_title(creature_ptr);
2135 if (creature_ptr->redraw & (PR_LEV))
2137 creature_ptr->redraw &= ~(PR_LEV);
2138 prt_level(creature_ptr);
2141 if (creature_ptr->redraw & (PR_EXP))
2143 creature_ptr->redraw &= ~(PR_EXP);
2144 prt_exp(creature_ptr);
2147 if (creature_ptr->redraw & (PR_STATS))
2149 creature_ptr->redraw &= ~(PR_STATS);
2150 prt_stat(creature_ptr, A_STR);
2151 prt_stat(creature_ptr, A_INT);
2152 prt_stat(creature_ptr, A_WIS);
2153 prt_stat(creature_ptr, A_DEX);
2154 prt_stat(creature_ptr, A_CON);
2155 prt_stat(creature_ptr, A_CHR);
2158 if (creature_ptr->redraw & (PR_STATUS))
2160 creature_ptr->redraw &= ~(PR_STATUS);
2161 prt_status(creature_ptr);
2164 if (creature_ptr->redraw & (PR_ARMOR))
2166 creature_ptr->redraw &= ~(PR_ARMOR);
2167 prt_ac(creature_ptr);
2170 if (creature_ptr->redraw & (PR_HP))
2172 creature_ptr->redraw &= ~(PR_HP);
2173 prt_hp(creature_ptr);
2176 if (creature_ptr->redraw & (PR_MANA))
2178 creature_ptr->redraw &= ~(PR_MANA);
2179 prt_sp(creature_ptr);
2182 if (creature_ptr->redraw & (PR_GOLD))
2184 creature_ptr->redraw &= ~(PR_GOLD);
2188 if (creature_ptr->redraw & (PR_DEPTH))
2190 creature_ptr->redraw &= ~(PR_DEPTH);
2194 if (creature_ptr->redraw & (PR_HEALTH))
2196 creature_ptr->redraw &= ~(PR_HEALTH);
2197 health_redraw(creature_ptr, FALSE);
2200 if (creature_ptr->redraw & (PR_UHEALTH))
2202 creature_ptr->redraw &= ~(PR_UHEALTH);
2203 health_redraw(creature_ptr, TRUE);
2206 if (creature_ptr->redraw & (PR_EXTRA))
2208 creature_ptr->redraw &= ~(PR_EXTRA);
2209 creature_ptr->redraw &= ~(PR_CUT | PR_STUN);
2210 creature_ptr->redraw &= ~(PR_HUNGER);
2211 creature_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
2215 if (creature_ptr->redraw & (PR_CUT))
2217 creature_ptr->redraw &= ~(PR_CUT);
2218 prt_cut(creature_ptr);
2221 if (creature_ptr->redraw & (PR_STUN))
2223 creature_ptr->redraw &= ~(PR_STUN);
2224 prt_stun(creature_ptr);
2227 if (creature_ptr->redraw & (PR_HUNGER))
2229 creature_ptr->redraw &= ~(PR_HUNGER);
2233 if (creature_ptr->redraw & (PR_STATE))
2235 creature_ptr->redraw &= ~(PR_STATE);
2239 if (creature_ptr->redraw & (PR_SPEED))
2241 creature_ptr->redraw &= ~(PR_SPEED);
2245 if (creature_ptr->pclass == CLASS_IMITATOR)
2247 if (creature_ptr->redraw & (PR_IMITATION))
2249 creature_ptr->redraw &= ~(PR_IMITATION);
2253 else if (creature_ptr->redraw & (PR_STUDY))
2255 creature_ptr->redraw &= ~(PR_STUDY);
2261 * @brief player_ptr->window のフラグに応じた更新をまとめて行う / Handle "player_ptr->window"
2262 * @param player_ptr プレーヤーへの参照ポインタ
2264 * @details 更新処理の対象はサブウィンドウ全般
2266 void window_stuff(player_type *player_ptr)
2269 BIT_FLAGS mask = 0L;
2272 if (!player_ptr->window) return;
2275 for (j = 0; j < 8; j++)
2277 /* Save usable flags */
2278 if (angband_term[j]) mask |= window_flag[j];
2281 /* Apply usable flags */
2282 player_ptr->window &= mask;
2285 if (!player_ptr->window) return;
2287 if (player_ptr->window & (PW_INVEN))
2289 player_ptr->window &= ~(PW_INVEN);
2293 /* Display equipment */
2294 if (player_ptr->window & (PW_EQUIP))
2296 player_ptr->window &= ~(PW_EQUIP);
2300 /* Display spell list */
2301 if (player_ptr->window & (PW_SPELL))
2303 player_ptr->window &= ~(PW_SPELL);
2307 /* Display player */
2308 if (player_ptr->window & (PW_PLAYER))
2310 player_ptr->window &= ~(PW_PLAYER);
2314 /* Display monster list */
2315 if (player_ptr->window & (PW_MONSTER_LIST))
2317 player_ptr->window &= ~(PW_MONSTER_LIST);
2321 /* Display overhead view */
2322 if (player_ptr->window & (PW_MESSAGE))
2324 player_ptr->window &= ~(PW_MESSAGE);
2328 /* Display overhead view */
2329 if (player_ptr->window & (PW_OVERHEAD))
2331 player_ptr->window &= ~(PW_OVERHEAD);
2335 /* Display overhead view */
2336 if (player_ptr->window & (PW_DUNGEON))
2338 player_ptr->window &= ~(PW_DUNGEON);
2342 /* Display monster recall */
2343 if (player_ptr->window & (PW_MONSTER))
2345 player_ptr->window &= ~(PW_MONSTER);
2349 /* Display object recall */
2350 if (player_ptr->window & (PW_OBJECT))
2352 player_ptr->window &= ~(PW_OBJECT);
2353 fix_object(player_ptr);
2359 * @brief コンソールのリサイズに合わせてマップを再描画する /
2360 * Map resizing whenever the main term changes size
2363 void resize_map(void)
2365 /* Only if the dungeon exists */
2366 if (!current_world_ptr->character_dungeon) return;
2368 /* Mega-Hack -- no panel yet */
2372 /* Reset the panels */
2373 panel_row_min = p_ptr->current_floor_ptr->height;
2374 panel_col_min = p_ptr->current_floor_ptr->width;
2378 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2379 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2380 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2381 p_ptr->update |= (PU_MONSTERS);
2382 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2384 handle_stuff(p_ptr);
2389 * Place the cursor on the player
2391 if (can_save) move_cursor_relative(p_ptr->y, p_ptr->x);
2397 * @brief コンソールを再描画する /
2398 * Redraw a term when it is resized
2401 void redraw_window(void)
2403 /* Only if the dungeon exists */
2404 if (!current_world_ptr->character_dungeon) return;
2406 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2407 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2409 handle_stuff(p_ptr);
2415 * @brief フォーカスを当てるべきマップ描画の基準座標を指定する(サブルーチン)
2416 * @param dy 変更先のフロアY座標
2417 * @param dx 変更先のフロアX座標
2418 * Handle a request to change the current panel
2419 * Return TRUE if the panel was changed.
2420 * Also used in do_cmd_locate
2421 * @return 実際に再描画が必要だった場合TRUEを返す
2423 bool change_panel(POSITION dy, POSITION dx)
2428 get_screen_size(&wid, &hgt);
2430 /* Apply the motion */
2431 y = panel_row_min + dy * hgt / 2;
2432 x = panel_col_min + dx * wid / 2;
2434 /* Verify the row */
2435 if (y > p_ptr->current_floor_ptr->height - hgt) y = p_ptr->current_floor_ptr->height - hgt;
2438 /* Verify the col */
2439 if (x > p_ptr->current_floor_ptr->width - wid) x = p_ptr->current_floor_ptr->width - wid;
2442 /* Handle "changes" */
2443 if ((y != panel_row_min) || (x != panel_col_min))
2445 /* Save the new panel info */
2449 panel_bounds_center();
2451 p_ptr->update |= (PU_MONSTERS);
2452 p_ptr->redraw |= (PR_MAP);
2453 handle_stuff(p_ptr);
2464 * @brief プレイヤーの装備一覧シンボルを固定位置に表示する
2465 * @param creature_ptr プレーヤーへの参照ポインタ
2468 void print_equippy(player_type *creature_ptr)
2470 display_player_equippy(creature_ptr, ROW_EQUIPPY, COL_EQUIPPY, 0);
2474 * @brief 現在のコンソール表示の縦横を返す。 /
2475 * Get term size and calculate screen size
2476 * @param wid_p コンソールの表示幅文字数を返す
2477 * @param hgt_p コンソールの表示行数を返す
2480 void get_screen_size(TERM_LEN *wid_p, TERM_LEN *hgt_p)
2482 Term_get_size(wid_p, hgt_p);
2483 *hgt_p -= ROW_MAP + 2;
2484 *wid_p -= COL_MAP + 2;
2485 if (use_bigtile) *wid_p /= 2;
2489 * Calculate panel colum of a location in the map
2491 int panel_col_of(int col)
2493 col -= panel_col_min;
2494 if (use_bigtile) col *= 2;
2499 * Prints the map of the dungeon
2501 * Note that, for efficiency, we contain an "optimized" version
2502 * of both "lite_spot()" and "print_rel()", and that we use the
2503 * "lite_spot()" function to display the player grid, if needed.
2511 POSITION xmin, xmax, ymin, ymax;
2515 Term_get_size(&wid, &hgt);
2517 /* Remove map offset */
2521 /* Access the cursor state */
2522 (void)Term_get_cursor(&v);
2524 /* Hide the cursor */
2525 (void)Term_set_cursor(0);
2528 xmin = (0 < panel_col_min) ? panel_col_min : 0;
2529 xmax = (p_ptr->current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : p_ptr->current_floor_ptr->width - 1;
2530 ymin = (0 < panel_row_min) ? panel_row_min : 0;
2531 ymax = (p_ptr->current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : p_ptr->current_floor_ptr->height - 1;
2533 /* Bottom section of screen */
2534 for (y = 1; y <= ymin - panel_row_prt; y++)
2536 /* Erase the section */
2537 Term_erase(COL_MAP, y, wid);
2540 /* Top section of screen */
2541 for (y = ymax - panel_row_prt; y <= hgt; y++)
2543 /* Erase the section */
2544 Term_erase(COL_MAP, y, wid);
2548 for (y = ymin; y <= ymax; y++)
2550 /* Scan the columns of row "y" */
2551 for (x = xmin; x <= xmax; x++)
2559 /* Determine what is there */
2560 map_info(y, x, &a, &c, &ta, &tc);
2562 /* Hack -- fake monochrome */
2565 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
2566 else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
2567 else if (p_ptr->wraith_form) a = TERM_L_DARK;
2570 /* Efficiency -- Redraw that grid of the map */
2571 Term_queue_bigchar(panel_col_of(x), y - panel_row_prt, a, c, ta, tc);
2575 /* Display player */
2576 lite_spot(p_ptr->y, p_ptr->x);
2578 /* Restore the cursor */
2579 (void)Term_set_cursor(v);
2585 * 一般的にモンスターシンボルとして扱われる記号を定義する(幻覚処理向け) / Hack -- Legal monster codes
2587 static char image_monster_hack[] = \
2588 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2591 * 一般的にオブジェクトシンボルとして扱われる記号を定義する(幻覚処理向け) / Hack -- Legal object codes
2593 static char image_object_hack[] = "?/|\\\"!$()_-=[]{},~";
2596 * @brief モンスターの表示を幻覚状態に差し替える / Mega-Hack -- Hallucinatory monster
2601 static void image_monster(TERM_COLOR *ap, SYMBOL_CODE *cp)
2603 /* Random symbol from set above */
2606 monster_race *r_ptr = &r_info[randint1(max_r_idx - 1)];
2608 *cp = r_ptr->x_char;
2609 *ap = r_ptr->x_attr;
2614 *cp = (one_in_(25) ?
2615 image_object_hack[randint0(sizeof(image_object_hack) - 1)] :
2616 image_monster_hack[randint0(sizeof(image_monster_hack) - 1)]);
2624 * @brief オブジェクトの表示を幻覚状態に差し替える / Hallucinatory object
2629 static void image_object(TERM_COLOR *ap, SYMBOL_CODE *cp)
2633 object_kind *k_ptr = &k_info[randint1(max_k_idx - 1)];
2635 *cp = k_ptr->x_char;
2636 *ap = k_ptr->x_attr;
2640 int n = sizeof(image_object_hack) - 1;
2642 *cp = image_object_hack[randint0(n)];
2651 * @brief オブジェクト&モンスターの表示を幻覚状態に差し替える / Hack -- Random hallucination
2656 static void image_random(TERM_COLOR *ap, SYMBOL_CODE *cp)
2658 /* Normally, assume monsters */
2659 if (randint0(100) < 75)
2661 image_monster(ap, cp);
2664 /* Otherwise, assume objects */
2667 image_object(ap, cp);
2672 * 照明の表現を行うための色合いの関係を{暗闇時, 照明時} で定義する /
2673 * This array lists the effects of "brightness" on various "base" colours.\n
2675 * This is used to do dynamic lighting effects in ascii :-)\n
2676 * At the moment, only the various "floor" tiles are affected.\n
2678 * The layout of the array is [x][0] = light and [x][1] = dark.\n
2680 static TERM_COLOR lighting_colours[16][2] =
2683 {TERM_L_DARK, TERM_DARK},
2686 {TERM_YELLOW, TERM_SLATE},
2689 {TERM_WHITE, TERM_L_DARK},
2692 {TERM_L_UMBER, TERM_UMBER},
2695 {TERM_RED, TERM_RED},
2698 {TERM_L_GREEN, TERM_GREEN},
2701 {TERM_BLUE, TERM_BLUE},
2704 {TERM_L_UMBER, TERM_RED},
2707 {TERM_SLATE, TERM_L_DARK},
2710 {TERM_WHITE, TERM_SLATE},
2713 {TERM_L_RED, TERM_BLUE},
2716 {TERM_YELLOW, TERM_ORANGE},
2719 {TERM_L_RED, TERM_L_RED},
2722 {TERM_L_GREEN, TERM_GREEN},
2725 {TERM_L_BLUE, TERM_L_BLUE},
2728 {TERM_L_UMBER, TERM_UMBER}
2736 void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE f_char[F_LIT_MAX])
2738 TERM_COLOR s_attr = f_attr[F_LIT_STANDARD];
2739 SYMBOL_CODE s_char = f_char[F_LIT_STANDARD];
2742 if (IS_ASCII_GRAPHICS(s_attr)) /* For ASCII */
2744 f_attr[F_LIT_LITE] = lighting_colours[s_attr & 0x0f][0];
2745 f_attr[F_LIT_DARK] = lighting_colours[s_attr & 0x0f][1];
2746 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++) f_char[i] = s_char;
2748 else /* For tile graphics */
2750 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++) f_attr[i] = s_attr;
2751 f_char[F_LIT_LITE] = s_char + 2;
2752 f_char[F_LIT_DARK] = s_char + 1;
2758 * @brief Mコマンドによる縮小マップの表示を行う / Extract the attr/char to display at the given (legal) map location
2760 * Basically, we "paint" the chosen attr/char in several passes, starting\n
2761 * with any known "terrain features" (defaulting to darkness), then adding\n
2762 * any known "objects", and finally, adding any known "monsters". This\n
2763 * is not the fastest method but since most of the calls to this function\n
2764 * are made for grids with no monsters or objects, it is fast enough.\n
2766 * Note that this function, if used on the grid containing the "player",\n
2767 * will return the attr/char of the grid underneath the player, and not\n
2768 * the actual player attr/char itself, allowing a lot of optimization\n
2769 * in various "display" functions.\n
2771 * Note that the "zero" entry in the feature/object/monster arrays are\n
2772 * used to provide "special" attr/char codes, with "monster zero" being\n
2773 * used for the player attr/char, "object zero" being used for the "stack"\n
2774 * attr/char, and "feature zero" being used for the "nothing" attr/char,\n
2775 * though this function makes use of only "feature zero".\n
2777 * Note that monsters can have some "special" flags, including "ATTR_MULTI",\n
2778 * which means their color changes, and "ATTR_CLEAR", which means they take\n
2779 * the color of whatever is under them, and "CHAR_CLEAR", which means that\n
2780 * they take the symbol of whatever is under them. Technically, the flag\n
2781 * "CHAR_MULTI" is supposed to indicate that a monster looks strange when\n
2782 * examined, but this flag is currently ignored.\n
2784 * Currently, we do nothing with multi-hued objects, because there are\n
2785 * not any. If there were, they would have to set "shimmer_objects"\n
2786 * when they were created, and then new "shimmer" code in "dungeon.c"\n
2787 * would have to be created handle the "shimmer" effect, and the code\n
2788 * in floor would have to be updated to create the shimmer effect.\n
2790 * Note the effects of hallucination. Objects always appear as random\n
2791 * "objects", monsters as random "monsters", and normal grids occasionally\n
2792 * appear as random "monsters" or "objects", but note that these random\n
2793 * "monsters" and "objects" are really just "colored ascii symbols".\n
2795 * Note that "floors" and "invisible traps" (and "zero" features) are\n
2796 * drawn as "floors" using a special check for optimization purposes,\n
2797 * and these are the only features which get drawn using the special\n
2798 * lighting effects activated by "view_special_lite".\n
2800 * Note the use of the "mimic" field in the "terrain feature" processing,\n
2801 * which allows any feature to "pretend" to be another feature. This is\n
2802 * used to "hide" secret doors, and to make all "doors" appear the same,\n
2803 * and all "walls" appear the same, and "hidden" treasure stay hidden.\n
2804 * It is possible to use this field to make a feature "look" like a floor,\n
2805 * but the "special lighting effects" for floors will not be used.\n
2807 * Note the use of the new "terrain feature" information. Note that the\n
2808 * assumption that all interesting "objects" and "terrain features" are\n
2809 * memorized allows extremely optimized processing below. Note the use\n
2810 * of separate flags on objects to mark them as memorized allows a grid\n
2811 * to have memorized "terrain" without granting knowledge of any object\n
2812 * which may appear in that grid.\n
2814 * Note the efficient code used to determine if a "floor" grid is\n
2815 * "memorized" or "viewable" by the player, where the test for the\n
2816 * grid being "viewable" is based on the facts that (1) the grid\n
2817 * must be "lit" (torch-lit or perma-lit), (2) the grid must be in\n
2818 * line of sight, and (3) the player must not be blind, and uses the\n
2819 * assumption that all torch-lit grids are in line of sight.\n
2821 * Note that floors (and invisible traps) are the only grids which are\n
2822 * not memorized when seen, so only these grids need to check to see if\n
2823 * the grid is "viewable" to the player (if it is not memorized). Since\n
2824 * most non-memorized grids are in fact walls, this induces *massive*\n
2825 * efficiency, at the cost of *forcing* the memorization of non-floor\n
2826 * grids when they are first seen. Note that "invisible traps" are\n
2827 * always treated exactly like "floors", which prevents "cheating".\n
2829 * Note the "special lighting effects" which can be activated for floor\n
2830 * grids using the "view_special_lite" option (for "white" floor grids),\n
2831 * causing certain grids to be displayed using special colors. If the\n
2832 * player is "blind", we will use "dark gray", else if the grid is lit\n
2833 * by the torch, and the "view_yellow_lite" option is set, we will use\n
2834 * "yellow", else if the grid is "dark", we will use "dark gray", else\n
2835 * if the grid is not "viewable", and the "view_bright_lite" option is\n
2836 * set, and the we will use "slate" (gray). We will use "white" for all\n
2837 * other cases, in particular, for illuminated viewable floor grids.\n
2839 * Note the "special lighting effects" which can be activated for wall\n
2840 * grids using the "view_granite_lite" option (for "white" wall grids),\n
2841 * causing certain grids to be displayed using special colors. If the\n
2842 * player is "blind", we will use "dark gray", else if the grid is lit\n
2843 * by the torch, and the "view_yellow_lite" option is set, we will use\n
2844 * "yellow", else if the "view_bright_lite" option is set, and the grid\n
2845 * is not "viewable", or is "dark", or is glowing, but not when viewed\n
2846 * from the player's current location, we will use "slate" (gray). We\n
2847 * will use "white" for all other cases, in particular, for correctly\n
2848 * illuminated viewable wall grids.\n
2850 * Note that, when "view_granite_lite" is set, we use an inline version\n
2851 * of the "player_can_see_bold()" function to check the "viewability" of\n
2852 * grids when the "view_bright_lite" option is set, and we do NOT use\n
2853 * any special colors for "dark" wall grids, since this would allow the\n
2854 * player to notice the walls of illuminated rooms from a hallway that\n
2855 * happened to run beside the room. The alternative, by the way, would\n
2856 * be to prevent the generation of hallways next to rooms, but this\n
2857 * would still allow problems when digging towards a room.\n
2859 * Note that bizarre things must be done when the "attr" and/or "char"\n
2860 * codes have the "high-bit" set, since these values are used to encode\n
2861 * various "special" pictures in some versions, and certain situations,\n
2862 * such as "multi-hued" or "clear" monsters, cause the attr/char codes\n
2863 * to be "scrambled" in various ways.\n
2865 * Note that eventually we may use the "&" symbol for embedded treasure,\n
2866 * and use the "*" symbol to indicate multiple objects, though this will\n
2867 * have to wait for Angband 2.8.0 or later. Note that currently, this\n
2868 * is not important, since only one object or terrain feature is allowed\n
2869 * in each grid. If needed, "k_info[0]" will hold the "stack" attr/char.\n
2871 * Note the assumption that doing "x_ptr = &x_info[x]" plus a few of\n
2872 * "x_ptr->xxx", is quicker than "x_info[x].xxx", if this is incorrect\n
2873 * then a whole lot of code should be changed... XXX XXX\n
2875 void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLOR *tap, SYMBOL_CODE *tcp)
2877 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
2879 OBJECT_IDX this_o_idx, next_o_idx = 0;
2881 /* Feature code (applying "mimic" field) */
2882 FEAT_IDX feat = get_feat_mimic(g_ptr);
2885 feature_type *f_ptr = &f_info[feat];
2890 /* Boring grids (floors, etc) */
2891 if (!have_flag(f_ptr->flags, FF_REMEMBER))
2894 * Handle Memorized or visible floor
2896 * No visual when blinded.
2897 * (to prevent strange effects on darkness breath)
2899 * - Can see grids with CAVE_MARK.
2900 * - Can see grids with CAVE_LITE or CAVE_MNLT.
2901 * (Such grids also have CAVE_VIEW)
2902 * - Can see grids with CAVE_VIEW unless darkened by monsters.
2904 if (!p_ptr->blind &&
2905 ((g_ptr->info & (CAVE_MARK | CAVE_LITE | CAVE_MNLT)) ||
2906 ((g_ptr->info & CAVE_VIEW) && (((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) || p_ptr->see_nocto))))
2908 /* Normal attr/char */
2909 a = f_ptr->x_attr[F_LIT_STANDARD];
2910 c = f_ptr->x_char[F_LIT_STANDARD];
2912 if (p_ptr->wild_mode)
2914 /* Special lighting effects */
2915 /* Handle "night" */
2916 if (view_special_lite && !is_daytime())
2918 /* Use a darkened colour/tile */
2919 a = f_ptr->x_attr[F_LIT_DARK];
2920 c = f_ptr->x_char[F_LIT_DARK];
2924 /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
2925 else if (darkened_grid(g_ptr))
2927 /* Unsafe grid -- idea borrowed from Unangband */
2928 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
2930 /* Access darkness */
2931 f_ptr = &f_info[feat];
2933 /* Char and attr of darkness */
2934 a = f_ptr->x_attr[F_LIT_STANDARD];
2935 c = f_ptr->x_char[F_LIT_STANDARD];
2938 /* Special lighting effects */
2939 else if (view_special_lite)
2941 /* Handle "torch-lit" grids */
2942 if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
2945 if (view_yellow_lite)
2947 /* Use a brightly lit colour/tile */
2948 a = f_ptr->x_attr[F_LIT_LITE];
2949 c = f_ptr->x_char[F_LIT_LITE];
2953 /* Handle "dark" grids */
2954 else if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
2956 /* Use a darkened colour/tile */
2957 a = f_ptr->x_attr[F_LIT_DARK];
2958 c = f_ptr->x_char[F_LIT_DARK];
2961 /* Handle "out-of-sight" grids */
2962 else if (!(g_ptr->info & CAVE_VIEW))
2965 if (view_bright_lite)
2967 /* Use a darkened colour/tile */
2968 a = f_ptr->x_attr[F_LIT_DARK];
2969 c = f_ptr->x_char[F_LIT_DARK];
2978 /* Unsafe grid -- idea borrowed from Unangband */
2979 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
2981 /* Access darkness */
2982 f_ptr = &f_info[feat];
2984 /* Normal attr/char */
2985 a = f_ptr->x_attr[F_LIT_STANDARD];
2986 c = f_ptr->x_char[F_LIT_STANDARD];
2990 /* Interesting grids (non-floors) */
2993 /* Memorized grids */
2994 if (g_ptr->info & CAVE_MARK)
2996 /* Normal attr/char */
2997 a = f_ptr->x_attr[F_LIT_STANDARD];
2998 c = f_ptr->x_char[F_LIT_STANDARD];
3000 if (p_ptr->wild_mode)
3002 /* Special lighting effects */
3003 /* Handle "blind" or "night" */
3004 if (view_granite_lite && (p_ptr->blind || !is_daytime()))
3006 /* Use a darkened colour/tile */
3007 a = f_ptr->x_attr[F_LIT_DARK];
3008 c = f_ptr->x_char[F_LIT_DARK];
3012 /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
3013 else if (darkened_grid(g_ptr) && !p_ptr->blind)
3015 if (have_flag(f_ptr->flags, FF_LOS) && have_flag(f_ptr->flags, FF_PROJECT))
3017 /* Unsafe grid -- idea borrowed from Unangband */
3018 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
3020 /* Access darkness */
3021 f_ptr = &f_info[feat];
3023 /* Char and attr of darkness */
3024 a = f_ptr->x_attr[F_LIT_STANDARD];
3025 c = f_ptr->x_char[F_LIT_STANDARD];
3027 else if (view_granite_lite && view_bright_lite)
3029 /* Use a darkened colour/tile */
3030 a = f_ptr->x_attr[F_LIT_DARK];
3031 c = f_ptr->x_char[F_LIT_DARK];
3035 /* Special lighting effects */
3036 else if (view_granite_lite)
3038 /* Handle "blind" */
3041 /* Use a darkened colour/tile */
3042 a = f_ptr->x_attr[F_LIT_DARK];
3043 c = f_ptr->x_char[F_LIT_DARK];
3046 /* Handle "torch-lit" grids */
3047 else if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
3050 if (view_yellow_lite)
3052 /* Use a brightly lit colour/tile */
3053 a = f_ptr->x_attr[F_LIT_LITE];
3054 c = f_ptr->x_char[F_LIT_LITE];
3058 /* Handle "view_bright_lite" */
3059 else if (view_bright_lite)
3062 if (!(g_ptr->info & CAVE_VIEW))
3064 /* Use a darkened colour/tile */
3065 a = f_ptr->x_attr[F_LIT_DARK];
3066 c = f_ptr->x_char[F_LIT_DARK];
3070 else if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
3072 /* Use a darkened colour/tile */
3073 a = f_ptr->x_attr[F_LIT_DARK];
3074 c = f_ptr->x_char[F_LIT_DARK];
3077 /* Not glowing correctly */
3078 else if (!have_flag(f_ptr->flags, FF_LOS) && !check_local_illumination(p_ptr, y, x))
3080 /* Use a darkened colour/tile */
3081 a = f_ptr->x_attr[F_LIT_DARK];
3082 c = f_ptr->x_char[F_LIT_DARK];
3091 /* Unsafe grid -- idea borrowed from Unangband */
3092 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
3094 /* Access feature */
3095 f_ptr = &f_info[feat];
3097 /* Normal attr/char */
3098 a = f_ptr->x_attr[F_LIT_STANDARD];
3099 c = f_ptr->x_char[F_LIT_STANDARD];
3103 if (feat_priority == -1) feat_priority = f_ptr->priority;
3105 /* Save the terrain info for the transparency effects */
3113 /* Hack -- rare random hallucination, except on outer dungeon walls */
3118 image_random(ap, cp);
3123 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3126 o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
3127 next_o_idx = o_ptr->next_o_idx;
3129 /* Memorized objects */
3130 if (o_ptr->marked & OM_FOUND)
3132 if (display_autopick)
3136 match_autopick = is_autopick(p_ptr, o_ptr);
3137 if (match_autopick == -1)
3140 act = autopick_list[match_autopick].action;
3142 if ((act & DO_DISPLAY) && (act & display_autopick))
3144 autopick_obj = o_ptr;
3148 match_autopick = -1;
3153 (*cp) = object_char(o_ptr);
3156 (*ap) = object_attr(o_ptr);
3160 /* Hack -- hallucination */
3161 if (p_ptr->image) image_object(ap, cp);
3168 /* Handle monsters */
3169 if (g_ptr->m_idx && display_autopick == 0)
3171 monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
3173 /* Visible monster */
3176 monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
3184 * Monsters with both CHAR_CLEAR and ATTR_CLEAR
3185 * flags are always unseen.
3187 if ((r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR)) == (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR))
3193 image_monster(ap, cp);
3198 /* Monster attr/char */
3202 if (!(r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_SHAPECHANGER | RF1_ATTR_CLEAR
3203 | RF1_ATTR_MULTI | RF1_ATTR_SEMIRAND)))
3205 /* Desired monster attr/char */
3211 * Monsters with both CHAR_CLEAR and ATTR_CLEAR
3212 * flags are always unseen.
3214 else if ((r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR)) == (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR))
3221 /*** Monster's attr ***/
3222 if ((r_ptr->flags1 & RF1_ATTR_CLEAR) && (*ap != TERM_DARK) && !use_graphics)
3227 else if ((r_ptr->flags1 & RF1_ATTR_MULTI) && !use_graphics)
3229 /* Multi-hued attr */
3230 if (r_ptr->flags2 & RF2_ATTR_ANY) *ap = randint1(15);
3231 else switch (randint1(7))
3233 case 1: *ap = TERM_RED; break;
3234 case 2: *ap = TERM_L_RED; break;
3235 case 3: *ap = TERM_WHITE; break;
3236 case 4: *ap = TERM_L_GREEN; break;
3237 case 5: *ap = TERM_BLUE; break;
3238 case 6: *ap = TERM_L_DARK; break;
3239 case 7: *ap = TERM_GREEN; break;
3242 else if ((r_ptr->flags1 & RF1_ATTR_SEMIRAND) && !use_graphics)
3244 /* Use semi-random attr (usually mimics' colors vary) */
3245 *ap = g_ptr->m_idx % 15 + 1;
3253 /*** Monster's char ***/
3254 if ((r_ptr->flags1 & RF1_CHAR_CLEAR) && (*cp != ' ') && !use_graphics)
3259 else if (r_ptr->flags1 & RF1_SHAPECHANGER)
3263 monster_race *tmp_r_ptr = &r_info[randint1(max_r_idx - 1)];
3264 *cp = tmp_r_ptr->x_char;
3265 *ap = tmp_r_ptr->x_attr;
3269 *cp = (one_in_(25) ?
3270 image_object_hack[randint0(sizeof(image_object_hack) - 1)] :
3271 image_monster_hack[randint0(sizeof(image_monster_hack) - 1)]);
3284 /* Handle "player" */
3285 if (player_bold(p_ptr, y, x))
3287 monster_race *r_ptr = &r_info[0];
3288 *ap = r_ptr->x_attr;
3289 *cp = r_ptr->x_char;
3295 static concptr simplify_list[][2] =
3302 {"^Amulet of ", "\""},
3303 {"^Scroll of ", "?"},
3304 {"^Scroll titled ", "?"},
3305 {"^Wand of " , "-"},
3307 {"^Staff of " , "_"},
3308 {"^Potion of ", "!"},
3321 static void display_shortened_item_name(object_type *o_ptr, int y)
3328 object_desc(buf, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NAME_ONLY));
3329 attr = tval_to_attr[o_ptr->tval % 128];
3334 strcpy(buf, _("何か奇妙な物", "something strange"));
3337 for (c = buf; *c; c++)
3340 for (i = 0; simplify_list[i][1]; i++)
3342 concptr org_w = simplify_list[i][0];
3352 if (!strncmp(c, org_w, strlen(org_w)))
3355 concptr tmp = simplify_list[i][1];
3358 tmp = c + strlen(org_w);
3374 if (len + 2 > 12) break;
3381 if (len + 1 > 12) break;
3387 Term_putstr(0, y, 12, attr, buf);
3391 * Display a "small-scale" map of the dungeon in the active Term
3393 void display_map(floor_type *floor_ptr, int *cy, int *cx)
3403 SYMBOL_CODE **bigmc;
3410 /* Save lighting effects */
3411 bool old_view_special_lite = view_special_lite;
3412 bool old_view_granite_lite = view_granite_lite;
3414 TERM_LEN hgt, wid, yrat, xrat;
3416 int **match_autopick_yx;
3417 object_type ***object_autopick_yx;
3419 Term_get_size(&wid, &hgt);
3422 if (use_bigtile) wid /= 2;
3424 yrat = (floor_ptr->height + hgt - 1) / hgt;
3425 xrat = (floor_ptr->width + wid - 1) / wid;
3427 /* Disable lighting effects */
3428 view_special_lite = FALSE;
3429 view_granite_lite = FALSE;
3431 /* Allocate the maps */
3432 C_MAKE(ma, (hgt + 2), TERM_COLOR *);
3433 C_MAKE(mc, (hgt + 2), char_ptr);
3434 C_MAKE(mp, (hgt + 2), byte_ptr);
3435 C_MAKE(match_autopick_yx, (hgt + 2), sint_ptr);
3436 C_MAKE(object_autopick_yx, (hgt + 2), object_type **);
3438 /* Allocate and wipe each line map */
3439 for (y = 0; y < (hgt + 2); y++)
3441 /* Allocate one row each array */
3442 C_MAKE(ma[y], (wid + 2), TERM_COLOR);
3443 C_MAKE(mc[y], (wid + 2), char);
3444 C_MAKE(mp[y], (wid + 2), byte);
3445 C_MAKE(match_autopick_yx[y], (wid + 2), int);
3446 C_MAKE(object_autopick_yx[y], (wid + 2), object_type *);
3448 for (x = 0; x < wid + 2; ++x)
3450 match_autopick_yx[y][x] = -1;
3451 object_autopick_yx[y][x] = NULL;
3454 ma[y][x] = TERM_WHITE;
3462 /* Allocate the maps */
3463 C_MAKE(bigma, (floor_ptr->height + 2), TERM_COLOR *);
3464 C_MAKE(bigmc, (floor_ptr->height + 2), char_ptr);
3465 C_MAKE(bigmp, (floor_ptr->height + 2), byte_ptr);
3467 /* Allocate and wipe each line map */
3468 for (y = 0; y < (floor_ptr->height + 2); y++)
3470 /* Allocate one row each array */
3471 C_MAKE(bigma[y], (floor_ptr->width + 2), TERM_COLOR);
3472 C_MAKE(bigmc[y], (floor_ptr->width + 2), char);
3473 C_MAKE(bigmp[y], (floor_ptr->width + 2), byte);
3475 for (x = 0; x < floor_ptr->width + 2; ++x)
3478 bigma[y][x] = TERM_WHITE;
3486 /* Fill in the map */
3487 for (i = 0; i < floor_ptr->width; ++i)
3489 for (j = 0; j < floor_ptr->height; ++j)
3494 match_autopick = -1;
3495 autopick_obj = NULL;
3498 /* Extract the current attr/char at that map location */
3499 map_info(j, i, &ta, &tc, &ta, &tc);
3501 /* Extract the priority */
3502 tp = (byte_hack)feat_priority;
3504 if (match_autopick != -1
3505 && (match_autopick_yx[y][x] == -1
3506 || match_autopick_yx[y][x] > match_autopick))
3508 match_autopick_yx[y][x] = match_autopick;
3509 object_autopick_yx[y][x] = autopick_obj;
3513 /* Save the char, attr and priority */
3514 bigmc[j + 1][i + 1] = tc;
3515 bigma[j + 1][i + 1] = ta;
3516 bigmp[j + 1][i + 1] = tp;
3520 for (j = 0; j < floor_ptr->height; ++j)
3522 for (i = 0; i < floor_ptr->width; ++i)
3527 tc = bigmc[j + 1][i + 1];
3528 ta = bigma[j + 1][i + 1];
3529 tp = bigmp[j + 1][i + 1];
3531 /* rare feature has more priority */
3537 for (t = 0; t < 8; t++)
3539 if (tc == bigmc[j + 1 + ddy_cdd[t]][i + 1 + ddx_cdd[t]] &&
3540 ta == bigma[j + 1 + ddy_cdd[t]][i + 1 + ddx_cdd[t]])
3550 /* Save the char, attr and priority */
3563 /* Draw the corners */
3564 mc[0][0] = mc[0][x] = mc[y][0] = mc[y][x] = '+';
3566 /* Draw the horizontal edges */
3567 for (x = 1; x <= wid; x++) mc[0][x] = mc[y][x] = '-';
3569 /* Draw the vertical edges */
3570 for (y = 1; y <= hgt; y++) mc[y][0] = mc[y][x] = '|';
3573 /* Display each map line in order */
3574 for (y = 0; y < hgt + 2; ++y)
3576 /* Start a new line */
3577 Term_gotoxy(COL_MAP, y);
3579 /* Display the line */
3580 for (x = 0; x < wid + 2; ++x)
3585 /* Hack -- fake monochrome */
3588 if (current_world_ptr->timewalk_m_idx) ta = TERM_DARK;
3589 else if (IS_INVULN(p_ptr) || p_ptr->timewalk) ta = TERM_WHITE;
3590 else if (p_ptr->wraith_form) ta = TERM_L_DARK;
3593 /* Add the character */
3594 Term_add_bigch(ta, tc);
3599 for (y = 1; y < hgt + 1; ++y)
3601 match_autopick = -1;
3602 for (x = 1; x <= wid; x++) {
3603 if (match_autopick_yx[y][x] != -1 &&
3604 (match_autopick > match_autopick_yx[y][x] ||
3605 match_autopick == -1)) {
3606 match_autopick = match_autopick_yx[y][x];
3607 autopick_obj = object_autopick_yx[y][x];
3611 /* Clear old display */
3612 Term_putstr(0, y, 12, 0, " ");
3614 if (match_autopick != -1)
3616 display_shortened_item_name(autopick_obj, y);
3619 char buf[13] = "\0";
3620 strncpy(buf, autopick_list[match_autopick].name, 12);
3628 /* Player location */
3629 (*cy) = p_ptr->y / yrat + 1 + ROW_MAP;
3631 (*cx) = p_ptr->x / xrat + 1 + COL_MAP;
3633 (*cx) = (p_ptr->x / xrat + 1) * 2 + COL_MAP;
3635 /* Restore lighting effects */
3636 view_special_lite = old_view_special_lite;
3637 view_granite_lite = old_view_granite_lite;
3639 /* Free each line map */
3640 for (y = 0; y < (hgt + 2); y++)
3642 /* Free one row each array */
3643 C_KILL(ma[y], (wid + 2), TERM_COLOR);
3644 C_KILL(mc[y], (wid + 2), SYMBOL_CODE);
3645 C_KILL(mp[y], (wid + 2), byte);
3646 C_KILL(match_autopick_yx[y], (wid + 2), int);
3647 C_KILL(object_autopick_yx[y], (wid + 2), object_type *);
3650 /* Free each line map */
3651 C_KILL(ma, (hgt + 2), TERM_COLOR *);
3652 C_KILL(mc, (hgt + 2), char_ptr);
3653 C_KILL(mp, (hgt + 2), byte_ptr);
3654 C_KILL(match_autopick_yx, (hgt + 2), sint_ptr);
3655 C_KILL(object_autopick_yx, (hgt + 2), object_type **);
3657 /* Free each line map */
3658 for (y = 0; y < (floor_ptr->height + 2); y++)
3660 /* Free one row each array */
3661 C_KILL(bigma[y], (floor_ptr->width + 2), TERM_COLOR);
3662 C_KILL(bigmc[y], (floor_ptr->width + 2), SYMBOL_CODE);
3663 C_KILL(bigmp[y], (floor_ptr->width + 2), byte);
3666 /* Free each line map */
3667 C_KILL(bigma, (floor_ptr->height + 2), TERM_COLOR *);
3668 C_KILL(bigmc, (floor_ptr->height + 2), char_ptr);
3669 C_KILL(bigmp, (floor_ptr->height + 2), byte_ptr);
3674 * Display a "small-scale" map of the dungeon for the player
3676 * Currently, the "player" is displayed on the map.
3678 void do_cmd_view_map(void)
3684 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
3689 display_autopick = 0;
3691 /* Display the map */
3692 display_map(p_ptr->current_floor_ptr, &cy, &cx);
3695 if (max_autopick && !p_ptr->wild_mode)
3697 display_autopick = ITEM_DISPLAY;
3704 int wid, hgt, row_message;
3706 Term_get_size(&wid, &hgt);
3707 row_message = hgt - 1;
3709 put_str(_("何かキーを押してください('M':拾う 'N':放置 'D':M+N 'K':壊すアイテムを表示)",
3710 " Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items."), row_message, 1);
3712 /* Hilite the player */
3713 move_cursor(cy, cx);
3718 flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK);
3720 flag = DONT_AUTOPICK;
3722 flag = DO_AUTODESTROY;
3724 flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK | DONT_AUTOPICK);
3730 if (~display_autopick & flag)
3731 display_autopick |= flag;
3733 display_autopick &= ~flag;
3734 /* Display the map */
3735 display_map(p_ptr->current_floor_ptr, &cy, &cx);
3738 display_autopick = 0;
3743 put_str(_("何かキーを押すとゲームに戻ります", "Hit any key to continue"), 23, 30);
3744 /* Hilite the player */
3745 move_cursor(cy, cx);
3753 * Track a new monster
3755 void health_track(MONSTER_IDX m_idx)
3757 /* Mount monster is already tracked */
3758 if (m_idx && m_idx == p_ptr->riding) return;
3760 /* Track a new guy */
3761 p_ptr->health_who = m_idx;
3763 /* Redraw (later) */
3764 p_ptr->redraw |= (PR_HEALTH);
3769 * Moves the cursor to a given MAP (y,x) location
3771 void move_cursor_relative(int row, int col)
3773 /* Real co-ords convert to screen positions */
3774 row -= panel_row_prt;
3777 Term_gotoxy(panel_col_of(col), row);
3782 * print project path
3784 void prt_path(floor_type *floor_ptr, POSITION y, POSITION x)
3789 byte_hack default_color = TERM_SLATE;
3791 if (!display_path) return;
3792 if (-1 == project_length)
3795 /* Get projection path */
3796 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);
3798 p_ptr->redraw |= (PR_MAP);
3799 handle_stuff(p_ptr);
3802 for (i = 0; i < path_n; i++)
3804 POSITION ny = GRID_Y(path_g[i]);
3805 POSITION nx = GRID_X(path_g[i]);
3806 grid_type *g_ptr = &floor_ptr->grid_array[ny][nx];
3808 if (panel_contains(ny, nx))
3810 TERM_COLOR a = default_color;
3813 TERM_COLOR ta = default_color;
3816 if (g_ptr->m_idx && floor_ptr->m_list[g_ptr->m_idx].ml)
3818 /* Determine what is there */
3819 map_info(ny, nx, &a, &c, &ta, &tc);
3821 if (!IS_ASCII_GRAPHICS(a))
3823 else if (c == '.' && (a == TERM_WHITE || a == TERM_L_WHITE))
3825 else if (a == default_color)
3831 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
3832 else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
3833 else if (p_ptr->wraith_form) a = TERM_L_DARK;
3838 /* Hack -- Queue it */
3839 Term_queue_bigchar(panel_col_of(nx), ny - panel_row_prt, a, c, ta, tc);
3843 if ((g_ptr->info & CAVE_MARK) && !cave_have_flag_grid(g_ptr, FF_PROJECT)) break;
3846 if (nx == x && ny == y) default_color = TERM_L_DARK;
3852 * Hack -- track the given monster race
3854 void monster_race_track(MONRACE_IDX r_idx)
3856 /* Save this monster ID */
3857 p_ptr->monster_race_idx = r_idx;
3859 p_ptr->window |= (PW_MONSTER);
3863 * Hack -- track the given object kind
3865 void object_kind_track(KIND_OBJECT_IDX k_idx)
3867 /* Save this monster ID */
3868 p_ptr->object_kind_idx = k_idx;
3870 p_ptr->window |= (PW_OBJECT);
3875 * @brief 実ゲームプレイ時間を更新する
3877 void update_playtime(void)
3879 /* Check if the game has started */
3880 if (current_world_ptr->start_time != 0)
3882 u32b tmp = (u32b)time(NULL);
3883 current_world_ptr->play_time += (tmp - current_world_ptr->start_time);
3884 current_world_ptr->start_time = tmp;
3889 * Mega-Hack -- Delayed visual update
3890 * Only used if update_view(), update_lite() or update_mon_lite() was called
3892 void delayed_visual_update(floor_type *floor_ptr)
3898 /* Update needed grids */
3899 for (i = 0; i < floor_ptr->redraw_n; i++)
3901 y = floor_ptr->redraw_y[i];
3902 x = floor_ptr->redraw_x[i];
3903 g_ptr = &floor_ptr->grid_array[y][x];
3905 /* Update only needed grids (prevent multiple updating) */
3906 if (!(g_ptr->info & CAVE_REDRAW)) continue;
3908 /* If required, note */
3909 if (g_ptr->info & CAVE_NOTE) note_spot(y, x);
3913 /* Hack -- Visual update of monster on this grid */
3914 if (g_ptr->m_idx) update_monster(p_ptr, g_ptr->m_idx, FALSE);
3916 /* No longer in the array */
3917 g_ptr->info &= ~(CAVE_NOTE | CAVE_REDRAW);
3921 floor_ptr->redraw_n = 0;