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.
45 #include "player-status.h"
58 * Mark strings for auto dump
60 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
61 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
64 * Variables for auto dump
66 static FILE *auto_dump_stream;
67 static concptr auto_dump_mark;
68 static int auto_dump_line_num;
72 * @brief prf出力内容を消去する /
73 * Remove old lines automatically generated before.
74 * @param orig_file 消去を行うファイル名
76 static void remove_auto_dump(concptr orig_file)
78 FILE *tmp_fff, *orig_fff;
82 bool between_mark = FALSE;
85 long header_location = 0;
86 char header_mark_str[80];
87 char footer_mark_str[80];
90 /* Prepare a header/footer mark string */
91 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
92 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
94 mark_len = strlen(footer_mark_str);
96 /* Open an old dump file in read-only mode */
97 orig_fff = my_fopen(orig_file, "r");
99 /* If original file does not exist, nothing to do */
100 if (!orig_fff) return;
102 /* Open a new (temporary) file */
103 tmp_fff = my_fopen_temp(tmp_file, 1024);
107 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), tmp_file);
112 /* Loop for every line */
116 if (my_fgets(orig_fff, buf, sizeof(buf)))
118 /* Read error: Assume End of File */
121 * Was looking for the footer, but not found.
123 * Since automatic dump might be edited by hand,
124 * it's dangerous to kill these lines.
125 * Seek back to the next line of the (pseudo) header,
130 fseek(orig_fff, header_location, SEEK_SET);
131 between_mark = FALSE;
135 /* Success -- End the loop */
142 /* We are looking for the header mark of automatic dump */
145 /* Is this line a header? */
146 if (!strcmp(buf, header_mark_str))
148 /* Memorise seek point of this line */
149 header_location = ftell(orig_fff);
151 /* Initialize counter for number of lines */
154 /* Look for the footer from now */
157 /* There are some changes */
164 /* Copy orginally lines */
165 fprintf(tmp_fff, "%s\n", buf);
169 /* We are looking for the footer mark of automatic dump */
172 /* Is this line a footer? */
173 if (!strncmp(buf, footer_mark_str, mark_len))
178 * Compare the number of lines
180 * If there is an inconsistency between
181 * actual number of lines and the
182 * number here, the automatic dump
183 * might be edited by hand. So it's
184 * dangerous to kill these lines.
185 * Seek back to the next line of the
186 * (pseudo) header, and read again.
188 if (!sscanf(buf + mark_len, " (%d)", &tmp)
191 fseek(orig_fff, header_location, SEEK_SET);
194 /* Look for another header */
195 between_mark = FALSE;
201 /* Ignore old line, and count number of lines */
211 /* If there are some changes, overwrite the original file with new one */
214 /* Copy contents of temporary file */
216 tmp_fff = my_fopen(tmp_file, "r");
217 orig_fff = my_fopen(orig_file, "w");
219 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
220 fprintf(orig_fff, "%s\n", buf);
226 /* Kill the temporary file */
234 * @brief prfファイルのフォーマットに従った内容を出力する /
235 * Dump a formatted line, using "vstrnfmt()".
238 static void auto_dump_printf(concptr fmt, ...)
245 /* Begin the Varargs Stuff */
248 /* Format the args, save the length */
249 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
251 /* End the Varargs Stuff */
254 /* Count number of lines */
255 for (p = buf; *p; p++)
257 if (*p == '\n') auto_dump_line_num++;
261 fprintf(auto_dump_stream, "%s", buf);
266 * @brief prfファイルをファイルオープンする /
267 * Open file to append auto dump.
269 * @param mark 出力するヘッダマーク
270 * @return ファイルポインタを取得できたらTRUEを返す
272 static bool open_auto_dump(concptr buf, concptr mark)
275 char header_mark_str[80];
277 /* Save the mark string */
278 auto_dump_mark = mark;
280 /* Prepare a header mark string */
281 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
283 /* Remove old macro dumps */
284 remove_auto_dump(buf);
286 /* Append to the file */
287 auto_dump_stream = my_fopen(buf, "a");
290 if (!auto_dump_stream) {
291 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
299 fprintf(auto_dump_stream, "%s\n", header_mark_str);
301 /* Initialize counter */
302 auto_dump_line_num = 0;
304 auto_dump_printf(_("# *警告!!* 以降の行は自動生成されたものです。\n",
305 "# *Warning!* The lines below are an automatic dump.\n"));
306 auto_dump_printf(_("# *警告!!* 後で自動的に削除されるので編集しないでください。\n",
307 "# Don't edit them; changes will be deleted and replaced automatically.\n"));
313 * @brief prfファイルをファイルクローズする /
314 * Append foot part and close auto dump.
317 static void close_auto_dump(void)
319 char footer_mark_str[80];
321 /* Prepare a footer mark string */
322 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
324 auto_dump_printf(_("# *警告!!* 以降の行は自動生成されたものです。\n",
325 "# *Warning!* The lines below are an automatic dump.\n"));
326 auto_dump_printf(_("# *警告!!* 後で自動的に削除されるので編集しないでください。\n",
327 "# Don't edit them; changes will be deleted and replaced automatically.\n"));
329 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
332 my_fclose(auto_dump_stream);
341 * @brief Return suffix of ordinal number
343 * @return pointer of suffix string.
345 concptr get_ordinal_number_suffix(int num)
347 num = ABS(num) % 100;
351 return (num == 11) ? "th" : "st";
353 return (num == 12) ? "th" : "nd";
355 return (num == 13) ? "th" : "rd";
364 * @brief 日記にメッセージを追加する /
365 * Take note to the diary.
366 * @param type 日記内容のID
367 * @param num 日記内容のIDに応じた数値
368 * @param note 日記内容のIDに応じた文字列参照ポインタ
371 errr do_cmd_write_nikki(int type, int num, concptr note)
375 GAME_TEXT file_name[MAX_NLEN];
377 concptr note_level = "";
378 bool do_level = TRUE;
379 char note_level_buf[40];
382 static bool disable_nikki = FALSE;
384 extract_day_hour_min(&day, &hour, &min);
386 if (disable_nikki) return(-1);
388 if (type == NIKKI_FIX_QUEST_C ||
389 type == NIKKI_FIX_QUEST_F ||
390 type == NIKKI_RAND_QUEST_C ||
391 type == NIKKI_RAND_QUEST_F ||
392 type == NIKKI_TO_QUEST)
396 old_quest = p_ptr->inside_quest;
397 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
399 /* Get the quest text */
400 init_flags = INIT_NAME_ONLY;
402 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
404 /* Reset the old quest number */
405 p_ptr->inside_quest = old_quest;
408 /* different filne name to avoid mixing */
409 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
411 /* Build the filename */
412 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
414 /* File type is "TEXT" */
415 FILE_TYPE(FILE_TYPE_TEXT);
417 fff = my_fopen(buf, "a");
422 msg_format(_("%s を開くことができませんでした。プレイ記録を一時停止します。", "Failed to open %s. Play-Record is disabled temporally."), buf);
428 q_idx = quest_number(dun_level);
432 if (p_ptr->inside_arena)
433 note_level = _("アリーナ:", "Arane:");
435 note_level = _("地上:", "Surface:");
436 else if (q_idx && (is_fixed_quest_idx(q_idx)
437 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
438 note_level = _("クエスト:", "Quest:");
442 sprintf(note_level_buf, "%d階(%s):", (int)dun_level, d_name+d_info[dungeon_type].name);
444 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, (int)dun_level);
446 note_level = note_level_buf;
454 if (day < MAX_DAYS) fprintf(fff, _("%d日目\n", "Day %d\n"), day);
455 else fputs(_("*****日目\n", "Day *****\n"), fff);
463 fprintf(fff, "%s\n",note);
467 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
472 fprintf(fff, _(" %2d:%02d %20s %sを発見した。\n", " %2d:%02d %20s discovered %s.\n"), hour, min, note_level, note);
475 case NIKKI_ART_SCROLL:
477 fprintf(fff, _(" %2d:%02d %20s 巻物によって%sを生成した。\n", " %2d:%02d %20s created %s by scroll.\n"), hour, min, note_level, note);
482 fprintf(fff, _(" %2d:%02d %20s %sを倒した。\n", " %2d:%02d %20s defeated %s.\n"), hour, min, note_level, note);
485 case NIKKI_FIX_QUEST_C:
487 if (quest[num].flags & QUEST_FLAG_SILENT) break;
488 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」を達成した。\n",
489 " %2d:%02d %20s completed quest '%s'.\n"), hour, min, note_level, quest[num].name);
492 case NIKKI_FIX_QUEST_F:
494 if (quest[num].flags & QUEST_FLAG_SILENT) break;
495 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」から命からがら逃げ帰った。\n",
496 " %2d:%02d %20s run away from quest '%s'.\n"), hour, min, note_level, quest[num].name);
499 case NIKKI_RAND_QUEST_C:
501 GAME_TEXT name[MAX_NLEN];
502 strcpy(name, r_name+r_info[quest[num].r_idx].name);
503 fprintf(fff, _(" %2d:%02d %20s ランダムクエスト(%s)を達成した。\n",
504 " %2d:%02d %20s completed random quest '%s'\n"), hour, min, note_level, name);
507 case NIKKI_RAND_QUEST_F:
509 GAME_TEXT name[MAX_NLEN];
510 strcpy(name, r_name+r_info[quest[num].r_idx].name);
511 fprintf(fff, _(" %2d:%02d %20s ランダムクエスト(%s)から逃げ出した。\n",
512 " %2d:%02d %20s ran away from quest '%s'.\n"), hour, min, note_level, name);
515 case NIKKI_MAXDEAPTH:
517 fprintf(fff, _(" %2d:%02d %20s %sの最深階%d階に到達した。\n",
518 " %2d:%02d %20s reached level %d of %s for the first time.\n"), hour, min, note_level,
519 _(d_name+d_info[dungeon_type].name, num),
520 _(num, d_name+d_info[dungeon_type].name));
525 fprintf(fff, _(" %2d:%02d %20s %s%sの最深階を%d階にセットした。\n",
526 " %2d:%02d %20s reset recall level of %s to %d %s.\n"), hour, min, note_level, note,
527 _(d_name + d_info[num].name, (int)max_dlv[num]),
528 _((int)max_dlv[num], d_name + d_info[num].name));
534 if (q_idx && (is_fixed_quest_idx(q_idx)
535 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
537 to = _("地上", "the surface");
541 if (!(dun_level+num)) to = _("地上", "the surface");
542 else to = format(_("%d階", "level %d"), dun_level+num);
544 fprintf(fff, _(" %2d:%02d %20s %sへ%s。\n", " %2d:%02d %20s %s %s.\n"), hour, min, note_level, _(to, note), _(note, to));
550 fprintf(fff, _(" %2d:%02d %20s 帰還を使って%sの%d階へ下りた。\n", " %2d:%02d %20s recalled to dungeon level %d of %s.\n"),
551 hour, min, note_level, _(d_name+d_info[dungeon_type].name, (int)max_dlv[dungeon_type]),
552 _((int)max_dlv[dungeon_type], d_name+d_info[dungeon_type].name));
554 fprintf(fff, _(" %2d:%02d %20s 帰還を使って地上へと戻った。\n", " %2d:%02d %20s recalled from dungeon to surface.\n"), hour, min, note_level);
559 if (quest[num].flags & QUEST_FLAG_SILENT) break;
560 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」へと突入した。\n", " %2d:%02d %20s entered the quest '%s'.\n"),
561 hour, min, note_level, quest[num].name);
566 fprintf(fff, _(" %2d:%02d %20s レベル・テレポートで脱出した。\n", " %2d:%02d %20s Got out using teleport level.\n"),
567 hour, min, note_level);
572 fprintf(fff, _(" %2d:%02d %20s %sを購入した。\n", " %2d:%02d %20s bought %s.\n"), hour, min, note_level, note);
577 fprintf(fff, _(" %2d:%02d %20s %sを売却した。\n", " %2d:%02d %20s sold %s.\n"), hour, min, note_level, note);
585 fprintf(fff, _(" %2d:%02d %20s 闘技場の%d%s回戦で、%sの前に敗れ去った。\n", " %2d:%02d %20s beaten by %s in the %d%s fight.\n"),
586 hour, min, note_level, _(n, note), _("", n), _(note, get_ordinal_number_suffix(n)));
589 fprintf(fff, _(" %2d:%02d %20s 闘技場の%d%s回戦(%s)に勝利した。\n", " %2d:%02d %20s won the %d%s fight (%s).\n"),
590 hour, min, note_level, num, _("", get_ordinal_number_suffix(num)), note);
592 if (num == MAX_ARENA_MONS)
594 fprintf(fff, _(" 闘技場のすべての敵に勝利し、チャンピオンとなった。\n",
595 " won all fight to become a Chanpion.\n"));
602 fprintf(fff, _(" %2d:%02d %20s %sを識別した。\n", " %2d:%02d %20s identified %s.\n"), hour, min, note_level, note);
609 to = _("地上", "the surface");
611 to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_type].name);
613 fprintf(fff, _(" %2d:%02d %20s %sへとウィザード・テレポートで移動した。\n",
614 " %2d:%02d %20s wizard-teleport to %s.\n"), hour, min, note_level, to);
621 to = _("地上", "the surface");
623 to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_type].name);
625 fprintf(fff, _(" %2d:%02d %20s %sへとパターンの力で移動した。\n",
626 " %2d:%02d %20s used Pattern to teleport to %s.\n"), hour, min, note_level, to);
631 fprintf(fff, _(" %2d:%02d %20s レベルが%dに上がった。\n", " %2d:%02d %20s reached player level %d.\n"), hour, min, note_level, num);
634 case NIKKI_GAMESTART:
636 time_t ct = time((time_t*)0);
640 fprintf(fff, "%s %s",note, ctime(&ct));
643 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
646 case NIKKI_NAMED_PET:
648 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
651 case RECORD_NAMED_PET_NAME:
652 fprintf(fff, _("%sを旅の友にすることに決めた。\n", "decided to travel together with %s.\n"), note);
654 case RECORD_NAMED_PET_UNNAME:
655 fprintf(fff, _("%sの名前を消した。\n", "unnamed %s.\n"), note);
657 case RECORD_NAMED_PET_DISMISS:
658 fprintf(fff, _("%sを解放した。\n", "dismissed %s.\n"), note);
660 case RECORD_NAMED_PET_DEATH:
661 fprintf(fff, _("%sが死んでしまった。\n", "%s died.\n"), note);
663 case RECORD_NAMED_PET_MOVED:
664 fprintf(fff, _("%sをおいて別のマップへ移動した。\n", "moved to another map leaving %s behind.\n"), note);
666 case RECORD_NAMED_PET_LOST_SIGHT:
667 fprintf(fff, _("%sとはぐれてしまった。\n", "lost sight of %s.\n"), note);
669 case RECORD_NAMED_PET_DESTROY:
670 fprintf(fff, _("%sが*破壊*によって消え去った。\n", "%s was made disappeared by *destruction*.\n"), note);
672 case RECORD_NAMED_PET_EARTHQUAKE:
673 fprintf(fff, _("%sが岩石に押し潰された。\n", "%s was crushed by falling rocks.\n"), note);
675 case RECORD_NAMED_PET_GENOCIDE:
676 fprintf(fff, _("%sが抹殺によって消え去った。\n", "%s was made disappeared by genocide.\n"), note);
678 case RECORD_NAMED_PET_WIZ_ZAP:
679 fprintf(fff, _("%sがデバッグコマンドによって消え去った。\n", "%s was removed by debug command.\n"), note);
681 case RECORD_NAMED_PET_TELE_LEVEL:
682 fprintf(fff, _("%sがテレポート・レベルによって消え去った。\n", "%s was made disappeared by teleport level.\n"), note);
684 case RECORD_NAMED_PET_BLAST:
685 fprintf(fff, _("%sを爆破した。\n", "blasted %s.\n"), note);
687 case RECORD_NAMED_PET_HEAL_LEPER:
688 fprintf(fff, _("%sの病気が治り旅から外れた。\n", "%s was healed and left.\n"), note);
690 case RECORD_NAMED_PET_COMPACT:
691 fprintf(fff, _("%sがモンスター情報圧縮によって消え去った。\n", "%s was made disappeared by compacting monsters.\n"), note);
693 case RECORD_NAMED_PET_LOSE_PARENT:
694 fprintf(fff, _("%sの召喚者が既にいないため消え去った。\n", "%s disappeared because there does not exist summoner.\n"), note);
705 case NIKKI_WIZARD_LOG:
706 fprintf(fff, "%s\n", note);
715 if (do_level) write_level = FALSE;
721 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
724 * @brief 日記のタイトル表記と内容出力 /
727 * 日記のタイトルは本関数の subtitle ローカル変数で定義されている。
729 static void do_cmd_disp_nikki(void)
731 char nikki_title[256];
732 GAME_TEXT file_name[MAX_NLEN];
737 static const char subtitle[][30] = {"最強の肉体を求めて",
768 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
769 "Attack is the best form of defence.",
771 "An unexpected windfall",
772 "A drowning man will catch at a straw",
773 "Don't count your chickens before they are hatched.",
774 "It is no use crying over spilt milk.",
775 "Seeing is believing.",
776 "Strike the iron while it is hot.",
777 "I don't care what follows.",
778 "To dig a well to put out a house on fire.",
779 "Tomorrow is another day.",
780 "Easy come, easy go.",
781 "The more haste, the less speed.",
782 "Where there is life, there is hope.",
783 "There is no royal road to *WINNER*.",
784 "Danger past, God forgotten.",
785 "The best thing to do now is to run away.",
786 "Life is but an empty dream.",
787 "Dead men tell no tales.",
788 "A book that remains shut is but a block.",
789 "Misfortunes never come singly.",
790 "A little knowledge is a dangerous thing.",
791 "History repeats itself.",
792 "*WINNER* was not built in a day.",
793 "Ignorance is bliss.",
794 "To lose is to win?",
795 "No medicine can cure folly.",
796 "All good things come to an end.",
797 "M$ Empire strikes back.",
798 "To see is to believe",
800 "Quest of The World's Greatest Brain"};
802 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
804 /* Build the filename */
805 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
807 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
808 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
809 else if (IS_WIZARD_CLASS())
810 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
811 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
814 sprintf(nikki_title, "「%s%s%sの伝説 -%s-」", ap_ptr->title, ap_ptr->no ? "の" : "", p_ptr->name, tmp);
816 sprintf(nikki_title, "Legend of %s %s '%s'", ap_ptr->title, p_ptr->name, tmp);
819 /* Display the file contents */
820 show_file(FALSE, buf, nikki_title, -1, 0);
824 * @brief 日記に任意の内容を表記するコマンドのメインルーチン /
827 static void do_cmd_bunshou(void)
830 char bunshou[80] = "\0";
832 if (get_string(_("内容: ", "diary note: "), tmp, 79))
834 strcpy(bunshou, tmp);
836 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
841 * @brief 最後に取得したアイテムの情報を日記に追加するメインルーチン /
844 static void do_cmd_last_get(void)
849 if (record_o_name[0] == '\0') return;
851 sprintf(buf,_("%sの入手を記録します。", "Do you really want to record getting %s? "),record_o_name);
852 if (!get_check(buf)) return;
856 sprintf(buf,_("%sを手に入れた。", "descover %s."), record_o_name);
857 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
862 * @brief ファイル中の全日記記録を消去する /
865 static void do_cmd_erase_nikki(void)
867 GAME_TEXT file_name[MAX_NLEN];
871 if (!get_check(_("本当に記録を消去しますか?", "Do you really want to delete all your record? "))) return;
872 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
874 /* Build the filename */
875 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
877 /* Remove the file */
880 fff = my_fopen(buf, "w");
883 msg_format(_("記録を消去しました。", "deleted record."));
885 msg_format(_("%s の消去に失敗しました。", "failed to delete %s."), buf);
894 void do_cmd_nikki(void)
898 /* File type is "TEXT" */
899 FILE_TYPE(FILE_TYPE_TEXT);
902 /* Interact until done */
907 /* Ask for a choice */
908 prt(_("[ 記録の設定 ]", "[ Play Record ]"), 2, 0);
910 /* Give some choices */
911 prt(_("(1) 記録を見る", "(1) Display your record"), 4, 5);
912 prt(_("(2) 文章を記録する", "(2) Add record"), 5, 5);
913 prt(_("(3) 直前に入手又は鑑定したものを記録する", "(3) Record item you last get/identify"), 6, 5);
914 prt(_("(4) 記録を消去する", "(4) Delete your record"), 7, 5);
916 prt(_("(R) プレイ動画を記録する/中止する", "(R) Record playing movie / or stop it"), 9, 5);
919 prt(_("コマンド:", "Command: "), 18, 0);
924 if (i == ESCAPE) break;
938 do_cmd_erase_nikki();
942 prepare_movie_hooks();
944 default: /* Unknown option */
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)
974 /* Hack -- react to changes */
975 Term_xtra(TERM_XTRA_REACT, 0);
977 /* Combine and Reorder the pack (later) */
978 p_ptr->update |= (PU_COMBINE | PU_REORDER);
979 p_ptr->update |= (PU_TORCH);
980 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
981 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
982 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
983 p_ptr->update |= (PU_MONSTERS);
985 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
987 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
988 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
994 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
997 /* Redraw every window */
998 for (j = 0; j < 8; j++)
1001 if (!angband_term[j]) continue;
1004 Term_activate(angband_term[j]);
1013 * @brief 名前を変更するコマンドのメインルーチン
1014 * Hack -- change name
1017 void do_cmd_change_name(void)
1032 /* Display the player */
1033 display_player(mode);
1038 display_player(mode);
1043 Term_putstr(2, 23, -1, TERM_WHITE,
1044 "['c'で名前変更, 'f'でファイルへ書出, 'h'でモード変更, ESCで終了]");
1046 Term_putstr(2, 23, -1, TERM_WHITE,
1047 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1055 if (c == ESCAPE) break;
1062 /* Process the player name */
1063 process_player_name(FALSE);
1069 sprintf(tmp, "%s.txt", player_base);
1070 if (get_string(_("ファイル名: ", "File name: "), tmp, 80))
1072 if (tmp[0] && (tmp[0] != ' '))
1074 file_character(tmp);
1092 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1099 * @brief 最近表示されたメッセージを再表示するコマンドのメインルーチン
1100 * Recall the most recent message
1103 void do_cmd_message_one(void)
1105 /* Recall one message */
1106 prt(format("> %s", message_str(0)), 0, 0);
1111 * @brief メッセージのログを表示するコマンドのメインルーチン
1112 * Recall the most recent message
1116 * Show previous messages to the user -BEN-
1118 * The screen format uses line 0 and 23 for headers and prompts,
1119 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1121 * This command shows you which commands you are viewing, and allows
1122 * you to "search" for strings in the recall.
1124 * Note that messages may be longer than 80 characters, but they are
1125 * displayed using "infinite" length, with a special sub-command to
1126 * "slide" the virtual display to the left or right.
1128 * Attempt to only hilite the matching portions of the string.
1131 void do_cmd_messages(int num_now)
1135 char shower_str[81];
1136 char finder_str[81];
1138 concptr shower = NULL;
1142 Term_get_size(&wid, &hgt);
1144 /* Number of message lines in a screen */
1145 num_lines = hgt - 4;
1148 strcpy(finder_str, "");
1151 strcpy(shower_str, "");
1153 /* Total messages */
1156 /* Start on first message */
1161 /* Process requests until done */
1167 /* Dump up to 20 lines of messages */
1168 for (j = 0; (j < num_lines) && (i + j < n); j++)
1170 concptr msg = message_str(i+j);
1172 /* Dump the messages, bottom to top */
1173 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1175 /* Hilite "shower" */
1176 if (shower && shower[0])
1180 /* Display matches */
1181 while ((str = my_strstr(str, shower)) != NULL)
1183 int len = strlen(shower);
1185 /* Display the match */
1186 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1194 /* Erase remaining lines */
1195 for (; j < num_lines; j++)
1197 Term_erase(0, num_lines + 1 - j, 255);
1200 /* Display header */
1202 prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"),
1203 i, i + j - 1, n), 0, 0);
1205 /* Display prompt (not very informative) */
1206 prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]",
1207 "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0);
1209 skey = inkey_special(TRUE);
1211 /* Exit on Escape */
1212 if (skey == ESCAPE) break;
1214 /* Hack -- Save the old index */
1219 /* Hack -- handle show */
1222 prt(_("強調: ", "Show: "), hgt - 1, 0);
1224 /* Get a "shower" string, or continue */
1225 strcpy(back_str, shower_str);
1226 if (askfor(shower_str, 80))
1229 shower = shower_str[0] ? shower_str : NULL;
1231 else strcpy(shower_str, back_str);
1235 /* Hack -- handle find */
1242 prt(_("検索: ", "Find: "), hgt - 1, 0);
1244 /* Get a "finder" string, or continue */
1245 strcpy(back_str, finder_str);
1246 if (!askfor(finder_str, 80))
1248 strcpy(finder_str, back_str);
1251 else if (!finder_str[0])
1253 shower = NULL; /* Stop showing */
1258 shower = finder_str;
1261 for (z = i + 1; z < n; z++)
1263 concptr msg = message_str(z);
1266 if (my_strstr(msg, finder_str))
1277 /* Recall 1 older message */
1279 /* Go to the oldest line */
1283 /* Recall 1 newer message */
1285 /* Go to the newest line */
1289 /* Recall 1 older message */
1294 /* Go older if legal */
1295 i = MIN(i + 1, n - num_lines);
1298 /* Recall 10 older messages */
1300 /* Go older if legal */
1301 i = MIN(i + 10, n - num_lines);
1304 /* Recall 20 older messages */
1309 /* Go older if legal */
1310 i = MIN(i + num_lines, n - num_lines);
1313 /* Recall 20 newer messages */
1317 /* Go newer (if able) */
1318 i = MAX(0, i - num_lines);
1321 /* Recall 10 newer messages */
1323 /* Go newer (if able) */
1327 /* Recall 1 newer messages */
1330 /* Go newer (if able) */
1335 /* Hack -- Error of some kind */
1343 * @brief チートオプションを変更するコマンドのメインルーチン
1344 * Interact with some options for cheating
1345 * @param info 表示メッセージ
1348 static void do_cmd_options_cheat(concptr info)
1351 int i, k = 0, n = CHEAT_MAX;
1355 /* Interact with the player */
1361 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info);
1366 /* 詐欺オプションをうっかりいじってしまう人がいるようなので注意 */
1367 prt(" << 注意 >>", 11, 0);
1368 prt(" 詐欺オプションを一度でも設定すると、スコア記録が残らなくなります!", 12, 0);
1369 prt(" 後に解除してもダメですので、勝利者を目指す方はここのオプションはい", 13, 0);
1370 prt(" じらないようにして下さい。", 14, 0);
1372 /* Display the options */
1373 for (i = 0; i < n; i++)
1375 byte a = TERM_WHITE;
1377 /* Color current option */
1378 if (i == k) a = TERM_L_BLUE;
1380 /* Display the option text */
1381 sprintf(buf, "%-48s: %s (%s)",
1382 cheat_info[i].o_desc,
1383 (*cheat_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1384 cheat_info[i].o_text);
1385 c_prt(a, buf, i + 2, 0);
1388 /* Hilite current option */
1389 move_cursor(k + 2, 50);
1395 * HACK - Try to translate the key into a direction
1396 * to allow using the roguelike keys for navigation.
1398 dir = get_keymap_dir(ch);
1399 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1413 k = (n + k - 1) % n;
1431 do_cmd_write_nikki(NIKKI_BUNSHOU, 0,
1432 _("詐欺オプションをONにして、スコアを残せなくなった。", "give up sending score to use cheating options."));
1433 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1434 (*cheat_info[k].o_var) = TRUE;
1443 (*cheat_info[k].o_var) = FALSE;
1450 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), cheat_info[k].o_text);
1451 /* Peruse the help file */
1452 (void)show_file(TRUE, buf, NULL, 0, 0);
1469 * @brief セーブ頻度ターンの次の値を返す
1470 * @param current 現在のセーブ頻度ターン値
1471 * @return 次のセーブ頻度ターン値
1473 static s16b toggle_frequency(s16b current)
1478 case 50: return 100;
1479 case 100: return 250;
1480 case 250: return 500;
1481 case 500: return 1000;
1482 case 1000: return 2500;
1483 case 2500: return 5000;
1484 case 5000: return 10000;
1485 case 10000: return 25000;
1492 * @brief 自動セーブオプションを変更するコマンドのメインルーチン
1493 * @param info 表示メッセージ
1496 static void do_cmd_options_autosave(concptr info)
1499 int i, k = 0, n = 2;
1504 /* Interact with the player */
1508 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, F で頻度を入力, ESC で決定 ) ",
1509 "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) "), info);
1513 /* Display the options */
1514 for (i = 0; i < n; i++)
1516 byte a = TERM_WHITE;
1518 /* Color current option */
1519 if (i == k) a = TERM_L_BLUE;
1521 /* Display the option text */
1522 sprintf(buf, "%-48s: %s (%s)",
1523 autosave_info[i].o_desc,
1524 (*autosave_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1525 autosave_info[i].o_text);
1526 c_prt(a, buf, i + 2, 0);
1528 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1530 /* Hilite current option */
1531 move_cursor(k + 2, 50);
1547 k = (n + k - 1) % n;
1565 (*autosave_info[k].o_var) = TRUE;
1574 (*autosave_info[k].o_var) = FALSE;
1582 autosave_freq = toggle_frequency(autosave_freq);
1583 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1589 (void)show_file(TRUE, _("joption.txt#Autosave", "option.txt#Autosave"), NULL, 0, 0);
1605 * @brief 標準オプションを変更するコマンドのサブルーチン /
1606 * Interact with some options
1607 * @param page オプションページ番号
1608 * @param info 表示メッセージ
1611 void do_cmd_options_aux(int page, concptr info)
1614 int i, k = 0, n = 0, l;
1617 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1618 (!p_ptr->wizard || !allow_debug_opts);
1621 /* Lookup the options */
1622 for (i = 0; i < 24; i++) opt[i] = 0;
1624 /* Scan the options */
1625 for (i = 0; option_info[i].o_desc; i++)
1627 /* Notice options on this "page" */
1628 if (option_info[i].o_page == page) opt[n++] = i;
1632 /* Interact with the player */
1638 sprintf(buf, _("%s (リターン:次, %sESC:終了, ?:ヘルプ) ", "%s (RET:next, %s, ?:help) "),
1639 info, browse_only ? _("", "ESC:exit") : _("y/n:変更, ", "y/n:change, ESC:accept"));
1642 /* HACK -- description for easy-auto-destroy options */
1643 if (page == OPT_PAGE_AUTODESTROY)
1644 c_prt(TERM_YELLOW, _("以下のオプションは、簡易自動破壊を使用するときのみ有効",
1645 "Following options will protect items from easy auto-destroyer."), 6, _(6, 3));
1647 /* Display the options */
1648 for (i = 0; i < n; i++)
1650 byte a = TERM_WHITE;
1652 /* Color current option */
1653 if (i == k) a = TERM_L_BLUE;
1655 /* Display the option text */
1656 sprintf(buf, "%-48s: %s (%.19s)",
1657 option_info[opt[i]].o_desc,
1658 (*option_info[opt[i]].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1659 option_info[opt[i]].o_text);
1660 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1661 else c_prt(a, buf, i + 2, 0);
1664 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
1667 /* Hilite current option */
1668 move_cursor(k + 2 + l, 50);
1674 * HACK - Try to translate the key into a direction
1675 * to allow using the roguelike keys for navigation.
1677 dir = get_keymap_dir(ch);
1678 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1692 k = (n + k - 1) % n;
1709 if (browse_only) break;
1710 (*option_info[opt[k]].o_var) = TRUE;
1719 if (browse_only) break;
1720 (*option_info[opt[k]].o_var) = FALSE;
1728 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
1734 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), option_info[opt[k]].o_text);
1735 /* Peruse the help file */
1736 (void)show_file(TRUE, buf, NULL, 0, 0);
1753 * @brief ウィンドウオプションを変更するコマンドのメインルーチン /
1754 * Modify the "window" options
1757 static void do_cmd_options_win(void)
1767 /* Memorize old flags */
1768 for (j = 0; j < 8; j++)
1770 /* Acquire current flags */
1771 old_flag[j] = window_flag[j];
1780 prt(_("ウィンドウ・フラグ (<方向>で移動, tでチェンジ, y/n でセット, ESC)", "Window Flags (<dir>, t, y, n, ESC) "), 0, 0);
1782 /* Display the windows */
1783 for (j = 0; j < 8; j++)
1785 byte a = TERM_WHITE;
1787 concptr s = angband_term_name[j];
1790 if (j == x) a = TERM_L_BLUE;
1792 /* Window name, staggered, centered */
1793 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
1796 /* Display the options */
1797 for (i = 0; i < 16; i++)
1799 byte a = TERM_WHITE;
1801 concptr str = window_flag_desc[i];
1804 if (i == y) a = TERM_L_BLUE;
1807 if (!str) str = _("(未使用)", "(Unused option)");
1810 Term_putstr(0, i + 5, -1, a, str);
1812 /* Display the windows */
1813 for (j = 0; j < 8; j++)
1819 if ((i == y) && (j == x)) a = TERM_L_BLUE;
1822 if (window_flag[j] & (1L << i)) c = 'X';
1825 Term_putch(35 + j * 5, i + 5, a, c);
1830 Term_gotoxy(35 + x * 5, y + 5);
1848 for (j = 0; j < 8; j++)
1850 window_flag[j] &= ~(1L << y);
1854 for (i = 0; i < 16; i++)
1856 window_flag[x] &= ~(1L << i);
1869 window_flag[x] |= (1L << y);
1877 window_flag[x] &= ~(1L << y);
1883 (void)show_file(TRUE, _("joption.txt#Window", "option.txt#Window"), NULL, 0, 0);
1891 d = get_keymap_dir(ch);
1893 x = (x + ddx[d] + 8) % 8;
1894 y = (y + ddy[d] + 16) % 16;
1901 /* Notice changes */
1902 for (j = 0; j < 8; j++)
1907 if (!angband_term[j]) continue;
1909 /* Ignore non-changes */
1910 if (window_flag[j] == old_flag[j]) continue;
1913 Term_activate(angband_term[j]);
1930 option_fields[OPT_NUM] =
1933 { '1', " キー入力 オプション", 3 },
1934 { '2', " マップ画面 オプション", 4 },
1935 { '3', " テキスト表示 オプション", 5 },
1936 { '4', " ゲームプレイ オプション", 6 },
1937 { '5', " 行動中止関係 オプション", 7 },
1938 { '6', " 簡易自動破壊 オプション", 8 },
1939 { 'r', " プレイ記録 オプション", 9 },
1941 { 'p', "自動拾いエディタ", 11 },
1942 { 'd', " 基本ウェイト量 ", 12 },
1943 { 'h', "低ヒットポイント", 13 },
1944 { 'm', " 低魔力色閾値 ", 14 },
1945 { 'a', " 自動セーブ オプション", 15 },
1946 { 'w', "ウインドウフラグ", 16 },
1948 { 'b', " 初期 オプション (参照のみ)", 18 },
1949 { 'c', " 詐欺 オプション", 19 },
1951 { '1', "Input Options", 3 },
1952 { '2', "Map Screen Options", 4 },
1953 { '3', "Text Display Options", 5 },
1954 { '4', "Game-Play Options", 6 },
1955 { '5', "Disturbance Options", 7 },
1956 { '6', "Easy Auto-Destroyer Options", 8 },
1957 { 'r', "Play record Options", 9 },
1959 { 'p', "Auto-picker/destroyer editor", 11 },
1960 { 'd', "Base Delay Factor", 12 },
1961 { 'h', "Hitpoint Warning", 13 },
1962 { 'm', "Mana Color Threshold", 14 },
1963 { 'a', "Autosave Options", 15 },
1964 { 'w', "Window Flags", 16 },
1966 { 'b', "Birth Options (Browse Only)", 18 },
1967 { 'c', "Cheat Options", 19 },
1973 * @brief 標準オプションを変更するコマンドのメインルーチン /
1974 * Set or unset various options.
1978 * The user must use the "Ctrl-R" command to "adapt" to changes
1979 * in any options which control "visual" aspects of the game.
1982 void do_cmd_options(void)
1994 /* Does not list cheat option when cheat option is off */
1995 if (!p_ptr->noscore && !allow_debug_opts) n--;
1998 /* Why are we here */
1999 prt(_("[ オプションの設定 ]", "TinyAngband options"), 1, 0);
2003 /* Give some choices */
2004 for (i = 0; i < n; i++)
2006 byte a = TERM_WHITE;
2007 if (i == y) a = TERM_L_BLUE;
2008 Term_putstr(5, option_fields[i].row, -1, a,
2009 format("(%c) %s", toupper(option_fields[i].key), option_fields[i].name));
2012 prt(_("<方向>で移動, Enterで決定, ESCでキャンセル, ?でヘルプ: ", "Move to <dir>, Select to Enter, Cancel to ESC, ? to help: "), 21, 0);
2015 skey = inkey_special(TRUE);
2016 if (!(skey & SKEY_MASK)) k = (char)skey;
2020 if (k == ESCAPE) break;
2022 if (my_strchr("\n\r ", k))
2024 k = option_fields[y].key;
2028 for (i = 0; i < n; i++)
2030 if (tolower(k) == option_fields[i].key) break;
2033 /* Command is found */
2036 /* Hack -- browse help */
2037 if (k == '?') break;
2041 if (skey == SKEY_UP) d = 8;
2042 if (skey == SKEY_DOWN) d = 2;
2043 y = (y + ddy[d] + n) % n;
2048 if (k == ESCAPE) break;
2055 /* Process the general options */
2056 do_cmd_options_aux(OPT_PAGE_INPUT, _("キー入力オプション", "Input Options"));
2062 /* Process the general options */
2063 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, _("マップ画面オプション", "Map Screen Options"));
2070 do_cmd_options_aux(OPT_PAGE_TEXT, _("テキスト表示オプション", "Text Display Options"));
2077 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, _("ゲームプレイ・オプション", "Game-Play Options"));
2084 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, _("行動中止関係のオプション", "Disturbance Options"));
2091 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, _("簡易自動破壊オプション", "Easy Auto-Destroyer Options"));
2095 /* Play-record Options */
2100 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, _("プレイ記録オプション", "Play-record Options"));
2109 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ?
2110 _("初期オプション(参照のみ)", "Birth Options(browse only)") :
2111 _("初期オプション((*)はスコアに影響)", "Birth Options((*)s effect score)"));
2115 /* Cheating Options */
2118 if (!p_ptr->noscore && !allow_debug_opts)
2120 /* Cheat options are not permitted */
2126 do_cmd_options_cheat(_("詐欺師は決して勝利できない!", "Cheaters never win"));
2133 do_cmd_options_autosave(_("自動セーブ", "Autosave"));
2142 do_cmd_options_win();
2143 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2144 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2145 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2146 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON |
2151 /* Auto-picker/destroyer editor */
2155 do_cmd_edit_autopick();
2159 /* Hack -- Delay Speed */
2165 prt(_("コマンド: 基本ウェイト量", "Command: Base Delay Factor"), 19, 0);
2167 /* Get a new value */
2170 int msec = delay_factor * delay_factor * delay_factor;
2171 prt(format(_("現在のウェイト: %d (%dミリ秒)", "Current base delay factor: %d (%d msec)"), delay_factor, msec), 22, 0);
2172 prt(_("ウェイト (0-9) ESCで決定: ", "Delay Factor (0-9 or ESC to accept): "), 20, 0);
2174 if (k == ESCAPE) break;
2177 (void)show_file(TRUE, _("joption.txt#BaseDelay", "option.txt#BaseDelay"), NULL, 0, 0);
2180 else if (isdigit(k)) delay_factor = D2I(k);
2187 /* Hack -- hitpoint warning factor */
2193 prt(_("コマンド: 低ヒットポイント警告", "Command: Hitpoint Warning"), 19, 0);
2195 /* Get a new value */
2198 prt(format(_("現在の低ヒットポイント警告: %d0%%", "Current hitpoint warning: %d0%%"), hitpoint_warn), 22, 0);
2199 prt(_("低ヒットポイント警告 (0-9) ESCで決定: ", "Hitpoint Warning (0-9 or ESC to accept): "), 20, 0);
2201 if (k == ESCAPE) break;
2204 (void)show_file(TRUE, _("joption.txt#Hitpoint", "option.txt#Hitpoint"), NULL, 0, 0);
2207 else if (isdigit(k)) hitpoint_warn = D2I(k);
2214 /* Hack -- mana color factor */
2220 prt(_("コマンド: 低魔力色閾値", "Command: Mana Color Threshold"), 19, 0);
2222 /* Get a new value */
2225 prt(format(_("現在の低魔力色閾値: %d0%%", "Current mana color threshold: %d0%%"), mana_warn), 22, 0);
2226 prt(_("低魔力閾値 (0-9) ESCで決定: ", "Mana color Threshold (0-9 or ESC to accept): "), 20, 0);
2228 if (k == ESCAPE) break;
2231 (void)show_file(TRUE, _("joption.txt#Manapoint", "option.txt#Manapoint"), NULL, 0, 0);
2234 else if (isdigit(k)) mana_warn = D2I(k);
2242 (void)show_file(TRUE, _("joption.txt", "option.txt"), NULL, 0, 0);
2246 /* Unknown option */
2259 /* Hack - Redraw equippy chars */
2260 p_ptr->redraw |= (PR_EQUIPPY);
2266 * @brief prefファイルを選択して処理する /
2267 * Ask for a "user pref line" and process it
2270 * Allow absolute file names?
2272 void do_cmd_pref(void)
2279 /* Ask for a "user pref command" */
2280 if (!get_string(_("設定変更コマンド: ", "Pref: "), buf, 80)) return;
2282 /* Process that pref command */
2283 (void)process_pref_file_command(buf);
2287 * @brief 自動拾い設定ファイルをロードするコマンドのメインルーチン /
2290 void do_cmd_reload_autopick(void)
2292 if (!get_check(_("自動拾い設定ファイルをロードしますか? ", "Reload auto-pick preference file? "))) return;
2293 /* Load the file with messages */
2294 autopick_load_pref(TRUE);
2300 * @brief マクロ情報をprefファイルに保存する /
2301 * @param fname ファイル名
2304 static errr macro_dump(concptr fname)
2306 static concptr mark = "Macro Dump";
2312 /* Build the filename */
2313 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2315 /* File type is "TEXT" */
2316 FILE_TYPE(FILE_TYPE_TEXT);
2318 /* Append to the file */
2319 if (!open_auto_dump(buf, mark)) return (-1);
2322 auto_dump_printf(_("\n# 自動マクロセーブ\n\n", "\n# Automatic macro dump\n\n"));
2325 for (i = 0; i < macro__num; i++)
2327 /* Extract the action */
2328 ascii_to_text(buf, macro__act[i]);
2330 /* Dump the macro */
2331 auto_dump_printf("A:%s\n", buf);
2333 /* Extract the action */
2334 ascii_to_text(buf, macro__pat[i]);
2336 /* Dump normal macros */
2337 auto_dump_printf("P:%s\n", buf);
2340 auto_dump_printf("\n");
2352 * @brief マクロのトリガーキーを取得する /
2353 * Hack -- ask for a "trigger" (see below)
2354 * @param buf キー表記を保管するバッファ
2358 * Note the complex use of the "inkey()" function from "util.c".
2360 * Note that both "flush()" calls are extremely important.
2363 static void do_cmd_macro_aux(char *buf)
2371 /* Do not process macros */
2377 /* Read the pattern */
2383 /* Do not process macros */
2386 /* Do not wait for keys */
2389 /* Attempt to read a key */
2398 /* Convert the trigger */
2399 ascii_to_text(tmp, buf);
2401 /* Hack -- display the trigger */
2402 Term_addstr(-1, TERM_WHITE, tmp);
2408 * @brief マクロのキー表記からアスキーコードを得てターミナルに表示する /
2409 * Hack -- ask for a keymap "trigger" (see below)
2410 * @param buf キー表記を取得するバッファ
2414 * Note that both "flush()" calls are extremely important. This may
2415 * no longer be true, since "util.c" is much simpler now.
2418 static void do_cmd_macro_aux_keymap(char *buf)
2428 /* Convert to ascii */
2429 ascii_to_text(tmp, buf);
2431 /* Hack -- display the trigger */
2432 Term_addstr(-1, TERM_WHITE, tmp);
2439 * @brief キーマップをprefファイルにダンプする /
2440 * Hack -- append all keymaps to the given file
2441 * @param fname ファイルネーム
2445 static errr keymap_dump(concptr fname)
2447 static concptr mark = "Keymap Dump";
2456 if (rogue_like_commands)
2458 mode = KEYMAP_MODE_ROGUE;
2464 mode = KEYMAP_MODE_ORIG;
2468 /* Build the filename */
2469 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2471 /* File type is "TEXT" */
2472 FILE_TYPE(FILE_TYPE_TEXT);
2474 /* Append to the file */
2475 if (!open_auto_dump(buf, mark)) return -1;
2478 auto_dump_printf(_("\n# 自動キー配置セーブ\n\n", "\n# Automatic keymap dump\n\n"));
2481 for (i = 0; i < 256; i++)
2485 /* Loop up the keymap */
2486 act = keymap_act[mode][i];
2488 /* Skip empty keymaps */
2491 /* Encode the key */
2494 ascii_to_text(key, buf);
2496 /* Encode the action */
2497 ascii_to_text(buf, act);
2499 /* Dump the macro */
2500 auto_dump_printf("A:%s\n", buf);
2501 auto_dump_printf("C:%d:%s\n", mode, key);
2513 * @brief マクロを設定するコマンドのメインルーチン /
2514 * Interact with "macros"
2518 * Note that the macro "action" must be defined before the trigger.
2520 * Could use some helpful instructions on this page.
2523 void do_cmd_macros(void)
2535 if (rogue_like_commands)
2537 mode = KEYMAP_MODE_ROGUE;
2543 mode = KEYMAP_MODE_ORIG;
2546 /* File type is "TEXT" */
2547 FILE_TYPE(FILE_TYPE_TEXT);
2552 /* Process requests until done */
2556 prt(_("[ マクロの設定 ]", "Interact with Macros"), 2, 0);
2558 /* Describe that action */
2559 prt(_("マクロ行動が(もしあれば)下に表示されます:", "Current action (if any) shown below:"), 20, 0);
2561 /* Analyze the current action */
2562 ascii_to_text(buf, macro__buf);
2564 /* Display the current action */
2569 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
2571 prt(_("(2) ファイルにマクロを追加", "(2) Append macros to a file"), 5, 5);
2572 prt(_("(3) マクロの確認", "(3) Query a macro"), 6, 5);
2573 prt(_("(4) マクロの作成", "(4) Create a macro"), 7, 5);
2574 prt(_("(5) マクロの削除", "(5) Remove a macro"), 8, 5);
2575 prt(_("(6) ファイルにキー配置を追加", "(6) Append keymaps to a file"), 9, 5);
2576 prt(_("(7) キー配置の確認", "(7) Query a keymap"), 10, 5);
2577 prt(_("(8) キー配置の作成", "(8) Create a keymap"), 11, 5);
2578 prt(_("(9) キー配置の削除", "(9) Remove a keymap"), 12, 5);
2579 prt(_("(0) マクロ行動の入力", "(0) Enter a new action"), 13, 5);
2580 #endif /* ALLOW_MACROS */
2583 prt(_("コマンド: ", "Command: "), 16, 0);
2588 if (i == ESCAPE) break;
2590 /* Load a 'macro' file */
2596 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 16, 0);
2599 prt(_("ファイル: ", "File: "), 18, 0);
2601 /* Default filename */
2602 sprintf(tmp, "%s.prf", player_base);
2604 /* Ask for a file */
2605 if (!askfor(tmp, 80)) continue;
2607 /* Process the given filename */
2608 err = process_pref_file(tmp);
2611 msg_format(_("標準の設定ファイル'%s'を読み込みました。", "Loaded default '%s'."), tmp);
2616 msg_format(_("'%s'の読み込みに失敗しました!", "Failed to load '%s'!"), tmp);
2620 msg_format(_("'%s'を読み込みました。", "Loaded '%s'."), tmp);
2630 prt(_("コマンド: マクロをファイルに追加する", "Command: Append macros to a file"), 16, 0);
2633 prt(_("ファイル: ", "File: "), 18, 0);
2635 /* Default filename */
2636 sprintf(tmp, "%s.prf", player_base);
2638 /* Ask for a file */
2639 if (!askfor(tmp, 80)) continue;
2641 /* Dump the macros */
2642 (void)macro_dump(tmp);
2645 msg_print(_("マクロを追加しました。", "Appended macros."));
2654 prt(_("コマンド: マクロの確認", "Command: Query a macro"), 16, 0);
2658 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2660 /* Get a macro trigger */
2661 do_cmd_macro_aux(buf);
2663 /* Acquire action */
2664 k = macro_find_exact(buf);
2670 msg_print(_("そのキーにはマクロは定義されていません。", "Found no macro."));
2676 /* Obtain the action */
2677 strcpy(macro__buf, macro__act[k]);
2679 /* Analyze the current action */
2680 ascii_to_text(buf, macro__buf);
2682 /* Display the current action */
2686 msg_print(_("マクロを確認しました。", "Found a macro."));
2690 /* Create a macro */
2694 prt(_("コマンド: マクロの作成", "Command: Create a macro"), 16, 0);
2697 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2699 /* Get a macro trigger */
2700 do_cmd_macro_aux(buf);
2706 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2707 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2710 prt(_("マクロ行動: ", "Action: "), 20, 0);
2712 /* Convert to text */
2713 ascii_to_text(tmp, macro__buf);
2715 /* Get an encoded action */
2716 if (askfor(tmp, 80))
2718 /* Convert to ascii */
2719 text_to_ascii(macro__buf, tmp);
2721 /* Link the macro */
2722 macro_add(buf, macro__buf);
2725 msg_print(_("マクロを追加しました。", "Added a macro."));
2729 /* Remove a macro */
2733 prt(_("コマンド: マクロの削除", "Command: Remove a macro"), 16, 0);
2736 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2738 /* Get a macro trigger */
2739 do_cmd_macro_aux(buf);
2741 /* Link the macro */
2742 macro_add(buf, buf);
2745 msg_print(_("マクロを削除しました。", "Removed a macro."));
2752 prt(_("コマンド: キー配置をファイルに追加する", "Command: Append keymaps to a file"), 16, 0);
2755 prt(_("ファイル: ", "File: "), 18, 0);
2757 /* Default filename */
2758 sprintf(tmp, "%s.prf", player_base);
2760 /* Ask for a file */
2761 if (!askfor(tmp, 80)) continue;
2763 /* Dump the macros */
2764 (void)keymap_dump(tmp);
2767 msg_print(_("キー配置を追加しました。", "Appended keymaps."));
2770 /* Query a keymap */
2776 prt(_("コマンド: キー配置の確認", "Command: Query a keymap"), 16, 0);
2779 prt(_("押すキー: ", "Keypress: "), 18, 0);
2781 /* Get a keymap trigger */
2782 do_cmd_macro_aux_keymap(buf);
2784 /* Look up the keymap */
2785 act = keymap_act[mode][(byte)(buf[0])];
2791 msg_print(_("キー配置は定義されていません。", "Found no keymap."));
2797 /* Obtain the action */
2798 strcpy(macro__buf, act);
2800 /* Analyze the current action */
2801 ascii_to_text(buf, macro__buf);
2803 /* Display the current action */
2807 msg_print(_("キー配置を確認しました。", "Found a keymap."));
2811 /* Create a keymap */
2815 prt(_("コマンド: キー配置の作成", "Command: Create a keymap"), 16, 0);
2818 prt(_("押すキー: ", "Keypress: "), 18, 0);
2820 /* Get a keymap trigger */
2821 do_cmd_macro_aux_keymap(buf);
2827 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2828 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2831 prt(_("行動: ", "Action: "), 20, 0);
2833 /* Convert to text */
2834 ascii_to_text(tmp, macro__buf);
2836 /* Get an encoded action */
2837 if (askfor(tmp, 80))
2839 /* Convert to ascii */
2840 text_to_ascii(macro__buf, tmp);
2842 /* Free old keymap */
2843 string_free(keymap_act[mode][(byte)(buf[0])]);
2845 /* Make new keymap */
2846 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
2849 msg_print(_("キー配置を追加しました。", "Added a keymap."));
2853 /* Remove a keymap */
2857 prt(_("コマンド: キー配置の削除", "Command: Remove a keymap"), 16, 0);
2860 prt(_("押すキー: ", "Keypress: "), 18, 0);
2862 /* Get a keymap trigger */
2863 do_cmd_macro_aux_keymap(buf);
2865 /* Free old keymap */
2866 string_free(keymap_act[mode][(byte)(buf[0])]);
2868 /* Make new keymap */
2869 keymap_act[mode][(byte)(buf[0])] = NULL;
2872 msg_print(_("キー配置を削除しました。", "Removed a keymap."));
2875 /* Enter a new action */
2879 prt(_("コマンド: マクロ行動の入力", "Command: Enter a new action"), 16, 0);
2885 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2886 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2889 prt(_("マクロ行動: ", "Action: "), 20, 0);
2891 /* Hack -- limit the value */
2894 /* Get an encoded action */
2895 if (!askfor(buf, 80)) continue;
2897 /* Extract an action */
2898 text_to_ascii(macro__buf, buf);
2901 #endif /* ALLOW_MACROS */
2914 * @brief キャラクタ色の明暗表現
2916 static concptr lighting_level_str[F_LIT_MAX] =
2931 * @brief キャラクタのビジュアルIDを変更する際の対象指定関数
2932 * @param i 指定対象となるキャラクタコード
2933 * @param num 指定されたビジュアルIDを返す参照ポインタ
2934 * @param max ビジュアルIDの最大数
2935 * @return 指定が実際に行われた場合TRUE、キャンセルされた場合FALSE
2937 static bool cmd_visuals_aux(int i, IDX *num, IDX max)
2944 sprintf(str, "%d", *num);
2946 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
2949 tmp = (IDX)strtol(str, NULL, 0);
2950 if (tmp >= 0 && tmp < max)
2953 else if (isupper(i))
2954 *num = (*num + max - 1) % max;
2956 *num = (*num + 1) % max;
2962 * @brief キャラクタの変更メニュー表示
2963 * @param choice_msg 選択メッセージ
2966 static void print_visuals_menu(concptr choice_msg)
2968 prt(_("[ 画面表示の設定 ]", "Interact with Visuals"), 1, 0);
2970 /* Give some choices */
2971 prt(_("(0) ユーザー設定ファイルのロード", "(0) Load a user pref file"), 3, 5);
2973 #ifdef ALLOW_VISUALS
2974 prt(_("(1) モンスターの 色/文字 をファイルに書き出す", "(1) Dump monster attr/chars"), 4, 5);
2975 prt(_("(2) アイテムの 色/文字 をファイルに書き出す", "(2) Dump object attr/chars"), 5, 5);
2976 prt(_("(3) 地形の 色/文字 をファイルに書き出す", "(3) Dump feature attr/chars"), 6, 5);
2977 prt(_("(4) モンスターの 色/文字 を変更する (数値操作)", "(4) Change monster attr/chars (numeric operation)"), 7, 5);
2978 prt(_("(5) アイテムの 色/文字 を変更する (数値操作)", "(5) Change object attr/chars (numeric operation)"), 8, 5);
2979 prt(_("(6) 地形の 色/文字 を変更する (数値操作)", "(6) Change feature attr/chars (numeric operation)"), 9, 5);
2980 prt(_("(7) モンスターの 色/文字 を変更する (シンボルエディタ)", "(7) Change monster attr/chars (visual mode)"), 10, 5);
2981 prt(_("(8) アイテムの 色/文字 を変更する (シンボルエディタ)", "(8) Change object attr/chars (visual mode)"), 11, 5);
2982 prt(_("(9) 地形の 色/文字 を変更する (シンボルエディタ)", "(9) Change feature attr/chars (visual mode)"), 12, 5);
2983 #endif /* ALLOW_VISUALS */
2985 prt(_("(R) 画面表示方法の初期化", "(R) Reset visuals"), 13, 5);
2988 prt(format("コマンド: %s", choice_msg ? choice_msg : _("", "")), 15, 0);
2991 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx);
2992 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx);
2993 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level);
2996 * Interact with "visuals"
2998 void do_cmd_visuals(void)
3003 bool need_redraw = FALSE;
3004 concptr empty_symbol = "<< ? >>";
3006 if (use_bigtile) empty_symbol = "<< ?? >>";
3008 /* File type is "TEXT" */
3009 FILE_TYPE(FILE_TYPE_TEXT);
3012 /* Interact until done */
3017 /* Ask for a choice */
3018 print_visuals_menu(NULL);
3023 if (i == ESCAPE) break;
3027 /* Load a 'pref' file */
3030 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 15, 0);
3033 prt(_("ファイル: ", "File: "), 17, 0);
3035 /* Default filename */
3036 sprintf(tmp, "%s.prf", player_base);
3039 if (!askfor(tmp, 70)) continue;
3041 /* Process the given filename */
3042 (void)process_pref_file(tmp);
3047 #ifdef ALLOW_VISUALS
3049 /* Dump monster attr/chars */
3052 static concptr mark = "Monster attr/chars";
3055 prt(_("コマンド: モンスターの[色/文字]をファイルに書き出します", "Command: Dump monster attr/chars"), 15, 0);
3058 prt(_("ファイル: ", "File: "), 17, 0);
3060 /* Default filename */
3061 sprintf(tmp, "%s.prf", player_base);
3063 /* Get a filename */
3064 if (!askfor(tmp, 70)) continue;
3066 /* Build the filename */
3067 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3069 /* Append to the file */
3070 if (!open_auto_dump(buf, mark)) continue;
3073 auto_dump_printf(_("\n# モンスターの[色/文字]の設定\n\n", "\n# Monster attr/char definitions\n\n"));
3076 for (i = 0; i < max_r_idx; i++)
3078 monster_race *r_ptr = &r_info[i];
3080 /* Skip non-entries */
3081 if (!r_ptr->name) continue;
3083 /* Dump a comment */
3084 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3086 /* Dump the monster attr/char info */
3087 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3088 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3094 msg_print(_("モンスターの[色/文字]をファイルに書き出しました。", "Dumped monster attr/chars."));
3099 /* Dump object attr/chars */
3102 static concptr mark = "Object attr/chars";
3103 KIND_OBJECT_IDX k_idx;
3106 prt(_("コマンド: アイテムの[色/文字]をファイルに書き出します", "Command: Dump object attr/chars"), 15, 0);
3109 prt(_("ファイル: ", "File: "), 17, 0);
3111 /* Default filename */
3112 sprintf(tmp, "%s.prf", player_base);
3114 /* Get a filename */
3115 if (!askfor(tmp, 70)) continue;
3117 /* Build the filename */
3118 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3120 /* Append to the file */
3121 if (!open_auto_dump(buf, mark)) continue;
3124 auto_dump_printf(_("\n# アイテムの[色/文字]の設定\n\n", "\n# Object attr/char definitions\n\n"));
3127 for (k_idx = 0; k_idx < max_k_idx; k_idx++)
3129 GAME_TEXT o_name[MAX_NLEN];
3130 object_kind *k_ptr = &k_info[k_idx];
3132 /* Skip non-entries */
3133 if (!k_ptr->name) continue;
3138 strip_name(o_name, k_idx);
3144 /* Prepare dummy object */
3145 object_prep(&forge, k_idx);
3147 /* Get un-shuffled flavor name */
3148 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3151 /* Dump a comment */
3152 auto_dump_printf("# %s\n", o_name);
3154 /* Dump the object attr/char info */
3155 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", (int)k_idx,
3156 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3162 msg_print(_("アイテムの[色/文字]をファイルに書き出しました。", "Dumped object attr/chars."));
3167 /* Dump feature attr/chars */
3170 static concptr mark = "Feature attr/chars";
3173 prt(_("コマンド: 地形の[色/文字]をファイルに書き出します", "Command: Dump feature 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# Feature attr/char definitions\n\n"));
3194 for (i = 0; i < max_f_idx; i++)
3196 feature_type *f_ptr = &f_info[i];
3198 /* Skip non-entries */
3199 if (!f_ptr->name) continue;
3201 /* Skip mimiccing features */
3202 if (f_ptr->mimic != i) continue;
3204 /* Dump a comment */
3205 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3207 /* Dump the feature attr/char info */
3208 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
3209 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
3210 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
3211 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
3217 msg_print(_("地形の[色/文字]をファイルに書き出しました。", "Dumped feature attr/chars."));
3222 /* Modify monster attr/chars (numeric operation) */
3225 static concptr choice_msg = _("モンスターの[色/文字]を変更します", "Change monster attr/chars");
3226 static MONRACE_IDX r = 0;
3228 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3230 /* Hack -- query until done */
3233 monster_race *r_ptr = &r_info[r];
3237 TERM_COLOR da = r_ptr->d_attr;
3238 byte dc = r_ptr->d_char;
3239 TERM_COLOR ca = r_ptr->x_attr;
3240 byte cc = r_ptr->x_char;
3242 /* Label the object */
3243 Term_putstr(5, 17, -1, TERM_WHITE,
3244 format(_("モンスター = %d, 名前 = %-40.40s", "Monster = %d, Name = %-40.40s"), r, (r_name + r_ptr->name)));
3246 /* Label the Default values */
3247 Term_putstr(10, 19, -1, TERM_WHITE,
3248 format(_("初期値 色 / 文字 = %3u / %3u", "Default attr/char = %3u / %3u"), da, dc));
3250 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3251 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3253 /* Label the Current values */
3254 Term_putstr(10, 20, -1, TERM_WHITE,
3255 format(_("現在値 色 / 文字 = %3u / %3u", "Current attr/char = %3u / %3u"), ca, cc));
3257 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3258 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3261 Term_putstr(0, 22, -1, TERM_WHITE,
3262 _("コマンド (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): "));
3267 if (i == ESCAPE) break;
3269 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3270 else if (isupper(i)) c = 'a' + i - 'A';
3280 if (!cmd_visuals_aux(i, &r, max_r_idx))
3286 while (!r_info[r].name);
3290 t = (int)r_ptr->x_attr;
3291 (void)cmd_visuals_aux(i, &t, 256);
3292 r_ptr->x_attr = (byte)t;
3296 t = (int)r_ptr->x_char;
3297 (void)cmd_visuals_aux(i, &t, 256);
3298 r_ptr->x_char = (byte)t;
3302 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
3304 print_visuals_menu(choice_msg);
3312 /* Modify object attr/chars (numeric operation) */
3315 static concptr choice_msg = _("アイテムの[色/文字]を変更します", "Change object attr/chars");
3317 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3319 /* Hack -- query until done */
3322 object_kind *k_ptr = &k_info[k];
3326 TERM_COLOR da = k_ptr->d_attr;
3327 SYMBOL_CODE dc = k_ptr->d_char;
3328 TERM_COLOR ca = k_ptr->x_attr;
3329 SYMBOL_CODE cc = k_ptr->x_char;
3331 /* Label the object */
3332 Term_putstr(5, 17, -1, TERM_WHITE,
3333 format(_("アイテム = %d, 名前 = %-40.40s", "Object = %d, Name = %-40.40s"),
3334 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
3336 /* Label the Default values */
3337 Term_putstr(10, 19, -1, TERM_WHITE,
3338 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3340 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3341 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3343 /* Label the Current values */
3344 Term_putstr(10, 20, -1, TERM_WHITE,
3345 format(_("現在値 色 / 文字 = %3d / %3d", "Current attr/char = %3d / %3d"), ca, cc));
3347 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3348 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3351 Term_putstr(0, 22, -1, TERM_WHITE,
3352 _("コマンド (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): "));
3357 if (i == ESCAPE) break;
3359 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3360 else if (isupper(i)) c = 'a' + i - 'A';
3370 if (!cmd_visuals_aux(i, &k, max_k_idx))
3376 while (!k_info[k].name);
3380 t = (int)k_ptr->x_attr;
3381 (void)cmd_visuals_aux(i, &t, 256);
3382 k_ptr->x_attr = (byte)t;
3386 t = (int)k_ptr->x_char;
3387 (void)cmd_visuals_aux(i, &t, 256);
3388 k_ptr->x_char = (byte)t;
3392 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
3394 print_visuals_menu(choice_msg);
3402 /* Modify feature attr/chars (numeric operation) */
3405 static concptr choice_msg = _("地形の[色/文字]を変更します", "Change feature attr/chars");
3407 static IDX lighting_level = F_LIT_STANDARD;
3408 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3410 /* Hack -- query until done */
3413 feature_type *f_ptr = &f_info[f];
3417 TERM_COLOR da = f_ptr->d_attr[lighting_level];
3418 byte dc = f_ptr->d_char[lighting_level];
3419 TERM_COLOR ca = f_ptr->x_attr[lighting_level];
3420 byte cc = f_ptr->x_char[lighting_level];
3422 /* Label the object */
3424 Term_putstr(5, 17, -1, TERM_WHITE,
3425 format(_("地形 = %d, 名前 = %s, 明度 = %s", "Terrain = %d, Name = %s, Lighting = %s"),
3426 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
3428 /* Label the Default values */
3429 Term_putstr(10, 19, -1, TERM_WHITE,
3430 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3432 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3433 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3435 /* Label the Current values */
3437 Term_putstr(10, 20, -1, TERM_WHITE,
3438 format("現在値 色 / 文字 = %3d / %3d", ca, cc));
3440 Term_putstr(10, 20, -1, TERM_WHITE,
3441 format("Current attr/char = %3d / %3d", ca, cc));
3444 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3445 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3449 Term_putstr(0, 22, -1, TERM_WHITE,
3450 "コマンド (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3452 Term_putstr(0, 22, -1, TERM_WHITE,
3453 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3459 if (i == ESCAPE) break;
3461 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3462 else if (isupper(i)) c = 'a' + i - 'A';
3472 if (!cmd_visuals_aux(i, &f, max_f_idx))
3478 while (!f_info[f].name || (f_info[f].mimic != f));
3482 t = (int)f_ptr->x_attr[lighting_level];
3483 (void)cmd_visuals_aux(i, &t, 256);
3484 f_ptr->x_attr[lighting_level] = (byte)t;
3488 t = (int)f_ptr->x_char[lighting_level];
3489 (void)cmd_visuals_aux(i, &t, 256);
3490 f_ptr->x_char[lighting_level] = (byte)t;
3494 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
3497 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
3501 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
3503 print_visuals_menu(choice_msg);
3511 /* Modify monster attr/chars (visual mode) */
3513 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
3516 /* Modify object attr/chars (visual mode) */
3518 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
3521 /* Modify feature attr/chars (visual mode) */
3524 IDX lighting_level = F_LIT_STANDARD;
3525 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
3529 #endif /* ALLOW_VISUALS */
3537 msg_print(_("画面上の[色/文字]を初期値にリセットしました。", "Visual attr/char tables reset."));
3541 /* Unknown option */
3551 if (need_redraw) do_cmd_redraw();
3556 * Interact with "colors"
3558 void do_cmd_colors(void)
3567 /* File type is "TEXT" */
3568 FILE_TYPE(FILE_TYPE_TEXT);
3573 /* Interact until done */
3578 /* Ask for a choice */
3579 prt(_("[ カラーの設定 ]", "Interact with Colors"), 2, 0);
3581 /* Give some choices */
3582 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
3585 prt(_("(2) カラーの設定をファイルに書き出す", "(2) Dump colors"), 5, 5);
3586 prt(_("(3) カラーの設定を変更する", "(3) Modify colors"), 6, 5);
3590 prt(_("コマンド: ", "Command: "), 8, 0);
3594 if (i == ESCAPE) break;
3596 /* Load a 'pref' file */
3600 prt(_("コマンド: ユーザー設定ファイルをロードします", "Command: Load a user pref file"), 8, 0);
3603 prt(_("ファイル: ", "File: "), 10, 0);
3606 sprintf(tmp, "%s.prf", player_base);
3609 if (!askfor(tmp, 70)) continue;
3611 /* Process the given filename */
3612 (void)process_pref_file(tmp);
3614 /* Mega-Hack -- react to changes */
3615 Term_xtra(TERM_XTRA_REACT, 0);
3617 /* Mega-Hack -- redraw */
3626 static concptr mark = "Colors";
3629 prt(_("コマンド: カラーの設定をファイルに書き出します", "Command: Dump colors"), 8, 0);
3632 prt(_("ファイル: ", "File: "), 10, 0);
3634 /* Default filename */
3635 sprintf(tmp, "%s.prf", player_base);
3637 /* Get a filename */
3638 if (!askfor(tmp, 70)) continue;
3640 /* Build the filename */
3641 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3643 /* Append to the file */
3644 if (!open_auto_dump(buf, mark)) continue;
3647 auto_dump_printf(_("\n# カラーの設定\n\n", "\n# Color redefinitions\n\n"));
3650 for (i = 0; i < 256; i++)
3652 int kv = angband_color_table[i][0];
3653 int rv = angband_color_table[i][1];
3654 int gv = angband_color_table[i][2];
3655 int bv = angband_color_table[i][3];
3657 concptr name = _("未知", "unknown");
3659 /* Skip non-entries */
3660 if (!kv && !rv && !gv && !bv) continue;
3662 /* Extract the color name */
3663 if (i < 16) name = color_names[i];
3665 /* Dump a comment */
3666 auto_dump_printf(_("# カラー '%s'\n", "# Color '%s'\n"), name);
3668 /* Dump the monster attr/char info */
3669 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
3676 msg_print(_("カラーの設定をファイルに書き出しました。", "Dumped color redefinitions."));
3685 prt(_("コマンド: カラーの設定を変更します", "Command: Modify colors"), 8, 0);
3687 /* Hack -- query until done */
3696 /* Exhibit the normal colors */
3697 for (j = 0; j < 16; j++)
3699 /* Exhibit this color */
3700 Term_putstr(j*4, 20, -1, a, "###");
3702 /* Exhibit all colors */
3703 Term_putstr(j*4, 22, -1, j, format("%3d", j));
3706 /* Describe the color */
3707 name = ((a < 16) ? color_names[a] : _("未定義", "undefined"));
3709 /* Describe the color */
3710 Term_putstr(5, 10, -1, TERM_WHITE,
3711 format(_("カラー = %d, 名前 = %s", "Color = %d, Name = %s"), a, name));
3713 /* Label the Current values */
3714 Term_putstr(5, 12, -1, TERM_WHITE,
3715 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
3716 angband_color_table[a][0],
3717 angband_color_table[a][1],
3718 angband_color_table[a][2],
3719 angband_color_table[a][3]));
3722 Term_putstr(0, 14, -1, TERM_WHITE,
3723 _("コマンド (n/N/k/K/r/R/g/G/b/B): ", "Command (n/N/k/K/r/R/g/G/b/B): "));
3728 if (i == ESCAPE) break;
3731 if (i == 'n') a = (byte)(a + 1);
3732 if (i == 'N') a = (byte)(a - 1);
3733 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
3734 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
3735 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
3736 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
3737 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
3738 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
3739 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
3740 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
3742 /* Hack -- react to changes */
3743 Term_xtra(TERM_XTRA_REACT, 0);
3745 /* Hack -- redraw */
3752 /* Unknown option */
3766 * Note something in the message recall
3768 void do_cmd_note(void)
3776 if (!get_string(_("メモ: ", "Note: "), buf, 60)) return;
3778 /* Ignore empty notes */
3779 if (!buf[0] || (buf[0] == ' ')) return;
3781 /* Add the note to the message recall */
3782 msg_format(_("メモ: %s", "Note: %s"), buf);
3787 * Mention the current version
3789 void do_cmd_version(void)
3791 #if FAKE_VER_EXTRA > 0
3792 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d.%d", "You are playing Hengband %d.%d.%d.%d."),
3793 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
3795 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d", "You are playing Hengband %d.%d.%d."),
3796 FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
3803 * Array of feeling strings
3805 static concptr do_cmd_feeling_text[11] =
3807 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3808 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3809 _("恐ろしい死の幻が目に浮かび、気絶しそうになった!", "You nearly faint as horrible visions of death fill your mind!"),
3810 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3811 _("とても悪い予感がする...", "You have a very bad feeling..."),
3812 _("悪い予感がする...", "You have a bad feeling..."),
3813 _("何か緊張する。", "You feel nervous."),
3814 _("少し不運な気がする...", "You feel your luck is turning..."),
3815 _("この場所は好きになれない。", "You don't like the look of this place."),
3816 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3817 _("なんて退屈なところだ...", "What a boring place...")
3820 static concptr do_cmd_feeling_text_combat[11] =
3822 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3823 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3824 _("今夜もまた、誰かが命を落とす...", "You nearly faint as horrible visions of death fill your mind!"),
3825 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3826 _("とても悪い予感がする...", "You have a very bad feeling..."),
3827 _("悪い予感がする...", "You have a bad feeling..."),
3828 _("何か緊張する。", "You feel nervous."),
3829 _("少し不運な気がする...", "You feel your luck is turning..."),
3830 _("この場所は好きになれない。", "You don't like the look of this place."),
3831 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3832 _("なんて退屈なところだ...", "What a boring place...")
3835 static concptr do_cmd_feeling_text_lucky[11] =
3837 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3838 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3839 _("この階はこの上なく素晴らしい感じがする。", "You have a superb feeling about this level."),
3840 _("素晴らしい感じがする...", "You have an excellent feeling..."),
3841 _("とても良い感じがする...", "You have a very good feeling..."),
3842 _("良い感じがする...", "You have a good feeling..."),
3843 _("ちょっと幸運な感じがする...", "You feel strangely lucky..."),
3844 _("多少は運が向いてきたか...", "You feel your luck is turning..."),
3845 _("見た感じ悪くはない...", "You like the look of this place..."),
3846 _("全然駄目ということはないが...", "This level can't be all bad..."),
3847 _("なんて退屈なところだ...", "What a boring place...")
3852 * Note that "feeling" is set to zero unless some time has passed.
3853 * Note that this is done when the level is GENERATED, not entered.
3855 void do_cmd_feeling(void)
3857 if (p_ptr->wild_mode) return;
3859 /* No useful feeling in quests */
3860 if (p_ptr->inside_quest && !random_quest_number(dun_level))
3862 msg_print(_("典型的なクエストのダンジョンのようだ。", "Looks like a typical quest level."));
3866 /* No useful feeling in town */
3867 else if (p_ptr->town_num && !dun_level)
3869 if (!strcmp(town[p_ptr->town_num].name, _("荒野", "wilderness")))
3871 msg_print(_("何かありそうな荒野のようだ。", "Looks like a strange wilderness."));
3876 msg_print(_("典型的な町のようだ。", "Looks like a typical town."));
3881 /* No useful feeling in the wilderness */
3882 else if (!dun_level)
3884 msg_print(_("典型的な荒野のようだ。", "Looks like a typical wilderness."));
3888 /* Display the feeling */
3889 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
3890 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
3891 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
3892 inventory[INVEN_BOW].name1 == ART_CRIMSON)
3893 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
3895 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
3901 * Description of each monster group.
3903 static concptr monster_group_text[] =
3906 "ユニーク", /* "Uniques" */
3907 "乗馬可能なモンスター", /* "Riding" */
3908 "賞金首", /* "Wanted */
3909 "アンバーの王族", /* "Ambertite" */
3938 /* "古代ドラゴン/ワイアーム", */
3999 /* "Ancient Dragon/Wyrm", */
4008 "Multi-Headed Reptile",
4013 "Reptile/Amphibian",
4014 "Spider/Scorpion/Tick",
4016 /* "Major Demon", */
4033 * Symbols of monsters in each group. Note the "Uniques" group
4034 * is handled differently.
4036 static concptr monster_group_char[] =
4093 "!$&()+./=>?[\\]`{|~",
4103 * hook function to sort monsters by level
4105 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
4107 u16b *who = (u16b*)(u);
4112 monster_race *r_ptr1 = &r_info[w1];
4113 monster_race *r_ptr2 = &r_info[w2];
4118 if (r_ptr2->level > r_ptr1->level) return TRUE;
4119 if (r_ptr1->level > r_ptr2->level) return FALSE;
4121 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
4122 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
4127 * Build a list of monster indexes in the given group. Return the number
4128 * of monsters in the group.
4130 * mode & 0x01 : check for non-empty group
4131 * mode & 0x02 : visual operation only
4133 static IDX collect_monsters(IDX grp_cur, IDX mon_idx[], BIT_FLAGS8 mode)
4139 /* Get a list of x_char in this group */
4140 concptr group_char = monster_group_char[grp_cur];
4142 /* XXX Hack -- Check if this is the "Uniques" group */
4143 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
4145 /* XXX Hack -- Check if this is the "Riding" group */
4146 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
4148 /* XXX Hack -- Check if this is the "Wanted" group */
4149 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
4151 /* XXX Hack -- Check if this is the "Amberite" group */
4152 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
4155 /* Check every race */
4156 for (i = 0; i < max_r_idx; i++)
4158 /* Access the race */
4159 monster_race *r_ptr = &r_info[i];
4161 /* Skip empty race */
4162 if (!r_ptr->name) continue ;
4164 /* Require known monsters */
4165 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
4169 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
4172 else if (grp_riding)
4174 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
4177 else if (grp_wanted)
4179 bool wanted = FALSE;
4181 for (j = 0; j < MAX_KUBI; j++)
4183 if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
4184 (p_ptr->today_mon && p_ptr->today_mon == i))
4190 if (!wanted) continue;
4193 else if (grp_amberite)
4195 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
4200 /* Check for race in the group */
4201 if (!my_strchr(group_char, r_ptr->d_char)) continue;
4205 mon_idx[mon_cnt++] = i;
4207 /* XXX Hack -- Just checking for non-empty group */
4208 if (mode & 0x01) break;
4211 /* Terminate the list */
4212 mon_idx[mon_cnt] = -1;
4214 /* Select the sort method */
4215 ang_sort_comp = ang_sort_comp_monster_level;
4216 ang_sort_swap = ang_sort_swap_hook;
4218 /* Sort by monster level */
4219 ang_sort(mon_idx, &dummy_why, mon_cnt);
4221 /* Return the number of races */
4227 * Description of each monster group.
4229 static concptr object_group_text[] =
4232 "キノコ", /* "Mushrooms" */
4233 "薬", /* "Potions" */
4234 "油つぼ", /* "Flasks" */
4235 "巻物", /* "Scrolls" */
4237 "アミュレット", /* "Amulets" */
4238 "笛", /* "Whistle" */
4239 "光源", /* "Lanterns" */
4240 "魔法棒", /* "Wands" */
4243 "カード", /* "Cards" */
4254 "刀剣類", /* "Swords" */
4255 "鈍器", /* "Blunt Weapons" */
4256 "長柄武器", /* "Polearms" */
4257 "採掘道具", /* "Diggers" */
4258 "飛び道具", /* "Bows" */
4262 "軽装鎧", /* "Soft Armor" */
4263 "重装鎧", /* "Hard Armor" */
4264 "ドラゴン鎧", /* "Dragon Armor" */
4265 "盾", /* "Shields" */
4266 "クローク", /* "Cloaks" */
4267 "籠手", /* "Gloves" */
4268 "ヘルメット", /* "Helms" */
4270 "ブーツ", /* "Boots" */
4323 * TVALs of items in each group
4325 static byte object_group_tval[] =
4366 TV_LIFE_BOOK, /* Hack -- all spellbooks */
4374 * Build a list of object indexes in the given group. Return the number
4375 * of objects in the group.
4377 * mode & 0x01 : check for non-empty group
4378 * mode & 0x02 : visual operation only
4380 static KIND_OBJECT_IDX collect_objects(int grp_cur, KIND_OBJECT_IDX object_idx[], BIT_FLAGS8 mode)
4382 KIND_OBJECT_IDX i, object_cnt = 0;
4385 /* Get a list of x_char in this group */
4386 byte group_tval = object_group_tval[grp_cur];
4388 /* Check every object */
4389 for (i = 0; i < max_k_idx; i++)
4391 /* Access the object */
4392 object_kind *k_ptr = &k_info[i];
4394 /* Skip empty objects */
4395 if (!k_ptr->name) continue;
4399 /* Any objects will be displayed */
4405 /* Skip non-flavoured objects */
4406 if (!k_ptr->flavor) continue;
4408 /* Require objects ever seen */
4409 if (!k_ptr->aware) continue;
4412 /* Skip items with no distribution (special artifacts) */
4413 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
4417 /* Check for objects in the group */
4418 if (TV_LIFE_BOOK == group_tval)
4420 /* Hack -- All spell books */
4421 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HEX_BOOK)
4423 /* Add the object */
4424 object_idx[object_cnt++] = i;
4428 else if (k_ptr->tval == group_tval)
4430 /* Add the object */
4431 object_idx[object_cnt++] = i;
4435 /* XXX Hack -- Just checking for non-empty group */
4436 if (mode & 0x01) break;
4439 /* Terminate the list */
4440 object_idx[object_cnt] = -1;
4442 /* Return the number of objects */
4448 * Description of each feature group.
4450 static concptr feature_group_text[] =
4458 * Build a list of feature indexes in the given group. Return the number
4459 * of features in the group.
4461 * mode & 0x01 : check for non-empty group
4463 static FEAT_IDX collect_features(int grp_cur, FEAT_IDX *feat_idx, BIT_FLAGS8 mode)
4466 FEAT_IDX feat_cnt = 0;
4468 /* Unused; There is a single group. */
4471 /* Check every feature */
4472 for (i = 0; i < max_f_idx; i++)
4474 /* Access the index */
4475 feature_type *f_ptr = &f_info[i];
4477 /* Skip empty index */
4478 if (!f_ptr->name) continue;
4480 /* Skip mimiccing features */
4481 if (f_ptr->mimic != i) continue;
4484 feat_idx[feat_cnt++] = i;
4486 /* XXX Hack -- Just checking for non-empty group */
4487 if (mode & 0x01) break;
4490 /* Terminate the list */
4491 feat_idx[feat_cnt] = -1;
4493 /* Return the number of races */
4500 * Build a list of monster indexes in the given group. Return the number
4501 * of monsters in the group.
4503 static int collect_artifacts(int grp_cur, int object_idx[])
4505 int i, object_cnt = 0;
4507 /* Get a list of x_char in this group */
4508 byte group_tval = object_group_tval[grp_cur];
4510 /* Check every object */
4511 for (i = 0; i < max_a_idx; i++)
4513 /* Access the artifact */
4514 artifact_type *a_ptr = &a_info[i];
4516 /* Skip empty artifacts */
4517 if (!a_ptr->name) continue;
4519 /* Skip "uncreated" artifacts */
4520 if (!a_ptr->cur_num) continue;
4522 /* Check for race in the group */
4523 if (a_ptr->tval == group_tval)
4526 object_idx[object_cnt++] = i;
4530 /* Terminate the list */
4531 object_idx[object_cnt] = 0;
4533 /* Return the number of races */
4540 * Encode the screen colors
4542 static char hack[17] = "dwsorgbuDWvyRGBU";
4546 * Hack -- load a screen dump from a file
4548 void do_cmd_load_screen(void)
4553 SYMBOL_CODE c = ' ';
4559 Term_get_size(&wid, &hgt);
4561 /* Build the filename */
4562 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
4564 /* Append to the file */
4565 fff = my_fopen(buf, "r");
4568 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
4576 /* Load the screen */
4577 for (y = 0; okay; y++)
4579 /* Get a line of data including control code */
4580 if (!fgets(buf, 1024, fff)) okay = FALSE;
4582 /* Get the blank line */
4583 if (buf[0] == '\n' || buf[0] == '\0') break;
4585 /* Ignore too large screen image */
4586 if (y >= hgt) continue;
4589 for (x = 0; x < wid - 1; x++)
4592 if (buf[x] == '\n' || buf[x] == '\0') break;
4594 /* Put the attr/char */
4595 Term_draw(x, y, TERM_WHITE, buf[x]);
4599 /* Dump the screen */
4600 for (y = 0; okay; y++)
4602 /* Get a line of data including control code */
4603 if (!fgets(buf, 1024, fff)) okay = FALSE;
4605 /* Get the blank line */
4606 if (buf[0] == '\n' || buf[0] == '\0') break;
4608 /* Ignore too large screen image */
4609 if (y >= hgt) continue;
4612 for (x = 0; x < wid - 1; x++)
4615 if (buf[x] == '\n' || buf[x] == '\0') break;
4617 /* Get the attr/char */
4618 (void)(Term_what(x, y, &a, &c));
4620 /* Look up the attr */
4621 for (i = 0; i < 16; i++)
4623 /* Use attr matches */
4624 if (hack[i] == buf[x]) a = (byte_hack)i;
4627 /* Put the attr/char */
4628 Term_draw(x, y, a, c);
4635 prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
4646 concptr inven_res_label = _(" 酸電火冷毒光闇破轟獄因沌劣 盲怖乱痺透命感消復浮",
4647 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv");
4650 #define IM_FLAG_STR _("*", "* ")
4651 #define HAS_FLAG_STR _("+", "+ ")
4652 #define NO_FLAG_STR _("・", ". ")
4654 #define print_im_or_res_flag(IM, RES) \
4656 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
4657 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
4660 #define print_flag(TR) \
4662 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
4666 /* XTRA HACK RESLIST */
4667 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, OBJECT_TYPE_VALUE tval, char *where)
4669 GAME_TEXT o_name[MAX_NLEN];
4670 BIT_FLAGS flgs[TR_FLAG_SIZE];
4672 if (!o_ptr->k_idx) return;
4673 if (o_ptr->tval != tval) return;
4675 /* Identified items only */
4676 if (!object_is_known(o_ptr)) return;
4679 * HACK:Ring of Lordly protection and Dragon equipment
4680 * have random resistances.
4682 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
4683 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
4684 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
4685 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
4686 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
4687 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
4688 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
4689 || object_is_artifact(o_ptr))
4692 object_desc(o_name, o_ptr, OD_NAME_ONLY);
4694 while (o_name[i] && (i < 26))
4697 if (iskanji(o_name[i])) i++;
4706 o_name[i] = ' '; i++;
4711 fprintf(fff, "%s %s", where, o_name);
4713 if (!(o_ptr->ident & (IDENT_MENTAL)))
4715 fputs(_("-------不明--------------- -------不明---------\n",
4716 "-------unknown------------ -------unknown------\n"), fff);
4720 object_flags_known(o_ptr, flgs);
4722 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
4723 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
4724 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
4725 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
4726 print_flag(TR_RES_POIS);
4727 print_flag(TR_RES_LITE);
4728 print_flag(TR_RES_DARK);
4729 print_flag(TR_RES_SHARDS);
4730 print_flag(TR_RES_SOUND);
4731 print_flag(TR_RES_NETHER);
4732 print_flag(TR_RES_NEXUS);
4733 print_flag(TR_RES_CHAOS);
4734 print_flag(TR_RES_DISEN);
4738 print_flag(TR_RES_BLIND);
4739 print_flag(TR_RES_FEAR);
4740 print_flag(TR_RES_CONF);
4741 print_flag(TR_FREE_ACT);
4742 print_flag(TR_SEE_INVIS);
4743 print_flag(TR_HOLD_EXP);
4744 print_flag(TR_TELEPATHY);
4745 print_flag(TR_SLOW_DIGEST);
4746 print_flag(TR_REGEN);
4747 print_flag(TR_LEVITATION);
4755 fprintf(fff, "%s\n", inven_res_label);
4761 * Display *ID* ed weapons/armors's resistances
4763 static void do_cmd_knowledge_inven(void)
4766 GAME_TEXT file_name[1024];
4768 OBJECT_TYPE_VALUE tval;
4774 /* Open a new file */
4775 fff = my_fopen_temp(file_name, 1024);
4778 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4782 fprintf(fff, "%s\n", inven_res_label);
4784 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
4788 for (; j < 9; j++) fputc('\n', fff);
4790 fprintf(fff, "%s\n", inven_res_label);
4792 strcpy(where, _("装", "E "));
4793 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4795 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4797 strcpy(where, _("持", "I "));
4798 for (i = 0; i < INVEN_PACK; i++)
4800 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4803 st_ptr = &town[1].store[STORE_HOME];
4804 strcpy(where, _("家", "H "));
4805 for (i = 0; i < st_ptr->stock_num; i++)
4807 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
4812 /* Display the file contents */
4813 show_file(TRUE, file_name, _("*鑑定*済み武器/防具の耐性リスト", "Resistances of *identified* equipment"), 0, 0);
4815 /* Remove the file */
4820 void do_cmd_save_screen_html_aux(char *filename, int message)
4825 TERM_COLOR a = 0, old_a = 0;
4839 concptr html_head[] = {
4840 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
4844 concptr html_foot[] = {
4846 "</body>\n</html>\n",
4852 Term_get_size(&wid, &hgt);
4854 /* File type is "TEXT" */
4855 FILE_TYPE(FILE_TYPE_TEXT);
4857 /* Append to the file */
4858 fff = my_fopen(filename, "w");
4862 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename);
4868 if (message) screen_save();
4870 /* Build the filename */
4871 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
4872 tmpfff = my_fopen(buf, "r");
4874 for (i = 0; html_head[i]; i++)
4875 fputs(html_head[i], fff);
4879 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
4881 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
4885 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
4887 fprintf(fff, "%s\n", buf);
4892 /* Dump the screen */
4893 for (y = 0; y < hgt; y++)
4900 for (x = 0; x < wid - 1; x++)
4904 /* Get the attr/char */
4905 (void)(Term_what(x, y, &a, &c));
4909 case '&': cc = "&"; break;
4910 case '<': cc = "<"; break;
4911 case '>': cc = ">"; break;
4913 case 0x1f: c = '.'; break;
4914 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
4919 if ((y == 0 && x == 0) || a != old_a) {
4920 rv = angband_color_table[a][1];
4921 gv = angband_color_table[a][2];
4922 bv = angband_color_table[a][3];
4923 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
4924 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
4928 fprintf(fff, "%s", cc);
4930 fprintf(fff, "%c", c);
4933 fprintf(fff, "</font>");
4936 for (i = 0; html_foot[i]; i++)
4937 fputs(html_foot[i], fff);
4942 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
4944 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
4948 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
4950 fprintf(fff, "%s\n", buf);
4963 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
4971 * Hack -- save a screen dump to a file
4973 static void do_cmd_save_screen_html(void)
4975 char buf[1024], tmp[256] = "screen.html";
4977 if (!get_string(_("ファイル名: ", "File name: "), tmp, 80))
4980 /* Build the filename */
4981 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4985 do_cmd_save_screen_html_aux(buf, 1);
4990 * Redefinable "save_screen" action
4992 void (*screendump_aux)(void) = NULL;
4996 * Hack -- save a screen dump to a file
4998 void do_cmd_save_screen(void)
5000 bool old_use_graphics = use_graphics;
5001 bool html_dump = FALSE;
5005 prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
5009 if (c == 'Y' || c == 'y')
5011 else if (c == 'H' || c == 'h')
5023 Term_get_size(&wid, &hgt);
5025 if (old_use_graphics)
5027 use_graphics = FALSE;
5029 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5035 do_cmd_save_screen_html();
5039 /* Do we use a special screendump function ? */
5040 else if (screendump_aux)
5042 /* Dump the screen to a graphics file */
5043 (*screendump_aux)();
5045 else /* Dump the screen as text */
5049 SYMBOL_CODE c = ' ';
5053 /* Build the filename */
5054 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5056 /* File type is "TEXT" */
5057 FILE_TYPE(FILE_TYPE_TEXT);
5059 /* Append to the file */
5060 fff = my_fopen(buf, "w");
5064 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
5072 /* Dump the screen */
5073 for (y = 0; y < hgt; y++)
5076 for (x = 0; x < wid - 1; x++)
5078 /* Get the attr/char */
5079 (void)(Term_what(x, y, &a, &c));
5089 fprintf(fff, "%s\n", buf);
5096 /* Dump the screen */
5097 for (y = 0; y < hgt; y++)
5100 for (x = 0; x < wid - 1; x++)
5102 /* Get the attr/char */
5103 (void)(Term_what(x, y, &a, &c));
5106 buf[x] = hack[a&0x0F];
5113 fprintf(fff, "%s\n", buf);
5122 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5127 if (old_use_graphics)
5129 use_graphics = TRUE;
5131 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5138 * Sorting hook -- Comp function -- see below
5140 * We use "u" to point to array of monster indexes,
5141 * and "v" to select the type of sorting to perform on "u".
5143 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
5145 u16b *who = (u16b*)(u);
5147 u16b *why = (u16b*)(v);
5154 /* Sort by total kills */
5157 /* Extract total kills */
5158 z1 = a_info[w1].tval;
5159 z2 = a_info[w2].tval;
5161 /* Compare total kills */
5162 if (z1 < z2) return (TRUE);
5163 if (z1 > z2) return (FALSE);
5167 /* Sort by monster level */
5170 /* Extract levels */
5171 z1 = a_info[w1].sval;
5172 z2 = a_info[w2].sval;
5174 /* Compare levels */
5175 if (z1 < z2) return (TRUE);
5176 if (z1 > z2) return (FALSE);
5180 /* Sort by monster experience */
5183 /* Extract experience */
5184 z1 = a_info[w1].level;
5185 z2 = a_info[w2].level;
5187 /* Compare experience */
5188 if (z1 < z2) return (TRUE);
5189 if (z1 > z2) return (FALSE);
5193 /* Compare indexes */
5199 * Sorting hook -- Swap function -- see below
5201 * We use "u" to point to array of monster indexes,
5202 * and "v" to select the type of sorting to perform.
5204 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
5206 u16b *who = (u16b*)(u);
5221 * Check the status of "artifacts"
5223 static void do_cmd_knowledge_artifacts(void)
5233 GAME_TEXT file_name[1024];
5234 GAME_TEXT base_name[MAX_NLEN];
5238 /* Open a new file */
5239 fff = my_fopen_temp(file_name, 1024);
5242 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5247 /* Allocate the "who" array */
5248 C_MAKE(who, max_a_idx, ARTIFACT_IDX);
5250 /* Allocate the "okay" array */
5251 C_MAKE(okay, max_a_idx, bool);
5253 /* Scan the artifacts */
5254 for (k = 0; k < max_a_idx; k++)
5256 artifact_type *a_ptr = &a_info[k];
5261 /* Skip "empty" artifacts */
5262 if (!a_ptr->name) continue;
5264 /* Skip "uncreated" artifacts */
5265 if (!a_ptr->cur_num) continue;
5271 /* Check the dungeon */
5272 for (y = 0; y < cur_hgt; y++)
5274 for (x = 0; x < cur_wid; x++)
5276 cave_type *c_ptr = &cave[y][x];
5278 OBJECT_IDX this_o_idx, next_o_idx = 0;
5280 /* Scan all objects in the grid */
5281 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
5284 o_ptr = &o_list[this_o_idx];
5286 /* Acquire next object */
5287 next_o_idx = o_ptr->next_o_idx;
5289 /* Ignore non-artifacts */
5290 if (!object_is_fixed_artifact(o_ptr)) continue;
5292 /* Ignore known items */
5293 if (object_is_known(o_ptr)) continue;
5295 /* Note the artifact */
5296 okay[o_ptr->name1] = FALSE;
5301 /* Check the inventory and equipment */
5302 for (i = 0; i < INVEN_TOTAL; i++)
5304 object_type *o_ptr = &inventory[i];
5306 /* Ignore non-objects */
5307 if (!o_ptr->k_idx) continue;
5309 /* Ignore non-artifacts */
5310 if (!object_is_fixed_artifact(o_ptr)) continue;
5312 /* Ignore known items */
5313 if (object_is_known(o_ptr)) continue;
5315 /* Note the artifact */
5316 okay[o_ptr->name1] = FALSE;
5319 for (k = 0; k < max_a_idx; k++)
5321 if (okay[k]) who[n++] = k;
5324 /* Select the sort method */
5325 ang_sort_comp = ang_sort_art_comp;
5326 ang_sort_swap = ang_sort_art_swap;
5328 /* Sort the array by dungeon depth of monsters */
5329 ang_sort(who, &why, n);
5331 /* Scan the artifacts */
5332 for (k = 0; k < n; k++)
5334 artifact_type *a_ptr = &a_info[who[k]];
5337 strcpy(base_name, _("未知の伝説のアイテム", "Unknown Artifact"));
5339 /* Obtain the base object type */
5340 z = lookup_kind(a_ptr->tval, a_ptr->sval);
5349 /* Create fake object */
5350 object_prep(q_ptr, z);
5352 /* Make it an artifact */
5353 q_ptr->name1 = (byte)who[k];
5355 /* Display as if known */
5356 q_ptr->ident |= IDENT_STORE;
5358 /* Describe the artifact */
5359 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5362 /* Hack -- Build the artifact name */
5363 fprintf(fff, _(" %s\n", " The %s\n"), base_name);
5366 /* Free the "who" array */
5367 C_KILL(who, max_a_idx, ARTIFACT_IDX);
5369 /* Free the "okay" array */
5370 C_KILL(okay, max_a_idx, bool);
5373 /* Display the file contents */
5374 show_file(TRUE, file_name, _("既知の伝説のアイテム", "Artifacts Seen"), 0, 0);
5376 /* Remove the file */
5382 * Display known uniques
5383 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
5385 static void do_cmd_knowledge_uniques(void)
5394 GAME_TEXT file_name[1024];
5397 int n_alive_surface = 0;
5398 int n_alive_over100 = 0;
5399 int n_alive_total = 0;
5402 for (i = 0; i < 10; i++) n_alive[i] = 0;
5404 /* Open a new file */
5405 fff = my_fopen_temp(file_name, 1024);
5409 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5414 /* Allocate the "who" array */
5415 C_MAKE(who, max_r_idx, MONRACE_IDX);
5417 /* Scan the monsters */
5418 for (i = 1; i < max_r_idx; i++)
5420 monster_race *r_ptr = &r_info[i];
5423 if (!r_ptr->name) continue;
5425 /* Require unique monsters */
5426 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5428 /* Only display "known" uniques */
5429 if (!cheat_know && !r_ptr->r_sights) continue;
5431 /* Only print rarity <= 100 uniques */
5432 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
5434 /* Only "alive" uniques */
5435 if (r_ptr->max_num == 0) continue;
5439 lev = (r_ptr->level - 1) / 10;
5443 if (max_lev < lev) max_lev = lev;
5445 else n_alive_over100++;
5447 else n_alive_surface++;
5449 /* Collect "appropriate" monsters */
5453 /* Select the sort method */
5454 ang_sort_comp = ang_sort_comp_hook;
5455 ang_sort_swap = ang_sort_swap_hook;
5457 /* Sort the array by dungeon depth of monsters */
5458 ang_sort(who, &why, n);
5460 if (n_alive_surface)
5462 fprintf(fff, _(" 地上 生存: %3d体\n", " Surface alive: %3d\n"), n_alive_surface);
5463 n_alive_total += n_alive_surface;
5465 for (i = 0; i <= max_lev; i++)
5467 fprintf(fff, _("%3d-%3d階 生存: %3d体\n", "Level %3d-%3d alive: %3d\n"), 1 + i * 10, 10 + i * 10, n_alive[i]);
5468 n_alive_total += n_alive[i];
5470 if (n_alive_over100)
5472 fprintf(fff, _("101- 階 生存: %3d体\n", "Level 101- alive: %3d\n"), n_alive_over100);
5473 n_alive_total += n_alive_over100;
5478 fputs(_("--------- -----------\n", "------------- ----------\n"), fff);
5479 fprintf(fff, _(" 合計 生存: %3d体\n\n", " Total alive: %3d\n\n"), n_alive_total);
5483 fputs(_("現在は既知の生存ユニークはいません。\n", "No known uniques alive.\n"), fff);
5486 /* Scan the monster races */
5487 for (k = 0; k < n; k++)
5489 monster_race *r_ptr = &r_info[who[k]];
5491 fprintf(fff, _(" %s (レベル%d)\n", " %s (level %d)\n"), r_name + r_ptr->name, (int)r_ptr->level);
5494 /* Free the "who" array */
5495 C_KILL(who, max_r_idx, s16b);
5498 /* Display the file contents */
5499 show_file(TRUE, file_name, _("まだ生きているユニーク・モンスター", "Alive Uniques"), 0, 0);
5501 /* Remove the file */
5507 * Display weapon-exp
5509 static void do_cmd_knowledge_weapon_exp(void)
5517 GAME_TEXT file_name[1024];
5520 /* Open a new file */
5521 fff = my_fopen_temp(file_name, 1024);
5523 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5528 for (i = 0; i < 5; i++)
5530 for (num = 0; num < 64; num++)
5532 for (j = 0; j < max_k_idx; j++)
5534 object_kind *k_ptr = &k_info[j];
5536 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
5538 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON || k_ptr->sval == SV_HARP)) continue;
5540 weapon_exp = p_ptr->weapon_exp[4 - i][num];
5542 fprintf(fff, "%-25s ", tmp);
5543 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
5544 else fprintf(fff, " ");
5545 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
5546 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
5555 /* Display the file contents */
5556 show_file(TRUE, file_name, _("武器の経験値", "Weapon Proficiency"), 0, 0);
5558 /* Remove the file */
5564 * @brief 魔法の経験値を表示するコマンドのメインルーチン
5568 static void do_cmd_knowledge_spell_exp(void)
5575 const magic_type *s_ptr;
5577 GAME_TEXT file_name[1024];
5579 /* Open a new file */
5580 fff = my_fopen_temp(file_name, 1024);
5582 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5587 if (p_ptr->realm1 != REALM_NONE)
5589 fprintf(fff, _("%sの魔法書\n", "%s Spellbook\n"), realm_names[p_ptr->realm1]);
5590 for (i = 0; i < 32; i++)
5592 if (!is_magic(p_ptr->realm1))
5594 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
5598 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
5600 if (s_ptr->slevel >= 99) continue;
5601 spell_exp = p_ptr->spell_exp[i];
5602 exp_level = spell_exp_level(spell_exp);
5603 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
5604 if (p_ptr->realm1 == REALM_HISSATSU)
5605 fprintf(fff, "[--]");
5608 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
5609 else fprintf(fff, " ");
5610 fprintf(fff, "%s", exp_level_str[exp_level]);
5612 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5617 if (p_ptr->realm2 != REALM_NONE)
5619 fprintf(fff, _("%sの魔法書\n", "\n%s Spellbook\n"), realm_names[p_ptr->realm2]);
5620 for (i = 0; i < 32; i++)
5622 if (!is_magic(p_ptr->realm1))
5624 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
5628 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
5630 if (s_ptr->slevel >= 99) continue;
5632 spell_exp = p_ptr->spell_exp[i + 32];
5633 exp_level = spell_exp_level(spell_exp);
5634 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
5635 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
5636 else fprintf(fff, " ");
5637 fprintf(fff, "%s", exp_level_str[exp_level]);
5638 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5644 /* Display the file contents */
5645 show_file(TRUE, file_name, _("魔法の経験値", "Spell Proficiency"), 0, 0);
5647 /* Remove the file */
5653 * @brief スキル情報を表示するコマンドのメインルーチン /
5657 static void do_cmd_knowledge_skill_exp(void)
5659 int i = 0, skill_exp;
5663 char file_name[1024];
5664 char skill_name[GINOU_TEMPMAX][20] =
5666 _("マーシャルアーツ", "Martial Arts "),
5667 _("二刀流 ", "Dual Wielding "),
5668 _("乗馬 ", "Riding "),
5672 /* Open a new file */
5673 fff = my_fopen_temp(file_name, 1024);
5675 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5680 for (i = 0; i < GINOU_TEMPMAX; i++)
5682 skill_exp = p_ptr->skill_exp[i];
5683 fprintf(fff, "%-20s ", skill_name[i]);
5684 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
5685 else fprintf(fff, " ");
5686 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
5687 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
5692 /* Display the file contents */
5693 show_file(TRUE, file_name, _("技能の経験値", "Miscellaneous Proficiency"), 0, 0);
5695 /* Remove the file */
5701 * @brief 英単語、句、説を複数形を変換する / Pluralize a monster name
5702 * @param Name 変換したい文字列の参照ポインタ
5705 void plural_aux(char *Name)
5707 int NameLen = strlen(Name);
5709 if (my_strstr(Name, "Disembodied hand"))
5711 strcpy(Name, "Disembodied hands that strangled people");
5713 else if (my_strstr(Name, "Colour out of space"))
5715 strcpy(Name, "Colours out of space");
5717 else if (my_strstr(Name, "stairway to hell"))
5719 strcpy(Name, "stairways to hell");
5721 else if (my_strstr(Name, "Dweller on the threshold"))
5723 strcpy(Name, "Dwellers on the threshold");
5725 else if (my_strstr(Name, " of "))
5727 concptr aider = my_strstr(Name, " of ");
5738 if (dummy[i-1] == 's')
5740 strcpy(&(dummy[i]), "es");
5745 strcpy(&(dummy[i]), "s");
5748 strcpy(&(dummy[i+1]), aider);
5749 strcpy(Name, dummy);
5751 else if (my_strstr(Name, "coins"))
5754 strcpy(dummy, "piles of ");
5755 strcat(dummy, Name);
5756 strcpy(Name, dummy);
5759 else if (my_strstr(Name, "Manes"))
5763 else if (streq(&(Name[NameLen - 2]), "ey"))
5765 strcpy(&(Name[NameLen - 2]), "eys");
5767 else if (Name[NameLen - 1] == 'y')
5769 strcpy(&(Name[NameLen - 1]), "ies");
5771 else if (streq(&(Name[NameLen - 4]), "ouse"))
5773 strcpy(&(Name[NameLen - 4]), "ice");
5775 else if (streq(&(Name[NameLen - 2]), "us"))
5777 strcpy(&(Name[NameLen - 2]), "i");
5779 else if (streq(&(Name[NameLen - 6]), "kelman"))
5781 strcpy(&(Name[NameLen - 6]), "kelmen");
5783 else if (streq(&(Name[NameLen - 8]), "wordsman"))
5785 strcpy(&(Name[NameLen - 8]), "wordsmen");
5787 else if (streq(&(Name[NameLen - 7]), "oodsman"))
5789 strcpy(&(Name[NameLen - 7]), "oodsmen");
5791 else if (streq(&(Name[NameLen - 7]), "eastman"))
5793 strcpy(&(Name[NameLen - 7]), "eastmen");
5795 else if (streq(&(Name[NameLen - 8]), "izardman"))
5797 strcpy(&(Name[NameLen - 8]), "izardmen");
5799 else if (streq(&(Name[NameLen - 5]), "geist"))
5801 strcpy(&(Name[NameLen - 5]), "geister");
5803 else if (streq(&(Name[NameLen - 2]), "ex"))
5805 strcpy(&(Name[NameLen - 2]), "ices");
5807 else if (streq(&(Name[NameLen - 2]), "lf"))
5809 strcpy(&(Name[NameLen - 2]), "lves");
5811 else if (suffix(Name, "ch") ||
5812 suffix(Name, "sh") ||
5813 suffix(Name, "nx") ||
5814 suffix(Name, "s") ||
5817 strcpy(&(Name[NameLen]), "es");
5821 strcpy(&(Name[NameLen]), "s");
5826 * @brief 現在のペットを表示するコマンドのメインルーチン /
5827 * Display current pets
5830 static void do_cmd_knowledge_pets(void)
5834 monster_type *m_ptr;
5835 GAME_TEXT pet_name[MAX_NLEN];
5837 int show_upkeep = 0;
5838 GAME_TEXT file_name[1024];
5841 /* Open a new file */
5842 fff = my_fopen_temp(file_name, 1024);
5844 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5849 /* Process the monsters (backwards) */
5850 for (i = m_max - 1; i >= 1; i--)
5852 /* Access the monster */
5855 /* Ignore "dead" monsters */
5856 if (!m_ptr->r_idx) continue;
5858 /* Calculate "upkeep" for pets */
5862 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
5863 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
5867 show_upkeep = calculate_upkeep();
5869 fprintf(fff, "----------------------------------------------\n");
5871 fprintf(fff, " 合計: %d 体のペット\n", t_friends);
5873 fprintf(fff, " Total: %d pet%s.\n", t_friends, (t_friends == 1 ? "" : "s"));
5875 fprintf(fff, _(" 維持コスト: %d%% MP\n", " Upkeep: %d%% mana.\n"), show_upkeep);
5880 /* Display the file contents */
5881 show_file(TRUE, file_name, _("現在のペット", "Current Pets"), 0, 0);
5883 /* Remove the file */
5889 * @brief 現在のペットを表示するコマンドのメインルーチン /
5892 * @note the player ghosts are ignored.
5894 static void do_cmd_knowledge_kill_count(void)
5901 GAME_TEXT file_name[1024];
5906 /* Open a new file */
5907 fff = my_fopen_temp(file_name, 1024);
5910 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5915 /* Allocate the "who" array */
5916 C_MAKE(who, max_r_idx, MONRACE_IDX);
5919 /* Monsters slain */
5922 for (kk = 1; kk < max_r_idx; kk++)
5924 monster_race *r_ptr = &r_info[kk];
5926 if (r_ptr->flags1 & (RF1_UNIQUE))
5928 bool dead = (r_ptr->max_num == 0);
5937 MONSTER_NUMBER This = r_ptr->r_pkills;
5947 fprintf(fff,_("あなたはまだ敵を倒していない。\n\n", "You have defeated no enemies yet.\n\n"));
5950 fprintf(fff,"あなたは%ld体の敵を倒している。\n\n", (long int)Total);
5952 fprintf(fff,"You have defeated %ld %s.\n\n", (long int)Total, (Total == 1) ? "enemy" : "enemies");
5958 /* Scan the monsters */
5959 for (i = 1; i < max_r_idx; i++)
5961 monster_race *r_ptr = &r_info[i];
5963 /* Use that monster */
5964 if (r_ptr->name) who[n++] = i;
5967 /* Select the sort method */
5968 ang_sort_comp = ang_sort_comp_hook;
5969 ang_sort_swap = ang_sort_swap_hook;
5971 /* Sort the array by dungeon depth of monsters */
5972 ang_sort(who, &why, n);
5974 /* Scan the monster races */
5975 for (k = 0; k < n; k++)
5977 monster_race *r_ptr = &r_info[who[k]];
5979 if (r_ptr->flags1 & (RF1_UNIQUE))
5981 bool dead = (r_ptr->max_num == 0);
5985 fprintf(fff, " %s\n", (r_name + r_ptr->name));
5991 MONSTER_NUMBER This = r_ptr->r_pkills;
5996 /* p,tは人と数える by ita */
5997 if (my_strchr("pt", r_ptr->d_char))
5998 fprintf(fff, " %3d 人の %s\n", (int)This, r_name + r_ptr->name);
6000 fprintf(fff, " %3d 体の %s\n", (int)This, r_name + r_ptr->name);
6004 if (my_strstr(r_name + r_ptr->name, "coins"))
6006 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
6010 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
6016 strcpy(ToPlural, (r_name + r_ptr->name));
6017 plural_aux(ToPlural);
6018 fprintf(fff, " %d %s\n", This, ToPlural);
6028 fprintf(fff,"----------------------------------------------\n");
6030 fprintf(fff," 合計: %lu 体を倒した。\n", (unsigned long int)Total);
6032 fprintf(fff," Total: %lu creature%s killed.\n", (unsigned long int)Total, (Total == 1 ? "" : "s"));
6036 /* Free the "who" array */
6037 C_KILL(who, max_r_idx, s16b);
6040 /* Display the file contents */
6041 show_file(TRUE, file_name, _("倒した敵の数", "Kill Count"), 0, 0);
6043 /* Remove the file */
6049 * @brief モンスター情報リスト中のグループを表示する /
6050 * Display the object groups.
6054 * @param per_page リストの表示行
6055 * @param grp_idx グループのID配列
6056 * @param group_text グループ名の文字列配列
6057 * @param grp_cur 現在の選択ID
6058 * @param grp_top 現在の選択リスト最上部ID
6061 static void display_group_list(int col, int row, int wid, int per_page, IDX grp_idx[], concptr group_text[], int grp_cur, int grp_top)
6065 /* Display lines until done */
6066 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
6068 /* Get the group index */
6069 int grp = grp_idx[grp_top + i];
6071 /* Choose a color */
6072 TERM_COLOR attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
6074 /* Erase the entire line */
6075 Term_erase(col, row + i, wid);
6077 /* Display the group label */
6078 c_put_str(attr, group_text[grp], row + i, col);
6084 * Move the cursor in a browser window
6086 static void browser_cursor(char ch, int *column, IDX *grp_cur, int grp_cnt,
6087 IDX *list_cur, int list_cnt)
6092 IDX list = *list_cur;
6094 /* Extract direction */
6097 /* Hack -- scroll up full screen */
6102 /* Hack -- scroll down full screen */
6107 d = get_keymap_dir(ch);
6112 /* Diagonals - hack */
6113 if ((ddx[d] > 0) && ddy[d])
6118 Term_get_size(&wid, &hgt);
6120 browser_rows = hgt - 8;
6122 /* Browse group list */
6127 /* Move up or down */
6128 grp += ddy[d] * (browser_rows - 1);
6131 if (grp >= grp_cnt) grp = grp_cnt - 1;
6132 if (grp < 0) grp = 0;
6133 if (grp != old_grp) list = 0;
6136 /* Browse sub-list list */
6139 /* Move up or down */
6140 list += ddy[d] * browser_rows;
6143 if (list >= list_cnt) list = list_cnt - 1;
6144 if (list < 0) list = 0;
6156 if (col < 0) col = 0;
6157 if (col > 1) col = 1;
6164 /* Browse group list */
6169 /* Move up or down */
6173 if (grp >= grp_cnt) grp = grp_cnt - 1;
6174 if (grp < 0) grp = 0;
6175 if (grp != old_grp) list = 0;
6178 /* Browse sub-list list */
6181 /* Move up or down */
6185 if (list >= list_cnt) list = list_cnt - 1;
6186 if (list < 0) list = 0;
6197 static void display_visual_list(int col, int row, int height, int width, TERM_COLOR attr_top, byte char_left)
6201 /* Clear the display lines */
6202 for (i = 0; i < height; i++)
6204 Term_erase(col, row + i, width);
6207 /* Bigtile mode uses double width */
6208 if (use_bigtile) width /= 2;
6210 /* Display lines until done */
6211 for (i = 0; i < height; i++)
6213 /* Display columns until done */
6214 for (j = 0; j < width; j++)
6218 TERM_LEN x = col + j;
6219 TERM_LEN y = row + i;
6222 /* Bigtile mode uses double width */
6223 if (use_bigtile) x += j;
6228 /* Ignore illegal characters */
6229 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
6230 (!use_graphics && ic > 0x7f))
6236 /* Force correct code for both ASCII character and tile */
6237 if (c & 0x80) a |= 0x80;
6239 /* Display symbol */
6240 Term_queue_bigchar(x, y, a, c, 0, 0);
6247 * Place the cursor at the collect position for visual mode
6249 static void place_visual_list_cursor(TERM_LEN col, TERM_LEN row, TERM_COLOR a, byte c, TERM_COLOR attr_top, byte char_left)
6251 int i = (a & 0x7f) - attr_top;
6252 int j = c - char_left;
6254 TERM_LEN x = col + j;
6255 TERM_LEN y = row + i;
6257 /* Bigtile mode uses double width */
6258 if (use_bigtile) x += j;
6260 /* Place the cursor */
6266 * Clipboard variables for copy&paste in visual mode
6268 static TERM_COLOR attr_idx = 0;
6269 static SYMBOL_CODE char_idx = 0;
6271 /* Hack -- for feature lighting */
6272 static TERM_COLOR attr_idx_feat[F_LIT_MAX];
6273 static SYMBOL_CODE char_idx_feat[F_LIT_MAX];
6276 * Do visual mode command -- Change symbols
6278 static bool visual_mode_command(char ch, bool *visual_list_ptr,
6279 int height, int width,
6280 TERM_COLOR *attr_top_ptr, byte *char_left_ptr,
6281 TERM_COLOR *cur_attr_ptr, SYMBOL_CODE *cur_char_ptr, bool *need_redraw)
6283 static TERM_COLOR attr_old = 0;
6284 static SYMBOL_CODE char_old = 0;
6289 if (*visual_list_ptr)
6292 *cur_attr_ptr = attr_old;
6293 *cur_char_ptr = char_old;
6294 *visual_list_ptr = FALSE;
6302 if (*visual_list_ptr)
6305 *visual_list_ptr = FALSE;
6306 *need_redraw = TRUE;
6314 if (!*visual_list_ptr)
6316 *visual_list_ptr = TRUE;
6318 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6319 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6321 attr_old = *cur_attr_ptr;
6322 char_old = *cur_char_ptr;
6333 /* Set the visual */
6334 attr_idx = *cur_attr_ptr;
6335 char_idx = *cur_char_ptr;
6337 /* Hack -- for feature lighting */
6338 for (i = 0; i < F_LIT_MAX; i++)
6340 attr_idx_feat[i] = 0;
6341 char_idx_feat[i] = 0;
6348 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
6351 *cur_attr_ptr = attr_idx;
6352 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6353 if (!*visual_list_ptr) *need_redraw = TRUE;
6359 *cur_char_ptr = char_idx;
6360 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6361 if (!*visual_list_ptr) *need_redraw = TRUE;
6367 if (*visual_list_ptr)
6370 int d = get_keymap_dir(ch);
6371 TERM_COLOR a = (*cur_attr_ptr & 0x7f);
6372 SYMBOL_CODE c = *cur_char_ptr;
6374 if (use_bigtile) eff_width = width / 2;
6375 else eff_width = width;
6377 /* Restrict direction */
6378 if ((a == 0) && (ddy[d] < 0)) d = 0;
6379 if ((c == 0) && (ddx[d] < 0)) d = 0;
6380 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
6381 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
6386 /* Force correct code for both ASCII character and tile */
6387 if (c & 0x80) a |= 0x80;
6389 /* Set the visual */
6394 /* Move the frame */
6395 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
6396 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
6397 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
6398 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
6404 /* Visual mode command is not used */
6410 * Display the monsters in a group.
6412 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
6413 int mon_cur, int mon_top, bool visual_only)
6417 /* Display lines until done */
6418 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
6422 /* Get the race index */
6423 MONRACE_IDX r_idx = mon_idx[mon_top + i] ;
6425 /* Access the race */
6426 monster_race *r_ptr = &r_info[r_idx];
6428 /* Choose a color */
6429 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
6431 /* Display the name */
6432 c_prt(attr, (r_name + r_ptr->name), row + i, col);
6434 /* Hack -- visual_list mode */
6437 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
6439 if (p_ptr->wizard || visual_only)
6441 c_prt(attr, format("%d", r_idx), row + i, 62);
6444 /* Erase chars before overwritten by the race letter */
6445 Term_erase(69, row + i, 255);
6447 /* Display symbol */
6448 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
6453 if (!(r_ptr->flags1 & RF1_UNIQUE))
6454 put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
6456 c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE),
6457 (r_ptr->max_num == 0 ? _("死亡", " dead") : _("生存", "alive")), row + i, 74);
6461 /* Clear remaining lines */
6462 for (; i < per_page; i++)
6464 Term_erase(col, row + i, 255);
6470 * Display known monsters.
6472 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx)
6476 IDX grp_cur, grp_top, old_grp_cur;
6477 IDX mon_cur, mon_top;
6478 IDX grp_cnt, grp_idx[100];
6486 bool visual_list = FALSE;
6487 TERM_COLOR attr_top = 0;
6495 Term_get_size(&wid, &hgt);
6497 browser_rows = hgt - 8;
6499 /* Allocate the "mon_idx" array */
6500 C_MAKE(mon_idx, max_r_idx, MONRACE_IDX);
6505 if (direct_r_idx < 0)
6507 mode = visual_only ? 0x03 : 0x01;
6509 /* Check every group */
6510 for (i = 0; monster_group_text[i] != NULL; i++)
6512 /* Measure the label */
6513 len = strlen(monster_group_text[i]);
6515 /* Save the maximum length */
6516 if (len > max) max = len;
6518 /* See if any monsters are known */
6519 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
6521 /* Build a list of groups with known monsters */
6522 grp_idx[grp_cnt++] = i;
6530 mon_idx[0] = direct_r_idx;
6533 /* Terminate the list */
6536 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
6537 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
6540 /* Terminate the list */
6541 grp_idx[grp_cnt] = -1;
6544 grp_cur = grp_top = 0;
6545 mon_cur = mon_top = 0;
6550 mode = visual_only ? 0x02 : 0x00;
6555 monster_race *r_ptr;
6560 prt(format(_("%s - モンスター", "%s - monsters"), !visual_only ? _("知識", "Knowledge") : _("表示", "Visuals")), 2, 0);
6561 if (direct_r_idx < 0) prt(_("グループ", "Group"), 4, 0);
6562 prt(_("名前", "Name"), 4, max + 3);
6563 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6564 prt(_("文字", "Sym"), 4, 67);
6565 if (!visual_only) prt(_("殺害数", "Kills"), 4, 72);
6567 for (i = 0; i < 78; i++)
6569 Term_putch(i, 5, TERM_WHITE, '=');
6572 if (direct_r_idx < 0)
6574 for (i = 0; i < browser_rows; i++)
6576 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
6583 if (direct_r_idx < 0)
6585 /* Scroll group list */
6586 if (grp_cur < grp_top) grp_top = grp_cur;
6587 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
6589 /* Display a list of monster groups */
6590 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
6592 if (old_grp_cur != grp_cur)
6594 old_grp_cur = grp_cur;
6596 /* Get a list of monsters in the current group */
6597 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
6600 /* Scroll monster list */
6601 while (mon_cur < mon_top)
6602 mon_top = MAX(0, mon_top - browser_rows/2);
6603 while (mon_cur >= mon_top + browser_rows)
6604 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
6609 /* Display a list of monsters in the current group */
6610 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
6616 /* Display a monster name */
6617 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
6619 /* Display visual list below first monster */
6620 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
6624 prt(format(_("<方向>%s%s%s, ESC", "<dir>%s%s%s, ESC"),
6625 (!visual_list && !visual_only) ? _(", 'r'で思い出を見る", ", 'r' to recall") : "",
6626 visual_list ? _(", ENTERで決定", ", ENTER to accept") : _(", 'v'でシンボル変更", ", 'v' for visuals"),
6627 (attr_idx || char_idx) ? _(", 'c', 'p'でペースト", ", 'c', 'p' to paste") : _(", 'c'でコピー", ", 'c' to copy")),
6630 /* Get the current monster */
6631 r_ptr = &r_info[mon_idx[mon_cur]];
6635 /* Mega Hack -- track this monster race */
6636 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
6642 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
6646 Term_gotoxy(0, 6 + (grp_cur - grp_top));
6650 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
6655 /* Do visual mode command if needed */
6656 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))
6658 if (direct_r_idx >= 0)
6683 /* Recall on screen */
6684 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
6686 screen_roff(mon_idx[mon_cur], 0);
6697 /* Move the cursor */
6698 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
6705 /* Free the "mon_idx" array */
6706 C_KILL(mon_idx, max_r_idx, MONRACE_IDX);
6711 * Display the objects in a group.
6713 static void display_object_list(int col, int row, int per_page, IDX object_idx[],
6714 int object_cur, int object_top, bool visual_only)
6718 /* Display lines until done */
6719 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
6721 GAME_TEXT o_name[MAX_NLEN];
6724 object_kind *flavor_k_ptr;
6726 /* Get the object index */
6727 KIND_OBJECT_IDX k_idx = object_idx[object_top + i];
6729 /* Access the object */
6730 object_kind *k_ptr = &k_info[k_idx];
6732 /* Choose a color */
6733 TERM_COLOR attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
6734 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
6737 if (!visual_only && k_ptr->flavor)
6739 /* Appearance of this object is shuffled */
6740 flavor_k_ptr = &k_info[k_ptr->flavor];
6744 /* Appearance of this object is very normal */
6745 flavor_k_ptr = k_ptr;
6750 attr = ((i + object_top == object_cur) ? cursor : attr);
6752 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
6755 strip_name(o_name, k_idx);
6760 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
6763 /* Display the name */
6764 c_prt(attr, o_name, row + i, col);
6766 /* Hack -- visual_list mode */
6769 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);
6771 if (p_ptr->wizard || visual_only)
6773 c_prt(attr, format("%d", k_idx), row + i, 70);
6776 a = flavor_k_ptr->x_attr;
6777 c = flavor_k_ptr->x_char;
6779 /* Display symbol */
6780 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
6783 /* Clear remaining lines */
6784 for (; i < per_page; i++)
6786 Term_erase(col, row + i, 255);
6791 * Describe fake object
6793 static void desc_obj_fake(KIND_OBJECT_IDX k_idx)
6796 object_type object_type_body;
6797 o_ptr = &object_type_body;
6800 /* Create the artifact */
6801 object_prep(o_ptr, k_idx);
6803 /* It's fully know */
6804 o_ptr->ident |= IDENT_KNOWN;
6806 /* Track the object */
6807 /* object_actual_track(o_ptr); */
6809 /* Hack - mark as fake */
6810 /* term_obj_real = FALSE; */
6813 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
6815 msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
6823 * Display known objects
6825 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx)
6829 IDX grp_cur, grp_top, old_grp_cur;
6830 IDX object_old, object_cur, object_top;
6834 OBJECT_IDX *object_idx;
6840 bool visual_list = FALSE;
6841 TERM_COLOR attr_top = 0;
6849 Term_get_size(&wid, &hgt);
6851 browser_rows = hgt - 8;
6853 /* Allocate the "object_idx" array */
6854 C_MAKE(object_idx, max_k_idx, KIND_OBJECT_IDX);
6859 if (direct_k_idx < 0)
6861 mode = visual_only ? 0x03 : 0x01;
6863 /* Check every group */
6864 for (i = 0; object_group_text[i] != NULL; i++)
6866 /* Measure the label */
6867 len = strlen(object_group_text[i]);
6869 /* Save the maximum length */
6870 if (len > max) max = len;
6872 /* See if any monsters are known */
6873 if (collect_objects(i, object_idx, mode))
6875 /* Build a list of groups with known monsters */
6876 grp_idx[grp_cnt++] = i;
6885 object_kind *k_ptr = &k_info[direct_k_idx];
6886 object_kind *flavor_k_ptr;
6888 if (!visual_only && k_ptr->flavor)
6890 /* Appearance of this object is shuffled */
6891 flavor_k_ptr = &k_info[k_ptr->flavor];
6895 /* Appearance of this object is very normal */
6896 flavor_k_ptr = k_ptr;
6899 object_idx[0] = direct_k_idx;
6900 object_old = direct_k_idx;
6903 /* Terminate the list */
6906 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
6907 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
6910 /* Terminate the list */
6911 grp_idx[grp_cnt] = -1;
6914 grp_cur = grp_top = 0;
6915 object_cur = object_top = 0;
6920 mode = visual_only ? 0x02 : 0x00;
6925 object_kind *k_ptr, *flavor_k_ptr;
6932 prt(format("%s - アイテム", !visual_only ? "知識" : "表示"), 2, 0);
6933 if (direct_k_idx < 0) prt("グループ", 4, 0);
6934 prt("名前", 4, max + 3);
6935 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
6938 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
6939 if (direct_k_idx < 0) prt("Group", 4, 0);
6940 prt("Name", 4, max + 3);
6941 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
6945 for (i = 0; i < 78; i++)
6947 Term_putch(i, 5, TERM_WHITE, '=');
6950 if (direct_k_idx < 0)
6952 for (i = 0; i < browser_rows; i++)
6954 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
6961 if (direct_k_idx < 0)
6963 /* Scroll group list */
6964 if (grp_cur < grp_top) grp_top = grp_cur;
6965 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
6967 /* Display a list of object groups */
6968 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
6970 if (old_grp_cur != grp_cur)
6972 old_grp_cur = grp_cur;
6974 /* Get a list of objects in the current group */
6975 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
6978 /* Scroll object list */
6979 while (object_cur < object_top)
6980 object_top = MAX(0, object_top - browser_rows/2);
6981 while (object_cur >= object_top + browser_rows)
6982 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
6987 /* Display a list of objects in the current group */
6988 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
6992 object_top = object_cur;
6994 /* Display a list of objects in the current group */
6995 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
6997 /* Display visual list below first object */
6998 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7001 /* Get the current object */
7002 k_ptr = &k_info[object_idx[object_cur]];
7004 if (!visual_only && k_ptr->flavor)
7006 /* Appearance of this object is shuffled */
7007 flavor_k_ptr = &k_info[k_ptr->flavor];
7011 /* Appearance of this object is very normal */
7012 flavor_k_ptr = k_ptr;
7017 prt(format("<方向>%s%s%s, ESC",
7018 (!visual_list && !visual_only) ? ", 'r'で詳細を見る" : "",
7019 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
7020 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7023 prt(format("<dir>%s%s%s, ESC",
7024 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7025 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7026 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7032 /* Mega Hack -- track this object */
7033 if (object_cnt) object_kind_track(object_idx[object_cur]);
7035 /* The "current" object changed */
7036 if (object_old != object_idx[object_cur])
7040 /* Remember the "current" object */
7041 object_old = object_idx[object_cur];
7047 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
7051 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7055 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
7060 /* Do visual mode command if needed */
7061 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))
7063 if (direct_k_idx >= 0)
7088 /* Recall on screen */
7089 if (!visual_list && !visual_only && (grp_cnt > 0))
7091 desc_obj_fake(object_idx[object_cur]);
7099 /* Move the cursor */
7100 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
7106 /* Free the "object_idx" array */
7107 C_KILL(object_idx, max_k_idx, KIND_OBJECT_IDX);
7112 * Display the features in a group.
7114 static void display_feature_list(int col, int row, int per_page, FEAT_IDX *feat_idx,
7115 FEAT_IDX feat_cur, FEAT_IDX feat_top, bool visual_only, int lighting_level)
7117 int lit_col[F_LIT_MAX], i, j;
7118 int f_idx_col = use_bigtile ? 62 : 64;
7120 /* Correct columns 1 and 4 */
7121 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
7122 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7123 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
7125 /* Display lines until done */
7126 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
7131 FEAT_IDX f_idx = feat_idx[feat_top + i];
7133 /* Access the index */
7134 feature_type *f_ptr = &f_info[f_idx];
7136 int row_i = row + i;
7138 /* Choose a color */
7139 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
7141 /* Display the name */
7142 c_prt(attr, f_name + f_ptr->name, row_i, col);
7144 /* Hack -- visual_list mode */
7147 /* Display lighting level */
7148 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
7150 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));
7152 if (p_ptr->wizard || visual_only)
7154 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
7157 /* Display symbol */
7158 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);
7160 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
7161 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
7163 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
7165 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
7167 /* Mega-hack -- Use non-standard colour */
7168 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
7170 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
7174 /* Clear remaining lines */
7175 for (; i < per_page; i++)
7177 Term_erase(col, row + i, 255);
7183 * Interact with feature visuals.
7185 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level)
7189 FEAT_IDX grp_cur, grp_top, old_grp_cur;
7190 FEAT_IDX feat_cur, feat_top;
7192 FEAT_IDX grp_idx[100];
7196 TERM_LEN column = 0;
7200 bool visual_list = FALSE;
7201 TERM_COLOR attr_top = 0;
7204 TERM_LEN browser_rows;
7207 TERM_COLOR attr_old[F_LIT_MAX];
7208 SYMBOL_CODE char_old[F_LIT_MAX];
7209 TERM_COLOR *cur_attr_ptr;
7210 SYMBOL_CODE *cur_char_ptr;
7212 (void)C_WIPE(attr_old, F_LIT_MAX, TERM_COLOR);
7213 (void)C_WIPE(char_old, F_LIT_MAX, SYMBOL_CODE);
7215 Term_get_size(&wid, &hgt);
7217 browser_rows = hgt - 8;
7219 /* Allocate the "feat_idx" array */
7220 C_MAKE(feat_idx, max_f_idx, FEAT_IDX);
7225 if (direct_f_idx < 0)
7227 /* Check every group */
7228 for (i = 0; feature_group_text[i] != NULL; i++)
7230 /* Measure the label */
7231 len = strlen(feature_group_text[i]);
7233 /* Save the maximum length */
7234 if (len > max) max = len;
7236 /* See if any features are known */
7237 if (collect_features(i, feat_idx, 0x01))
7239 /* Build a list of groups with known features */
7240 grp_idx[grp_cnt++] = i;
7248 feature_type *f_ptr = &f_info[direct_f_idx];
7250 feat_idx[0] = direct_f_idx;
7253 /* Terminate the list */
7256 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7257 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
7259 for (i = 0; i < F_LIT_MAX; i++)
7261 attr_old[i] = f_ptr->x_attr[i];
7262 char_old[i] = f_ptr->x_char[i];
7266 /* Terminate the list */
7267 grp_idx[grp_cnt] = -1;
7270 grp_cur = grp_top = 0;
7271 feat_cur = feat_top = 0;
7279 feature_type *f_ptr;
7285 prt(_("表示 - 地形", "Visuals - features"), 2, 0);
7286 if (direct_f_idx < 0) prt(_("グループ", "Group"), 4, 0);
7287 prt(_("名前", "Name"), 4, max + 3);
7290 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7291 prt(_("文字 ( l/ d)", "Sym ( l/ d)"), 4, 66);
7295 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7296 prt(_("文字 (l/d)", "Sym (l/d)"), 4, 68);
7299 for (i = 0; i < 78; i++)
7301 Term_putch(i, 5, TERM_WHITE, '=');
7304 if (direct_f_idx < 0)
7306 for (i = 0; i < browser_rows; i++)
7308 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7315 if (direct_f_idx < 0)
7317 /* Scroll group list */
7318 if (grp_cur < grp_top) grp_top = grp_cur;
7319 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7321 /* Display a list of feature groups */
7322 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
7324 if (old_grp_cur != grp_cur)
7326 old_grp_cur = grp_cur;
7328 /* Get a list of features in the current group */
7329 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
7332 /* Scroll feature list */
7333 while (feat_cur < feat_top)
7334 feat_top = MAX(0, feat_top - browser_rows/2);
7335 while (feat_cur >= feat_top + browser_rows)
7336 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
7341 /* Display a list of features in the current group */
7342 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
7346 feat_top = feat_cur;
7348 /* Display a list of features in the current group */
7349 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
7351 /* Display visual list below first object */
7352 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7356 prt(format(_("<方向>%s, 'd'で標準光源効果%s, ESC", "<dir>%s, 'd' for default lighting%s, ESC"),
7357 visual_list ? _(", ENTERで決定, 'a'で対象明度変更", ", ENTER to accept, 'a' for lighting level") : _(", 'v'でシンボル変更", ", 'v' for visuals"),
7358 (attr_idx || char_idx) ? _(", 'c', 'p'でペースト", ", 'c', 'p' to paste") : _(", 'c'でコピー", ", 'c' to copy")),
7361 /* Get the current feature */
7362 f_ptr = &f_info[feat_idx[feat_cur]];
7363 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
7364 cur_char_ptr = &f_ptr->x_char[*lighting_level];
7368 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
7372 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7376 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
7381 if (visual_list && ((ch == 'A') || (ch == 'a')))
7383 int prev_lighting_level = *lighting_level;
7387 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
7388 else (*lighting_level)--;
7392 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
7393 else (*lighting_level)++;
7396 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
7397 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7399 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
7400 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7405 else if ((ch == 'D') || (ch == 'd'))
7407 TERM_COLOR prev_x_attr = f_ptr->x_attr[*lighting_level];
7408 byte prev_x_char = f_ptr->x_char[*lighting_level];
7410 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
7414 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
7415 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7417 if (prev_x_char != f_ptr->x_char[*lighting_level])
7418 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7420 else *need_redraw = TRUE;
7425 /* Do visual mode command if needed */
7426 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))
7430 /* Restore previous visual settings */
7432 for (i = 0; i < F_LIT_MAX; i++)
7434 f_ptr->x_attr[i] = attr_old[i];
7435 f_ptr->x_char[i] = char_old[i];
7442 if (direct_f_idx >= 0) flag = TRUE;
7443 else *lighting_level = F_LIT_STANDARD;
7446 /* Preserve current visual settings */
7449 for (i = 0; i < F_LIT_MAX; i++)
7451 attr_old[i] = f_ptr->x_attr[i];
7452 char_old[i] = f_ptr->x_char[i];
7454 *lighting_level = F_LIT_STANDARD;
7461 for (i = 0; i < F_LIT_MAX; i++)
7463 attr_idx_feat[i] = f_ptr->x_attr[i];
7464 char_idx_feat[i] = f_ptr->x_char[i];
7473 /* Allow TERM_DARK text */
7474 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7476 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
7477 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
7495 /* Move the cursor */
7496 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
7502 /* Free the "feat_idx" array */
7503 C_KILL(feat_idx, max_f_idx, FEAT_IDX);
7508 * List wanted monsters
7510 static void do_cmd_knowledge_kubi(void)
7515 GAME_TEXT file_name[1024];
7518 /* Open a new file */
7519 fff = my_fopen_temp(file_name, 1024);
7521 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7528 bool listed = FALSE;
7530 fprintf(fff, _("今日のターゲット : %s\n", "Today target : %s\n"),
7531 (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : _("不明", "unknown")));
7533 fprintf(fff, _("賞金首リスト\n", "List of wanted monsters\n"));
7534 fprintf(fff, "----------------------------------------------\n");
7536 for (i = 0; i < MAX_KUBI; i++)
7538 if (kubi_r_idx[i] <= 10000)
7540 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
7548 fprintf(fff,"\n%s\n", _("賞金首はもう残っていません。", "There is no more wanted monster."));
7553 /* Display the file contents */
7554 show_file(TRUE, file_name, _("賞金首の一覧", "Wanted monsters"), 0, 0);
7556 /* Remove the file */
7561 * List virtues & status
7563 static void do_cmd_knowledge_virtues(void)
7566 GAME_TEXT file_name[1024];
7568 /* Open a new file */
7569 fff = my_fopen_temp(file_name, 1024);
7571 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7578 fprintf(fff, _("現在の属性 : %s\n\n", "Your alighnment : %s\n\n"), your_alignment());
7583 /* Display the file contents */
7584 show_file(TRUE, file_name, _("八つの徳", "Virtues"), 0, 0);
7586 /* Remove the file */
7593 static void do_cmd_knowledge_dungeon(void)
7597 GAME_TEXT file_name[1024];
7600 /* Open a new file */
7601 fff = my_fopen_temp(file_name, 1024);
7603 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7610 for (i = 1; i < max_d_idx; i++)
7614 if (!d_info[i].maxdepth) continue;
7615 if (!max_dlv[i]) continue;
7616 if (d_info[i].final_guardian)
7618 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
7620 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
7622 fprintf(fff, _("%c%-12s : %3d 階\n", "%c%-16s : level %3d\n"), seiha ? '!' : ' ', d_name + d_info[i].name, (int)max_dlv[i]);
7627 /* Display the file contents */
7628 show_file(TRUE, file_name, _("今までに入ったダンジョン", "Dungeon"), 0, 0);
7630 /* Remove the file */
7635 * List virtues & status
7638 static void do_cmd_knowledge_stat(void)
7642 GAME_TEXT file_name[1024];
7645 /* Open a new file */
7646 fff = my_fopen_temp(file_name, 1024);
7648 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7655 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
7656 (2 * p_ptr->hitdie +
7657 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
7659 if (p_ptr->knowledge & KNOW_HPRATE)
7660 fprintf(fff, _("現在の体力ランク : %d/100\n\n", "Your current Life Rating is %d/100.\n\n"), percent);
7661 else fprintf(fff, _("現在の体力ランク : ???\n\n", "Your current Life Rating is ???.\n\n"));
7663 fprintf(fff, _("能力の最大値\n\n", "Limits of maximum stats\n\n"));
7664 for (v_nr = 0; v_nr < A_MAX; v_nr++)
7666 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);
7667 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
7674 /* Display the file contents */
7675 show_file(TRUE, file_name, _("自分に関する情報", "HP-rate & Max stat"), 0, 0);
7677 /* Remove the file */
7683 * Print all active quests
7685 static void do_cmd_knowledge_quests_current(FILE *fff)
7688 char rand_tmp_str[120] = "\0";
7689 GAME_TEXT name[MAX_NLEN];
7690 monster_race *r_ptr;
7692 int rand_level = 100;
7695 fprintf(fff, _("《遂行中のクエスト》\n", "< Current Quest >\n"));
7697 for (i = 1; i < max_q_idx; i++)
7699 if ((quest[i].status == QUEST_STATUS_TAKEN) ||
7700 ((quest[i].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[i].type == QUEST_TYPE_TOWER)) ||
7701 (quest[i].status == QUEST_STATUS_COMPLETED))
7703 /* Set the quest number temporary */
7704 QUEST_IDX old_quest = p_ptr->inside_quest;
7707 /* Clear the text */
7708 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
7709 quest_text_line = 0;
7711 p_ptr->inside_quest = i;
7713 /* Get the quest text */
7714 init_flags = INIT_SHOW_TEXT;
7716 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
7718 /* Reset the old quest number */
7719 p_ptr->inside_quest = old_quest;
7721 /* No info from "silent" quests */
7722 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
7726 if (quest[i].type != QUEST_TYPE_RANDOM)
7728 char note[80] = "\0";
7730 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_STAGE_COMPLETED)
7732 switch (quest[i].type)
7734 case QUEST_TYPE_KILL_LEVEL:
7735 case QUEST_TYPE_KILL_ANY_LEVEL:
7736 r_ptr = &r_info[quest[i].r_idx];
7737 strcpy(name, r_name + r_ptr->name);
7738 if (quest[i].max_num > 1)
7741 sprintf(note," - %d 体の%sを倒す。(あと %d 体)",
7742 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
7745 sprintf(note," - kill %d %s, have killed %d.",
7746 (int)quest[i].max_num, name, (int)quest[i].cur_num);
7750 sprintf(note,_(" - %sを倒す。", " - kill %s."),name);
7753 case QUEST_TYPE_FIND_ARTIFACT:
7756 artifact_type *a_ptr = &a_info[quest[i].k_idx];
7758 object_type *q_ptr = &forge;
7759 KIND_OBJECT_IDX k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
7760 object_prep(q_ptr, k_idx);
7761 q_ptr->name1 = quest[i].k_idx;
7762 q_ptr->ident = IDENT_STORE;
7763 object_desc(name, q_ptr, OD_NAME_ONLY);
7765 sprintf(note,_("\n - %sを見つけ出す。", "\n - Find out %s."), name);
7767 case QUEST_TYPE_FIND_EXIT:
7768 sprintf(note,_(" - 出口に到達する。", " - Reach to Exit."));
7771 case QUEST_TYPE_KILL_NUMBER:
7773 sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)",
7774 (int)quest[i].max_num, (int)(quest[i].max_num - quest[i].cur_num));
7776 sprintf(note," - Kill %d monsters, have killed %d.",
7777 (int)quest[i].max_num, (int)quest[i].cur_num);
7781 case QUEST_TYPE_KILL_ALL:
7782 case QUEST_TYPE_TOWER:
7783 sprintf(note,_(" - 全てのモンスターを倒す。", " - Kill all monsters."));
7788 /* Print the quest info */
7789 sprintf(tmp_str, _(" %s (危険度:%d階相当)%s\n", " %s (Danger level: %d)%s\n"),
7790 quest[i].name, (int)quest[i].level, note);
7792 fputs(tmp_str, fff);
7794 if (quest[i].status == QUEST_STATUS_COMPLETED)
7796 sprintf(tmp_str, _(" クエスト達成 - まだ報酬を受けとってない。\n", " Quest Completed - Unrewarded\n"));
7797 fputs(tmp_str, fff);
7803 while (quest_text[j][0] && j < 10)
7805 fprintf(fff, " %s\n", quest_text[j]);
7810 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
7813 rand_level = quest[i].level;
7815 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
7817 /* Print the quest info */
7818 r_ptr = &r_info[quest[i].r_idx];
7819 strcpy(name, r_name + r_ptr->name);
7821 if (quest[i].max_num > 1)
7824 sprintf(rand_tmp_str," %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
7825 quest[i].name, (int)quest[i].level,
7826 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
7830 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
7831 quest[i].name, (int)quest[i].level,
7832 (int)quest[i].max_num, name, (int)quest[i].cur_num);
7837 sprintf(rand_tmp_str,_(" %s (%d 階) - %sを倒す。\n", " %s (Dungeon level: %d)\n Kill %s.\n"),
7838 quest[i].name, (int)quest[i].level, name);
7845 /* Print the current random quest */
7846 if (rand_tmp_str[0]) fputs(rand_tmp_str, fff);
7848 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
7852 static bool do_cmd_knowledge_quests_aux(FILE *fff, IDX q_idx)
7855 char playtime_str[16];
7856 quest_type* const q_ptr = &quest[q_idx];
7858 if (is_fixed_quest_idx(q_idx))
7860 /* Set the quest number temporary */
7861 IDX old_quest = p_ptr->inside_quest;
7863 p_ptr->inside_quest = q_idx;
7866 init_flags = INIT_NAME_ONLY;
7868 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
7870 /* Reset the old quest number */
7871 p_ptr->inside_quest = old_quest;
7873 /* No info from "silent" quests */
7874 if (q_ptr->flags & QUEST_FLAG_SILENT) return FALSE;
7877 strnfmt(playtime_str, sizeof(playtime_str), "%02d:%02d:%02d",
7878 q_ptr->comptime/(60*60), (q_ptr->comptime/60)%60, q_ptr->comptime%60);
7880 if (!is_fixed_quest_idx(q_idx) && q_ptr->r_idx)
7882 /* Print the quest info */
7883 if (q_ptr->complev == 0)
7886 _(" %-35s (%3d階) - 不戦勝 - %s\n",
7887 " %-35s (Dungeon level: %3d) - Unearned - %s\n") ,
7888 r_name+r_info[q_ptr->r_idx].name,
7889 (int)q_ptr->level, playtime_str);
7894 _(" %-35s (%3d階) - レベル%2d - %s\n",
7895 " %-35s (Dungeon level: %3d) - level %2d - %s\n") ,
7896 r_name+r_info[q_ptr->r_idx].name,
7904 /* Print the quest info */
7906 _(" %-35s (危険度:%3d階相当) - レベル%2d - %s\n",
7907 " %-35s (Danger level: %3d) - level %2d - %s\n") ,
7908 q_ptr->name, (int)q_ptr->level, q_ptr->complev, playtime_str);
7911 fputs(tmp_str, fff);
7917 * Print all finished quests
7919 void do_cmd_knowledge_quests_completed(FILE *fff, QUEST_IDX quest_num[])
7922 QUEST_IDX total = 0;
7924 fprintf(fff, _("《達成したクエスト》\n", "< Completed Quest >\n"));
7925 for (i = 1; i < max_q_idx; i++)
7927 QUEST_IDX q_idx = quest_num[i];
7928 quest_type* const q_ptr = &quest[q_idx];
7930 if (q_ptr->status == QUEST_STATUS_FINISHED && do_cmd_knowledge_quests_aux(fff, q_idx))
7935 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
7940 * Print all failed quests
7942 void do_cmd_knowledge_quests_failed(FILE *fff, QUEST_IDX quest_num[])
7945 QUEST_IDX total = 0;
7947 fprintf(fff, _("《失敗したクエスト》\n", "< Failed Quest >\n"));
7948 for (i = 1; i < max_q_idx; i++)
7950 QUEST_IDX q_idx = quest_num[i];
7951 quest_type* const q_ptr = &quest[q_idx];
7953 if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) &&
7954 do_cmd_knowledge_quests_aux(fff, q_idx))
7959 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
7964 * Print all random quests
7966 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
7968 GAME_TEXT tmp_str[120];
7970 QUEST_IDX total = 0;
7972 fprintf(fff, _("《残りのランダムクエスト》\n", "< Remaining Random Quest >\n"));
7973 for (i = 1; i < max_q_idx; i++)
7975 /* No info from "silent" quests */
7976 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
7978 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
7982 /* Print the quest info */
7983 sprintf(tmp_str, _(" %s (%d階, %s)\n", " %s (%d, %s)\n"),
7984 quest[i].name, (int)quest[i].level, r_name+r_info[quest[i].r_idx].name);
7985 fputs(tmp_str, fff);
7988 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
7992 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
7994 QUEST_IDX *q_num = (QUEST_IDX *)u;
7995 quest_type *qa = &quest[q_num[a]];
7996 quest_type *qb = &quest[q_num[b]];
8001 return (qa->comptime != qb->comptime) ?
8002 (qa->comptime < qb->comptime) :
8003 (qa->level <= qb->level);
8006 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
8008 QUEST_IDX *q_num = (QUEST_IDX *)u;
8015 q_num[a] = q_num[b];
8021 * Print quest status of all active quests
8023 static void do_cmd_knowledge_quests(void)
8026 GAME_TEXT file_name[1024];
8031 /* Open a new file */
8032 fff = my_fopen_temp(file_name, 1024);
8035 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8040 /* Allocate Memory */
8041 C_MAKE(quest_num, max_q_idx, QUEST_IDX);
8043 /* Sort by compete level */
8044 for (i = 1; i < max_q_idx; i++) quest_num[i] = i;
8045 ang_sort_comp = ang_sort_comp_quest_num;
8046 ang_sort_swap = ang_sort_swap_quest_num;
8047 ang_sort(quest_num, &dummy, max_q_idx);
8049 /* Dump Quest Information */
8050 do_cmd_knowledge_quests_current(fff);
8052 do_cmd_knowledge_quests_completed(fff, quest_num);
8054 do_cmd_knowledge_quests_failed(fff, quest_num);
8058 do_cmd_knowledge_quests_wiz_random(fff);
8062 /* Display the file contents */
8063 show_file(TRUE, file_name, _("クエスト達成状況", "Quest status"), 0, 0);
8065 /* Remove the file */
8069 C_KILL(quest_num, max_q_idx, QUEST_IDX);
8076 static void do_cmd_knowledge_home(void)
8081 GAME_TEXT file_name[1024];
8083 GAME_TEXT o_name[MAX_NLEN];
8084 concptr paren = ")";
8086 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
8088 /* Open a new file */
8089 fff = my_fopen_temp(file_name, 1024);
8091 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8098 /* Print all homes in the different towns */
8099 st_ptr = &town[1].store[STORE_HOME];
8101 /* Home -- if anything there */
8102 if (st_ptr->stock_num)
8107 /* Header with name of the town */
8108 fprintf(fff, _(" [ 我が家のアイテム ]\n", " [Home Inventory]\n"));
8110 /* Dump all available items */
8111 for (i = 0; i < st_ptr->stock_num; i++)
8114 if ((i % 12) == 0) fprintf(fff, "\n ( %d ページ )\n", x++);
8115 object_desc(o_name, &st_ptr->stock[i], 0);
8116 if (strlen(o_name) <= 80-3)
8118 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8124 for (n = 0, t = o_name; n < 80-3; n++, t++)
8125 if(iskanji(*t)) {t++; n++;}
8126 if (n == 81-3) n = 79-3; /* 最後が漢字半分 */
8128 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
8129 fprintf(fff, " %.77s\n", o_name+n);
8132 object_desc(o_name, &st_ptr->stock[i], 0);
8133 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8138 /* Add an empty line */
8139 fprintf(fff, "\n\n");
8144 /* Display the file contents */
8145 show_file(TRUE, file_name, _("我が家のアイテム", "Home Inventory"), 0, 0);
8147 /* Remove the file */
8153 * Check the status of "autopick"
8155 static void do_cmd_knowledge_autopick(void)
8159 GAME_TEXT file_name[1024];
8161 /* Open a new file */
8162 fff = my_fopen_temp(file_name, 1024);
8166 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8173 fprintf(fff, _("自動破壊/拾いには何も登録されていません。", "No preference for auto picker/destroyer."));
8177 fprintf(fff, _(" 自動拾い/破壊には現在 %d行登録されています。\n\n",
8178 " There are %d registered lines for auto picker/destroyer.\n\n"), max_autopick);
8181 for (k = 0; k < max_autopick; k++)
8184 byte act = autopick_list[k].action;
8185 if (act & DONT_AUTOPICK)
8187 tmp = _("放置", "Leave");
8189 else if (act & DO_AUTODESTROY)
8191 tmp = _("破壊", "Destroy");
8193 else if (act & DO_AUTOPICK)
8195 tmp = _("拾う", "Pickup");
8199 tmp = _("確認", "Query");
8202 if (act & DO_DISPLAY)
8203 fprintf(fff, "%11s", format("[%s]", tmp));
8205 fprintf(fff, "%11s", format("(%s)", tmp));
8207 tmp = autopick_line_from_entry(&autopick_list[k]);
8208 fprintf(fff, " %s", tmp);
8213 /* Display the file contents */
8214 show_file(TRUE, file_name, _("自動拾い/破壊 設定リスト", "Auto-picker/Destroyer"), 0, 0);
8216 /* Remove the file */
8222 * Interact with "knowledge"
8224 void do_cmd_knowledge(void)
8227 bool need_redraw = FALSE;
8229 /* File type is "TEXT" */
8230 FILE_TYPE(FILE_TYPE_TEXT);
8233 /* Interact until done */
8238 /* Ask for a choice */
8239 prt(format(_("%d/2 ページ", "page %d/2"), (p+1)), 2, 65);
8240 prt(_("現在の知識を確認する", "Display current knowledge"), 3, 0);
8242 /* Give some choices */
8246 prt("(1) 既知の伝説のアイテム の一覧", 6, 5);
8247 prt("(2) 既知のアイテム の一覧", 7, 5);
8248 prt("(3) 既知の生きているユニーク・モンスター の一覧", 8, 5);
8249 prt("(4) 既知のモンスター の一覧", 9, 5);
8250 prt("(5) 倒した敵の数 の一覧", 10, 5);
8251 if (!vanilla_town) prt("(6) 賞金首 の一覧", 11, 5);
8252 prt("(7) 現在のペット の一覧", 12, 5);
8253 prt("(8) 我が家のアイテム の一覧", 13, 5);
8254 prt("(9) *鑑定*済み装備の耐性 の一覧", 14, 5);
8255 prt("(0) 地形の表示文字/タイル の一覧", 15, 5);
8259 prt("(a) 自分に関する情報 の一覧", 6, 5);
8260 prt("(b) 突然変異 の一覧", 7, 5);
8261 prt("(c) 武器の経験値 の一覧", 8, 5);
8262 prt("(d) 魔法の経験値 の一覧", 9, 5);
8263 prt("(e) 技能の経験値 の一覧", 10, 5);
8264 prt("(f) プレイヤーの徳 の一覧", 11, 5);
8265 prt("(g) 入ったダンジョン の一覧", 12, 5);
8266 prt("(h) 実行中のクエスト の一覧", 13, 5);
8267 prt("(i) 現在の自動拾い/破壊設定 の一覧", 14, 5);
8272 prt("(1) Display known artifacts", 6, 5);
8273 prt("(2) Display known objects", 7, 5);
8274 prt("(3) Display remaining uniques", 8, 5);
8275 prt("(4) Display known monster", 9, 5);
8276 prt("(5) Display kill count", 10, 5);
8277 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
8278 prt("(7) Display current pets", 12, 5);
8279 prt("(8) Display home inventory", 13, 5);
8280 prt("(9) Display *identified* equip.", 14, 5);
8281 prt("(0) Display terrain symbols.", 15, 5);
8285 prt("(a) Display about yourself", 6, 5);
8286 prt("(b) Display mutations", 7, 5);
8287 prt("(c) Display weapon proficiency", 8, 5);
8288 prt("(d) Display spell proficiency", 9, 5);
8289 prt("(e) Display misc. proficiency", 10, 5);
8290 prt("(f) Display virtues", 11, 5);
8291 prt("(g) Display dungeons", 12, 5);
8292 prt("(h) Display current quests", 13, 5);
8293 prt("(i) Display auto pick/destroy", 14, 5);
8297 prt(_("-続く-", "-more-"), 17, 8);
8298 prt(_("ESC) 抜ける", "ESC) Exit menu"), 21, 1);
8299 prt(_("SPACE) 次ページ", "SPACE) Next page"), 21, 30);
8300 /*prt("-) 前ページ", 21, 60);*/
8301 prt(_("コマンド:", "Command: "), 20, 0);
8304 if (i == ESCAPE) break;
8307 case ' ': /* Page change */
8311 case '1': /* Artifacts */
8312 do_cmd_knowledge_artifacts();
8314 case '2': /* Objects */
8315 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
8317 case '3': /* Uniques */
8318 do_cmd_knowledge_uniques();
8320 case '4': /* Monsters */
8321 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
8323 case '5': /* Kill count */
8324 do_cmd_knowledge_kill_count();
8326 case '6': /* wanted */
8327 if (!vanilla_town) do_cmd_knowledge_kubi();
8329 case '7': /* Pets */
8330 do_cmd_knowledge_pets();
8332 case '8': /* Home */
8333 do_cmd_knowledge_home();
8335 case '9': /* Resist list */
8336 do_cmd_knowledge_inven();
8338 case '0': /* Feature list */
8340 IDX lighting_level = F_LIT_STANDARD;
8341 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
8345 case 'a': /* Max stat */
8346 do_cmd_knowledge_stat();
8348 case 'b': /* Mutations */
8349 do_cmd_knowledge_mutations();
8351 case 'c': /* weapon-exp */
8352 do_cmd_knowledge_weapon_exp();
8354 case 'd': /* spell-exp */
8355 do_cmd_knowledge_spell_exp();
8357 case 'e': /* skill-exp */
8358 do_cmd_knowledge_skill_exp();
8360 case 'f': /* Virtues */
8361 do_cmd_knowledge_virtues();
8363 case 'g': /* Dungeon */
8364 do_cmd_knowledge_dungeon();
8366 case 'h': /* Quests */
8367 do_cmd_knowledge_quests();
8369 case 'i': /* Autopick */
8370 do_cmd_knowledge_autopick();
8372 default: /* Unknown option */
8380 if (need_redraw) do_cmd_redraw();
8385 * Check on the status of an active quest
8387 void do_cmd_checkquest(void)
8389 /* File type is "TEXT" */
8390 FILE_TYPE(FILE_TYPE_TEXT);
8394 do_cmd_knowledge_quests();
8400 * Display the time and date
8402 void do_cmd_time(void)
8404 int day, hour, min, full, start, end, num;
8412 extract_day_hour_min(&day, &hour, &min);
8414 full = hour * 100 + min;
8421 strcpy(desc, _("変な時刻だ。", "It is a strange time."));
8423 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
8424 else strcpy(day_buf, "*****");
8426 msg_format(_("%s日目, 時刻は%d:%02d %sです。", "This is day %s. The time is %d:%02d %s."),
8427 day_buf, (hour % 12 == 0) ? 12 : (hour % 12), min, (hour < 12) ? "AM" : "PM");
8430 if (!randint0(10) || p_ptr->image)
8432 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timefun_j.txt", "timefun.txt"));
8436 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timenorm_j.txt", "timenorm.txt"));
8439 /* Open this file */
8440 fff = my_fopen(buf, "rt");
8444 /* Find this time */
8445 while (!my_fgets(fff, buf, sizeof(buf)))
8447 /* Ignore comments */
8448 if (!buf[0] || (buf[0] == '#')) continue;
8450 /* Ignore invalid lines */
8451 if (buf[1] != ':') continue;
8453 /* Process 'Start' */
8456 /* Extract the starting time */
8457 start = atoi(buf + 2);
8459 /* Assume valid for an hour */
8469 /* Extract the ending time */
8470 end = atoi(buf + 2);
8476 /* Ignore incorrect range */
8477 if ((start > full) || (full > end)) continue;
8479 /* Process 'Description' */
8484 /* Apply the randomizer */
8485 if (!randint0(num)) strcpy(desc, buf + 2);