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);
922 if (i == ESCAPE) break;
936 do_cmd_erase_nikki();
940 prepare_movie_hooks();
942 default: /* Unknown option */
950 /* Restore the screen */
955 * @brief 画面を再描画するコマンドのメインルーチン
956 * Hack -- redraw the screen
960 * This command performs various low level updates, clears all the "extra"
961 * windows, does a total redraw of the main window, and requests all of the
962 * interesting updates and redraws that I can think of.
964 * This command is also used to "instantiate" the results of the user
965 * selecting various things, such as graphics mode, so it must call
966 * the "TERM_XTRA_REACT" hook before redrawing the windows.
969 void do_cmd_redraw(void)
976 /* Hack -- react to changes */
977 Term_xtra(TERM_XTRA_REACT, 0);
980 /* Combine and Reorder the pack (later) */
981 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
985 p_ptr->update |= (PU_TORCH);
988 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
990 /* Forget lite/view */
991 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
993 /* Update lite/view */
994 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
996 /* Update monsters */
997 p_ptr->update |= (PU_MONSTERS);
999 /* Redraw everything */
1000 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1003 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1006 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1010 /* Hack -- update */
1013 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1016 /* Redraw every window */
1017 for (j = 0; j < 8; j++)
1020 if (!angband_term[j]) continue;
1023 Term_activate(angband_term[j]);
1038 * @brief 名前を変更するコマンドのメインルーチン
1039 * Hack -- change name
1042 void do_cmd_change_name(void)
1051 /* Save the screen */
1059 /* Display the player */
1060 display_player(mode);
1065 display_player(mode);
1070 Term_putstr(2, 23, -1, TERM_WHITE,
1071 "['c'で名前変更, 'f'でファイルへ書出, 'h'でモード変更, ESCで終了]");
1073 Term_putstr(2, 23, -1, TERM_WHITE,
1074 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1082 if (c == ESCAPE) break;
1089 /* Process the player name */
1090 process_player_name(FALSE);
1096 sprintf(tmp, "%s.txt", player_base);
1097 if (get_string(_("ファイル名: ", "File name: "), tmp, 80))
1099 if (tmp[0] && (tmp[0] != ' '))
1101 file_character(tmp);
1118 /* Flush messages */
1122 /* Restore the screen */
1125 /* Redraw everything */
1126 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1133 * @brief 最近表示されたメッセージを再表示するコマンドのメインルーチン
1134 * Recall the most recent message
1137 void do_cmd_message_one(void)
1139 /* Recall one message XXX XXX XXX */
1140 prt(format("> %s", message_str(0)), 0, 0);
1145 * @brief メッセージのログを表示するコマンドのメインルーチン
1146 * Recall the most recent message
1150 * Show previous messages to the user -BEN-
1152 * The screen format uses line 0 and 23 for headers and prompts,
1153 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1155 * This command shows you which commands you are viewing, and allows
1156 * you to "search" for strings in the recall.
1158 * Note that messages may be longer than 80 characters, but they are
1159 * displayed using "infinite" length, with a special sub-command to
1160 * "slide" the virtual display to the left or right.
1162 * Attempt to only hilite the matching portions of the string.
1165 void do_cmd_messages(int num_now)
1169 char shower_str[81];
1170 char finder_str[81];
1177 Term_get_size(&wid, &hgt);
1179 /* Number of message lines in a screen */
1180 num_lines = hgt - 4;
1183 strcpy(finder_str, "");
1186 strcpy(shower_str, "");
1188 /* Total messages */
1191 /* Start on first message */
1194 /* Save the screen */
1200 /* Process requests until done */
1206 /* Dump up to 20 lines of messages */
1207 for (j = 0; (j < num_lines) && (i + j < n); j++)
1209 cptr msg = message_str(i+j);
1211 /* Dump the messages, bottom to top */
1212 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1214 /* Hilite "shower" */
1215 if (shower && shower[0])
1219 /* Display matches */
1220 while ((str = my_strstr(str, shower)) != NULL)
1222 int len = strlen(shower);
1224 /* Display the match */
1225 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1233 /* Erase remaining lines */
1234 for (; j < num_lines; j++)
1236 Term_erase(0, num_lines + 1 - j, 255);
1239 /* Display header XXX XXX XXX */
1241 prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"),
1242 i, i + j - 1, n), 0, 0);
1244 /* Display prompt (not very informative) */
1245 prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]",
1246 "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0);
1249 skey = inkey_special(TRUE);
1251 /* Exit on Escape */
1252 if (skey == ESCAPE) break;
1254 /* Hack -- Save the old index */
1259 /* Hack -- handle show */
1262 prt(_("強調: ", "Show: "), hgt - 1, 0);
1264 /* Get a "shower" string, or continue */
1265 strcpy(back_str, shower_str);
1266 if (askfor(shower_str, 80))
1269 shower = shower_str[0] ? shower_str : NULL;
1271 else strcpy(shower_str, back_str);
1276 /* Hack -- handle find */
1283 prt(_("検索: ", "Find: "), hgt - 1, 0);
1285 /* Get a "finder" string, or continue */
1286 strcpy(back_str, finder_str);
1287 if (!askfor(finder_str, 80))
1289 strcpy(finder_str, back_str);
1292 else if (!finder_str[0])
1294 shower = NULL; /* Stop showing */
1299 shower = finder_str;
1302 for (z = i + 1; z < n; z++)
1304 cptr msg = message_str(z);
1307 if (my_strstr(msg, finder_str))
1319 /* Recall 1 older message */
1321 /* Go to the oldest line */
1325 /* Recall 1 newer message */
1327 /* Go to the newest line */
1331 /* Recall 1 older message */
1336 /* Go older if legal */
1337 i = MIN(i + 1, n - num_lines);
1340 /* Recall 10 older messages */
1342 /* Go older if legal */
1343 i = MIN(i + 10, n - num_lines);
1346 /* Recall 20 older messages */
1351 /* Go older if legal */
1352 i = MIN(i + num_lines, n - num_lines);
1355 /* Recall 20 newer messages */
1359 /* Go newer (if able) */
1360 i = MAX(0, i - num_lines);
1363 /* Recall 10 newer messages */
1365 /* Go newer (if able) */
1369 /* Recall 1 newer messages */
1372 /* Go newer (if able) */
1377 /* Hack -- Error of some kind */
1381 /* Restore the screen */
1387 * @brief チートオプションを変更するコマンドのメインルーチン
1388 * Interact with some options for cheating
1389 * @param info 表示メッセージ
1392 static void do_cmd_options_cheat(cptr info)
1395 int i, k = 0, n = CHEAT_MAX;
1401 /* Interact with the player */
1406 /* Prompt XXX XXX XXX */
1407 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info);
1412 /* 詐欺オプションをうっかりいじってしまう人がいるようなので注意 */
1413 prt(" << 注意 >>", 11, 0);
1414 prt(" 詐欺オプションを一度でも設定すると、スコア記録が残らなくなります!", 12, 0);
1415 prt(" 後に解除してもダメですので、勝利者を目指す方はここのオプションはい", 13, 0);
1416 prt(" じらないようにして下さい。", 14, 0);
1418 /* Display the options */
1419 for (i = 0; i < n; i++)
1421 byte a = TERM_WHITE;
1423 /* Color current option */
1424 if (i == k) a = TERM_L_BLUE;
1426 /* Display the option text */
1427 sprintf(buf, "%-48s: %s (%s)",
1428 cheat_info[i].o_desc,
1429 (*cheat_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1430 cheat_info[i].o_text);
1431 c_prt(a, buf, i + 2, 0);
1434 /* Hilite current option */
1435 move_cursor(k + 2, 50);
1441 * HACK - Try to translate the key into a direction
1442 * to allow using the roguelike keys for navigation.
1444 dir = get_keymap_dir(ch);
1445 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1459 k = (n + k - 1) % n;
1477 do_cmd_write_nikki(NIKKI_BUNSHOU, 0,
1478 _("詐欺オプションをONにして、スコアを残せなくなった。", "give up sending score to use cheating options."));
1479 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1480 (*cheat_info[k].o_var) = TRUE;
1489 (*cheat_info[k].o_var) = FALSE;
1496 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), cheat_info[k].o_text);
1497 /* Peruse the help file */
1498 (void)show_file(TRUE, buf, NULL, 0, 0);
1515 * @brief セーブ頻度ターンの次の値を返す
1516 * @param current 現在のセーブ頻度ターン値
1517 * @return 次のセーブ頻度ターン値
1519 static s16b toggle_frequency(s16b current)
1524 case 50: return 100;
1525 case 100: return 250;
1526 case 250: return 500;
1527 case 500: return 1000;
1528 case 1000: return 2500;
1529 case 2500: return 5000;
1530 case 5000: return 10000;
1531 case 10000: return 25000;
1538 * @brief 自動セーブオプションを変更するコマンドのメインルーチン
1539 * @param info 表示メッセージ
1542 static void do_cmd_options_autosave(cptr info)
1546 int i, k = 0, n = 2;
1554 /* Interact with the player */
1557 /* Prompt XXX XXX XXX */
1558 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, F で頻度を入力, ESC で決定 ) ",
1559 "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) "), info);
1563 /* Display the options */
1564 for (i = 0; i < n; i++)
1566 byte a = TERM_WHITE;
1568 /* Color current option */
1569 if (i == k) a = TERM_L_BLUE;
1571 /* Display the option text */
1572 sprintf(buf, "%-48s: %s (%s)",
1573 autosave_info[i].o_desc,
1574 (*autosave_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1575 autosave_info[i].o_text);
1576 c_prt(a, buf, i + 2, 0);
1578 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1580 /* Hilite current option */
1581 move_cursor(k + 2, 50);
1597 k = (n + k - 1) % n;
1615 (*autosave_info[k].o_var) = TRUE;
1624 (*autosave_info[k].o_var) = FALSE;
1632 autosave_freq = toggle_frequency(autosave_freq);
1633 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1639 (void)show_file(TRUE, _("joption.txt#Autosave", "option.txt#Autosave"), NULL, 0, 0);
1655 * @brief 標準オプションを変更するコマンドのサブルーチン /
1656 * Interact with some options
1657 * @param page オプションページ番号
1658 * @param info 表示メッセージ
1661 void do_cmd_options_aux(int page, cptr info)
1664 int i, k = 0, n = 0, l;
1667 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1668 (!p_ptr->wizard || !allow_debug_opts);
1671 /* Lookup the options */
1672 for (i = 0; i < 24; i++) opt[i] = 0;
1674 /* Scan the options */
1675 for (i = 0; option_info[i].o_desc; i++)
1677 /* Notice options on this "page" */
1678 if (option_info[i].o_page == page) opt[n++] = i;
1685 /* Interact with the player */
1690 /* Prompt XXX XXX XXX */
1691 sprintf(buf, _("%s (リターン:次, %sESC:終了, ?:ヘルプ) ", "%s (RET:next, %s, ?:help) "),
1692 info, browse_only ? _("", "ESC:exit") : _("y/n:変更, ", "y/n:change, ESC:accept"));
1695 /* HACK -- description for easy-auto-destroy options */
1696 if (page == OPT_PAGE_AUTODESTROY)
1697 c_prt(TERM_YELLOW, _("以下のオプションは、簡易自動破壊を使用するときのみ有効",
1698 "Following options will protect items from easy auto-destroyer."), 6, _(6, 3));
1700 /* Display the options */
1701 for (i = 0; i < n; i++)
1703 byte a = TERM_WHITE;
1705 /* Color current option */
1706 if (i == k) a = TERM_L_BLUE;
1708 /* Display the option text */
1709 sprintf(buf, "%-48s: %s (%.19s)",
1710 option_info[opt[i]].o_desc,
1711 (*option_info[opt[i]].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1712 option_info[opt[i]].o_text);
1713 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1714 else c_prt(a, buf, i + 2, 0);
1717 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
1720 /* Hilite current option */
1721 move_cursor(k + 2 + l, 50);
1727 * HACK - Try to translate the key into a direction
1728 * to allow using the roguelike keys for navigation.
1730 dir = get_keymap_dir(ch);
1731 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1745 k = (n + k - 1) % n;
1762 if (browse_only) break;
1763 (*option_info[opt[k]].o_var) = TRUE;
1772 if (browse_only) break;
1773 (*option_info[opt[k]].o_var) = FALSE;
1781 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
1787 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), option_info[opt[k]].o_text);
1788 /* Peruse the help file */
1789 (void)show_file(TRUE, buf, NULL, 0, 0);
1806 * @brief ウィンドウオプションを変更するコマンドのメインルーチン /
1807 * Modify the "window" options
1810 static void do_cmd_options_win(void)
1820 /* Memorize old flags */
1821 for (j = 0; j < 8; j++)
1823 /* Acquire current flags */
1824 old_flag[j] = window_flag[j];
1834 /* Prompt XXX XXX XXX */
1835 prt(_("ウィンドウ・フラグ (<方向>で移動, tでチェンジ, y/n でセット, ESC)", "Window Flags (<dir>, t, y, n, ESC) "), 0, 0);
1837 /* Display the windows */
1838 for (j = 0; j < 8; j++)
1840 byte a = TERM_WHITE;
1842 cptr s = angband_term_name[j];
1845 if (j == x) a = TERM_L_BLUE;
1847 /* Window name, staggered, centered */
1848 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
1851 /* Display the options */
1852 for (i = 0; i < 16; i++)
1854 byte a = TERM_WHITE;
1856 cptr str = window_flag_desc[i];
1859 if (i == y) a = TERM_L_BLUE;
1862 if (!str) str = _("(未使用)", "(Unused option)");
1865 Term_putstr(0, i + 5, -1, a, str);
1867 /* Display the windows */
1868 for (j = 0; j < 8; j++)
1874 if ((i == y) && (j == x)) a = TERM_L_BLUE;
1877 if (window_flag[j] & (1L << i)) c = 'X';
1880 Term_putch(35 + j * 5, i + 5, a, c);
1885 Term_gotoxy(35 + x * 5, y + 5);
1903 for (j = 0; j < 8; j++)
1905 window_flag[j] &= ~(1L << y);
1909 for (i = 0; i < 16; i++)
1911 window_flag[x] &= ~(1L << i);
1924 window_flag[x] |= (1L << y);
1932 window_flag[x] &= ~(1L << y);
1938 (void)show_file(TRUE, _("joption.txt#Window", "option.txt#Window"), NULL, 0, 0);
1946 d = get_keymap_dir(ch);
1948 x = (x + ddx[d] + 8) % 8;
1949 y = (y + ddy[d] + 16) % 16;
1956 /* Notice changes */
1957 for (j = 0; j < 8; j++)
1962 if (!angband_term[j]) continue;
1964 /* Ignore non-changes */
1965 if (window_flag[j] == old_flag[j]) continue;
1968 Term_activate(angband_term[j]);
1991 option_fields[OPT_NUM] =
1994 { '1', " キー入力 オプション", 3 },
1995 { '2', " マップ画面 オプション", 4 },
1996 { '3', " テキスト表示 オプション", 5 },
1997 { '4', " ゲームプレイ オプション", 6 },
1998 { '5', " 行動中止関係 オプション", 7 },
1999 { '6', " 簡易自動破壊 オプション", 8 },
2000 { 'r', " プレイ記録 オプション", 9 },
2002 { 'p', "自動拾いエディタ", 11 },
2003 { 'd', " 基本ウェイト量 ", 12 },
2004 { 'h', "低ヒットポイント", 13 },
2005 { 'm', " 低魔力色閾値 ", 14 },
2006 { 'a', " 自動セーブ オプション", 15 },
2007 { 'w', "ウインドウフラグ", 16 },
2009 { 'b', " 初期 オプション (参照のみ)", 18 },
2010 { 'c', " 詐欺 オプション", 19 },
2012 { '1', "Input Options", 3 },
2013 { '2', "Map Screen Options", 4 },
2014 { '3', "Text Display Options", 5 },
2015 { '4', "Game-Play Options", 6 },
2016 { '5', "Disturbance Options", 7 },
2017 { '6', "Easy Auto-Destroyer Options", 8 },
2018 { 'r', "Play record Options", 9 },
2020 { 'p', "Auto-picker/destroyer editor", 11 },
2021 { 'd', "Base Delay Factor", 12 },
2022 { 'h', "Hitpoint Warning", 13 },
2023 { 'm', "Mana Color Threshold", 14 },
2024 { 'a', "Autosave Options", 15 },
2025 { 'w', "Window Flags", 16 },
2027 { 'b', "Birth Options (Browse Only)", 18 },
2028 { 'c', "Cheat Options", 19 },
2034 * @brief 標準オプションを変更するコマンドのメインルーチン /
2035 * Set or unset various options.
2039 * The user must use the "Ctrl-R" command to "adapt" to changes
2040 * in any options which control "visual" aspects of the game.
2043 void do_cmd_options(void)
2049 /* Save the screen */
2057 /* Does not list cheat option when cheat option is off */
2058 if (!p_ptr->noscore && !allow_debug_opts) n--;
2063 /* Why are we here */
2064 prt(_("[ オプションの設定 ]", "TinyAngband options"), 1, 0);
2068 /* Give some choices */
2069 for (i = 0; i < n; i++)
2071 byte a = TERM_WHITE;
2072 if (i == y) a = TERM_L_BLUE;
2073 Term_putstr(5, option_fields[i].row, -1, a,
2074 format("(%c) %s", toupper(option_fields[i].key), option_fields[i].name));
2077 prt(_("<方向>で移動, Enterで決定, ESCでキャンセル, ?でヘルプ: ", "Move to <dir>, Select to Enter, Cancel to ESC, ? to help: "), 21, 0);
2080 skey = inkey_special(TRUE);
2081 if (!(skey & SKEY_MASK)) k = (char)skey;
2085 if (k == ESCAPE) break;
2087 if (my_strchr("\n\r ", k))
2089 k = option_fields[y].key;
2093 for (i = 0; i < n; i++)
2095 if (tolower(k) == option_fields[i].key) break;
2098 /* Command is found */
2101 /* Hack -- browse help */
2102 if (k == '?') break;
2106 if (skey == SKEY_UP) d = 8;
2107 if (skey == SKEY_DOWN) d = 2;
2108 y = (y + ddy[d] + n) % n;
2113 if (k == ESCAPE) break;
2120 /* Process the general options */
2121 do_cmd_options_aux(OPT_PAGE_INPUT, _("キー入力オプション", "Input Options"));
2127 /* Process the general options */
2128 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, _("マップ画面オプション", "Map Screen Options"));
2135 do_cmd_options_aux(OPT_PAGE_TEXT, _("テキスト表示オプション", "Text Display Options"));
2142 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, _("ゲームプレイ・オプション", "Game-Play Options"));
2149 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, _("行動中止関係のオプション", "Disturbance Options"));
2156 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, _("簡易自動破壊オプション", "Easy Auto-Destroyer Options"));
2160 /* Play-record Options */
2165 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, _("プレイ記録オプション", "Play-record Options"));
2174 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ?
2175 _("初期オプション(参照のみ)", "Birth Options(browse only)") :
2176 _("初期オプション((*)はスコアに影響)", "Birth Options((*)s effect score)"));
2180 /* Cheating Options */
2183 if (!p_ptr->noscore && !allow_debug_opts)
2185 /* Cheat options are not permitted */
2191 do_cmd_options_cheat(_("詐欺師は決して勝利できない!", "Cheaters never win"));
2198 do_cmd_options_autosave(_("自動セーブ", "Autosave"));
2207 do_cmd_options_win();
2208 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2209 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2210 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2211 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON |
2216 /* Auto-picker/destroyer editor */
2220 do_cmd_edit_autopick();
2224 /* Hack -- Delay Speed */
2230 prt(_("コマンド: 基本ウェイト量", "Command: Base Delay Factor"), 19, 0);
2232 /* Get a new value */
2235 int msec = delay_factor * delay_factor * delay_factor;
2236 prt(format(_("現在のウェイト: %d (%dミリ秒)", "Current base delay factor: %d (%d msec)"), delay_factor, msec), 22, 0);
2237 prt(_("ウェイト (0-9) ESCで決定: ", "Delay Factor (0-9 or ESC to accept): "), 20, 0);
2239 if (k == ESCAPE) break;
2242 (void)show_file(TRUE, _("joption.txt#BaseDelay", "option.txt#BaseDelay"), NULL, 0, 0);
2245 else if (isdigit(k)) delay_factor = D2I(k);
2252 /* Hack -- hitpoint warning factor */
2258 prt(_("コマンド: 低ヒットポイント警告", "Command: Hitpoint Warning"), 19, 0);
2260 /* Get a new value */
2263 prt(format(_("現在の低ヒットポイント警告: %d0%%", "Current hitpoint warning: %d0%%"), hitpoint_warn), 22, 0);
2264 prt(_("低ヒットポイント警告 (0-9) ESCで決定: ", "Hitpoint Warning (0-9 or ESC to accept): "), 20, 0);
2266 if (k == ESCAPE) break;
2269 (void)show_file(TRUE, _("joption.txt#Hitpoint", "option.txt#Hitpoint"), NULL, 0, 0);
2272 else if (isdigit(k)) hitpoint_warn = D2I(k);
2279 /* Hack -- mana color factor */
2285 prt(_("コマンド: 低魔力色閾値", "Command: Mana Color Threshold"), 19, 0);
2287 /* Get a new value */
2290 prt(format(_("現在の低魔力色閾値: %d0%%", "Current mana color threshold: %d0%%"), mana_warn), 22, 0);
2291 prt(_("低魔力閾値 (0-9) ESCで決定: ", "Mana color Threshold (0-9 or ESC to accept): "), 20, 0);
2293 if (k == ESCAPE) break;
2296 (void)show_file(TRUE, _("joption.txt#Manapoint", "option.txt#Manapoint"), NULL, 0, 0);
2299 else if (isdigit(k)) mana_warn = D2I(k);
2307 (void)show_file(TRUE, _("joption.txt", "option.txt"), NULL, 0, 0);
2311 /* Unknown option */
2320 /* Flush messages */
2325 /* Restore the screen */
2328 /* Hack - Redraw equippy chars */
2329 p_ptr->redraw |= (PR_EQUIPPY);
2335 * @brief prefファイルを選択して処理する /
2336 * Ask for a "user pref line" and process it
2339 * XXX XXX XXX Allow absolute file names?
2341 void do_cmd_pref(void)
2348 /* Ask for a "user pref command" */
2349 if (!get_string(_("設定変更コマンド: ", "Pref: "), buf, 80)) return;
2351 /* Process that pref command */
2352 (void)process_pref_file_command(buf);
2356 * @brief 自動拾い設定ファイルをロードするコマンドのメインルーチン /
2359 void do_cmd_reload_autopick(void)
2361 if (!get_check(_("自動拾い設定ファイルをロードしますか? ", "Reload auto-pick preference file? "))) return;
2362 /* Load the file with messages */
2363 autopick_load_pref(TRUE);
2369 * @brief マクロ情報をprefファイルに保存する /
2370 * @param fname ファイル名
2373 static errr macro_dump(cptr fname)
2375 static cptr mark = "Macro Dump";
2381 /* Build the filename */
2382 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2384 /* File type is "TEXT" */
2385 FILE_TYPE(FILE_TYPE_TEXT);
2387 /* Append to the file */
2388 if (!open_auto_dump(buf, mark)) return (-1);
2391 auto_dump_printf(_("\n# 自動マクロセーブ\n\n", "\n# Automatic macro dump\n\n"));
2394 for (i = 0; i < macro__num; i++)
2396 /* Extract the action */
2397 ascii_to_text(buf, macro__act[i]);
2399 /* Dump the macro */
2400 auto_dump_printf("A:%s\n", buf);
2402 /* Extract the action */
2403 ascii_to_text(buf, macro__pat[i]);
2405 /* Dump normal macros */
2406 auto_dump_printf("P:%s\n", buf);
2409 auto_dump_printf("\n");
2421 * @brief マクロのトリガーキーを取得する /
2422 * Hack -- ask for a "trigger" (see below)
2423 * @param buf キー表記を保管するバッファ
2427 * Note the complex use of the "inkey()" function from "util.c".
2429 * Note that both "flush()" calls are extremely important.
2432 static void do_cmd_macro_aux(char *buf)
2441 /* Do not process macros */
2447 /* Read the pattern */
2453 /* Do not process macros */
2456 /* Do not wait for keys */
2459 /* Attempt to read a key */
2470 /* Convert the trigger */
2471 ascii_to_text(tmp, buf);
2473 /* Hack -- display the trigger */
2474 Term_addstr(-1, TERM_WHITE, tmp);
2480 * @brief マクロのキー表記からアスキーコードを得てターミナルに表示する /
2481 * Hack -- ask for a keymap "trigger" (see below)
2482 * @param buf キー表記を取得するバッファ
2486 * Note that both "flush()" calls are extremely important. This may
2487 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2490 static void do_cmd_macro_aux_keymap(char *buf)
2504 /* Convert to ascii */
2505 ascii_to_text(tmp, buf);
2507 /* Hack -- display the trigger */
2508 Term_addstr(-1, TERM_WHITE, tmp);
2517 * @brief キーマップをprefファイルにダンプする /
2518 * Hack -- append all keymaps to the given file
2519 * @param fname ファイルネーム
2523 static errr keymap_dump(cptr fname)
2525 static cptr mark = "Keymap Dump";
2534 if (rogue_like_commands)
2536 mode = KEYMAP_MODE_ROGUE;
2542 mode = KEYMAP_MODE_ORIG;
2546 /* Build the filename */
2547 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2549 /* File type is "TEXT" */
2550 FILE_TYPE(FILE_TYPE_TEXT);
2552 /* Append to the file */
2553 if (!open_auto_dump(buf, mark)) return -1;
2556 auto_dump_printf(_("\n# 自動キー配置セーブ\n\n", "\n# Automatic keymap dump\n\n"));
2559 for (i = 0; i < 256; i++)
2563 /* Loop up the keymap */
2564 act = keymap_act[mode][i];
2566 /* Skip empty keymaps */
2569 /* Encode the key */
2572 ascii_to_text(key, buf);
2574 /* Encode the action */
2575 ascii_to_text(buf, act);
2577 /* Dump the macro */
2578 auto_dump_printf("A:%s\n", buf);
2579 auto_dump_printf("C:%d:%s\n", mode, key);
2591 * @brief マクロを設定するコマンドのメインルーチン /
2592 * Interact with "macros"
2596 * Note that the macro "action" must be defined before the trigger.
2598 * Could use some helpful instructions on this page. XXX XXX XXX
2601 void do_cmd_macros(void)
2613 if (rogue_like_commands)
2615 mode = KEYMAP_MODE_ROGUE;
2621 mode = KEYMAP_MODE_ORIG;
2624 /* File type is "TEXT" */
2625 FILE_TYPE(FILE_TYPE_TEXT);
2632 /* Process requests until done */
2639 prt(_("[ マクロの設定 ]", "Interact with Macros"), 2, 0);
2641 /* Describe that action */
2642 prt(_("マクロ行動が(もしあれば)下に表示されます:", "Current action (if any) shown below:"), 20, 0);
2644 /* Analyze the current action */
2645 ascii_to_text(buf, macro__buf);
2647 /* Display the current action */
2652 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
2654 prt(_("(2) ファイルにマクロを追加", "(2) Append macros to a file"), 5, 5);
2655 prt(_("(3) マクロの確認", "(3) Query a macro"), 6, 5);
2656 prt(_("(4) マクロの作成", "(4) Create a macro"), 7, 5);
2657 prt(_("(5) マクロの削除", "(5) Remove a macro"), 8, 5);
2658 prt(_("(6) ファイルにキー配置を追加", "(6) Append keymaps to a file"), 9, 5);
2659 prt(_("(7) キー配置の確認", "(7) Query a keymap"), 10, 5);
2660 prt(_("(8) キー配置の作成", "(8) Create a keymap"), 11, 5);
2661 prt(_("(9) キー配置の削除", "(9) Remove a keymap"), 12, 5);
2662 prt(_("(0) マクロ行動の入力", "(0) Enter a new action"), 13, 5);
2663 #endif /* ALLOW_MACROS */
2666 prt(_("コマンド: ", "Command: "), 16, 0);
2672 if (i == ESCAPE) break;
2674 /* Load a 'macro' file */
2680 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 16, 0);
2683 prt(_("ファイル: ", "File: "), 18, 0);
2685 /* Default filename */
2686 sprintf(tmp, "%s.prf", player_base);
2688 /* Ask for a file */
2689 if (!askfor(tmp, 80)) continue;
2691 /* Process the given filename */
2692 err = process_pref_file(tmp);
2695 msg_format(_("標準の設定ファイル'%s'を読み込みました。", "Loaded default '%s'."), tmp);
2700 msg_format(_("'%s'の読み込みに失敗しました!", "Failed to load '%s'!"), tmp);
2704 msg_format(_("'%s'を読み込みました。", "Loaded '%s'."), tmp);
2714 prt(_("コマンド: マクロをファイルに追加する", "Command: Append macros to a file"), 16, 0);
2717 prt(_("ファイル: ", "File: "), 18, 0);
2719 /* Default filename */
2720 sprintf(tmp, "%s.prf", player_base);
2722 /* Ask for a file */
2723 if (!askfor(tmp, 80)) continue;
2725 /* Dump the macros */
2726 (void)macro_dump(tmp);
2729 msg_print(_("マクロを追加しました。", "Appended macros."));
2738 prt(_("コマンド: マクロの確認", "Command: Query a macro"), 16, 0);
2742 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2744 /* Get a macro trigger */
2745 do_cmd_macro_aux(buf);
2747 /* Acquire action */
2748 k = macro_find_exact(buf);
2754 msg_print(_("そのキーにはマクロは定義されていません。", "Found no macro."));
2760 /* Obtain the action */
2761 strcpy(macro__buf, macro__act[k]);
2763 /* Analyze the current action */
2764 ascii_to_text(buf, macro__buf);
2766 /* Display the current action */
2770 msg_print(_("マクロを確認しました。", "Found a macro."));
2774 /* Create a macro */
2778 prt(_("コマンド: マクロの作成", "Command: Create a macro"), 16, 0);
2781 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2783 /* Get a macro trigger */
2784 do_cmd_macro_aux(buf);
2790 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2791 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2794 prt(_("マクロ行動: ", "Action: "), 20, 0);
2796 /* Convert to text */
2797 ascii_to_text(tmp, macro__buf);
2799 /* Get an encoded action */
2800 if (askfor(tmp, 80))
2802 /* Convert to ascii */
2803 text_to_ascii(macro__buf, tmp);
2805 /* Link the macro */
2806 macro_add(buf, macro__buf);
2809 msg_print(_("マクロを追加しました。", "Added a macro."));
2813 /* Remove a macro */
2817 prt(_("コマンド: マクロの削除", "Command: Remove a macro"), 16, 0);
2820 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2822 /* Get a macro trigger */
2823 do_cmd_macro_aux(buf);
2825 /* Link the macro */
2826 macro_add(buf, buf);
2829 msg_print(_("マクロを削除しました。", "Removed a macro."));
2836 prt(_("コマンド: キー配置をファイルに追加する", "Command: Append keymaps to a file"), 16, 0);
2839 prt(_("ファイル: ", "File: "), 18, 0);
2841 /* Default filename */
2842 sprintf(tmp, "%s.prf", player_base);
2844 /* Ask for a file */
2845 if (!askfor(tmp, 80)) continue;
2847 /* Dump the macros */
2848 (void)keymap_dump(tmp);
2851 msg_print(_("キー配置を追加しました。", "Appended keymaps."));
2854 /* Query a keymap */
2860 prt(_("コマンド: キー配置の確認", "Command: Query a keymap"), 16, 0);
2863 prt(_("押すキー: ", "Keypress: "), 18, 0);
2865 /* Get a keymap trigger */
2866 do_cmd_macro_aux_keymap(buf);
2868 /* Look up the keymap */
2869 act = keymap_act[mode][(byte)(buf[0])];
2875 msg_print(_("キー配置は定義されていません。", "Found no keymap."));
2881 /* Obtain the action */
2882 strcpy(macro__buf, act);
2884 /* Analyze the current action */
2885 ascii_to_text(buf, macro__buf);
2887 /* Display the current action */
2891 msg_print(_("キー配置を確認しました。", "Found a keymap."));
2895 /* Create a keymap */
2899 prt(_("コマンド: キー配置の作成", "Command: Create a keymap"), 16, 0);
2902 prt(_("押すキー: ", "Keypress: "), 18, 0);
2904 /* Get a keymap trigger */
2905 do_cmd_macro_aux_keymap(buf);
2911 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2912 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2915 prt(_("行動: ", "Action: "), 20, 0);
2917 /* Convert to text */
2918 ascii_to_text(tmp, macro__buf);
2920 /* Get an encoded action */
2921 if (askfor(tmp, 80))
2923 /* Convert to ascii */
2924 text_to_ascii(macro__buf, tmp);
2926 /* Free old keymap */
2927 string_free(keymap_act[mode][(byte)(buf[0])]);
2929 /* Make new keymap */
2930 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
2933 msg_print(_("キー配置を追加しました。", "Added a keymap."));
2937 /* Remove a keymap */
2941 prt(_("コマンド: キー配置の削除", "Command: Remove a keymap"), 16, 0);
2944 prt(_("押すキー: ", "Keypress: "), 18, 0);
2946 /* Get a keymap trigger */
2947 do_cmd_macro_aux_keymap(buf);
2949 /* Free old keymap */
2950 string_free(keymap_act[mode][(byte)(buf[0])]);
2952 /* Make new keymap */
2953 keymap_act[mode][(byte)(buf[0])] = NULL;
2956 msg_print(_("キー配置を削除しました。", "Removed a keymap."));
2959 /* Enter a new action */
2963 prt(_("コマンド: マクロ行動の入力", "Command: Enter a new action"), 16, 0);
2969 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2970 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2973 prt(_("マクロ行動: ", "Action: "), 20, 0);
2975 /* Hack -- limit the value */
2978 /* Get an encoded action */
2979 if (!askfor(buf, 80)) continue;
2981 /* Extract an action */
2982 text_to_ascii(macro__buf, buf);
2985 #endif /* ALLOW_MACROS */
2994 /* Flush messages */
3003 * @brief キャラクタ色の明暗表現
3005 static cptr lighting_level_str[F_LIT_MAX] =
3020 * @brief キャラクタのビジュアルIDを変更する際の対象指定関数
3021 * @param i 指定対象となるキャラクタコード
3022 * @param num 指定されたビジュアルIDを返す参照ポインタ
3023 * @param max ビジュアルIDの最大数
3024 * @return 指定が実際に行われた場合TRUE、キャンセルされた場合FALSE
3026 static bool cmd_visuals_aux(int i, IDX *num, IDX max)
3033 sprintf(str, "%d", *num);
3035 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3038 tmp = (IDX)strtol(str, NULL, 0);
3039 if (tmp >= 0 && tmp < max)
3042 else if (isupper(i))
3043 *num = (*num + max - 1) % max;
3045 *num = (*num + 1) % max;
3051 * @brief キャラクタの変更メニュー表示
3052 * @param choice_msg 選択メッセージ
3055 static void print_visuals_menu(cptr choice_msg)
3057 prt(_("[ 画面表示の設定 ]", "Interact with Visuals"), 1, 0);
3059 /* Give some choices */
3060 prt(_("(0) ユーザー設定ファイルのロード", "(0) Load a user pref file"), 3, 5);
3062 #ifdef ALLOW_VISUALS
3063 prt(_("(1) モンスターの 色/文字 をファイルに書き出す", "(1) Dump monster attr/chars"), 4, 5);
3064 prt(_("(2) アイテムの 色/文字 をファイルに書き出す", "(2) Dump object attr/chars"), 5, 5);
3065 prt(_("(3) 地形の 色/文字 をファイルに書き出す", "(3) Dump feature attr/chars"), 6, 5);
3066 prt(_("(4) モンスターの 色/文字 を変更する (数値操作)", "(4) Change monster attr/chars (numeric operation)"), 7, 5);
3067 prt(_("(5) アイテムの 色/文字 を変更する (数値操作)", "(5) Change object attr/chars (numeric operation)"), 8, 5);
3068 prt(_("(6) 地形の 色/文字 を変更する (数値操作)", "(6) Change feature attr/chars (numeric operation)"), 9, 5);
3069 prt(_("(7) モンスターの 色/文字 を変更する (シンボルエディタ)", "(7) Change monster attr/chars (visual mode)"), 10, 5);
3070 prt(_("(8) アイテムの 色/文字 を変更する (シンボルエディタ)", "(8) Change object attr/chars (visual mode)"), 11, 5);
3071 prt(_("(9) 地形の 色/文字 を変更する (シンボルエディタ)", "(9) Change feature attr/chars (visual mode)"), 12, 5);
3072 #endif /* ALLOW_VISUALS */
3074 prt(_("(R) 画面表示方法の初期化", "(R) Reset visuals"), 13, 5);
3077 prt(format("コマンド: %s", choice_msg ? choice_msg : _("", "")), 15, 0);
3080 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx);
3081 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx);
3082 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level);
3085 * Interact with "visuals"
3087 void do_cmd_visuals(void)
3092 bool need_redraw = FALSE;
3093 const char *empty_symbol = "<< ? >>";
3095 if (use_bigtile) empty_symbol = "<< ?? >>";
3097 /* File type is "TEXT" */
3098 FILE_TYPE(FILE_TYPE_TEXT);
3100 /* Save the screen */
3103 /* Interact until done */
3109 /* Ask for a choice */
3110 print_visuals_menu(NULL);
3116 if (i == ESCAPE) break;
3120 /* Load a 'pref' file */
3123 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 15, 0);
3126 prt(_("ファイル: ", "File: "), 17, 0);
3128 /* Default filename */
3129 sprintf(tmp, "%s.prf", player_base);
3132 if (!askfor(tmp, 70)) continue;
3134 /* Process the given filename */
3135 (void)process_pref_file(tmp);
3140 #ifdef ALLOW_VISUALS
3142 /* Dump monster attr/chars */
3145 static cptr mark = "Monster attr/chars";
3148 prt(_("コマンド: モンスターの[色/文字]をファイルに書き出します", "Command: Dump monster attr/chars"), 15, 0);
3151 prt(_("ファイル: ", "File: "), 17, 0);
3153 /* Default filename */
3154 sprintf(tmp, "%s.prf", player_base);
3156 /* Get a filename */
3157 if (!askfor(tmp, 70)) continue;
3159 /* Build the filename */
3160 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3162 /* Append to the file */
3163 if (!open_auto_dump(buf, mark)) continue;
3166 auto_dump_printf(_("\n# モンスターの[色/文字]の設定\n\n", "\n# Monster attr/char definitions\n\n"));
3169 for (i = 0; i < max_r_idx; i++)
3171 monster_race *r_ptr = &r_info[i];
3173 /* Skip non-entries */
3174 if (!r_ptr->name) continue;
3176 /* Dump a comment */
3177 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3179 /* Dump the monster attr/char info */
3180 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3181 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3187 msg_print(_("モンスターの[色/文字]をファイルに書き出しました。", "Dumped monster attr/chars."));
3192 /* Dump object attr/chars */
3195 static cptr mark = "Object attr/chars";
3196 KIND_OBJECT_IDX k_idx;
3199 prt(_("コマンド: アイテムの[色/文字]をファイルに書き出します", "Command: Dump object attr/chars"), 15, 0);
3202 prt(_("ファイル: ", "File: "), 17, 0);
3204 /* Default filename */
3205 sprintf(tmp, "%s.prf", player_base);
3207 /* Get a filename */
3208 if (!askfor(tmp, 70)) continue;
3210 /* Build the filename */
3211 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3213 /* Append to the file */
3214 if (!open_auto_dump(buf, mark)) continue;
3217 auto_dump_printf(_("\n# アイテムの[色/文字]の設定\n\n", "\n# Object attr/char definitions\n\n"));
3220 for (k_idx = 0; k_idx < max_k_idx; k_idx++)
3223 object_kind *k_ptr = &k_info[k_idx];
3225 /* Skip non-entries */
3226 if (!k_ptr->name) continue;
3231 strip_name(o_name, k_idx);
3237 /* Prepare dummy object */
3238 object_prep(&forge, k_idx);
3240 /* Get un-shuffled flavor name */
3241 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3244 /* Dump a comment */
3245 auto_dump_printf("# %s\n", o_name);
3247 /* Dump the object attr/char info */
3248 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", (int)k_idx,
3249 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3255 msg_print(_("アイテムの[色/文字]をファイルに書き出しました。", "Dumped object attr/chars."));
3260 /* Dump feature attr/chars */
3263 static cptr mark = "Feature attr/chars";
3266 prt(_("コマンド: 地形の[色/文字]をファイルに書き出します", "Command: Dump feature attr/chars"), 15, 0);
3269 prt(_("ファイル: ", "File: "), 17, 0);
3271 /* Default filename */
3272 sprintf(tmp, "%s.prf", player_base);
3274 /* Get a filename */
3275 if (!askfor(tmp, 70)) continue;
3277 /* Build the filename */
3278 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3280 /* Append to the file */
3281 if (!open_auto_dump(buf, mark)) continue;
3284 auto_dump_printf(_("\n# 地形の[色/文字]の設定\n\n", "\n# Feature attr/char definitions\n\n"));
3287 for (i = 0; i < max_f_idx; i++)
3289 feature_type *f_ptr = &f_info[i];
3291 /* Skip non-entries */
3292 if (!f_ptr->name) continue;
3294 /* Skip mimiccing features */
3295 if (f_ptr->mimic != i) continue;
3297 /* Dump a comment */
3298 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3300 /* Dump the feature attr/char info */
3301 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
3302 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
3303 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
3304 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
3310 msg_print(_("地形の[色/文字]をファイルに書き出しました。", "Dumped feature attr/chars."));
3315 /* Modify monster attr/chars (numeric operation) */
3318 static cptr choice_msg = _("モンスターの[色/文字]を変更します", "Change monster attr/chars");
3321 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3323 /* Hack -- query until done */
3326 monster_race *r_ptr = &r_info[r];
3330 TERM_COLOR da = r_ptr->d_attr;
3331 byte dc = r_ptr->d_char;
3332 TERM_COLOR ca = r_ptr->x_attr;
3333 byte cc = r_ptr->x_char;
3335 /* Label the object */
3336 Term_putstr(5, 17, -1, TERM_WHITE,
3337 format(_("モンスター = %d, 名前 = %-40.40s", "Monster = %d, Name = %-40.40s"), r, (r_name + r_ptr->name)));
3339 /* Label the Default values */
3340 Term_putstr(10, 19, -1, TERM_WHITE,
3341 format(_("初期値 色 / 文字 = %3u / %3u", "Default attr/char = %3u / %3u"), da, dc));
3343 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3344 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3346 /* Label the Current values */
3347 Term_putstr(10, 20, -1, TERM_WHITE,
3348 format(_("現在値 色 / 文字 = %3u / %3u", "Current attr/char = %3u / %3u"), ca, cc));
3350 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3351 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3354 Term_putstr(0, 22, -1, TERM_WHITE,
3355 _("コマンド (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): "));
3361 if (i == ESCAPE) break;
3363 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3364 else if (isupper(i)) c = 'a' + i - 'A';
3374 if (!cmd_visuals_aux(i, &r, max_r_idx))
3380 while (!r_info[r].name);
3384 t = (int)r_ptr->x_attr;
3385 (void)cmd_visuals_aux(i, &t, 256);
3386 r_ptr->x_attr = (byte)t;
3390 t = (int)r_ptr->x_char;
3391 (void)cmd_visuals_aux(i, &t, 256);
3392 r_ptr->x_char = (byte)t;
3396 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
3400 print_visuals_menu(choice_msg);
3408 /* Modify object attr/chars (numeric operation) */
3411 static cptr choice_msg = _("アイテムの[色/文字]を変更します", "Change object attr/chars");
3413 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3415 /* Hack -- query until done */
3418 object_kind *k_ptr = &k_info[k];
3422 TERM_COLOR da = k_ptr->d_attr;
3423 SYMBOL_CODE dc = k_ptr->d_char;
3424 TERM_COLOR ca = k_ptr->x_attr;
3425 SYMBOL_CODE cc = k_ptr->x_char;
3427 /* Label the object */
3428 Term_putstr(5, 17, -1, TERM_WHITE,
3429 format(_("アイテム = %d, 名前 = %-40.40s", "Object = %d, Name = %-40.40s"),
3430 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
3432 /* Label the Default values */
3433 Term_putstr(10, 19, -1, TERM_WHITE,
3434 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3436 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3437 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3439 /* Label the Current values */
3440 Term_putstr(10, 20, -1, TERM_WHITE,
3441 format(_("現在値 色 / 文字 = %3d / %3d", "Current attr/char = %3d / %3d"), ca, cc));
3443 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3444 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3447 Term_putstr(0, 22, -1, TERM_WHITE,
3448 _("コマンド (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): "));
3454 if (i == ESCAPE) break;
3456 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3457 else if (isupper(i)) c = 'a' + i - 'A';
3467 if (!cmd_visuals_aux(i, &k, max_k_idx))
3473 while (!k_info[k].name);
3477 t = (int)k_ptr->x_attr;
3478 (void)cmd_visuals_aux(i, &t, 256);
3479 k_ptr->x_attr = (byte)t;
3483 t = (int)k_ptr->x_char;
3484 (void)cmd_visuals_aux(i, &t, 256);
3485 k_ptr->x_char = (byte)t;
3489 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
3493 print_visuals_menu(choice_msg);
3501 /* Modify feature attr/chars (numeric operation) */
3504 static cptr choice_msg = _("地形の[色/文字]を変更します", "Change feature attr/chars");
3506 static IDX lighting_level = F_LIT_STANDARD;
3507 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3509 /* Hack -- query until done */
3512 feature_type *f_ptr = &f_info[f];
3516 TERM_COLOR da = f_ptr->d_attr[lighting_level];
3517 byte dc = f_ptr->d_char[lighting_level];
3518 TERM_COLOR ca = f_ptr->x_attr[lighting_level];
3519 byte cc = f_ptr->x_char[lighting_level];
3521 /* Label the object */
3523 Term_putstr(5, 17, -1, TERM_WHITE,
3524 format(_("地形 = %d, 名前 = %s, 明度 = %s", "Terrain = %d, Name = %s, Lighting = %s"),
3525 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
3527 /* Label the Default values */
3528 Term_putstr(10, 19, -1, TERM_WHITE,
3529 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3531 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3532 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3534 /* Label the Current values */
3536 Term_putstr(10, 20, -1, TERM_WHITE,
3537 format("現在値 色 / 文字 = %3d / %3d", ca, cc));
3539 Term_putstr(10, 20, -1, TERM_WHITE,
3540 format("Current attr/char = %3d / %3d", ca, cc));
3543 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3544 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3548 Term_putstr(0, 22, -1, TERM_WHITE,
3549 "コマンド (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3551 Term_putstr(0, 22, -1, TERM_WHITE,
3552 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3559 if (i == ESCAPE) break;
3561 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3562 else if (isupper(i)) c = 'a' + i - 'A';
3572 if (!cmd_visuals_aux(i, &f, max_f_idx))
3578 while (!f_info[f].name || (f_info[f].mimic != f));
3582 t = (int)f_ptr->x_attr[lighting_level];
3583 (void)cmd_visuals_aux(i, &t, 256);
3584 f_ptr->x_attr[lighting_level] = (byte)t;
3588 t = (int)f_ptr->x_char[lighting_level];
3589 (void)cmd_visuals_aux(i, &t, 256);
3590 f_ptr->x_char[lighting_level] = (byte)t;
3594 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
3597 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
3601 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
3605 print_visuals_menu(choice_msg);
3613 /* Modify monster attr/chars (visual mode) */
3615 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
3618 /* Modify object attr/chars (visual mode) */
3620 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
3623 /* Modify feature attr/chars (visual mode) */
3626 IDX lighting_level = F_LIT_STANDARD;
3627 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
3631 #endif /* ALLOW_VISUALS */
3639 msg_print(_("画面上の[色/文字]を初期値にリセットしました。", "Visual attr/char tables reset."));
3643 /* Unknown option */
3649 /* Flush messages */
3653 /* Restore the screen */
3656 if (need_redraw) do_cmd_redraw();
3661 * Interact with "colors"
3663 void do_cmd_colors(void)
3672 /* File type is "TEXT" */
3673 FILE_TYPE(FILE_TYPE_TEXT);
3676 /* Save the screen */
3680 /* Interact until done */
3686 /* Ask for a choice */
3687 prt(_("[ カラーの設定 ]", "Interact with Colors"), 2, 0);
3689 /* Give some choices */
3690 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
3693 prt(_("(2) カラーの設定をファイルに書き出す", "(2) Dump colors"), 5, 5);
3694 prt(_("(3) カラーの設定を変更する", "(3) Modify colors"), 6, 5);
3698 prt(_("コマンド: ", "Command: "), 8, 0);
3703 if (i == ESCAPE) break;
3705 /* Load a 'pref' file */
3709 prt(_("コマンド: ユーザー設定ファイルをロードします", "Command: Load a user pref file"), 8, 0);
3712 prt(_("ファイル: ", "File: "), 10, 0);
3715 sprintf(tmp, "%s.prf", player_base);
3718 if (!askfor(tmp, 70)) continue;
3720 /* Process the given filename */
3721 (void)process_pref_file(tmp);
3723 /* Mega-Hack -- react to changes */
3724 Term_xtra(TERM_XTRA_REACT, 0);
3726 /* Mega-Hack -- redraw */
3735 static cptr mark = "Colors";
3738 prt(_("コマンド: カラーの設定をファイルに書き出します", "Command: Dump colors"), 8, 0);
3741 prt(_("ファイル: ", "File: "), 10, 0);
3743 /* Default filename */
3744 sprintf(tmp, "%s.prf", player_base);
3746 /* Get a filename */
3747 if (!askfor(tmp, 70)) continue;
3749 /* Build the filename */
3750 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3752 /* Append to the file */
3753 if (!open_auto_dump(buf, mark)) continue;
3756 auto_dump_printf(_("\n# カラーの設定\n\n", "\n# Color redefinitions\n\n"));
3759 for (i = 0; i < 256; i++)
3761 int kv = angband_color_table[i][0];
3762 int rv = angband_color_table[i][1];
3763 int gv = angband_color_table[i][2];
3764 int bv = angband_color_table[i][3];
3766 cptr name = _("未知", "unknown");
3768 /* Skip non-entries */
3769 if (!kv && !rv && !gv && !bv) continue;
3771 /* Extract the color name */
3772 if (i < 16) name = color_names[i];
3774 /* Dump a comment */
3775 auto_dump_printf(_("# カラー '%s'\n", "# Color '%s'\n"), name);
3777 /* Dump the monster attr/char info */
3778 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
3785 msg_print(_("カラーの設定をファイルに書き出しました。", "Dumped color redefinitions."));
3794 prt(_("コマンド: カラーの設定を変更します", "Command: Modify colors"), 8, 0);
3796 /* Hack -- query until done */
3805 /* Exhibit the normal colors */
3806 for (j = 0; j < 16; j++)
3808 /* Exhibit this color */
3809 Term_putstr(j*4, 20, -1, a, "###");
3811 /* Exhibit all colors */
3812 Term_putstr(j*4, 22, -1, j, format("%3d", j));
3815 /* Describe the color */
3816 name = ((a < 16) ? color_names[a] : _("未定義", "undefined"));
3818 /* Describe the color */
3819 Term_putstr(5, 10, -1, TERM_WHITE,
3820 format(_("カラー = %d, 名前 = %s", "Color = %d, Name = %s"), a, name));
3822 /* Label the Current values */
3823 Term_putstr(5, 12, -1, TERM_WHITE,
3824 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
3825 angband_color_table[a][0],
3826 angband_color_table[a][1],
3827 angband_color_table[a][2],
3828 angband_color_table[a][3]));
3831 Term_putstr(0, 14, -1, TERM_WHITE,
3832 _("コマンド (n/N/k/K/r/R/g/G/b/B): ", "Command (n/N/k/K/r/R/g/G/b/B): "));
3839 if (i == ESCAPE) break;
3842 if (i == 'n') a = (byte)(a + 1);
3843 if (i == 'N') a = (byte)(a - 1);
3844 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
3845 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
3846 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
3847 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
3848 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
3849 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
3850 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
3851 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
3853 /* Hack -- react to changes */
3854 Term_xtra(TERM_XTRA_REACT, 0);
3856 /* Hack -- redraw */
3863 /* Unknown option */
3869 /* Flush messages */
3874 /* Restore the screen */
3880 * Note something in the message recall
3882 void do_cmd_note(void)
3890 if (!get_string(_("メモ: ", "Note: "), buf, 60)) return;
3892 /* Ignore empty notes */
3893 if (!buf[0] || (buf[0] == ' ')) return;
3895 /* Add the note to the message recall */
3896 msg_format(_("メモ: %s", "Note: %s"), buf);
3901 * Mention the current version
3903 void do_cmd_version(void)
3907 #if FAKE_VER_EXTRA > 0
3908 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d.%d", "You are playing Hengband %d.%d.%d.%d."),
3909 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
3911 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d", "You are playing Hengband %d.%d.%d."),
3912 FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
3919 * Array of feeling strings
3921 static cptr do_cmd_feeling_text[11] =
3923 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3924 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3925 _("恐ろしい死の幻が目に浮かび、気絶しそうになった!", "You nearly faint as horrible visions of death fill your mind!"),
3926 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3927 _("とても悪い予感がする...", "You have a very bad feeling..."),
3928 _("悪い予感がする...", "You have a bad feeling..."),
3929 _("何か緊張する。", "You feel nervous."),
3930 _("少し不運な気がする...", "You feel your luck is turning..."),
3931 _("この場所は好きになれない。", "You don't like the look of this place."),
3932 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3933 _("なんて退屈なところだ...", "What a boring place...")
3936 static cptr do_cmd_feeling_text_combat[11] =
3938 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3939 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3940 _("今夜もまた、誰かが命を落とす...", "You nearly faint as horrible visions of death fill your mind!"),
3941 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3942 _("とても悪い予感がする...", "You have a very bad feeling..."),
3943 _("悪い予感がする...", "You have a bad feeling..."),
3944 _("何か緊張する。", "You feel nervous."),
3945 _("少し不運な気がする...", "You feel your luck is turning..."),
3946 _("この場所は好きになれない。", "You don't like the look of this place."),
3947 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3948 _("なんて退屈なところだ...", "What a boring place...")
3951 static cptr do_cmd_feeling_text_lucky[11] =
3953 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3954 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3955 _("この階はこの上なく素晴らしい感じがする。", "You have a superb feeling about this level."),
3956 _("素晴らしい感じがする...", "You have an excellent feeling..."),
3957 _("とても良い感じがする...", "You have a very good feeling..."),
3958 _("良い感じがする...", "You have a good feeling..."),
3959 _("ちょっと幸運な感じがする...", "You feel strangely lucky..."),
3960 _("多少は運が向いてきたか...", "You feel your luck is turning..."),
3961 _("見た感じ悪くはない...", "You like the look of this place..."),
3962 _("全然駄目ということはないが...", "This level can't be all bad..."),
3963 _("なんて退屈なところだ...", "What a boring place...")
3968 * Note that "feeling" is set to zero unless some time has passed.
3969 * Note that this is done when the level is GENERATED, not entered.
3971 void do_cmd_feeling(void)
3973 /* No useful feeling in quests */
3974 if (p_ptr->inside_quest && !random_quest_number(dun_level))
3976 msg_print(_("典型的なクエストのダンジョンのようだ。", "Looks like a typical quest level."));
3980 /* No useful feeling in town */
3981 else if (p_ptr->town_num && !dun_level)
3983 if (!strcmp(town[p_ptr->town_num].name, _("荒野", "wilderness")))
3985 msg_print(_("何かありそうな荒野のようだ。", "Looks like a strange wilderness."));
3990 msg_print(_("典型的な町のようだ。", "Looks like a typical town."));
3995 /* No useful feeling in the wilderness */
3996 else if (!dun_level)
3998 msg_print(_("典型的な荒野のようだ。", "Looks like a typical wilderness."));
4002 /* Display the feeling */
4003 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
4004 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
4005 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
4006 inventory[INVEN_BOW].name1 == ART_CRIMSON)
4007 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
4009 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
4015 * Description of each monster group.
4017 static cptr monster_group_text[] =
4020 "ユニーク", /* "Uniques" */
4021 "乗馬可能なモンスター", /* "Riding" */
4022 "賞金首", /* "Wanted */
4023 "アンバーの王族", /* "Ambertite" */
4052 /* "古代ドラゴン/ワイアーム", */
4113 /* "Ancient Dragon/Wyrm", */
4122 "Multi-Headed Reptile",
4127 "Reptile/Amphibian",
4128 "Spider/Scorpion/Tick",
4130 /* "Major Demon", */
4147 * Symbols of monsters in each group. Note the "Uniques" group
4148 * is handled differently.
4150 static cptr monster_group_char[] =
4207 "!$&()+./=>?[\\]`{|~",
4217 * hook function to sort monsters by level
4219 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
4221 u16b *who = (u16b*)(u);
4226 monster_race *r_ptr1 = &r_info[w1];
4227 monster_race *r_ptr2 = &r_info[w2];
4232 if (r_ptr2->level > r_ptr1->level) return TRUE;
4233 if (r_ptr1->level > r_ptr2->level) return FALSE;
4235 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
4236 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
4241 * Build a list of monster indexes in the given group. Return the number
4242 * of monsters in the group.
4244 * mode & 0x01 : check for non-empty group
4245 * mode & 0x02 : visual operation only
4247 static IDX collect_monsters(IDX grp_cur, IDX mon_idx[], BIT_FLAGS8 mode)
4253 /* Get a list of x_char in this group */
4254 cptr group_char = monster_group_char[grp_cur];
4256 /* XXX Hack -- Check if this is the "Uniques" group */
4257 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
4259 /* XXX Hack -- Check if this is the "Riding" group */
4260 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
4262 /* XXX Hack -- Check if this is the "Wanted" group */
4263 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
4265 /* XXX Hack -- Check if this is the "Amberite" group */
4266 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
4269 /* Check every race */
4270 for (i = 0; i < max_r_idx; i++)
4272 /* Access the race */
4273 monster_race *r_ptr = &r_info[i];
4275 /* Skip empty race */
4276 if (!r_ptr->name) continue ;
4278 /* Require known monsters */
4279 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
4283 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
4286 else if (grp_riding)
4288 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
4291 else if (grp_wanted)
4293 bool wanted = FALSE;
4295 for (j = 0; j < MAX_KUBI; j++)
4297 if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
4298 (p_ptr->today_mon && p_ptr->today_mon == i))
4304 if (!wanted) continue;
4307 else if (grp_amberite)
4309 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
4314 /* Check for race in the group */
4315 if (!my_strchr(group_char, r_ptr->d_char)) continue;
4319 mon_idx[mon_cnt++] = i;
4321 /* XXX Hack -- Just checking for non-empty group */
4322 if (mode & 0x01) break;
4325 /* Terminate the list */
4326 mon_idx[mon_cnt] = -1;
4328 /* Select the sort method */
4329 ang_sort_comp = ang_sort_comp_monster_level;
4330 ang_sort_swap = ang_sort_swap_hook;
4332 /* Sort by monster level */
4333 ang_sort(mon_idx, &dummy_why, mon_cnt);
4335 /* Return the number of races */
4341 * Description of each monster group.
4343 static cptr object_group_text[] =
4346 "キノコ", /* "Mushrooms" */
4347 "薬", /* "Potions" */
4348 "油つぼ", /* "Flasks" */
4349 "巻物", /* "Scrolls" */
4351 "アミュレット", /* "Amulets" */
4352 "笛", /* "Whistle" */
4353 "光源", /* "Lanterns" */
4354 "魔法棒", /* "Wands" */
4357 "カード", /* "Cards" */
4368 "刀剣類", /* "Swords" */
4369 "鈍器", /* "Blunt Weapons" */
4370 "長柄武器", /* "Polearms" */
4371 "採掘道具", /* "Diggers" */
4372 "飛び道具", /* "Bows" */
4376 "軽装鎧", /* "Soft Armor" */
4377 "重装鎧", /* "Hard Armor" */
4378 "ドラゴン鎧", /* "Dragon Armor" */
4379 "盾", /* "Shields" */
4380 "クローク", /* "Cloaks" */
4381 "籠手", /* "Gloves" */
4382 "ヘルメット", /* "Helms" */
4384 "ブーツ", /* "Boots" */
4437 * TVALs of items in each group
4439 static byte object_group_tval[] =
4480 TV_LIFE_BOOK, /* Hack -- all spellbooks */
4488 * Build a list of object indexes in the given group. Return the number
4489 * of objects in the group.
4491 * mode & 0x01 : check for non-empty group
4492 * mode & 0x02 : visual operation only
4494 static int collect_objects(int grp_cur, IDX object_idx[], BIT_FLAGS8 mode)
4497 int j, k, object_cnt = 0;
4499 /* Get a list of x_char in this group */
4500 byte group_tval = object_group_tval[grp_cur];
4502 /* Check every object */
4503 for (i = 0; i < max_k_idx; i++)
4505 /* Access the object */
4506 object_kind *k_ptr = &k_info[i];
4508 /* Skip empty objects */
4509 if (!k_ptr->name) continue;
4513 /* Any objects will be displayed */
4519 /* Skip non-flavoured objects */
4520 if (!k_ptr->flavor) continue;
4522 /* Require objects ever seen */
4523 if (!k_ptr->aware) continue;
4526 /* Skip items with no distribution (special artifacts) */
4527 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
4531 /* Check for objects in the group */
4532 if (TV_LIFE_BOOK == group_tval)
4534 /* Hack -- All spell books */
4535 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HEX_BOOK)
4537 /* Add the object */
4538 object_idx[object_cnt++] = i;
4542 else if (k_ptr->tval == group_tval)
4544 /* Add the object */
4545 object_idx[object_cnt++] = i;
4549 /* XXX Hack -- Just checking for non-empty group */
4550 if (mode & 0x01) break;
4553 /* Terminate the list */
4554 object_idx[object_cnt] = -1;
4556 /* Return the number of objects */
4562 * Description of each feature group.
4564 static cptr feature_group_text[] =
4572 * Build a list of feature indexes in the given group. Return the number
4573 * of features in the group.
4575 * mode & 0x01 : check for non-empty group
4577 static int collect_features(int grp_cur, IDX *feat_idx, BIT_FLAGS8 mode)
4582 /* Unused; There is a single group. */
4585 /* Check every feature */
4586 for (i = 0; i < max_f_idx; i++)
4588 /* Access the index */
4589 feature_type *f_ptr = &f_info[i];
4591 /* Skip empty index */
4592 if (!f_ptr->name) continue;
4594 /* Skip mimiccing features */
4595 if (f_ptr->mimic != i) continue;
4598 feat_idx[feat_cnt++] = i;
4600 /* XXX Hack -- Just checking for non-empty group */
4601 if (mode & 0x01) break;
4604 /* Terminate the list */
4605 feat_idx[feat_cnt] = -1;
4607 /* Return the number of races */
4614 * Build a list of monster indexes in the given group. Return the number
4615 * of monsters in the group.
4617 static int collect_artifacts(int grp_cur, int object_idx[])
4619 int i, object_cnt = 0;
4621 /* Get a list of x_char in this group */
4622 byte group_tval = object_group_tval[grp_cur];
4624 /* Check every object */
4625 for (i = 0; i < max_a_idx; i++)
4627 /* Access the artifact */
4628 artifact_type *a_ptr = &a_info[i];
4630 /* Skip empty artifacts */
4631 if (!a_ptr->name) continue;
4633 /* Skip "uncreated" artifacts */
4634 if (!a_ptr->cur_num) continue;
4636 /* Check for race in the group */
4637 if (a_ptr->tval == group_tval)
4640 object_idx[object_cnt++] = i;
4644 /* Terminate the list */
4645 object_idx[object_cnt] = 0;
4647 /* Return the number of races */
4654 * Encode the screen colors
4656 static char hack[17] = "dwsorgbuDWvyRGBU";
4660 * Hack -- load a screen dump from a file
4662 void do_cmd_load_screen(void)
4677 Term_get_size(&wid, &hgt);
4679 /* Build the filename */
4680 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
4682 /* Append to the file */
4683 fff = my_fopen(buf, "r");
4687 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
4693 /* Save the screen */
4696 /* Clear the screen */
4700 /* Load the screen */
4701 for (y = 0; okay; y++)
4703 /* Get a line of data including control code */
4704 if (!fgets(buf, 1024, fff)) okay = FALSE;
4706 /* Get the blank line */
4707 if (buf[0] == '\n' || buf[0] == '\0') break;
4709 /* Ignore too large screen image */
4710 if (y >= hgt) continue;
4713 for (x = 0; x < wid - 1; x++)
4716 if (buf[x] == '\n' || buf[x] == '\0') break;
4718 /* Put the attr/char */
4719 Term_draw(x, y, TERM_WHITE, buf[x]);
4723 /* Dump the screen */
4724 for (y = 0; okay; y++)
4726 /* Get a line of data including control code */
4727 if (!fgets(buf, 1024, fff)) okay = FALSE;
4729 /* Get the blank line */
4730 if (buf[0] == '\n' || buf[0] == '\0') break;
4732 /* Ignore too large screen image */
4733 if (y >= hgt) continue;
4736 for (x = 0; x < wid - 1; x++)
4739 if (buf[x] == '\n' || buf[x] == '\0') break;
4741 /* Get the attr/char */
4742 (void)(Term_what(x, y, &a, &c));
4744 /* Look up the attr */
4745 for (i = 0; i < 16; i++)
4747 /* Use attr matches */
4748 if (hack[i] == buf[x]) a = (byte_hack)i;
4751 /* Put the attr/char */
4752 Term_draw(x, y, a, c);
4761 prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
4767 /* Restore the screen */
4774 cptr inven_res_label = _(" 酸電火冷毒光闇破轟獄因沌劣 盲怖乱痺透命感消復浮",
4775 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv");
4778 #define IM_FLAG_STR _("*", "* ")
4779 #define HAS_FLAG_STR _("+", "+ ")
4780 #define NO_FLAG_STR _("・", ". ")
4782 #define print_im_or_res_flag(IM, RES) \
4784 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
4785 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
4788 #define print_flag(TR) \
4790 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
4794 /* XTRA HACK RESLIST */
4795 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, OBJECT_TYPE_VALUE tval, char *where)
4797 char o_name[MAX_NLEN];
4798 BIT_FLAGS flgs[TR_FLAG_SIZE];
4800 if (!o_ptr->k_idx) return;
4801 if (o_ptr->tval != tval) return;
4803 /* Identified items only */
4804 if (!object_is_known(o_ptr)) return;
4807 * HACK:Ring of Lordly protection and Dragon equipment
4808 * have random resistances.
4810 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
4811 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
4812 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
4813 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
4814 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
4815 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
4816 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
4817 || object_is_artifact(o_ptr))
4820 object_desc(o_name, o_ptr, OD_NAME_ONLY);
4822 while (o_name[i] && (i < 26))
4825 if (iskanji(o_name[i])) i++;
4834 o_name[i] = ' '; i++;
4839 fprintf(fff, "%s %s", where, o_name);
4841 if (!(o_ptr->ident & (IDENT_MENTAL)))
4843 fputs(_("-------不明--------------- -------不明---------\n",
4844 "-------unknown------------ -------unknown------\n"), fff);
4848 object_flags_known(o_ptr, flgs);
4850 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
4851 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
4852 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
4853 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
4854 print_flag(TR_RES_POIS);
4855 print_flag(TR_RES_LITE);
4856 print_flag(TR_RES_DARK);
4857 print_flag(TR_RES_SHARDS);
4858 print_flag(TR_RES_SOUND);
4859 print_flag(TR_RES_NETHER);
4860 print_flag(TR_RES_NEXUS);
4861 print_flag(TR_RES_CHAOS);
4862 print_flag(TR_RES_DISEN);
4866 print_flag(TR_RES_BLIND);
4867 print_flag(TR_RES_FEAR);
4868 print_flag(TR_RES_CONF);
4869 print_flag(TR_FREE_ACT);
4870 print_flag(TR_SEE_INVIS);
4871 print_flag(TR_HOLD_EXP);
4872 print_flag(TR_TELEPATHY);
4873 print_flag(TR_SLOW_DIGEST);
4874 print_flag(TR_REGEN);
4875 print_flag(TR_LEVITATION);
4883 fprintf(fff, "%s\n", inven_res_label);
4889 * Display *ID* ed weapons/armors's resistances
4891 static void do_cmd_knowledge_inven(void)
4895 char file_name[1024];
4899 OBJECT_TYPE_VALUE tval;
4905 /* Open a new file */
4906 fff = my_fopen_temp(file_name, 1024);
4909 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4913 fprintf(fff, "%s\n", inven_res_label);
4915 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
4919 for (; j < 9; j++) fputc('\n', fff);
4921 fprintf(fff, "%s\n", inven_res_label);
4923 strcpy(where, _("装", "E "));
4924 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4926 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4928 strcpy(where, _("持", "I "));
4929 for (i = 0; i < INVEN_PACK; i++)
4931 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4934 st_ptr = &town[1].store[STORE_HOME];
4935 strcpy(where, _("家", "H "));
4936 for (i = 0; i < st_ptr->stock_num; i++)
4938 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
4942 /* Close the file */
4945 /* Display the file contents */
4946 show_file(TRUE, file_name, _("*鑑定*済み武器/防具の耐性リスト", "Resistances of *identified* equipment"), 0, 0);
4948 /* Remove the file */
4953 void do_cmd_save_screen_html_aux(char *filename, int message)
4957 TERM_COLOR a = 0, old_a = 0;
4971 cptr html_head[] = {
4972 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
4976 cptr html_foot[] = {
4978 "</body>\n</html>\n",
4984 Term_get_size(&wid, &hgt);
4986 /* File type is "TEXT" */
4987 FILE_TYPE(FILE_TYPE_TEXT);
4989 /* Append to the file */
4990 fff = my_fopen(filename, "w");
4995 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename);
5002 /* Save the screen */
5006 /* Build the filename */
5007 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
5008 tmpfff = my_fopen(buf, "r");
5010 for (i = 0; html_head[i]; i++)
5011 fputs(html_head[i], fff);
5015 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5017 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
5021 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
5023 fprintf(fff, "%s\n", buf);
5028 /* Dump the screen */
5029 for (y = 0; y < hgt; y++)
5036 for (x = 0; x < wid - 1; x++)
5040 /* Get the attr/char */
5041 (void)(Term_what(x, y, &a, &c));
5045 case '&': cc = "&"; break;
5046 case '<': cc = "<"; break;
5047 case '>': cc = ">"; break;
5049 case 0x1f: c = '.'; break;
5050 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5055 if ((y == 0 && x == 0) || a != old_a) {
5056 rv = angband_color_table[a][1];
5057 gv = angband_color_table[a][2];
5058 bv = angband_color_table[a][3];
5059 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5060 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
5064 fprintf(fff, "%s", cc);
5066 fprintf(fff, "%c", c);
5069 fprintf(fff, "</font>");
5072 for (i = 0; html_foot[i]; i++)
5073 fputs(html_foot[i], fff);
5078 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5080 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
5084 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
5086 fprintf(fff, "%s\n", buf);
5099 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5103 /* Restore the screen */
5109 * Hack -- save a screen dump to a file
5111 static void do_cmd_save_screen_html(void)
5113 char buf[1024], tmp[256] = "screen.html";
5115 if (!get_string(_("ファイル名: ", "File name: "), tmp, 80))
5118 /* Build the filename */
5119 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
5123 do_cmd_save_screen_html_aux(buf, 1);
5128 * Redefinable "save_screen" action
5130 void (*screendump_aux)(void) = NULL;
5134 * Hack -- save a screen dump to a file
5136 void do_cmd_save_screen(void)
5138 bool old_use_graphics = use_graphics;
5139 bool html_dump = FALSE;
5143 prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
5147 if (c == 'Y' || c == 'y')
5149 else if (c == 'H' || c == 'h')
5161 Term_get_size(&wid, &hgt);
5163 if (old_use_graphics)
5165 use_graphics = FALSE;
5168 /* Redraw everything */
5169 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5171 /* Hack -- update */
5177 do_cmd_save_screen_html();
5181 /* Do we use a special screendump function ? */
5182 else if (screendump_aux)
5184 /* Dump the screen to a graphics file */
5185 (*screendump_aux)();
5187 else /* Dump the screen as text */
5198 /* Build the filename */
5199 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5201 /* File type is "TEXT" */
5202 FILE_TYPE(FILE_TYPE_TEXT);
5204 /* Append to the file */
5205 fff = my_fopen(buf, "w");
5210 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
5216 /* Save the screen */
5220 /* Dump the screen */
5221 for (y = 0; y < hgt; y++)
5224 for (x = 0; x < wid - 1; x++)
5226 /* Get the attr/char */
5227 (void)(Term_what(x, y, &a, &c));
5237 fprintf(fff, "%s\n", buf);
5244 /* Dump the screen */
5245 for (y = 0; y < hgt; y++)
5248 for (x = 0; x < wid - 1; x++)
5250 /* Get the attr/char */
5251 (void)(Term_what(x, y, &a, &c));
5254 buf[x] = hack[a&0x0F];
5261 fprintf(fff, "%s\n", buf);
5271 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5274 /* Restore the screen */
5278 if (old_use_graphics)
5280 use_graphics = TRUE;
5283 /* Redraw everything */
5284 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5286 /* Hack -- update */
5293 * Sorting hook -- Comp function -- see below
5295 * We use "u" to point to array of monster indexes,
5296 * and "v" to select the type of sorting to perform on "u".
5298 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
5300 u16b *who = (u16b*)(u);
5302 u16b *why = (u16b*)(v);
5309 /* Sort by total kills */
5312 /* Extract total kills */
5313 z1 = a_info[w1].tval;
5314 z2 = a_info[w2].tval;
5316 /* Compare total kills */
5317 if (z1 < z2) return (TRUE);
5318 if (z1 > z2) return (FALSE);
5322 /* Sort by monster level */
5325 /* Extract levels */
5326 z1 = a_info[w1].sval;
5327 z2 = a_info[w2].sval;
5329 /* Compare levels */
5330 if (z1 < z2) return (TRUE);
5331 if (z1 > z2) return (FALSE);
5335 /* Sort by monster experience */
5338 /* Extract experience */
5339 z1 = a_info[w1].level;
5340 z2 = a_info[w2].level;
5342 /* Compare experience */
5343 if (z1 < z2) return (TRUE);
5344 if (z1 > z2) return (FALSE);
5348 /* Compare indexes */
5354 * Sorting hook -- Swap function -- see below
5356 * We use "u" to point to array of monster indexes,
5357 * and "v" to select the type of sorting to perform.
5359 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
5361 u16b *who = (u16b*)(u);
5376 * Check the status of "artifacts"
5378 static void do_cmd_knowledge_artifacts(void)
5390 char file_name[1024];
5392 char base_name[MAX_NLEN];
5396 /* Open a new file */
5397 fff = my_fopen_temp(file_name, 1024);
5400 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5405 /* Allocate the "who" array */
5406 C_MAKE(who, max_a_idx, s16b);
5408 /* Allocate the "okay" array */
5409 C_MAKE(okay, max_a_idx, bool);
5411 /* Scan the artifacts */
5412 for (k = 0; k < max_a_idx; k++)
5414 artifact_type *a_ptr = &a_info[k];
5419 /* Skip "empty" artifacts */
5420 if (!a_ptr->name) continue;
5422 /* Skip "uncreated" artifacts */
5423 if (!a_ptr->cur_num) continue;
5429 /* Check the dungeon */
5430 for (y = 0; y < cur_hgt; y++)
5432 for (x = 0; x < cur_wid; x++)
5434 cave_type *c_ptr = &cave[y][x];
5436 OBJECT_IDX this_o_idx, next_o_idx = 0;
5438 /* Scan all objects in the grid */
5439 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
5443 /* Acquire object */
5444 o_ptr = &o_list[this_o_idx];
5446 /* Acquire next object */
5447 next_o_idx = o_ptr->next_o_idx;
5449 /* Ignore non-artifacts */
5450 if (!object_is_fixed_artifact(o_ptr)) continue;
5452 /* Ignore known items */
5453 if (object_is_known(o_ptr)) continue;
5455 /* Note the artifact */
5456 okay[o_ptr->name1] = FALSE;
5461 /* Check the inventory and equipment */
5462 for (i = 0; i < INVEN_TOTAL; i++)
5464 object_type *o_ptr = &inventory[i];
5466 /* Ignore non-objects */
5467 if (!o_ptr->k_idx) continue;
5469 /* Ignore non-artifacts */
5470 if (!object_is_fixed_artifact(o_ptr)) continue;
5472 /* Ignore known items */
5473 if (object_is_known(o_ptr)) continue;
5475 /* Note the artifact */
5476 okay[o_ptr->name1] = FALSE;
5479 for (k = 0; k < max_a_idx; k++)
5481 if (okay[k]) who[n++] = k;
5484 /* Select the sort method */
5485 ang_sort_comp = ang_sort_art_comp;
5486 ang_sort_swap = ang_sort_art_swap;
5488 /* Sort the array by dungeon depth of monsters */
5489 ang_sort(who, &why, n);
5491 /* Scan the artifacts */
5492 for (k = 0; k < n; k++)
5494 artifact_type *a_ptr = &a_info[who[k]];
5497 strcpy(base_name, _("未知の伝説のアイテム", "Unknown Artifact"));
5499 /* Obtain the base object type */
5500 z = lookup_kind(a_ptr->tval, a_ptr->sval);
5508 /* Get local object */
5511 /* Create fake object */
5512 object_prep(q_ptr, z);
5514 /* Make it an artifact */
5515 q_ptr->name1 = (byte)who[k];
5517 /* Display as if known */
5518 q_ptr->ident |= IDENT_STORE;
5520 /* Describe the artifact */
5521 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5524 /* Hack -- Build the artifact name */
5525 fprintf(fff, _(" %s\n", " The %s\n"), base_name);
5528 /* Free the "who" array */
5529 C_KILL(who, max_a_idx, s16b);
5531 /* Free the "okay" array */
5532 C_KILL(okay, max_a_idx, bool);
5534 /* Close the file */
5537 /* Display the file contents */
5538 show_file(TRUE, file_name, _("既知の伝説のアイテム", "Artifacts Seen"), 0, 0);
5540 /* Remove the file */
5546 * Display known uniques
5547 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
5549 static void do_cmd_knowledge_uniques(void)
5558 char file_name[1024];
5561 int n_alive_surface = 0;
5562 int n_alive_over100 = 0;
5563 int n_alive_total = 0;
5566 for (i = 0; i < 10; i++) n_alive[i] = 0;
5568 /* Open a new file */
5569 fff = my_fopen_temp(file_name, 1024);
5573 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5578 /* Allocate the "who" array */
5579 C_MAKE(who, max_r_idx, s16b);
5581 /* Scan the monsters */
5582 for (i = 1; i < max_r_idx; i++)
5584 monster_race *r_ptr = &r_info[i];
5587 if (!r_ptr->name) continue;
5589 /* Require unique monsters */
5590 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5592 /* Only display "known" uniques */
5593 if (!cheat_know && !r_ptr->r_sights) continue;
5595 /* Only print rarity <= 100 uniques */
5596 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
5598 /* Only "alive" uniques */
5599 if (r_ptr->max_num == 0) continue;
5603 lev = (r_ptr->level - 1) / 10;
5607 if (max_lev < lev) max_lev = lev;
5609 else n_alive_over100++;
5611 else n_alive_surface++;
5613 /* Collect "appropriate" monsters */
5617 /* Select the sort method */
5618 ang_sort_comp = ang_sort_comp_hook;
5619 ang_sort_swap = ang_sort_swap_hook;
5621 /* Sort the array by dungeon depth of monsters */
5622 ang_sort(who, &why, n);
5624 if (n_alive_surface)
5626 fprintf(fff, _(" 地上 生存: %3d体\n", " Surface alive: %3d\n"), n_alive_surface);
5627 n_alive_total += n_alive_surface;
5629 for (i = 0; i <= max_lev; i++)
5631 fprintf(fff, _("%3d-%3d階 生存: %3d体\n", "Level %3d-%3d alive: %3d\n"), 1 + i * 10, 10 + i * 10, n_alive[i]);
5632 n_alive_total += n_alive[i];
5634 if (n_alive_over100)
5636 fprintf(fff, _("101- 階 生存: %3d体\n", "Level 101- alive: %3d\n"), n_alive_over100);
5637 n_alive_total += n_alive_over100;
5642 fputs(_("--------- -----------\n", "------------- ----------\n"), fff);
5643 fprintf(fff, _(" 合計 生存: %3d体\n\n", " Total alive: %3d\n\n"), n_alive_total);
5647 fputs(_("現在は既知の生存ユニークはいません。\n", "No known uniques alive.\n"), fff);
5650 /* Scan the monster races */
5651 for (k = 0; k < n; k++)
5653 monster_race *r_ptr = &r_info[who[k]];
5655 /* Print a message */
5656 fprintf(fff, _(" %s (レベル%d)\n", " %s (level %d)\n"), r_name + r_ptr->name, (int)r_ptr->level);
5659 /* Free the "who" array */
5660 C_KILL(who, max_r_idx, s16b);
5662 /* Close the file */
5665 /* Display the file contents */
5666 show_file(TRUE, file_name, _("まだ生きているユニーク・モンスター", "Alive Uniques"), 0, 0);
5668 /* Remove the file */
5674 * Display weapon-exp
5676 static void do_cmd_knowledge_weapon_exp(void)
5678 int i, num, weapon_exp;
5683 char file_name[1024];
5686 /* Open a new file */
5687 fff = my_fopen_temp(file_name, 1024);
5689 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5694 for (i = 0; i < 5; i++)
5696 for (num = 0; num < 64; num++)
5698 for (j = 0; j < max_k_idx; j++)
5700 object_kind *k_ptr = &k_info[j];
5702 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
5704 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON || k_ptr->sval == SV_HARP)) continue;
5706 weapon_exp = p_ptr->weapon_exp[4 - i][num];
5708 fprintf(fff, "%-25s ", tmp);
5709 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
5710 else fprintf(fff, " ");
5711 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
5712 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
5720 /* Close the file */
5723 /* Display the file contents */
5724 show_file(TRUE, file_name, _("武器の経験値", "Weapon Proficiency"), 0, 0);
5726 /* Remove the file */
5732 * @brief 魔法の経験値を表示するコマンドのメインルーチン
5736 static void do_cmd_knowledge_spell_exp(void)
5739 int spell_exp, exp_level;
5742 const magic_type *s_ptr;
5744 char file_name[1024];
5746 /* Open a new file */
5747 fff = my_fopen_temp(file_name, 1024);
5749 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5754 if (p_ptr->realm1 != REALM_NONE)
5756 fprintf(fff, _("%sの魔法書\n", "%s Spellbook\n"), realm_names[p_ptr->realm1]);
5757 for (i = 0; i < 32; i++)
5759 if (!is_magic(p_ptr->realm1))
5761 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
5765 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
5767 if (s_ptr->slevel >= 99) continue;
5768 spell_exp = p_ptr->spell_exp[i];
5769 exp_level = spell_exp_level(spell_exp);
5770 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
5771 if (p_ptr->realm1 == REALM_HISSATSU)
5772 fprintf(fff, "[--]");
5775 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
5776 else fprintf(fff, " ");
5777 fprintf(fff, "%s", exp_level_str[exp_level]);
5779 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5784 if (p_ptr->realm2 != REALM_NONE)
5786 fprintf(fff, _("%sの魔法書\n", "\n%s Spellbook\n"), realm_names[p_ptr->realm2]);
5787 for (i = 0; i < 32; i++)
5789 if (!is_magic(p_ptr->realm1))
5791 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
5795 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
5797 if (s_ptr->slevel >= 99) continue;
5799 spell_exp = p_ptr->spell_exp[i + 32];
5800 exp_level = spell_exp_level(spell_exp);
5801 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
5802 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
5803 else fprintf(fff, " ");
5804 fprintf(fff, "%s", exp_level_str[exp_level]);
5805 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5810 /* Close the file */
5813 /* Display the file contents */
5814 show_file(TRUE, file_name, _("魔法の経験値", "Spell Proficiency"), 0, 0);
5816 /* Remove the file */
5822 * @brief スキル情報を表示するコマンドのメインルーチン /
5826 static void do_cmd_knowledge_skill_exp(void)
5828 int i = 0, skill_exp;
5832 char file_name[1024];
5833 char skill_name[3][20]={_("マーシャルアーツ", "Martial Arts "),
5834 _("二刀流 ", "Dual Wielding "),
5835 _("乗馬 ", "Riding ")};
5837 /* Open a new file */
5838 fff = my_fopen_temp(file_name, 1024);
5840 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5845 for (i = 0; i < 3; i++)
5847 skill_exp = p_ptr->skill_exp[i];
5848 fprintf(fff, "%-20s ", skill_name[i]);
5849 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
5850 else fprintf(fff, " ");
5851 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
5852 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
5856 /* Close the file */
5859 /* Display the file contents */
5860 show_file(TRUE, file_name, _("技能の経験値", "Miscellaneous Proficiency"), 0, 0);
5862 /* Remove the file */
5868 * @brief 英単語、句、説を複数形を変換する / Pluralize a monster name
5869 * @param Name 変換したい文字列の参照ポインタ
5872 void plural_aux(char *Name)
5874 int NameLen = strlen(Name);
5876 if (my_strstr(Name, "Disembodied hand"))
5878 strcpy(Name, "Disembodied hands that strangled people");
5880 else if (my_strstr(Name, "Colour out of space"))
5882 strcpy(Name, "Colours out of space");
5884 else if (my_strstr(Name, "stairway to hell"))
5886 strcpy(Name, "stairways to hell");
5888 else if (my_strstr(Name, "Dweller on the threshold"))
5890 strcpy(Name, "Dwellers on the threshold");
5892 else if (my_strstr(Name, " of "))
5894 cptr aider = my_strstr(Name, " of ");
5905 if (dummy[i-1] == 's')
5907 strcpy(&(dummy[i]), "es");
5912 strcpy(&(dummy[i]), "s");
5915 strcpy(&(dummy[i+1]), aider);
5916 strcpy(Name, dummy);
5918 else if (my_strstr(Name, "coins"))
5921 strcpy(dummy, "piles of ");
5922 strcat(dummy, Name);
5923 strcpy(Name, dummy);
5926 else if (my_strstr(Name, "Manes"))
5930 else if (streq(&(Name[NameLen - 2]), "ey"))
5932 strcpy(&(Name[NameLen - 2]), "eys");
5934 else if (Name[NameLen - 1] == 'y')
5936 strcpy(&(Name[NameLen - 1]), "ies");
5938 else if (streq(&(Name[NameLen - 4]), "ouse"))
5940 strcpy(&(Name[NameLen - 4]), "ice");
5942 else if (streq(&(Name[NameLen - 2]), "us"))
5944 strcpy(&(Name[NameLen - 2]), "i");
5946 else if (streq(&(Name[NameLen - 6]), "kelman"))
5948 strcpy(&(Name[NameLen - 6]), "kelmen");
5950 else if (streq(&(Name[NameLen - 8]), "wordsman"))
5952 strcpy(&(Name[NameLen - 8]), "wordsmen");
5954 else if (streq(&(Name[NameLen - 7]), "oodsman"))
5956 strcpy(&(Name[NameLen - 7]), "oodsmen");
5958 else if (streq(&(Name[NameLen - 7]), "eastman"))
5960 strcpy(&(Name[NameLen - 7]), "eastmen");
5962 else if (streq(&(Name[NameLen - 8]), "izardman"))
5964 strcpy(&(Name[NameLen - 8]), "izardmen");
5966 else if (streq(&(Name[NameLen - 5]), "geist"))
5968 strcpy(&(Name[NameLen - 5]), "geister");
5970 else if (streq(&(Name[NameLen - 2]), "ex"))
5972 strcpy(&(Name[NameLen - 2]), "ices");
5974 else if (streq(&(Name[NameLen - 2]), "lf"))
5976 strcpy(&(Name[NameLen - 2]), "lves");
5978 else if (suffix(Name, "ch") ||
5979 suffix(Name, "sh") ||
5980 suffix(Name, "nx") ||
5981 suffix(Name, "s") ||
5984 strcpy(&(Name[NameLen]), "es");
5988 strcpy(&(Name[NameLen]), "s");
5993 * @brief 現在のペットを表示するコマンドのメインルーチン /
5994 * Display current pets
5997 static void do_cmd_knowledge_pets(void)
6001 monster_type *m_ptr;
6004 int show_upkeep = 0;
6005 char file_name[1024];
6008 /* Open a new file */
6009 fff = my_fopen_temp(file_name, 1024);
6011 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6016 /* Process the monsters (backwards) */
6017 for (i = m_max - 1; i >= 1; i--)
6019 /* Access the monster */
6022 /* Ignore "dead" monsters */
6023 if (!m_ptr->r_idx) continue;
6025 /* Calculate "upkeep" for pets */
6029 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6030 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
6034 show_upkeep = calculate_upkeep();
6036 fprintf(fff, "----------------------------------------------\n");
6038 fprintf(fff, " 合計: %d 体のペット\n", t_friends);
6039 fprintf(fff, " 維持コスト: %d%% MP\n", show_upkeep);
6041 fprintf(fff, " Total: %d pet%s.\n",
6042 t_friends, (t_friends == 1 ? "" : "s"));
6043 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
6048 /* Close the file */
6051 /* Display the file contents */
6052 show_file(TRUE, file_name, _("現在のペット", "Current Pets"), 0, 0);
6054 /* Remove the file */
6060 * @brief 現在のペットを表示するコマンドのメインルーチン /
6063 * @note the player ghosts are ignored. XXX XXX XXX
6065 static void do_cmd_knowledge_kill_count(void)
6074 char file_name[1024];
6079 /* Open a new file */
6080 fff = my_fopen_temp(file_name, 1024);
6083 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6088 /* Allocate the "who" array */
6089 C_MAKE(who, max_r_idx, s16b);
6092 /* Monsters slain */
6095 for (kk = 1; kk < max_r_idx; kk++)
6097 monster_race *r_ptr = &r_info[kk];
6099 if (r_ptr->flags1 & (RF1_UNIQUE))
6101 bool dead = (r_ptr->max_num == 0);
6110 MONSTER_NUMBER This = r_ptr->r_pkills;
6120 fprintf(fff,_("あなたはまだ敵を倒していない。\n\n", "You have defeated no enemies yet.\n\n"));
6123 fprintf(fff,"あなたは%ld体の敵を倒している。\n\n", (long int)Total);
6125 fprintf(fff,"You have defeated %ld %s.\n\n", (long int)Total, (Total == 1) ? "enemy" : "enemies");
6131 /* Scan the monsters */
6132 for (i = 1; i < max_r_idx; i++)
6134 monster_race *r_ptr = &r_info[i];
6136 /* Use that monster */
6137 if (r_ptr->name) who[n++] = i;
6140 /* Select the sort method */
6141 ang_sort_comp = ang_sort_comp_hook;
6142 ang_sort_swap = ang_sort_swap_hook;
6144 /* Sort the array by dungeon depth of monsters */
6145 ang_sort(who, &why, n);
6147 /* Scan the monster races */
6148 for (k = 0; k < n; k++)
6150 monster_race *r_ptr = &r_info[who[k]];
6152 if (r_ptr->flags1 & (RF1_UNIQUE))
6154 bool dead = (r_ptr->max_num == 0);
6158 /* Print a message */
6159 fprintf(fff, " %s\n",
6160 (r_name + r_ptr->name));
6166 MONSTER_NUMBER This = r_ptr->r_pkills;
6171 /* p,tは人と数える by ita */
6172 if (my_strchr("pt", r_ptr->d_char))
6173 fprintf(fff, " %3d 人の %s\n", (int)This, r_name + r_ptr->name);
6175 fprintf(fff, " %3d 体の %s\n", (int)This, r_name + r_ptr->name);
6179 if (my_strstr(r_name + r_ptr->name, "coins"))
6181 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
6185 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
6191 strcpy(ToPlural, (r_name + r_ptr->name));
6192 plural_aux(ToPlural);
6193 fprintf(fff, " %d %s\n", This, ToPlural);
6203 fprintf(fff,"----------------------------------------------\n");
6205 fprintf(fff," 合計: %lu 体を倒した。\n", (unsigned long int)Total);
6207 fprintf(fff," Total: %lu creature%s killed.\n",
6208 (unsigned long int)Total, (Total == 1 ? "" : "s"));
6212 /* Free the "who" array */
6213 C_KILL(who, max_r_idx, s16b);
6215 /* Close the file */
6218 /* Display the file contents */
6219 show_file(TRUE, file_name, _("倒した敵の数", "Kill Count"), 0, 0);
6221 /* Remove the file */
6227 * @brief モンスター情報リスト中のグループを表示する /
6228 * Display the object groups.
6232 * @param per_page リストの表示行
6233 * @param grp_idx グループのID配列
6234 * @param group_text グループ名の文字列配列
6235 * @param grp_cur 現在の選択ID
6236 * @param grp_top 現在の選択リスト最上部ID
6239 static void display_group_list(int col, int row, int wid, int per_page,
6240 IDX grp_idx[], cptr group_text[], int grp_cur, int grp_top)
6244 /* Display lines until done */
6245 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
6247 /* Get the group index */
6248 int grp = grp_idx[grp_top + i];
6250 /* Choose a color */
6251 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
6253 /* Erase the entire line */
6254 Term_erase(col, row + i, wid);
6256 /* Display the group label */
6257 c_put_str(attr, group_text[grp], row + i, col);
6263 * Move the cursor in a browser window
6265 static void browser_cursor(char ch, int *column, IDX *grp_cur, int grp_cnt,
6266 IDX *list_cur, int list_cnt)
6271 IDX list = *list_cur;
6273 /* Extract direction */
6276 /* Hack -- scroll up full screen */
6281 /* Hack -- scroll down full screen */
6286 d = get_keymap_dir(ch);
6291 /* Diagonals - hack */
6292 if ((ddx[d] > 0) && ddy[d])
6298 Term_get_size(&wid, &hgt);
6300 browser_rows = hgt - 8;
6302 /* Browse group list */
6307 /* Move up or down */
6308 grp += ddy[d] * (browser_rows - 1);
6311 if (grp >= grp_cnt) grp = grp_cnt - 1;
6312 if (grp < 0) grp = 0;
6313 if (grp != old_grp) list = 0;
6316 /* Browse sub-list list */
6319 /* Move up or down */
6320 list += ddy[d] * browser_rows;
6323 if (list >= list_cnt) list = list_cnt - 1;
6324 if (list < 0) list = 0;
6336 if (col < 0) col = 0;
6337 if (col > 1) col = 1;
6344 /* Browse group list */
6349 /* Move up or down */
6353 if (grp >= grp_cnt) grp = grp_cnt - 1;
6354 if (grp < 0) grp = 0;
6355 if (grp != old_grp) list = 0;
6358 /* Browse sub-list list */
6361 /* Move up or down */
6365 if (list >= list_cnt) list = list_cnt - 1;
6366 if (list < 0) list = 0;
6377 static void display_visual_list(int col, int row, int height, int width, TERM_COLOR attr_top, byte char_left)
6381 /* Clear the display lines */
6382 for (i = 0; i < height; i++)
6384 Term_erase(col, row + i, width);
6387 /* Bigtile mode uses double width */
6388 if (use_bigtile) width /= 2;
6390 /* Display lines until done */
6391 for (i = 0; i < height; i++)
6393 /* Display columns until done */
6394 for (j = 0; j < width; j++)
6398 TERM_LEN x = col + j;
6399 TERM_LEN y = row + i;
6402 /* Bigtile mode uses double width */
6403 if (use_bigtile) x += j;
6408 /* Ignore illegal characters */
6409 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
6410 (!use_graphics && ic > 0x7f))
6416 /* Force correct code for both ASCII character and tile */
6417 if (c & 0x80) a |= 0x80;
6419 /* Display symbol */
6420 Term_queue_bigchar(x, y, a, c, 0, 0);
6427 * Place the cursor at the collect position for visual mode
6429 static void place_visual_list_cursor(TERM_LEN col, TERM_LEN row, TERM_COLOR a, byte c, TERM_COLOR attr_top, byte char_left)
6431 int i = (a & 0x7f) - attr_top;
6432 int j = c - char_left;
6434 TERM_LEN x = col + j;
6435 TERM_LEN y = row + i;
6437 /* Bigtile mode uses double width */
6438 if (use_bigtile) x += j;
6440 /* Place the cursor */
6446 * Clipboard variables for copy&paste in visual mode
6448 static TERM_COLOR attr_idx = 0;
6449 static byte char_idx = 0;
6451 /* Hack -- for feature lighting */
6452 static TERM_COLOR attr_idx_feat[F_LIT_MAX];
6453 static byte char_idx_feat[F_LIT_MAX];
6456 * Do visual mode command -- Change symbols
6458 static bool visual_mode_command(char ch, bool *visual_list_ptr,
6459 int height, int width,
6460 TERM_COLOR *attr_top_ptr, byte *char_left_ptr,
6461 TERM_COLOR *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
6463 static TERM_COLOR attr_old = 0;
6464 static byte char_old = 0;
6469 if (*visual_list_ptr)
6472 *cur_attr_ptr = attr_old;
6473 *cur_char_ptr = char_old;
6474 *visual_list_ptr = FALSE;
6482 if (*visual_list_ptr)
6485 *visual_list_ptr = FALSE;
6486 *need_redraw = TRUE;
6494 if (!*visual_list_ptr)
6496 *visual_list_ptr = TRUE;
6498 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6499 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6501 attr_old = *cur_attr_ptr;
6502 char_old = *cur_char_ptr;
6513 /* Set the visual */
6514 attr_idx = *cur_attr_ptr;
6515 char_idx = *cur_char_ptr;
6517 /* Hack -- for feature lighting */
6518 for (i = 0; i < F_LIT_MAX; i++)
6520 attr_idx_feat[i] = 0;
6521 char_idx_feat[i] = 0;
6528 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
6531 *cur_attr_ptr = attr_idx;
6532 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6533 if (!*visual_list_ptr) *need_redraw = TRUE;
6539 *cur_char_ptr = char_idx;
6540 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6541 if (!*visual_list_ptr) *need_redraw = TRUE;
6547 if (*visual_list_ptr)
6550 int d = get_keymap_dir(ch);
6551 byte a = (*cur_attr_ptr & 0x7f);
6552 byte c = *cur_char_ptr;
6554 if (use_bigtile) eff_width = width / 2;
6555 else eff_width = width;
6557 /* Restrict direction */
6558 if ((a == 0) && (ddy[d] < 0)) d = 0;
6559 if ((c == 0) && (ddx[d] < 0)) d = 0;
6560 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
6561 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
6566 /* Force correct code for both ASCII character and tile */
6567 if (c & 0x80) a |= 0x80;
6569 /* Set the visual */
6574 /* Move the frame */
6575 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
6576 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
6577 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
6578 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
6584 /* Visual mode command is not used */
6590 * Display the monsters in a group.
6592 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
6593 int mon_cur, int mon_top, bool visual_only)
6597 /* Display lines until done */
6598 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
6602 /* Get the race index */
6603 MONRACE_IDX r_idx = mon_idx[mon_top + i] ;
6605 /* Access the race */
6606 monster_race *r_ptr = &r_info[r_idx];
6608 /* Choose a color */
6609 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
6611 /* Display the name */
6612 c_prt(attr, (r_name + r_ptr->name), row + i, col);
6614 /* Hack -- visual_list mode */
6617 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
6619 if (p_ptr->wizard || visual_only)
6621 c_prt(attr, format("%d", r_idx), row + i, 62);
6624 /* Erase chars before overwritten by the race letter */
6625 Term_erase(69, row + i, 255);
6627 /* Display symbol */
6628 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
6633 if (!(r_ptr->flags1 & RF1_UNIQUE))
6634 put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
6636 c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE),
6637 (r_ptr->max_num == 0 ? _("死亡", " dead") : _("生存", "alive")), row + i, 74);
6641 /* Clear remaining lines */
6642 for (; i < per_page; i++)
6644 Term_erase(col, row + i, 255);
6650 * Display known monsters.
6652 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx)
6656 IDX grp_cur, grp_top, old_grp_cur;
6657 IDX mon_cur, mon_top;
6658 IDX grp_cnt, grp_idx[100];
6666 bool visual_list = FALSE;
6667 TERM_COLOR attr_top = 0;
6676 Term_get_size(&wid, &hgt);
6678 browser_rows = hgt - 8;
6680 /* Allocate the "mon_idx" array */
6681 C_MAKE(mon_idx, max_r_idx, s16b);
6686 if (direct_r_idx < 0)
6688 mode = visual_only ? 0x03 : 0x01;
6690 /* Check every group */
6691 for (i = 0; monster_group_text[i] != NULL; i++)
6693 /* Measure the label */
6694 len = strlen(monster_group_text[i]);
6696 /* Save the maximum length */
6697 if (len > max) max = len;
6699 /* See if any monsters are known */
6700 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
6702 /* Build a list of groups with known monsters */
6703 grp_idx[grp_cnt++] = i;
6711 mon_idx[0] = direct_r_idx;
6714 /* Terminate the list */
6717 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
6718 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
6721 /* Terminate the list */
6722 grp_idx[grp_cnt] = -1;
6725 grp_cur = grp_top = 0;
6726 mon_cur = mon_top = 0;
6731 mode = visual_only ? 0x02 : 0x00;
6736 monster_race *r_ptr;
6743 prt(format("%s - モンスター", !visual_only ? "知識" : "表示"), 2, 0);
6744 if (direct_r_idx < 0) prt("グループ", 4, 0);
6745 prt("名前", 4, max + 3);
6746 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6748 if (!visual_only) prt("殺害数", 4, 72);
6750 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
6751 if (direct_r_idx < 0) prt("Group", 4, 0);
6752 prt("Name", 4, max + 3);
6753 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6755 if (!visual_only) prt("Kills", 4, 73);
6758 for (i = 0; i < 78; i++)
6760 Term_putch(i, 5, TERM_WHITE, '=');
6763 if (direct_r_idx < 0)
6765 for (i = 0; i < browser_rows; i++)
6767 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
6774 if (direct_r_idx < 0)
6776 /* Scroll group list */
6777 if (grp_cur < grp_top) grp_top = grp_cur;
6778 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
6780 /* Display a list of monster groups */
6781 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
6783 if (old_grp_cur != grp_cur)
6785 old_grp_cur = grp_cur;
6787 /* Get a list of monsters in the current group */
6788 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
6791 /* Scroll monster list */
6792 while (mon_cur < mon_top)
6793 mon_top = MAX(0, mon_top - browser_rows/2);
6794 while (mon_cur >= mon_top + browser_rows)
6795 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
6800 /* Display a list of monsters in the current group */
6801 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
6807 /* Display a monster name */
6808 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
6810 /* Display visual list below first monster */
6811 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
6816 prt(format("<方向>%s%s%s, ESC",
6817 (!visual_list && !visual_only) ? ", 'r'で思い出を見る" : "",
6818 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
6819 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
6822 prt(format("<dir>%s%s%s, ESC",
6823 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
6824 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
6825 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
6829 /* Get the current monster */
6830 r_ptr = &r_info[mon_idx[mon_cur]];
6834 /* Mega Hack -- track this monster race */
6835 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
6837 /* Hack -- handle stuff */
6843 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
6847 Term_gotoxy(0, 6 + (grp_cur - grp_top));
6851 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
6856 /* Do visual mode command if needed */
6857 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))
6859 if (direct_r_idx >= 0)
6884 /* Recall on screen */
6885 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
6887 screen_roff(mon_idx[mon_cur], 0);
6898 /* Move the cursor */
6899 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
6906 /* Free the "mon_idx" array */
6907 C_KILL(mon_idx, max_r_idx, s16b);
6912 * Display the objects in a group.
6914 static void display_object_list(int col, int row, int per_page, IDX object_idx[],
6915 int object_cur, int object_top, bool visual_only)
6919 /* Display lines until done */
6920 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
6925 object_kind *flavor_k_ptr;
6927 /* Get the object index */
6928 KIND_OBJECT_IDX k_idx = object_idx[object_top + i];
6930 /* Access the object */
6931 object_kind *k_ptr = &k_info[k_idx];
6933 /* Choose a color */
6934 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
6935 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
6938 if (!visual_only && k_ptr->flavor)
6940 /* Appearance of this object is shuffled */
6941 flavor_k_ptr = &k_info[k_ptr->flavor];
6945 /* Appearance of this object is very normal */
6946 flavor_k_ptr = k_ptr;
6951 attr = ((i + object_top == object_cur) ? cursor : attr);
6953 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
6956 strip_name(o_name, k_idx);
6961 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
6964 /* Display the name */
6965 c_prt(attr, o_name, row + i, col);
6967 /* Hack -- visual_list mode */
6970 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);
6972 if (p_ptr->wizard || visual_only)
6974 c_prt(attr, format("%d", k_idx), row + i, 70);
6977 a = flavor_k_ptr->x_attr;
6978 c = flavor_k_ptr->x_char;
6980 /* Display symbol */
6981 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
6984 /* Clear remaining lines */
6985 for (; i < per_page; i++)
6987 Term_erase(col, row + i, 255);
6992 * Describe fake object
6994 static void desc_obj_fake(KIND_OBJECT_IDX k_idx)
6997 object_type object_type_body;
6999 /* Get local object */
7000 o_ptr = &object_type_body;
7002 /* Wipe the object */
7005 /* Create the artifact */
7006 object_prep(o_ptr, k_idx);
7008 /* It's fully know */
7009 o_ptr->ident |= IDENT_KNOWN;
7011 /* Track the object */
7012 /* object_actual_track(o_ptr); */
7014 /* Hack - mark as fake */
7015 /* term_obj_real = FALSE; */
7017 /* Hack -- Handle stuff */
7020 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
7022 msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
7030 * Display known objects
7032 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx)
7036 IDX grp_cur, grp_top, old_grp_cur;
7037 IDX object_old, object_cur, object_top;
7047 bool visual_list = FALSE;
7048 TERM_COLOR attr_top = 0;
7057 Term_get_size(&wid, &hgt);
7059 browser_rows = hgt - 8;
7061 /* Allocate the "object_idx" array */
7062 C_MAKE(object_idx, max_k_idx, IDX);
7067 if (direct_k_idx < 0)
7069 mode = visual_only ? 0x03 : 0x01;
7071 /* Check every group */
7072 for (i = 0; object_group_text[i] != NULL; i++)
7074 /* Measure the label */
7075 len = strlen(object_group_text[i]);
7077 /* Save the maximum length */
7078 if (len > max) max = len;
7080 /* See if any monsters are known */
7081 if (collect_objects(i, object_idx, mode))
7083 /* Build a list of groups with known monsters */
7084 grp_idx[grp_cnt++] = i;
7093 object_kind *k_ptr = &k_info[direct_k_idx];
7094 object_kind *flavor_k_ptr;
7096 if (!visual_only && k_ptr->flavor)
7098 /* Appearance of this object is shuffled */
7099 flavor_k_ptr = &k_info[k_ptr->flavor];
7103 /* Appearance of this object is very normal */
7104 flavor_k_ptr = k_ptr;
7107 object_idx[0] = direct_k_idx;
7108 object_old = direct_k_idx;
7111 /* Terminate the list */
7114 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7115 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
7118 /* Terminate the list */
7119 grp_idx[grp_cnt] = -1;
7122 grp_cur = grp_top = 0;
7123 object_cur = object_top = 0;
7128 mode = visual_only ? 0x02 : 0x00;
7133 object_kind *k_ptr, *flavor_k_ptr;
7140 prt(format("%s - アイテム", !visual_only ? "知識" : "表示"), 2, 0);
7141 if (direct_k_idx < 0) prt("グループ", 4, 0);
7142 prt("名前", 4, max + 3);
7143 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
7146 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7147 if (direct_k_idx < 0) prt("Group", 4, 0);
7148 prt("Name", 4, max + 3);
7149 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
7153 for (i = 0; i < 78; i++)
7155 Term_putch(i, 5, TERM_WHITE, '=');
7158 if (direct_k_idx < 0)
7160 for (i = 0; i < browser_rows; i++)
7162 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7169 if (direct_k_idx < 0)
7171 /* Scroll group list */
7172 if (grp_cur < grp_top) grp_top = grp_cur;
7173 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7175 /* Display a list of object groups */
7176 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
7178 if (old_grp_cur != grp_cur)
7180 old_grp_cur = grp_cur;
7182 /* Get a list of objects in the current group */
7183 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
7186 /* Scroll object list */
7187 while (object_cur < object_top)
7188 object_top = MAX(0, object_top - browser_rows/2);
7189 while (object_cur >= object_top + browser_rows)
7190 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
7195 /* Display a list of objects in the current group */
7196 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
7200 object_top = object_cur;
7202 /* Display a list of objects in the current group */
7203 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
7205 /* Display visual list below first object */
7206 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7209 /* Get the current object */
7210 k_ptr = &k_info[object_idx[object_cur]];
7212 if (!visual_only && k_ptr->flavor)
7214 /* Appearance of this object is shuffled */
7215 flavor_k_ptr = &k_info[k_ptr->flavor];
7219 /* Appearance of this object is very normal */
7220 flavor_k_ptr = k_ptr;
7225 prt(format("<方向>%s%s%s, ESC",
7226 (!visual_list && !visual_only) ? ", 'r'で詳細を見る" : "",
7227 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
7228 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7231 prt(format("<dir>%s%s%s, ESC",
7232 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7233 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7234 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7240 /* Mega Hack -- track this object */
7241 if (object_cnt) object_kind_track(object_idx[object_cur]);
7243 /* The "current" object changed */
7244 if (object_old != object_idx[object_cur])
7246 /* Hack -- handle stuff */
7249 /* Remember the "current" object */
7250 object_old = object_idx[object_cur];
7256 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
7260 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7264 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
7269 /* Do visual mode command if needed */
7270 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))
7272 if (direct_k_idx >= 0)
7297 /* Recall on screen */
7298 if (!visual_list && !visual_only && (grp_cnt > 0))
7300 desc_obj_fake(object_idx[object_cur]);
7308 /* Move the cursor */
7309 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
7315 /* Free the "object_idx" array */
7316 C_KILL(object_idx, max_k_idx, IDX);
7321 * Display the features in a group.
7323 static void display_feature_list(int col, int row, int per_page, FEAT_IDX *feat_idx,
7324 FEAT_IDX feat_cur, FEAT_IDX feat_top, bool visual_only, int lighting_level)
7326 int lit_col[F_LIT_MAX], i, j;
7327 int f_idx_col = use_bigtile ? 62 : 64;
7329 /* Correct columns 1 and 4 */
7330 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
7331 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7332 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
7334 /* Display lines until done */
7335 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
7340 FEAT_IDX f_idx = feat_idx[feat_top + i];
7342 /* Access the index */
7343 feature_type *f_ptr = &f_info[f_idx];
7345 int row_i = row + i;
7347 /* Choose a color */
7348 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
7350 /* Display the name */
7351 c_prt(attr, f_name + f_ptr->name, row_i, col);
7353 /* Hack -- visual_list mode */
7356 /* Display lighting level */
7357 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
7359 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));
7361 if (p_ptr->wizard || visual_only)
7363 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
7366 /* Display symbol */
7367 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);
7369 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
7370 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
7372 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
7374 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
7376 /* Mega-hack -- Use non-standard colour */
7377 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
7379 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
7383 /* Clear remaining lines */
7384 for (; i < per_page; i++)
7386 Term_erase(col, row + i, 255);
7392 * Interact with feature visuals.
7394 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level)
7398 IDX grp_cur, grp_top, old_grp_cur;
7399 IDX feat_cur, feat_top;
7409 bool visual_list = FALSE;
7410 TERM_COLOR attr_top = 0;
7416 TERM_COLOR attr_old[F_LIT_MAX];
7417 byte char_old[F_LIT_MAX];
7418 TERM_COLOR *cur_attr_ptr;
7421 (void)C_WIPE(attr_old, F_LIT_MAX, byte);
7422 (void)C_WIPE(char_old, F_LIT_MAX, byte);
7425 Term_get_size(&wid, &hgt);
7427 browser_rows = hgt - 8;
7429 /* Allocate the "feat_idx" array */
7430 C_MAKE(feat_idx, max_f_idx, IDX);
7435 if (direct_f_idx < 0)
7437 /* Check every group */
7438 for (i = 0; feature_group_text[i] != NULL; i++)
7440 /* Measure the label */
7441 len = strlen(feature_group_text[i]);
7443 /* Save the maximum length */
7444 if (len > max) max = len;
7446 /* See if any features are known */
7447 if (collect_features(i, feat_idx, 0x01))
7449 /* Build a list of groups with known features */
7450 grp_idx[grp_cnt++] = i;
7458 feature_type *f_ptr = &f_info[direct_f_idx];
7460 feat_idx[0] = direct_f_idx;
7463 /* Terminate the list */
7466 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7467 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
7469 for (i = 0; i < F_LIT_MAX; i++)
7471 attr_old[i] = f_ptr->x_attr[i];
7472 char_old[i] = f_ptr->x_char[i];
7476 /* Terminate the list */
7477 grp_idx[grp_cnt] = -1;
7480 grp_cur = grp_top = 0;
7481 feat_cur = feat_top = 0;
7489 feature_type *f_ptr;
7496 prt("表示 - 地形", 2, 0);
7497 if (direct_f_idx < 0) prt("グループ", 4, 0);
7498 prt("名前", 4, max + 3);
7501 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7502 prt("文字 ( l/ d)", 4, 66);
7506 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7507 prt("文字 (l/d)", 4, 68);
7510 prt("Visuals - features", 2, 0);
7511 if (direct_f_idx < 0) prt("Group", 4, 0);
7512 prt("Name", 4, max + 3);
7515 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7516 prt("Sym ( l/ d)", 4, 67);
7520 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7521 prt("Sym (l/d)", 4, 69);
7525 for (i = 0; i < 78; i++)
7527 Term_putch(i, 5, TERM_WHITE, '=');
7530 if (direct_f_idx < 0)
7532 for (i = 0; i < browser_rows; i++)
7534 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7541 if (direct_f_idx < 0)
7543 /* Scroll group list */
7544 if (grp_cur < grp_top) grp_top = grp_cur;
7545 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7547 /* Display a list of feature groups */
7548 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
7550 if (old_grp_cur != grp_cur)
7552 old_grp_cur = grp_cur;
7554 /* Get a list of features in the current group */
7555 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
7558 /* Scroll feature list */
7559 while (feat_cur < feat_top)
7560 feat_top = MAX(0, feat_top - browser_rows/2);
7561 while (feat_cur >= feat_top + browser_rows)
7562 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
7567 /* Display a list of features in the current group */
7568 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
7572 feat_top = feat_cur;
7574 /* Display a list of features in the current group */
7575 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
7577 /* Display visual list below first object */
7578 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7583 prt(format("<方向>%s, 'd'で標準光源効果%s, ESC",
7584 visual_list ? ", ENTERで決定, 'a'で対象明度変更" : ", 'v'でシンボル変更",
7585 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7588 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
7589 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
7590 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7594 /* Get the current feature */
7595 f_ptr = &f_info[feat_idx[feat_cur]];
7596 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
7597 cur_char_ptr = &f_ptr->x_char[*lighting_level];
7601 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
7605 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7609 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
7614 if (visual_list && ((ch == 'A') || (ch == 'a')))
7616 int prev_lighting_level = *lighting_level;
7620 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
7621 else (*lighting_level)--;
7625 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
7626 else (*lighting_level)++;
7629 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
7630 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7632 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
7633 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7638 else if ((ch == 'D') || (ch == 'd'))
7640 TERM_COLOR prev_x_attr = f_ptr->x_attr[*lighting_level];
7641 byte prev_x_char = f_ptr->x_char[*lighting_level];
7643 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
7647 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
7648 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7650 if (prev_x_char != f_ptr->x_char[*lighting_level])
7651 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7653 else *need_redraw = TRUE;
7658 /* Do visual mode command if needed */
7659 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))
7663 /* Restore previous visual settings */
7665 for (i = 0; i < F_LIT_MAX; i++)
7667 f_ptr->x_attr[i] = attr_old[i];
7668 f_ptr->x_char[i] = char_old[i];
7675 if (direct_f_idx >= 0) flag = TRUE;
7676 else *lighting_level = F_LIT_STANDARD;
7679 /* Preserve current visual settings */
7682 for (i = 0; i < F_LIT_MAX; i++)
7684 attr_old[i] = f_ptr->x_attr[i];
7685 char_old[i] = f_ptr->x_char[i];
7687 *lighting_level = F_LIT_STANDARD;
7694 for (i = 0; i < F_LIT_MAX; i++)
7696 attr_idx_feat[i] = f_ptr->x_attr[i];
7697 char_idx_feat[i] = f_ptr->x_char[i];
7706 /* Allow TERM_DARK text */
7707 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7709 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
7710 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
7728 /* Move the cursor */
7729 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
7735 /* Free the "feat_idx" array */
7736 C_KILL(feat_idx, max_f_idx, IDX);
7741 * List wanted monsters
7743 static void do_cmd_knowledge_kubi(void)
7748 char file_name[1024];
7751 /* Open a new file */
7752 fff = my_fopen_temp(file_name, 1024);
7754 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7761 bool listed = FALSE;
7764 fprintf(fff, "今日のターゲット : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "不明"));
7766 fprintf(fff, "賞金首リスト\n");
7768 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
7770 fprintf(fff, "List of wanted monsters\n");
7772 fprintf(fff, "----------------------------------------------\n");
7774 for (i = 0; i < MAX_KUBI; i++)
7776 if (kubi_r_idx[i] <= 10000)
7778 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
7786 fprintf(fff,"\n%s\n", _("賞金首はもう残っていません。", "There is no more wanted monster."));
7790 /* Close the file */
7793 /* Display the file contents */
7794 show_file(TRUE, file_name, _("賞金首の一覧", "Wanted monsters"), 0, 0);
7796 /* Remove the file */
7801 * List virtues & status
7803 static void do_cmd_knowledge_virtues(void)
7807 char file_name[1024];
7810 /* Open a new file */
7811 fff = my_fopen_temp(file_name, 1024);
7813 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7820 fprintf(fff, _("現在の属性 : %s\n\n", "Your alighnment : %s\n\n"), your_alignment());
7824 /* Close the file */
7827 /* Display the file contents */
7828 show_file(TRUE, file_name, _("八つの徳", "Virtues"), 0, 0);
7830 /* Remove the file */
7838 static void do_cmd_knowledge_dungeon(void)
7842 char file_name[1024];
7846 /* Open a new file */
7847 fff = my_fopen_temp(file_name, 1024);
7849 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7856 for (i = 1; i < max_d_idx; i++)
7860 if (!d_info[i].maxdepth) continue;
7861 if (!max_dlv[i]) continue;
7862 if (d_info[i].final_guardian)
7864 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
7866 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
7868 fprintf(fff, _("%c%-12s : %3d 階\n", "%c%-16s : level %3d\n"), seiha ? '!' : ' ', d_name + d_info[i].name, (int)max_dlv[i]);
7872 /* Close the file */
7875 /* Display the file contents */
7876 show_file(TRUE, file_name, _("今までに入ったダンジョン", "Dungeon"), 0, 0);
7878 /* Remove the file */
7883 * List virtues & status
7886 static void do_cmd_knowledge_stat(void)
7890 char file_name[1024];
7893 /* Open a new file */
7894 fff = my_fopen_temp(file_name, 1024);
7896 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7903 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
7904 (2 * p_ptr->hitdie +
7905 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
7908 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "現在の体力ランク : %d/100\n\n", percent);
7909 else fprintf(fff, "現在の体力ランク : ???\n\n");
7910 fprintf(fff, "能力の最大値\n\n");
7912 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
7913 else fprintf(fff, "Your current Life Rating is ???.\n\n");
7914 fprintf(fff, "Limits of maximum stats\n\n");
7916 for (v_nr = 0; v_nr < 6; v_nr++)
7918 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);
7919 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
7925 /* Close the file */
7928 /* Display the file contents */
7929 show_file(TRUE, file_name, _("自分に関する情報", "HP-rate & Max stat"), 0, 0);
7931 /* Remove the file */
7937 * Print all active quests
7939 static void do_cmd_knowledge_quests_current(FILE *fff)
7942 char rand_tmp_str[120] = "\0";
7944 monster_race *r_ptr;
7946 int rand_level = 100;
7949 fprintf(fff, _("《遂行中のクエスト》\n", "< Current Quest >\n"));
7951 for (i = 1; i < max_q_idx; i++)
7953 if ((quest[i].status == QUEST_STATUS_TAKEN) ||
7954 ((quest[i].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[i].type == QUEST_TYPE_TOWER)) ||
7955 (quest[i].status == QUEST_STATUS_COMPLETED))
7957 /* Set the quest number temporary */
7958 IDX old_quest = p_ptr->inside_quest;
7961 /* Clear the text */
7962 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
7963 quest_text_line = 0;
7965 p_ptr->inside_quest = i;
7967 /* Get the quest text */
7968 init_flags = INIT_SHOW_TEXT;
7970 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
7972 /* Reset the old quest number */
7973 p_ptr->inside_quest = old_quest;
7975 /* No info from "silent" quests */
7976 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
7980 if (quest[i].type != QUEST_TYPE_RANDOM)
7982 char note[80] = "\0";
7984 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_STAGE_COMPLETED)
7986 switch (quest[i].type)
7988 case QUEST_TYPE_KILL_LEVEL:
7989 case QUEST_TYPE_KILL_ANY_LEVEL:
7990 r_ptr = &r_info[quest[i].r_idx];
7991 strcpy(name, r_name + r_ptr->name);
7992 if (quest[i].max_num > 1)
7995 sprintf(note," - %d 体の%sを倒す。(あと %d 体)",
7996 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
7999 sprintf(note," - kill %d %s, have killed %d.",
8000 (int)quest[i].max_num, name, (int)quest[i].cur_num);
8004 sprintf(note,_(" - %sを倒す。", " - kill %s."),name);
8007 case QUEST_TYPE_FIND_ARTIFACT:
8010 artifact_type *a_ptr = &a_info[quest[i].k_idx];
8012 object_type *q_ptr = &forge;
8013 KIND_OBJECT_IDX k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
8014 object_prep(q_ptr, k_idx);
8015 q_ptr->name1 = quest[i].k_idx;
8016 q_ptr->ident = IDENT_STORE;
8017 object_desc(name, q_ptr, OD_NAME_ONLY);
8019 sprintf(note,_("\n - %sを見つけ出す。", "\n - Find out %s."), name);
8021 case QUEST_TYPE_FIND_EXIT:
8022 sprintf(note,_(" - 出口に到達する。", " - Reach to Exit."));
8025 case QUEST_TYPE_KILL_NUMBER:
8027 sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)",
8028 (int)quest[i].max_num, (int)(quest[i].max_num - quest[i].cur_num));
8030 sprintf(note," - Kill %d monsters, have killed %d.",
8031 (int)quest[i].max_num, (int)quest[i].cur_num);
8035 case QUEST_TYPE_KILL_ALL:
8036 case QUEST_TYPE_TOWER:
8037 sprintf(note,_(" - 全てのモンスターを倒す。", " - Kill all monsters."));
8042 /* Print the quest info */
8043 sprintf(tmp_str, _(" %s (危険度:%d階相当)%s\n", " %s (Danger level: %d)%s\n"),
8044 quest[i].name, (int)quest[i].level, note);
8046 fputs(tmp_str, fff);
8048 if (quest[i].status == QUEST_STATUS_COMPLETED)
8050 sprintf(tmp_str, _(" クエスト達成 - まだ報酬を受けとってない。\n", " Quest Completed - Unrewarded\n"));
8051 fputs(tmp_str, fff);
8057 while (quest_text[j][0] && j < 10)
8059 fprintf(fff, " %s\n", quest_text[j]);
8064 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
8067 rand_level = quest[i].level;
8069 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8071 /* Print the quest info */
8072 r_ptr = &r_info[quest[i].r_idx];
8073 strcpy(name, r_name + r_ptr->name);
8075 if (quest[i].max_num > 1)
8078 sprintf(rand_tmp_str," %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
8079 quest[i].name, (int)quest[i].level,
8080 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
8084 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8085 quest[i].name, (int)quest[i].level,
8086 (int)quest[i].max_num, name, (int)quest[i].cur_num);
8091 sprintf(rand_tmp_str,_(" %s (%d 階) - %sを倒す。\n", " %s (Dungeon level: %d)\n Kill %s.\n"),
8092 quest[i].name, (int)quest[i].level, name);
8099 /* Print the current random quest */
8100 if (rand_tmp_str[0]) fputs(rand_tmp_str, fff);
8102 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8106 static bool do_cmd_knowledge_quests_aux(FILE *fff, IDX q_idx)
8109 char playtime_str[16];
8110 quest_type* const q_ptr = &quest[q_idx];
8112 if (is_fixed_quest_idx(q_idx))
8114 /* Set the quest number temporary */
8115 IDX old_quest = p_ptr->inside_quest;
8117 p_ptr->inside_quest = q_idx;
8120 init_flags = INIT_NAME_ONLY;
8122 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8124 /* Reset the old quest number */
8125 p_ptr->inside_quest = old_quest;
8127 /* No info from "silent" quests */
8128 if (q_ptr->flags & QUEST_FLAG_SILENT) return FALSE;
8131 strnfmt(playtime_str, sizeof(playtime_str), "%02d:%02d:%02d",
8132 q_ptr->comptime/(60*60), (q_ptr->comptime/60)%60, q_ptr->comptime%60);
8134 if (!is_fixed_quest_idx(q_idx) && q_ptr->r_idx)
8136 /* Print the quest info */
8137 if (q_ptr->complev == 0)
8140 _(" %-35s (%3d階) - 不戦勝 - %s\n",
8141 " %-35s (Dungeon level: %3d) - Unearned - %s\n") ,
8142 r_name+r_info[q_ptr->r_idx].name,
8143 (int)q_ptr->level, playtime_str);
8148 _(" %-35s (%3d階) - レベル%2d - %s\n",
8149 " %-35s (Dungeon level: %3d) - level %2d - %s\n") ,
8150 r_name+r_info[q_ptr->r_idx].name,
8158 /* Print the quest info */
8160 _(" %-35s (危険度:%3d階相当) - レベル%2d - %s\n",
8161 " %-35s (Danger level: %3d) - level %2d - %s\n") ,
8162 q_ptr->name, (int)q_ptr->level, q_ptr->complev, playtime_str);
8165 fputs(tmp_str, fff);
8171 * Print all finished quests
8173 void do_cmd_knowledge_quests_completed(FILE *fff, IDX quest_num[])
8178 fprintf(fff, _("《達成したクエスト》\n", "< Completed Quest >\n"));
8179 for (i = 1; i < max_q_idx; i++)
8181 IDX q_idx = quest_num[i];
8182 quest_type* const q_ptr = &quest[q_idx];
8184 if (q_ptr->status == QUEST_STATUS_FINISHED &&
8185 do_cmd_knowledge_quests_aux(fff, q_idx))
8190 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8195 * Print all failed quests
8197 void do_cmd_knowledge_quests_failed(FILE *fff, IDX quest_num[])
8202 fprintf(fff, _("《失敗したクエスト》\n", "< Failed Quest >\n"));
8203 for (i = 1; i < max_q_idx; i++)
8205 IDX q_idx = quest_num[i];
8206 quest_type* const q_ptr = &quest[q_idx];
8208 if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) &&
8209 do_cmd_knowledge_quests_aux(fff, q_idx))
8214 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8219 * Print all random quests
8221 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
8227 fprintf(fff, _("《残りのランダムクエスト》\n", "< Remaining Random Quest >\n"));
8228 for (i = 1; i < max_q_idx; i++)
8230 /* No info from "silent" quests */
8231 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8233 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
8237 /* Print the quest info */
8238 sprintf(tmp_str, _(" %s (%d階, %s)\n", " %s (%d, %s)\n"),
8239 quest[i].name, (int)quest[i].level, r_name+r_info[quest[i].r_idx].name);
8240 fputs(tmp_str, fff);
8243 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8247 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
8249 QUEST_IDX *q_num = (QUEST_IDX *)u;
8250 quest_type *qa = &quest[q_num[a]];
8251 quest_type *qb = &quest[q_num[b]];
8256 return (qa->comptime != qb->comptime) ?
8257 (qa->comptime < qb->comptime) :
8258 (qa->level <= qb->level);
8261 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
8263 QUEST_IDX *q_num = (QUEST_IDX *)u;
8270 q_num[a] = q_num[b];
8276 * Print quest status of all active quests
8278 static void do_cmd_knowledge_quests(void)
8281 char file_name[1024];
8286 /* Open a new file */
8287 fff = my_fopen_temp(file_name, 1024);
8290 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8295 /* Allocate Memory */
8296 C_MAKE(quest_num, max_q_idx, IDX);
8298 /* Sort by compete level */
8299 for (i = 1; i < max_q_idx; i++) quest_num[i] = i;
8300 ang_sort_comp = ang_sort_comp_quest_num;
8301 ang_sort_swap = ang_sort_swap_quest_num;
8302 ang_sort(quest_num, &dummy, max_q_idx);
8304 /* Dump Quest Information */
8305 do_cmd_knowledge_quests_current(fff);
8307 do_cmd_knowledge_quests_completed(fff, quest_num);
8309 do_cmd_knowledge_quests_failed(fff, quest_num);
8313 do_cmd_knowledge_quests_wiz_random(fff);
8316 /* Close the file */
8319 /* Display the file contents */
8320 show_file(TRUE, file_name, _("クエスト達成状況", "Quest status"), 0, 0);
8322 /* Remove the file */
8326 C_KILL(quest_num, max_q_idx, IDX);
8333 static void do_cmd_knowledge_home(void)
8338 char file_name[1024];
8340 char o_name[MAX_NLEN];
8343 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
8345 /* Open a new file */
8346 fff = my_fopen_temp(file_name, 1024);
8348 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8355 /* Print all homes in the different towns */
8356 st_ptr = &town[1].store[STORE_HOME];
8358 /* Home -- if anything there */
8359 if (st_ptr->stock_num)
8364 /* Header with name of the town */
8365 fprintf(fff, _(" [ 我が家のアイテム ]\n", " [Home Inventory]\n"));
8367 /* Dump all available items */
8368 for (i = 0; i < st_ptr->stock_num; i++)
8371 if ((i % 12) == 0) fprintf(fff, "\n ( %d ページ )\n", x++);
8372 object_desc(o_name, &st_ptr->stock[i], 0);
8373 if (strlen(o_name) <= 80-3)
8375 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8381 for (n = 0, t = o_name; n < 80-3; n++, t++)
8382 if(iskanji(*t)) {t++; n++;}
8383 if (n == 81-3) n = 79-3; /* 最後が漢字半分 */
8385 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
8386 fprintf(fff, " %.77s\n", o_name+n);
8389 object_desc(o_name, &st_ptr->stock[i], 0);
8390 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8395 /* Add an empty line */
8396 fprintf(fff, "\n\n");
8400 /* Close the file */
8403 /* Display the file contents */
8404 show_file(TRUE, file_name, _("我が家のアイテム", "Home Inventory"), 0, 0);
8406 /* Remove the file */
8412 * Check the status of "autopick"
8414 static void do_cmd_knowledge_autopick(void)
8418 char file_name[1024];
8420 /* Open a new file */
8421 fff = my_fopen_temp(file_name, 1024);
8425 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8432 fprintf(fff, _("自動破壊/拾いには何も登録されていません。", "No preference for auto picker/destroyer."));
8436 fprintf(fff, _(" 自動拾い/破壊には現在 %d行登録されています。\n\n",
8437 " There are %d registered lines for auto picker/destroyer.\n\n"), max_autopick);
8440 for (k = 0; k < max_autopick; k++)
8443 byte act = autopick_list[k].action;
8444 if (act & DONT_AUTOPICK)
8446 tmp = _("放置", "Leave");
8448 else if (act & DO_AUTODESTROY)
8450 tmp = _("破壊", "Destroy");
8452 else if (act & DO_AUTOPICK)
8454 tmp = _("拾う", "Pickup");
8456 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
8458 tmp = _("確認", "Query");
8461 if (act & DO_DISPLAY)
8462 fprintf(fff, "%11s", format("[%s]", tmp));
8464 fprintf(fff, "%11s", format("(%s)", tmp));
8466 tmp = autopick_line_from_entry(&autopick_list[k]);
8467 fprintf(fff, " %s", tmp);
8471 /* Close the file */
8473 /* Display the file contents */
8474 show_file(TRUE, file_name, _("自動拾い/破壊 設定リスト", "Auto-picker/Destroyer"), 0, 0);
8476 /* Remove the file */
8482 * Interact with "knowledge"
8484 void do_cmd_knowledge(void)
8487 bool need_redraw = FALSE;
8489 /* File type is "TEXT" */
8490 FILE_TYPE(FILE_TYPE_TEXT);
8492 /* Save the screen */
8495 /* Interact until done */
8501 /* Ask for a choice */
8503 prt(format("%d/2 ページ", (p+1)), 2, 65);
8504 prt("現在の知識を確認する", 3, 0);
8506 prt(format("page %d/2", (p+1)), 2, 65);
8507 prt("Display current knowledge", 3, 0);
8510 /* Give some choices */
8514 prt("(1) 既知の伝説のアイテム の一覧", 6, 5);
8515 prt("(2) 既知のアイテム の一覧", 7, 5);
8516 prt("(3) 既知の生きているユニーク・モンスター の一覧", 8, 5);
8517 prt("(4) 既知のモンスター の一覧", 9, 5);
8518 prt("(5) 倒した敵の数 の一覧", 10, 5);
8519 if (!vanilla_town) prt("(6) 賞金首 の一覧", 11, 5);
8520 prt("(7) 現在のペット の一覧", 12, 5);
8521 prt("(8) 我が家のアイテム の一覧", 13, 5);
8522 prt("(9) *鑑定*済み装備の耐性 の一覧", 14, 5);
8523 prt("(0) 地形の表示文字/タイル の一覧", 15, 5);
8527 prt("(a) 自分に関する情報 の一覧", 6, 5);
8528 prt("(b) 突然変異 の一覧", 7, 5);
8529 prt("(c) 武器の経験値 の一覧", 8, 5);
8530 prt("(d) 魔法の経験値 の一覧", 9, 5);
8531 prt("(e) 技能の経験値 の一覧", 10, 5);
8532 prt("(f) プレイヤーの徳 の一覧", 11, 5);
8533 prt("(g) 入ったダンジョン の一覧", 12, 5);
8534 prt("(h) 実行中のクエスト の一覧", 13, 5);
8535 prt("(i) 現在の自動拾い/破壊設定 の一覧", 14, 5);
8540 prt("(1) Display known artifacts", 6, 5);
8541 prt("(2) Display known objects", 7, 5);
8542 prt("(3) Display remaining uniques", 8, 5);
8543 prt("(4) Display known monster", 9, 5);
8544 prt("(5) Display kill count", 10, 5);
8545 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
8546 prt("(7) Display current pets", 12, 5);
8547 prt("(8) Display home inventory", 13, 5);
8548 prt("(9) Display *identified* equip.", 14, 5);
8549 prt("(0) Display terrain symbols.", 15, 5);
8553 prt("(a) Display about yourself", 6, 5);
8554 prt("(b) Display mutations", 7, 5);
8555 prt("(c) Display weapon proficiency", 8, 5);
8556 prt("(d) Display spell proficiency", 9, 5);
8557 prt("(e) Display misc. proficiency", 10, 5);
8558 prt("(f) Display virtues", 11, 5);
8559 prt("(g) Display dungeons", 12, 5);
8560 prt("(h) Display current quests", 13, 5);
8561 prt("(i) Display auto pick/destroy", 14, 5);
8567 prt("ESC) 抜ける", 21, 1);
8568 prt("SPACE) 次ページ", 21, 30);
8569 /*prt("-) 前ページ", 21, 60);*/
8570 prt("コマンド:", 20, 0);
8572 prt("-more-", 17, 8);
8573 prt("ESC) Exit menu", 21, 1);
8574 prt("SPACE) Next page", 21, 30);
8575 /*prt("-) Previous page", 21, 60);*/
8576 prt("Command: ", 20, 0);
8583 if (i == ESCAPE) break;
8586 case ' ': /* Page change */
8590 case '1': /* Artifacts */
8591 do_cmd_knowledge_artifacts();
8593 case '2': /* Objects */
8594 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
8596 case '3': /* Uniques */
8597 do_cmd_knowledge_uniques();
8599 case '4': /* Monsters */
8600 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
8602 case '5': /* Kill count */
8603 do_cmd_knowledge_kill_count();
8605 case '6': /* wanted */
8606 if (!vanilla_town) do_cmd_knowledge_kubi();
8608 case '7': /* Pets */
8609 do_cmd_knowledge_pets();
8611 case '8': /* Home */
8612 do_cmd_knowledge_home();
8614 case '9': /* Resist list */
8615 do_cmd_knowledge_inven();
8617 case '0': /* Feature list */
8619 IDX lighting_level = F_LIT_STANDARD;
8620 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
8624 case 'a': /* Max stat */
8625 do_cmd_knowledge_stat();
8627 case 'b': /* Mutations */
8628 do_cmd_knowledge_mutations();
8630 case 'c': /* weapon-exp */
8631 do_cmd_knowledge_weapon_exp();
8633 case 'd': /* spell-exp */
8634 do_cmd_knowledge_spell_exp();
8636 case 'e': /* skill-exp */
8637 do_cmd_knowledge_skill_exp();
8639 case 'f': /* Virtues */
8640 do_cmd_knowledge_virtues();
8642 case 'g': /* Dungeon */
8643 do_cmd_knowledge_dungeon();
8645 case 'h': /* Quests */
8646 do_cmd_knowledge_quests();
8648 case 'i': /* Autopick */
8649 do_cmd_knowledge_autopick();
8651 default: /* Unknown option */
8655 /* Flush messages */
8659 /* Restore the screen */
8662 if (need_redraw) do_cmd_redraw();
8667 * Check on the status of an active quest
8669 void do_cmd_checkquest(void)
8671 /* File type is "TEXT" */
8672 FILE_TYPE(FILE_TYPE_TEXT);
8674 /* Save the screen */
8678 do_cmd_knowledge_quests();
8680 /* Restore the screen */
8686 * Display the time and date
8688 void do_cmd_time(void)
8690 int day, hour, min, full, start, end, num;
8698 extract_day_hour_min(&day, &hour, &min);
8700 full = hour * 100 + min;
8707 strcpy(desc, _("変な時刻だ。", "It is a strange time."));
8709 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
8710 else strcpy(day_buf, "*****");
8713 msg_format("%s日目, 時刻は%d:%02d %sです。",
8714 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
8715 min, (hour < 12) ? "AM" : "PM");
8717 msg_format("This is day %s. The time is %d:%02d %s.",
8718 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
8719 min, (hour < 12) ? "AM" : "PM");
8724 if (!randint0(10) || p_ptr->image)
8726 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timefun_j.txt", "timefun.txt"));
8730 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timenorm_j.txt", "timenorm.txt"));
8733 /* Open this file */
8734 fff = my_fopen(buf, "rt");
8739 /* Find this time */
8740 while (!my_fgets(fff, buf, sizeof(buf)))
8742 /* Ignore comments */
8743 if (!buf[0] || (buf[0] == '#')) continue;
8745 /* Ignore invalid lines */
8746 if (buf[1] != ':') continue;
8748 /* Process 'Start' */
8751 /* Extract the starting time */
8752 start = atoi(buf + 2);
8754 /* Assume valid for an hour */
8764 /* Extract the ending time */
8765 end = atoi(buf + 2);
8771 /* Ignore incorrect range */
8772 if ((start > full) || (full > end)) continue;
8774 /* Process 'Description' */
8779 /* Apply the randomizer */
8780 if (!randint0(num)) strcpy(desc, buf + 2);
8789 /* Close the file */