3 * @brief プレイヤーのインターフェイスに関するコマンドの実装 / Interface commands
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
14 * A set of functions to maintain automatic dumps of various kinds.
16 * remove_auto_dump(orig_file, mark)
17 * Remove the old automatic dump of type "mark".
18 * auto_dump_printf(fmt, ...)
19 * Dump a formatted string using fprintf().
20 * open_auto_dump(buf, mark)
21 * Open a file, remove old dump, and add new header.
22 * close_auto_dump(void)
23 * Add a footer, and close the file.
24 * The dump commands of original Angband simply add new lines to
25 * existing files; these files will become bigger and bigger unless
26 * an user deletes some or all of these files by hand at some
28 * These three functions automatically delete old dumped lines
29 * before adding new ones. Since there are various kinds of automatic
30 * dumps in a single file, we add a header and a footer with a type
31 * name for every automatic dump, and kill old lines only when the
32 * lines have the correct type of header and footer.
33 * We need to be quite paranoid about correctness; the user might
34 * (mistakenly) edit the file by hand, and see all their work come
35 * to nothing on the next auto dump otherwise. The current code only
36 * detects changes by noting inconsistencies between the actual number
37 * of lines and the number written in the footer. Note that this will
38 * not catch single-line edits.
50 * Mark strings for auto dump
52 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
53 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
56 * Variables for auto dump
58 static FILE *auto_dump_stream;
59 static cptr auto_dump_mark;
60 static int auto_dump_line_num;
64 * @brief prf出力内容を消去する /
65 * Remove old lines automatically generated before.
66 * @param orig_file 消去を行うファイル名
68 static void remove_auto_dump(cptr orig_file)
70 FILE *tmp_fff, *orig_fff;
74 bool between_mark = FALSE;
77 long header_location = 0;
78 char header_mark_str[80];
79 char footer_mark_str[80];
82 /* Prepare a header/footer mark string */
83 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
84 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
86 mark_len = strlen(footer_mark_str);
88 /* Open an old dump file in read-only mode */
89 orig_fff = my_fopen(orig_file, "r");
91 /* If original file does not exist, nothing to do */
92 if (!orig_fff) return;
94 /* Open a new (temporary) file */
95 tmp_fff = my_fopen_temp(tmp_file, 1024);
99 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), tmp_file);
104 /* Loop for every line */
108 if (my_fgets(orig_fff, buf, sizeof(buf)))
110 /* Read error: Assume End of File */
113 * Was looking for the footer, but not found.
115 * Since automatic dump might be edited by hand,
116 * it's dangerous to kill these lines.
117 * Seek back to the next line of the (pseudo) header,
122 fseek(orig_fff, header_location, SEEK_SET);
123 between_mark = FALSE;
127 /* Success -- End the loop */
134 /* We are looking for the header mark of automatic dump */
137 /* Is this line a header? */
138 if (!strcmp(buf, header_mark_str))
140 /* Memorise seek point of this line */
141 header_location = ftell(orig_fff);
143 /* Initialize counter for number of lines */
146 /* Look for the footer from now */
149 /* There are some changes */
156 /* Copy orginally lines */
157 fprintf(tmp_fff, "%s\n", buf);
161 /* We are looking for the footer mark of automatic dump */
164 /* Is this line a footer? */
165 if (!strncmp(buf, footer_mark_str, mark_len))
170 * Compare the number of lines
172 * If there is an inconsistency between
173 * actual number of lines and the
174 * number here, the automatic dump
175 * might be edited by hand. So it's
176 * dangerous to kill these lines.
177 * Seek back to the next line of the
178 * (pseudo) header, and read again.
180 if (!sscanf(buf + mark_len, " (%d)", &tmp)
183 fseek(orig_fff, header_location, SEEK_SET);
186 /* Look for another header */
187 between_mark = FALSE;
193 /* Ignore old line, and count number of lines */
203 /* If there are some changes, overwrite the original file with new one */
206 /* Copy contents of temporary file */
208 tmp_fff = my_fopen(tmp_file, "r");
209 orig_fff = my_fopen(orig_file, "w");
211 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
212 fprintf(orig_fff, "%s\n", buf);
218 /* Kill the temporary file */
226 * @brief prfファイルのフォーマットに従った内容を出力する /
227 * Dump a formatted line, using "vstrnfmt()".
230 static void auto_dump_printf(cptr fmt, ...)
237 /* Begin the Varargs Stuff */
240 /* Format the args, save the length */
241 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
243 /* End the Varargs Stuff */
246 /* Count number of lines */
247 for (p = buf; *p; p++)
249 if (*p == '\n') auto_dump_line_num++;
253 fprintf(auto_dump_stream, "%s", buf);
258 * @brief prfファイルをファイルオープンする /
259 * Open file to append auto dump.
261 * @param mark 出力するヘッダマーク
262 * @return ファイルポインタを取得できたらTRUEを返す
264 static bool open_auto_dump(cptr buf, cptr mark)
267 char header_mark_str[80];
269 /* Save the mark string */
270 auto_dump_mark = mark;
272 /* Prepare a header mark string */
273 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
275 /* Remove old macro dumps */
276 remove_auto_dump(buf);
278 /* Append to the file */
279 auto_dump_stream = my_fopen(buf, "a");
282 if (!auto_dump_stream) {
283 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
291 fprintf(auto_dump_stream, "%s\n", header_mark_str);
293 /* Initialize counter */
294 auto_dump_line_num = 0;
296 auto_dump_printf(_("# *警告!!* 以降の行は自動生成されたものです。\n",
297 "# *Warning!* The lines below are an automatic dump.\n"));
298 auto_dump_printf(_("# *警告!!* 後で自動的に削除されるので編集しないでください。\n",
299 "# Don't edit them; changes will be deleted and replaced automatically.\n"));
305 * @brief prfファイルをファイルクローズする /
306 * Append foot part and close auto dump.
309 static void close_auto_dump(void)
311 char footer_mark_str[80];
313 /* Prepare a footer mark string */
314 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
316 auto_dump_printf(_("# *警告!!* 以降の行は自動生成されたものです。\n",
317 "# *Warning!* The lines below are an automatic dump.\n"));
318 auto_dump_printf(_("# *警告!!* 後で自動的に削除されるので編集しないでください。\n",
319 "# Don't edit them; changes will be deleted and replaced automatically.\n"));
321 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
324 my_fclose(auto_dump_stream);
333 * @brief Return suffix of ordinal number
335 * @return pointer of suffix string.
337 cptr get_ordinal_number_suffix(int num)
339 num = ABS(num) % 100;
343 return (num == 11) ? "th" : "st";
345 return (num == 12) ? "th" : "nd";
347 return (num == 13) ? "th" : "rd";
356 * @brief 日記にメッセージを追加する /
357 * Take note to the diary.
358 * @param type 日記内容のID
359 * @param num 日記内容のIDに応じた数値
360 * @param note 日記内容のIDに応じた文字列参照ポインタ
363 errr do_cmd_write_nikki(int type, int num, cptr note)
369 cptr note_level = "";
370 bool do_level = TRUE;
371 char note_level_buf[40];
374 static bool disable_nikki = FALSE;
376 extract_day_hour_min(&day, &hour, &min);
378 if (disable_nikki) return(-1);
380 if (type == NIKKI_FIX_QUEST_C ||
381 type == NIKKI_FIX_QUEST_F ||
382 type == NIKKI_RAND_QUEST_C ||
383 type == NIKKI_RAND_QUEST_F ||
384 type == NIKKI_TO_QUEST)
388 old_quest = p_ptr->inside_quest;
389 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
391 /* Get the quest text */
392 init_flags = INIT_NAME_ONLY;
394 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
396 /* Reset the old quest number */
397 p_ptr->inside_quest = old_quest;
400 /* different filne name to avoid mixing */
401 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
403 /* Build the filename */
404 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
406 /* File type is "TEXT" */
407 FILE_TYPE(FILE_TYPE_TEXT);
409 fff = my_fopen(buf, "a");
414 msg_format(_("%s を開くことができませんでした。プレイ記録を一時停止します。", "Failed to open %s. Play-Record is disabled temporally."), buf);
420 q_idx = quest_number(dun_level);
424 if (p_ptr->inside_arena)
425 note_level = _("アリーナ:", "Arane:");
427 note_level = _("地上:", "Surface:");
428 else if (q_idx && (is_fixed_quest_idx(q_idx)
429 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
430 note_level = _("クエスト:", "Quest:");
434 sprintf(note_level_buf, "%d階(%s):", (int)dun_level, d_name+d_info[dungeon_type].name);
436 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, (int)dun_level);
438 note_level = note_level_buf;
446 if (day < MAX_DAYS) fprintf(fff, _("%d日目\n", "Day %d\n"), day);
447 else fputs(_("*****日目\n", "Day *****\n"), fff);
455 fprintf(fff, "%s\n",note);
459 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
464 fprintf(fff, _(" %2d:%02d %20s %sを発見した。\n", " %2d:%02d %20s discovered %s.\n"), hour, min, note_level, note);
467 case NIKKI_ART_SCROLL:
469 fprintf(fff, _(" %2d:%02d %20s 巻物によって%sを生成した。\n", " %2d:%02d %20s created %s by scroll.\n"), hour, min, note_level, note);
474 fprintf(fff, _(" %2d:%02d %20s %sを倒した。\n", " %2d:%02d %20s defeated %s.\n"), hour, min, note_level, note);
477 case NIKKI_FIX_QUEST_C:
479 if (quest[num].flags & QUEST_FLAG_SILENT) break;
480 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」を達成した。\n",
481 " %2d:%02d %20s completed quest '%s'.\n"), hour, min, note_level, quest[num].name);
484 case NIKKI_FIX_QUEST_F:
486 if (quest[num].flags & QUEST_FLAG_SILENT) break;
487 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」から命からがら逃げ帰った。\n",
488 " %2d:%02d %20s run away from quest '%s'.\n"), hour, min, note_level, quest[num].name);
491 case NIKKI_RAND_QUEST_C:
494 strcpy(name, r_name+r_info[quest[num].r_idx].name);
495 fprintf(fff, _(" %2d:%02d %20s ランダムクエスト(%s)を達成した。\n",
496 " %2d:%02d %20s completed random quest '%s'\n"), hour, min, note_level, name);
499 case NIKKI_RAND_QUEST_F:
502 strcpy(name, r_name+r_info[quest[num].r_idx].name);
503 fprintf(fff, _(" %2d:%02d %20s ランダムクエスト(%s)から逃げ出した。\n",
504 " %2d:%02d %20s ran away from quest '%s'.\n"), hour, min, note_level, name);
507 case NIKKI_MAXDEAPTH:
509 fprintf(fff, _(" %2d:%02d %20s %sの最深階%d階に到達した。\n",
510 " %2d:%02d %20s reached level %d of %s for the first time.\n"), hour, min, note_level,
511 _(d_name+d_info[dungeon_type].name, num),
512 _(num, d_name+d_info[dungeon_type].name));
517 fprintf(fff, _(" %2d:%02d %20s %s%sの最深階を%d階にセットした。\n",
518 " %2d:%02d %20s reset recall level of %s to %d %s.\n"), hour, min, note_level, note,
519 _(d_name + d_info[num].name, (int)max_dlv[num]),
520 _((int)max_dlv[num], d_name + d_info[num].name));
526 if (q_idx && (is_fixed_quest_idx(q_idx)
527 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
529 to = _("地上", "the surface");
533 if (!(dun_level+num)) to = _("地上", "the surface");
534 else to = format(_("%d階", "level %d"), dun_level+num);
536 fprintf(fff, _(" %2d:%02d %20s %sへ%s。\n", " %2d:%02d %20s %s %s.\n"), hour, min, note_level, _(to, note), _(note, to));
542 fprintf(fff, _(" %2d:%02d %20s 帰還を使って%sの%d階へ下りた。\n", " %2d:%02d %20s recalled to dungeon level %d of %s.\n"),
543 hour, min, note_level, _(d_name+d_info[dungeon_type].name, (int)max_dlv[dungeon_type]),
544 _((int)max_dlv[dungeon_type], d_name+d_info[dungeon_type].name));
546 fprintf(fff, _(" %2d:%02d %20s 帰還を使って地上へと戻った。\n", " %2d:%02d %20s recalled from dungeon to surface.\n"), hour, min, note_level);
551 if (quest[num].flags & QUEST_FLAG_SILENT) break;
552 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」へと突入した。\n", " %2d:%02d %20s entered the quest '%s'.\n"),
553 hour, min, note_level, quest[num].name);
558 fprintf(fff, _(" %2d:%02d %20s レベル・テレポートで脱出した。\n", " %2d:%02d %20s Got out using teleport level.\n"),
559 hour, min, note_level);
564 fprintf(fff, _(" %2d:%02d %20s %sを購入した。\n", " %2d:%02d %20s bought %s.\n"), hour, min, note_level, note);
569 fprintf(fff, _(" %2d:%02d %20s %sを売却した。\n", " %2d:%02d %20s sold %s.\n"), hour, min, note_level, note);
577 fprintf(fff, _(" %2d:%02d %20s 闘技場の%d%s回戦で、%sの前に敗れ去った。\n", " %2d:%02d %20s beaten by %s in the %d%s fight.\n"),
578 hour, min, note_level, _(n, note), _("", n), _(note, get_ordinal_number_suffix(n)));
581 fprintf(fff, _(" %2d:%02d %20s 闘技場の%d%s回戦(%s)に勝利した。\n", " %2d:%02d %20s won the %d%s fight (%s).\n"),
582 hour, min, note_level, num, _("", get_ordinal_number_suffix(num)), note);
584 if (num == MAX_ARENA_MONS)
586 fprintf(fff, _(" 闘技場のすべての敵に勝利し、チャンピオンとなった。\n",
587 " won all fight to become a Chanpion.\n"));
594 fprintf(fff, _(" %2d:%02d %20s %sを識別した。\n", " %2d:%02d %20s identified %s.\n"), hour, min, note_level, note);
601 to = _("地上", "the surface");
603 to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_type].name);
605 fprintf(fff, _(" %2d:%02d %20s %sへとウィザード・テレポートで移動した。\n",
606 " %2d:%02d %20s wizard-teleport to %s.\n"), hour, min, note_level, to);
613 to = _("地上", "the surface");
615 to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_type].name);
617 fprintf(fff, _(" %2d:%02d %20s %sへとパターンの力で移動した。\n",
618 " %2d:%02d %20s used Pattern to teleport to %s.\n"), hour, min, note_level, to);
623 fprintf(fff, _(" %2d:%02d %20s レベルが%dに上がった。\n", " %2d:%02d %20s reached player level %d.\n"), hour, min, note_level, num);
626 case NIKKI_GAMESTART:
628 time_t ct = time((time_t*)0);
632 fprintf(fff, "%s %s",note, ctime(&ct));
635 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
638 case NIKKI_NAMED_PET:
640 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
643 case RECORD_NAMED_PET_NAME:
644 fprintf(fff, _("%sを旅の友にすることに決めた。\n", "decided to travel together with %s.\n"), note);
646 case RECORD_NAMED_PET_UNNAME:
647 fprintf(fff, _("%sの名前を消した。\n", "unnamed %s.\n"), note);
649 case RECORD_NAMED_PET_DISMISS:
650 fprintf(fff, _("%sを解放した。\n", "dismissed %s.\n"), note);
652 case RECORD_NAMED_PET_DEATH:
653 fprintf(fff, _("%sが死んでしまった。\n", "%s died.\n"), note);
655 case RECORD_NAMED_PET_MOVED:
656 fprintf(fff, _("%sをおいて別のマップへ移動した。\n", "moved to another map leaving %s behind.\n"), note);
658 case RECORD_NAMED_PET_LOST_SIGHT:
659 fprintf(fff, _("%sとはぐれてしまった。\n", "lost sight of %s.\n"), note);
661 case RECORD_NAMED_PET_DESTROY:
662 fprintf(fff, _("%sが*破壊*によって消え去った。\n", "%s was made disappeared by *destruction*.\n"), note);
664 case RECORD_NAMED_PET_EARTHQUAKE:
665 fprintf(fff, _("%sが岩石に押し潰された。\n", "%s was crushed by falling rocks.\n"), note);
667 case RECORD_NAMED_PET_GENOCIDE:
668 fprintf(fff, _("%sが抹殺によって消え去った。\n", "%s was made disappeared by genocide.\n"), note);
670 case RECORD_NAMED_PET_WIZ_ZAP:
671 fprintf(fff, _("%sがデバッグコマンドによって消え去った。\n", "%s was removed by debug command.\n"), note);
673 case RECORD_NAMED_PET_TELE_LEVEL:
674 fprintf(fff, _("%sがテレポート・レベルによって消え去った。\n", "%s was made disappeared by teleport level.\n"), note);
676 case RECORD_NAMED_PET_BLAST:
677 fprintf(fff, _("%sを爆破した。\n", "blasted %s.\n"), note);
679 case RECORD_NAMED_PET_HEAL_LEPER:
680 fprintf(fff, _("%sの病気が治り旅から外れた。\n", "%s was healed and left.\n"), note);
682 case RECORD_NAMED_PET_COMPACT:
683 fprintf(fff, _("%sがモンスター情報圧縮によって消え去った。\n", "%s was made disappeared by compacting monsters.\n"), note);
685 case RECORD_NAMED_PET_LOSE_PARENT:
686 fprintf(fff, _("%sの召喚者が既にいないため消え去った。\n", "%s disappeared because there does not exist summoner.\n"), note);
697 case NIKKI_WIZARD_LOG:
698 fprintf(fff, "%s\n", note);
707 if (do_level) write_level = FALSE;
713 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
716 * @brief 日記のタイトル表記と内容出力 /
719 * 日記のタイトルは本関数の subtitle ローカル変数で定義されている。
721 static void do_cmd_disp_nikki(void)
723 char nikki_title[256];
729 static const char subtitle[][30] = {"最強の肉体を求めて",
760 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
761 "Attack is the best form of defence.",
763 "An unexpected windfall",
764 "A drowning man will catch at a straw",
765 "Don't count your chickens before they are hatched.",
766 "It is no use crying over spilt milk.",
767 "Seeing is believing.",
768 "Strike the iron while it is hot.",
769 "I don't care what follows.",
770 "To dig a well to put out a house on fire.",
771 "Tomorrow is another day.",
772 "Easy come, easy go.",
773 "The more haste, the less speed.",
774 "Where there is life, there is hope.",
775 "There is no royal road to *WINNER*.",
776 "Danger past, God forgotten.",
777 "The best thing to do now is to run away.",
778 "Life is but an empty dream.",
779 "Dead men tell no tales.",
780 "A book that remains shut is but a block.",
781 "Misfortunes never come singly.",
782 "A little knowledge is a dangerous thing.",
783 "History repeats itself.",
784 "*WINNER* was not built in a day.",
785 "Ignorance is bliss.",
786 "To lose is to win?",
787 "No medicine can cure folly.",
788 "All good things come to an end.",
789 "M$ Empire strikes back.",
790 "To see is to believe",
792 "Quest of The World's Greatest Brain"};
794 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
796 /* Build the filename */
797 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
799 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
800 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
801 else if (IS_WIZARD_CLASS())
802 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
803 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
806 sprintf(nikki_title, "「%s%s%sの伝説 -%s-」",
807 ap_ptr->title, ap_ptr->no ? "の" : "", p_ptr->name, tmp);
809 sprintf(nikki_title, "Legend of %s %s '%s'",
810 ap_ptr->title, p_ptr->name, tmp);
813 /* Display the file contents */
814 show_file(FALSE, buf, nikki_title, -1, 0);
818 * @brief 日記に任意の内容を表記するコマンドのメインルーチン /
821 static void do_cmd_bunshou(void)
824 char bunshou[80] = "\0";
826 if (get_string(_("内容: ", "diary note: "), tmp, 79))
828 strcpy(bunshou, tmp);
830 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
835 * @brief 最後に取得したアイテムの情報を日記に追加するメインルーチン /
838 static void do_cmd_last_get(void)
843 if (record_o_name[0] == '\0') return;
845 sprintf(buf,_("%sの入手を記録します。", "Do you really want to record getting %s? "),record_o_name);
846 if (!get_check(buf)) return;
850 sprintf(buf,_("%sを手に入れた。", "descover %s."), record_o_name);
851 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
856 * @brief ファイル中の全日記記録を消去する /
859 static void do_cmd_erase_nikki(void)
865 if (!get_check(_("本当に記録を消去しますか?", "Do you really want to delete all your record? "))) return;
866 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
868 /* Build the filename */
869 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
871 /* Remove the file */
874 fff = my_fopen(buf, "w");
877 msg_format(_("記録を消去しました。", "deleted record."));
879 msg_format(_("%s の消去に失敗しました。", "failed to delete %s."), buf);
888 void do_cmd_nikki(void)
892 /* File type is "TEXT" */
893 FILE_TYPE(FILE_TYPE_TEXT);
895 /* Save the screen */
898 /* Interact until done */
904 /* Ask for a choice */
905 prt(_("[ 記録の設定 ]", "[ Play Record ]"), 2, 0);
907 /* Give some choices */
908 prt(_("(1) 記録を見る", "(1) Display your record"), 4, 5);
909 prt(_("(2) 文章を記録する", "(2) Add record"), 5, 5);
910 prt(_("(3) 直前に入手又は鑑定したものを記録する", "(3) Record item you last get/identify"), 6, 5);
911 prt(_("(4) 記録を消去する", "(4) Delete your record"), 7, 5);
913 prt(_("(R) プレイ動画を記録する/中止する", "(R) Record playing movie / or stop it"), 9, 5);
916 prt(_("コマンド:", "Command: "), 18, 0);
921 if (i == ESCAPE) break;
935 do_cmd_erase_nikki();
939 prepare_movie_hooks();
941 default: /* Unknown option */
949 /* Restore the screen */
954 * @brief 画面を再描画するコマンドのメインルーチン
955 * Hack -- redraw the screen
959 * This command performs various low level updates, clears all the "extra"
960 * windows, does a total redraw of the main window, and requests all of the
961 * interesting updates and redraws that I can think of.
963 * This command is also used to "instantiate" the results of the user
964 * selecting various things, such as graphics mode, so it must call
965 * the "TERM_XTRA_REACT" hook before redrawing the windows.
968 void do_cmd_redraw(void)
975 /* Hack -- react to changes */
976 Term_xtra(TERM_XTRA_REACT, 0);
979 /* Combine and Reorder the pack (later) */
980 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
984 p_ptr->update |= (PU_TORCH);
986 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
988 /* Forget lite/view */
989 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
991 /* Update lite/view */
992 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
994 /* Update monsters */
995 p_ptr->update |= (PU_MONSTERS);
997 /* Redraw everything */
998 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1000 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1002 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1006 /* Hack -- update */
1009 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1012 /* Redraw every window */
1013 for (j = 0; j < 8; j++)
1016 if (!angband_term[j]) continue;
1019 Term_activate(angband_term[j]);
1034 * @brief 名前を変更するコマンドのメインルーチン
1035 * Hack -- change name
1038 void do_cmd_change_name(void)
1047 /* Save the screen */
1055 /* Display the player */
1056 display_player(mode);
1061 display_player(mode);
1066 Term_putstr(2, 23, -1, TERM_WHITE,
1067 "['c'で名前変更, 'f'でファイルへ書出, 'h'でモード変更, ESCで終了]");
1069 Term_putstr(2, 23, -1, TERM_WHITE,
1070 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1078 if (c == ESCAPE) break;
1085 /* Process the player name */
1086 process_player_name(FALSE);
1092 sprintf(tmp, "%s.txt", player_base);
1093 if (get_string(_("ファイル名: ", "File name: "), tmp, 80))
1095 if (tmp[0] && (tmp[0] != ' '))
1097 file_character(tmp);
1113 /* Flush messages */
1117 /* Restore the screen */
1120 /* Redraw everything */
1121 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1128 * @brief 最近表示されたメッセージを再表示するコマンドのメインルーチン
1129 * Recall the most recent message
1132 void do_cmd_message_one(void)
1134 /* Recall one message */
1135 prt(format("> %s", message_str(0)), 0, 0);
1140 * @brief メッセージのログを表示するコマンドのメインルーチン
1141 * Recall the most recent message
1145 * Show previous messages to the user -BEN-
1147 * The screen format uses line 0 and 23 for headers and prompts,
1148 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1150 * This command shows you which commands you are viewing, and allows
1151 * you to "search" for strings in the recall.
1153 * Note that messages may be longer than 80 characters, but they are
1154 * displayed using "infinite" length, with a special sub-command to
1155 * "slide" the virtual display to the left or right.
1157 * Attempt to only hilite the matching portions of the string.
1160 void do_cmd_messages(int num_now)
1164 char shower_str[81];
1165 char finder_str[81];
1171 Term_get_size(&wid, &hgt);
1173 /* Number of message lines in a screen */
1174 num_lines = hgt - 4;
1177 strcpy(finder_str, "");
1180 strcpy(shower_str, "");
1182 /* Total messages */
1185 /* Start on first message */
1188 /* Save the screen */
1194 /* Process requests until done */
1200 /* Dump up to 20 lines of messages */
1201 for (j = 0; (j < num_lines) && (i + j < n); j++)
1203 cptr msg = message_str(i+j);
1205 /* Dump the messages, bottom to top */
1206 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1208 /* Hilite "shower" */
1209 if (shower && shower[0])
1213 /* Display matches */
1214 while ((str = my_strstr(str, shower)) != NULL)
1216 int len = strlen(shower);
1218 /* Display the match */
1219 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1227 /* Erase remaining lines */
1228 for (; j < num_lines; j++)
1230 Term_erase(0, num_lines + 1 - j, 255);
1233 /* Display header */
1235 prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"),
1236 i, i + j - 1, n), 0, 0);
1238 /* Display prompt (not very informative) */
1239 prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]",
1240 "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0);
1243 skey = inkey_special(TRUE);
1245 /* Exit on Escape */
1246 if (skey == ESCAPE) break;
1248 /* Hack -- Save the old index */
1253 /* Hack -- handle show */
1256 prt(_("強調: ", "Show: "), hgt - 1, 0);
1258 /* Get a "shower" string, or continue */
1259 strcpy(back_str, shower_str);
1260 if (askfor(shower_str, 80))
1263 shower = shower_str[0] ? shower_str : NULL;
1265 else strcpy(shower_str, back_str);
1269 /* Hack -- handle find */
1276 prt(_("検索: ", "Find: "), hgt - 1, 0);
1278 /* Get a "finder" string, or continue */
1279 strcpy(back_str, finder_str);
1280 if (!askfor(finder_str, 80))
1282 strcpy(finder_str, back_str);
1285 else if (!finder_str[0])
1287 shower = NULL; /* Stop showing */
1292 shower = finder_str;
1295 for (z = i + 1; z < n; z++)
1297 cptr msg = message_str(z);
1300 if (my_strstr(msg, finder_str))
1311 /* Recall 1 older message */
1313 /* Go to the oldest line */
1317 /* Recall 1 newer message */
1319 /* Go to the newest line */
1323 /* Recall 1 older message */
1328 /* Go older if legal */
1329 i = MIN(i + 1, n - num_lines);
1332 /* Recall 10 older messages */
1334 /* Go older if legal */
1335 i = MIN(i + 10, n - num_lines);
1338 /* Recall 20 older messages */
1343 /* Go older if legal */
1344 i = MIN(i + num_lines, n - num_lines);
1347 /* Recall 20 newer messages */
1351 /* Go newer (if able) */
1352 i = MAX(0, i - num_lines);
1355 /* Recall 10 newer messages */
1357 /* Go newer (if able) */
1361 /* Recall 1 newer messages */
1364 /* Go newer (if able) */
1369 /* Hack -- Error of some kind */
1373 /* Restore the screen */
1379 * @brief チートオプションを変更するコマンドのメインルーチン
1380 * Interact with some options for cheating
1381 * @param info 表示メッセージ
1384 static void do_cmd_options_cheat(cptr info)
1387 int i, k = 0, n = CHEAT_MAX;
1393 /* Interact with the player */
1399 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info);
1404 /* 詐欺オプションをうっかりいじってしまう人がいるようなので注意 */
1405 prt(" << 注意 >>", 11, 0);
1406 prt(" 詐欺オプションを一度でも設定すると、スコア記録が残らなくなります!", 12, 0);
1407 prt(" 後に解除してもダメですので、勝利者を目指す方はここのオプションはい", 13, 0);
1408 prt(" じらないようにして下さい。", 14, 0);
1410 /* Display the options */
1411 for (i = 0; i < n; i++)
1413 byte a = TERM_WHITE;
1415 /* Color current option */
1416 if (i == k) a = TERM_L_BLUE;
1418 /* Display the option text */
1419 sprintf(buf, "%-48s: %s (%s)",
1420 cheat_info[i].o_desc,
1421 (*cheat_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1422 cheat_info[i].o_text);
1423 c_prt(a, buf, i + 2, 0);
1426 /* Hilite current option */
1427 move_cursor(k + 2, 50);
1433 * HACK - Try to translate the key into a direction
1434 * to allow using the roguelike keys for navigation.
1436 dir = get_keymap_dir(ch);
1437 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1451 k = (n + k - 1) % n;
1469 do_cmd_write_nikki(NIKKI_BUNSHOU, 0,
1470 _("詐欺オプションをONにして、スコアを残せなくなった。", "give up sending score to use cheating options."));
1471 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1472 (*cheat_info[k].o_var) = TRUE;
1481 (*cheat_info[k].o_var) = FALSE;
1488 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), cheat_info[k].o_text);
1489 /* Peruse the help file */
1490 (void)show_file(TRUE, buf, NULL, 0, 0);
1507 * @brief セーブ頻度ターンの次の値を返す
1508 * @param current 現在のセーブ頻度ターン値
1509 * @return 次のセーブ頻度ターン値
1511 static s16b toggle_frequency(s16b current)
1516 case 50: return 100;
1517 case 100: return 250;
1518 case 250: return 500;
1519 case 500: return 1000;
1520 case 1000: return 2500;
1521 case 2500: return 5000;
1522 case 5000: return 10000;
1523 case 10000: return 25000;
1530 * @brief 自動セーブオプションを変更するコマンドのメインルーチン
1531 * @param info 表示メッセージ
1534 static void do_cmd_options_autosave(cptr info)
1537 int i, k = 0, n = 2;
1544 /* Interact with the player */
1548 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, F で頻度を入力, ESC で決定 ) ",
1549 "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) "), info);
1553 /* Display the options */
1554 for (i = 0; i < n; i++)
1556 byte a = TERM_WHITE;
1558 /* Color current option */
1559 if (i == k) a = TERM_L_BLUE;
1561 /* Display the option text */
1562 sprintf(buf, "%-48s: %s (%s)",
1563 autosave_info[i].o_desc,
1564 (*autosave_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1565 autosave_info[i].o_text);
1566 c_prt(a, buf, i + 2, 0);
1568 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1570 /* Hilite current option */
1571 move_cursor(k + 2, 50);
1587 k = (n + k - 1) % n;
1605 (*autosave_info[k].o_var) = TRUE;
1614 (*autosave_info[k].o_var) = FALSE;
1622 autosave_freq = toggle_frequency(autosave_freq);
1623 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1629 (void)show_file(TRUE, _("joption.txt#Autosave", "option.txt#Autosave"), NULL, 0, 0);
1645 * @brief 標準オプションを変更するコマンドのサブルーチン /
1646 * Interact with some options
1647 * @param page オプションページ番号
1648 * @param info 表示メッセージ
1651 void do_cmd_options_aux(int page, cptr info)
1654 int i, k = 0, n = 0, l;
1657 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1658 (!p_ptr->wizard || !allow_debug_opts);
1661 /* Lookup the options */
1662 for (i = 0; i < 24; i++) opt[i] = 0;
1664 /* Scan the options */
1665 for (i = 0; option_info[i].o_desc; i++)
1667 /* Notice options on this "page" */
1668 if (option_info[i].o_page == page) opt[n++] = i;
1674 /* Interact with the player */
1680 sprintf(buf, _("%s (リターン:次, %sESC:終了, ?:ヘルプ) ", "%s (RET:next, %s, ?:help) "),
1681 info, browse_only ? _("", "ESC:exit") : _("y/n:変更, ", "y/n:change, ESC:accept"));
1684 /* HACK -- description for easy-auto-destroy options */
1685 if (page == OPT_PAGE_AUTODESTROY)
1686 c_prt(TERM_YELLOW, _("以下のオプションは、簡易自動破壊を使用するときのみ有効",
1687 "Following options will protect items from easy auto-destroyer."), 6, _(6, 3));
1689 /* Display the options */
1690 for (i = 0; i < n; i++)
1692 byte a = TERM_WHITE;
1694 /* Color current option */
1695 if (i == k) a = TERM_L_BLUE;
1697 /* Display the option text */
1698 sprintf(buf, "%-48s: %s (%.19s)",
1699 option_info[opt[i]].o_desc,
1700 (*option_info[opt[i]].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1701 option_info[opt[i]].o_text);
1702 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1703 else c_prt(a, buf, i + 2, 0);
1706 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
1709 /* Hilite current option */
1710 move_cursor(k + 2 + l, 50);
1716 * HACK - Try to translate the key into a direction
1717 * to allow using the roguelike keys for navigation.
1719 dir = get_keymap_dir(ch);
1720 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1734 k = (n + k - 1) % n;
1751 if (browse_only) break;
1752 (*option_info[opt[k]].o_var) = TRUE;
1761 if (browse_only) break;
1762 (*option_info[opt[k]].o_var) = FALSE;
1770 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
1776 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), option_info[opt[k]].o_text);
1777 /* Peruse the help file */
1778 (void)show_file(TRUE, buf, NULL, 0, 0);
1795 * @brief ウィンドウオプションを変更するコマンドのメインルーチン /
1796 * Modify the "window" options
1799 static void do_cmd_options_win(void)
1809 /* Memorize old flags */
1810 for (j = 0; j < 8; j++)
1812 /* Acquire current flags */
1813 old_flag[j] = window_flag[j];
1824 prt(_("ウィンドウ・フラグ (<方向>で移動, tでチェンジ, y/n でセット, ESC)", "Window Flags (<dir>, t, y, n, ESC) "), 0, 0);
1826 /* Display the windows */
1827 for (j = 0; j < 8; j++)
1829 byte a = TERM_WHITE;
1831 cptr s = angband_term_name[j];
1834 if (j == x) a = TERM_L_BLUE;
1836 /* Window name, staggered, centered */
1837 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
1840 /* Display the options */
1841 for (i = 0; i < 16; i++)
1843 byte a = TERM_WHITE;
1845 cptr str = window_flag_desc[i];
1848 if (i == y) a = TERM_L_BLUE;
1851 if (!str) str = _("(未使用)", "(Unused option)");
1854 Term_putstr(0, i + 5, -1, a, str);
1856 /* Display the windows */
1857 for (j = 0; j < 8; j++)
1863 if ((i == y) && (j == x)) a = TERM_L_BLUE;
1866 if (window_flag[j] & (1L << i)) c = 'X';
1869 Term_putch(35 + j * 5, i + 5, a, c);
1874 Term_gotoxy(35 + x * 5, y + 5);
1892 for (j = 0; j < 8; j++)
1894 window_flag[j] &= ~(1L << y);
1898 for (i = 0; i < 16; i++)
1900 window_flag[x] &= ~(1L << i);
1913 window_flag[x] |= (1L << y);
1921 window_flag[x] &= ~(1L << y);
1927 (void)show_file(TRUE, _("joption.txt#Window", "option.txt#Window"), NULL, 0, 0);
1935 d = get_keymap_dir(ch);
1937 x = (x + ddx[d] + 8) % 8;
1938 y = (y + ddy[d] + 16) % 16;
1945 /* Notice changes */
1946 for (j = 0; j < 8; j++)
1951 if (!angband_term[j]) continue;
1953 /* Ignore non-changes */
1954 if (window_flag[j] == old_flag[j]) continue;
1957 Term_activate(angband_term[j]);
1980 option_fields[OPT_NUM] =
1983 { '1', " キー入力 オプション", 3 },
1984 { '2', " マップ画面 オプション", 4 },
1985 { '3', " テキスト表示 オプション", 5 },
1986 { '4', " ゲームプレイ オプション", 6 },
1987 { '5', " 行動中止関係 オプション", 7 },
1988 { '6', " 簡易自動破壊 オプション", 8 },
1989 { 'r', " プレイ記録 オプション", 9 },
1991 { 'p', "自動拾いエディタ", 11 },
1992 { 'd', " 基本ウェイト量 ", 12 },
1993 { 'h', "低ヒットポイント", 13 },
1994 { 'm', " 低魔力色閾値 ", 14 },
1995 { 'a', " 自動セーブ オプション", 15 },
1996 { 'w', "ウインドウフラグ", 16 },
1998 { 'b', " 初期 オプション (参照のみ)", 18 },
1999 { 'c', " 詐欺 オプション", 19 },
2001 { '1', "Input Options", 3 },
2002 { '2', "Map Screen Options", 4 },
2003 { '3', "Text Display Options", 5 },
2004 { '4', "Game-Play Options", 6 },
2005 { '5', "Disturbance Options", 7 },
2006 { '6', "Easy Auto-Destroyer Options", 8 },
2007 { 'r', "Play record Options", 9 },
2009 { 'p', "Auto-picker/destroyer editor", 11 },
2010 { 'd', "Base Delay Factor", 12 },
2011 { 'h', "Hitpoint Warning", 13 },
2012 { 'm', "Mana Color Threshold", 14 },
2013 { 'a', "Autosave Options", 15 },
2014 { 'w', "Window Flags", 16 },
2016 { 'b', "Birth Options (Browse Only)", 18 },
2017 { 'c', "Cheat Options", 19 },
2023 * @brief 標準オプションを変更するコマンドのメインルーチン /
2024 * Set or unset various options.
2028 * The user must use the "Ctrl-R" command to "adapt" to changes
2029 * in any options which control "visual" aspects of the game.
2032 void do_cmd_options(void)
2038 /* Save the screen */
2046 /* Does not list cheat option when cheat option is off */
2047 if (!p_ptr->noscore && !allow_debug_opts) n--;
2052 /* Why are we here */
2053 prt(_("[ オプションの設定 ]", "TinyAngband options"), 1, 0);
2057 /* Give some choices */
2058 for (i = 0; i < n; i++)
2060 byte a = TERM_WHITE;
2061 if (i == y) a = TERM_L_BLUE;
2062 Term_putstr(5, option_fields[i].row, -1, a,
2063 format("(%c) %s", toupper(option_fields[i].key), option_fields[i].name));
2066 prt(_("<方向>で移動, Enterで決定, ESCでキャンセル, ?でヘルプ: ", "Move to <dir>, Select to Enter, Cancel to ESC, ? to help: "), 21, 0);
2069 skey = inkey_special(TRUE);
2070 if (!(skey & SKEY_MASK)) k = (char)skey;
2074 if (k == ESCAPE) break;
2076 if (my_strchr("\n\r ", k))
2078 k = option_fields[y].key;
2082 for (i = 0; i < n; i++)
2084 if (tolower(k) == option_fields[i].key) break;
2087 /* Command is found */
2090 /* Hack -- browse help */
2091 if (k == '?') break;
2095 if (skey == SKEY_UP) d = 8;
2096 if (skey == SKEY_DOWN) d = 2;
2097 y = (y + ddy[d] + n) % n;
2102 if (k == ESCAPE) break;
2109 /* Process the general options */
2110 do_cmd_options_aux(OPT_PAGE_INPUT, _("キー入力オプション", "Input Options"));
2116 /* Process the general options */
2117 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, _("マップ画面オプション", "Map Screen Options"));
2124 do_cmd_options_aux(OPT_PAGE_TEXT, _("テキスト表示オプション", "Text Display Options"));
2131 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, _("ゲームプレイ・オプション", "Game-Play Options"));
2138 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, _("行動中止関係のオプション", "Disturbance Options"));
2145 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, _("簡易自動破壊オプション", "Easy Auto-Destroyer Options"));
2149 /* Play-record Options */
2154 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, _("プレイ記録オプション", "Play-record Options"));
2163 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ?
2164 _("初期オプション(参照のみ)", "Birth Options(browse only)") :
2165 _("初期オプション((*)はスコアに影響)", "Birth Options((*)s effect score)"));
2169 /* Cheating Options */
2172 if (!p_ptr->noscore && !allow_debug_opts)
2174 /* Cheat options are not permitted */
2180 do_cmd_options_cheat(_("詐欺師は決して勝利できない!", "Cheaters never win"));
2187 do_cmd_options_autosave(_("自動セーブ", "Autosave"));
2196 do_cmd_options_win();
2197 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2198 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2199 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2200 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON |
2205 /* Auto-picker/destroyer editor */
2209 do_cmd_edit_autopick();
2213 /* Hack -- Delay Speed */
2219 prt(_("コマンド: 基本ウェイト量", "Command: Base Delay Factor"), 19, 0);
2221 /* Get a new value */
2224 int msec = delay_factor * delay_factor * delay_factor;
2225 prt(format(_("現在のウェイト: %d (%dミリ秒)", "Current base delay factor: %d (%d msec)"), delay_factor, msec), 22, 0);
2226 prt(_("ウェイト (0-9) ESCで決定: ", "Delay Factor (0-9 or ESC to accept): "), 20, 0);
2228 if (k == ESCAPE) break;
2231 (void)show_file(TRUE, _("joption.txt#BaseDelay", "option.txt#BaseDelay"), NULL, 0, 0);
2234 else if (isdigit(k)) delay_factor = D2I(k);
2241 /* Hack -- hitpoint warning factor */
2247 prt(_("コマンド: 低ヒットポイント警告", "Command: Hitpoint Warning"), 19, 0);
2249 /* Get a new value */
2252 prt(format(_("現在の低ヒットポイント警告: %d0%%", "Current hitpoint warning: %d0%%"), hitpoint_warn), 22, 0);
2253 prt(_("低ヒットポイント警告 (0-9) ESCで決定: ", "Hitpoint Warning (0-9 or ESC to accept): "), 20, 0);
2255 if (k == ESCAPE) break;
2258 (void)show_file(TRUE, _("joption.txt#Hitpoint", "option.txt#Hitpoint"), NULL, 0, 0);
2261 else if (isdigit(k)) hitpoint_warn = D2I(k);
2268 /* Hack -- mana color factor */
2274 prt(_("コマンド: 低魔力色閾値", "Command: Mana Color Threshold"), 19, 0);
2276 /* Get a new value */
2279 prt(format(_("現在の低魔力色閾値: %d0%%", "Current mana color threshold: %d0%%"), mana_warn), 22, 0);
2280 prt(_("低魔力閾値 (0-9) ESCで決定: ", "Mana color Threshold (0-9 or ESC to accept): "), 20, 0);
2282 if (k == ESCAPE) break;
2285 (void)show_file(TRUE, _("joption.txt#Manapoint", "option.txt#Manapoint"), NULL, 0, 0);
2288 else if (isdigit(k)) mana_warn = D2I(k);
2296 (void)show_file(TRUE, _("joption.txt", "option.txt"), NULL, 0, 0);
2300 /* Unknown option */
2308 /* Flush messages */
2313 /* Restore the screen */
2316 /* Hack - Redraw equippy chars */
2317 p_ptr->redraw |= (PR_EQUIPPY);
2323 * @brief prefファイルを選択して処理する /
2324 * Ask for a "user pref line" and process it
2327 * Allow absolute file names?
2329 void do_cmd_pref(void)
2336 /* Ask for a "user pref command" */
2337 if (!get_string(_("設定変更コマンド: ", "Pref: "), buf, 80)) return;
2339 /* Process that pref command */
2340 (void)process_pref_file_command(buf);
2344 * @brief 自動拾い設定ファイルをロードするコマンドのメインルーチン /
2347 void do_cmd_reload_autopick(void)
2349 if (!get_check(_("自動拾い設定ファイルをロードしますか? ", "Reload auto-pick preference file? "))) return;
2350 /* Load the file with messages */
2351 autopick_load_pref(TRUE);
2357 * @brief マクロ情報をprefファイルに保存する /
2358 * @param fname ファイル名
2361 static errr macro_dump(cptr fname)
2363 static cptr mark = "Macro Dump";
2369 /* Build the filename */
2370 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2372 /* File type is "TEXT" */
2373 FILE_TYPE(FILE_TYPE_TEXT);
2375 /* Append to the file */
2376 if (!open_auto_dump(buf, mark)) return (-1);
2379 auto_dump_printf(_("\n# 自動マクロセーブ\n\n", "\n# Automatic macro dump\n\n"));
2382 for (i = 0; i < macro__num; i++)
2384 /* Extract the action */
2385 ascii_to_text(buf, macro__act[i]);
2387 /* Dump the macro */
2388 auto_dump_printf("A:%s\n", buf);
2390 /* Extract the action */
2391 ascii_to_text(buf, macro__pat[i]);
2393 /* Dump normal macros */
2394 auto_dump_printf("P:%s\n", buf);
2397 auto_dump_printf("\n");
2409 * @brief マクロのトリガーキーを取得する /
2410 * Hack -- ask for a "trigger" (see below)
2411 * @param buf キー表記を保管するバッファ
2415 * Note the complex use of the "inkey()" function from "util.c".
2417 * Note that both "flush()" calls are extremely important.
2420 static void do_cmd_macro_aux(char *buf)
2428 /* Do not process macros */
2434 /* Read the pattern */
2440 /* Do not process macros */
2443 /* Do not wait for keys */
2446 /* Attempt to read a key */
2455 /* Convert the trigger */
2456 ascii_to_text(tmp, buf);
2458 /* Hack -- display the trigger */
2459 Term_addstr(-1, TERM_WHITE, tmp);
2465 * @brief マクロのキー表記からアスキーコードを得てターミナルに表示する /
2466 * Hack -- ask for a keymap "trigger" (see below)
2467 * @param buf キー表記を取得するバッファ
2471 * Note that both "flush()" calls are extremely important. This may
2472 * no longer be true, since "util.c" is much simpler now.
2475 static void do_cmd_macro_aux_keymap(char *buf)
2485 /* Convert to ascii */
2486 ascii_to_text(tmp, buf);
2488 /* Hack -- display the trigger */
2489 Term_addstr(-1, TERM_WHITE, tmp);
2496 * @brief キーマップをprefファイルにダンプする /
2497 * Hack -- append all keymaps to the given file
2498 * @param fname ファイルネーム
2502 static errr keymap_dump(cptr fname)
2504 static cptr mark = "Keymap Dump";
2513 if (rogue_like_commands)
2515 mode = KEYMAP_MODE_ROGUE;
2521 mode = KEYMAP_MODE_ORIG;
2525 /* Build the filename */
2526 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2528 /* File type is "TEXT" */
2529 FILE_TYPE(FILE_TYPE_TEXT);
2531 /* Append to the file */
2532 if (!open_auto_dump(buf, mark)) return -1;
2535 auto_dump_printf(_("\n# 自動キー配置セーブ\n\n", "\n# Automatic keymap dump\n\n"));
2538 for (i = 0; i < 256; i++)
2542 /* Loop up the keymap */
2543 act = keymap_act[mode][i];
2545 /* Skip empty keymaps */
2548 /* Encode the key */
2551 ascii_to_text(key, buf);
2553 /* Encode the action */
2554 ascii_to_text(buf, act);
2556 /* Dump the macro */
2557 auto_dump_printf("A:%s\n", buf);
2558 auto_dump_printf("C:%d:%s\n", mode, key);
2570 * @brief マクロを設定するコマンドのメインルーチン /
2571 * Interact with "macros"
2575 * Note that the macro "action" must be defined before the trigger.
2577 * Could use some helpful instructions on this page.
2580 void do_cmd_macros(void)
2592 if (rogue_like_commands)
2594 mode = KEYMAP_MODE_ROGUE;
2600 mode = KEYMAP_MODE_ORIG;
2603 /* File type is "TEXT" */
2604 FILE_TYPE(FILE_TYPE_TEXT);
2611 /* Process requests until done */
2616 prt(_("[ マクロの設定 ]", "Interact with Macros"), 2, 0);
2618 /* Describe that action */
2619 prt(_("マクロ行動が(もしあれば)下に表示されます:", "Current action (if any) shown below:"), 20, 0);
2621 /* Analyze the current action */
2622 ascii_to_text(buf, macro__buf);
2624 /* Display the current action */
2629 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
2631 prt(_("(2) ファイルにマクロを追加", "(2) Append macros to a file"), 5, 5);
2632 prt(_("(3) マクロの確認", "(3) Query a macro"), 6, 5);
2633 prt(_("(4) マクロの作成", "(4) Create a macro"), 7, 5);
2634 prt(_("(5) マクロの削除", "(5) Remove a macro"), 8, 5);
2635 prt(_("(6) ファイルにキー配置を追加", "(6) Append keymaps to a file"), 9, 5);
2636 prt(_("(7) キー配置の確認", "(7) Query a keymap"), 10, 5);
2637 prt(_("(8) キー配置の作成", "(8) Create a keymap"), 11, 5);
2638 prt(_("(9) キー配置の削除", "(9) Remove a keymap"), 12, 5);
2639 prt(_("(0) マクロ行動の入力", "(0) Enter a new action"), 13, 5);
2640 #endif /* ALLOW_MACROS */
2643 prt(_("コマンド: ", "Command: "), 16, 0);
2649 if (i == ESCAPE) break;
2651 /* Load a 'macro' file */
2657 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 16, 0);
2660 prt(_("ファイル: ", "File: "), 18, 0);
2662 /* Default filename */
2663 sprintf(tmp, "%s.prf", player_base);
2665 /* Ask for a file */
2666 if (!askfor(tmp, 80)) continue;
2668 /* Process the given filename */
2669 err = process_pref_file(tmp);
2672 msg_format(_("標準の設定ファイル'%s'を読み込みました。", "Loaded default '%s'."), tmp);
2677 msg_format(_("'%s'の読み込みに失敗しました!", "Failed to load '%s'!"), tmp);
2681 msg_format(_("'%s'を読み込みました。", "Loaded '%s'."), tmp);
2691 prt(_("コマンド: マクロをファイルに追加する", "Command: Append macros to a file"), 16, 0);
2694 prt(_("ファイル: ", "File: "), 18, 0);
2696 /* Default filename */
2697 sprintf(tmp, "%s.prf", player_base);
2699 /* Ask for a file */
2700 if (!askfor(tmp, 80)) continue;
2702 /* Dump the macros */
2703 (void)macro_dump(tmp);
2706 msg_print(_("マクロを追加しました。", "Appended macros."));
2715 prt(_("コマンド: マクロの確認", "Command: Query a macro"), 16, 0);
2719 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2721 /* Get a macro trigger */
2722 do_cmd_macro_aux(buf);
2724 /* Acquire action */
2725 k = macro_find_exact(buf);
2731 msg_print(_("そのキーにはマクロは定義されていません。", "Found no macro."));
2737 /* Obtain the action */
2738 strcpy(macro__buf, macro__act[k]);
2740 /* Analyze the current action */
2741 ascii_to_text(buf, macro__buf);
2743 /* Display the current action */
2747 msg_print(_("マクロを確認しました。", "Found a macro."));
2751 /* Create a macro */
2755 prt(_("コマンド: マクロの作成", "Command: Create a macro"), 16, 0);
2758 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2760 /* Get a macro trigger */
2761 do_cmd_macro_aux(buf);
2767 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2768 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2771 prt(_("マクロ行動: ", "Action: "), 20, 0);
2773 /* Convert to text */
2774 ascii_to_text(tmp, macro__buf);
2776 /* Get an encoded action */
2777 if (askfor(tmp, 80))
2779 /* Convert to ascii */
2780 text_to_ascii(macro__buf, tmp);
2782 /* Link the macro */
2783 macro_add(buf, macro__buf);
2786 msg_print(_("マクロを追加しました。", "Added a macro."));
2790 /* Remove a macro */
2794 prt(_("コマンド: マクロの削除", "Command: Remove a macro"), 16, 0);
2797 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2799 /* Get a macro trigger */
2800 do_cmd_macro_aux(buf);
2802 /* Link the macro */
2803 macro_add(buf, buf);
2806 msg_print(_("マクロを削除しました。", "Removed a macro."));
2813 prt(_("コマンド: キー配置をファイルに追加する", "Command: Append keymaps to a file"), 16, 0);
2816 prt(_("ファイル: ", "File: "), 18, 0);
2818 /* Default filename */
2819 sprintf(tmp, "%s.prf", player_base);
2821 /* Ask for a file */
2822 if (!askfor(tmp, 80)) continue;
2824 /* Dump the macros */
2825 (void)keymap_dump(tmp);
2828 msg_print(_("キー配置を追加しました。", "Appended keymaps."));
2831 /* Query a keymap */
2837 prt(_("コマンド: キー配置の確認", "Command: Query a keymap"), 16, 0);
2840 prt(_("押すキー: ", "Keypress: "), 18, 0);
2842 /* Get a keymap trigger */
2843 do_cmd_macro_aux_keymap(buf);
2845 /* Look up the keymap */
2846 act = keymap_act[mode][(byte)(buf[0])];
2852 msg_print(_("キー配置は定義されていません。", "Found no keymap."));
2858 /* Obtain the action */
2859 strcpy(macro__buf, act);
2861 /* Analyze the current action */
2862 ascii_to_text(buf, macro__buf);
2864 /* Display the current action */
2868 msg_print(_("キー配置を確認しました。", "Found a keymap."));
2872 /* Create a keymap */
2876 prt(_("コマンド: キー配置の作成", "Command: Create a keymap"), 16, 0);
2879 prt(_("押すキー: ", "Keypress: "), 18, 0);
2881 /* Get a keymap trigger */
2882 do_cmd_macro_aux_keymap(buf);
2888 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2889 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2892 prt(_("行動: ", "Action: "), 20, 0);
2894 /* Convert to text */
2895 ascii_to_text(tmp, macro__buf);
2897 /* Get an encoded action */
2898 if (askfor(tmp, 80))
2900 /* Convert to ascii */
2901 text_to_ascii(macro__buf, tmp);
2903 /* Free old keymap */
2904 string_free(keymap_act[mode][(byte)(buf[0])]);
2906 /* Make new keymap */
2907 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
2910 msg_print(_("キー配置を追加しました。", "Added a keymap."));
2914 /* Remove a keymap */
2918 prt(_("コマンド: キー配置の削除", "Command: Remove a keymap"), 16, 0);
2921 prt(_("押すキー: ", "Keypress: "), 18, 0);
2923 /* Get a keymap trigger */
2924 do_cmd_macro_aux_keymap(buf);
2926 /* Free old keymap */
2927 string_free(keymap_act[mode][(byte)(buf[0])]);
2929 /* Make new keymap */
2930 keymap_act[mode][(byte)(buf[0])] = NULL;
2933 msg_print(_("キー配置を削除しました。", "Removed a keymap."));
2936 /* Enter a new action */
2940 prt(_("コマンド: マクロ行動の入力", "Command: Enter a new action"), 16, 0);
2946 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2947 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2950 prt(_("マクロ行動: ", "Action: "), 20, 0);
2952 /* Hack -- limit the value */
2955 /* Get an encoded action */
2956 if (!askfor(buf, 80)) continue;
2958 /* Extract an action */
2959 text_to_ascii(macro__buf, buf);
2962 #endif /* ALLOW_MACROS */
2969 /* Flush messages */
2978 * @brief キャラクタ色の明暗表現
2980 static cptr lighting_level_str[F_LIT_MAX] =
2995 * @brief キャラクタのビジュアルIDを変更する際の対象指定関数
2996 * @param i 指定対象となるキャラクタコード
2997 * @param num 指定されたビジュアルIDを返す参照ポインタ
2998 * @param max ビジュアルIDの最大数
2999 * @return 指定が実際に行われた場合TRUE、キャンセルされた場合FALSE
3001 static bool cmd_visuals_aux(int i, IDX *num, IDX max)
3008 sprintf(str, "%d", *num);
3010 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3013 tmp = (IDX)strtol(str, NULL, 0);
3014 if (tmp >= 0 && tmp < max)
3017 else if (isupper(i))
3018 *num = (*num + max - 1) % max;
3020 *num = (*num + 1) % max;
3026 * @brief キャラクタの変更メニュー表示
3027 * @param choice_msg 選択メッセージ
3030 static void print_visuals_menu(cptr choice_msg)
3032 prt(_("[ 画面表示の設定 ]", "Interact with Visuals"), 1, 0);
3034 /* Give some choices */
3035 prt(_("(0) ユーザー設定ファイルのロード", "(0) Load a user pref file"), 3, 5);
3037 #ifdef ALLOW_VISUALS
3038 prt(_("(1) モンスターの 色/文字 をファイルに書き出す", "(1) Dump monster attr/chars"), 4, 5);
3039 prt(_("(2) アイテムの 色/文字 をファイルに書き出す", "(2) Dump object attr/chars"), 5, 5);
3040 prt(_("(3) 地形の 色/文字 をファイルに書き出す", "(3) Dump feature attr/chars"), 6, 5);
3041 prt(_("(4) モンスターの 色/文字 を変更する (数値操作)", "(4) Change monster attr/chars (numeric operation)"), 7, 5);
3042 prt(_("(5) アイテムの 色/文字 を変更する (数値操作)", "(5) Change object attr/chars (numeric operation)"), 8, 5);
3043 prt(_("(6) 地形の 色/文字 を変更する (数値操作)", "(6) Change feature attr/chars (numeric operation)"), 9, 5);
3044 prt(_("(7) モンスターの 色/文字 を変更する (シンボルエディタ)", "(7) Change monster attr/chars (visual mode)"), 10, 5);
3045 prt(_("(8) アイテムの 色/文字 を変更する (シンボルエディタ)", "(8) Change object attr/chars (visual mode)"), 11, 5);
3046 prt(_("(9) 地形の 色/文字 を変更する (シンボルエディタ)", "(9) Change feature attr/chars (visual mode)"), 12, 5);
3047 #endif /* ALLOW_VISUALS */
3049 prt(_("(R) 画面表示方法の初期化", "(R) Reset visuals"), 13, 5);
3052 prt(format("コマンド: %s", choice_msg ? choice_msg : _("", "")), 15, 0);
3055 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx);
3056 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx);
3057 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level);
3060 * Interact with "visuals"
3062 void do_cmd_visuals(void)
3067 bool need_redraw = FALSE;
3068 const char *empty_symbol = "<< ? >>";
3070 if (use_bigtile) empty_symbol = "<< ?? >>";
3072 /* File type is "TEXT" */
3073 FILE_TYPE(FILE_TYPE_TEXT);
3075 /* Save the screen */
3078 /* Interact until done */
3084 /* Ask for a choice */
3085 print_visuals_menu(NULL);
3090 if (i == ESCAPE) break;
3094 /* Load a 'pref' file */
3097 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 15, 0);
3100 prt(_("ファイル: ", "File: "), 17, 0);
3102 /* Default filename */
3103 sprintf(tmp, "%s.prf", player_base);
3106 if (!askfor(tmp, 70)) continue;
3108 /* Process the given filename */
3109 (void)process_pref_file(tmp);
3114 #ifdef ALLOW_VISUALS
3116 /* Dump monster attr/chars */
3119 static cptr mark = "Monster attr/chars";
3122 prt(_("コマンド: モンスターの[色/文字]をファイルに書き出します", "Command: Dump monster attr/chars"), 15, 0);
3125 prt(_("ファイル: ", "File: "), 17, 0);
3127 /* Default filename */
3128 sprintf(tmp, "%s.prf", player_base);
3130 /* Get a filename */
3131 if (!askfor(tmp, 70)) continue;
3133 /* Build the filename */
3134 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3136 /* Append to the file */
3137 if (!open_auto_dump(buf, mark)) continue;
3140 auto_dump_printf(_("\n# モンスターの[色/文字]の設定\n\n", "\n# Monster attr/char definitions\n\n"));
3143 for (i = 0; i < max_r_idx; i++)
3145 monster_race *r_ptr = &r_info[i];
3147 /* Skip non-entries */
3148 if (!r_ptr->name) continue;
3150 /* Dump a comment */
3151 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3153 /* Dump the monster attr/char info */
3154 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3155 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3161 msg_print(_("モンスターの[色/文字]をファイルに書き出しました。", "Dumped monster attr/chars."));
3166 /* Dump object attr/chars */
3169 static cptr mark = "Object attr/chars";
3170 KIND_OBJECT_IDX k_idx;
3173 prt(_("コマンド: アイテムの[色/文字]をファイルに書き出します", "Command: Dump object attr/chars"), 15, 0);
3176 prt(_("ファイル: ", "File: "), 17, 0);
3178 /* Default filename */
3179 sprintf(tmp, "%s.prf", player_base);
3181 /* Get a filename */
3182 if (!askfor(tmp, 70)) continue;
3184 /* Build the filename */
3185 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3187 /* Append to the file */
3188 if (!open_auto_dump(buf, mark)) continue;
3191 auto_dump_printf(_("\n# アイテムの[色/文字]の設定\n\n", "\n# Object attr/char definitions\n\n"));
3194 for (k_idx = 0; k_idx < max_k_idx; k_idx++)
3197 object_kind *k_ptr = &k_info[k_idx];
3199 /* Skip non-entries */
3200 if (!k_ptr->name) continue;
3205 strip_name(o_name, k_idx);
3211 /* Prepare dummy object */
3212 object_prep(&forge, k_idx);
3214 /* Get un-shuffled flavor name */
3215 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3218 /* Dump a comment */
3219 auto_dump_printf("# %s\n", o_name);
3221 /* Dump the object attr/char info */
3222 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", (int)k_idx,
3223 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3229 msg_print(_("アイテムの[色/文字]をファイルに書き出しました。", "Dumped object attr/chars."));
3234 /* Dump feature attr/chars */
3237 static cptr mark = "Feature attr/chars";
3240 prt(_("コマンド: 地形の[色/文字]をファイルに書き出します", "Command: Dump feature attr/chars"), 15, 0);
3243 prt(_("ファイル: ", "File: "), 17, 0);
3245 /* Default filename */
3246 sprintf(tmp, "%s.prf", player_base);
3248 /* Get a filename */
3249 if (!askfor(tmp, 70)) continue;
3251 /* Build the filename */
3252 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3254 /* Append to the file */
3255 if (!open_auto_dump(buf, mark)) continue;
3258 auto_dump_printf(_("\n# 地形の[色/文字]の設定\n\n", "\n# Feature attr/char definitions\n\n"));
3261 for (i = 0; i < max_f_idx; i++)
3263 feature_type *f_ptr = &f_info[i];
3265 /* Skip non-entries */
3266 if (!f_ptr->name) continue;
3268 /* Skip mimiccing features */
3269 if (f_ptr->mimic != i) continue;
3271 /* Dump a comment */
3272 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3274 /* Dump the feature attr/char info */
3275 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
3276 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
3277 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
3278 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
3284 msg_print(_("地形の[色/文字]をファイルに書き出しました。", "Dumped feature attr/chars."));
3289 /* Modify monster attr/chars (numeric operation) */
3292 static cptr choice_msg = _("モンスターの[色/文字]を変更します", "Change monster attr/chars");
3295 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3297 /* Hack -- query until done */
3300 monster_race *r_ptr = &r_info[r];
3304 TERM_COLOR da = r_ptr->d_attr;
3305 byte dc = r_ptr->d_char;
3306 TERM_COLOR ca = r_ptr->x_attr;
3307 byte cc = r_ptr->x_char;
3309 /* Label the object */
3310 Term_putstr(5, 17, -1, TERM_WHITE,
3311 format(_("モンスター = %d, 名前 = %-40.40s", "Monster = %d, Name = %-40.40s"), r, (r_name + r_ptr->name)));
3313 /* Label the Default values */
3314 Term_putstr(10, 19, -1, TERM_WHITE,
3315 format(_("初期値 色 / 文字 = %3u / %3u", "Default attr/char = %3u / %3u"), da, dc));
3317 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3318 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3320 /* Label the Current values */
3321 Term_putstr(10, 20, -1, TERM_WHITE,
3322 format(_("現在値 色 / 文字 = %3u / %3u", "Current attr/char = %3u / %3u"), ca, cc));
3324 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3325 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3328 Term_putstr(0, 22, -1, TERM_WHITE,
3329 _("コマンド (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ", "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): "));
3335 if (i == ESCAPE) break;
3337 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3338 else if (isupper(i)) c = 'a' + i - 'A';
3348 if (!cmd_visuals_aux(i, &r, max_r_idx))
3354 while (!r_info[r].name);
3358 t = (int)r_ptr->x_attr;
3359 (void)cmd_visuals_aux(i, &t, 256);
3360 r_ptr->x_attr = (byte)t;
3364 t = (int)r_ptr->x_char;
3365 (void)cmd_visuals_aux(i, &t, 256);
3366 r_ptr->x_char = (byte)t;
3370 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
3374 print_visuals_menu(choice_msg);
3382 /* Modify object attr/chars (numeric operation) */
3385 static cptr choice_msg = _("アイテムの[色/文字]を変更します", "Change object attr/chars");
3387 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3389 /* Hack -- query until done */
3392 object_kind *k_ptr = &k_info[k];
3396 TERM_COLOR da = k_ptr->d_attr;
3397 SYMBOL_CODE dc = k_ptr->d_char;
3398 TERM_COLOR ca = k_ptr->x_attr;
3399 SYMBOL_CODE cc = k_ptr->x_char;
3401 /* Label the object */
3402 Term_putstr(5, 17, -1, TERM_WHITE,
3403 format(_("アイテム = %d, 名前 = %-40.40s", "Object = %d, Name = %-40.40s"),
3404 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
3406 /* Label the Default values */
3407 Term_putstr(10, 19, -1, TERM_WHITE,
3408 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3410 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3411 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3413 /* Label the Current values */
3414 Term_putstr(10, 20, -1, TERM_WHITE,
3415 format(_("現在値 色 / 文字 = %3d / %3d", "Current attr/char = %3d / %3d"), ca, cc));
3417 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3418 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3421 Term_putstr(0, 22, -1, TERM_WHITE,
3422 _("コマンド (n/N/^N/a/A/^A/c/C/^C/v/V/^V): ", "Command (n/N/^N/a/A/^A/c/C/^C/v/V/^V): "));
3428 if (i == ESCAPE) break;
3430 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3431 else if (isupper(i)) c = 'a' + i - 'A';
3441 if (!cmd_visuals_aux(i, &k, max_k_idx))
3447 while (!k_info[k].name);
3451 t = (int)k_ptr->x_attr;
3452 (void)cmd_visuals_aux(i, &t, 256);
3453 k_ptr->x_attr = (byte)t;
3457 t = (int)k_ptr->x_char;
3458 (void)cmd_visuals_aux(i, &t, 256);
3459 k_ptr->x_char = (byte)t;
3463 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
3467 print_visuals_menu(choice_msg);
3475 /* Modify feature attr/chars (numeric operation) */
3478 static cptr choice_msg = _("地形の[色/文字]を変更します", "Change feature attr/chars");
3480 static IDX lighting_level = F_LIT_STANDARD;
3481 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3483 /* Hack -- query until done */
3486 feature_type *f_ptr = &f_info[f];
3490 TERM_COLOR da = f_ptr->d_attr[lighting_level];
3491 byte dc = f_ptr->d_char[lighting_level];
3492 TERM_COLOR ca = f_ptr->x_attr[lighting_level];
3493 byte cc = f_ptr->x_char[lighting_level];
3495 /* Label the object */
3497 Term_putstr(5, 17, -1, TERM_WHITE,
3498 format(_("地形 = %d, 名前 = %s, 明度 = %s", "Terrain = %d, Name = %s, Lighting = %s"),
3499 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
3501 /* Label the Default values */
3502 Term_putstr(10, 19, -1, TERM_WHITE,
3503 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3505 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3506 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3508 /* Label the Current values */
3510 Term_putstr(10, 20, -1, TERM_WHITE,
3511 format("現在値 色 / 文字 = %3d / %3d", ca, cc));
3513 Term_putstr(10, 20, -1, TERM_WHITE,
3514 format("Current attr/char = %3d / %3d", ca, cc));
3517 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3518 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3522 Term_putstr(0, 22, -1, TERM_WHITE,
3523 "コマンド (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3525 Term_putstr(0, 22, -1, TERM_WHITE,
3526 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3533 if (i == ESCAPE) break;
3535 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3536 else if (isupper(i)) c = 'a' + i - 'A';
3546 if (!cmd_visuals_aux(i, &f, max_f_idx))
3552 while (!f_info[f].name || (f_info[f].mimic != f));
3556 t = (int)f_ptr->x_attr[lighting_level];
3557 (void)cmd_visuals_aux(i, &t, 256);
3558 f_ptr->x_attr[lighting_level] = (byte)t;
3562 t = (int)f_ptr->x_char[lighting_level];
3563 (void)cmd_visuals_aux(i, &t, 256);
3564 f_ptr->x_char[lighting_level] = (byte)t;
3568 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
3571 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
3575 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
3579 print_visuals_menu(choice_msg);
3587 /* Modify monster attr/chars (visual mode) */
3589 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
3592 /* Modify object attr/chars (visual mode) */
3594 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
3597 /* Modify feature attr/chars (visual mode) */
3600 IDX lighting_level = F_LIT_STANDARD;
3601 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
3605 #endif /* ALLOW_VISUALS */
3613 msg_print(_("画面上の[色/文字]を初期値にリセットしました。", "Visual attr/char tables reset."));
3617 /* Unknown option */
3623 /* Flush messages */
3627 /* Restore the screen */
3630 if (need_redraw) do_cmd_redraw();
3635 * Interact with "colors"
3637 void do_cmd_colors(void)
3646 /* File type is "TEXT" */
3647 FILE_TYPE(FILE_TYPE_TEXT);
3650 /* Save the screen */
3654 /* Interact until done */
3660 /* Ask for a choice */
3661 prt(_("[ カラーの設定 ]", "Interact with Colors"), 2, 0);
3663 /* Give some choices */
3664 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
3667 prt(_("(2) カラーの設定をファイルに書き出す", "(2) Dump colors"), 5, 5);
3668 prt(_("(3) カラーの設定を変更する", "(3) Modify colors"), 6, 5);
3672 prt(_("コマンド: ", "Command: "), 8, 0);
3676 if (i == ESCAPE) break;
3678 /* Load a 'pref' file */
3682 prt(_("コマンド: ユーザー設定ファイルをロードします", "Command: Load a user pref file"), 8, 0);
3685 prt(_("ファイル: ", "File: "), 10, 0);
3688 sprintf(tmp, "%s.prf", player_base);
3691 if (!askfor(tmp, 70)) continue;
3693 /* Process the given filename */
3694 (void)process_pref_file(tmp);
3696 /* Mega-Hack -- react to changes */
3697 Term_xtra(TERM_XTRA_REACT, 0);
3699 /* Mega-Hack -- redraw */
3708 static cptr mark = "Colors";
3711 prt(_("コマンド: カラーの設定をファイルに書き出します", "Command: Dump colors"), 8, 0);
3714 prt(_("ファイル: ", "File: "), 10, 0);
3716 /* Default filename */
3717 sprintf(tmp, "%s.prf", player_base);
3719 /* Get a filename */
3720 if (!askfor(tmp, 70)) continue;
3722 /* Build the filename */
3723 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3725 /* Append to the file */
3726 if (!open_auto_dump(buf, mark)) continue;
3729 auto_dump_printf(_("\n# カラーの設定\n\n", "\n# Color redefinitions\n\n"));
3732 for (i = 0; i < 256; i++)
3734 int kv = angband_color_table[i][0];
3735 int rv = angband_color_table[i][1];
3736 int gv = angband_color_table[i][2];
3737 int bv = angband_color_table[i][3];
3739 cptr name = _("未知", "unknown");
3741 /* Skip non-entries */
3742 if (!kv && !rv && !gv && !bv) continue;
3744 /* Extract the color name */
3745 if (i < 16) name = color_names[i];
3747 /* Dump a comment */
3748 auto_dump_printf(_("# カラー '%s'\n", "# Color '%s'\n"), name);
3750 /* Dump the monster attr/char info */
3751 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
3758 msg_print(_("カラーの設定をファイルに書き出しました。", "Dumped color redefinitions."));
3767 prt(_("コマンド: カラーの設定を変更します", "Command: Modify colors"), 8, 0);
3769 /* Hack -- query until done */
3778 /* Exhibit the normal colors */
3779 for (j = 0; j < 16; j++)
3781 /* Exhibit this color */
3782 Term_putstr(j*4, 20, -1, a, "###");
3784 /* Exhibit all colors */
3785 Term_putstr(j*4, 22, -1, j, format("%3d", j));
3788 /* Describe the color */
3789 name = ((a < 16) ? color_names[a] : _("未定義", "undefined"));
3791 /* Describe the color */
3792 Term_putstr(5, 10, -1, TERM_WHITE,
3793 format(_("カラー = %d, 名前 = %s", "Color = %d, Name = %s"), a, name));
3795 /* Label the Current values */
3796 Term_putstr(5, 12, -1, TERM_WHITE,
3797 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
3798 angband_color_table[a][0],
3799 angband_color_table[a][1],
3800 angband_color_table[a][2],
3801 angband_color_table[a][3]));
3804 Term_putstr(0, 14, -1, TERM_WHITE,
3805 _("コマンド (n/N/k/K/r/R/g/G/b/B): ", "Command (n/N/k/K/r/R/g/G/b/B): "));
3812 if (i == ESCAPE) break;
3815 if (i == 'n') a = (byte)(a + 1);
3816 if (i == 'N') a = (byte)(a - 1);
3817 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
3818 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
3819 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
3820 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
3821 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
3822 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
3823 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
3824 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
3826 /* Hack -- react to changes */
3827 Term_xtra(TERM_XTRA_REACT, 0);
3829 /* Hack -- redraw */
3836 /* Unknown option */
3842 /* Flush messages */
3847 /* Restore the screen */
3853 * Note something in the message recall
3855 void do_cmd_note(void)
3863 if (!get_string(_("メモ: ", "Note: "), buf, 60)) return;
3865 /* Ignore empty notes */
3866 if (!buf[0] || (buf[0] == ' ')) return;
3868 /* Add the note to the message recall */
3869 msg_format(_("メモ: %s", "Note: %s"), buf);
3874 * Mention the current version
3876 void do_cmd_version(void)
3880 #if FAKE_VER_EXTRA > 0
3881 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d.%d", "You are playing Hengband %d.%d.%d.%d."),
3882 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
3884 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d", "You are playing Hengband %d.%d.%d."),
3885 FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
3892 * Array of feeling strings
3894 static cptr do_cmd_feeling_text[11] =
3896 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3897 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3898 _("恐ろしい死の幻が目に浮かび、気絶しそうになった!", "You nearly faint as horrible visions of death fill your mind!"),
3899 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3900 _("とても悪い予感がする...", "You have a very bad feeling..."),
3901 _("悪い予感がする...", "You have a bad feeling..."),
3902 _("何か緊張する。", "You feel nervous."),
3903 _("少し不運な気がする...", "You feel your luck is turning..."),
3904 _("この場所は好きになれない。", "You don't like the look of this place."),
3905 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3906 _("なんて退屈なところだ...", "What a boring place...")
3909 static cptr do_cmd_feeling_text_combat[11] =
3911 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3912 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3913 _("今夜もまた、誰かが命を落とす...", "You nearly faint as horrible visions of death fill your mind!"),
3914 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3915 _("とても悪い予感がする...", "You have a very bad feeling..."),
3916 _("悪い予感がする...", "You have a bad feeling..."),
3917 _("何か緊張する。", "You feel nervous."),
3918 _("少し不運な気がする...", "You feel your luck is turning..."),
3919 _("この場所は好きになれない。", "You don't like the look of this place."),
3920 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3921 _("なんて退屈なところだ...", "What a boring place...")
3924 static cptr do_cmd_feeling_text_lucky[11] =
3926 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3927 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3928 _("この階はこの上なく素晴らしい感じがする。", "You have a superb feeling about this level."),
3929 _("素晴らしい感じがする...", "You have an excellent feeling..."),
3930 _("とても良い感じがする...", "You have a very good feeling..."),
3931 _("良い感じがする...", "You have a good feeling..."),
3932 _("ちょっと幸運な感じがする...", "You feel strangely lucky..."),
3933 _("多少は運が向いてきたか...", "You feel your luck is turning..."),
3934 _("見た感じ悪くはない...", "You like the look of this place..."),
3935 _("全然駄目ということはないが...", "This level can't be all bad..."),
3936 _("なんて退屈なところだ...", "What a boring place...")
3941 * Note that "feeling" is set to zero unless some time has passed.
3942 * Note that this is done when the level is GENERATED, not entered.
3944 void do_cmd_feeling(void)
3946 /* No useful feeling in quests */
3947 if (p_ptr->inside_quest && !random_quest_number(dun_level))
3949 msg_print(_("典型的なクエストのダンジョンのようだ。", "Looks like a typical quest level."));
3953 /* No useful feeling in town */
3954 else if (p_ptr->town_num && !dun_level)
3956 if (!strcmp(town[p_ptr->town_num].name, _("荒野", "wilderness")))
3958 msg_print(_("何かありそうな荒野のようだ。", "Looks like a strange wilderness."));
3963 msg_print(_("典型的な町のようだ。", "Looks like a typical town."));
3968 /* No useful feeling in the wilderness */
3969 else if (!dun_level)
3971 msg_print(_("典型的な荒野のようだ。", "Looks like a typical wilderness."));
3975 /* Display the feeling */
3976 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
3977 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
3978 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
3979 inventory[INVEN_BOW].name1 == ART_CRIMSON)
3980 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
3982 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
3988 * Description of each monster group.
3990 static cptr monster_group_text[] =
3993 "ユニーク", /* "Uniques" */
3994 "乗馬可能なモンスター", /* "Riding" */
3995 "賞金首", /* "Wanted */
3996 "アンバーの王族", /* "Ambertite" */
4025 /* "古代ドラゴン/ワイアーム", */
4086 /* "Ancient Dragon/Wyrm", */
4095 "Multi-Headed Reptile",
4100 "Reptile/Amphibian",
4101 "Spider/Scorpion/Tick",
4103 /* "Major Demon", */
4120 * Symbols of monsters in each group. Note the "Uniques" group
4121 * is handled differently.
4123 static cptr monster_group_char[] =
4180 "!$&()+./=>?[\\]`{|~",
4190 * hook function to sort monsters by level
4192 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
4194 u16b *who = (u16b*)(u);
4199 monster_race *r_ptr1 = &r_info[w1];
4200 monster_race *r_ptr2 = &r_info[w2];
4205 if (r_ptr2->level > r_ptr1->level) return TRUE;
4206 if (r_ptr1->level > r_ptr2->level) return FALSE;
4208 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
4209 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
4214 * Build a list of monster indexes in the given group. Return the number
4215 * of monsters in the group.
4217 * mode & 0x01 : check for non-empty group
4218 * mode & 0x02 : visual operation only
4220 static IDX collect_monsters(IDX grp_cur, IDX mon_idx[], BIT_FLAGS8 mode)
4226 /* Get a list of x_char in this group */
4227 cptr group_char = monster_group_char[grp_cur];
4229 /* XXX Hack -- Check if this is the "Uniques" group */
4230 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
4232 /* XXX Hack -- Check if this is the "Riding" group */
4233 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
4235 /* XXX Hack -- Check if this is the "Wanted" group */
4236 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
4238 /* XXX Hack -- Check if this is the "Amberite" group */
4239 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
4242 /* Check every race */
4243 for (i = 0; i < max_r_idx; i++)
4245 /* Access the race */
4246 monster_race *r_ptr = &r_info[i];
4248 /* Skip empty race */
4249 if (!r_ptr->name) continue ;
4251 /* Require known monsters */
4252 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
4256 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
4259 else if (grp_riding)
4261 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
4264 else if (grp_wanted)
4266 bool wanted = FALSE;
4268 for (j = 0; j < MAX_KUBI; j++)
4270 if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
4271 (p_ptr->today_mon && p_ptr->today_mon == i))
4277 if (!wanted) continue;
4280 else if (grp_amberite)
4282 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
4287 /* Check for race in the group */
4288 if (!my_strchr(group_char, r_ptr->d_char)) continue;
4292 mon_idx[mon_cnt++] = i;
4294 /* XXX Hack -- Just checking for non-empty group */
4295 if (mode & 0x01) break;
4298 /* Terminate the list */
4299 mon_idx[mon_cnt] = -1;
4301 /* Select the sort method */
4302 ang_sort_comp = ang_sort_comp_monster_level;
4303 ang_sort_swap = ang_sort_swap_hook;
4305 /* Sort by monster level */
4306 ang_sort(mon_idx, &dummy_why, mon_cnt);
4308 /* Return the number of races */
4314 * Description of each monster group.
4316 static cptr object_group_text[] =
4319 "キノコ", /* "Mushrooms" */
4320 "薬", /* "Potions" */
4321 "油つぼ", /* "Flasks" */
4322 "巻物", /* "Scrolls" */
4324 "アミュレット", /* "Amulets" */
4325 "笛", /* "Whistle" */
4326 "光源", /* "Lanterns" */
4327 "魔法棒", /* "Wands" */
4330 "カード", /* "Cards" */
4341 "刀剣類", /* "Swords" */
4342 "鈍器", /* "Blunt Weapons" */
4343 "長柄武器", /* "Polearms" */
4344 "採掘道具", /* "Diggers" */
4345 "飛び道具", /* "Bows" */
4349 "軽装鎧", /* "Soft Armor" */
4350 "重装鎧", /* "Hard Armor" */
4351 "ドラゴン鎧", /* "Dragon Armor" */
4352 "盾", /* "Shields" */
4353 "クローク", /* "Cloaks" */
4354 "籠手", /* "Gloves" */
4355 "ヘルメット", /* "Helms" */
4357 "ブーツ", /* "Boots" */
4410 * TVALs of items in each group
4412 static byte object_group_tval[] =
4453 TV_LIFE_BOOK, /* Hack -- all spellbooks */
4461 * Build a list of object indexes in the given group. Return the number
4462 * of objects in the group.
4464 * mode & 0x01 : check for non-empty group
4465 * mode & 0x02 : visual operation only
4467 static int collect_objects(int grp_cur, IDX object_idx[], BIT_FLAGS8 mode)
4470 int j, k, object_cnt = 0;
4472 /* Get a list of x_char in this group */
4473 byte group_tval = object_group_tval[grp_cur];
4475 /* Check every object */
4476 for (i = 0; i < max_k_idx; i++)
4478 /* Access the object */
4479 object_kind *k_ptr = &k_info[i];
4481 /* Skip empty objects */
4482 if (!k_ptr->name) continue;
4486 /* Any objects will be displayed */
4492 /* Skip non-flavoured objects */
4493 if (!k_ptr->flavor) continue;
4495 /* Require objects ever seen */
4496 if (!k_ptr->aware) continue;
4499 /* Skip items with no distribution (special artifacts) */
4500 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
4504 /* Check for objects in the group */
4505 if (TV_LIFE_BOOK == group_tval)
4507 /* Hack -- All spell books */
4508 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HEX_BOOK)
4510 /* Add the object */
4511 object_idx[object_cnt++] = i;
4515 else if (k_ptr->tval == group_tval)
4517 /* Add the object */
4518 object_idx[object_cnt++] = i;
4522 /* XXX Hack -- Just checking for non-empty group */
4523 if (mode & 0x01) break;
4526 /* Terminate the list */
4527 object_idx[object_cnt] = -1;
4529 /* Return the number of objects */
4535 * Description of each feature group.
4537 static cptr feature_group_text[] =
4545 * Build a list of feature indexes in the given group. Return the number
4546 * of features in the group.
4548 * mode & 0x01 : check for non-empty group
4550 static int collect_features(int grp_cur, IDX *feat_idx, BIT_FLAGS8 mode)
4555 /* Unused; There is a single group. */
4558 /* Check every feature */
4559 for (i = 0; i < max_f_idx; i++)
4561 /* Access the index */
4562 feature_type *f_ptr = &f_info[i];
4564 /* Skip empty index */
4565 if (!f_ptr->name) continue;
4567 /* Skip mimiccing features */
4568 if (f_ptr->mimic != i) continue;
4571 feat_idx[feat_cnt++] = i;
4573 /* XXX Hack -- Just checking for non-empty group */
4574 if (mode & 0x01) break;
4577 /* Terminate the list */
4578 feat_idx[feat_cnt] = -1;
4580 /* Return the number of races */
4587 * Build a list of monster indexes in the given group. Return the number
4588 * of monsters in the group.
4590 static int collect_artifacts(int grp_cur, int object_idx[])
4592 int i, object_cnt = 0;
4594 /* Get a list of x_char in this group */
4595 byte group_tval = object_group_tval[grp_cur];
4597 /* Check every object */
4598 for (i = 0; i < max_a_idx; i++)
4600 /* Access the artifact */
4601 artifact_type *a_ptr = &a_info[i];
4603 /* Skip empty artifacts */
4604 if (!a_ptr->name) continue;
4606 /* Skip "uncreated" artifacts */
4607 if (!a_ptr->cur_num) continue;
4609 /* Check for race in the group */
4610 if (a_ptr->tval == group_tval)
4613 object_idx[object_cnt++] = i;
4617 /* Terminate the list */
4618 object_idx[object_cnt] = 0;
4620 /* Return the number of races */
4627 * Encode the screen colors
4629 static char hack[17] = "dwsorgbuDWvyRGBU";
4633 * Hack -- load a screen dump from a file
4635 void do_cmd_load_screen(void)
4650 Term_get_size(&wid, &hgt);
4652 /* Build the filename */
4653 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
4655 /* Append to the file */
4656 fff = my_fopen(buf, "r");
4659 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
4665 /* Save the screen */
4668 /* Clear the screen */
4672 /* Load the screen */
4673 for (y = 0; okay; y++)
4675 /* Get a line of data including control code */
4676 if (!fgets(buf, 1024, fff)) okay = FALSE;
4678 /* Get the blank line */
4679 if (buf[0] == '\n' || buf[0] == '\0') break;
4681 /* Ignore too large screen image */
4682 if (y >= hgt) continue;
4685 for (x = 0; x < wid - 1; x++)
4688 if (buf[x] == '\n' || buf[x] == '\0') break;
4690 /* Put the attr/char */
4691 Term_draw(x, y, TERM_WHITE, buf[x]);
4695 /* Dump the screen */
4696 for (y = 0; okay; y++)
4698 /* Get a line of data including control code */
4699 if (!fgets(buf, 1024, fff)) okay = FALSE;
4701 /* Get the blank line */
4702 if (buf[0] == '\n' || buf[0] == '\0') break;
4704 /* Ignore too large screen image */
4705 if (y >= hgt) continue;
4708 for (x = 0; x < wid - 1; x++)
4711 if (buf[x] == '\n' || buf[x] == '\0') break;
4713 /* Get the attr/char */
4714 (void)(Term_what(x, y, &a, &c));
4716 /* Look up the attr */
4717 for (i = 0; i < 16; i++)
4719 /* Use attr matches */
4720 if (hack[i] == buf[x]) a = (byte_hack)i;
4723 /* Put the attr/char */
4724 Term_draw(x, y, a, c);
4733 prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
4739 /* Restore the screen */
4746 cptr inven_res_label = _(" 酸電火冷毒光闇破轟獄因沌劣 盲怖乱痺透命感消復浮",
4747 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv");
4750 #define IM_FLAG_STR _("*", "* ")
4751 #define HAS_FLAG_STR _("+", "+ ")
4752 #define NO_FLAG_STR _("・", ". ")
4754 #define print_im_or_res_flag(IM, RES) \
4756 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
4757 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
4760 #define print_flag(TR) \
4762 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
4766 /* XTRA HACK RESLIST */
4767 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, OBJECT_TYPE_VALUE tval, char *where)
4769 char o_name[MAX_NLEN];
4770 BIT_FLAGS flgs[TR_FLAG_SIZE];
4772 if (!o_ptr->k_idx) return;
4773 if (o_ptr->tval != tval) return;
4775 /* Identified items only */
4776 if (!object_is_known(o_ptr)) return;
4779 * HACK:Ring of Lordly protection and Dragon equipment
4780 * have random resistances.
4782 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
4783 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
4784 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
4785 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
4786 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
4787 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
4788 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
4789 || object_is_artifact(o_ptr))
4792 object_desc(o_name, o_ptr, OD_NAME_ONLY);
4794 while (o_name[i] && (i < 26))
4797 if (iskanji(o_name[i])) i++;
4806 o_name[i] = ' '; i++;
4811 fprintf(fff, "%s %s", where, o_name);
4813 if (!(o_ptr->ident & (IDENT_MENTAL)))
4815 fputs(_("-------不明--------------- -------不明---------\n",
4816 "-------unknown------------ -------unknown------\n"), fff);
4820 object_flags_known(o_ptr, flgs);
4822 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
4823 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
4824 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
4825 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
4826 print_flag(TR_RES_POIS);
4827 print_flag(TR_RES_LITE);
4828 print_flag(TR_RES_DARK);
4829 print_flag(TR_RES_SHARDS);
4830 print_flag(TR_RES_SOUND);
4831 print_flag(TR_RES_NETHER);
4832 print_flag(TR_RES_NEXUS);
4833 print_flag(TR_RES_CHAOS);
4834 print_flag(TR_RES_DISEN);
4838 print_flag(TR_RES_BLIND);
4839 print_flag(TR_RES_FEAR);
4840 print_flag(TR_RES_CONF);
4841 print_flag(TR_FREE_ACT);
4842 print_flag(TR_SEE_INVIS);
4843 print_flag(TR_HOLD_EXP);
4844 print_flag(TR_TELEPATHY);
4845 print_flag(TR_SLOW_DIGEST);
4846 print_flag(TR_REGEN);
4847 print_flag(TR_LEVITATION);
4855 fprintf(fff, "%s\n", inven_res_label);
4861 * Display *ID* ed weapons/armors's resistances
4863 static void do_cmd_knowledge_inven(void)
4867 char file_name[1024];
4871 OBJECT_TYPE_VALUE tval;
4877 /* Open a new file */
4878 fff = my_fopen_temp(file_name, 1024);
4881 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4885 fprintf(fff, "%s\n", inven_res_label);
4887 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
4891 for (; j < 9; j++) fputc('\n', fff);
4893 fprintf(fff, "%s\n", inven_res_label);
4895 strcpy(where, _("装", "E "));
4896 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4898 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4900 strcpy(where, _("持", "I "));
4901 for (i = 0; i < INVEN_PACK; i++)
4903 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4906 st_ptr = &town[1].store[STORE_HOME];
4907 strcpy(where, _("家", "H "));
4908 for (i = 0; i < st_ptr->stock_num; i++)
4910 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
4914 /* Close the file */
4917 /* Display the file contents */
4918 show_file(TRUE, file_name, _("*鑑定*済み武器/防具の耐性リスト", "Resistances of *identified* equipment"), 0, 0);
4920 /* Remove the file */
4925 void do_cmd_save_screen_html_aux(char *filename, int message)
4929 TERM_COLOR a = 0, old_a = 0;
4943 cptr html_head[] = {
4944 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
4948 cptr html_foot[] = {
4950 "</body>\n</html>\n",
4956 Term_get_size(&wid, &hgt);
4958 /* File type is "TEXT" */
4959 FILE_TYPE(FILE_TYPE_TEXT);
4961 /* Append to the file */
4962 fff = my_fopen(filename, "w");
4966 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename);
4973 /* Save the screen */
4977 /* Build the filename */
4978 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
4979 tmpfff = my_fopen(buf, "r");
4981 for (i = 0; html_head[i]; i++)
4982 fputs(html_head[i], fff);
4986 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
4988 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
4992 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
4994 fprintf(fff, "%s\n", buf);
4999 /* Dump the screen */
5000 for (y = 0; y < hgt; y++)
5007 for (x = 0; x < wid - 1; x++)
5011 /* Get the attr/char */
5012 (void)(Term_what(x, y, &a, &c));
5016 case '&': cc = "&"; break;
5017 case '<': cc = "<"; break;
5018 case '>': cc = ">"; break;
5020 case 0x1f: c = '.'; break;
5021 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5026 if ((y == 0 && x == 0) || a != old_a) {
5027 rv = angband_color_table[a][1];
5028 gv = angband_color_table[a][2];
5029 bv = angband_color_table[a][3];
5030 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5031 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
5035 fprintf(fff, "%s", cc);
5037 fprintf(fff, "%c", c);
5040 fprintf(fff, "</font>");
5043 for (i = 0; html_foot[i]; i++)
5044 fputs(html_foot[i], fff);
5049 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5051 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
5055 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
5057 fprintf(fff, "%s\n", buf);
5070 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5074 /* Restore the screen */
5080 * Hack -- save a screen dump to a file
5082 static void do_cmd_save_screen_html(void)
5084 char buf[1024], tmp[256] = "screen.html";
5086 if (!get_string(_("ファイル名: ", "File name: "), tmp, 80))
5089 /* Build the filename */
5090 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
5094 do_cmd_save_screen_html_aux(buf, 1);
5099 * Redefinable "save_screen" action
5101 void (*screendump_aux)(void) = NULL;
5105 * Hack -- save a screen dump to a file
5107 void do_cmd_save_screen(void)
5109 bool old_use_graphics = use_graphics;
5110 bool html_dump = FALSE;
5114 prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
5118 if (c == 'Y' || c == 'y')
5120 else if (c == 'H' || c == 'h')
5132 Term_get_size(&wid, &hgt);
5134 if (old_use_graphics)
5136 use_graphics = FALSE;
5139 /* Redraw everything */
5140 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5142 /* Hack -- update */
5148 do_cmd_save_screen_html();
5152 /* Do we use a special screendump function ? */
5153 else if (screendump_aux)
5155 /* Dump the screen to a graphics file */
5156 (*screendump_aux)();
5158 else /* Dump the screen as text */
5169 /* Build the filename */
5170 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5172 /* File type is "TEXT" */
5173 FILE_TYPE(FILE_TYPE_TEXT);
5175 /* Append to the file */
5176 fff = my_fopen(buf, "w");
5180 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
5186 /* Save the screen */
5190 /* Dump the screen */
5191 for (y = 0; y < hgt; y++)
5194 for (x = 0; x < wid - 1; x++)
5196 /* Get the attr/char */
5197 (void)(Term_what(x, y, &a, &c));
5207 fprintf(fff, "%s\n", buf);
5214 /* Dump the screen */
5215 for (y = 0; y < hgt; y++)
5218 for (x = 0; x < wid - 1; x++)
5220 /* Get the attr/char */
5221 (void)(Term_what(x, y, &a, &c));
5224 buf[x] = hack[a&0x0F];
5231 fprintf(fff, "%s\n", buf);
5241 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5244 /* Restore the screen */
5248 if (old_use_graphics)
5250 use_graphics = TRUE;
5253 /* Redraw everything */
5254 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5256 /* Hack -- update */
5263 * Sorting hook -- Comp function -- see below
5265 * We use "u" to point to array of monster indexes,
5266 * and "v" to select the type of sorting to perform on "u".
5268 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
5270 u16b *who = (u16b*)(u);
5272 u16b *why = (u16b*)(v);
5279 /* Sort by total kills */
5282 /* Extract total kills */
5283 z1 = a_info[w1].tval;
5284 z2 = a_info[w2].tval;
5286 /* Compare total kills */
5287 if (z1 < z2) return (TRUE);
5288 if (z1 > z2) return (FALSE);
5292 /* Sort by monster level */
5295 /* Extract levels */
5296 z1 = a_info[w1].sval;
5297 z2 = a_info[w2].sval;
5299 /* Compare levels */
5300 if (z1 < z2) return (TRUE);
5301 if (z1 > z2) return (FALSE);
5305 /* Sort by monster experience */
5308 /* Extract experience */
5309 z1 = a_info[w1].level;
5310 z2 = a_info[w2].level;
5312 /* Compare experience */
5313 if (z1 < z2) return (TRUE);
5314 if (z1 > z2) return (FALSE);
5318 /* Compare indexes */
5324 * Sorting hook -- Swap function -- see below
5326 * We use "u" to point to array of monster indexes,
5327 * and "v" to select the type of sorting to perform.
5329 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
5331 u16b *who = (u16b*)(u);
5346 * Check the status of "artifacts"
5348 static void do_cmd_knowledge_artifacts(void)
5360 char file_name[1024];
5362 char base_name[MAX_NLEN];
5366 /* Open a new file */
5367 fff = my_fopen_temp(file_name, 1024);
5370 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5375 /* Allocate the "who" array */
5376 C_MAKE(who, max_a_idx, s16b);
5378 /* Allocate the "okay" array */
5379 C_MAKE(okay, max_a_idx, bool);
5381 /* Scan the artifacts */
5382 for (k = 0; k < max_a_idx; k++)
5384 artifact_type *a_ptr = &a_info[k];
5389 /* Skip "empty" artifacts */
5390 if (!a_ptr->name) continue;
5392 /* Skip "uncreated" artifacts */
5393 if (!a_ptr->cur_num) continue;
5399 /* Check the dungeon */
5400 for (y = 0; y < cur_hgt; y++)
5402 for (x = 0; x < cur_wid; x++)
5404 cave_type *c_ptr = &cave[y][x];
5406 OBJECT_IDX this_o_idx, next_o_idx = 0;
5408 /* Scan all objects in the grid */
5409 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
5413 /* Acquire object */
5414 o_ptr = &o_list[this_o_idx];
5416 /* Acquire next object */
5417 next_o_idx = o_ptr->next_o_idx;
5419 /* Ignore non-artifacts */
5420 if (!object_is_fixed_artifact(o_ptr)) continue;
5422 /* Ignore known items */
5423 if (object_is_known(o_ptr)) continue;
5425 /* Note the artifact */
5426 okay[o_ptr->name1] = FALSE;
5431 /* Check the inventory and equipment */
5432 for (i = 0; i < INVEN_TOTAL; i++)
5434 object_type *o_ptr = &inventory[i];
5436 /* Ignore non-objects */
5437 if (!o_ptr->k_idx) continue;
5439 /* Ignore non-artifacts */
5440 if (!object_is_fixed_artifact(o_ptr)) continue;
5442 /* Ignore known items */
5443 if (object_is_known(o_ptr)) continue;
5445 /* Note the artifact */
5446 okay[o_ptr->name1] = FALSE;
5449 for (k = 0; k < max_a_idx; k++)
5451 if (okay[k]) who[n++] = k;
5454 /* Select the sort method */
5455 ang_sort_comp = ang_sort_art_comp;
5456 ang_sort_swap = ang_sort_art_swap;
5458 /* Sort the array by dungeon depth of monsters */
5459 ang_sort(who, &why, n);
5461 /* Scan the artifacts */
5462 for (k = 0; k < n; k++)
5464 artifact_type *a_ptr = &a_info[who[k]];
5467 strcpy(base_name, _("未知の伝説のアイテム", "Unknown Artifact"));
5469 /* Obtain the base object type */
5470 z = lookup_kind(a_ptr->tval, a_ptr->sval);
5478 /* Get local object */
5481 /* Create fake object */
5482 object_prep(q_ptr, z);
5484 /* Make it an artifact */
5485 q_ptr->name1 = (byte)who[k];
5487 /* Display as if known */
5488 q_ptr->ident |= IDENT_STORE;
5490 /* Describe the artifact */
5491 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5494 /* Hack -- Build the artifact name */
5495 fprintf(fff, _(" %s\n", " The %s\n"), base_name);
5498 /* Free the "who" array */
5499 C_KILL(who, max_a_idx, s16b);
5501 /* Free the "okay" array */
5502 C_KILL(okay, max_a_idx, bool);
5504 /* Close the file */
5507 /* Display the file contents */
5508 show_file(TRUE, file_name, _("既知の伝説のアイテム", "Artifacts Seen"), 0, 0);
5510 /* Remove the file */
5516 * Display known uniques
5517 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
5519 static void do_cmd_knowledge_uniques(void)
5528 char file_name[1024];
5531 int n_alive_surface = 0;
5532 int n_alive_over100 = 0;
5533 int n_alive_total = 0;
5536 for (i = 0; i < 10; i++) n_alive[i] = 0;
5538 /* Open a new file */
5539 fff = my_fopen_temp(file_name, 1024);
5543 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5548 /* Allocate the "who" array */
5549 C_MAKE(who, max_r_idx, s16b);
5551 /* Scan the monsters */
5552 for (i = 1; i < max_r_idx; i++)
5554 monster_race *r_ptr = &r_info[i];
5557 if (!r_ptr->name) continue;
5559 /* Require unique monsters */
5560 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5562 /* Only display "known" uniques */
5563 if (!cheat_know && !r_ptr->r_sights) continue;
5565 /* Only print rarity <= 100 uniques */
5566 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
5568 /* Only "alive" uniques */
5569 if (r_ptr->max_num == 0) continue;
5573 lev = (r_ptr->level - 1) / 10;
5577 if (max_lev < lev) max_lev = lev;
5579 else n_alive_over100++;
5581 else n_alive_surface++;
5583 /* Collect "appropriate" monsters */
5587 /* Select the sort method */
5588 ang_sort_comp = ang_sort_comp_hook;
5589 ang_sort_swap = ang_sort_swap_hook;
5591 /* Sort the array by dungeon depth of monsters */
5592 ang_sort(who, &why, n);
5594 if (n_alive_surface)
5596 fprintf(fff, _(" 地上 生存: %3d体\n", " Surface alive: %3d\n"), n_alive_surface);
5597 n_alive_total += n_alive_surface;
5599 for (i = 0; i <= max_lev; i++)
5601 fprintf(fff, _("%3d-%3d階 生存: %3d体\n", "Level %3d-%3d alive: %3d\n"), 1 + i * 10, 10 + i * 10, n_alive[i]);
5602 n_alive_total += n_alive[i];
5604 if (n_alive_over100)
5606 fprintf(fff, _("101- 階 生存: %3d体\n", "Level 101- alive: %3d\n"), n_alive_over100);
5607 n_alive_total += n_alive_over100;
5612 fputs(_("--------- -----------\n", "------------- ----------\n"), fff);
5613 fprintf(fff, _(" 合計 生存: %3d体\n\n", " Total alive: %3d\n\n"), n_alive_total);
5617 fputs(_("現在は既知の生存ユニークはいません。\n", "No known uniques alive.\n"), fff);
5620 /* Scan the monster races */
5621 for (k = 0; k < n; k++)
5623 monster_race *r_ptr = &r_info[who[k]];
5625 fprintf(fff, _(" %s (レベル%d)\n", " %s (level %d)\n"), r_name + r_ptr->name, (int)r_ptr->level);
5628 /* Free the "who" array */
5629 C_KILL(who, max_r_idx, s16b);
5631 /* Close the file */
5634 /* Display the file contents */
5635 show_file(TRUE, file_name, _("まだ生きているユニーク・モンスター", "Alive Uniques"), 0, 0);
5637 /* Remove the file */
5643 * Display weapon-exp
5645 static void do_cmd_knowledge_weapon_exp(void)
5647 int i, num, weapon_exp;
5652 char file_name[1024];
5655 /* Open a new file */
5656 fff = my_fopen_temp(file_name, 1024);
5658 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5663 for (i = 0; i < 5; i++)
5665 for (num = 0; num < 64; num++)
5667 for (j = 0; j < max_k_idx; j++)
5669 object_kind *k_ptr = &k_info[j];
5671 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
5673 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON || k_ptr->sval == SV_HARP)) continue;
5675 weapon_exp = p_ptr->weapon_exp[4 - i][num];
5677 fprintf(fff, "%-25s ", tmp);
5678 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
5679 else fprintf(fff, " ");
5680 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
5681 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
5689 /* Close the file */
5692 /* Display the file contents */
5693 show_file(TRUE, file_name, _("武器の経験値", "Weapon Proficiency"), 0, 0);
5695 /* Remove the file */
5701 * @brief 魔法の経験値を表示するコマンドのメインルーチン
5705 static void do_cmd_knowledge_spell_exp(void)
5708 int spell_exp, exp_level;
5711 const magic_type *s_ptr;
5713 char file_name[1024];
5715 /* Open a new file */
5716 fff = my_fopen_temp(file_name, 1024);
5718 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5723 if (p_ptr->realm1 != REALM_NONE)
5725 fprintf(fff, _("%sの魔法書\n", "%s Spellbook\n"), realm_names[p_ptr->realm1]);
5726 for (i = 0; i < 32; i++)
5728 if (!is_magic(p_ptr->realm1))
5730 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
5734 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
5736 if (s_ptr->slevel >= 99) continue;
5737 spell_exp = p_ptr->spell_exp[i];
5738 exp_level = spell_exp_level(spell_exp);
5739 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
5740 if (p_ptr->realm1 == REALM_HISSATSU)
5741 fprintf(fff, "[--]");
5744 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
5745 else fprintf(fff, " ");
5746 fprintf(fff, "%s", exp_level_str[exp_level]);
5748 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5753 if (p_ptr->realm2 != REALM_NONE)
5755 fprintf(fff, _("%sの魔法書\n", "\n%s Spellbook\n"), realm_names[p_ptr->realm2]);
5756 for (i = 0; i < 32; i++)
5758 if (!is_magic(p_ptr->realm1))
5760 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
5764 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
5766 if (s_ptr->slevel >= 99) continue;
5768 spell_exp = p_ptr->spell_exp[i + 32];
5769 exp_level = spell_exp_level(spell_exp);
5770 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
5771 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
5772 else fprintf(fff, " ");
5773 fprintf(fff, "%s", exp_level_str[exp_level]);
5774 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5779 /* Close the file */
5782 /* Display the file contents */
5783 show_file(TRUE, file_name, _("魔法の経験値", "Spell Proficiency"), 0, 0);
5785 /* Remove the file */
5791 * @brief スキル情報を表示するコマンドのメインルーチン /
5795 static void do_cmd_knowledge_skill_exp(void)
5797 int i = 0, skill_exp;
5801 char file_name[1024];
5802 char skill_name[3][20]={_("マーシャルアーツ", "Martial Arts "),
5803 _("二刀流 ", "Dual Wielding "),
5804 _("乗馬 ", "Riding ")};
5806 /* Open a new file */
5807 fff = my_fopen_temp(file_name, 1024);
5809 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5814 for (i = 0; i < 3; i++)
5816 skill_exp = p_ptr->skill_exp[i];
5817 fprintf(fff, "%-20s ", skill_name[i]);
5818 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
5819 else fprintf(fff, " ");
5820 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
5821 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
5825 /* Close the file */
5828 /* Display the file contents */
5829 show_file(TRUE, file_name, _("技能の経験値", "Miscellaneous Proficiency"), 0, 0);
5831 /* Remove the file */
5837 * @brief 英単語、句、説を複数形を変換する / Pluralize a monster name
5838 * @param Name 変換したい文字列の参照ポインタ
5841 void plural_aux(char *Name)
5843 int NameLen = strlen(Name);
5845 if (my_strstr(Name, "Disembodied hand"))
5847 strcpy(Name, "Disembodied hands that strangled people");
5849 else if (my_strstr(Name, "Colour out of space"))
5851 strcpy(Name, "Colours out of space");
5853 else if (my_strstr(Name, "stairway to hell"))
5855 strcpy(Name, "stairways to hell");
5857 else if (my_strstr(Name, "Dweller on the threshold"))
5859 strcpy(Name, "Dwellers on the threshold");
5861 else if (my_strstr(Name, " of "))
5863 cptr aider = my_strstr(Name, " of ");
5874 if (dummy[i-1] == 's')
5876 strcpy(&(dummy[i]), "es");
5881 strcpy(&(dummy[i]), "s");
5884 strcpy(&(dummy[i+1]), aider);
5885 strcpy(Name, dummy);
5887 else if (my_strstr(Name, "coins"))
5890 strcpy(dummy, "piles of ");
5891 strcat(dummy, Name);
5892 strcpy(Name, dummy);
5895 else if (my_strstr(Name, "Manes"))
5899 else if (streq(&(Name[NameLen - 2]), "ey"))
5901 strcpy(&(Name[NameLen - 2]), "eys");
5903 else if (Name[NameLen - 1] == 'y')
5905 strcpy(&(Name[NameLen - 1]), "ies");
5907 else if (streq(&(Name[NameLen - 4]), "ouse"))
5909 strcpy(&(Name[NameLen - 4]), "ice");
5911 else if (streq(&(Name[NameLen - 2]), "us"))
5913 strcpy(&(Name[NameLen - 2]), "i");
5915 else if (streq(&(Name[NameLen - 6]), "kelman"))
5917 strcpy(&(Name[NameLen - 6]), "kelmen");
5919 else if (streq(&(Name[NameLen - 8]), "wordsman"))
5921 strcpy(&(Name[NameLen - 8]), "wordsmen");
5923 else if (streq(&(Name[NameLen - 7]), "oodsman"))
5925 strcpy(&(Name[NameLen - 7]), "oodsmen");
5927 else if (streq(&(Name[NameLen - 7]), "eastman"))
5929 strcpy(&(Name[NameLen - 7]), "eastmen");
5931 else if (streq(&(Name[NameLen - 8]), "izardman"))
5933 strcpy(&(Name[NameLen - 8]), "izardmen");
5935 else if (streq(&(Name[NameLen - 5]), "geist"))
5937 strcpy(&(Name[NameLen - 5]), "geister");
5939 else if (streq(&(Name[NameLen - 2]), "ex"))
5941 strcpy(&(Name[NameLen - 2]), "ices");
5943 else if (streq(&(Name[NameLen - 2]), "lf"))
5945 strcpy(&(Name[NameLen - 2]), "lves");
5947 else if (suffix(Name, "ch") ||
5948 suffix(Name, "sh") ||
5949 suffix(Name, "nx") ||
5950 suffix(Name, "s") ||
5953 strcpy(&(Name[NameLen]), "es");
5957 strcpy(&(Name[NameLen]), "s");
5962 * @brief 現在のペットを表示するコマンドのメインルーチン /
5963 * Display current pets
5966 static void do_cmd_knowledge_pets(void)
5970 monster_type *m_ptr;
5973 int show_upkeep = 0;
5974 char file_name[1024];
5977 /* Open a new file */
5978 fff = my_fopen_temp(file_name, 1024);
5980 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5985 /* Process the monsters (backwards) */
5986 for (i = m_max - 1; i >= 1; i--)
5988 /* Access the monster */
5991 /* Ignore "dead" monsters */
5992 if (!m_ptr->r_idx) continue;
5994 /* Calculate "upkeep" for pets */
5998 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
5999 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
6003 show_upkeep = calculate_upkeep();
6005 fprintf(fff, "----------------------------------------------\n");
6007 fprintf(fff, " 合計: %d 体のペット\n", t_friends);
6008 fprintf(fff, " 維持コスト: %d%% MP\n", show_upkeep);
6010 fprintf(fff, " Total: %d pet%s.\n",
6011 t_friends, (t_friends == 1 ? "" : "s"));
6012 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
6017 /* Close the file */
6020 /* Display the file contents */
6021 show_file(TRUE, file_name, _("現在のペット", "Current Pets"), 0, 0);
6023 /* Remove the file */
6029 * @brief 現在のペットを表示するコマンドのメインルーチン /
6032 * @note the player ghosts are ignored.
6034 static void do_cmd_knowledge_kill_count(void)
6043 char file_name[1024];
6048 /* Open a new file */
6049 fff = my_fopen_temp(file_name, 1024);
6052 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6057 /* Allocate the "who" array */
6058 C_MAKE(who, max_r_idx, s16b);
6061 /* Monsters slain */
6064 for (kk = 1; kk < max_r_idx; kk++)
6066 monster_race *r_ptr = &r_info[kk];
6068 if (r_ptr->flags1 & (RF1_UNIQUE))
6070 bool dead = (r_ptr->max_num == 0);
6079 MONSTER_NUMBER This = r_ptr->r_pkills;
6089 fprintf(fff,_("あなたはまだ敵を倒していない。\n\n", "You have defeated no enemies yet.\n\n"));
6092 fprintf(fff,"あなたは%ld体の敵を倒している。\n\n", (long int)Total);
6094 fprintf(fff,"You have defeated %ld %s.\n\n", (long int)Total, (Total == 1) ? "enemy" : "enemies");
6100 /* Scan the monsters */
6101 for (i = 1; i < max_r_idx; i++)
6103 monster_race *r_ptr = &r_info[i];
6105 /* Use that monster */
6106 if (r_ptr->name) who[n++] = i;
6109 /* Select the sort method */
6110 ang_sort_comp = ang_sort_comp_hook;
6111 ang_sort_swap = ang_sort_swap_hook;
6113 /* Sort the array by dungeon depth of monsters */
6114 ang_sort(who, &why, n);
6116 /* Scan the monster races */
6117 for (k = 0; k < n; k++)
6119 monster_race *r_ptr = &r_info[who[k]];
6121 if (r_ptr->flags1 & (RF1_UNIQUE))
6123 bool dead = (r_ptr->max_num == 0);
6127 fprintf(fff, " %s\n", (r_name + r_ptr->name));
6133 MONSTER_NUMBER This = r_ptr->r_pkills;
6138 /* p,tは人と数える by ita */
6139 if (my_strchr("pt", r_ptr->d_char))
6140 fprintf(fff, " %3d 人の %s\n", (int)This, r_name + r_ptr->name);
6142 fprintf(fff, " %3d 体の %s\n", (int)This, r_name + r_ptr->name);
6146 if (my_strstr(r_name + r_ptr->name, "coins"))
6148 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
6152 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
6158 strcpy(ToPlural, (r_name + r_ptr->name));
6159 plural_aux(ToPlural);
6160 fprintf(fff, " %d %s\n", This, ToPlural);
6170 fprintf(fff,"----------------------------------------------\n");
6172 fprintf(fff," 合計: %lu 体を倒した。\n", (unsigned long int)Total);
6174 fprintf(fff," Total: %lu creature%s killed.\n", (unsigned long int)Total, (Total == 1 ? "" : "s"));
6178 /* Free the "who" array */
6179 C_KILL(who, max_r_idx, s16b);
6181 /* Close the file */
6184 /* Display the file contents */
6185 show_file(TRUE, file_name, _("倒した敵の数", "Kill Count"), 0, 0);
6187 /* Remove the file */
6193 * @brief モンスター情報リスト中のグループを表示する /
6194 * Display the object groups.
6198 * @param per_page リストの表示行
6199 * @param grp_idx グループのID配列
6200 * @param group_text グループ名の文字列配列
6201 * @param grp_cur 現在の選択ID
6202 * @param grp_top 現在の選択リスト最上部ID
6205 static void display_group_list(int col, int row, int wid, int per_page, IDX grp_idx[], cptr group_text[], int grp_cur, int grp_top)
6209 /* Display lines until done */
6210 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
6212 /* Get the group index */
6213 int grp = grp_idx[grp_top + i];
6215 /* Choose a color */
6216 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
6218 /* Erase the entire line */
6219 Term_erase(col, row + i, wid);
6221 /* Display the group label */
6222 c_put_str(attr, group_text[grp], row + i, col);
6228 * Move the cursor in a browser window
6230 static void browser_cursor(char ch, int *column, IDX *grp_cur, int grp_cnt,
6231 IDX *list_cur, int list_cnt)
6236 IDX list = *list_cur;
6238 /* Extract direction */
6241 /* Hack -- scroll up full screen */
6246 /* Hack -- scroll down full screen */
6251 d = get_keymap_dir(ch);
6256 /* Diagonals - hack */
6257 if ((ddx[d] > 0) && ddy[d])
6262 Term_get_size(&wid, &hgt);
6264 browser_rows = hgt - 8;
6266 /* Browse group list */
6271 /* Move up or down */
6272 grp += ddy[d] * (browser_rows - 1);
6275 if (grp >= grp_cnt) grp = grp_cnt - 1;
6276 if (grp < 0) grp = 0;
6277 if (grp != old_grp) list = 0;
6280 /* Browse sub-list list */
6283 /* Move up or down */
6284 list += ddy[d] * browser_rows;
6287 if (list >= list_cnt) list = list_cnt - 1;
6288 if (list < 0) list = 0;
6300 if (col < 0) col = 0;
6301 if (col > 1) col = 1;
6308 /* Browse group list */
6313 /* Move up or down */
6317 if (grp >= grp_cnt) grp = grp_cnt - 1;
6318 if (grp < 0) grp = 0;
6319 if (grp != old_grp) list = 0;
6322 /* Browse sub-list list */
6325 /* Move up or down */
6329 if (list >= list_cnt) list = list_cnt - 1;
6330 if (list < 0) list = 0;
6341 static void display_visual_list(int col, int row, int height, int width, TERM_COLOR attr_top, byte char_left)
6345 /* Clear the display lines */
6346 for (i = 0; i < height; i++)
6348 Term_erase(col, row + i, width);
6351 /* Bigtile mode uses double width */
6352 if (use_bigtile) width /= 2;
6354 /* Display lines until done */
6355 for (i = 0; i < height; i++)
6357 /* Display columns until done */
6358 for (j = 0; j < width; j++)
6362 TERM_LEN x = col + j;
6363 TERM_LEN y = row + i;
6366 /* Bigtile mode uses double width */
6367 if (use_bigtile) x += j;
6372 /* Ignore illegal characters */
6373 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
6374 (!use_graphics && ic > 0x7f))
6380 /* Force correct code for both ASCII character and tile */
6381 if (c & 0x80) a |= 0x80;
6383 /* Display symbol */
6384 Term_queue_bigchar(x, y, a, c, 0, 0);
6391 * Place the cursor at the collect position for visual mode
6393 static void place_visual_list_cursor(TERM_LEN col, TERM_LEN row, TERM_COLOR a, byte c, TERM_COLOR attr_top, byte char_left)
6395 int i = (a & 0x7f) - attr_top;
6396 int j = c - char_left;
6398 TERM_LEN x = col + j;
6399 TERM_LEN y = row + i;
6401 /* Bigtile mode uses double width */
6402 if (use_bigtile) x += j;
6404 /* Place the cursor */
6410 * Clipboard variables for copy&paste in visual mode
6412 static TERM_COLOR attr_idx = 0;
6413 static byte char_idx = 0;
6415 /* Hack -- for feature lighting */
6416 static TERM_COLOR attr_idx_feat[F_LIT_MAX];
6417 static byte char_idx_feat[F_LIT_MAX];
6420 * Do visual mode command -- Change symbols
6422 static bool visual_mode_command(char ch, bool *visual_list_ptr,
6423 int height, int width,
6424 TERM_COLOR *attr_top_ptr, byte *char_left_ptr,
6425 TERM_COLOR *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
6427 static TERM_COLOR attr_old = 0;
6428 static byte char_old = 0;
6433 if (*visual_list_ptr)
6436 *cur_attr_ptr = attr_old;
6437 *cur_char_ptr = char_old;
6438 *visual_list_ptr = FALSE;
6446 if (*visual_list_ptr)
6449 *visual_list_ptr = FALSE;
6450 *need_redraw = TRUE;
6458 if (!*visual_list_ptr)
6460 *visual_list_ptr = TRUE;
6462 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6463 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6465 attr_old = *cur_attr_ptr;
6466 char_old = *cur_char_ptr;
6477 /* Set the visual */
6478 attr_idx = *cur_attr_ptr;
6479 char_idx = *cur_char_ptr;
6481 /* Hack -- for feature lighting */
6482 for (i = 0; i < F_LIT_MAX; i++)
6484 attr_idx_feat[i] = 0;
6485 char_idx_feat[i] = 0;
6492 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
6495 *cur_attr_ptr = attr_idx;
6496 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6497 if (!*visual_list_ptr) *need_redraw = TRUE;
6503 *cur_char_ptr = char_idx;
6504 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6505 if (!*visual_list_ptr) *need_redraw = TRUE;
6511 if (*visual_list_ptr)
6514 int d = get_keymap_dir(ch);
6515 byte a = (*cur_attr_ptr & 0x7f);
6516 byte c = *cur_char_ptr;
6518 if (use_bigtile) eff_width = width / 2;
6519 else eff_width = width;
6521 /* Restrict direction */
6522 if ((a == 0) && (ddy[d] < 0)) d = 0;
6523 if ((c == 0) && (ddx[d] < 0)) d = 0;
6524 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
6525 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
6530 /* Force correct code for both ASCII character and tile */
6531 if (c & 0x80) a |= 0x80;
6533 /* Set the visual */
6538 /* Move the frame */
6539 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
6540 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
6541 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
6542 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
6548 /* Visual mode command is not used */
6554 * Display the monsters in a group.
6556 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
6557 int mon_cur, int mon_top, bool visual_only)
6561 /* Display lines until done */
6562 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
6566 /* Get the race index */
6567 MONRACE_IDX r_idx = mon_idx[mon_top + i] ;
6569 /* Access the race */
6570 monster_race *r_ptr = &r_info[r_idx];
6572 /* Choose a color */
6573 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
6575 /* Display the name */
6576 c_prt(attr, (r_name + r_ptr->name), row + i, col);
6578 /* Hack -- visual_list mode */
6581 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
6583 if (p_ptr->wizard || visual_only)
6585 c_prt(attr, format("%d", r_idx), row + i, 62);
6588 /* Erase chars before overwritten by the race letter */
6589 Term_erase(69, row + i, 255);
6591 /* Display symbol */
6592 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
6597 if (!(r_ptr->flags1 & RF1_UNIQUE))
6598 put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
6600 c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE),
6601 (r_ptr->max_num == 0 ? _("死亡", " dead") : _("生存", "alive")), row + i, 74);
6605 /* Clear remaining lines */
6606 for (; i < per_page; i++)
6608 Term_erase(col, row + i, 255);
6614 * Display known monsters.
6616 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx)
6620 IDX grp_cur, grp_top, old_grp_cur;
6621 IDX mon_cur, mon_top;
6622 IDX grp_cnt, grp_idx[100];
6630 bool visual_list = FALSE;
6631 TERM_COLOR attr_top = 0;
6639 Term_get_size(&wid, &hgt);
6641 browser_rows = hgt - 8;
6643 /* Allocate the "mon_idx" array */
6644 C_MAKE(mon_idx, max_r_idx, s16b);
6649 if (direct_r_idx < 0)
6651 mode = visual_only ? 0x03 : 0x01;
6653 /* Check every group */
6654 for (i = 0; monster_group_text[i] != NULL; i++)
6656 /* Measure the label */
6657 len = strlen(monster_group_text[i]);
6659 /* Save the maximum length */
6660 if (len > max) max = len;
6662 /* See if any monsters are known */
6663 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
6665 /* Build a list of groups with known monsters */
6666 grp_idx[grp_cnt++] = i;
6674 mon_idx[0] = direct_r_idx;
6677 /* Terminate the list */
6680 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
6681 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
6684 /* Terminate the list */
6685 grp_idx[grp_cnt] = -1;
6688 grp_cur = grp_top = 0;
6689 mon_cur = mon_top = 0;
6694 mode = visual_only ? 0x02 : 0x00;
6699 monster_race *r_ptr;
6706 prt(format("%s - モンスター", !visual_only ? "知識" : "表示"), 2, 0);
6707 if (direct_r_idx < 0) prt("グループ", 4, 0);
6708 prt("名前", 4, max + 3);
6709 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6711 if (!visual_only) prt("殺害数", 4, 72);
6713 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
6714 if (direct_r_idx < 0) prt("Group", 4, 0);
6715 prt("Name", 4, max + 3);
6716 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6718 if (!visual_only) prt("Kills", 4, 73);
6721 for (i = 0; i < 78; i++)
6723 Term_putch(i, 5, TERM_WHITE, '=');
6726 if (direct_r_idx < 0)
6728 for (i = 0; i < browser_rows; i++)
6730 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
6737 if (direct_r_idx < 0)
6739 /* Scroll group list */
6740 if (grp_cur < grp_top) grp_top = grp_cur;
6741 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
6743 /* Display a list of monster groups */
6744 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
6746 if (old_grp_cur != grp_cur)
6748 old_grp_cur = grp_cur;
6750 /* Get a list of monsters in the current group */
6751 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
6754 /* Scroll monster list */
6755 while (mon_cur < mon_top)
6756 mon_top = MAX(0, mon_top - browser_rows/2);
6757 while (mon_cur >= mon_top + browser_rows)
6758 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
6763 /* Display a list of monsters in the current group */
6764 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
6770 /* Display a monster name */
6771 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
6773 /* Display visual list below first monster */
6774 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
6779 prt(format("<方向>%s%s%s, ESC",
6780 (!visual_list && !visual_only) ? ", 'r'で思い出を見る" : "",
6781 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
6782 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
6785 prt(format("<dir>%s%s%s, ESC",
6786 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
6787 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
6788 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
6792 /* Get the current monster */
6793 r_ptr = &r_info[mon_idx[mon_cur]];
6797 /* Mega Hack -- track this monster race */
6798 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
6800 /* Hack -- handle stuff */
6806 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
6810 Term_gotoxy(0, 6 + (grp_cur - grp_top));
6814 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
6819 /* Do visual mode command if needed */
6820 if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &r_ptr->x_attr, &r_ptr->x_char, need_redraw))
6822 if (direct_r_idx >= 0)
6847 /* Recall on screen */
6848 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
6850 screen_roff(mon_idx[mon_cur], 0);
6861 /* Move the cursor */
6862 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
6869 /* Free the "mon_idx" array */
6870 C_KILL(mon_idx, max_r_idx, s16b);
6875 * Display the objects in a group.
6877 static void display_object_list(int col, int row, int per_page, IDX object_idx[],
6878 int object_cur, int object_top, bool visual_only)
6882 /* Display lines until done */
6883 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
6888 object_kind *flavor_k_ptr;
6890 /* Get the object index */
6891 KIND_OBJECT_IDX k_idx = object_idx[object_top + i];
6893 /* Access the object */
6894 object_kind *k_ptr = &k_info[k_idx];
6896 /* Choose a color */
6897 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
6898 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
6901 if (!visual_only && k_ptr->flavor)
6903 /* Appearance of this object is shuffled */
6904 flavor_k_ptr = &k_info[k_ptr->flavor];
6908 /* Appearance of this object is very normal */
6909 flavor_k_ptr = k_ptr;
6914 attr = ((i + object_top == object_cur) ? cursor : attr);
6916 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
6919 strip_name(o_name, k_idx);
6924 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
6927 /* Display the name */
6928 c_prt(attr, o_name, row + i, col);
6930 /* Hack -- visual_list mode */
6933 c_prt(attr, format("%02x/%02x", flavor_k_ptr->x_attr, flavor_k_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 64 : 68);
6935 if (p_ptr->wizard || visual_only)
6937 c_prt(attr, format("%d", k_idx), row + i, 70);
6940 a = flavor_k_ptr->x_attr;
6941 c = flavor_k_ptr->x_char;
6943 /* Display symbol */
6944 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
6947 /* Clear remaining lines */
6948 for (; i < per_page; i++)
6950 Term_erase(col, row + i, 255);
6955 * Describe fake object
6957 static void desc_obj_fake(KIND_OBJECT_IDX k_idx)
6960 object_type object_type_body;
6962 /* Get local object */
6963 o_ptr = &object_type_body;
6966 /* Create the artifact */
6967 object_prep(o_ptr, k_idx);
6969 /* It's fully know */
6970 o_ptr->ident |= IDENT_KNOWN;
6972 /* Track the object */
6973 /* object_actual_track(o_ptr); */
6975 /* Hack - mark as fake */
6976 /* term_obj_real = FALSE; */
6978 /* Hack -- Handle stuff */
6981 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
6983 msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
6991 * Display known objects
6993 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx)
6997 IDX grp_cur, grp_top, old_grp_cur;
6998 IDX object_old, object_cur, object_top;
7008 bool visual_list = FALSE;
7009 TERM_COLOR attr_top = 0;
7017 Term_get_size(&wid, &hgt);
7019 browser_rows = hgt - 8;
7021 /* Allocate the "object_idx" array */
7022 C_MAKE(object_idx, max_k_idx, IDX);
7027 if (direct_k_idx < 0)
7029 mode = visual_only ? 0x03 : 0x01;
7031 /* Check every group */
7032 for (i = 0; object_group_text[i] != NULL; i++)
7034 /* Measure the label */
7035 len = strlen(object_group_text[i]);
7037 /* Save the maximum length */
7038 if (len > max) max = len;
7040 /* See if any monsters are known */
7041 if (collect_objects(i, object_idx, mode))
7043 /* Build a list of groups with known monsters */
7044 grp_idx[grp_cnt++] = i;
7053 object_kind *k_ptr = &k_info[direct_k_idx];
7054 object_kind *flavor_k_ptr;
7056 if (!visual_only && k_ptr->flavor)
7058 /* Appearance of this object is shuffled */
7059 flavor_k_ptr = &k_info[k_ptr->flavor];
7063 /* Appearance of this object is very normal */
7064 flavor_k_ptr = k_ptr;
7067 object_idx[0] = direct_k_idx;
7068 object_old = direct_k_idx;
7071 /* Terminate the list */
7074 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7075 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
7078 /* Terminate the list */
7079 grp_idx[grp_cnt] = -1;
7082 grp_cur = grp_top = 0;
7083 object_cur = object_top = 0;
7088 mode = visual_only ? 0x02 : 0x00;
7093 object_kind *k_ptr, *flavor_k_ptr;
7100 prt(format("%s - アイテム", !visual_only ? "知識" : "表示"), 2, 0);
7101 if (direct_k_idx < 0) prt("グループ", 4, 0);
7102 prt("名前", 4, max + 3);
7103 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
7106 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7107 if (direct_k_idx < 0) prt("Group", 4, 0);
7108 prt("Name", 4, max + 3);
7109 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
7113 for (i = 0; i < 78; i++)
7115 Term_putch(i, 5, TERM_WHITE, '=');
7118 if (direct_k_idx < 0)
7120 for (i = 0; i < browser_rows; i++)
7122 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7129 if (direct_k_idx < 0)
7131 /* Scroll group list */
7132 if (grp_cur < grp_top) grp_top = grp_cur;
7133 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7135 /* Display a list of object groups */
7136 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
7138 if (old_grp_cur != grp_cur)
7140 old_grp_cur = grp_cur;
7142 /* Get a list of objects in the current group */
7143 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
7146 /* Scroll object list */
7147 while (object_cur < object_top)
7148 object_top = MAX(0, object_top - browser_rows/2);
7149 while (object_cur >= object_top + browser_rows)
7150 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
7155 /* Display a list of objects in the current group */
7156 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
7160 object_top = object_cur;
7162 /* Display a list of objects in the current group */
7163 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
7165 /* Display visual list below first object */
7166 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7169 /* Get the current object */
7170 k_ptr = &k_info[object_idx[object_cur]];
7172 if (!visual_only && k_ptr->flavor)
7174 /* Appearance of this object is shuffled */
7175 flavor_k_ptr = &k_info[k_ptr->flavor];
7179 /* Appearance of this object is very normal */
7180 flavor_k_ptr = k_ptr;
7185 prt(format("<方向>%s%s%s, ESC",
7186 (!visual_list && !visual_only) ? ", 'r'で詳細を見る" : "",
7187 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
7188 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7191 prt(format("<dir>%s%s%s, ESC",
7192 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7193 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7194 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7200 /* Mega Hack -- track this object */
7201 if (object_cnt) object_kind_track(object_idx[object_cur]);
7203 /* The "current" object changed */
7204 if (object_old != object_idx[object_cur])
7206 /* Hack -- handle stuff */
7209 /* Remember the "current" object */
7210 object_old = object_idx[object_cur];
7216 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
7220 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7224 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
7229 /* Do visual mode command if needed */
7230 if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw))
7232 if (direct_k_idx >= 0)
7257 /* Recall on screen */
7258 if (!visual_list && !visual_only && (grp_cnt > 0))
7260 desc_obj_fake(object_idx[object_cur]);
7268 /* Move the cursor */
7269 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
7275 /* Free the "object_idx" array */
7276 C_KILL(object_idx, max_k_idx, IDX);
7281 * Display the features in a group.
7283 static void display_feature_list(int col, int row, int per_page, FEAT_IDX *feat_idx,
7284 FEAT_IDX feat_cur, FEAT_IDX feat_top, bool visual_only, int lighting_level)
7286 int lit_col[F_LIT_MAX], i, j;
7287 int f_idx_col = use_bigtile ? 62 : 64;
7289 /* Correct columns 1 and 4 */
7290 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
7291 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7292 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
7294 /* Display lines until done */
7295 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
7300 FEAT_IDX f_idx = feat_idx[feat_top + i];
7302 /* Access the index */
7303 feature_type *f_ptr = &f_info[f_idx];
7305 int row_i = row + i;
7307 /* Choose a color */
7308 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
7310 /* Display the name */
7311 c_prt(attr, f_name + f_ptr->name, row_i, col);
7313 /* Hack -- visual_list mode */
7316 /* Display lighting level */
7317 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
7319 c_prt(attr, format("%02x/%02x", f_ptr->x_attr[lighting_level], f_ptr->x_char[lighting_level]), row_i, f_idx_col - ((p_ptr->wizard || visual_only) ? 6 : 2));
7321 if (p_ptr->wizard || visual_only)
7323 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
7326 /* Display symbol */
7327 Term_queue_bigchar(lit_col[F_LIT_STANDARD], row_i, f_ptr->x_attr[F_LIT_STANDARD], f_ptr->x_char[F_LIT_STANDARD], 0, 0);
7329 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
7330 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
7332 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
7334 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
7336 /* Mega-hack -- Use non-standard colour */
7337 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
7339 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
7343 /* Clear remaining lines */
7344 for (; i < per_page; i++)
7346 Term_erase(col, row + i, 255);
7352 * Interact with feature visuals.
7354 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level)
7358 IDX grp_cur, grp_top, old_grp_cur;
7359 IDX feat_cur, feat_top;
7369 bool visual_list = FALSE;
7370 TERM_COLOR attr_top = 0;
7376 TERM_COLOR attr_old[F_LIT_MAX];
7377 byte char_old[F_LIT_MAX];
7378 TERM_COLOR *cur_attr_ptr;
7381 (void)C_WIPE(attr_old, F_LIT_MAX, byte);
7382 (void)C_WIPE(char_old, F_LIT_MAX, byte);
7384 Term_get_size(&wid, &hgt);
7386 browser_rows = hgt - 8;
7388 /* Allocate the "feat_idx" array */
7389 C_MAKE(feat_idx, max_f_idx, IDX);
7394 if (direct_f_idx < 0)
7396 /* Check every group */
7397 for (i = 0; feature_group_text[i] != NULL; i++)
7399 /* Measure the label */
7400 len = strlen(feature_group_text[i]);
7402 /* Save the maximum length */
7403 if (len > max) max = len;
7405 /* See if any features are known */
7406 if (collect_features(i, feat_idx, 0x01))
7408 /* Build a list of groups with known features */
7409 grp_idx[grp_cnt++] = i;
7417 feature_type *f_ptr = &f_info[direct_f_idx];
7419 feat_idx[0] = direct_f_idx;
7422 /* Terminate the list */
7425 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7426 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
7428 for (i = 0; i < F_LIT_MAX; i++)
7430 attr_old[i] = f_ptr->x_attr[i];
7431 char_old[i] = f_ptr->x_char[i];
7435 /* Terminate the list */
7436 grp_idx[grp_cnt] = -1;
7439 grp_cur = grp_top = 0;
7440 feat_cur = feat_top = 0;
7448 feature_type *f_ptr;
7455 prt("表示 - 地形", 2, 0);
7456 if (direct_f_idx < 0) prt("グループ", 4, 0);
7457 prt("名前", 4, max + 3);
7460 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7461 prt("文字 ( l/ d)", 4, 66);
7465 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7466 prt("文字 (l/d)", 4, 68);
7469 prt("Visuals - features", 2, 0);
7470 if (direct_f_idx < 0) prt("Group", 4, 0);
7471 prt("Name", 4, max + 3);
7474 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7475 prt("Sym ( l/ d)", 4, 67);
7479 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7480 prt("Sym (l/d)", 4, 69);
7484 for (i = 0; i < 78; i++)
7486 Term_putch(i, 5, TERM_WHITE, '=');
7489 if (direct_f_idx < 0)
7491 for (i = 0; i < browser_rows; i++)
7493 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7500 if (direct_f_idx < 0)
7502 /* Scroll group list */
7503 if (grp_cur < grp_top) grp_top = grp_cur;
7504 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7506 /* Display a list of feature groups */
7507 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
7509 if (old_grp_cur != grp_cur)
7511 old_grp_cur = grp_cur;
7513 /* Get a list of features in the current group */
7514 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
7517 /* Scroll feature list */
7518 while (feat_cur < feat_top)
7519 feat_top = MAX(0, feat_top - browser_rows/2);
7520 while (feat_cur >= feat_top + browser_rows)
7521 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
7526 /* Display a list of features in the current group */
7527 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
7531 feat_top = feat_cur;
7533 /* Display a list of features in the current group */
7534 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
7536 /* Display visual list below first object */
7537 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7542 prt(format("<方向>%s, 'd'で標準光源効果%s, ESC",
7543 visual_list ? ", ENTERで決定, 'a'で対象明度変更" : ", 'v'でシンボル変更",
7544 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7547 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
7548 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
7549 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7553 /* Get the current feature */
7554 f_ptr = &f_info[feat_idx[feat_cur]];
7555 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
7556 cur_char_ptr = &f_ptr->x_char[*lighting_level];
7560 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
7564 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7568 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
7573 if (visual_list && ((ch == 'A') || (ch == 'a')))
7575 int prev_lighting_level = *lighting_level;
7579 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
7580 else (*lighting_level)--;
7584 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
7585 else (*lighting_level)++;
7588 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
7589 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7591 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
7592 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7597 else if ((ch == 'D') || (ch == 'd'))
7599 TERM_COLOR prev_x_attr = f_ptr->x_attr[*lighting_level];
7600 byte prev_x_char = f_ptr->x_char[*lighting_level];
7602 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
7606 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
7607 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7609 if (prev_x_char != f_ptr->x_char[*lighting_level])
7610 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7612 else *need_redraw = TRUE;
7617 /* Do visual mode command if needed */
7618 else if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, cur_attr_ptr, cur_char_ptr, need_redraw))
7622 /* Restore previous visual settings */
7624 for (i = 0; i < F_LIT_MAX; i++)
7626 f_ptr->x_attr[i] = attr_old[i];
7627 f_ptr->x_char[i] = char_old[i];
7634 if (direct_f_idx >= 0) flag = TRUE;
7635 else *lighting_level = F_LIT_STANDARD;
7638 /* Preserve current visual settings */
7641 for (i = 0; i < F_LIT_MAX; i++)
7643 attr_old[i] = f_ptr->x_attr[i];
7644 char_old[i] = f_ptr->x_char[i];
7646 *lighting_level = F_LIT_STANDARD;
7653 for (i = 0; i < F_LIT_MAX; i++)
7655 attr_idx_feat[i] = f_ptr->x_attr[i];
7656 char_idx_feat[i] = f_ptr->x_char[i];
7665 /* Allow TERM_DARK text */
7666 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7668 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
7669 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
7687 /* Move the cursor */
7688 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
7694 /* Free the "feat_idx" array */
7695 C_KILL(feat_idx, max_f_idx, IDX);
7700 * List wanted monsters
7702 static void do_cmd_knowledge_kubi(void)
7707 char file_name[1024];
7710 /* Open a new file */
7711 fff = my_fopen_temp(file_name, 1024);
7713 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7720 bool listed = FALSE;
7723 fprintf(fff, "今日のターゲット : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "不明"));
7725 fprintf(fff, "賞金首リスト\n");
7727 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
7729 fprintf(fff, "List of wanted monsters\n");
7731 fprintf(fff, "----------------------------------------------\n");
7733 for (i = 0; i < MAX_KUBI; i++)
7735 if (kubi_r_idx[i] <= 10000)
7737 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
7745 fprintf(fff,"\n%s\n", _("賞金首はもう残っていません。", "There is no more wanted monster."));
7749 /* Close the file */
7752 /* Display the file contents */
7753 show_file(TRUE, file_name, _("賞金首の一覧", "Wanted monsters"), 0, 0);
7755 /* Remove the file */
7760 * List virtues & status
7762 static void do_cmd_knowledge_virtues(void)
7766 char file_name[1024];
7769 /* Open a new file */
7770 fff = my_fopen_temp(file_name, 1024);
7772 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7779 fprintf(fff, _("現在の属性 : %s\n\n", "Your alighnment : %s\n\n"), your_alignment());
7783 /* Close the file */
7786 /* Display the file contents */
7787 show_file(TRUE, file_name, _("八つの徳", "Virtues"), 0, 0);
7789 /* Remove the file */
7797 static void do_cmd_knowledge_dungeon(void)
7801 char file_name[1024];
7805 /* Open a new file */
7806 fff = my_fopen_temp(file_name, 1024);
7808 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7815 for (i = 1; i < max_d_idx; i++)
7819 if (!d_info[i].maxdepth) continue;
7820 if (!max_dlv[i]) continue;
7821 if (d_info[i].final_guardian)
7823 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
7825 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
7827 fprintf(fff, _("%c%-12s : %3d 階\n", "%c%-16s : level %3d\n"), seiha ? '!' : ' ', d_name + d_info[i].name, (int)max_dlv[i]);
7831 /* Close the file */
7834 /* Display the file contents */
7835 show_file(TRUE, file_name, _("今までに入ったダンジョン", "Dungeon"), 0, 0);
7837 /* Remove the file */
7842 * List virtues & status
7845 static void do_cmd_knowledge_stat(void)
7849 char file_name[1024];
7852 /* Open a new file */
7853 fff = my_fopen_temp(file_name, 1024);
7855 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7862 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
7863 (2 * p_ptr->hitdie +
7864 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
7867 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "現在の体力ランク : %d/100\n\n", percent);
7868 else fprintf(fff, "現在の体力ランク : ???\n\n");
7869 fprintf(fff, "能力の最大値\n\n");
7871 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
7872 else fprintf(fff, "Your current Life Rating is ???.\n\n");
7873 fprintf(fff, "Limits of maximum stats\n\n");
7875 for (v_nr = 0; v_nr < 6; v_nr++)
7877 if ((p_ptr->knowledge & KNOW_STAT) || p_ptr->stat_max[v_nr] == p_ptr->stat_max_max[v_nr]) fprintf(fff, "%s 18/%d\n", stat_names[v_nr], p_ptr->stat_max_max[v_nr]-18);
7878 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
7884 /* Close the file */
7887 /* Display the file contents */
7888 show_file(TRUE, file_name, _("自分に関する情報", "HP-rate & Max stat"), 0, 0);
7890 /* Remove the file */
7896 * Print all active quests
7898 static void do_cmd_knowledge_quests_current(FILE *fff)
7901 char rand_tmp_str[120] = "\0";
7903 monster_race *r_ptr;
7905 int rand_level = 100;
7908 fprintf(fff, _("《遂行中のクエスト》\n", "< Current Quest >\n"));
7910 for (i = 1; i < max_q_idx; i++)
7912 if ((quest[i].status == QUEST_STATUS_TAKEN) ||
7913 ((quest[i].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[i].type == QUEST_TYPE_TOWER)) ||
7914 (quest[i].status == QUEST_STATUS_COMPLETED))
7916 /* Set the quest number temporary */
7917 IDX old_quest = p_ptr->inside_quest;
7920 /* Clear the text */
7921 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
7922 quest_text_line = 0;
7924 p_ptr->inside_quest = i;
7926 /* Get the quest text */
7927 init_flags = INIT_SHOW_TEXT;
7929 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
7931 /* Reset the old quest number */
7932 p_ptr->inside_quest = old_quest;
7934 /* No info from "silent" quests */
7935 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
7939 if (quest[i].type != QUEST_TYPE_RANDOM)
7941 char note[80] = "\0";
7943 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_STAGE_COMPLETED)
7945 switch (quest[i].type)
7947 case QUEST_TYPE_KILL_LEVEL:
7948 case QUEST_TYPE_KILL_ANY_LEVEL:
7949 r_ptr = &r_info[quest[i].r_idx];
7950 strcpy(name, r_name + r_ptr->name);
7951 if (quest[i].max_num > 1)
7954 sprintf(note," - %d 体の%sを倒す。(あと %d 体)",
7955 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
7958 sprintf(note," - kill %d %s, have killed %d.",
7959 (int)quest[i].max_num, name, (int)quest[i].cur_num);
7963 sprintf(note,_(" - %sを倒す。", " - kill %s."),name);
7966 case QUEST_TYPE_FIND_ARTIFACT:
7969 artifact_type *a_ptr = &a_info[quest[i].k_idx];
7971 object_type *q_ptr = &forge;
7972 KIND_OBJECT_IDX k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
7973 object_prep(q_ptr, k_idx);
7974 q_ptr->name1 = quest[i].k_idx;
7975 q_ptr->ident = IDENT_STORE;
7976 object_desc(name, q_ptr, OD_NAME_ONLY);
7978 sprintf(note,_("\n - %sを見つけ出す。", "\n - Find out %s."), name);
7980 case QUEST_TYPE_FIND_EXIT:
7981 sprintf(note,_(" - 出口に到達する。", " - Reach to Exit."));
7984 case QUEST_TYPE_KILL_NUMBER:
7986 sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)",
7987 (int)quest[i].max_num, (int)(quest[i].max_num - quest[i].cur_num));
7989 sprintf(note," - Kill %d monsters, have killed %d.",
7990 (int)quest[i].max_num, (int)quest[i].cur_num);
7994 case QUEST_TYPE_KILL_ALL:
7995 case QUEST_TYPE_TOWER:
7996 sprintf(note,_(" - 全てのモンスターを倒す。", " - Kill all monsters."));
8001 /* Print the quest info */
8002 sprintf(tmp_str, _(" %s (危険度:%d階相当)%s\n", " %s (Danger level: %d)%s\n"),
8003 quest[i].name, (int)quest[i].level, note);
8005 fputs(tmp_str, fff);
8007 if (quest[i].status == QUEST_STATUS_COMPLETED)
8009 sprintf(tmp_str, _(" クエスト達成 - まだ報酬を受けとってない。\n", " Quest Completed - Unrewarded\n"));
8010 fputs(tmp_str, fff);
8016 while (quest_text[j][0] && j < 10)
8018 fprintf(fff, " %s\n", quest_text[j]);
8023 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
8026 rand_level = quest[i].level;
8028 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8030 /* Print the quest info */
8031 r_ptr = &r_info[quest[i].r_idx];
8032 strcpy(name, r_name + r_ptr->name);
8034 if (quest[i].max_num > 1)
8037 sprintf(rand_tmp_str," %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
8038 quest[i].name, (int)quest[i].level,
8039 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
8043 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8044 quest[i].name, (int)quest[i].level,
8045 (int)quest[i].max_num, name, (int)quest[i].cur_num);
8050 sprintf(rand_tmp_str,_(" %s (%d 階) - %sを倒す。\n", " %s (Dungeon level: %d)\n Kill %s.\n"),
8051 quest[i].name, (int)quest[i].level, name);
8058 /* Print the current random quest */
8059 if (rand_tmp_str[0]) fputs(rand_tmp_str, fff);
8061 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8065 static bool do_cmd_knowledge_quests_aux(FILE *fff, IDX q_idx)
8068 char playtime_str[16];
8069 quest_type* const q_ptr = &quest[q_idx];
8071 if (is_fixed_quest_idx(q_idx))
8073 /* Set the quest number temporary */
8074 IDX old_quest = p_ptr->inside_quest;
8076 p_ptr->inside_quest = q_idx;
8079 init_flags = INIT_NAME_ONLY;
8081 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8083 /* Reset the old quest number */
8084 p_ptr->inside_quest = old_quest;
8086 /* No info from "silent" quests */
8087 if (q_ptr->flags & QUEST_FLAG_SILENT) return FALSE;
8090 strnfmt(playtime_str, sizeof(playtime_str), "%02d:%02d:%02d",
8091 q_ptr->comptime/(60*60), (q_ptr->comptime/60)%60, q_ptr->comptime%60);
8093 if (!is_fixed_quest_idx(q_idx) && q_ptr->r_idx)
8095 /* Print the quest info */
8096 if (q_ptr->complev == 0)
8099 _(" %-35s (%3d階) - 不戦勝 - %s\n",
8100 " %-35s (Dungeon level: %3d) - Unearned - %s\n") ,
8101 r_name+r_info[q_ptr->r_idx].name,
8102 (int)q_ptr->level, playtime_str);
8107 _(" %-35s (%3d階) - レベル%2d - %s\n",
8108 " %-35s (Dungeon level: %3d) - level %2d - %s\n") ,
8109 r_name+r_info[q_ptr->r_idx].name,
8117 /* Print the quest info */
8119 _(" %-35s (危険度:%3d階相当) - レベル%2d - %s\n",
8120 " %-35s (Danger level: %3d) - level %2d - %s\n") ,
8121 q_ptr->name, (int)q_ptr->level, q_ptr->complev, playtime_str);
8124 fputs(tmp_str, fff);
8130 * Print all finished quests
8132 void do_cmd_knowledge_quests_completed(FILE *fff, IDX quest_num[])
8137 fprintf(fff, _("《達成したクエスト》\n", "< Completed Quest >\n"));
8138 for (i = 1; i < max_q_idx; i++)
8140 IDX q_idx = quest_num[i];
8141 quest_type* const q_ptr = &quest[q_idx];
8143 if (q_ptr->status == QUEST_STATUS_FINISHED &&
8144 do_cmd_knowledge_quests_aux(fff, q_idx))
8149 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8154 * Print all failed quests
8156 void do_cmd_knowledge_quests_failed(FILE *fff, IDX quest_num[])
8161 fprintf(fff, _("《失敗したクエスト》\n", "< Failed Quest >\n"));
8162 for (i = 1; i < max_q_idx; i++)
8164 IDX q_idx = quest_num[i];
8165 quest_type* const q_ptr = &quest[q_idx];
8167 if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) &&
8168 do_cmd_knowledge_quests_aux(fff, q_idx))
8173 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8178 * Print all random quests
8180 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
8186 fprintf(fff, _("《残りのランダムクエスト》\n", "< Remaining Random Quest >\n"));
8187 for (i = 1; i < max_q_idx; i++)
8189 /* No info from "silent" quests */
8190 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8192 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
8196 /* Print the quest info */
8197 sprintf(tmp_str, _(" %s (%d階, %s)\n", " %s (%d, %s)\n"),
8198 quest[i].name, (int)quest[i].level, r_name+r_info[quest[i].r_idx].name);
8199 fputs(tmp_str, fff);
8202 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8206 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
8208 QUEST_IDX *q_num = (QUEST_IDX *)u;
8209 quest_type *qa = &quest[q_num[a]];
8210 quest_type *qb = &quest[q_num[b]];
8215 return (qa->comptime != qb->comptime) ?
8216 (qa->comptime < qb->comptime) :
8217 (qa->level <= qb->level);
8220 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
8222 QUEST_IDX *q_num = (QUEST_IDX *)u;
8229 q_num[a] = q_num[b];
8235 * Print quest status of all active quests
8237 static void do_cmd_knowledge_quests(void)
8240 char file_name[1024];
8245 /* Open a new file */
8246 fff = my_fopen_temp(file_name, 1024);
8249 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8254 /* Allocate Memory */
8255 C_MAKE(quest_num, max_q_idx, IDX);
8257 /* Sort by compete level */
8258 for (i = 1; i < max_q_idx; i++) quest_num[i] = i;
8259 ang_sort_comp = ang_sort_comp_quest_num;
8260 ang_sort_swap = ang_sort_swap_quest_num;
8261 ang_sort(quest_num, &dummy, max_q_idx);
8263 /* Dump Quest Information */
8264 do_cmd_knowledge_quests_current(fff);
8266 do_cmd_knowledge_quests_completed(fff, quest_num);
8268 do_cmd_knowledge_quests_failed(fff, quest_num);
8272 do_cmd_knowledge_quests_wiz_random(fff);
8275 /* Close the file */
8278 /* Display the file contents */
8279 show_file(TRUE, file_name, _("クエスト達成状況", "Quest status"), 0, 0);
8281 /* Remove the file */
8285 C_KILL(quest_num, max_q_idx, IDX);
8292 static void do_cmd_knowledge_home(void)
8297 char file_name[1024];
8299 char o_name[MAX_NLEN];
8302 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
8304 /* Open a new file */
8305 fff = my_fopen_temp(file_name, 1024);
8307 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8314 /* Print all homes in the different towns */
8315 st_ptr = &town[1].store[STORE_HOME];
8317 /* Home -- if anything there */
8318 if (st_ptr->stock_num)
8323 /* Header with name of the town */
8324 fprintf(fff, _(" [ 我が家のアイテム ]\n", " [Home Inventory]\n"));
8326 /* Dump all available items */
8327 for (i = 0; i < st_ptr->stock_num; i++)
8330 if ((i % 12) == 0) fprintf(fff, "\n ( %d ページ )\n", x++);
8331 object_desc(o_name, &st_ptr->stock[i], 0);
8332 if (strlen(o_name) <= 80-3)
8334 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8340 for (n = 0, t = o_name; n < 80-3; n++, t++)
8341 if(iskanji(*t)) {t++; n++;}
8342 if (n == 81-3) n = 79-3; /* 最後が漢字半分 */
8344 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
8345 fprintf(fff, " %.77s\n", o_name+n);
8348 object_desc(o_name, &st_ptr->stock[i], 0);
8349 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8354 /* Add an empty line */
8355 fprintf(fff, "\n\n");
8359 /* Close the file */
8362 /* Display the file contents */
8363 show_file(TRUE, file_name, _("我が家のアイテム", "Home Inventory"), 0, 0);
8365 /* Remove the file */
8371 * Check the status of "autopick"
8373 static void do_cmd_knowledge_autopick(void)
8377 char file_name[1024];
8379 /* Open a new file */
8380 fff = my_fopen_temp(file_name, 1024);
8384 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8391 fprintf(fff, _("自動破壊/拾いには何も登録されていません。", "No preference for auto picker/destroyer."));
8395 fprintf(fff, _(" 自動拾い/破壊には現在 %d行登録されています。\n\n",
8396 " There are %d registered lines for auto picker/destroyer.\n\n"), max_autopick);
8399 for (k = 0; k < max_autopick; k++)
8402 byte act = autopick_list[k].action;
8403 if (act & DONT_AUTOPICK)
8405 tmp = _("放置", "Leave");
8407 else if (act & DO_AUTODESTROY)
8409 tmp = _("破壊", "Destroy");
8411 else if (act & DO_AUTOPICK)
8413 tmp = _("拾う", "Pickup");
8417 tmp = _("確認", "Query");
8420 if (act & DO_DISPLAY)
8421 fprintf(fff, "%11s", format("[%s]", tmp));
8423 fprintf(fff, "%11s", format("(%s)", tmp));
8425 tmp = autopick_line_from_entry(&autopick_list[k]);
8426 fprintf(fff, " %s", tmp);
8430 /* Close the file */
8432 /* Display the file contents */
8433 show_file(TRUE, file_name, _("自動拾い/破壊 設定リスト", "Auto-picker/Destroyer"), 0, 0);
8435 /* Remove the file */
8441 * Interact with "knowledge"
8443 void do_cmd_knowledge(void)
8446 bool need_redraw = FALSE;
8448 /* File type is "TEXT" */
8449 FILE_TYPE(FILE_TYPE_TEXT);
8451 /* Save the screen */
8454 /* Interact until done */
8460 /* Ask for a choice */
8462 prt(format("%d/2 ページ", (p+1)), 2, 65);
8463 prt("現在の知識を確認する", 3, 0);
8465 prt(format("page %d/2", (p+1)), 2, 65);
8466 prt("Display current knowledge", 3, 0);
8469 /* Give some choices */
8473 prt("(1) 既知の伝説のアイテム の一覧", 6, 5);
8474 prt("(2) 既知のアイテム の一覧", 7, 5);
8475 prt("(3) 既知の生きているユニーク・モンスター の一覧", 8, 5);
8476 prt("(4) 既知のモンスター の一覧", 9, 5);
8477 prt("(5) 倒した敵の数 の一覧", 10, 5);
8478 if (!vanilla_town) prt("(6) 賞金首 の一覧", 11, 5);
8479 prt("(7) 現在のペット の一覧", 12, 5);
8480 prt("(8) 我が家のアイテム の一覧", 13, 5);
8481 prt("(9) *鑑定*済み装備の耐性 の一覧", 14, 5);
8482 prt("(0) 地形の表示文字/タイル の一覧", 15, 5);
8486 prt("(a) 自分に関する情報 の一覧", 6, 5);
8487 prt("(b) 突然変異 の一覧", 7, 5);
8488 prt("(c) 武器の経験値 の一覧", 8, 5);
8489 prt("(d) 魔法の経験値 の一覧", 9, 5);
8490 prt("(e) 技能の経験値 の一覧", 10, 5);
8491 prt("(f) プレイヤーの徳 の一覧", 11, 5);
8492 prt("(g) 入ったダンジョン の一覧", 12, 5);
8493 prt("(h) 実行中のクエスト の一覧", 13, 5);
8494 prt("(i) 現在の自動拾い/破壊設定 の一覧", 14, 5);
8499 prt("(1) Display known artifacts", 6, 5);
8500 prt("(2) Display known objects", 7, 5);
8501 prt("(3) Display remaining uniques", 8, 5);
8502 prt("(4) Display known monster", 9, 5);
8503 prt("(5) Display kill count", 10, 5);
8504 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
8505 prt("(7) Display current pets", 12, 5);
8506 prt("(8) Display home inventory", 13, 5);
8507 prt("(9) Display *identified* equip.", 14, 5);
8508 prt("(0) Display terrain symbols.", 15, 5);
8512 prt("(a) Display about yourself", 6, 5);
8513 prt("(b) Display mutations", 7, 5);
8514 prt("(c) Display weapon proficiency", 8, 5);
8515 prt("(d) Display spell proficiency", 9, 5);
8516 prt("(e) Display misc. proficiency", 10, 5);
8517 prt("(f) Display virtues", 11, 5);
8518 prt("(g) Display dungeons", 12, 5);
8519 prt("(h) Display current quests", 13, 5);
8520 prt("(i) Display auto pick/destroy", 14, 5);
8526 prt("ESC) 抜ける", 21, 1);
8527 prt("SPACE) 次ページ", 21, 30);
8528 /*prt("-) 前ページ", 21, 60);*/
8529 prt("コマンド:", 20, 0);
8531 prt("-more-", 17, 8);
8532 prt("ESC) Exit menu", 21, 1);
8533 prt("SPACE) Next page", 21, 30);
8534 /*prt("-) Previous page", 21, 60);*/
8535 prt("Command: ", 20, 0);
8541 if (i == ESCAPE) break;
8544 case ' ': /* Page change */
8548 case '1': /* Artifacts */
8549 do_cmd_knowledge_artifacts();
8551 case '2': /* Objects */
8552 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
8554 case '3': /* Uniques */
8555 do_cmd_knowledge_uniques();
8557 case '4': /* Monsters */
8558 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
8560 case '5': /* Kill count */
8561 do_cmd_knowledge_kill_count();
8563 case '6': /* wanted */
8564 if (!vanilla_town) do_cmd_knowledge_kubi();
8566 case '7': /* Pets */
8567 do_cmd_knowledge_pets();
8569 case '8': /* Home */
8570 do_cmd_knowledge_home();
8572 case '9': /* Resist list */
8573 do_cmd_knowledge_inven();
8575 case '0': /* Feature list */
8577 IDX lighting_level = F_LIT_STANDARD;
8578 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
8582 case 'a': /* Max stat */
8583 do_cmd_knowledge_stat();
8585 case 'b': /* Mutations */
8586 do_cmd_knowledge_mutations();
8588 case 'c': /* weapon-exp */
8589 do_cmd_knowledge_weapon_exp();
8591 case 'd': /* spell-exp */
8592 do_cmd_knowledge_spell_exp();
8594 case 'e': /* skill-exp */
8595 do_cmd_knowledge_skill_exp();
8597 case 'f': /* Virtues */
8598 do_cmd_knowledge_virtues();
8600 case 'g': /* Dungeon */
8601 do_cmd_knowledge_dungeon();
8603 case 'h': /* Quests */
8604 do_cmd_knowledge_quests();
8606 case 'i': /* Autopick */
8607 do_cmd_knowledge_autopick();
8609 default: /* Unknown option */
8613 /* Flush messages */
8617 /* Restore the screen */
8620 if (need_redraw) do_cmd_redraw();
8625 * Check on the status of an active quest
8627 void do_cmd_checkquest(void)
8629 /* File type is "TEXT" */
8630 FILE_TYPE(FILE_TYPE_TEXT);
8632 /* Save the screen */
8636 do_cmd_knowledge_quests();
8638 /* Restore the screen */
8644 * Display the time and date
8646 void do_cmd_time(void)
8648 int day, hour, min, full, start, end, num;
8656 extract_day_hour_min(&day, &hour, &min);
8658 full = hour * 100 + min;
8665 strcpy(desc, _("変な時刻だ。", "It is a strange time."));
8667 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
8668 else strcpy(day_buf, "*****");
8671 msg_format("%s日目, 時刻は%d:%02d %sです。",
8672 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
8673 min, (hour < 12) ? "AM" : "PM");
8675 msg_format("This is day %s. The time is %d:%02d %s.",
8676 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
8677 min, (hour < 12) ? "AM" : "PM");
8682 if (!randint0(10) || p_ptr->image)
8684 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timefun_j.txt", "timefun.txt"));
8688 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timenorm_j.txt", "timenorm.txt"));
8691 /* Open this file */
8692 fff = my_fopen(buf, "rt");
8696 /* Find this time */
8697 while (!my_fgets(fff, buf, sizeof(buf)))
8699 /* Ignore comments */
8700 if (!buf[0] || (buf[0] == '#')) continue;
8702 /* Ignore invalid lines */
8703 if (buf[1] != ':') continue;
8705 /* Process 'Start' */
8708 /* Extract the starting time */
8709 start = atoi(buf + 2);
8711 /* Assume valid for an hour */
8721 /* Extract the ending time */
8722 end = atoi(buf + 2);
8728 /* Ignore incorrect range */
8729 if ((start > full) || (full > end)) continue;
8731 /* Process 'Description' */
8736 /* Apply the randomizer */
8737 if (!randint0(num)) strcpy(desc, buf + 2);
8746 /* Close the file */