3 * @brief プレイヤーのインターフェイスに関するコマンドの実装 / Interface commands
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
14 * A set of functions to maintain automatic dumps of various kinds.
16 * remove_auto_dump(orig_file, mark)
17 * Remove the old automatic dump of type "mark".
18 * auto_dump_printf(fmt, ...)
19 * Dump a formatted string using fprintf().
20 * open_auto_dump(buf, mark)
21 * Open a file, remove old dump, and add new header.
22 * close_auto_dump(void)
23 * Add a footer, and close the file.
24 * The dump commands of original Angband simply add new lines to
25 * existing files; these files will become bigger and bigger unless
26 * an user deletes some or all of these files by hand at some
28 * These three functions automatically delete old dumped lines
29 * before adding new ones. Since there are various kinds of automatic
30 * dumps in a single file, we add a header and a footer with a type
31 * name for every automatic dump, and kill old lines only when the
32 * lines have the correct type of header and footer.
33 * We need to be quite paranoid about correctness; the user might
34 * (mistakenly) edit the file by hand, and see all their work come
35 * to nothing on the next auto dump otherwise. The current code only
36 * detects changes by noting inconsistencies between the actual number
37 * of lines and the number written in the footer. Note that this will
38 * not catch single-line edits.
50 * Mark strings for auto dump
52 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
53 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
56 * Variables for auto dump
58 static FILE *auto_dump_stream;
59 static cptr auto_dump_mark;
60 static int auto_dump_line_num;
64 * @brief prf出力内容を消去する /
65 * Remove old lines automatically generated before.
66 * @param orig_file 消去を行うファイル名
68 static void remove_auto_dump(cptr orig_file)
70 FILE *tmp_fff, *orig_fff;
74 bool between_mark = FALSE;
77 long header_location = 0;
78 char header_mark_str[80];
79 char footer_mark_str[80];
82 /* Prepare a header/footer mark string */
83 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
84 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
86 mark_len = strlen(footer_mark_str);
88 /* Open an old dump file in read-only mode */
89 orig_fff = my_fopen(orig_file, "r");
91 /* If original file does not exist, nothing to do */
92 if (!orig_fff) return;
94 /* Open a new (temporary) file */
95 tmp_fff = my_fopen_temp(tmp_file, 1024);
99 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), tmp_file);
104 /* Loop for every line */
108 if (my_fgets(orig_fff, buf, sizeof(buf)))
110 /* Read error: Assume End of File */
113 * Was looking for the footer, but not found.
115 * Since automatic dump might be edited by hand,
116 * it's dangerous to kill these lines.
117 * Seek back to the next line of the (pseudo) header,
122 fseek(orig_fff, header_location, SEEK_SET);
123 between_mark = FALSE;
127 /* Success -- End the loop */
134 /* We are looking for the header mark of automatic dump */
137 /* Is this line a header? */
138 if (!strcmp(buf, header_mark_str))
140 /* Memorise seek point of this line */
141 header_location = ftell(orig_fff);
143 /* Initialize counter for number of lines */
146 /* Look for the footer from now */
149 /* There are some changes */
156 /* Copy orginally lines */
157 fprintf(tmp_fff, "%s\n", buf);
161 /* We are looking for the footer mark of automatic dump */
164 /* Is this line a footer? */
165 if (!strncmp(buf, footer_mark_str, mark_len))
170 * Compare the number of lines
172 * If there is an inconsistency between
173 * actual number of lines and the
174 * number here, the automatic dump
175 * might be edited by hand. So it's
176 * dangerous to kill these lines.
177 * Seek back to the next line of the
178 * (pseudo) header, and read again.
180 if (!sscanf(buf + mark_len, " (%d)", &tmp)
183 fseek(orig_fff, header_location, SEEK_SET);
186 /* Look for another header */
187 between_mark = FALSE;
193 /* Ignore old line, and count number of lines */
203 /* If there are some changes, overwrite the original file with new one */
206 /* Copy contents of temporary file */
208 tmp_fff = my_fopen(tmp_file, "r");
209 orig_fff = my_fopen(orig_file, "w");
211 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
212 fprintf(orig_fff, "%s\n", buf);
218 /* Kill the temporary file */
226 * @brief prfファイルのフォーマットに従った内容を出力する /
227 * Dump a formatted line, using "vstrnfmt()".
230 static void auto_dump_printf(cptr fmt, ...)
237 /* Begin the Varargs Stuff */
240 /* Format the args, save the length */
241 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
243 /* End the Varargs Stuff */
246 /* Count number of lines */
247 for (p = buf; *p; p++)
249 if (*p == '\n') auto_dump_line_num++;
253 fprintf(auto_dump_stream, "%s", buf);
258 * @brief prfファイルをファイルオープンする /
259 * Open file to append auto dump.
261 * @param mark 出力するヘッダマーク
262 * @return ファイルポインタを取得できたらTRUEを返す
264 static bool open_auto_dump(cptr buf, cptr mark)
267 char header_mark_str[80];
269 /* Save the mark string */
270 auto_dump_mark = mark;
272 /* Prepare a header mark string */
273 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
275 /* Remove old macro dumps */
276 remove_auto_dump(buf);
278 /* Append to the file */
279 auto_dump_stream = my_fopen(buf, "a");
282 if (!auto_dump_stream) {
283 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
291 fprintf(auto_dump_stream, "%s\n", header_mark_str);
293 /* Initialize counter */
294 auto_dump_line_num = 0;
296 auto_dump_printf(_("# *警告!!* 以降の行は自動生成されたものです。\n",
297 "# *Warning!* The lines below are an automatic dump.\n"));
298 auto_dump_printf(_("# *警告!!* 後で自動的に削除されるので編集しないでください。\n",
299 "# Don't edit them; changes will be deleted and replaced automatically.\n"));
305 * @brief prfファイルをファイルクローズする /
306 * Append foot part and close auto dump.
309 static void close_auto_dump(void)
311 char footer_mark_str[80];
313 /* Prepare a footer mark string */
314 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
316 auto_dump_printf(_("# *警告!!* 以降の行は自動生成されたものです。\n",
317 "# *Warning!* The lines below are an automatic dump.\n"));
318 auto_dump_printf(_("# *警告!!* 後で自動的に削除されるので編集しないでください。\n",
319 "# Don't edit them; changes will be deleted and replaced automatically.\n"));
321 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
324 my_fclose(auto_dump_stream);
333 * @brief Return suffix of ordinal number
335 * @return pointer of suffix string.
337 cptr get_ordinal_number_suffix(int num)
339 num = ABS(num) % 100;
343 return (num == 11) ? "th" : "st";
345 return (num == 12) ? "th" : "nd";
347 return (num == 13) ? "th" : "rd";
356 * @brief 日記にメッセージを追加する /
357 * Take note to the diary.
358 * @param type 日記内容のID
359 * @param num 日記内容のIDに応じた数値
360 * @param note 日記内容のIDに応じた文字列参照ポインタ
363 errr do_cmd_write_nikki(int type, int num, cptr note)
369 cptr note_level = "";
370 bool do_level = TRUE;
371 char note_level_buf[40];
374 static bool disable_nikki = FALSE;
376 extract_day_hour_min(&day, &hour, &min);
378 if (disable_nikki) return(-1);
380 if (type == NIKKI_FIX_QUEST_C ||
381 type == NIKKI_FIX_QUEST_F ||
382 type == NIKKI_RAND_QUEST_C ||
383 type == NIKKI_RAND_QUEST_F ||
384 type == NIKKI_TO_QUEST)
388 old_quest = p_ptr->inside_quest;
389 p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
391 /* Get the quest text */
392 init_flags = INIT_NAME_ONLY;
394 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
396 /* Reset the old quest number */
397 p_ptr->inside_quest = old_quest;
400 /* different filne name to avoid mixing */
401 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
403 /* Build the filename */
404 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
406 /* File type is "TEXT" */
407 FILE_TYPE(FILE_TYPE_TEXT);
409 fff = my_fopen(buf, "a");
414 msg_format(_("%s を開くことができませんでした。プレイ記録を一時停止します。", "Failed to open %s. Play-Record is disabled temporally."), buf);
420 q_idx = quest_number(dun_level);
424 if (p_ptr->inside_arena)
425 note_level = _("アリーナ:", "Arane:");
427 note_level = _("地上:", "Surface:");
428 else if (q_idx && (is_fixed_quest_idx(q_idx)
429 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
430 note_level = _("クエスト:", "Quest:");
434 sprintf(note_level_buf, "%d階(%s):", (int)dun_level, d_name+d_info[dungeon_type].name);
436 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, (int)dun_level);
438 note_level = note_level_buf;
446 if (day < MAX_DAYS) fprintf(fff, _("%d日目\n", "Day %d\n"), day);
447 else fputs(_("*****日目\n", "Day *****\n"), fff);
455 fprintf(fff, "%s\n",note);
459 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
464 fprintf(fff, _(" %2d:%02d %20s %sを発見した。\n", " %2d:%02d %20s discovered %s.\n"), hour, min, note_level, note);
467 case NIKKI_ART_SCROLL:
469 fprintf(fff, _(" %2d:%02d %20s 巻物によって%sを生成した。\n", " %2d:%02d %20s created %s by scroll.\n"), hour, min, note_level, note);
474 fprintf(fff, _(" %2d:%02d %20s %sを倒した。\n", " %2d:%02d %20s defeated %s.\n"), hour, min, note_level, note);
477 case NIKKI_FIX_QUEST_C:
479 if (quest[num].flags & QUEST_FLAG_SILENT) break;
480 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」を達成した。\n",
481 " %2d:%02d %20s completed quest '%s'.\n"), hour, min, note_level, quest[num].name);
484 case NIKKI_FIX_QUEST_F:
486 if (quest[num].flags & QUEST_FLAG_SILENT) break;
487 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」から命からがら逃げ帰った。\n",
488 " %2d:%02d %20s run away from quest '%s'.\n"), hour, min, note_level, quest[num].name);
491 case NIKKI_RAND_QUEST_C:
494 strcpy(name, r_name+r_info[quest[num].r_idx].name);
495 fprintf(fff, _(" %2d:%02d %20s ランダムクエスト(%s)を達成した。\n",
496 " %2d:%02d %20s completed random quest '%s'\n"), hour, min, note_level, name);
499 case NIKKI_RAND_QUEST_F:
502 strcpy(name, r_name+r_info[quest[num].r_idx].name);
503 fprintf(fff, _(" %2d:%02d %20s ランダムクエスト(%s)から逃げ出した。\n",
504 " %2d:%02d %20s ran away from quest '%s'.\n"), hour, min, note_level, name);
507 case NIKKI_MAXDEAPTH:
509 fprintf(fff, _(" %2d:%02d %20s %sの最深階%d階に到達した。\n",
510 " %2d:%02d %20s reached level %d of %s for the first time.\n"), hour, min, note_level,
511 _(d_name+d_info[dungeon_type].name, num),
512 _(num, d_name+d_info[dungeon_type].name));
517 fprintf(fff, _(" %2d:%02d %20s %s%sの最深階を%d階にセットした。\n",
518 " %2d:%02d %20s reset recall level of %s to %d %s.\n"), hour, min, note_level, note,
519 _(d_name + d_info[num].name, (int)max_dlv[num]),
520 _((int)max_dlv[num], d_name + d_info[num].name));
526 if (q_idx && (is_fixed_quest_idx(q_idx)
527 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
529 to = _("地上", "the surface");
533 if (!(dun_level+num)) to = _("地上", "the surface");
534 else to = format(_("%d階", "level %d"), dun_level+num);
536 fprintf(fff, _(" %2d:%02d %20s %sへ%s。\n", " %2d:%02d %20s %s %s.\n"), hour, min, note_level, _(to, note), _(note, to));
542 fprintf(fff, _(" %2d:%02d %20s 帰還を使って%sの%d階へ下りた。\n", " %2d:%02d %20s recalled to dungeon level %d of %s.\n"),
543 hour, min, note_level, _(d_name+d_info[dungeon_type].name, (int)max_dlv[dungeon_type]),
544 _((int)max_dlv[dungeon_type], d_name+d_info[dungeon_type].name));
546 fprintf(fff, _(" %2d:%02d %20s 帰還を使って地上へと戻った。\n", " %2d:%02d %20s recalled from dungeon to surface.\n"), hour, min, note_level);
551 if (quest[num].flags & QUEST_FLAG_SILENT) break;
552 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」へと突入した。\n", " %2d:%02d %20s entered the quest '%s'.\n"),
553 hour, min, note_level, quest[num].name);
558 fprintf(fff, _(" %2d:%02d %20s レベル・テレポートで脱出した。\n", " %2d:%02d %20s Got out using teleport level.\n"),
559 hour, min, note_level);
564 fprintf(fff, _(" %2d:%02d %20s %sを購入した。\n", " %2d:%02d %20s bought %s.\n"), hour, min, note_level, note);
569 fprintf(fff, _(" %2d:%02d %20s %sを売却した。\n", " %2d:%02d %20s sold %s.\n"), hour, min, note_level, note);
577 fprintf(fff, _(" %2d:%02d %20s 闘技場の%d%s回戦で、%sの前に敗れ去った。\n", " %2d:%02d %20s beaten by %s in the %d%s fight.\n"),
578 hour, min, note_level, _(n, note), _("", n), _(note, get_ordinal_number_suffix(n)));
581 fprintf(fff, _(" %2d:%02d %20s 闘技場の%d%s回戦(%s)に勝利した。\n", " %2d:%02d %20s won the %d%s fight (%s).\n"),
582 hour, min, note_level, num, _("", get_ordinal_number_suffix(num)), note);
584 if (num == MAX_ARENA_MONS)
586 fprintf(fff, _(" 闘技場のすべての敵に勝利し、チャンピオンとなった。\n",
587 " won all fight to become a Chanpion.\n"));
594 fprintf(fff, _(" %2d:%02d %20s %sを識別した。\n", " %2d:%02d %20s identified %s.\n"), hour, min, note_level, note);
601 to = _("地上", "the surface");
603 to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_type].name);
605 fprintf(fff, _(" %2d:%02d %20s %sへとウィザード・テレポートで移動した。\n",
606 " %2d:%02d %20s wizard-teleport to %s.\n"), hour, min, note_level, to);
613 to = _("地上", "the surface");
615 to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_type].name);
617 fprintf(fff, _(" %2d:%02d %20s %sへとパターンの力で移動した。\n",
618 " %2d:%02d %20s used Pattern to teleport to %s.\n"), hour, min, note_level, to);
623 fprintf(fff, _(" %2d:%02d %20s レベルが%dに上がった。\n", " %2d:%02d %20s reached player level %d.\n"), hour, min, note_level, num);
626 case NIKKI_GAMESTART:
628 time_t ct = time((time_t*)0);
632 fprintf(fff, "%s %s",note, ctime(&ct));
635 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
638 case NIKKI_NAMED_PET:
640 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
643 case RECORD_NAMED_PET_NAME:
644 fprintf(fff, _("%sを旅の友にすることに決めた。\n", "decided to travel together with %s.\n"), note);
646 case RECORD_NAMED_PET_UNNAME:
647 fprintf(fff, _("%sの名前を消した。\n", "unnamed %s.\n"), note);
649 case RECORD_NAMED_PET_DISMISS:
650 fprintf(fff, _("%sを解放した。\n", "dismissed %s.\n"), note);
652 case RECORD_NAMED_PET_DEATH:
653 fprintf(fff, _("%sが死んでしまった。\n", "%s died.\n"), note);
655 case RECORD_NAMED_PET_MOVED:
656 fprintf(fff, _("%sをおいて別のマップへ移動した。\n", "moved to another map leaving %s behind.\n"), note);
658 case RECORD_NAMED_PET_LOST_SIGHT:
659 fprintf(fff, _("%sとはぐれてしまった。\n", "lost sight of %s.\n"), note);
661 case RECORD_NAMED_PET_DESTROY:
662 fprintf(fff, _("%sが*破壊*によって消え去った。\n", "%s was made disappeared by *destruction*.\n"), note);
664 case RECORD_NAMED_PET_EARTHQUAKE:
665 fprintf(fff, _("%sが岩石に押し潰された。\n", "%s was crushed by falling rocks.\n"), note);
667 case RECORD_NAMED_PET_GENOCIDE:
668 fprintf(fff, _("%sが抹殺によって消え去った。\n", "%s was made disappeared by genocide.\n"), note);
670 case RECORD_NAMED_PET_WIZ_ZAP:
671 fprintf(fff, _("%sがデバッグコマンドによって消え去った。\n", "%s was removed by debug command.\n"), note);
673 case RECORD_NAMED_PET_TELE_LEVEL:
674 fprintf(fff, _("%sがテレポート・レベルによって消え去った。\n", "%s was made disappeared by teleport level.\n"), note);
676 case RECORD_NAMED_PET_BLAST:
677 fprintf(fff, _("%sを爆破した。\n", "blasted %s.\n"), note);
679 case RECORD_NAMED_PET_HEAL_LEPER:
680 fprintf(fff, _("%sの病気が治り旅から外れた。\n", "%s was healed and left.\n"), note);
682 case RECORD_NAMED_PET_COMPACT:
683 fprintf(fff, _("%sがモンスター情報圧縮によって消え去った。\n", "%s was made disappeared by compacting monsters.\n"), note);
685 case RECORD_NAMED_PET_LOSE_PARENT:
686 fprintf(fff, _("%sの召喚者が既にいないため消え去った。\n", "%s disappeared because there does not exist summoner.\n"), note);
697 case NIKKI_WIZARD_LOG:
698 fprintf(fff, "%s\n", note);
707 if (do_level) write_level = FALSE;
713 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
716 * @brief 日記のタイトル表記と内容出力 /
719 * 日記のタイトルは本関数の subtitle ローカル変数で定義されている。
721 static void do_cmd_disp_nikki(void)
723 char nikki_title[256];
729 static const char subtitle[][30] = {"最強の肉体を求めて",
760 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
761 "Attack is the best form of defence.",
763 "An unexpected windfall",
764 "A drowning man will catch at a straw",
765 "Don't count your chickens before they are hatched.",
766 "It is no use crying over spilt milk.",
767 "Seeing is believing.",
768 "Strike the iron while it is hot.",
769 "I don't care what follows.",
770 "To dig a well to put out a house on fire.",
771 "Tomorrow is another day.",
772 "Easy come, easy go.",
773 "The more haste, the less speed.",
774 "Where there is life, there is hope.",
775 "There is no royal road to *WINNER*.",
776 "Danger past, God forgotten.",
777 "The best thing to do now is to run away.",
778 "Life is but an empty dream.",
779 "Dead men tell no tales.",
780 "A book that remains shut is but a block.",
781 "Misfortunes never come singly.",
782 "A little knowledge is a dangerous thing.",
783 "History repeats itself.",
784 "*WINNER* was not built in a day.",
785 "Ignorance is bliss.",
786 "To lose is to win?",
787 "No medicine can cure folly.",
788 "All good things come to an end.",
789 "M$ Empire strikes back.",
790 "To see is to believe",
792 "Quest of The World's Greatest Brain"};
794 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
796 /* Build the filename */
797 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
799 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
800 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
801 else if (IS_WIZARD_CLASS())
802 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
803 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
806 sprintf(nikki_title, "「%s%s%sの伝説 -%s-」",
807 ap_ptr->title, ap_ptr->no ? "の" : "", p_ptr->name, tmp);
809 sprintf(nikki_title, "Legend of %s %s '%s'",
810 ap_ptr->title, p_ptr->name, tmp);
813 /* Display the file contents */
814 show_file(FALSE, buf, nikki_title, -1, 0);
818 * @brief 日記に任意の内容を表記するコマンドのメインルーチン /
821 static void do_cmd_bunshou(void)
824 char bunshou[80] = "\0";
826 if (get_string(_("内容: ", "diary note: "), tmp, 79))
828 strcpy(bunshou, tmp);
830 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
835 * @brief 最後に取得したアイテムの情報を日記に追加するメインルーチン /
838 static void do_cmd_last_get(void)
843 if (record_o_name[0] == '\0') return;
845 sprintf(buf,_("%sの入手を記録します。", "Do you really want to record getting %s? "),record_o_name);
846 if (!get_check(buf)) return;
850 sprintf(buf,_("%sを手に入れた。", "descover %s."), record_o_name);
851 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
856 * @brief ファイル中の全日記記録を消去する /
859 static void do_cmd_erase_nikki(void)
865 if (!get_check(_("本当に記録を消去しますか?", "Do you really want to delete all your record? "))) return;
866 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
868 /* Build the filename */
869 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
871 /* Remove the file */
874 fff = my_fopen(buf, "w");
877 msg_format(_("記録を消去しました。", "deleted record."));
879 msg_format(_("%s の消去に失敗しました。", "failed to delete %s."), buf);
888 void do_cmd_nikki(void)
892 /* File type is "TEXT" */
893 FILE_TYPE(FILE_TYPE_TEXT);
895 /* Save the screen */
898 /* Interact until done */
904 /* Ask for a choice */
905 prt(_("[ 記録の設定 ]", "[ Play Record ]"), 2, 0);
907 /* Give some choices */
908 prt(_("(1) 記録を見る", "(1) Display your record"), 4, 5);
909 prt(_("(2) 文章を記録する", "(2) Add record"), 5, 5);
910 prt(_("(3) 直前に入手又は鑑定したものを記録する", "(3) Record item you last get/identify"), 6, 5);
911 prt(_("(4) 記録を消去する", "(4) Delete your record"), 7, 5);
913 prt(_("(R) プレイ動画を記録する/中止する", "(R) Record playing movie / or stop it"), 9, 5);
916 prt(_("コマンド:", "Command: "), 18, 0);
921 if (i == ESCAPE) break;
935 do_cmd_erase_nikki();
939 prepare_movie_hooks();
941 default: /* Unknown option */
949 /* Restore the screen */
954 * @brief 画面を再描画するコマンドのメインルーチン
955 * Hack -- redraw the screen
959 * This command performs various low level updates, clears all the "extra"
960 * windows, does a total redraw of the main window, and requests all of the
961 * interesting updates and redraws that I can think of.
963 * This command is also used to "instantiate" the results of the user
964 * selecting various things, such as graphics mode, so it must call
965 * the "TERM_XTRA_REACT" hook before redrawing the windows.
968 void do_cmd_redraw(void)
975 /* Hack -- react to changes */
976 Term_xtra(TERM_XTRA_REACT, 0);
979 /* Combine and Reorder the pack (later) */
980 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
984 p_ptr->update |= (PU_TORCH);
986 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
988 /* Forget lite/view */
989 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
991 /* Update lite/view */
992 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
993 p_ptr->update |= (PU_MONSTERS);
995 /* Redraw everything */
996 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
998 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1000 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1004 /* Hack -- update */
1007 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1010 /* Redraw every window */
1011 for (j = 0; j < 8; j++)
1014 if (!angband_term[j]) continue;
1017 Term_activate(angband_term[j]);
1030 * @brief 名前を変更するコマンドのメインルーチン
1031 * Hack -- change name
1034 void do_cmd_change_name(void)
1043 /* Save the screen */
1051 /* Display the player */
1052 display_player(mode);
1057 display_player(mode);
1062 Term_putstr(2, 23, -1, TERM_WHITE,
1063 "['c'で名前変更, 'f'でファイルへ書出, 'h'でモード変更, ESCで終了]");
1065 Term_putstr(2, 23, -1, TERM_WHITE,
1066 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1074 if (c == ESCAPE) break;
1081 /* Process the player name */
1082 process_player_name(FALSE);
1088 sprintf(tmp, "%s.txt", player_base);
1089 if (get_string(_("ファイル名: ", "File name: "), tmp, 80))
1091 if (tmp[0] && (tmp[0] != ' '))
1093 file_character(tmp);
1109 /* Flush messages */
1113 /* Restore the screen */
1116 /* Redraw everything */
1117 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1124 * @brief 最近表示されたメッセージを再表示するコマンドのメインルーチン
1125 * Recall the most recent message
1128 void do_cmd_message_one(void)
1130 /* Recall one message */
1131 prt(format("> %s", message_str(0)), 0, 0);
1136 * @brief メッセージのログを表示するコマンドのメインルーチン
1137 * Recall the most recent message
1141 * Show previous messages to the user -BEN-
1143 * The screen format uses line 0 and 23 for headers and prompts,
1144 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1146 * This command shows you which commands you are viewing, and allows
1147 * you to "search" for strings in the recall.
1149 * Note that messages may be longer than 80 characters, but they are
1150 * displayed using "infinite" length, with a special sub-command to
1151 * "slide" the virtual display to the left or right.
1153 * Attempt to only hilite the matching portions of the string.
1156 void do_cmd_messages(int num_now)
1160 char shower_str[81];
1161 char finder_str[81];
1167 Term_get_size(&wid, &hgt);
1169 /* Number of message lines in a screen */
1170 num_lines = hgt - 4;
1173 strcpy(finder_str, "");
1176 strcpy(shower_str, "");
1178 /* Total messages */
1181 /* Start on first message */
1184 /* Save the screen */
1190 /* Process requests until done */
1196 /* Dump up to 20 lines of messages */
1197 for (j = 0; (j < num_lines) && (i + j < n); j++)
1199 cptr msg = message_str(i+j);
1201 /* Dump the messages, bottom to top */
1202 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1204 /* Hilite "shower" */
1205 if (shower && shower[0])
1209 /* Display matches */
1210 while ((str = my_strstr(str, shower)) != NULL)
1212 int len = strlen(shower);
1214 /* Display the match */
1215 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1223 /* Erase remaining lines */
1224 for (; j < num_lines; j++)
1226 Term_erase(0, num_lines + 1 - j, 255);
1229 /* Display header */
1231 prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"),
1232 i, i + j - 1, n), 0, 0);
1234 /* Display prompt (not very informative) */
1235 prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]",
1236 "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0);
1239 skey = inkey_special(TRUE);
1241 /* Exit on Escape */
1242 if (skey == ESCAPE) break;
1244 /* Hack -- Save the old index */
1249 /* Hack -- handle show */
1252 prt(_("強調: ", "Show: "), hgt - 1, 0);
1254 /* Get a "shower" string, or continue */
1255 strcpy(back_str, shower_str);
1256 if (askfor(shower_str, 80))
1259 shower = shower_str[0] ? shower_str : NULL;
1261 else strcpy(shower_str, back_str);
1265 /* Hack -- handle find */
1272 prt(_("検索: ", "Find: "), hgt - 1, 0);
1274 /* Get a "finder" string, or continue */
1275 strcpy(back_str, finder_str);
1276 if (!askfor(finder_str, 80))
1278 strcpy(finder_str, back_str);
1281 else if (!finder_str[0])
1283 shower = NULL; /* Stop showing */
1288 shower = finder_str;
1291 for (z = i + 1; z < n; z++)
1293 cptr msg = message_str(z);
1296 if (my_strstr(msg, finder_str))
1307 /* Recall 1 older message */
1309 /* Go to the oldest line */
1313 /* Recall 1 newer message */
1315 /* Go to the newest line */
1319 /* Recall 1 older message */
1324 /* Go older if legal */
1325 i = MIN(i + 1, n - num_lines);
1328 /* Recall 10 older messages */
1330 /* Go older if legal */
1331 i = MIN(i + 10, n - num_lines);
1334 /* Recall 20 older messages */
1339 /* Go older if legal */
1340 i = MIN(i + num_lines, n - num_lines);
1343 /* Recall 20 newer messages */
1347 /* Go newer (if able) */
1348 i = MAX(0, i - num_lines);
1351 /* Recall 10 newer messages */
1353 /* Go newer (if able) */
1357 /* Recall 1 newer messages */
1360 /* Go newer (if able) */
1365 /* Hack -- Error of some kind */
1369 /* Restore the screen */
1375 * @brief チートオプションを変更するコマンドのメインルーチン
1376 * Interact with some options for cheating
1377 * @param info 表示メッセージ
1380 static void do_cmd_options_cheat(cptr info)
1383 int i, k = 0, n = CHEAT_MAX;
1389 /* Interact with the player */
1395 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info);
1400 /* 詐欺オプションをうっかりいじってしまう人がいるようなので注意 */
1401 prt(" << 注意 >>", 11, 0);
1402 prt(" 詐欺オプションを一度でも設定すると、スコア記録が残らなくなります!", 12, 0);
1403 prt(" 後に解除してもダメですので、勝利者を目指す方はここのオプションはい", 13, 0);
1404 prt(" じらないようにして下さい。", 14, 0);
1406 /* Display the options */
1407 for (i = 0; i < n; i++)
1409 byte a = TERM_WHITE;
1411 /* Color current option */
1412 if (i == k) a = TERM_L_BLUE;
1414 /* Display the option text */
1415 sprintf(buf, "%-48s: %s (%s)",
1416 cheat_info[i].o_desc,
1417 (*cheat_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1418 cheat_info[i].o_text);
1419 c_prt(a, buf, i + 2, 0);
1422 /* Hilite current option */
1423 move_cursor(k + 2, 50);
1429 * HACK - Try to translate the key into a direction
1430 * to allow using the roguelike keys for navigation.
1432 dir = get_keymap_dir(ch);
1433 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1447 k = (n + k - 1) % n;
1465 do_cmd_write_nikki(NIKKI_BUNSHOU, 0,
1466 _("詐欺オプションをONにして、スコアを残せなくなった。", "give up sending score to use cheating options."));
1467 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1468 (*cheat_info[k].o_var) = TRUE;
1477 (*cheat_info[k].o_var) = FALSE;
1484 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), cheat_info[k].o_text);
1485 /* Peruse the help file */
1486 (void)show_file(TRUE, buf, NULL, 0, 0);
1503 * @brief セーブ頻度ターンの次の値を返す
1504 * @param current 現在のセーブ頻度ターン値
1505 * @return 次のセーブ頻度ターン値
1507 static s16b toggle_frequency(s16b current)
1512 case 50: return 100;
1513 case 100: return 250;
1514 case 250: return 500;
1515 case 500: return 1000;
1516 case 1000: return 2500;
1517 case 2500: return 5000;
1518 case 5000: return 10000;
1519 case 10000: return 25000;
1526 * @brief 自動セーブオプションを変更するコマンドのメインルーチン
1527 * @param info 表示メッセージ
1530 static void do_cmd_options_autosave(cptr info)
1533 int i, k = 0, n = 2;
1540 /* Interact with the player */
1544 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, F で頻度を入力, ESC で決定 ) ",
1545 "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) "), info);
1549 /* Display the options */
1550 for (i = 0; i < n; i++)
1552 byte a = TERM_WHITE;
1554 /* Color current option */
1555 if (i == k) a = TERM_L_BLUE;
1557 /* Display the option text */
1558 sprintf(buf, "%-48s: %s (%s)",
1559 autosave_info[i].o_desc,
1560 (*autosave_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1561 autosave_info[i].o_text);
1562 c_prt(a, buf, i + 2, 0);
1564 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1566 /* Hilite current option */
1567 move_cursor(k + 2, 50);
1583 k = (n + k - 1) % n;
1601 (*autosave_info[k].o_var) = TRUE;
1610 (*autosave_info[k].o_var) = FALSE;
1618 autosave_freq = toggle_frequency(autosave_freq);
1619 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1625 (void)show_file(TRUE, _("joption.txt#Autosave", "option.txt#Autosave"), NULL, 0, 0);
1641 * @brief 標準オプションを変更するコマンドのサブルーチン /
1642 * Interact with some options
1643 * @param page オプションページ番号
1644 * @param info 表示メッセージ
1647 void do_cmd_options_aux(int page, cptr info)
1650 int i, k = 0, n = 0, l;
1653 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1654 (!p_ptr->wizard || !allow_debug_opts);
1657 /* Lookup the options */
1658 for (i = 0; i < 24; i++) opt[i] = 0;
1660 /* Scan the options */
1661 for (i = 0; option_info[i].o_desc; i++)
1663 /* Notice options on this "page" */
1664 if (option_info[i].o_page == page) opt[n++] = i;
1670 /* Interact with the player */
1676 sprintf(buf, _("%s (リターン:次, %sESC:終了, ?:ヘルプ) ", "%s (RET:next, %s, ?:help) "),
1677 info, browse_only ? _("", "ESC:exit") : _("y/n:変更, ", "y/n:change, ESC:accept"));
1680 /* HACK -- description for easy-auto-destroy options */
1681 if (page == OPT_PAGE_AUTODESTROY)
1682 c_prt(TERM_YELLOW, _("以下のオプションは、簡易自動破壊を使用するときのみ有効",
1683 "Following options will protect items from easy auto-destroyer."), 6, _(6, 3));
1685 /* Display the options */
1686 for (i = 0; i < n; i++)
1688 byte a = TERM_WHITE;
1690 /* Color current option */
1691 if (i == k) a = TERM_L_BLUE;
1693 /* Display the option text */
1694 sprintf(buf, "%-48s: %s (%.19s)",
1695 option_info[opt[i]].o_desc,
1696 (*option_info[opt[i]].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1697 option_info[opt[i]].o_text);
1698 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1699 else c_prt(a, buf, i + 2, 0);
1702 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
1705 /* Hilite current option */
1706 move_cursor(k + 2 + l, 50);
1712 * HACK - Try to translate the key into a direction
1713 * to allow using the roguelike keys for navigation.
1715 dir = get_keymap_dir(ch);
1716 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1730 k = (n + k - 1) % n;
1747 if (browse_only) break;
1748 (*option_info[opt[k]].o_var) = TRUE;
1757 if (browse_only) break;
1758 (*option_info[opt[k]].o_var) = FALSE;
1766 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
1772 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), option_info[opt[k]].o_text);
1773 /* Peruse the help file */
1774 (void)show_file(TRUE, buf, NULL, 0, 0);
1791 * @brief ウィンドウオプションを変更するコマンドのメインルーチン /
1792 * Modify the "window" options
1795 static void do_cmd_options_win(void)
1805 /* Memorize old flags */
1806 for (j = 0; j < 8; j++)
1808 /* Acquire current flags */
1809 old_flag[j] = window_flag[j];
1820 prt(_("ウィンドウ・フラグ (<方向>で移動, tでチェンジ, y/n でセット, ESC)", "Window Flags (<dir>, t, y, n, ESC) "), 0, 0);
1822 /* Display the windows */
1823 for (j = 0; j < 8; j++)
1825 byte a = TERM_WHITE;
1827 cptr s = angband_term_name[j];
1830 if (j == x) a = TERM_L_BLUE;
1832 /* Window name, staggered, centered */
1833 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
1836 /* Display the options */
1837 for (i = 0; i < 16; i++)
1839 byte a = TERM_WHITE;
1841 cptr str = window_flag_desc[i];
1844 if (i == y) a = TERM_L_BLUE;
1847 if (!str) str = _("(未使用)", "(Unused option)");
1850 Term_putstr(0, i + 5, -1, a, str);
1852 /* Display the windows */
1853 for (j = 0; j < 8; j++)
1859 if ((i == y) && (j == x)) a = TERM_L_BLUE;
1862 if (window_flag[j] & (1L << i)) c = 'X';
1865 Term_putch(35 + j * 5, i + 5, a, c);
1870 Term_gotoxy(35 + x * 5, y + 5);
1888 for (j = 0; j < 8; j++)
1890 window_flag[j] &= ~(1L << y);
1894 for (i = 0; i < 16; i++)
1896 window_flag[x] &= ~(1L << i);
1909 window_flag[x] |= (1L << y);
1917 window_flag[x] &= ~(1L << y);
1923 (void)show_file(TRUE, _("joption.txt#Window", "option.txt#Window"), NULL, 0, 0);
1931 d = get_keymap_dir(ch);
1933 x = (x + ddx[d] + 8) % 8;
1934 y = (y + ddy[d] + 16) % 16;
1941 /* Notice changes */
1942 for (j = 0; j < 8; j++)
1947 if (!angband_term[j]) continue;
1949 /* Ignore non-changes */
1950 if (window_flag[j] == old_flag[j]) continue;
1953 Term_activate(angband_term[j]);
1976 option_fields[OPT_NUM] =
1979 { '1', " キー入力 オプション", 3 },
1980 { '2', " マップ画面 オプション", 4 },
1981 { '3', " テキスト表示 オプション", 5 },
1982 { '4', " ゲームプレイ オプション", 6 },
1983 { '5', " 行動中止関係 オプション", 7 },
1984 { '6', " 簡易自動破壊 オプション", 8 },
1985 { 'r', " プレイ記録 オプション", 9 },
1987 { 'p', "自動拾いエディタ", 11 },
1988 { 'd', " 基本ウェイト量 ", 12 },
1989 { 'h', "低ヒットポイント", 13 },
1990 { 'm', " 低魔力色閾値 ", 14 },
1991 { 'a', " 自動セーブ オプション", 15 },
1992 { 'w', "ウインドウフラグ", 16 },
1994 { 'b', " 初期 オプション (参照のみ)", 18 },
1995 { 'c', " 詐欺 オプション", 19 },
1997 { '1', "Input Options", 3 },
1998 { '2', "Map Screen Options", 4 },
1999 { '3', "Text Display Options", 5 },
2000 { '4', "Game-Play Options", 6 },
2001 { '5', "Disturbance Options", 7 },
2002 { '6', "Easy Auto-Destroyer Options", 8 },
2003 { 'r', "Play record Options", 9 },
2005 { 'p', "Auto-picker/destroyer editor", 11 },
2006 { 'd', "Base Delay Factor", 12 },
2007 { 'h', "Hitpoint Warning", 13 },
2008 { 'm', "Mana Color Threshold", 14 },
2009 { 'a', "Autosave Options", 15 },
2010 { 'w', "Window Flags", 16 },
2012 { 'b', "Birth Options (Browse Only)", 18 },
2013 { 'c', "Cheat Options", 19 },
2019 * @brief 標準オプションを変更するコマンドのメインルーチン /
2020 * Set or unset various options.
2024 * The user must use the "Ctrl-R" command to "adapt" to changes
2025 * in any options which control "visual" aspects of the game.
2028 void do_cmd_options(void)
2034 /* Save the screen */
2042 /* Does not list cheat option when cheat option is off */
2043 if (!p_ptr->noscore && !allow_debug_opts) n--;
2048 /* Why are we here */
2049 prt(_("[ オプションの設定 ]", "TinyAngband options"), 1, 0);
2053 /* Give some choices */
2054 for (i = 0; i < n; i++)
2056 byte a = TERM_WHITE;
2057 if (i == y) a = TERM_L_BLUE;
2058 Term_putstr(5, option_fields[i].row, -1, a,
2059 format("(%c) %s", toupper(option_fields[i].key), option_fields[i].name));
2062 prt(_("<方向>で移動, Enterで決定, ESCでキャンセル, ?でヘルプ: ", "Move to <dir>, Select to Enter, Cancel to ESC, ? to help: "), 21, 0);
2065 skey = inkey_special(TRUE);
2066 if (!(skey & SKEY_MASK)) k = (char)skey;
2070 if (k == ESCAPE) break;
2072 if (my_strchr("\n\r ", k))
2074 k = option_fields[y].key;
2078 for (i = 0; i < n; i++)
2080 if (tolower(k) == option_fields[i].key) break;
2083 /* Command is found */
2086 /* Hack -- browse help */
2087 if (k == '?') break;
2091 if (skey == SKEY_UP) d = 8;
2092 if (skey == SKEY_DOWN) d = 2;
2093 y = (y + ddy[d] + n) % n;
2098 if (k == ESCAPE) break;
2105 /* Process the general options */
2106 do_cmd_options_aux(OPT_PAGE_INPUT, _("キー入力オプション", "Input Options"));
2112 /* Process the general options */
2113 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, _("マップ画面オプション", "Map Screen Options"));
2120 do_cmd_options_aux(OPT_PAGE_TEXT, _("テキスト表示オプション", "Text Display Options"));
2127 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, _("ゲームプレイ・オプション", "Game-Play Options"));
2134 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, _("行動中止関係のオプション", "Disturbance Options"));
2141 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, _("簡易自動破壊オプション", "Easy Auto-Destroyer Options"));
2145 /* Play-record Options */
2150 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, _("プレイ記録オプション", "Play-record Options"));
2159 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ?
2160 _("初期オプション(参照のみ)", "Birth Options(browse only)") :
2161 _("初期オプション((*)はスコアに影響)", "Birth Options((*)s effect score)"));
2165 /* Cheating Options */
2168 if (!p_ptr->noscore && !allow_debug_opts)
2170 /* Cheat options are not permitted */
2176 do_cmd_options_cheat(_("詐欺師は決して勝利できない!", "Cheaters never win"));
2183 do_cmd_options_autosave(_("自動セーブ", "Autosave"));
2192 do_cmd_options_win();
2193 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2194 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2195 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2196 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON |
2201 /* Auto-picker/destroyer editor */
2205 do_cmd_edit_autopick();
2209 /* Hack -- Delay Speed */
2215 prt(_("コマンド: 基本ウェイト量", "Command: Base Delay Factor"), 19, 0);
2217 /* Get a new value */
2220 int msec = delay_factor * delay_factor * delay_factor;
2221 prt(format(_("現在のウェイト: %d (%dミリ秒)", "Current base delay factor: %d (%d msec)"), delay_factor, msec), 22, 0);
2222 prt(_("ウェイト (0-9) ESCで決定: ", "Delay Factor (0-9 or ESC to accept): "), 20, 0);
2224 if (k == ESCAPE) break;
2227 (void)show_file(TRUE, _("joption.txt#BaseDelay", "option.txt#BaseDelay"), NULL, 0, 0);
2230 else if (isdigit(k)) delay_factor = D2I(k);
2237 /* Hack -- hitpoint warning factor */
2243 prt(_("コマンド: 低ヒットポイント警告", "Command: Hitpoint Warning"), 19, 0);
2245 /* Get a new value */
2248 prt(format(_("現在の低ヒットポイント警告: %d0%%", "Current hitpoint warning: %d0%%"), hitpoint_warn), 22, 0);
2249 prt(_("低ヒットポイント警告 (0-9) ESCで決定: ", "Hitpoint Warning (0-9 or ESC to accept): "), 20, 0);
2251 if (k == ESCAPE) break;
2254 (void)show_file(TRUE, _("joption.txt#Hitpoint", "option.txt#Hitpoint"), NULL, 0, 0);
2257 else if (isdigit(k)) hitpoint_warn = D2I(k);
2264 /* Hack -- mana color factor */
2270 prt(_("コマンド: 低魔力色閾値", "Command: Mana Color Threshold"), 19, 0);
2272 /* Get a new value */
2275 prt(format(_("現在の低魔力色閾値: %d0%%", "Current mana color threshold: %d0%%"), mana_warn), 22, 0);
2276 prt(_("低魔力閾値 (0-9) ESCで決定: ", "Mana color Threshold (0-9 or ESC to accept): "), 20, 0);
2278 if (k == ESCAPE) break;
2281 (void)show_file(TRUE, _("joption.txt#Manapoint", "option.txt#Manapoint"), NULL, 0, 0);
2284 else if (isdigit(k)) mana_warn = D2I(k);
2292 (void)show_file(TRUE, _("joption.txt", "option.txt"), NULL, 0, 0);
2296 /* Unknown option */
2304 /* Flush messages */
2309 /* Restore the screen */
2312 /* Hack - Redraw equippy chars */
2313 p_ptr->redraw |= (PR_EQUIPPY);
2319 * @brief prefファイルを選択して処理する /
2320 * Ask for a "user pref line" and process it
2323 * Allow absolute file names?
2325 void do_cmd_pref(void)
2332 /* Ask for a "user pref command" */
2333 if (!get_string(_("設定変更コマンド: ", "Pref: "), buf, 80)) return;
2335 /* Process that pref command */
2336 (void)process_pref_file_command(buf);
2340 * @brief 自動拾い設定ファイルをロードするコマンドのメインルーチン /
2343 void do_cmd_reload_autopick(void)
2345 if (!get_check(_("自動拾い設定ファイルをロードしますか? ", "Reload auto-pick preference file? "))) return;
2346 /* Load the file with messages */
2347 autopick_load_pref(TRUE);
2353 * @brief マクロ情報をprefファイルに保存する /
2354 * @param fname ファイル名
2357 static errr macro_dump(cptr fname)
2359 static cptr mark = "Macro Dump";
2365 /* Build the filename */
2366 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2368 /* File type is "TEXT" */
2369 FILE_TYPE(FILE_TYPE_TEXT);
2371 /* Append to the file */
2372 if (!open_auto_dump(buf, mark)) return (-1);
2375 auto_dump_printf(_("\n# 自動マクロセーブ\n\n", "\n# Automatic macro dump\n\n"));
2378 for (i = 0; i < macro__num; i++)
2380 /* Extract the action */
2381 ascii_to_text(buf, macro__act[i]);
2383 /* Dump the macro */
2384 auto_dump_printf("A:%s\n", buf);
2386 /* Extract the action */
2387 ascii_to_text(buf, macro__pat[i]);
2389 /* Dump normal macros */
2390 auto_dump_printf("P:%s\n", buf);
2393 auto_dump_printf("\n");
2405 * @brief マクロのトリガーキーを取得する /
2406 * Hack -- ask for a "trigger" (see below)
2407 * @param buf キー表記を保管するバッファ
2411 * Note the complex use of the "inkey()" function from "util.c".
2413 * Note that both "flush()" calls are extremely important.
2416 static void do_cmd_macro_aux(char *buf)
2424 /* Do not process macros */
2430 /* Read the pattern */
2436 /* Do not process macros */
2439 /* Do not wait for keys */
2442 /* Attempt to read a key */
2451 /* Convert the trigger */
2452 ascii_to_text(tmp, buf);
2454 /* Hack -- display the trigger */
2455 Term_addstr(-1, TERM_WHITE, tmp);
2461 * @brief マクロのキー表記からアスキーコードを得てターミナルに表示する /
2462 * Hack -- ask for a keymap "trigger" (see below)
2463 * @param buf キー表記を取得するバッファ
2467 * Note that both "flush()" calls are extremely important. This may
2468 * no longer be true, since "util.c" is much simpler now.
2471 static void do_cmd_macro_aux_keymap(char *buf)
2481 /* Convert to ascii */
2482 ascii_to_text(tmp, buf);
2484 /* Hack -- display the trigger */
2485 Term_addstr(-1, TERM_WHITE, tmp);
2492 * @brief キーマップをprefファイルにダンプする /
2493 * Hack -- append all keymaps to the given file
2494 * @param fname ファイルネーム
2498 static errr keymap_dump(cptr fname)
2500 static cptr mark = "Keymap Dump";
2509 if (rogue_like_commands)
2511 mode = KEYMAP_MODE_ROGUE;
2517 mode = KEYMAP_MODE_ORIG;
2521 /* Build the filename */
2522 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2524 /* File type is "TEXT" */
2525 FILE_TYPE(FILE_TYPE_TEXT);
2527 /* Append to the file */
2528 if (!open_auto_dump(buf, mark)) return -1;
2531 auto_dump_printf(_("\n# 自動キー配置セーブ\n\n", "\n# Automatic keymap dump\n\n"));
2534 for (i = 0; i < 256; i++)
2538 /* Loop up the keymap */
2539 act = keymap_act[mode][i];
2541 /* Skip empty keymaps */
2544 /* Encode the key */
2547 ascii_to_text(key, buf);
2549 /* Encode the action */
2550 ascii_to_text(buf, act);
2552 /* Dump the macro */
2553 auto_dump_printf("A:%s\n", buf);
2554 auto_dump_printf("C:%d:%s\n", mode, key);
2566 * @brief マクロを設定するコマンドのメインルーチン /
2567 * Interact with "macros"
2571 * Note that the macro "action" must be defined before the trigger.
2573 * Could use some helpful instructions on this page.
2576 void do_cmd_macros(void)
2588 if (rogue_like_commands)
2590 mode = KEYMAP_MODE_ROGUE;
2596 mode = KEYMAP_MODE_ORIG;
2599 /* File type is "TEXT" */
2600 FILE_TYPE(FILE_TYPE_TEXT);
2605 /* Process requests until done */
2610 prt(_("[ マクロの設定 ]", "Interact with Macros"), 2, 0);
2612 /* Describe that action */
2613 prt(_("マクロ行動が(もしあれば)下に表示されます:", "Current action (if any) shown below:"), 20, 0);
2615 /* Analyze the current action */
2616 ascii_to_text(buf, macro__buf);
2618 /* Display the current action */
2623 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
2625 prt(_("(2) ファイルにマクロを追加", "(2) Append macros to a file"), 5, 5);
2626 prt(_("(3) マクロの確認", "(3) Query a macro"), 6, 5);
2627 prt(_("(4) マクロの作成", "(4) Create a macro"), 7, 5);
2628 prt(_("(5) マクロの削除", "(5) Remove a macro"), 8, 5);
2629 prt(_("(6) ファイルにキー配置を追加", "(6) Append keymaps to a file"), 9, 5);
2630 prt(_("(7) キー配置の確認", "(7) Query a keymap"), 10, 5);
2631 prt(_("(8) キー配置の作成", "(8) Create a keymap"), 11, 5);
2632 prt(_("(9) キー配置の削除", "(9) Remove a keymap"), 12, 5);
2633 prt(_("(0) マクロ行動の入力", "(0) Enter a new action"), 13, 5);
2634 #endif /* ALLOW_MACROS */
2637 prt(_("コマンド: ", "Command: "), 16, 0);
2643 if (i == ESCAPE) break;
2645 /* Load a 'macro' file */
2651 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 16, 0);
2654 prt(_("ファイル: ", "File: "), 18, 0);
2656 /* Default filename */
2657 sprintf(tmp, "%s.prf", player_base);
2659 /* Ask for a file */
2660 if (!askfor(tmp, 80)) continue;
2662 /* Process the given filename */
2663 err = process_pref_file(tmp);
2666 msg_format(_("標準の設定ファイル'%s'を読み込みました。", "Loaded default '%s'."), tmp);
2671 msg_format(_("'%s'の読み込みに失敗しました!", "Failed to load '%s'!"), tmp);
2675 msg_format(_("'%s'を読み込みました。", "Loaded '%s'."), tmp);
2685 prt(_("コマンド: マクロをファイルに追加する", "Command: Append macros to a file"), 16, 0);
2688 prt(_("ファイル: ", "File: "), 18, 0);
2690 /* Default filename */
2691 sprintf(tmp, "%s.prf", player_base);
2693 /* Ask for a file */
2694 if (!askfor(tmp, 80)) continue;
2696 /* Dump the macros */
2697 (void)macro_dump(tmp);
2700 msg_print(_("マクロを追加しました。", "Appended macros."));
2709 prt(_("コマンド: マクロの確認", "Command: Query a macro"), 16, 0);
2713 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2715 /* Get a macro trigger */
2716 do_cmd_macro_aux(buf);
2718 /* Acquire action */
2719 k = macro_find_exact(buf);
2725 msg_print(_("そのキーにはマクロは定義されていません。", "Found no macro."));
2731 /* Obtain the action */
2732 strcpy(macro__buf, macro__act[k]);
2734 /* Analyze the current action */
2735 ascii_to_text(buf, macro__buf);
2737 /* Display the current action */
2741 msg_print(_("マクロを確認しました。", "Found a macro."));
2745 /* Create a macro */
2749 prt(_("コマンド: マクロの作成", "Command: Create a macro"), 16, 0);
2752 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2754 /* Get a macro trigger */
2755 do_cmd_macro_aux(buf);
2761 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2762 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2765 prt(_("マクロ行動: ", "Action: "), 20, 0);
2767 /* Convert to text */
2768 ascii_to_text(tmp, macro__buf);
2770 /* Get an encoded action */
2771 if (askfor(tmp, 80))
2773 /* Convert to ascii */
2774 text_to_ascii(macro__buf, tmp);
2776 /* Link the macro */
2777 macro_add(buf, macro__buf);
2780 msg_print(_("マクロを追加しました。", "Added a macro."));
2784 /* Remove a macro */
2788 prt(_("コマンド: マクロの削除", "Command: Remove a macro"), 16, 0);
2791 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2793 /* Get a macro trigger */
2794 do_cmd_macro_aux(buf);
2796 /* Link the macro */
2797 macro_add(buf, buf);
2800 msg_print(_("マクロを削除しました。", "Removed a macro."));
2807 prt(_("コマンド: キー配置をファイルに追加する", "Command: Append keymaps to a file"), 16, 0);
2810 prt(_("ファイル: ", "File: "), 18, 0);
2812 /* Default filename */
2813 sprintf(tmp, "%s.prf", player_base);
2815 /* Ask for a file */
2816 if (!askfor(tmp, 80)) continue;
2818 /* Dump the macros */
2819 (void)keymap_dump(tmp);
2822 msg_print(_("キー配置を追加しました。", "Appended keymaps."));
2825 /* Query a keymap */
2831 prt(_("コマンド: キー配置の確認", "Command: Query a keymap"), 16, 0);
2834 prt(_("押すキー: ", "Keypress: "), 18, 0);
2836 /* Get a keymap trigger */
2837 do_cmd_macro_aux_keymap(buf);
2839 /* Look up the keymap */
2840 act = keymap_act[mode][(byte)(buf[0])];
2846 msg_print(_("キー配置は定義されていません。", "Found no keymap."));
2852 /* Obtain the action */
2853 strcpy(macro__buf, act);
2855 /* Analyze the current action */
2856 ascii_to_text(buf, macro__buf);
2858 /* Display the current action */
2862 msg_print(_("キー配置を確認しました。", "Found a keymap."));
2866 /* Create a keymap */
2870 prt(_("コマンド: キー配置の作成", "Command: Create a keymap"), 16, 0);
2873 prt(_("押すキー: ", "Keypress: "), 18, 0);
2875 /* Get a keymap trigger */
2876 do_cmd_macro_aux_keymap(buf);
2882 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2883 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2886 prt(_("行動: ", "Action: "), 20, 0);
2888 /* Convert to text */
2889 ascii_to_text(tmp, macro__buf);
2891 /* Get an encoded action */
2892 if (askfor(tmp, 80))
2894 /* Convert to ascii */
2895 text_to_ascii(macro__buf, tmp);
2897 /* Free old keymap */
2898 string_free(keymap_act[mode][(byte)(buf[0])]);
2900 /* Make new keymap */
2901 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
2904 msg_print(_("キー配置を追加しました。", "Added a keymap."));
2908 /* Remove a keymap */
2912 prt(_("コマンド: キー配置の削除", "Command: Remove a keymap"), 16, 0);
2915 prt(_("押すキー: ", "Keypress: "), 18, 0);
2917 /* Get a keymap trigger */
2918 do_cmd_macro_aux_keymap(buf);
2920 /* Free old keymap */
2921 string_free(keymap_act[mode][(byte)(buf[0])]);
2923 /* Make new keymap */
2924 keymap_act[mode][(byte)(buf[0])] = NULL;
2927 msg_print(_("キー配置を削除しました。", "Removed a keymap."));
2930 /* Enter a new action */
2934 prt(_("コマンド: マクロ行動の入力", "Command: Enter a new action"), 16, 0);
2940 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2941 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2944 prt(_("マクロ行動: ", "Action: "), 20, 0);
2946 /* Hack -- limit the value */
2949 /* Get an encoded action */
2950 if (!askfor(buf, 80)) continue;
2952 /* Extract an action */
2953 text_to_ascii(macro__buf, buf);
2956 #endif /* ALLOW_MACROS */
2963 /* Flush messages */
2970 * @brief キャラクタ色の明暗表現
2972 static cptr lighting_level_str[F_LIT_MAX] =
2987 * @brief キャラクタのビジュアルIDを変更する際の対象指定関数
2988 * @param i 指定対象となるキャラクタコード
2989 * @param num 指定されたビジュアルIDを返す参照ポインタ
2990 * @param max ビジュアルIDの最大数
2991 * @return 指定が実際に行われた場合TRUE、キャンセルされた場合FALSE
2993 static bool cmd_visuals_aux(int i, IDX *num, IDX max)
3000 sprintf(str, "%d", *num);
3002 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3005 tmp = (IDX)strtol(str, NULL, 0);
3006 if (tmp >= 0 && tmp < max)
3009 else if (isupper(i))
3010 *num = (*num + max - 1) % max;
3012 *num = (*num + 1) % max;
3018 * @brief キャラクタの変更メニュー表示
3019 * @param choice_msg 選択メッセージ
3022 static void print_visuals_menu(cptr choice_msg)
3024 prt(_("[ 画面表示の設定 ]", "Interact with Visuals"), 1, 0);
3026 /* Give some choices */
3027 prt(_("(0) ユーザー設定ファイルのロード", "(0) Load a user pref file"), 3, 5);
3029 #ifdef ALLOW_VISUALS
3030 prt(_("(1) モンスターの 色/文字 をファイルに書き出す", "(1) Dump monster attr/chars"), 4, 5);
3031 prt(_("(2) アイテムの 色/文字 をファイルに書き出す", "(2) Dump object attr/chars"), 5, 5);
3032 prt(_("(3) 地形の 色/文字 をファイルに書き出す", "(3) Dump feature attr/chars"), 6, 5);
3033 prt(_("(4) モンスターの 色/文字 を変更する (数値操作)", "(4) Change monster attr/chars (numeric operation)"), 7, 5);
3034 prt(_("(5) アイテムの 色/文字 を変更する (数値操作)", "(5) Change object attr/chars (numeric operation)"), 8, 5);
3035 prt(_("(6) 地形の 色/文字 を変更する (数値操作)", "(6) Change feature attr/chars (numeric operation)"), 9, 5);
3036 prt(_("(7) モンスターの 色/文字 を変更する (シンボルエディタ)", "(7) Change monster attr/chars (visual mode)"), 10, 5);
3037 prt(_("(8) アイテムの 色/文字 を変更する (シンボルエディタ)", "(8) Change object attr/chars (visual mode)"), 11, 5);
3038 prt(_("(9) 地形の 色/文字 を変更する (シンボルエディタ)", "(9) Change feature attr/chars (visual mode)"), 12, 5);
3039 #endif /* ALLOW_VISUALS */
3041 prt(_("(R) 画面表示方法の初期化", "(R) Reset visuals"), 13, 5);
3044 prt(format("コマンド: %s", choice_msg ? choice_msg : _("", "")), 15, 0);
3047 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx);
3048 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx);
3049 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level);
3052 * Interact with "visuals"
3054 void do_cmd_visuals(void)
3059 bool need_redraw = FALSE;
3060 const char *empty_symbol = "<< ? >>";
3062 if (use_bigtile) empty_symbol = "<< ?? >>";
3064 /* File type is "TEXT" */
3065 FILE_TYPE(FILE_TYPE_TEXT);
3067 /* Save the screen */
3070 /* Interact until done */
3076 /* Ask for a choice */
3077 print_visuals_menu(NULL);
3082 if (i == ESCAPE) break;
3086 /* Load a 'pref' file */
3089 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 15, 0);
3092 prt(_("ファイル: ", "File: "), 17, 0);
3094 /* Default filename */
3095 sprintf(tmp, "%s.prf", player_base);
3098 if (!askfor(tmp, 70)) continue;
3100 /* Process the given filename */
3101 (void)process_pref_file(tmp);
3106 #ifdef ALLOW_VISUALS
3108 /* Dump monster attr/chars */
3111 static cptr mark = "Monster attr/chars";
3114 prt(_("コマンド: モンスターの[色/文字]をファイルに書き出します", "Command: Dump monster attr/chars"), 15, 0);
3117 prt(_("ファイル: ", "File: "), 17, 0);
3119 /* Default filename */
3120 sprintf(tmp, "%s.prf", player_base);
3122 /* Get a filename */
3123 if (!askfor(tmp, 70)) continue;
3125 /* Build the filename */
3126 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3128 /* Append to the file */
3129 if (!open_auto_dump(buf, mark)) continue;
3132 auto_dump_printf(_("\n# モンスターの[色/文字]の設定\n\n", "\n# Monster attr/char definitions\n\n"));
3135 for (i = 0; i < max_r_idx; i++)
3137 monster_race *r_ptr = &r_info[i];
3139 /* Skip non-entries */
3140 if (!r_ptr->name) continue;
3142 /* Dump a comment */
3143 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3145 /* Dump the monster attr/char info */
3146 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3147 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3153 msg_print(_("モンスターの[色/文字]をファイルに書き出しました。", "Dumped monster attr/chars."));
3158 /* Dump object attr/chars */
3161 static cptr mark = "Object attr/chars";
3162 KIND_OBJECT_IDX k_idx;
3165 prt(_("コマンド: アイテムの[色/文字]をファイルに書き出します", "Command: Dump object attr/chars"), 15, 0);
3168 prt(_("ファイル: ", "File: "), 17, 0);
3170 /* Default filename */
3171 sprintf(tmp, "%s.prf", player_base);
3173 /* Get a filename */
3174 if (!askfor(tmp, 70)) continue;
3176 /* Build the filename */
3177 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3179 /* Append to the file */
3180 if (!open_auto_dump(buf, mark)) continue;
3183 auto_dump_printf(_("\n# アイテムの[色/文字]の設定\n\n", "\n# Object attr/char definitions\n\n"));
3186 for (k_idx = 0; k_idx < max_k_idx; k_idx++)
3189 object_kind *k_ptr = &k_info[k_idx];
3191 /* Skip non-entries */
3192 if (!k_ptr->name) continue;
3197 strip_name(o_name, k_idx);
3203 /* Prepare dummy object */
3204 object_prep(&forge, k_idx);
3206 /* Get un-shuffled flavor name */
3207 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3210 /* Dump a comment */
3211 auto_dump_printf("# %s\n", o_name);
3213 /* Dump the object attr/char info */
3214 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", (int)k_idx,
3215 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3221 msg_print(_("アイテムの[色/文字]をファイルに書き出しました。", "Dumped object attr/chars."));
3226 /* Dump feature attr/chars */
3229 static cptr mark = "Feature attr/chars";
3232 prt(_("コマンド: 地形の[色/文字]をファイルに書き出します", "Command: Dump feature attr/chars"), 15, 0);
3235 prt(_("ファイル: ", "File: "), 17, 0);
3237 /* Default filename */
3238 sprintf(tmp, "%s.prf", player_base);
3240 /* Get a filename */
3241 if (!askfor(tmp, 70)) continue;
3243 /* Build the filename */
3244 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3246 /* Append to the file */
3247 if (!open_auto_dump(buf, mark)) continue;
3250 auto_dump_printf(_("\n# 地形の[色/文字]の設定\n\n", "\n# Feature attr/char definitions\n\n"));
3253 for (i = 0; i < max_f_idx; i++)
3255 feature_type *f_ptr = &f_info[i];
3257 /* Skip non-entries */
3258 if (!f_ptr->name) continue;
3260 /* Skip mimiccing features */
3261 if (f_ptr->mimic != i) continue;
3263 /* Dump a comment */
3264 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3266 /* Dump the feature attr/char info */
3267 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
3268 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
3269 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
3270 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
3276 msg_print(_("地形の[色/文字]をファイルに書き出しました。", "Dumped feature attr/chars."));
3281 /* Modify monster attr/chars (numeric operation) */
3284 static cptr choice_msg = _("モンスターの[色/文字]を変更します", "Change monster attr/chars");
3287 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3289 /* Hack -- query until done */
3292 monster_race *r_ptr = &r_info[r];
3296 TERM_COLOR da = r_ptr->d_attr;
3297 byte dc = r_ptr->d_char;
3298 TERM_COLOR ca = r_ptr->x_attr;
3299 byte cc = r_ptr->x_char;
3301 /* Label the object */
3302 Term_putstr(5, 17, -1, TERM_WHITE,
3303 format(_("モンスター = %d, 名前 = %-40.40s", "Monster = %d, Name = %-40.40s"), r, (r_name + r_ptr->name)));
3305 /* Label the Default values */
3306 Term_putstr(10, 19, -1, TERM_WHITE,
3307 format(_("初期値 色 / 文字 = %3u / %3u", "Default attr/char = %3u / %3u"), da, dc));
3309 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3310 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3312 /* Label the Current values */
3313 Term_putstr(10, 20, -1, TERM_WHITE,
3314 format(_("現在値 色 / 文字 = %3u / %3u", "Current attr/char = %3u / %3u"), ca, cc));
3316 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3317 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3320 Term_putstr(0, 22, -1, TERM_WHITE,
3321 _("コマンド (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): "));
3327 if (i == ESCAPE) break;
3329 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3330 else if (isupper(i)) c = 'a' + i - 'A';
3340 if (!cmd_visuals_aux(i, &r, max_r_idx))
3346 while (!r_info[r].name);
3350 t = (int)r_ptr->x_attr;
3351 (void)cmd_visuals_aux(i, &t, 256);
3352 r_ptr->x_attr = (byte)t;
3356 t = (int)r_ptr->x_char;
3357 (void)cmd_visuals_aux(i, &t, 256);
3358 r_ptr->x_char = (byte)t;
3362 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
3366 print_visuals_menu(choice_msg);
3374 /* Modify object attr/chars (numeric operation) */
3377 static cptr choice_msg = _("アイテムの[色/文字]を変更します", "Change object attr/chars");
3379 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3381 /* Hack -- query until done */
3384 object_kind *k_ptr = &k_info[k];
3388 TERM_COLOR da = k_ptr->d_attr;
3389 SYMBOL_CODE dc = k_ptr->d_char;
3390 TERM_COLOR ca = k_ptr->x_attr;
3391 SYMBOL_CODE cc = k_ptr->x_char;
3393 /* Label the object */
3394 Term_putstr(5, 17, -1, TERM_WHITE,
3395 format(_("アイテム = %d, 名前 = %-40.40s", "Object = %d, Name = %-40.40s"),
3396 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
3398 /* Label the Default values */
3399 Term_putstr(10, 19, -1, TERM_WHITE,
3400 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3402 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3403 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3405 /* Label the Current values */
3406 Term_putstr(10, 20, -1, TERM_WHITE,
3407 format(_("現在値 色 / 文字 = %3d / %3d", "Current attr/char = %3d / %3d"), ca, cc));
3409 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3410 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3413 Term_putstr(0, 22, -1, TERM_WHITE,
3414 _("コマンド (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): "));
3420 if (i == ESCAPE) break;
3422 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3423 else if (isupper(i)) c = 'a' + i - 'A';
3433 if (!cmd_visuals_aux(i, &k, max_k_idx))
3439 while (!k_info[k].name);
3443 t = (int)k_ptr->x_attr;
3444 (void)cmd_visuals_aux(i, &t, 256);
3445 k_ptr->x_attr = (byte)t;
3449 t = (int)k_ptr->x_char;
3450 (void)cmd_visuals_aux(i, &t, 256);
3451 k_ptr->x_char = (byte)t;
3455 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
3459 print_visuals_menu(choice_msg);
3467 /* Modify feature attr/chars (numeric operation) */
3470 static cptr choice_msg = _("地形の[色/文字]を変更します", "Change feature attr/chars");
3472 static IDX lighting_level = F_LIT_STANDARD;
3473 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3475 /* Hack -- query until done */
3478 feature_type *f_ptr = &f_info[f];
3482 TERM_COLOR da = f_ptr->d_attr[lighting_level];
3483 byte dc = f_ptr->d_char[lighting_level];
3484 TERM_COLOR ca = f_ptr->x_attr[lighting_level];
3485 byte cc = f_ptr->x_char[lighting_level];
3487 /* Label the object */
3489 Term_putstr(5, 17, -1, TERM_WHITE,
3490 format(_("地形 = %d, 名前 = %s, 明度 = %s", "Terrain = %d, Name = %s, Lighting = %s"),
3491 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
3493 /* Label the Default values */
3494 Term_putstr(10, 19, -1, TERM_WHITE,
3495 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3497 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3498 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3500 /* Label the Current values */
3502 Term_putstr(10, 20, -1, TERM_WHITE,
3503 format("現在値 色 / 文字 = %3d / %3d", ca, cc));
3505 Term_putstr(10, 20, -1, TERM_WHITE,
3506 format("Current attr/char = %3d / %3d", ca, cc));
3509 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3510 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3514 Term_putstr(0, 22, -1, TERM_WHITE,
3515 "コマンド (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3517 Term_putstr(0, 22, -1, TERM_WHITE,
3518 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3525 if (i == ESCAPE) break;
3527 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3528 else if (isupper(i)) c = 'a' + i - 'A';
3538 if (!cmd_visuals_aux(i, &f, max_f_idx))
3544 while (!f_info[f].name || (f_info[f].mimic != f));
3548 t = (int)f_ptr->x_attr[lighting_level];
3549 (void)cmd_visuals_aux(i, &t, 256);
3550 f_ptr->x_attr[lighting_level] = (byte)t;
3554 t = (int)f_ptr->x_char[lighting_level];
3555 (void)cmd_visuals_aux(i, &t, 256);
3556 f_ptr->x_char[lighting_level] = (byte)t;
3560 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
3563 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
3567 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
3571 print_visuals_menu(choice_msg);
3579 /* Modify monster attr/chars (visual mode) */
3581 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
3584 /* Modify object attr/chars (visual mode) */
3586 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
3589 /* Modify feature attr/chars (visual mode) */
3592 IDX lighting_level = F_LIT_STANDARD;
3593 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
3597 #endif /* ALLOW_VISUALS */
3605 msg_print(_("画面上の[色/文字]を初期値にリセットしました。", "Visual attr/char tables reset."));
3609 /* Unknown option */
3615 /* Flush messages */
3619 /* Restore the screen */
3622 if (need_redraw) do_cmd_redraw();
3627 * Interact with "colors"
3629 void do_cmd_colors(void)
3638 /* File type is "TEXT" */
3639 FILE_TYPE(FILE_TYPE_TEXT);
3642 /* Save the screen */
3646 /* Interact until done */
3652 /* Ask for a choice */
3653 prt(_("[ カラーの設定 ]", "Interact with Colors"), 2, 0);
3655 /* Give some choices */
3656 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
3659 prt(_("(2) カラーの設定をファイルに書き出す", "(2) Dump colors"), 5, 5);
3660 prt(_("(3) カラーの設定を変更する", "(3) Modify colors"), 6, 5);
3664 prt(_("コマンド: ", "Command: "), 8, 0);
3668 if (i == ESCAPE) break;
3670 /* Load a 'pref' file */
3674 prt(_("コマンド: ユーザー設定ファイルをロードします", "Command: Load a user pref file"), 8, 0);
3677 prt(_("ファイル: ", "File: "), 10, 0);
3680 sprintf(tmp, "%s.prf", player_base);
3683 if (!askfor(tmp, 70)) continue;
3685 /* Process the given filename */
3686 (void)process_pref_file(tmp);
3688 /* Mega-Hack -- react to changes */
3689 Term_xtra(TERM_XTRA_REACT, 0);
3691 /* Mega-Hack -- redraw */
3700 static cptr mark = "Colors";
3703 prt(_("コマンド: カラーの設定をファイルに書き出します", "Command: Dump colors"), 8, 0);
3706 prt(_("ファイル: ", "File: "), 10, 0);
3708 /* Default filename */
3709 sprintf(tmp, "%s.prf", player_base);
3711 /* Get a filename */
3712 if (!askfor(tmp, 70)) continue;
3714 /* Build the filename */
3715 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3717 /* Append to the file */
3718 if (!open_auto_dump(buf, mark)) continue;
3721 auto_dump_printf(_("\n# カラーの設定\n\n", "\n# Color redefinitions\n\n"));
3724 for (i = 0; i < 256; i++)
3726 int kv = angband_color_table[i][0];
3727 int rv = angband_color_table[i][1];
3728 int gv = angband_color_table[i][2];
3729 int bv = angband_color_table[i][3];
3731 cptr name = _("未知", "unknown");
3733 /* Skip non-entries */
3734 if (!kv && !rv && !gv && !bv) continue;
3736 /* Extract the color name */
3737 if (i < 16) name = color_names[i];
3739 /* Dump a comment */
3740 auto_dump_printf(_("# カラー '%s'\n", "# Color '%s'\n"), name);
3742 /* Dump the monster attr/char info */
3743 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
3750 msg_print(_("カラーの設定をファイルに書き出しました。", "Dumped color redefinitions."));
3759 prt(_("コマンド: カラーの設定を変更します", "Command: Modify colors"), 8, 0);
3761 /* Hack -- query until done */
3770 /* Exhibit the normal colors */
3771 for (j = 0; j < 16; j++)
3773 /* Exhibit this color */
3774 Term_putstr(j*4, 20, -1, a, "###");
3776 /* Exhibit all colors */
3777 Term_putstr(j*4, 22, -1, j, format("%3d", j));
3780 /* Describe the color */
3781 name = ((a < 16) ? color_names[a] : _("未定義", "undefined"));
3783 /* Describe the color */
3784 Term_putstr(5, 10, -1, TERM_WHITE,
3785 format(_("カラー = %d, 名前 = %s", "Color = %d, Name = %s"), a, name));
3787 /* Label the Current values */
3788 Term_putstr(5, 12, -1, TERM_WHITE,
3789 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
3790 angband_color_table[a][0],
3791 angband_color_table[a][1],
3792 angband_color_table[a][2],
3793 angband_color_table[a][3]));
3796 Term_putstr(0, 14, -1, TERM_WHITE,
3797 _("コマンド (n/N/k/K/r/R/g/G/b/B): ", "Command (n/N/k/K/r/R/g/G/b/B): "));
3804 if (i == ESCAPE) break;
3807 if (i == 'n') a = (byte)(a + 1);
3808 if (i == 'N') a = (byte)(a - 1);
3809 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
3810 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
3811 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
3812 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
3813 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
3814 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
3815 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
3816 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
3818 /* Hack -- react to changes */
3819 Term_xtra(TERM_XTRA_REACT, 0);
3821 /* Hack -- redraw */
3828 /* Unknown option */
3834 /* Flush messages */
3839 /* Restore the screen */
3845 * Note something in the message recall
3847 void do_cmd_note(void)
3855 if (!get_string(_("メモ: ", "Note: "), buf, 60)) return;
3857 /* Ignore empty notes */
3858 if (!buf[0] || (buf[0] == ' ')) return;
3860 /* Add the note to the message recall */
3861 msg_format(_("メモ: %s", "Note: %s"), buf);
3866 * Mention the current version
3868 void do_cmd_version(void)
3872 #if FAKE_VER_EXTRA > 0
3873 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d.%d", "You are playing Hengband %d.%d.%d.%d."),
3874 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
3876 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d", "You are playing Hengband %d.%d.%d."),
3877 FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
3884 * Array of feeling strings
3886 static cptr do_cmd_feeling_text[11] =
3888 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3889 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3890 _("恐ろしい死の幻が目に浮かび、気絶しそうになった!", "You nearly faint as horrible visions of death fill your mind!"),
3891 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3892 _("とても悪い予感がする...", "You have a very bad feeling..."),
3893 _("悪い予感がする...", "You have a bad feeling..."),
3894 _("何か緊張する。", "You feel nervous."),
3895 _("少し不運な気がする...", "You feel your luck is turning..."),
3896 _("この場所は好きになれない。", "You don't like the look of this place."),
3897 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3898 _("なんて退屈なところだ...", "What a boring place...")
3901 static cptr do_cmd_feeling_text_combat[11] =
3903 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3904 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3905 _("今夜もまた、誰かが命を落とす...", "You nearly faint as horrible visions of death fill your mind!"),
3906 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3907 _("とても悪い予感がする...", "You have a very bad feeling..."),
3908 _("悪い予感がする...", "You have a bad feeling..."),
3909 _("何か緊張する。", "You feel nervous."),
3910 _("少し不運な気がする...", "You feel your luck is turning..."),
3911 _("この場所は好きになれない。", "You don't like the look of this place."),
3912 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3913 _("なんて退屈なところだ...", "What a boring place...")
3916 static cptr do_cmd_feeling_text_lucky[11] =
3918 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3919 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3920 _("この階はこの上なく素晴らしい感じがする。", "You have a superb feeling about this level."),
3921 _("素晴らしい感じがする...", "You have an excellent feeling..."),
3922 _("とても良い感じがする...", "You have a very good feeling..."),
3923 _("良い感じがする...", "You have a good feeling..."),
3924 _("ちょっと幸運な感じがする...", "You feel strangely lucky..."),
3925 _("多少は運が向いてきたか...", "You feel your luck is turning..."),
3926 _("見た感じ悪くはない...", "You like the look of this place..."),
3927 _("全然駄目ということはないが...", "This level can't be all bad..."),
3928 _("なんて退屈なところだ...", "What a boring place...")
3933 * Note that "feeling" is set to zero unless some time has passed.
3934 * Note that this is done when the level is GENERATED, not entered.
3936 void do_cmd_feeling(void)
3938 /* No useful feeling in quests */
3939 if (p_ptr->inside_quest && !random_quest_number(dun_level))
3941 msg_print(_("典型的なクエストのダンジョンのようだ。", "Looks like a typical quest level."));
3945 /* No useful feeling in town */
3946 else if (p_ptr->town_num && !dun_level)
3948 if (!strcmp(town[p_ptr->town_num].name, _("荒野", "wilderness")))
3950 msg_print(_("何かありそうな荒野のようだ。", "Looks like a strange wilderness."));
3955 msg_print(_("典型的な町のようだ。", "Looks like a typical town."));
3960 /* No useful feeling in the wilderness */
3961 else if (!dun_level)
3963 msg_print(_("典型的な荒野のようだ。", "Looks like a typical wilderness."));
3967 /* Display the feeling */
3968 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
3969 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
3970 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
3971 inventory[INVEN_BOW].name1 == ART_CRIMSON)
3972 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
3974 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
3980 * Description of each monster group.
3982 static cptr monster_group_text[] =
3985 "ユニーク", /* "Uniques" */
3986 "乗馬可能なモンスター", /* "Riding" */
3987 "賞金首", /* "Wanted */
3988 "アンバーの王族", /* "Ambertite" */
4017 /* "古代ドラゴン/ワイアーム", */
4078 /* "Ancient Dragon/Wyrm", */
4087 "Multi-Headed Reptile",
4092 "Reptile/Amphibian",
4093 "Spider/Scorpion/Tick",
4095 /* "Major Demon", */
4112 * Symbols of monsters in each group. Note the "Uniques" group
4113 * is handled differently.
4115 static cptr monster_group_char[] =
4172 "!$&()+./=>?[\\]`{|~",
4182 * hook function to sort monsters by level
4184 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
4186 u16b *who = (u16b*)(u);
4191 monster_race *r_ptr1 = &r_info[w1];
4192 monster_race *r_ptr2 = &r_info[w2];
4197 if (r_ptr2->level > r_ptr1->level) return TRUE;
4198 if (r_ptr1->level > r_ptr2->level) return FALSE;
4200 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
4201 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
4206 * Build a list of monster indexes in the given group. Return the number
4207 * of monsters in the group.
4209 * mode & 0x01 : check for non-empty group
4210 * mode & 0x02 : visual operation only
4212 static IDX collect_monsters(IDX grp_cur, IDX mon_idx[], BIT_FLAGS8 mode)
4218 /* Get a list of x_char in this group */
4219 cptr group_char = monster_group_char[grp_cur];
4221 /* XXX Hack -- Check if this is the "Uniques" group */
4222 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
4224 /* XXX Hack -- Check if this is the "Riding" group */
4225 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
4227 /* XXX Hack -- Check if this is the "Wanted" group */
4228 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
4230 /* XXX Hack -- Check if this is the "Amberite" group */
4231 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
4234 /* Check every race */
4235 for (i = 0; i < max_r_idx; i++)
4237 /* Access the race */
4238 monster_race *r_ptr = &r_info[i];
4240 /* Skip empty race */
4241 if (!r_ptr->name) continue ;
4243 /* Require known monsters */
4244 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
4248 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
4251 else if (grp_riding)
4253 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
4256 else if (grp_wanted)
4258 bool wanted = FALSE;
4260 for (j = 0; j < MAX_KUBI; j++)
4262 if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
4263 (p_ptr->today_mon && p_ptr->today_mon == i))
4269 if (!wanted) continue;
4272 else if (grp_amberite)
4274 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
4279 /* Check for race in the group */
4280 if (!my_strchr(group_char, r_ptr->d_char)) continue;
4284 mon_idx[mon_cnt++] = i;
4286 /* XXX Hack -- Just checking for non-empty group */
4287 if (mode & 0x01) break;
4290 /* Terminate the list */
4291 mon_idx[mon_cnt] = -1;
4293 /* Select the sort method */
4294 ang_sort_comp = ang_sort_comp_monster_level;
4295 ang_sort_swap = ang_sort_swap_hook;
4297 /* Sort by monster level */
4298 ang_sort(mon_idx, &dummy_why, mon_cnt);
4300 /* Return the number of races */
4306 * Description of each monster group.
4308 static cptr object_group_text[] =
4311 "キノコ", /* "Mushrooms" */
4312 "薬", /* "Potions" */
4313 "油つぼ", /* "Flasks" */
4314 "巻物", /* "Scrolls" */
4316 "アミュレット", /* "Amulets" */
4317 "笛", /* "Whistle" */
4318 "光源", /* "Lanterns" */
4319 "魔法棒", /* "Wands" */
4322 "カード", /* "Cards" */
4333 "刀剣類", /* "Swords" */
4334 "鈍器", /* "Blunt Weapons" */
4335 "長柄武器", /* "Polearms" */
4336 "採掘道具", /* "Diggers" */
4337 "飛び道具", /* "Bows" */
4341 "軽装鎧", /* "Soft Armor" */
4342 "重装鎧", /* "Hard Armor" */
4343 "ドラゴン鎧", /* "Dragon Armor" */
4344 "盾", /* "Shields" */
4345 "クローク", /* "Cloaks" */
4346 "籠手", /* "Gloves" */
4347 "ヘルメット", /* "Helms" */
4349 "ブーツ", /* "Boots" */
4402 * TVALs of items in each group
4404 static byte object_group_tval[] =
4445 TV_LIFE_BOOK, /* Hack -- all spellbooks */
4453 * Build a list of object indexes in the given group. Return the number
4454 * of objects in the group.
4456 * mode & 0x01 : check for non-empty group
4457 * mode & 0x02 : visual operation only
4459 static int collect_objects(int grp_cur, IDX object_idx[], BIT_FLAGS8 mode)
4462 int j, k, object_cnt = 0;
4464 /* Get a list of x_char in this group */
4465 byte group_tval = object_group_tval[grp_cur];
4467 /* Check every object */
4468 for (i = 0; i < max_k_idx; i++)
4470 /* Access the object */
4471 object_kind *k_ptr = &k_info[i];
4473 /* Skip empty objects */
4474 if (!k_ptr->name) continue;
4478 /* Any objects will be displayed */
4484 /* Skip non-flavoured objects */
4485 if (!k_ptr->flavor) continue;
4487 /* Require objects ever seen */
4488 if (!k_ptr->aware) continue;
4491 /* Skip items with no distribution (special artifacts) */
4492 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
4496 /* Check for objects in the group */
4497 if (TV_LIFE_BOOK == group_tval)
4499 /* Hack -- All spell books */
4500 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HEX_BOOK)
4502 /* Add the object */
4503 object_idx[object_cnt++] = i;
4507 else if (k_ptr->tval == group_tval)
4509 /* Add the object */
4510 object_idx[object_cnt++] = i;
4514 /* XXX Hack -- Just checking for non-empty group */
4515 if (mode & 0x01) break;
4518 /* Terminate the list */
4519 object_idx[object_cnt] = -1;
4521 /* Return the number of objects */
4527 * Description of each feature group.
4529 static cptr feature_group_text[] =
4537 * Build a list of feature indexes in the given group. Return the number
4538 * of features in the group.
4540 * mode & 0x01 : check for non-empty group
4542 static int collect_features(int grp_cur, IDX *feat_idx, BIT_FLAGS8 mode)
4547 /* Unused; There is a single group. */
4550 /* Check every feature */
4551 for (i = 0; i < max_f_idx; i++)
4553 /* Access the index */
4554 feature_type *f_ptr = &f_info[i];
4556 /* Skip empty index */
4557 if (!f_ptr->name) continue;
4559 /* Skip mimiccing features */
4560 if (f_ptr->mimic != i) continue;
4563 feat_idx[feat_cnt++] = i;
4565 /* XXX Hack -- Just checking for non-empty group */
4566 if (mode & 0x01) break;
4569 /* Terminate the list */
4570 feat_idx[feat_cnt] = -1;
4572 /* Return the number of races */
4579 * Build a list of monster indexes in the given group. Return the number
4580 * of monsters in the group.
4582 static int collect_artifacts(int grp_cur, int object_idx[])
4584 int i, object_cnt = 0;
4586 /* Get a list of x_char in this group */
4587 byte group_tval = object_group_tval[grp_cur];
4589 /* Check every object */
4590 for (i = 0; i < max_a_idx; i++)
4592 /* Access the artifact */
4593 artifact_type *a_ptr = &a_info[i];
4595 /* Skip empty artifacts */
4596 if (!a_ptr->name) continue;
4598 /* Skip "uncreated" artifacts */
4599 if (!a_ptr->cur_num) continue;
4601 /* Check for race in the group */
4602 if (a_ptr->tval == group_tval)
4605 object_idx[object_cnt++] = i;
4609 /* Terminate the list */
4610 object_idx[object_cnt] = 0;
4612 /* Return the number of races */
4619 * Encode the screen colors
4621 static char hack[17] = "dwsorgbuDWvyRGBU";
4625 * Hack -- load a screen dump from a file
4627 void do_cmd_load_screen(void)
4642 Term_get_size(&wid, &hgt);
4644 /* Build the filename */
4645 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
4647 /* Append to the file */
4648 fff = my_fopen(buf, "r");
4651 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
4657 /* Save the screen */
4660 /* Clear the screen */
4664 /* Load the screen */
4665 for (y = 0; okay; y++)
4667 /* Get a line of data including control code */
4668 if (!fgets(buf, 1024, fff)) okay = FALSE;
4670 /* Get the blank line */
4671 if (buf[0] == '\n' || buf[0] == '\0') break;
4673 /* Ignore too large screen image */
4674 if (y >= hgt) continue;
4677 for (x = 0; x < wid - 1; x++)
4680 if (buf[x] == '\n' || buf[x] == '\0') break;
4682 /* Put the attr/char */
4683 Term_draw(x, y, TERM_WHITE, buf[x]);
4687 /* Dump the screen */
4688 for (y = 0; okay; y++)
4690 /* Get a line of data including control code */
4691 if (!fgets(buf, 1024, fff)) okay = FALSE;
4693 /* Get the blank line */
4694 if (buf[0] == '\n' || buf[0] == '\0') break;
4696 /* Ignore too large screen image */
4697 if (y >= hgt) continue;
4700 for (x = 0; x < wid - 1; x++)
4703 if (buf[x] == '\n' || buf[x] == '\0') break;
4705 /* Get the attr/char */
4706 (void)(Term_what(x, y, &a, &c));
4708 /* Look up the attr */
4709 for (i = 0; i < 16; i++)
4711 /* Use attr matches */
4712 if (hack[i] == buf[x]) a = (byte_hack)i;
4715 /* Put the attr/char */
4716 Term_draw(x, y, a, c);
4725 prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
4731 /* Restore the screen */
4738 cptr inven_res_label = _(" 酸電火冷毒光闇破轟獄因沌劣 盲怖乱痺透命感消復浮",
4739 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv");
4742 #define IM_FLAG_STR _("*", "* ")
4743 #define HAS_FLAG_STR _("+", "+ ")
4744 #define NO_FLAG_STR _("・", ". ")
4746 #define print_im_or_res_flag(IM, RES) \
4748 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
4749 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
4752 #define print_flag(TR) \
4754 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
4758 /* XTRA HACK RESLIST */
4759 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, OBJECT_TYPE_VALUE tval, char *where)
4761 char o_name[MAX_NLEN];
4762 BIT_FLAGS flgs[TR_FLAG_SIZE];
4764 if (!o_ptr->k_idx) return;
4765 if (o_ptr->tval != tval) return;
4767 /* Identified items only */
4768 if (!object_is_known(o_ptr)) return;
4771 * HACK:Ring of Lordly protection and Dragon equipment
4772 * have random resistances.
4774 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
4775 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
4776 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
4777 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
4778 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
4779 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
4780 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
4781 || object_is_artifact(o_ptr))
4784 object_desc(o_name, o_ptr, OD_NAME_ONLY);
4786 while (o_name[i] && (i < 26))
4789 if (iskanji(o_name[i])) i++;
4798 o_name[i] = ' '; i++;
4803 fprintf(fff, "%s %s", where, o_name);
4805 if (!(o_ptr->ident & (IDENT_MENTAL)))
4807 fputs(_("-------不明--------------- -------不明---------\n",
4808 "-------unknown------------ -------unknown------\n"), fff);
4812 object_flags_known(o_ptr, flgs);
4814 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
4815 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
4816 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
4817 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
4818 print_flag(TR_RES_POIS);
4819 print_flag(TR_RES_LITE);
4820 print_flag(TR_RES_DARK);
4821 print_flag(TR_RES_SHARDS);
4822 print_flag(TR_RES_SOUND);
4823 print_flag(TR_RES_NETHER);
4824 print_flag(TR_RES_NEXUS);
4825 print_flag(TR_RES_CHAOS);
4826 print_flag(TR_RES_DISEN);
4830 print_flag(TR_RES_BLIND);
4831 print_flag(TR_RES_FEAR);
4832 print_flag(TR_RES_CONF);
4833 print_flag(TR_FREE_ACT);
4834 print_flag(TR_SEE_INVIS);
4835 print_flag(TR_HOLD_EXP);
4836 print_flag(TR_TELEPATHY);
4837 print_flag(TR_SLOW_DIGEST);
4838 print_flag(TR_REGEN);
4839 print_flag(TR_LEVITATION);
4847 fprintf(fff, "%s\n", inven_res_label);
4853 * Display *ID* ed weapons/armors's resistances
4855 static void do_cmd_knowledge_inven(void)
4859 char file_name[1024];
4863 OBJECT_TYPE_VALUE tval;
4869 /* Open a new file */
4870 fff = my_fopen_temp(file_name, 1024);
4873 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4877 fprintf(fff, "%s\n", inven_res_label);
4879 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
4883 for (; j < 9; j++) fputc('\n', fff);
4885 fprintf(fff, "%s\n", inven_res_label);
4887 strcpy(where, _("装", "E "));
4888 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4890 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4892 strcpy(where, _("持", "I "));
4893 for (i = 0; i < INVEN_PACK; i++)
4895 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4898 st_ptr = &town[1].store[STORE_HOME];
4899 strcpy(where, _("家", "H "));
4900 for (i = 0; i < st_ptr->stock_num; i++)
4902 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
4906 /* Close the file */
4909 /* Display the file contents */
4910 show_file(TRUE, file_name, _("*鑑定*済み武器/防具の耐性リスト", "Resistances of *identified* equipment"), 0, 0);
4912 /* Remove the file */
4917 void do_cmd_save_screen_html_aux(char *filename, int message)
4921 TERM_COLOR a = 0, old_a = 0;
4935 cptr html_head[] = {
4936 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
4940 cptr html_foot[] = {
4942 "</body>\n</html>\n",
4948 Term_get_size(&wid, &hgt);
4950 /* File type is "TEXT" */
4951 FILE_TYPE(FILE_TYPE_TEXT);
4953 /* Append to the file */
4954 fff = my_fopen(filename, "w");
4958 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename);
4965 /* Save the screen */
4969 /* Build the filename */
4970 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
4971 tmpfff = my_fopen(buf, "r");
4973 for (i = 0; html_head[i]; i++)
4974 fputs(html_head[i], fff);
4978 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
4980 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
4984 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
4986 fprintf(fff, "%s\n", buf);
4991 /* Dump the screen */
4992 for (y = 0; y < hgt; y++)
4999 for (x = 0; x < wid - 1; x++)
5003 /* Get the attr/char */
5004 (void)(Term_what(x, y, &a, &c));
5008 case '&': cc = "&"; break;
5009 case '<': cc = "<"; break;
5010 case '>': cc = ">"; break;
5012 case 0x1f: c = '.'; break;
5013 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5018 if ((y == 0 && x == 0) || a != old_a) {
5019 rv = angband_color_table[a][1];
5020 gv = angband_color_table[a][2];
5021 bv = angband_color_table[a][3];
5022 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5023 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
5027 fprintf(fff, "%s", cc);
5029 fprintf(fff, "%c", c);
5032 fprintf(fff, "</font>");
5035 for (i = 0; html_foot[i]; i++)
5036 fputs(html_foot[i], fff);
5041 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5043 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
5047 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
5049 fprintf(fff, "%s\n", buf);
5062 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5066 /* Restore the screen */
5072 * Hack -- save a screen dump to a file
5074 static void do_cmd_save_screen_html(void)
5076 char buf[1024], tmp[256] = "screen.html";
5078 if (!get_string(_("ファイル名: ", "File name: "), tmp, 80))
5081 /* Build the filename */
5082 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
5086 do_cmd_save_screen_html_aux(buf, 1);
5091 * Redefinable "save_screen" action
5093 void (*screendump_aux)(void) = NULL;
5097 * Hack -- save a screen dump to a file
5099 void do_cmd_save_screen(void)
5101 bool old_use_graphics = use_graphics;
5102 bool html_dump = FALSE;
5106 prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
5110 if (c == 'Y' || c == 'y')
5112 else if (c == 'H' || c == 'h')
5124 Term_get_size(&wid, &hgt);
5126 if (old_use_graphics)
5128 use_graphics = FALSE;
5131 /* Redraw everything */
5132 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5134 /* Hack -- update */
5140 do_cmd_save_screen_html();
5144 /* Do we use a special screendump function ? */
5145 else if (screendump_aux)
5147 /* Dump the screen to a graphics file */
5148 (*screendump_aux)();
5150 else /* Dump the screen as text */
5161 /* Build the filename */
5162 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5164 /* File type is "TEXT" */
5165 FILE_TYPE(FILE_TYPE_TEXT);
5167 /* Append to the file */
5168 fff = my_fopen(buf, "w");
5172 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
5178 /* Save the screen */
5182 /* Dump the screen */
5183 for (y = 0; y < hgt; y++)
5186 for (x = 0; x < wid - 1; x++)
5188 /* Get the attr/char */
5189 (void)(Term_what(x, y, &a, &c));
5199 fprintf(fff, "%s\n", buf);
5206 /* Dump the screen */
5207 for (y = 0; y < hgt; y++)
5210 for (x = 0; x < wid - 1; x++)
5212 /* Get the attr/char */
5213 (void)(Term_what(x, y, &a, &c));
5216 buf[x] = hack[a&0x0F];
5223 fprintf(fff, "%s\n", buf);
5233 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5236 /* Restore the screen */
5240 if (old_use_graphics)
5242 use_graphics = TRUE;
5245 /* Redraw everything */
5246 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5248 /* Hack -- update */
5255 * Sorting hook -- Comp function -- see below
5257 * We use "u" to point to array of monster indexes,
5258 * and "v" to select the type of sorting to perform on "u".
5260 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
5262 u16b *who = (u16b*)(u);
5264 u16b *why = (u16b*)(v);
5271 /* Sort by total kills */
5274 /* Extract total kills */
5275 z1 = a_info[w1].tval;
5276 z2 = a_info[w2].tval;
5278 /* Compare total kills */
5279 if (z1 < z2) return (TRUE);
5280 if (z1 > z2) return (FALSE);
5284 /* Sort by monster level */
5287 /* Extract levels */
5288 z1 = a_info[w1].sval;
5289 z2 = a_info[w2].sval;
5291 /* Compare levels */
5292 if (z1 < z2) return (TRUE);
5293 if (z1 > z2) return (FALSE);
5297 /* Sort by monster experience */
5300 /* Extract experience */
5301 z1 = a_info[w1].level;
5302 z2 = a_info[w2].level;
5304 /* Compare experience */
5305 if (z1 < z2) return (TRUE);
5306 if (z1 > z2) return (FALSE);
5310 /* Compare indexes */
5316 * Sorting hook -- Swap function -- see below
5318 * We use "u" to point to array of monster indexes,
5319 * and "v" to select the type of sorting to perform.
5321 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
5323 u16b *who = (u16b*)(u);
5338 * Check the status of "artifacts"
5340 static void do_cmd_knowledge_artifacts(void)
5352 char file_name[1024];
5354 char base_name[MAX_NLEN];
5358 /* Open a new file */
5359 fff = my_fopen_temp(file_name, 1024);
5362 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5367 /* Allocate the "who" array */
5368 C_MAKE(who, max_a_idx, s16b);
5370 /* Allocate the "okay" array */
5371 C_MAKE(okay, max_a_idx, bool);
5373 /* Scan the artifacts */
5374 for (k = 0; k < max_a_idx; k++)
5376 artifact_type *a_ptr = &a_info[k];
5381 /* Skip "empty" artifacts */
5382 if (!a_ptr->name) continue;
5384 /* Skip "uncreated" artifacts */
5385 if (!a_ptr->cur_num) continue;
5391 /* Check the dungeon */
5392 for (y = 0; y < cur_hgt; y++)
5394 for (x = 0; x < cur_wid; x++)
5396 cave_type *c_ptr = &cave[y][x];
5398 OBJECT_IDX this_o_idx, next_o_idx = 0;
5400 /* Scan all objects in the grid */
5401 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
5404 o_ptr = &o_list[this_o_idx];
5406 /* Acquire next object */
5407 next_o_idx = o_ptr->next_o_idx;
5409 /* Ignore non-artifacts */
5410 if (!object_is_fixed_artifact(o_ptr)) continue;
5412 /* Ignore known items */
5413 if (object_is_known(o_ptr)) continue;
5415 /* Note the artifact */
5416 okay[o_ptr->name1] = FALSE;
5421 /* Check the inventory and equipment */
5422 for (i = 0; i < INVEN_TOTAL; i++)
5424 object_type *o_ptr = &inventory[i];
5426 /* Ignore non-objects */
5427 if (!o_ptr->k_idx) continue;
5429 /* Ignore non-artifacts */
5430 if (!object_is_fixed_artifact(o_ptr)) continue;
5432 /* Ignore known items */
5433 if (object_is_known(o_ptr)) continue;
5435 /* Note the artifact */
5436 okay[o_ptr->name1] = FALSE;
5439 for (k = 0; k < max_a_idx; k++)
5441 if (okay[k]) who[n++] = k;
5444 /* Select the sort method */
5445 ang_sort_comp = ang_sort_art_comp;
5446 ang_sort_swap = ang_sort_art_swap;
5448 /* Sort the array by dungeon depth of monsters */
5449 ang_sort(who, &why, n);
5451 /* Scan the artifacts */
5452 for (k = 0; k < n; k++)
5454 artifact_type *a_ptr = &a_info[who[k]];
5457 strcpy(base_name, _("未知の伝説のアイテム", "Unknown Artifact"));
5459 /* Obtain the base object type */
5460 z = lookup_kind(a_ptr->tval, a_ptr->sval);
5469 /* Create fake object */
5470 object_prep(q_ptr, z);
5472 /* Make it an artifact */
5473 q_ptr->name1 = (byte)who[k];
5475 /* Display as if known */
5476 q_ptr->ident |= IDENT_STORE;
5478 /* Describe the artifact */
5479 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5482 /* Hack -- Build the artifact name */
5483 fprintf(fff, _(" %s\n", " The %s\n"), base_name);
5486 /* Free the "who" array */
5487 C_KILL(who, max_a_idx, s16b);
5489 /* Free the "okay" array */
5490 C_KILL(okay, max_a_idx, bool);
5492 /* Close the file */
5495 /* Display the file contents */
5496 show_file(TRUE, file_name, _("既知の伝説のアイテム", "Artifacts Seen"), 0, 0);
5498 /* Remove the file */
5504 * Display known uniques
5505 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
5507 static void do_cmd_knowledge_uniques(void)
5516 char file_name[1024];
5519 int n_alive_surface = 0;
5520 int n_alive_over100 = 0;
5521 int n_alive_total = 0;
5524 for (i = 0; i < 10; i++) n_alive[i] = 0;
5526 /* Open a new file */
5527 fff = my_fopen_temp(file_name, 1024);
5531 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5536 /* Allocate the "who" array */
5537 C_MAKE(who, max_r_idx, s16b);
5539 /* Scan the monsters */
5540 for (i = 1; i < max_r_idx; i++)
5542 monster_race *r_ptr = &r_info[i];
5545 if (!r_ptr->name) continue;
5547 /* Require unique monsters */
5548 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5550 /* Only display "known" uniques */
5551 if (!cheat_know && !r_ptr->r_sights) continue;
5553 /* Only print rarity <= 100 uniques */
5554 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
5556 /* Only "alive" uniques */
5557 if (r_ptr->max_num == 0) continue;
5561 lev = (r_ptr->level - 1) / 10;
5565 if (max_lev < lev) max_lev = lev;
5567 else n_alive_over100++;
5569 else n_alive_surface++;
5571 /* Collect "appropriate" monsters */
5575 /* Select the sort method */
5576 ang_sort_comp = ang_sort_comp_hook;
5577 ang_sort_swap = ang_sort_swap_hook;
5579 /* Sort the array by dungeon depth of monsters */
5580 ang_sort(who, &why, n);
5582 if (n_alive_surface)
5584 fprintf(fff, _(" 地上 生存: %3d体\n", " Surface alive: %3d\n"), n_alive_surface);
5585 n_alive_total += n_alive_surface;
5587 for (i = 0; i <= max_lev; i++)
5589 fprintf(fff, _("%3d-%3d階 生存: %3d体\n", "Level %3d-%3d alive: %3d\n"), 1 + i * 10, 10 + i * 10, n_alive[i]);
5590 n_alive_total += n_alive[i];
5592 if (n_alive_over100)
5594 fprintf(fff, _("101- 階 生存: %3d体\n", "Level 101- alive: %3d\n"), n_alive_over100);
5595 n_alive_total += n_alive_over100;
5600 fputs(_("--------- -----------\n", "------------- ----------\n"), fff);
5601 fprintf(fff, _(" 合計 生存: %3d体\n\n", " Total alive: %3d\n\n"), n_alive_total);
5605 fputs(_("現在は既知の生存ユニークはいません。\n", "No known uniques alive.\n"), fff);
5608 /* Scan the monster races */
5609 for (k = 0; k < n; k++)
5611 monster_race *r_ptr = &r_info[who[k]];
5613 fprintf(fff, _(" %s (レベル%d)\n", " %s (level %d)\n"), r_name + r_ptr->name, (int)r_ptr->level);
5616 /* Free the "who" array */
5617 C_KILL(who, max_r_idx, s16b);
5619 /* Close the file */
5622 /* Display the file contents */
5623 show_file(TRUE, file_name, _("まだ生きているユニーク・モンスター", "Alive Uniques"), 0, 0);
5625 /* Remove the file */
5631 * Display weapon-exp
5633 static void do_cmd_knowledge_weapon_exp(void)
5635 int i, num, weapon_exp;
5640 char file_name[1024];
5643 /* Open a new file */
5644 fff = my_fopen_temp(file_name, 1024);
5646 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5651 for (i = 0; i < 5; i++)
5653 for (num = 0; num < 64; num++)
5655 for (j = 0; j < max_k_idx; j++)
5657 object_kind *k_ptr = &k_info[j];
5659 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
5661 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON || k_ptr->sval == SV_HARP)) continue;
5663 weapon_exp = p_ptr->weapon_exp[4 - i][num];
5665 fprintf(fff, "%-25s ", tmp);
5666 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
5667 else fprintf(fff, " ");
5668 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
5669 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
5677 /* Close the file */
5680 /* Display the file contents */
5681 show_file(TRUE, file_name, _("武器の経験値", "Weapon Proficiency"), 0, 0);
5683 /* Remove the file */
5689 * @brief 魔法の経験値を表示するコマンドのメインルーチン
5693 static void do_cmd_knowledge_spell_exp(void)
5696 int spell_exp, exp_level;
5699 const magic_type *s_ptr;
5701 char file_name[1024];
5703 /* Open a new file */
5704 fff = my_fopen_temp(file_name, 1024);
5706 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5711 if (p_ptr->realm1 != REALM_NONE)
5713 fprintf(fff, _("%sの魔法書\n", "%s Spellbook\n"), realm_names[p_ptr->realm1]);
5714 for (i = 0; i < 32; i++)
5716 if (!is_magic(p_ptr->realm1))
5718 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
5722 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
5724 if (s_ptr->slevel >= 99) continue;
5725 spell_exp = p_ptr->spell_exp[i];
5726 exp_level = spell_exp_level(spell_exp);
5727 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
5728 if (p_ptr->realm1 == REALM_HISSATSU)
5729 fprintf(fff, "[--]");
5732 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
5733 else fprintf(fff, " ");
5734 fprintf(fff, "%s", exp_level_str[exp_level]);
5736 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5741 if (p_ptr->realm2 != REALM_NONE)
5743 fprintf(fff, _("%sの魔法書\n", "\n%s Spellbook\n"), realm_names[p_ptr->realm2]);
5744 for (i = 0; i < 32; i++)
5746 if (!is_magic(p_ptr->realm1))
5748 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
5752 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
5754 if (s_ptr->slevel >= 99) continue;
5756 spell_exp = p_ptr->spell_exp[i + 32];
5757 exp_level = spell_exp_level(spell_exp);
5758 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
5759 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
5760 else fprintf(fff, " ");
5761 fprintf(fff, "%s", exp_level_str[exp_level]);
5762 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5767 /* Close the file */
5770 /* Display the file contents */
5771 show_file(TRUE, file_name, _("魔法の経験値", "Spell Proficiency"), 0, 0);
5773 /* Remove the file */
5779 * @brief スキル情報を表示するコマンドのメインルーチン /
5783 static void do_cmd_knowledge_skill_exp(void)
5785 int i = 0, skill_exp;
5789 char file_name[1024];
5790 char skill_name[3][20]={_("マーシャルアーツ", "Martial Arts "),
5791 _("二刀流 ", "Dual Wielding "),
5792 _("乗馬 ", "Riding ")};
5794 /* Open a new file */
5795 fff = my_fopen_temp(file_name, 1024);
5797 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5802 for (i = 0; i < 3; i++)
5804 skill_exp = p_ptr->skill_exp[i];
5805 fprintf(fff, "%-20s ", skill_name[i]);
5806 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
5807 else fprintf(fff, " ");
5808 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
5809 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
5813 /* Close the file */
5816 /* Display the file contents */
5817 show_file(TRUE, file_name, _("技能の経験値", "Miscellaneous Proficiency"), 0, 0);
5819 /* Remove the file */
5825 * @brief 英単語、句、説を複数形を変換する / Pluralize a monster name
5826 * @param Name 変換したい文字列の参照ポインタ
5829 void plural_aux(char *Name)
5831 int NameLen = strlen(Name);
5833 if (my_strstr(Name, "Disembodied hand"))
5835 strcpy(Name, "Disembodied hands that strangled people");
5837 else if (my_strstr(Name, "Colour out of space"))
5839 strcpy(Name, "Colours out of space");
5841 else if (my_strstr(Name, "stairway to hell"))
5843 strcpy(Name, "stairways to hell");
5845 else if (my_strstr(Name, "Dweller on the threshold"))
5847 strcpy(Name, "Dwellers on the threshold");
5849 else if (my_strstr(Name, " of "))
5851 cptr aider = my_strstr(Name, " of ");
5862 if (dummy[i-1] == 's')
5864 strcpy(&(dummy[i]), "es");
5869 strcpy(&(dummy[i]), "s");
5872 strcpy(&(dummy[i+1]), aider);
5873 strcpy(Name, dummy);
5875 else if (my_strstr(Name, "coins"))
5878 strcpy(dummy, "piles of ");
5879 strcat(dummy, Name);
5880 strcpy(Name, dummy);
5883 else if (my_strstr(Name, "Manes"))
5887 else if (streq(&(Name[NameLen - 2]), "ey"))
5889 strcpy(&(Name[NameLen - 2]), "eys");
5891 else if (Name[NameLen - 1] == 'y')
5893 strcpy(&(Name[NameLen - 1]), "ies");
5895 else if (streq(&(Name[NameLen - 4]), "ouse"))
5897 strcpy(&(Name[NameLen - 4]), "ice");
5899 else if (streq(&(Name[NameLen - 2]), "us"))
5901 strcpy(&(Name[NameLen - 2]), "i");
5903 else if (streq(&(Name[NameLen - 6]), "kelman"))
5905 strcpy(&(Name[NameLen - 6]), "kelmen");
5907 else if (streq(&(Name[NameLen - 8]), "wordsman"))
5909 strcpy(&(Name[NameLen - 8]), "wordsmen");
5911 else if (streq(&(Name[NameLen - 7]), "oodsman"))
5913 strcpy(&(Name[NameLen - 7]), "oodsmen");
5915 else if (streq(&(Name[NameLen - 7]), "eastman"))
5917 strcpy(&(Name[NameLen - 7]), "eastmen");
5919 else if (streq(&(Name[NameLen - 8]), "izardman"))
5921 strcpy(&(Name[NameLen - 8]), "izardmen");
5923 else if (streq(&(Name[NameLen - 5]), "geist"))
5925 strcpy(&(Name[NameLen - 5]), "geister");
5927 else if (streq(&(Name[NameLen - 2]), "ex"))
5929 strcpy(&(Name[NameLen - 2]), "ices");
5931 else if (streq(&(Name[NameLen - 2]), "lf"))
5933 strcpy(&(Name[NameLen - 2]), "lves");
5935 else if (suffix(Name, "ch") ||
5936 suffix(Name, "sh") ||
5937 suffix(Name, "nx") ||
5938 suffix(Name, "s") ||
5941 strcpy(&(Name[NameLen]), "es");
5945 strcpy(&(Name[NameLen]), "s");
5950 * @brief 現在のペットを表示するコマンドのメインルーチン /
5951 * Display current pets
5954 static void do_cmd_knowledge_pets(void)
5958 monster_type *m_ptr;
5961 int show_upkeep = 0;
5962 char file_name[1024];
5965 /* Open a new file */
5966 fff = my_fopen_temp(file_name, 1024);
5968 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5973 /* Process the monsters (backwards) */
5974 for (i = m_max - 1; i >= 1; i--)
5976 /* Access the monster */
5979 /* Ignore "dead" monsters */
5980 if (!m_ptr->r_idx) continue;
5982 /* Calculate "upkeep" for pets */
5986 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
5987 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
5991 show_upkeep = calculate_upkeep();
5993 fprintf(fff, "----------------------------------------------\n");
5995 fprintf(fff, " 合計: %d 体のペット\n", t_friends);
5996 fprintf(fff, " 維持コスト: %d%% MP\n", show_upkeep);
5998 fprintf(fff, " Total: %d pet%s.\n",
5999 t_friends, (t_friends == 1 ? "" : "s"));
6000 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
6005 /* Close the file */
6008 /* Display the file contents */
6009 show_file(TRUE, file_name, _("現在のペット", "Current Pets"), 0, 0);
6011 /* Remove the file */
6017 * @brief 現在のペットを表示するコマンドのメインルーチン /
6020 * @note the player ghosts are ignored.
6022 static void do_cmd_knowledge_kill_count(void)
6031 char file_name[1024];
6036 /* Open a new file */
6037 fff = my_fopen_temp(file_name, 1024);
6040 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6045 /* Allocate the "who" array */
6046 C_MAKE(who, max_r_idx, s16b);
6049 /* Monsters slain */
6052 for (kk = 1; kk < max_r_idx; kk++)
6054 monster_race *r_ptr = &r_info[kk];
6056 if (r_ptr->flags1 & (RF1_UNIQUE))
6058 bool dead = (r_ptr->max_num == 0);
6067 MONSTER_NUMBER This = r_ptr->r_pkills;
6077 fprintf(fff,_("あなたはまだ敵を倒していない。\n\n", "You have defeated no enemies yet.\n\n"));
6080 fprintf(fff,"あなたは%ld体の敵を倒している。\n\n", (long int)Total);
6082 fprintf(fff,"You have defeated %ld %s.\n\n", (long int)Total, (Total == 1) ? "enemy" : "enemies");
6088 /* Scan the monsters */
6089 for (i = 1; i < max_r_idx; i++)
6091 monster_race *r_ptr = &r_info[i];
6093 /* Use that monster */
6094 if (r_ptr->name) who[n++] = i;
6097 /* Select the sort method */
6098 ang_sort_comp = ang_sort_comp_hook;
6099 ang_sort_swap = ang_sort_swap_hook;
6101 /* Sort the array by dungeon depth of monsters */
6102 ang_sort(who, &why, n);
6104 /* Scan the monster races */
6105 for (k = 0; k < n; k++)
6107 monster_race *r_ptr = &r_info[who[k]];
6109 if (r_ptr->flags1 & (RF1_UNIQUE))
6111 bool dead = (r_ptr->max_num == 0);
6115 fprintf(fff, " %s\n", (r_name + r_ptr->name));
6121 MONSTER_NUMBER This = r_ptr->r_pkills;
6126 /* p,tは人と数える by ita */
6127 if (my_strchr("pt", r_ptr->d_char))
6128 fprintf(fff, " %3d 人の %s\n", (int)This, r_name + r_ptr->name);
6130 fprintf(fff, " %3d 体の %s\n", (int)This, r_name + r_ptr->name);
6134 if (my_strstr(r_name + r_ptr->name, "coins"))
6136 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
6140 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
6146 strcpy(ToPlural, (r_name + r_ptr->name));
6147 plural_aux(ToPlural);
6148 fprintf(fff, " %d %s\n", This, ToPlural);
6158 fprintf(fff,"----------------------------------------------\n");
6160 fprintf(fff," 合計: %lu 体を倒した。\n", (unsigned long int)Total);
6162 fprintf(fff," Total: %lu creature%s killed.\n", (unsigned long int)Total, (Total == 1 ? "" : "s"));
6166 /* Free the "who" array */
6167 C_KILL(who, max_r_idx, s16b);
6169 /* Close the file */
6172 /* Display the file contents */
6173 show_file(TRUE, file_name, _("倒した敵の数", "Kill Count"), 0, 0);
6175 /* Remove the file */
6181 * @brief モンスター情報リスト中のグループを表示する /
6182 * Display the object groups.
6186 * @param per_page リストの表示行
6187 * @param grp_idx グループのID配列
6188 * @param group_text グループ名の文字列配列
6189 * @param grp_cur 現在の選択ID
6190 * @param grp_top 現在の選択リスト最上部ID
6193 static void display_group_list(int col, int row, int wid, int per_page, IDX grp_idx[], cptr group_text[], int grp_cur, int grp_top)
6197 /* Display lines until done */
6198 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
6200 /* Get the group index */
6201 int grp = grp_idx[grp_top + i];
6203 /* Choose a color */
6204 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
6206 /* Erase the entire line */
6207 Term_erase(col, row + i, wid);
6209 /* Display the group label */
6210 c_put_str(attr, group_text[grp], row + i, col);
6216 * Move the cursor in a browser window
6218 static void browser_cursor(char ch, int *column, IDX *grp_cur, int grp_cnt,
6219 IDX *list_cur, int list_cnt)
6224 IDX list = *list_cur;
6226 /* Extract direction */
6229 /* Hack -- scroll up full screen */
6234 /* Hack -- scroll down full screen */
6239 d = get_keymap_dir(ch);
6244 /* Diagonals - hack */
6245 if ((ddx[d] > 0) && ddy[d])
6250 Term_get_size(&wid, &hgt);
6252 browser_rows = hgt - 8;
6254 /* Browse group list */
6259 /* Move up or down */
6260 grp += ddy[d] * (browser_rows - 1);
6263 if (grp >= grp_cnt) grp = grp_cnt - 1;
6264 if (grp < 0) grp = 0;
6265 if (grp != old_grp) list = 0;
6268 /* Browse sub-list list */
6271 /* Move up or down */
6272 list += ddy[d] * browser_rows;
6275 if (list >= list_cnt) list = list_cnt - 1;
6276 if (list < 0) list = 0;
6288 if (col < 0) col = 0;
6289 if (col > 1) col = 1;
6296 /* Browse group list */
6301 /* Move up or down */
6305 if (grp >= grp_cnt) grp = grp_cnt - 1;
6306 if (grp < 0) grp = 0;
6307 if (grp != old_grp) list = 0;
6310 /* Browse sub-list list */
6313 /* Move up or down */
6317 if (list >= list_cnt) list = list_cnt - 1;
6318 if (list < 0) list = 0;
6329 static void display_visual_list(int col, int row, int height, int width, TERM_COLOR attr_top, byte char_left)
6333 /* Clear the display lines */
6334 for (i = 0; i < height; i++)
6336 Term_erase(col, row + i, width);
6339 /* Bigtile mode uses double width */
6340 if (use_bigtile) width /= 2;
6342 /* Display lines until done */
6343 for (i = 0; i < height; i++)
6345 /* Display columns until done */
6346 for (j = 0; j < width; j++)
6350 TERM_LEN x = col + j;
6351 TERM_LEN y = row + i;
6354 /* Bigtile mode uses double width */
6355 if (use_bigtile) x += j;
6360 /* Ignore illegal characters */
6361 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
6362 (!use_graphics && ic > 0x7f))
6368 /* Force correct code for both ASCII character and tile */
6369 if (c & 0x80) a |= 0x80;
6371 /* Display symbol */
6372 Term_queue_bigchar(x, y, a, c, 0, 0);
6379 * Place the cursor at the collect position for visual mode
6381 static void place_visual_list_cursor(TERM_LEN col, TERM_LEN row, TERM_COLOR a, byte c, TERM_COLOR attr_top, byte char_left)
6383 int i = (a & 0x7f) - attr_top;
6384 int j = c - char_left;
6386 TERM_LEN x = col + j;
6387 TERM_LEN y = row + i;
6389 /* Bigtile mode uses double width */
6390 if (use_bigtile) x += j;
6392 /* Place the cursor */
6398 * Clipboard variables for copy&paste in visual mode
6400 static TERM_COLOR attr_idx = 0;
6401 static byte char_idx = 0;
6403 /* Hack -- for feature lighting */
6404 static TERM_COLOR attr_idx_feat[F_LIT_MAX];
6405 static byte char_idx_feat[F_LIT_MAX];
6408 * Do visual mode command -- Change symbols
6410 static bool visual_mode_command(char ch, bool *visual_list_ptr,
6411 int height, int width,
6412 TERM_COLOR *attr_top_ptr, byte *char_left_ptr,
6413 TERM_COLOR *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
6415 static TERM_COLOR attr_old = 0;
6416 static byte char_old = 0;
6421 if (*visual_list_ptr)
6424 *cur_attr_ptr = attr_old;
6425 *cur_char_ptr = char_old;
6426 *visual_list_ptr = FALSE;
6434 if (*visual_list_ptr)
6437 *visual_list_ptr = FALSE;
6438 *need_redraw = TRUE;
6446 if (!*visual_list_ptr)
6448 *visual_list_ptr = TRUE;
6450 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6451 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6453 attr_old = *cur_attr_ptr;
6454 char_old = *cur_char_ptr;
6465 /* Set the visual */
6466 attr_idx = *cur_attr_ptr;
6467 char_idx = *cur_char_ptr;
6469 /* Hack -- for feature lighting */
6470 for (i = 0; i < F_LIT_MAX; i++)
6472 attr_idx_feat[i] = 0;
6473 char_idx_feat[i] = 0;
6480 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
6483 *cur_attr_ptr = attr_idx;
6484 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6485 if (!*visual_list_ptr) *need_redraw = TRUE;
6491 *cur_char_ptr = char_idx;
6492 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6493 if (!*visual_list_ptr) *need_redraw = TRUE;
6499 if (*visual_list_ptr)
6502 int d = get_keymap_dir(ch);
6503 byte a = (*cur_attr_ptr & 0x7f);
6504 byte c = *cur_char_ptr;
6506 if (use_bigtile) eff_width = width / 2;
6507 else eff_width = width;
6509 /* Restrict direction */
6510 if ((a == 0) && (ddy[d] < 0)) d = 0;
6511 if ((c == 0) && (ddx[d] < 0)) d = 0;
6512 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
6513 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
6518 /* Force correct code for both ASCII character and tile */
6519 if (c & 0x80) a |= 0x80;
6521 /* Set the visual */
6526 /* Move the frame */
6527 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
6528 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
6529 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
6530 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
6536 /* Visual mode command is not used */
6542 * Display the monsters in a group.
6544 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
6545 int mon_cur, int mon_top, bool visual_only)
6549 /* Display lines until done */
6550 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
6554 /* Get the race index */
6555 MONRACE_IDX r_idx = mon_idx[mon_top + i] ;
6557 /* Access the race */
6558 monster_race *r_ptr = &r_info[r_idx];
6560 /* Choose a color */
6561 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
6563 /* Display the name */
6564 c_prt(attr, (r_name + r_ptr->name), row + i, col);
6566 /* Hack -- visual_list mode */
6569 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
6571 if (p_ptr->wizard || visual_only)
6573 c_prt(attr, format("%d", r_idx), row + i, 62);
6576 /* Erase chars before overwritten by the race letter */
6577 Term_erase(69, row + i, 255);
6579 /* Display symbol */
6580 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
6585 if (!(r_ptr->flags1 & RF1_UNIQUE))
6586 put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
6588 c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE),
6589 (r_ptr->max_num == 0 ? _("死亡", " dead") : _("生存", "alive")), row + i, 74);
6593 /* Clear remaining lines */
6594 for (; i < per_page; i++)
6596 Term_erase(col, row + i, 255);
6602 * Display known monsters.
6604 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx)
6608 IDX grp_cur, grp_top, old_grp_cur;
6609 IDX mon_cur, mon_top;
6610 IDX grp_cnt, grp_idx[100];
6618 bool visual_list = FALSE;
6619 TERM_COLOR attr_top = 0;
6627 Term_get_size(&wid, &hgt);
6629 browser_rows = hgt - 8;
6631 /* Allocate the "mon_idx" array */
6632 C_MAKE(mon_idx, max_r_idx, s16b);
6637 if (direct_r_idx < 0)
6639 mode = visual_only ? 0x03 : 0x01;
6641 /* Check every group */
6642 for (i = 0; monster_group_text[i] != NULL; i++)
6644 /* Measure the label */
6645 len = strlen(monster_group_text[i]);
6647 /* Save the maximum length */
6648 if (len > max) max = len;
6650 /* See if any monsters are known */
6651 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
6653 /* Build a list of groups with known monsters */
6654 grp_idx[grp_cnt++] = i;
6662 mon_idx[0] = direct_r_idx;
6665 /* Terminate the list */
6668 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
6669 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
6672 /* Terminate the list */
6673 grp_idx[grp_cnt] = -1;
6676 grp_cur = grp_top = 0;
6677 mon_cur = mon_top = 0;
6682 mode = visual_only ? 0x02 : 0x00;
6687 monster_race *r_ptr;
6694 prt(format("%s - モンスター", !visual_only ? "知識" : "表示"), 2, 0);
6695 if (direct_r_idx < 0) prt("グループ", 4, 0);
6696 prt("名前", 4, max + 3);
6697 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6699 if (!visual_only) prt("殺害数", 4, 72);
6701 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
6702 if (direct_r_idx < 0) prt("Group", 4, 0);
6703 prt("Name", 4, max + 3);
6704 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6706 if (!visual_only) prt("Kills", 4, 73);
6709 for (i = 0; i < 78; i++)
6711 Term_putch(i, 5, TERM_WHITE, '=');
6714 if (direct_r_idx < 0)
6716 for (i = 0; i < browser_rows; i++)
6718 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
6725 if (direct_r_idx < 0)
6727 /* Scroll group list */
6728 if (grp_cur < grp_top) grp_top = grp_cur;
6729 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
6731 /* Display a list of monster groups */
6732 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
6734 if (old_grp_cur != grp_cur)
6736 old_grp_cur = grp_cur;
6738 /* Get a list of monsters in the current group */
6739 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
6742 /* Scroll monster list */
6743 while (mon_cur < mon_top)
6744 mon_top = MAX(0, mon_top - browser_rows/2);
6745 while (mon_cur >= mon_top + browser_rows)
6746 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
6751 /* Display a list of monsters in the current group */
6752 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
6758 /* Display a monster name */
6759 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
6761 /* Display visual list below first monster */
6762 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
6767 prt(format("<方向>%s%s%s, ESC",
6768 (!visual_list && !visual_only) ? ", 'r'で思い出を見る" : "",
6769 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
6770 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
6773 prt(format("<dir>%s%s%s, ESC",
6774 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
6775 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
6776 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
6780 /* Get the current monster */
6781 r_ptr = &r_info[mon_idx[mon_cur]];
6785 /* Mega Hack -- track this monster race */
6786 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
6792 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
6796 Term_gotoxy(0, 6 + (grp_cur - grp_top));
6800 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
6805 /* Do visual mode command if needed */
6806 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))
6808 if (direct_r_idx >= 0)
6833 /* Recall on screen */
6834 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
6836 screen_roff(mon_idx[mon_cur], 0);
6847 /* Move the cursor */
6848 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
6855 /* Free the "mon_idx" array */
6856 C_KILL(mon_idx, max_r_idx, s16b);
6861 * Display the objects in a group.
6863 static void display_object_list(int col, int row, int per_page, IDX object_idx[],
6864 int object_cur, int object_top, bool visual_only)
6868 /* Display lines until done */
6869 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
6874 object_kind *flavor_k_ptr;
6876 /* Get the object index */
6877 KIND_OBJECT_IDX k_idx = object_idx[object_top + i];
6879 /* Access the object */
6880 object_kind *k_ptr = &k_info[k_idx];
6882 /* Choose a color */
6883 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
6884 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
6887 if (!visual_only && k_ptr->flavor)
6889 /* Appearance of this object is shuffled */
6890 flavor_k_ptr = &k_info[k_ptr->flavor];
6894 /* Appearance of this object is very normal */
6895 flavor_k_ptr = k_ptr;
6900 attr = ((i + object_top == object_cur) ? cursor : attr);
6902 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
6905 strip_name(o_name, k_idx);
6910 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
6913 /* Display the name */
6914 c_prt(attr, o_name, row + i, col);
6916 /* Hack -- visual_list mode */
6919 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);
6921 if (p_ptr->wizard || visual_only)
6923 c_prt(attr, format("%d", k_idx), row + i, 70);
6926 a = flavor_k_ptr->x_attr;
6927 c = flavor_k_ptr->x_char;
6929 /* Display symbol */
6930 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
6933 /* Clear remaining lines */
6934 for (; i < per_page; i++)
6936 Term_erase(col, row + i, 255);
6941 * Describe fake object
6943 static void desc_obj_fake(KIND_OBJECT_IDX k_idx)
6946 object_type object_type_body;
6947 o_ptr = &object_type_body;
6950 /* Create the artifact */
6951 object_prep(o_ptr, k_idx);
6953 /* It's fully know */
6954 o_ptr->ident |= IDENT_KNOWN;
6956 /* Track the object */
6957 /* object_actual_track(o_ptr); */
6959 /* Hack - mark as fake */
6960 /* term_obj_real = FALSE; */
6963 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
6965 msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
6973 * Display known objects
6975 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx)
6979 IDX grp_cur, grp_top, old_grp_cur;
6980 IDX object_old, object_cur, object_top;
6990 bool visual_list = FALSE;
6991 TERM_COLOR attr_top = 0;
6999 Term_get_size(&wid, &hgt);
7001 browser_rows = hgt - 8;
7003 /* Allocate the "object_idx" array */
7004 C_MAKE(object_idx, max_k_idx, IDX);
7009 if (direct_k_idx < 0)
7011 mode = visual_only ? 0x03 : 0x01;
7013 /* Check every group */
7014 for (i = 0; object_group_text[i] != NULL; i++)
7016 /* Measure the label */
7017 len = strlen(object_group_text[i]);
7019 /* Save the maximum length */
7020 if (len > max) max = len;
7022 /* See if any monsters are known */
7023 if (collect_objects(i, object_idx, mode))
7025 /* Build a list of groups with known monsters */
7026 grp_idx[grp_cnt++] = i;
7035 object_kind *k_ptr = &k_info[direct_k_idx];
7036 object_kind *flavor_k_ptr;
7038 if (!visual_only && k_ptr->flavor)
7040 /* Appearance of this object is shuffled */
7041 flavor_k_ptr = &k_info[k_ptr->flavor];
7045 /* Appearance of this object is very normal */
7046 flavor_k_ptr = k_ptr;
7049 object_idx[0] = direct_k_idx;
7050 object_old = direct_k_idx;
7053 /* Terminate the list */
7056 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7057 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
7060 /* Terminate the list */
7061 grp_idx[grp_cnt] = -1;
7064 grp_cur = grp_top = 0;
7065 object_cur = object_top = 0;
7070 mode = visual_only ? 0x02 : 0x00;
7075 object_kind *k_ptr, *flavor_k_ptr;
7082 prt(format("%s - アイテム", !visual_only ? "知識" : "表示"), 2, 0);
7083 if (direct_k_idx < 0) prt("グループ", 4, 0);
7084 prt("名前", 4, max + 3);
7085 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
7088 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7089 if (direct_k_idx < 0) prt("Group", 4, 0);
7090 prt("Name", 4, max + 3);
7091 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
7095 for (i = 0; i < 78; i++)
7097 Term_putch(i, 5, TERM_WHITE, '=');
7100 if (direct_k_idx < 0)
7102 for (i = 0; i < browser_rows; i++)
7104 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7111 if (direct_k_idx < 0)
7113 /* Scroll group list */
7114 if (grp_cur < grp_top) grp_top = grp_cur;
7115 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7117 /* Display a list of object groups */
7118 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
7120 if (old_grp_cur != grp_cur)
7122 old_grp_cur = grp_cur;
7124 /* Get a list of objects in the current group */
7125 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
7128 /* Scroll object list */
7129 while (object_cur < object_top)
7130 object_top = MAX(0, object_top - browser_rows/2);
7131 while (object_cur >= object_top + browser_rows)
7132 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
7137 /* Display a list of objects in the current group */
7138 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
7142 object_top = object_cur;
7144 /* Display a list of objects in the current group */
7145 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
7147 /* Display visual list below first object */
7148 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7151 /* Get the current object */
7152 k_ptr = &k_info[object_idx[object_cur]];
7154 if (!visual_only && k_ptr->flavor)
7156 /* Appearance of this object is shuffled */
7157 flavor_k_ptr = &k_info[k_ptr->flavor];
7161 /* Appearance of this object is very normal */
7162 flavor_k_ptr = k_ptr;
7167 prt(format("<方向>%s%s%s, ESC",
7168 (!visual_list && !visual_only) ? ", 'r'で詳細を見る" : "",
7169 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
7170 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7173 prt(format("<dir>%s%s%s, ESC",
7174 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7175 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7176 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7182 /* Mega Hack -- track this object */
7183 if (object_cnt) object_kind_track(object_idx[object_cur]);
7185 /* The "current" object changed */
7186 if (object_old != object_idx[object_cur])
7190 /* Remember the "current" object */
7191 object_old = object_idx[object_cur];
7197 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
7201 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7205 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
7210 /* Do visual mode command if needed */
7211 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))
7213 if (direct_k_idx >= 0)
7238 /* Recall on screen */
7239 if (!visual_list && !visual_only && (grp_cnt > 0))
7241 desc_obj_fake(object_idx[object_cur]);
7249 /* Move the cursor */
7250 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
7256 /* Free the "object_idx" array */
7257 C_KILL(object_idx, max_k_idx, IDX);
7262 * Display the features in a group.
7264 static void display_feature_list(int col, int row, int per_page, FEAT_IDX *feat_idx,
7265 FEAT_IDX feat_cur, FEAT_IDX feat_top, bool visual_only, int lighting_level)
7267 int lit_col[F_LIT_MAX], i, j;
7268 int f_idx_col = use_bigtile ? 62 : 64;
7270 /* Correct columns 1 and 4 */
7271 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
7272 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7273 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
7275 /* Display lines until done */
7276 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
7281 FEAT_IDX f_idx = feat_idx[feat_top + i];
7283 /* Access the index */
7284 feature_type *f_ptr = &f_info[f_idx];
7286 int row_i = row + i;
7288 /* Choose a color */
7289 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
7291 /* Display the name */
7292 c_prt(attr, f_name + f_ptr->name, row_i, col);
7294 /* Hack -- visual_list mode */
7297 /* Display lighting level */
7298 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
7300 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));
7302 if (p_ptr->wizard || visual_only)
7304 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
7307 /* Display symbol */
7308 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);
7310 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
7311 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
7313 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
7315 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
7317 /* Mega-hack -- Use non-standard colour */
7318 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
7320 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
7324 /* Clear remaining lines */
7325 for (; i < per_page; i++)
7327 Term_erase(col, row + i, 255);
7333 * Interact with feature visuals.
7335 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level)
7339 IDX grp_cur, grp_top, old_grp_cur;
7340 IDX feat_cur, feat_top;
7350 bool visual_list = FALSE;
7351 TERM_COLOR attr_top = 0;
7357 TERM_COLOR attr_old[F_LIT_MAX];
7358 byte char_old[F_LIT_MAX];
7359 TERM_COLOR *cur_attr_ptr;
7362 (void)C_WIPE(attr_old, F_LIT_MAX, byte);
7363 (void)C_WIPE(char_old, F_LIT_MAX, byte);
7365 Term_get_size(&wid, &hgt);
7367 browser_rows = hgt - 8;
7369 /* Allocate the "feat_idx" array */
7370 C_MAKE(feat_idx, max_f_idx, IDX);
7375 if (direct_f_idx < 0)
7377 /* Check every group */
7378 for (i = 0; feature_group_text[i] != NULL; i++)
7380 /* Measure the label */
7381 len = strlen(feature_group_text[i]);
7383 /* Save the maximum length */
7384 if (len > max) max = len;
7386 /* See if any features are known */
7387 if (collect_features(i, feat_idx, 0x01))
7389 /* Build a list of groups with known features */
7390 grp_idx[grp_cnt++] = i;
7398 feature_type *f_ptr = &f_info[direct_f_idx];
7400 feat_idx[0] = direct_f_idx;
7403 /* Terminate the list */
7406 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7407 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
7409 for (i = 0; i < F_LIT_MAX; i++)
7411 attr_old[i] = f_ptr->x_attr[i];
7412 char_old[i] = f_ptr->x_char[i];
7416 /* Terminate the list */
7417 grp_idx[grp_cnt] = -1;
7420 grp_cur = grp_top = 0;
7421 feat_cur = feat_top = 0;
7429 feature_type *f_ptr;
7436 prt("表示 - 地形", 2, 0);
7437 if (direct_f_idx < 0) prt("グループ", 4, 0);
7438 prt("名前", 4, max + 3);
7441 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7442 prt("文字 ( l/ d)", 4, 66);
7446 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7447 prt("文字 (l/d)", 4, 68);
7450 prt("Visuals - features", 2, 0);
7451 if (direct_f_idx < 0) prt("Group", 4, 0);
7452 prt("Name", 4, max + 3);
7455 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7456 prt("Sym ( l/ d)", 4, 67);
7460 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7461 prt("Sym (l/d)", 4, 69);
7465 for (i = 0; i < 78; i++)
7467 Term_putch(i, 5, TERM_WHITE, '=');
7470 if (direct_f_idx < 0)
7472 for (i = 0; i < browser_rows; i++)
7474 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7481 if (direct_f_idx < 0)
7483 /* Scroll group list */
7484 if (grp_cur < grp_top) grp_top = grp_cur;
7485 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7487 /* Display a list of feature groups */
7488 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
7490 if (old_grp_cur != grp_cur)
7492 old_grp_cur = grp_cur;
7494 /* Get a list of features in the current group */
7495 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
7498 /* Scroll feature list */
7499 while (feat_cur < feat_top)
7500 feat_top = MAX(0, feat_top - browser_rows/2);
7501 while (feat_cur >= feat_top + browser_rows)
7502 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
7507 /* Display a list of features in the current group */
7508 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
7512 feat_top = feat_cur;
7514 /* Display a list of features in the current group */
7515 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
7517 /* Display visual list below first object */
7518 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7523 prt(format("<方向>%s, 'd'で標準光源効果%s, ESC",
7524 visual_list ? ", ENTERで決定, 'a'で対象明度変更" : ", 'v'でシンボル変更",
7525 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7528 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
7529 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
7530 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7534 /* Get the current feature */
7535 f_ptr = &f_info[feat_idx[feat_cur]];
7536 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
7537 cur_char_ptr = &f_ptr->x_char[*lighting_level];
7541 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
7545 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7549 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
7554 if (visual_list && ((ch == 'A') || (ch == 'a')))
7556 int prev_lighting_level = *lighting_level;
7560 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
7561 else (*lighting_level)--;
7565 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
7566 else (*lighting_level)++;
7569 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
7570 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7572 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
7573 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7578 else if ((ch == 'D') || (ch == 'd'))
7580 TERM_COLOR prev_x_attr = f_ptr->x_attr[*lighting_level];
7581 byte prev_x_char = f_ptr->x_char[*lighting_level];
7583 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
7587 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
7588 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7590 if (prev_x_char != f_ptr->x_char[*lighting_level])
7591 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7593 else *need_redraw = TRUE;
7598 /* Do visual mode command if needed */
7599 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))
7603 /* Restore previous visual settings */
7605 for (i = 0; i < F_LIT_MAX; i++)
7607 f_ptr->x_attr[i] = attr_old[i];
7608 f_ptr->x_char[i] = char_old[i];
7615 if (direct_f_idx >= 0) flag = TRUE;
7616 else *lighting_level = F_LIT_STANDARD;
7619 /* Preserve current visual settings */
7622 for (i = 0; i < F_LIT_MAX; i++)
7624 attr_old[i] = f_ptr->x_attr[i];
7625 char_old[i] = f_ptr->x_char[i];
7627 *lighting_level = F_LIT_STANDARD;
7634 for (i = 0; i < F_LIT_MAX; i++)
7636 attr_idx_feat[i] = f_ptr->x_attr[i];
7637 char_idx_feat[i] = f_ptr->x_char[i];
7646 /* Allow TERM_DARK text */
7647 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7649 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
7650 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
7668 /* Move the cursor */
7669 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
7675 /* Free the "feat_idx" array */
7676 C_KILL(feat_idx, max_f_idx, IDX);
7681 * List wanted monsters
7683 static void do_cmd_knowledge_kubi(void)
7688 char file_name[1024];
7691 /* Open a new file */
7692 fff = my_fopen_temp(file_name, 1024);
7694 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7701 bool listed = FALSE;
7704 fprintf(fff, "今日のターゲット : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "不明"));
7706 fprintf(fff, "賞金首リスト\n");
7708 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
7710 fprintf(fff, "List of wanted monsters\n");
7712 fprintf(fff, "----------------------------------------------\n");
7714 for (i = 0; i < MAX_KUBI; i++)
7716 if (kubi_r_idx[i] <= 10000)
7718 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
7726 fprintf(fff,"\n%s\n", _("賞金首はもう残っていません。", "There is no more wanted monster."));
7730 /* Close the file */
7733 /* Display the file contents */
7734 show_file(TRUE, file_name, _("賞金首の一覧", "Wanted monsters"), 0, 0);
7736 /* Remove the file */
7741 * List virtues & status
7743 static void do_cmd_knowledge_virtues(void)
7747 char file_name[1024];
7750 /* Open a new file */
7751 fff = my_fopen_temp(file_name, 1024);
7753 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7760 fprintf(fff, _("現在の属性 : %s\n\n", "Your alighnment : %s\n\n"), your_alignment());
7764 /* Close the file */
7767 /* Display the file contents */
7768 show_file(TRUE, file_name, _("八つの徳", "Virtues"), 0, 0);
7770 /* Remove the file */
7778 static void do_cmd_knowledge_dungeon(void)
7782 char file_name[1024];
7786 /* Open a new file */
7787 fff = my_fopen_temp(file_name, 1024);
7789 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7796 for (i = 1; i < max_d_idx; i++)
7800 if (!d_info[i].maxdepth) continue;
7801 if (!max_dlv[i]) continue;
7802 if (d_info[i].final_guardian)
7804 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
7806 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
7808 fprintf(fff, _("%c%-12s : %3d 階\n", "%c%-16s : level %3d\n"), seiha ? '!' : ' ', d_name + d_info[i].name, (int)max_dlv[i]);
7812 /* Close the file */
7815 /* Display the file contents */
7816 show_file(TRUE, file_name, _("今までに入ったダンジョン", "Dungeon"), 0, 0);
7818 /* Remove the file */
7823 * List virtues & status
7826 static void do_cmd_knowledge_stat(void)
7830 char file_name[1024];
7833 /* Open a new file */
7834 fff = my_fopen_temp(file_name, 1024);
7836 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7843 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
7844 (2 * p_ptr->hitdie +
7845 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
7848 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "現在の体力ランク : %d/100\n\n", percent);
7849 else fprintf(fff, "現在の体力ランク : ???\n\n");
7850 fprintf(fff, "能力の最大値\n\n");
7852 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
7853 else fprintf(fff, "Your current Life Rating is ???.\n\n");
7854 fprintf(fff, "Limits of maximum stats\n\n");
7856 for (v_nr = 0; v_nr < 6; v_nr++)
7858 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);
7859 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
7865 /* Close the file */
7868 /* Display the file contents */
7869 show_file(TRUE, file_name, _("自分に関する情報", "HP-rate & Max stat"), 0, 0);
7871 /* Remove the file */
7877 * Print all active quests
7879 static void do_cmd_knowledge_quests_current(FILE *fff)
7882 char rand_tmp_str[120] = "\0";
7884 monster_race *r_ptr;
7886 int rand_level = 100;
7889 fprintf(fff, _("《遂行中のクエスト》\n", "< Current Quest >\n"));
7891 for (i = 1; i < max_q_idx; i++)
7893 if ((quest[i].status == QUEST_STATUS_TAKEN) ||
7894 ((quest[i].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[i].type == QUEST_TYPE_TOWER)) ||
7895 (quest[i].status == QUEST_STATUS_COMPLETED))
7897 /* Set the quest number temporary */
7898 IDX old_quest = p_ptr->inside_quest;
7901 /* Clear the text */
7902 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
7903 quest_text_line = 0;
7905 p_ptr->inside_quest = i;
7907 /* Get the quest text */
7908 init_flags = INIT_SHOW_TEXT;
7910 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
7912 /* Reset the old quest number */
7913 p_ptr->inside_quest = old_quest;
7915 /* No info from "silent" quests */
7916 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
7920 if (quest[i].type != QUEST_TYPE_RANDOM)
7922 char note[80] = "\0";
7924 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_STAGE_COMPLETED)
7926 switch (quest[i].type)
7928 case QUEST_TYPE_KILL_LEVEL:
7929 case QUEST_TYPE_KILL_ANY_LEVEL:
7930 r_ptr = &r_info[quest[i].r_idx];
7931 strcpy(name, r_name + r_ptr->name);
7932 if (quest[i].max_num > 1)
7935 sprintf(note," - %d 体の%sを倒す。(あと %d 体)",
7936 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
7939 sprintf(note," - kill %d %s, have killed %d.",
7940 (int)quest[i].max_num, name, (int)quest[i].cur_num);
7944 sprintf(note,_(" - %sを倒す。", " - kill %s."),name);
7947 case QUEST_TYPE_FIND_ARTIFACT:
7950 artifact_type *a_ptr = &a_info[quest[i].k_idx];
7952 object_type *q_ptr = &forge;
7953 KIND_OBJECT_IDX k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
7954 object_prep(q_ptr, k_idx);
7955 q_ptr->name1 = quest[i].k_idx;
7956 q_ptr->ident = IDENT_STORE;
7957 object_desc(name, q_ptr, OD_NAME_ONLY);
7959 sprintf(note,_("\n - %sを見つけ出す。", "\n - Find out %s."), name);
7961 case QUEST_TYPE_FIND_EXIT:
7962 sprintf(note,_(" - 出口に到達する。", " - Reach to Exit."));
7965 case QUEST_TYPE_KILL_NUMBER:
7967 sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)",
7968 (int)quest[i].max_num, (int)(quest[i].max_num - quest[i].cur_num));
7970 sprintf(note," - Kill %d monsters, have killed %d.",
7971 (int)quest[i].max_num, (int)quest[i].cur_num);
7975 case QUEST_TYPE_KILL_ALL:
7976 case QUEST_TYPE_TOWER:
7977 sprintf(note,_(" - 全てのモンスターを倒す。", " - Kill all monsters."));
7982 /* Print the quest info */
7983 sprintf(tmp_str, _(" %s (危険度:%d階相当)%s\n", " %s (Danger level: %d)%s\n"),
7984 quest[i].name, (int)quest[i].level, note);
7986 fputs(tmp_str, fff);
7988 if (quest[i].status == QUEST_STATUS_COMPLETED)
7990 sprintf(tmp_str, _(" クエスト達成 - まだ報酬を受けとってない。\n", " Quest Completed - Unrewarded\n"));
7991 fputs(tmp_str, fff);
7997 while (quest_text[j][0] && j < 10)
7999 fprintf(fff, " %s\n", quest_text[j]);
8004 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
8007 rand_level = quest[i].level;
8009 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8011 /* Print the quest info */
8012 r_ptr = &r_info[quest[i].r_idx];
8013 strcpy(name, r_name + r_ptr->name);
8015 if (quest[i].max_num > 1)
8018 sprintf(rand_tmp_str," %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
8019 quest[i].name, (int)quest[i].level,
8020 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
8024 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8025 quest[i].name, (int)quest[i].level,
8026 (int)quest[i].max_num, name, (int)quest[i].cur_num);
8031 sprintf(rand_tmp_str,_(" %s (%d 階) - %sを倒す。\n", " %s (Dungeon level: %d)\n Kill %s.\n"),
8032 quest[i].name, (int)quest[i].level, name);
8039 /* Print the current random quest */
8040 if (rand_tmp_str[0]) fputs(rand_tmp_str, fff);
8042 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8046 static bool do_cmd_knowledge_quests_aux(FILE *fff, IDX q_idx)
8049 char playtime_str[16];
8050 quest_type* const q_ptr = &quest[q_idx];
8052 if (is_fixed_quest_idx(q_idx))
8054 /* Set the quest number temporary */
8055 IDX old_quest = p_ptr->inside_quest;
8057 p_ptr->inside_quest = q_idx;
8060 init_flags = INIT_NAME_ONLY;
8062 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8064 /* Reset the old quest number */
8065 p_ptr->inside_quest = old_quest;
8067 /* No info from "silent" quests */
8068 if (q_ptr->flags & QUEST_FLAG_SILENT) return FALSE;
8071 strnfmt(playtime_str, sizeof(playtime_str), "%02d:%02d:%02d",
8072 q_ptr->comptime/(60*60), (q_ptr->comptime/60)%60, q_ptr->comptime%60);
8074 if (!is_fixed_quest_idx(q_idx) && q_ptr->r_idx)
8076 /* Print the quest info */
8077 if (q_ptr->complev == 0)
8080 _(" %-35s (%3d階) - 不戦勝 - %s\n",
8081 " %-35s (Dungeon level: %3d) - Unearned - %s\n") ,
8082 r_name+r_info[q_ptr->r_idx].name,
8083 (int)q_ptr->level, playtime_str);
8088 _(" %-35s (%3d階) - レベル%2d - %s\n",
8089 " %-35s (Dungeon level: %3d) - level %2d - %s\n") ,
8090 r_name+r_info[q_ptr->r_idx].name,
8098 /* Print the quest info */
8100 _(" %-35s (危険度:%3d階相当) - レベル%2d - %s\n",
8101 " %-35s (Danger level: %3d) - level %2d - %s\n") ,
8102 q_ptr->name, (int)q_ptr->level, q_ptr->complev, playtime_str);
8105 fputs(tmp_str, fff);
8111 * Print all finished quests
8113 void do_cmd_knowledge_quests_completed(FILE *fff, IDX quest_num[])
8118 fprintf(fff, _("《達成したクエスト》\n", "< Completed Quest >\n"));
8119 for (i = 1; i < max_q_idx; i++)
8121 IDX q_idx = quest_num[i];
8122 quest_type* const q_ptr = &quest[q_idx];
8124 if (q_ptr->status == QUEST_STATUS_FINISHED &&
8125 do_cmd_knowledge_quests_aux(fff, q_idx))
8130 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8135 * Print all failed quests
8137 void do_cmd_knowledge_quests_failed(FILE *fff, IDX quest_num[])
8142 fprintf(fff, _("《失敗したクエスト》\n", "< Failed Quest >\n"));
8143 for (i = 1; i < max_q_idx; i++)
8145 IDX q_idx = quest_num[i];
8146 quest_type* const q_ptr = &quest[q_idx];
8148 if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) &&
8149 do_cmd_knowledge_quests_aux(fff, q_idx))
8154 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8159 * Print all random quests
8161 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
8167 fprintf(fff, _("《残りのランダムクエスト》\n", "< Remaining Random Quest >\n"));
8168 for (i = 1; i < max_q_idx; i++)
8170 /* No info from "silent" quests */
8171 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8173 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
8177 /* Print the quest info */
8178 sprintf(tmp_str, _(" %s (%d階, %s)\n", " %s (%d, %s)\n"),
8179 quest[i].name, (int)quest[i].level, r_name+r_info[quest[i].r_idx].name);
8180 fputs(tmp_str, fff);
8183 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8187 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
8189 QUEST_IDX *q_num = (QUEST_IDX *)u;
8190 quest_type *qa = &quest[q_num[a]];
8191 quest_type *qb = &quest[q_num[b]];
8196 return (qa->comptime != qb->comptime) ?
8197 (qa->comptime < qb->comptime) :
8198 (qa->level <= qb->level);
8201 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
8203 QUEST_IDX *q_num = (QUEST_IDX *)u;
8210 q_num[a] = q_num[b];
8216 * Print quest status of all active quests
8218 static void do_cmd_knowledge_quests(void)
8221 char file_name[1024];
8226 /* Open a new file */
8227 fff = my_fopen_temp(file_name, 1024);
8230 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8235 /* Allocate Memory */
8236 C_MAKE(quest_num, max_q_idx, IDX);
8238 /* Sort by compete level */
8239 for (i = 1; i < max_q_idx; i++) quest_num[i] = i;
8240 ang_sort_comp = ang_sort_comp_quest_num;
8241 ang_sort_swap = ang_sort_swap_quest_num;
8242 ang_sort(quest_num, &dummy, max_q_idx);
8244 /* Dump Quest Information */
8245 do_cmd_knowledge_quests_current(fff);
8247 do_cmd_knowledge_quests_completed(fff, quest_num);
8249 do_cmd_knowledge_quests_failed(fff, quest_num);
8253 do_cmd_knowledge_quests_wiz_random(fff);
8256 /* Close the file */
8259 /* Display the file contents */
8260 show_file(TRUE, file_name, _("クエスト達成状況", "Quest status"), 0, 0);
8262 /* Remove the file */
8266 C_KILL(quest_num, max_q_idx, IDX);
8273 static void do_cmd_knowledge_home(void)
8278 char file_name[1024];
8280 char o_name[MAX_NLEN];
8283 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
8285 /* Open a new file */
8286 fff = my_fopen_temp(file_name, 1024);
8288 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8295 /* Print all homes in the different towns */
8296 st_ptr = &town[1].store[STORE_HOME];
8298 /* Home -- if anything there */
8299 if (st_ptr->stock_num)
8304 /* Header with name of the town */
8305 fprintf(fff, _(" [ 我が家のアイテム ]\n", " [Home Inventory]\n"));
8307 /* Dump all available items */
8308 for (i = 0; i < st_ptr->stock_num; i++)
8311 if ((i % 12) == 0) fprintf(fff, "\n ( %d ページ )\n", x++);
8312 object_desc(o_name, &st_ptr->stock[i], 0);
8313 if (strlen(o_name) <= 80-3)
8315 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8321 for (n = 0, t = o_name; n < 80-3; n++, t++)
8322 if(iskanji(*t)) {t++; n++;}
8323 if (n == 81-3) n = 79-3; /* 最後が漢字半分 */
8325 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
8326 fprintf(fff, " %.77s\n", o_name+n);
8329 object_desc(o_name, &st_ptr->stock[i], 0);
8330 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8335 /* Add an empty line */
8336 fprintf(fff, "\n\n");
8340 /* Close the file */
8343 /* Display the file contents */
8344 show_file(TRUE, file_name, _("我が家のアイテム", "Home Inventory"), 0, 0);
8346 /* Remove the file */
8352 * Check the status of "autopick"
8354 static void do_cmd_knowledge_autopick(void)
8358 char file_name[1024];
8360 /* Open a new file */
8361 fff = my_fopen_temp(file_name, 1024);
8365 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8372 fprintf(fff, _("自動破壊/拾いには何も登録されていません。", "No preference for auto picker/destroyer."));
8376 fprintf(fff, _(" 自動拾い/破壊には現在 %d行登録されています。\n\n",
8377 " There are %d registered lines for auto picker/destroyer.\n\n"), max_autopick);
8380 for (k = 0; k < max_autopick; k++)
8383 byte act = autopick_list[k].action;
8384 if (act & DONT_AUTOPICK)
8386 tmp = _("放置", "Leave");
8388 else if (act & DO_AUTODESTROY)
8390 tmp = _("破壊", "Destroy");
8392 else if (act & DO_AUTOPICK)
8394 tmp = _("拾う", "Pickup");
8398 tmp = _("確認", "Query");
8401 if (act & DO_DISPLAY)
8402 fprintf(fff, "%11s", format("[%s]", tmp));
8404 fprintf(fff, "%11s", format("(%s)", tmp));
8406 tmp = autopick_line_from_entry(&autopick_list[k]);
8407 fprintf(fff, " %s", tmp);
8411 /* Close the file */
8413 /* Display the file contents */
8414 show_file(TRUE, file_name, _("自動拾い/破壊 設定リスト", "Auto-picker/Destroyer"), 0, 0);
8416 /* Remove the file */
8422 * Interact with "knowledge"
8424 void do_cmd_knowledge(void)
8427 bool need_redraw = FALSE;
8429 /* File type is "TEXT" */
8430 FILE_TYPE(FILE_TYPE_TEXT);
8432 /* Save the screen */
8435 /* Interact until done */
8441 /* Ask for a choice */
8443 prt(format("%d/2 ページ", (p+1)), 2, 65);
8444 prt("現在の知識を確認する", 3, 0);
8446 prt(format("page %d/2", (p+1)), 2, 65);
8447 prt("Display current knowledge", 3, 0);
8450 /* Give some choices */
8454 prt("(1) 既知の伝説のアイテム の一覧", 6, 5);
8455 prt("(2) 既知のアイテム の一覧", 7, 5);
8456 prt("(3) 既知の生きているユニーク・モンスター の一覧", 8, 5);
8457 prt("(4) 既知のモンスター の一覧", 9, 5);
8458 prt("(5) 倒した敵の数 の一覧", 10, 5);
8459 if (!vanilla_town) prt("(6) 賞金首 の一覧", 11, 5);
8460 prt("(7) 現在のペット の一覧", 12, 5);
8461 prt("(8) 我が家のアイテム の一覧", 13, 5);
8462 prt("(9) *鑑定*済み装備の耐性 の一覧", 14, 5);
8463 prt("(0) 地形の表示文字/タイル の一覧", 15, 5);
8467 prt("(a) 自分に関する情報 の一覧", 6, 5);
8468 prt("(b) 突然変異 の一覧", 7, 5);
8469 prt("(c) 武器の経験値 の一覧", 8, 5);
8470 prt("(d) 魔法の経験値 の一覧", 9, 5);
8471 prt("(e) 技能の経験値 の一覧", 10, 5);
8472 prt("(f) プレイヤーの徳 の一覧", 11, 5);
8473 prt("(g) 入ったダンジョン の一覧", 12, 5);
8474 prt("(h) 実行中のクエスト の一覧", 13, 5);
8475 prt("(i) 現在の自動拾い/破壊設定 の一覧", 14, 5);
8480 prt("(1) Display known artifacts", 6, 5);
8481 prt("(2) Display known objects", 7, 5);
8482 prt("(3) Display remaining uniques", 8, 5);
8483 prt("(4) Display known monster", 9, 5);
8484 prt("(5) Display kill count", 10, 5);
8485 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
8486 prt("(7) Display current pets", 12, 5);
8487 prt("(8) Display home inventory", 13, 5);
8488 prt("(9) Display *identified* equip.", 14, 5);
8489 prt("(0) Display terrain symbols.", 15, 5);
8493 prt("(a) Display about yourself", 6, 5);
8494 prt("(b) Display mutations", 7, 5);
8495 prt("(c) Display weapon proficiency", 8, 5);
8496 prt("(d) Display spell proficiency", 9, 5);
8497 prt("(e) Display misc. proficiency", 10, 5);
8498 prt("(f) Display virtues", 11, 5);
8499 prt("(g) Display dungeons", 12, 5);
8500 prt("(h) Display current quests", 13, 5);
8501 prt("(i) Display auto pick/destroy", 14, 5);
8507 prt("ESC) 抜ける", 21, 1);
8508 prt("SPACE) 次ページ", 21, 30);
8509 /*prt("-) 前ページ", 21, 60);*/
8510 prt("コマンド:", 20, 0);
8512 prt("-more-", 17, 8);
8513 prt("ESC) Exit menu", 21, 1);
8514 prt("SPACE) Next page", 21, 30);
8515 /*prt("-) Previous page", 21, 60);*/
8516 prt("Command: ", 20, 0);
8522 if (i == ESCAPE) break;
8525 case ' ': /* Page change */
8529 case '1': /* Artifacts */
8530 do_cmd_knowledge_artifacts();
8532 case '2': /* Objects */
8533 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
8535 case '3': /* Uniques */
8536 do_cmd_knowledge_uniques();
8538 case '4': /* Monsters */
8539 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
8541 case '5': /* Kill count */
8542 do_cmd_knowledge_kill_count();
8544 case '6': /* wanted */
8545 if (!vanilla_town) do_cmd_knowledge_kubi();
8547 case '7': /* Pets */
8548 do_cmd_knowledge_pets();
8550 case '8': /* Home */
8551 do_cmd_knowledge_home();
8553 case '9': /* Resist list */
8554 do_cmd_knowledge_inven();
8556 case '0': /* Feature list */
8558 IDX lighting_level = F_LIT_STANDARD;
8559 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
8563 case 'a': /* Max stat */
8564 do_cmd_knowledge_stat();
8566 case 'b': /* Mutations */
8567 do_cmd_knowledge_mutations();
8569 case 'c': /* weapon-exp */
8570 do_cmd_knowledge_weapon_exp();
8572 case 'd': /* spell-exp */
8573 do_cmd_knowledge_spell_exp();
8575 case 'e': /* skill-exp */
8576 do_cmd_knowledge_skill_exp();
8578 case 'f': /* Virtues */
8579 do_cmd_knowledge_virtues();
8581 case 'g': /* Dungeon */
8582 do_cmd_knowledge_dungeon();
8584 case 'h': /* Quests */
8585 do_cmd_knowledge_quests();
8587 case 'i': /* Autopick */
8588 do_cmd_knowledge_autopick();
8590 default: /* Unknown option */
8594 /* Flush messages */
8598 /* Restore the screen */
8601 if (need_redraw) do_cmd_redraw();
8606 * Check on the status of an active quest
8608 void do_cmd_checkquest(void)
8610 /* File type is "TEXT" */
8611 FILE_TYPE(FILE_TYPE_TEXT);
8613 /* Save the screen */
8617 do_cmd_knowledge_quests();
8619 /* Restore the screen */
8625 * Display the time and date
8627 void do_cmd_time(void)
8629 int day, hour, min, full, start, end, num;
8637 extract_day_hour_min(&day, &hour, &min);
8639 full = hour * 100 + min;
8646 strcpy(desc, _("変な時刻だ。", "It is a strange time."));
8648 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
8649 else strcpy(day_buf, "*****");
8652 msg_format("%s日目, 時刻は%d:%02d %sです。",
8653 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
8654 min, (hour < 12) ? "AM" : "PM");
8656 msg_format("This is day %s. The time is %d:%02d %s.",
8657 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
8658 min, (hour < 12) ? "AM" : "PM");
8663 if (!randint0(10) || p_ptr->image)
8665 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timefun_j.txt", "timefun.txt"));
8669 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timenorm_j.txt", "timenorm.txt"));
8672 /* Open this file */
8673 fff = my_fopen(buf, "rt");
8677 /* Find this time */
8678 while (!my_fgets(fff, buf, sizeof(buf)))
8680 /* Ignore comments */
8681 if (!buf[0] || (buf[0] == '#')) continue;
8683 /* Ignore invalid lines */
8684 if (buf[1] != ':') continue;
8686 /* Process 'Start' */
8689 /* Extract the starting time */
8690 start = atoi(buf + 2);
8692 /* Assume valid for an hour */
8702 /* Extract the ending time */
8703 end = atoi(buf + 2);
8709 /* Ignore incorrect range */
8710 if ((start > full) || (full > end)) continue;
8712 /* Process 'Description' */
8717 /* Apply the randomizer */
8718 if (!randint0(num)) strcpy(desc, buf + 2);
8727 /* Close the file */