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))
53 static int feat_priority; /*!< マップ縮小表示時に表示すべき地形の優先度を保管する */
54 static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
55 static int match_autopick;
56 static object_type *autopick_obj; /*!< 各種自動拾い処理時に使うオブジェクトポインタ */
61 POSITION panel_row_min, panel_row_max;
62 POSITION panel_col_min, panel_col_max;
63 POSITION panel_col_prt, panel_row_prt;
66 * Some screen locations for various display routines
67 * Currently, row 8 and 15 are the only "blank" rows.
68 * That leaves a "border" around the "stat" values.
72 #define COL_RACE 0 /* <race name> */
74 /*#define ROW_CLASS 2 */
75 /*#define COL_CLASS 0 */ /* <class name> */
78 #define COL_TITLE 0 /* <title> or <mode> */
80 /*#define ROW_SEIKAKU 4 */
81 /*#define COL_SEIKAKU 0*/ /* <seikaku> */
84 #define COL_DAY 0 /* day */
86 #define ROW_DUNGEON 22
87 #define COL_DUNGEON 0 /* dungeon */
90 #define COL_LEVEL 0 /* "LEVEL xxxxxx" */
93 #define COL_EXP 0 /* "EXP xxxxxxxx" */
96 #define COL_GOLD 0 /* "AU xxxxxxxxx" */
99 #define COL_EQUIPPY 0 /* equippy chars */
102 #define COL_STAT 0 /* "xxx xxxxxx" */
105 #define COL_AC 0 /* "Cur AC xxxxx" */
111 #define COL_CURHP 0 /* "Cur HP xxxxx" */
114 #define COL_CURSP 0 /* "Cur SP xxxxx" */
116 #define ROW_RIDING_INFO 16
117 #define COL_RIDING_INFO 0 /* "xxxxxxxxxxxx" */
120 #define COL_INFO 0 /* "xxxxxxxxxxxx" */
123 #define COL_CUT 0 /* <cut> */
126 #define COL_STUN 0 /* <stun> */
128 #define ROW_HUNGRY 20
129 #define COL_HUNGRY 0 /* "Weak" / "Hungry" / "Full" / "Gorged" */
132 #define COL_STATE 7 /* <state> */
134 #define ROW_SPEED (-1)
135 #define COL_SPEED (-24) /* "Slow (-NN)" or "Fast (+NN)" */
137 #define ROW_STUDY (-1)
138 #define COL_STUDY (-13) /* "Study" */
140 #define ROW_DEPTH (-1)
141 #define COL_DEPTH (-8) /* "Lev NNN" / "NNNN ft" */
143 #define ROW_STATBAR (-1)
144 #define COL_STATBAR 0
145 #define MAX_COL_STATBAR (-26)
150 * @brief 画面左の能力値表示を行うために指定位置から13キャラ分を空白消去後指定のメッセージを明るい青で描画する /
151 * Print character info at given row, column in a 13 char field
157 static void prt_field(concptr info, TERM_LEN row, TERM_LEN col)
159 /* Dump 13 spaces to clear */
160 c_put_str(TERM_WHITE, " ", row, col);
162 /* Dump the info itself */
163 c_put_str(TERM_L_BLUE, info, row, col);
167 * @brief ゲーム時刻を表示する /
175 /* Dump 13 spaces to clear */
176 c_put_str(TERM_WHITE, " ", ROW_DAY, COL_DAY);
178 extract_day_hour_min(&day, &hour, &min);
180 /* Dump the info itself */
181 if (day < 1000) c_put_str(TERM_WHITE, format(_("%2d日目", "Day%3d"), day), ROW_DAY, COL_DAY);
182 else c_put_str(TERM_WHITE, _("***日目", "Day***"), ROW_DAY, COL_DAY);
184 c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
188 * @brief 現在のマップ名を返す /
189 * @return マップ名の文字列参照ポインタ
191 concptr map_name(void)
193 if (p_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(p_ptr->current_floor_ptr->inside_quest)
194 && (quest[p_ptr->current_floor_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
195 return _("クエスト", "Quest");
196 else if (p_ptr->wild_mode)
197 return _("地上", "Surface");
198 else if (p_ptr->current_floor_ptr->inside_arena)
199 return _("アリーナ", "Arena");
200 else if (p_ptr->phase_out)
201 return _("闘技場", "Monster Arena");
202 else if (!p_ptr->current_floor_ptr->dun_level && p_ptr->town_num)
203 return town_info[p_ptr->town_num].name;
205 return d_name+d_info[p_ptr->dungeon_idx].name;
209 * @brief 現在のマップ名を描画する / Print dungeon
212 static void prt_dungeon(void)
214 concptr dungeon_name;
217 /* Dump 13 spaces to clear */
218 c_put_str(TERM_WHITE, " ", ROW_DUNGEON, COL_DUNGEON);
220 dungeon_name = map_name();
222 col = COL_DUNGEON + 6 - strlen(dungeon_name)/2;
223 if (col < 0) col = 0;
225 /* Dump the info itself */
226 c_put_str(TERM_L_UMBER, format("%s",dungeon_name),
232 * @brief プレイヤー能力値を描画する / Print character stat in given row, column
233 * @param stat 描画するステータスのID
236 static void prt_stat(player_type *creature_ptr, int stat)
240 /* Display "injured" stat */
241 if (creature_ptr->stat_cur[stat] < creature_ptr->stat_max[stat])
243 put_str(stat_names_reduced[stat], ROW_STAT + stat, 0);
244 cnv_stat(creature_ptr->stat_use[stat], tmp);
245 c_put_str(TERM_YELLOW, tmp, ROW_STAT + stat, COL_STAT + 6);
248 /* Display "healthy" stat */
251 put_str(stat_names[stat], ROW_STAT + stat, 0);
252 cnv_stat(creature_ptr->stat_use[stat], tmp);
253 c_put_str(TERM_L_GREEN, tmp, ROW_STAT + stat, COL_STAT + 6);
256 /* Indicate natural maximum */
257 if (creature_ptr->stat_max[stat] == creature_ptr->stat_max_max[stat])
260 /* 日本語にかぶらないように表示位置を変更 */
261 put_str("!", ROW_STAT + stat, 5);
263 put_str("!", ROW_STAT + stat, 3);
271 * 画面下部に表示する状態表示定義ID / Data structure for status bar
273 #define BAR_TSUYOSHI 0 /*!< 下部ステータス表示: オクレ兄さん状態 */
274 #define BAR_HALLUCINATION 1 /*!< 下部ステータス表示: 幻覚 */
275 #define BAR_BLINDNESS 2 /*!< 下部ステータス表示: 盲目 */
276 #define BAR_PARALYZE 3 /*!< 下部ステータス表示: 麻痺 */
277 #define BAR_CONFUSE 4 /*!< 下部ステータス表示: 混乱 */
278 #define BAR_POISONED 5 /*!< 下部ステータス表示: 毒 */
279 #define BAR_AFRAID 6 /*!< 下部ステータス表示: 恐怖 */
280 #define BAR_LEVITATE 7 /*!< 下部ステータス表示: 浮遊 */
281 #define BAR_REFLECTION 8 /*!< 下部ステータス表示: 反射 */
282 #define BAR_PASSWALL 9 /*!< 下部ステータス表示: 壁抜け */
283 #define BAR_WRAITH 10 /*!< 下部ステータス表示: 幽体化 */
284 #define BAR_PROTEVIL 11 /*!< 下部ステータス表示: 対邪悪結界 */
285 #define BAR_KAWARIMI 12 /*!< 下部ステータス表示: 変わり身 */
286 #define BAR_MAGICDEFENSE 13 /*!< 下部ステータス表示: 魔法の鎧 */
287 #define BAR_EXPAND 14 /*!< 下部ステータス表示: 横伸び */
288 #define BAR_STONESKIN 15 /*!< 下部ステータス表示: 石肌化 */
289 #define BAR_MULTISHADOW 16 /*!< 下部ステータス表示: 影分身 */
290 #define BAR_REGMAGIC 17 /*!< 下部ステータス表示: 魔法防御 */
291 #define BAR_ULTIMATE 18 /*!< 下部ステータス表示: 究極の耐性 */
292 #define BAR_INVULN 19 /*!< 下部ステータス表示: 無敵化 */
293 #define BAR_IMMACID 20 /*!< 下部ステータス表示: 酸免疫 */
294 #define BAR_RESACID 21 /*!< 下部ステータス表示: 酸耐性 */
295 #define BAR_IMMELEC 22 /*!< 下部ステータス表示: 電撃免疫 */
296 #define BAR_RESELEC 23 /*!< 下部ステータス表示: 電撃耐性 */
297 #define BAR_IMMFIRE 24 /*!< 下部ステータス表示: 火炎免疫 */
298 #define BAR_RESFIRE 25 /*!< 下部ステータス表示: 火炎耐性 */
299 #define BAR_IMMCOLD 26 /*!< 下部ステータス表示: 冷気免疫 */
300 #define BAR_RESCOLD 27 /*!< 下部ステータス表示: 冷気耐性 */
301 #define BAR_RESPOIS 28 /*!< 下部ステータス表示: 毒耐性 */
302 #define BAR_RESNETH 29 /*!< 下部ステータス表示: 地獄耐性 */
303 #define BAR_RESTIME 30 /*!< 下部ステータス表示: 時間逆転耐性 */
304 #define BAR_DUSTROBE 31 /*!< 下部ステータス表示: 破片オーラ */
305 #define BAR_SHFIRE 32 /*!< 下部ステータス表示: 火炎オーラ */
306 #define BAR_TOUKI 33 /*!< 下部ステータス表示: 闘気 */
307 #define BAR_SHHOLY 34 /*!< 下部ステータス表示: 聖なるオーラ */
308 #define BAR_EYEEYE 35 /*!< 下部ステータス表示: 目には目を */
309 #define BAR_BLESSED 36 /*!< 下部ステータス表示: 祝福 */
310 #define BAR_HEROISM 37 /*!< 下部ステータス表示: 士気高揚 */
311 #define BAR_BERSERK 38 /*!< 下部ステータス表示: 狂戦士化 */
312 #define BAR_ATTKFIRE 39 /*!< 下部ステータス表示: 焼棄スレイ */
313 #define BAR_ATTKCOLD 40 /*!< 下部ステータス表示: 冷凍スレイ */
314 #define BAR_ATTKELEC 41 /*!< 下部ステータス表示: 電撃スレイ */
315 #define BAR_ATTKACID 42 /*!< 下部ステータス表示: 溶解スレイ */
316 #define BAR_ATTKPOIS 43 /*!< 下部ステータス表示: 毒殺スレイ */
317 #define BAR_ATTKCONF 44 /*!< 下部ステータス表示: 混乱打撃 */
318 #define BAR_SENSEUNSEEN 45 /*!< 下部ステータス表示: 透明視 */
319 #define BAR_TELEPATHY 46 /*!< 下部ステータス表示: テレパシー */
320 #define BAR_REGENERATION 47 /*!< 下部ステータス表示: 急回復 */
321 #define BAR_INFRAVISION 48 /*!< 下部ステータス表示: 赤外線視力 */
322 #define BAR_STEALTH 49 /*!< 下部ステータス表示: 隠密 */
323 #define BAR_SUPERSTEALTH 50 /*!< 下部ステータス表示: 超隠密 */
324 #define BAR_RECALL 51 /*!< 下部ステータス表示: 帰還待ち */
325 #define BAR_ALTER 52 /*!< 下部ステータス表示: 現実変容待ち */
326 #define BAR_SHCOLD 53 /*!< 下部ステータス表示: 冷気オーラ */
327 #define BAR_SHELEC 54 /*!< 下部ステータス表示: 電撃オーラ */
328 #define BAR_SHSHADOW 55 /*!< 下部ステータス表示: 影のオーラ */
329 #define BAR_MIGHT 56 /*!< 下部ステータス表示: 腕力強化 */
330 #define BAR_BUILD 57 /*!< 下部ステータス表示: 肉体強化 */
331 #define BAR_ANTIMULTI 58 /*!< 下部ステータス表示: 反増殖 */
332 #define BAR_ANTITELE 59 /*!< 下部ステータス表示: 反テレポート */
333 #define BAR_ANTIMAGIC 60 /*!< 下部ステータス表示: 反魔法 */
334 #define BAR_PATIENCE 61 /*!< 下部ステータス表示: 我慢 */
335 #define BAR_REVENGE 62 /*!< 下部ステータス表示: 宣告 */
336 #define BAR_RUNESWORD 63 /*!< 下部ステータス表示: 魔剣化 */
337 #define BAR_VAMPILIC 64 /*!< 下部ステータス表示: 吸血 */
338 #define BAR_CURE 65 /*!< 下部ステータス表示: 回復 */
339 #define BAR_ESP_EVIL 66 /*!< 下部ステータス表示: 邪悪感知 */
348 {TERM_YELLOW, "つ", "つよし"},
349 {TERM_VIOLET, "幻", "幻覚"},
350 {TERM_L_DARK, "盲", "盲目"},
351 {TERM_RED, "痺", "麻痺"},
352 {TERM_VIOLET, "乱", "混乱"},
353 {TERM_GREEN, "毒", "毒"},
354 {TERM_BLUE, "恐", "恐怖"},
355 {TERM_L_BLUE, "浮", "浮遊"},
356 {TERM_SLATE, "反", "反射"},
357 {TERM_SLATE, "壁", "壁抜け"},
358 {TERM_L_DARK, "幽", "幽体"},
359 {TERM_SLATE, "邪", "防邪"},
360 {TERM_VIOLET, "変", "変わり身"},
361 {TERM_YELLOW, "魔", "魔法鎧"},
362 {TERM_L_UMBER, "伸", "伸び"},
363 {TERM_WHITE, "石", "石肌"},
364 {TERM_L_BLUE, "分", "分身"},
365 {TERM_SLATE, "防", "魔法防御"},
366 {TERM_YELLOW, "究", "究極"},
367 {TERM_YELLOW, "無", "無敵"},
368 {TERM_L_GREEN, "酸", "酸免疫"},
369 {TERM_GREEN, "酸", "耐酸"},
370 {TERM_L_BLUE, "電", "電免疫"},
371 {TERM_BLUE, "電", "耐電"},
372 {TERM_L_RED, "火", "火免疫"},
373 {TERM_RED, "火", "耐火"},
374 {TERM_WHITE, "冷", "冷免疫"},
375 {TERM_SLATE, "冷", "耐冷"},
376 {TERM_GREEN, "毒", "耐毒"},
377 {TERM_L_DARK, "獄", "耐地獄"},
378 {TERM_L_BLUE, "時", "耐時間"},
379 {TERM_L_DARK, "鏡", "鏡オーラ"},
380 {TERM_L_RED, "オ", "火オーラ"},
381 {TERM_WHITE, "闘", "闘気"},
382 {TERM_WHITE, "聖", "聖オーラ"},
383 {TERM_VIOLET, "目", "目には目"},
384 {TERM_WHITE, "祝", "祝福"},
385 {TERM_WHITE, "勇", "勇"},
386 {TERM_RED, "狂", "狂乱"},
387 {TERM_L_RED, "火", "魔剣火"},
388 {TERM_WHITE, "冷", "魔剣冷"},
389 {TERM_L_BLUE, "電", "魔剣電"},
390 {TERM_SLATE, "酸", "魔剣酸"},
391 {TERM_L_GREEN, "毒", "魔剣毒"},
392 {TERM_RED, "乱", "混乱打撃"},
393 {TERM_L_BLUE, "視", "透明視"},
394 {TERM_ORANGE, "テ", "テレパシ"},
395 {TERM_L_BLUE, "回", "回復"},
396 {TERM_L_RED, "赤", "赤外"},
397 {TERM_UMBER, "隠", "隠密"},
398 {TERM_YELLOW, "隠", "超隠密"},
399 {TERM_WHITE, "帰", "帰還"},
400 {TERM_WHITE, "現", "現実変容"},
401 {TERM_WHITE, "オ", "氷オーラ"},
402 {TERM_BLUE, "オ", "電オーラ"},
403 {TERM_L_DARK, "オ", "影オーラ"},
404 {TERM_YELLOW, "腕", "腕力強化"},
405 {TERM_RED, "肉", "肉体強化"},
406 {TERM_L_DARK, "殖", "反増殖"},
407 {TERM_ORANGE, "テ", "反テレポ"},
408 {TERM_RED, "魔", "反魔法"},
409 {TERM_SLATE, "我", "我慢"},
410 {TERM_SLATE, "宣", "宣告"},
411 {TERM_L_DARK, "剣", "魔剣化"},
412 {TERM_RED, "吸", "吸血打撃"},
413 {TERM_WHITE, "回", "回復"},
414 {TERM_L_DARK, "感", "邪悪感知"},
419 {TERM_YELLOW, "Ts", "Tsuyoshi"},
420 {TERM_VIOLET, "Ha", "Halluc"},
421 {TERM_L_DARK, "Bl", "Blind"},
422 {TERM_RED, "Pa", "Paralyzed"},
423 {TERM_VIOLET, "Cf", "Confused"},
424 {TERM_GREEN, "Po", "Poisoned"},
425 {TERM_BLUE, "Af", "Afraid"},
426 {TERM_L_BLUE, "Lv", "Levit"},
427 {TERM_SLATE, "Rf", "Reflect"},
428 {TERM_SLATE, "Pw", "PassWall"},
429 {TERM_L_DARK, "Wr", "Wraith"},
430 {TERM_SLATE, "Ev", "PrtEvl"},
431 {TERM_VIOLET, "Kw", "Kawarimi"},
432 {TERM_YELLOW, "Md", "MgcArm"},
433 {TERM_L_UMBER, "Eh", "Expand"},
434 {TERM_WHITE, "Ss", "StnSkn"},
435 {TERM_L_BLUE, "Ms", "MltShdw"},
436 {TERM_SLATE, "Rm", "ResMag"},
437 {TERM_YELLOW, "Ul", "Ultima"},
438 {TERM_YELLOW, "Iv", "Invuln"},
439 {TERM_L_GREEN, "IAc", "ImmAcid"},
440 {TERM_GREEN, "Ac", "Acid"},
441 {TERM_L_BLUE, "IEl", "ImmElec"},
442 {TERM_BLUE, "El", "Elec"},
443 {TERM_L_RED, "IFi", "ImmFire"},
444 {TERM_RED, "Fi", "Fire"},
445 {TERM_WHITE, "ICo", "ImmCold"},
446 {TERM_SLATE, "Co", "Cold"},
447 {TERM_GREEN, "Po", "Pois"},
448 {TERM_L_DARK, "Nt", "Nthr"},
449 {TERM_L_BLUE, "Ti", "Time"},
450 {TERM_L_DARK, "Mr", "Mirr"},
451 {TERM_L_RED, "SFi", "SFire"},
452 {TERM_WHITE, "Fo", "Force"},
453 {TERM_WHITE, "Ho", "Holy"},
454 {TERM_VIOLET, "Ee", "EyeEye"},
455 {TERM_WHITE, "Bs", "Bless"},
456 {TERM_WHITE, "He", "Hero"},
457 {TERM_RED, "Br", "Berserk"},
458 {TERM_L_RED, "BFi", "BFire"},
459 {TERM_WHITE, "BCo", "BCold"},
460 {TERM_L_BLUE, "BEl", "BElec"},
461 {TERM_SLATE, "BAc", "BAcid"},
462 {TERM_L_GREEN, "BPo", "BPois"},
463 {TERM_RED, "TCf", "TchCnf"},
464 {TERM_L_BLUE, "Se", "SInv"},
465 {TERM_ORANGE, "Te", "Telepa"},
466 {TERM_L_BLUE, "Rg", "Regen"},
467 {TERM_L_RED, "If", "Infr"},
468 {TERM_UMBER, "Sl", "Stealth"},
469 {TERM_YELLOW, "Stlt", "Stealth"},
470 {TERM_WHITE, "Rc", "Recall"},
471 {TERM_WHITE, "Al", "Alter"},
472 {TERM_WHITE, "SCo", "SCold"},
473 {TERM_BLUE, "SEl", "SElec"},
474 {TERM_L_DARK, "SSh", "SShadow"},
475 {TERM_YELLOW, "EMi", "ExMight"},
476 {TERM_RED, "Bu", "BuildUp"},
477 {TERM_L_DARK, "AMl", "AntiMulti"},
478 {TERM_ORANGE, "AT", "AntiTele"},
479 {TERM_RED, "AM", "AntiMagic"},
480 {TERM_SLATE, "Pa", "Patience"},
481 {TERM_SLATE, "Rv", "Revenge"},
482 {TERM_L_DARK, "Rs", "RuneSword"},
483 {TERM_RED, "Vm", "Vampiric"},
484 {TERM_WHITE, "Cu", "Cure"},
485 {TERM_L_DARK, "ET", "EvilTele"},
491 * @brief 32ビット変数配列の指定位置のビットフラグを1にする。
492 * @param FLG フラグ位置(ビット)
495 #define ADD_FLG(FLG) (bar_flags[FLG / 32] |= (1L << (FLG % 32)))
498 * @brief 32ビット変数配列の指定位置のビットフラグが1かどうかを返す。
499 * @param FLG フラグ位置(ビット)
502 #define IS_FLG(FLG) (bar_flags[FLG / 32] & (1L << (FLG % 32)))
506 * @brief 下部に状態表示を行う / Show status bar
509 static void prt_status(player_type *creature_ptr)
511 BIT_FLAGS bar_flags[3];
512 TERM_LEN wid, hgt, row_statbar, max_col_statbar;
514 TERM_LEN col = 0, num = 0;
517 Term_get_size(&wid, &hgt);
518 row_statbar = hgt + ROW_STATBAR;
519 max_col_statbar = wid + MAX_COL_STATBAR;
521 Term_erase(0, row_statbar, max_col_statbar);
523 bar_flags[0] = bar_flags[1] = bar_flags[2] = 0L;
526 if (creature_ptr->tsuyoshi) ADD_FLG(BAR_TSUYOSHI);
529 if (creature_ptr->image) ADD_FLG(BAR_HALLUCINATION);
532 if (creature_ptr->blind) ADD_FLG(BAR_BLINDNESS);
535 if (creature_ptr->paralyzed) ADD_FLG(BAR_PARALYZE);
538 if (creature_ptr->confused) ADD_FLG(BAR_CONFUSE);
541 if (creature_ptr->poisoned) ADD_FLG(BAR_POISONED);
543 /* Times see-invisible */
544 if (creature_ptr->tim_invis) ADD_FLG(BAR_SENSEUNSEEN);
547 if (IS_TIM_ESP()) ADD_FLG(BAR_TELEPATHY);
549 /* Timed regenerate */
550 if (creature_ptr->tim_regen) ADD_FLG(BAR_REGENERATION);
552 /* Timed infra-vision */
553 if (creature_ptr->tim_infra) ADD_FLG(BAR_INFRAVISION);
555 /* Protection from evil */
556 if (creature_ptr->protevil) ADD_FLG(BAR_PROTEVIL);
558 /* Invulnerability */
559 if (IS_INVULN(creature_ptr)) ADD_FLG(BAR_INVULN);
562 if (creature_ptr->wraith_form) ADD_FLG(BAR_WRAITH);
565 if (creature_ptr->kabenuke) ADD_FLG(BAR_PASSWALL);
567 if (creature_ptr->tim_reflect) ADD_FLG(BAR_REFLECTION);
570 if (IS_HERO()) ADD_FLG(BAR_HEROISM);
572 /* Super Heroism / berserk */
573 if (creature_ptr->shero) ADD_FLG(BAR_BERSERK);
576 if (IS_BLESSED()) ADD_FLG(BAR_BLESSED);
579 if (creature_ptr->magicdef) ADD_FLG(BAR_MAGICDEFENSE);
581 if (creature_ptr->tsubureru) ADD_FLG(BAR_EXPAND);
583 if (creature_ptr->shield) ADD_FLG(BAR_STONESKIN);
585 if (creature_ptr->special_defense & NINJA_KAWARIMI) ADD_FLG(BAR_KAWARIMI);
588 if (creature_ptr->special_defense & DEFENSE_ACID) ADD_FLG(BAR_IMMACID);
589 if (IS_OPPOSE_ACID()) ADD_FLG(BAR_RESACID);
591 /* Oppose Lightning */
592 if (creature_ptr->special_defense & DEFENSE_ELEC) ADD_FLG(BAR_IMMELEC);
593 if (IS_OPPOSE_ELEC()) ADD_FLG(BAR_RESELEC);
596 if (creature_ptr->special_defense & DEFENSE_FIRE) ADD_FLG(BAR_IMMFIRE);
597 if (IS_OPPOSE_FIRE()) ADD_FLG(BAR_RESFIRE);
600 if (creature_ptr->special_defense & DEFENSE_COLD) ADD_FLG(BAR_IMMCOLD);
601 if (IS_OPPOSE_COLD()) ADD_FLG(BAR_RESCOLD);
604 if (IS_OPPOSE_POIS()) ADD_FLG(BAR_RESPOIS);
607 if (creature_ptr->word_recall) ADD_FLG(BAR_RECALL);
610 if (creature_ptr->alter_reality) ADD_FLG(BAR_ALTER);
613 if (creature_ptr->afraid) ADD_FLG(BAR_AFRAID);
616 if (creature_ptr->tim_res_time) ADD_FLG(BAR_RESTIME);
618 if (creature_ptr->multishadow) ADD_FLG(BAR_MULTISHADOW);
620 /* Confusing Hands */
621 if (creature_ptr->special_attack & ATTACK_CONFUSE) ADD_FLG(BAR_ATTKCONF);
623 if (creature_ptr->resist_magic) ADD_FLG(BAR_REGMAGIC);
625 /* Ultimate-resistance */
626 if (creature_ptr->ult_res) ADD_FLG(BAR_ULTIMATE);
629 if (creature_ptr->tim_levitation) ADD_FLG(BAR_LEVITATE);
631 if (creature_ptr->tim_res_nether) ADD_FLG(BAR_RESNETH);
633 if (creature_ptr->dustrobe) ADD_FLG(BAR_DUSTROBE);
636 if (creature_ptr->special_attack & ATTACK_FIRE) ADD_FLG(BAR_ATTKFIRE);
637 if (creature_ptr->special_attack & ATTACK_COLD) ADD_FLG(BAR_ATTKCOLD);
638 if (creature_ptr->special_attack & ATTACK_ELEC) ADD_FLG(BAR_ATTKELEC);
639 if (creature_ptr->special_attack & ATTACK_ACID) ADD_FLG(BAR_ATTKACID);
640 if (creature_ptr->special_attack & ATTACK_POIS) ADD_FLG(BAR_ATTKPOIS);
641 if (creature_ptr->special_defense & NINJA_S_STEALTH) ADD_FLG(BAR_SUPERSTEALTH);
643 if (creature_ptr->tim_sh_fire) ADD_FLG(BAR_SHFIRE);
646 if (IS_TIM_STEALTH()) ADD_FLG(BAR_STEALTH);
648 if (creature_ptr->tim_sh_touki) ADD_FLG(BAR_TOUKI);
651 if (creature_ptr->tim_sh_holy) ADD_FLG(BAR_SHHOLY);
653 /* An Eye for an Eye */
654 if (creature_ptr->tim_eyeeye) ADD_FLG(BAR_EYEEYE);
657 if (creature_ptr->realm1 == REALM_HEX)
659 if (hex_spelling(HEX_BLESS)) ADD_FLG(BAR_BLESSED);
660 if (hex_spelling(HEX_DEMON_AURA)) { ADD_FLG(BAR_SHFIRE); ADD_FLG(BAR_REGENERATION); }
661 if (hex_spelling(HEX_XTRA_MIGHT)) ADD_FLG(BAR_MIGHT);
662 if (hex_spelling(HEX_DETECT_EVIL)) ADD_FLG(BAR_ESP_EVIL);
663 if (hex_spelling(HEX_ICE_ARMOR)) ADD_FLG(BAR_SHCOLD);
664 if (hex_spelling(HEX_RUNESWORD)) ADD_FLG(BAR_RUNESWORD);
665 if (hex_spelling(HEX_BUILDING)) ADD_FLG(BAR_BUILD);
666 if (hex_spelling(HEX_ANTI_TELE)) ADD_FLG(BAR_ANTITELE);
667 if (hex_spelling(HEX_SHOCK_CLOAK)) ADD_FLG(BAR_SHELEC);
668 if (hex_spelling(HEX_SHADOW_CLOAK)) ADD_FLG(BAR_SHSHADOW);
669 if (hex_spelling(HEX_CONFUSION)) ADD_FLG(BAR_ATTKCONF);
670 if (hex_spelling(HEX_EYE_FOR_EYE)) ADD_FLG(BAR_EYEEYE);
671 if (hex_spelling(HEX_ANTI_MULTI)) ADD_FLG(BAR_ANTIMULTI);
672 if (hex_spelling(HEX_VAMP_BLADE)) ADD_FLG(BAR_VAMPILIC);
673 if (hex_spelling(HEX_ANTI_MAGIC)) ADD_FLG(BAR_ANTIMAGIC);
674 if (hex_spelling(HEX_CURE_LIGHT) ||
675 hex_spelling(HEX_CURE_SERIOUS) ||
676 hex_spelling(HEX_CURE_CRITICAL)) ADD_FLG(BAR_CURE);
678 if (HEX_REVENGE_TURN(creature_ptr))
680 if (HEX_REVENGE_TYPE(creature_ptr) == 1) ADD_FLG(BAR_PATIENCE);
681 if (HEX_REVENGE_TYPE(creature_ptr) == 2) ADD_FLG(BAR_REVENGE);
685 /* Calcurate length */
686 for (i = 0; bar[i].sstr; i++)
690 col += strlen(bar[i].lstr) + 1;
695 /* If there are not excess spaces for long strings, use short one */
696 if (col - 1 > max_col_statbar)
701 for (i = 0; bar[i].sstr; i++)
705 col += strlen(bar[i].sstr);
709 /* If there are excess spaces for short string, use more */
710 if (col - 1 <= max_col_statbar - (num-1))
718 /* Centering display column */
719 col = (max_col_statbar - col) / 2;
721 /* Display status bar */
722 for (i = 0; bar[i].sstr; i++)
727 if (space == 2) str = bar[i].lstr;
728 else str = bar[i].sstr;
730 c_put_str(bar[i].attr, str, row_statbar, col);
732 if (space > 0) col++;
733 if (col > max_col_statbar) break;
740 * @brief プレイヤーの称号を表示する / Prints "title", including "wizard" or "winner" as needed.
743 static void prt_title(player_type *creature_ptr)
748 if (current_world_ptr->wizard)
750 p = _("[ウィザード]", "[=-WIZARD-=]");
752 else if (creature_ptr->total_winner || (creature_ptr->lev > PY_MAX_LEVEL))
754 if (creature_ptr->arena_number > MAX_ARENA_MONS + 2)
756 p = _("*真・勝利者*", "*TRUEWINNER*");
760 p = _("***勝利者***", "***WINNER***");
767 my_strcpy(str, player_title[creature_ptr->pclass][(creature_ptr->lev - 1) / 5], sizeof(str));
771 prt_field(p, ROW_TITLE, COL_TITLE);
776 * @brief プレイヤーのレベルを表示する / Prints level
779 static void prt_level(player_type *creature_ptr)
782 sprintf(tmp, "%5d", creature_ptr->lev);
783 if (creature_ptr->lev >= creature_ptr->max_plv)
785 put_str(_("レベル ", "LEVEL "), ROW_LEVEL, 0);
786 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 7);
790 put_str(_("xレベル", "Level "), ROW_LEVEL, 0);
791 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 7);
797 * @brief プレイヤーの経験値を表示する / Display the experience
800 static void prt_exp(player_type *creature_ptr)
804 if ((!exp_need)||(creature_ptr->prace == RACE_ANDROID))
806 (void)sprintf(out_val, "%8ld", (long)creature_ptr->exp);
810 if (creature_ptr->lev >= PY_MAX_LEVEL)
812 (void)sprintf(out_val, "********");
816 (void)sprintf(out_val, "%8ld", (long)(player_exp [creature_ptr->lev - 1] * creature_ptr->expfact / 100L) - creature_ptr->exp);
820 if (creature_ptr->exp >= creature_ptr->max_exp)
822 if (creature_ptr->prace == RACE_ANDROID) put_str(_("強化 ", "Cst "), ROW_EXP, 0);
823 else put_str(_("経験 ", "EXP "), ROW_EXP, 0);
824 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 4);
828 put_str(_("x経験", "Exp "), ROW_EXP, 0);
829 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 4);
834 * @brief プレイヤーの所持金を表示する / Prints current gold
837 static void prt_gold(void)
840 put_str(_("$ ", "AU "), ROW_GOLD, COL_GOLD);
841 sprintf(tmp, "%9ld", (long)p_ptr->au);
842 c_put_str(TERM_L_GREEN, tmp, ROW_GOLD, COL_GOLD + 3);
847 * @brief プレイヤーのACを表示する / Prints current AC
850 static void prt_ac(player_type *creature_ptr)
855 /* AC の表示方式を変更している */
856 put_str(" AC( )", ROW_AC, COL_AC);
857 sprintf(tmp, "%5d", creature_ptr->dis_ac + creature_ptr->dis_to_a);
858 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 6);
860 put_str("Cur 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 + 7);
869 * @brief プレイヤーのHPを表示する / Prints Cur/Max hit points
872 static void prt_hp(player_type *creature_ptr)
874 /* ヒットポイントの表示方法を変更 */
880 put_str("HP", ROW_CURHP, COL_CURHP);
883 sprintf(tmp, "%4ld", (long int)creature_ptr->chp);
885 if (creature_ptr->chp >= creature_ptr->mhp)
887 color = TERM_L_GREEN;
889 else if (creature_ptr->chp > (creature_ptr->mhp * hitpoint_warn) / 10)
898 c_put_str(color, tmp, ROW_CURHP, COL_CURHP+3);
901 put_str( "/", ROW_CURHP, COL_CURHP + 7 );
904 sprintf(tmp, "%4ld", (long int)creature_ptr->mhp);
905 color = TERM_L_GREEN;
907 c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
912 * @brief プレイヤーのMPを表示する / Prints players max/cur spell points
915 static void prt_sp(player_type *creature_ptr)
917 /* マジックポイントの表示方法を変更している */
922 /* Do not show mana unless it matters */
923 if (!mp_ptr->spell_book) return;
926 put_str(_("MP", "SP"), ROW_CURSP, COL_CURSP);
929 sprintf(tmp, "%4ld", (long int)creature_ptr->csp);
931 if (creature_ptr->csp >= creature_ptr->msp)
933 color = TERM_L_GREEN;
935 else if (creature_ptr->csp > (creature_ptr->msp * mana_warn) / 10)
944 c_put_str(color, tmp, ROW_CURSP, COL_CURSP+3);
947 put_str( "/", ROW_CURSP, COL_CURSP + 7 );
950 sprintf(tmp, "%4ld", (long int)creature_ptr->msp);
951 color = TERM_L_GREEN;
953 c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
958 * @brief 現在のフロアの深さを表示する / Prints depth in stat area
961 static void prt_depth(void)
964 TERM_LEN wid, hgt, row_depth, col_depth;
965 TERM_COLOR attr = TERM_WHITE;
967 Term_get_size(&wid, &hgt);
968 col_depth = wid + COL_DEPTH;
969 row_depth = hgt + ROW_DEPTH;
971 if (!p_ptr->current_floor_ptr->dun_level)
973 strcpy(depths, _("地上", "Surf."));
975 else if (p_ptr->current_floor_ptr->inside_quest && !p_ptr->dungeon_idx)
977 strcpy(depths, _("地上", "Quest"));
981 if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)p_ptr->current_floor_ptr->dun_level * 50);
982 else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)p_ptr->current_floor_ptr->dun_level);
984 /* Get color of level based on feeling -JSV- */
985 switch (p_ptr->feeling)
987 case 0: attr = TERM_SLATE; break; /* Unknown */
988 case 1: attr = TERM_L_BLUE; break; /* Special */
989 case 2: attr = TERM_VIOLET; break; /* Horrible visions */
990 case 3: attr = TERM_RED; break; /* Very dangerous */
991 case 4: attr = TERM_L_RED; break; /* Very bad feeling */
992 case 5: attr = TERM_ORANGE; break; /* Bad feeling */
993 case 6: attr = TERM_YELLOW; break; /* Nervous */
994 case 7: attr = TERM_L_UMBER; break; /* Luck is turning */
995 case 8: attr = TERM_L_WHITE; break; /* Don't like */
996 case 9: attr = TERM_WHITE; break; /* Reasonably safe */
997 case 10: attr = TERM_WHITE; break; /* Boring place */
1001 /* Right-Adjust the "depth", and clear old values */
1002 c_prt(attr, format("%7s", depths), row_depth, col_depth);
1007 * @brief プレイヤーの空腹状態を表示する / Prints status of hunger
1010 static void prt_hunger(void)
1012 if(current_world_ptr->wizard && p_ptr->current_floor_ptr->inside_arena) return;
1014 /* Fainting / Starving */
1015 if (p_ptr->food < PY_FOOD_FAINT)
1017 c_put_str(TERM_RED, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
1021 else if (p_ptr->food < PY_FOOD_WEAK)
1023 c_put_str(TERM_ORANGE, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
1027 else if (p_ptr->food < PY_FOOD_ALERT)
1029 c_put_str(TERM_YELLOW, _("空腹 ", "Hungry"), ROW_HUNGRY, COL_HUNGRY);
1033 else if (p_ptr->food < PY_FOOD_FULL)
1035 c_put_str(TERM_L_GREEN, " ", ROW_HUNGRY, COL_HUNGRY);
1039 else if (p_ptr->food < PY_FOOD_MAX)
1041 c_put_str(TERM_L_GREEN, _("満腹 ", "Full "), ROW_HUNGRY, COL_HUNGRY);
1047 c_put_str(TERM_GREEN, _("食過ぎ", "Gorged"), ROW_HUNGRY, COL_HUNGRY);
1053 * @brief プレイヤーの行動状態を表示する / Prints Searching, Resting, Paralysis, or 'count' status
1056 * Display is always exactly 10 characters wide (see below)
1057 * This function was a major bottleneck when resting, so a lot of
1058 * the text formatting code was optimized in place below.
1060 static void prt_state(void)
1062 TERM_COLOR attr = TERM_WHITE;
1068 if (command_rep > 999)
1070 (void)sprintf(text, "%2d00", command_rep / 100);
1074 (void)sprintf(text, " %2d", command_rep);
1081 switch(p_ptr->action)
1085 strcpy(text, _("探索", "Sear"));
1089 /* Start with "Rest" */
1090 strcpy(text, _(" ", " "));
1092 if (p_ptr->resting > 0)
1094 sprintf(text, "%4d", p_ptr->resting);
1096 else if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
1098 text[0] = text[1] = text[2] = text[3] = '*';
1100 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
1102 text[0] = text[1] = text[2] = text[3] = '&';
1108 strcpy(text, _("学習", "lear"));
1109 if (p_ptr->new_mane) attr = TERM_L_RED;
1114 strcpy(text, _("釣り", "fish"));
1120 for (i = 0; i < MAX_KAMAE; i++)
1121 if (p_ptr->special_defense & (KAMAE_GENBU << i)) break;
1124 case 0: attr = TERM_GREEN;break;
1125 case 1: attr = TERM_WHITE;break;
1126 case 2: attr = TERM_L_BLUE;break;
1127 case 3: attr = TERM_L_RED;break;
1129 strcpy(text, kamae_shurui[i].desc);
1135 for (i = 0; i < MAX_KATA; i++)
1136 if (p_ptr->special_defense & (KATA_IAI << i)) break;
1137 strcpy(text, kata_shurui[i].desc);
1142 strcpy(text, _("歌 ", "Sing"));
1145 case ACTION_HAYAGAKE:
1147 strcpy(text, _("速駆", "Fast"));
1152 strcpy(text, _("詠唱", "Spel"));
1163 /* Display the info (or blanks) */
1164 c_put_str(attr, format("%5.5s",text), ROW_STATE, COL_STATE);
1169 * @brief プレイヤーの行動速度を表示する / Prints the speed of a character. -CJS-
1172 static void prt_speed(void)
1174 int i = p_ptr->pspeed;
1175 bool is_fast = IS_FAST(p_ptr);
1177 TERM_COLOR attr = TERM_WHITE;
1179 TERM_LEN wid, hgt, row_speed, col_speed;
1181 Term_get_size(&wid, &hgt);
1182 col_speed = wid + COL_SPEED;
1183 row_speed = hgt + ROW_SPEED;
1185 /* Hack -- Visually "undo" the Search Mode Slowdown */
1186 if (p_ptr->action == ACTION_SEARCH && !p_ptr->lightspeed) i += 10;
1193 monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding];
1194 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1195 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1196 else attr = TERM_GREEN;
1198 else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
1199 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1200 else attr = TERM_L_GREEN;
1201 sprintf(buf, "%s(+%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("加速", "Fast")), (i - 110));
1209 monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->riding];
1210 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1211 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1212 else attr = TERM_RED;
1214 else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
1215 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1216 else attr = TERM_L_UMBER;
1217 sprintf(buf, "%s(-%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("減速", "Slow")), (110 - i));
1219 else if (p_ptr->riding)
1222 strcpy(buf, _("乗馬中", "Riding"));
1225 /* Display the speed */
1226 c_put_str(attr, format("%-9s", buf), row_speed, col_speed);
1231 * @brief プレイヤーの呪文学習可能状態を表示する
1234 static void prt_study(void)
1236 TERM_LEN wid, hgt, row_study, col_study;
1238 Term_get_size(&wid, &hgt);
1239 col_study = wid + COL_STUDY;
1240 row_study = hgt + ROW_STUDY;
1242 if (p_ptr->new_spells)
1244 put_str(_("学習", "Stud"), row_study, col_study);
1248 put_str(" ", row_study, col_study);
1254 * @brief プレイヤーのものまね可能状態を表示する
1257 static void prt_imitation(void)
1259 TERM_LEN wid, hgt, row_study, col_study;
1261 Term_get_size(&wid, &hgt);
1262 col_study = wid + COL_STUDY;
1263 row_study = hgt + ROW_STUDY;
1265 if (p_ptr->pclass == CLASS_IMITATOR)
1267 if (p_ptr->mane_num)
1270 if (p_ptr->new_mane) attr = TERM_L_RED;
1271 else attr = TERM_WHITE;
1272 c_put_str(attr, _("まね", "Imit"), row_study, col_study);
1276 put_str(" ", row_study, col_study);
1282 * @brief プレイヤーの負傷状態を表示する
1285 static void prt_cut(player_type *creature_ptr)
1287 int c = creature_ptr->cut;
1291 c_put_str(TERM_L_RED, _("致命傷 ", "Mortal wound"), ROW_CUT, COL_CUT);
1295 c_put_str(TERM_RED, _("ひどい深手 ", "Deep gash "), ROW_CUT, COL_CUT);
1299 c_put_str(TERM_RED, _("重傷 ", "Severe cut "), ROW_CUT, COL_CUT);
1303 c_put_str(TERM_ORANGE, _("大変な傷 ", "Nasty cut "), ROW_CUT, COL_CUT);
1307 c_put_str(TERM_ORANGE, _("ひどい傷 ", "Bad cut "), ROW_CUT, COL_CUT);
1311 c_put_str(TERM_YELLOW, _("軽傷 ", "Light cut "), ROW_CUT, COL_CUT);
1315 c_put_str(TERM_YELLOW, _("かすり傷 ", "Graze "), ROW_CUT, COL_CUT);
1319 put_str(" ", ROW_CUT, COL_CUT);
1325 * @brief プレイヤーの朦朧状態を表示する
1328 static void prt_stun(player_type *creature_ptr)
1330 int s = creature_ptr->stun;
1334 c_put_str(TERM_RED, _("意識不明瞭 ", "Knocked out "), ROW_STUN, COL_STUN);
1338 c_put_str(TERM_ORANGE, _("ひどく朦朧 ", "Heavy stun "), ROW_STUN, COL_STUN);
1342 c_put_str(TERM_ORANGE, _("朦朧 ", "Stun "), ROW_STUN, COL_STUN);
1346 put_str(" ", ROW_STUN, COL_STUN);
1353 * @brief モンスターの体力ゲージを表示する
1354 * @param riding TRUEならば騎乗中のモンスターの体力、FALSEならターゲットモンスターの体力を表示する。表示位置は固定。
1358 * Redraw the "monster health bar" -DRS-
1359 * Rather extensive modifications by -BEN-
1361 * The "monster health bar" provides visual feedback on the "health"
1362 * of the monster currently being "tracked". There are several ways
1363 * to "track" a monster, including targetting it, attacking it, and
1364 * affecting it (and nobody else) with a ranged attack.
1366 * Display the monster health bar (affectionately known as the
1367 * "health-o-meter"). Clear health bar if nothing is being tracked.
1368 * Auto-track current target monster when bored. Note that the
1369 * health-bar stops tracking any monster that "disappears".
1372 static void health_redraw(player_type *creature_ptr, bool riding)
1376 monster_type *m_ptr;
1380 health_who = creature_ptr->riding;
1381 row = ROW_RIDING_INFO;
1382 col = COL_RIDING_INFO;
1386 health_who = creature_ptr->health_who;
1391 m_ptr = &creature_ptr->current_floor_ptr->m_list[health_who];
1393 if (current_world_ptr->wizard && creature_ptr->phase_out)
1398 Term_putstr(col - 2, row, 12, TERM_WHITE, " / ");
1399 Term_putstr(col - 2, row + 1, 12, TERM_WHITE, " / ");
1400 Term_putstr(col - 2, row + 2, 12, TERM_WHITE, " / ");
1401 Term_putstr(col - 2, row + 3, 12, TERM_WHITE, " / ");
1403 if(creature_ptr->current_floor_ptr->m_list[1].r_idx)
1405 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));
1406 Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[1].hp));
1407 Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[1].max_maxhp));
1410 if(creature_ptr->current_floor_ptr->m_list[2].r_idx)
1412 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));
1413 Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[2].hp));
1414 Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[2].max_maxhp));
1417 if(creature_ptr->current_floor_ptr->m_list[3].r_idx)
1419 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));
1420 Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[3].hp));
1421 Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[3].max_maxhp));
1424 if(creature_ptr->current_floor_ptr->m_list[4].r_idx)
1426 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));
1427 Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[4].hp));
1428 Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", creature_ptr->current_floor_ptr->m_list[4].max_maxhp));
1437 /* Erase the health bar */
1438 Term_erase(col, row, 12);
1441 /* Tracking an unseen monster */
1442 else if (!m_ptr->ml)
1444 /* Indicate that the monster health is "unknown" */
1445 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1448 /* Tracking a hallucinatory monster */
1449 else if (creature_ptr->image)
1451 /* Indicate that the monster health is "unknown" */
1452 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1455 /* Tracking a dead monster (???) */
1456 else if (m_ptr->hp < 0)
1458 /* Indicate that the monster health is "unknown" */
1459 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1462 /* Tracking a visible monster */
1465 /* Extract the "percent" of health */
1466 int pct = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->maxhp : 0;
1467 int pct2 = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->max_maxhp: 0;
1469 /* Convert percent into "health" */
1470 int len = (pct2 < 10) ? 1 : (pct2 < 90) ? (pct2 / 10 + 1) : 10;
1472 /* Default to almost dead */
1473 TERM_COLOR attr = TERM_RED;
1476 if (MON_INVULNER(m_ptr)) attr = TERM_WHITE;
1479 else if (MON_CSLEEP(m_ptr)) attr = TERM_BLUE;
1482 else if (MON_MONFEAR(m_ptr)) attr = TERM_VIOLET;
1485 else if (pct >= 100) attr = TERM_L_GREEN;
1487 /* Somewhat Wounded */
1488 else if (pct >= 60) attr = TERM_YELLOW;
1491 else if (pct >= 25) attr = TERM_ORANGE;
1494 else if (pct >= 10) attr = TERM_L_RED;
1496 /* Default to "unknown" */
1497 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1499 /* Dump the current "health" (use '*' symbols) */
1500 Term_putstr(col + 1, row, len, attr, "**********");
1508 * @brief プレイヤーのステータスを一括表示する(左側部分) / Display basic info (mostly left of map)
1511 static void prt_frame_basic(void)
1514 if (p_ptr->mimic_form)
1515 prt_field(mimic_info[p_ptr->mimic_form].title, ROW_RACE, COL_RACE);
1519 my_strcpy(str, rp_ptr->title, sizeof(str));
1520 prt_field(str, ROW_RACE, COL_RACE);
1526 for (i = 0; i < A_MAX; i++) prt_stat(p_ptr, i);
1532 health_redraw(p_ptr, FALSE);
1533 health_redraw(p_ptr, TRUE);
1538 * @brief プレイヤーのステータスを一括表示する(下部分) / Display extra info (mostly below map)
1541 static void prt_frame_extra(void)
1555 * @brief サブウィンドウに所持品一覧を表示する / Hack -- display inventory in sub-windows
1558 static void fix_inven(void)
1563 for (j = 0; j < 8; j++)
1568 if (!angband_term[j]) continue;
1570 /* No relevant flags */
1571 if (!(window_flag[j] & (PW_INVEN))) continue;
1574 Term_activate(angband_term[j]);
1576 display_inven(p_ptr, item_tester_tval);
1584 * @brief モンスターの現在数を一行で表現する / Print monster info in line
1587 * @param m_ptr 思い出を表示するモンスター情報の参照ポインタ
1588 * @param n_same モンスターの数の現在数
1592 * nnn : number or unique(U) or wanted unique(W)
1593 * X : symbol of monster
1594 * LV : monster lv if known
1595 * name: name of monster
1599 static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type* m_ptr, int n_same){
1602 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1603 monster_race* r_ptr = &r_info[r_idx];
1607 //Number of 'U'nique
1608 if(r_ptr->flags1&RF1_UNIQUE){//unique
1609 bool is_kubi = FALSE;
1610 for(i=0;i<MAX_KUBI;i++){
1611 if(current_world_ptr->bounty_r_idx[i] == r_idx){
1616 Term_addstr(-1, TERM_WHITE, is_kubi?" W":" U");
1618 sprintf(buf, "%3d", n_same);
1619 Term_addstr(-1, TERM_WHITE, buf);
1622 Term_addstr(-1, TERM_WHITE, " ");
1623 //Term_add_bigch(r_ptr->d_attr, r_ptr->d_char);
1624 //Term_addstr(-1, TERM_WHITE, "/");
1625 Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
1627 if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){
1628 sprintf(buf, " %2d", (int)r_ptr->level);
1632 Term_addstr(-1, TERM_WHITE, buf);
1634 sprintf(buf, " %s ", r_name+r_ptr->name);
1635 Term_addstr(-1, TERM_WHITE, buf);
1637 //Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0));
1641 * @brief モンスターの出現リストを表示する / Print monster info in line
1644 * @param max_lines 最大何行描画するか
1646 void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
1648 monster_type* last_mons = NULL;
1649 monster_type* m_ptr = NULL;
1653 for(i=0;i<tmp_pos.n;i++){
1654 grid_type* g_ptr = &p_ptr->current_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]];
1655 if(!g_ptr->m_idx || !p_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look
1656 m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
1657 if(is_pet(m_ptr))continue;//pet
1658 if(!m_ptr->r_idx)continue;//dead?
1661 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1662 monster_race* r_ptr = &r_info[r_idx];
1663 concptr name = (r_name + r_ptr->name);
1664 concptr ename = (r_name + r_ptr->name);
1665 //ミミック類や「それ」等は、一覧に出てはいけない
1666 if(r_ptr->flags1&RF1_CHAR_CLEAR)continue;
1667 if((r_ptr->flags1&RF1_NEVER_MOVE)&&(r_ptr->flags2&RF2_CHAR_MULTI))continue;
1669 if((strcmp(name, "生ける虚無『ヌル』")==0)||
1670 (strcmp(ename, "Null the Living Void")==0))continue;
1671 //"金無垢の指輪"は、一覧に出てはいけない
1672 if((strcmp(name, "金無垢の指輪")==0)||
1673 (strcmp(ename, "Plain Gold Ring")==0))continue;
1677 //ソート済みなので同じモンスターは連続する.これを利用して同じモンスターをカウント,まとめて表示する.
1678 if(!last_mons){//先頭モンスター
1684 if(last_mons->ap_r_idx == m_ptr->ap_r_idx){
1686 continue;//表示処理を次に回す
1688 //print last mons info
1689 print_monster_line(x, line++, last_mons, n_same);
1692 if(line-y-1==max_lines){//残り1行
1696 if(line-y-1==max_lines && i!=tmp_pos.n){
1697 Term_gotoxy(x, line);
1698 Term_addstr(-1, TERM_WHITE, "-- and more --");
1700 if(last_mons)print_monster_line(x, line++, last_mons, n_same);
1705 * @brief 出現中モンスターのリストをサブウィンドウに表示する / Hack -- display monster list in sub-windows
1708 static void fix_monster_list(void)
1714 for (j = 0; j < 8; j++)
1719 if (!angband_term[j]) continue;
1721 /* No relevant flags */
1722 if (!(window_flag[j] & (PW_MONSTER_LIST))) continue;
1725 Term_activate(angband_term[j]);
1726 Term_get_size(&w, &h);
1730 target_set_prepare_look();//モンスター一覧を生成,ソート
1731 print_monster_list(0, 0, h);
1740 * @brief 現在の装備品をサブウィンドウに表示する /
1741 * Hack -- display equipment in sub-windows
1744 static void fix_equip(void)
1749 for (j = 0; j < 8; j++)
1754 if (!angband_term[j]) continue;
1756 /* No relevant flags */
1757 if (!(window_flag[j] & (PW_EQUIP))) continue;
1760 Term_activate(angband_term[j]);
1762 /* Display equipment */
1763 display_equip(p_ptr, item_tester_tval);
1771 * @brief 現在の習得済魔法をサブウィンドウに表示する /
1772 * Hack -- display spells in sub-windows
1775 static void fix_spell(void)
1780 for (j = 0; j < 8; j++)
1785 if (!angband_term[j]) continue;
1787 /* No relevant flags */
1788 if (!(window_flag[j] & (PW_SPELL))) continue;
1791 Term_activate(angband_term[j]);
1793 /* Display spell list */
1794 display_spell_list(p_ptr);
1802 * @brief 現在のプレイヤーステータスをサブウィンドウに表示する /
1803 * Hack -- display character in sub-windows
1806 static void fix_player(void)
1811 for (j = 0; j < 8; j++)
1816 if (!angband_term[j]) continue;
1818 /* No relevant flags */
1819 if (!(window_flag[j] & (PW_PLAYER))) continue;
1822 Term_activate(angband_term[j]);
1825 display_player(p_ptr, 0);
1832 * @brief ゲームメッセージ履歴をサブウィンドウに表示する /
1833 * Hack -- display recent messages in sub-windows
1834 * Adjust for width and split messages
1837 static void fix_message(void)
1844 for (j = 0; j < 8; j++)
1849 if (!angband_term[j]) continue;
1851 /* No relevant flags */
1852 if (!(window_flag[j] & (PW_MESSAGE))) continue;
1855 Term_activate(angband_term[j]);
1857 Term_get_size(&w, &h);
1860 for (i = 0; i < h; i++)
1862 /* Dump the message on the appropriate line */
1863 Term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
1866 Term_locate(&x, &y);
1868 /* Clear to end of line */
1869 Term_erase(x, y, 255);
1878 * @brief 簡易マップをサブウィンドウに表示する /
1879 * Hack -- display overhead view in sub-windows
1880 * Adjust for width and split messages
1883 * Note that the "player" symbol does NOT appear on the map.
1885 static void fix_overhead(void)
1891 for (j = 0; j < 8; j++)
1897 if (!angband_term[j]) continue;
1899 /* No relevant flags */
1900 if (!(window_flag[j] & (PW_OVERHEAD))) continue;
1903 Term_activate(angband_term[j]);
1905 /* Full map in too small window is useless */
1906 Term_get_size(&wid, &hgt);
1907 if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2)
1910 display_map(p_ptr->current_floor_ptr, &cy, &cx);
1917 static void display_dungeon(void)
1924 SYMBOL_CODE tc = '\0';
1926 for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++)
1928 for (y = p_ptr->y - Term->hgt / 2 + 1; y <= p_ptr->y + Term->hgt / 2; y++)
1930 if (in_bounds2(p_ptr->current_floor_ptr, y, x))
1932 map_info(y, x, &a, &c, &ta, &tc);
1934 /* Hack -- fake monochrome */
1937 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
1938 else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
1939 else if (p_ptr->wraith_form) a = TERM_L_DARK;
1942 /* Hack -- Queue it */
1943 Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
1947 /* Clear out-of-bound tiles */
1949 /* Access darkness */
1950 feature_type *f_ptr = &f_info[feat_none];
1953 a = f_ptr->x_attr[F_LIT_STANDARD];
1956 c = f_ptr->x_char[F_LIT_STANDARD];
1958 /* Hack -- Queue it */
1959 Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
1966 * @brief ダンジョンの地形をサブウィンドウに表示する /
1967 * Hack -- display dungeon view in sub-windows
1970 static void fix_dungeon(void)
1975 for (j = 0; j < 8; j++)
1980 if (!angband_term[j]) continue;
1982 /* No relevant flags */
1983 if (!(window_flag[j] & (PW_DUNGEON))) continue;
1986 Term_activate(angband_term[j]);
1988 /* Redraw dungeon view */
1997 * @brief モンスターの思い出をサブウィンドウに表示する /
1998 * Hack -- display dungeon view in sub-windows
2001 static void fix_monster(void)
2006 for (j = 0; j < 8; j++)
2011 if (!angband_term[j]) continue;
2013 /* No relevant flags */
2014 if (!(window_flag[j] & (PW_MONSTER))) continue;
2017 Term_activate(angband_term[j]);
2019 /* Display monster race info */
2020 if (p_ptr->monster_race_idx) display_roff(p_ptr->monster_race_idx);
2028 * @brief ベースアイテム情報をサブウィンドウに表示する /
2029 * Hack -- display object recall in sub-windows
2032 static void fix_object(void)
2037 for (j = 0; j < 8; j++)
2042 if (!angband_term[j]) continue;
2044 /* No relevant flags */
2045 if (!(window_flag[j] & (PW_OBJECT))) continue;
2048 Term_activate(angband_term[j]);
2050 /* Display monster race info */
2051 if (p_ptr->object_kind_idx) display_koff(p_ptr->object_kind_idx);
2060 * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 /
2061 * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
2062 * @return 重すぎるならばTRUE
2064 bool is_heavy_shoot(player_type *creature_ptr, object_type *o_ptr)
2066 int hold = adj_str_hold[creature_ptr->stat_ind[A_STR]];
2067 /* It is hard to carholdry a heavy bow */
2068 return (hold < o_ptr->weight / 10);
2073 * @brief redraw のフラグに応じた更新をまとめて行う / Handle "redraw"
2075 * @details 更新処理の対象はゲーム中の全描画処理
2077 void redraw_stuff(player_type *creature_ptr)
2079 if (!creature_ptr->redraw) return;
2081 /* Character is not ready yet, no screen updates */
2082 if (!current_world_ptr->character_generated) return;
2084 /* Character is in "icky" mode, no screen updates */
2085 if (current_world_ptr->character_icky) return;
2087 /* Hack -- clear the screen */
2088 if (creature_ptr->redraw & (PR_WIPE))
2090 creature_ptr->redraw &= ~(PR_WIPE);
2095 if (creature_ptr->redraw & (PR_MAP))
2097 creature_ptr->redraw &= ~(PR_MAP);
2101 if (creature_ptr->redraw & (PR_BASIC))
2103 creature_ptr->redraw &= ~(PR_BASIC);
2104 creature_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
2105 creature_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
2106 creature_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
2107 creature_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
2113 if (creature_ptr->redraw & (PR_EQUIPPY))
2115 creature_ptr->redraw &= ~(PR_EQUIPPY);
2116 print_equippy(); /* To draw / delete equippy chars */
2119 if (creature_ptr->redraw & (PR_MISC))
2121 creature_ptr->redraw &= ~(PR_MISC);
2122 prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
2123 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
2126 if (creature_ptr->redraw & (PR_TITLE))
2128 creature_ptr->redraw &= ~(PR_TITLE);
2129 prt_title(creature_ptr);
2132 if (creature_ptr->redraw & (PR_LEV))
2134 creature_ptr->redraw &= ~(PR_LEV);
2135 prt_level(creature_ptr);
2138 if (creature_ptr->redraw & (PR_EXP))
2140 creature_ptr->redraw &= ~(PR_EXP);
2141 prt_exp(creature_ptr);
2144 if (creature_ptr->redraw & (PR_STATS))
2146 creature_ptr->redraw &= ~(PR_STATS);
2147 prt_stat(creature_ptr, A_STR);
2148 prt_stat(creature_ptr, A_INT);
2149 prt_stat(creature_ptr, A_WIS);
2150 prt_stat(creature_ptr, A_DEX);
2151 prt_stat(creature_ptr, A_CON);
2152 prt_stat(creature_ptr, A_CHR);
2155 if (creature_ptr->redraw & (PR_STATUS))
2157 creature_ptr->redraw &= ~(PR_STATUS);
2158 prt_status(creature_ptr);
2161 if (creature_ptr->redraw & (PR_ARMOR))
2163 creature_ptr->redraw &= ~(PR_ARMOR);
2164 prt_ac(creature_ptr);
2167 if (creature_ptr->redraw & (PR_HP))
2169 creature_ptr->redraw &= ~(PR_HP);
2170 prt_hp(creature_ptr);
2173 if (creature_ptr->redraw & (PR_MANA))
2175 creature_ptr->redraw &= ~(PR_MANA);
2176 prt_sp(creature_ptr);
2179 if (creature_ptr->redraw & (PR_GOLD))
2181 creature_ptr->redraw &= ~(PR_GOLD);
2185 if (creature_ptr->redraw & (PR_DEPTH))
2187 creature_ptr->redraw &= ~(PR_DEPTH);
2191 if (creature_ptr->redraw & (PR_HEALTH))
2193 creature_ptr->redraw &= ~(PR_HEALTH);
2194 health_redraw(creature_ptr, FALSE);
2197 if (creature_ptr->redraw & (PR_UHEALTH))
2199 creature_ptr->redraw &= ~(PR_UHEALTH);
2200 health_redraw(creature_ptr, TRUE);
2203 if (creature_ptr->redraw & (PR_EXTRA))
2205 creature_ptr->redraw &= ~(PR_EXTRA);
2206 creature_ptr->redraw &= ~(PR_CUT | PR_STUN);
2207 creature_ptr->redraw &= ~(PR_HUNGER);
2208 creature_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
2212 if (creature_ptr->redraw & (PR_CUT))
2214 creature_ptr->redraw &= ~(PR_CUT);
2215 prt_cut(creature_ptr);
2218 if (creature_ptr->redraw & (PR_STUN))
2220 creature_ptr->redraw &= ~(PR_STUN);
2221 prt_stun(creature_ptr);
2224 if (creature_ptr->redraw & (PR_HUNGER))
2226 creature_ptr->redraw &= ~(PR_HUNGER);
2230 if (creature_ptr->redraw & (PR_STATE))
2232 creature_ptr->redraw &= ~(PR_STATE);
2236 if (creature_ptr->redraw & (PR_SPEED))
2238 creature_ptr->redraw &= ~(PR_SPEED);
2242 if (creature_ptr->pclass == CLASS_IMITATOR)
2244 if (creature_ptr->redraw & (PR_IMITATION))
2246 creature_ptr->redraw &= ~(PR_IMITATION);
2250 else if (creature_ptr->redraw & (PR_STUDY))
2252 creature_ptr->redraw &= ~(PR_STUDY);
2258 * @brief p_ptr->window のフラグに応じた更新をまとめて行う / Handle "p_ptr->window"
2260 * @details 更新処理の対象はサブウィンドウ全般
2262 void window_stuff(void)
2265 BIT_FLAGS mask = 0L;
2268 if (!p_ptr->window) return;
2271 for (j = 0; j < 8; j++)
2273 /* Save usable flags */
2274 if (angband_term[j]) mask |= window_flag[j];
2277 /* Apply usable flags */
2278 p_ptr->window &= mask;
2281 if (!p_ptr->window) return;
2283 if (p_ptr->window & (PW_INVEN))
2285 p_ptr->window &= ~(PW_INVEN);
2289 /* Display equipment */
2290 if (p_ptr->window & (PW_EQUIP))
2292 p_ptr->window &= ~(PW_EQUIP);
2296 /* Display spell list */
2297 if (p_ptr->window & (PW_SPELL))
2299 p_ptr->window &= ~(PW_SPELL);
2303 /* Display player */
2304 if (p_ptr->window & (PW_PLAYER))
2306 p_ptr->window &= ~(PW_PLAYER);
2310 /* Display monster list */
2311 if (p_ptr->window & (PW_MONSTER_LIST))
2313 p_ptr->window &= ~(PW_MONSTER_LIST);
2317 /* Display overhead view */
2318 if (p_ptr->window & (PW_MESSAGE))
2320 p_ptr->window &= ~(PW_MESSAGE);
2324 /* Display overhead view */
2325 if (p_ptr->window & (PW_OVERHEAD))
2327 p_ptr->window &= ~(PW_OVERHEAD);
2331 /* Display overhead view */
2332 if (p_ptr->window & (PW_DUNGEON))
2334 p_ptr->window &= ~(PW_DUNGEON);
2338 /* Display monster recall */
2339 if (p_ptr->window & (PW_MONSTER))
2341 p_ptr->window &= ~(PW_MONSTER);
2345 /* Display object recall */
2346 if (p_ptr->window & (PW_OBJECT))
2348 p_ptr->window &= ~(PW_OBJECT);
2354 * @brief コンソールのリサイズに合わせてマップを再描画する /
2355 * Map resizing whenever the main term changes size
2358 void resize_map(void)
2360 /* Only if the dungeon exists */
2361 if (!current_world_ptr->character_dungeon) return;
2363 /* Mega-Hack -- no panel yet */
2367 /* Reset the panels */
2368 panel_row_min = p_ptr->current_floor_ptr->height;
2369 panel_col_min = p_ptr->current_floor_ptr->width;
2373 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2374 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2375 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2376 p_ptr->update |= (PU_MONSTERS);
2377 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2384 * Place the cursor on the player
2386 if (can_save) move_cursor_relative(p_ptr->y, p_ptr->x);
2392 * @brief コンソールを再描画する /
2393 * Redraw a term when it is resized
2396 void redraw_window(void)
2398 /* Only if the dungeon exists */
2399 if (!current_world_ptr->character_dungeon) return;
2401 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2402 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2410 * @brief フォーカスを当てるべきマップ描画の基準座標を指定する(サブルーチン)
2411 * @param dy 変更先のフロアY座標
2412 * @param dx 変更先のフロアX座標
2413 * Handle a request to change the current panel
2414 * Return TRUE if the panel was changed.
2415 * Also used in do_cmd_locate
2416 * @return 実際に再描画が必要だった場合TRUEを返す
2418 bool change_panel(POSITION dy, POSITION dx)
2423 get_screen_size(&wid, &hgt);
2425 /* Apply the motion */
2426 y = panel_row_min + dy * hgt / 2;
2427 x = panel_col_min + dx * wid / 2;
2429 /* Verify the row */
2430 if (y > p_ptr->current_floor_ptr->height - hgt) y = p_ptr->current_floor_ptr->height - hgt;
2433 /* Verify the col */
2434 if (x > p_ptr->current_floor_ptr->width - wid) x = p_ptr->current_floor_ptr->width - wid;
2437 /* Handle "changes" */
2438 if ((y != panel_row_min) || (x != panel_col_min))
2440 /* Save the new panel info */
2444 panel_bounds_center();
2446 p_ptr->update |= (PU_MONSTERS);
2447 p_ptr->redraw |= (PR_MAP);
2459 * @brief プレイヤーの装備一覧シンボルを固定位置に表示する
2462 void print_equippy(void)
2464 display_player_equippy(ROW_EQUIPPY, COL_EQUIPPY, 0);
2468 * @brief 現在のコンソール表示の縦横を返す。 /
2469 * Get term size and calculate screen size
2470 * @param wid_p コンソールの表示幅文字数を返す
2471 * @param hgt_p コンソールの表示行数を返す
2474 void get_screen_size(TERM_LEN *wid_p, TERM_LEN *hgt_p)
2476 Term_get_size(wid_p, hgt_p);
2477 *hgt_p -= ROW_MAP + 2;
2478 *wid_p -= COL_MAP + 2;
2479 if (use_bigtile) *wid_p /= 2;
2483 * Calculate panel colum of a location in the map
2485 int panel_col_of(int col)
2487 col -= panel_col_min;
2488 if (use_bigtile) col *= 2;
2493 * Prints the map of the dungeon
2495 * Note that, for efficiency, we contain an "optimized" version
2496 * of both "lite_spot()" and "print_rel()", and that we use the
2497 * "lite_spot()" function to display the player grid, if needed.
2505 POSITION xmin, xmax, ymin, ymax;
2509 Term_get_size(&wid, &hgt);
2511 /* Remove map offset */
2515 /* Access the cursor state */
2516 (void)Term_get_cursor(&v);
2518 /* Hide the cursor */
2519 (void)Term_set_cursor(0);
2522 xmin = (0 < panel_col_min) ? panel_col_min : 0;
2523 xmax = (p_ptr->current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : p_ptr->current_floor_ptr->width - 1;
2524 ymin = (0 < panel_row_min) ? panel_row_min : 0;
2525 ymax = (p_ptr->current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : p_ptr->current_floor_ptr->height - 1;
2527 /* Bottom section of screen */
2528 for (y = 1; y <= ymin - panel_row_prt; y++)
2530 /* Erase the section */
2531 Term_erase(COL_MAP, y, wid);
2534 /* Top section of screen */
2535 for (y = ymax - panel_row_prt; y <= hgt; y++)
2537 /* Erase the section */
2538 Term_erase(COL_MAP, y, wid);
2542 for (y = ymin; y <= ymax; y++)
2544 /* Scan the columns of row "y" */
2545 for (x = xmin; x <= xmax; x++)
2553 /* Determine what is there */
2554 map_info(y, x, &a, &c, &ta, &tc);
2556 /* Hack -- fake monochrome */
2559 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
2560 else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
2561 else if (p_ptr->wraith_form) a = TERM_L_DARK;
2564 /* Efficiency -- Redraw that grid of the map */
2565 Term_queue_bigchar(panel_col_of(x), y - panel_row_prt, a, c, ta, tc);
2569 /* Display player */
2570 lite_spot(p_ptr->y, p_ptr->x);
2572 /* Restore the cursor */
2573 (void)Term_set_cursor(v);
2579 * 一般的にモンスターシンボルとして扱われる記号を定義する(幻覚処理向け) / Hack -- Legal monster codes
2581 static char image_monster_hack[] = \
2582 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2585 * 一般的にオブジェクトシンボルとして扱われる記号を定義する(幻覚処理向け) / Hack -- Legal object codes
2587 static char image_object_hack[] = "?/|\\\"!$()_-=[]{},~";
2590 * @brief モンスターの表示を幻覚状態に差し替える / Mega-Hack -- Hallucinatory monster
2595 static void image_monster(TERM_COLOR *ap, SYMBOL_CODE *cp)
2597 /* Random symbol from set above */
2600 monster_race *r_ptr = &r_info[randint1(max_r_idx - 1)];
2602 *cp = r_ptr->x_char;
2603 *ap = r_ptr->x_attr;
2608 *cp = (one_in_(25) ?
2609 image_object_hack[randint0(sizeof(image_object_hack) - 1)] :
2610 image_monster_hack[randint0(sizeof(image_monster_hack) - 1)]);
2618 * @brief オブジェクトの表示を幻覚状態に差し替える / Hallucinatory object
2623 static void image_object(TERM_COLOR *ap, SYMBOL_CODE *cp)
2627 object_kind *k_ptr = &k_info[randint1(max_k_idx - 1)];
2629 *cp = k_ptr->x_char;
2630 *ap = k_ptr->x_attr;
2634 int n = sizeof(image_object_hack) - 1;
2636 *cp = image_object_hack[randint0(n)];
2645 * @brief オブジェクト&モンスターの表示を幻覚状態に差し替える / Hack -- Random hallucination
2650 static void image_random(TERM_COLOR *ap, SYMBOL_CODE *cp)
2652 /* Normally, assume monsters */
2653 if (randint0(100) < 75)
2655 image_monster(ap, cp);
2658 /* Otherwise, assume objects */
2661 image_object(ap, cp);
2666 * 照明の表現を行うための色合いの関係を{暗闇時, 照明時} で定義する /
2667 * This array lists the effects of "brightness" on various "base" colours.\n
2669 * This is used to do dynamic lighting effects in ascii :-)\n
2670 * At the moment, only the various "floor" tiles are affected.\n
2672 * The layout of the array is [x][0] = light and [x][1] = dark.\n
2674 static TERM_COLOR lighting_colours[16][2] =
2677 {TERM_L_DARK, TERM_DARK},
2680 {TERM_YELLOW, TERM_SLATE},
2683 {TERM_WHITE, TERM_L_DARK},
2686 {TERM_L_UMBER, TERM_UMBER},
2689 {TERM_RED, TERM_RED},
2692 {TERM_L_GREEN, TERM_GREEN},
2695 {TERM_BLUE, TERM_BLUE},
2698 {TERM_L_UMBER, TERM_RED},
2701 {TERM_SLATE, TERM_L_DARK},
2704 {TERM_WHITE, TERM_SLATE},
2707 {TERM_L_RED, TERM_BLUE},
2710 {TERM_YELLOW, TERM_ORANGE},
2713 {TERM_L_RED, TERM_L_RED},
2716 {TERM_L_GREEN, TERM_GREEN},
2719 {TERM_L_BLUE, TERM_L_BLUE},
2722 {TERM_L_UMBER, TERM_UMBER}
2730 void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE f_char[F_LIT_MAX])
2732 TERM_COLOR s_attr = f_attr[F_LIT_STANDARD];
2733 SYMBOL_CODE s_char = f_char[F_LIT_STANDARD];
2736 if (IS_ASCII_GRAPHICS(s_attr)) /* For ASCII */
2738 f_attr[F_LIT_LITE] = lighting_colours[s_attr & 0x0f][0];
2739 f_attr[F_LIT_DARK] = lighting_colours[s_attr & 0x0f][1];
2740 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++) f_char[i] = s_char;
2742 else /* For tile graphics */
2744 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++) f_attr[i] = s_attr;
2745 f_char[F_LIT_LITE] = s_char + 2;
2746 f_char[F_LIT_DARK] = s_char + 1;
2752 * @brief Mコマンドによる縮小マップの表示を行う / Extract the attr/char to display at the given (legal) map location
2754 * Basically, we "paint" the chosen attr/char in several passes, starting\n
2755 * with any known "terrain features" (defaulting to darkness), then adding\n
2756 * any known "objects", and finally, adding any known "monsters". This\n
2757 * is not the fastest method but since most of the calls to this function\n
2758 * are made for grids with no monsters or objects, it is fast enough.\n
2760 * Note that this function, if used on the grid containing the "player",\n
2761 * will return the attr/char of the grid underneath the player, and not\n
2762 * the actual player attr/char itself, allowing a lot of optimization\n
2763 * in various "display" functions.\n
2765 * Note that the "zero" entry in the feature/object/monster arrays are\n
2766 * used to provide "special" attr/char codes, with "monster zero" being\n
2767 * used for the player attr/char, "object zero" being used for the "stack"\n
2768 * attr/char, and "feature zero" being used for the "nothing" attr/char,\n
2769 * though this function makes use of only "feature zero".\n
2771 * Note that monsters can have some "special" flags, including "ATTR_MULTI",\n
2772 * which means their color changes, and "ATTR_CLEAR", which means they take\n
2773 * the color of whatever is under them, and "CHAR_CLEAR", which means that\n
2774 * they take the symbol of whatever is under them. Technically, the flag\n
2775 * "CHAR_MULTI" is supposed to indicate that a monster looks strange when\n
2776 * examined, but this flag is currently ignored.\n
2778 * Currently, we do nothing with multi-hued objects, because there are\n
2779 * not any. If there were, they would have to set "shimmer_objects"\n
2780 * when they were created, and then new "shimmer" code in "dungeon.c"\n
2781 * would have to be created handle the "shimmer" effect, and the code\n
2782 * in floor would have to be updated to create the shimmer effect.\n
2784 * Note the effects of hallucination. Objects always appear as random\n
2785 * "objects", monsters as random "monsters", and normal grids occasionally\n
2786 * appear as random "monsters" or "objects", but note that these random\n
2787 * "monsters" and "objects" are really just "colored ascii symbols".\n
2789 * Note that "floors" and "invisible traps" (and "zero" features) are\n
2790 * drawn as "floors" using a special check for optimization purposes,\n
2791 * and these are the only features which get drawn using the special\n
2792 * lighting effects activated by "view_special_lite".\n
2794 * Note the use of the "mimic" field in the "terrain feature" processing,\n
2795 * which allows any feature to "pretend" to be another feature. This is\n
2796 * used to "hide" secret doors, and to make all "doors" appear the same,\n
2797 * and all "walls" appear the same, and "hidden" treasure stay hidden.\n
2798 * It is possible to use this field to make a feature "look" like a floor,\n
2799 * but the "special lighting effects" for floors will not be used.\n
2801 * Note the use of the new "terrain feature" information. Note that the\n
2802 * assumption that all interesting "objects" and "terrain features" are\n
2803 * memorized allows extremely optimized processing below. Note the use\n
2804 * of separate flags on objects to mark them as memorized allows a grid\n
2805 * to have memorized "terrain" without granting knowledge of any object\n
2806 * which may appear in that grid.\n
2808 * Note the efficient code used to determine if a "floor" grid is\n
2809 * "memorized" or "viewable" by the player, where the test for the\n
2810 * grid being "viewable" is based on the facts that (1) the grid\n
2811 * must be "lit" (torch-lit or perma-lit), (2) the grid must be in\n
2812 * line of sight, and (3) the player must not be blind, and uses the\n
2813 * assumption that all torch-lit grids are in line of sight.\n
2815 * Note that floors (and invisible traps) are the only grids which are\n
2816 * not memorized when seen, so only these grids need to check to see if\n
2817 * the grid is "viewable" to the player (if it is not memorized). Since\n
2818 * most non-memorized grids are in fact walls, this induces *massive*\n
2819 * efficiency, at the cost of *forcing* the memorization of non-floor\n
2820 * grids when they are first seen. Note that "invisible traps" are\n
2821 * always treated exactly like "floors", which prevents "cheating".\n
2823 * Note the "special lighting effects" which can be activated for floor\n
2824 * grids using the "view_special_lite" option (for "white" floor grids),\n
2825 * causing certain grids to be displayed using special colors. If the\n
2826 * player is "blind", we will use "dark gray", else if the grid is lit\n
2827 * by the torch, and the "view_yellow_lite" option is set, we will use\n
2828 * "yellow", else if the grid is "dark", we will use "dark gray", else\n
2829 * if the grid is not "viewable", and the "view_bright_lite" option is\n
2830 * set, and the we will use "slate" (gray). We will use "white" for all\n
2831 * other cases, in particular, for illuminated viewable floor grids.\n
2833 * Note the "special lighting effects" which can be activated for wall\n
2834 * grids using the "view_granite_lite" option (for "white" wall grids),\n
2835 * causing certain grids to be displayed using special colors. If the\n
2836 * player is "blind", we will use "dark gray", else if the grid is lit\n
2837 * by the torch, and the "view_yellow_lite" option is set, we will use\n
2838 * "yellow", else if the "view_bright_lite" option is set, and the grid\n
2839 * is not "viewable", or is "dark", or is glowing, but not when viewed\n
2840 * from the player's current location, we will use "slate" (gray). We\n
2841 * will use "white" for all other cases, in particular, for correctly\n
2842 * illuminated viewable wall grids.\n
2844 * Note that, when "view_granite_lite" is set, we use an inline version\n
2845 * of the "player_can_see_bold()" function to check the "viewability" of\n
2846 * grids when the "view_bright_lite" option is set, and we do NOT use\n
2847 * any special colors for "dark" wall grids, since this would allow the\n
2848 * player to notice the walls of illuminated rooms from a hallway that\n
2849 * happened to run beside the room. The alternative, by the way, would\n
2850 * be to prevent the generation of hallways next to rooms, but this\n
2851 * would still allow problems when digging towards a room.\n
2853 * Note that bizarre things must be done when the "attr" and/or "char"\n
2854 * codes have the "high-bit" set, since these values are used to encode\n
2855 * various "special" pictures in some versions, and certain situations,\n
2856 * such as "multi-hued" or "clear" monsters, cause the attr/char codes\n
2857 * to be "scrambled" in various ways.\n
2859 * Note that eventually we may use the "&" symbol for embedded treasure,\n
2860 * and use the "*" symbol to indicate multiple objects, though this will\n
2861 * have to wait for Angband 2.8.0 or later. Note that currently, this\n
2862 * is not important, since only one object or terrain feature is allowed\n
2863 * in each grid. If needed, "k_info[0]" will hold the "stack" attr/char.\n
2865 * Note the assumption that doing "x_ptr = &x_info[x]" plus a few of\n
2866 * "x_ptr->xxx", is quicker than "x_info[x].xxx", if this is incorrect\n
2867 * then a whole lot of code should be changed... XXX XXX\n
2869 void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLOR *tap, SYMBOL_CODE *tcp)
2871 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
2873 OBJECT_IDX this_o_idx, next_o_idx = 0;
2875 /* Feature code (applying "mimic" field) */
2876 FEAT_IDX feat = get_feat_mimic(g_ptr);
2879 feature_type *f_ptr = &f_info[feat];
2884 /* Boring grids (floors, etc) */
2885 if (!have_flag(f_ptr->flags, FF_REMEMBER))
2888 * Handle Memorized or visible floor
2890 * No visual when blinded.
2891 * (to prevent strange effects on darkness breath)
2893 * - Can see grids with CAVE_MARK.
2894 * - Can see grids with CAVE_LITE or CAVE_MNLT.
2895 * (Such grids also have CAVE_VIEW)
2896 * - Can see grids with CAVE_VIEW unless darkened by monsters.
2898 if (!p_ptr->blind &&
2899 ((g_ptr->info & (CAVE_MARK | CAVE_LITE | CAVE_MNLT)) ||
2900 ((g_ptr->info & CAVE_VIEW) && (((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) || p_ptr->see_nocto))))
2902 /* Normal attr/char */
2903 a = f_ptr->x_attr[F_LIT_STANDARD];
2904 c = f_ptr->x_char[F_LIT_STANDARD];
2906 if (p_ptr->wild_mode)
2908 /* Special lighting effects */
2909 /* Handle "night" */
2910 if (view_special_lite && !is_daytime())
2912 /* Use a darkened colour/tile */
2913 a = f_ptr->x_attr[F_LIT_DARK];
2914 c = f_ptr->x_char[F_LIT_DARK];
2918 /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
2919 else if (darkened_grid(g_ptr))
2921 /* Unsafe grid -- idea borrowed from Unangband */
2922 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
2924 /* Access darkness */
2925 f_ptr = &f_info[feat];
2927 /* Char and attr of darkness */
2928 a = f_ptr->x_attr[F_LIT_STANDARD];
2929 c = f_ptr->x_char[F_LIT_STANDARD];
2932 /* Special lighting effects */
2933 else if (view_special_lite)
2935 /* Handle "torch-lit" grids */
2936 if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
2939 if (view_yellow_lite)
2941 /* Use a brightly lit colour/tile */
2942 a = f_ptr->x_attr[F_LIT_LITE];
2943 c = f_ptr->x_char[F_LIT_LITE];
2947 /* Handle "dark" grids */
2948 else if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
2950 /* Use a darkened colour/tile */
2951 a = f_ptr->x_attr[F_LIT_DARK];
2952 c = f_ptr->x_char[F_LIT_DARK];
2955 /* Handle "out-of-sight" grids */
2956 else if (!(g_ptr->info & CAVE_VIEW))
2959 if (view_bright_lite)
2961 /* Use a darkened colour/tile */
2962 a = f_ptr->x_attr[F_LIT_DARK];
2963 c = f_ptr->x_char[F_LIT_DARK];
2972 /* Unsafe grid -- idea borrowed from Unangband */
2973 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
2975 /* Access darkness */
2976 f_ptr = &f_info[feat];
2978 /* Normal attr/char */
2979 a = f_ptr->x_attr[F_LIT_STANDARD];
2980 c = f_ptr->x_char[F_LIT_STANDARD];
2984 /* Interesting grids (non-floors) */
2987 /* Memorized grids */
2988 if (g_ptr->info & CAVE_MARK)
2990 /* Normal attr/char */
2991 a = f_ptr->x_attr[F_LIT_STANDARD];
2992 c = f_ptr->x_char[F_LIT_STANDARD];
2994 if (p_ptr->wild_mode)
2996 /* Special lighting effects */
2997 /* Handle "blind" or "night" */
2998 if (view_granite_lite && (p_ptr->blind || !is_daytime()))
3000 /* Use a darkened colour/tile */
3001 a = f_ptr->x_attr[F_LIT_DARK];
3002 c = f_ptr->x_char[F_LIT_DARK];
3006 /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
3007 else if (darkened_grid(g_ptr) && !p_ptr->blind)
3009 if (have_flag(f_ptr->flags, FF_LOS) && have_flag(f_ptr->flags, FF_PROJECT))
3011 /* Unsafe grid -- idea borrowed from Unangband */
3012 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
3014 /* Access darkness */
3015 f_ptr = &f_info[feat];
3017 /* Char and attr of darkness */
3018 a = f_ptr->x_attr[F_LIT_STANDARD];
3019 c = f_ptr->x_char[F_LIT_STANDARD];
3021 else if (view_granite_lite && view_bright_lite)
3023 /* Use a darkened colour/tile */
3024 a = f_ptr->x_attr[F_LIT_DARK];
3025 c = f_ptr->x_char[F_LIT_DARK];
3029 /* Special lighting effects */
3030 else if (view_granite_lite)
3032 /* Handle "blind" */
3035 /* Use a darkened colour/tile */
3036 a = f_ptr->x_attr[F_LIT_DARK];
3037 c = f_ptr->x_char[F_LIT_DARK];
3040 /* Handle "torch-lit" grids */
3041 else if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
3044 if (view_yellow_lite)
3046 /* Use a brightly lit colour/tile */
3047 a = f_ptr->x_attr[F_LIT_LITE];
3048 c = f_ptr->x_char[F_LIT_LITE];
3052 /* Handle "view_bright_lite" */
3053 else if (view_bright_lite)
3056 if (!(g_ptr->info & CAVE_VIEW))
3058 /* Use a darkened colour/tile */
3059 a = f_ptr->x_attr[F_LIT_DARK];
3060 c = f_ptr->x_char[F_LIT_DARK];
3064 else if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
3066 /* Use a darkened colour/tile */
3067 a = f_ptr->x_attr[F_LIT_DARK];
3068 c = f_ptr->x_char[F_LIT_DARK];
3071 /* Not glowing correctly */
3072 else if (!have_flag(f_ptr->flags, FF_LOS) && !check_local_illumination(p_ptr, y, x))
3074 /* Use a darkened colour/tile */
3075 a = f_ptr->x_attr[F_LIT_DARK];
3076 c = f_ptr->x_char[F_LIT_DARK];
3085 /* Unsafe grid -- idea borrowed from Unangband */
3086 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
3088 /* Access feature */
3089 f_ptr = &f_info[feat];
3091 /* Normal attr/char */
3092 a = f_ptr->x_attr[F_LIT_STANDARD];
3093 c = f_ptr->x_char[F_LIT_STANDARD];
3097 if (feat_priority == -1) feat_priority = f_ptr->priority;
3099 /* Save the terrain info for the transparency effects */
3107 /* Hack -- rare random hallucination, except on outer dungeon walls */
3112 image_random(ap, cp);
3117 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3120 o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
3121 next_o_idx = o_ptr->next_o_idx;
3123 /* Memorized objects */
3124 if (o_ptr->marked & OM_FOUND)
3126 if (display_autopick)
3130 match_autopick = is_autopick(o_ptr);
3131 if (match_autopick == -1)
3134 act = autopick_list[match_autopick].action;
3136 if ((act & DO_DISPLAY) && (act & display_autopick))
3138 autopick_obj = o_ptr;
3142 match_autopick = -1;
3147 (*cp) = object_char(o_ptr);
3150 (*ap) = object_attr(o_ptr);
3154 /* Hack -- hallucination */
3155 if (p_ptr->image) image_object(ap, cp);
3162 /* Handle monsters */
3163 if (g_ptr->m_idx && display_autopick == 0)
3165 monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
3167 /* Visible monster */
3170 monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
3178 * Monsters with both CHAR_CLEAR and ATTR_CLEAR
3179 * flags are always unseen.
3181 if ((r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR)) == (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR))
3187 image_monster(ap, cp);
3192 /* Monster attr/char */
3196 if (!(r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_SHAPECHANGER | RF1_ATTR_CLEAR
3197 | RF1_ATTR_MULTI | RF1_ATTR_SEMIRAND)))
3199 /* Desired monster attr/char */
3205 * Monsters with both CHAR_CLEAR and ATTR_CLEAR
3206 * flags are always unseen.
3208 else if ((r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR)) == (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR))
3215 /*** Monster's attr ***/
3216 if ((r_ptr->flags1 & RF1_ATTR_CLEAR) && (*ap != TERM_DARK) && !use_graphics)
3221 else if ((r_ptr->flags1 & RF1_ATTR_MULTI) && !use_graphics)
3223 /* Multi-hued attr */
3224 if (r_ptr->flags2 & RF2_ATTR_ANY) *ap = randint1(15);
3225 else switch (randint1(7))
3227 case 1: *ap = TERM_RED; break;
3228 case 2: *ap = TERM_L_RED; break;
3229 case 3: *ap = TERM_WHITE; break;
3230 case 4: *ap = TERM_L_GREEN; break;
3231 case 5: *ap = TERM_BLUE; break;
3232 case 6: *ap = TERM_L_DARK; break;
3233 case 7: *ap = TERM_GREEN; break;
3236 else if ((r_ptr->flags1 & RF1_ATTR_SEMIRAND) && !use_graphics)
3238 /* Use semi-random attr (usually mimics' colors vary) */
3239 *ap = g_ptr->m_idx % 15 + 1;
3247 /*** Monster's char ***/
3248 if ((r_ptr->flags1 & RF1_CHAR_CLEAR) && (*cp != ' ') && !use_graphics)
3253 else if (r_ptr->flags1 & RF1_SHAPECHANGER)
3257 monster_race *tmp_r_ptr = &r_info[randint1(max_r_idx - 1)];
3258 *cp = tmp_r_ptr->x_char;
3259 *ap = tmp_r_ptr->x_attr;
3263 *cp = (one_in_(25) ?
3264 image_object_hack[randint0(sizeof(image_object_hack) - 1)] :
3265 image_monster_hack[randint0(sizeof(image_monster_hack) - 1)]);
3278 /* Handle "player" */
3279 if (player_bold(p_ptr, y, x))
3281 monster_race *r_ptr = &r_info[0];
3282 *ap = r_ptr->x_attr;
3283 *cp = r_ptr->x_char;
3289 static concptr simplify_list[][2] =
3296 {"^Amulet of ", "\""},
3297 {"^Scroll of ", "?"},
3298 {"^Scroll titled ", "?"},
3299 {"^Wand of " , "-"},
3301 {"^Staff of " , "_"},
3302 {"^Potion of ", "!"},
3315 static void display_shortened_item_name(object_type *o_ptr, int y)
3322 object_desc(buf, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NAME_ONLY));
3323 attr = tval_to_attr[o_ptr->tval % 128];
3328 strcpy(buf, _("何か奇妙な物", "something strange"));
3331 for (c = buf; *c; c++)
3334 for (i = 0; simplify_list[i][1]; i++)
3336 concptr org_w = simplify_list[i][0];
3346 if (!strncmp(c, org_w, strlen(org_w)))
3349 concptr tmp = simplify_list[i][1];
3352 tmp = c + strlen(org_w);
3368 if (len + 2 > 12) break;
3375 if (len + 1 > 12) break;
3381 Term_putstr(0, y, 12, attr, buf);
3385 * Display a "small-scale" map of the dungeon in the active Term
3387 void display_map(floor_type *floor_ptr, int *cy, int *cx)
3397 SYMBOL_CODE **bigmc;
3404 /* Save lighting effects */
3405 bool old_view_special_lite = view_special_lite;
3406 bool old_view_granite_lite = view_granite_lite;
3408 TERM_LEN hgt, wid, yrat, xrat;
3410 int **match_autopick_yx;
3411 object_type ***object_autopick_yx;
3413 Term_get_size(&wid, &hgt);
3416 if (use_bigtile) wid /= 2;
3418 yrat = (floor_ptr->height + hgt - 1) / hgt;
3419 xrat = (floor_ptr->width + wid - 1) / wid;
3421 /* Disable lighting effects */
3422 view_special_lite = FALSE;
3423 view_granite_lite = FALSE;
3425 /* Allocate the maps */
3426 C_MAKE(ma, (hgt + 2), TERM_COLOR *);
3427 C_MAKE(mc, (hgt + 2), char_ptr);
3428 C_MAKE(mp, (hgt + 2), byte_ptr);
3429 C_MAKE(match_autopick_yx, (hgt + 2), sint_ptr);
3430 C_MAKE(object_autopick_yx, (hgt + 2), object_type **);
3432 /* Allocate and wipe each line map */
3433 for (y = 0; y < (hgt + 2); y++)
3435 /* Allocate one row each array */
3436 C_MAKE(ma[y], (wid + 2), TERM_COLOR);
3437 C_MAKE(mc[y], (wid + 2), char);
3438 C_MAKE(mp[y], (wid + 2), byte);
3439 C_MAKE(match_autopick_yx[y], (wid + 2), int);
3440 C_MAKE(object_autopick_yx[y], (wid + 2), object_type *);
3442 for (x = 0; x < wid + 2; ++x)
3444 match_autopick_yx[y][x] = -1;
3445 object_autopick_yx[y][x] = NULL;
3448 ma[y][x] = TERM_WHITE;
3456 /* Allocate the maps */
3457 C_MAKE(bigma, (floor_ptr->height + 2), TERM_COLOR *);
3458 C_MAKE(bigmc, (floor_ptr->height + 2), char_ptr);
3459 C_MAKE(bigmp, (floor_ptr->height + 2), byte_ptr);
3461 /* Allocate and wipe each line map */
3462 for (y = 0; y < (floor_ptr->height + 2); y++)
3464 /* Allocate one row each array */
3465 C_MAKE(bigma[y], (floor_ptr->width + 2), TERM_COLOR);
3466 C_MAKE(bigmc[y], (floor_ptr->width + 2), char);
3467 C_MAKE(bigmp[y], (floor_ptr->width + 2), byte);
3469 for (x = 0; x < floor_ptr->width + 2; ++x)
3472 bigma[y][x] = TERM_WHITE;
3480 /* Fill in the map */
3481 for (i = 0; i < floor_ptr->width; ++i)
3483 for (j = 0; j < floor_ptr->height; ++j)
3488 match_autopick = -1;
3489 autopick_obj = NULL;
3492 /* Extract the current attr/char at that map location */
3493 map_info(j, i, &ta, &tc, &ta, &tc);
3495 /* Extract the priority */
3496 tp = (byte_hack)feat_priority;
3498 if (match_autopick != -1
3499 && (match_autopick_yx[y][x] == -1
3500 || match_autopick_yx[y][x] > match_autopick))
3502 match_autopick_yx[y][x] = match_autopick;
3503 object_autopick_yx[y][x] = autopick_obj;
3507 /* Save the char, attr and priority */
3508 bigmc[j + 1][i + 1] = tc;
3509 bigma[j + 1][i + 1] = ta;
3510 bigmp[j + 1][i + 1] = tp;
3514 for (j = 0; j < floor_ptr->height; ++j)
3516 for (i = 0; i < floor_ptr->width; ++i)
3521 tc = bigmc[j + 1][i + 1];
3522 ta = bigma[j + 1][i + 1];
3523 tp = bigmp[j + 1][i + 1];
3525 /* rare feature has more priority */
3531 for (t = 0; t < 8; t++)
3533 if (tc == bigmc[j + 1 + ddy_cdd[t]][i + 1 + ddx_cdd[t]] &&
3534 ta == bigma[j + 1 + ddy_cdd[t]][i + 1 + ddx_cdd[t]])
3544 /* Save the char, attr and priority */
3557 /* Draw the corners */
3558 mc[0][0] = mc[0][x] = mc[y][0] = mc[y][x] = '+';
3560 /* Draw the horizontal edges */
3561 for (x = 1; x <= wid; x++) mc[0][x] = mc[y][x] = '-';
3563 /* Draw the vertical edges */
3564 for (y = 1; y <= hgt; y++) mc[y][0] = mc[y][x] = '|';
3567 /* Display each map line in order */
3568 for (y = 0; y < hgt + 2; ++y)
3570 /* Start a new line */
3571 Term_gotoxy(COL_MAP, y);
3573 /* Display the line */
3574 for (x = 0; x < wid + 2; ++x)
3579 /* Hack -- fake monochrome */
3582 if (current_world_ptr->timewalk_m_idx) ta = TERM_DARK;
3583 else if (IS_INVULN(p_ptr) || p_ptr->timewalk) ta = TERM_WHITE;
3584 else if (p_ptr->wraith_form) ta = TERM_L_DARK;
3587 /* Add the character */
3588 Term_add_bigch(ta, tc);
3593 for (y = 1; y < hgt + 1; ++y)
3595 match_autopick = -1;
3596 for (x = 1; x <= wid; x++) {
3597 if (match_autopick_yx[y][x] != -1 &&
3598 (match_autopick > match_autopick_yx[y][x] ||
3599 match_autopick == -1)) {
3600 match_autopick = match_autopick_yx[y][x];
3601 autopick_obj = object_autopick_yx[y][x];
3605 /* Clear old display */
3606 Term_putstr(0, y, 12, 0, " ");
3608 if (match_autopick != -1)
3610 display_shortened_item_name(autopick_obj, y);
3613 char buf[13] = "\0";
3614 strncpy(buf, autopick_list[match_autopick].name, 12);
3622 /* Player location */
3623 (*cy) = p_ptr->y / yrat + 1 + ROW_MAP;
3625 (*cx) = p_ptr->x / xrat + 1 + COL_MAP;
3627 (*cx) = (p_ptr->x / xrat + 1) * 2 + COL_MAP;
3629 /* Restore lighting effects */
3630 view_special_lite = old_view_special_lite;
3631 view_granite_lite = old_view_granite_lite;
3633 /* Free each line map */
3634 for (y = 0; y < (hgt + 2); y++)
3636 /* Free one row each array */
3637 C_KILL(ma[y], (wid + 2), TERM_COLOR);
3638 C_KILL(mc[y], (wid + 2), SYMBOL_CODE);
3639 C_KILL(mp[y], (wid + 2), byte);
3640 C_KILL(match_autopick_yx[y], (wid + 2), int);
3641 C_KILL(object_autopick_yx[y], (wid + 2), object_type *);
3644 /* Free each line map */
3645 C_KILL(ma, (hgt + 2), TERM_COLOR *);
3646 C_KILL(mc, (hgt + 2), char_ptr);
3647 C_KILL(mp, (hgt + 2), byte_ptr);
3648 C_KILL(match_autopick_yx, (hgt + 2), sint_ptr);
3649 C_KILL(object_autopick_yx, (hgt + 2), object_type **);
3651 /* Free each line map */
3652 for (y = 0; y < (floor_ptr->height + 2); y++)
3654 /* Free one row each array */
3655 C_KILL(bigma[y], (floor_ptr->width + 2), TERM_COLOR);
3656 C_KILL(bigmc[y], (floor_ptr->width + 2), SYMBOL_CODE);
3657 C_KILL(bigmp[y], (floor_ptr->width + 2), byte);
3660 /* Free each line map */
3661 C_KILL(bigma, (floor_ptr->height + 2), TERM_COLOR *);
3662 C_KILL(bigmc, (floor_ptr->height + 2), char_ptr);
3663 C_KILL(bigmp, (floor_ptr->height + 2), byte_ptr);
3668 * Display a "small-scale" map of the dungeon for the player
3670 * Currently, the "player" is displayed on the map.
3672 void do_cmd_view_map(void)
3678 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
3683 display_autopick = 0;
3685 /* Display the map */
3686 display_map(p_ptr->current_floor_ptr, &cy, &cx);
3689 if (max_autopick && !p_ptr->wild_mode)
3691 display_autopick = ITEM_DISPLAY;
3698 int wid, hgt, row_message;
3700 Term_get_size(&wid, &hgt);
3701 row_message = hgt - 1;
3703 put_str(_("何かキーを押してください('M':拾う 'N':放置 'D':M+N 'K':壊すアイテムを表示)",
3704 " Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items."), row_message, 1);
3706 /* Hilite the player */
3707 move_cursor(cy, cx);
3712 flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK);
3714 flag = DONT_AUTOPICK;
3716 flag = DO_AUTODESTROY;
3718 flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK | DONT_AUTOPICK);
3724 if (~display_autopick & flag)
3725 display_autopick |= flag;
3727 display_autopick &= ~flag;
3728 /* Display the map */
3729 display_map(p_ptr->current_floor_ptr, &cy, &cx);
3732 display_autopick = 0;
3737 put_str(_("何かキーを押すとゲームに戻ります", "Hit any key to continue"), 23, 30);
3738 /* Hilite the player */
3739 move_cursor(cy, cx);
3747 * Track a new monster
3749 void health_track(MONSTER_IDX m_idx)
3751 /* Mount monster is already tracked */
3752 if (m_idx && m_idx == p_ptr->riding) return;
3754 /* Track a new guy */
3755 p_ptr->health_who = m_idx;
3757 /* Redraw (later) */
3758 p_ptr->redraw |= (PR_HEALTH);
3763 * Moves the cursor to a given MAP (y,x) location
3765 void move_cursor_relative(int row, int col)
3767 /* Real co-ords convert to screen positions */
3768 row -= panel_row_prt;
3771 Term_gotoxy(panel_col_of(col), row);
3776 * print project path
3778 void prt_path(POSITION y, POSITION x)
3783 byte_hack default_color = TERM_SLATE;
3785 if (!display_path) return;
3786 if (-1 == project_length)
3789 /* Get projection path */
3790 path_n = project_path(p_ptr->current_floor_ptr, path_g, (project_length ? project_length : MAX_RANGE), p_ptr->y, p_ptr->x, y, x, PROJECT_PATH | PROJECT_THRU);
3792 p_ptr->redraw |= (PR_MAP);
3796 for (i = 0; i < path_n; i++)
3798 POSITION ny = GRID_Y(path_g[i]);
3799 POSITION nx = GRID_X(path_g[i]);
3800 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[ny][nx];
3802 if (panel_contains(ny, nx))
3804 TERM_COLOR a = default_color;
3807 TERM_COLOR ta = default_color;
3810 if (g_ptr->m_idx && p_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)
3812 /* Determine what is there */
3813 map_info(ny, nx, &a, &c, &ta, &tc);
3815 if (!IS_ASCII_GRAPHICS(a))
3817 else if (c == '.' && (a == TERM_WHITE || a == TERM_L_WHITE))
3819 else if (a == default_color)
3825 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
3826 else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
3827 else if (p_ptr->wraith_form) a = TERM_L_DARK;
3832 /* Hack -- Queue it */
3833 Term_queue_bigchar(panel_col_of(nx), ny - panel_row_prt, a, c, ta, tc);
3837 if ((g_ptr->info & CAVE_MARK) && !cave_have_flag_grid(g_ptr, FF_PROJECT)) break;
3840 if (nx == x && ny == y) default_color = TERM_L_DARK;
3846 * Hack -- track the given monster race
3848 void monster_race_track(MONRACE_IDX r_idx)
3850 /* Save this monster ID */
3851 p_ptr->monster_race_idx = r_idx;
3853 p_ptr->window |= (PW_MONSTER);
3857 * Hack -- track the given object kind
3859 void object_kind_track(KIND_OBJECT_IDX k_idx)
3861 /* Save this monster ID */
3862 p_ptr->object_kind_idx = k_idx;
3864 p_ptr->window |= (PW_OBJECT);
3869 * @brief 実ゲームプレイ時間を更新する
3871 void update_playtime(void)
3873 /* Check if the game has started */
3874 if (current_world_ptr->start_time != 0)
3876 u32b tmp = (u32b)time(NULL);
3877 current_world_ptr->play_time += (tmp - current_world_ptr->start_time);
3878 current_world_ptr->start_time = tmp;