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):", dun_level, d_name+d_info[dungeon_type].name);
436 sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, 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);
469 fprintf(fff, _(" %2d:%02d %20s %sを倒した。\n", " %2d:%02d %20s defeated %s.\n"), hour, min, note_level, note);
472 case NIKKI_FIX_QUEST_C:
474 if (quest[num].flags & QUEST_FLAG_SILENT) break;
475 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」を達成した。\n",
476 " %2d:%02d %20s completed quest '%s'.\n"), hour, min, note_level, quest[num].name);
479 case NIKKI_FIX_QUEST_F:
481 if (quest[num].flags & QUEST_FLAG_SILENT) break;
482 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」から命からがら逃げ帰った。\n",
483 " %2d:%02d %20s run away from quest '%s'.\n"), hour, min, note_level, quest[num].name);
486 case NIKKI_RAND_QUEST_C:
489 strcpy(name, r_name+r_info[quest[num].r_idx].name);
490 fprintf(fff, _(" %2d:%02d %20s ランダムクエスト(%s)を達成した。\n",
491 " %2d:%02d %20s completed random quest '%s'\n"), hour, min, note_level, name);
494 case NIKKI_RAND_QUEST_F:
497 strcpy(name, r_name+r_info[quest[num].r_idx].name);
498 fprintf(fff, _(" %2d:%02d %20s ランダムクエスト(%s)から逃げ出した。\n",
499 " %2d:%02d %20s ran away from quest '%s'.\n"), hour, min, note_level, name);
502 case NIKKI_MAXDEAPTH:
504 fprintf(fff, _(" %2d:%02d %20s %sの最深階%d階に到達した。\n",
505 " %2d:%02d %20s reached level %d of %s for the first time.\n"), hour, min, note_level,
506 _(d_name+d_info[dungeon_type].name, num),
507 _(num, d_name+d_info[dungeon_type].name));
512 fprintf(fff, _(" %2d:%02d %20s %s%sの最深階を%d階にセットした。\n",
513 " %2d:%02d %20s reset recall level of %s to %d %s.\n"), hour, min, note_level, note,
514 _(d_name + d_info[num].name, max_dlv[num]),
515 _(max_dlv[num], d_name + d_info[num].name));
521 if (q_idx && (is_fixed_quest_idx(q_idx)
522 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
524 to = _("地上", "the surface");
528 if (!(dun_level+num)) to = _("地上", "the surface");
529 else to = format(_("%d階", "level %d"), dun_level+num);
531 fprintf(fff, _(" %2d:%02d %20s %sへ%s。\n", " %2d:%02d %20s %s %s.\n"), hour, min, note_level, _(to, note), _(note, to));
537 fprintf(fff, _(" %2d:%02d %20s 帰還を使って%sの%d階へ下りた。\n", " %2d:%02d %20s recalled to dungeon level %d of %s.\n"),
538 hour, min, note_level, _(d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]),
539 _(max_dlv[dungeon_type], d_name+d_info[dungeon_type].name));
541 fprintf(fff, _(" %2d:%02d %20s 帰還を使って地上へと戻った。\n", " %2d:%02d %20s recalled from dungeon to surface.\n"), hour, min, note_level);
546 if (quest[num].flags & QUEST_FLAG_SILENT) break;
547 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」へと突入した。\n", " %2d:%02d %20s entered the quest '%s'.\n"),
548 hour, min, note_level, quest[num].name);
553 fprintf(fff, _(" %2d:%02d %20s レベル・テレポートで脱出した。\n", " %2d:%02d %20s Got out using teleport level.\n"),
554 hour, min, note_level);
559 fprintf(fff, _(" %2d:%02d %20s %sを購入した。\n", " %2d:%02d %20s bought %s.\n"), hour, min, note_level, note);
564 fprintf(fff, _(" %2d:%02d %20s %sを売却した。\n", " %2d:%02d %20s sold %s.\n"), hour, min, note_level, note);
572 fprintf(fff, _(" %2d:%02d %20s 闘技場の%d%s回戦で、%sの前に敗れ去った。\n", " %2d:%02d %20s beaten by %s in the %d%s fight.\n"),
573 hour, min, note_level, _(n, note), _("", n), _(note, get_ordinal_number_suffix(n)));
576 fprintf(fff, _(" %2d:%02d %20s 闘技場の%d%s回戦(%s)に勝利した。\n", " %2d:%02d %20s won the %d%s fight (%s).\n"),
577 hour, min, note_level, num, _("", get_ordinal_number_suffix(num)), note);
579 if (num == MAX_ARENA_MONS)
581 fprintf(fff, _(" 闘技場のすべての敵に勝利し、チャンピオンとなった。\n",
582 " won all fight to become a Chanpion.\n"));
589 fprintf(fff, _(" %2d:%02d %20s %sを識別した。\n", " %2d:%02d %20s identified %s.\n"), hour, min, note_level, note);
596 to = _("地上", "the surface");
598 to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_type].name);
600 fprintf(fff, _(" %2d:%02d %20s %sへとウィザード・テレポートで移動した。\n",
601 " %2d:%02d %20s wizard-teleport to %s.\n"), hour, min, note_level, to);
608 to = _("地上", "the surface");
610 to = format(_("%d階(%s)", "level %d of %s"), dun_level, d_name+d_info[dungeon_type].name);
612 fprintf(fff, _(" %2d:%02d %20s %sへとパターンの力で移動した。\n",
613 " %2d:%02d %20s used Pattern to teleport to %s.\n"), hour, min, note_level, to);
618 fprintf(fff, _(" %2d:%02d %20s レベルが%dに上がった。\n", " %2d:%02d %20s reached player level %d.\n"), hour, min, note_level, num);
621 case NIKKI_GAMESTART:
623 time_t ct = time((time_t*)0);
627 fprintf(fff, "%s %s",note, ctime(&ct));
630 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
633 case NIKKI_NAMED_PET:
635 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
638 case RECORD_NAMED_PET_NAME:
639 fprintf(fff, _("%sを旅の友にすることに決めた。\n", "decided to travel together with %s.\n"), note);
641 case RECORD_NAMED_PET_UNNAME:
642 fprintf(fff, _("%sの名前を消した。\n", "unnamed %s.\n"), note);
644 case RECORD_NAMED_PET_DISMISS:
645 fprintf(fff, _("%sを解放した。\n", "dismissed %s.\n"), note);
647 case RECORD_NAMED_PET_DEATH:
648 fprintf(fff, _("%sが死んでしまった。\n", "%s died.\n"), note);
650 case RECORD_NAMED_PET_MOVED:
651 fprintf(fff, _("%sをおいて別のマップへ移動した。\n", "moved to another map leaving %s behind.\n"), note);
653 case RECORD_NAMED_PET_LOST_SIGHT:
654 fprintf(fff, _("%sとはぐれてしまった。\n", "lost sight of %s.\n"), note);
656 case RECORD_NAMED_PET_DESTROY:
657 fprintf(fff, _("%sが*破壊*によって消え去った。\n", "%s was made disappeared by *destruction*.\n"), note);
659 case RECORD_NAMED_PET_EARTHQUAKE:
660 fprintf(fff, _("%sが岩石に押し潰された。\n", "%s was crushed by falling rocks.\n"), note);
662 case RECORD_NAMED_PET_GENOCIDE:
663 fprintf(fff, _("%sが抹殺によって消え去った。\n", "%s was made disappeared by genocide.\n"), note);
665 case RECORD_NAMED_PET_WIZ_ZAP:
666 fprintf(fff, _("%sがデバッグコマンドによって消え去った。\n", "%s was removed by debug command.\n"), note);
668 case RECORD_NAMED_PET_TELE_LEVEL:
669 fprintf(fff, _("%sがテレポート・レベルによって消え去った。\n", "%s was made disappeared by teleport level.\n"), note);
671 case RECORD_NAMED_PET_BLAST:
672 fprintf(fff, _("%sを爆破した。\n", "blasted %s.\n"), note);
674 case RECORD_NAMED_PET_HEAL_LEPER:
675 fprintf(fff, _("%sの病気が治り旅から外れた。\n", "%s was healed and left.\n"), note);
677 case RECORD_NAMED_PET_COMPACT:
678 fprintf(fff, _("%sがモンスター情報圧縮によって消え去った。\n", "%s was made disappeared by compacting monsters.\n"), note);
680 case RECORD_NAMED_PET_LOSE_PARENT:
681 fprintf(fff, _("%sの召喚者が既にいないため消え去った。\n", "%s disappeared because there does not exist summoner.\n"), note);
695 if (do_level) write_level = FALSE;
701 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
704 * @brief 日記のタイトル表記と内容出力 /
707 * 日記のタイトルは本関数の subtitle ローカル変数で定義されている。
709 static void do_cmd_disp_nikki(void)
711 char nikki_title[256];
717 static const char subtitle[][30] = {"最強の肉体を求めて",
748 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
749 "Attack is the best form of defence.",
751 "An unexpected windfall",
752 "A drowning man will catch at a straw",
753 "Don't count your chickens before they are hatched.",
754 "It is no use crying over spilt milk.",
755 "Seeing is believing.",
756 "Strike the iron while it is hot.",
757 "I don't care what follows.",
758 "To dig a well to put out a house on fire.",
759 "Tomorrow is another day.",
760 "Easy come, easy go.",
761 "The more haste, the less speed.",
762 "Where there is life, there is hope.",
763 "There is no royal road to *WINNER*.",
764 "Danger past, God forgotten.",
765 "The best thing to do now is to run away.",
766 "Life is but an empty dream.",
767 "Dead men tell no tales.",
768 "A book that remains shut is but a block.",
769 "Misfortunes never come singly.",
770 "A little knowledge is a dangerous thing.",
771 "History repeats itself.",
772 "*WINNER* was not built in a day.",
773 "Ignorance is bliss.",
774 "To lose is to win?",
775 "No medicine can cure folly.",
776 "All good things come to an end.",
777 "M$ Empire strikes back.",
778 "To see is to believe",
780 "Quest of The World's Greatest Brain"};
782 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
784 /* Build the filename */
785 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
787 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
788 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
789 else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
790 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
791 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
794 sprintf(nikki_title, "「%s%s%sの伝説 -%s-」",
795 ap_ptr->title, ap_ptr->no ? "の" : "", p_ptr->name, tmp);
797 sprintf(nikki_title, "Legend of %s %s '%s'",
798 ap_ptr->title, p_ptr->name, tmp);
801 /* Display the file contents */
802 show_file(FALSE, buf, nikki_title, -1, 0);
806 * @brief 日記に任意の内容を表記するコマンドのメインルーチン /
809 static void do_cmd_bunshou(void)
812 char bunshou[80] = "\0";
814 if (get_string(_("内容: ", "diary note: "), tmp, 79))
816 strcpy(bunshou, tmp);
818 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, bunshou);
823 * @brief 最後に取得したアイテムの情報を日記に追加するメインルーチン /
826 static void do_cmd_last_get(void)
831 if (record_o_name[0] == '\0') return;
833 sprintf(buf,_("%sの入手を記録します。", "Do you really want to record getting %s? "),record_o_name);
834 if (!get_check(buf)) return;
838 sprintf(buf,_("%sを手に入れた。", "descover %s."), record_o_name);
839 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
844 * @brief ファイル中の全日記記録を消去する /
847 static void do_cmd_erase_nikki(void)
853 if (!get_check(_("本当に記録を消去しますか?", "Do you really want to delete all your record? "))) return;
854 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
856 /* Build the filename */
857 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
859 /* Remove the file */
862 fff = my_fopen(buf, "w");
865 msg_format(_("記録を消去しました。", "deleted record."));
867 msg_format(_("%s の消去に失敗しました。", "failed to delete %s."), buf);
876 void do_cmd_nikki(void)
880 /* File type is "TEXT" */
881 FILE_TYPE(FILE_TYPE_TEXT);
883 /* Save the screen */
886 /* Interact until done */
892 /* Ask for a choice */
893 prt(_("[ 記録の設定 ]", "[ Play Record ]"), 2, 0);
895 /* Give some choices */
896 prt(_("(1) 記録を見る", "(1) Display your record"), 4, 5);
897 prt(_("(2) 文章を記録する", "(2) Add record"), 5, 5);
898 prt(_("(3) 直前に入手又は鑑定したものを記録する", "(3) Record item you last get/identify"), 6, 5);
899 prt(_("(4) 記録を消去する", "(4) Delete your record"), 7, 5);
901 prt(_("(R) プレイ動画を記録する/中止する", "(R) Record playing movie / or stop it"), 9, 5);
904 prt(_("コマンド:", "Command: "), 18, 0);
910 if (i == ESCAPE) break;
924 do_cmd_erase_nikki();
928 prepare_movie_hooks();
930 default: /* Unknown option */
938 /* Restore the screen */
943 * @brief 画面を再描画するコマンドのメインルーチン
944 * Hack -- redraw the screen
948 * This command performs various low level updates, clears all the "extra"
949 * windows, does a total redraw of the main window, and requests all of the
950 * interesting updates and redraws that I can think of.
952 * This command is also used to "instantiate" the results of the user
953 * selecting various things, such as graphics mode, so it must call
954 * the "TERM_XTRA_REACT" hook before redrawing the windows.
957 void do_cmd_redraw(void)
964 /* Hack -- react to changes */
965 Term_xtra(TERM_XTRA_REACT, 0);
968 /* Combine and Reorder the pack (later) */
969 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
973 p_ptr->update |= (PU_TORCH);
976 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
978 /* Forget lite/view */
979 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
981 /* Update lite/view */
982 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
984 /* Update monsters */
985 p_ptr->update |= (PU_MONSTERS);
987 /* Redraw everything */
988 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
991 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
994 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1001 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1004 /* Redraw every window */
1005 for (j = 0; j < 8; j++)
1008 if (!angband_term[j]) continue;
1011 Term_activate(angband_term[j]);
1026 * @brief 名前を変更するコマンドのメインルーチン
1027 * Hack -- change name
1030 void do_cmd_change_name(void)
1039 /* Save the screen */
1047 /* Display the player */
1048 display_player(mode);
1053 display_player(mode);
1058 Term_putstr(2, 23, -1, TERM_WHITE,
1059 "['c'で名前変更, 'f'でファイルへ書出, 'h'でモード変更, ESCで終了]");
1061 Term_putstr(2, 23, -1, TERM_WHITE,
1062 "['c' to change name, 'f' to file, 'h' to change mode, or ESC]");
1070 if (c == ESCAPE) break;
1077 /* Process the player name */
1078 process_player_name(FALSE);
1084 sprintf(tmp, "%s.txt", player_base);
1085 if (get_string(_("ファイル名: ", "File name: "), tmp, 80))
1087 if (tmp[0] && (tmp[0] != ' '))
1089 file_character(tmp);
1106 /* Flush messages */
1110 /* Restore the screen */
1113 /* Redraw everything */
1114 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1121 * @brief 最近表示されたメッセージを再表示するコマンドのメインルーチン
1122 * Recall the most recent message
1125 void do_cmd_message_one(void)
1127 /* Recall one message XXX XXX XXX */
1128 prt(format("> %s", message_str(0)), 0, 0);
1133 * @brief メッセージのログを表示するコマンドのメインルーチン
1134 * Recall the most recent message
1138 * Show previous messages to the user -BEN-
1140 * The screen format uses line 0 and 23 for headers and prompts,
1141 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1143 * This command shows you which commands you are viewing, and allows
1144 * you to "search" for strings in the recall.
1146 * Note that messages may be longer than 80 characters, but they are
1147 * displayed using "infinite" length, with a special sub-command to
1148 * "slide" the virtual display to the left or right.
1150 * Attempt to only hilite the matching portions of the string.
1153 void do_cmd_messages(int num_now)
1157 char shower_str[81];
1158 char finder_str[81];
1165 Term_get_size(&wid, &hgt);
1167 /* Number of message lines in a screen */
1168 num_lines = hgt - 4;
1171 strcpy(finder_str, "");
1174 strcpy(shower_str, "");
1176 /* Total messages */
1179 /* Start on first message */
1182 /* Save the screen */
1188 /* Process requests until done */
1194 /* Dump up to 20 lines of messages */
1195 for (j = 0; (j < num_lines) && (i + j < n); j++)
1197 cptr msg = message_str(i+j);
1199 /* Dump the messages, bottom to top */
1200 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1202 /* Hilite "shower" */
1203 if (shower && shower[0])
1207 /* Display matches */
1208 while ((str = my_strstr(str, shower)) != NULL)
1210 int len = strlen(shower);
1212 /* Display the match */
1213 Term_putstr(str-msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1221 /* Erase remaining lines */
1222 for (; j < num_lines; j++)
1224 Term_erase(0, num_lines + 1 - j, 255);
1227 /* Display header XXX XXX XXX */
1230 prt(format("以前のメッセージ %d-%d 全部で(%d)",
1231 i, i + j - 1, n), 0, 0);
1233 prt(format("Message Recall (%d-%d of %d)",
1234 i, i + j - 1, n), 0, 0);
1237 /* Display prompt (not very informative) */
1238 prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]",
1239 "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0);
1242 skey = inkey_special(TRUE);
1244 /* Exit on Escape */
1245 if (skey == ESCAPE) break;
1247 /* Hack -- Save the old index */
1252 /* Hack -- handle show */
1255 prt(_("強調: ", "Show: "), hgt - 1, 0);
1257 /* Get a "shower" string, or continue */
1258 strcpy(back_str, shower_str);
1259 if (askfor(shower_str, 80))
1262 shower = shower_str[0] ? shower_str : NULL;
1264 else strcpy(shower_str, back_str);
1269 /* Hack -- handle find */
1276 prt(_("検索: ", "Find: "), hgt - 1, 0);
1278 /* Get a "finder" string, or continue */
1279 strcpy(back_str, finder_str);
1280 if (!askfor(finder_str, 80))
1282 strcpy(finder_str, back_str);
1285 else if (!finder_str[0])
1287 shower = NULL; /* Stop showing */
1292 shower = finder_str;
1295 for (z = i + 1; z < n; z++)
1297 cptr msg = message_str(z);
1300 if (my_strstr(msg, finder_str))
1312 /* Recall 1 older message */
1314 /* Go to the oldest line */
1318 /* Recall 1 newer message */
1320 /* Go to the newest line */
1324 /* Recall 1 older message */
1329 /* Go older if legal */
1330 i = MIN(i + 1, n - num_lines);
1333 /* Recall 10 older messages */
1335 /* Go older if legal */
1336 i = MIN(i + 10, n - num_lines);
1339 /* Recall 20 older messages */
1344 /* Go older if legal */
1345 i = MIN(i + num_lines, n - num_lines);
1348 /* Recall 20 newer messages */
1352 /* Go newer (if able) */
1353 i = MAX(0, i - num_lines);
1356 /* Recall 10 newer messages */
1358 /* Go newer (if able) */
1362 /* Recall 1 newer messages */
1365 /* Go newer (if able) */
1370 /* Hack -- Error of some kind */
1374 /* Restore the screen */
1381 * チートオプションの最大数 / Number of cheating options
1386 * チーとオプションの定義テーブル / Cheating options
1388 static option_type cheat_info[CHEAT_MAX] =
1390 { &cheat_peek, FALSE, 255, 0x01, 0x00,
1391 "cheat_peek", _("アイテムの生成をのぞき見る", "Peek into object creation")
1394 { &cheat_hear, FALSE, 255, 0x02, 0x00,
1395 "cheat_hear", _("モンスターの生成をのぞき見る", "Peek into monster creation")
1398 { &cheat_room, FALSE, 255, 0x04, 0x00,
1399 "cheat_room", _("ダンジョンの生成をのぞき見る", "Peek into dungeon creation")
1402 { &cheat_xtra, FALSE, 255, 0x08, 0x00,
1403 "cheat_xtra", _("その他の事をのぞき見る", "Peek into something else")
1406 { &cheat_know, FALSE, 255, 0x10, 0x00,
1407 "cheat_know", _("完全なモンスターの思い出を知る", "Know complete monster info")
1410 { &cheat_live, FALSE, 255, 0x20, 0x00,
1411 "cheat_live", _("死を回避することを可能にする", "Allow player to avoid death")
1414 { &cheat_save, FALSE, 255, 0x40, 0x00,
1415 "cheat_save", _("死んだ時セーブするか確認する", "Ask for saving death")
1420 * @brief チートオプションを変更するコマンドのメインルーチン
1421 * Interact with some options for cheating
1422 * @param info 表示メッセージ
1425 static void do_cmd_options_cheat(cptr info)
1429 int i, k = 0, n = CHEAT_MAX;
1437 /* Interact with the player */
1442 /* Prompt XXX XXX XXX */
1443 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info);
1448 /* 詐欺オプションをうっかりいじってしまう人がいるようなので注意 */
1449 prt(" << 注意 >>", 11, 0);
1450 prt(" 詐欺オプションを一度でも設定すると、スコア記録が残らなくなります!", 12, 0);
1451 prt(" 後に解除してもダメですので、勝利者を目指す方はここのオプションはい", 13, 0);
1452 prt(" じらないようにして下さい。", 14, 0);
1454 /* Display the options */
1455 for (i = 0; i < n; i++)
1457 byte a = TERM_WHITE;
1459 /* Color current option */
1460 if (i == k) a = TERM_L_BLUE;
1462 /* Display the option text */
1463 sprintf(buf, "%-48s: %s (%s)",
1464 cheat_info[i].o_desc,
1465 (*cheat_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1466 cheat_info[i].o_text);
1467 c_prt(a, buf, i + 2, 0);
1470 /* Hilite current option */
1471 move_cursor(k + 2, 50);
1477 * HACK - Try to translate the key into a direction
1478 * to allow using the roguelike keys for navigation.
1480 dir = get_keymap_dir(ch);
1481 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1495 k = (n + k - 1) % n;
1513 do_cmd_write_nikki(NIKKI_BUNSHOU, 0,
1514 _("詐欺オプションをONにして、スコアを残せなくなった。", "give up sending score to use cheating options."));
1515 p_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
1516 (*cheat_info[k].o_var) = TRUE;
1525 (*cheat_info[k].o_var) = FALSE;
1532 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), cheat_info[k].o_text);
1533 /* Peruse the help file */
1534 (void)show_file(TRUE, buf, NULL, 0, 0);
1553 static option_type autosave_info[2] =
1555 { &autosave_l, FALSE, 255, 0x01, 0x00,
1556 "autosave_l", _("新しい階に入る度に自動セーブする", "Autosave when entering new levels") },
1558 { &autosave_t, FALSE, 255, 0x02, 0x00,
1559 "autosave_t", _("一定ターン毎に自動セーブする", "Timed autosave") },
1563 * @brief セーブ頻度ターンの次の値を返す
1564 * @param current 現在のセーブ頻度ターン値
1565 * @return 次のセーブ頻度ターン値
1567 static s16b toggle_frequency(s16b current)
1572 case 50: return 100;
1573 case 100: return 250;
1574 case 250: return 500;
1575 case 500: return 1000;
1576 case 1000: return 2500;
1577 case 2500: return 5000;
1578 case 5000: return 10000;
1579 case 10000: return 25000;
1586 * @brief 自動セーブオプションを変更するコマンドのメインルーチン
1587 * @param info 表示メッセージ
1590 static void do_cmd_options_autosave(cptr info)
1594 int i, k = 0, n = 2;
1602 /* Interact with the player */
1605 /* Prompt XXX XXX XXX */
1606 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, F で頻度を入力, ESC で決定 ) ",
1607 "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) "), info);
1611 /* Display the options */
1612 for (i = 0; i < n; i++)
1614 byte a = TERM_WHITE;
1616 /* Color current option */
1617 if (i == k) a = TERM_L_BLUE;
1619 /* Display the option text */
1620 sprintf(buf, "%-48s: %s (%s)",
1621 autosave_info[i].o_desc,
1622 (*autosave_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1623 autosave_info[i].o_text);
1624 c_prt(a, buf, i + 2, 0);
1626 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1628 /* Hilite current option */
1629 move_cursor(k + 2, 50);
1645 k = (n + k - 1) % n;
1663 (*autosave_info[k].o_var) = TRUE;
1672 (*autosave_info[k].o_var) = FALSE;
1680 autosave_freq = toggle_frequency(autosave_freq);
1681 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
1687 (void)show_file(TRUE, _("joption.txt#Autosave", "option.txt#Autosave"), NULL, 0, 0);
1703 * @brief 標準オプションを変更するコマンドのサブルーチン /
1704 * Interact with some options
1705 * @param page オプションページ番号
1706 * @param info 表示メッセージ
1709 void do_cmd_options_aux(int page, cptr info)
1712 int i, k = 0, n = 0, l;
1715 bool browse_only = (page == OPT_PAGE_BIRTH) && character_generated &&
1716 (!p_ptr->wizard || !allow_debug_opts);
1719 /* Lookup the options */
1720 for (i = 0; i < 24; i++) opt[i] = 0;
1722 /* Scan the options */
1723 for (i = 0; option_info[i].o_desc; i++)
1725 /* Notice options on this "page" */
1726 if (option_info[i].o_page == page) opt[n++] = i;
1733 /* Interact with the player */
1738 /* Prompt XXX XXX XXX */
1739 sprintf(buf, _("%s (リターン:次, %sESC:終了, ?:ヘルプ) ", "%s (RET:next, %s, ?:help) "),
1740 info, browse_only ? _("", "ESC:exit") : _("y/n:変更, ", "y/n:change, ESC:accept"));
1743 /* HACK -- description for easy-auto-destroy options */
1744 if (page == OPT_PAGE_AUTODESTROY)
1745 c_prt(TERM_YELLOW, _("以下のオプションは、簡易自動破壊を使用するときのみ有効",
1746 "Following options will protect items from easy auto-destroyer."), 6, _(6, 3));
1748 /* Display the options */
1749 for (i = 0; i < n; i++)
1751 byte a = TERM_WHITE;
1753 /* Color current option */
1754 if (i == k) a = TERM_L_BLUE;
1756 /* Display the option text */
1757 sprintf(buf, "%-48s: %s (%.19s)",
1758 option_info[opt[i]].o_desc,
1759 (*option_info[opt[i]].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
1760 option_info[opt[i]].o_text);
1761 if ((page == OPT_PAGE_AUTODESTROY) && i > 2) c_prt(a, buf, i + 5, 0);
1762 else c_prt(a, buf, i + 2, 0);
1765 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2)) l = 3;
1768 /* Hilite current option */
1769 move_cursor(k + 2 + l, 50);
1775 * HACK - Try to translate the key into a direction
1776 * to allow using the roguelike keys for navigation.
1778 dir = get_keymap_dir(ch);
1779 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
1793 k = (n + k - 1) % n;
1810 if (browse_only) break;
1811 (*option_info[opt[k]].o_var) = TRUE;
1820 if (browse_only) break;
1821 (*option_info[opt[k]].o_var) = FALSE;
1829 if (!browse_only) (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
1835 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), option_info[opt[k]].o_text);
1836 /* Peruse the help file */
1837 (void)show_file(TRUE, buf, NULL, 0, 0);
1854 * @brief ウィンドウオプションを変更するコマンドのメインルーチン /
1855 * Modify the "window" options
1858 static void do_cmd_options_win(void)
1868 /* Memorize old flags */
1869 for (j = 0; j < 8; j++)
1871 /* Acquire current flags */
1872 old_flag[j] = window_flag[j];
1882 /* Prompt XXX XXX XXX */
1883 prt(_("ウィンドウ・フラグ (<方向>で移動, tでチェンジ, y/n でセット, ESC)", "Window Flags (<dir>, t, y, n, ESC) "), 0, 0);
1885 /* Display the windows */
1886 for (j = 0; j < 8; j++)
1888 byte a = TERM_WHITE;
1890 cptr s = angband_term_name[j];
1893 if (j == x) a = TERM_L_BLUE;
1895 /* Window name, staggered, centered */
1896 Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
1899 /* Display the options */
1900 for (i = 0; i < 16; i++)
1902 byte a = TERM_WHITE;
1904 cptr str = window_flag_desc[i];
1907 if (i == y) a = TERM_L_BLUE;
1910 if (!str) str = _("(未使用)", "(Unused option)");
1913 Term_putstr(0, i + 5, -1, a, str);
1915 /* Display the windows */
1916 for (j = 0; j < 8; j++)
1922 if ((i == y) && (j == x)) a = TERM_L_BLUE;
1925 if (window_flag[j] & (1L << i)) c = 'X';
1928 Term_putch(35 + j * 5, i + 5, a, c);
1933 Term_gotoxy(35 + x * 5, y + 5);
1951 for (j = 0; j < 8; j++)
1953 window_flag[j] &= ~(1L << y);
1957 for (i = 0; i < 16; i++)
1959 window_flag[x] &= ~(1L << i);
1972 window_flag[x] |= (1L << y);
1980 window_flag[x] &= ~(1L << y);
1986 (void)show_file(TRUE, _("joption.txt#Window", "option.txt#Window"), NULL, 0, 0);
1994 d = get_keymap_dir(ch);
1996 x = (x + ddx[d] + 8) % 8;
1997 y = (y + ddy[d] + 16) % 16;
2004 /* Notice changes */
2005 for (j = 0; j < 8; j++)
2010 if (!angband_term[j]) continue;
2012 /* Ignore non-changes */
2013 if (window_flag[j] == old_flag[j]) continue;
2016 Term_activate(angband_term[j]);
2039 option_fields[OPT_NUM] =
2042 { '1', " キー入力 オプション", 3 },
2043 { '2', " マップ画面 オプション", 4 },
2044 { '3', " テキスト表示 オプション", 5 },
2045 { '4', " ゲームプレイ オプション", 6 },
2046 { '5', " 行動中止関係 オプション", 7 },
2047 { '6', " 簡易自動破壊 オプション", 8 },
2048 { 'r', " プレイ記録 オプション", 9 },
2050 { 'p', "自動拾いエディタ", 11 },
2051 { 'd', " 基本ウェイト量 ", 12 },
2052 { 'h', "低ヒットポイント", 13 },
2053 { 'm', " 低魔力色閾値 ", 14 },
2054 { 'a', " 自動セーブ オプション", 15 },
2055 { 'w', "ウインドウフラグ", 16 },
2057 { 'b', " 初期 オプション (参照のみ)", 18 },
2058 { 'c', " 詐欺 オプション", 19 },
2060 { '1', "Input Options", 3 },
2061 { '2', "Map Screen Options", 4 },
2062 { '3', "Text Display Options", 5 },
2063 { '4', "Game-Play Options", 6 },
2064 { '5', "Disturbance Options", 7 },
2065 { '6', "Easy Auto-Destroyer Options", 8 },
2066 { 'r', "Play record Options", 9 },
2068 { 'p', "Auto-picker/destroyer editor", 11 },
2069 { 'd', "Base Delay Factor", 12 },
2070 { 'h', "Hitpoint Warning", 13 },
2071 { 'm', "Mana Color Threshold", 14 },
2072 { 'a', "Autosave Options", 15 },
2073 { 'w', "Window Flags", 16 },
2075 { 'b', "Birth Options (Browse Only)", 18 },
2076 { 'c', "Cheat Options", 19 },
2082 * @brief 標準オプションを変更するコマンドのメインルーチン /
2083 * Set or unset various options.
2087 * The user must use the "Ctrl-R" command to "adapt" to changes
2088 * in any options which control "visual" aspects of the game.
2091 void do_cmd_options(void)
2097 /* Save the screen */
2105 /* Does not list cheat option when cheat option is off */
2106 if (!p_ptr->noscore && !allow_debug_opts) n--;
2111 /* Why are we here */
2112 prt(_("[ オプションの設定 ]", "TinyAngband options"), 1, 0);
2116 /* Give some choices */
2117 for (i = 0; i < n; i++)
2119 byte a = TERM_WHITE;
2120 if (i == y) a = TERM_L_BLUE;
2121 Term_putstr(5, option_fields[i].row, -1, a,
2122 format("(%c) %s", toupper(option_fields[i].key), option_fields[i].name));
2125 prt(_("<方向>で移動, Enterで決定, ESCでキャンセル, ?でヘルプ: ", "Move to <dir>, Select to Enter, Cancel to ESC, ? to help: "), 21, 0);
2128 skey = inkey_special(TRUE);
2129 if (!(skey & SKEY_MASK)) k = (char)skey;
2133 if (k == ESCAPE) break;
2135 if (my_strchr("\n\r ", k))
2137 k = option_fields[y].key;
2141 for (i = 0; i < n; i++)
2143 if (tolower(k) == option_fields[i].key) break;
2146 /* Command is found */
2149 /* Hack -- browse help */
2150 if (k == '?') break;
2154 if (skey == SKEY_UP) d = 8;
2155 if (skey == SKEY_DOWN) d = 2;
2156 y = (y + ddy[d] + n) % n;
2161 if (k == ESCAPE) break;
2168 /* Process the general options */
2169 do_cmd_options_aux(OPT_PAGE_INPUT, _("キー入力オプション", "Input Options"));
2175 /* Process the general options */
2176 do_cmd_options_aux(OPT_PAGE_MAPSCREEN, _("マップ画面オプション", "Map Screen Options"));
2183 do_cmd_options_aux(OPT_PAGE_TEXT, _("テキスト表示オプション", "Text Display Options"));
2190 do_cmd_options_aux(OPT_PAGE_GAMEPLAY, _("ゲームプレイ・オプション", "Game-Play Options"));
2197 do_cmd_options_aux(OPT_PAGE_DISTURBANCE, _("行動中止関係のオプション", "Disturbance Options"));
2204 do_cmd_options_aux(OPT_PAGE_AUTODESTROY, _("簡易自動破壊オプション", "Easy Auto-Destroyer Options"));
2208 /* Play-record Options */
2213 do_cmd_options_aux(OPT_PAGE_PLAYRECORD, _("プレイ記録オプション", "Play-record Options"));
2222 do_cmd_options_aux(OPT_PAGE_BIRTH, (!p_ptr->wizard || !allow_debug_opts) ?
2223 _("初期オプション(参照のみ)", "Birth Options(browse only)") :
2224 _("初期オプション((*)はスコアに影響)", "Birth Options((*)s effect score)"));
2228 /* Cheating Options */
2231 if (!p_ptr->noscore && !allow_debug_opts)
2233 /* Cheat options are not permitted */
2239 do_cmd_options_cheat(_("詐欺師は決して勝利できない!", "Cheaters never win"));
2246 do_cmd_options_autosave(_("自動セーブ", "Autosave"));
2255 do_cmd_options_win();
2256 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL |
2257 PW_PLAYER | PW_MESSAGE | PW_OVERHEAD |
2258 PW_MONSTER | PW_OBJECT | PW_SNAPSHOT |
2259 PW_BORG_1 | PW_BORG_2 | PW_DUNGEON |
2264 /* Auto-picker/destroyer editor */
2268 do_cmd_edit_autopick();
2272 /* Hack -- Delay Speed */
2278 prt(_("コマンド: 基本ウェイト量", "Command: Base Delay Factor"), 19, 0);
2280 /* Get a new value */
2283 int msec = delay_factor * delay_factor * delay_factor;
2284 prt(format(_("現在のウェイト: %d (%dミリ秒)", "Current base delay factor: %d (%d msec)"), delay_factor, msec), 22, 0);
2285 prt(_("ウェイト (0-9) ESCで決定: ", "Delay Factor (0-9 or ESC to accept): "), 20, 0);
2287 if (k == ESCAPE) break;
2290 (void)show_file(TRUE, _("joption.txt#BaseDelay", "option.txt#BaseDelay"), NULL, 0, 0);
2293 else if (isdigit(k)) delay_factor = D2I(k);
2300 /* Hack -- hitpoint warning factor */
2306 prt(_("コマンド: 低ヒットポイント警告", "Command: Hitpoint Warning"), 19, 0);
2308 /* Get a new value */
2311 prt(format(_("現在の低ヒットポイント警告: %d0%%", "Current hitpoint warning: %d0%%"), hitpoint_warn), 22, 0);
2312 prt(_("低ヒットポイント警告 (0-9) ESCで決定: ", "Hitpoint Warning (0-9 or ESC to accept): "), 20, 0);
2314 if (k == ESCAPE) break;
2317 (void)show_file(TRUE, _("joption.txt#Hitpoint", "option.txt#Hitpoint"), NULL, 0, 0);
2320 else if (isdigit(k)) hitpoint_warn = D2I(k);
2327 /* Hack -- mana color factor */
2333 prt(_("コマンド: 低魔力色閾値", "Command: Mana Color Threshold"), 19, 0);
2335 /* Get a new value */
2338 prt(format(_("現在の低魔力色閾値: %d0%%", "Current mana color threshold: %d0%%"), mana_warn), 22, 0);
2339 prt(_("低魔力閾値 (0-9) ESCで決定: ", "Mana color Threshold (0-9 or ESC to accept): "), 20, 0);
2341 if (k == ESCAPE) break;
2344 (void)show_file(TRUE, _("joption.txt#Manapoint", "option.txt#Manapoint"), NULL, 0, 0);
2347 else if (isdigit(k)) mana_warn = D2I(k);
2355 (void)show_file(TRUE, _("joption.txt", "option.txt"), NULL, 0, 0);
2359 /* Unknown option */
2368 /* Flush messages */
2373 /* Restore the screen */
2376 /* Hack - Redraw equippy chars */
2377 p_ptr->redraw |= (PR_EQUIPPY);
2383 * @brief prefファイルを選択して処理する /
2384 * Ask for a "user pref line" and process it
2387 * XXX XXX XXX Allow absolute file names?
2389 void do_cmd_pref(void)
2396 /* Ask for a "user pref command" */
2397 if (!get_string(_("設定変更コマンド: ", "Pref: "), buf, 80)) return;
2399 /* Process that pref command */
2400 (void)process_pref_file_command(buf);
2404 * @brief 自動拾い設定ファイルをロードするコマンドのメインルーチン /
2407 void do_cmd_reload_autopick(void)
2409 if (!get_check(_("自動拾い設定ファイルをロードしますか? ", "Reload auto-pick preference file? "))) return;
2410 /* Load the file with messages */
2411 autopick_load_pref(TRUE);
2417 * @brief マクロ情報をprefファイルに保存する /
2418 * @param fname ファイル名
2421 static errr macro_dump(cptr fname)
2423 static cptr mark = "Macro Dump";
2429 /* Build the filename */
2430 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2432 /* File type is "TEXT" */
2433 FILE_TYPE(FILE_TYPE_TEXT);
2435 /* Append to the file */
2436 if (!open_auto_dump(buf, mark)) return (-1);
2439 auto_dump_printf(_("\n# 自動マクロセーブ\n\n", "\n# Automatic macro dump\n\n"));
2442 for (i = 0; i < macro__num; i++)
2444 /* Extract the action */
2445 ascii_to_text(buf, macro__act[i]);
2447 /* Dump the macro */
2448 auto_dump_printf("A:%s\n", buf);
2450 /* Extract the action */
2451 ascii_to_text(buf, macro__pat[i]);
2453 /* Dump normal macros */
2454 auto_dump_printf("P:%s\n", buf);
2457 auto_dump_printf("\n");
2469 * @brief マクロのトリガーキーを取得する /
2470 * Hack -- ask for a "trigger" (see below)
2471 * @param buf キー表記を保管するバッファ
2475 * Note the complex use of the "inkey()" function from "util.c".
2477 * Note that both "flush()" calls are extremely important.
2480 static void do_cmd_macro_aux(char *buf)
2490 /* Do not process macros */
2496 /* Read the pattern */
2502 /* Do not process macros */
2505 /* Do not wait for keys */
2508 /* Attempt to read a key */
2519 /* Convert the trigger */
2520 ascii_to_text(tmp, buf);
2522 /* Hack -- display the trigger */
2523 Term_addstr(-1, TERM_WHITE, tmp);
2529 * @brief マクロのキー表記からアスキーコードを得てターミナルに表示する /
2530 * Hack -- ask for a keymap "trigger" (see below)
2531 * @param buf キー表記を取得するバッファ
2535 * Note that both "flush()" calls are extremely important. This may
2536 * no longer be true, since "util.c" is much simpler now. XXX XXX XXX
2539 static void do_cmd_macro_aux_keymap(char *buf)
2553 /* Convert to ascii */
2554 ascii_to_text(tmp, buf);
2556 /* Hack -- display the trigger */
2557 Term_addstr(-1, TERM_WHITE, tmp);
2566 * @brief キーマップをprefファイルにダンプする /
2567 * Hack -- append all keymaps to the given file
2568 * @param fname ファイルネーム
2572 static errr keymap_dump(cptr fname)
2574 static cptr mark = "Keymap Dump";
2583 if (rogue_like_commands)
2585 mode = KEYMAP_MODE_ROGUE;
2591 mode = KEYMAP_MODE_ORIG;
2595 /* Build the filename */
2596 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
2598 /* File type is "TEXT" */
2599 FILE_TYPE(FILE_TYPE_TEXT);
2601 /* Append to the file */
2602 if (!open_auto_dump(buf, mark)) return -1;
2605 auto_dump_printf(_("\n# 自動キー配置セーブ\n\n", "\n# Automatic keymap dump\n\n"));
2608 for (i = 0; i < 256; i++)
2612 /* Loop up the keymap */
2613 act = keymap_act[mode][i];
2615 /* Skip empty keymaps */
2618 /* Encode the key */
2621 ascii_to_text(key, buf);
2623 /* Encode the action */
2624 ascii_to_text(buf, act);
2626 /* Dump the macro */
2627 auto_dump_printf("A:%s\n", buf);
2628 auto_dump_printf("C:%d:%s\n", mode, key);
2640 * @brief マクロを設定するコマンドのメインルーチン /
2641 * Interact with "macros"
2645 * Note that the macro "action" must be defined before the trigger.
2647 * Could use some helpful instructions on this page. XXX XXX XXX
2650 void do_cmd_macros(void)
2662 if (rogue_like_commands)
2664 mode = KEYMAP_MODE_ROGUE;
2670 mode = KEYMAP_MODE_ORIG;
2673 /* File type is "TEXT" */
2674 FILE_TYPE(FILE_TYPE_TEXT);
2681 /* Process requests until done */
2688 prt(_("[ マクロの設定 ]", "Interact with Macros"), 2, 0);
2690 /* Describe that action */
2691 prt(_("マクロ行動が(もしあれば)下に表示されます:", "Current action (if any) shown below:"), 20, 0);
2693 /* Analyze the current action */
2694 ascii_to_text(buf, macro__buf);
2696 /* Display the current action */
2701 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
2703 prt(_("(2) ファイルにマクロを追加", "(2) Append macros to a file"), 5, 5);
2704 prt(_("(3) マクロの確認", "(3) Query a macro"), 6, 5);
2705 prt(_("(4) マクロの作成", "(4) Create a macro"), 7, 5);
2706 prt(_("(5) マクロの削除", "(5) Remove a macro"), 8, 5);
2707 prt(_("(6) ファイルにキー配置を追加", "(6) Append keymaps to a file"), 9, 5);
2708 prt(_("(7) キー配置の確認", "(7) Query a keymap"), 10, 5);
2709 prt(_("(8) キー配置の作成", "(8) Create a keymap"), 11, 5);
2710 prt(_("(9) キー配置の削除", "(9) Remove a keymap"), 12, 5);
2711 prt(_("(0) マクロ行動の入力", "(0) Enter a new action"), 13, 5);
2712 #endif /* ALLOW_MACROS */
2715 prt(_("コマンド: ", "Command: "), 16, 0);
2721 if (i == ESCAPE) break;
2723 /* Load a 'macro' file */
2729 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 16, 0);
2732 prt(_("ファイル: ", "File: "), 18, 0);
2734 /* Default filename */
2735 sprintf(tmp, "%s.prf", player_base);
2737 /* Ask for a file */
2738 if (!askfor(tmp, 80)) continue;
2740 /* Process the given filename */
2741 err = process_pref_file(tmp);
2744 msg_format(_("標準の設定ファイル'%s'を読み込みました。", "Loaded default '%s'."), tmp);
2749 msg_format(_("'%s'の読み込みに失敗しました!", "Failed to load '%s'!"), tmp);
2753 msg_format(_("'%s'を読み込みました。", "Loaded '%s'."), tmp);
2763 prt(_("コマンド: マクロをファイルに追加する", "Command: Append macros to a file"), 16, 0);
2766 prt(_("ファイル: ", "File: "), 18, 0);
2768 /* Default filename */
2769 sprintf(tmp, "%s.prf", player_base);
2771 /* Ask for a file */
2772 if (!askfor(tmp, 80)) continue;
2774 /* Dump the macros */
2775 (void)macro_dump(tmp);
2778 msg_print(_("マクロを追加しました。", "Appended macros."));
2787 prt(_("コマンド: マクロの確認", "Command: Query a macro"), 16, 0);
2791 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2793 /* Get a macro trigger */
2794 do_cmd_macro_aux(buf);
2796 /* Acquire action */
2797 k = macro_find_exact(buf);
2803 msg_print(_("そのキーにはマクロは定義されていません。", "Found no macro."));
2809 /* Obtain the action */
2810 strcpy(macro__buf, macro__act[k]);
2812 /* Analyze the current action */
2813 ascii_to_text(buf, macro__buf);
2815 /* Display the current action */
2819 msg_print(_("マクロを確認しました。", "Found a macro."));
2823 /* Create a macro */
2827 prt(_("コマンド: マクロの作成", "Command: Create a macro"), 16, 0);
2830 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2832 /* Get a macro trigger */
2833 do_cmd_macro_aux(buf);
2839 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2840 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2843 prt(_("マクロ行動: ", "Action: "), 20, 0);
2845 /* Convert to text */
2846 ascii_to_text(tmp, macro__buf);
2848 /* Get an encoded action */
2849 if (askfor(tmp, 80))
2851 /* Convert to ascii */
2852 text_to_ascii(macro__buf, tmp);
2854 /* Link the macro */
2855 macro_add(buf, macro__buf);
2858 msg_print(_("マクロを追加しました。", "Added a macro."));
2862 /* Remove a macro */
2866 prt(_("コマンド: マクロの削除", "Command: Remove a macro"), 16, 0);
2869 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
2871 /* Get a macro trigger */
2872 do_cmd_macro_aux(buf);
2874 /* Link the macro */
2875 macro_add(buf, buf);
2878 msg_print(_("マクロを削除しました。", "Removed a macro."));
2885 prt(_("コマンド: キー配置をファイルに追加する", "Command: Append keymaps to a file"), 16, 0);
2888 prt(_("ファイル: ", "File: "), 18, 0);
2890 /* Default filename */
2891 sprintf(tmp, "%s.prf", player_base);
2893 /* Ask for a file */
2894 if (!askfor(tmp, 80)) continue;
2896 /* Dump the macros */
2897 (void)keymap_dump(tmp);
2900 msg_print(_("キー配置を追加しました。", "Appended keymaps."));
2903 /* Query a keymap */
2909 prt(_("コマンド: キー配置の確認", "Command: Query a keymap"), 16, 0);
2912 prt(_("押すキー: ", "Keypress: "), 18, 0);
2914 /* Get a keymap trigger */
2915 do_cmd_macro_aux_keymap(buf);
2917 /* Look up the keymap */
2918 act = keymap_act[mode][(byte)(buf[0])];
2924 msg_print(_("キー配置は定義されていません。", "Found no keymap."));
2930 /* Obtain the action */
2931 strcpy(macro__buf, act);
2933 /* Analyze the current action */
2934 ascii_to_text(buf, macro__buf);
2936 /* Display the current action */
2940 msg_print(_("キー配置を確認しました。", "Found a keymap."));
2944 /* Create a keymap */
2948 prt(_("コマンド: キー配置の作成", "Command: Create a keymap"), 16, 0);
2951 prt(_("押すキー: ", "Keypress: "), 18, 0);
2953 /* Get a keymap trigger */
2954 do_cmd_macro_aux_keymap(buf);
2960 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
2961 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
2964 prt(_("行動: ", "Action: "), 20, 0);
2966 /* Convert to text */
2967 ascii_to_text(tmp, macro__buf);
2969 /* Get an encoded action */
2970 if (askfor(tmp, 80))
2972 /* Convert to ascii */
2973 text_to_ascii(macro__buf, tmp);
2975 /* Free old keymap */
2976 string_free(keymap_act[mode][(byte)(buf[0])]);
2978 /* Make new keymap */
2979 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
2982 msg_print(_("キー配置を追加しました。", "Added a keymap."));
2986 /* Remove a keymap */
2990 prt(_("コマンド: キー配置の削除", "Command: Remove a keymap"), 16, 0);
2993 prt(_("押すキー: ", "Keypress: "), 18, 0);
2995 /* Get a keymap trigger */
2996 do_cmd_macro_aux_keymap(buf);
2998 /* Free old keymap */
2999 string_free(keymap_act[mode][(byte)(buf[0])]);
3001 /* Make new keymap */
3002 keymap_act[mode][(byte)(buf[0])] = NULL;
3005 msg_print(_("キー配置を削除しました。", "Removed a keymap."));
3008 /* Enter a new action */
3012 prt(_("コマンド: マクロ行動の入力", "Command: Enter a new action"), 16, 0);
3018 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
3019 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
3022 prt(_("マクロ行動: ", "Action: "), 20, 0);
3024 /* Hack -- limit the value */
3027 /* Get an encoded action */
3028 if (!askfor(buf, 80)) continue;
3030 /* Extract an action */
3031 text_to_ascii(macro__buf, buf);
3034 #endif /* ALLOW_MACROS */
3043 /* Flush messages */
3052 * @brief キャラクタ色の明暗表現
3054 static cptr lighting_level_str[F_LIT_MAX] =
3069 * @brief キャラクタのビジュアルIDを変更する際の対象指定関数
3070 * @param i 指定対象となるキャラクタコード
3071 * @param num 指定されたビジュアルIDを返す参照ポインタ
3072 * @param max ビジュアルIDの最大数
3073 * @return 指定が実際に行われた場合TRUE、キャンセルされた場合FALSE
3075 static bool cmd_visuals_aux(int i, int *num, int max)
3082 sprintf(str, "%d", *num);
3084 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
3087 tmp = strtol(str, NULL, 0);
3088 if (tmp >= 0 && tmp < max)
3091 else if (isupper(i))
3092 *num = (*num + max - 1) % max;
3094 *num = (*num + 1) % max;
3100 * @brief キャラクタの変更メニュー表示
3101 * @param choice_msg 選択メッセージ
3104 static void print_visuals_menu(cptr choice_msg)
3106 prt(_("[ 画面表示の設定 ]", "Interact with Visuals"), 1, 0);
3108 /* Give some choices */
3109 prt(_("(0) ユーザー設定ファイルのロード", "(0) Load a user pref file"), 3, 5);
3111 #ifdef ALLOW_VISUALS
3112 prt(_("(1) モンスターの 色/文字 をファイルに書き出す", "(1) Dump monster attr/chars"), 4, 5);
3113 prt(_("(2) アイテムの 色/文字 をファイルに書き出す", "(2) Dump object attr/chars"), 5, 5);
3114 prt(_("(3) 地形の 色/文字 をファイルに書き出す", "(3) Dump feature attr/chars"), 6, 5);
3115 prt(_("(4) モンスターの 色/文字 を変更する (数値操作)", "(4) Change monster attr/chars (numeric operation)"), 7, 5);
3116 prt(_("(5) アイテムの 色/文字 を変更する (数値操作)", "(5) Change object attr/chars (numeric operation)"), 8, 5);
3117 prt(_("(6) 地形の 色/文字 を変更する (数値操作)", "(6) Change feature attr/chars (numeric operation)"), 9, 5);
3118 prt(_("(7) モンスターの 色/文字 を変更する (シンボルエディタ)", "(7) Change monster attr/chars (visual mode)"), 10, 5);
3119 prt(_("(8) アイテムの 色/文字 を変更する (シンボルエディタ)", "(8) Change object attr/chars (visual mode)"), 11, 5);
3120 prt(_("(9) 地形の 色/文字 を変更する (シンボルエディタ)", "(9) Change feature attr/chars (visual mode)"), 12, 5);
3121 #endif /* ALLOW_VISUALS */
3123 prt(_("(R) 画面表示方法の初期化", "(R) Reset visuals"), 13, 5);
3126 prt(format("コマンド: %s", choice_msg ? choice_msg : _("", "")), 15, 0);
3129 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx);
3130 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx);
3131 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level);
3134 * Interact with "visuals"
3136 void do_cmd_visuals(void)
3141 bool need_redraw = FALSE;
3142 const char *empty_symbol = "<< ? >>";
3144 if (use_bigtile) empty_symbol = "<< ?? >>";
3146 /* File type is "TEXT" */
3147 FILE_TYPE(FILE_TYPE_TEXT);
3149 /* Save the screen */
3152 /* Interact until done */
3158 /* Ask for a choice */
3159 print_visuals_menu(NULL);
3165 if (i == ESCAPE) break;
3169 /* Load a 'pref' file */
3172 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 15, 0);
3175 prt(_("ファイル: ", "File: "), 17, 0);
3177 /* Default filename */
3178 sprintf(tmp, "%s.prf", player_base);
3181 if (!askfor(tmp, 70)) continue;
3183 /* Process the given filename */
3184 (void)process_pref_file(tmp);
3189 #ifdef ALLOW_VISUALS
3191 /* Dump monster attr/chars */
3194 static cptr mark = "Monster attr/chars";
3197 prt(_("コマンド: モンスターの[色/文字]をファイルに書き出します", "Command: Dump monster attr/chars"), 15, 0);
3200 prt(_("ファイル: ", "File: "), 17, 0);
3202 /* Default filename */
3203 sprintf(tmp, "%s.prf", player_base);
3205 /* Get a filename */
3206 if (!askfor(tmp, 70)) continue;
3208 /* Build the filename */
3209 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3211 /* Append to the file */
3212 if (!open_auto_dump(buf, mark)) continue;
3215 auto_dump_printf(_("\n# モンスターの[色/文字]の設定\n\n", "\n# Monster attr/char definitions\n\n"));
3218 for (i = 0; i < max_r_idx; i++)
3220 monster_race *r_ptr = &r_info[i];
3222 /* Skip non-entries */
3223 if (!r_ptr->name) continue;
3225 /* Dump a comment */
3226 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
3228 /* Dump the monster attr/char info */
3229 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
3230 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
3237 msg_print(_("モンスターの[色/文字]をファイルに書き出しました。", "Dumped monster attr/chars."));
3242 /* Dump object attr/chars */
3245 static cptr mark = "Object attr/chars";
3248 prt(_("コマンド: アイテムの[色/文字]をファイルに書き出します", "Command: Dump object attr/chars"), 15, 0);
3251 prt(_("ファイル: ", "File: "), 17, 0);
3253 /* Default filename */
3254 sprintf(tmp, "%s.prf", player_base);
3256 /* Get a filename */
3257 if (!askfor(tmp, 70)) continue;
3259 /* Build the filename */
3260 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3262 /* Append to the file */
3263 if (!open_auto_dump(buf, mark)) continue;
3266 auto_dump_printf(_("\n# アイテムの[色/文字]の設定\n\n", "\n# Object attr/char definitions\n\n"));
3269 for (i = 0; i < max_k_idx; i++)
3272 object_kind *k_ptr = &k_info[i];
3274 /* Skip non-entries */
3275 if (!k_ptr->name) continue;
3280 strip_name(o_name, i);
3286 /* Prepare dummy object */
3287 object_prep(&forge, i);
3289 /* Get un-shuffled flavor name */
3290 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
3293 /* Dump a comment */
3294 auto_dump_printf("# %s\n", o_name);
3296 /* Dump the object attr/char info */
3297 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i,
3298 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
3305 msg_print(_("アイテムの[色/文字]をファイルに書き出しました。", "Dumped object attr/chars."));
3310 /* Dump feature attr/chars */
3313 static cptr mark = "Feature attr/chars";
3316 prt(_("コマンド: 地形の[色/文字]をファイルに書き出します", "Command: Dump feature attr/chars"), 15, 0);
3319 prt(_("ファイル: ", "File: "), 17, 0);
3321 /* Default filename */
3322 sprintf(tmp, "%s.prf", player_base);
3324 /* Get a filename */
3325 if (!askfor(tmp, 70)) continue;
3327 /* Build the filename */
3328 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3330 /* Append to the file */
3331 if (!open_auto_dump(buf, mark)) continue;
3334 auto_dump_printf(_("\n# 地形の[色/文字]の設定\n\n", "\n# Feature attr/char definitions\n\n"));
3337 for (i = 0; i < max_f_idx; i++)
3339 feature_type *f_ptr = &f_info[i];
3341 /* Skip non-entries */
3342 if (!f_ptr->name) continue;
3344 /* Skip mimiccing features */
3345 if (f_ptr->mimic != i) continue;
3347 /* Dump a comment */
3348 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
3350 /* Dump the feature attr/char info */
3351 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
3352 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
3353 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
3354 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
3361 msg_print(_("地形の[色/文字]をファイルに書き出しました。", "Dumped feature attr/chars."));
3366 /* Modify monster attr/chars (numeric operation) */
3369 static cptr choice_msg = _("モンスターの[色/文字]を変更します", "Change monster attr/chars");
3372 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3374 /* Hack -- query until done */
3377 monster_race *r_ptr = &r_info[r];
3381 byte da = r_ptr->d_attr;
3382 byte dc = r_ptr->d_char;
3383 byte ca = r_ptr->x_attr;
3384 byte cc = r_ptr->x_char;
3386 /* Label the object */
3387 Term_putstr(5, 17, -1, TERM_WHITE,
3388 format(_("モンスター = %d, 名前 = %-40.40s", "Monster = %d, Name = %-40.40s"), r, (r_name + r_ptr->name)));
3390 /* Label the Default values */
3391 Term_putstr(10, 19, -1, TERM_WHITE,
3392 format(_("初期値 色 / 文字 = %3u / %3u", "Default attr/char = %3u / %3u"), da, dc));
3394 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3395 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3397 /* Label the Current values */
3398 Term_putstr(10, 20, -1, TERM_WHITE,
3399 format(_("現在値 色 / 文字 = %3u / %3u", "Current attr/char = %3u / %3u"), ca, cc));
3401 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3402 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3405 Term_putstr(0, 22, -1, TERM_WHITE,
3406 _("コマンド (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): "));
3412 if (i == ESCAPE) break;
3414 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3415 else if (isupper(i)) c = 'a' + i - 'A';
3425 if (!cmd_visuals_aux(i, &r, max_r_idx))
3431 while (!r_info[r].name);
3435 t = (int)r_ptr->x_attr;
3436 (void)cmd_visuals_aux(i, &t, 256);
3437 r_ptr->x_attr = (byte)t;
3441 t = (int)r_ptr->x_char;
3442 (void)cmd_visuals_aux(i, &t, 256);
3443 r_ptr->x_char = (byte)t;
3447 do_cmd_knowledge_monsters(&need_redraw, TRUE, r);
3451 print_visuals_menu(choice_msg);
3459 /* Modify object attr/chars (numeric operation) */
3462 static cptr choice_msg = _("アイテムの[色/文字]を変更します", "Change object attr/chars");
3464 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3466 /* Hack -- query until done */
3469 object_kind *k_ptr = &k_info[k];
3473 byte da = k_ptr->d_attr;
3474 byte dc = k_ptr->d_char;
3475 byte ca = k_ptr->x_attr;
3476 byte cc = k_ptr->x_char;
3478 /* Label the object */
3479 Term_putstr(5, 17, -1, TERM_WHITE,
3480 format(_("アイテム = %d, 名前 = %-40.40s", "Object = %d, Name = %-40.40s"),
3481 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
3483 /* Label the Default values */
3484 Term_putstr(10, 19, -1, TERM_WHITE,
3485 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3487 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3488 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3490 /* Label the Current values */
3491 Term_putstr(10, 20, -1, TERM_WHITE,
3492 format(_("現在値 色 / 文字 = %3d / %3d", "Current attr/char = %3d / %3d"), ca, cc));
3494 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3495 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3498 Term_putstr(0, 22, -1, TERM_WHITE,
3499 _("コマンド (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): "));
3505 if (i == ESCAPE) break;
3507 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3508 else if (isupper(i)) c = 'a' + i - 'A';
3518 if (!cmd_visuals_aux(i, &k, max_k_idx))
3524 while (!k_info[k].name);
3528 t = (int)k_ptr->x_attr;
3529 (void)cmd_visuals_aux(i, &t, 256);
3530 k_ptr->x_attr = (byte)t;
3534 t = (int)k_ptr->x_char;
3535 (void)cmd_visuals_aux(i, &t, 256);
3536 k_ptr->x_char = (byte)t;
3540 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
3544 print_visuals_menu(choice_msg);
3552 /* Modify feature attr/chars (numeric operation) */
3555 static cptr choice_msg = _("地形の[色/文字]を変更します", "Change feature attr/chars");
3557 static int lighting_level = F_LIT_STANDARD;
3558 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
3560 /* Hack -- query until done */
3563 feature_type *f_ptr = &f_info[f];
3567 byte da = f_ptr->d_attr[lighting_level];
3568 byte dc = f_ptr->d_char[lighting_level];
3569 byte ca = f_ptr->x_attr[lighting_level];
3570 byte cc = f_ptr->x_char[lighting_level];
3572 /* Label the object */
3574 Term_putstr(5, 17, -1, TERM_WHITE,
3575 format(_("地形 = %d, 名前 = %s, 明度 = %s", "Terrain = %d, Name = %s, Lighting = %s"),
3576 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
3578 /* Label the Default values */
3579 Term_putstr(10, 19, -1, TERM_WHITE,
3580 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
3582 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
3583 Term_queue_bigchar(43, 19, da, dc, 0, 0);
3585 /* Label the Current values */
3587 Term_putstr(10, 20, -1, TERM_WHITE,
3588 format("現在値 色 / 文字 = %3d / %3d", ca, cc));
3590 Term_putstr(10, 20, -1, TERM_WHITE,
3591 format("Current attr/char = %3d / %3d", ca, cc));
3594 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
3595 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
3599 Term_putstr(0, 22, -1, TERM_WHITE,
3600 "コマンド (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3602 Term_putstr(0, 22, -1, TERM_WHITE,
3603 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
3610 if (i == ESCAPE) break;
3612 if (iscntrl(i)) c = 'a' + i - KTRL('A');
3613 else if (isupper(i)) c = 'a' + i - 'A';
3623 if (!cmd_visuals_aux(i, &f, max_f_idx))
3629 while (!f_info[f].name || (f_info[f].mimic != f));
3633 t = (int)f_ptr->x_attr[lighting_level];
3634 (void)cmd_visuals_aux(i, &t, 256);
3635 f_ptr->x_attr[lighting_level] = (byte)t;
3639 t = (int)f_ptr->x_char[lighting_level];
3640 (void)cmd_visuals_aux(i, &t, 256);
3641 f_ptr->x_char[lighting_level] = (byte)t;
3645 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
3648 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
3652 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
3656 print_visuals_menu(choice_msg);
3664 /* Modify monster attr/chars (visual mode) */
3666 do_cmd_knowledge_monsters(&need_redraw, TRUE, -1);
3669 /* Modify object attr/chars (visual mode) */
3671 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
3674 /* Modify feature attr/chars (visual mode) */
3677 int lighting_level = F_LIT_STANDARD;
3678 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
3682 #endif /* ALLOW_VISUALS */
3691 msg_print(_("画面上の[色/文字]を初期値にリセットしました。", "Visual attr/char tables reset."));
3695 /* Unknown option */
3701 /* Flush messages */
3705 /* Restore the screen */
3708 if (need_redraw) do_cmd_redraw();
3713 * Interact with "colors"
3715 void do_cmd_colors(void)
3724 /* File type is "TEXT" */
3725 FILE_TYPE(FILE_TYPE_TEXT);
3728 /* Save the screen */
3732 /* Interact until done */
3738 /* Ask for a choice */
3739 prt(_("[ カラーの設定 ]", "Interact with Colors"), 2, 0);
3741 /* Give some choices */
3742 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
3745 prt(_("(2) カラーの設定をファイルに書き出す", "(2) Dump colors"), 5, 5);
3746 prt(_("(3) カラーの設定を変更する", "(3) Modify colors"), 6, 5);
3750 prt(_("コマンド: ", "Command: "), 8, 0);
3755 if (i == ESCAPE) break;
3757 /* Load a 'pref' file */
3761 prt(_("コマンド: ユーザー設定ファイルをロードします", "Command: Load a user pref file"), 8, 0);
3764 prt(_("ファイル: ", "File: "), 10, 0);
3767 sprintf(tmp, "%s.prf", player_base);
3770 if (!askfor(tmp, 70)) continue;
3772 /* Process the given filename */
3773 (void)process_pref_file(tmp);
3775 /* Mega-Hack -- react to changes */
3776 Term_xtra(TERM_XTRA_REACT, 0);
3778 /* Mega-Hack -- redraw */
3787 static cptr mark = "Colors";
3790 prt(_("コマンド: カラーの設定をファイルに書き出します", "Command: Dump colors"), 8, 0);
3793 prt(_("ファイル: ", "File: "), 10, 0);
3795 /* Default filename */
3796 sprintf(tmp, "%s.prf", player_base);
3798 /* Get a filename */
3799 if (!askfor(tmp, 70)) continue;
3801 /* Build the filename */
3802 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
3804 /* Append to the file */
3805 if (!open_auto_dump(buf, mark)) continue;
3808 auto_dump_printf(_("\n# カラーの設定\n\n", "\n# Color redefinitions\n\n"));
3811 for (i = 0; i < 256; i++)
3813 int kv = angband_color_table[i][0];
3814 int rv = angband_color_table[i][1];
3815 int gv = angband_color_table[i][2];
3816 int bv = angband_color_table[i][3];
3818 cptr name = _("未知", "unknown");
3820 /* Skip non-entries */
3821 if (!kv && !rv && !gv && !bv) continue;
3823 /* Extract the color name */
3824 if (i < 16) name = color_names[i];
3826 /* Dump a comment */
3827 auto_dump_printf(_("# カラー '%s'\n", "# Color '%s'\n"), name);
3829 /* Dump the monster attr/char info */
3830 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
3838 msg_print(_("カラーの設定をファイルに書き出しました。", "Dumped color redefinitions."));
3847 prt(_("コマンド: カラーの設定を変更します", "Command: Modify colors"), 8, 0);
3849 /* Hack -- query until done */
3858 /* Exhibit the normal colors */
3859 for (j = 0; j < 16; j++)
3861 /* Exhibit this color */
3862 Term_putstr(j*4, 20, -1, a, "###");
3864 /* Exhibit all colors */
3865 Term_putstr(j*4, 22, -1, j, format("%3d", j));
3868 /* Describe the color */
3869 name = ((a < 16) ? color_names[a] : _("未定義", "undefined"));
3871 /* Describe the color */
3872 Term_putstr(5, 10, -1, TERM_WHITE,
3873 format(_("カラー = %d, 名前 = %s", "Color = %d, Name = %s"), a, name));
3875 /* Label the Current values */
3876 Term_putstr(5, 12, -1, TERM_WHITE,
3877 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
3878 angband_color_table[a][0],
3879 angband_color_table[a][1],
3880 angband_color_table[a][2],
3881 angband_color_table[a][3]));
3884 Term_putstr(0, 14, -1, TERM_WHITE,
3885 _("コマンド (n/N/k/K/r/R/g/G/b/B): ", "Command (n/N/k/K/r/R/g/G/b/B): "));
3892 if (i == ESCAPE) break;
3895 if (i == 'n') a = (byte)(a + 1);
3896 if (i == 'N') a = (byte)(a - 1);
3897 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
3898 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
3899 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
3900 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
3901 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
3902 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
3903 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
3904 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
3906 /* Hack -- react to changes */
3907 Term_xtra(TERM_XTRA_REACT, 0);
3909 /* Hack -- redraw */
3916 /* Unknown option */
3922 /* Flush messages */
3927 /* Restore the screen */
3933 * Note something in the message recall
3935 void do_cmd_note(void)
3943 if (!get_string(_("メモ: ", "Note: "), buf, 60)) return;
3945 /* Ignore empty notes */
3946 if (!buf[0] || (buf[0] == ' ')) return;
3948 /* Add the note to the message recall */
3949 msg_format(_("メモ: %s", "Note: %s"), buf);
3954 * Mention the current version
3956 void do_cmd_version(void)
3959 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d", "You are playing Hengband %d.%d.%d."),
3960 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH);
3966 * Array of feeling strings
3968 static cptr do_cmd_feeling_text[11] =
3970 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3971 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3972 _("恐ろしい死の幻が目に浮かび、気絶しそうになった!", "You nearly faint as horrible visions of death fill your mind!"),
3973 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3974 _("とても悪い予感がする...", "You have a very bad feeling..."),
3975 _("悪い予感がする...", "You have a bad feeling..."),
3976 _("何か緊張する。", "You feel nervous."),
3977 _("少し不運な気がする...", "You feel your luck is turning..."),
3978 _("この場所は好きになれない。", "You don't like the look of this place."),
3979 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3980 _("なんて退屈なところだ...", "What a boring place...")
3983 static cptr do_cmd_feeling_text_combat[11] =
3985 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
3986 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
3987 _("今夜もまた、誰かが命を落とす...", "You nearly faint as horrible visions of death fill your mind!"),
3988 _("この階はとても危険なようだ。", "This level looks very dangerous."),
3989 _("とても悪い予感がする...", "You have a very bad feeling..."),
3990 _("悪い予感がする...", "You have a bad feeling..."),
3991 _("何か緊張する。", "You feel nervous."),
3992 _("少し不運な気がする...", "You feel your luck is turning..."),
3993 _("この場所は好きになれない。", "You don't like the look of this place."),
3994 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
3995 _("なんて退屈なところだ...", "What a boring place...")
3998 static cptr do_cmd_feeling_text_lucky[11] =
4000 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
4001 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
4002 _("この階はこの上なく素晴らしい感じがする。", "You have a superb feeling about this level."),
4003 _("素晴らしい感じがする...", "You have an excellent feeling..."),
4004 _("とても良い感じがする...", "You have a very good feeling..."),
4005 _("良い感じがする...", "You have a good feeling..."),
4006 _("ちょっと幸運な感じがする...", "You feel strangely lucky..."),
4007 _("多少は運が向いてきたか...", "You feel your luck is turning..."),
4008 _("見た感じ悪くはない...", "You like the look of this place..."),
4009 _("全然駄目ということはないが...", "This level can't be all bad..."),
4010 _("なんて退屈なところだ...", "What a boring place...")
4015 * Note that "feeling" is set to zero unless some time has passed.
4016 * Note that this is done when the level is GENERATED, not entered.
4018 void do_cmd_feeling(void)
4020 /* No useful feeling in quests */
4021 if (p_ptr->inside_quest && !random_quest_number(dun_level))
4023 msg_print(_("典型的なクエストのダンジョンのようだ。", "Looks like a typical quest level."));
4027 /* No useful feeling in town */
4028 else if (p_ptr->town_num && !dun_level)
4030 if (!strcmp(town[p_ptr->town_num].name, _("荒野", "wilderness")))
4032 msg_print(_("何かありそうな荒野のようだ。", "Looks like a strange wilderness."));
4037 msg_print(_("典型的な町のようだ。", "Looks like a typical town."));
4042 /* No useful feeling in the wilderness */
4043 else if (!dun_level)
4045 msg_print(_("典型的な荒野のようだ。", "Looks like a typical wilderness."));
4049 /* Display the feeling */
4050 if (p_ptr->muta3 & MUT3_GOOD_LUCK)
4051 msg_print(do_cmd_feeling_text_lucky[p_ptr->feeling]);
4052 else if (p_ptr->pseikaku == SEIKAKU_COMBAT ||
4053 inventory[INVEN_BOW].name1 == ART_CRIMSON)
4054 msg_print(do_cmd_feeling_text_combat[p_ptr->feeling]);
4056 msg_print(do_cmd_feeling_text[p_ptr->feeling]);
4062 * Description of each monster group.
4064 static cptr monster_group_text[] =
4067 "ユニーク", /* "Uniques" */
4068 "乗馬可能なモンスター", /* "Riding" */
4069 "賞金首", /* "Wanted */
4070 "アンバーの王族", /* "Ambertite" */
4099 /* "古代ドラゴン/ワイアーム", */
4160 /* "Ancient Dragon/Wyrm", */
4169 "Multi-Headed Reptile",
4174 "Reptile/Amphibian",
4175 "Spider/Scorpion/Tick",
4177 /* "Major Demon", */
4194 * Symbols of monsters in each group. Note the "Uniques" group
4195 * is handled differently.
4197 static cptr monster_group_char[] =
4254 "!$&()+./=>?[\\]`{|~",
4264 * hook function to sort monsters by level
4266 static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b)
4268 u16b *who = (u16b*)(u);
4273 monster_race *r_ptr1 = &r_info[w1];
4274 monster_race *r_ptr2 = &r_info[w2];
4279 if (r_ptr2->level > r_ptr1->level) return TRUE;
4280 if (r_ptr1->level > r_ptr2->level) return FALSE;
4282 if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return TRUE;
4283 if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return FALSE;
4288 * Build a list of monster indexes in the given group. Return the number
4289 * of monsters in the group.
4291 * mode & 0x01 : check for non-empty group
4292 * mode & 0x02 : visual operation only
4294 static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode)
4299 /* Get a list of x_char in this group */
4300 cptr group_char = monster_group_char[grp_cur];
4302 /* XXX Hack -- Check if this is the "Uniques" group */
4303 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
4305 /* XXX Hack -- Check if this is the "Riding" group */
4306 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
4308 /* XXX Hack -- Check if this is the "Wanted" group */
4309 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
4311 /* XXX Hack -- Check if this is the "Amberite" group */
4312 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
4315 /* Check every race */
4316 for (i = 0; i < max_r_idx; i++)
4318 /* Access the race */
4319 monster_race *r_ptr = &r_info[i];
4321 /* Skip empty race */
4322 if (!r_ptr->name) continue ;
4324 /* Require known monsters */
4325 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
4329 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
4332 else if (grp_riding)
4334 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
4337 else if (grp_wanted)
4339 bool wanted = FALSE;
4341 for (j = 0; j < MAX_KUBI; j++)
4343 if (kubi_r_idx[j] == i || kubi_r_idx[j] - 10000 == i ||
4344 (p_ptr->today_mon && p_ptr->today_mon == i))
4350 if (!wanted) continue;
4353 else if (grp_amberite)
4355 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
4360 /* Check for race in the group */
4361 if (!my_strchr(group_char, r_ptr->d_char)) continue;
4365 mon_idx[mon_cnt++] = i;
4367 /* XXX Hack -- Just checking for non-empty group */
4368 if (mode & 0x01) break;
4371 /* Terminate the list */
4372 mon_idx[mon_cnt] = -1;
4374 /* Select the sort method */
4375 ang_sort_comp = ang_sort_comp_monster_level;
4376 ang_sort_swap = ang_sort_swap_hook;
4378 /* Sort by monster level */
4379 ang_sort(mon_idx, &dummy_why, mon_cnt);
4381 /* Return the number of races */
4387 * Description of each monster group.
4389 static cptr object_group_text[] =
4392 "キノコ", /* "Mushrooms" */
4393 "薬", /* "Potions" */
4394 "油つぼ", /* "Flasks" */
4395 "巻物", /* "Scrolls" */
4397 "アミュレット", /* "Amulets" */
4398 "笛", /* "Whistle" */
4399 "光源", /* "Lanterns" */
4400 "魔法棒", /* "Wands" */
4403 "カード", /* "Cards" */
4414 "刀剣類", /* "Swords" */
4415 "鈍器", /* "Blunt Weapons" */
4416 "長柄武器", /* "Polearms" */
4417 "採掘道具", /* "Diggers" */
4418 "飛び道具", /* "Bows" */
4422 "軽装鎧", /* "Soft Armor" */
4423 "重装鎧", /* "Hard Armor" */
4424 "ドラゴン鎧", /* "Dragon Armor" */
4425 "盾", /* "Shields" */
4426 "クローク", /* "Cloaks" */
4427 "籠手", /* "Gloves" */
4428 "ヘルメット", /* "Helms" */
4430 "ブーツ", /* "Boots" */
4483 * TVALs of items in each group
4485 static byte object_group_tval[] =
4526 TV_LIFE_BOOK, /* Hack -- all spellbooks */
4534 * Build a list of object indexes in the given group. Return the number
4535 * of objects in the group.
4537 * mode & 0x01 : check for non-empty group
4538 * mode & 0x02 : visual operation only
4540 static int collect_objects(int grp_cur, int object_idx[], byte mode)
4542 int i, j, k, object_cnt = 0;
4544 /* Get a list of x_char in this group */
4545 byte group_tval = object_group_tval[grp_cur];
4547 /* Check every object */
4548 for (i = 0; i < max_k_idx; i++)
4550 /* Access the object */
4551 object_kind *k_ptr = &k_info[i];
4553 /* Skip empty objects */
4554 if (!k_ptr->name) continue;
4558 /* Any objects will be displayed */
4564 /* Skip non-flavoured objects */
4565 if (!k_ptr->flavor) continue;
4567 /* Require objects ever seen */
4568 if (!k_ptr->aware) continue;
4571 /* Skip items with no distribution (special artifacts) */
4572 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
4576 /* Check for objects in the group */
4577 if (TV_LIFE_BOOK == group_tval)
4579 /* Hack -- All spell books */
4580 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HEX_BOOK)
4582 /* Add the object */
4583 object_idx[object_cnt++] = i;
4587 else if (k_ptr->tval == group_tval)
4589 /* Add the object */
4590 object_idx[object_cnt++] = i;
4594 /* XXX Hack -- Just checking for non-empty group */
4595 if (mode & 0x01) break;
4598 /* Terminate the list */
4599 object_idx[object_cnt] = -1;
4601 /* Return the number of objects */
4607 * Description of each feature group.
4609 static cptr feature_group_text[] =
4617 * Build a list of feature indexes in the given group. Return the number
4618 * of features in the group.
4620 * mode & 0x01 : check for non-empty group
4622 static int collect_features(int grp_cur, int *feat_idx, byte mode)
4624 int i, feat_cnt = 0;
4626 /* Unused; There is a single group. */
4629 /* Check every feature */
4630 for (i = 0; i < max_f_idx; i++)
4632 /* Access the index */
4633 feature_type *f_ptr = &f_info[i];
4635 /* Skip empty index */
4636 if (!f_ptr->name) continue;
4638 /* Skip mimiccing features */
4639 if (f_ptr->mimic != i) continue;
4642 feat_idx[feat_cnt++] = i;
4644 /* XXX Hack -- Just checking for non-empty group */
4645 if (mode & 0x01) break;
4648 /* Terminate the list */
4649 feat_idx[feat_cnt] = -1;
4651 /* Return the number of races */
4658 * Build a list of monster indexes in the given group. Return the number
4659 * of monsters in the group.
4661 static int collect_artifacts(int grp_cur, int object_idx[])
4663 int i, object_cnt = 0;
4665 /* Get a list of x_char in this group */
4666 byte group_tval = object_group_tval[grp_cur];
4668 /* Check every object */
4669 for (i = 0; i < max_a_idx; i++)
4671 /* Access the artifact */
4672 artifact_type *a_ptr = &a_info[i];
4674 /* Skip empty artifacts */
4675 if (!a_ptr->name) continue;
4677 /* Skip "uncreated" artifacts */
4678 if (!a_ptr->cur_num) continue;
4680 /* Check for race in the group */
4681 if (a_ptr->tval == group_tval)
4684 object_idx[object_cnt++] = i;
4688 /* Terminate the list */
4689 object_idx[object_cnt] = 0;
4691 /* Return the number of races */
4698 * Encode the screen colors
4700 static char hack[17] = "dwsorgbuDWvyRGBU";
4704 * Hack -- load a screen dump from a file
4706 void do_cmd_load_screen(void)
4721 Term_get_size(&wid, &hgt);
4723 /* Build the filename */
4724 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
4726 /* Append to the file */
4727 fff = my_fopen(buf, "r");
4731 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
4737 /* Save the screen */
4740 /* Clear the screen */
4744 /* Load the screen */
4745 for (y = 0; okay; y++)
4747 /* Get a line of data including control code */
4748 if (!fgets(buf, 1024, fff)) okay = FALSE;
4750 /* Get the blank line */
4751 if (buf[0] == '\n' || buf[0] == '\0') break;
4753 /* Ignore too large screen image */
4754 if (y >= hgt) continue;
4757 for (x = 0; x < wid - 1; x++)
4760 if (buf[x] == '\n' || buf[x] == '\0') break;
4762 /* Put the attr/char */
4763 Term_draw(x, y, TERM_WHITE, buf[x]);
4767 /* Dump the screen */
4768 for (y = 0; okay; y++)
4770 /* Get a line of data including control code */
4771 if (!fgets(buf, 1024, fff)) okay = FALSE;
4773 /* Get the blank line */
4774 if (buf[0] == '\n' || buf[0] == '\0') break;
4776 /* Ignore too large screen image */
4777 if (y >= hgt) continue;
4780 for (x = 0; x < wid - 1; x++)
4783 if (buf[x] == '\n' || buf[x] == '\0') break;
4785 /* Get the attr/char */
4786 (void)(Term_what(x, y, &a, &c));
4788 /* Look up the attr */
4789 for (i = 0; i < 16; i++)
4791 /* Use attr matches */
4792 if (hack[i] == buf[x]) a = i;
4795 /* Put the attr/char */
4796 Term_draw(x, y, a, c);
4806 prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
4812 /* Restore the screen */
4819 cptr inven_res_label = _(" 酸電火冷毒光闇破轟獄因沌劣 盲怖乱痺透命感消復浮",
4820 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv");
4823 #define IM_FLAG_STR _("*", "* ")
4824 #define HAS_FLAG_STR _("+", "+ ")
4825 #define NO_FLAG_STR _("・", ". ")
4827 #define print_im_or_res_flag(IM, RES) \
4829 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
4830 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
4833 #define print_flag(TR) \
4835 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
4839 /* XTRA HACK RESLIST */
4840 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where)
4842 char o_name[MAX_NLEN];
4843 u32b flgs[TR_FLAG_SIZE];
4845 if (!o_ptr->k_idx) return;
4846 if (o_ptr->tval != tval) return;
4848 /* Identified items only */
4849 if (!object_is_known(o_ptr)) return;
4852 * HACK:Ring of Lordly protection and Dragon equipment
4853 * have random resistances.
4855 if ((object_is_wearable(o_ptr) && object_is_ego(o_ptr))
4856 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
4857 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
4858 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
4859 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
4860 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
4861 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
4862 || object_is_artifact(o_ptr))
4865 object_desc(o_name, o_ptr, OD_NAME_ONLY);
4867 while (o_name[i] && (i < 26))
4870 if (iskanji(o_name[i])) i++;
4879 o_name[i] = ' '; i++;
4884 fprintf(fff, "%s %s", where, o_name);
4886 if (!(o_ptr->ident & (IDENT_MENTAL)))
4888 fputs(_("-------不明--------------- -------不明---------\n",
4889 "-------unknown------------ -------unknown------\n"), fff);
4893 object_flags_known(o_ptr, flgs);
4895 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
4896 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
4897 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
4898 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
4899 print_flag(TR_RES_POIS);
4900 print_flag(TR_RES_LITE);
4901 print_flag(TR_RES_DARK);
4902 print_flag(TR_RES_SHARDS);
4903 print_flag(TR_RES_SOUND);
4904 print_flag(TR_RES_NETHER);
4905 print_flag(TR_RES_NEXUS);
4906 print_flag(TR_RES_CHAOS);
4907 print_flag(TR_RES_DISEN);
4911 print_flag(TR_RES_BLIND);
4912 print_flag(TR_RES_FEAR);
4913 print_flag(TR_RES_CONF);
4914 print_flag(TR_FREE_ACT);
4915 print_flag(TR_SEE_INVIS);
4916 print_flag(TR_HOLD_EXP);
4917 print_flag(TR_TELEPATHY);
4918 print_flag(TR_SLOW_DIGEST);
4919 print_flag(TR_REGEN);
4920 print_flag(TR_LEVITATION);
4928 fprintf(fff, "%s\n", inven_res_label);
4934 * Display *ID* ed weapons/armors's resistances
4936 static void do_cmd_knowledge_inven(void)
4940 char file_name[1024];
4950 /* Open a new file */
4951 fff = my_fopen_temp(file_name, 1024);
4954 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4958 fprintf(fff, "%s\n", inven_res_label);
4960 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
4964 for (; j < 9; j++) fputc('\n', fff);
4966 fprintf(fff, "%s\n", inven_res_label);
4968 strcpy(where, _("装", "E "));
4969 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4971 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4973 strcpy(where, _("持", "I "));
4974 for (i = 0; i < INVEN_PACK; i++)
4976 do_cmd_knowledge_inven_aux(fff, &inventory[i], &j, tval, where);
4979 st_ptr = &town[1].store[STORE_HOME];
4980 strcpy(where, _("家", "H "));
4981 for (i = 0; i < st_ptr->stock_num; i++)
4983 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
4987 /* Close the file */
4990 /* Display the file contents */
4991 show_file(TRUE, file_name, _("*鑑定*済み武器/防具の耐性リスト", "Resistances of *identified* equipment"), 0, 0);
4993 /* Remove the file */
4998 void do_cmd_save_screen_html_aux(char *filename, int message)
5002 byte a = 0, old_a = 0;
5016 cptr html_head[] = {
5017 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
5021 cptr html_foot[] = {
5023 "</body>\n</html>\n",
5029 Term_get_size(&wid, &hgt);
5031 /* File type is "TEXT" */
5032 FILE_TYPE(FILE_TYPE_TEXT);
5034 /* Append to the file */
5035 fff = my_fopen(filename, "w");
5040 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename);
5047 /* Save the screen */
5051 /* Build the filename */
5052 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
5053 tmpfff = my_fopen(buf, "r");
5055 for (i = 0; html_head[i]; i++)
5056 fputs(html_head[i], fff);
5060 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5062 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
5066 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
5068 fprintf(fff, "%s\n", buf);
5073 /* Dump the screen */
5074 for (y = 0; y < hgt; y++)
5081 for (x = 0; x < wid - 1; x++)
5085 /* Get the attr/char */
5086 (void)(Term_what(x, y, &a, &c));
5090 case '&': cc = "&"; break;
5091 case '<': cc = "<"; break;
5092 case '>': cc = ">"; break;
5094 case 0x1f: c = '.'; break;
5095 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
5100 if ((y == 0 && x == 0) || a != old_a) {
5101 rv = angband_color_table[a][1];
5102 gv = angband_color_table[a][2];
5103 bv = angband_color_table[a][3];
5104 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
5105 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
5109 fprintf(fff, "%s", cc);
5111 fprintf(fff, "%c", c);
5114 fprintf(fff, "</font>");
5117 for (i = 0; html_foot[i]; i++)
5118 fputs(html_foot[i], fff);
5123 while (!my_fgets(tmpfff, buf, sizeof(buf))) {
5125 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
5129 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
5131 fprintf(fff, "%s\n", buf);
5145 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5149 /* Restore the screen */
5155 * Hack -- save a screen dump to a file
5157 static void do_cmd_save_screen_html(void)
5159 char buf[1024], tmp[256] = "screen.html";
5161 if (!get_string(_("ファイル名: ", "File name: "), tmp, 80))
5164 /* Build the filename */
5165 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
5169 do_cmd_save_screen_html_aux(buf, 1);
5174 * Redefinable "save_screen" action
5176 void (*screendump_aux)(void) = NULL;
5180 * Hack -- save a screen dump to a file
5182 void do_cmd_save_screen(void)
5184 bool old_use_graphics = use_graphics;
5185 bool html_dump = FALSE;
5189 prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
5193 if (c == 'Y' || c == 'y')
5195 else if (c == 'H' || c == 'h')
5207 Term_get_size(&wid, &hgt);
5209 if (old_use_graphics)
5211 use_graphics = FALSE;
5214 /* Redraw everything */
5215 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5217 /* Hack -- update */
5223 do_cmd_save_screen_html();
5227 /* Do we use a special screendump function ? */
5228 else if (screendump_aux)
5230 /* Dump the screen to a graphics file */
5231 (*screendump_aux)();
5233 else /* Dump the screen as text */
5244 /* Build the filename */
5245 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
5247 /* File type is "TEXT" */
5248 FILE_TYPE(FILE_TYPE_TEXT);
5250 /* Append to the file */
5251 fff = my_fopen(buf, "w");
5256 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
5262 /* Save the screen */
5266 /* Dump the screen */
5267 for (y = 0; y < hgt; y++)
5270 for (x = 0; x < wid - 1; x++)
5272 /* Get the attr/char */
5273 (void)(Term_what(x, y, &a, &c));
5283 fprintf(fff, "%s\n", buf);
5290 /* Dump the screen */
5291 for (y = 0; y < hgt; y++)
5294 for (x = 0; x < wid - 1; x++)
5296 /* Get the attr/char */
5297 (void)(Term_what(x, y, &a, &c));
5300 buf[x] = hack[a&0x0F];
5307 fprintf(fff, "%s\n", buf);
5318 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
5321 /* Restore the screen */
5325 if (old_use_graphics)
5327 use_graphics = TRUE;
5330 /* Redraw everything */
5331 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
5333 /* Hack -- update */
5340 * Sorting hook -- Comp function -- see below
5342 * We use "u" to point to array of monster indexes,
5343 * and "v" to select the type of sorting to perform on "u".
5345 static bool ang_sort_art_comp(vptr u, vptr v, int a, int b)
5347 u16b *who = (u16b*)(u);
5349 u16b *why = (u16b*)(v);
5356 /* Sort by total kills */
5359 /* Extract total kills */
5360 z1 = a_info[w1].tval;
5361 z2 = a_info[w2].tval;
5363 /* Compare total kills */
5364 if (z1 < z2) return (TRUE);
5365 if (z1 > z2) return (FALSE);
5369 /* Sort by monster level */
5372 /* Extract levels */
5373 z1 = a_info[w1].sval;
5374 z2 = a_info[w2].sval;
5376 /* Compare levels */
5377 if (z1 < z2) return (TRUE);
5378 if (z1 > z2) return (FALSE);
5382 /* Sort by monster experience */
5385 /* Extract experience */
5386 z1 = a_info[w1].level;
5387 z2 = a_info[w2].level;
5389 /* Compare experience */
5390 if (z1 < z2) return (TRUE);
5391 if (z1 > z2) return (FALSE);
5395 /* Compare indexes */
5401 * Sorting hook -- Swap function -- see below
5403 * We use "u" to point to array of monster indexes,
5404 * and "v" to select the type of sorting to perform.
5406 static void ang_sort_art_swap(vptr u, vptr v, int a, int b)
5408 u16b *who = (u16b*)(u);
5423 * Check the status of "artifacts"
5425 static void do_cmd_knowledge_artifacts(void)
5427 int i, k, z, x, y, n = 0;
5433 char file_name[1024];
5435 char base_name[MAX_NLEN];
5439 /* Open a new file */
5440 fff = my_fopen_temp(file_name, 1024);
5443 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5448 /* Allocate the "who" array */
5449 C_MAKE(who, max_a_idx, s16b);
5451 /* Allocate the "okay" array */
5452 C_MAKE(okay, max_a_idx, bool);
5454 /* Scan the artifacts */
5455 for (k = 0; k < max_a_idx; k++)
5457 artifact_type *a_ptr = &a_info[k];
5462 /* Skip "empty" artifacts */
5463 if (!a_ptr->name) continue;
5465 /* Skip "uncreated" artifacts */
5466 if (!a_ptr->cur_num) continue;
5472 /* Check the dungeon */
5473 for (y = 0; y < cur_hgt; y++)
5475 for (x = 0; x < cur_wid; x++)
5477 cave_type *c_ptr = &cave[y][x];
5479 s16b this_o_idx, next_o_idx = 0;
5481 /* Scan all objects in the grid */
5482 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
5486 /* Acquire object */
5487 o_ptr = &o_list[this_o_idx];
5489 /* Acquire next object */
5490 next_o_idx = o_ptr->next_o_idx;
5492 /* Ignore non-artifacts */
5493 if (!object_is_fixed_artifact(o_ptr)) continue;
5495 /* Ignore known items */
5496 if (object_is_known(o_ptr)) continue;
5498 /* Note the artifact */
5499 okay[o_ptr->name1] = FALSE;
5504 /* Check the inventory and equipment */
5505 for (i = 0; i < INVEN_TOTAL; i++)
5507 object_type *o_ptr = &inventory[i];
5509 /* Ignore non-objects */
5510 if (!o_ptr->k_idx) continue;
5512 /* Ignore non-artifacts */
5513 if (!object_is_fixed_artifact(o_ptr)) continue;
5515 /* Ignore known items */
5516 if (object_is_known(o_ptr)) continue;
5518 /* Note the artifact */
5519 okay[o_ptr->name1] = FALSE;
5522 for (k = 0; k < max_a_idx; k++)
5524 if (okay[k]) who[n++] = k;
5527 /* Select the sort method */
5528 ang_sort_comp = ang_sort_art_comp;
5529 ang_sort_swap = ang_sort_art_swap;
5531 /* Sort the array by dungeon depth of monsters */
5532 ang_sort(who, &why, n);
5534 /* Scan the artifacts */
5535 for (k = 0; k < n; k++)
5537 artifact_type *a_ptr = &a_info[who[k]];
5540 strcpy(base_name, _("未知の伝説のアイテム", "Unknown Artifact"));
5542 /* Obtain the base object type */
5543 z = lookup_kind(a_ptr->tval, a_ptr->sval);
5551 /* Get local object */
5554 /* Create fake object */
5555 object_prep(q_ptr, z);
5557 /* Make it an artifact */
5558 q_ptr->name1 = (byte)who[k];
5560 /* Display as if known */
5561 q_ptr->ident |= IDENT_STORE;
5563 /* Describe the artifact */
5564 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5567 /* Hack -- Build the artifact name */
5568 fprintf(fff, _(" %s\n", " The %s\n"), base_name);
5571 /* Free the "who" array */
5572 C_KILL(who, max_a_idx, s16b);
5574 /* Free the "okay" array */
5575 C_KILL(okay, max_a_idx, bool);
5577 /* Close the file */
5580 /* Display the file contents */
5581 show_file(TRUE, file_name, _("既知の伝説のアイテム", "Artifacts Seen"), 0, 0);
5583 /* Remove the file */
5589 * Display known uniques
5590 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
5592 static void do_cmd_knowledge_uniques(void)
5600 char file_name[1024];
5603 int n_alive_surface = 0;
5604 int n_alive_over100 = 0;
5605 int n_alive_total = 0;
5608 for (i = 0; i < 10; i++) n_alive[i] = 0;
5610 /* Open a new file */
5611 fff = my_fopen_temp(file_name, 1024);
5615 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5620 /* Allocate the "who" array */
5621 C_MAKE(who, max_r_idx, s16b);
5623 /* Scan the monsters */
5624 for (i = 1; i < max_r_idx; i++)
5626 monster_race *r_ptr = &r_info[i];
5629 if (!r_ptr->name) continue;
5631 /* Require unique monsters */
5632 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5634 /* Only display "known" uniques */
5635 if (!cheat_know && !r_ptr->r_sights) continue;
5637 /* Only print rarity <= 100 uniques */
5638 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
5640 /* Only "alive" uniques */
5641 if (r_ptr->max_num == 0) continue;
5645 lev = (r_ptr->level - 1) / 10;
5649 if (max_lev < lev) max_lev = lev;
5651 else n_alive_over100++;
5653 else n_alive_surface++;
5655 /* Collect "appropriate" monsters */
5659 /* Select the sort method */
5660 ang_sort_comp = ang_sort_comp_hook;
5661 ang_sort_swap = ang_sort_swap_hook;
5663 /* Sort the array by dungeon depth of monsters */
5664 ang_sort(who, &why, n);
5666 if (n_alive_surface)
5668 fprintf(fff, _(" 地上 生存: %3d体\n", " Surface alive: %3d\n"), n_alive_surface);
5669 n_alive_total += n_alive_surface;
5671 for (i = 0; i <= max_lev; i++)
5673 fprintf(fff, _("%3d-%3d階 生存: %3d体\n", "Level %3d-%3d alive: %3d\n"), 1 + i * 10, 10 + i * 10, n_alive[i]);
5674 n_alive_total += n_alive[i];
5676 if (n_alive_over100)
5678 fprintf(fff, _("101- 階 生存: %3d体\n", "Level 101- alive: %3d\n"), n_alive_over100);
5679 n_alive_total += n_alive_over100;
5684 fputs(_("--------- -----------\n", "------------- ----------\n"), fff);
5685 fprintf(fff, _(" 合計 生存: %3d体\n\n", " Total alive: %3d\n\n"), n_alive_total);
5689 fputs(_("現在は既知の生存ユニークはいません。\n", "No known uniques alive.\n"), fff);
5692 /* Scan the monster races */
5693 for (k = 0; k < n; k++)
5695 monster_race *r_ptr = &r_info[who[k]];
5697 /* Print a message */
5698 fprintf(fff, _(" %s (レベル%d)\n", " %s (level %d)\n"), r_name + r_ptr->name, r_ptr->level);
5701 /* Free the "who" array */
5702 C_KILL(who, max_r_idx, s16b);
5704 /* Close the file */
5707 /* Display the file contents */
5708 show_file(TRUE, file_name, _("まだ生きているユニーク・モンスター", "Alive Uniques"), 0, 0);
5710 /* Remove the file */
5716 * Display weapon-exp
5718 static void do_cmd_knowledge_weapon_exp(void)
5720 int i, j, num, weapon_exp;
5724 char file_name[1024];
5727 /* Open a new file */
5728 fff = my_fopen_temp(file_name, 1024);
5730 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5735 for (i = 0; i < 5; i++)
5737 for (num = 0; num < 64; num++)
5739 for (j = 0; j < max_k_idx; j++)
5741 object_kind *k_ptr = &k_info[j];
5743 if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
5745 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON || k_ptr->sval == SV_HARP)) continue;
5747 weapon_exp = p_ptr->weapon_exp[4 - i][num];
5749 fprintf(fff, "%-25s ", tmp);
5750 if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
5751 else fprintf(fff, " ");
5752 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
5753 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
5761 /* Close the file */
5764 /* Display the file contents */
5765 show_file(TRUE, file_name, _("武器の経験値", "Weapon Proficiency"), 0, 0);
5767 /* Remove the file */
5773 * @brief 魔法の経験値を表示するコマンドのメインルーチン
5777 static void do_cmd_knowledge_spell_exp(void)
5779 int i = 0, spell_exp, exp_level;
5782 const magic_type *s_ptr;
5784 char file_name[1024];
5786 /* Open a new file */
5787 fff = my_fopen_temp(file_name, 1024);
5789 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5794 if (p_ptr->realm1 != REALM_NONE)
5796 fprintf(fff, _("%sの魔法書\n", "%s Spellbook\n"), realm_names[p_ptr->realm1]);
5797 for (i = 0; i < 32; i++)
5799 if (!is_magic(p_ptr->realm1))
5801 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][i];
5805 s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
5807 if (s_ptr->slevel >= 99) continue;
5808 spell_exp = p_ptr->spell_exp[i];
5809 exp_level = spell_exp_level(spell_exp);
5810 fprintf(fff, "%-25s ", do_spell(p_ptr->realm1, i, SPELL_NAME));
5811 if (p_ptr->realm1 == REALM_HISSATSU)
5812 fprintf(fff, "[--]");
5815 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
5816 else fprintf(fff, " ");
5817 fprintf(fff, "%s", exp_level_str[exp_level]);
5819 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5824 if (p_ptr->realm2 != REALM_NONE)
5826 fprintf(fff, _("%sの魔法書\n", "\n%s Spellbook\n"), realm_names[p_ptr->realm2]);
5827 for (i = 0; i < 32; i++)
5829 if (!is_magic(p_ptr->realm1))
5831 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][i];
5835 s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
5837 if (s_ptr->slevel >= 99) continue;
5839 spell_exp = p_ptr->spell_exp[i + 32];
5840 exp_level = spell_exp_level(spell_exp);
5841 fprintf(fff, "%-25s ", do_spell(p_ptr->realm2, i, SPELL_NAME));
5842 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
5843 else fprintf(fff, " ");
5844 fprintf(fff, "%s", exp_level_str[exp_level]);
5845 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
5850 /* Close the file */
5853 /* Display the file contents */
5854 show_file(TRUE, file_name, _("魔法の経験値", "Spell Proficiency"), 0, 0);
5856 /* Remove the file */
5862 * @brief スキル情報を表示するコマンドのメインルーチン /
5866 static void do_cmd_knowledge_skill_exp(void)
5868 int i = 0, skill_exp;
5872 char file_name[1024];
5873 char skill_name[3][20]={_("マーシャルアーツ", "Martial Arts "),
5874 _("二刀流 ", "Dual Wielding "),
5875 _("乗馬 ", "Riding ")};
5877 /* Open a new file */
5878 fff = my_fopen_temp(file_name, 1024);
5880 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
5885 for (i = 0; i < 3; i++)
5887 skill_exp = p_ptr->skill_exp[i];
5888 fprintf(fff, "%-20s ", skill_name[i]);
5889 if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
5890 else fprintf(fff, " ");
5891 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
5892 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
5896 /* Close the file */
5899 /* Display the file contents */
5900 show_file(TRUE, file_name, _("技能の経験値", "Miscellaneous Proficiency"), 0, 0);
5902 /* Remove the file */
5908 * @brief 英単語、句、説を複数形を変換する / Pluralize a monster name
5909 * @param Name 変換したい文字列の参照ポインタ
5912 void plural_aux(char *Name)
5914 int NameLen = strlen(Name);
5916 if (my_strstr(Name, "Disembodied hand"))
5918 strcpy(Name, "Disembodied hands that strangled people");
5920 else if (my_strstr(Name, "Colour out of space"))
5922 strcpy(Name, "Colours out of space");
5924 else if (my_strstr(Name, "stairway to hell"))
5926 strcpy(Name, "stairways to hell");
5928 else if (my_strstr(Name, "Dweller on the threshold"))
5930 strcpy(Name, "Dwellers on the threshold");
5932 else if (my_strstr(Name, " of "))
5934 cptr aider = my_strstr(Name, " of ");
5945 if (dummy[i-1] == 's')
5947 strcpy(&(dummy[i]), "es");
5952 strcpy(&(dummy[i]), "s");
5955 strcpy(&(dummy[i+1]), aider);
5956 strcpy(Name, dummy);
5958 else if (my_strstr(Name, "coins"))
5961 strcpy(dummy, "piles of ");
5962 strcat(dummy, Name);
5963 strcpy(Name, dummy);
5966 else if (my_strstr(Name, "Manes"))
5970 else if (streq(&(Name[NameLen - 2]), "ey"))
5972 strcpy(&(Name[NameLen - 2]), "eys");
5974 else if (Name[NameLen - 1] == 'y')
5976 strcpy(&(Name[NameLen - 1]), "ies");
5978 else if (streq(&(Name[NameLen - 4]), "ouse"))
5980 strcpy(&(Name[NameLen - 4]), "ice");
5982 else if (streq(&(Name[NameLen - 2]), "us"))
5984 strcpy(&(Name[NameLen - 2]), "i");
5986 else if (streq(&(Name[NameLen - 6]), "kelman"))
5988 strcpy(&(Name[NameLen - 6]), "kelmen");
5990 else if (streq(&(Name[NameLen - 8]), "wordsman"))
5992 strcpy(&(Name[NameLen - 8]), "wordsmen");
5994 else if (streq(&(Name[NameLen - 7]), "oodsman"))
5996 strcpy(&(Name[NameLen - 7]), "oodsmen");
5998 else if (streq(&(Name[NameLen - 7]), "eastman"))
6000 strcpy(&(Name[NameLen - 7]), "eastmen");
6002 else if (streq(&(Name[NameLen - 8]), "izardman"))
6004 strcpy(&(Name[NameLen - 8]), "izardmen");
6006 else if (streq(&(Name[NameLen - 5]), "geist"))
6008 strcpy(&(Name[NameLen - 5]), "geister");
6010 else if (streq(&(Name[NameLen - 2]), "ex"))
6012 strcpy(&(Name[NameLen - 2]), "ices");
6014 else if (streq(&(Name[NameLen - 2]), "lf"))
6016 strcpy(&(Name[NameLen - 2]), "lves");
6018 else if (suffix(Name, "ch") ||
6019 suffix(Name, "sh") ||
6020 suffix(Name, "nx") ||
6021 suffix(Name, "s") ||
6024 strcpy(&(Name[NameLen]), "es");
6028 strcpy(&(Name[NameLen]), "s");
6033 * @brief 現在のペットを表示するコマンドのメインルーチン /
6034 * Display current pets
6037 static void do_cmd_knowledge_pets(void)
6041 monster_type *m_ptr;
6044 int show_upkeep = 0;
6045 char file_name[1024];
6048 /* Open a new file */
6049 fff = my_fopen_temp(file_name, 1024);
6051 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6056 /* Process the monsters (backwards) */
6057 for (i = m_max - 1; i >= 1; i--)
6059 /* Access the monster */
6062 /* Ignore "dead" monsters */
6063 if (!m_ptr->r_idx) continue;
6065 /* Calculate "upkeep" for pets */
6069 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6070 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
6074 show_upkeep = calculate_upkeep();
6076 fprintf(fff, "----------------------------------------------\n");
6078 fprintf(fff, " 合計: %d 体のペット\n", t_friends);
6079 fprintf(fff, " 維持コスト: %d%% MP\n", show_upkeep);
6081 fprintf(fff, " Total: %d pet%s.\n",
6082 t_friends, (t_friends == 1 ? "" : "s"));
6083 fprintf(fff, " Upkeep: %d%% mana.\n", show_upkeep);
6088 /* Close the file */
6091 /* Display the file contents */
6092 show_file(TRUE, file_name, _("現在のペット", "Current Pets"), 0, 0);
6094 /* Remove the file */
6100 * @brief 現在のペットを表示するコマンドのメインルーチン /
6103 * @note the player ghosts are ignored. XXX XXX XXX
6105 static void do_cmd_knowledge_kill_count(void)
6113 char file_name[1024];
6118 /* Open a new file */
6119 fff = my_fopen_temp(file_name, 1024);
6122 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6127 /* Allocate the "who" array */
6128 C_MAKE(who, max_r_idx, s16b);
6131 /* Monsters slain */
6134 for (kk = 1; kk < max_r_idx; kk++)
6136 monster_race *r_ptr = &r_info[kk];
6138 if (r_ptr->flags1 & (RF1_UNIQUE))
6140 bool dead = (r_ptr->max_num == 0);
6149 s16b This = r_ptr->r_pkills;
6159 fprintf(fff,_("あなたはまだ敵を倒していない。\n\n", "You have defeated no enemies yet.\n\n"));
6162 fprintf(fff,"あなたは%ld体の敵を倒している。\n\n", (long int)Total);
6164 fprintf(fff,"You have defeated %ld %s.\n\n", (long int)Total, (Total == 1) ? "enemy" : "enemies");
6170 /* Scan the monsters */
6171 for (i = 1; i < max_r_idx; i++)
6173 monster_race *r_ptr = &r_info[i];
6175 /* Use that monster */
6176 if (r_ptr->name) who[n++] = i;
6179 /* Select the sort method */
6180 ang_sort_comp = ang_sort_comp_hook;
6181 ang_sort_swap = ang_sort_swap_hook;
6183 /* Sort the array by dungeon depth of monsters */
6184 ang_sort(who, &why, n);
6186 /* Scan the monster races */
6187 for (k = 0; k < n; k++)
6189 monster_race *r_ptr = &r_info[who[k]];
6191 if (r_ptr->flags1 & (RF1_UNIQUE))
6193 bool dead = (r_ptr->max_num == 0);
6197 /* Print a message */
6198 fprintf(fff, " %s\n",
6199 (r_name + r_ptr->name));
6205 s16b This = r_ptr->r_pkills;
6210 /* p,tは人と数える by ita */
6211 if (my_strchr("pt", r_ptr->d_char))
6212 fprintf(fff, " %3d 人の %s\n", This, r_name + r_ptr->name);
6214 fprintf(fff, " %3d 体の %s\n", This, r_name + r_ptr->name);
6218 if (my_strstr(r_name + r_ptr->name, "coins"))
6220 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
6224 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
6230 strcpy(ToPlural, (r_name + r_ptr->name));
6231 plural_aux(ToPlural);
6232 fprintf(fff, " %d %s\n", This, ToPlural);
6242 fprintf(fff,"----------------------------------------------\n");
6244 fprintf(fff," 合計: %lu 体を倒した。\n", (unsigned long int)Total);
6246 fprintf(fff," Total: %lu creature%s killed.\n",
6247 (unsigned long int)Total, (Total == 1 ? "" : "s"));
6251 /* Free the "who" array */
6252 C_KILL(who, max_r_idx, s16b);
6254 /* Close the file */
6257 /* Display the file contents */
6258 show_file(TRUE, file_name, _("倒した敵の数", "Kill Count"), 0, 0);
6260 /* Remove the file */
6266 * @brief モンスター情報リスト中のグループを表示する /
6267 * Display the object groups.
6271 * @param per_page リストの表示行
6272 * @param grp_idx グループのID配列
6273 * @param group_text グループ名の文字列配列
6274 * @param grp_cur 現在の選択ID
6275 * @param grp_top 現在の選択リスト最上部ID
6278 static void display_group_list(int col, int row, int wid, int per_page,
6279 int grp_idx[], cptr group_text[], int grp_cur, int grp_top)
6283 /* Display lines until done */
6284 for (i = 0; i < per_page && (grp_idx[i] >= 0); i++)
6286 /* Get the group index */
6287 int grp = grp_idx[grp_top + i];
6289 /* Choose a color */
6290 byte attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
6292 /* Erase the entire line */
6293 Term_erase(col, row + i, wid);
6295 /* Display the group label */
6296 c_put_str(attr, group_text[grp], row + i, col);
6302 * Move the cursor in a browser window
6304 static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt,
6305 int *list_cur, int list_cnt)
6310 int list = *list_cur;
6312 /* Extract direction */
6315 /* Hack -- scroll up full screen */
6320 /* Hack -- scroll down full screen */
6325 d = get_keymap_dir(ch);
6330 /* Diagonals - hack */
6331 if ((ddx[d] > 0) && ddy[d])
6337 Term_get_size(&wid, &hgt);
6339 browser_rows = hgt - 8;
6341 /* Browse group list */
6346 /* Move up or down */
6347 grp += ddy[d] * (browser_rows - 1);
6350 if (grp >= grp_cnt) grp = grp_cnt - 1;
6351 if (grp < 0) grp = 0;
6352 if (grp != old_grp) list = 0;
6355 /* Browse sub-list list */
6358 /* Move up or down */
6359 list += ddy[d] * browser_rows;
6362 if (list >= list_cnt) list = list_cnt - 1;
6363 if (list < 0) list = 0;
6375 if (col < 0) col = 0;
6376 if (col > 1) col = 1;
6383 /* Browse group list */
6388 /* Move up or down */
6392 if (grp >= grp_cnt) grp = grp_cnt - 1;
6393 if (grp < 0) grp = 0;
6394 if (grp != old_grp) list = 0;
6397 /* Browse sub-list list */
6400 /* Move up or down */
6404 if (list >= list_cnt) list = list_cnt - 1;
6405 if (list < 0) list = 0;
6416 static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left)
6420 /* Clear the display lines */
6421 for (i = 0; i < height; i++)
6423 Term_erase(col, row + i, width);
6426 /* Bigtile mode uses double width */
6427 if (use_bigtile) width /= 2;
6429 /* Display lines until done */
6430 for (i = 0; i < height; i++)
6432 /* Display columns until done */
6433 for (j = 0; j < width; j++)
6441 /* Bigtile mode uses double width */
6442 if (use_bigtile) x += j;
6447 /* Ignore illegal characters */
6448 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
6449 (!use_graphics && ic > 0x7f))
6455 /* Force correct code for both ASCII character and tile */
6456 if (c & 0x80) a |= 0x80;
6458 /* Display symbol */
6459 Term_queue_bigchar(x, y, a, c, 0, 0);
6466 * Place the cursor at the collect position for visual mode
6468 static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left)
6470 int i = (a & 0x7f) - attr_top;
6471 int j = c - char_left;
6476 /* Bigtile mode uses double width */
6477 if (use_bigtile) x += j;
6479 /* Place the cursor */
6485 * Clipboard variables for copy&paste in visual mode
6487 static byte attr_idx = 0;
6488 static byte char_idx = 0;
6490 /* Hack -- for feature lighting */
6491 static byte attr_idx_feat[F_LIT_MAX];
6492 static byte char_idx_feat[F_LIT_MAX];
6495 * Do visual mode command -- Change symbols
6497 static bool visual_mode_command(char ch, bool *visual_list_ptr,
6498 int height, int width,
6499 byte *attr_top_ptr, byte *char_left_ptr,
6500 byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
6502 static byte attr_old = 0, char_old = 0;
6507 if (*visual_list_ptr)
6510 *cur_attr_ptr = attr_old;
6511 *cur_char_ptr = char_old;
6512 *visual_list_ptr = FALSE;
6520 if (*visual_list_ptr)
6523 *visual_list_ptr = FALSE;
6524 *need_redraw = TRUE;
6532 if (!*visual_list_ptr)
6534 *visual_list_ptr = TRUE;
6536 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6537 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6539 attr_old = *cur_attr_ptr;
6540 char_old = *cur_char_ptr;
6551 /* Set the visual */
6552 attr_idx = *cur_attr_ptr;
6553 char_idx = *cur_char_ptr;
6555 /* Hack -- for feature lighting */
6556 for (i = 0; i < F_LIT_MAX; i++)
6558 attr_idx_feat[i] = 0;
6559 char_idx_feat[i] = 0;
6566 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
6569 *cur_attr_ptr = attr_idx;
6570 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
6571 if (!*visual_list_ptr) *need_redraw = TRUE;
6577 *cur_char_ptr = char_idx;
6578 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
6579 if (!*visual_list_ptr) *need_redraw = TRUE;
6585 if (*visual_list_ptr)
6588 int d = get_keymap_dir(ch);
6589 byte a = (*cur_attr_ptr & 0x7f);
6590 byte c = *cur_char_ptr;
6592 if (use_bigtile) eff_width = width / 2;
6593 else eff_width = width;
6595 /* Restrict direction */
6596 if ((a == 0) && (ddy[d] < 0)) d = 0;
6597 if ((c == 0) && (ddx[d] < 0)) d = 0;
6598 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
6599 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
6604 /* Force correct code for both ASCII character and tile */
6605 if (c & 0x80) a |= 0x80;
6607 /* Set the visual */
6612 /* Move the frame */
6613 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
6614 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
6615 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
6616 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
6622 /* Visual mode command is not used */
6628 * Display the monsters in a group.
6630 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
6631 int mon_cur, int mon_top, bool visual_only)
6635 /* Display lines until done */
6636 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
6640 /* Get the race index */
6641 int r_idx = mon_idx[mon_top + i] ;
6643 /* Access the race */
6644 monster_race *r_ptr = &r_info[r_idx];
6646 /* Choose a color */
6647 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
6649 /* Display the name */
6650 c_prt(attr, (r_name + r_ptr->name), row + i, col);
6652 /* Hack -- visual_list mode */
6655 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (p_ptr->wizard || visual_only) ? 56 : 61);
6657 if (p_ptr->wizard || visual_only)
6659 c_prt(attr, format("%d", r_idx), row + i, 62);
6662 /* Erase chars before overwritten by the race letter */
6663 Term_erase(69, row + i, 255);
6665 /* Display symbol */
6666 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
6671 if (!(r_ptr->flags1 & RF1_UNIQUE))
6672 put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
6674 c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE),
6675 (r_ptr->max_num == 0 ? _("死亡", " dead") : _("生存", "alive")), row + i, 74);
6679 /* Clear remaining lines */
6680 for (; i < per_page; i++)
6682 Term_erase(col, row + i, 255);
6688 * Display known monsters.
6690 static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx)
6693 int grp_cur, grp_top, old_grp_cur;
6694 int mon_cur, mon_top;
6695 int grp_cnt, grp_idx[100];
6703 bool visual_list = FALSE;
6704 byte attr_top = 0, char_left = 0;
6712 Term_get_size(&wid, &hgt);
6714 browser_rows = hgt - 8;
6716 /* Allocate the "mon_idx" array */
6717 C_MAKE(mon_idx, max_r_idx, s16b);
6722 if (direct_r_idx < 0)
6724 mode = visual_only ? 0x03 : 0x01;
6726 /* Check every group */
6727 for (i = 0; monster_group_text[i] != NULL; i++)
6729 /* Measure the label */
6730 len = strlen(monster_group_text[i]);
6732 /* Save the maximum length */
6733 if (len > max) max = len;
6735 /* See if any monsters are known */
6736 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(i, mon_idx, mode))
6738 /* Build a list of groups with known monsters */
6739 grp_idx[grp_cnt++] = i;
6747 mon_idx[0] = direct_r_idx;
6750 /* Terminate the list */
6753 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
6754 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
6757 /* Terminate the list */
6758 grp_idx[grp_cnt] = -1;
6761 grp_cur = grp_top = 0;
6762 mon_cur = mon_top = 0;
6767 mode = visual_only ? 0x02 : 0x00;
6772 monster_race *r_ptr;
6779 prt(format("%s - モンスター", !visual_only ? "知識" : "表示"), 2, 0);
6780 if (direct_r_idx < 0) prt("グループ", 4, 0);
6781 prt("名前", 4, max + 3);
6782 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6784 if (!visual_only) prt("殺害数", 4, 72);
6786 prt(format("%s - monsters", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
6787 if (direct_r_idx < 0) prt("Group", 4, 0);
6788 prt("Name", 4, max + 3);
6789 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
6791 if (!visual_only) prt("Kills", 4, 73);
6794 for (i = 0; i < 78; i++)
6796 Term_putch(i, 5, TERM_WHITE, '=');
6799 if (direct_r_idx < 0)
6801 for (i = 0; i < browser_rows; i++)
6803 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
6810 if (direct_r_idx < 0)
6812 /* Scroll group list */
6813 if (grp_cur < grp_top) grp_top = grp_cur;
6814 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
6816 /* Display a list of monster groups */
6817 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
6819 if (old_grp_cur != grp_cur)
6821 old_grp_cur = grp_cur;
6823 /* Get a list of monsters in the current group */
6824 mon_cnt = collect_monsters(grp_idx[grp_cur], mon_idx, mode);
6827 /* Scroll monster list */
6828 while (mon_cur < mon_top)
6829 mon_top = MAX(0, mon_top - browser_rows/2);
6830 while (mon_cur >= mon_top + browser_rows)
6831 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
6836 /* Display a list of monsters in the current group */
6837 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
6843 /* Display a monster name */
6844 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
6846 /* Display visual list below first monster */
6847 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
6852 prt(format("<方向>%s%s%s, ESC",
6853 (!visual_list && !visual_only) ? ", 'r'で思い出を見る" : "",
6854 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
6855 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
6858 prt(format("<dir>%s%s%s, ESC",
6859 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
6860 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
6861 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
6865 /* Get the current monster */
6866 r_ptr = &r_info[mon_idx[mon_cur]];
6870 /* Mega Hack -- track this monster race */
6871 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
6873 /* Hack -- handle stuff */
6879 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
6883 Term_gotoxy(0, 6 + (grp_cur - grp_top));
6887 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
6892 /* Do visual mode command if needed */
6893 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))
6895 if (direct_r_idx >= 0)
6920 /* Recall on screen */
6921 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
6923 screen_roff(mon_idx[mon_cur], 0);
6934 /* Move the cursor */
6935 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
6942 /* Free the "mon_idx" array */
6943 C_KILL(mon_idx, max_r_idx, s16b);
6948 * Display the objects in a group.
6950 static void display_object_list(int col, int row, int per_page, int object_idx[],
6951 int object_cur, int object_top, bool visual_only)
6955 /* Display lines until done */
6956 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
6960 object_kind *flavor_k_ptr;
6962 /* Get the object index */
6963 int k_idx = object_idx[object_top + i];
6965 /* Access the object */
6966 object_kind *k_ptr = &k_info[k_idx];
6968 /* Choose a color */
6969 byte attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
6970 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
6973 if (!visual_only && k_ptr->flavor)
6975 /* Appearance of this object is shuffled */
6976 flavor_k_ptr = &k_info[k_ptr->flavor];
6980 /* Appearance of this object is very normal */
6981 flavor_k_ptr = k_ptr;
6986 attr = ((i + object_top == object_cur) ? cursor : attr);
6988 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
6991 strip_name(o_name, k_idx);
6996 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
6999 /* Display the name */
7000 c_prt(attr, o_name, row + i, col);
7002 /* Hack -- visual_list mode */
7005 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);
7007 if (p_ptr->wizard || visual_only)
7009 c_prt(attr, format("%d", k_idx), row + i, 70);
7012 a = flavor_k_ptr->x_attr;
7013 c = flavor_k_ptr->x_char;
7015 /* Display symbol */
7016 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
7019 /* Clear remaining lines */
7020 for (; i < per_page; i++)
7022 Term_erase(col, row + i, 255);
7027 * Describe fake object
7029 static void desc_obj_fake(int k_idx)
7032 object_type object_type_body;
7034 /* Get local object */
7035 o_ptr = &object_type_body;
7037 /* Wipe the object */
7040 /* Create the artifact */
7041 object_prep(o_ptr, k_idx);
7043 /* It's fully know */
7044 o_ptr->ident |= IDENT_KNOWN;
7046 /* Track the object */
7047 /* object_actual_track(o_ptr); */
7049 /* Hack - mark as fake */
7050 /* term_obj_real = FALSE; */
7052 /* Hack -- Handle stuff */
7055 if (!screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL))
7057 msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
7065 * Display known objects
7067 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx)
7070 int grp_cur, grp_top, old_grp_cur;
7071 int object_old, object_cur, object_top;
7072 int grp_cnt, grp_idx[100];
7080 bool visual_list = FALSE;
7081 byte attr_top = 0, char_left = 0;
7089 Term_get_size(&wid, &hgt);
7091 browser_rows = hgt - 8;
7093 /* Allocate the "object_idx" array */
7094 C_MAKE(object_idx, max_k_idx, int);
7099 if (direct_k_idx < 0)
7101 mode = visual_only ? 0x03 : 0x01;
7103 /* Check every group */
7104 for (i = 0; object_group_text[i] != NULL; i++)
7106 /* Measure the label */
7107 len = strlen(object_group_text[i]);
7109 /* Save the maximum length */
7110 if (len > max) max = len;
7112 /* See if any monsters are known */
7113 if (collect_objects(i, object_idx, mode))
7115 /* Build a list of groups with known monsters */
7116 grp_idx[grp_cnt++] = i;
7125 object_kind *k_ptr = &k_info[direct_k_idx];
7126 object_kind *flavor_k_ptr;
7128 if (!visual_only && k_ptr->flavor)
7130 /* Appearance of this object is shuffled */
7131 flavor_k_ptr = &k_info[k_ptr->flavor];
7135 /* Appearance of this object is very normal */
7136 flavor_k_ptr = k_ptr;
7139 object_idx[0] = direct_k_idx;
7140 object_old = direct_k_idx;
7143 /* Terminate the list */
7146 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7147 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
7150 /* Terminate the list */
7151 grp_idx[grp_cnt] = -1;
7154 grp_cur = grp_top = 0;
7155 object_cur = object_top = 0;
7160 mode = visual_only ? 0x02 : 0x00;
7165 object_kind *k_ptr, *flavor_k_ptr;
7172 prt(format("%s - アイテム", !visual_only ? "知識" : "表示"), 2, 0);
7173 if (direct_k_idx < 0) prt("グループ", 4, 0);
7174 prt("名前", 4, max + 3);
7175 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
7178 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
7179 if (direct_k_idx < 0) prt("Group", 4, 0);
7180 prt("Name", 4, max + 3);
7181 if (p_ptr->wizard || visual_only) prt("Idx", 4, 70);
7185 for (i = 0; i < 78; i++)
7187 Term_putch(i, 5, TERM_WHITE, '=');
7190 if (direct_k_idx < 0)
7192 for (i = 0; i < browser_rows; i++)
7194 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7201 if (direct_k_idx < 0)
7203 /* Scroll group list */
7204 if (grp_cur < grp_top) grp_top = grp_cur;
7205 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7207 /* Display a list of object groups */
7208 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
7210 if (old_grp_cur != grp_cur)
7212 old_grp_cur = grp_cur;
7214 /* Get a list of objects in the current group */
7215 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
7218 /* Scroll object list */
7219 while (object_cur < object_top)
7220 object_top = MAX(0, object_top - browser_rows/2);
7221 while (object_cur >= object_top + browser_rows)
7222 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
7227 /* Display a list of objects in the current group */
7228 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
7232 object_top = object_cur;
7234 /* Display a list of objects in the current group */
7235 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
7237 /* Display visual list below first object */
7238 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7241 /* Get the current object */
7242 k_ptr = &k_info[object_idx[object_cur]];
7244 if (!visual_only && k_ptr->flavor)
7246 /* Appearance of this object is shuffled */
7247 flavor_k_ptr = &k_info[k_ptr->flavor];
7251 /* Appearance of this object is very normal */
7252 flavor_k_ptr = k_ptr;
7257 prt(format("<方向>%s%s%s, ESC",
7258 (!visual_list && !visual_only) ? ", 'r'で詳細を見る" : "",
7259 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
7260 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7263 prt(format("<dir>%s%s%s, ESC",
7264 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
7265 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
7266 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7272 /* Mega Hack -- track this object */
7273 if (object_cnt) object_kind_track(object_idx[object_cur]);
7275 /* The "current" object changed */
7276 if (object_old != object_idx[object_cur])
7278 /* Hack -- handle stuff */
7281 /* Remember the "current" object */
7282 object_old = object_idx[object_cur];
7288 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
7292 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7296 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
7301 /* Do visual mode command if needed */
7302 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))
7304 if (direct_k_idx >= 0)
7329 /* Recall on screen */
7330 if (!visual_list && !visual_only && (grp_cnt > 0))
7332 desc_obj_fake(object_idx[object_cur]);
7340 /* Move the cursor */
7341 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
7347 /* Free the "object_idx" array */
7348 C_KILL(object_idx, max_k_idx, int);
7353 * Display the features in a group.
7355 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
7356 int feat_cur, int feat_top, bool visual_only, int lighting_level)
7358 int lit_col[F_LIT_MAX], i, j;
7359 int f_idx_col = use_bigtile ? 62 : 64;
7361 /* Correct columns 1 and 4 */
7362 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
7363 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7364 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
7366 /* Display lines until done */
7367 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
7372 int f_idx = feat_idx[feat_top + i];
7374 /* Access the index */
7375 feature_type *f_ptr = &f_info[f_idx];
7377 int row_i = row + i;
7379 /* Choose a color */
7380 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
7382 /* Display the name */
7383 c_prt(attr, f_name + f_ptr->name, row_i, col);
7385 /* Hack -- visual_list mode */
7388 /* Display lighting level */
7389 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
7391 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));
7393 if (p_ptr->wizard || visual_only)
7395 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
7398 /* Display symbol */
7399 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);
7401 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
7402 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
7404 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
7406 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
7408 /* Mega-hack -- Use non-standard colour */
7409 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
7411 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
7415 /* Clear remaining lines */
7416 for (; i < per_page; i++)
7418 Term_erase(col, row + i, 255);
7424 * Interact with feature visuals.
7426 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level)
7429 int grp_cur, grp_top, old_grp_cur;
7430 int feat_cur, feat_top;
7431 int grp_cnt, grp_idx[100];
7439 bool visual_list = FALSE;
7440 byte attr_top = 0, char_left = 0;
7445 byte attr_old[F_LIT_MAX];
7446 byte char_old[F_LIT_MAX];
7447 byte *cur_attr_ptr, *cur_char_ptr;
7449 (void)C_WIPE(attr_old, F_LIT_MAX, byte);
7450 (void)C_WIPE(char_old, F_LIT_MAX, byte);
7453 Term_get_size(&wid, &hgt);
7455 browser_rows = hgt - 8;
7457 /* Allocate the "feat_idx" array */
7458 C_MAKE(feat_idx, max_f_idx, int);
7463 if (direct_f_idx < 0)
7465 /* Check every group */
7466 for (i = 0; feature_group_text[i] != NULL; i++)
7468 /* Measure the label */
7469 len = strlen(feature_group_text[i]);
7471 /* Save the maximum length */
7472 if (len > max) max = len;
7474 /* See if any features are known */
7475 if (collect_features(i, feat_idx, 0x01))
7477 /* Build a list of groups with known features */
7478 grp_idx[grp_cnt++] = i;
7486 feature_type *f_ptr = &f_info[direct_f_idx];
7488 feat_idx[0] = direct_f_idx;
7491 /* Terminate the list */
7494 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
7495 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
7497 for (i = 0; i < F_LIT_MAX; i++)
7499 attr_old[i] = f_ptr->x_attr[i];
7500 char_old[i] = f_ptr->x_char[i];
7504 /* Terminate the list */
7505 grp_idx[grp_cnt] = -1;
7508 grp_cur = grp_top = 0;
7509 feat_cur = feat_top = 0;
7517 feature_type *f_ptr;
7524 prt("表示 - 地形", 2, 0);
7525 if (direct_f_idx < 0) prt("グループ", 4, 0);
7526 prt("名前", 4, max + 3);
7529 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7530 prt("文字 ( l/ d)", 4, 66);
7534 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7535 prt("文字 (l/d)", 4, 68);
7538 prt("Visuals - features", 2, 0);
7539 if (direct_f_idx < 0) prt("Group", 4, 0);
7540 prt("Name", 4, max + 3);
7543 if (p_ptr->wizard || visual_only) prt("Idx", 4, 62);
7544 prt("Sym ( l/ d)", 4, 67);
7548 if (p_ptr->wizard || visual_only) prt("Idx", 4, 64);
7549 prt("Sym (l/d)", 4, 69);
7553 for (i = 0; i < 78; i++)
7555 Term_putch(i, 5, TERM_WHITE, '=');
7558 if (direct_f_idx < 0)
7560 for (i = 0; i < browser_rows; i++)
7562 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
7569 if (direct_f_idx < 0)
7571 /* Scroll group list */
7572 if (grp_cur < grp_top) grp_top = grp_cur;
7573 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
7575 /* Display a list of feature groups */
7576 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
7578 if (old_grp_cur != grp_cur)
7580 old_grp_cur = grp_cur;
7582 /* Get a list of features in the current group */
7583 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
7586 /* Scroll feature list */
7587 while (feat_cur < feat_top)
7588 feat_top = MAX(0, feat_top - browser_rows/2);
7589 while (feat_cur >= feat_top + browser_rows)
7590 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
7595 /* Display a list of features in the current group */
7596 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
7600 feat_top = feat_cur;
7602 /* Display a list of features in the current group */
7603 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
7605 /* Display visual list below first object */
7606 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
7611 prt(format("<方向>%s, 'd'で標準光源効果%s, ESC",
7612 visual_list ? ", ENTERで決定, 'a'で対象明度変更" : ", 'v'でシンボル変更",
7613 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
7616 prt(format("<dir>%s, 'd' for default lighting%s, ESC",
7617 visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals",
7618 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
7622 /* Get the current feature */
7623 f_ptr = &f_info[feat_idx[feat_cur]];
7624 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
7625 cur_char_ptr = &f_ptr->x_char[*lighting_level];
7629 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
7633 Term_gotoxy(0, 6 + (grp_cur - grp_top));
7637 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
7642 if (visual_list && ((ch == 'A') || (ch == 'a')))
7644 int prev_lighting_level = *lighting_level;
7648 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
7649 else (*lighting_level)--;
7653 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
7654 else (*lighting_level)++;
7657 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
7658 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7660 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
7661 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7666 else if ((ch == 'D') || (ch == 'd'))
7668 byte prev_x_attr = f_ptr->x_attr[*lighting_level];
7669 byte prev_x_char = f_ptr->x_char[*lighting_level];
7671 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
7675 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
7676 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
7678 if (prev_x_char != f_ptr->x_char[*lighting_level])
7679 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
7681 else *need_redraw = TRUE;
7686 /* Do visual mode command if needed */
7687 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))
7691 /* Restore previous visual settings */
7693 for (i = 0; i < F_LIT_MAX; i++)
7695 f_ptr->x_attr[i] = attr_old[i];
7696 f_ptr->x_char[i] = char_old[i];
7703 if (direct_f_idx >= 0) flag = TRUE;
7704 else *lighting_level = F_LIT_STANDARD;
7707 /* Preserve current visual settings */
7710 for (i = 0; i < F_LIT_MAX; i++)
7712 attr_old[i] = f_ptr->x_attr[i];
7713 char_old[i] = f_ptr->x_char[i];
7715 *lighting_level = F_LIT_STANDARD;
7722 for (i = 0; i < F_LIT_MAX; i++)
7724 attr_idx_feat[i] = f_ptr->x_attr[i];
7725 char_idx_feat[i] = f_ptr->x_char[i];
7734 /* Allow TERM_DARK text */
7735 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
7737 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
7738 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
7756 /* Move the cursor */
7757 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
7763 /* Free the "feat_idx" array */
7764 C_KILL(feat_idx, max_f_idx, int);
7769 * List wanted monsters
7771 static void do_cmd_knowledge_kubi(void)
7776 char file_name[1024];
7779 /* Open a new file */
7780 fff = my_fopen_temp(file_name, 1024);
7782 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7789 bool listed = FALSE;
7792 fprintf(fff, "今日のターゲット : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "不明"));
7794 fprintf(fff, "賞金首リスト\n");
7796 fprintf(fff, "Today target : %s\n", (p_ptr->today_mon ? r_name + r_info[p_ptr->today_mon].name : "unknown"));
7798 fprintf(fff, "List of wanted monsters\n");
7800 fprintf(fff, "----------------------------------------------\n");
7802 for (i = 0; i < MAX_KUBI; i++)
7804 if (kubi_r_idx[i] <= 10000)
7806 fprintf(fff,"%s\n", r_name + r_info[kubi_r_idx[i]].name);
7814 fprintf(fff,"\n%s\n", _("賞金首はもう残っていません。", "There is no more wanted monster."));
7818 /* Close the file */
7821 /* Display the file contents */
7822 show_file(TRUE, file_name, _("賞金首の一覧", "Wanted monsters"), 0, 0);
7824 /* Remove the file */
7829 * List virtues & status
7831 static void do_cmd_knowledge_virtues(void)
7835 char file_name[1024];
7838 /* Open a new file */
7839 fff = my_fopen_temp(file_name, 1024);
7841 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7848 fprintf(fff, _("現在の属性 : %s\n\n", "Your alighnment : %s\n\n"), your_alignment());
7852 /* Close the file */
7855 /* Display the file contents */
7856 show_file(TRUE, file_name, _("八つの徳", "Virtues"), 0, 0);
7858 /* Remove the file */
7866 static void do_cmd_knowledge_dungeon(void)
7870 char file_name[1024];
7874 /* Open a new file */
7875 fff = my_fopen_temp(file_name, 1024);
7877 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7884 for (i = 1; i < max_d_idx; i++)
7888 if (!d_info[i].maxdepth) continue;
7889 if (!max_dlv[i]) continue;
7890 if (d_info[i].final_guardian)
7892 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
7894 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
7896 fprintf(fff, _("%c%-12s : %3d 階\n", "%c%-16s : level %3d\n"), seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]);
7900 /* Close the file */
7903 /* Display the file contents */
7904 show_file(TRUE, file_name, _("今までに入ったダンジョン", "Dungeon"), 0, 0);
7906 /* Remove the file */
7911 * List virtues & status
7914 static void do_cmd_knowledge_stat(void)
7918 char file_name[1024];
7921 /* Open a new file */
7922 fff = my_fopen_temp(file_name, 1024);
7924 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
7931 percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
7932 (2 * p_ptr->hitdie +
7933 ((PY_MAX_LEVEL - 1+3) * (p_ptr->hitdie + 1))));
7936 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "現在の体力ランク : %d/100\n\n", percent);
7937 else fprintf(fff, "現在の体力ランク : ???\n\n");
7938 fprintf(fff, "能力の最大値\n\n");
7940 if (p_ptr->knowledge & KNOW_HPRATE) fprintf(fff, "Your current Life Rating is %d/100.\n\n", percent);
7941 else fprintf(fff, "Your current Life Rating is ???.\n\n");
7942 fprintf(fff, "Limits of maximum stats\n\n");
7944 for (v_nr = 0; v_nr < 6; v_nr++)
7946 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);
7947 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
7953 /* Close the file */
7956 /* Display the file contents */
7957 show_file(TRUE, file_name, _("自分に関する情報", "HP-rate & Max stat"), 0, 0);
7959 /* Remove the file */
7965 * Print all active quests
7967 static void do_cmd_knowledge_quests_current(FILE *fff)
7970 char rand_tmp_str[120] = "\0";
7972 monster_race *r_ptr;
7974 int rand_level = 100;
7977 fprintf(fff, _("《遂行中のクエスト》\n", "< Current Quest >\n"));
7979 for (i = 1; i < max_quests; i++)
7981 if ((quest[i].status == QUEST_STATUS_TAKEN) ||
7982 ((quest[i].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[i].type == QUEST_TYPE_TOWER)) ||
7983 (quest[i].status == QUEST_STATUS_COMPLETED))
7985 /* Set the quest number temporary */
7986 int old_quest = p_ptr->inside_quest;
7989 /* Clear the text */
7990 for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
7991 quest_text_line = 0;
7993 p_ptr->inside_quest = i;
7995 /* Get the quest text */
7996 init_flags = INIT_SHOW_TEXT;
7998 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8000 /* Reset the old quest number */
8001 p_ptr->inside_quest = old_quest;
8003 /* No info from "silent" quests */
8004 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8008 if (quest[i].type != QUEST_TYPE_RANDOM)
8010 char note[80] = "\0";
8012 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_STAGE_COMPLETED)
8014 switch (quest[i].type)
8016 case QUEST_TYPE_KILL_LEVEL:
8017 case QUEST_TYPE_KILL_ANY_LEVEL:
8018 r_ptr = &r_info[quest[i].r_idx];
8019 strcpy(name, r_name + r_ptr->name);
8020 if (quest[i].max_num > 1)
8023 sprintf(note," - %d 体の%sを倒す。(あと %d 体)",
8024 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
8027 sprintf(note," - kill %d %s, have killed %d.",
8028 quest[i].max_num, name, quest[i].cur_num);
8032 sprintf(note,_(" - %sを倒す。", " - kill %s."),name);
8035 case QUEST_TYPE_FIND_ARTIFACT:
8038 artifact_type *a_ptr = &a_info[quest[i].k_idx];
8040 object_type *q_ptr = &forge;
8041 int k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
8042 object_prep(q_ptr, k_idx);
8043 q_ptr->name1 = quest[i].k_idx;
8044 q_ptr->ident = IDENT_STORE;
8045 object_desc(name, q_ptr, OD_NAME_ONLY);
8047 sprintf(note,_("\n - %sを見つけ出す。", "\n - Find out %s."), name);
8049 case QUEST_TYPE_FIND_EXIT:
8050 sprintf(note,_(" - 出口に到達する。", " - Reach to Exit."));
8053 case QUEST_TYPE_KILL_NUMBER:
8055 sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)",
8056 quest[i].max_num, quest[i].max_num - quest[i].cur_num);
8058 sprintf(note," - Kill %d monsters, have killed %d.",
8059 quest[i].max_num, quest[i].cur_num);
8063 case QUEST_TYPE_KILL_ALL:
8064 case QUEST_TYPE_TOWER:
8065 sprintf(note,_(" - 全てのモンスターを倒す。", " - Kill all monsters."));
8070 /* Print the quest info */
8072 sprintf(tmp_str, " %s (危険度:%d階相当)%s\n",
8073 quest[i].name, quest[i].level, note);
8075 sprintf(tmp_str, " %s (Danger level: %d)%s\n",
8076 quest[i].name, quest[i].level, note);
8079 fputs(tmp_str, fff);
8081 if (quest[i].status == QUEST_STATUS_COMPLETED)
8083 sprintf(tmp_str, _(" クエスト達成 - まだ報酬を受けとってない。\n", " Quest Completed - Unrewarded\n"));
8084 fputs(tmp_str, fff);
8090 while (quest_text[j][0] && j < 10)
8092 fprintf(fff, " %s\n", quest_text[j]);
8097 else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
8100 rand_level = quest[i].level;
8102 if (max_dlv[DUNGEON_ANGBAND] >= rand_level)
8104 /* Print the quest info */
8105 r_ptr = &r_info[quest[i].r_idx];
8106 strcpy(name, r_name + r_ptr->name);
8108 if (quest[i].max_num > 1)
8111 sprintf(rand_tmp_str," %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
8112 quest[i].name, quest[i].level,
8113 quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
8117 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8118 quest[i].name, quest[i].level,
8119 quest[i].max_num, name, quest[i].cur_num);
8125 sprintf(rand_tmp_str," %s (%d 階) - %sを倒す。\n",
8126 quest[i].name, quest[i].level, name);
8128 sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
8129 quest[i].name, quest[i].level, name);
8137 /* Print the current random quest */
8138 if (rand_tmp_str[0]) fputs(rand_tmp_str, fff);
8140 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8144 static bool do_cmd_knowledge_quests_aux(FILE *fff, int q_idx)
8147 char playtime_str[16];
8148 quest_type* const q_ptr = &quest[q_idx];
8150 if (is_fixed_quest_idx(q_idx))
8152 /* Set the quest number temporary */
8153 int old_quest = p_ptr->inside_quest;
8155 p_ptr->inside_quest = q_idx;
8158 init_flags = INIT_NAME_ONLY;
8160 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
8162 /* Reset the old quest number */
8163 p_ptr->inside_quest = old_quest;
8165 /* No info from "silent" quests */
8166 if (q_ptr->flags & QUEST_FLAG_SILENT) return FALSE;
8169 strnfmt(playtime_str, sizeof(playtime_str), "%02d:%02d:%02d",
8170 q_ptr->comptime/(60*60), (q_ptr->comptime/60)%60, q_ptr->comptime%60);
8172 if (!is_fixed_quest_idx(q_idx) && q_ptr->r_idx)
8174 /* Print the quest info */
8175 if (q_ptr->complev == 0)
8178 _(" %-35s (%3d階) - 不戦勝 - %s\n",
8179 " %-35s (Dungeon level: %3d) - Unearned - %s\n") ,
8180 r_name+r_info[q_ptr->r_idx].name,
8181 q_ptr->level, playtime_str);
8186 _(" %-35s (%3d階) - レベル%2d - %s\n",
8187 " %-35s (Dungeon level: %3d) - level %2d - %s\n") ,
8188 r_name+r_info[q_ptr->r_idx].name,
8196 /* Print the quest info */
8198 _(" %-35s (危険度:%3d階相当) - レベル%2d - %s\n",
8199 " %-35s (Danger level: %3d) - level %2d - %s\n") ,
8200 q_ptr->name, q_ptr->level, q_ptr->complev, playtime_str);
8203 fputs(tmp_str, fff);
8209 * Print all finished quests
8211 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
8216 fprintf(fff, _("《達成したクエスト》\n", "< Completed Quest >\n"));
8217 for (i = 1; i < max_quests; i++)
8219 int q_idx = quest_num[i];
8220 quest_type* const q_ptr = &quest[q_idx];
8222 if (q_ptr->status == QUEST_STATUS_FINISHED &&
8223 do_cmd_knowledge_quests_aux(fff, q_idx))
8228 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8233 * Print all failed quests
8235 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
8240 fprintf(fff, _("《失敗したクエスト》\n", "< Failed Quest >\n"));
8241 for (i = 1; i < max_quests; i++)
8243 int q_idx = quest_num[i];
8244 quest_type* const q_ptr = &quest[q_idx];
8246 if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) &&
8247 do_cmd_knowledge_quests_aux(fff, q_idx))
8252 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8257 * Print all random quests
8259 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
8265 fprintf(fff, _("《残りのランダムクエスト》\n", "< Remaining Random Quest >\n"));
8266 for (i = 1; i < max_quests; i++)
8268 /* No info from "silent" quests */
8269 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8271 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
8275 /* Print the quest info */
8277 sprintf(tmp_str, " %s (%d階, %s)\n",
8278 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
8280 sprintf(tmp_str, " %s (%d, %s)\n",
8281 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
8283 fputs(tmp_str, fff);
8286 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
8290 bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
8292 int *q_num = (int *)u;
8293 quest_type *qa = &quest[q_num[a]];
8294 quest_type *qb = &quest[q_num[b]];
8299 return (qa->comptime <= qb->comptime);
8302 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
8304 int *q_num = (int *)u;
8311 q_num[a] = q_num[b];
8317 * Print quest status of all active quests
8319 static void do_cmd_knowledge_quests(void)
8322 char file_name[1024];
8323 int *quest_num, dummy, i;
8325 /* Open a new file */
8326 fff = my_fopen_temp(file_name, 1024);
8329 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8334 /* Allocate Memory */
8335 C_MAKE(quest_num, max_quests, int);
8337 /* Sort by compete level */
8338 for (i = 1; i < max_quests; i++) quest_num[i] = i;
8339 ang_sort_comp = ang_sort_comp_quest_num;
8340 ang_sort_swap = ang_sort_swap_quest_num;
8341 ang_sort(quest_num, &dummy, max_quests);
8343 /* Dump Quest Information */
8344 do_cmd_knowledge_quests_current(fff);
8346 do_cmd_knowledge_quests_completed(fff, quest_num);
8348 do_cmd_knowledge_quests_failed(fff, quest_num);
8352 do_cmd_knowledge_quests_wiz_random(fff);
8355 /* Close the file */
8358 /* Display the file contents */
8359 show_file(TRUE, file_name, _("クエスト達成状況", "Quest status"), 0, 0);
8361 /* Remove the file */
8365 C_KILL(quest_num, max_quests, int);
8372 static void do_cmd_knowledge_home(void)
8377 char file_name[1024];
8379 char o_name[MAX_NLEN];
8382 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
8384 /* Open a new file */
8385 fff = my_fopen_temp(file_name, 1024);
8387 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8394 /* Print all homes in the different towns */
8395 st_ptr = &town[1].store[STORE_HOME];
8397 /* Home -- if anything there */
8398 if (st_ptr->stock_num)
8403 /* Header with name of the town */
8404 fprintf(fff, _(" [ 我が家のアイテム ]\n", " [Home Inventory]\n"));
8406 /* Dump all available items */
8407 for (i = 0; i < st_ptr->stock_num; i++)
8410 if ((i % 12) == 0) fprintf(fff, "\n ( %d ページ )\n", x++);
8411 object_desc(o_name, &st_ptr->stock[i], 0);
8412 if (strlen(o_name) <= 80-3)
8414 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8420 for (n = 0, t = o_name; n < 80-3; n++, t++)
8421 if(iskanji(*t)) {t++; n++;}
8422 if (n == 81-3) n = 79-3; /* 最後が漢字半分 */
8424 fprintf(fff, "%c%s %.*s\n", I2A(i%12), paren, n, o_name);
8425 fprintf(fff, " %.77s\n", o_name+n);
8428 object_desc(o_name, &st_ptr->stock[i], 0);
8429 fprintf(fff, "%c%s %s\n", I2A(i%12), paren, o_name);
8434 /* Add an empty line */
8435 fprintf(fff, "\n\n");
8439 /* Close the file */
8442 /* Display the file contents */
8443 show_file(TRUE, file_name, _("我が家のアイテム", "Home Inventory"), 0, 0);
8445 /* Remove the file */
8451 * Check the status of "autopick"
8453 static void do_cmd_knowledge_autopick(void)
8457 char file_name[1024];
8459 /* Open a new file */
8460 fff = my_fopen_temp(file_name, 1024);
8464 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
8471 fprintf(fff, _("自動破壊/拾いには何も登録されていません。", "No preference for auto picker/destroyer."));
8475 fprintf(fff, _(" 自動拾い/破壊には現在 %d行登録されています。\n\n",
8476 " There are %d registered lines for auto picker/destroyer.\n\n"), max_autopick);
8479 for (k = 0; k < max_autopick; k++)
8482 byte act = autopick_list[k].action;
8483 if (act & DONT_AUTOPICK)
8485 tmp = _("放置", "Leave");
8487 else if (act & DO_AUTODESTROY)
8489 tmp = _("破壊", "Destroy");
8491 else if (act & DO_AUTOPICK)
8493 tmp = _("拾う", "Pickup");
8495 else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */
8497 tmp = _("確認", "Query");
8500 if (act & DO_DISPLAY)
8501 fprintf(fff, "%11s", format("[%s]", tmp));
8503 fprintf(fff, "%11s", format("(%s)", tmp));
8505 tmp = autopick_line_from_entry(&autopick_list[k]);
8506 fprintf(fff, " %s", tmp);
8510 /* Close the file */
8512 /* Display the file contents */
8513 show_file(TRUE, file_name, _("自動拾い/破壊 設定リスト", "Auto-picker/Destroyer"), 0, 0);
8515 /* Remove the file */
8521 * Interact with "knowledge"
8523 void do_cmd_knowledge(void)
8526 bool need_redraw = FALSE;
8528 /* File type is "TEXT" */
8529 FILE_TYPE(FILE_TYPE_TEXT);
8531 /* Save the screen */
8534 /* Interact until done */
8540 /* Ask for a choice */
8542 prt(format("%d/2 ページ", (p+1)), 2, 65);
8543 prt("現在の知識を確認する", 3, 0);
8545 prt(format("page %d/2", (p+1)), 2, 65);
8546 prt("Display current knowledge", 3, 0);
8549 /* Give some choices */
8553 prt("(1) 既知の伝説のアイテム の一覧", 6, 5);
8554 prt("(2) 既知のアイテム の一覧", 7, 5);
8555 prt("(3) 既知の生きているユニーク・モンスター の一覧", 8, 5);
8556 prt("(4) 既知のモンスター の一覧", 9, 5);
8557 prt("(5) 倒した敵の数 の一覧", 10, 5);
8558 if (!vanilla_town) prt("(6) 賞金首 の一覧", 11, 5);
8559 prt("(7) 現在のペット の一覧", 12, 5);
8560 prt("(8) 我が家のアイテム の一覧", 13, 5);
8561 prt("(9) *鑑定*済み装備の耐性 の一覧", 14, 5);
8562 prt("(0) 地形の表示文字/タイル の一覧", 15, 5);
8566 prt("(a) 自分に関する情報 の一覧", 6, 5);
8567 prt("(b) 突然変異 の一覧", 7, 5);
8568 prt("(c) 武器の経験値 の一覧", 8, 5);
8569 prt("(d) 魔法の経験値 の一覧", 9, 5);
8570 prt("(e) 技能の経験値 の一覧", 10, 5);
8571 prt("(f) プレイヤーの徳 の一覧", 11, 5);
8572 prt("(g) 入ったダンジョン の一覧", 12, 5);
8573 prt("(h) 実行中のクエスト の一覧", 13, 5);
8574 prt("(i) 現在の自動拾い/破壊設定 の一覧", 14, 5);
8579 prt("(1) Display known artifacts", 6, 5);
8580 prt("(2) Display known objects", 7, 5);
8581 prt("(3) Display remaining uniques", 8, 5);
8582 prt("(4) Display known monster", 9, 5);
8583 prt("(5) Display kill count", 10, 5);
8584 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
8585 prt("(7) Display current pets", 12, 5);
8586 prt("(8) Display home inventory", 13, 5);
8587 prt("(9) Display *identified* equip.", 14, 5);
8588 prt("(0) Display terrain symbols.", 15, 5);
8592 prt("(a) Display about yourself", 6, 5);
8593 prt("(b) Display mutations", 7, 5);
8594 prt("(c) Display weapon proficiency", 8, 5);
8595 prt("(d) Display spell proficiency", 9, 5);
8596 prt("(e) Display misc. proficiency", 10, 5);
8597 prt("(f) Display virtues", 11, 5);
8598 prt("(g) Display dungeons", 12, 5);
8599 prt("(h) Display current quests", 13, 5);
8600 prt("(i) Display auto pick/destroy", 14, 5);
8606 prt("ESC) 抜ける", 21, 1);
8607 prt("SPACE) 次ページ", 21, 30);
8608 /*prt("-) 前ページ", 21, 60);*/
8609 prt("コマンド:", 20, 0);
8611 prt("-more-", 17, 8);
8612 prt("ESC) Exit menu", 21, 1);
8613 prt("SPACE) Next page", 21, 30);
8614 /*prt("-) Previous page", 21, 60);*/
8615 prt("Command: ", 20, 0);
8622 if (i == ESCAPE) break;
8625 case ' ': /* Page change */
8629 case '1': /* Artifacts */
8630 do_cmd_knowledge_artifacts();
8632 case '2': /* Objects */
8633 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
8635 case '3': /* Uniques */
8636 do_cmd_knowledge_uniques();
8638 case '4': /* Monsters */
8639 do_cmd_knowledge_monsters(&need_redraw, FALSE, -1);
8641 case '5': /* Kill count */
8642 do_cmd_knowledge_kill_count();
8644 case '6': /* wanted */
8645 if (!vanilla_town) do_cmd_knowledge_kubi();
8647 case '7': /* Pets */
8648 do_cmd_knowledge_pets();
8650 case '8': /* Home */
8651 do_cmd_knowledge_home();
8653 case '9': /* Resist list */
8654 do_cmd_knowledge_inven();
8656 case '0': /* Feature list */
8658 int lighting_level = F_LIT_STANDARD;
8659 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
8663 case 'a': /* Max stat */
8664 do_cmd_knowledge_stat();
8666 case 'b': /* Mutations */
8667 do_cmd_knowledge_mutations();
8669 case 'c': /* weapon-exp */
8670 do_cmd_knowledge_weapon_exp();
8672 case 'd': /* spell-exp */
8673 do_cmd_knowledge_spell_exp();
8675 case 'e': /* skill-exp */
8676 do_cmd_knowledge_skill_exp();
8678 case 'f': /* Virtues */
8679 do_cmd_knowledge_virtues();
8681 case 'g': /* Dungeon */
8682 do_cmd_knowledge_dungeon();
8684 case 'h': /* Quests */
8685 do_cmd_knowledge_quests();
8687 case 'i': /* Autopick */
8688 do_cmd_knowledge_autopick();
8690 default: /* Unknown option */
8694 /* Flush messages */
8698 /* Restore the screen */
8701 if (need_redraw) do_cmd_redraw();
8706 * Check on the status of an active quest
8708 void do_cmd_checkquest(void)
8710 /* File type is "TEXT" */
8711 FILE_TYPE(FILE_TYPE_TEXT);
8713 /* Save the screen */
8717 do_cmd_knowledge_quests();
8719 /* Restore the screen */
8725 * Display the time and date
8727 void do_cmd_time(void)
8729 int day, hour, min, full, start, end, num;
8737 extract_day_hour_min(&day, &hour, &min);
8739 full = hour * 100 + min;
8746 strcpy(desc, _("変な時刻だ。", "It is a strange time."));
8748 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
8749 else strcpy(day_buf, "*****");
8753 msg_format("%s日目, 時刻は%d:%02d %sです。",
8754 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
8755 min, (hour < 12) ? "AM" : "PM");
8757 msg_format("This is day %s. The time is %d:%02d %s.",
8758 day_buf, (hour % 12 == 0) ? 12 : (hour % 12),
8759 min, (hour < 12) ? "AM" : "PM");
8764 if (!randint0(10) || p_ptr->image)
8766 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timefun_j.txt", "timefun.txt"));
8770 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timenorm_j.txt", "timenorm.txt"));
8773 /* Open this file */
8774 fff = my_fopen(buf, "rt");
8779 /* Find this time */
8780 while (!my_fgets(fff, buf, sizeof(buf)))
8782 /* Ignore comments */
8783 if (!buf[0] || (buf[0] == '#')) continue;
8785 /* Ignore invalid lines */
8786 if (buf[1] != ':') continue;
8788 /* Process 'Start' */
8791 /* Extract the starting time */
8792 start = atoi(buf + 2);
8794 /* Assume valid for an hour */
8804 /* Extract the ending time */
8805 end = atoi(buf + 2);
8811 /* Ignore incorrect range */
8812 if ((start > full) || (full > end)) continue;
8814 /* Process 'Description' */
8819 /* Apply the randomizer */
8820 if (!randint0(num)) strcpy(desc, buf + 2);
8830 /* Close the file */