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 */
948 /* Restore the screen */
953 * @brief 画面を再描画するコマンドのメインルーチン
954 * Hack -- redraw the screen
958 * This command performs various low level updates, clears all the "extra"
959 * windows, does a total redraw of the main window, and requests all of the
960 * interesting updates and redraws that I can think of.
962 * This command is also used to "instantiate" the results of the user
963 * selecting various things, such as graphics mode, so it must call
964 * the "TERM_XTRA_REACT" hook before redrawing the windows.
967 void do_cmd_redraw(void)
974 /* Hack -- react to changes */
975 Term_xtra(TERM_XTRA_REACT, 0);
978 /* Combine and Reorder the pack (later) */
979 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
983 p_ptr->update |= (PU_TORCH);
985 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
987 /* Forget lite/view */
988 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
990 /* Update lite/view */
991 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
992 p_ptr->update |= (PU_MONSTERS);
994 /* Redraw everything */
995 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
997 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
999 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1003 /* Hack -- update */
1006 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1009 /* Redraw every window */
1010 for (j = 0; j < 8; j++)
1013 if (!angband_term[j]) continue;
1016 Term_activate(angband_term[j]);
1029 * @brief 名前を変更するコマンドのメインルーチン
1030 * Hack -- change name
1033 void do_cmd_change_name(void)
1042 /* Save the screen */
1050 /* Display the player */
1051 display_player(mode);
1056 display_player(mode);
1061 Term_putstr(2, 23, -1, TERM_WHITE,
1062 "['c'で名前変更, 'f'でファイルへ書出, 'h'でモード変更, ESCで終了]");
1064 Term_putstr(2, 23, -1, TERM_WHITE,
1065 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1073 if (c == ESCAPE) break;
1080 /* Process the player name */
1081 process_player_name(FALSE);
1087 sprintf(tmp, "%s.txt", player_base);
1088 if (get_string(_("ファイル名: ", "File name: "), tmp, 80))
1090 if (tmp[0] && (tmp[0] != ' '))
1092 file_character(tmp);
1110 /* Restore the screen */
1113 /* Redraw everything */
1114 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1121 * @brief 最近表示されたメッセージを再表示するコマンドのメインルーチン
1122 * Recall the most recent message
1125 void do_cmd_message_one(void)
1127 /* Recall one message */
1128 prt(format("> %s", message_str(0)), 0, 0);
1133 * @brief メッセージのログを表示するコマンドのメインルーチン
1134 * Recall the most recent message
1138 * Show previous messages to the user -BEN-
1140 * The screen format uses line 0 and 23 for headers and prompts,
1141 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1143 * This command shows you which commands you are viewing, and allows
1144 * you to "search" for strings in the recall.
1146 * Note that messages may be longer than 80 characters, but they are
1147 * displayed using "infinite" length, with a special sub-command to
1148 * "slide" the virtual display to the left or right.
1150 * Attempt to only hilite the matching portions of the string.
1153 void do_cmd_messages(int num_now)
1157 char shower_str[81];
1158 char finder_str[81];
1164 Term_get_size(&wid, &hgt);
1166 /* Number of message lines in a screen */
1167 num_lines = hgt - 4;
1170 strcpy(finder_str, "");
1173 strcpy(shower_str, "");
1175 /* Total messages */
1178 /* Start on first message */
1181 /* Save the screen */
1187 /* Process requests until done */
1193 /* Dump up to 20 lines of messages */
1194 for (j = 0; (j < num_lines) && (i + j < n); j++)
1196 cptr msg = message_str(i+j);
1198 /* Dump the messages, bottom to top */
1199 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1201 /* Hilite "shower" */
1202 if (shower && shower[0])
1206 /* Display matches */
1207 while ((str = my_strstr(str, shower)) != NULL)
1209 int len = strlen(shower);
1211 /* Display the match */
1212 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1220 /* Erase remaining lines */
1221 for (; j < num_lines; j++)
1223 Term_erase(0, num_lines + 1 - j, 255);
1226 /* Display header */
1228 prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"),
1229 i, i + j - 1, n), 0, 0);
1231 /* Display prompt (not very informative) */
1232 prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]",
1233 "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0);
1236 skey = inkey_special(TRUE);
1238 /* Exit on Escape */
1239 if (skey == ESCAPE) break;
1241 /* Hack -- Save the old index */
1246 /* Hack -- handle show */
1249 prt(_("強調: ", "Show: "), hgt - 1, 0);
1251 /* Get a "shower" string, or continue */
1252 strcpy(back_str, shower_str);
1253 if (askfor(shower_str, 80))
1256 shower = shower_str[0] ? shower_str : NULL;
1258 else strcpy(shower_str, back_str);
1262 /* Hack -- handle find */
1269 prt(_("検索: ", "Find: "), hgt - 1, 0);
1271 /* Get a "finder" string, or continue */
1272 strcpy(back_str, finder_str);
1273 if (!askfor(finder_str, 80))
1275 strcpy(finder_str, back_str);
1278 else if (!finder_str[0])
1280 shower = NULL; /* Stop showing */
1285 shower = finder_str;
1288 for (z = i + 1; z < n; z++)
1290 cptr msg = message_str(z);
1293 if (my_strstr(msg, finder_str))
1304 /* Recall 1 older message */
1306 /* Go to the oldest line */
1310 /* Recall 1 newer message */
1312 /* Go to the newest line */
1316 /* Recall 1 older message */
1321 /* Go older if legal */
1322 i = MIN(i + 1, n - num_lines);
1325 /* Recall 10 older messages */
1327 /* Go older if legal */
1328 i = MIN(i + 10, n - num_lines);
1331 /* Recall 20 older messages */
1336 /* Go older if legal */
1337 i = MIN(i + num_lines, n - num_lines);
1340 /* Recall 20 newer messages */
1344 /* Go newer (if able) */
1345 i = MAX(0, i - num_lines);
1348 /* Recall 10 newer messages */
1350 /* Go newer (if able) */
1354 /* Recall 1 newer messages */
1357 /* Go newer (if able) */
1362 /* Hack -- Error of some kind */
1366 /* Restore the screen */
1372 * @brief チートオプションを変更するコマンドのメインルーチン
1373 * Interact with some options for cheating
1374 * @param info 表示メッセージ
1377 static void do_cmd_options_cheat(cptr info)
1380 int i, k = 0, n = CHEAT_MAX;
1386 /* Interact with the player */
1392 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info);
1397 /* 詐欺オプションをうっかりいじってしまう人がいるようなので注意 */
1398 prt(" << 注意 >>", 11, 0);
1399 prt(" 詐欺オプションを一度でも設定すると、スコア記録が残らなくなります!", 12, 0);
1400 prt(" 後に解除してもダメですので、勝利者を目指す方はここのオプションはい", 13, 0);
1401 prt(" じらないようにして下さい。", 14, 0);
1403 /* Display the options */
1404 for (i = 0; i < n; i++)
1406 byte a = TERM_WHITE;
1408 /* Color current option */
1409 if (i == k) a = TERM_L_BLUE;
1411 /* Display the option text */
1412 sprintf(buf, "%-48s: %s (%s)",
1413 cheat_info[i].o_desc,
1414 (*cheat_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1415 cheat_info[i].o_text);
1416 c_prt(a, buf, i + 2, 0);
1419 /* Hilite current option */
1420 move_cursor(k + 2, 50);
1426 * HACK - Try to translate the key into a direction
1427 * to allow using the roguelike keys for navigation.
1429 dir = get_keymap_dir(ch);
1430 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1444 k = (n + k - 1) % n;
1462 do_cmd_write_nikki(NIKKI_BUNSHOU, 0,
1463 _("詐欺オプションをONにして、スコアを残せなくなった。", "give up sending score to use cheating options."));
1464 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1465 (*cheat_info[k].o_var) = TRUE;
1474 (*cheat_info[k].o_var) = FALSE;
1481 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), cheat_info[k].o_text);
1482 /* Peruse the help file */
1483 (void)show_file(TRUE, buf, NULL, 0, 0);
1500 * @brief セーブ頻度ターンの次の値を返す
1501 * @param current 現在のセーブ頻度ターン値
1502 * @return 次のセーブ頻度ターン値
1504 static s16b toggle_frequency(s16b current)
1509 case 50: return 100;
1510 case 100: return 250;
1511 case 250: return 500;
1512 case 500: return 1000;
1513 case 1000: return 2500;
1514 case 2500: return 5000;
1515 case 5000: return 10000;
1516 case 10000: return 25000;
1523 * @brief 自動セーブオプションを変更するコマンドのメインルーチン
1524 * @param info 表示メッセージ
1527 static void do_cmd_options_autosave(cptr info)
1530 int i, k = 0, n = 2;
1537 /* Interact with the player */
1541 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, F で頻度を入力, ESC で決定 ) ",
1542 "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) "), info);
1546 /* Display the options */
1547 for (i = 0; i < n; i++)
1549 byte a = TERM_WHITE;
1551 /* Color current option */
1552 if (i == k) a = TERM_L_BLUE;
1554 /* Display the option text */
1555 sprintf(buf, "%-48s: %s (%s)",
1556 autosave_info[i].o_desc,
1557 (*autosave_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1558 autosave_info[i].o_text);
1559 c_prt(a, buf, i + 2, 0);
1561 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1563 /* Hilite current option */
1564 move_cursor(k + 2, 50);
1580 k = (n + k - 1) % n;
1598 (*autosave_info[k].o_var) = TRUE;
1607 (*autosave_info[k].o_var) = FALSE;
1615 autosave_freq = toggle_frequency(autosave_freq);
1616 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1622 (void)show_file(TRUE, _("joption.txt#Autosave", "option.txt#Autosave"), NULL, 0, 0);
1638 * @brief 標準オプションを変更するコマンドのサブルーチン /
1639 * Interact with some options
1640 * @param page オプションページ番号
1641 * @param info 表示メッセージ
1644 void do_cmd_options_aux(int page, cptr info)
1647 int i, k = 0, n = 0, l;
1650 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1651 (!p_ptr->wizard || !allow_debug_opts);
1654 /* Lookup the options */
1655 for (i = 0; i < 24; i++) opt[i] = 0;
1657 /* Scan the options */
1658 for (i = 0; option_info[i].o_desc; i++)
1660 /* Notice options on this "page" */
1661 if (option_info[i].o_page == page) opt[n++] = i;
1667 /* Interact with the player */
1673 sprintf(buf, _("%s (リターン:次, %sESC:終了, ?:ヘルプ) ", "%s (RET:next, %s, ?:help) "),
1674 info, browse_only ? _("", "ESC:exit") : _("y/n:変更, ", "y/n:change, ESC:accept"));
1677 /* HACK -- description for easy-auto-destroy options */
1678 if (page == OPT_PAGE_AUTODESTROY)
1679 c_prt(TERM_YELLOW, _("以下のオプションは、簡易自動破壊を使用するときのみ有効",
1680 "Following options will protect items from easy auto-destroyer."), 6, _(6, 3));
1682 /* Display the options */
1683 for (i = 0; i < n; i++)
1685 byte a = TERM_WHITE;
1687 /* Color current option */
1688 if (i == k) a = TERM_L_BLUE;
1690 /* Display the option text */
1691 sprintf(buf, "%-48s: %s (%.19s)",
1692 option_info[opt[i]].o_desc,
1693 (*option_info[opt[i]].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1694 option_info[opt[i]].o_text);
1695 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1696 else c_prt(a, buf, i + 2, 0);
1699 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
1702 /* Hilite current option */
1703 move_cursor(k + 2 + l, 50);
1709 * HACK - Try to translate the key into a direction
1710 * to allow using the roguelike keys for navigation.
1712 dir = get_keymap_dir(ch);
1713 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1727 k = (n + k - 1) % n;
1744 if (browse_only) break;
1745 (*option_info[opt[k]].o_var) = TRUE;
1754 if (browse_only) break;
1755 (*option_info[opt[k]].o_var) = FALSE;
1763 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
1769 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), option_info[opt[k]].o_text);
1770 /* Peruse the help file */
1771 (void)show_file(TRUE, buf, NULL, 0, 0);
1788 * @brief ウィンドウオプションを変更するコマンドのメインルーチン /
1789 * Modify the "window" options
1792 static void do_cmd_options_win(void)
1802 /* Memorize old flags */
1803 for (j = 0; j < 8; j++)
1805 /* Acquire current flags */
1806 old_flag[j] = window_flag[j];
1817 prt(_("ウィンドウ・フラグ (<方向>で移動, tでチェンジ, y/n でセット, ESC)", "Window Flags (<dir>, t, y, n, ESC) "), 0, 0);
1819 /* Display the windows */
1820 for (j = 0; j < 8; j++)
1822 byte a = TERM_WHITE;
1824 cptr s = angband_term_name[j];
1827 if (j == x) a = TERM_L_BLUE;
1829 /* Window name, staggered, centered */
1830 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
1833 /* Display the options */
1834 for (i = 0; i < 16; i++)
1836 byte a = TERM_WHITE;
1838 cptr str = window_flag_desc[i];
1841 if (i == y) a = TERM_L_BLUE;
1844 if (!str) str = _("(未使用)", "(Unused option)");
1847 Term_putstr(0, i + 5, -1, a, str);
1849 /* Display the windows */
1850 for (j = 0; j < 8; j++)
1856 if ((i == y) && (j == x)) a = TERM_L_BLUE;
1859 if (window_flag[j] & (1L << i)) c = 'X';
1862 Term_putch(35 + j * 5, i + 5, a, c);
1867 Term_gotoxy(35 + x * 5, y + 5);
1885 for (j = 0; j < 8; j++)
1887 window_flag[j] &= ~(1L << y);
1891 for (i = 0; i < 16; i++)
1893 window_flag[x] &= ~(1L << i);
1906 window_flag[x] |= (1L << y);
1914 window_flag[x] &= ~(1L << y);
1920 (void)show_file(TRUE, _("joption.txt#Window", "option.txt#Window"), NULL, 0, 0);
1928 d = get_keymap_dir(ch);
1930 x = (x + ddx[d] + 8) % 8;
1931 y = (y + ddy[d] + 16) % 16;
1938 /* Notice changes */
1939 for (j = 0; j < 8; j++)
1944 if (!angband_term[j]) continue;
1946 /* Ignore non-changes */
1947 if (window_flag[j] == old_flag[j]) continue;
1950 Term_activate(angband_term[j]);
1973 option_fields[OPT_NUM] =
1976 { '1', " キー入力 オプション", 3 },
1977 { '2', " マップ画面 オプション", 4 },
1978 { '3', " テキスト表示 オプション", 5 },
1979 { '4', " ゲームプレイ オプション", 6 },
1980 { '5', " 行動中止関係 オプション", 7 },
1981 { '6', " 簡易自動破壊 オプション", 8 },
1982 { 'r', " プレイ記録 オプション", 9 },
1984 { 'p', "自動拾いエディタ", 11 },
1985 { 'd', " 基本ウェイト量 ", 12 },
1986 { 'h', "低ヒットポイント", 13 },
1987 { 'm', " 低魔力色閾値 ", 14 },
1988 { 'a', " 自動セーブ オプション", 15 },
1989 { 'w', "ウインドウフラグ", 16 },
1991 { 'b', " 初期 オプション (参照のみ)", 18 },
1992 { 'c', " 詐欺 オプション", 19 },
1994 { '1', "Input Options", 3 },
1995 { '2', "Map Screen Options", 4 },
1996 { '3', "Text Display Options", 5 },
1997 { '4', "Game-Play Options", 6 },
1998 { '5', "Disturbance Options", 7 },
1999 { '6', "Easy Auto-Destroyer Options", 8 },
2000 { 'r', "Play record Options", 9 },
2002 { 'p', "Auto-picker/destroyer editor", 11 },
2003 { 'd', "Base Delay Factor", 12 },
2004 { 'h', "Hitpoint Warning", 13 },
2005 { 'm', "Mana Color Threshold", 14 },
2006 { 'a', "Autosave Options", 15 },
2007 { 'w', "Window Flags", 16 },
2009 { 'b', "Birth Options (Browse Only)", 18 },
2010 { 'c', "Cheat Options", 19 },
2016 * @brief 標準オプションを変更するコマンドのメインルーチン /
2017 * Set or unset various options.
2021 * The user must use the "Ctrl-R" command to "adapt" to changes
2022 * in any options which control "visual" aspects of the game.
2025 void do_cmd_options(void)
2031 /* Save the screen */
2039 /* Does not list cheat option when cheat option is off */
2040 if (!p_ptr->noscore && !allow_debug_opts) n--;
2045 /* Why are we here */
2046 prt(_("[ オプションの設定 ]", "TinyAngband options"), 1, 0);
2050 /* Give some choices */
2051 for (i = 0; i < n; i++)
2053 byte a = TERM_WHITE;
2054 if (i == y) a = TERM_L_BLUE;
2055 Term_putstr(5, option_fields[i].row, -1, a,
2056 format("(%c) %s", toupper(option_fields[i].key), option_fields[i].name));
2059 prt(_("<方向>で移動, Enterで決定, ESCでキャンセル, ?でヘルプ: ", "Move to <dir>, Select to Enter, Cancel to ESC, ? to help: "), 21, 0);
2062 skey = inkey_special(TRUE);
2063 if (!(skey & SKEY_MASK)) k = (char)skey;
2067 if (k == ESCAPE) break;
2069 if (my_strchr("\n\r ", k))
2071 k = option_fields[y].key;
2075 for (i = 0; i < n; i++)
2077 if (tolower(k) == option_fields[i].key) break;
2080 /* Command is found */
2083 /* Hack -- browse help */
2084 if (k == '?') break;
2088 if (skey == SKEY_UP) d = 8;
2089 if (skey == SKEY_DOWN) d = 2;
2090 y = (y + ddy[d] + n) % n;
2095 if (k == ESCAPE) break;
2102 /* Process the general options */
2103 do_cmd_options_aux(OPT_PAGE_INPUT, _("キー入力オプション", "Input Options"));
2109 /* Process the general options */
2110 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, _("マップ画面オプション", "Map Screen Options"));
2117 do_cmd_options_aux(OPT_PAGE_TEXT, _("テキスト表示オプション", "Text Display Options"));
2124 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, _("ゲームプレイ・オプション", "Game-Play Options"));
2131 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, _("行動中止関係のオプション", "Disturbance Options"));
2138 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, _("簡易自動破壊オプション", "Easy Auto-Destroyer Options"));
2142 /* Play-record Options */
2147 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, _("プレイ記録オプション", "Play-record Options"));
2156 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ?
2157 _("初期オプション(参照のみ)", "Birth Options(browse only)") :
2158 _("初期オプション((*)はスコアに影響)", "Birth Options((*)s effect score)"));
2162 /* Cheating Options */
2165 if (!p_ptr->noscore && !allow_debug_opts)
2167 /* Cheat options are not permitted */
2173 do_cmd_options_cheat(_("詐欺師は決して勝利できない!", "Cheaters never win"));
2180 do_cmd_options_autosave(_("自動セーブ", "Autosave"));
2189 do_cmd_options_win();
2190 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2191 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2192 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2193 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON |
2198 /* Auto-picker/destroyer editor */
2202 do_cmd_edit_autopick();
2206 /* Hack -- Delay Speed */
2212 prt(_("コマンド: 基本ウェイト量", "Command: Base Delay Factor"), 19, 0);
2214 /* Get a new value */
2217 int msec = delay_factor * delay_factor * delay_factor;
2218 prt(format(_("現在のウェイト: %d (%dミリ秒)", "Current base delay factor: %d (%d msec)"), delay_factor, msec), 22, 0);
2219 prt(_("ウェイト (0-9) ESCで決定: ", "Delay Factor (0-9 or ESC to accept): "), 20, 0);
2221 if (k == ESCAPE) break;
2224 (void)show_file(TRUE, _("joption.txt#BaseDelay", "option.txt#BaseDelay"), NULL, 0, 0);
2227 else if (isdigit(k)) delay_factor = D2I(k);
2234 /* Hack -- hitpoint warning factor */
2240 prt(_("コマンド: 低ヒットポイント警告", "Command: Hitpoint Warning"), 19, 0);
2242 /* Get a new value */
2245 prt(format(_("現在の低ヒットポイント警告: %d0%%", "Current hitpoint warning: %d0%%"), hitpoint_warn), 22, 0);
2246 prt(_("低ヒットポイント警告 (0-9) ESCで決定: ", "Hitpoint Warning (0-9 or ESC to accept): "), 20, 0);
2248 if (k == ESCAPE) break;
2251 (void)show_file(TRUE, _("joption.txt#Hitpoint", "option.txt#Hitpoint"), NULL, 0, 0);
2254 else if (isdigit(k)) hitpoint_warn = D2I(k);
2261 /* Hack -- mana color factor */
2267 prt(_("コマンド: 低魔力色閾値", "Command: Mana Color Threshold"), 19, 0);
2269 /* Get a new value */
2272 prt(format(_("現在の低魔力色閾値: %d0%%", "Current mana color threshold: %d0%%"), mana_warn), 22, 0);
2273 prt(_("低魔力閾値 (0-9) ESCで決定: ", "Mana color Threshold (0-9 or ESC to accept): "), 20, 0);
2275 if (k == ESCAPE) break;
2278 (void)show_file(TRUE, _("joption.txt#Manapoint", "option.txt#Manapoint"), NULL, 0, 0);
2281 else if (isdigit(k)) mana_warn = D2I(k);
2289 (void)show_file(TRUE, _("joption.txt", "option.txt"), NULL, 0, 0);
2293 /* Unknown option */
2305 /* Restore the screen */
2308 /* Hack - Redraw equippy chars */
2309 p_ptr->redraw |= (PR_EQUIPPY);
2315 * @brief prefファイルを選択して処理する /
2316 * Ask for a "user pref line" and process it
2319 * Allow absolute file names?
2321 void do_cmd_pref(void)
2328 /* Ask for a "user pref command" */
2329 if (!get_string(_("設定変更コマンド: ", "Pref: "), buf, 80)) return;
2331 /* Process that pref command */
2332 (void)process_pref_file_command(buf);
2336 * @brief 自動拾い設定ファイルをロードするコマンドのメインルーチン /
2339 void do_cmd_reload_autopick(void)
2341 if (!get_check(_("自動拾い設定ファイルをロードしますか? ", "Reload auto-pick preference file? "))) return;
2342 /* Load the file with messages */
2343 autopick_load_pref(TRUE);
2349 * @brief マクロ情報をprefファイルに保存する /
2350 * @param fname ファイル名
2353 static errr macro_dump(cptr fname)
2355 static cptr mark = "Macro Dump";
2361 /* Build the filename */
2362 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2364 /* File type is "TEXT" */
2365 FILE_TYPE(FILE_TYPE_TEXT);
2367 /* Append to the file */
2368 if (!open_auto_dump(buf, mark)) return (-1);
2371 auto_dump_printf(_("\n# 自動マクロセーブ\n\n", "\n# Automatic macro dump\n\n"));
2374 for (i = 0; i < macro__num; i++)
2376 /* Extract the action */
2377 ascii_to_text(buf, macro__act[i]);
2379 /* Dump the macro */
2380 auto_dump_printf("A:%s\n", buf);
2382 /* Extract the action */
2383 ascii_to_text(buf, macro__pat[i]);
2385 /* Dump normal macros */
2386 auto_dump_printf("P:%s\n", buf);
2389 auto_dump_printf("\n");
2401 * @brief マクロのトリガーキーを取得する /
2402 * Hack -- ask for a "trigger" (see below)
2403 * @param buf キー表記を保管するバッファ
2407 * Note the complex use of the "inkey()" function from "util.c".
2409 * Note that both "flush()" calls are extremely important.
2412 static void do_cmd_macro_aux(char *buf)
2420 /* Do not process macros */
2426 /* Read the pattern */
2432 /* Do not process macros */
2435 /* Do not wait for keys */
2438 /* Attempt to read a key */
2447 /* Convert the trigger */
2448 ascii_to_text(tmp, buf);
2450 /* Hack -- display the trigger */
2451 Term_addstr(-1, TERM_WHITE, tmp);
2457 * @brief マクロのキー表記からアスキーコードを得てターミナルに表示する /
2458 * Hack -- ask for a keymap "trigger" (see below)
2459 * @param buf キー表記を取得するバッファ
2463 * Note that both "flush()" calls are extremely important. This may
2464 * no longer be true, since "util.c" is much simpler now.
2467 static void do_cmd_macro_aux_keymap(char *buf)
2477 /* Convert to ascii */
2478 ascii_to_text(tmp, buf);
2480 /* Hack -- display the trigger */
2481 Term_addstr(-1, TERM_WHITE, tmp);
2488 * @brief キーマップをprefファイルにダンプする /
2489 * Hack -- append all keymaps to the given file
2490 * @param fname ファイルネーム
2494 static errr keymap_dump(cptr fname)
2496 static cptr mark = "Keymap Dump";
2505 if (rogue_like_commands)
2507 mode = KEYMAP_MODE_ROGUE;
2513 mode = KEYMAP_MODE_ORIG;
2517 /* Build the filename */
2518 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2520 /* File type is "TEXT" */
2521 FILE_TYPE(FILE_TYPE_TEXT);
2523 /* Append to the file */
2524 if (!open_auto_dump(buf, mark)) return -1;
2527 auto_dump_printf(_("\n# 自動キー配置セーブ\n\n", "\n# Automatic keymap dump\n\n"));
2530 for (i = 0; i < 256; i++)
2534 /* Loop up the keymap */
2535 act = keymap_act[mode][i];
2537 /* Skip empty keymaps */
2540 /* Encode the key */
2543 ascii_to_text(key, buf);
2545 /* Encode the action */
2546 ascii_to_text(buf, act);
2548 /* Dump the macro */
2549 auto_dump_printf("A:%s\n", buf);
2550 auto_dump_printf("C:%d:%s\n", mode, key);
2562 * @brief マクロを設定するコマンドのメインルーチン /
2563 * Interact with "macros"
2567 * Note that the macro "action" must be defined before the trigger.
2569 * Could use some helpful instructions on this page.
2572 void do_cmd_macros(void)
2584 if (rogue_like_commands)
2586 mode = KEYMAP_MODE_ROGUE;
2592 mode = KEYMAP_MODE_ORIG;
2595 /* File type is "TEXT" */
2596 FILE_TYPE(FILE_TYPE_TEXT);
2601 /* Process requests until done */
2606 prt(_("[ マクロの設定 ]", "Interact with Macros"), 2, 0);
2608 /* Describe that action */
2609 prt(_("マクロ行動が(もしあれば)下に表示されます:", "Current action (if any) shown below:"), 20, 0);
2611 /* Analyze the current action */
2612 ascii_to_text(buf, macro__buf);
2614 /* Display the current action */
2619 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
2621 prt(_("(2) ファイルにマクロを追加", "(2) Append macros to a file"), 5, 5);
2622 prt(_("(3) マクロの確認", "(3) Query a macro"), 6, 5);
2623 prt(_("(4) マクロの作成", "(4) Create a macro"), 7, 5);
2624 prt(_("(5) マクロの削除", "(5) Remove a macro"), 8, 5);
2625 prt(_("(6) ファイルにキー配置を追加", "(6) Append keymaps to a file"), 9, 5);
2626 prt(_("(7) キー配置の確認", "(7) Query a keymap"), 10, 5);
2627 prt(_("(8) キー配置の作成", "(8) Create a keymap"), 11, 5);
2628 prt(_("(9) キー配置の削除", "(9) Remove a keymap"), 12, 5);
2629 prt(_("(0) マクロ行動の入力", "(0) Enter a new action"), 13, 5);
2630 #endif /* ALLOW_MACROS */
2633 prt(_("コマンド: ", "Command: "), 16, 0);
2639 if (i == ESCAPE) break;
2641 /* Load a 'macro' file */
2647 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 16, 0);
2650 prt(_("ファイル: ", "File: "), 18, 0);
2652 /* Default filename */
2653 sprintf(tmp, "%s.prf", player_base);
2655 /* Ask for a file */
2656 if (!askfor(tmp, 80)) continue;
2658 /* Process the given filename */
2659 err = process_pref_file(tmp);
2662 msg_format(_("標準の設定ファイル'%s'を読み込みました。", "Loaded default '%s'."), tmp);
2667 msg_format(_("'%s'の読み込みに失敗しました!", "Failed to load '%s'!"), tmp);
2671 msg_format(_("'%s'を読み込みました。", "Loaded '%s'."), tmp);
2681 prt(_("コマンド: マクロをファイルに追加する", "Command: Append macros to a file"), 16, 0);
2684 prt(_("ファイル: ", "File: "), 18, 0);
2686 /* Default filename */
2687 sprintf(tmp, "%s.prf", player_base);
2689 /* Ask for a file */
2690 if (!askfor(tmp, 80)) continue;
2692 /* Dump the macros */
2693 (void)macro_dump(tmp);
2696 msg_print(_("マクロを追加しました。", "Appended macros."));
2705 prt(_("コマンド: マクロの確認", "Command: Query a macro"), 16, 0);
2709 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2711 /* Get a macro trigger */
2712 do_cmd_macro_aux(buf);
2714 /* Acquire action */
2715 k = macro_find_exact(buf);
2721 msg_print(_("そのキーにはマクロは定義されていません。", "Found no macro."));
2727 /* Obtain the action */
2728 strcpy(macro__buf, macro__act[k]);
2730 /* Analyze the current action */
2731 ascii_to_text(buf, macro__buf);
2733 /* Display the current action */
2737 msg_print(_("マクロを確認しました。", "Found a macro."));
2741 /* Create a macro */
2745 prt(_("コマンド: マクロの作成", "Command: Create a macro"), 16, 0);
2748 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2750 /* Get a macro trigger */
2751 do_cmd_macro_aux(buf);
2757 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2758 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2761 prt(_("マクロ行動: ", "Action: "), 20, 0);
2763 /* Convert to text */
2764 ascii_to_text(tmp, macro__buf);
2766 /* Get an encoded action */
2767 if (askfor(tmp, 80))
2769 /* Convert to ascii */
2770 text_to_ascii(macro__buf, tmp);
2772 /* Link the macro */
2773 macro_add(buf, macro__buf);
2776 msg_print(_("マクロを追加しました。", "Added a macro."));
2780 /* Remove a macro */
2784 prt(_("コマンド: マクロの削除", "Command: Remove a macro"), 16, 0);
2787 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2789 /* Get a macro trigger */
2790 do_cmd_macro_aux(buf);
2792 /* Link the macro */
2793 macro_add(buf, buf);
2796 msg_print(_("マクロを削除しました。", "Removed a macro."));
2803 prt(_("コマンド: キー配置をファイルに追加する", "Command: Append keymaps to a file"), 16, 0);
2806 prt(_("ファイル: ", "File: "), 18, 0);
2808 /* Default filename */
2809 sprintf(tmp, "%s.prf", player_base);
2811 /* Ask for a file */
2812 if (!askfor(tmp, 80)) continue;
2814 /* Dump the macros */
2815 (void)keymap_dump(tmp);
2818 msg_print(_("キー配置を追加しました。", "Appended keymaps."));
2821 /* Query a keymap */
2827 prt(_("コマンド: キー配置の確認", "Command: Query a keymap"), 16, 0);
2830 prt(_("押すキー: ", "Keypress: "), 18, 0);
2832 /* Get a keymap trigger */
2833 do_cmd_macro_aux_keymap(buf);
2835 /* Look up the keymap */
2836 act = keymap_act[mode][(byte)(buf[0])];
2842 msg_print(_("キー配置は定義されていません。", "Found no keymap."));
2848 /* Obtain the action */
2849 strcpy(macro__buf, act);
2851 /* Analyze the current action */
2852 ascii_to_text(buf, macro__buf);
2854 /* Display the current action */
2858 msg_print(_("キー配置を確認しました。", "Found a keymap."));
2862 /* Create a keymap */
2866 prt(_("コマンド: キー配置の作成", "Command: Create a keymap"), 16, 0);
2869 prt(_("押すキー: ", "Keypress: "), 18, 0);
2871 /* Get a keymap trigger */
2872 do_cmd_macro_aux_keymap(buf);
2878 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2879 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2882 prt(_("行動: ", "Action: "), 20, 0);
2884 /* Convert to text */
2885 ascii_to_text(tmp, macro__buf);
2887 /* Get an encoded action */
2888 if (askfor(tmp, 80))
2890 /* Convert to ascii */
2891 text_to_ascii(macro__buf, tmp);
2893 /* Free old keymap */
2894 string_free(keymap_act[mode][(byte)(buf[0])]);
2896 /* Make new keymap */
2897 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
2900 msg_print(_("キー配置を追加しました。", "Added a keymap."));
2904 /* Remove a keymap */
2908 prt(_("コマンド: キー配置の削除", "Command: Remove a keymap"), 16, 0);
2911 prt(_("押すキー: ", "Keypress: "), 18, 0);
2913 /* Get a keymap trigger */
2914 do_cmd_macro_aux_keymap(buf);
2916 /* Free old keymap */
2917 string_free(keymap_act[mode][(byte)(buf[0])]);
2919 /* Make new keymap */
2920 keymap_act[mode][(byte)(buf[0])] = NULL;
2923 msg_print(_("キー配置を削除しました。", "Removed a keymap."));
2926 /* Enter a new action */
2930 prt(_("コマンド: マクロ行動の入力", "Command: Enter a new action"), 16, 0);
2936 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2937 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2940 prt(_("マクロ行動: ", "Action: "), 20, 0);
2942 /* Hack -- limit the value */
2945 /* Get an encoded action */
2946 if (!askfor(buf, 80)) continue;
2948 /* Extract an action */
2949 text_to_ascii(macro__buf, buf);
2952 #endif /* ALLOW_MACROS */
2965 * @brief キャラクタ色の明暗表現
2967 static cptr lighting_level_str[F_LIT_MAX] =
2982 * @brief キャラクタのビジュアルIDを変更する際の対象指定関数
2983 * @param i 指定対象となるキャラクタコード
2984 * @param num 指定されたビジュアルIDを返す参照ポインタ
2985 * @param max ビジュアルIDの最大数
2986 * @return 指定が実際に行われた場合TRUE、キャンセルされた場合FALSE
2988 static bool cmd_visuals_aux(int i, IDX *num, IDX max)
2995 sprintf(str, "%d", *num);
2997 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3000 tmp = (IDX)strtol(str, NULL, 0);
3001 if (tmp >= 0 && tmp < max)
3004 else if (isupper(i))
3005 *num = (*num + max - 1) % max;
3007 *num = (*num + 1) % max;
3013 * @brief キャラクタの変更メニュー表示
3014 * @param choice_msg 選択メッセージ
3017 static void print_visuals_menu(cptr choice_msg)
3019 prt(_("[ 画面表示の設定 ]", "Interact with Visuals"), 1, 0);
3021 /* Give some choices */
3022 prt(_("(0) ユーザー設定ファイルのロード", "(0) Load a user pref file"), 3, 5);
3024 #ifdef ALLOW_VISUALS
3025 prt(_("(1) モンスターの 色/文字 をファイルに書き出す", "(1) Dump monster attr/chars"), 4, 5);
3026 prt(_("(2) アイテムの 色/文字 をファイルに書き出す", "(2) Dump object attr/chars"), 5, 5);
3027 prt(_("(3) 地形の 色/文字 をファイルに書き出す", "(3) Dump feature attr/chars"), 6, 5);
3028 prt(_("(4) モンスターの 色/文字 を変更する (数値操作)", "(4) Change monster attr/chars (numeric operation)"), 7, 5);
3029 prt(_("(5) アイテムの 色/文字 を変更する (数値操作)", "(5) Change object attr/chars (numeric operation)"), 8, 5);
3030 prt(_("(6) 地形の 色/文字 を変更する (数値操作)", "(6) Change feature attr/chars (numeric operation)"), 9, 5);
3031 prt(_("(7) モンスターの 色/文字 を変更する (シンボルエディタ)", "(7) Change monster attr/chars (visual mode)"), 10, 5);
3032 prt(_("(8) アイテムの 色/文字 を変更する (シンボルエディタ)", "(8) Change object attr/chars (visual mode)"), 11, 5);
3033 prt(_("(9) 地形の 色/文字 を変更する (シンボルエディタ)", "(9) Change feature attr/chars (visual mode)"), 12, 5);
3034 #endif /* ALLOW_VISUALS */
3036 prt(_("(R) 画面表示方法の初期化", "(R) Reset visuals"), 13, 5);
3039 prt(format("コマンド: %s", choice_msg ? choice_msg : _("", "")), 15, 0);
3042 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx);
3043 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx);
3044 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level);
3047 * Interact with "visuals"
3049 void do_cmd_visuals(void)
3054 bool need_redraw = FALSE;
3055 const char *empty_symbol = "<< ? >>";
3057 if (use_bigtile) empty_symbol = "<< ?? >>";
3059 /* File type is "TEXT" */
3060 FILE_TYPE(FILE_TYPE_TEXT);
3062 /* Save the screen */
3065 /* Interact until done */
3071 /* Ask for a choice */
3072 print_visuals_menu(NULL);
3077 if (i == ESCAPE) break;
3081 /* Load a 'pref' file */
3084 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 15, 0);
3087 prt(_("ファイル: ", "File: "), 17, 0);
3089 /* Default filename */
3090 sprintf(tmp, "%s.prf", player_base);
3093 if (!askfor(tmp, 70)) continue;
3095 /* Process the given filename */
3096 (void)process_pref_file(tmp);
3101 #ifdef ALLOW_VISUALS
3103 /* Dump monster attr/chars */
3106 static cptr mark = "Monster attr/chars";
3109 prt(_("コマンド: モンスターの[色/文字]をファイルに書き出します", "Command: Dump monster attr/chars"), 15, 0);
3112 prt(_("ファイル: ", "File: "), 17, 0);
3114 /* Default filename */
3115 sprintf(tmp, "%s.prf", player_base);
3117 /* Get a filename */
3118 if (!askfor(tmp, 70)) continue;
3120 /* Build the filename */
3121 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3123 /* Append to the file */
3124 if (!open_auto_dump(buf, mark)) continue;
3127 auto_dump_printf(_("\n# モンスターの[色/文字]の設定\n\n", "\n# Monster attr/char definitions\n\n"));
3130 for (i = 0; i < max_r_idx; i++)
3132 monster_race *r_ptr = &r_info[i];
3134 /* Skip non-entries */
3135 if (!r_ptr->name) continue;
3137 /* Dump a comment */
3138 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3140 /* Dump the monster attr/char info */
3141 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3142 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3148 msg_print(_("モンスターの[色/文字]をファイルに書き出しました。", "Dumped monster attr/chars."));
3153 /* Dump object attr/chars */
3156 static cptr mark = "Object attr/chars";
3157 KIND_OBJECT_IDX k_idx;
3160 prt(_("コマンド: アイテムの[色/文字]をファイルに書き出します", "Command: Dump object attr/chars"), 15, 0);
3163 prt(_("ファイル: ", "File: "), 17, 0);
3165 /* Default filename */
3166 sprintf(tmp, "%s.prf", player_base);
3168 /* Get a filename */
3169 if (!askfor(tmp, 70)) continue;
3171 /* Build the filename */
3172 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3174 /* Append to the file */
3175 if (!open_auto_dump(buf, mark)) continue;
3178 auto_dump_printf(_("\n# アイテムの[色/文字]の設定\n\n", "\n# Object attr/char definitions\n\n"));
3181 for (k_idx = 0; k_idx < max_k_idx; k_idx++)
3184 object_kind *k_ptr = &k_info[k_idx];
3186 /* Skip non-entries */
3187 if (!k_ptr->name) continue;
3192 strip_name(o_name, k_idx);
3198 /* Prepare dummy object */
3199 object_prep(&forge, k_idx);
3201 /* Get un-shuffled flavor name */
3202 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3205 /* Dump a comment */
3206 auto_dump_printf("# %s\n", o_name);
3208 /* Dump the object attr/char info */
3209 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", (int)k_idx,
3210 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3216 msg_print(_("アイテムの[色/文字]をファイルに書き出しました。", "Dumped object attr/chars."));
3221 /* Dump feature attr/chars */
3224 static cptr mark = "Feature attr/chars";
3227 prt(_("コマンド: 地形の[色/文字]をファイルに書き出します", "Command: Dump feature attr/chars"), 15, 0);
3230 prt(_("ファイル: ", "File: "), 17, 0);
3232 /* Default filename */
3233 sprintf(tmp, "%s.prf", player_base);
3235 /* Get a filename */
3236 if (!askfor(tmp, 70)) continue;
3238 /* Build the filename */
3239 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3241 /* Append to the file */
3242 if (!open_auto_dump(buf, mark)) continue;
3245 auto_dump_printf(_("\n# 地形の[色/文字]の設定\n\n", "\n# Feature attr/char definitions\n\n"));
3248 for (i = 0; i < max_f_idx; i++)
3250 feature_type *f_ptr = &f_info[i];
3252 /* Skip non-entries */
3253 if (!f_ptr->name) continue;
3255 /* Skip mimiccing features */
3256 if (f_ptr->mimic != i) continue;
3258 /* Dump a comment */
3259 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3261 /* Dump the feature attr/char info */
3262 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
3263 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
3264 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
3265 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
3271 msg_print(_("地形の[色/文字]をファイルに書き出しました。", "Dumped feature attr/chars."));
3276 /* Modify monster attr/chars (numeric operation) */
3279 static cptr choice_msg = _("モンスターの[色/文字]を変更します", "Change monster attr/chars");
3282 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3284 /* Hack -- query until done */
3287 monster_race *r_ptr = &r_info[r];
3291 TERM_COLOR da = r_ptr->d_attr;
3292 byte dc = r_ptr->d_char;
3293 TERM_COLOR ca = r_ptr->x_attr;
3294 byte cc = r_ptr->x_char;
3296 /* Label the object */
3297 Term_putstr(5, 17, -1, TERM_WHITE,
3298 format(_("モンスター = %d, 名前 = %-40.40s", "Monster = %d, Name = %-40.40s"), r, (r_name + r_ptr->name)));
3300 /* Label the Default values */
3301 Term_putstr(10, 19, -1, TERM_WHITE,
3302 format(_("初期値 色 / 文字 = %3u / %3u", "Default attr/char = %3u / %3u"), da, dc));
3304 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3305 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3307 /* Label the Current values */
3308 Term_putstr(10, 20, -1, TERM_WHITE,
3309 format(_("現在値 色 / 文字 = %3u / %3u", "Current attr/char = %3u / %3u"), ca, cc));
3311 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3312 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3315 Term_putstr(0, 22, -1, TERM_WHITE,
3316 _("コマンド (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): "));
3322 if (i == ESCAPE) break;
3324 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3325 else if (isupper(i)) c = 'a' + i - 'A';
3335 if (!cmd_visuals_aux(i, &r, max_r_idx))
3341 while (!r_info[r].name);
3345 t = (int)r_ptr->x_attr;
3346 (void)cmd_visuals_aux(i, &t, 256);
3347 r_ptr->x_attr = (byte)t;
3351 t = (int)r_ptr->x_char;
3352 (void)cmd_visuals_aux(i, &t, 256);
3353 r_ptr->x_char = (byte)t;
3357 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
3361 print_visuals_menu(choice_msg);
3369 /* Modify object attr/chars (numeric operation) */
3372 static cptr choice_msg = _("アイテムの[色/文字]を変更します", "Change object attr/chars");
3374 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3376 /* Hack -- query until done */
3379 object_kind *k_ptr = &k_info[k];
3383 TERM_COLOR da = k_ptr->d_attr;
3384 SYMBOL_CODE dc = k_ptr->d_char;
3385 TERM_COLOR ca = k_ptr->x_attr;
3386 SYMBOL_CODE cc = k_ptr->x_char;
3388 /* Label the object */
3389 Term_putstr(5, 17, -1, TERM_WHITE,
3390 format(_("アイテム = %d, 名前 = %-40.40s", "Object = %d, Name = %-40.40s"),
3391 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
3393 /* Label the Default values */
3394 Term_putstr(10, 19, -1, TERM_WHITE,
3395 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3397 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3398 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3400 /* Label the Current values */
3401 Term_putstr(10, 20, -1, TERM_WHITE,
3402 format(_("現在値 色 / 文字 = %3d / %3d", "Current attr/char = %3d / %3d"), ca, cc));
3404 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3405 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3408 Term_putstr(0, 22, -1, TERM_WHITE,
3409 _("コマンド (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): "));
3415 if (i == ESCAPE) break;
3417 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3418 else if (isupper(i)) c = 'a' + i - 'A';
3428 if (!cmd_visuals_aux(i, &k, max_k_idx))
3434 while (!k_info[k].name);
3438 t = (int)k_ptr->x_attr;
3439 (void)cmd_visuals_aux(i, &t, 256);
3440 k_ptr->x_attr = (byte)t;
3444 t = (int)k_ptr->x_char;
3445 (void)cmd_visuals_aux(i, &t, 256);
3446 k_ptr->x_char = (byte)t;
3450 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
3454 print_visuals_menu(choice_msg);
3462 /* Modify feature attr/chars (numeric operation) */
3465 static cptr choice_msg = _("地形の[色/文字]を変更します", "Change feature attr/chars");
3467 static IDX lighting_level = F_LIT_STANDARD;
3468 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3470 /* Hack -- query until done */
3473 feature_type *f_ptr = &f_info[f];
3477 TERM_COLOR da = f_ptr->d_attr[lighting_level];
3478 byte dc = f_ptr->d_char[lighting_level];
3479 TERM_COLOR ca = f_ptr->x_attr[lighting_level];
3480 byte cc = f_ptr->x_char[lighting_level];
3482 /* Label the object */
3484 Term_putstr(5, 17, -1, TERM_WHITE,
3485 format(_("地形 = %d, 名前 = %s, 明度 = %s", "Terrain = %d, Name = %s, Lighting = %s"),
3486 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
3488 /* Label the Default values */
3489 Term_putstr(10, 19, -1, TERM_WHITE,
3490 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3492 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3493 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3495 /* Label the Current values */
3497 Term_putstr(10, 20, -1, TERM_WHITE,
3498 format("現在値 色 / 文字 = %3d / %3d", ca, cc));
3500 Term_putstr(10, 20, -1, TERM_WHITE,
3501 format("Current attr/char = %3d / %3d", ca, cc));
3504 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3505 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3509 Term_putstr(0, 22, -1, TERM_WHITE,
3510 "コマンド (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3512 Term_putstr(0, 22, -1, TERM_WHITE,
3513 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3520 if (i == ESCAPE) break;
3522 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3523 else if (isupper(i)) c = 'a' + i - 'A';
3533 if (!cmd_visuals_aux(i, &f, max_f_idx))
3539 while (!f_info[f].name || (f_info[f].mimic != f));
3543 t = (int)f_ptr->x_attr[lighting_level];
3544 (void)cmd_visuals_aux(i, &t, 256);
3545 f_ptr->x_attr[lighting_level] = (byte)t;
3549 t = (int)f_ptr->x_char[lighting_level];
3550 (void)cmd_visuals_aux(i, &t, 256);
3551 f_ptr->x_char[lighting_level] = (byte)t;
3555 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
3558 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
3562 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
3566 print_visuals_menu(choice_msg);
3574 /* Modify monster attr/chars (visual mode) */
3576 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
3579 /* Modify object attr/chars (visual mode) */
3581 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
3584 /* Modify feature attr/chars (visual mode) */
3587 IDX lighting_level = F_LIT_STANDARD;
3588 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
3592 #endif /* ALLOW_VISUALS */
3600 msg_print(_("画面上の[色/文字]を初期値にリセットしました。", "Visual attr/char tables reset."));
3604 /* Unknown option */
3613 /* Restore the screen */
3616 if (need_redraw) do_cmd_redraw();
3621 * Interact with "colors"
3623 void do_cmd_colors(void)
3632 /* File type is "TEXT" */
3633 FILE_TYPE(FILE_TYPE_TEXT);
3636 /* Save the screen */
3640 /* Interact until done */
3646 /* Ask for a choice */
3647 prt(_("[ カラーの設定 ]", "Interact with Colors"), 2, 0);
3649 /* Give some choices */
3650 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
3653 prt(_("(2) カラーの設定をファイルに書き出す", "(2) Dump colors"), 5, 5);
3654 prt(_("(3) カラーの設定を変更する", "(3) Modify colors"), 6, 5);
3658 prt(_("コマンド: ", "Command: "), 8, 0);
3662 if (i == ESCAPE) break;
3664 /* Load a 'pref' file */
3668 prt(_("コマンド: ユーザー設定ファイルをロードします", "Command: Load a user pref file"), 8, 0);
3671 prt(_("ファイル: ", "File: "), 10, 0);
3674 sprintf(tmp, "%s.prf", player_base);
3677 if (!askfor(tmp, 70)) continue;
3679 /* Process the given filename */
3680 (void)process_pref_file(tmp);
3682 /* Mega-Hack -- react to changes */
3683 Term_xtra(TERM_XTRA_REACT, 0);
3685 /* Mega-Hack -- redraw */
3694 static cptr mark = "Colors";
3697 prt(_("コマンド: カラーの設定をファイルに書き出します", "Command: Dump colors"), 8, 0);
3700 prt(_("ファイル: ", "File: "), 10, 0);
3702 /* Default filename */
3703 sprintf(tmp, "%s.prf", player_base);
3705 /* Get a filename */
3706 if (!askfor(tmp, 70)) continue;
3708 /* Build the filename */
3709 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3711 /* Append to the file */
3712 if (!open_auto_dump(buf, mark)) continue;
3715 auto_dump_printf(_("\n# カラーの設定\n\n", "\n# Color redefinitions\n\n"));
3718 for (i = 0; i < 256; i++)
3720 int kv = angband_color_table[i][0];
3721 int rv = angband_color_table[i][1];
3722 int gv = angband_color_table[i][2];
3723 int bv = angband_color_table[i][3];
3725 cptr name = _("未知", "unknown");
3727 /* Skip non-entries */
3728 if (!kv && !rv && !gv && !bv) continue;
3730 /* Extract the color name */
3731 if (i < 16) name = color_names[i];
3733 /* Dump a comment */
3734 auto_dump_printf(_("# カラー '%s'\n", "# Color '%s'\n"), name);
3736 /* Dump the monster attr/char info */
3737 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
3744 msg_print(_("カラーの設定をファイルに書き出しました。", "Dumped color redefinitions."));
3753 prt(_("コマンド: カラーの設定を変更します", "Command: Modify colors"), 8, 0);
3755 /* Hack -- query until done */
3764 /* Exhibit the normal colors */
3765 for (j = 0; j < 16; j++)
3767 /* Exhibit this color */
3768 Term_putstr(j*4, 20, -1, a, "###");
3770 /* Exhibit all colors */
3771 Term_putstr(j*4, 22, -1, j, format("%3d", j));
3774 /* Describe the color */
3775 name = ((a < 16) ? color_names[a] : _("未定義", "undefined"));
3777 /* Describe the color */
3778 Term_putstr(5, 10, -1, TERM_WHITE,
3779 format(_("カラー = %d, 名前 = %s", "Color = %d, Name = %s"), a, name));
3781 /* Label the Current values */
3782 Term_putstr(5, 12, -1, TERM_WHITE,
3783 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
3784 angband_color_table[a][0],
3785 angband_color_table[a][1],
3786 angband_color_table[a][2],
3787 angband_color_table[a][3]));
3790 Term_putstr(0, 14, -1, TERM_WHITE,
3791 _("コマンド (n/N/k/K/r/R/g/G/b/B): ", "Command (n/N/k/K/r/R/g/G/b/B): "));
3798 if (i == ESCAPE) break;
3801 if (i == 'n') a = (byte)(a + 1);
3802 if (i == 'N') a = (byte)(a - 1);
3803 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
3804 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
3805 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
3806 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
3807 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
3808 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
3809 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
3810 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
3812 /* Hack -- react to changes */
3813 Term_xtra(TERM_XTRA_REACT, 0);
3815 /* Hack -- redraw */
3822 /* Unknown option */
3832 /* Restore the screen */
3838 * Note something in the message recall
3840 void do_cmd_note(void)
3848 if (!get_string(_("メモ: ", "Note: "), buf, 60)) return;
3850 /* Ignore empty notes */
3851 if (!buf[0] || (buf[0] == ' ')) return;
3853 /* Add the note to the message recall */
3854 msg_format(_("メモ: %s", "Note: %s"), buf);
3859 * Mention the current version
3861 void do_cmd_version(void)
3865 #if FAKE_VER_EXTRA > 0
3866 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d.%d", "You are playing Hengband %d.%d.%d.%d."),
3867 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
3869 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d", "You are playing Hengband %d.%d.%d."),
3870 FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
3877 * Array of feeling strings
3879 static cptr do_cmd_feeling_text[11] =
3881 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3882 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3883 _("恐ろしい死の幻が目に浮かび、気絶しそうになった!", "You nearly faint as horrible visions of death fill your mind!"),
3884 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3885 _("とても悪い予感がする...", "You have a very bad feeling..."),
3886 _("悪い予感がする...", "You have a bad feeling..."),
3887 _("何か緊張する。", "You feel nervous."),
3888 _("少し不運な気がする...", "You feel your luck is turning..."),
3889 _("この場所は好きになれない。", "You don't like the look of this place."),
3890 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3891 _("なんて退屈なところだ...", "What a boring place...")
3894 static cptr do_cmd_feeling_text_combat[11] =
3896 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3897 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3898 _("今夜もまた、誰かが命を落とす...", "You nearly faint as horrible visions of death fill your mind!"),
3899 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3900 _("とても悪い予感がする...", "You have a very bad feeling..."),
3901 _("悪い予感がする...", "You have a bad feeling..."),
3902 _("何か緊張する。", "You feel nervous."),
3903 _("少し不運な気がする...", "You feel your luck is turning..."),
3904 _("この場所は好きになれない。", "You don't like the look of this place."),
3905 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3906 _("なんて退屈なところだ...", "What a boring place...")
3909 static cptr do_cmd_feeling_text_lucky[11] =
3911 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3912 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3913 _("この階はこの上なく素晴らしい感じがする。", "You have a superb feeling about this level."),
3914 _("素晴らしい感じがする...", "You have an excellent feeling..."),
3915 _("とても良い感じがする...", "You have a very good feeling..."),
3916 _("良い感じがする...", "You have a good feeling..."),
3917 _("ちょっと幸運な感じがする...", "You feel strangely lucky..."),
3918 _("多少は運が向いてきたか...", "You feel your luck is turning..."),
3919 _("見た感じ悪くはない...", "You like the look of this place..."),
3920 _("全然駄目ということはないが...", "This level can't be all bad..."),
3921 _("なんて退屈なところだ...", "What a boring place...")
3926 * Note that "feeling" is set to zero unless some time has passed.
3927 * Note that this is done when the level is GENERATED, not entered.
3929 void do_cmd_feeling(void)
3931 /* No useful feeling in quests */
3932 if (p_ptr->inside_quest && !random_quest_number(dun_level))
3934 msg_print(_("典型的なクエストのダンジョンのようだ。", "Looks like a typical quest level."));
3938 /* No useful feeling in town */
3939 else if (p_ptr->town_num && !dun_level)
3941 if (!strcmp(town[p_ptr->town_num].name, _("荒野", "wilderness")))
3943 msg_print(_("何かありそうな荒野のようだ。", "Looks like a strange wilderness."));
3948 msg_print(_("典型的な町のようだ。", "Looks like a typical town."));
3953 /* No useful feeling in the wilderness */
3954 else if (!dun_level)
3956 msg_print(_("典型的な荒野のようだ。", "Looks like a typical wilderness."));
3960 /* Display the feeling */
3961 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
3962 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
3963 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
3964 inventory[INVEN_BOW].name1 == ART_CRIMSON)
3965 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
3967 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
3973 * Description of each monster group.
3975 static cptr monster_group_text[] =
3978 "ユニーク", /* "Uniques" */
3979 "乗馬可能なモンスター", /* "Riding" */
3980 "賞金首", /* "Wanted */
3981 "アンバーの王族", /* "Ambertite" */
4010 /* "古代ドラゴン/ワイアーム", */
4071 /* "Ancient Dragon/Wyrm", */
4080 "Multi-Headed Reptile",
4085 "Reptile/Amphibian",
4086 "Spider/Scorpion/Tick",
4088 /* "Major Demon", */
4105 * Symbols of monsters in each group. Note the "Uniques" group
4106 * is handled differently.
4108 static cptr monster_group_char[] =
4165 "!$&()+./=>?[\\]`{|~",
4175 * hook function to sort monsters by level
4177 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
4179 u16b *who = (u16b*)(u);
4184 monster_race *r_ptr1 = &r_info[w1];
4185 monster_race *r_ptr2 = &r_info[w2];
4190 if (r_ptr2->level > r_ptr1->level) return TRUE;
4191 if (r_ptr1->level > r_ptr2->level) return FALSE;
4193 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
4194 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
4199 * Build a list of monster indexes in the given group. Return the number
4200 * of monsters in the group.
4202 * mode & 0x01 : check for non-empty group
4203 * mode & 0x02 : visual operation only
4205 static IDX collect_monsters(IDX grp_cur, IDX mon_idx[], BIT_FLAGS8 mode)
4211 /* Get a list of x_char in this group */
4212 cptr group_char = monster_group_char[grp_cur];
4214 /* XXX Hack -- Check if this is the "Uniques" group */
4215 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
4217 /* XXX Hack -- Check if this is the "Riding" group */
4218 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
4220 /* XXX Hack -- Check if this is the "Wanted" group */
4221 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
4223 /* XXX Hack -- Check if this is the "Amberite" group */
4224 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
4227 /* Check every race */
4228 for (i = 0; i < max_r_idx; i++)
4230 /* Access the race */
4231 monster_race *r_ptr = &r_info[i];
4233 /* Skip empty race */
4234 if (!r_ptr->name) continue ;
4236 /* Require known monsters */
4237 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
4241 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
4244 else if (grp_riding)
4246 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
4249 else if (grp_wanted)
4251 bool wanted = FALSE;
4253 for (j = 0; j < MAX_KUBI; j++)
4255 if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
4256 (p_ptr->today_mon && p_ptr->today_mon == i))
4262 if (!wanted) continue;
4265 else if (grp_amberite)
4267 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
4272 /* Check for race in the group */
4273 if (!my_strchr(group_char, r_ptr->d_char)) continue;
4277 mon_idx[mon_cnt++] = i;
4279 /* XXX Hack -- Just checking for non-empty group */
4280 if (mode & 0x01) break;
4283 /* Terminate the list */
4284 mon_idx[mon_cnt] = -1;
4286 /* Select the sort method */
4287 ang_sort_comp = ang_sort_comp_monster_level;
4288 ang_sort_swap = ang_sort_swap_hook;
4290 /* Sort by monster level */
4291 ang_sort(mon_idx, &dummy_why, mon_cnt);
4293 /* Return the number of races */
4299 * Description of each monster group.
4301 static cptr object_group_text[] =
4304 "キノコ", /* "Mushrooms" */
4305 "薬", /* "Potions" */
4306 "油つぼ", /* "Flasks" */
4307 "巻物", /* "Scrolls" */
4309 "アミュレット", /* "Amulets" */
4310 "笛", /* "Whistle" */
4311 "光源", /* "Lanterns" */
4312 "魔法棒", /* "Wands" */
4315 "カード", /* "Cards" */
4326 "刀剣類", /* "Swords" */
4327 "鈍器", /* "Blunt Weapons" */
4328 "長柄武器", /* "Polearms" */
4329 "採掘道具", /* "Diggers" */
4330 "飛び道具", /* "Bows" */
4334 "軽装鎧", /* "Soft Armor" */
4335 "重装鎧", /* "Hard Armor" */
4336 "ドラゴン鎧", /* "Dragon Armor" */
4337 "盾", /* "Shields" */
4338 "クローク", /* "Cloaks" */
4339 "籠手", /* "Gloves" */
4340 "ヘルメット", /* "Helms" */
4342 "ブーツ", /* "Boots" */
4395 * TVALs of items in each group
4397 static byte object_group_tval[] =
4438 TV_LIFE_BOOK, /* Hack -- all spellbooks */
4446 * Build a list of object indexes in the given group. Return the number
4447 * of objects in the group.
4449 * mode & 0x01 : check for non-empty group
4450 * mode & 0x02 : visual operation only
4452 static int collect_objects(int grp_cur, IDX object_idx[], BIT_FLAGS8 mode)
4455 int j, k, object_cnt = 0;
4457 /* Get a list of x_char in this group */
4458 byte group_tval = object_group_tval[grp_cur];
4460 /* Check every object */
4461 for (i = 0; i < max_k_idx; i++)
4463 /* Access the object */
4464 object_kind *k_ptr = &k_info[i];
4466 /* Skip empty objects */
4467 if (!k_ptr->name) continue;
4471 /* Any objects will be displayed */
4477 /* Skip non-flavoured objects */
4478 if (!k_ptr->flavor) continue;
4480 /* Require objects ever seen */
4481 if (!k_ptr->aware) continue;
4484 /* Skip items with no distribution (special artifacts) */
4485 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
4489 /* Check for objects in the group */
4490 if (TV_LIFE_BOOK == group_tval)
4492 /* Hack -- All spell books */
4493 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HEX_BOOK)
4495 /* Add the object */
4496 object_idx[object_cnt++] = i;
4500 else if (k_ptr->tval == group_tval)
4502 /* Add the object */
4503 object_idx[object_cnt++] = i;
4507 /* XXX Hack -- Just checking for non-empty group */
4508 if (mode & 0x01) break;
4511 /* Terminate the list */
4512 object_idx[object_cnt] = -1;
4514 /* Return the number of objects */
4520 * Description of each feature group.
4522 static cptr feature_group_text[] =
4530 * Build a list of feature indexes in the given group. Return the number
4531 * of features in the group.
4533 * mode & 0x01 : check for non-empty group
4535 static int collect_features(int grp_cur, IDX *feat_idx, BIT_FLAGS8 mode)
4540 /* Unused; There is a single group. */
4543 /* Check every feature */
4544 for (i = 0; i < max_f_idx; i++)
4546 /* Access the index */
4547 feature_type *f_ptr = &f_info[i];
4549 /* Skip empty index */
4550 if (!f_ptr->name) continue;
4552 /* Skip mimiccing features */
4553 if (f_ptr->mimic != i) continue;
4556 feat_idx[feat_cnt++] = i;
4558 /* XXX Hack -- Just checking for non-empty group */
4559 if (mode & 0x01) break;
4562 /* Terminate the list */
4563 feat_idx[feat_cnt] = -1;
4565 /* Return the number of races */
4572 * Build a list of monster indexes in the given group. Return the number
4573 * of monsters in the group.
4575 static int collect_artifacts(int grp_cur, int object_idx[])
4577 int i, object_cnt = 0;
4579 /* Get a list of x_char in this group */
4580 byte group_tval = object_group_tval[grp_cur];
4582 /* Check every object */
4583 for (i = 0; i < max_a_idx; i++)
4585 /* Access the artifact */
4586 artifact_type *a_ptr = &a_info[i];
4588 /* Skip empty artifacts */
4589 if (!a_ptr->name) continue;
4591 /* Skip "uncreated" artifacts */
4592 if (!a_ptr->cur_num) continue;
4594 /* Check for race in the group */
4595 if (a_ptr->tval == group_tval)
4598 object_idx[object_cnt++] = i;
4602 /* Terminate the list */
4603 object_idx[object_cnt] = 0;
4605 /* Return the number of races */
4612 * Encode the screen colors
4614 static char hack[17] = "dwsorgbuDWvyRGBU";
4618 * Hack -- load a screen dump from a file
4620 void do_cmd_load_screen(void)
4635 Term_get_size(&wid, &hgt);
4637 /* Build the filename */
4638 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
4640 /* Append to the file */
4641 fff = my_fopen(buf, "r");
4644 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
4650 /* Save the screen */
4653 /* Clear the screen */
4657 /* Load the screen */
4658 for (y = 0; okay; y++)
4660 /* Get a line of data including control code */
4661 if (!fgets(buf, 1024, fff)) okay = FALSE;
4663 /* Get the blank line */
4664 if (buf[0] == '\n' || buf[0] == '\0') break;
4666 /* Ignore too large screen image */
4667 if (y >= hgt) continue;
4670 for (x = 0; x < wid - 1; x++)
4673 if (buf[x] == '\n' || buf[x] == '\0') break;
4675 /* Put the attr/char */
4676 Term_draw(x, y, TERM_WHITE, buf[x]);
4680 /* Dump the screen */
4681 for (y = 0; okay; y++)
4683 /* Get a line of data including control code */
4684 if (!fgets(buf, 1024, fff)) okay = FALSE;
4686 /* Get the blank line */
4687 if (buf[0] == '\n' || buf[0] == '\0') break;
4689 /* Ignore too large screen image */
4690 if (y >= hgt) continue;
4693 for (x = 0; x < wid - 1; x++)
4696 if (buf[x] == '\n' || buf[x] == '\0') break;
4698 /* Get the attr/char */
4699 (void)(Term_what(x, y, &a, &c));
4701 /* Look up the attr */
4702 for (i = 0; i < 16; i++)
4704 /* Use attr matches */
4705 if (hack[i] == buf[x]) a = (byte_hack)i;
4708 /* Put the attr/char */
4709 Term_draw(x, y, a, c);
4718 prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
4724 /* Restore the screen */
4731 cptr inven_res_label = _(" 酸電火冷毒光闇破轟獄因沌劣 盲怖乱痺透命感消復浮",
4732 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv");
4735 #define IM_FLAG_STR _("*", "* ")
4736 #define HAS_FLAG_STR _("+", "+ ")
4737 #define NO_FLAG_STR _("・", ". ")
4739 #define print_im_or_res_flag(IM, RES) \
4741 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
4742 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
4745 #define print_flag(TR) \
4747 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
4751 /* XTRA HACK RESLIST */
4752 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, OBJECT_TYPE_VALUE tval, char *where)
4754 char o_name[MAX_NLEN];
4755 BIT_FLAGS flgs[TR_FLAG_SIZE];
4757 if (!o_ptr->k_idx) return;
4758 if (o_ptr->tval != tval) return;
4760 /* Identified items only */
4761 if (!object_is_known(o_ptr)) return;
4764 * HACK:Ring of Lordly protection and Dragon equipment
4765 * have random resistances.
4767 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
4768 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
4769 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
4770 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
4771 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
4772 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
4773 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
4774 || object_is_artifact(o_ptr))
4777 object_desc(o_name, o_ptr, OD_NAME_ONLY);
4779 while (o_name[i] && (i < 26))
4782 if (iskanji(o_name[i])) i++;
4791 o_name[i] = ' '; i++;
4796 fprintf(fff, "%s %s", where, o_name);
4798 if (!(o_ptr->ident & (IDENT_MENTAL)))
4800 fputs(_("-------不明--------------- -------不明---------\n",
4801 "-------unknown------------ -------unknown------\n"), fff);
4805 object_flags_known(o_ptr, flgs);
4807 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
4808 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
4809 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
4810 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
4811 print_flag(TR_RES_POIS);
4812 print_flag(TR_RES_LITE);
4813 print_flag(TR_RES_DARK);
4814 print_flag(TR_RES_SHARDS);
4815 print_flag(TR_RES_SOUND);
4816 print_flag(TR_RES_NETHER);
4817 print_flag(TR_RES_NEXUS);
4818 print_flag(TR_RES_CHAOS);
4819 print_flag(TR_RES_DISEN);
4823 print_flag(TR_RES_BLIND);
4824 print_flag(TR_RES_FEAR);
4825 print_flag(TR_RES_CONF);
4826 print_flag(TR_FREE_ACT);
4827 print_flag(TR_SEE_INVIS);
4828 print_flag(TR_HOLD_EXP);
4829 print_flag(TR_TELEPATHY);
4830 print_flag(TR_SLOW_DIGEST);
4831 print_flag(TR_REGEN);
4832 print_flag(TR_LEVITATION);
4840 fprintf(fff, "%s\n", inven_res_label);
4846 * Display *ID* ed weapons/armors's resistances
4848 static void do_cmd_knowledge_inven(void)
4852 char file_name[1024];
4856 OBJECT_TYPE_VALUE tval;
4862 /* Open a new file */
4863 fff = my_fopen_temp(file_name, 1024);
4866 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4870 fprintf(fff, "%s\n", inven_res_label);
4872 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
4876 for (; j < 9; j++) fputc('\n', fff);
4878 fprintf(fff, "%s\n", inven_res_label);
4880 strcpy(where, _("装", "E "));
4881 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4883 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4885 strcpy(where, _("持", "I "));
4886 for (i = 0; i < INVEN_PACK; i++)
4888 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4891 st_ptr = &town[1].store[STORE_HOME];
4892 strcpy(where, _("家", "H "));
4893 for (i = 0; i < st_ptr->stock_num; i++)
4895 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
4899 /* Close the file */
4902 /* Display the file contents */
4903 show_file(TRUE, file_name, _("*鑑定*済み武器/防具の耐性リスト", "Resistances of *identified* equipment"), 0, 0);
4905 /* Remove the file */
4910 void do_cmd_save_screen_html_aux(char *filename, int message)
4914 TERM_COLOR a = 0, old_a = 0;
4928 cptr html_head[] = {
4929 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
4933 cptr html_foot[] = {
4935 "</body>\n</html>\n",
4941 Term_get_size(&wid, &hgt);
4943 /* File type is "TEXT" */
4944 FILE_TYPE(FILE_TYPE_TEXT);
4946 /* Append to the file */
4947 fff = my_fopen(filename, "w");
4951 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename);
4958 /* Save the screen */
4962 /* Build the filename */
4963 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
4964 tmpfff = my_fopen(buf, "r");
4966 for (i = 0; html_head[i]; i++)
4967 fputs(html_head[i], fff);
4971 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
4973 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
4977 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
4979 fprintf(fff, "%s\n", buf);
4984 /* Dump the screen */
4985 for (y = 0; y < hgt; y++)
4992 for (x = 0; x < wid - 1; x++)
4996 /* Get the attr/char */
4997 (void)(Term_what(x, y, &a, &c));
5001 case '&': cc = "&"; break;
5002 case '<': cc = "<"; break;
5003 case '>': cc = ">"; break;
5005 case 0x1f: c = '.'; break;
5006 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5011 if ((y == 0 && x == 0) || a != old_a) {
5012 rv = angband_color_table[a][1];
5013 gv = angband_color_table[a][2];
5014 bv = angband_color_table[a][3];
5015 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5016 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
5020 fprintf(fff, "%s", cc);
5022 fprintf(fff, "%c", c);
5025 fprintf(fff, "</font>");
5028 for (i = 0; html_foot[i]; i++)
5029 fputs(html_foot[i], fff);
5034 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5036 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
5040 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
5042 fprintf(fff, "%s\n", buf);
5055 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5059 /* Restore the screen */
5065 * Hack -- save a screen dump to a file
5067 static void do_cmd_save_screen_html(void)
5069 char buf[1024], tmp[256] = "screen.html";
5071 if (!get_string(_("ファイル名: ", "File name: "), tmp, 80))
5074 /* Build the filename */
5075 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
5079 do_cmd_save_screen_html_aux(buf, 1);
5084 * Redefinable "save_screen" action
5086 void (*screendump_aux)(void) = NULL;
5090 * Hack -- save a screen dump to a file
5092 void do_cmd_save_screen(void)
5094 bool old_use_graphics = use_graphics;
5095 bool html_dump = FALSE;
5099 prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
5103 if (c == 'Y' || c == 'y')
5105 else if (c == 'H' || c == 'h')
5117 Term_get_size(&wid, &hgt);
5119 if (old_use_graphics)
5121 use_graphics = FALSE;
5124 /* Redraw everything */
5125 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5127 /* Hack -- update */
5133 do_cmd_save_screen_html();
5137 /* Do we use a special screendump function ? */
5138 else if (screendump_aux)
5140 /* Dump the screen to a graphics file */
5141 (*screendump_aux)();
5143 else /* Dump the screen as text */
5154 /* Build the filename */
5155 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5157 /* File type is "TEXT" */
5158 FILE_TYPE(FILE_TYPE_TEXT);
5160 /* Append to the file */
5161 fff = my_fopen(buf, "w");
5165 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
5171 /* Save the screen */
5175 /* Dump the screen */
5176 for (y = 0; y < hgt; y++)
5179 for (x = 0; x < wid - 1; x++)
5181 /* Get the attr/char */
5182 (void)(Term_what(x, y, &a, &c));
5192 fprintf(fff, "%s\n", buf);
5199 /* Dump the screen */
5200 for (y = 0; y < hgt; y++)
5203 for (x = 0; x < wid - 1; x++)
5205 /* Get the attr/char */
5206 (void)(Term_what(x, y, &a, &c));
5209 buf[x] = hack[a&0x0F];
5216 fprintf(fff, "%s\n", buf);
5226 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5229 /* Restore the screen */
5233 if (old_use_graphics)
5235 use_graphics = TRUE;
5238 /* Redraw everything */
5239 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5241 /* Hack -- update */
5248 * Sorting hook -- Comp function -- see below
5250 * We use "u" to point to array of monster indexes,
5251 * and "v" to select the type of sorting to perform on "u".
5253 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
5255 u16b *who = (u16b*)(u);
5257 u16b *why = (u16b*)(v);
5264 /* Sort by total kills */
5267 /* Extract total kills */
5268 z1 = a_info[w1].tval;
5269 z2 = a_info[w2].tval;
5271 /* Compare total kills */
5272 if (z1 < z2) return (TRUE);
5273 if (z1 > z2) return (FALSE);
5277 /* Sort by monster level */
5280 /* Extract levels */
5281 z1 = a_info[w1].sval;
5282 z2 = a_info[w2].sval;
5284 /* Compare levels */
5285 if (z1 < z2) return (TRUE);
5286 if (z1 > z2) return (FALSE);
5290 /* Sort by monster experience */
5293 /* Extract experience */
5294 z1 = a_info[w1].level;
5295 z2 = a_info[w2].level;
5297 /* Compare experience */
5298 if (z1 < z2) return (TRUE);
5299 if (z1 > z2) return (FALSE);
5303 /* Compare indexes */
5309 * Sorting hook -- Swap function -- see below
5311 * We use "u" to point to array of monster indexes,
5312 * and "v" to select the type of sorting to perform.
5314 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
5316 u16b *who = (u16b*)(u);
5331 * Check the status of "artifacts"
5333 static void do_cmd_knowledge_artifacts(void)
5345 char file_name[1024];
5347 char base_name[MAX_NLEN];
5351 /* Open a new file */
5352 fff = my_fopen_temp(file_name, 1024);
5355 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5360 /* Allocate the "who" array */
5361 C_MAKE(who, max_a_idx, s16b);
5363 /* Allocate the "okay" array */
5364 C_MAKE(okay, max_a_idx, bool);
5366 /* Scan the artifacts */
5367 for (k = 0; k < max_a_idx; k++)
5369 artifact_type *a_ptr = &a_info[k];
5374 /* Skip "empty" artifacts */
5375 if (!a_ptr->name) continue;
5377 /* Skip "uncreated" artifacts */
5378 if (!a_ptr->cur_num) continue;
5384 /* Check the dungeon */
5385 for (y = 0; y < cur_hgt; y++)
5387 for (x = 0; x < cur_wid; x++)
5389 cave_type *c_ptr = &cave[y][x];
5391 OBJECT_IDX this_o_idx, next_o_idx = 0;
5393 /* Scan all objects in the grid */
5394 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
5397 o_ptr = &o_list[this_o_idx];
5399 /* Acquire next object */
5400 next_o_idx = o_ptr->next_o_idx;
5402 /* Ignore non-artifacts */
5403 if (!object_is_fixed_artifact(o_ptr)) continue;
5405 /* Ignore known items */
5406 if (object_is_known(o_ptr)) continue;
5408 /* Note the artifact */
5409 okay[o_ptr->name1] = FALSE;
5414 /* Check the inventory and equipment */
5415 for (i = 0; i < INVEN_TOTAL; i++)
5417 object_type *o_ptr = &inventory[i];
5419 /* Ignore non-objects */
5420 if (!o_ptr->k_idx) continue;
5422 /* Ignore non-artifacts */
5423 if (!object_is_fixed_artifact(o_ptr)) continue;
5425 /* Ignore known items */
5426 if (object_is_known(o_ptr)) continue;
5428 /* Note the artifact */
5429 okay[o_ptr->name1] = FALSE;
5432 for (k = 0; k < max_a_idx; k++)
5434 if (okay[k]) who[n++] = k;
5437 /* Select the sort method */
5438 ang_sort_comp = ang_sort_art_comp;
5439 ang_sort_swap = ang_sort_art_swap;
5441 /* Sort the array by dungeon depth of monsters */
5442 ang_sort(who, &why, n);
5444 /* Scan the artifacts */
5445 for (k = 0; k < n; k++)
5447 artifact_type *a_ptr = &a_info[who[k]];
5450 strcpy(base_name, _("未知の伝説のアイテム", "Unknown Artifact"));
5452 /* Obtain the base object type */
5453 z = lookup_kind(a_ptr->tval, a_ptr->sval);
5462 /* Create fake object */
5463 object_prep(q_ptr, z);
5465 /* Make it an artifact */
5466 q_ptr->name1 = (byte)who[k];
5468 /* Display as if known */
5469 q_ptr->ident |= IDENT_STORE;
5471 /* Describe the artifact */
5472 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5475 /* Hack -- Build the artifact name */
5476 fprintf(fff, _(" %s\n", " The %s\n"), base_name);
5479 /* Free the "who" array */
5480 C_KILL(who, max_a_idx, s16b);
5482 /* Free the "okay" array */
5483 C_KILL(okay, max_a_idx, bool);
5485 /* Close the file */
5488 /* Display the file contents */
5489 show_file(TRUE, file_name, _("既知の伝説のアイテム", "Artifacts Seen"), 0, 0);
5491 /* Remove the file */
5497 * Display known uniques
5498 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
5500 static void do_cmd_knowledge_uniques(void)
5509 char file_name[1024];
5512 int n_alive_surface = 0;
5513 int n_alive_over100 = 0;
5514 int n_alive_total = 0;
5517 for (i = 0; i < 10; i++) n_alive[i] = 0;
5519 /* Open a new file */
5520 fff = my_fopen_temp(file_name, 1024);
5524 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5529 /* Allocate the "who" array */
5530 C_MAKE(who, max_r_idx, s16b);
5532 /* Scan the monsters */
5533 for (i = 1; i < max_r_idx; i++)
5535 monster_race *r_ptr = &r_info[i];
5538 if (!r_ptr->name) continue;
5540 /* Require unique monsters */
5541 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5543 /* Only display "known" uniques */
5544 if (!cheat_know && !r_ptr->r_sights) continue;
5546 /* Only print rarity <= 100 uniques */
5547 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
5549 /* Only "alive" uniques */
5550 if (r_ptr->max_num == 0) continue;
5554 lev = (r_ptr->level - 1) / 10;
5558 if (max_lev < lev) max_lev = lev;
5560 else n_alive_over100++;
5562 else n_alive_surface++;
5564 /* Collect "appropriate" monsters */
5568 /* Select the sort method */
5569 ang_sort_comp = ang_sort_comp_hook;
5570 ang_sort_swap = ang_sort_swap_hook;
5572 /* Sort the array by dungeon depth of monsters */
5573 ang_sort(who, &why, n);
5575 if (n_alive_surface)
5577 fprintf(fff, _(" 地上 生存: %3d体\n", " Surface alive: %3d\n"), n_alive_surface);
5578 n_alive_total += n_alive_surface;
5580 for (i = 0; i <= max_lev; i++)
5582 fprintf(fff, _("%3d-%3d階 生存: %3d体\n", "Level %3d-%3d alive: %3d\n"), 1 + i * 10, 10 + i * 10, n_alive[i]);
5583 n_alive_total += n_alive[i];
5585 if (n_alive_over100)
5587 fprintf(fff, _("101- 階 生存: %3d体\n", "Level 101- alive: %3d\n"), n_alive_over100);
5588 n_alive_total += n_alive_over100;
5593 fputs(_("--------- -----------\n", "------------- ----------\n"), fff);
5594 fprintf(fff, _(" 合計 生存: %3d体\n\n", " Total alive: %3d\n\n"), n_alive_total);
5598 fputs(_("現在は既知の生存ユニークはいません。\n", "No known uniques alive.\n"), fff);
5601 /* Scan the monster races */
5602 for (k = 0; k < n; k++)
5604 monster_race *r_ptr = &r_info[who[k]];
5606 fprintf(fff, _(" %s (レベル%d)\n", " %s (level %d)\n"), r_name + r_ptr->name, (int)r_ptr->level);
5609 /* Free the "who" array */
5610 C_KILL(who, max_r_idx, s16b);
5612 /* Close the file */
5615 /* Display the file contents */
5616 show_file(TRUE, file_name, _("まだ生きているユニーク・モンスター", "Alive Uniques"), 0, 0);
5618 /* Remove the file */
5624 * Display weapon-exp
5626 static void do_cmd_knowledge_weapon_exp(void)
5628 int i, num, weapon_exp;
5633 char file_name[1024];
5636 /* Open a new file */
5637 fff = my_fopen_temp(file_name, 1024);
5639 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5644 for (i = 0; i < 5; i++)
5646 for (num = 0; num < 64; num++)
5648 for (j = 0; j < max_k_idx; j++)
5650 object_kind *k_ptr = &k_info[j];
5652 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
5654 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON || k_ptr->sval == SV_HARP)) continue;
5656 weapon_exp = p_ptr->weapon_exp[4 - i][num];
5658 fprintf(fff, "%-25s ", tmp);
5659 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
5660 else fprintf(fff, " ");
5661 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
5662 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
5670 /* Close the file */
5673 /* Display the file contents */
5674 show_file(TRUE, file_name, _("武器の経験値", "Weapon Proficiency"), 0, 0);
5676 /* Remove the file */
5682 * @brief 魔法の経験値を表示するコマンドのメインルーチン
5686 static void do_cmd_knowledge_spell_exp(void)
5689 int spell_exp, exp_level;
5692 const magic_type *s_ptr;
5694 char file_name[1024];
5696 /* Open a new file */
5697 fff = my_fopen_temp(file_name, 1024);
5699 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5704 if (p_ptr->realm1 != REALM_NONE)
5706 fprintf(fff, _("%sの魔法書\n", "%s Spellbook\n"), realm_names[p_ptr->realm1]);
5707 for (i = 0; i < 32; i++)
5709 if (!is_magic(p_ptr->realm1))
5711 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
5715 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
5717 if (s_ptr->slevel >= 99) continue;
5718 spell_exp = p_ptr->spell_exp[i];
5719 exp_level = spell_exp_level(spell_exp);
5720 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
5721 if (p_ptr->realm1 == REALM_HISSATSU)
5722 fprintf(fff, "[--]");
5725 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
5726 else fprintf(fff, " ");
5727 fprintf(fff, "%s", exp_level_str[exp_level]);
5729 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5734 if (p_ptr->realm2 != REALM_NONE)
5736 fprintf(fff, _("%sの魔法書\n", "\n%s Spellbook\n"), realm_names[p_ptr->realm2]);
5737 for (i = 0; i < 32; i++)
5739 if (!is_magic(p_ptr->realm1))
5741 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
5745 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
5747 if (s_ptr->slevel >= 99) continue;
5749 spell_exp = p_ptr->spell_exp[i + 32];
5750 exp_level = spell_exp_level(spell_exp);
5751 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
5752 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
5753 else fprintf(fff, " ");
5754 fprintf(fff, "%s", exp_level_str[exp_level]);
5755 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5760 /* Close the file */
5763 /* Display the file contents */
5764 show_file(TRUE, file_name, _("魔法の経験値", "Spell Proficiency"), 0, 0);
5766 /* Remove the file */
5772 * @brief スキル情報を表示するコマンドのメインルーチン /
5776 static void do_cmd_knowledge_skill_exp(void)
5778 int i = 0, skill_exp;
5782 char file_name[1024];
5783 char skill_name[3][20]={_("マーシャルアーツ", "Martial Arts "),
5784 _("二刀流 ", "Dual Wielding "),
5785 _("乗馬 ", "Riding ")};
5787 /* Open a new file */
5788 fff = my_fopen_temp(file_name, 1024);
5790 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5795 for (i = 0; i < 3; i++)
5797 skill_exp = p_ptr->skill_exp[i];
5798 fprintf(fff, "%-20s ", skill_name[i]);
5799 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
5800 else fprintf(fff, " ");
5801 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
5802 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
5806 /* Close the file */
5809 /* Display the file contents */
5810 show_file(TRUE, file_name, _("技能の経験値", "Miscellaneous Proficiency"), 0, 0);
5812 /* Remove the file */
5818 * @brief 英単語、句、説を複数形を変換する / Pluralize a monster name
5819 * @param Name 変換したい文字列の参照ポインタ
5822 void plural_aux(char *Name)
5824 int NameLen = strlen(Name);
5826 if (my_strstr(Name, "Disembodied hand"))
5828 strcpy(Name, "Disembodied hands that strangled people");
5830 else if (my_strstr(Name, "Colour out of space"))
5832 strcpy(Name, "Colours out of space");
5834 else if (my_strstr(Name, "stairway to hell"))
5836 strcpy(Name, "stairways to hell");
5838 else if (my_strstr(Name, "Dweller on the threshold"))
5840 strcpy(Name, "Dwellers on the threshold");
5842 else if (my_strstr(Name, " of "))
5844 cptr aider = my_strstr(Name, " of ");
5855 if (dummy[i-1] == 's')
5857 strcpy(&(dummy[i]), "es");
5862 strcpy(&(dummy[i]), "s");
5865 strcpy(&(dummy[i+1]), aider);
5866 strcpy(Name, dummy);
5868 else if (my_strstr(Name, "coins"))
5871 strcpy(dummy, "piles of ");
5872 strcat(dummy, Name);
5873 strcpy(Name, dummy);
5876 else if (my_strstr(Name, "Manes"))
5880 else if (streq(&(Name[NameLen - 2]), "ey"))
5882 strcpy(&(Name[NameLen - 2]), "eys");
5884 else if (Name[NameLen - 1] == 'y')
5886 strcpy(&(Name[NameLen - 1]), "ies");
5888 else if (streq(&(Name[NameLen - 4]), "ouse"))
5890 strcpy(&(Name[NameLen - 4]), "ice");
5892 else if (streq(&(Name[NameLen - 2]), "us"))
5894 strcpy(&(Name[NameLen - 2]), "i");
5896 else if (streq(&(Name[NameLen - 6]), "kelman"))
5898 strcpy(&(Name[NameLen - 6]), "kelmen");
5900 else if (streq(&(Name[NameLen - 8]), "wordsman"))
5902 strcpy(&(Name[NameLen - 8]), "wordsmen");
5904 else if (streq(&(Name[NameLen - 7]), "oodsman"))
5906 strcpy(&(Name[NameLen - 7]), "oodsmen");
5908 else if (streq(&(Name[NameLen - 7]), "eastman"))
5910 strcpy(&(Name[NameLen - 7]), "eastmen");
5912 else if (streq(&(Name[NameLen - 8]), "izardman"))
5914 strcpy(&(Name[NameLen - 8]), "izardmen");
5916 else if (streq(&(Name[NameLen - 5]), "geist"))
5918 strcpy(&(Name[NameLen - 5]), "geister");
5920 else if (streq(&(Name[NameLen - 2]), "ex"))
5922 strcpy(&(Name[NameLen - 2]), "ices");
5924 else if (streq(&(Name[NameLen - 2]), "lf"))
5926 strcpy(&(Name[NameLen - 2]), "lves");
5928 else if (suffix(Name, "ch") ||
5929 suffix(Name, "sh") ||
5930 suffix(Name, "nx") ||
5931 suffix(Name, "s") ||
5934 strcpy(&(Name[NameLen]), "es");
5938 strcpy(&(Name[NameLen]), "s");
5943 * @brief 現在のペットを表示するコマンドのメインルーチン /
5944 * Display current pets
5947 static void do_cmd_knowledge_pets(void)
5951 monster_type *m_ptr;
5954 int show_upkeep = 0;
5955 char file_name[1024];
5958 /* Open a new file */
5959 fff = my_fopen_temp(file_name, 1024);
5961 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5966 /* Process the monsters (backwards) */
5967 for (i = m_max - 1; i >= 1; i--)
5969 /* Access the monster */
5972 /* Ignore "dead" monsters */
5973 if (!m_ptr->r_idx) continue;
5975 /* Calculate "upkeep" for pets */
5979 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
5980 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
5984 show_upkeep = calculate_upkeep();
5986 fprintf(fff, "----------------------------------------------\n");
5988 fprintf(fff, " 合計: %d 体のペット\n", t_friends);
5989 fprintf(fff, " 維持コスト: %d%% MP\n", show_upkeep);
5991 fprintf(fff, " Total: %d pet%s.\n",
5992 t_friends, (t_friends == 1 ? "" : "s"));
5993 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
5998 /* Close the file */
6001 /* Display the file contents */
6002 show_file(TRUE, file_name, _("現在のペット", "Current Pets"), 0, 0);
6004 /* Remove the file */
6010 * @brief 現在のペットを表示するコマンドのメインルーチン /
6013 * @note the player ghosts are ignored.
6015 static void do_cmd_knowledge_kill_count(void)
6024 char file_name[1024];
6029 /* Open a new file */
6030 fff = my_fopen_temp(file_name, 1024);
6033 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6038 /* Allocate the "who" array */
6039 C_MAKE(who, max_r_idx, s16b);
6042 /* Monsters slain */
6045 for (kk = 1; kk < max_r_idx; kk++)
6047 monster_race *r_ptr = &r_info[kk];
6049 if (r_ptr->flags1 & (RF1_UNIQUE))
6051 bool dead = (r_ptr->max_num == 0);
6060 MONSTER_NUMBER This = r_ptr->r_pkills;
6070 fprintf(fff,_("あなたはまだ敵を倒していない。\n\n", "You have defeated no enemies yet.\n\n"));
6073 fprintf(fff,"あなたは%ld体の敵を倒している。\n\n", (long int)Total);
6075 fprintf(fff,"You have defeated %ld %s.\n\n", (long int)Total, (Total == 1) ? "enemy" : "enemies");
6081 /* Scan the monsters */
6082 for (i = 1; i < max_r_idx; i++)
6084 monster_race *r_ptr = &r_info[i];
6086 /* Use that monster */
6087 if (r_ptr->name) who[n++] = i;
6090 /* Select the sort method */
6091 ang_sort_comp = ang_sort_comp_hook;
6092 ang_sort_swap = ang_sort_swap_hook;
6094 /* Sort the array by dungeon depth of monsters */
6095 ang_sort(who, &why, n);
6097 /* Scan the monster races */
6098 for (k = 0; k < n; k++)
6100 monster_race *r_ptr = &r_info[who[k]];
6102 if (r_ptr->flags1 & (RF1_UNIQUE))
6104 bool dead = (r_ptr->max_num == 0);
6108 fprintf(fff, " %s\n", (r_name + r_ptr->name));
6114 MONSTER_NUMBER This = r_ptr->r_pkills;
6119 /* p,tは人と数える by ita */
6120 if (my_strchr("pt", r_ptr->d_char))
6121 fprintf(fff, " %3d 人の %s\n", (int)This, r_name + r_ptr->name);
6123 fprintf(fff, " %3d 体の %s\n", (int)This, r_name + r_ptr->name);
6127 if (my_strstr(r_name + r_ptr->name, "coins"))
6129 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
6133 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
6139 strcpy(ToPlural, (r_name + r_ptr->name));
6140 plural_aux(ToPlural);
6141 fprintf(fff, " %d %s\n", This, ToPlural);
6151 fprintf(fff,"----------------------------------------------\n");
6153 fprintf(fff," 合計: %lu 体を倒した。\n", (unsigned long int)Total);
6155 fprintf(fff," Total: %lu creature%s killed.\n", (unsigned long int)Total, (Total == 1 ? "" : "s"));
6159 /* Free the "who" array */
6160 C_KILL(who, max_r_idx, s16b);
6162 /* Close the file */
6165 /* Display the file contents */
6166 show_file(TRUE, file_name, _("倒した敵の数", "Kill Count"), 0, 0);
6168 /* Remove the file */
6174 * @brief モンスター情報リスト中のグループを表示する /
6175 * Display the object groups.
6179 * @param per_page リストの表示行
6180 * @param grp_idx グループのID配列
6181 * @param group_text グループ名の文字列配列
6182 * @param grp_cur 現在の選択ID
6183 * @param grp_top 現在の選択リスト最上部ID
6186 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)
6190 /* Display lines until done */
6191 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
6193 /* Get the group index */
6194 int grp = grp_idx[grp_top + i];
6196 /* Choose a color */
6197 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
6199 /* Erase the entire line */
6200 Term_erase(col, row + i, wid);
6202 /* Display the group label */
6203 c_put_str(attr, group_text[grp], row + i, col);
6209 * Move the cursor in a browser window
6211 static void browser_cursor(char ch, int *column, IDX *grp_cur, int grp_cnt,
6212 IDX *list_cur, int list_cnt)
6217 IDX list = *list_cur;
6219 /* Extract direction */
6222 /* Hack -- scroll up full screen */
6227 /* Hack -- scroll down full screen */
6232 d = get_keymap_dir(ch);
6237 /* Diagonals - hack */
6238 if ((ddx[d] > 0) && ddy[d])
6243 Term_get_size(&wid, &hgt);
6245 browser_rows = hgt - 8;
6247 /* Browse group list */
6252 /* Move up or down */
6253 grp += ddy[d] * (browser_rows - 1);
6256 if (grp >= grp_cnt) grp = grp_cnt - 1;
6257 if (grp < 0) grp = 0;
6258 if (grp != old_grp) list = 0;
6261 /* Browse sub-list list */
6264 /* Move up or down */
6265 list += ddy[d] * browser_rows;
6268 if (list >= list_cnt) list = list_cnt - 1;
6269 if (list < 0) list = 0;
6281 if (col < 0) col = 0;
6282 if (col > 1) col = 1;
6289 /* Browse group list */
6294 /* Move up or down */
6298 if (grp >= grp_cnt) grp = grp_cnt - 1;
6299 if (grp < 0) grp = 0;
6300 if (grp != old_grp) list = 0;
6303 /* Browse sub-list list */
6306 /* Move up or down */
6310 if (list >= list_cnt) list = list_cnt - 1;
6311 if (list < 0) list = 0;
6322 static void display_visual_list(int col, int row, int height, int width, TERM_COLOR attr_top, byte char_left)
6326 /* Clear the display lines */
6327 for (i = 0; i < height; i++)
6329 Term_erase(col, row + i, width);
6332 /* Bigtile mode uses double width */
6333 if (use_bigtile) width /= 2;
6335 /* Display lines until done */
6336 for (i = 0; i < height; i++)
6338 /* Display columns until done */
6339 for (j = 0; j < width; j++)
6343 TERM_LEN x = col + j;
6344 TERM_LEN y = row + i;
6347 /* Bigtile mode uses double width */
6348 if (use_bigtile) x += j;
6353 /* Ignore illegal characters */
6354 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
6355 (!use_graphics && ic > 0x7f))
6361 /* Force correct code for both ASCII character and tile */
6362 if (c & 0x80) a |= 0x80;
6364 /* Display symbol */
6365 Term_queue_bigchar(x, y, a, c, 0, 0);
6372 * Place the cursor at the collect position for visual mode
6374 static void place_visual_list_cursor(TERM_LEN col, TERM_LEN row, TERM_COLOR a, byte c, TERM_COLOR attr_top, byte char_left)
6376 int i = (a & 0x7f) - attr_top;
6377 int j = c - char_left;
6379 TERM_LEN x = col + j;
6380 TERM_LEN y = row + i;
6382 /* Bigtile mode uses double width */
6383 if (use_bigtile) x += j;
6385 /* Place the cursor */
6391 * Clipboard variables for copy&paste in visual mode
6393 static TERM_COLOR attr_idx = 0;
6394 static byte char_idx = 0;
6396 /* Hack -- for feature lighting */
6397 static TERM_COLOR attr_idx_feat[F_LIT_MAX];
6398 static byte char_idx_feat[F_LIT_MAX];
6401 * Do visual mode command -- Change symbols
6403 static bool visual_mode_command(char ch, bool *visual_list_ptr,
6404 int height, int width,
6405 TERM_COLOR *attr_top_ptr, byte *char_left_ptr,
6406 TERM_COLOR *cur_attr_ptr, SYMBOL_CODE *cur_char_ptr, bool *need_redraw)
6408 static TERM_COLOR attr_old = 0;
6409 static SYMBOL_CODE char_old = 0;
6414 if (*visual_list_ptr)
6417 *cur_attr_ptr = attr_old;
6418 *cur_char_ptr = char_old;
6419 *visual_list_ptr = FALSE;
6427 if (*visual_list_ptr)
6430 *visual_list_ptr = FALSE;
6431 *need_redraw = TRUE;
6439 if (!*visual_list_ptr)
6441 *visual_list_ptr = TRUE;
6443 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6444 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6446 attr_old = *cur_attr_ptr;
6447 char_old = *cur_char_ptr;
6458 /* Set the visual */
6459 attr_idx = *cur_attr_ptr;
6460 char_idx = *cur_char_ptr;
6462 /* Hack -- for feature lighting */
6463 for (i = 0; i < F_LIT_MAX; i++)
6465 attr_idx_feat[i] = 0;
6466 char_idx_feat[i] = 0;
6473 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
6476 *cur_attr_ptr = attr_idx;
6477 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6478 if (!*visual_list_ptr) *need_redraw = TRUE;
6484 *cur_char_ptr = char_idx;
6485 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6486 if (!*visual_list_ptr) *need_redraw = TRUE;
6492 if (*visual_list_ptr)
6495 int d = get_keymap_dir(ch);
6496 byte a = (*cur_attr_ptr & 0x7f);
6497 byte c = *cur_char_ptr;
6499 if (use_bigtile) eff_width = width / 2;
6500 else eff_width = width;
6502 /* Restrict direction */
6503 if ((a == 0) && (ddy[d] < 0)) d = 0;
6504 if ((c == 0) && (ddx[d] < 0)) d = 0;
6505 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
6506 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
6511 /* Force correct code for both ASCII character and tile */
6512 if (c & 0x80) a |= 0x80;
6514 /* Set the visual */
6519 /* Move the frame */
6520 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
6521 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
6522 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
6523 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
6529 /* Visual mode command is not used */
6535 * Display the monsters in a group.
6537 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
6538 int mon_cur, int mon_top, bool visual_only)
6542 /* Display lines until done */
6543 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
6547 /* Get the race index */
6548 MONRACE_IDX r_idx = mon_idx[mon_top + i] ;
6550 /* Access the race */
6551 monster_race *r_ptr = &r_info[r_idx];
6553 /* Choose a color */
6554 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
6556 /* Display the name */
6557 c_prt(attr, (r_name + r_ptr->name), row + i, col);
6559 /* Hack -- visual_list mode */
6562 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
6564 if (p_ptr->wizard || visual_only)
6566 c_prt(attr, format("%d", r_idx), row + i, 62);
6569 /* Erase chars before overwritten by the race letter */
6570 Term_erase(69, row + i, 255);
6572 /* Display symbol */
6573 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
6578 if (!(r_ptr->flags1 & RF1_UNIQUE))
6579 put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
6581 c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE),
6582 (r_ptr->max_num == 0 ? _("死亡", " dead") : _("生存", "alive")), row + i, 74);
6586 /* Clear remaining lines */
6587 for (; i < per_page; i++)
6589 Term_erase(col, row + i, 255);
6595 * Display known monsters.
6597 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx)
6601 IDX grp_cur, grp_top, old_grp_cur;
6602 IDX mon_cur, mon_top;
6603 IDX grp_cnt, grp_idx[100];
6611 bool visual_list = FALSE;
6612 TERM_COLOR attr_top = 0;
6620 Term_get_size(&wid, &hgt);
6622 browser_rows = hgt - 8;
6624 /* Allocate the "mon_idx" array */
6625 C_MAKE(mon_idx, max_r_idx, s16b);
6630 if (direct_r_idx < 0)
6632 mode = visual_only ? 0x03 : 0x01;
6634 /* Check every group */
6635 for (i = 0; monster_group_text[i] != NULL; i++)
6637 /* Measure the label */
6638 len = strlen(monster_group_text[i]);
6640 /* Save the maximum length */
6641 if (len > max) max = len;
6643 /* See if any monsters are known */
6644 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
6646 /* Build a list of groups with known monsters */
6647 grp_idx[grp_cnt++] = i;
6655 mon_idx[0] = direct_r_idx;
6658 /* Terminate the list */
6661 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
6662 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
6665 /* Terminate the list */
6666 grp_idx[grp_cnt] = -1;
6669 grp_cur = grp_top = 0;
6670 mon_cur = mon_top = 0;
6675 mode = visual_only ? 0x02 : 0x00;
6680 monster_race *r_ptr;
6687 prt(format("%s - モンスター", !visual_only ? "知識" : "表示"), 2, 0);
6688 if (direct_r_idx < 0) prt("グループ", 4, 0);
6689 prt("名前", 4, max + 3);
6690 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6692 if (!visual_only) prt("殺害数", 4, 72);
6694 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
6695 if (direct_r_idx < 0) prt("Group", 4, 0);
6696 prt("Name", 4, max + 3);
6697 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6699 if (!visual_only) prt("Kills", 4, 73);
6702 for (i = 0; i < 78; i++)
6704 Term_putch(i, 5, TERM_WHITE, '=');
6707 if (direct_r_idx < 0)
6709 for (i = 0; i < browser_rows; i++)
6711 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
6718 if (direct_r_idx < 0)
6720 /* Scroll group list */
6721 if (grp_cur < grp_top) grp_top = grp_cur;
6722 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
6724 /* Display a list of monster groups */
6725 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
6727 if (old_grp_cur != grp_cur)
6729 old_grp_cur = grp_cur;
6731 /* Get a list of monsters in the current group */
6732 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
6735 /* Scroll monster list */
6736 while (mon_cur < mon_top)
6737 mon_top = MAX(0, mon_top - browser_rows/2);
6738 while (mon_cur >= mon_top + browser_rows)
6739 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
6744 /* Display a list of monsters in the current group */
6745 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
6751 /* Display a monster name */
6752 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
6754 /* Display visual list below first monster */
6755 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
6760 prt(format("<方向>%s%s%s, ESC",
6761 (!visual_list && !visual_only) ? ", 'r'で思い出を見る" : "",
6762 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
6763 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
6766 prt(format("<dir>%s%s%s, ESC",
6767 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
6768 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
6769 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
6773 /* Get the current monster */
6774 r_ptr = &r_info[mon_idx[mon_cur]];
6778 /* Mega Hack -- track this monster race */
6779 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
6785 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
6789 Term_gotoxy(0, 6 + (grp_cur - grp_top));
6793 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
6798 /* Do visual mode command if needed */
6799 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))
6801 if (direct_r_idx >= 0)
6826 /* Recall on screen */
6827 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
6829 screen_roff(mon_idx[mon_cur], 0);
6840 /* Move the cursor */
6841 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
6848 /* Free the "mon_idx" array */
6849 C_KILL(mon_idx, max_r_idx, s16b);
6854 * Display the objects in a group.
6856 static void display_object_list(int col, int row, int per_page, IDX object_idx[],
6857 int object_cur, int object_top, bool visual_only)
6861 /* Display lines until done */
6862 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
6867 object_kind *flavor_k_ptr;
6869 /* Get the object index */
6870 KIND_OBJECT_IDX k_idx = object_idx[object_top + i];
6872 /* Access the object */
6873 object_kind *k_ptr = &k_info[k_idx];
6875 /* Choose a color */
6876 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
6877 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
6880 if (!visual_only && k_ptr->flavor)
6882 /* Appearance of this object is shuffled */
6883 flavor_k_ptr = &k_info[k_ptr->flavor];
6887 /* Appearance of this object is very normal */
6888 flavor_k_ptr = k_ptr;
6893 attr = ((i + object_top == object_cur) ? cursor : attr);
6895 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
6898 strip_name(o_name, k_idx);
6903 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
6906 /* Display the name */
6907 c_prt(attr, o_name, row + i, col);
6909 /* Hack -- visual_list mode */
6912 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);
6914 if (p_ptr->wizard || visual_only)
6916 c_prt(attr, format("%d", k_idx), row + i, 70);
6919 a = flavor_k_ptr->x_attr;
6920 c = flavor_k_ptr->x_char;
6922 /* Display symbol */
6923 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
6926 /* Clear remaining lines */
6927 for (; i < per_page; i++)
6929 Term_erase(col, row + i, 255);
6934 * Describe fake object
6936 static void desc_obj_fake(KIND_OBJECT_IDX k_idx)
6939 object_type object_type_body;
6940 o_ptr = &object_type_body;
6943 /* Create the artifact */
6944 object_prep(o_ptr, k_idx);
6946 /* It's fully know */
6947 o_ptr->ident |= IDENT_KNOWN;
6949 /* Track the object */
6950 /* object_actual_track(o_ptr); */
6952 /* Hack - mark as fake */
6953 /* term_obj_real = FALSE; */
6956 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
6958 msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
6966 * Display known objects
6968 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx)
6972 IDX grp_cur, grp_top, old_grp_cur;
6973 IDX object_old, object_cur, object_top;
6983 bool visual_list = FALSE;
6984 TERM_COLOR attr_top = 0;
6992 Term_get_size(&wid, &hgt);
6994 browser_rows = hgt - 8;
6996 /* Allocate the "object_idx" array */
6997 C_MAKE(object_idx, max_k_idx, IDX);
7002 if (direct_k_idx < 0)
7004 mode = visual_only ? 0x03 : 0x01;
7006 /* Check every group */
7007 for (i = 0; object_group_text[i] != NULL; i++)
7009 /* Measure the label */
7010 len = strlen(object_group_text[i]);
7012 /* Save the maximum length */
7013 if (len > max) max = len;
7015 /* See if any monsters are known */
7016 if (collect_objects(i, object_idx, mode))
7018 /* Build a list of groups with known monsters */
7019 grp_idx[grp_cnt++] = i;
7028 object_kind *k_ptr = &k_info[direct_k_idx];
7029 object_kind *flavor_k_ptr;
7031 if (!visual_only && k_ptr->flavor)
7033 /* Appearance of this object is shuffled */
7034 flavor_k_ptr = &k_info[k_ptr->flavor];
7038 /* Appearance of this object is very normal */
7039 flavor_k_ptr = k_ptr;
7042 object_idx[0] = direct_k_idx;
7043 object_old = direct_k_idx;
7046 /* Terminate the list */
7049 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7050 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
7053 /* Terminate the list */
7054 grp_idx[grp_cnt] = -1;
7057 grp_cur = grp_top = 0;
7058 object_cur = object_top = 0;
7063 mode = visual_only ? 0x02 : 0x00;
7068 object_kind *k_ptr, *flavor_k_ptr;
7075 prt(format("%s - アイテム", !visual_only ? "知識" : "表示"), 2, 0);
7076 if (direct_k_idx < 0) prt("グループ", 4, 0);
7077 prt("名前", 4, max + 3);
7078 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
7081 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7082 if (direct_k_idx < 0) prt("Group", 4, 0);
7083 prt("Name", 4, max + 3);
7084 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
7088 for (i = 0; i < 78; i++)
7090 Term_putch(i, 5, TERM_WHITE, '=');
7093 if (direct_k_idx < 0)
7095 for (i = 0; i < browser_rows; i++)
7097 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7104 if (direct_k_idx < 0)
7106 /* Scroll group list */
7107 if (grp_cur < grp_top) grp_top = grp_cur;
7108 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7110 /* Display a list of object groups */
7111 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
7113 if (old_grp_cur != grp_cur)
7115 old_grp_cur = grp_cur;
7117 /* Get a list of objects in the current group */
7118 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
7121 /* Scroll object list */
7122 while (object_cur < object_top)
7123 object_top = MAX(0, object_top - browser_rows/2);
7124 while (object_cur >= object_top + browser_rows)
7125 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
7130 /* Display a list of objects in the current group */
7131 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
7135 object_top = object_cur;
7137 /* Display a list of objects in the current group */
7138 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
7140 /* Display visual list below first object */
7141 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7144 /* Get the current object */
7145 k_ptr = &k_info[object_idx[object_cur]];
7147 if (!visual_only && k_ptr->flavor)
7149 /* Appearance of this object is shuffled */
7150 flavor_k_ptr = &k_info[k_ptr->flavor];
7154 /* Appearance of this object is very normal */
7155 flavor_k_ptr = k_ptr;
7160 prt(format("<方向>%s%s%s, ESC",
7161 (!visual_list && !visual_only) ? ", 'r'で詳細を見る" : "",
7162 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
7163 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7166 prt(format("<dir>%s%s%s, ESC",
7167 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7168 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7169 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7175 /* Mega Hack -- track this object */
7176 if (object_cnt) object_kind_track(object_idx[object_cur]);
7178 /* The "current" object changed */
7179 if (object_old != object_idx[object_cur])
7183 /* Remember the "current" object */
7184 object_old = object_idx[object_cur];
7190 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
7194 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7198 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
7203 /* Do visual mode command if needed */
7204 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))
7206 if (direct_k_idx >= 0)
7231 /* Recall on screen */
7232 if (!visual_list && !visual_only && (grp_cnt > 0))
7234 desc_obj_fake(object_idx[object_cur]);
7242 /* Move the cursor */
7243 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
7249 /* Free the "object_idx" array */
7250 C_KILL(object_idx, max_k_idx, IDX);
7255 * Display the features in a group.
7257 static void display_feature_list(int col, int row, int per_page, FEAT_IDX *feat_idx,
7258 FEAT_IDX feat_cur, FEAT_IDX feat_top, bool visual_only, int lighting_level)
7260 int lit_col[F_LIT_MAX], i, j;
7261 int f_idx_col = use_bigtile ? 62 : 64;
7263 /* Correct columns 1 and 4 */
7264 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
7265 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7266 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
7268 /* Display lines until done */
7269 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
7274 FEAT_IDX f_idx = feat_idx[feat_top + i];
7276 /* Access the index */
7277 feature_type *f_ptr = &f_info[f_idx];
7279 int row_i = row + i;
7281 /* Choose a color */
7282 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
7284 /* Display the name */
7285 c_prt(attr, f_name + f_ptr->name, row_i, col);
7287 /* Hack -- visual_list mode */
7290 /* Display lighting level */
7291 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
7293 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));
7295 if (p_ptr->wizard || visual_only)
7297 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
7300 /* Display symbol */
7301 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);
7303 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
7304 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
7306 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
7308 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
7310 /* Mega-hack -- Use non-standard colour */
7311 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
7313 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
7317 /* Clear remaining lines */
7318 for (; i < per_page; i++)
7320 Term_erase(col, row + i, 255);
7326 * Interact with feature visuals.
7328 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level)
7332 IDX grp_cur, grp_top, old_grp_cur;
7333 IDX feat_cur, feat_top;
7343 bool visual_list = FALSE;
7344 TERM_COLOR attr_top = 0;
7350 TERM_COLOR attr_old[F_LIT_MAX];
7351 SYMBOL_CODE char_old[F_LIT_MAX];
7352 TERM_COLOR *cur_attr_ptr;
7353 SYMBOL_CODE *cur_char_ptr;
7355 (void)C_WIPE(attr_old, F_LIT_MAX, byte);
7356 (void)C_WIPE(char_old, F_LIT_MAX, byte);
7358 Term_get_size(&wid, &hgt);
7360 browser_rows = hgt - 8;
7362 /* Allocate the "feat_idx" array */
7363 C_MAKE(feat_idx, max_f_idx, IDX);
7368 if (direct_f_idx < 0)
7370 /* Check every group */
7371 for (i = 0; feature_group_text[i] != NULL; i++)
7373 /* Measure the label */
7374 len = strlen(feature_group_text[i]);
7376 /* Save the maximum length */
7377 if (len > max) max = len;
7379 /* See if any features are known */
7380 if (collect_features(i, feat_idx, 0x01))
7382 /* Build a list of groups with known features */
7383 grp_idx[grp_cnt++] = i;
7391 feature_type *f_ptr = &f_info[direct_f_idx];
7393 feat_idx[0] = direct_f_idx;
7396 /* Terminate the list */
7399 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7400 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
7402 for (i = 0; i < F_LIT_MAX; i++)
7404 attr_old[i] = f_ptr->x_attr[i];
7405 char_old[i] = f_ptr->x_char[i];
7409 /* Terminate the list */
7410 grp_idx[grp_cnt] = -1;
7413 grp_cur = grp_top = 0;
7414 feat_cur = feat_top = 0;
7422 feature_type *f_ptr;
7429 prt("表示 - 地形", 2, 0);
7430 if (direct_f_idx < 0) prt("グループ", 4, 0);
7431 prt("名前", 4, max + 3);
7434 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7435 prt("文字 ( l/ d)", 4, 66);
7439 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7440 prt("文字 (l/d)", 4, 68);
7443 prt("Visuals - features", 2, 0);
7444 if (direct_f_idx < 0) prt("Group", 4, 0);
7445 prt("Name", 4, max + 3);
7448 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7449 prt("Sym ( l/ d)", 4, 67);
7453 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7454 prt("Sym (l/d)", 4, 69);
7458 for (i = 0; i < 78; i++)
7460 Term_putch(i, 5, TERM_WHITE, '=');
7463 if (direct_f_idx < 0)
7465 for (i = 0; i < browser_rows; i++)
7467 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7474 if (direct_f_idx < 0)
7476 /* Scroll group list */
7477 if (grp_cur < grp_top) grp_top = grp_cur;
7478 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7480 /* Display a list of feature groups */
7481 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
7483 if (old_grp_cur != grp_cur)
7485 old_grp_cur = grp_cur;
7487 /* Get a list of features in the current group */
7488 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
7491 /* Scroll feature list */
7492 while (feat_cur < feat_top)
7493 feat_top = MAX(0, feat_top - browser_rows/2);
7494 while (feat_cur >= feat_top + browser_rows)
7495 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
7500 /* Display a list of features in the current group */
7501 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
7505 feat_top = feat_cur;
7507 /* Display a list of features in the current group */
7508 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
7510 /* Display visual list below first object */
7511 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7516 prt(format("<方向>%s, 'd'で標準光源効果%s, ESC",
7517 visual_list ? ", ENTERで決定, 'a'で対象明度変更" : ", 'v'でシンボル変更",
7518 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7521 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
7522 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
7523 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7527 /* Get the current feature */
7528 f_ptr = &f_info[feat_idx[feat_cur]];
7529 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
7530 cur_char_ptr = &f_ptr->x_char[*lighting_level];
7534 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
7538 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7542 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
7547 if (visual_list && ((ch == 'A') || (ch == 'a')))
7549 int prev_lighting_level = *lighting_level;
7553 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
7554 else (*lighting_level)--;
7558 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
7559 else (*lighting_level)++;
7562 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
7563 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7565 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
7566 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7571 else if ((ch == 'D') || (ch == 'd'))
7573 TERM_COLOR prev_x_attr = f_ptr->x_attr[*lighting_level];
7574 byte prev_x_char = f_ptr->x_char[*lighting_level];
7576 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
7580 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
7581 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7583 if (prev_x_char != f_ptr->x_char[*lighting_level])
7584 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7586 else *need_redraw = TRUE;
7591 /* Do visual mode command if needed */
7592 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))
7596 /* Restore previous visual settings */
7598 for (i = 0; i < F_LIT_MAX; i++)
7600 f_ptr->x_attr[i] = attr_old[i];
7601 f_ptr->x_char[i] = char_old[i];
7608 if (direct_f_idx >= 0) flag = TRUE;
7609 else *lighting_level = F_LIT_STANDARD;
7612 /* Preserve current visual settings */
7615 for (i = 0; i < F_LIT_MAX; i++)
7617 attr_old[i] = f_ptr->x_attr[i];
7618 char_old[i] = f_ptr->x_char[i];
7620 *lighting_level = F_LIT_STANDARD;
7627 for (i = 0; i < F_LIT_MAX; i++)
7629 attr_idx_feat[i] = f_ptr->x_attr[i];
7630 char_idx_feat[i] = f_ptr->x_char[i];
7639 /* Allow TERM_DARK text */
7640 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7642 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
7643 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
7661 /* Move the cursor */
7662 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
7668 /* Free the "feat_idx" array */
7669 C_KILL(feat_idx, max_f_idx, IDX);
7674 * List wanted monsters
7676 static void do_cmd_knowledge_kubi(void)
7681 char file_name[1024];
7684 /* Open a new file */
7685 fff = my_fopen_temp(file_name, 1024);
7687 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7694 bool listed = FALSE;
7697 fprintf(fff, "今日のターゲット : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "不明"));
7699 fprintf(fff, "賞金首リスト\n");
7701 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
7703 fprintf(fff, "List of wanted monsters\n");
7705 fprintf(fff, "----------------------------------------------\n");
7707 for (i = 0; i < MAX_KUBI; i++)
7709 if (kubi_r_idx[i] <= 10000)
7711 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
7719 fprintf(fff,"\n%s\n", _("賞金首はもう残っていません。", "There is no more wanted monster."));
7723 /* Close the file */
7726 /* Display the file contents */
7727 show_file(TRUE, file_name, _("賞金首の一覧", "Wanted monsters"), 0, 0);
7729 /* Remove the file */
7734 * List virtues & status
7736 static void do_cmd_knowledge_virtues(void)
7739 char file_name[1024];
7741 /* Open a new file */
7742 fff = my_fopen_temp(file_name, 1024);
7744 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7751 fprintf(fff, _("現在の属性 : %s\n\n", "Your alighnment : %s\n\n"), your_alignment());
7755 /* Close the file */
7758 /* Display the file contents */
7759 show_file(TRUE, file_name, _("八つの徳", "Virtues"), 0, 0);
7761 /* Remove the file */
7769 static void do_cmd_knowledge_dungeon(void)
7773 char file_name[1024];
7776 /* Open a new file */
7777 fff = my_fopen_temp(file_name, 1024);
7779 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7786 for (i = 1; i < max_d_idx; i++)
7790 if (!d_info[i].maxdepth) continue;
7791 if (!max_dlv[i]) continue;
7792 if (d_info[i].final_guardian)
7794 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
7796 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
7798 fprintf(fff, _("%c%-12s : %3d 階\n", "%c%-16s : level %3d\n"), seiha ? '!' : ' ', d_name + d_info[i].name, (int)max_dlv[i]);
7802 /* Close the file */
7805 /* Display the file contents */
7806 show_file(TRUE, file_name, _("今までに入ったダンジョン", "Dungeon"), 0, 0);
7808 /* Remove the file */
7813 * List virtues & status
7816 static void do_cmd_knowledge_stat(void)
7820 char file_name[1024];
7823 /* Open a new file */
7824 fff = my_fopen_temp(file_name, 1024);
7826 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7833 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
7834 (2 * p_ptr->hitdie +
7835 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
7838 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "現在の体力ランク : %d/100\n\n", percent);
7839 else fprintf(fff, "現在の体力ランク : ???\n\n");
7840 fprintf(fff, "能力の最大値\n\n");
7842 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
7843 else fprintf(fff, "Your current Life Rating is ???.\n\n");
7844 fprintf(fff, "Limits of maximum stats\n\n");
7846 for (v_nr = 0; v_nr < 6; v_nr++)
7848 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);
7849 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
7855 /* Close the file */
7858 /* Display the file contents */
7859 show_file(TRUE, file_name, _("自分に関する情報", "HP-rate & Max stat"), 0, 0);
7861 /* Remove the file */
7867 * Print all active quests
7869 static void do_cmd_knowledge_quests_current(FILE *fff)
7872 char rand_tmp_str[120] = "\0";
7874 monster_race *r_ptr;
7876 int rand_level = 100;
7879 fprintf(fff, _("《遂行中のクエスト》\n", "< Current Quest >\n"));
7881 for (i = 1; i < max_q_idx; i++)
7883 if ((quest[i].status == QUEST_STATUS_TAKEN) ||
7884 ((quest[i].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[i].type == QUEST_TYPE_TOWER)) ||
7885 (quest[i].status == QUEST_STATUS_COMPLETED))
7887 /* Set the quest number temporary */
7888 IDX old_quest = p_ptr->inside_quest;
7891 /* Clear the text */
7892 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
7893 quest_text_line = 0;
7895 p_ptr->inside_quest = i;
7897 /* Get the quest text */
7898 init_flags = INIT_SHOW_TEXT;
7900 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
7902 /* Reset the old quest number */
7903 p_ptr->inside_quest = old_quest;
7905 /* No info from "silent" quests */
7906 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
7910 if (quest[i].type != QUEST_TYPE_RANDOM)
7912 char note[80] = "\0";
7914 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_STAGE_COMPLETED)
7916 switch (quest[i].type)
7918 case QUEST_TYPE_KILL_LEVEL:
7919 case QUEST_TYPE_KILL_ANY_LEVEL:
7920 r_ptr = &r_info[quest[i].r_idx];
7921 strcpy(name, r_name + r_ptr->name);
7922 if (quest[i].max_num > 1)
7925 sprintf(note," - %d 体の%sを倒す。(あと %d 体)",
7926 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
7929 sprintf(note," - kill %d %s, have killed %d.",
7930 (int)quest[i].max_num, name, (int)quest[i].cur_num);
7934 sprintf(note,_(" - %sを倒す。", " - kill %s."),name);
7937 case QUEST_TYPE_FIND_ARTIFACT:
7940 artifact_type *a_ptr = &a_info[quest[i].k_idx];
7942 object_type *q_ptr = &forge;
7943 KIND_OBJECT_IDX k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
7944 object_prep(q_ptr, k_idx);
7945 q_ptr->name1 = quest[i].k_idx;
7946 q_ptr->ident = IDENT_STORE;
7947 object_desc(name, q_ptr, OD_NAME_ONLY);
7949 sprintf(note,_("\n - %sを見つけ出す。", "\n - Find out %s."), name);
7951 case QUEST_TYPE_FIND_EXIT:
7952 sprintf(note,_(" - 出口に到達する。", " - Reach to Exit."));
7955 case QUEST_TYPE_KILL_NUMBER:
7957 sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)",
7958 (int)quest[i].max_num, (int)(quest[i].max_num - quest[i].cur_num));
7960 sprintf(note," - Kill %d monsters, have killed %d.",
7961 (int)quest[i].max_num, (int)quest[i].cur_num);
7965 case QUEST_TYPE_KILL_ALL:
7966 case QUEST_TYPE_TOWER:
7967 sprintf(note,_(" - 全てのモンスターを倒す。", " - Kill all monsters."));
7972 /* Print the quest info */
7973 sprintf(tmp_str, _(" %s (危険度:%d階相当)%s\n", " %s (Danger level: %d)%s\n"),
7974 quest[i].name, (int)quest[i].level, note);
7976 fputs(tmp_str, fff);
7978 if (quest[i].status == QUEST_STATUS_COMPLETED)
7980 sprintf(tmp_str, _(" クエスト達成 - まだ報酬を受けとってない。\n", " Quest Completed - Unrewarded\n"));
7981 fputs(tmp_str, fff);
7987 while (quest_text[j][0] && j < 10)
7989 fprintf(fff, " %s\n", quest_text[j]);
7994 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
7997 rand_level = quest[i].level;
7999 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8001 /* Print the quest info */
8002 r_ptr = &r_info[quest[i].r_idx];
8003 strcpy(name, r_name + r_ptr->name);
8005 if (quest[i].max_num > 1)
8008 sprintf(rand_tmp_str," %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
8009 quest[i].name, (int)quest[i].level,
8010 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
8014 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8015 quest[i].name, (int)quest[i].level,
8016 (int)quest[i].max_num, name, (int)quest[i].cur_num);
8021 sprintf(rand_tmp_str,_(" %s (%d 階) - %sを倒す。\n", " %s (Dungeon level: %d)\n Kill %s.\n"),
8022 quest[i].name, (int)quest[i].level, name);
8029 /* Print the current random quest */
8030 if (rand_tmp_str[0]) fputs(rand_tmp_str, fff);
8032 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8036 static bool do_cmd_knowledge_quests_aux(FILE *fff, IDX q_idx)
8039 char playtime_str[16];
8040 quest_type* const q_ptr = &quest[q_idx];
8042 if (is_fixed_quest_idx(q_idx))
8044 /* Set the quest number temporary */
8045 IDX old_quest = p_ptr->inside_quest;
8047 p_ptr->inside_quest = q_idx;
8050 init_flags = INIT_NAME_ONLY;
8052 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8054 /* Reset the old quest number */
8055 p_ptr->inside_quest = old_quest;
8057 /* No info from "silent" quests */
8058 if (q_ptr->flags & QUEST_FLAG_SILENT) return FALSE;
8061 strnfmt(playtime_str, sizeof(playtime_str), "%02d:%02d:%02d",
8062 q_ptr->comptime/(60*60), (q_ptr->comptime/60)%60, q_ptr->comptime%60);
8064 if (!is_fixed_quest_idx(q_idx) && q_ptr->r_idx)
8066 /* Print the quest info */
8067 if (q_ptr->complev == 0)
8070 _(" %-35s (%3d階) - 不戦勝 - %s\n",
8071 " %-35s (Dungeon level: %3d) - Unearned - %s\n") ,
8072 r_name+r_info[q_ptr->r_idx].name,
8073 (int)q_ptr->level, playtime_str);
8078 _(" %-35s (%3d階) - レベル%2d - %s\n",
8079 " %-35s (Dungeon level: %3d) - level %2d - %s\n") ,
8080 r_name+r_info[q_ptr->r_idx].name,
8088 /* Print the quest info */
8090 _(" %-35s (危険度:%3d階相当) - レベル%2d - %s\n",
8091 " %-35s (Danger level: %3d) - level %2d - %s\n") ,
8092 q_ptr->name, (int)q_ptr->level, q_ptr->complev, playtime_str);
8095 fputs(tmp_str, fff);
8101 * Print all finished quests
8103 void do_cmd_knowledge_quests_completed(FILE *fff, IDX quest_num[])
8108 fprintf(fff, _("《達成したクエスト》\n", "< Completed Quest >\n"));
8109 for (i = 1; i < max_q_idx; i++)
8111 IDX q_idx = quest_num[i];
8112 quest_type* const q_ptr = &quest[q_idx];
8114 if (q_ptr->status == QUEST_STATUS_FINISHED &&
8115 do_cmd_knowledge_quests_aux(fff, q_idx))
8120 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8125 * Print all failed quests
8127 void do_cmd_knowledge_quests_failed(FILE *fff, IDX quest_num[])
8132 fprintf(fff, _("《失敗したクエスト》\n", "< Failed Quest >\n"));
8133 for (i = 1; i < max_q_idx; i++)
8135 IDX q_idx = quest_num[i];
8136 quest_type* const q_ptr = &quest[q_idx];
8138 if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) &&
8139 do_cmd_knowledge_quests_aux(fff, q_idx))
8144 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8149 * Print all random quests
8151 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
8157 fprintf(fff, _("《残りのランダムクエスト》\n", "< Remaining Random Quest >\n"));
8158 for (i = 1; i < max_q_idx; i++)
8160 /* No info from "silent" quests */
8161 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8163 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
8167 /* Print the quest info */
8168 sprintf(tmp_str, _(" %s (%d階, %s)\n", " %s (%d, %s)\n"),
8169 quest[i].name, (int)quest[i].level, r_name+r_info[quest[i].r_idx].name);
8170 fputs(tmp_str, fff);
8173 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8177 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
8179 QUEST_IDX *q_num = (QUEST_IDX *)u;
8180 quest_type *qa = &quest[q_num[a]];
8181 quest_type *qb = &quest[q_num[b]];
8186 return (qa->comptime != qb->comptime) ?
8187 (qa->comptime < qb->comptime) :
8188 (qa->level <= qb->level);
8191 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
8193 QUEST_IDX *q_num = (QUEST_IDX *)u;
8200 q_num[a] = q_num[b];
8206 * Print quest status of all active quests
8208 static void do_cmd_knowledge_quests(void)
8211 char file_name[1024];
8216 /* Open a new file */
8217 fff = my_fopen_temp(file_name, 1024);
8220 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8225 /* Allocate Memory */
8226 C_MAKE(quest_num, max_q_idx, IDX);
8228 /* Sort by compete level */
8229 for (i = 1; i < max_q_idx; i++) quest_num[i] = i;
8230 ang_sort_comp = ang_sort_comp_quest_num;
8231 ang_sort_swap = ang_sort_swap_quest_num;
8232 ang_sort(quest_num, &dummy, max_q_idx);
8234 /* Dump Quest Information */
8235 do_cmd_knowledge_quests_current(fff);
8237 do_cmd_knowledge_quests_completed(fff, quest_num);
8239 do_cmd_knowledge_quests_failed(fff, quest_num);
8243 do_cmd_knowledge_quests_wiz_random(fff);
8246 /* Close the file */
8249 /* Display the file contents */
8250 show_file(TRUE, file_name, _("クエスト達成状況", "Quest status"), 0, 0);
8252 /* Remove the file */
8256 C_KILL(quest_num, max_q_idx, IDX);
8263 static void do_cmd_knowledge_home(void)
8268 char file_name[1024];
8270 char o_name[MAX_NLEN];
8273 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
8275 /* Open a new file */
8276 fff = my_fopen_temp(file_name, 1024);
8278 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8285 /* Print all homes in the different towns */
8286 st_ptr = &town[1].store[STORE_HOME];
8288 /* Home -- if anything there */
8289 if (st_ptr->stock_num)
8294 /* Header with name of the town */
8295 fprintf(fff, _(" [ 我が家のアイテム ]\n", " [Home Inventory]\n"));
8297 /* Dump all available items */
8298 for (i = 0; i < st_ptr->stock_num; i++)
8301 if ((i % 12) == 0) fprintf(fff, "\n ( %d ページ )\n", x++);
8302 object_desc(o_name, &st_ptr->stock[i], 0);
8303 if (strlen(o_name) <= 80-3)
8305 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8311 for (n = 0, t = o_name; n < 80-3; n++, t++)
8312 if(iskanji(*t)) {t++; n++;}
8313 if (n == 81-3) n = 79-3; /* 最後が漢字半分 */
8315 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
8316 fprintf(fff, " %.77s\n", o_name+n);
8319 object_desc(o_name, &st_ptr->stock[i], 0);
8320 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8325 /* Add an empty line */
8326 fprintf(fff, "\n\n");
8330 /* Close the file */
8333 /* Display the file contents */
8334 show_file(TRUE, file_name, _("我が家のアイテム", "Home Inventory"), 0, 0);
8336 /* Remove the file */
8342 * Check the status of "autopick"
8344 static void do_cmd_knowledge_autopick(void)
8348 char file_name[1024];
8350 /* Open a new file */
8351 fff = my_fopen_temp(file_name, 1024);
8355 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8362 fprintf(fff, _("自動破壊/拾いには何も登録されていません。", "No preference for auto picker/destroyer."));
8366 fprintf(fff, _(" 自動拾い/破壊には現在 %d行登録されています。\n\n",
8367 " There are %d registered lines for auto picker/destroyer.\n\n"), max_autopick);
8370 for (k = 0; k < max_autopick; k++)
8373 byte act = autopick_list[k].action;
8374 if (act & DONT_AUTOPICK)
8376 tmp = _("放置", "Leave");
8378 else if (act & DO_AUTODESTROY)
8380 tmp = _("破壊", "Destroy");
8382 else if (act & DO_AUTOPICK)
8384 tmp = _("拾う", "Pickup");
8388 tmp = _("確認", "Query");
8391 if (act & DO_DISPLAY)
8392 fprintf(fff, "%11s", format("[%s]", tmp));
8394 fprintf(fff, "%11s", format("(%s)", tmp));
8396 tmp = autopick_line_from_entry(&autopick_list[k]);
8397 fprintf(fff, " %s", tmp);
8401 /* Close the file */
8403 /* Display the file contents */
8404 show_file(TRUE, file_name, _("自動拾い/破壊 設定リスト", "Auto-picker/Destroyer"), 0, 0);
8406 /* Remove the file */
8412 * Interact with "knowledge"
8414 void do_cmd_knowledge(void)
8417 bool need_redraw = FALSE;
8419 /* File type is "TEXT" */
8420 FILE_TYPE(FILE_TYPE_TEXT);
8422 /* Save the screen */
8425 /* Interact until done */
8431 /* Ask for a choice */
8432 prt(format(_("%d/2 ページ", "page %d/2"), (p+1)), 2, 65);
8433 prt(_("現在の知識を確認する", "Display current knowledge"), 3, 0);
8435 /* Give some choices */
8439 prt("(1) 既知の伝説のアイテム の一覧", 6, 5);
8440 prt("(2) 既知のアイテム の一覧", 7, 5);
8441 prt("(3) 既知の生きているユニーク・モンスター の一覧", 8, 5);
8442 prt("(4) 既知のモンスター の一覧", 9, 5);
8443 prt("(5) 倒した敵の数 の一覧", 10, 5);
8444 if (!vanilla_town) prt("(6) 賞金首 の一覧", 11, 5);
8445 prt("(7) 現在のペット の一覧", 12, 5);
8446 prt("(8) 我が家のアイテム の一覧", 13, 5);
8447 prt("(9) *鑑定*済み装備の耐性 の一覧", 14, 5);
8448 prt("(0) 地形の表示文字/タイル の一覧", 15, 5);
8452 prt("(a) 自分に関する情報 の一覧", 6, 5);
8453 prt("(b) 突然変異 の一覧", 7, 5);
8454 prt("(c) 武器の経験値 の一覧", 8, 5);
8455 prt("(d) 魔法の経験値 の一覧", 9, 5);
8456 prt("(e) 技能の経験値 の一覧", 10, 5);
8457 prt("(f) プレイヤーの徳 の一覧", 11, 5);
8458 prt("(g) 入ったダンジョン の一覧", 12, 5);
8459 prt("(h) 実行中のクエスト の一覧", 13, 5);
8460 prt("(i) 現在の自動拾い/破壊設定 の一覧", 14, 5);
8465 prt("(1) Display known artifacts", 6, 5);
8466 prt("(2) Display known objects", 7, 5);
8467 prt("(3) Display remaining uniques", 8, 5);
8468 prt("(4) Display known monster", 9, 5);
8469 prt("(5) Display kill count", 10, 5);
8470 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
8471 prt("(7) Display current pets", 12, 5);
8472 prt("(8) Display home inventory", 13, 5);
8473 prt("(9) Display *identified* equip.", 14, 5);
8474 prt("(0) Display terrain symbols.", 15, 5);
8478 prt("(a) Display about yourself", 6, 5);
8479 prt("(b) Display mutations", 7, 5);
8480 prt("(c) Display weapon proficiency", 8, 5);
8481 prt("(d) Display spell proficiency", 9, 5);
8482 prt("(e) Display misc. proficiency", 10, 5);
8483 prt("(f) Display virtues", 11, 5);
8484 prt("(g) Display dungeons", 12, 5);
8485 prt("(h) Display current quests", 13, 5);
8486 prt("(i) Display auto pick/destroy", 14, 5);
8490 prt(_("-続く-", "-more-"), 17, 8);
8491 prt(_("ESC) 抜ける", "ESC) Exit menu"), 21, 1);
8492 prt(_("SPACE) 次ページ", "SPACE) Next page"), 21, 30);
8493 /*prt("-) 前ページ", 21, 60);*/
8494 prt(_("コマンド:", "Command: "), 20, 0);
8497 if (i == ESCAPE) break;
8500 case ' ': /* Page change */
8504 case '1': /* Artifacts */
8505 do_cmd_knowledge_artifacts();
8507 case '2': /* Objects */
8508 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
8510 case '3': /* Uniques */
8511 do_cmd_knowledge_uniques();
8513 case '4': /* Monsters */
8514 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
8516 case '5': /* Kill count */
8517 do_cmd_knowledge_kill_count();
8519 case '6': /* wanted */
8520 if (!vanilla_town) do_cmd_knowledge_kubi();
8522 case '7': /* Pets */
8523 do_cmd_knowledge_pets();
8525 case '8': /* Home */
8526 do_cmd_knowledge_home();
8528 case '9': /* Resist list */
8529 do_cmd_knowledge_inven();
8531 case '0': /* Feature list */
8533 IDX lighting_level = F_LIT_STANDARD;
8534 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
8538 case 'a': /* Max stat */
8539 do_cmd_knowledge_stat();
8541 case 'b': /* Mutations */
8542 do_cmd_knowledge_mutations();
8544 case 'c': /* weapon-exp */
8545 do_cmd_knowledge_weapon_exp();
8547 case 'd': /* spell-exp */
8548 do_cmd_knowledge_spell_exp();
8550 case 'e': /* skill-exp */
8551 do_cmd_knowledge_skill_exp();
8553 case 'f': /* Virtues */
8554 do_cmd_knowledge_virtues();
8556 case 'g': /* Dungeon */
8557 do_cmd_knowledge_dungeon();
8559 case 'h': /* Quests */
8560 do_cmd_knowledge_quests();
8562 case 'i': /* Autopick */
8563 do_cmd_knowledge_autopick();
8565 default: /* Unknown option */
8572 /* Restore the screen */
8575 if (need_redraw) do_cmd_redraw();
8580 * Check on the status of an active quest
8582 void do_cmd_checkquest(void)
8584 /* File type is "TEXT" */
8585 FILE_TYPE(FILE_TYPE_TEXT);
8587 /* Save the screen */
8591 do_cmd_knowledge_quests();
8593 /* Restore the screen */
8599 * Display the time and date
8601 void do_cmd_time(void)
8603 int day, hour, min, full, start, end, num;
8611 extract_day_hour_min(&day, &hour, &min);
8613 full = hour * 100 + min;
8620 strcpy(desc, _("変な時刻だ。", "It is a strange time."));
8622 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
8623 else strcpy(day_buf, "*****");
8626 msg_format("%s日目, 時刻は%d:%02d %sです。",
8627 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
8628 min, (hour < 12) ? "AM" : "PM");
8630 msg_format("This is day %s. The time is %d:%02d %s.",
8631 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
8632 min, (hour < 12) ? "AM" : "PM");
8637 if (!randint0(10) || p_ptr->image)
8639 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timefun_j.txt", "timefun.txt"));
8643 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timenorm_j.txt", "timenorm.txt"));
8646 /* Open this file */
8647 fff = my_fopen(buf, "rt");
8651 /* Find this time */
8652 while (!my_fgets(fff, buf, sizeof(buf)))
8654 /* Ignore comments */
8655 if (!buf[0] || (buf[0] == '#')) continue;
8657 /* Ignore invalid lines */
8658 if (buf[1] != ':') continue;
8660 /* Process 'Start' */
8663 /* Extract the starting time */
8664 start = atoi(buf + 2);
8666 /* Assume valid for an hour */
8676 /* Extract the ending time */
8677 end = atoi(buf + 2);
8683 /* Ignore incorrect range */
8684 if ((start > full) || (full > end)) continue;
8686 /* Process 'Description' */
8691 /* Apply the randomizer */
8692 if (!randint0(num)) strcpy(desc, buf + 2);
8701 /* Close the file */