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"
30 #include "view-mainwindow.h"
33 #include "realm-hex.h"
34 #include "realm-song.h"
36 #include "object-flavor.h"
41 #include "floor-town.h"
43 #include "objectkind.h"
44 #include "targeting.h"
47 * Not using graphical tiles for this feature?
49 #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; /*!< 各種自動拾い処理時に使うオブジェクトポインタ */
61 POSITION panel_row_min, panel_row_max;
62 POSITION panel_col_min, panel_col_max;
63 POSITION panel_col_prt, panel_row_prt;
67 * Some screen locations for various display routines
68 * Currently, row 8 and 15 are the only "blank" rows.
69 * That leaves a "border" around the "stat" values.
73 #define COL_RACE 0 /* <race name> */
75 /*#define ROW_CLASS 2 */
76 /*#define COL_CLASS 0 */ /* <class name> */
79 #define COL_TITLE 0 /* <title> or <mode> */
81 /*#define ROW_SEIKAKU 4 */
82 /*#define COL_SEIKAKU 0*/ /* <seikaku> */
85 #define COL_DAY 0 /* day */
87 #define ROW_DUNGEON 22
88 #define COL_DUNGEON 0 /* dungeon */
91 #define COL_LEVEL 0 /* "LEVEL xxxxxx" */
94 #define COL_EXP 0 /* "EXP xxxxxxxx" */
97 #define COL_GOLD 0 /* "AU xxxxxxxxx" */
100 #define COL_EQUIPPY 0 /* equippy chars */
103 #define COL_STAT 0 /* "xxx xxxxxx" */
106 #define COL_AC 0 /* "Cur AC xxxxx" */
112 #define COL_CURHP 0 /* "Cur HP xxxxx" */
115 #define COL_CURSP 0 /* "Cur SP xxxxx" */
117 #define ROW_RIDING_INFO 16
118 #define COL_RIDING_INFO 0 /* "xxxxxxxxxxxx" */
121 #define COL_INFO 0 /* "xxxxxxxxxxxx" */
124 #define COL_CUT 0 /* <cut> */
127 #define COL_STUN 0 /* <stun> */
129 #define ROW_HUNGRY 20
130 #define COL_HUNGRY 0 /* "Weak" / "Hungry" / "Full" / "Gorged" */
133 #define COL_STATE 7 /* <state> */
135 #define ROW_SPEED (-1)
136 #define COL_SPEED (-24) /* "Slow (-NN)" or "Fast (+NN)" */
138 #define ROW_STUDY (-1)
139 #define COL_STUDY (-13) /* "Study" */
141 #define ROW_DEPTH (-1)
142 #define COL_DEPTH (-8) /* "Lev NNN" / "NNNN ft" */
144 #define ROW_STATBAR (-1)
145 #define COL_STATBAR 0
146 #define MAX_COL_STATBAR (-26)
151 * @brief 画面左の能力値表示を行うために指定位置から13キャラ分を空白消去後指定のメッセージを明るい青で描画する /
152 * Print character info at given row, column in a 13 char field
158 static void prt_field(concptr info, TERM_LEN row, TERM_LEN col)
160 /* Dump 13 spaces to clear */
161 c_put_str(TERM_WHITE, " ", row, col);
163 /* Dump the info itself */
164 c_put_str(TERM_L_BLUE, info, row, col);
168 * @brief ゲーム時刻を表示する /
176 /* Dump 13 spaces to clear */
177 c_put_str(TERM_WHITE, " ", ROW_DAY, COL_DAY);
179 extract_day_hour_min(&day, &hour, &min);
181 /* Dump the info itself */
182 if (day < 1000) c_put_str(TERM_WHITE, format(_("%2d日目", "Day%3d"), day), ROW_DAY, COL_DAY);
183 else c_put_str(TERM_WHITE, _("***日目", "Day***"), ROW_DAY, COL_DAY);
185 c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
189 * @brief 現在のマップ名を返す /
190 * @return マップ名の文字列参照ポインタ
192 concptr map_name(void)
194 if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)
195 && (quest[p_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
196 return _("クエスト", "Quest");
197 else if (p_ptr->wild_mode)
198 return _("地上", "Surface");
199 else if (p_ptr->inside_arena)
200 return _("アリーナ", "Arena");
201 else if (p_ptr->inside_battle)
202 return _("闘技場", "Monster Arena");
203 else if (!current_floor_ptr->dun_level && p_ptr->town_num)
204 return town_info[p_ptr->town_num].name;
206 return d_name+d_info[p_ptr->dungeon_idx].name;
210 * @brief 現在のマップ名を描画する / Print dungeon
213 static void prt_dungeon(void)
215 concptr dungeon_name;
218 /* Dump 13 spaces to clear */
219 c_put_str(TERM_WHITE, " ", ROW_DUNGEON, COL_DUNGEON);
221 dungeon_name = map_name();
223 col = COL_DUNGEON + 6 - strlen(dungeon_name)/2;
224 if (col < 0) col = 0;
226 /* Dump the info itself */
227 c_put_str(TERM_L_UMBER, format("%s",dungeon_name),
233 * @brief プレイヤー能力値を描画する / Print character stat in given row, column
234 * @param stat 描画するステータスのID
237 static void prt_stat(int stat)
241 /* Display "injured" stat */
242 if (p_ptr->stat_cur[stat] < p_ptr->stat_max[stat])
244 put_str(stat_names_reduced[stat], ROW_STAT + stat, 0);
245 cnv_stat(p_ptr->stat_use[stat], tmp);
246 c_put_str(TERM_YELLOW, tmp, ROW_STAT + stat, COL_STAT + 6);
249 /* Display "healthy" stat */
252 put_str(stat_names[stat], ROW_STAT + stat, 0);
253 cnv_stat(p_ptr->stat_use[stat], tmp);
254 c_put_str(TERM_L_GREEN, tmp, ROW_STAT + stat, COL_STAT + 6);
257 /* Indicate natural maximum */
258 if (p_ptr->stat_max[stat] == p_ptr->stat_max_max[stat])
261 /* 日本語にかぶらないように表示位置を変更 */
262 put_str("!", ROW_STAT + stat, 5);
264 put_str("!", ROW_STAT + stat, 3);
272 * 画面下部に表示する状態表示定義ID / Data structure for status bar
274 #define BAR_TSUYOSHI 0 /*!< 下部ステータス表示: オクレ兄さん状態 */
275 #define BAR_HALLUCINATION 1 /*!< 下部ステータス表示: 幻覚 */
276 #define BAR_BLINDNESS 2 /*!< 下部ステータス表示: 盲目 */
277 #define BAR_PARALYZE 3 /*!< 下部ステータス表示: 麻痺 */
278 #define BAR_CONFUSE 4 /*!< 下部ステータス表示: 混乱 */
279 #define BAR_POISONED 5 /*!< 下部ステータス表示: 毒 */
280 #define BAR_AFRAID 6 /*!< 下部ステータス表示: 恐怖 */
281 #define BAR_LEVITATE 7 /*!< 下部ステータス表示: 浮遊 */
282 #define BAR_REFLECTION 8 /*!< 下部ステータス表示: 反射 */
283 #define BAR_PASSWALL 9 /*!< 下部ステータス表示: 壁抜け */
284 #define BAR_WRAITH 10 /*!< 下部ステータス表示: 幽体化 */
285 #define BAR_PROTEVIL 11 /*!< 下部ステータス表示: 対邪悪結界 */
286 #define BAR_KAWARIMI 12 /*!< 下部ステータス表示: 変わり身 */
287 #define BAR_MAGICDEFENSE 13 /*!< 下部ステータス表示: 魔法の鎧 */
288 #define BAR_EXPAND 14 /*!< 下部ステータス表示: 横伸び */
289 #define BAR_STONESKIN 15 /*!< 下部ステータス表示: 石肌化 */
290 #define BAR_MULTISHADOW 16 /*!< 下部ステータス表示: 影分身 */
291 #define BAR_REGMAGIC 17 /*!< 下部ステータス表示: 魔法防御 */
292 #define BAR_ULTIMATE 18 /*!< 下部ステータス表示: 究極の耐性 */
293 #define BAR_INVULN 19 /*!< 下部ステータス表示: 無敵化 */
294 #define BAR_IMMACID 20 /*!< 下部ステータス表示: 酸免疫 */
295 #define BAR_RESACID 21 /*!< 下部ステータス表示: 酸耐性 */
296 #define BAR_IMMELEC 22 /*!< 下部ステータス表示: 電撃免疫 */
297 #define BAR_RESELEC 23 /*!< 下部ステータス表示: 電撃耐性 */
298 #define BAR_IMMFIRE 24 /*!< 下部ステータス表示: 火炎免疫 */
299 #define BAR_RESFIRE 25 /*!< 下部ステータス表示: 火炎耐性 */
300 #define BAR_IMMCOLD 26 /*!< 下部ステータス表示: 冷気免疫 */
301 #define BAR_RESCOLD 27 /*!< 下部ステータス表示: 冷気耐性 */
302 #define BAR_RESPOIS 28 /*!< 下部ステータス表示: 毒耐性 */
303 #define BAR_RESNETH 29 /*!< 下部ステータス表示: 地獄耐性 */
304 #define BAR_RESTIME 30 /*!< 下部ステータス表示: 時間逆転耐性 */
305 #define BAR_DUSTROBE 31 /*!< 下部ステータス表示: 破片オーラ */
306 #define BAR_SHFIRE 32 /*!< 下部ステータス表示: 火炎オーラ */
307 #define BAR_TOUKI 33 /*!< 下部ステータス表示: 闘気 */
308 #define BAR_SHHOLY 34 /*!< 下部ステータス表示: 聖なるオーラ */
309 #define BAR_EYEEYE 35 /*!< 下部ステータス表示: 目には目を */
310 #define BAR_BLESSED 36 /*!< 下部ステータス表示: 祝福 */
311 #define BAR_HEROISM 37 /*!< 下部ステータス表示: 士気高揚 */
312 #define BAR_BERSERK 38 /*!< 下部ステータス表示: 狂戦士化 */
313 #define BAR_ATTKFIRE 39 /*!< 下部ステータス表示: 焼棄スレイ */
314 #define BAR_ATTKCOLD 40 /*!< 下部ステータス表示: 冷凍スレイ */
315 #define BAR_ATTKELEC 41 /*!< 下部ステータス表示: 電撃スレイ */
316 #define BAR_ATTKACID 42 /*!< 下部ステータス表示: 溶解スレイ */
317 #define BAR_ATTKPOIS 43 /*!< 下部ステータス表示: 毒殺スレイ */
318 #define BAR_ATTKCONF 44 /*!< 下部ステータス表示: 混乱打撃 */
319 #define BAR_SENSEUNSEEN 45 /*!< 下部ステータス表示: 透明視 */
320 #define BAR_TELEPATHY 46 /*!< 下部ステータス表示: テレパシー */
321 #define BAR_REGENERATION 47 /*!< 下部ステータス表示: 急回復 */
322 #define BAR_INFRAVISION 48 /*!< 下部ステータス表示: 赤外線視力 */
323 #define BAR_STEALTH 49 /*!< 下部ステータス表示: 隠密 */
324 #define BAR_SUPERSTEALTH 50 /*!< 下部ステータス表示: 超隠密 */
325 #define BAR_RECALL 51 /*!< 下部ステータス表示: 帰還待ち */
326 #define BAR_ALTER 52 /*!< 下部ステータス表示: 現実変容待ち */
327 #define BAR_SHCOLD 53 /*!< 下部ステータス表示: 冷気オーラ */
328 #define BAR_SHELEC 54 /*!< 下部ステータス表示: 電撃オーラ */
329 #define BAR_SHSHADOW 55 /*!< 下部ステータス表示: 影のオーラ */
330 #define BAR_MIGHT 56 /*!< 下部ステータス表示: 腕力強化 */
331 #define BAR_BUILD 57 /*!< 下部ステータス表示: 肉体強化 */
332 #define BAR_ANTIMULTI 58 /*!< 下部ステータス表示: 反増殖 */
333 #define BAR_ANTITELE 59 /*!< 下部ステータス表示: 反テレポート */
334 #define BAR_ANTIMAGIC 60 /*!< 下部ステータス表示: 反魔法 */
335 #define BAR_PATIENCE 61 /*!< 下部ステータス表示: 我慢 */
336 #define BAR_REVENGE 62 /*!< 下部ステータス表示: 宣告 */
337 #define BAR_RUNESWORD 63 /*!< 下部ステータス表示: 魔剣化 */
338 #define BAR_VAMPILIC 64 /*!< 下部ステータス表示: 吸血 */
339 #define BAR_CURE 65 /*!< 下部ステータス表示: 回復 */
340 #define BAR_ESP_EVIL 66 /*!< 下部ステータス表示: 邪悪感知 */
349 {TERM_YELLOW, "つ", "つよし"},
350 {TERM_VIOLET, "幻", "幻覚"},
351 {TERM_L_DARK, "盲", "盲目"},
352 {TERM_RED, "痺", "麻痺"},
353 {TERM_VIOLET, "乱", "混乱"},
354 {TERM_GREEN, "毒", "毒"},
355 {TERM_BLUE, "恐", "恐怖"},
356 {TERM_L_BLUE, "浮", "浮遊"},
357 {TERM_SLATE, "反", "反射"},
358 {TERM_SLATE, "壁", "壁抜け"},
359 {TERM_L_DARK, "幽", "幽体"},
360 {TERM_SLATE, "邪", "防邪"},
361 {TERM_VIOLET, "変", "変わり身"},
362 {TERM_YELLOW, "魔", "魔法鎧"},
363 {TERM_L_UMBER, "伸", "伸び"},
364 {TERM_WHITE, "石", "石肌"},
365 {TERM_L_BLUE, "分", "分身"},
366 {TERM_SLATE, "防", "魔法防御"},
367 {TERM_YELLOW, "究", "究極"},
368 {TERM_YELLOW, "無", "無敵"},
369 {TERM_L_GREEN, "酸", "酸免疫"},
370 {TERM_GREEN, "酸", "耐酸"},
371 {TERM_L_BLUE, "電", "電免疫"},
372 {TERM_BLUE, "電", "耐電"},
373 {TERM_L_RED, "火", "火免疫"},
374 {TERM_RED, "火", "耐火"},
375 {TERM_WHITE, "冷", "冷免疫"},
376 {TERM_SLATE, "冷", "耐冷"},
377 {TERM_GREEN, "毒", "耐毒"},
378 {TERM_L_DARK, "獄", "耐地獄"},
379 {TERM_L_BLUE, "時", "耐時間"},
380 {TERM_L_DARK, "鏡", "鏡オーラ"},
381 {TERM_L_RED, "オ", "火オーラ"},
382 {TERM_WHITE, "闘", "闘気"},
383 {TERM_WHITE, "聖", "聖オーラ"},
384 {TERM_VIOLET, "目", "目には目"},
385 {TERM_WHITE, "祝", "祝福"},
386 {TERM_WHITE, "勇", "勇"},
387 {TERM_RED, "狂", "狂乱"},
388 {TERM_L_RED, "火", "魔剣火"},
389 {TERM_WHITE, "冷", "魔剣冷"},
390 {TERM_L_BLUE, "電", "魔剣電"},
391 {TERM_SLATE, "酸", "魔剣酸"},
392 {TERM_L_GREEN, "毒", "魔剣毒"},
393 {TERM_RED, "乱", "混乱打撃"},
394 {TERM_L_BLUE, "視", "透明視"},
395 {TERM_ORANGE, "テ", "テレパシ"},
396 {TERM_L_BLUE, "回", "回復"},
397 {TERM_L_RED, "赤", "赤外"},
398 {TERM_UMBER, "隠", "隠密"},
399 {TERM_YELLOW, "隠", "超隠密"},
400 {TERM_WHITE, "帰", "帰還"},
401 {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"},
475 {TERM_WHITE, "SCo", "SCold"},
476 {TERM_BLUE, "SEl", "SElec"},
477 {TERM_L_DARK, "SSh", "SShadow"},
478 {TERM_YELLOW, "EMi", "ExMight"},
479 {TERM_RED, "Bu", "BuildUp"},
480 {TERM_L_DARK, "AMl", "AntiMulti"},
481 {TERM_ORANGE, "AT", "AntiTele"},
482 {TERM_RED, "AM", "AntiMagic"},
483 {TERM_SLATE, "Pa", "Patience"},
484 {TERM_SLATE, "Rv", "Revenge"},
485 {TERM_L_DARK, "Rs", "RuneSword"},
486 {TERM_RED, "Vm", "Vampiric"},
487 {TERM_WHITE, "Cu", "Cure"},
488 {TERM_L_DARK, "ET", "EvilTele"},
494 * @brief 32ビット変数配列の指定位置のビットフラグを1にする。
495 * @param FLG フラグ位置(ビット)
498 #define ADD_FLG(FLG) (bar_flags[FLG / 32] |= (1L << (FLG % 32)))
501 * @brief 32ビット変数配列の指定位置のビットフラグが1かどうかを返す。
502 * @param FLG フラグ位置(ビット)
505 #define IS_FLG(FLG) (bar_flags[FLG / 32] & (1L << (FLG % 32)))
509 * @brief 下部に状態表示を行う / Show status bar
512 static void prt_status(void)
514 BIT_FLAGS bar_flags[3];
515 TERM_LEN wid, hgt, row_statbar, max_col_statbar;
517 TERM_LEN col = 0, num = 0;
520 Term_get_size(&wid, &hgt);
521 row_statbar = hgt + ROW_STATBAR;
522 max_col_statbar = wid + MAX_COL_STATBAR;
524 Term_erase(0, row_statbar, max_col_statbar);
526 bar_flags[0] = bar_flags[1] = bar_flags[2] = 0L;
529 if (p_ptr->tsuyoshi) ADD_FLG(BAR_TSUYOSHI);
532 if (p_ptr->image) ADD_FLG(BAR_HALLUCINATION);
535 if (p_ptr->blind) ADD_FLG(BAR_BLINDNESS);
538 if (p_ptr->paralyzed) ADD_FLG(BAR_PARALYZE);
541 if (p_ptr->confused) ADD_FLG(BAR_CONFUSE);
544 if (p_ptr->poisoned) ADD_FLG(BAR_POISONED);
546 /* Times see-invisible */
547 if (p_ptr->tim_invis) ADD_FLG(BAR_SENSEUNSEEN);
550 if (IS_TIM_ESP()) ADD_FLG(BAR_TELEPATHY);
552 /* Timed regenerate */
553 if (p_ptr->tim_regen) ADD_FLG(BAR_REGENERATION);
555 /* Timed infra-vision */
556 if (p_ptr->tim_infra) ADD_FLG(BAR_INFRAVISION);
558 /* Protection from evil */
559 if (p_ptr->protevil) ADD_FLG(BAR_PROTEVIL);
561 /* Invulnerability */
562 if (IS_INVULN()) ADD_FLG(BAR_INVULN);
565 if (p_ptr->wraith_form) ADD_FLG(BAR_WRAITH);
568 if (p_ptr->kabenuke) ADD_FLG(BAR_PASSWALL);
570 if (p_ptr->tim_reflect) ADD_FLG(BAR_REFLECTION);
573 if (IS_HERO()) ADD_FLG(BAR_HEROISM);
575 /* Super Heroism / berserk */
576 if (p_ptr->shero) ADD_FLG(BAR_BERSERK);
579 if (IS_BLESSED()) ADD_FLG(BAR_BLESSED);
582 if (p_ptr->magicdef) ADD_FLG(BAR_MAGICDEFENSE);
584 if (p_ptr->tsubureru) ADD_FLG(BAR_EXPAND);
586 if (p_ptr->shield) ADD_FLG(BAR_STONESKIN);
588 if (p_ptr->special_defense & NINJA_KAWARIMI) ADD_FLG(BAR_KAWARIMI);
591 if (p_ptr->special_defense & DEFENSE_ACID) ADD_FLG(BAR_IMMACID);
592 if (IS_OPPOSE_ACID()) ADD_FLG(BAR_RESACID);
594 /* Oppose Lightning */
595 if (p_ptr->special_defense & DEFENSE_ELEC) ADD_FLG(BAR_IMMELEC);
596 if (IS_OPPOSE_ELEC()) ADD_FLG(BAR_RESELEC);
599 if (p_ptr->special_defense & DEFENSE_FIRE) ADD_FLG(BAR_IMMFIRE);
600 if (IS_OPPOSE_FIRE()) ADD_FLG(BAR_RESFIRE);
603 if (p_ptr->special_defense & DEFENSE_COLD) ADD_FLG(BAR_IMMCOLD);
604 if (IS_OPPOSE_COLD()) ADD_FLG(BAR_RESCOLD);
607 if (IS_OPPOSE_POIS()) ADD_FLG(BAR_RESPOIS);
610 if (p_ptr->word_recall) ADD_FLG(BAR_RECALL);
613 if (p_ptr->alter_reality) ADD_FLG(BAR_ALTER);
616 if (p_ptr->afraid) ADD_FLG(BAR_AFRAID);
619 if (p_ptr->tim_res_time) ADD_FLG(BAR_RESTIME);
621 if (p_ptr->multishadow) ADD_FLG(BAR_MULTISHADOW);
623 /* Confusing Hands */
624 if (p_ptr->special_attack & ATTACK_CONFUSE) ADD_FLG(BAR_ATTKCONF);
626 if (p_ptr->resist_magic) ADD_FLG(BAR_REGMAGIC);
628 /* Ultimate-resistance */
629 if (p_ptr->ult_res) ADD_FLG(BAR_ULTIMATE);
632 if (p_ptr->tim_levitation) ADD_FLG(BAR_LEVITATE);
634 if (p_ptr->tim_res_nether) ADD_FLG(BAR_RESNETH);
636 if (p_ptr->dustrobe) ADD_FLG(BAR_DUSTROBE);
639 if (p_ptr->special_attack & ATTACK_FIRE) ADD_FLG(BAR_ATTKFIRE);
640 if (p_ptr->special_attack & ATTACK_COLD) ADD_FLG(BAR_ATTKCOLD);
641 if (p_ptr->special_attack & ATTACK_ELEC) ADD_FLG(BAR_ATTKELEC);
642 if (p_ptr->special_attack & ATTACK_ACID) ADD_FLG(BAR_ATTKACID);
643 if (p_ptr->special_attack & ATTACK_POIS) ADD_FLG(BAR_ATTKPOIS);
644 if (p_ptr->special_defense & NINJA_S_STEALTH) ADD_FLG(BAR_SUPERSTEALTH);
646 if (p_ptr->tim_sh_fire) ADD_FLG(BAR_SHFIRE);
649 if (IS_TIM_STEALTH()) ADD_FLG(BAR_STEALTH);
651 if (p_ptr->tim_sh_touki) ADD_FLG(BAR_TOUKI);
654 if (p_ptr->tim_sh_holy) ADD_FLG(BAR_SHHOLY);
656 /* An Eye for an Eye */
657 if (p_ptr->tim_eyeeye) ADD_FLG(BAR_EYEEYE);
660 if (p_ptr->realm1 == REALM_HEX)
662 if (hex_spelling(HEX_BLESS)) ADD_FLG(BAR_BLESSED);
663 if (hex_spelling(HEX_DEMON_AURA)) { ADD_FLG(BAR_SHFIRE); ADD_FLG(BAR_REGENERATION); }
664 if (hex_spelling(HEX_XTRA_MIGHT)) ADD_FLG(BAR_MIGHT);
665 if (hex_spelling(HEX_DETECT_EVIL)) ADD_FLG(BAR_ESP_EVIL);
666 if (hex_spelling(HEX_ICE_ARMOR)) ADD_FLG(BAR_SHCOLD);
667 if (hex_spelling(HEX_RUNESWORD)) ADD_FLG(BAR_RUNESWORD);
668 if (hex_spelling(HEX_BUILDING)) ADD_FLG(BAR_BUILD);
669 if (hex_spelling(HEX_ANTI_TELE)) ADD_FLG(BAR_ANTITELE);
670 if (hex_spelling(HEX_SHOCK_CLOAK)) ADD_FLG(BAR_SHELEC);
671 if (hex_spelling(HEX_SHADOW_CLOAK)) ADD_FLG(BAR_SHSHADOW);
672 if (hex_spelling(HEX_CONFUSION)) ADD_FLG(BAR_ATTKCONF);
673 if (hex_spelling(HEX_EYE_FOR_EYE)) ADD_FLG(BAR_EYEEYE);
674 if (hex_spelling(HEX_ANTI_MULTI)) ADD_FLG(BAR_ANTIMULTI);
675 if (hex_spelling(HEX_VAMP_BLADE)) ADD_FLG(BAR_VAMPILIC);
676 if (hex_spelling(HEX_ANTI_MAGIC)) ADD_FLG(BAR_ANTIMAGIC);
677 if (hex_spelling(HEX_CURE_LIGHT) ||
678 hex_spelling(HEX_CURE_SERIOUS) ||
679 hex_spelling(HEX_CURE_CRITICAL)) ADD_FLG(BAR_CURE);
681 if (HEX_REVENGE_TURN(p_ptr))
683 if (HEX_REVENGE_TYPE(p_ptr) == 1) ADD_FLG(BAR_PATIENCE);
684 if (HEX_REVENGE_TYPE(p_ptr) == 2) ADD_FLG(BAR_REVENGE);
688 /* Calcurate length */
689 for (i = 0; bar[i].sstr; i++)
693 col += strlen(bar[i].lstr) + 1;
698 /* If there are not excess spaces for long strings, use short one */
699 if (col - 1 > max_col_statbar)
704 for (i = 0; bar[i].sstr; i++)
708 col += strlen(bar[i].sstr);
712 /* If there are excess spaces for short string, use more */
713 if (col - 1 <= max_col_statbar - (num-1))
721 /* Centering display column */
722 col = (max_col_statbar - col) / 2;
724 /* Display status bar */
725 for (i = 0; bar[i].sstr; i++)
730 if (space == 2) str = bar[i].lstr;
731 else str = bar[i].sstr;
733 c_put_str(bar[i].attr, str, row_statbar, col);
735 if (space > 0) col++;
736 if (col > max_col_statbar) break;
743 * @brief プレイヤーの称号を表示する / Prints "title", including "wizard" or "winner" as needed.
746 static void prt_title(void)
753 p = _("[ウィザード]", "[=-WIZARD-=]");
755 else if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL))
757 if (p_ptr->arena_number > MAX_ARENA_MONS + 2)
759 p = _("*真・勝利者*", "*TRUEWINNER*");
763 p = _("***勝利者***", "***WINNER***");
770 my_strcpy(str, player_title[p_ptr->pclass][(p_ptr->lev - 1) / 5], sizeof(str));
774 prt_field(p, ROW_TITLE, COL_TITLE);
779 * @brief プレイヤーのレベルを表示する / Prints level
782 static void prt_level(void)
786 sprintf(tmp, _("%5d", "%6d"), p_ptr->lev);
788 if (p_ptr->lev >= p_ptr->max_plv)
790 put_str(_("レベル ", "LEVEL "), ROW_LEVEL, 0);
791 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 7);
795 put_str(_("xレベル", "Level "), ROW_LEVEL, 0);
796 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 7);
802 * @brief プレイヤーの経験値を表示する / Display the experience
805 static void prt_exp(void)
809 if ((!exp_need)||(p_ptr->prace == RACE_ANDROID))
811 (void)sprintf(out_val, "%8ld", (long)p_ptr->exp);
815 if (p_ptr->lev >= PY_MAX_LEVEL)
817 (void)sprintf(out_val, "********");
821 (void)sprintf(out_val, "%8ld", (long)(player_exp [p_ptr->lev - 1] * p_ptr->expfact / 100L) - p_ptr->exp);
825 if (p_ptr->exp >= p_ptr->max_exp)
827 if (p_ptr->prace == RACE_ANDROID) put_str(_("強化 ", "Cst "), ROW_EXP, 0);
828 else put_str(_("経験 ", "EXP "), ROW_EXP, 0);
829 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 4);
833 put_str(_("x経験", "Exp "), ROW_EXP, 0);
834 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 4);
839 * @brief プレイヤーの所持金を表示する / Prints current gold
842 static void prt_gold(void)
845 put_str(_("$ ", "AU "), ROW_GOLD, COL_GOLD);
846 sprintf(tmp, "%9ld", (long)p_ptr->au);
847 c_put_str(TERM_L_GREEN, tmp, ROW_GOLD, COL_GOLD + 3);
852 * @brief プレイヤーのACを表示する / Prints current AC
855 static void prt_ac(void)
860 /* AC の表示方式を変更している */
861 put_str(" AC( )", ROW_AC, COL_AC);
862 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
863 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 6);
865 put_str("Cur AC ", ROW_AC, COL_AC);
866 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
867 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 7);
874 * @brief プレイヤーのHPを表示する / Prints Cur/Max hit points
877 static void prt_hp(void)
879 /* ヒットポイントの表示方法を変更 */
885 put_str("HP", ROW_CURHP, COL_CURHP);
888 sprintf(tmp, "%4ld", (long int)p_ptr->chp);
890 if (p_ptr->chp >= p_ptr->mhp)
892 color = TERM_L_GREEN;
894 else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
903 c_put_str(color, tmp, ROW_CURHP, COL_CURHP+3);
906 put_str( "/", ROW_CURHP, COL_CURHP + 7 );
909 sprintf(tmp, "%4ld", (long int)p_ptr->mhp);
910 color = TERM_L_GREEN;
912 c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
917 * @brief プレイヤーのMPを表示する / Prints players max/cur spell points
920 static void prt_sp(void)
922 /* マジックポイントの表示方法を変更している */
927 /* Do not show mana unless it matters */
928 if (!mp_ptr->spell_book) return;
931 put_str(_("MP", "SP"), ROW_CURSP, COL_CURSP);
934 sprintf(tmp, "%4ld", (long int)p_ptr->csp);
936 if (p_ptr->csp >= p_ptr->msp)
938 color = TERM_L_GREEN;
940 else if (p_ptr->csp > (p_ptr->msp * mana_warn) / 10)
949 c_put_str(color, tmp, ROW_CURSP, COL_CURSP+3);
952 put_str( "/", ROW_CURSP, COL_CURSP + 7 );
955 sprintf(tmp, "%4ld", (long int)p_ptr->msp);
956 color = TERM_L_GREEN;
958 c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
963 * @brief 現在のフロアの深さを表示する / Prints depth in stat area
966 static void prt_depth(void)
969 TERM_LEN wid, hgt, row_depth, col_depth;
970 TERM_COLOR attr = TERM_WHITE;
972 Term_get_size(&wid, &hgt);
973 col_depth = wid + COL_DEPTH;
974 row_depth = hgt + ROW_DEPTH;
976 if (!current_floor_ptr->dun_level)
978 strcpy(depths, _("地上", "Surf."));
980 else if (p_ptr->inside_quest && !p_ptr->dungeon_idx)
982 strcpy(depths, _("地上", "Quest"));
986 if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)current_floor_ptr->dun_level * 50);
987 else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)current_floor_ptr->dun_level);
989 /* Get color of level based on feeling -JSV- */
990 switch (p_ptr->feeling)
992 case 0: attr = TERM_SLATE; break; /* Unknown */
993 case 1: attr = TERM_L_BLUE; break; /* Special */
994 case 2: attr = TERM_VIOLET; break; /* Horrible visions */
995 case 3: attr = TERM_RED; break; /* Very dangerous */
996 case 4: attr = TERM_L_RED; break; /* Very bad feeling */
997 case 5: attr = TERM_ORANGE; break; /* Bad feeling */
998 case 6: attr = TERM_YELLOW; break; /* Nervous */
999 case 7: attr = TERM_L_UMBER; break; /* Luck is turning */
1000 case 8: attr = TERM_L_WHITE; break; /* Don't like */
1001 case 9: attr = TERM_WHITE; break; /* Reasonably safe */
1002 case 10: attr = TERM_WHITE; break; /* Boring place */
1006 /* Right-Adjust the "depth", and clear old values */
1007 c_prt(attr, format("%7s", depths), row_depth, col_depth);
1012 * @brief プレイヤーの空腹状態を表示する / Prints status of hunger
1015 static void prt_hunger(void)
1017 if(p_ptr->wizard && p_ptr->inside_arena) return;
1019 /* Fainting / Starving */
1020 if (p_ptr->food < PY_FOOD_FAINT)
1022 c_put_str(TERM_RED, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
1026 else if (p_ptr->food < PY_FOOD_WEAK)
1028 c_put_str(TERM_ORANGE, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
1032 else if (p_ptr->food < PY_FOOD_ALERT)
1034 c_put_str(TERM_YELLOW, _("空腹 ", "Hungry"), ROW_HUNGRY, COL_HUNGRY);
1038 else if (p_ptr->food < PY_FOOD_FULL)
1040 c_put_str(TERM_L_GREEN, " ", ROW_HUNGRY, COL_HUNGRY);
1044 else if (p_ptr->food < PY_FOOD_MAX)
1046 c_put_str(TERM_L_GREEN, _("満腹 ", "Full "), ROW_HUNGRY, COL_HUNGRY);
1052 c_put_str(TERM_GREEN, _("食過ぎ", "Gorged"), ROW_HUNGRY, COL_HUNGRY);
1058 * @brief プレイヤーの行動状態を表示する / Prints Searching, Resting, Paralysis, or 'count' status
1061 * Display is always exactly 10 characters wide (see below)
1062 * This function was a major bottleneck when resting, so a lot of
1063 * the text formatting code was optimized in place below.
1065 static void prt_state(void)
1067 TERM_COLOR attr = TERM_WHITE;
1073 if (command_rep > 999)
1075 (void)sprintf(text, "%2d00", command_rep / 100);
1079 (void)sprintf(text, " %2d", command_rep);
1086 switch(p_ptr->action)
1090 strcpy(text, _("探索", "Sear"));
1094 /* Start with "Rest" */
1095 strcpy(text, _(" ", " "));
1097 if (p_ptr->resting > 0)
1099 sprintf(text, "%4d", p_ptr->resting);
1101 else if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
1103 text[0] = text[1] = text[2] = text[3] = '*';
1105 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
1107 text[0] = text[1] = text[2] = text[3] = '&';
1113 strcpy(text, _("学習", "lear"));
1114 if (new_mane) attr = TERM_L_RED;
1119 strcpy(text, _("釣り", "fish"));
1125 for (i = 0; i < MAX_KAMAE; i++)
1126 if (p_ptr->special_defense & (KAMAE_GENBU << i)) break;
1129 case 0: attr = TERM_GREEN;break;
1130 case 1: attr = TERM_WHITE;break;
1131 case 2: attr = TERM_L_BLUE;break;
1132 case 3: attr = TERM_L_RED;break;
1134 strcpy(text, kamae_shurui[i].desc);
1140 for (i = 0; i < MAX_KATA; i++)
1141 if (p_ptr->special_defense & (KATA_IAI << i)) break;
1142 strcpy(text, kata_shurui[i].desc);
1147 strcpy(text, _("歌 ", "Sing"));
1150 case ACTION_HAYAGAKE:
1152 strcpy(text, _("速駆", "Fast"));
1157 strcpy(text, _("詠唱", "Spel"));
1168 /* Display the info (or blanks) */
1169 c_put_str(attr, format("%5.5s",text), ROW_STATE, COL_STATE);
1174 * @brief プレイヤーの行動速度を表示する / Prints the speed of a character. -CJS-
1177 static void prt_speed(void)
1179 int i = p_ptr->pspeed;
1180 bool is_fast = IS_FAST();
1182 TERM_COLOR attr = TERM_WHITE;
1184 TERM_LEN wid, hgt, row_speed, col_speed;
1186 Term_get_size(&wid, &hgt);
1187 col_speed = wid + COL_SPEED;
1188 row_speed = hgt + ROW_SPEED;
1190 /* Hack -- Visually "undo" the Search Mode Slowdown */
1191 if (p_ptr->action == ACTION_SEARCH && !p_ptr->lightspeed) i += 10;
1198 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
1199 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1200 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1201 else attr = TERM_GREEN;
1203 else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
1204 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1205 else attr = TERM_L_GREEN;
1206 sprintf(buf, "%s(+%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("加速", "Fast")), (i - 110));
1214 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
1215 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1216 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1217 else attr = TERM_RED;
1219 else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
1220 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1221 else attr = TERM_L_UMBER;
1222 sprintf(buf, "%s(-%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("減速", "Slow")), (110 - i));
1224 else if (p_ptr->riding)
1227 strcpy(buf, _("乗馬中", "Riding"));
1230 /* Display the speed */
1231 c_put_str(attr, format("%-9s", buf), row_speed, col_speed);
1236 * @brief プレイヤーの呪文学習可能状態を表示する
1239 static void prt_study(void)
1241 TERM_LEN wid, hgt, row_study, col_study;
1243 Term_get_size(&wid, &hgt);
1244 col_study = wid + COL_STUDY;
1245 row_study = hgt + ROW_STUDY;
1247 if (p_ptr->new_spells)
1249 put_str(_("学習", "Stud"), row_study, col_study);
1253 put_str(" ", row_study, col_study);
1259 * @brief プレイヤーのものまね可能状態を表示する
1262 static void prt_imitation(void)
1264 TERM_LEN wid, hgt, row_study, col_study;
1266 Term_get_size(&wid, &hgt);
1267 col_study = wid + COL_STUDY;
1268 row_study = hgt + ROW_STUDY;
1270 if (p_ptr->pclass == CLASS_IMITATOR)
1272 if (p_ptr->mane_num)
1275 if (new_mane) attr = TERM_L_RED;
1276 else attr = TERM_WHITE;
1277 c_put_str(attr, _("まね", "Imit"), row_study, col_study);
1281 put_str(" ", row_study, col_study);
1287 * @brief プレイヤーの負傷状態を表示する
1290 static void prt_cut(void)
1296 c_put_str(TERM_L_RED, _("致命傷 ", "Mortal wound"), ROW_CUT, COL_CUT);
1300 c_put_str(TERM_RED, _("ひどい深手 ", "Deep gash "), ROW_CUT, COL_CUT);
1304 c_put_str(TERM_RED, _("重傷 ", "Severe cut "), ROW_CUT, COL_CUT);
1308 c_put_str(TERM_ORANGE, _("大変な傷 ", "Nasty cut "), ROW_CUT, COL_CUT);
1312 c_put_str(TERM_ORANGE, _("ひどい傷 ", "Bad cut "), ROW_CUT, COL_CUT);
1316 c_put_str(TERM_YELLOW, _("軽傷 ", "Light cut "), ROW_CUT, COL_CUT);
1320 c_put_str(TERM_YELLOW, _("かすり傷 ", "Graze "), ROW_CUT, COL_CUT);
1324 put_str(" ", ROW_CUT, COL_CUT);
1330 * @brief プレイヤーの朦朧状態を表示する
1333 static void prt_stun(void)
1335 int s = p_ptr->stun;
1339 c_put_str(TERM_RED, _("意識不明瞭 ", "Knocked out "), ROW_STUN, COL_STUN);
1343 c_put_str(TERM_ORANGE, _("ひどく朦朧 ", "Heavy stun "), ROW_STUN, COL_STUN);
1347 c_put_str(TERM_ORANGE, _("朦朧 ", "Stun "), ROW_STUN, COL_STUN);
1351 put_str(" ", ROW_STUN, COL_STUN);
1358 * @brief モンスターの体力ゲージを表示する
1359 * @param riding TRUEならば騎乗中のモンスターの体力、FALSEならターゲットモンスターの体力を表示する。表示位置は固定。
1363 * Redraw the "monster health bar" -DRS-
1364 * Rather extensive modifications by -BEN-
1366 * The "monster health bar" provides visual feedback on the "health"
1367 * of the monster currently being "tracked". There are several ways
1368 * to "track" a monster, including targetting it, attacking it, and
1369 * affecting it (and nobody else) with a ranged attack.
1371 * Display the monster health bar (affectionately known as the
1372 * "health-o-meter"). Clear health bar if nothing is being tracked.
1373 * Auto-track current target monster when bored. Note that the
1374 * health-bar stops tracking any monster that "disappears".
1377 static void health_redraw(bool riding)
1381 monster_type *m_ptr;
1385 health_who = p_ptr->riding;
1386 row = ROW_RIDING_INFO;
1387 col = COL_RIDING_INFO;
1391 health_who = p_ptr->health_who;
1396 m_ptr = ¤t_floor_ptr->m_list[health_who];
1398 if (p_ptr->wizard && p_ptr->inside_battle)
1403 Term_putstr(col - 2, row, 12, TERM_WHITE, " / ");
1404 Term_putstr(col - 2, row + 1, 12, TERM_WHITE, " / ");
1405 Term_putstr(col - 2, row + 2, 12, TERM_WHITE, " / ");
1406 Term_putstr(col - 2, row + 3, 12, TERM_WHITE, " / ");
1408 if(current_floor_ptr->m_list[1].r_idx)
1410 Term_putstr(col - 2, row, 2, r_info[current_floor_ptr->m_list[1].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[1].r_idx].x_char));
1411 Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].hp));
1412 Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].max_maxhp));
1415 if(current_floor_ptr->m_list[2].r_idx)
1417 Term_putstr(col - 2, row + 1, 2, r_info[current_floor_ptr->m_list[2].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[2].r_idx].x_char));
1418 Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].hp));
1419 Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].max_maxhp));
1422 if(current_floor_ptr->m_list[3].r_idx)
1424 Term_putstr(col - 2, row + 2, 2, r_info[current_floor_ptr->m_list[3].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[3].r_idx].x_char));
1425 Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].hp));
1426 Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].max_maxhp));
1429 if(current_floor_ptr->m_list[4].r_idx)
1431 Term_putstr(col - 2, row + 3, 2, r_info[current_floor_ptr->m_list[4].r_idx].x_attr, format("%c", r_info[current_floor_ptr->m_list[4].r_idx].x_char));
1432 Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].hp));
1433 Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].max_maxhp));
1442 /* Erase the health bar */
1443 Term_erase(col, row, 12);
1446 /* Tracking an unseen monster */
1447 else if (!m_ptr->ml)
1449 /* Indicate that the monster health is "unknown" */
1450 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1453 /* Tracking a hallucinatory monster */
1454 else if (p_ptr->image)
1456 /* Indicate that the monster health is "unknown" */
1457 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1460 /* Tracking a dead monster (???) */
1461 else if (m_ptr->hp < 0)
1463 /* Indicate that the monster health is "unknown" */
1464 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1467 /* Tracking a visible monster */
1470 /* Extract the "percent" of health */
1471 int pct = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->maxhp : 0;
1472 int pct2 = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->max_maxhp: 0;
1474 /* Convert percent into "health" */
1475 int len = (pct2 < 10) ? 1 : (pct2 < 90) ? (pct2 / 10 + 1) : 10;
1477 /* Default to almost dead */
1478 TERM_COLOR attr = TERM_RED;
1481 if (MON_INVULNER(m_ptr)) attr = TERM_WHITE;
1484 else if (MON_CSLEEP(m_ptr)) attr = TERM_BLUE;
1487 else if (MON_MONFEAR(m_ptr)) attr = TERM_VIOLET;
1490 else if (pct >= 100) attr = TERM_L_GREEN;
1492 /* Somewhat Wounded */
1493 else if (pct >= 60) attr = TERM_YELLOW;
1496 else if (pct >= 25) attr = TERM_ORANGE;
1499 else if (pct >= 10) attr = TERM_L_RED;
1501 /* Default to "unknown" */
1502 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1504 /* Dump the current "health" (use '*' symbols) */
1505 Term_putstr(col + 1, row, len, attr, "**********");
1513 * @brief プレイヤーのステータスを一括表示する(左側部分) / Display basic info (mostly left of map)
1516 static void prt_frame_basic(void)
1519 if (p_ptr->mimic_form)
1520 prt_field(mimic_info[p_ptr->mimic_form].title, ROW_RACE, COL_RACE);
1524 my_strcpy(str, rp_ptr->title, sizeof(str));
1525 prt_field(str, ROW_RACE, COL_RACE);
1531 for (i = 0; i < A_MAX; i++) prt_stat(i);
1537 health_redraw(FALSE);
1538 health_redraw(TRUE);
1543 * @brief プレイヤーのステータスを一括表示する(下部分) / Display extra info (mostly below map)
1546 static void prt_frame_extra(void)
1560 * @brief サブウィンドウに所持品一覧を表示する / Hack -- display p_ptr->inventory_list in sub-windows
1563 static void fix_inven(void)
1568 for (j = 0; j < 8; j++)
1573 if (!angband_term[j]) continue;
1575 /* No relevant flags */
1576 if (!(window_flag[j] & (PW_INVEN))) continue;
1579 Term_activate(angband_term[j]);
1581 /* Display p_ptr->inventory_list */
1590 * @brief モンスターの現在数を一行で表現する / Print monster info in line
1593 * @param m_ptr 思い出を表示するモンスター情報の参照ポインタ
1594 * @param n_same モンスターの数の現在数
1598 * nnn : number or unique(U) or wanted unique(W)
1599 * X : symbol of monster
1600 * LV : monster lv if known
1601 * name: name of monster
1605 static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type* m_ptr, int n_same){
1608 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1609 monster_race* r_ptr = &r_info[r_idx];
1613 //Number of 'U'nique
1614 if(r_ptr->flags1&RF1_UNIQUE){//unique
1615 bool is_kubi = FALSE;
1616 for(i=0;i<MAX_KUBI;i++){
1617 if(current_world_ptr->bounty_r_idx[i] == r_idx){
1622 Term_addstr(-1, TERM_WHITE, is_kubi?" W":" U");
1624 sprintf(buf, "%3d", n_same);
1625 Term_addstr(-1, TERM_WHITE, buf);
1628 Term_addstr(-1, TERM_WHITE, " ");
1629 //Term_add_bigch(r_ptr->d_attr, r_ptr->d_char);
1630 //Term_addstr(-1, TERM_WHITE, "/");
1631 Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
1633 if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){
1634 sprintf(buf, " %2d", (int)r_ptr->level);
1638 Term_addstr(-1, TERM_WHITE, buf);
1640 sprintf(buf, " %s ", r_name+r_ptr->name);
1641 Term_addstr(-1, TERM_WHITE, buf);
1643 //Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0));
1647 * @brief モンスターの出現リストを表示する / Print monster info in line
1650 * @param max_lines 最大何行描画するか
1652 void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
1654 monster_type* last_mons = NULL;
1655 monster_type* m_ptr = NULL;
1659 for(i=0;i<tmp_pos.n;i++){
1660 grid_type* g_ptr = ¤t_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]];
1661 if(!g_ptr->m_idx || !current_floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look
1662 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1663 if(is_pet(m_ptr))continue;//pet
1664 if(!m_ptr->r_idx)continue;//dead?
1667 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1668 monster_race* r_ptr = &r_info[r_idx];
1669 concptr name = (r_name + r_ptr->name);
1670 concptr ename = (r_name + r_ptr->name);
1671 //ミミック類や「それ」等は、一覧に出てはいけない
1672 if(r_ptr->flags1&RF1_CHAR_CLEAR)continue;
1673 if((r_ptr->flags1&RF1_NEVER_MOVE)&&(r_ptr->flags2&RF2_CHAR_MULTI))continue;
1675 if((strcmp(name, "生ける虚無『ヌル』")==0)||
1676 (strcmp(ename, "Null the Living Void")==0))continue;
1677 //"金無垢の指輪"は、一覧に出てはいけない
1678 if((strcmp(name, "金無垢の指輪")==0)||
1679 (strcmp(ename, "Plain Gold Ring")==0))continue;
1683 //ソート済みなので同じモンスターは連続する.これを利用して同じモンスターをカウント,まとめて表示する.
1684 if(!last_mons){//先頭モンスター
1690 if(last_mons->ap_r_idx == m_ptr->ap_r_idx){
1692 continue;//表示処理を次に回す
1694 //print last mons info
1695 print_monster_line(x, line++, last_mons, n_same);
1698 if(line-y-1==max_lines){//残り1行
1702 if(line-y-1==max_lines && i!=tmp_pos.n){
1703 Term_gotoxy(x, line);
1704 Term_addstr(-1, TERM_WHITE, "-- and more --");
1706 if(last_mons)print_monster_line(x, line++, last_mons, n_same);
1711 * @brief 出現中モンスターのリストをサブウィンドウに表示する / Hack -- display monster list in sub-windows
1714 static void fix_monster_list(void)
1720 for (j = 0; j < 8; j++)
1725 if (!angband_term[j]) continue;
1727 /* No relevant flags */
1728 if (!(window_flag[j] & (PW_MONSTER_LIST))) continue;
1731 Term_activate(angband_term[j]);
1732 Term_get_size(&w, &h);
1736 target_set_prepare_look();//モンスター一覧を生成,ソート
1737 print_monster_list(0, 0, h);
1746 * @brief 現在の装備品をサブウィンドウに表示する /
1747 * Hack -- display equipment in sub-windows
1750 static void fix_equip(void)
1755 for (j = 0; j < 8; j++)
1760 if (!angband_term[j]) continue;
1762 /* No relevant flags */
1763 if (!(window_flag[j] & (PW_EQUIP))) continue;
1766 Term_activate(angband_term[j]);
1768 /* Display equipment */
1777 * @brief 現在の習得済魔法をサブウィンドウに表示する /
1778 * Hack -- display spells in sub-windows
1781 static void fix_spell(void)
1786 for (j = 0; j < 8; j++)
1791 if (!angband_term[j]) continue;
1793 /* No relevant flags */
1794 if (!(window_flag[j] & (PW_SPELL))) continue;
1797 Term_activate(angband_term[j]);
1799 /* Display spell list */
1800 display_spell_list();
1808 * @brief 現在のプレイヤーステータスをサブウィンドウに表示する /
1809 * Hack -- display character in sub-windows
1812 static void fix_player(void)
1817 for (j = 0; j < 8; j++)
1822 if (!angband_term[j]) continue;
1824 /* No relevant flags */
1825 if (!(window_flag[j] & (PW_PLAYER))) continue;
1828 Term_activate(angband_term[j]);
1838 * @brief ゲームメッセージ履歴をサブウィンドウに表示する /
1839 * Hack -- display recent messages in sub-windows
1840 * Adjust for width and split messages
1843 static void fix_message(void)
1850 for (j = 0; j < 8; j++)
1855 if (!angband_term[j]) continue;
1857 /* No relevant flags */
1858 if (!(window_flag[j] & (PW_MESSAGE))) continue;
1861 Term_activate(angband_term[j]);
1863 Term_get_size(&w, &h);
1866 for (i = 0; i < h; i++)
1868 /* Dump the message on the appropriate line */
1869 Term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
1872 Term_locate(&x, &y);
1874 /* Clear to end of line */
1875 Term_erase(x, y, 255);
1884 * @brief 簡易マップをサブウィンドウに表示する /
1885 * Hack -- display overhead view in sub-windows
1886 * Adjust for width and split messages
1889 * Note that the "player" symbol does NOT appear on the map.
1891 static void fix_overhead(void)
1897 for (j = 0; j < 8; j++)
1903 if (!angband_term[j]) continue;
1905 /* No relevant flags */
1906 if (!(window_flag[j] & (PW_OVERHEAD))) continue;
1909 Term_activate(angband_term[j]);
1911 /* Full map in too small window is useless */
1912 Term_get_size(&wid, &hgt);
1913 if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2)
1916 display_map(&cy, &cx);
1923 static void display_dungeon(void)
1930 SYMBOL_CODE tc = '\0';
1932 for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++)
1934 for (y = p_ptr->y - Term->hgt / 2 + 1; y <= p_ptr->y + Term->hgt / 2; y++)
1936 if (in_bounds2(y, x))
1938 map_info(y, x, &a, &c, &ta, &tc);
1940 /* Hack -- fake monochrome */
1943 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
1944 else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
1945 else if (p_ptr->wraith_form) a = TERM_L_DARK;
1948 /* Hack -- Queue it */
1949 Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
1953 /* Clear out-of-bound tiles */
1955 /* Access darkness */
1956 feature_type *f_ptr = &f_info[feat_none];
1959 a = f_ptr->x_attr[F_LIT_STANDARD];
1962 c = f_ptr->x_char[F_LIT_STANDARD];
1964 /* Hack -- Queue it */
1965 Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
1972 * @brief ダンジョンの地形をサブウィンドウに表示する /
1973 * Hack -- display dungeon view in sub-windows
1976 static void fix_dungeon(void)
1981 for (j = 0; j < 8; j++)
1986 if (!angband_term[j]) continue;
1988 /* No relevant flags */
1989 if (!(window_flag[j] & (PW_DUNGEON))) continue;
1992 Term_activate(angband_term[j]);
1994 /* Redraw dungeon view */
2003 * @brief モンスターの思い出をサブウィンドウに表示する /
2004 * Hack -- display dungeon view in sub-windows
2007 static void fix_monster(void)
2012 for (j = 0; j < 8; j++)
2017 if (!angband_term[j]) continue;
2019 /* No relevant flags */
2020 if (!(window_flag[j] & (PW_MONSTER))) continue;
2023 Term_activate(angband_term[j]);
2025 /* Display monster race info */
2026 if (p_ptr->monster_race_idx) display_roff(p_ptr->monster_race_idx);
2034 * @brief ベースアイテム情報をサブウィンドウに表示する /
2035 * Hack -- display object recall in sub-windows
2038 static void fix_object(void)
2043 for (j = 0; j < 8; j++)
2048 if (!angband_term[j]) continue;
2050 /* No relevant flags */
2051 if (!(window_flag[j] & (PW_OBJECT))) continue;
2054 Term_activate(angband_term[j]);
2056 /* Display monster race info */
2057 if (p_ptr->object_kind_idx) display_koff(p_ptr->object_kind_idx);
2066 * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 /
2067 * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
2068 * @return 重すぎるならばTRUE
2070 bool is_heavy_shoot(object_type *o_ptr)
2072 int hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
2073 /* It is hard to carholdry a heavy bow */
2074 return (hold < o_ptr->weight / 10);
2079 * @brief p_ptr->redraw のフラグに応じた更新をまとめて行う / Handle "p_ptr->redraw"
2081 * @details 更新処理の対象はゲーム中の全描画処理
2083 void redraw_stuff(void)
2085 if (!p_ptr->redraw) return;
2087 /* Character is not ready yet, no screen updates */
2088 if (!current_world_ptr->character_generated) return;
2090 /* Character is in "icky" mode, no screen updates */
2091 if (current_world_ptr->character_icky) return;
2093 /* Hack -- clear the screen */
2094 if (p_ptr->redraw & (PR_WIPE))
2096 p_ptr->redraw &= ~(PR_WIPE);
2101 if (p_ptr->redraw & (PR_MAP))
2103 p_ptr->redraw &= ~(PR_MAP);
2107 if (p_ptr->redraw & (PR_BASIC))
2109 p_ptr->redraw &= ~(PR_BASIC);
2110 p_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
2111 p_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
2112 p_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
2113 p_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
2119 if (p_ptr->redraw & (PR_EQUIPPY))
2121 p_ptr->redraw &= ~(PR_EQUIPPY);
2122 print_equippy(); /* To draw / delete equippy chars */
2125 if (p_ptr->redraw & (PR_MISC))
2127 p_ptr->redraw &= ~(PR_MISC);
2128 prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
2129 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
2132 if (p_ptr->redraw & (PR_TITLE))
2134 p_ptr->redraw &= ~(PR_TITLE);
2138 if (p_ptr->redraw & (PR_LEV))
2140 p_ptr->redraw &= ~(PR_LEV);
2144 if (p_ptr->redraw & (PR_EXP))
2146 p_ptr->redraw &= ~(PR_EXP);
2150 if (p_ptr->redraw & (PR_STATS))
2152 p_ptr->redraw &= ~(PR_STATS);
2161 if (p_ptr->redraw & (PR_STATUS))
2163 p_ptr->redraw &= ~(PR_STATUS);
2167 if (p_ptr->redraw & (PR_ARMOR))
2169 p_ptr->redraw &= ~(PR_ARMOR);
2173 if (p_ptr->redraw & (PR_HP))
2175 p_ptr->redraw &= ~(PR_HP);
2179 if (p_ptr->redraw & (PR_MANA))
2181 p_ptr->redraw &= ~(PR_MANA);
2185 if (p_ptr->redraw & (PR_GOLD))
2187 p_ptr->redraw &= ~(PR_GOLD);
2191 if (p_ptr->redraw & (PR_DEPTH))
2193 p_ptr->redraw &= ~(PR_DEPTH);
2197 if (p_ptr->redraw & (PR_HEALTH))
2199 p_ptr->redraw &= ~(PR_HEALTH);
2200 health_redraw(FALSE);
2203 if (p_ptr->redraw & (PR_UHEALTH))
2205 p_ptr->redraw &= ~(PR_UHEALTH);
2206 health_redraw(TRUE);
2209 if (p_ptr->redraw & (PR_EXTRA))
2211 p_ptr->redraw &= ~(PR_EXTRA);
2212 p_ptr->redraw &= ~(PR_CUT | PR_STUN);
2213 p_ptr->redraw &= ~(PR_HUNGER);
2214 p_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
2218 if (p_ptr->redraw & (PR_CUT))
2220 p_ptr->redraw &= ~(PR_CUT);
2224 if (p_ptr->redraw & (PR_STUN))
2226 p_ptr->redraw &= ~(PR_STUN);
2230 if (p_ptr->redraw & (PR_HUNGER))
2232 p_ptr->redraw &= ~(PR_HUNGER);
2236 if (p_ptr->redraw & (PR_STATE))
2238 p_ptr->redraw &= ~(PR_STATE);
2242 if (p_ptr->redraw & (PR_SPEED))
2244 p_ptr->redraw &= ~(PR_SPEED);
2248 if (p_ptr->pclass == CLASS_IMITATOR)
2250 if (p_ptr->redraw & (PR_IMITATION))
2252 p_ptr->redraw &= ~(PR_IMITATION);
2256 else if (p_ptr->redraw & (PR_STUDY))
2258 p_ptr->redraw &= ~(PR_STUDY);
2264 * @brief p_ptr->window のフラグに応じた更新をまとめて行う / Handle "p_ptr->window"
2266 * @details 更新処理の対象はサブウィンドウ全般
2268 void window_stuff(void)
2271 BIT_FLAGS mask = 0L;
2274 if (!p_ptr->window) return;
2277 for (j = 0; j < 8; j++)
2279 /* Save usable flags */
2280 if (angband_term[j]) mask |= window_flag[j];
2283 /* Apply usable flags */
2284 p_ptr->window &= mask;
2287 if (!p_ptr->window) return;
2289 /* Display p_ptr->inventory_list */
2290 if (p_ptr->window & (PW_INVEN))
2292 p_ptr->window &= ~(PW_INVEN);
2296 /* Display equipment */
2297 if (p_ptr->window & (PW_EQUIP))
2299 p_ptr->window &= ~(PW_EQUIP);
2303 /* Display spell list */
2304 if (p_ptr->window & (PW_SPELL))
2306 p_ptr->window &= ~(PW_SPELL);
2310 /* Display player */
2311 if (p_ptr->window & (PW_PLAYER))
2313 p_ptr->window &= ~(PW_PLAYER);
2317 /* Display monster list */
2318 if (p_ptr->window & (PW_MONSTER_LIST))
2320 p_ptr->window &= ~(PW_MONSTER_LIST);
2324 /* Display overhead view */
2325 if (p_ptr->window & (PW_MESSAGE))
2327 p_ptr->window &= ~(PW_MESSAGE);
2331 /* Display overhead view */
2332 if (p_ptr->window & (PW_OVERHEAD))
2334 p_ptr->window &= ~(PW_OVERHEAD);
2338 /* Display overhead view */
2339 if (p_ptr->window & (PW_DUNGEON))
2341 p_ptr->window &= ~(PW_DUNGEON);
2345 /* Display monster recall */
2346 if (p_ptr->window & (PW_MONSTER))
2348 p_ptr->window &= ~(PW_MONSTER);
2352 /* Display object recall */
2353 if (p_ptr->window & (PW_OBJECT))
2355 p_ptr->window &= ~(PW_OBJECT);
2361 * @brief コンソールのリサイズに合わせてマップを再描画する /
2362 * Map resizing whenever the main term changes size
2365 void resize_map(void)
2367 /* Only if the dungeon exists */
2368 if (!current_world_ptr->character_dungeon) return;
2370 /* Mega-Hack -- no panel yet */
2374 /* Reset the panels */
2375 panel_row_min = current_floor_ptr->height;
2376 panel_col_min = current_floor_ptr->width;
2380 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2381 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2382 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2383 p_ptr->update |= (PU_MONSTERS);
2384 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2391 * Place the cursor on the player
2393 if (can_save) move_cursor_relative(p_ptr->y, p_ptr->x);
2399 * @brief コンソールを再描画する /
2400 * Redraw a term when it is resized
2403 void redraw_window(void)
2405 /* Only if the dungeon exists */
2406 if (!current_world_ptr->character_dungeon) return;
2408 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2409 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2417 * @brief フォーカスを当てるべきマップ描画の基準座標を指定する(サブルーチン)
2418 * @param dy 変更先のフロアY座標
2419 * @param dx 変更先のフロアX座標
2420 * Handle a request to change the current panel
2421 * Return TRUE if the panel was changed.
2422 * Also used in do_cmd_locate
2423 * @return 実際に再描画が必要だった場合TRUEを返す
2425 bool change_panel(POSITION dy, POSITION dx)
2430 get_screen_size(&wid, &hgt);
2432 /* Apply the motion */
2433 y = panel_row_min + dy * hgt / 2;
2434 x = panel_col_min + dx * wid / 2;
2436 /* Verify the row */
2437 if (y > current_floor_ptr->height - hgt) y = current_floor_ptr->height - hgt;
2440 /* Verify the col */
2441 if (x > current_floor_ptr->width - wid) x = current_floor_ptr->width - wid;
2444 /* Handle "changes" */
2445 if ((y != panel_row_min) || (x != panel_col_min))
2447 /* Save the new panel info */
2451 panel_bounds_center();
2453 p_ptr->update |= (PU_MONSTERS);
2454 p_ptr->redraw |= (PR_MAP);
2466 * @brief プレイヤーの装備一覧シンボルを固定位置に表示する
2469 void print_equippy(void)
2471 display_player_equippy(ROW_EQUIPPY, COL_EQUIPPY, 0);
2475 * @brief 現在のコンソール表示の縦横を返す。 /
2476 * Get term size and calculate screen size
2477 * @param wid_p コンソールの表示幅文字数を返す
2478 * @param hgt_p コンソールの表示行数を返す
2481 void get_screen_size(TERM_LEN *wid_p, TERM_LEN *hgt_p)
2483 Term_get_size(wid_p, hgt_p);
2484 *hgt_p -= ROW_MAP + 2;
2485 *wid_p -= COL_MAP + 2;
2486 if (use_bigtile) *wid_p /= 2;
2490 * Calculate panel colum of a location in the map
2492 int panel_col_of(int col)
2494 col -= panel_col_min;
2495 if (use_bigtile) col *= 2;
2500 * Prints the map of the dungeon
2502 * Note that, for efficiency, we contain an "optimized" version
2503 * of both "lite_spot()" and "print_rel()", and that we use the
2504 * "lite_spot()" function to display the player grid, if needed.
2512 POSITION xmin, xmax, ymin, ymax;
2516 Term_get_size(&wid, &hgt);
2518 /* Remove map offset */
2522 /* Access the cursor state */
2523 (void)Term_get_cursor(&v);
2525 /* Hide the cursor */
2526 (void)Term_set_cursor(0);
2529 xmin = (0 < panel_col_min) ? panel_col_min : 0;
2530 xmax = (current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : current_floor_ptr->width - 1;
2531 ymin = (0 < panel_row_min) ? panel_row_min : 0;
2532 ymax = (current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : current_floor_ptr->height - 1;
2534 /* Bottom section of screen */
2535 for (y = 1; y <= ymin - panel_row_prt; y++)
2537 /* Erase the section */
2538 Term_erase(COL_MAP, y, wid);
2541 /* Top section of screen */
2542 for (y = ymax - panel_row_prt; y <= hgt; y++)
2544 /* Erase the section */
2545 Term_erase(COL_MAP, y, wid);
2549 for (y = ymin; y <= ymax; y++)
2551 /* Scan the columns of row "y" */
2552 for (x = xmin; x <= xmax; x++)
2560 /* Determine what is there */
2561 map_info(y, x, &a, &c, &ta, &tc);
2563 /* Hack -- fake monochrome */
2566 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
2567 else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
2568 else if (p_ptr->wraith_form) a = TERM_L_DARK;
2571 /* Efficiency -- Redraw that grid of the map */
2572 Term_queue_bigchar(panel_col_of(x), y - panel_row_prt, a, c, ta, tc);
2576 /* Display player */
2577 lite_spot(p_ptr->y, p_ptr->x);
2579 /* Restore the cursor */
2580 (void)Term_set_cursor(v);
2586 * 一般的にモンスターシンボルとして扱われる記号を定義する(幻覚処理向け) / Hack -- Legal monster codes
2588 static char image_monster_hack[] = \
2589 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2592 * 一般的にオブジェクトシンボルとして扱われる記号を定義する(幻覚処理向け) / Hack -- Legal object codes
2594 static char image_object_hack[] = "?/|\\\"!$()_-=[]{},~";
2597 * @brief モンスターの表示を幻覚状態に差し替える / Mega-Hack -- Hallucinatory monster
2602 static void image_monster(TERM_COLOR *ap, SYMBOL_CODE *cp)
2604 /* Random symbol from set above */
2607 monster_race *r_ptr = &r_info[randint1(max_r_idx - 1)];
2609 *cp = r_ptr->x_char;
2610 *ap = r_ptr->x_attr;
2615 *cp = (one_in_(25) ?
2616 image_object_hack[randint0(sizeof(image_object_hack) - 1)] :
2617 image_monster_hack[randint0(sizeof(image_monster_hack) - 1)]);
2625 * @brief オブジェクトの表示を幻覚状態に差し替える / Hallucinatory object
2630 static void image_object(TERM_COLOR *ap, SYMBOL_CODE *cp)
2634 object_kind *k_ptr = &k_info[randint1(max_k_idx - 1)];
2636 *cp = k_ptr->x_char;
2637 *ap = k_ptr->x_attr;
2641 int n = sizeof(image_object_hack) - 1;
2643 *cp = image_object_hack[randint0(n)];
2652 * @brief オブジェクト&モンスターの表示を幻覚状態に差し替える / Hack -- Random hallucination
2657 static void image_random(TERM_COLOR *ap, SYMBOL_CODE *cp)
2659 /* Normally, assume monsters */
2660 if (randint0(100) < 75)
2662 image_monster(ap, cp);
2665 /* Otherwise, assume objects */
2668 image_object(ap, cp);
2673 * 照明の表現を行うための色合いの関係を{暗闇時, 照明時} で定義する /
2674 * This array lists the effects of "brightness" on various "base" colours.\n
2676 * This is used to do dynamic lighting effects in ascii :-)\n
2677 * At the moment, only the various "floor" tiles are affected.\n
2679 * The layout of the array is [x][0] = light and [x][1] = dark.\n
2681 static TERM_COLOR lighting_colours[16][2] =
2684 {TERM_L_DARK, TERM_DARK},
2687 {TERM_YELLOW, TERM_SLATE},
2690 {TERM_WHITE, TERM_L_DARK},
2693 {TERM_L_UMBER, TERM_UMBER},
2696 {TERM_RED, TERM_RED},
2699 {TERM_L_GREEN, TERM_GREEN},
2702 {TERM_BLUE, TERM_BLUE},
2705 {TERM_L_UMBER, TERM_RED},
2708 {TERM_SLATE, TERM_L_DARK},
2711 {TERM_WHITE, TERM_SLATE},
2714 {TERM_L_RED, TERM_BLUE},
2717 {TERM_YELLOW, TERM_ORANGE},
2720 {TERM_L_RED, TERM_L_RED},
2723 {TERM_L_GREEN, TERM_GREEN},
2726 {TERM_L_BLUE, TERM_L_BLUE},
2729 {TERM_L_UMBER, TERM_UMBER}
2737 void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE f_char[F_LIT_MAX])
2739 TERM_COLOR s_attr = f_attr[F_LIT_STANDARD];
2740 SYMBOL_CODE s_char = f_char[F_LIT_STANDARD];
2743 if (IS_ASCII_GRAPHICS(s_attr)) /* For ASCII */
2745 f_attr[F_LIT_LITE] = lighting_colours[s_attr & 0x0f][0];
2746 f_attr[F_LIT_DARK] = lighting_colours[s_attr & 0x0f][1];
2747 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++) f_char[i] = s_char;
2749 else /* For tile graphics */
2751 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++) f_attr[i] = s_attr;
2752 f_char[F_LIT_LITE] = s_char + 2;
2753 f_char[F_LIT_DARK] = s_char + 1;
2759 * @brief Mコマンドによる縮小マップの表示を行う / Extract the attr/char to display at the given (legal) map location
2761 * Basically, we "paint" the chosen attr/char in several passes, starting\n
2762 * with any known "terrain features" (defaulting to darkness), then adding\n
2763 * any known "objects", and finally, adding any known "monsters". This\n
2764 * is not the fastest method but since most of the calls to this function\n
2765 * are made for grids with no monsters or objects, it is fast enough.\n
2767 * Note that this function, if used on the grid containing the "player",\n
2768 * will return the attr/char of the grid underneath the player, and not\n
2769 * the actual player attr/char itself, allowing a lot of optimization\n
2770 * in various "display" functions.\n
2772 * Note that the "zero" entry in the feature/object/monster arrays are\n
2773 * used to provide "special" attr/char codes, with "monster zero" being\n
2774 * used for the player attr/char, "object zero" being used for the "stack"\n
2775 * attr/char, and "feature zero" being used for the "nothing" attr/char,\n
2776 * though this function makes use of only "feature zero".\n
2778 * Note that monsters can have some "special" flags, including "ATTR_MULTI",\n
2779 * which means their color changes, and "ATTR_CLEAR", which means they take\n
2780 * the color of whatever is under them, and "CHAR_CLEAR", which means that\n
2781 * they take the symbol of whatever is under them. Technically, the flag\n
2782 * "CHAR_MULTI" is supposed to indicate that a monster looks strange when\n
2783 * examined, but this flag is currently ignored.\n
2785 * Currently, we do nothing with multi-hued objects, because there are\n
2786 * not any. If there were, they would have to set "shimmer_objects"\n
2787 * when they were created, and then new "shimmer" code in "dungeon.c"\n
2788 * would have to be created handle the "shimmer" effect, and the code\n
2789 * in "current_floor_ptr->grid_array.c" would have to be updated to create the shimmer effect.\n
2791 * Note the effects of hallucination. Objects always appear as random\n
2792 * "objects", monsters as random "monsters", and normal grids occasionally\n
2793 * appear as random "monsters" or "objects", but note that these random\n
2794 * "monsters" and "objects" are really just "colored ascii symbols".\n
2796 * Note that "floors" and "invisible traps" (and "zero" features) are\n
2797 * drawn as "floors" using a special check for optimization purposes,\n
2798 * and these are the only features which get drawn using the special\n
2799 * lighting effects activated by "view_special_lite".\n
2801 * Note the use of the "mimic" field in the "terrain feature" processing,\n
2802 * which allows any feature to "pretend" to be another feature. This is\n
2803 * used to "hide" secret doors, and to make all "doors" appear the same,\n
2804 * and all "walls" appear the same, and "hidden" treasure stay hidden.\n
2805 * It is possible to use this field to make a feature "look" like a floor,\n
2806 * but the "special lighting effects" for floors will not be used.\n
2808 * Note the use of the new "terrain feature" information. Note that the\n
2809 * assumption that all interesting "objects" and "terrain features" are\n
2810 * memorized allows extremely optimized processing below. Note the use\n
2811 * of separate flags on objects to mark them as memorized allows a grid\n
2812 * to have memorized "terrain" without granting knowledge of any object\n
2813 * which may appear in that grid.\n
2815 * Note the efficient code used to determine if a "floor" grid is\n
2816 * "memorized" or "viewable" by the player, where the test for the\n
2817 * grid being "viewable" is based on the facts that (1) the grid\n
2818 * must be "lit" (torch-lit or perma-lit), (2) the grid must be in\n
2819 * line of sight, and (3) the player must not be blind, and uses the\n
2820 * assumption that all torch-lit grids are in line of sight.\n
2822 * Note that floors (and invisible traps) are the only grids which are\n
2823 * not memorized when seen, so only these grids need to check to see if\n
2824 * the grid is "viewable" to the player (if it is not memorized). Since\n
2825 * most non-memorized grids are in fact walls, this induces *massive*\n
2826 * efficiency, at the cost of *forcing* the memorization of non-floor\n
2827 * grids when they are first seen. Note that "invisible traps" are\n
2828 * always treated exactly like "floors", which prevents "cheating".\n
2830 * Note the "special lighting effects" which can be activated for floor\n
2831 * grids using the "view_special_lite" option (for "white" floor grids),\n
2832 * causing certain grids to be displayed using special colors. If the\n
2833 * player is "blind", we will use "dark gray", else if the grid is lit\n
2834 * by the torch, and the "view_yellow_lite" option is set, we will use\n
2835 * "yellow", else if the grid is "dark", we will use "dark gray", else\n
2836 * if the grid is not "viewable", and the "view_bright_lite" option is\n
2837 * set, and the we will use "slate" (gray). We will use "white" for all\n
2838 * other cases, in particular, for illuminated viewable floor grids.\n
2840 * Note the "special lighting effects" which can be activated for wall\n
2841 * grids using the "view_granite_lite" option (for "white" wall grids),\n
2842 * causing certain grids to be displayed using special colors. If the\n
2843 * player is "blind", we will use "dark gray", else if the grid is lit\n
2844 * by the torch, and the "view_yellow_lite" option is set, we will use\n
2845 * "yellow", else if the "view_bright_lite" option is set, and the grid\n
2846 * is not "viewable", or is "dark", or is glowing, but not when viewed\n
2847 * from the player's current location, we will use "slate" (gray). We\n
2848 * will use "white" for all other cases, in particular, for correctly\n
2849 * illuminated viewable wall grids.\n
2851 * Note that, when "view_granite_lite" is set, we use an inline version\n
2852 * of the "player_can_see_bold()" function to check the "viewability" of\n
2853 * grids when the "view_bright_lite" option is set, and we do NOT use\n
2854 * any special colors for "dark" wall grids, since this would allow the\n
2855 * player to notice the walls of illuminated rooms from a hallway that\n
2856 * happened to run beside the room. The alternative, by the way, would\n
2857 * be to prevent the generation of hallways next to rooms, but this\n
2858 * would still allow problems when digging towards a room.\n
2860 * Note that bizarre things must be done when the "attr" and/or "char"\n
2861 * codes have the "high-bit" set, since these values are used to encode\n
2862 * various "special" pictures in some versions, and certain situations,\n
2863 * such as "multi-hued" or "clear" monsters, cause the attr/char codes\n
2864 * to be "scrambled" in various ways.\n
2866 * Note that eventually we may use the "&" symbol for embedded treasure,\n
2867 * and use the "*" symbol to indicate multiple objects, though this will\n
2868 * have to wait for Angband 2.8.0 or later. Note that currently, this\n
2869 * is not important, since only one object or terrain feature is allowed\n
2870 * in each grid. If needed, "k_info[0]" will hold the "stack" attr/char.\n
2872 * Note the assumption that doing "x_ptr = &x_info[x]" plus a few of\n
2873 * "x_ptr->xxx", is quicker than "x_info[x].xxx", if this is incorrect\n
2874 * then a whole lot of code should be changed... XXX XXX\n
2876 void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLOR *tap, SYMBOL_CODE *tcp)
2878 /* Get the current_floor_ptr->grid_array */
2879 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2881 OBJECT_IDX this_o_idx, next_o_idx = 0;
2883 /* Feature code (applying "mimic" field) */
2884 FEAT_IDX feat = get_feat_mimic(g_ptr);
2887 feature_type *f_ptr = &f_info[feat];
2892 /* Boring grids (floors, etc) */
2893 if (!have_flag(f_ptr->flags, FF_REMEMBER))
2896 * Handle Memorized or visible floor
2898 * No visual when blinded.
2899 * (to prevent strange effects on darkness breath)
2901 * - Can see grids with CAVE_MARK.
2902 * - Can see grids with CAVE_LITE or CAVE_MNLT.
2903 * (Such grids also have CAVE_VIEW)
2904 * - Can see grids with CAVE_VIEW unless darkened by monsters.
2906 if (!p_ptr->blind &&
2907 ((g_ptr->info & (CAVE_MARK | CAVE_LITE | CAVE_MNLT)) ||
2908 ((g_ptr->info & CAVE_VIEW) && (((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) || p_ptr->see_nocto))))
2910 /* Normal attr/char */
2911 a = f_ptr->x_attr[F_LIT_STANDARD];
2912 c = f_ptr->x_char[F_LIT_STANDARD];
2914 if (p_ptr->wild_mode)
2916 /* Special lighting effects */
2917 /* Handle "night" */
2918 if (view_special_lite && !is_daytime())
2920 /* Use a darkened colour/tile */
2921 a = f_ptr->x_attr[F_LIT_DARK];
2922 c = f_ptr->x_char[F_LIT_DARK];
2926 /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
2927 else if (darkened_grid(g_ptr))
2929 /* Unsafe grid -- idea borrowed from Unangband */
2930 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
2932 /* Access darkness */
2933 f_ptr = &f_info[feat];
2935 /* Char and attr of darkness */
2936 a = f_ptr->x_attr[F_LIT_STANDARD];
2937 c = f_ptr->x_char[F_LIT_STANDARD];
2940 /* Special lighting effects */
2941 else if (view_special_lite)
2943 /* Handle "torch-lit" grids */
2944 if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
2947 if (view_yellow_lite)
2949 /* Use a brightly lit colour/tile */
2950 a = f_ptr->x_attr[F_LIT_LITE];
2951 c = f_ptr->x_char[F_LIT_LITE];
2955 /* Handle "dark" grids */
2956 else if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
2958 /* Use a darkened colour/tile */
2959 a = f_ptr->x_attr[F_LIT_DARK];
2960 c = f_ptr->x_char[F_LIT_DARK];
2963 /* Handle "out-of-sight" grids */
2964 else if (!(g_ptr->info & CAVE_VIEW))
2967 if (view_bright_lite)
2969 /* Use a darkened colour/tile */
2970 a = f_ptr->x_attr[F_LIT_DARK];
2971 c = f_ptr->x_char[F_LIT_DARK];
2980 /* Unsafe grid -- idea borrowed from Unangband */
2981 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
2983 /* Access darkness */
2984 f_ptr = &f_info[feat];
2986 /* Normal attr/char */
2987 a = f_ptr->x_attr[F_LIT_STANDARD];
2988 c = f_ptr->x_char[F_LIT_STANDARD];
2992 /* Interesting grids (non-floors) */
2995 /* Memorized grids */
2996 if (g_ptr->info & CAVE_MARK)
2998 /* Normal attr/char */
2999 a = f_ptr->x_attr[F_LIT_STANDARD];
3000 c = f_ptr->x_char[F_LIT_STANDARD];
3002 if (p_ptr->wild_mode)
3004 /* Special lighting effects */
3005 /* Handle "blind" or "night" */
3006 if (view_granite_lite && (p_ptr->blind || !is_daytime()))
3008 /* Use a darkened colour/tile */
3009 a = f_ptr->x_attr[F_LIT_DARK];
3010 c = f_ptr->x_char[F_LIT_DARK];
3014 /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
3015 else if (darkened_grid(g_ptr) && !p_ptr->blind)
3017 if (have_flag(f_ptr->flags, FF_LOS) && have_flag(f_ptr->flags, FF_PROJECT))
3019 /* Unsafe grid -- idea borrowed from Unangband */
3020 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
3022 /* Access darkness */
3023 f_ptr = &f_info[feat];
3025 /* Char and attr of darkness */
3026 a = f_ptr->x_attr[F_LIT_STANDARD];
3027 c = f_ptr->x_char[F_LIT_STANDARD];
3029 else if (view_granite_lite && view_bright_lite)
3031 /* Use a darkened colour/tile */
3032 a = f_ptr->x_attr[F_LIT_DARK];
3033 c = f_ptr->x_char[F_LIT_DARK];
3037 /* Special lighting effects */
3038 else if (view_granite_lite)
3040 /* Handle "blind" */
3043 /* Use a darkened colour/tile */
3044 a = f_ptr->x_attr[F_LIT_DARK];
3045 c = f_ptr->x_char[F_LIT_DARK];
3048 /* Handle "torch-lit" grids */
3049 else if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
3052 if (view_yellow_lite)
3054 /* Use a brightly lit colour/tile */
3055 a = f_ptr->x_attr[F_LIT_LITE];
3056 c = f_ptr->x_char[F_LIT_LITE];
3060 /* Handle "view_bright_lite" */
3061 else if (view_bright_lite)
3064 if (!(g_ptr->info & CAVE_VIEW))
3066 /* Use a darkened colour/tile */
3067 a = f_ptr->x_attr[F_LIT_DARK];
3068 c = f_ptr->x_char[F_LIT_DARK];
3072 else if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
3074 /* Use a darkened colour/tile */
3075 a = f_ptr->x_attr[F_LIT_DARK];
3076 c = f_ptr->x_char[F_LIT_DARK];
3079 /* Not glowing correctly */
3080 else if (!have_flag(f_ptr->flags, FF_LOS) && !check_local_illumination(y, x))
3082 /* Use a darkened colour/tile */
3083 a = f_ptr->x_attr[F_LIT_DARK];
3084 c = f_ptr->x_char[F_LIT_DARK];
3093 /* Unsafe grid -- idea borrowed from Unangband */
3094 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
3096 /* Access feature */
3097 f_ptr = &f_info[feat];
3099 /* Normal attr/char */
3100 a = f_ptr->x_attr[F_LIT_STANDARD];
3101 c = f_ptr->x_char[F_LIT_STANDARD];
3105 if (feat_priority == -1) feat_priority = f_ptr->priority;
3107 /* Save the terrain info for the transparency effects */
3115 /* Hack -- rare random hallucination, except on outer dungeon walls */
3120 image_random(ap, cp);
3125 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3128 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3129 next_o_idx = o_ptr->next_o_idx;
3131 /* Memorized objects */
3132 if (o_ptr->marked & OM_FOUND)
3134 if (display_autopick)
3138 match_autopick = is_autopick(o_ptr);
3139 if (match_autopick == -1)
3142 act = autopick_list[match_autopick].action;
3144 if ((act & DO_DISPLAY) && (act & display_autopick))
3146 autopick_obj = o_ptr;
3150 match_autopick = -1;
3155 (*cp) = object_char(o_ptr);
3158 (*ap) = object_attr(o_ptr);
3162 /* Hack -- hallucination */
3163 if (p_ptr->image) image_object(ap, cp);
3170 /* Handle monsters */
3171 if (g_ptr->m_idx && display_autopick == 0)
3173 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
3175 /* Visible monster */
3178 monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
3186 * Monsters with both CHAR_CLEAR and ATTR_CLEAR
3187 * flags are always unseen.
3189 if ((r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR)) == (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR))
3195 image_monster(ap, cp);
3200 /* Monster attr/char */
3204 if (!(r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_SHAPECHANGER | RF1_ATTR_CLEAR
3205 | RF1_ATTR_MULTI | RF1_ATTR_SEMIRAND)))
3207 /* Desired monster attr/char */
3213 * Monsters with both CHAR_CLEAR and ATTR_CLEAR
3214 * flags are always unseen.
3216 else if ((r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR)) == (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR))
3223 /*** Monster's attr ***/
3224 if ((r_ptr->flags1 & RF1_ATTR_CLEAR) && (*ap != TERM_DARK) && !use_graphics)
3229 else if ((r_ptr->flags1 & RF1_ATTR_MULTI) && !use_graphics)
3231 /* Multi-hued attr */
3232 if (r_ptr->flags2 & RF2_ATTR_ANY) *ap = randint1(15);
3233 else switch (randint1(7))
3235 case 1: *ap = TERM_RED; break;
3236 case 2: *ap = TERM_L_RED; break;
3237 case 3: *ap = TERM_WHITE; break;
3238 case 4: *ap = TERM_L_GREEN; break;
3239 case 5: *ap = TERM_BLUE; break;
3240 case 6: *ap = TERM_L_DARK; break;
3241 case 7: *ap = TERM_GREEN; break;
3244 else if ((r_ptr->flags1 & RF1_ATTR_SEMIRAND) && !use_graphics)
3246 /* Use semi-random attr (usually mimics' colors vary) */
3247 *ap = g_ptr->m_idx % 15 + 1;
3255 /*** Monster's char ***/
3256 if ((r_ptr->flags1 & RF1_CHAR_CLEAR) && (*cp != ' ') && !use_graphics)
3261 else if (r_ptr->flags1 & RF1_SHAPECHANGER)
3265 monster_race *tmp_r_ptr = &r_info[randint1(max_r_idx - 1)];
3266 *cp = tmp_r_ptr->x_char;
3267 *ap = tmp_r_ptr->x_attr;
3271 *cp = (one_in_(25) ?
3272 image_object_hack[randint0(sizeof(image_object_hack) - 1)] :
3273 image_monster_hack[randint0(sizeof(image_monster_hack) - 1)]);
3286 /* Handle "player" */
3287 if (player_bold(y, x))
3289 monster_race *r_ptr = &r_info[0];
3290 *ap = r_ptr->x_attr;
3291 *cp = r_ptr->x_char;
3297 static concptr simplify_list[][2] =
3304 {"^Amulet of ", "\""},
3305 {"^Scroll of ", "?"},
3306 {"^Scroll titled ", "?"},
3307 {"^Wand of " , "-"},
3309 {"^Staff of " , "_"},
3310 {"^Potion of ", "!"},
3323 static void display_shortened_item_name(object_type *o_ptr, int y)
3330 object_desc(buf, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NAME_ONLY));
3331 attr = tval_to_attr[o_ptr->tval % 128];
3336 strcpy(buf, _("何か奇妙な物", "something strange"));
3339 for (c = buf; *c; c++)
3342 for (i = 0; simplify_list[i][1]; i++)
3344 concptr org_w = simplify_list[i][0];
3354 if (!strncmp(c, org_w, strlen(org_w)))
3357 concptr tmp = simplify_list[i][1];
3360 tmp = c + strlen(org_w);
3376 if (len + 2 > 12) break;
3383 if (len + 1 > 12) break;
3389 Term_putstr(0, y, 12, attr, buf);
3393 * Display a "small-scale" map of the dungeon in the active Term
3395 void display_map(int *cy, int *cx)
3405 SYMBOL_CODE **bigmc;
3412 /* Save lighting effects */
3413 bool old_view_special_lite = view_special_lite;
3414 bool old_view_granite_lite = view_granite_lite;
3416 TERM_LEN hgt, wid, yrat, xrat;
3418 int **match_autopick_yx;
3419 object_type ***object_autopick_yx;
3421 Term_get_size(&wid, &hgt);
3424 if (use_bigtile) wid /= 2;
3426 yrat = (current_floor_ptr->height + hgt - 1) / hgt;
3427 xrat = (current_floor_ptr->width + wid - 1) / wid;
3429 /* Disable lighting effects */
3430 view_special_lite = FALSE;
3431 view_granite_lite = FALSE;
3433 /* Allocate the maps */
3434 C_MAKE(ma, (hgt + 2), TERM_COLOR *);
3435 C_MAKE(mc, (hgt + 2), char_ptr);
3436 C_MAKE(mp, (hgt + 2), byte_ptr);
3437 C_MAKE(match_autopick_yx, (hgt + 2), sint_ptr);
3438 C_MAKE(object_autopick_yx, (hgt + 2), object_type **);
3440 /* Allocate and wipe each line map */
3441 for (y = 0; y < (hgt + 2); y++)
3443 /* Allocate one row each array */
3444 C_MAKE(ma[y], (wid + 2), TERM_COLOR);
3445 C_MAKE(mc[y], (wid + 2), char);
3446 C_MAKE(mp[y], (wid + 2), byte);
3447 C_MAKE(match_autopick_yx[y], (wid + 2), int);
3448 C_MAKE(object_autopick_yx[y], (wid + 2), object_type *);
3450 for (x = 0; x < wid + 2; ++x)
3452 match_autopick_yx[y][x] = -1;
3453 object_autopick_yx[y][x] = NULL;
3456 ma[y][x] = TERM_WHITE;
3464 /* Allocate the maps */
3465 C_MAKE(bigma, (current_floor_ptr->height + 2), TERM_COLOR *);
3466 C_MAKE(bigmc, (current_floor_ptr->height + 2), char_ptr);
3467 C_MAKE(bigmp, (current_floor_ptr->height + 2), byte_ptr);
3469 /* Allocate and wipe each line map */
3470 for (y = 0; y < (current_floor_ptr->height + 2); y++)
3472 /* Allocate one row each array */
3473 C_MAKE(bigma[y], (current_floor_ptr->width + 2), TERM_COLOR);
3474 C_MAKE(bigmc[y], (current_floor_ptr->width + 2), char);
3475 C_MAKE(bigmp[y], (current_floor_ptr->width + 2), byte);
3477 for (x = 0; x < current_floor_ptr->width + 2; ++x)
3480 bigma[y][x] = TERM_WHITE;
3488 /* Fill in the map */
3489 for (i = 0; i < current_floor_ptr->width; ++i)
3491 for (j = 0; j < current_floor_ptr->height; ++j)
3496 match_autopick = -1;
3497 autopick_obj = NULL;
3500 /* Extract the current attr/char at that map location */
3501 map_info(j, i, &ta, &tc, &ta, &tc);
3503 /* Extract the priority */
3504 tp = (byte_hack)feat_priority;
3506 if (match_autopick != -1
3507 && (match_autopick_yx[y][x] == -1
3508 || match_autopick_yx[y][x] > match_autopick))
3510 match_autopick_yx[y][x] = match_autopick;
3511 object_autopick_yx[y][x] = autopick_obj;
3515 /* Save the char, attr and priority */
3516 bigmc[j + 1][i + 1] = tc;
3517 bigma[j + 1][i + 1] = ta;
3518 bigmp[j + 1][i + 1] = tp;
3522 for (j = 0; j < current_floor_ptr->height; ++j)
3524 for (i = 0; i < current_floor_ptr->width; ++i)
3529 tc = bigmc[j + 1][i + 1];
3530 ta = bigma[j + 1][i + 1];
3531 tp = bigmp[j + 1][i + 1];
3533 /* rare feature has more priority */
3539 for (t = 0; t < 8; t++)
3541 if (tc == bigmc[j + 1 + ddy_cdd[t]][i + 1 + ddx_cdd[t]] &&
3542 ta == bigma[j + 1 + ddy_cdd[t]][i + 1 + ddx_cdd[t]])
3552 /* Save the char, attr and priority */
3565 /* Draw the corners */
3566 mc[0][0] = mc[0][x] = mc[y][0] = mc[y][x] = '+';
3568 /* Draw the horizontal edges */
3569 for (x = 1; x <= wid; x++) mc[0][x] = mc[y][x] = '-';
3571 /* Draw the vertical edges */
3572 for (y = 1; y <= hgt; y++) mc[y][0] = mc[y][x] = '|';
3575 /* Display each map line in order */
3576 for (y = 0; y < hgt + 2; ++y)
3578 /* Start a new line */
3579 Term_gotoxy(COL_MAP, y);
3581 /* Display the line */
3582 for (x = 0; x < wid + 2; ++x)
3587 /* Hack -- fake monochrome */
3590 if (current_world_ptr->timewalk_m_idx) ta = TERM_DARK;
3591 else if (IS_INVULN() || p_ptr->timewalk) ta = TERM_WHITE;
3592 else if (p_ptr->wraith_form) ta = TERM_L_DARK;
3595 /* Add the character */
3596 Term_add_bigch(ta, tc);
3601 for (y = 1; y < hgt + 1; ++y)
3603 match_autopick = -1;
3604 for (x = 1; x <= wid; x++) {
3605 if (match_autopick_yx[y][x] != -1 &&
3606 (match_autopick > match_autopick_yx[y][x] ||
3607 match_autopick == -1)) {
3608 match_autopick = match_autopick_yx[y][x];
3609 autopick_obj = object_autopick_yx[y][x];
3613 /* Clear old display */
3614 Term_putstr(0, y, 12, 0, " ");
3616 if (match_autopick != -1)
3618 display_shortened_item_name(autopick_obj, y);
3621 char buf[13] = "\0";
3622 strncpy(buf, autopick_list[match_autopick].name, 12);
3630 /* Player location */
3631 (*cy) = p_ptr->y / yrat + 1 + ROW_MAP;
3633 (*cx) = p_ptr->x / xrat + 1 + COL_MAP;
3635 (*cx) = (p_ptr->x / xrat + 1) * 2 + COL_MAP;
3637 /* Restore lighting effects */
3638 view_special_lite = old_view_special_lite;
3639 view_granite_lite = old_view_granite_lite;
3641 /* Free each line map */
3642 for (y = 0; y < (hgt + 2); y++)
3644 /* Free one row each array */
3645 C_KILL(ma[y], (wid + 2), TERM_COLOR);
3646 C_KILL(mc[y], (wid + 2), SYMBOL_CODE);
3647 C_KILL(mp[y], (wid + 2), byte);
3648 C_KILL(match_autopick_yx[y], (wid + 2), int);
3649 C_KILL(object_autopick_yx[y], (wid + 2), object_type *);
3652 /* Free each line map */
3653 C_KILL(ma, (hgt + 2), TERM_COLOR *);
3654 C_KILL(mc, (hgt + 2), char_ptr);
3655 C_KILL(mp, (hgt + 2), byte_ptr);
3656 C_KILL(match_autopick_yx, (hgt + 2), sint_ptr);
3657 C_KILL(object_autopick_yx, (hgt + 2), object_type **);
3659 /* Free each line map */
3660 for (y = 0; y < (current_floor_ptr->height + 2); y++)
3662 /* Free one row each array */
3663 C_KILL(bigma[y], (current_floor_ptr->width + 2), TERM_COLOR);
3664 C_KILL(bigmc[y], (current_floor_ptr->width + 2), SYMBOL_CODE);
3665 C_KILL(bigmp[y], (current_floor_ptr->width + 2), byte);
3668 /* Free each line map */
3669 C_KILL(bigma, (current_floor_ptr->height + 2), TERM_COLOR *);
3670 C_KILL(bigmc, (current_floor_ptr->height + 2), char_ptr);
3671 C_KILL(bigmp, (current_floor_ptr->height + 2), byte_ptr);
3676 * Display a "small-scale" map of the dungeon for the player
3678 * Currently, the "player" is displayed on the map.
3680 void do_cmd_view_map(void)
3686 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
3691 display_autopick = 0;
3693 /* Display the map */
3694 display_map(&cy, &cx);
3697 if (max_autopick && !p_ptr->wild_mode)
3699 display_autopick = ITEM_DISPLAY;
3706 int wid, hgt, row_message;
3708 Term_get_size(&wid, &hgt);
3709 row_message = hgt - 1;
3711 put_str(_("何かキーを押してください('M':拾う 'N':放置 'D':M+N 'K':壊すアイテムを表示)",
3712 " Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items."), row_message, 1);
3714 /* Hilite the player */
3715 move_cursor(cy, cx);
3720 flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK);
3722 flag = DONT_AUTOPICK;
3724 flag = DO_AUTODESTROY;
3726 flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK | DONT_AUTOPICK);
3732 if (~display_autopick & flag)
3733 display_autopick |= flag;
3735 display_autopick &= ~flag;
3736 /* Display the map */
3737 display_map(&cy, &cx);
3740 display_autopick = 0;
3745 put_str(_("何かキーを押すとゲームに戻ります", "Hit any key to continue"), 23, 30);
3746 /* Hilite the player */
3747 move_cursor(cy, cx);
3755 * Track a new monster
3757 void health_track(MONSTER_IDX m_idx)
3759 /* Mount monster is already tracked */
3760 if (m_idx && m_idx == p_ptr->riding) return;
3762 /* Track a new guy */
3763 p_ptr->health_who = m_idx;
3765 /* Redraw (later) */
3766 p_ptr->redraw |= (PR_HEALTH);
3771 * Moves the cursor to a given MAP (y,x) location
3773 void move_cursor_relative(int row, int col)
3775 /* Real co-ords convert to screen positions */
3776 row -= panel_row_prt;
3779 Term_gotoxy(panel_col_of(col), row);
3784 * print project path
3786 void prt_path(POSITION y, POSITION x)
3791 byte_hack default_color = TERM_SLATE;
3793 if (!display_path) return;
3794 if (-1 == project_length)
3797 /* Get projection path */
3798 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), p_ptr->y, p_ptr->x, y, x, PROJECT_PATH | PROJECT_THRU);
3800 p_ptr->redraw |= (PR_MAP);
3804 for (i = 0; i < path_n; i++)
3806 POSITION ny = GRID_Y(path_g[i]);
3807 POSITION nx = GRID_X(path_g[i]);
3808 grid_type *g_ptr = ¤t_floor_ptr->grid_array[ny][nx];
3810 if (panel_contains(ny, nx))
3812 TERM_COLOR a = default_color;
3815 TERM_COLOR ta = default_color;
3818 if (g_ptr->m_idx && current_floor_ptr->m_list[g_ptr->m_idx].ml)
3820 /* Determine what is there */
3821 map_info(ny, nx, &a, &c, &ta, &tc);
3823 if (!IS_ASCII_GRAPHICS(a))
3825 else if (c == '.' && (a == TERM_WHITE || a == TERM_L_WHITE))
3827 else if (a == default_color)
3833 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
3834 else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
3835 else if (p_ptr->wraith_form) a = TERM_L_DARK;
3840 /* Hack -- Queue it */
3841 Term_queue_bigchar(panel_col_of(nx), ny - panel_row_prt, a, c, ta, tc);
3845 if ((g_ptr->info & CAVE_MARK) && !cave_have_flag_grid(g_ptr, FF_PROJECT)) break;
3848 if (nx == x && ny == y) default_color = TERM_L_DARK;
3854 * Hack -- track the given monster race
3856 void monster_race_track(MONRACE_IDX r_idx)
3858 /* Save this monster ID */
3859 p_ptr->monster_race_idx = r_idx;
3861 p_ptr->window |= (PW_MONSTER);
3865 * Hack -- track the given object kind
3867 void object_kind_track(KIND_OBJECT_IDX k_idx)
3869 /* Save this monster ID */
3870 p_ptr->object_kind_idx = k_idx;
3872 p_ptr->window |= (PW_OBJECT);
3877 * @brief 実ゲームプレイ時間を更新する
3879 void update_playtime(void)
3881 /* Check if the game has started */
3882 if (current_world_ptr->start_time != 0)
3884 u32b tmp = (u32b)time(NULL);
3885 current_world_ptr->play_time += (tmp - current_world_ptr->start_time);
3886 current_world_ptr->start_time = tmp;