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.
24 #include "player-status.h"
25 #include "player-class.h"
26 #include "player-race.h"
27 #include "player-effects.h"
29 #include "view-mainwindow.h"
32 #include "realm-hex.h"
34 #include "object-flavor.h"
39 #include "floor-town.h"
41 #include "objectkind.h"
42 #include "targeting.h"
44 static int feat_priority; /*!< マップ縮小表示時に表示すべき地形の優先度を保管する */
45 static byte display_autopick; /*!< 自動拾い状態の設定フラグ */
46 static int match_autopick;
47 static object_type *autopick_obj; /*!< 各種自動拾い処理時に使うオブジェクトポインタ */
50 * Some screen locations for various display routines
51 * Currently, row 8 and 15 are the only "blank" rows.
52 * That leaves a "border" around the "stat" values.
56 #define COL_RACE 0 /* <race name> */
58 /*#define ROW_CLASS 2 */
59 /*#define COL_CLASS 0 */ /* <class name> */
62 #define COL_TITLE 0 /* <title> or <mode> */
64 /*#define ROW_SEIKAKU 4 */
65 /*#define COL_SEIKAKU 0*/ /* <seikaku> */
68 #define COL_DAY 0 /* day */
70 #define ROW_DUNGEON 22
71 #define COL_DUNGEON 0 /* dungeon */
74 #define COL_LEVEL 0 /* "LEVEL xxxxxx" */
77 #define COL_EXP 0 /* "EXP xxxxxxxx" */
80 #define COL_GOLD 0 /* "AU xxxxxxxxx" */
83 #define COL_EQUIPPY 0 /* equippy chars */
86 #define COL_STAT 0 /* "xxx xxxxxx" */
89 #define COL_AC 0 /* "Cur AC xxxxx" */
95 #define COL_CURHP 0 /* "Cur HP xxxxx" */
98 #define COL_CURSP 0 /* "Cur SP xxxxx" */
100 #define ROW_RIDING_INFO 16
101 #define COL_RIDING_INFO 0 /* "xxxxxxxxxxxx" */
104 #define COL_INFO 0 /* "xxxxxxxxxxxx" */
107 #define COL_CUT 0 /* <cut> */
110 #define COL_STUN 0 /* <stun> */
112 #define ROW_HUNGRY 20
113 #define COL_HUNGRY 0 /* "Weak" / "Hungry" / "Full" / "Gorged" */
116 #define COL_STATE 7 /* <state> */
118 #define ROW_SPEED (-1)
119 #define COL_SPEED (-24) /* "Slow (-NN)" or "Fast (+NN)" */
121 #define ROW_STUDY (-1)
122 #define COL_STUDY (-13) /* "Study" */
124 #define ROW_DEPTH (-1)
125 #define COL_DEPTH (-8) /* "Lev NNN" / "NNNN ft" */
127 #define ROW_STATBAR (-1)
128 #define COL_STATBAR 0
129 #define MAX_COL_STATBAR (-26)
134 * @brief 画面左の能力値表示を行うために指定位置から13キャラ分を空白消去後指定のメッセージを明るい青で描画する /
135 * Print character info at given row, column in a 13 char field
141 static void prt_field(concptr info, TERM_LEN row, TERM_LEN col)
143 /* Dump 13 spaces to clear */
144 c_put_str(TERM_WHITE, " ", row, col);
146 /* Dump the info itself */
147 c_put_str(TERM_L_BLUE, info, row, col);
151 * @brief ゲーム時刻を表示する /
159 /* Dump 13 spaces to clear */
160 c_put_str(TERM_WHITE, " ", ROW_DAY, COL_DAY);
162 extract_day_hour_min(&day, &hour, &min);
164 /* Dump the info itself */
165 if (day < 1000) c_put_str(TERM_WHITE, format(_("%2d日目", "Day%3d"), day), ROW_DAY, COL_DAY);
166 else c_put_str(TERM_WHITE, _("***日目", "Day***"), ROW_DAY, COL_DAY);
168 c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
172 * @brief 現在のマップ名を返す /
173 * @return マップ名の文字列参照ポインタ
175 concptr map_name(void)
177 if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)
178 && (quest[p_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
179 return _("クエスト", "Quest");
180 else if (p_ptr->wild_mode)
181 return _("地上", "Surface");
182 else if (p_ptr->inside_arena)
183 return _("アリーナ", "Arena");
184 else if (p_ptr->inside_battle)
185 return _("闘技場", "Monster Arena");
186 else if (!current_floor_ptr->dun_level && p_ptr->town_num)
187 return town_info[p_ptr->town_num].name;
189 return d_name+d_info[p_ptr->dungeon_idx].name;
193 * @brief 現在のマップ名を描画する / Print dungeon
196 static void prt_dungeon(void)
198 concptr dungeon_name;
201 /* Dump 13 spaces to clear */
202 c_put_str(TERM_WHITE, " ", ROW_DUNGEON, COL_DUNGEON);
204 dungeon_name = map_name();
206 col = COL_DUNGEON + 6 - strlen(dungeon_name)/2;
207 if (col < 0) col = 0;
209 /* Dump the info itself */
210 c_put_str(TERM_L_UMBER, format("%s",dungeon_name),
216 * @brief プレイヤー能力値を描画する / Print character stat in given row, column
217 * @param stat 描画するステータスのID
220 static void prt_stat(int stat)
224 /* Display "injured" stat */
225 if (p_ptr->stat_cur[stat] < p_ptr->stat_max[stat])
227 put_str(stat_names_reduced[stat], ROW_STAT + stat, 0);
228 cnv_stat(p_ptr->stat_use[stat], tmp);
229 c_put_str(TERM_YELLOW, tmp, ROW_STAT + stat, COL_STAT + 6);
232 /* Display "healthy" stat */
235 put_str(stat_names[stat], ROW_STAT + stat, 0);
236 cnv_stat(p_ptr->stat_use[stat], tmp);
237 c_put_str(TERM_L_GREEN, tmp, ROW_STAT + stat, COL_STAT + 6);
240 /* Indicate natural maximum */
241 if (p_ptr->stat_max[stat] == p_ptr->stat_max_max[stat])
244 /* 日本語にかぶらないように表示位置を変更 */
245 put_str("!", ROW_STAT + stat, 5);
247 put_str("!", ROW_STAT + stat, 3);
255 * 画面下部に表示する状態表示定義ID / Data structure for status bar
257 #define BAR_TSUYOSHI 0 /*!< 下部ステータス表示: オクレ兄さん状態 */
258 #define BAR_HALLUCINATION 1 /*!< 下部ステータス表示: 幻覚 */
259 #define BAR_BLINDNESS 2 /*!< 下部ステータス表示: 盲目 */
260 #define BAR_PARALYZE 3 /*!< 下部ステータス表示: 麻痺 */
261 #define BAR_CONFUSE 4 /*!< 下部ステータス表示: 混乱 */
262 #define BAR_POISONED 5 /*!< 下部ステータス表示: 毒 */
263 #define BAR_AFRAID 6 /*!< 下部ステータス表示: 恐怖 */
264 #define BAR_LEVITATE 7 /*!< 下部ステータス表示: 浮遊 */
265 #define BAR_REFLECTION 8 /*!< 下部ステータス表示: 反射 */
266 #define BAR_PASSWALL 9 /*!< 下部ステータス表示: 壁抜け */
267 #define BAR_WRAITH 10 /*!< 下部ステータス表示: 幽体化 */
268 #define BAR_PROTEVIL 11 /*!< 下部ステータス表示: 対邪悪結界 */
269 #define BAR_KAWARIMI 12 /*!< 下部ステータス表示: 変わり身 */
270 #define BAR_MAGICDEFENSE 13 /*!< 下部ステータス表示: 魔法の鎧 */
271 #define BAR_EXPAND 14 /*!< 下部ステータス表示: 横伸び */
272 #define BAR_STONESKIN 15 /*!< 下部ステータス表示: 石肌化 */
273 #define BAR_MULTISHADOW 16 /*!< 下部ステータス表示: 影分身 */
274 #define BAR_REGMAGIC 17 /*!< 下部ステータス表示: 魔法防御 */
275 #define BAR_ULTIMATE 18 /*!< 下部ステータス表示: 究極の耐性 */
276 #define BAR_INVULN 19 /*!< 下部ステータス表示: 無敵化 */
277 #define BAR_IMMACID 20 /*!< 下部ステータス表示: 酸免疫 */
278 #define BAR_RESACID 21 /*!< 下部ステータス表示: 酸耐性 */
279 #define BAR_IMMELEC 22 /*!< 下部ステータス表示: 電撃免疫 */
280 #define BAR_RESELEC 23 /*!< 下部ステータス表示: 電撃耐性 */
281 #define BAR_IMMFIRE 24 /*!< 下部ステータス表示: 火炎免疫 */
282 #define BAR_RESFIRE 25 /*!< 下部ステータス表示: 火炎耐性 */
283 #define BAR_IMMCOLD 26 /*!< 下部ステータス表示: 冷気免疫 */
284 #define BAR_RESCOLD 27 /*!< 下部ステータス表示: 冷気耐性 */
285 #define BAR_RESPOIS 28 /*!< 下部ステータス表示: 毒耐性 */
286 #define BAR_RESNETH 29 /*!< 下部ステータス表示: 地獄耐性 */
287 #define BAR_RESTIME 30 /*!< 下部ステータス表示: 時間逆転耐性 */
288 #define BAR_DUSTROBE 31 /*!< 下部ステータス表示: 破片オーラ */
289 #define BAR_SHFIRE 32 /*!< 下部ステータス表示: 火炎オーラ */
290 #define BAR_TOUKI 33 /*!< 下部ステータス表示: 闘気 */
291 #define BAR_SHHOLY 34 /*!< 下部ステータス表示: 聖なるオーラ */
292 #define BAR_EYEEYE 35 /*!< 下部ステータス表示: 目には目を */
293 #define BAR_BLESSED 36 /*!< 下部ステータス表示: 祝福 */
294 #define BAR_HEROISM 37 /*!< 下部ステータス表示: 士気高揚 */
295 #define BAR_BERSERK 38 /*!< 下部ステータス表示: 狂戦士化 */
296 #define BAR_ATTKFIRE 39 /*!< 下部ステータス表示: 焼棄スレイ */
297 #define BAR_ATTKCOLD 40 /*!< 下部ステータス表示: 冷凍スレイ */
298 #define BAR_ATTKELEC 41 /*!< 下部ステータス表示: 電撃スレイ */
299 #define BAR_ATTKACID 42 /*!< 下部ステータス表示: 溶解スレイ */
300 #define BAR_ATTKPOIS 43 /*!< 下部ステータス表示: 毒殺スレイ */
301 #define BAR_ATTKCONF 44 /*!< 下部ステータス表示: 混乱打撃 */
302 #define BAR_SENSEUNSEEN 45 /*!< 下部ステータス表示: 透明視 */
303 #define BAR_TELEPATHY 46 /*!< 下部ステータス表示: テレパシー */
304 #define BAR_REGENERATION 47 /*!< 下部ステータス表示: 急回復 */
305 #define BAR_INFRAVISION 48 /*!< 下部ステータス表示: 赤外線視力 */
306 #define BAR_STEALTH 49 /*!< 下部ステータス表示: 隠密 */
307 #define BAR_SUPERSTEALTH 50 /*!< 下部ステータス表示: 超隠密 */
308 #define BAR_RECALL 51 /*!< 下部ステータス表示: 帰還待ち */
309 #define BAR_ALTER 52 /*!< 下部ステータス表示: 現実変容待ち */
310 #define BAR_SHCOLD 53 /*!< 下部ステータス表示: 冷気オーラ */
311 #define BAR_SHELEC 54 /*!< 下部ステータス表示: 電撃オーラ */
312 #define BAR_SHSHADOW 55 /*!< 下部ステータス表示: 影のオーラ */
313 #define BAR_MIGHT 56 /*!< 下部ステータス表示: 腕力強化 */
314 #define BAR_BUILD 57 /*!< 下部ステータス表示: 肉体強化 */
315 #define BAR_ANTIMULTI 58 /*!< 下部ステータス表示: 反増殖 */
316 #define BAR_ANTITELE 59 /*!< 下部ステータス表示: 反テレポート */
317 #define BAR_ANTIMAGIC 60 /*!< 下部ステータス表示: 反魔法 */
318 #define BAR_PATIENCE 61 /*!< 下部ステータス表示: 我慢 */
319 #define BAR_REVENGE 62 /*!< 下部ステータス表示: 宣告 */
320 #define BAR_RUNESWORD 63 /*!< 下部ステータス表示: 魔剣化 */
321 #define BAR_VAMPILIC 64 /*!< 下部ステータス表示: 吸血 */
322 #define BAR_CURE 65 /*!< 下部ステータス表示: 回復 */
323 #define BAR_ESP_EVIL 66 /*!< 下部ステータス表示: 邪悪感知 */
332 {TERM_YELLOW, "つ", "つよし"},
333 {TERM_VIOLET, "幻", "幻覚"},
334 {TERM_L_DARK, "盲", "盲目"},
335 {TERM_RED, "痺", "麻痺"},
336 {TERM_VIOLET, "乱", "混乱"},
337 {TERM_GREEN, "毒", "毒"},
338 {TERM_BLUE, "恐", "恐怖"},
339 {TERM_L_BLUE, "浮", "浮遊"},
340 {TERM_SLATE, "反", "反射"},
341 {TERM_SLATE, "壁", "壁抜け"},
342 {TERM_L_DARK, "幽", "幽体"},
343 {TERM_SLATE, "邪", "防邪"},
344 {TERM_VIOLET, "変", "変わり身"},
345 {TERM_YELLOW, "魔", "魔法鎧"},
346 {TERM_L_UMBER, "伸", "伸び"},
347 {TERM_WHITE, "石", "石肌"},
348 {TERM_L_BLUE, "分", "分身"},
349 {TERM_SLATE, "防", "魔法防御"},
350 {TERM_YELLOW, "究", "究極"},
351 {TERM_YELLOW, "無", "無敵"},
352 {TERM_L_GREEN, "酸", "酸免疫"},
353 {TERM_GREEN, "酸", "耐酸"},
354 {TERM_L_BLUE, "電", "電免疫"},
355 {TERM_BLUE, "電", "耐電"},
356 {TERM_L_RED, "火", "火免疫"},
357 {TERM_RED, "火", "耐火"},
358 {TERM_WHITE, "冷", "冷免疫"},
359 {TERM_SLATE, "冷", "耐冷"},
360 {TERM_GREEN, "毒", "耐毒"},
361 {TERM_L_DARK, "獄", "耐地獄"},
362 {TERM_L_BLUE, "時", "耐時間"},
363 {TERM_L_DARK, "鏡", "鏡オーラ"},
364 {TERM_L_RED, "オ", "火オーラ"},
365 {TERM_WHITE, "闘", "闘気"},
366 {TERM_WHITE, "聖", "聖オーラ"},
367 {TERM_VIOLET, "目", "目には目"},
368 {TERM_WHITE, "祝", "祝福"},
369 {TERM_WHITE, "勇", "勇"},
370 {TERM_RED, "狂", "狂乱"},
371 {TERM_L_RED, "火", "魔剣火"},
372 {TERM_WHITE, "冷", "魔剣冷"},
373 {TERM_L_BLUE, "電", "魔剣電"},
374 {TERM_SLATE, "酸", "魔剣酸"},
375 {TERM_L_GREEN, "毒", "魔剣毒"},
376 {TERM_RED, "乱", "混乱打撃"},
377 {TERM_L_BLUE, "視", "透明視"},
378 {TERM_ORANGE, "テ", "テレパシ"},
379 {TERM_L_BLUE, "回", "回復"},
380 {TERM_L_RED, "赤", "赤外"},
381 {TERM_UMBER, "隠", "隠密"},
382 {TERM_YELLOW, "隠", "超隠密"},
383 {TERM_WHITE, "帰", "帰還"},
384 {TERM_WHITE, "現", "現実変容"},
386 {TERM_WHITE, "オ", "氷オーラ"},
387 {TERM_BLUE, "オ", "電オーラ"},
388 {TERM_L_DARK, "オ", "影オーラ"},
389 {TERM_YELLOW, "腕", "腕力強化"},
390 {TERM_RED, "肉", "肉体強化"},
391 {TERM_L_DARK, "殖", "反増殖"},
392 {TERM_ORANGE, "テ", "反テレポ"},
393 {TERM_RED, "魔", "反魔法"},
394 {TERM_SLATE, "我", "我慢"},
395 {TERM_SLATE, "宣", "宣告"},
396 {TERM_L_DARK, "剣", "魔剣化"},
397 {TERM_RED, "吸", "吸血打撃"},
398 {TERM_WHITE, "回", "回復"},
399 {TERM_L_DARK, "感", "邪悪感知"},
404 {TERM_YELLOW, "Ts", "Tsuyoshi"},
405 {TERM_VIOLET, "Ha", "Halluc"},
406 {TERM_L_DARK, "Bl", "Blind"},
407 {TERM_RED, "Pa", "Paralyzed"},
408 {TERM_VIOLET, "Cf", "Confused"},
409 {TERM_GREEN, "Po", "Poisoned"},
410 {TERM_BLUE, "Af", "Afraid"},
411 {TERM_L_BLUE, "Lv", "Levit"},
412 {TERM_SLATE, "Rf", "Reflect"},
413 {TERM_SLATE, "Pw", "PassWall"},
414 {TERM_L_DARK, "Wr", "Wraith"},
415 {TERM_SLATE, "Ev", "PrtEvl"},
416 {TERM_VIOLET, "Kw", "Kawarimi"},
417 {TERM_YELLOW, "Md", "MgcArm"},
418 {TERM_L_UMBER, "Eh", "Expand"},
419 {TERM_WHITE, "Ss", "StnSkn"},
420 {TERM_L_BLUE, "Ms", "MltShdw"},
421 {TERM_SLATE, "Rm", "ResMag"},
422 {TERM_YELLOW, "Ul", "Ultima"},
423 {TERM_YELLOW, "Iv", "Invuln"},
424 {TERM_L_GREEN, "IAc", "ImmAcid"},
425 {TERM_GREEN, "Ac", "Acid"},
426 {TERM_L_BLUE, "IEl", "ImmElec"},
427 {TERM_BLUE, "El", "Elec"},
428 {TERM_L_RED, "IFi", "ImmFire"},
429 {TERM_RED, "Fi", "Fire"},
430 {TERM_WHITE, "ICo", "ImmCold"},
431 {TERM_SLATE, "Co", "Cold"},
432 {TERM_GREEN, "Po", "Pois"},
433 {TERM_L_DARK, "Nt", "Nthr"},
434 {TERM_L_BLUE, "Ti", "Time"},
435 {TERM_L_DARK, "Mr", "Mirr"},
436 {TERM_L_RED, "SFi", "SFire"},
437 {TERM_WHITE, "Fo", "Force"},
438 {TERM_WHITE, "Ho", "Holy"},
439 {TERM_VIOLET, "Ee", "EyeEye"},
440 {TERM_WHITE, "Bs", "Bless"},
441 {TERM_WHITE, "He", "Hero"},
442 {TERM_RED, "Br", "Berserk"},
443 {TERM_L_RED, "BFi", "BFire"},
444 {TERM_WHITE, "BCo", "BCold"},
445 {TERM_L_BLUE, "BEl", "BElec"},
446 {TERM_SLATE, "BAc", "BAcid"},
447 {TERM_L_GREEN, "BPo", "BPois"},
448 {TERM_RED, "TCf", "TchCnf"},
449 {TERM_L_BLUE, "Se", "SInv"},
450 {TERM_ORANGE, "Te", "Telepa"},
451 {TERM_L_BLUE, "Rg", "Regen"},
452 {TERM_L_RED, "If", "Infr"},
453 {TERM_UMBER, "Sl", "Stealth"},
454 {TERM_YELLOW, "Stlt", "Stealth"},
455 {TERM_WHITE, "Rc", "Recall"},
456 {TERM_WHITE, "Al", "Alter"},
458 {TERM_WHITE, "SCo", "SCold"},
459 {TERM_BLUE, "SEl", "SElec"},
460 {TERM_L_DARK, "SSh", "SShadow"},
461 {TERM_YELLOW, "EMi", "ExMight"},
462 {TERM_RED, "Bu", "BuildUp"},
463 {TERM_L_DARK, "AMl", "AntiMulti"},
464 {TERM_ORANGE, "AT", "AntiTele"},
465 {TERM_RED, "AM", "AntiMagic"},
466 {TERM_SLATE, "Pa", "Patience"},
467 {TERM_SLATE, "Rv", "Revenge"},
468 {TERM_L_DARK, "Rs", "RuneSword"},
469 {TERM_RED, "Vm", "Vampiric"},
470 {TERM_WHITE, "Cu", "Cure"},
471 {TERM_L_DARK, "ET", "EvilTele"},
477 * @brief 32ビット変数配列の指定位置のビットフラグを1にする。
478 * @param FLG フラグ位置(ビット)
481 #define ADD_FLG(FLG) (bar_flags[FLG / 32] |= (1L << (FLG % 32)))
484 * @brief 32ビット変数配列の指定位置のビットフラグが1かどうかを返す。
485 * @param FLG フラグ位置(ビット)
488 #define IS_FLG(FLG) (bar_flags[FLG / 32] & (1L << (FLG % 32)))
492 * @brief 下部に状態表示を行う / Show status bar
495 static void prt_status(void)
497 BIT_FLAGS bar_flags[3];
498 TERM_LEN wid, hgt, row_statbar, max_col_statbar;
500 TERM_LEN col = 0, num = 0;
503 Term_get_size(&wid, &hgt);
504 row_statbar = hgt + ROW_STATBAR;
505 max_col_statbar = wid + MAX_COL_STATBAR;
507 Term_erase(0, row_statbar, max_col_statbar);
509 bar_flags[0] = bar_flags[1] = bar_flags[2] = 0L;
512 if (p_ptr->tsuyoshi) ADD_FLG(BAR_TSUYOSHI);
515 if (p_ptr->image) ADD_FLG(BAR_HALLUCINATION);
518 if (p_ptr->blind) ADD_FLG(BAR_BLINDNESS);
521 if (p_ptr->paralyzed) ADD_FLG(BAR_PARALYZE);
524 if (p_ptr->confused) ADD_FLG(BAR_CONFUSE);
527 if (p_ptr->poisoned) ADD_FLG(BAR_POISONED);
529 /* Times see-invisible */
530 if (p_ptr->tim_invis) ADD_FLG(BAR_SENSEUNSEEN);
533 if (IS_TIM_ESP()) ADD_FLG(BAR_TELEPATHY);
535 /* Timed regenerate */
536 if (p_ptr->tim_regen) ADD_FLG(BAR_REGENERATION);
538 /* Timed infra-vision */
539 if (p_ptr->tim_infra) ADD_FLG(BAR_INFRAVISION);
541 /* Protection from evil */
542 if (p_ptr->protevil) ADD_FLG(BAR_PROTEVIL);
544 /* Invulnerability */
545 if (IS_INVULN()) ADD_FLG(BAR_INVULN);
548 if (p_ptr->wraith_form) ADD_FLG(BAR_WRAITH);
551 if (p_ptr->kabenuke) ADD_FLG(BAR_PASSWALL);
553 if (p_ptr->tim_reflect) ADD_FLG(BAR_REFLECTION);
556 if (IS_HERO()) ADD_FLG(BAR_HEROISM);
558 /* Super Heroism / berserk */
559 if (p_ptr->shero) ADD_FLG(BAR_BERSERK);
562 if (IS_BLESSED()) ADD_FLG(BAR_BLESSED);
565 if (p_ptr->magicdef) ADD_FLG(BAR_MAGICDEFENSE);
567 if (p_ptr->tsubureru) ADD_FLG(BAR_EXPAND);
569 if (p_ptr->shield) ADD_FLG(BAR_STONESKIN);
571 if (p_ptr->special_defense & NINJA_KAWARIMI) ADD_FLG(BAR_KAWARIMI);
574 if (p_ptr->special_defense & DEFENSE_ACID) ADD_FLG(BAR_IMMACID);
575 if (IS_OPPOSE_ACID()) ADD_FLG(BAR_RESACID);
577 /* Oppose Lightning */
578 if (p_ptr->special_defense & DEFENSE_ELEC) ADD_FLG(BAR_IMMELEC);
579 if (IS_OPPOSE_ELEC()) ADD_FLG(BAR_RESELEC);
582 if (p_ptr->special_defense & DEFENSE_FIRE) ADD_FLG(BAR_IMMFIRE);
583 if (IS_OPPOSE_FIRE()) ADD_FLG(BAR_RESFIRE);
586 if (p_ptr->special_defense & DEFENSE_COLD) ADD_FLG(BAR_IMMCOLD);
587 if (IS_OPPOSE_COLD()) ADD_FLG(BAR_RESCOLD);
590 if (IS_OPPOSE_POIS()) ADD_FLG(BAR_RESPOIS);
593 if (p_ptr->word_recall) ADD_FLG(BAR_RECALL);
596 if (p_ptr->alter_reality) ADD_FLG(BAR_ALTER);
599 if (p_ptr->afraid) ADD_FLG(BAR_AFRAID);
602 if (p_ptr->tim_res_time) ADD_FLG(BAR_RESTIME);
604 if (p_ptr->multishadow) ADD_FLG(BAR_MULTISHADOW);
606 /* Confusing Hands */
607 if (p_ptr->special_attack & ATTACK_CONFUSE) ADD_FLG(BAR_ATTKCONF);
609 if (p_ptr->resist_magic) ADD_FLG(BAR_REGMAGIC);
611 /* Ultimate-resistance */
612 if (p_ptr->ult_res) ADD_FLG(BAR_ULTIMATE);
615 if (p_ptr->tim_levitation) ADD_FLG(BAR_LEVITATE);
617 if (p_ptr->tim_res_nether) ADD_FLG(BAR_RESNETH);
619 if (p_ptr->dustrobe) ADD_FLG(BAR_DUSTROBE);
622 if (p_ptr->special_attack & ATTACK_FIRE) ADD_FLG(BAR_ATTKFIRE);
623 if (p_ptr->special_attack & ATTACK_COLD) ADD_FLG(BAR_ATTKCOLD);
624 if (p_ptr->special_attack & ATTACK_ELEC) ADD_FLG(BAR_ATTKELEC);
625 if (p_ptr->special_attack & ATTACK_ACID) ADD_FLG(BAR_ATTKACID);
626 if (p_ptr->special_attack & ATTACK_POIS) ADD_FLG(BAR_ATTKPOIS);
627 if (p_ptr->special_defense & NINJA_S_STEALTH) ADD_FLG(BAR_SUPERSTEALTH);
629 if (p_ptr->tim_sh_fire) ADD_FLG(BAR_SHFIRE);
632 if (IS_TIM_STEALTH()) ADD_FLG(BAR_STEALTH);
634 if (p_ptr->tim_sh_touki) ADD_FLG(BAR_TOUKI);
637 if (p_ptr->tim_sh_holy) ADD_FLG(BAR_SHHOLY);
639 /* An Eye for an Eye */
640 if (p_ptr->tim_eyeeye) ADD_FLG(BAR_EYEEYE);
643 if (p_ptr->realm1 == REALM_HEX)
645 if (hex_spelling(HEX_BLESS)) ADD_FLG(BAR_BLESSED);
646 if (hex_spelling(HEX_DEMON_AURA)) { ADD_FLG(BAR_SHFIRE); ADD_FLG(BAR_REGENERATION); }
647 if (hex_spelling(HEX_XTRA_MIGHT)) ADD_FLG(BAR_MIGHT);
648 if (hex_spelling(HEX_DETECT_EVIL)) ADD_FLG(BAR_ESP_EVIL);
649 if (hex_spelling(HEX_ICE_ARMOR)) ADD_FLG(BAR_SHCOLD);
650 if (hex_spelling(HEX_RUNESWORD)) ADD_FLG(BAR_RUNESWORD);
651 if (hex_spelling(HEX_BUILDING)) ADD_FLG(BAR_BUILD);
652 if (hex_spelling(HEX_ANTI_TELE)) ADD_FLG(BAR_ANTITELE);
653 if (hex_spelling(HEX_SHOCK_CLOAK)) ADD_FLG(BAR_SHELEC);
654 if (hex_spelling(HEX_SHADOW_CLOAK)) ADD_FLG(BAR_SHSHADOW);
655 if (hex_spelling(HEX_CONFUSION)) ADD_FLG(BAR_ATTKCONF);
656 if (hex_spelling(HEX_EYE_FOR_EYE)) ADD_FLG(BAR_EYEEYE);
657 if (hex_spelling(HEX_ANTI_MULTI)) ADD_FLG(BAR_ANTIMULTI);
658 if (hex_spelling(HEX_VAMP_BLADE)) ADD_FLG(BAR_VAMPILIC);
659 if (hex_spelling(HEX_ANTI_MAGIC)) ADD_FLG(BAR_ANTIMAGIC);
660 if (hex_spelling(HEX_CURE_LIGHT) ||
661 hex_spelling(HEX_CURE_SERIOUS) ||
662 hex_spelling(HEX_CURE_CRITICAL)) ADD_FLG(BAR_CURE);
664 if (HEX_REVENGE_TURN(p_ptr))
666 if (HEX_REVENGE_TYPE(p_ptr) == 1) ADD_FLG(BAR_PATIENCE);
667 if (HEX_REVENGE_TYPE(p_ptr) == 2) ADD_FLG(BAR_REVENGE);
671 /* Calcurate length */
672 for (i = 0; bar[i].sstr; i++)
676 col += strlen(bar[i].lstr) + 1;
681 /* If there are not excess spaces for long strings, use short one */
682 if (col - 1 > max_col_statbar)
687 for (i = 0; bar[i].sstr; i++)
691 col += strlen(bar[i].sstr);
695 /* If there are excess spaces for short string, use more */
696 if (col - 1 <= max_col_statbar - (num-1))
704 /* Centering display column */
705 col = (max_col_statbar - col) / 2;
707 /* Display status bar */
708 for (i = 0; bar[i].sstr; i++)
713 if (space == 2) str = bar[i].lstr;
714 else str = bar[i].sstr;
716 c_put_str(bar[i].attr, str, row_statbar, col);
718 if (space > 0) col++;
719 if (col > max_col_statbar) break;
726 * @brief プレイヤーの称号を表示する / Prints "title", including "wizard" or "winner" as needed.
729 static void prt_title(void)
736 p = _("[ウィザード]", "[=-WIZARD-=]");
738 else if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL))
740 if (p_ptr->arena_number > MAX_ARENA_MONS + 2)
742 p = _("*真・勝利者*", "*TRUEWINNER*");
746 p = _("***勝利者***", "***WINNER***");
753 my_strcpy(str, player_title[p_ptr->pclass][(p_ptr->lev - 1) / 5], sizeof(str));
757 prt_field(p, ROW_TITLE, COL_TITLE);
762 * @brief プレイヤーのレベルを表示する / Prints level
765 static void prt_level(void)
769 sprintf(tmp, _("%5d", "%6d"), p_ptr->lev);
771 if (p_ptr->lev >= p_ptr->max_plv)
773 put_str(_("レベル ", "LEVEL "), ROW_LEVEL, 0);
774 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 7);
778 put_str(_("xレベル", "Level "), ROW_LEVEL, 0);
779 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 7);
785 * @brief プレイヤーの経験値を表示する / Display the experience
788 static void prt_exp(void)
792 if ((!exp_need)||(p_ptr->prace == RACE_ANDROID))
794 (void)sprintf(out_val, "%8ld", (long)p_ptr->exp);
798 if (p_ptr->lev >= PY_MAX_LEVEL)
800 (void)sprintf(out_val, "********");
804 (void)sprintf(out_val, "%8ld", (long)(player_exp [p_ptr->lev - 1] * p_ptr->expfact / 100L) - p_ptr->exp);
808 if (p_ptr->exp >= p_ptr->max_exp)
810 if (p_ptr->prace == RACE_ANDROID) put_str(_("強化 ", "Cst "), ROW_EXP, 0);
811 else put_str(_("経験 ", "EXP "), ROW_EXP, 0);
812 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 4);
816 put_str(_("x経験", "Exp "), ROW_EXP, 0);
817 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 4);
822 * @brief プレイヤーの所持金を表示する / Prints current gold
825 static void prt_gold(void)
828 put_str(_("$ ", "AU "), ROW_GOLD, COL_GOLD);
829 sprintf(tmp, "%9ld", (long)p_ptr->au);
830 c_put_str(TERM_L_GREEN, tmp, ROW_GOLD, COL_GOLD + 3);
835 * @brief プレイヤーのACを表示する / Prints current AC
838 static void prt_ac(void)
843 /* AC の表示方式を変更している */
844 put_str(" AC( )", ROW_AC, COL_AC);
845 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
846 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 6);
848 put_str("Cur AC ", ROW_AC, COL_AC);
849 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
850 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 7);
857 * @brief プレイヤーのHPを表示する / Prints Cur/Max hit points
860 static void prt_hp(void)
862 /* ヒットポイントの表示方法を変更 */
868 put_str("HP", ROW_CURHP, COL_CURHP);
871 sprintf(tmp, "%4ld", (long int)p_ptr->chp);
873 if (p_ptr->chp >= p_ptr->mhp)
875 color = TERM_L_GREEN;
877 else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
886 c_put_str(color, tmp, ROW_CURHP, COL_CURHP+3);
889 put_str( "/", ROW_CURHP, COL_CURHP + 7 );
892 sprintf(tmp, "%4ld", (long int)p_ptr->mhp);
893 color = TERM_L_GREEN;
895 c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
900 * @brief プレイヤーのMPを表示する / Prints players max/cur spell points
903 static void prt_sp(void)
905 /* マジックポイントの表示方法を変更している */
910 /* Do not show mana unless it matters */
911 if (!mp_ptr->spell_book) return;
914 put_str(_("MP", "SP"), ROW_CURSP, COL_CURSP);
917 sprintf(tmp, "%4ld", (long int)p_ptr->csp);
919 if (p_ptr->csp >= p_ptr->msp)
921 color = TERM_L_GREEN;
923 else if (p_ptr->csp > (p_ptr->msp * mana_warn) / 10)
932 c_put_str(color, tmp, ROW_CURSP, COL_CURSP+3);
935 put_str( "/", ROW_CURSP, COL_CURSP + 7 );
938 sprintf(tmp, "%4ld", (long int)p_ptr->msp);
939 color = TERM_L_GREEN;
941 c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
946 * @brief 現在のフロアの深さを表示する / Prints depth in stat area
949 static void prt_depth(void)
952 TERM_LEN wid, hgt, row_depth, col_depth;
953 TERM_COLOR attr = TERM_WHITE;
955 Term_get_size(&wid, &hgt);
956 col_depth = wid + COL_DEPTH;
957 row_depth = hgt + ROW_DEPTH;
959 if (!current_floor_ptr->dun_level)
961 strcpy(depths, _("地上", "Surf."));
963 else if (p_ptr->inside_quest && !p_ptr->dungeon_idx)
965 strcpy(depths, _("地上", "Quest"));
969 if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)current_floor_ptr->dun_level * 50);
970 else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)current_floor_ptr->dun_level);
972 /* Get color of level based on feeling -JSV- */
973 switch (p_ptr->feeling)
975 case 0: attr = TERM_SLATE; break; /* Unknown */
976 case 1: attr = TERM_L_BLUE; break; /* Special */
977 case 2: attr = TERM_VIOLET; break; /* Horrible visions */
978 case 3: attr = TERM_RED; break; /* Very dangerous */
979 case 4: attr = TERM_L_RED; break; /* Very bad feeling */
980 case 5: attr = TERM_ORANGE; break; /* Bad feeling */
981 case 6: attr = TERM_YELLOW; break; /* Nervous */
982 case 7: attr = TERM_L_UMBER; break; /* Luck is turning */
983 case 8: attr = TERM_L_WHITE; break; /* Don't like */
984 case 9: attr = TERM_WHITE; break; /* Reasonably safe */
985 case 10: attr = TERM_WHITE; break; /* Boring place */
989 /* Right-Adjust the "depth", and clear old values */
990 c_prt(attr, format("%7s", depths), row_depth, col_depth);
995 * @brief プレイヤーの空腹状態を表示する / Prints status of hunger
998 static void prt_hunger(void)
1000 if(p_ptr->wizard && p_ptr->inside_arena) return;
1002 /* Fainting / Starving */
1003 if (p_ptr->food < PY_FOOD_FAINT)
1005 c_put_str(TERM_RED, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
1009 else if (p_ptr->food < PY_FOOD_WEAK)
1011 c_put_str(TERM_ORANGE, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
1015 else if (p_ptr->food < PY_FOOD_ALERT)
1017 c_put_str(TERM_YELLOW, _("空腹 ", "Hungry"), ROW_HUNGRY, COL_HUNGRY);
1021 else if (p_ptr->food < PY_FOOD_FULL)
1023 c_put_str(TERM_L_GREEN, " ", ROW_HUNGRY, COL_HUNGRY);
1027 else if (p_ptr->food < PY_FOOD_MAX)
1029 c_put_str(TERM_L_GREEN, _("満腹 ", "Full "), ROW_HUNGRY, COL_HUNGRY);
1035 c_put_str(TERM_GREEN, _("食過ぎ", "Gorged"), ROW_HUNGRY, COL_HUNGRY);
1041 * @brief プレイヤーの行動状態を表示する / Prints Searching, Resting, Paralysis, or 'count' status
1044 * Display is always exactly 10 characters wide (see below)
1045 * This function was a major bottleneck when resting, so a lot of
1046 * the text formatting code was optimized in place below.
1048 static void prt_state(void)
1050 TERM_COLOR attr = TERM_WHITE;
1056 if (command_rep > 999)
1058 (void)sprintf(text, "%2d00", command_rep / 100);
1062 (void)sprintf(text, " %2d", command_rep);
1069 switch(p_ptr->action)
1073 strcpy(text, _("探索", "Sear"));
1077 /* Start with "Rest" */
1078 strcpy(text, _(" ", " "));
1080 if (p_ptr->resting > 0)
1082 sprintf(text, "%4d", p_ptr->resting);
1084 else if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
1086 text[0] = text[1] = text[2] = text[3] = '*';
1088 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
1090 text[0] = text[1] = text[2] = text[3] = '&';
1096 strcpy(text, _("学習", "lear"));
1097 if (new_mane) attr = TERM_L_RED;
1102 strcpy(text, _("釣り", "fish"));
1108 for (i = 0; i < MAX_KAMAE; i++)
1109 if (p_ptr->special_defense & (KAMAE_GENBU << i)) break;
1112 case 0: attr = TERM_GREEN;break;
1113 case 1: attr = TERM_WHITE;break;
1114 case 2: attr = TERM_L_BLUE;break;
1115 case 3: attr = TERM_L_RED;break;
1117 strcpy(text, kamae_shurui[i].desc);
1123 for (i = 0; i < MAX_KATA; i++)
1124 if (p_ptr->special_defense & (KATA_IAI << i)) break;
1125 strcpy(text, kata_shurui[i].desc);
1130 strcpy(text, _("歌 ", "Sing"));
1133 case ACTION_HAYAGAKE:
1135 strcpy(text, _("速駆", "Fast"));
1140 strcpy(text, _("詠唱", "Spel"));
1151 /* Display the info (or blanks) */
1152 c_put_str(attr, format("%5.5s",text), ROW_STATE, COL_STATE);
1157 * @brief プレイヤーの行動速度を表示する / Prints the speed of a character. -CJS-
1160 static void prt_speed(void)
1162 int i = p_ptr->pspeed;
1163 bool is_fast = IS_FAST();
1165 TERM_COLOR attr = TERM_WHITE;
1167 TERM_LEN wid, hgt, row_speed, col_speed;
1169 Term_get_size(&wid, &hgt);
1170 col_speed = wid + COL_SPEED;
1171 row_speed = hgt + ROW_SPEED;
1173 /* Hack -- Visually "undo" the Search Mode Slowdown */
1174 if (p_ptr->action == ACTION_SEARCH && !p_ptr->lightspeed) i += 10;
1181 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
1182 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1183 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1184 else attr = TERM_GREEN;
1186 else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
1187 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1188 else attr = TERM_L_GREEN;
1189 sprintf(buf, "%s(+%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("加速", "Fast")), (i - 110));
1197 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
1198 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1199 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1200 else attr = TERM_RED;
1202 else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
1203 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1204 else attr = TERM_L_UMBER;
1205 sprintf(buf, "%s(-%d)", (p_ptr->riding ? _("乗馬", "Ride") : _("減速", "Slow")), (110 - i));
1207 else if (p_ptr->riding)
1210 strcpy(buf, _("乗馬中", "Riding"));
1213 /* Display the speed */
1214 c_put_str(attr, format("%-9s", buf), row_speed, col_speed);
1219 * @brief プレイヤーの呪文学習可能状態を表示する
1222 static void prt_study(void)
1224 TERM_LEN wid, hgt, row_study, col_study;
1226 Term_get_size(&wid, &hgt);
1227 col_study = wid + COL_STUDY;
1228 row_study = hgt + ROW_STUDY;
1230 if (p_ptr->new_spells)
1232 put_str(_("学習", "Stud"), row_study, col_study);
1236 put_str(" ", row_study, col_study);
1242 * @brief プレイヤーのものまね可能状態を表示する
1245 static void prt_imitation(void)
1247 TERM_LEN wid, hgt, row_study, col_study;
1249 Term_get_size(&wid, &hgt);
1250 col_study = wid + COL_STUDY;
1251 row_study = hgt + ROW_STUDY;
1253 if (p_ptr->pclass == CLASS_IMITATOR)
1255 if (p_ptr->mane_num)
1258 if (new_mane) attr = TERM_L_RED;
1259 else attr = TERM_WHITE;
1260 c_put_str(attr, _("まね", "Imit"), row_study, col_study);
1264 put_str(" ", row_study, col_study);
1270 * @brief プレイヤーの負傷状態を表示する
1273 static void prt_cut(void)
1279 c_put_str(TERM_L_RED, _("致命傷 ", "Mortal wound"), ROW_CUT, COL_CUT);
1283 c_put_str(TERM_RED, _("ひどい深手 ", "Deep gash "), ROW_CUT, COL_CUT);
1287 c_put_str(TERM_RED, _("重傷 ", "Severe cut "), ROW_CUT, COL_CUT);
1291 c_put_str(TERM_ORANGE, _("大変な傷 ", "Nasty cut "), ROW_CUT, COL_CUT);
1295 c_put_str(TERM_ORANGE, _("ひどい傷 ", "Bad cut "), ROW_CUT, COL_CUT);
1299 c_put_str(TERM_YELLOW, _("軽傷 ", "Light cut "), ROW_CUT, COL_CUT);
1303 c_put_str(TERM_YELLOW, _("かすり傷 ", "Graze "), ROW_CUT, COL_CUT);
1307 put_str(" ", ROW_CUT, COL_CUT);
1313 * @brief プレイヤーの朦朧状態を表示する
1316 static void prt_stun(void)
1318 int s = p_ptr->stun;
1322 c_put_str(TERM_RED, _("意識不明瞭 ", "Knocked out "), ROW_STUN, COL_STUN);
1326 c_put_str(TERM_ORANGE, _("ひどく朦朧 ", "Heavy stun "), ROW_STUN, COL_STUN);
1330 c_put_str(TERM_ORANGE, _("朦朧 ", "Stun "), ROW_STUN, COL_STUN);
1334 put_str(" ", ROW_STUN, COL_STUN);
1341 * @brief モンスターの体力ゲージを表示する
1342 * @param riding TRUEならば騎乗中のモンスターの体力、FALSEならターゲットモンスターの体力を表示する。表示位置は固定。
1346 * Redraw the "monster health bar" -DRS-
1347 * Rather extensive modifications by -BEN-
1349 * The "monster health bar" provides visual feedback on the "health"
1350 * of the monster currently being "tracked". There are several ways
1351 * to "track" a monster, including targetting it, attacking it, and
1352 * affecting it (and nobody else) with a ranged attack.
1354 * Display the monster health bar (affectionately known as the
1355 * "health-o-meter"). Clear health bar if nothing is being tracked.
1356 * Auto-track current target monster when bored. Note that the
1357 * health-bar stops tracking any monster that "disappears".
1360 static void health_redraw(bool riding)
1364 monster_type *m_ptr;
1368 health_who = p_ptr->riding;
1369 row = ROW_RIDING_INFO;
1370 col = COL_RIDING_INFO;
1374 health_who = p_ptr->health_who;
1379 m_ptr = ¤t_floor_ptr->m_list[health_who];
1381 if (p_ptr->wizard && p_ptr->inside_battle)
1386 Term_putstr(col - 2, row, 12, TERM_WHITE, " / ");
1387 Term_putstr(col - 2, row + 1, 12, TERM_WHITE, " / ");
1388 Term_putstr(col - 2, row + 2, 12, TERM_WHITE, " / ");
1389 Term_putstr(col - 2, row + 3, 12, TERM_WHITE, " / ");
1391 if(current_floor_ptr->m_list[1].r_idx)
1393 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));
1394 Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].hp));
1395 Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[1].max_maxhp));
1398 if(current_floor_ptr->m_list[2].r_idx)
1400 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));
1401 Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].hp));
1402 Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[2].max_maxhp));
1405 if(current_floor_ptr->m_list[3].r_idx)
1407 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));
1408 Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].hp));
1409 Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[3].max_maxhp));
1412 if(current_floor_ptr->m_list[4].r_idx)
1414 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));
1415 Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].hp));
1416 Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", current_floor_ptr->m_list[4].max_maxhp));
1425 /* Erase the health bar */
1426 Term_erase(col, row, 12);
1429 /* Tracking an unseen monster */
1430 else if (!m_ptr->ml)
1432 /* Indicate that the monster health is "unknown" */
1433 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1436 /* Tracking a hallucinatory monster */
1437 else if (p_ptr->image)
1439 /* Indicate that the monster health is "unknown" */
1440 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1443 /* Tracking a dead monster (???) */
1444 else if (m_ptr->hp < 0)
1446 /* Indicate that the monster health is "unknown" */
1447 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1450 /* Tracking a visible monster */
1453 /* Extract the "percent" of health */
1454 int pct = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->maxhp : 0;
1455 int pct2 = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->max_maxhp: 0;
1457 /* Convert percent into "health" */
1458 int len = (pct2 < 10) ? 1 : (pct2 < 90) ? (pct2 / 10 + 1) : 10;
1460 /* Default to almost dead */
1461 TERM_COLOR attr = TERM_RED;
1464 if (MON_INVULNER(m_ptr)) attr = TERM_WHITE;
1467 else if (MON_CSLEEP(m_ptr)) attr = TERM_BLUE;
1470 else if (MON_MONFEAR(m_ptr)) attr = TERM_VIOLET;
1473 else if (pct >= 100) attr = TERM_L_GREEN;
1475 /* Somewhat Wounded */
1476 else if (pct >= 60) attr = TERM_YELLOW;
1479 else if (pct >= 25) attr = TERM_ORANGE;
1482 else if (pct >= 10) attr = TERM_L_RED;
1484 /* Default to "unknown" */
1485 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1487 /* Dump the current "health" (use '*' symbols) */
1488 Term_putstr(col + 1, row, len, attr, "**********");
1496 * @brief プレイヤーのステータスを一括表示する(左側部分) / Display basic info (mostly left of map)
1499 static void prt_frame_basic(void)
1502 if (p_ptr->mimic_form)
1503 prt_field(mimic_info[p_ptr->mimic_form].title, ROW_RACE, COL_RACE);
1507 my_strcpy(str, rp_ptr->title, sizeof(str));
1508 prt_field(str, ROW_RACE, COL_RACE);
1514 for (i = 0; i < A_MAX; i++) prt_stat(i);
1520 health_redraw(FALSE);
1521 health_redraw(TRUE);
1526 * @brief プレイヤーのステータスを一括表示する(下部分) / Display extra info (mostly below map)
1529 static void prt_frame_extra(void)
1543 * @brief サブウィンドウに所持品一覧を表示する / Hack -- display p_ptr->inventory_list in sub-windows
1546 static void fix_inven(void)
1551 for (j = 0; j < 8; j++)
1556 if (!angband_term[j]) continue;
1558 /* No relevant flags */
1559 if (!(window_flag[j] & (PW_INVEN))) continue;
1562 Term_activate(angband_term[j]);
1564 /* Display p_ptr->inventory_list */
1573 * @brief モンスターの現在数を一行で表現する / Print monster info in line
1576 * @param m_ptr 思い出を表示するモンスター情報の参照ポインタ
1577 * @param n_same モンスターの数の現在数
1581 * nnn : number or unique(U) or wanted unique(W)
1582 * X : symbol of monster
1583 * LV : monster lv if known
1584 * name: name of monster
1588 static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type* m_ptr, int n_same){
1591 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1592 monster_race* r_ptr = &r_info[r_idx];
1596 //Number of 'U'nique
1597 if(r_ptr->flags1&RF1_UNIQUE){//unique
1598 bool is_kubi = FALSE;
1599 for(i=0;i<MAX_KUBI;i++){
1600 if(current_world_ptr->bounty_r_idx[i] == r_idx){
1605 Term_addstr(-1, TERM_WHITE, is_kubi?" W":" U");
1607 sprintf(buf, "%3d", n_same);
1608 Term_addstr(-1, TERM_WHITE, buf);
1611 Term_addstr(-1, TERM_WHITE, " ");
1612 //Term_add_bigch(r_ptr->d_attr, r_ptr->d_char);
1613 //Term_addstr(-1, TERM_WHITE, "/");
1614 Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
1616 if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){
1617 sprintf(buf, " %2d", (int)r_ptr->level);
1621 Term_addstr(-1, TERM_WHITE, buf);
1623 sprintf(buf, " %s ", r_name+r_ptr->name);
1624 Term_addstr(-1, TERM_WHITE, buf);
1626 //Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0));
1630 * @brief モンスターの出現リストを表示する / Print monster info in line
1633 * @param max_lines 最大何行描画するか
1635 void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
1637 monster_type* last_mons = NULL;
1638 monster_type* m_ptr = NULL;
1642 for(i=0;i<tmp_pos.n;i++){
1643 grid_type* g_ptr = ¤t_floor_ptr->grid_array[tmp_pos.y[i]][tmp_pos.x[i]];
1644 if(!g_ptr->m_idx || !current_floor_ptr->m_list[g_ptr->m_idx].ml)continue;//no mons or cannot look
1645 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1646 if(is_pet(m_ptr))continue;//pet
1647 if(!m_ptr->r_idx)continue;//dead?
1650 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1651 monster_race* r_ptr = &r_info[r_idx];
1652 concptr name = (r_name + r_ptr->name);
1653 concptr ename = (r_name + r_ptr->name);
1654 //ミミック類や「それ」等は、一覧に出てはいけない
1655 if(r_ptr->flags1&RF1_CHAR_CLEAR)continue;
1656 if((r_ptr->flags1&RF1_NEVER_MOVE)&&(r_ptr->flags2&RF2_CHAR_MULTI))continue;
1658 if((strcmp(name, "生ける虚無『ヌル』")==0)||
1659 (strcmp(ename, "Null the Living Void")==0))continue;
1660 //"金無垢の指輪"は、一覧に出てはいけない
1661 if((strcmp(name, "金無垢の指輪")==0)||
1662 (strcmp(ename, "Plain Gold Ring")==0))continue;
1666 //ソート済みなので同じモンスターは連続する.これを利用して同じモンスターをカウント,まとめて表示する.
1667 if(!last_mons){//先頭モンスター
1673 if(last_mons->ap_r_idx == m_ptr->ap_r_idx){
1675 continue;//表示処理を次に回す
1677 //print last mons info
1678 print_monster_line(x, line++, last_mons, n_same);
1681 if(line-y-1==max_lines){//残り1行
1685 if(line-y-1==max_lines && i!=tmp_pos.n){
1686 Term_gotoxy(x, line);
1687 Term_addstr(-1, TERM_WHITE, "-- and more --");
1689 if(last_mons)print_monster_line(x, line++, last_mons, n_same);
1694 * @brief 出現中モンスターのリストをサブウィンドウに表示する / Hack -- display monster list in sub-windows
1697 static void fix_monster_list(void)
1703 for (j = 0; j < 8; j++)
1708 if (!angband_term[j]) continue;
1710 /* No relevant flags */
1711 if (!(window_flag[j] & (PW_MONSTER_LIST))) continue;
1714 Term_activate(angband_term[j]);
1715 Term_get_size(&w, &h);
1719 target_set_prepare_look();//モンスター一覧を生成,ソート
1720 print_monster_list(0, 0, h);
1729 * @brief 現在の装備品をサブウィンドウに表示する /
1730 * Hack -- display equipment in sub-windows
1733 static void fix_equip(void)
1738 for (j = 0; j < 8; j++)
1743 if (!angband_term[j]) continue;
1745 /* No relevant flags */
1746 if (!(window_flag[j] & (PW_EQUIP))) continue;
1749 Term_activate(angband_term[j]);
1751 /* Display equipment */
1760 * @brief 現在の習得済魔法をサブウィンドウに表示する /
1761 * Hack -- display spells in sub-windows
1764 static void fix_spell(void)
1769 for (j = 0; j < 8; j++)
1774 if (!angband_term[j]) continue;
1776 /* No relevant flags */
1777 if (!(window_flag[j] & (PW_SPELL))) continue;
1780 Term_activate(angband_term[j]);
1782 /* Display spell list */
1783 display_spell_list();
1791 * @brief 現在のプレイヤーステータスをサブウィンドウに表示する /
1792 * Hack -- display character in sub-windows
1795 static void fix_player(void)
1800 for (j = 0; j < 8; j++)
1805 if (!angband_term[j]) continue;
1807 /* No relevant flags */
1808 if (!(window_flag[j] & (PW_PLAYER))) continue;
1811 Term_activate(angband_term[j]);
1821 * @brief ゲームメッセージ履歴をサブウィンドウに表示する /
1822 * Hack -- display recent messages in sub-windows
1823 * Adjust for width and split messages
1826 static void fix_message(void)
1833 for (j = 0; j < 8; j++)
1838 if (!angband_term[j]) continue;
1840 /* No relevant flags */
1841 if (!(window_flag[j] & (PW_MESSAGE))) continue;
1844 Term_activate(angband_term[j]);
1846 Term_get_size(&w, &h);
1849 for (i = 0; i < h; i++)
1851 /* Dump the message on the appropriate line */
1852 Term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
1855 Term_locate(&x, &y);
1857 /* Clear to end of line */
1858 Term_erase(x, y, 255);
1867 * @brief 簡易マップをサブウィンドウに表示する /
1868 * Hack -- display overhead view in sub-windows
1869 * Adjust for width and split messages
1872 * Note that the "player" symbol does NOT appear on the map.
1874 static void fix_overhead(void)
1880 for (j = 0; j < 8; j++)
1886 if (!angband_term[j]) continue;
1888 /* No relevant flags */
1889 if (!(window_flag[j] & (PW_OVERHEAD))) continue;
1892 Term_activate(angband_term[j]);
1894 /* Full map in too small window is useless */
1895 Term_get_size(&wid, &hgt);
1896 if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2)
1899 display_map(&cy, &cx);
1906 static void display_dungeon(void)
1913 SYMBOL_CODE tc = '\0';
1915 for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++)
1917 for (y = p_ptr->y - Term->hgt / 2 + 1; y <= p_ptr->y + Term->hgt / 2; y++)
1919 if (in_bounds2(y, x))
1921 map_info(y, x, &a, &c, &ta, &tc);
1923 /* Hack -- fake monochrome */
1926 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
1927 else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
1928 else if (p_ptr->wraith_form) a = TERM_L_DARK;
1931 /* Hack -- Queue it */
1932 Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
1936 /* Clear out-of-bound tiles */
1938 /* Access darkness */
1939 feature_type *f_ptr = &f_info[feat_none];
1942 a = f_ptr->x_attr[F_LIT_STANDARD];
1945 c = f_ptr->x_char[F_LIT_STANDARD];
1947 /* Hack -- Queue it */
1948 Term_queue_char(x - p_ptr->x + Term->wid / 2 - 1, y - p_ptr->y + Term->hgt / 2 - 1, a, c, ta, tc);
1955 * @brief ダンジョンの地形をサブウィンドウに表示する /
1956 * Hack -- display dungeon view in sub-windows
1959 static void fix_dungeon(void)
1964 for (j = 0; j < 8; j++)
1969 if (!angband_term[j]) continue;
1971 /* No relevant flags */
1972 if (!(window_flag[j] & (PW_DUNGEON))) continue;
1975 Term_activate(angband_term[j]);
1977 /* Redraw dungeon view */
1986 * @brief モンスターの思い出をサブウィンドウに表示する /
1987 * Hack -- display dungeon view in sub-windows
1990 static void fix_monster(void)
1995 for (j = 0; j < 8; j++)
2000 if (!angband_term[j]) continue;
2002 /* No relevant flags */
2003 if (!(window_flag[j] & (PW_MONSTER))) continue;
2006 Term_activate(angband_term[j]);
2008 /* Display monster race info */
2009 if (p_ptr->monster_race_idx) display_roff(p_ptr->monster_race_idx);
2017 * @brief ベースアイテム情報をサブウィンドウに表示する /
2018 * Hack -- display object recall in sub-windows
2021 static void fix_object(void)
2026 for (j = 0; j < 8; j++)
2031 if (!angband_term[j]) continue;
2033 /* No relevant flags */
2034 if (!(window_flag[j] & (PW_OBJECT))) continue;
2037 Term_activate(angband_term[j]);
2039 /* Display monster race info */
2040 if (p_ptr->object_kind_idx) display_koff(p_ptr->object_kind_idx);
2049 * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 /
2050 * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
2051 * @return 重すぎるならばTRUE
2053 bool is_heavy_shoot(object_type *o_ptr)
2055 int hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
2056 /* It is hard to carholdry a heavy bow */
2057 return (hold < o_ptr->weight / 10);
2062 * @brief p_ptr->redraw のフラグに応じた更新をまとめて行う / Handle "p_ptr->redraw"
2064 * @details 更新処理の対象はゲーム中の全描画処理
2066 void redraw_stuff(void)
2068 if (!p_ptr->redraw) return;
2070 /* Character is not ready yet, no screen updates */
2071 if (!current_world_ptr->character_generated) return;
2073 /* Character is in "icky" mode, no screen updates */
2074 if (current_world_ptr->character_icky) return;
2076 /* Hack -- clear the screen */
2077 if (p_ptr->redraw & (PR_WIPE))
2079 p_ptr->redraw &= ~(PR_WIPE);
2084 if (p_ptr->redraw & (PR_MAP))
2086 p_ptr->redraw &= ~(PR_MAP);
2090 if (p_ptr->redraw & (PR_BASIC))
2092 p_ptr->redraw &= ~(PR_BASIC);
2093 p_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
2094 p_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
2095 p_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
2096 p_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
2102 if (p_ptr->redraw & (PR_EQUIPPY))
2104 p_ptr->redraw &= ~(PR_EQUIPPY);
2105 print_equippy(); /* To draw / delete equippy chars */
2108 if (p_ptr->redraw & (PR_MISC))
2110 p_ptr->redraw &= ~(PR_MISC);
2111 prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
2112 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
2115 if (p_ptr->redraw & (PR_TITLE))
2117 p_ptr->redraw &= ~(PR_TITLE);
2121 if (p_ptr->redraw & (PR_LEV))
2123 p_ptr->redraw &= ~(PR_LEV);
2127 if (p_ptr->redraw & (PR_EXP))
2129 p_ptr->redraw &= ~(PR_EXP);
2133 if (p_ptr->redraw & (PR_STATS))
2135 p_ptr->redraw &= ~(PR_STATS);
2144 if (p_ptr->redraw & (PR_STATUS))
2146 p_ptr->redraw &= ~(PR_STATUS);
2150 if (p_ptr->redraw & (PR_ARMOR))
2152 p_ptr->redraw &= ~(PR_ARMOR);
2156 if (p_ptr->redraw & (PR_HP))
2158 p_ptr->redraw &= ~(PR_HP);
2162 if (p_ptr->redraw & (PR_MANA))
2164 p_ptr->redraw &= ~(PR_MANA);
2168 if (p_ptr->redraw & (PR_GOLD))
2170 p_ptr->redraw &= ~(PR_GOLD);
2174 if (p_ptr->redraw & (PR_DEPTH))
2176 p_ptr->redraw &= ~(PR_DEPTH);
2180 if (p_ptr->redraw & (PR_HEALTH))
2182 p_ptr->redraw &= ~(PR_HEALTH);
2183 health_redraw(FALSE);
2186 if (p_ptr->redraw & (PR_UHEALTH))
2188 p_ptr->redraw &= ~(PR_UHEALTH);
2189 health_redraw(TRUE);
2192 if (p_ptr->redraw & (PR_EXTRA))
2194 p_ptr->redraw &= ~(PR_EXTRA);
2195 p_ptr->redraw &= ~(PR_CUT | PR_STUN);
2196 p_ptr->redraw &= ~(PR_HUNGER);
2197 p_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
2201 if (p_ptr->redraw & (PR_CUT))
2203 p_ptr->redraw &= ~(PR_CUT);
2207 if (p_ptr->redraw & (PR_STUN))
2209 p_ptr->redraw &= ~(PR_STUN);
2213 if (p_ptr->redraw & (PR_HUNGER))
2215 p_ptr->redraw &= ~(PR_HUNGER);
2219 if (p_ptr->redraw & (PR_STATE))
2221 p_ptr->redraw &= ~(PR_STATE);
2225 if (p_ptr->redraw & (PR_SPEED))
2227 p_ptr->redraw &= ~(PR_SPEED);
2231 if (p_ptr->pclass == CLASS_IMITATOR)
2233 if (p_ptr->redraw & (PR_IMITATION))
2235 p_ptr->redraw &= ~(PR_IMITATION);
2239 else if (p_ptr->redraw & (PR_STUDY))
2241 p_ptr->redraw &= ~(PR_STUDY);
2247 * @brief p_ptr->window のフラグに応じた更新をまとめて行う / Handle "p_ptr->window"
2249 * @details 更新処理の対象はサブウィンドウ全般
2251 void window_stuff(void)
2254 BIT_FLAGS mask = 0L;
2257 if (!p_ptr->window) return;
2260 for (j = 0; j < 8; j++)
2262 /* Save usable flags */
2263 if (angband_term[j]) mask |= window_flag[j];
2266 /* Apply usable flags */
2267 p_ptr->window &= mask;
2270 if (!p_ptr->window) return;
2272 /* Display p_ptr->inventory_list */
2273 if (p_ptr->window & (PW_INVEN))
2275 p_ptr->window &= ~(PW_INVEN);
2279 /* Display equipment */
2280 if (p_ptr->window & (PW_EQUIP))
2282 p_ptr->window &= ~(PW_EQUIP);
2286 /* Display spell list */
2287 if (p_ptr->window & (PW_SPELL))
2289 p_ptr->window &= ~(PW_SPELL);
2293 /* Display player */
2294 if (p_ptr->window & (PW_PLAYER))
2296 p_ptr->window &= ~(PW_PLAYER);
2300 /* Display monster list */
2301 if (p_ptr->window & (PW_MONSTER_LIST))
2303 p_ptr->window &= ~(PW_MONSTER_LIST);
2307 /* Display overhead view */
2308 if (p_ptr->window & (PW_MESSAGE))
2310 p_ptr->window &= ~(PW_MESSAGE);
2314 /* Display overhead view */
2315 if (p_ptr->window & (PW_OVERHEAD))
2317 p_ptr->window &= ~(PW_OVERHEAD);
2321 /* Display overhead view */
2322 if (p_ptr->window & (PW_DUNGEON))
2324 p_ptr->window &= ~(PW_DUNGEON);
2328 /* Display monster recall */
2329 if (p_ptr->window & (PW_MONSTER))
2331 p_ptr->window &= ~(PW_MONSTER);
2335 /* Display object recall */
2336 if (p_ptr->window & (PW_OBJECT))
2338 p_ptr->window &= ~(PW_OBJECT);
2344 * @brief コンソールのリサイズに合わせてマップを再描画する /
2345 * Map resizing whenever the main term changes size
2348 void resize_map(void)
2350 /* Only if the dungeon exists */
2351 if (!current_world_ptr->character_dungeon) return;
2353 /* Mega-Hack -- no panel yet */
2357 /* Reset the panels */
2358 panel_row_min = current_floor_ptr->height;
2359 panel_col_min = current_floor_ptr->width;
2363 p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
2364 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2365 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
2366 p_ptr->update |= (PU_MONSTERS);
2367 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
2374 * Place the cursor on the player
2376 if (can_save) move_cursor_relative(p_ptr->y, p_ptr->x);
2382 * @brief コンソールを再描画する /
2383 * Redraw a term when it is resized
2386 void redraw_window(void)
2388 /* Only if the dungeon exists */
2389 if (!current_world_ptr->character_dungeon) return;
2391 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
2392 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
2400 * @brief フォーカスを当てるべきマップ描画の基準座標を指定する(サブルーチン)
2401 * @param dy 変更先のフロアY座標
2402 * @param dx 変更先のフロアX座標
2403 * Handle a request to change the current panel
2404 * Return TRUE if the panel was changed.
2405 * Also used in do_cmd_locate
2406 * @return 実際に再描画が必要だった場合TRUEを返す
2408 bool change_panel(POSITION dy, POSITION dx)
2413 get_screen_size(&wid, &hgt);
2415 /* Apply the motion */
2416 y = panel_row_min + dy * hgt / 2;
2417 x = panel_col_min + dx * wid / 2;
2419 /* Verify the row */
2420 if (y > current_floor_ptr->height - hgt) y = current_floor_ptr->height - hgt;
2423 /* Verify the col */
2424 if (x > current_floor_ptr->width - wid) x = current_floor_ptr->width - wid;
2427 /* Handle "changes" */
2428 if ((y != panel_row_min) || (x != panel_col_min))
2430 /* Save the new panel info */
2434 panel_bounds_center();
2436 p_ptr->update |= (PU_MONSTERS);
2437 p_ptr->redraw |= (PR_MAP);
2449 * @brief プレイヤーの装備一覧シンボルを固定位置に表示する
2452 void print_equippy(void)
2454 display_player_equippy(ROW_EQUIPPY, COL_EQUIPPY, 0);
2458 * @brief 現在のコンソール表示の縦横を返す。 /
2459 * Get term size and calculate screen size
2460 * @param wid_p コンソールの表示幅文字数を返す
2461 * @param hgt_p コンソールの表示行数を返す
2464 void get_screen_size(TERM_LEN *wid_p, TERM_LEN *hgt_p)
2466 Term_get_size(wid_p, hgt_p);
2467 *hgt_p -= ROW_MAP + 2;
2468 *wid_p -= COL_MAP + 2;
2469 if (use_bigtile) *wid_p /= 2;
2473 * Calculate panel colum of a location in the map
2475 int panel_col_of(int col)
2477 col -= panel_col_min;
2478 if (use_bigtile) col *= 2;
2483 * Prints the map of the dungeon
2485 * Note that, for efficiency, we contain an "optimized" version
2486 * of both "lite_spot()" and "print_rel()", and that we use the
2487 * "lite_spot()" function to display the player grid, if needed.
2495 POSITION xmin, xmax, ymin, ymax;
2499 Term_get_size(&wid, &hgt);
2501 /* Remove map offset */
2505 /* Access the cursor state */
2506 (void)Term_get_cursor(&v);
2508 /* Hide the cursor */
2509 (void)Term_set_cursor(0);
2512 xmin = (0 < panel_col_min) ? panel_col_min : 0;
2513 xmax = (current_floor_ptr->width - 1 > panel_col_max) ? panel_col_max : current_floor_ptr->width - 1;
2514 ymin = (0 < panel_row_min) ? panel_row_min : 0;
2515 ymax = (current_floor_ptr->height - 1 > panel_row_max) ? panel_row_max : current_floor_ptr->height - 1;
2517 /* Bottom section of screen */
2518 for (y = 1; y <= ymin - panel_row_prt; y++)
2520 /* Erase the section */
2521 Term_erase(COL_MAP, y, wid);
2524 /* Top section of screen */
2525 for (y = ymax - panel_row_prt; y <= hgt; y++)
2527 /* Erase the section */
2528 Term_erase(COL_MAP, y, wid);
2532 for (y = ymin; y <= ymax; y++)
2534 /* Scan the columns of row "y" */
2535 for (x = xmin; x <= xmax; x++)
2543 /* Determine what is there */
2544 map_info(y, x, &a, &c, &ta, &tc);
2546 /* Hack -- fake monochrome */
2549 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
2550 else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
2551 else if (p_ptr->wraith_form) a = TERM_L_DARK;
2554 /* Efficiency -- Redraw that grid of the map */
2555 Term_queue_bigchar(panel_col_of(x), y - panel_row_prt, a, c, ta, tc);
2559 /* Display player */
2560 lite_spot(p_ptr->y, p_ptr->x);
2562 /* Restore the cursor */
2563 (void)Term_set_cursor(v);
2569 * 一般的にモンスターシンボルとして扱われる記号を定義する(幻覚処理向け) / Hack -- Legal monster codes
2571 static char image_monster_hack[] = \
2572 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2575 * 一般的にオブジェクトシンボルとして扱われる記号を定義する(幻覚処理向け) / Hack -- Legal object codes
2577 static char image_object_hack[] = "?/|\\\"!$()_-=[]{},~";
2580 * @brief モンスターの表示を幻覚状態に差し替える / Mega-Hack -- Hallucinatory monster
2585 static void image_monster(TERM_COLOR *ap, SYMBOL_CODE *cp)
2587 /* Random symbol from set above */
2590 monster_race *r_ptr = &r_info[randint1(max_r_idx - 1)];
2592 *cp = r_ptr->x_char;
2593 *ap = r_ptr->x_attr;
2598 *cp = (one_in_(25) ?
2599 image_object_hack[randint0(sizeof(image_object_hack) - 1)] :
2600 image_monster_hack[randint0(sizeof(image_monster_hack) - 1)]);
2608 * @brief オブジェクトの表示を幻覚状態に差し替える / Hallucinatory object
2613 static void image_object(TERM_COLOR *ap, SYMBOL_CODE *cp)
2617 object_kind *k_ptr = &k_info[randint1(max_k_idx - 1)];
2619 *cp = k_ptr->x_char;
2620 *ap = k_ptr->x_attr;
2624 int n = sizeof(image_object_hack) - 1;
2626 *cp = image_object_hack[randint0(n)];
2635 * @brief オブジェクト&モンスターの表示を幻覚状態に差し替える / Hack -- Random hallucination
2640 static void image_random(TERM_COLOR *ap, SYMBOL_CODE *cp)
2642 /* Normally, assume monsters */
2643 if (randint0(100) < 75)
2645 image_monster(ap, cp);
2648 /* Otherwise, assume objects */
2651 image_object(ap, cp);
2656 * 照明の表現を行うための色合いの関係を{暗闇時, 照明時} で定義する /
2657 * This array lists the effects of "brightness" on various "base" colours.\n
2659 * This is used to do dynamic lighting effects in ascii :-)\n
2660 * At the moment, only the various "floor" tiles are affected.\n
2662 * The layout of the array is [x][0] = light and [x][1] = dark.\n
2664 static TERM_COLOR lighting_colours[16][2] =
2667 {TERM_L_DARK, TERM_DARK},
2670 {TERM_YELLOW, TERM_SLATE},
2673 {TERM_WHITE, TERM_L_DARK},
2676 {TERM_L_UMBER, TERM_UMBER},
2679 {TERM_RED, TERM_RED},
2682 {TERM_L_GREEN, TERM_GREEN},
2685 {TERM_BLUE, TERM_BLUE},
2688 {TERM_L_UMBER, TERM_RED},
2691 {TERM_SLATE, TERM_L_DARK},
2694 {TERM_WHITE, TERM_SLATE},
2697 {TERM_L_RED, TERM_BLUE},
2700 {TERM_YELLOW, TERM_ORANGE},
2703 {TERM_L_RED, TERM_L_RED},
2706 {TERM_L_GREEN, TERM_GREEN},
2709 {TERM_L_BLUE, TERM_L_BLUE},
2712 {TERM_L_UMBER, TERM_UMBER}
2720 void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], SYMBOL_CODE f_char[F_LIT_MAX])
2722 TERM_COLOR s_attr = f_attr[F_LIT_STANDARD];
2723 SYMBOL_CODE s_char = f_char[F_LIT_STANDARD];
2726 if (is_ascii_graphics(s_attr)) /* For ASCII */
2728 f_attr[F_LIT_LITE] = lighting_colours[s_attr & 0x0f][0];
2729 f_attr[F_LIT_DARK] = lighting_colours[s_attr & 0x0f][1];
2730 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++) f_char[i] = s_char;
2732 else /* For tile graphics */
2734 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++) f_attr[i] = s_attr;
2735 f_char[F_LIT_LITE] = s_char + 2;
2736 f_char[F_LIT_DARK] = s_char + 1;
2742 * @brief Mコマンドによる縮小マップの表示を行う / Extract the attr/char to display at the given (legal) map location
2744 * Basically, we "paint" the chosen attr/char in several passes, starting\n
2745 * with any known "terrain features" (defaulting to darkness), then adding\n
2746 * any known "objects", and finally, adding any known "monsters". This\n
2747 * is not the fastest method but since most of the calls to this function\n
2748 * are made for grids with no monsters or objects, it is fast enough.\n
2750 * Note that this function, if used on the grid containing the "player",\n
2751 * will return the attr/char of the grid underneath the player, and not\n
2752 * the actual player attr/char itself, allowing a lot of optimization\n
2753 * in various "display" functions.\n
2755 * Note that the "zero" entry in the feature/object/monster arrays are\n
2756 * used to provide "special" attr/char codes, with "monster zero" being\n
2757 * used for the player attr/char, "object zero" being used for the "stack"\n
2758 * attr/char, and "feature zero" being used for the "nothing" attr/char,\n
2759 * though this function makes use of only "feature zero".\n
2761 * Note that monsters can have some "special" flags, including "ATTR_MULTI",\n
2762 * which means their color changes, and "ATTR_CLEAR", which means they take\n
2763 * the color of whatever is under them, and "CHAR_CLEAR", which means that\n
2764 * they take the symbol of whatever is under them. Technically, the flag\n
2765 * "CHAR_MULTI" is supposed to indicate that a monster looks strange when\n
2766 * examined, but this flag is currently ignored.\n
2768 * Currently, we do nothing with multi-hued objects, because there are\n
2769 * not any. If there were, they would have to set "shimmer_objects"\n
2770 * when they were created, and then new "shimmer" code in "dungeon.c"\n
2771 * would have to be created handle the "shimmer" effect, and the code\n
2772 * in "current_floor_ptr->grid_array.c" would have to be updated to create the shimmer effect.\n
2774 * Note the effects of hallucination. Objects always appear as random\n
2775 * "objects", monsters as random "monsters", and normal grids occasionally\n
2776 * appear as random "monsters" or "objects", but note that these random\n
2777 * "monsters" and "objects" are really just "colored ascii symbols".\n
2779 * Note that "floors" and "invisible traps" (and "zero" features) are\n
2780 * drawn as "floors" using a special check for optimization purposes,\n
2781 * and these are the only features which get drawn using the special\n
2782 * lighting effects activated by "view_special_lite".\n
2784 * Note the use of the "mimic" field in the "terrain feature" processing,\n
2785 * which allows any feature to "pretend" to be another feature. This is\n
2786 * used to "hide" secret doors, and to make all "doors" appear the same,\n
2787 * and all "walls" appear the same, and "hidden" treasure stay hidden.\n
2788 * It is possible to use this field to make a feature "look" like a floor,\n
2789 * but the "special lighting effects" for floors will not be used.\n
2791 * Note the use of the new "terrain feature" information. Note that the\n
2792 * assumption that all interesting "objects" and "terrain features" are\n
2793 * memorized allows extremely optimized processing below. Note the use\n
2794 * of separate flags on objects to mark them as memorized allows a grid\n
2795 * to have memorized "terrain" without granting knowledge of any object\n
2796 * which may appear in that grid.\n
2798 * Note the efficient code used to determine if a "floor" grid is\n
2799 * "memorized" or "viewable" by the player, where the test for the\n
2800 * grid being "viewable" is based on the facts that (1) the grid\n
2801 * must be "lit" (torch-lit or perma-lit), (2) the grid must be in\n
2802 * line of sight, and (3) the player must not be blind, and uses the\n
2803 * assumption that all torch-lit grids are in line of sight.\n
2805 * Note that floors (and invisible traps) are the only grids which are\n
2806 * not memorized when seen, so only these grids need to check to see if\n
2807 * the grid is "viewable" to the player (if it is not memorized). Since\n
2808 * most non-memorized grids are in fact walls, this induces *massive*\n
2809 * efficiency, at the cost of *forcing* the memorization of non-floor\n
2810 * grids when they are first seen. Note that "invisible traps" are\n
2811 * always treated exactly like "floors", which prevents "cheating".\n
2813 * Note the "special lighting effects" which can be activated for floor\n
2814 * grids using the "view_special_lite" option (for "white" floor grids),\n
2815 * causing certain grids to be displayed using special colors. If the\n
2816 * player is "blind", we will use "dark gray", else if the grid is lit\n
2817 * by the torch, and the "view_yellow_lite" option is set, we will use\n
2818 * "yellow", else if the grid is "dark", we will use "dark gray", else\n
2819 * if the grid is not "viewable", and the "view_bright_lite" option is\n
2820 * set, and the we will use "slate" (gray). We will use "white" for all\n
2821 * other cases, in particular, for illuminated viewable floor grids.\n
2823 * Note the "special lighting effects" which can be activated for wall\n
2824 * grids using the "view_granite_lite" option (for "white" wall 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 "view_bright_lite" option is set, and the grid\n
2829 * is not "viewable", or is "dark", or is glowing, but not when viewed\n
2830 * from the player's current location, we will use "slate" (gray). We\n
2831 * will use "white" for all other cases, in particular, for correctly\n
2832 * illuminated viewable wall grids.\n
2834 * Note that, when "view_granite_lite" is set, we use an inline version\n
2835 * of the "player_can_see_bold()" function to check the "viewability" of\n
2836 * grids when the "view_bright_lite" option is set, and we do NOT use\n
2837 * any special colors for "dark" wall grids, since this would allow the\n
2838 * player to notice the walls of illuminated rooms from a hallway that\n
2839 * happened to run beside the room. The alternative, by the way, would\n
2840 * be to prevent the generation of hallways next to rooms, but this\n
2841 * would still allow problems when digging towards a room.\n
2843 * Note that bizarre things must be done when the "attr" and/or "char"\n
2844 * codes have the "high-bit" set, since these values are used to encode\n
2845 * various "special" pictures in some versions, and certain situations,\n
2846 * such as "multi-hued" or "clear" monsters, cause the attr/char codes\n
2847 * to be "scrambled" in various ways.\n
2849 * Note that eventually we may use the "&" symbol for embedded treasure,\n
2850 * and use the "*" symbol to indicate multiple objects, though this will\n
2851 * have to wait for Angband 2.8.0 or later. Note that currently, this\n
2852 * is not important, since only one object or terrain feature is allowed\n
2853 * in each grid. If needed, "k_info[0]" will hold the "stack" attr/char.\n
2855 * Note the assumption that doing "x_ptr = &x_info[x]" plus a few of\n
2856 * "x_ptr->xxx", is quicker than "x_info[x].xxx", if this is incorrect\n
2857 * then a whole lot of code should be changed... XXX XXX\n
2859 void map_info(POSITION y, POSITION x, TERM_COLOR *ap, SYMBOL_CODE *cp, TERM_COLOR *tap, SYMBOL_CODE *tcp)
2861 /* Get the current_floor_ptr->grid_array */
2862 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2864 OBJECT_IDX this_o_idx, next_o_idx = 0;
2866 /* Feature code (applying "mimic" field) */
2867 FEAT_IDX feat = get_feat_mimic(g_ptr);
2870 feature_type *f_ptr = &f_info[feat];
2875 /* Boring grids (floors, etc) */
2876 if (!have_flag(f_ptr->flags, FF_REMEMBER))
2879 * Handle Memorized or visible floor
2881 * No visual when blinded.
2882 * (to prevent strange effects on darkness breath)
2884 * - Can see grids with CAVE_MARK.
2885 * - Can see grids with CAVE_LITE or CAVE_MNLT.
2886 * (Such grids also have CAVE_VIEW)
2887 * - Can see grids with CAVE_VIEW unless darkened by monsters.
2889 if (!p_ptr->blind &&
2890 ((g_ptr->info & (CAVE_MARK | CAVE_LITE | CAVE_MNLT)) ||
2891 ((g_ptr->info & CAVE_VIEW) && (((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) || p_ptr->see_nocto))))
2893 /* Normal attr/char */
2894 a = f_ptr->x_attr[F_LIT_STANDARD];
2895 c = f_ptr->x_char[F_LIT_STANDARD];
2897 if (p_ptr->wild_mode)
2899 /* Special lighting effects */
2900 /* Handle "night" */
2901 if (view_special_lite && !is_daytime())
2903 /* Use a darkened colour/tile */
2904 a = f_ptr->x_attr[F_LIT_DARK];
2905 c = f_ptr->x_char[F_LIT_DARK];
2909 /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
2910 else if (darkened_grid(g_ptr))
2912 /* Unsafe grid -- idea borrowed from Unangband */
2913 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
2915 /* Access darkness */
2916 f_ptr = &f_info[feat];
2918 /* Char and attr of darkness */
2919 a = f_ptr->x_attr[F_LIT_STANDARD];
2920 c = f_ptr->x_char[F_LIT_STANDARD];
2923 /* Special lighting effects */
2924 else if (view_special_lite)
2926 /* Handle "torch-lit" grids */
2927 if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
2930 if (view_yellow_lite)
2932 /* Use a brightly lit colour/tile */
2933 a = f_ptr->x_attr[F_LIT_LITE];
2934 c = f_ptr->x_char[F_LIT_LITE];
2938 /* Handle "dark" grids */
2939 else if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
2941 /* Use a darkened colour/tile */
2942 a = f_ptr->x_attr[F_LIT_DARK];
2943 c = f_ptr->x_char[F_LIT_DARK];
2946 /* Handle "out-of-sight" grids */
2947 else if (!(g_ptr->info & CAVE_VIEW))
2950 if (view_bright_lite)
2952 /* Use a darkened colour/tile */
2953 a = f_ptr->x_attr[F_LIT_DARK];
2954 c = f_ptr->x_char[F_LIT_DARK];
2963 /* Unsafe grid -- idea borrowed from Unangband */
2964 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
2966 /* Access darkness */
2967 f_ptr = &f_info[feat];
2969 /* Normal attr/char */
2970 a = f_ptr->x_attr[F_LIT_STANDARD];
2971 c = f_ptr->x_char[F_LIT_STANDARD];
2975 /* Interesting grids (non-floors) */
2978 /* Memorized grids */
2979 if (g_ptr->info & CAVE_MARK)
2981 /* Normal attr/char */
2982 a = f_ptr->x_attr[F_LIT_STANDARD];
2983 c = f_ptr->x_char[F_LIT_STANDARD];
2985 if (p_ptr->wild_mode)
2987 /* Special lighting effects */
2988 /* Handle "blind" or "night" */
2989 if (view_granite_lite && (p_ptr->blind || !is_daytime()))
2991 /* Use a darkened colour/tile */
2992 a = f_ptr->x_attr[F_LIT_DARK];
2993 c = f_ptr->x_char[F_LIT_DARK];
2997 /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
2998 else if (darkened_grid(g_ptr) && !p_ptr->blind)
3000 if (have_flag(f_ptr->flags, FF_LOS) && have_flag(f_ptr->flags, FF_PROJECT))
3002 /* Unsafe grid -- idea borrowed from Unangband */
3003 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
3005 /* Access darkness */
3006 f_ptr = &f_info[feat];
3008 /* Char and attr of darkness */
3009 a = f_ptr->x_attr[F_LIT_STANDARD];
3010 c = f_ptr->x_char[F_LIT_STANDARD];
3012 else if (view_granite_lite && view_bright_lite)
3014 /* Use a darkened colour/tile */
3015 a = f_ptr->x_attr[F_LIT_DARK];
3016 c = f_ptr->x_char[F_LIT_DARK];
3020 /* Special lighting effects */
3021 else if (view_granite_lite)
3023 /* Handle "blind" */
3026 /* Use a darkened colour/tile */
3027 a = f_ptr->x_attr[F_LIT_DARK];
3028 c = f_ptr->x_char[F_LIT_DARK];
3031 /* Handle "torch-lit" grids */
3032 else if (g_ptr->info & (CAVE_LITE | CAVE_MNLT))
3035 if (view_yellow_lite)
3037 /* Use a brightly lit colour/tile */
3038 a = f_ptr->x_attr[F_LIT_LITE];
3039 c = f_ptr->x_char[F_LIT_LITE];
3043 /* Handle "view_bright_lite" */
3044 else if (view_bright_lite)
3047 if (!(g_ptr->info & CAVE_VIEW))
3049 /* Use a darkened colour/tile */
3050 a = f_ptr->x_attr[F_LIT_DARK];
3051 c = f_ptr->x_char[F_LIT_DARK];
3055 else if ((g_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
3057 /* Use a darkened colour/tile */
3058 a = f_ptr->x_attr[F_LIT_DARK];
3059 c = f_ptr->x_char[F_LIT_DARK];
3062 /* Not glowing correctly */
3063 else if (!have_flag(f_ptr->flags, FF_LOS) && !check_local_illumination(y, x))
3065 /* Use a darkened colour/tile */
3066 a = f_ptr->x_attr[F_LIT_DARK];
3067 c = f_ptr->x_char[F_LIT_DARK];
3076 /* Unsafe grid -- idea borrowed from Unangband */
3077 feat = (view_unsafe_grids && (g_ptr->info & CAVE_UNSAFE)) ? feat_undetected : feat_none;
3079 /* Access feature */
3080 f_ptr = &f_info[feat];
3082 /* Normal attr/char */
3083 a = f_ptr->x_attr[F_LIT_STANDARD];
3084 c = f_ptr->x_char[F_LIT_STANDARD];
3088 if (feat_priority == -1) feat_priority = f_ptr->priority;
3090 /* Save the terrain info for the transparency effects */
3098 /* Hack -- rare random hallucination, except on outer dungeon walls */
3103 image_random(ap, cp);
3108 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
3111 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
3112 next_o_idx = o_ptr->next_o_idx;
3114 /* Memorized objects */
3115 if (o_ptr->marked & OM_FOUND)
3117 if (display_autopick)
3121 match_autopick = is_autopick(o_ptr);
3122 if (match_autopick == -1)
3125 act = autopick_list[match_autopick].action;
3127 if ((act & DO_DISPLAY) && (act & display_autopick))
3129 autopick_obj = o_ptr;
3133 match_autopick = -1;
3138 (*cp) = object_char(o_ptr);
3141 (*ap) = object_attr(o_ptr);
3145 /* Hack -- hallucination */
3146 if (p_ptr->image) image_object(ap, cp);
3153 /* Handle monsters */
3154 if (g_ptr->m_idx && display_autopick == 0)
3156 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
3158 /* Visible monster */
3161 monster_race *r_ptr = &r_info[m_ptr->ap_r_idx];
3169 * Monsters with both CHAR_CLEAR and ATTR_CLEAR
3170 * flags are always unseen.
3172 if ((r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR)) == (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR))
3178 image_monster(ap, cp);
3183 /* Monster attr/char */
3187 if (!(r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_SHAPECHANGER | RF1_ATTR_CLEAR
3188 | RF1_ATTR_MULTI | RF1_ATTR_SEMIRAND)))
3190 /* Desired monster attr/char */
3196 * Monsters with both CHAR_CLEAR and ATTR_CLEAR
3197 * flags are always unseen.
3199 else if ((r_ptr->flags1 & (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR)) == (RF1_CHAR_CLEAR | RF1_ATTR_CLEAR))
3206 /*** Monster's attr ***/
3207 if ((r_ptr->flags1 & RF1_ATTR_CLEAR) && (*ap != TERM_DARK) && !use_graphics)
3212 else if ((r_ptr->flags1 & RF1_ATTR_MULTI) && !use_graphics)
3214 /* Multi-hued attr */
3215 if (r_ptr->flags2 & RF2_ATTR_ANY) *ap = randint1(15);
3216 else switch (randint1(7))
3218 case 1: *ap = TERM_RED; break;
3219 case 2: *ap = TERM_L_RED; break;
3220 case 3: *ap = TERM_WHITE; break;
3221 case 4: *ap = TERM_L_GREEN; break;
3222 case 5: *ap = TERM_BLUE; break;
3223 case 6: *ap = TERM_L_DARK; break;
3224 case 7: *ap = TERM_GREEN; break;
3227 else if ((r_ptr->flags1 & RF1_ATTR_SEMIRAND) && !use_graphics)
3229 /* Use semi-random attr (usually mimics' colors vary) */
3230 *ap = g_ptr->m_idx % 15 + 1;
3238 /*** Monster's char ***/
3239 if ((r_ptr->flags1 & RF1_CHAR_CLEAR) && (*cp != ' ') && !use_graphics)
3244 else if (r_ptr->flags1 & RF1_SHAPECHANGER)
3248 monster_race *tmp_r_ptr = &r_info[randint1(max_r_idx - 1)];
3249 *cp = tmp_r_ptr->x_char;
3250 *ap = tmp_r_ptr->x_attr;
3254 *cp = (one_in_(25) ?
3255 image_object_hack[randint0(sizeof(image_object_hack) - 1)] :
3256 image_monster_hack[randint0(sizeof(image_monster_hack) - 1)]);
3269 /* Handle "player" */
3270 if (player_bold(y, x))
3272 monster_race *r_ptr = &r_info[0];
3273 *ap = r_ptr->x_attr;
3274 *cp = r_ptr->x_char;
3280 static concptr simplify_list[][2] =
3287 {"^Amulet of ", "\""},
3288 {"^Scroll of ", "?"},
3289 {"^Scroll titled ", "?"},
3290 {"^Wand of " , "-"},
3292 {"^Staff of " , "_"},
3293 {"^Potion of ", "!"},
3306 static void display_shortened_item_name(object_type *o_ptr, int y)
3313 object_desc(buf, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NAME_ONLY));
3314 attr = tval_to_attr[o_ptr->tval % 128];
3319 strcpy(buf, _("何か奇妙な物", "something strange"));
3322 for (c = buf; *c; c++)
3325 for (i = 0; simplify_list[i][1]; i++)
3327 concptr org_w = simplify_list[i][0];
3337 if (!strncmp(c, org_w, strlen(org_w)))
3340 concptr tmp = simplify_list[i][1];
3343 tmp = c + strlen(org_w);
3359 if (len + 2 > 12) break;
3366 if (len + 1 > 12) break;
3372 Term_putstr(0, y, 12, attr, buf);
3376 * Display a "small-scale" map of the dungeon in the active Term
3378 void display_map(int *cy, int *cx)
3388 SYMBOL_CODE **bigmc;
3395 /* Save lighting effects */
3396 bool old_view_special_lite = view_special_lite;
3397 bool old_view_granite_lite = view_granite_lite;
3399 TERM_LEN hgt, wid, yrat, xrat;
3401 int **match_autopick_yx;
3402 object_type ***object_autopick_yx;
3404 Term_get_size(&wid, &hgt);
3407 if (use_bigtile) wid /= 2;
3409 yrat = (current_floor_ptr->height + hgt - 1) / hgt;
3410 xrat = (current_floor_ptr->width + wid - 1) / wid;
3412 /* Disable lighting effects */
3413 view_special_lite = FALSE;
3414 view_granite_lite = FALSE;
3416 /* Allocate the maps */
3417 C_MAKE(ma, (hgt + 2), TERM_COLOR *);
3418 C_MAKE(mc, (hgt + 2), char_ptr);
3419 C_MAKE(mp, (hgt + 2), byte_ptr);
3420 C_MAKE(match_autopick_yx, (hgt + 2), sint_ptr);
3421 C_MAKE(object_autopick_yx, (hgt + 2), object_type **);
3423 /* Allocate and wipe each line map */
3424 for (y = 0; y < (hgt + 2); y++)
3426 /* Allocate one row each array */
3427 C_MAKE(ma[y], (wid + 2), TERM_COLOR);
3428 C_MAKE(mc[y], (wid + 2), char);
3429 C_MAKE(mp[y], (wid + 2), byte);
3430 C_MAKE(match_autopick_yx[y], (wid + 2), int);
3431 C_MAKE(object_autopick_yx[y], (wid + 2), object_type *);
3433 for (x = 0; x < wid + 2; ++x)
3435 match_autopick_yx[y][x] = -1;
3436 object_autopick_yx[y][x] = NULL;
3439 ma[y][x] = TERM_WHITE;
3447 /* Allocate the maps */
3448 C_MAKE(bigma, (current_floor_ptr->height + 2), TERM_COLOR *);
3449 C_MAKE(bigmc, (current_floor_ptr->height + 2), char_ptr);
3450 C_MAKE(bigmp, (current_floor_ptr->height + 2), byte_ptr);
3452 /* Allocate and wipe each line map */
3453 for (y = 0; y < (current_floor_ptr->height + 2); y++)
3455 /* Allocate one row each array */
3456 C_MAKE(bigma[y], (current_floor_ptr->width + 2), TERM_COLOR);
3457 C_MAKE(bigmc[y], (current_floor_ptr->width + 2), char);
3458 C_MAKE(bigmp[y], (current_floor_ptr->width + 2), byte);
3460 for (x = 0; x < current_floor_ptr->width + 2; ++x)
3463 bigma[y][x] = TERM_WHITE;
3471 /* Fill in the map */
3472 for (i = 0; i < current_floor_ptr->width; ++i)
3474 for (j = 0; j < current_floor_ptr->height; ++j)
3479 match_autopick = -1;
3480 autopick_obj = NULL;
3483 /* Extract the current attr/char at that map location */
3484 map_info(j, i, &ta, &tc, &ta, &tc);
3486 /* Extract the priority */
3487 tp = (byte_hack)feat_priority;
3489 if (match_autopick != -1
3490 && (match_autopick_yx[y][x] == -1
3491 || match_autopick_yx[y][x] > match_autopick))
3493 match_autopick_yx[y][x] = match_autopick;
3494 object_autopick_yx[y][x] = autopick_obj;
3498 /* Save the char, attr and priority */
3499 bigmc[j + 1][i + 1] = tc;
3500 bigma[j + 1][i + 1] = ta;
3501 bigmp[j + 1][i + 1] = tp;
3505 for (j = 0; j < current_floor_ptr->height; ++j)
3507 for (i = 0; i < current_floor_ptr->width; ++i)
3512 tc = bigmc[j + 1][i + 1];
3513 ta = bigma[j + 1][i + 1];
3514 tp = bigmp[j + 1][i + 1];
3516 /* rare feature has more priority */
3522 for (t = 0; t < 8; t++)
3524 if (tc == bigmc[j + 1 + ddy_cdd[t]][i + 1 + ddx_cdd[t]] &&
3525 ta == bigma[j + 1 + ddy_cdd[t]][i + 1 + ddx_cdd[t]])
3535 /* Save the char, attr and priority */
3548 /* Draw the corners */
3549 mc[0][0] = mc[0][x] = mc[y][0] = mc[y][x] = '+';
3551 /* Draw the horizontal edges */
3552 for (x = 1; x <= wid; x++) mc[0][x] = mc[y][x] = '-';
3554 /* Draw the vertical edges */
3555 for (y = 1; y <= hgt; y++) mc[y][0] = mc[y][x] = '|';
3558 /* Display each map line in order */
3559 for (y = 0; y < hgt + 2; ++y)
3561 /* Start a new line */
3562 Term_gotoxy(COL_MAP, y);
3564 /* Display the line */
3565 for (x = 0; x < wid + 2; ++x)
3570 /* Hack -- fake monochrome */
3573 if (current_world_ptr->timewalk_m_idx) ta = TERM_DARK;
3574 else if (IS_INVULN() || p_ptr->timewalk) ta = TERM_WHITE;
3575 else if (p_ptr->wraith_form) ta = TERM_L_DARK;
3578 /* Add the character */
3579 Term_add_bigch(ta, tc);
3584 for (y = 1; y < hgt + 1; ++y)
3586 match_autopick = -1;
3587 for (x = 1; x <= wid; x++) {
3588 if (match_autopick_yx[y][x] != -1 &&
3589 (match_autopick > match_autopick_yx[y][x] ||
3590 match_autopick == -1)) {
3591 match_autopick = match_autopick_yx[y][x];
3592 autopick_obj = object_autopick_yx[y][x];
3596 /* Clear old display */
3597 Term_putstr(0, y, 12, 0, " ");
3599 if (match_autopick != -1)
3601 display_shortened_item_name(autopick_obj, y);
3604 char buf[13] = "\0";
3605 strncpy(buf, autopick_list[match_autopick].name, 12);
3613 /* Player location */
3614 (*cy) = p_ptr->y / yrat + 1 + ROW_MAP;
3616 (*cx) = p_ptr->x / xrat + 1 + COL_MAP;
3618 (*cx) = (p_ptr->x / xrat + 1) * 2 + COL_MAP;
3620 /* Restore lighting effects */
3621 view_special_lite = old_view_special_lite;
3622 view_granite_lite = old_view_granite_lite;
3624 /* Free each line map */
3625 for (y = 0; y < (hgt + 2); y++)
3627 /* Free one row each array */
3628 C_KILL(ma[y], (wid + 2), TERM_COLOR);
3629 C_KILL(mc[y], (wid + 2), SYMBOL_CODE);
3630 C_KILL(mp[y], (wid + 2), byte);
3631 C_KILL(match_autopick_yx[y], (wid + 2), int);
3632 C_KILL(object_autopick_yx[y], (wid + 2), object_type *);
3635 /* Free each line map */
3636 C_KILL(ma, (hgt + 2), TERM_COLOR *);
3637 C_KILL(mc, (hgt + 2), char_ptr);
3638 C_KILL(mp, (hgt + 2), byte_ptr);
3639 C_KILL(match_autopick_yx, (hgt + 2), sint_ptr);
3640 C_KILL(object_autopick_yx, (hgt + 2), object_type **);
3642 /* Free each line map */
3643 for (y = 0; y < (current_floor_ptr->height + 2); y++)
3645 /* Free one row each array */
3646 C_KILL(bigma[y], (current_floor_ptr->width + 2), TERM_COLOR);
3647 C_KILL(bigmc[y], (current_floor_ptr->width + 2), SYMBOL_CODE);
3648 C_KILL(bigmp[y], (current_floor_ptr->width + 2), byte);
3651 /* Free each line map */
3652 C_KILL(bigma, (current_floor_ptr->height + 2), TERM_COLOR *);
3653 C_KILL(bigmc, (current_floor_ptr->height + 2), char_ptr);
3654 C_KILL(bigmp, (current_floor_ptr->height + 2), byte_ptr);
3659 * Display a "small-scale" map of the dungeon for the player
3661 * Currently, the "player" is displayed on the map.
3663 void do_cmd_view_map(void)
3669 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
3674 display_autopick = 0;
3676 /* Display the map */
3677 display_map(&cy, &cx);
3680 if (max_autopick && !p_ptr->wild_mode)
3682 display_autopick = ITEM_DISPLAY;
3689 int wid, hgt, row_message;
3691 Term_get_size(&wid, &hgt);
3692 row_message = hgt - 1;
3694 put_str(_("何かキーを押してください('M':拾う 'N':放置 'D':M+N 'K':壊すアイテムを表示)",
3695 " Hit M, N(for ~), K(for !), or D(same as M+N) to display auto-picker items."), row_message, 1);
3697 /* Hilite the player */
3698 move_cursor(cy, cx);
3703 flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK);
3705 flag = DONT_AUTOPICK;
3707 flag = DO_AUTODESTROY;
3709 flag = (DO_AUTOPICK | DO_QUERY_AUTOPICK | DONT_AUTOPICK);
3715 if (~display_autopick & flag)
3716 display_autopick |= flag;
3718 display_autopick &= ~flag;
3719 /* Display the map */
3720 display_map(&cy, &cx);
3723 display_autopick = 0;
3728 put_str(_("何かキーを押すとゲームに戻ります", "Hit any key to continue"), 23, 30);
3729 /* Hilite the player */
3730 move_cursor(cy, cx);
3738 * Track a new monster
3740 void health_track(MONSTER_IDX m_idx)
3742 /* Mount monster is already tracked */
3743 if (m_idx && m_idx == p_ptr->riding) return;
3745 /* Track a new guy */
3746 p_ptr->health_who = m_idx;
3748 /* Redraw (later) */
3749 p_ptr->redraw |= (PR_HEALTH);
3754 * Moves the cursor to a given MAP (y,x) location
3756 void move_cursor_relative(int row, int col)
3758 /* Real co-ords convert to screen positions */
3759 row -= panel_row_prt;
3762 Term_gotoxy(panel_col_of(col), row);
3767 * print project path
3769 void prt_path(POSITION y, POSITION x)
3774 byte_hack default_color = TERM_SLATE;
3776 if (!display_path) return;
3777 if (-1 == project_length)
3780 /* Get projection path */
3781 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), p_ptr->y, p_ptr->x, y, x, PROJECT_PATH | PROJECT_THRU);
3783 p_ptr->redraw |= (PR_MAP);
3787 for (i = 0; i < path_n; i++)
3789 POSITION ny = GRID_Y(path_g[i]);
3790 POSITION nx = GRID_X(path_g[i]);
3791 grid_type *g_ptr = ¤t_floor_ptr->grid_array[ny][nx];
3793 if (panel_contains(ny, nx))
3795 TERM_COLOR a = default_color;
3798 TERM_COLOR ta = default_color;
3801 if (g_ptr->m_idx && current_floor_ptr->m_list[g_ptr->m_idx].ml)
3803 /* Determine what is there */
3804 map_info(ny, nx, &a, &c, &ta, &tc);
3806 if (!is_ascii_graphics(a))
3808 else if (c == '.' && (a == TERM_WHITE || a == TERM_L_WHITE))
3810 else if (a == default_color)
3816 if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
3817 else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
3818 else if (p_ptr->wraith_form) a = TERM_L_DARK;
3823 /* Hack -- Queue it */
3824 Term_queue_bigchar(panel_col_of(nx), ny - panel_row_prt, a, c, ta, tc);
3828 if ((g_ptr->info & CAVE_MARK) && !cave_have_flag_grid(g_ptr, FF_PROJECT)) break;
3831 if (nx == x && ny == y) default_color = TERM_L_DARK;
3837 * Hack -- track the given monster race
3839 void monster_race_track(MONRACE_IDX r_idx)
3841 /* Save this monster ID */
3842 p_ptr->monster_race_idx = r_idx;
3844 p_ptr->window |= (PW_MONSTER);
3848 * Hack -- track the given object kind
3850 void object_kind_track(KIND_OBJECT_IDX k_idx)
3852 /* Save this monster ID */
3853 p_ptr->object_kind_idx = k_idx;
3855 p_ptr->window |= (PW_OBJECT);
3860 * @brief 実ゲームプレイ時間を更新する
3862 void update_playtime(void)
3864 /* Check if the game has started */
3865 if (current_world_ptr->start_time != 0)
3867 u32b tmp = (u32b)time(NULL);
3868 current_world_ptr->play_time += (tmp - current_world_ptr->start_time);
3869 current_world_ptr->start_time = tmp;