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.
54 #include "cmd-spell.h"
58 #include "player-effects.h"
59 #include "player-status.h"
60 #include "player-skill.h"
61 #include "player-personality.h"
68 #include "object-flavor.h"
69 #include "object-hook.h"
71 #include "monster-status.h"
73 #include "view-mainwindow.h"
74 #include "dungeon-file.h"
76 #include "player-class.h"
77 #include "player-move.h"
79 #include "objectkind.h"
80 #include "floor-town.h"
82 #include "view-mainwindow.h"
87 * Mark strings for auto dump
89 static char auto_dump_header[] = "# vvvvvvv== %s ==vvvvvvv";
90 static char auto_dump_footer[] = "# ^^^^^^^== %s ==^^^^^^^";
93 * Variables for auto dump
95 static FILE *auto_dump_stream;
96 static concptr auto_dump_mark;
97 static int auto_dump_line_num;
99 static void do_cmd_knowledge_monsters(player_type *creature_ptr, bool *need_redraw, bool visual_only, IDX direct_r_idx);
100 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx);
101 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level);
107 * @brief prf出力内容を消去する /
108 * Remove old lines automatically generated before.
109 * @param orig_file 消去を行うファイル名
111 static void remove_auto_dump(concptr orig_file)
113 FILE *tmp_fff, *orig_fff;
117 bool between_mark = FALSE;
118 bool changed = FALSE;
120 long header_location = 0;
121 char header_mark_str[80];
122 char footer_mark_str[80];
125 /* Prepare a header/footer mark string */
126 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
127 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
129 mark_len = strlen(footer_mark_str);
131 /* Open an old dump file in read-only mode */
132 orig_fff = my_fopen(orig_file, "r");
134 /* If original file does not exist, nothing to do */
135 if (!orig_fff) return;
137 /* Open a new (temporary) file */
138 tmp_fff = my_fopen_temp(tmp_file, 1024);
142 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), tmp_file);
147 /* Loop for every line */
151 if (my_fgets(orig_fff, buf, sizeof(buf)))
153 /* Read error: Assume End of File */
156 * Was looking for the footer, but not found.
158 * Since automatic dump might be edited by hand,
159 * it's dangerous to kill these lines.
160 * Seek back to the next line of the (pseudo) header,
165 fseek(orig_fff, header_location, SEEK_SET);
166 between_mark = FALSE;
170 /* Success -- End the loop */
177 /* We are looking for the header mark of automatic dump */
180 /* Is this line a header? */
181 if (!strcmp(buf, header_mark_str))
183 /* Memorise seek point of this line */
184 header_location = ftell(orig_fff);
186 /* Initialize counter for number of lines */
189 /* Look for the footer from now */
192 /* There are some changes */
199 /* Copy orginally lines */
200 fprintf(tmp_fff, "%s\n", buf);
206 /* todo 処理よりもコメントが邪魔でif文を反転できない*/
207 /* We are looking for the footer mark of automatic dump */
208 /* Is this line a footer? */
209 if (!strncmp(buf, footer_mark_str, mark_len))
214 * Compare the number of lines
216 * If there is an inconsistency between
217 * actual number of lines and the
218 * number here, the automatic dump
219 * might be edited by hand. So it's
220 * dangerous to kill these lines.
221 * Seek back to the next line of the
222 * (pseudo) header, and read again.
224 if (!sscanf(buf + mark_len, " (%d)", &tmp)
227 fseek(orig_fff, header_location, SEEK_SET);
230 /* Look for another header */
231 between_mark = FALSE;
236 /* Ignore old line, and count number of lines */
244 /* If there are some changes, overwrite the original file with new one */
247 /* Copy contents of temporary file */
249 tmp_fff = my_fopen(tmp_file, "r");
250 orig_fff = my_fopen(orig_file, "w");
252 while (!my_fgets(tmp_fff, buf, sizeof(buf)))
253 fprintf(orig_fff, "%s\n", buf);
259 /* Kill the temporary file */
265 * @brief prfファイルのフォーマットに従った内容を出力する /
266 * Dump a formatted line, using "vstrnfmt()".
269 static void auto_dump_printf(concptr fmt, ...)
276 /* Begin the Varargs Stuff */
279 /* Format the args, save the length */
280 (void)vstrnfmt(buf, sizeof(buf), fmt, vp);
282 /* End the Varargs Stuff */
285 /* Count number of lines */
286 for (p = buf; *p; p++)
288 if (*p == '\n') auto_dump_line_num++;
292 fprintf(auto_dump_stream, "%s", buf);
297 * @brief prfファイルをファイルオープンする /
298 * Open file to append auto dump.
300 * @param mark 出力するヘッダマーク
301 * @return ファイルポインタを取得できたらTRUEを返す
303 static bool open_auto_dump(concptr buf, concptr mark)
305 char header_mark_str[80];
307 /* Save the mark string */
308 auto_dump_mark = mark;
310 /* Prepare a header mark string */
311 sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
313 /* Remove old macro dumps */
314 remove_auto_dump(buf);
316 /* Append to the file */
317 auto_dump_stream = my_fopen(buf, "a");
320 if (!auto_dump_stream)
322 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
330 fprintf(auto_dump_stream, "%s\n", header_mark_str);
332 /* Initialize counter */
333 auto_dump_line_num = 0;
335 auto_dump_printf(_("# *警告!!* 以降の行は自動生成されたものです。\n",
336 "# *Warning!* The lines below are an automatic dump.\n"));
337 auto_dump_printf(_("# *警告!!* 後で自動的に削除されるので編集しないでください。\n",
338 "# Don't edit them; changes will be deleted and replaced automatically.\n"));
343 * @brief prfファイルをファイルクローズする /
344 * Append foot part and close auto dump.
347 static void close_auto_dump(void)
349 char footer_mark_str[80];
351 /* Prepare a footer mark string */
352 sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
354 auto_dump_printf(_("# *警告!!* 以降の行は自動生成されたものです。\n",
355 "# *Warning!* The lines below are an automatic dump.\n"));
356 auto_dump_printf(_("# *警告!!* 後で自動的に削除されるので編集しないでください。\n",
357 "# Don't edit them; changes will be deleted and replaced automatically.\n"));
359 fprintf(auto_dump_stream, "%s (%d)\n", footer_mark_str, auto_dump_line_num);
362 my_fclose(auto_dump_stream);
371 * @brief Return suffix of ordinal number
373 * @return pointer of suffix string.
375 concptr get_ordinal_number_suffix(int num)
377 num = ABS(num) % 100;
381 return (num == 11) ? "th" : "st";
383 return (num == 12) ? "th" : "nd";
385 return (num == 13) ? "th" : "rd";
394 * @brief 日記にメッセージを追加する /
395 * Take note to the diary.
396 * @param type 日記内容のID
397 * @param num 日記内容のIDに応じた数値
398 * @param note 日記内容のIDに応じた文字列参照ポインタ
401 errr exe_write_diary(player_type *creature_ptr, int type, int num, concptr note)
405 GAME_TEXT file_name[MAX_NLEN];
407 concptr note_level = "";
408 bool do_level = TRUE;
409 char note_level_buf[40];
412 static bool disable_nikki = FALSE;
414 extract_day_hour_min(&day, &hour, &min);
416 if (disable_nikki) return(-1);
418 if (type == NIKKI_FIX_QUEST_C ||
419 type == NIKKI_FIX_QUEST_F ||
420 type == NIKKI_RAND_QUEST_C ||
421 type == NIKKI_RAND_QUEST_F ||
422 type == NIKKI_TO_QUEST)
426 old_quest = creature_ptr->current_floor_ptr->inside_quest;
427 creature_ptr->current_floor_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num;
429 /* Get the quest text */
430 init_flags = INIT_NAME_ONLY;
432 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
434 /* Reset the old quest number */
435 creature_ptr->current_floor_ptr->inside_quest = old_quest;
438 /* different filne name to avoid mixing */
439 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
440 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
442 /* File type is "TEXT" */
443 FILE_TYPE(FILE_TYPE_TEXT);
445 fff = my_fopen(buf, "a");
450 msg_format(_("%s を開くことができませんでした。プレイ記録を一時停止します。", "Failed to open %s. Play-Record is disabled temporally."), buf);
456 q_idx = quest_number(creature_ptr->current_floor_ptr->dun_level);
460 if (creature_ptr->current_floor_ptr->inside_arena)
461 note_level = _("アリーナ:", "Arane:");
462 else if (!creature_ptr->current_floor_ptr->dun_level)
463 note_level = _("地上:", "Surface:");
464 else if (q_idx && (is_fixed_quest_idx(q_idx)
465 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
466 note_level = _("クエスト:", "Quest:");
470 sprintf(note_level_buf, "%d階(%s):", (int)creature_ptr->current_floor_ptr->dun_level, d_name+d_info[creature_ptr->dungeon_idx].name);
472 sprintf(note_level_buf, "%s L%d:", d_name+d_info[creature_ptr->dungeon_idx].name, (int)creature_ptr->current_floor_ptr->dun_level);
474 note_level = note_level_buf;
482 if (day < MAX_DAYS) fprintf(fff, _("%d日目\n", "Day %d\n"), day);
483 else fputs(_("*****日目\n", "Day *****\n"), fff);
491 fprintf(fff, "%s\n",note);
495 fprintf(fff, " %2d:%02d %20s %s\n",hour, min, note_level, note);
500 fprintf(fff, _(" %2d:%02d %20s %sを発見した。\n", " %2d:%02d %20s discovered %s.\n"), hour, min, note_level, note);
503 case NIKKI_ART_SCROLL:
505 fprintf(fff, _(" %2d:%02d %20s 巻物によって%sを生成した。\n", " %2d:%02d %20s created %s by scroll.\n"), hour, min, note_level, note);
510 fprintf(fff, _(" %2d:%02d %20s %sを倒した。\n", " %2d:%02d %20s defeated %s.\n"), hour, min, note_level, note);
513 case NIKKI_FIX_QUEST_C:
515 if (quest[num].flags & QUEST_FLAG_SILENT) break;
516 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」を達成した。\n",
517 " %2d:%02d %20s completed quest '%s'.\n"), hour, min, note_level, quest[num].name);
520 case NIKKI_FIX_QUEST_F:
522 if (quest[num].flags & QUEST_FLAG_SILENT) break;
523 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」から命からがら逃げ帰った。\n",
524 " %2d:%02d %20s run away from quest '%s'.\n"), hour, min, note_level, quest[num].name);
527 case NIKKI_RAND_QUEST_C:
529 GAME_TEXT name[MAX_NLEN];
530 strcpy(name, r_name+r_info[quest[num].r_idx].name);
531 fprintf(fff, _(" %2d:%02d %20s ランダムクエスト(%s)を達成した。\n",
532 " %2d:%02d %20s completed random quest '%s'\n"), hour, min, note_level, name);
535 case NIKKI_RAND_QUEST_F:
537 GAME_TEXT name[MAX_NLEN];
538 strcpy(name, r_name+r_info[quest[num].r_idx].name);
539 fprintf(fff, _(" %2d:%02d %20s ランダムクエスト(%s)から逃げ出した。\n",
540 " %2d:%02d %20s ran away from quest '%s'.\n"), hour, min, note_level, name);
543 case NIKKI_MAXDEAPTH:
545 fprintf(fff, _(" %2d:%02d %20s %sの最深階%d階に到達した。\n",
546 " %2d:%02d %20s reached level %d of %s for the first time.\n"), hour, min, note_level,
547 _(d_name+d_info[creature_ptr->dungeon_idx].name, num),
548 _(num, d_name+d_info[creature_ptr->dungeon_idx].name));
553 fprintf(fff, _(" %2d:%02d %20s %s%sの最深階を%d階にセットした。\n",
554 " %2d:%02d %20s reset recall level of %s to %d %s.\n"), hour, min, note_level, note,
555 _(d_name + d_info[num].name, (int)max_dlv[num]),
556 _((int)max_dlv[num], d_name + d_info[num].name));
562 if (q_idx && (is_fixed_quest_idx(q_idx)
563 && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT))))
565 to = _("地上", "the surface");
569 if (!(creature_ptr->current_floor_ptr->dun_level+num)) to = _("地上", "the surface");
570 else to = format(_("%d階", "level %d"), creature_ptr->current_floor_ptr->dun_level+num);
572 fprintf(fff, _(" %2d:%02d %20s %sへ%s。\n", " %2d:%02d %20s %s %s.\n"), hour, min, note_level, _(to, note), _(note, to));
578 fprintf(fff, _(" %2d:%02d %20s 帰還を使って%sの%d階へ下りた。\n", " %2d:%02d %20s recalled to dungeon level %d of %s.\n"),
579 hour, min, note_level, _(d_name+d_info[creature_ptr->dungeon_idx].name, (int)max_dlv[creature_ptr->dungeon_idx]),
580 _((int)max_dlv[creature_ptr->dungeon_idx], d_name+d_info[creature_ptr->dungeon_idx].name));
582 fprintf(fff, _(" %2d:%02d %20s 帰還を使って地上へと戻った。\n", " %2d:%02d %20s recalled from dungeon to surface.\n"), hour, min, note_level);
587 if (quest[num].flags & QUEST_FLAG_SILENT) break;
588 fprintf(fff, _(" %2d:%02d %20s クエスト「%s」へと突入した。\n", " %2d:%02d %20s entered the quest '%s'.\n"),
589 hour, min, note_level, quest[num].name);
594 fprintf(fff, _(" %2d:%02d %20s レベル・テレポートで脱出した。\n", " %2d:%02d %20s Got out using teleport level.\n"),
595 hour, min, note_level);
600 fprintf(fff, _(" %2d:%02d %20s %sを購入した。\n", " %2d:%02d %20s bought %s.\n"), hour, min, note_level, note);
605 fprintf(fff, _(" %2d:%02d %20s %sを売却した。\n", " %2d:%02d %20s sold %s.\n"), hour, min, note_level, note);
613 fprintf(fff, _(" %2d:%02d %20s 闘技場の%d%s回戦で、%sの前に敗れ去った。\n", " %2d:%02d %20s beaten by %s in the %d%s fight.\n"),
614 hour, min, note_level, _(n, note), _("", n), _(note, get_ordinal_number_suffix(n)));
617 fprintf(fff, _(" %2d:%02d %20s 闘技場の%d%s回戦(%s)に勝利した。\n", " %2d:%02d %20s won the %d%s fight (%s).\n"),
618 hour, min, note_level, num, _("", get_ordinal_number_suffix(num)), note);
620 if (num == MAX_ARENA_MONS)
622 fprintf(fff, _(" 闘技場のすべての敵に勝利し、チャンピオンとなった。\n",
623 " won all fight to become a Chanpion.\n"));
630 fprintf(fff, _(" %2d:%02d %20s %sを識別した。\n", " %2d:%02d %20s identified %s.\n"), hour, min, note_level, note);
636 if (!creature_ptr->current_floor_ptr->dun_level)
637 to = _("地上", "the surface");
639 to = format(_("%d階(%s)", "level %d of %s"), creature_ptr->current_floor_ptr->dun_level, d_name+d_info[creature_ptr->dungeon_idx].name);
641 fprintf(fff, _(" %2d:%02d %20s %sへとウィザード・テレポートで移動した。\n",
642 " %2d:%02d %20s wizard-teleport to %s.\n"), hour, min, note_level, to);
648 if (!creature_ptr->current_floor_ptr->dun_level)
649 to = _("地上", "the surface");
651 to = format(_("%d階(%s)", "level %d of %s"), creature_ptr->current_floor_ptr->dun_level, d_name+d_info[creature_ptr->dungeon_idx].name);
653 fprintf(fff, _(" %2d:%02d %20s %sへとパターンの力で移動した。\n",
654 " %2d:%02d %20s used Pattern to teleport to %s.\n"), hour, min, note_level, to);
659 fprintf(fff, _(" %2d:%02d %20s レベルが%dに上がった。\n", " %2d:%02d %20s reached player level %d.\n"), hour, min, note_level, num);
662 case NIKKI_GAMESTART:
664 time_t ct = time((time_t*)0);
668 fprintf(fff, "%s %s",note, ctime(&ct));
671 fprintf(fff, " %2d:%02d %20s %s %s",hour, min, note_level, note, ctime(&ct));
674 case NIKKI_NAMED_PET:
676 fprintf(fff, " %2d:%02d %20s ", hour, min, note_level);
679 case RECORD_NAMED_PET_NAME:
680 fprintf(fff, _("%sを旅の友にすることに決めた。\n", "decided to travel together with %s.\n"), note);
682 case RECORD_NAMED_PET_UNNAME:
683 fprintf(fff, _("%sの名前を消した。\n", "unnamed %s.\n"), note);
685 case RECORD_NAMED_PET_DISMISS:
686 fprintf(fff, _("%sを解放した。\n", "dismissed %s.\n"), note);
688 case RECORD_NAMED_PET_DEATH:
689 fprintf(fff, _("%sが死んでしまった。\n", "%s died.\n"), note);
691 case RECORD_NAMED_PET_MOVED:
692 fprintf(fff, _("%sをおいて別のマップへ移動した。\n", "moved to another map leaving %s behind.\n"), note);
694 case RECORD_NAMED_PET_LOST_SIGHT:
695 fprintf(fff, _("%sとはぐれてしまった。\n", "lost sight of %s.\n"), note);
697 case RECORD_NAMED_PET_DESTROY:
698 fprintf(fff, _("%sが*破壊*によって消え去った。\n", "%s was made disappeared by *destruction*.\n"), note);
700 case RECORD_NAMED_PET_EARTHQUAKE:
701 fprintf(fff, _("%sが岩石に押し潰された。\n", "%s was crushed by falling rocks.\n"), note);
703 case RECORD_NAMED_PET_GENOCIDE:
704 fprintf(fff, _("%sが抹殺によって消え去った。\n", "%s was made disappeared by genocide.\n"), note);
706 case RECORD_NAMED_PET_WIZ_ZAP:
707 fprintf(fff, _("%sがデバッグコマンドによって消え去った。\n", "%s was removed by debug command.\n"), note);
709 case RECORD_NAMED_PET_TELE_LEVEL:
710 fprintf(fff, _("%sがテレポート・レベルによって消え去った。\n", "%s was made disappeared by teleport level.\n"), note);
712 case RECORD_NAMED_PET_BLAST:
713 fprintf(fff, _("%sを爆破した。\n", "blasted %s.\n"), note);
715 case RECORD_NAMED_PET_HEAL_LEPER:
716 fprintf(fff, _("%sの病気が治り旅から外れた。\n", "%s was healed and left.\n"), note);
718 case RECORD_NAMED_PET_COMPACT:
719 fprintf(fff, _("%sがモンスター情報圧縮によって消え去った。\n", "%s was made disappeared by compacting monsters.\n"), note);
721 case RECORD_NAMED_PET_LOSE_PARENT:
722 fprintf(fff, _("%sの召喚者が既にいないため消え去った。\n", "%s disappeared because there does not exist summoner.\n"), note);
733 case NIKKI_WIZARD_LOG:
734 fprintf(fff, "%s\n", note);
743 if (do_level) write_level = FALSE;
749 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
752 * @brief 日記のタイトル表記と内容出力 /
755 * 日記のタイトルは本関数の subtitle ローカル変数で定義されている。
757 static void display_diary(player_type *creature_ptr)
759 char nikki_title[256];
760 GAME_TEXT file_name[MAX_NLEN];
765 static const char subtitle[][30] = {"最強の肉体を求めて",
796 static const char subtitle[][51] ={"Quest of The World's Toughest Body",
797 "Attack is the best form of defence.",
799 "An unexpected windfall",
800 "A drowning man will catch at a straw",
801 "Don't count your chickens before they are hatched.",
802 "It is no use crying over spilt milk.",
803 "Seeing is believing.",
804 "Strike the iron while it is hot.",
805 "I don't care what follows.",
806 "To dig a well to put out a house on fire.",
807 "Tomorrow is another day.",
808 "Easy come, easy go.",
809 "The more haste, the less speed.",
810 "Where there is life, there is hope.",
811 "There is no royal road to *WINNER*.",
812 "Danger past, God forgotten.",
813 "The best thing to do now is to run away.",
814 "Life is but an empty dream.",
815 "Dead men tell no tales.",
816 "A book that remains shut is but a block.",
817 "Misfortunes never come singly.",
818 "A little knowledge is a dangerous thing.",
819 "History repeats itself.",
820 "*WINNER* was not built in a day.",
821 "Ignorance is bliss.",
822 "To lose is to win?",
823 "No medicine can cure folly.",
824 "All good things come to an end.",
825 "M$ Empire strikes back.",
826 "To see is to believe",
828 "Quest of The World's Greatest Brain"};
830 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
831 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
833 if (creature_ptr->pclass == CLASS_WARRIOR || creature_ptr->pclass == CLASS_MONK || creature_ptr->pclass == CLASS_SAMURAI || creature_ptr->pclass == CLASS_BERSERKER)
834 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
835 else if (IS_WIZARD_CLASS(creature_ptr))
836 strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
837 else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
840 sprintf(nikki_title, "「%s%s%sの伝説 -%s-」", ap_ptr->title, ap_ptr->no ? "の" : "", creature_ptr->name, tmp);
842 sprintf(nikki_title, "Legend of %s %s '%s'", ap_ptr->title, creature_ptr->name, tmp);
845 /* Display the file contents */
846 show_file(FALSE, buf, nikki_title, -1, 0);
850 * @brief 日記に任意の内容を表記するコマンドのメインルーチン /
853 static void add_diary_note(player_type *creature_ptr)
856 char bunshou[80] = "\0";
858 if (get_string(_("内容: ", "diary note: "), tmp, 79))
860 strcpy(bunshou, tmp);
861 exe_write_diary(creature_ptr, NIKKI_BUNSHOU, 0, bunshou);
866 * @brief 最後に取得したアイテムの情報を日記に追加するメインルーチン /
869 static void do_cmd_last_get(player_type *creaute_ptr)
874 if (record_o_name[0] == '\0') return;
876 sprintf(buf,_("%sの入手を記録します。", "Do you really want to record getting %s? "),record_o_name);
877 if (!get_check(buf)) return;
879 turn_tmp = current_world_ptr->game_turn;
880 current_world_ptr->game_turn = record_turn;
881 sprintf(buf,_("%sを手に入れた。", "descover %s."), record_o_name);
882 exe_write_diary(creaute_ptr, NIKKI_BUNSHOU, 0, buf);
883 current_world_ptr->game_turn = turn_tmp;
887 * @brief ファイル中の全日記記録を消去する /
890 static void do_cmd_erase_nikki(void)
892 GAME_TEXT file_name[MAX_NLEN];
896 if (!get_check(_("本当に記録を消去しますか?", "Do you really want to delete all your record? "))) return;
897 sprintf(file_name,_("playrecord-%s.txt", "playrec-%s.txt"),savefile_base);
898 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
901 fff = my_fopen(buf, "w");
905 msg_format(_("記録を消去しました。", "deleted record."));
908 msg_format(_("%s の消去に失敗しました。", "failed to delete %s."), buf);
916 * @param crerature_ptr プレーヤーへの参照ポインタ
919 void do_cmd_nikki(player_type *creature_ptr)
923 /* File type is "TEXT" */
924 FILE_TYPE(FILE_TYPE_TEXT);
927 /* Interact until done */
932 /* Ask for a choice */
933 prt(_("[ 記録の設定 ]", "[ Play Record ]"), 2, 0);
935 /* Give some choices */
936 prt(_("(1) 記録を見る", "(1) Display your record"), 4, 5);
937 prt(_("(2) 文章を記録する", "(2) Add record"), 5, 5);
938 prt(_("(3) 直前に入手又は鑑定したものを記録する", "(3) Record item you last get/identify"), 6, 5);
939 prt(_("(4) 記録を消去する", "(4) Delete your record"), 7, 5);
941 prt(_("(R) プレイ動画を記録する/中止する", "(R) Record playing movie / or stop it"), 9, 5);
944 prt(_("コマンド:", "Command: "), 18, 0);
949 if (i == ESCAPE) break;
954 display_diary(creature_ptr);
957 add_diary_note(creature_ptr);
960 do_cmd_last_get(creature_ptr);
963 do_cmd_erase_nikki();
967 prepare_movie_hooks();
969 default: /* Unknown option */
981 * @brief 画面を再描画するコマンドのメインルーチン
982 * Hack -- redraw the screen
986 * This command performs various low level updates, clears all the "extra"
987 * windows, does a total redraw of the main window, and requests all of the
988 * interesting updates and redraws that I can think of.
990 * This command is also used to "instantiate" the results of the user
991 * selecting various things, such as graphics mode, so it must call
992 * the "TERM_XTRA_REACT" hook before redrawing the windows.
995 void do_cmd_redraw(player_type *creature_ptr)
999 /* Hack -- react to changes */
1000 Term_xtra(TERM_XTRA_REACT, 0);
1002 /* Combine and Reorder the pack (later) */
1003 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
1004 creature_ptr->update |= (PU_TORCH);
1005 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
1006 creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1007 creature_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
1008 creature_ptr->update |= (PU_MONSTERS);
1010 creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1012 creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
1013 creature_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
1019 if (creature_ptr->prace == RACE_ANDROID) calc_android_exp(creature_ptr);
1021 /* Redraw every window */
1022 for (int j = 0; j < 8; j++)
1025 if (!angband_term[j]) continue;
1028 Term_activate(angband_term[j]);
1037 * @brief プレイヤーのステータス表示
1040 void do_cmd_player_status(player_type *creature_ptr)
1051 display_player(creature_ptr, mode);
1056 display_player(creature_ptr, mode);
1060 Term_putstr(2, 23, -1, TERM_WHITE,
1061 _("['c'で名前変更, 'f'でファイルへ書出, 'h'でモード変更, ESCで終了]", "['c' to change name, 'f' to file, 'h' to change mode, or ESC]"));
1065 if (c == ESCAPE) break;
1070 get_name(creature_ptr);
1072 /* Process the player name */
1073 process_player_name(FALSE);
1079 sprintf(tmp, "%s.txt", creature_ptr->base_name);
1080 if (get_string(_("ファイル名: ", "File name: "), tmp, 80))
1082 if (tmp[0] && (tmp[0] != ' '))
1084 file_character(creature_ptr, tmp);
1102 creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
1109 * @brief 最近表示されたメッセージを再表示するコマンドのメインルーチン
1110 * Recall the most recent message
1113 void do_cmd_message_one(void)
1115 /* Recall one message */
1116 prt(format("> %s", message_str(0)), 0, 0);
1121 * @brief メッセージのログを表示するコマンドのメインルーチン
1122 * Recall the most recent message
1126 * Show previous messages to the user -BEN-
1128 * The screen format uses line 0 and 23 for headers and prompts,
1129 * skips line 1 and 22, and uses line 2 thru 21 for old messages.
1131 * This command shows you which commands you are viewing, and allows
1132 * you to "search" for strings in the recall.
1134 * Note that messages may be longer than 80 characters, but they are
1135 * displayed using "infinite" length, with a special sub-command to
1136 * "slide" the virtual display to the left or right.
1138 * Attempt to only hilite the matching portions of the string.
1141 void do_cmd_messages(int num_now)
1143 char shower_str[81];
1144 char finder_str[81];
1146 concptr shower = NULL;
1150 Term_get_size(&wid, &hgt);
1152 /* Number of message lines in a screen */
1153 num_lines = hgt - 4;
1156 strcpy(finder_str, "");
1159 strcpy(shower_str, "");
1161 /* Total messages */
1162 int n = message_num();
1164 /* Start on first message */
1169 /* Process requests until done */
1175 /* Dump up to 20 lines of messages */
1176 for (j = 0; (j < num_lines) && (i + j < n); j++)
1178 concptr msg = message_str(i+j);
1180 /* Dump the messages, bottom to top */
1181 c_prt((i + j < num_now ? TERM_WHITE : TERM_SLATE), msg, num_lines + 1 - j, 0);
1183 if (!shower || !shower[0]) continue;
1185 /* Hilite "shower" */
1188 /* Display matches */
1189 while ((str = my_strstr(str, shower)) != NULL)
1191 int len = strlen(shower);
1193 /* Display the match */
1194 Term_putstr(str - msg, num_lines + 1 - j, len, TERM_YELLOW, shower);
1201 /* Erase remaining lines */
1202 for (; j < num_lines; j++) Term_erase(0, num_lines + 1 - j, 255);
1204 /* Display header */
1206 prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"),
1207 i, i + j - 1, n), 0, 0);
1209 /* Display prompt (not very informative) */
1210 prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]",
1211 "[Press 'p' for older, 'n' for newer, ..., or ESCAPE]"), hgt - 1, 0);
1213 skey = inkey_special(TRUE);
1215 /* Exit on Escape */
1216 if (skey == ESCAPE) break;
1218 /* Hack -- Save the old index */
1223 /* Hack -- handle show */
1226 prt(_("強調: ", "Show: "), hgt - 1, 0);
1228 /* Get a "shower" string, or continue */
1229 strcpy(back_str, shower_str);
1230 if (askfor(shower_str, 80))
1233 shower = shower_str[0] ? shower_str : NULL;
1235 else strcpy(shower_str, back_str);
1239 /* Hack -- handle find */
1246 prt(_("検索: ", "Find: "), hgt - 1, 0);
1248 /* Get a "finder" string, or continue */
1249 strcpy(back_str, finder_str);
1250 if (!askfor(finder_str, 80))
1252 strcpy(finder_str, back_str);
1255 else if (!finder_str[0])
1257 shower = NULL; /* Stop showing */
1262 shower = finder_str;
1265 for (z = i + 1; z < n; z++)
1267 concptr msg = message_str(z);
1270 if (my_strstr(msg, finder_str))
1281 /* Recall 1 older message */
1283 /* Go to the oldest line */
1287 /* Recall 1 newer message */
1289 /* Go to the newest line */
1293 /* Recall 1 older message */
1298 /* Go older if legal */
1299 i = MIN(i + 1, n - num_lines);
1302 /* Recall 10 older messages */
1304 /* Go older if legal */
1305 i = MIN(i + 10, n - num_lines);
1308 /* Recall 20 older messages */
1313 /* Go older if legal */
1314 i = MIN(i + num_lines, n - num_lines);
1317 /* Recall 20 newer messages */
1321 /* Go newer (if able) */
1322 i = MAX(0, i - num_lines);
1325 /* Recall 10 newer messages */
1327 /* Go newer (if able) */
1331 /* Recall 1 newer messages */
1334 /* Go newer (if able) */
1339 /* Hack -- Error of some kind */
1348 * @brief prefファイルを選択して処理する /
1349 * Ask for a "user pref line" and process it
1352 * Allow absolute file names?
1354 void do_cmd_pref(void)
1361 /* Ask for a "user pref command" */
1362 if (!get_string(_("設定変更コマンド: ", "Pref: "), buf, 80)) return;
1364 /* Process that pref command */
1365 (void)process_pref_file_command(buf);
1369 * @brief 自動拾い設定ファイルをロードするコマンドのメインルーチン /
1372 void do_cmd_reload_autopick(void)
1374 if (!get_check(_("自動拾い設定ファイルをロードしますか? ", "Reload auto-pick preference file? "))) return;
1375 /* Load the file with messages */
1376 autopick_load_pref(TRUE);
1382 * @brief マクロ情報をprefファイルに保存する /
1383 * @param fname ファイル名
1386 static errr macro_dump(concptr fname)
1388 static concptr mark = "Macro Dump";
1390 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1392 /* File type is "TEXT" */
1393 FILE_TYPE(FILE_TYPE_TEXT);
1395 /* Append to the file */
1396 if (!open_auto_dump(buf, mark)) return (-1);
1399 auto_dump_printf(_("\n# 自動マクロセーブ\n\n", "\n# Automatic macro dump\n\n"));
1402 for (int i = 0; i < macro__num; i++)
1404 /* Extract the action */
1405 ascii_to_text(buf, macro__act[i]);
1407 /* Dump the macro */
1408 auto_dump_printf("A:%s\n", buf);
1410 /* Extract the action */
1411 ascii_to_text(buf, macro__pat[i]);
1413 /* Dump normal macros */
1414 auto_dump_printf("P:%s\n", buf);
1417 auto_dump_printf("\n");
1426 * @brief マクロのトリガーキーを取得する /
1427 * Hack -- ask for a "trigger" (see below)
1428 * @param buf キー表記を保管するバッファ
1432 * Note the complex use of the "inkey()" function from "util.c".
1434 * Note that both "flush()" calls are extremely important.
1437 static void do_cmd_macro_aux(char *buf)
1445 /* Do not process macros */
1451 /* Read the pattern */
1457 /* Do not process macros */
1460 /* Do not wait for keys */
1463 /* Attempt to read a key */
1472 /* Convert the trigger */
1473 ascii_to_text(tmp, buf);
1475 /* Hack -- display the trigger */
1476 Term_addstr(-1, TERM_WHITE, tmp);
1482 * @brief マクロのキー表記からアスキーコードを得てターミナルに表示する /
1483 * Hack -- ask for a keymap "trigger" (see below)
1484 * @param buf キー表記を取得するバッファ
1488 * Note that both "flush()" calls are extremely important. This may
1489 * no longer be true, since "util.c" is much simpler now.
1492 static void do_cmd_macro_aux_keymap(char *buf)
1502 /* Convert to ascii */
1503 ascii_to_text(tmp, buf);
1505 /* Hack -- display the trigger */
1506 Term_addstr(-1, TERM_WHITE, tmp);
1513 * @brief キーマップをprefファイルにダンプする /
1514 * Hack -- append all keymaps to the given file
1515 * @param fname ファイルネーム
1519 static errr keymap_dump(concptr fname)
1521 static concptr mark = "Keymap Dump";
1528 if (rogue_like_commands)
1530 mode = KEYMAP_MODE_ROGUE;
1536 mode = KEYMAP_MODE_ORIG;
1539 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, fname);
1541 /* File type is "TEXT" */
1542 FILE_TYPE(FILE_TYPE_TEXT);
1544 /* Append to the file */
1545 if (!open_auto_dump(buf, mark)) return -1;
1548 auto_dump_printf(_("\n# 自動キー配置セーブ\n\n", "\n# Automatic keymap dump\n\n"));
1551 for (int i = 0; i < 256; i++)
1555 /* Loop up the keymap */
1556 act = keymap_act[mode][i];
1558 /* Skip empty keymaps */
1561 /* Encode the key */
1564 ascii_to_text(key, buf);
1566 /* Encode the action */
1567 ascii_to_text(buf, act);
1569 /* Dump the macro */
1570 auto_dump_printf("A:%s\n", buf);
1571 auto_dump_printf("C:%d:%s\n", mode, key);
1580 * @brief マクロを設定するコマンドのメインルーチン /
1581 * Interact with "macros"
1585 * Note that the macro "action" must be defined before the trigger.
1587 * Could use some helpful instructions on this page.
1590 void do_cmd_macros(player_type *creature_ptr)
1598 if (rogue_like_commands)
1600 mode = KEYMAP_MODE_ROGUE;
1606 mode = KEYMAP_MODE_ORIG;
1609 /* File type is "TEXT" */
1610 FILE_TYPE(FILE_TYPE_TEXT);
1614 /* Process requests until done */
1618 prt(_("[ マクロの設定 ]", "Interact with Macros"), 2, 0);
1620 /* Describe that action */
1621 prt(_("マクロ行動が(もしあれば)下に表示されます:", "Current action (if any) shown below:"), 20, 0);
1623 /* Analyze the current action */
1624 ascii_to_text(buf, macro__buf);
1626 /* Display the current action */
1631 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
1633 prt(_("(2) ファイルにマクロを追加", "(2) Append macros to a file"), 5, 5);
1634 prt(_("(3) マクロの確認", "(3) Query a macro"), 6, 5);
1635 prt(_("(4) マクロの作成", "(4) Create a macro"), 7, 5);
1636 prt(_("(5) マクロの削除", "(5) Remove a macro"), 8, 5);
1637 prt(_("(6) ファイルにキー配置を追加", "(6) Append keymaps to a file"), 9, 5);
1638 prt(_("(7) キー配置の確認", "(7) Query a keymap"), 10, 5);
1639 prt(_("(8) キー配置の作成", "(8) Create a keymap"), 11, 5);
1640 prt(_("(9) キー配置の削除", "(9) Remove a keymap"), 12, 5);
1641 prt(_("(0) マクロ行動の入力", "(0) Enter a new action"), 13, 5);
1642 #endif /* ALLOW_MACROS */
1645 prt(_("コマンド: ", "Command: "), 16, 0);
1650 if (i == ESCAPE) break;
1652 /* Load a 'macro' file */
1658 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 16, 0);
1661 prt(_("ファイル: ", "File: "), 18, 0);
1663 /* Default filename */
1664 sprintf(tmp, "%s.prf", creature_ptr->base_name);
1666 /* Ask for a file */
1667 if (!askfor(tmp, 80)) continue;
1669 /* Process the given filename */
1670 err = process_pref_file(tmp);
1673 msg_format(_("標準の設定ファイル'%s'を読み込みました。", "Loaded default '%s'."), tmp);
1678 msg_format(_("'%s'の読み込みに失敗しました!", "Failed to load '%s'!"), tmp);
1682 msg_format(_("'%s'を読み込みました。", "Loaded '%s'."), tmp);
1691 prt(_("コマンド: マクロをファイルに追加する", "Command: Append macros to a file"), 16, 0);
1694 prt(_("ファイル: ", "File: "), 18, 0);
1696 /* Default filename */
1697 sprintf(tmp, "%s.prf", creature_ptr->base_name);
1699 /* Ask for a file */
1700 if (!askfor(tmp, 80)) continue;
1702 /* Dump the macros */
1703 (void)macro_dump(tmp);
1706 msg_print(_("マクロを追加しました。", "Appended macros."));
1715 prt(_("コマンド: マクロの確認", "Command: Query a macro"), 16, 0);
1719 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
1721 /* Get a macro trigger */
1722 do_cmd_macro_aux(buf);
1724 /* Acquire action */
1725 k = macro_find_exact(buf);
1731 msg_print(_("そのキーにはマクロは定義されていません。", "Found no macro."));
1737 /* Obtain the action */
1738 strcpy(macro__buf, macro__act[k]);
1740 /* Analyze the current action */
1741 ascii_to_text(buf, macro__buf);
1743 /* Display the current action */
1747 msg_print(_("マクロを確認しました。", "Found a macro."));
1751 /* Create a macro */
1755 prt(_("コマンド: マクロの作成", "Command: Create a macro"), 16, 0);
1758 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
1760 /* Get a macro trigger */
1761 do_cmd_macro_aux(buf);
1765 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
1766 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
1769 prt(_("マクロ行動: ", "Action: "), 20, 0);
1771 /* Convert to text */
1772 ascii_to_text(tmp, macro__buf);
1774 /* Get an encoded action */
1775 if (askfor(tmp, 80))
1777 /* Convert to ascii */
1778 text_to_ascii(macro__buf, tmp);
1780 /* Link the macro */
1781 macro_add(buf, macro__buf);
1784 msg_print(_("マクロを追加しました。", "Added a macro."));
1788 /* Remove a macro */
1792 prt(_("コマンド: マクロの削除", "Command: Remove a macro"), 16, 0);
1795 prt(_("トリガーキー: ", "Trigger: "), 18, 0);
1797 /* Get a macro trigger */
1798 do_cmd_macro_aux(buf);
1800 /* Link the macro */
1801 macro_add(buf, buf);
1804 msg_print(_("マクロを削除しました。", "Removed a macro."));
1811 prt(_("コマンド: キー配置をファイルに追加する", "Command: Append keymaps to a file"), 16, 0);
1814 prt(_("ファイル: ", "File: "), 18, 0);
1816 /* Default filename */
1817 sprintf(tmp, "%s.prf", creature_ptr->base_name);
1819 /* Ask for a file */
1820 if (!askfor(tmp, 80)) continue;
1822 /* Dump the macros */
1823 (void)keymap_dump(tmp);
1826 msg_print(_("キー配置を追加しました。", "Appended keymaps."));
1829 /* Query a keymap */
1835 prt(_("コマンド: キー配置の確認", "Command: Query a keymap"), 16, 0);
1838 prt(_("押すキー: ", "Keypress: "), 18, 0);
1840 /* Get a keymap trigger */
1841 do_cmd_macro_aux_keymap(buf);
1843 /* Look up the keymap */
1844 act = keymap_act[mode][(byte)(buf[0])];
1850 msg_print(_("キー配置は定義されていません。", "Found no keymap."));
1856 /* Obtain the action */
1857 strcpy(macro__buf, act);
1859 /* Analyze the current action */
1860 ascii_to_text(buf, macro__buf);
1862 /* Display the current action */
1866 msg_print(_("キー配置を確認しました。", "Found a keymap."));
1870 /* Create a keymap */
1874 prt(_("コマンド: キー配置の作成", "Command: Create a keymap"), 16, 0);
1877 prt(_("押すキー: ", "Keypress: "), 18, 0);
1879 /* Get a keymap trigger */
1880 do_cmd_macro_aux_keymap(buf);
1884 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
1885 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
1888 prt(_("行動: ", "Action: "), 20, 0);
1890 /* Convert to text */
1891 ascii_to_text(tmp, macro__buf);
1893 /* Get an encoded action */
1894 if (askfor(tmp, 80))
1896 /* Convert to ascii */
1897 text_to_ascii(macro__buf, tmp);
1899 /* Free old keymap */
1900 string_free(keymap_act[mode][(byte)(buf[0])]);
1902 /* Make new keymap */
1903 keymap_act[mode][(byte)(buf[0])] = string_make(macro__buf);
1906 msg_print(_("キー配置を追加しました。", "Added a keymap."));
1910 /* Remove a keymap */
1914 prt(_("コマンド: キー配置の削除", "Command: Remove a keymap"), 16, 0);
1917 prt(_("押すキー: ", "Keypress: "), 18, 0);
1919 /* Get a keymap trigger */
1920 do_cmd_macro_aux_keymap(buf);
1922 /* Free old keymap */
1923 string_free(keymap_act[mode][(byte)(buf[0])]);
1925 /* Make new keymap */
1926 keymap_act[mode][(byte)(buf[0])] = NULL;
1929 msg_print(_("キー配置を削除しました。", "Removed a keymap."));
1932 /* Enter a new action */
1936 prt(_("コマンド: マクロ行動の入力", "Command: Enter a new action"), 16, 0);
1940 c_prt(TERM_L_RED, _("カーソルキーの左右でカーソル位置を移動。BackspaceかDeleteで一文字削除。",
1941 "Press Left/Right arrow keys to move cursor. Backspace/Delete to delete a char."), 22, 0);
1944 prt(_("マクロ行動: ", "Action: "), 20, 0);
1946 /* Hack -- limit the value */
1949 /* Get an encoded action */
1950 if (!askfor(buf, 80)) continue;
1952 /* Extract an action */
1953 text_to_ascii(macro__buf, buf);
1955 #endif /* ALLOW_MACROS */
1970 * @brief キャラクタ色の明暗表現
1972 static concptr lighting_level_str[F_LIT_MAX] =
1987 * @brief キャラクタのビジュアルIDを変更する際の対象指定関数
1988 * @param i 指定対象となるキャラクタコード
1989 * @param num 指定されたビジュアルIDを返す参照ポインタ
1990 * @param max ビジュアルIDの最大数
1991 * @return 指定が実際に行われた場合TRUE、キャンセルされた場合FALSE
1993 static bool cmd_visuals_aux(int i, IDX *num, IDX max)
2000 sprintf(str, "%d", *num);
2002 if (!get_string(format("Input new number(0-%d): ", max-1), str, 4))
2005 tmp = (IDX)strtol(str, NULL, 0);
2006 if (tmp >= 0 && tmp < max)
2009 else if (isupper(i))
2010 *num = (*num + max - 1) % max;
2012 *num = (*num + 1) % max;
2018 * @brief キャラクタの変更メニュー表示
2019 * @param choice_msg 選択メッセージ
2022 static void print_visuals_menu(concptr choice_msg)
2024 prt(_("[ 画面表示の設定 ]", "Interact with Visuals"), 1, 0);
2026 /* Give some choices */
2027 prt(_("(0) ユーザー設定ファイルのロード", "(0) Load a user pref file"), 3, 5);
2029 #ifdef ALLOW_VISUALS
2030 prt(_("(1) モンスターの 色/文字 をファイルに書き出す", "(1) Dump monster attr/chars"), 4, 5);
2031 prt(_("(2) アイテムの 色/文字 をファイルに書き出す", "(2) Dump object attr/chars"), 5, 5);
2032 prt(_("(3) 地形の 色/文字 をファイルに書き出す", "(3) Dump feature attr/chars"), 6, 5);
2033 prt(_("(4) モンスターの 色/文字 を変更する (数値操作)", "(4) Change monster attr/chars (numeric operation)"), 7, 5);
2034 prt(_("(5) アイテムの 色/文字 を変更する (数値操作)", "(5) Change object attr/chars (numeric operation)"), 8, 5);
2035 prt(_("(6) 地形の 色/文字 を変更する (数値操作)", "(6) Change feature attr/chars (numeric operation)"), 9, 5);
2036 prt(_("(7) モンスターの 色/文字 を変更する (シンボルエディタ)", "(7) Change monster attr/chars (visual mode)"), 10, 5);
2037 prt(_("(8) アイテムの 色/文字 を変更する (シンボルエディタ)", "(8) Change object attr/chars (visual mode)"), 11, 5);
2038 prt(_("(9) 地形の 色/文字 を変更する (シンボルエディタ)", "(9) Change feature attr/chars (visual mode)"), 12, 5);
2039 #endif /* ALLOW_VISUALS */
2041 prt(_("(R) 画面表示方法の初期化", "(R) Reset visuals"), 13, 5);
2044 prt(format("コマンド: %s", choice_msg ? choice_msg : _("", "")), 15, 0);
2049 * Interact with "visuals"
2051 void do_cmd_visuals(player_type *creature_ptr)
2056 bool need_redraw = FALSE;
2057 concptr empty_symbol = "<< ? >>";
2059 if (use_bigtile) empty_symbol = "<< ?? >>";
2061 /* File type is "TEXT" */
2062 FILE_TYPE(FILE_TYPE_TEXT);
2065 /* Interact until done */
2070 /* Ask for a choice */
2071 print_visuals_menu(NULL);
2076 if (i == ESCAPE) break;
2080 /* Load a 'pref' file */
2083 prt(_("コマンド: ユーザー設定ファイルのロード", "Command: Load a user pref file"), 15, 0);
2086 prt(_("ファイル: ", "File: "), 17, 0);
2088 /* Default filename */
2089 sprintf(tmp, "%s.prf", creature_ptr->base_name);
2092 if (!askfor(tmp, 70)) continue;
2094 /* Process the given filename */
2095 (void)process_pref_file(tmp);
2100 #ifdef ALLOW_VISUALS
2102 /* Dump monster attr/chars */
2105 static concptr mark = "Monster attr/chars";
2108 prt(_("コマンド: モンスターの[色/文字]をファイルに書き出します", "Command: Dump monster attr/chars"), 15, 0);
2111 prt(_("ファイル: ", "File: "), 17, 0);
2113 /* Default filename */
2114 sprintf(tmp, "%s.prf", creature_ptr->base_name);
2116 /* Get a filename */
2117 if (!askfor(tmp, 70)) continue;
2118 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
2120 /* Append to the file */
2121 if (!open_auto_dump(buf, mark)) continue;
2124 auto_dump_printf(_("\n# モンスターの[色/文字]の設定\n\n", "\n# Monster attr/char definitions\n\n"));
2127 for (i = 0; i < max_r_idx; i++)
2129 monster_race *r_ptr = &r_info[i];
2131 /* Skip non-entries */
2132 if (!r_ptr->name) continue;
2134 /* Dump a comment */
2135 auto_dump_printf("# %s\n", (r_name + r_ptr->name));
2137 /* Dump the monster attr/char info */
2138 auto_dump_printf("R:%d:0x%02X/0x%02X\n\n", i,
2139 (byte)(r_ptr->x_attr), (byte)(r_ptr->x_char));
2145 msg_print(_("モンスターの[色/文字]をファイルに書き出しました。", "Dumped monster attr/chars."));
2150 /* Dump object attr/chars */
2153 static concptr mark = "Object attr/chars";
2154 KIND_OBJECT_IDX k_idx;
2157 prt(_("コマンド: アイテムの[色/文字]をファイルに書き出します", "Command: Dump object attr/chars"), 15, 0);
2160 prt(_("ファイル: ", "File: "), 17, 0);
2162 /* Default filename */
2163 sprintf(tmp, "%s.prf", creature_ptr->base_name);
2165 /* Get a filename */
2166 if (!askfor(tmp, 70)) continue;
2167 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
2169 /* Append to the file */
2170 if (!open_auto_dump(buf, mark)) continue;
2173 auto_dump_printf(_("\n# アイテムの[色/文字]の設定\n\n", "\n# Object attr/char definitions\n\n"));
2176 for (k_idx = 0; k_idx < max_k_idx; k_idx++)
2178 GAME_TEXT o_name[MAX_NLEN];
2179 object_kind *k_ptr = &k_info[k_idx];
2181 /* Skip non-entries */
2182 if (!k_ptr->name) continue;
2187 strip_name(o_name, k_idx);
2193 /* Prepare dummy object */
2194 object_prep(&forge, k_idx);
2196 /* Get un-shuffled flavor name */
2197 object_desc(o_name, &forge, OD_FORCE_FLAVOR);
2200 /* Dump a comment */
2201 auto_dump_printf("# %s\n", o_name);
2203 /* Dump the object attr/char info */
2204 auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", (int)k_idx,
2205 (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char));
2211 msg_print(_("アイテムの[色/文字]をファイルに書き出しました。", "Dumped object attr/chars."));
2216 /* Dump feature attr/chars */
2219 static concptr mark = "Feature attr/chars";
2222 prt(_("コマンド: 地形の[色/文字]をファイルに書き出します", "Command: Dump feature attr/chars"), 15, 0);
2225 prt(_("ファイル: ", "File: "), 17, 0);
2227 /* Default filename */
2228 sprintf(tmp, "%s.prf", creature_ptr->base_name);
2230 /* Get a filename */
2231 if (!askfor(tmp, 70)) continue;
2232 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
2234 /* Append to the file */
2235 if (!open_auto_dump(buf, mark)) continue;
2238 auto_dump_printf(_("\n# 地形の[色/文字]の設定\n\n", "\n# Feature attr/char definitions\n\n"));
2241 for (i = 0; i < max_f_idx; i++)
2243 feature_type *f_ptr = &f_info[i];
2245 /* Skip non-entries */
2246 if (!f_ptr->name) continue;
2248 /* Skip mimiccing features */
2249 if (f_ptr->mimic != i) continue;
2251 /* Dump a comment */
2252 auto_dump_printf("# %s\n", (f_name + f_ptr->name));
2254 /* Dump the feature attr/char info */
2255 auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
2256 (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
2257 (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
2258 (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]));
2264 msg_print(_("地形の[色/文字]をファイルに書き出しました。", "Dumped feature attr/chars."));
2269 /* Modify monster attr/chars (numeric operation) */
2272 static concptr choice_msg = _("モンスターの[色/文字]を変更します", "Change monster attr/chars");
2273 static MONRACE_IDX r = 0;
2275 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
2277 /* Hack -- query until done */
2280 monster_race *r_ptr = &r_info[r];
2284 TERM_COLOR da = r_ptr->d_attr;
2285 byte dc = r_ptr->d_char;
2286 TERM_COLOR ca = r_ptr->x_attr;
2287 byte cc = r_ptr->x_char;
2289 /* Label the object */
2290 Term_putstr(5, 17, -1, TERM_WHITE,
2291 format(_("モンスター = %d, 名前 = %-40.40s", "Monster = %d, Name = %-40.40s"), r, (r_name + r_ptr->name)));
2293 /* Label the Default values */
2294 Term_putstr(10, 19, -1, TERM_WHITE,
2295 format(_("初期値 色 / 文字 = %3u / %3u", "Default attr/char = %3u / %3u"), da, dc));
2297 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
2298 Term_queue_bigchar(43, 19, da, dc, 0, 0);
2300 /* Label the Current values */
2301 Term_putstr(10, 20, -1, TERM_WHITE,
2302 format(_("現在値 色 / 文字 = %3u / %3u", "Current attr/char = %3u / %3u"), ca, cc));
2304 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
2305 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
2308 Term_putstr(0, 22, -1, TERM_WHITE,
2309 _("コマンド (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): "));
2314 if (i == ESCAPE) break;
2316 if (iscntrl(i)) c = 'a' + i - KTRL('A');
2317 else if (isupper(i)) c = 'a' + i - 'A';
2327 if (!cmd_visuals_aux(i, &r, max_r_idx))
2333 while (!r_info[r].name);
2337 t = (int)r_ptr->x_attr;
2338 (void)cmd_visuals_aux(i, &t, 256);
2339 r_ptr->x_attr = (byte)t;
2343 t = (int)r_ptr->x_char;
2344 (void)cmd_visuals_aux(i, &t, 256);
2345 r_ptr->x_char = (byte)t;
2349 do_cmd_knowledge_monsters(creature_ptr, &need_redraw, TRUE, r);
2351 print_visuals_menu(choice_msg);
2359 /* Modify object attr/chars (numeric operation) */
2362 static concptr choice_msg = _("アイテムの[色/文字]を変更します", "Change object attr/chars");
2364 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
2366 /* Hack -- query until done */
2369 object_kind *k_ptr = &k_info[k];
2373 TERM_COLOR da = k_ptr->d_attr;
2374 SYMBOL_CODE dc = k_ptr->d_char;
2375 TERM_COLOR ca = k_ptr->x_attr;
2376 SYMBOL_CODE cc = k_ptr->x_char;
2378 /* Label the object */
2379 Term_putstr(5, 17, -1, TERM_WHITE,
2380 format(_("アイテム = %d, 名前 = %-40.40s", "Object = %d, Name = %-40.40s"),
2381 k, k_name + (!k_ptr->flavor ? k_ptr->name : k_ptr->flavor_name)));
2383 /* Label the Default values */
2384 Term_putstr(10, 19, -1, TERM_WHITE,
2385 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
2387 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
2388 Term_queue_bigchar(43, 19, da, dc, 0, 0);
2390 /* Label the Current values */
2391 Term_putstr(10, 20, -1, TERM_WHITE,
2392 format(_("現在値 色 / 文字 = %3d / %3d", "Current attr/char = %3d / %3d"), ca, cc));
2394 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
2395 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
2398 Term_putstr(0, 22, -1, TERM_WHITE,
2399 _("コマンド (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): "));
2404 if (i == ESCAPE) break;
2406 if (iscntrl(i)) c = 'a' + i - KTRL('A');
2407 else if (isupper(i)) c = 'a' + i - 'A';
2417 if (!cmd_visuals_aux(i, &k, max_k_idx))
2423 while (!k_info[k].name);
2427 t = (int)k_ptr->x_attr;
2428 (void)cmd_visuals_aux(i, &t, 256);
2429 k_ptr->x_attr = (byte)t;
2433 t = (int)k_ptr->x_char;
2434 (void)cmd_visuals_aux(i, &t, 256);
2435 k_ptr->x_char = (byte)t;
2439 do_cmd_knowledge_objects(&need_redraw, TRUE, k);
2441 print_visuals_menu(choice_msg);
2449 /* Modify feature attr/chars (numeric operation) */
2452 static concptr choice_msg = _("地形の[色/文字]を変更します", "Change feature attr/chars");
2454 static IDX lighting_level = F_LIT_STANDARD;
2455 prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
2457 /* Hack -- query until done */
2460 feature_type *f_ptr = &f_info[f];
2464 TERM_COLOR da = f_ptr->d_attr[lighting_level];
2465 byte dc = f_ptr->d_char[lighting_level];
2466 TERM_COLOR ca = f_ptr->x_attr[lighting_level];
2467 byte cc = f_ptr->x_char[lighting_level];
2469 /* Label the object */
2471 Term_putstr(5, 17, -1, TERM_WHITE,
2472 format(_("地形 = %d, 名前 = %s, 明度 = %s", "Terrain = %d, Name = %s, Lighting = %s"),
2473 f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
2475 /* Label the Default values */
2476 Term_putstr(10, 19, -1, TERM_WHITE,
2477 format(_("初期値 色 / 文字 = %3d / %3d", "Default attr/char = %3d / %3d"), da, dc));
2479 Term_putstr(40, 19, -1, TERM_WHITE, empty_symbol);
2480 Term_queue_bigchar(43, 19, da, dc, 0, 0);
2482 /* Label the Current values */
2484 Term_putstr(10, 20, -1, TERM_WHITE,
2485 format("現在値 色 / 文字 = %3d / %3d", ca, cc));
2487 Term_putstr(10, 20, -1, TERM_WHITE,
2488 format("Current attr/char = %3d / %3d", ca, cc));
2491 Term_putstr(40, 20, -1, TERM_WHITE, empty_symbol);
2492 Term_queue_bigchar(43, 20, ca, cc, 0, 0);
2496 Term_putstr(0, 22, -1, TERM_WHITE,
2497 "コマンド (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
2499 Term_putstr(0, 22, -1, TERM_WHITE,
2500 "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L/d/D/^D/v/V/^V): ");
2506 if (i == ESCAPE) break;
2508 if (iscntrl(i)) c = 'a' + i - KTRL('A');
2509 else if (isupper(i)) c = 'a' + i - 'A';
2519 if (!cmd_visuals_aux(i, &f, max_f_idx))
2525 while (!f_info[f].name || (f_info[f].mimic != f));
2529 t = (int)f_ptr->x_attr[lighting_level];
2530 (void)cmd_visuals_aux(i, &t, 256);
2531 f_ptr->x_attr[lighting_level] = (byte)t;
2535 t = (int)f_ptr->x_char[lighting_level];
2536 (void)cmd_visuals_aux(i, &t, 256);
2537 f_ptr->x_char[lighting_level] = (byte)t;
2541 (void)cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
2544 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
2548 do_cmd_knowledge_features(&need_redraw, TRUE, f, &lighting_level);
2550 print_visuals_menu(choice_msg);
2558 /* Modify monster attr/chars (visual mode) */
2560 do_cmd_knowledge_monsters(creature_ptr, &need_redraw, TRUE, -1);
2563 /* Modify object attr/chars (visual mode) */
2565 do_cmd_knowledge_objects(&need_redraw, TRUE, -1);
2568 /* Modify feature attr/chars (visual mode) */
2571 IDX lighting_level = F_LIT_STANDARD;
2572 do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level);
2576 #endif /* ALLOW_VISUALS */
2584 msg_print(_("画面上の[色/文字]を初期値にリセットしました。", "Visual attr/char tables reset."));
2588 /* Unknown option */
2599 if (need_redraw) do_cmd_redraw(creature_ptr);
2604 * Interact with "colors"
2606 void do_cmd_colors(player_type *creature_ptr)
2612 /* File type is "TEXT" */
2613 FILE_TYPE(FILE_TYPE_TEXT);
2617 /* Interact until done */
2622 /* Ask for a choice */
2623 prt(_("[ カラーの設定 ]", "Interact with Colors"), 2, 0);
2625 /* Give some choices */
2626 prt(_("(1) ユーザー設定ファイルのロード", "(1) Load a user pref file"), 4, 5);
2629 prt(_("(2) カラーの設定をファイルに書き出す", "(2) Dump colors"), 5, 5);
2630 prt(_("(3) カラーの設定を変更する", "(3) Modify colors"), 6, 5);
2634 prt(_("コマンド: ", "Command: "), 8, 0);
2638 if (i == ESCAPE) break;
2640 /* Load a 'pref' file */
2644 prt(_("コマンド: ユーザー設定ファイルをロードします", "Command: Load a user pref file"), 8, 0);
2647 prt(_("ファイル: ", "File: "), 10, 0);
2650 sprintf(tmp, "%s.prf", creature_ptr->base_name);
2653 if (!askfor(tmp, 70)) continue;
2655 /* Process the given filename */
2656 (void)process_pref_file(tmp);
2658 /* Mega-Hack -- react to changes */
2659 Term_xtra(TERM_XTRA_REACT, 0);
2661 /* Mega-Hack -- redraw */
2670 static concptr mark = "Colors";
2673 prt(_("コマンド: カラーの設定をファイルに書き出します", "Command: Dump colors"), 8, 0);
2676 prt(_("ファイル: ", "File: "), 10, 0);
2678 /* Default filename */
2679 sprintf(tmp, "%s.prf", creature_ptr->base_name);
2681 /* Get a filename */
2682 if (!askfor(tmp, 70)) continue;
2683 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
2685 /* Append to the file */
2686 if (!open_auto_dump(buf, mark)) continue;
2689 auto_dump_printf(_("\n# カラーの設定\n\n", "\n# Color redefinitions\n\n"));
2692 for (i = 0; i < 256; i++)
2694 int kv = angband_color_table[i][0];
2695 int rv = angband_color_table[i][1];
2696 int gv = angband_color_table[i][2];
2697 int bv = angband_color_table[i][3];
2699 concptr name = _("未知", "unknown");
2701 /* Skip non-entries */
2702 if (!kv && !rv && !gv && !bv) continue;
2704 /* Extract the color name */
2705 if (i < 16) name = color_names[i];
2707 /* Dump a comment */
2708 auto_dump_printf(_("# カラー '%s'\n", "# Color '%s'\n"), name);
2710 /* Dump the monster attr/char info */
2711 auto_dump_printf("V:%d:0x%02X:0x%02X:0x%02X:0x%02X\n\n",
2718 msg_print(_("カラーの設定をファイルに書き出しました。", "Dumped color redefinitions."));
2727 prt(_("コマンド: カラーの設定を変更します", "Command: Modify colors"), 8, 0);
2729 /* Hack -- query until done */
2736 /* Exhibit the normal colors */
2737 for (j = 0; j < 16; j++)
2739 /* Exhibit this color */
2740 Term_putstr(j*4, 20, -1, a, "###");
2742 /* Exhibit all colors */
2743 Term_putstr(j*4, 22, -1, j, format("%3d", j));
2746 /* Describe the color */
2747 name = ((a < 16) ? color_names[a] : _("未定義", "undefined"));
2749 /* Describe the color */
2750 Term_putstr(5, 10, -1, TERM_WHITE,
2751 format(_("カラー = %d, 名前 = %s", "Color = %d, Name = %s"), a, name));
2753 /* Label the Current values */
2754 Term_putstr(5, 12, -1, TERM_WHITE,
2755 format("K = 0x%02x / R,G,B = 0x%02x,0x%02x,0x%02x",
2756 angband_color_table[a][0],
2757 angband_color_table[a][1],
2758 angband_color_table[a][2],
2759 angband_color_table[a][3]));
2762 Term_putstr(0, 14, -1, TERM_WHITE,
2763 _("コマンド (n/N/k/K/r/R/g/G/b/B): ", "Command (n/N/k/K/r/R/g/G/b/B): "));
2768 if (i == ESCAPE) break;
2771 if (i == 'n') a = (byte)(a + 1);
2772 if (i == 'N') a = (byte)(a - 1);
2773 if (i == 'k') angband_color_table[a][0] = (byte)(angband_color_table[a][0] + 1);
2774 if (i == 'K') angband_color_table[a][0] = (byte)(angband_color_table[a][0] - 1);
2775 if (i == 'r') angband_color_table[a][1] = (byte)(angband_color_table[a][1] + 1);
2776 if (i == 'R') angband_color_table[a][1] = (byte)(angband_color_table[a][1] - 1);
2777 if (i == 'g') angband_color_table[a][2] = (byte)(angband_color_table[a][2] + 1);
2778 if (i == 'G') angband_color_table[a][2] = (byte)(angband_color_table[a][2] - 1);
2779 if (i == 'b') angband_color_table[a][3] = (byte)(angband_color_table[a][3] + 1);
2780 if (i == 'B') angband_color_table[a][3] = (byte)(angband_color_table[a][3] - 1);
2782 /* Hack -- react to changes */
2783 Term_xtra(TERM_XTRA_REACT, 0);
2785 /* Hack -- redraw */
2792 /* Unknown option */
2806 * Note something in the message recall
2808 void do_cmd_note(void)
2816 if (!get_string(_("メモ: ", "Note: "), buf, 60)) return;
2818 /* Ignore empty notes */
2819 if (!buf[0] || (buf[0] == ' ')) return;
2821 /* Add the note to the message recall */
2822 msg_format(_("メモ: %s", "Note: %s"), buf);
2827 * Mention the current version
2829 void do_cmd_version(void)
2831 #if FAKE_VER_EXTRA > 0
2832 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d.%d", "You are playing Hengband %d.%d.%d.%d."),
2833 FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA);
2835 msg_format(_("変愚蛮怒(Hengband) %d.%d.%d", "You are playing Hengband %d.%d.%d."),
2836 FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
2842 * Array of feeling strings
2844 static concptr do_cmd_feeling_text[11] =
2846 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
2847 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
2848 _("恐ろしい死の幻が目に浮かび、気絶しそうになった!", "You nearly faint as horrible visions of death fill your mind!"),
2849 _("この階はとても危険なようだ。", "This level looks very dangerous."),
2850 _("とても悪い予感がする...", "You have a very bad feeling..."),
2851 _("悪い予感がする...", "You have a bad feeling..."),
2852 _("何か緊張する。", "You feel nervous."),
2853 _("少し不運な気がする...", "You feel your luck is turning..."),
2854 _("この場所は好きになれない。", "You don't like the look of this place."),
2855 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
2856 _("なんて退屈なところだ...", "What a boring place...")
2859 static concptr do_cmd_feeling_text_combat[11] =
2861 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
2862 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
2863 _("今夜もまた、誰かが命を落とす...", "You nearly faint as horrible visions of death fill your mind!"),
2864 _("この階はとても危険なようだ。", "This level looks very dangerous."),
2865 _("とても悪い予感がする...", "You have a very bad feeling..."),
2866 _("悪い予感がする...", "You have a bad feeling..."),
2867 _("何か緊張する。", "You feel nervous."),
2868 _("少し不運な気がする...", "You feel your luck is turning..."),
2869 _("この場所は好きになれない。", "You don't like the look of this place."),
2870 _("この階はそれなりに安全なようだ。", "This level looks reasonably safe."),
2871 _("なんて退屈なところだ...", "What a boring place...")
2874 static concptr do_cmd_feeling_text_lucky[11] =
2876 _("この階の雰囲気を感じとれなかった...", "Looks like any other level."),
2877 _("この階には何か特別なものがあるような気がする。", "You feel there is something special about this level."),
2878 _("この階はこの上なく素晴らしい感じがする。", "You have a superb feeling about this level."),
2879 _("素晴らしい感じがする...", "You have an excellent feeling..."),
2880 _("とても良い感じがする...", "You have a very good feeling..."),
2881 _("良い感じがする...", "You have a good feeling..."),
2882 _("ちょっと幸運な感じがする...", "You feel strangely lucky..."),
2883 _("多少は運が向いてきたか...", "You feel your luck is turning..."),
2884 _("見た感じ悪くはない...", "You like the look of this place..."),
2885 _("全然駄目ということはないが...", "This level can't be all bad..."),
2886 _("なんて退屈なところだ...", "What a boring place...")
2891 * Note that "feeling" is set to zero unless some time has passed.
2892 * Note that this is done when the level is GENERATED, not entered.
2894 void do_cmd_feeling(player_type *creature_ptr)
2896 if (creature_ptr->wild_mode) return;
2898 /* No useful feeling in quests */
2899 if (creature_ptr->current_floor_ptr->inside_quest && !random_quest_number(creature_ptr->current_floor_ptr->dun_level))
2901 msg_print(_("典型的なクエストのダンジョンのようだ。", "Looks like a typical quest level."));
2905 /* No useful feeling in town */
2906 if (creature_ptr->town_num && !creature_ptr->current_floor_ptr->dun_level)
2908 if (!strcmp(town_info[creature_ptr->town_num].name, _("荒野", "wilderness")))
2910 msg_print(_("何かありそうな荒野のようだ。", "Looks like a strange wilderness."));
2914 msg_print(_("典型的な町のようだ。", "Looks like a typical town."));
2918 /* No useful feeling in the wilderness */
2919 if (!creature_ptr->current_floor_ptr->dun_level)
2921 msg_print(_("典型的な荒野のようだ。", "Looks like a typical wilderness."));
2925 /* Display the feeling */
2926 if (creature_ptr->muta3 & MUT3_GOOD_LUCK)
2927 msg_print(do_cmd_feeling_text_lucky[creature_ptr->feeling]);
2928 else if (creature_ptr->pseikaku == SEIKAKU_COMBAT ||
2929 creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON)
2930 msg_print(do_cmd_feeling_text_combat[creature_ptr->feeling]);
2932 msg_print(do_cmd_feeling_text[creature_ptr->feeling]);
2937 * Description of each monster group.
2939 static concptr monster_group_text[] =
2942 "ユニーク", /* "Uniques" */
2943 "乗馬可能なモンスター", /* "Riding" */
2944 "賞金首", /* "Wanted */
2945 "アンバーの王族", /* "Ambertite" */
2974 /* "古代ドラゴン/ワイアーム", */
3035 /* "Ancient Dragon/Wyrm", */
3044 "Multi-Headed Reptile",
3049 "Reptile/Amphibian",
3050 "Spider/Scorpion/Tick",
3052 /* "Major Demon", */
3069 * Symbols of monsters in each group. Note the "Uniques" group
3070 * is handled differently.
3072 static concptr monster_group_char[] =
3129 "!$&()+./=>?[\\]`{|~",
3139 * todo 引数と戻り値について追記求む
3140 * Build a list of monster indexes in the given group.
3142 * mode & 0x01 : check for non-empty group
3143 * mode & 0x02 : visual operation only
3145 * @param creature_ptr プレーヤーへの参照ポインタ
3146 * @param grp_cur ???
3147 * @param mon_idx[] ???
3149 * @return The number of monsters in the group
3151 static IDX collect_monsters(player_type *creature_ptr, IDX grp_cur, IDX mon_idx[], BIT_FLAGS8 mode)
3156 /* Get a list of x_char in this group */
3157 concptr group_char = monster_group_char[grp_cur];
3159 /* XXX Hack -- Check if this is the "Uniques" group */
3160 bool grp_unique = (monster_group_char[grp_cur] == (char *) -1L);
3162 /* XXX Hack -- Check if this is the "Riding" group */
3163 bool grp_riding = (monster_group_char[grp_cur] == (char *) -2L);
3165 /* XXX Hack -- Check if this is the "Wanted" group */
3166 bool grp_wanted = (monster_group_char[grp_cur] == (char *) -3L);
3168 /* XXX Hack -- Check if this is the "Amberite" group */
3169 bool grp_amberite = (monster_group_char[grp_cur] == (char *) -4L);
3172 /* Check every race */
3173 for (IDX i = 0; i < max_r_idx; i++)
3175 /* Access the race */
3176 monster_race *r_ptr = &r_info[i];
3178 /* Skip empty race */
3179 if (!r_ptr->name) continue ;
3181 /* Require known monsters */
3182 if (!(mode & 0x02) && !cheat_know && !r_ptr->r_sights) continue;
3186 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
3189 else if (grp_riding)
3191 if (!(r_ptr->flags7 & RF7_RIDING)) continue;
3194 else if (grp_wanted)
3196 bool wanted = FALSE;
3198 for (j = 0; j < MAX_KUBI; j++)
3200 if (current_world_ptr->bounty_r_idx[j] == i || current_world_ptr->bounty_r_idx[j] - 10000 == i ||
3201 (creature_ptr->today_mon && creature_ptr->today_mon == i))
3207 if (!wanted) continue;
3210 else if (grp_amberite)
3212 if (!(r_ptr->flags3 & RF3_AMBERITE)) continue;
3217 /* Check for race in the group */
3218 if (!my_strchr(group_char, r_ptr->d_char)) continue;
3222 mon_idx[mon_cnt++] = i;
3224 /* XXX Hack -- Just checking for non-empty group */
3225 if (mode & 0x01) break;
3228 /* Terminate the list */
3229 mon_idx[mon_cnt] = -1;
3231 ang_sort(mon_idx, &dummy_why, mon_cnt, ang_sort_comp_monster_level, ang_sort_swap_hook);
3233 /* Return the number of races */
3239 * Description of each monster group.
3241 static concptr object_group_text[] =
3244 "キノコ", /* "Mushrooms" */
3245 "薬", /* "Potions" */
3246 "油つぼ", /* "Flasks" */
3247 "巻物", /* "Scrolls" */
3249 "アミュレット", /* "Amulets" */
3250 "笛", /* "Whistle" */
3251 "光源", /* "Lanterns" */
3252 "魔法棒", /* "Wands" */
3255 "カード", /* "Cards" */
3266 "刀剣類", /* "Swords" */
3267 "鈍器", /* "Blunt Weapons" */
3268 "長柄武器", /* "Polearms" */
3269 "採掘道具", /* "Diggers" */
3270 "飛び道具", /* "Bows" */
3274 "軽装鎧", /* "Soft Armor" */
3275 "重装鎧", /* "Hard Armor" */
3276 "ドラゴン鎧", /* "Dragon Armor" */
3277 "盾", /* "Shields" */
3278 "クローク", /* "Cloaks" */
3279 "籠手", /* "Gloves" */
3280 "ヘルメット", /* "Helms" */
3282 "ブーツ", /* "Boots" */
3335 * TVALs of items in each group
3337 static byte object_group_tval[] =
3378 TV_LIFE_BOOK, /* Hack -- all spellbooks */
3386 * Build a list of object indexes in the given group. Return the number
3387 * of objects in the group.
3389 * mode & 0x01 : check for non-empty group
3390 * mode & 0x02 : visual operation only
3392 static KIND_OBJECT_IDX collect_objects(int grp_cur, KIND_OBJECT_IDX object_idx[], BIT_FLAGS8 mode)
3394 KIND_OBJECT_IDX i, object_cnt = 0;
3397 /* Get a list of x_char in this group */
3398 byte group_tval = object_group_tval[grp_cur];
3400 /* Check every object */
3401 for (i = 0; i < max_k_idx; i++)
3403 /* Access the object */
3404 object_kind *k_ptr = &k_info[i];
3406 /* Skip empty objects */
3407 if (!k_ptr->name) continue;
3411 if (!current_world_ptr->wizard)
3413 /* Skip non-flavoured objects */
3414 if (!k_ptr->flavor) continue;
3416 /* Require objects ever seen */
3417 if (!k_ptr->aware) continue;
3420 /* Skip items with no distribution (special artifacts) */
3421 for (j = 0, k = 0; j < 4; j++) k += k_ptr->chance[j];
3425 /* Check for objects in the group */
3426 if (TV_LIFE_BOOK == group_tval)
3428 /* Hack -- All spell books */
3429 if (TV_LIFE_BOOK <= k_ptr->tval && k_ptr->tval <= TV_HEX_BOOK)
3431 /* Add the object */
3432 object_idx[object_cnt++] = i;
3436 else if (k_ptr->tval == group_tval)
3438 /* Add the object */
3439 object_idx[object_cnt++] = i;
3443 /* XXX Hack -- Just checking for non-empty group */
3444 if (mode & 0x01) break;
3447 /* Terminate the list */
3448 object_idx[object_cnt] = -1;
3450 /* Return the number of objects */
3456 * Description of each feature group.
3458 static concptr feature_group_text[] =
3466 * Build a list of feature indexes in the given group. Return the number
3467 * of features in the group.
3469 * mode & 0x01 : check for non-empty group
3471 static FEAT_IDX collect_features(int grp_cur, FEAT_IDX *feat_idx, BIT_FLAGS8 mode)
3474 FEAT_IDX feat_cnt = 0;
3476 /* Unused; There is a single group. */
3479 /* Check every feature */
3480 for (i = 0; i < max_f_idx; i++)
3482 feature_type *f_ptr = &f_info[i];
3484 /* Skip empty index */
3485 if (!f_ptr->name) continue;
3487 /* Skip mimiccing features */
3488 if (f_ptr->mimic != i) continue;
3491 feat_idx[feat_cnt++] = i;
3493 /* XXX Hack -- Just checking for non-empty group */
3494 if (mode & 0x01) break;
3497 /* Terminate the list */
3498 feat_idx[feat_cnt] = -1;
3500 /* Return the number of races */
3507 * Build a list of monster indexes in the given group. Return the number
3508 * of monsters in the group.
3510 static int collect_artifacts(int grp_cur, int object_idx[])
3512 int i, object_cnt = 0;
3514 /* Get a list of x_char in this group */
3515 byte group_tval = object_group_tval[grp_cur];
3517 /* Check every object */
3518 for (i = 0; i < max_a_idx; i++)
3520 /* Access the artifact */
3521 artifact_type *a_ptr = &a_info[i];
3523 /* Skip empty artifacts */
3524 if (!a_ptr->name) continue;
3526 /* Skip "uncreated" artifacts */
3527 if (!a_ptr->cur_num) continue;
3529 /* Check for race in the group */
3530 if (a_ptr->tval == group_tval)
3533 object_idx[object_cnt++] = i;
3537 /* Terminate the list */
3538 object_idx[object_cnt] = 0;
3540 /* Return the number of races */
3547 * Encode the screen colors
3549 static char hack[17] = "dwsorgbuDWvyRGBU";
3553 * Hack -- load a screen dump from a file
3555 void do_cmd_load_screen(void)
3559 SYMBOL_CODE c = ' ';
3565 Term_get_size(&wid, &hgt);
3566 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
3568 /* Append to the file */
3569 fff = my_fopen(buf, "r");
3573 msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf);
3581 /* Load the screen */
3582 for (y = 0; okay; y++)
3584 /* Get a line of data including control code */
3585 if (!fgets(buf, 1024, fff)) okay = FALSE;
3587 /* Get the blank line */
3588 if (buf[0] == '\n' || buf[0] == '\0') break;
3590 /* Ignore too large screen image */
3591 if (y >= hgt) continue;
3594 for (x = 0; x < wid - 1; x++)
3597 if (buf[x] == '\n' || buf[x] == '\0') break;
3599 /* Put the attr/char */
3600 Term_draw(x, y, TERM_WHITE, buf[x]);
3604 /* Dump the screen */
3605 for (y = 0; okay; y++)
3607 /* Get a line of data including control code */
3608 if (!fgets(buf, 1024, fff)) okay = FALSE;
3610 /* Get the blank line */
3611 if (buf[0] == '\n' || buf[0] == '\0') break;
3613 /* Ignore too large screen image */
3614 if (y >= hgt) continue;
3617 for (x = 0; x < wid - 1; x++)
3620 if (buf[x] == '\n' || buf[x] == '\0') break;
3622 /* Get the attr/char */
3623 (void)(Term_what(x, y, &a, &c));
3625 /* Look up the attr */
3626 for (int i = 0; i < 16; i++)
3628 /* Use attr matches */
3629 if (hack[i] == buf[x]) a = (byte_hack)i;
3632 /* Put the attr/char */
3633 Term_draw(x, y, a, c);
3639 prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0);
3647 // todo なぜこんな中途半端なところに? defineも…
3648 concptr inven_res_label = _(" 酸電火冷毒光闇破轟獄因沌劣 盲怖乱痺透命感消復浮",
3649 " AcElFiCoPoLiDkShSoNtNxCaDi BlFeCfFaSeHlEpSdRgLv");
3651 #define IM_FLAG_STR _("*", "* ")
3652 #define HAS_FLAG_STR _("+", "+ ")
3653 #define NO_FLAG_STR _("・", ". ")
3655 #define print_im_or_res_flag(IM, RES) \
3657 fputs(have_flag(flgs, (IM)) ? IM_FLAG_STR : \
3658 (have_flag(flgs, (RES)) ? HAS_FLAG_STR : NO_FLAG_STR), fff); \
3661 #define print_flag(TR) \
3663 fputs(have_flag(flgs, (TR)) ? HAS_FLAG_STR : NO_FLAG_STR, fff); \
3667 /* XTRA HACK RESLIST */
3668 static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, OBJECT_TYPE_VALUE tval, char *where)
3670 GAME_TEXT o_name[MAX_NLEN];
3671 BIT_FLAGS flgs[TR_FLAG_SIZE];
3673 if (!o_ptr->k_idx) return;
3674 if (o_ptr->tval != tval) return;
3676 /* Identified items only */
3677 if (!object_is_known(o_ptr)) return;
3680 * HACK:Ring of Lordly protection and Dragon equipment
3681 * have random resistances.
3683 bool is_special_item_type = (object_is_wearable(o_ptr) && object_is_ego(o_ptr))
3684 || ((tval == TV_AMULET) && (o_ptr->sval == SV_AMULET_RESISTANCE))
3685 || ((tval == TV_RING) && (o_ptr->sval == SV_RING_LORDLY))
3686 || ((tval == TV_SHIELD) && (o_ptr->sval == SV_DRAGON_SHIELD))
3687 || ((tval == TV_HELM) && (o_ptr->sval == SV_DRAGON_HELM))
3688 || ((tval == TV_GLOVES) && (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES))
3689 || ((tval == TV_BOOTS) && (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE))
3690 || object_is_artifact(o_ptr);
3691 if (!is_special_item_type)
3697 object_desc(o_name, o_ptr, OD_NAME_ONLY);
3699 while (o_name[i] && (i < 26))
3702 if (iskanji(o_name[i])) i++;
3711 o_name[i] = ' '; i++;
3717 fprintf(fff, "%s %s", where, o_name);
3719 if (!(o_ptr->ident & (IDENT_MENTAL)))
3721 fputs(_("-------不明--------------- -------不明---------\n",
3722 "-------unknown------------ -------unknown------\n"), fff);
3726 object_flags_known(o_ptr, flgs);
3728 print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID);
3729 print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC);
3730 print_im_or_res_flag(TR_IM_FIRE, TR_RES_FIRE);
3731 print_im_or_res_flag(TR_IM_COLD, TR_RES_COLD);
3732 print_flag(TR_RES_POIS);
3733 print_flag(TR_RES_LITE);
3734 print_flag(TR_RES_DARK);
3735 print_flag(TR_RES_SHARDS);
3736 print_flag(TR_RES_SOUND);
3737 print_flag(TR_RES_NETHER);
3738 print_flag(TR_RES_NEXUS);
3739 print_flag(TR_RES_CHAOS);
3740 print_flag(TR_RES_DISEN);
3744 print_flag(TR_RES_BLIND);
3745 print_flag(TR_RES_FEAR);
3746 print_flag(TR_RES_CONF);
3747 print_flag(TR_FREE_ACT);
3748 print_flag(TR_SEE_INVIS);
3749 print_flag(TR_HOLD_EXP);
3750 print_flag(TR_TELEPATHY);
3751 print_flag(TR_SLOW_DIGEST);
3752 print_flag(TR_REGEN);
3753 print_flag(TR_LEVITATION);
3762 fprintf(fff, "%s\n", inven_res_label);
3767 * Display *ID* ed weapons/armors's resistances
3769 static void do_cmd_knowledge_inven(player_type *creature_ptr)
3772 GAME_TEXT file_name[1024];
3774 OBJECT_TYPE_VALUE tval;
3780 /* Open a new file */
3781 fff = my_fopen_temp(file_name, 1024);
3784 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
3789 fprintf(fff, "%s\n", inven_res_label);
3791 for (tval = TV_WEARABLE_BEGIN; tval <= TV_WEARABLE_END; tval++)
3795 for (; j < 9; j++) fputc('\n', fff);
3797 fprintf(fff, "%s\n", inven_res_label);
3800 strcpy(where, _("装", "E "));
3801 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3803 do_cmd_knowledge_inven_aux(fff, &creature_ptr->inventory_list[i], &j, tval, where);
3806 strcpy(where, _("持", "I "));
3807 for (i = 0; i < INVEN_PACK; i++)
3809 do_cmd_knowledge_inven_aux(fff, &creature_ptr->inventory_list[i], &j, tval, where);
3812 st_ptr = &town_info[1].store[STORE_HOME];
3813 strcpy(where, _("家", "H "));
3814 for (i = 0; i < st_ptr->stock_num; i++)
3816 do_cmd_knowledge_inven_aux(fff, &st_ptr->stock[i], &j, tval, where);
3822 /* Display the file contents */
3823 show_file(TRUE, file_name, _("*鑑定*済み武器/防具の耐性リスト", "Resistances of *identified* equipment"), 0, 0);
3828 void do_cmd_save_screen_html_aux(char *filename, int message)
3833 TERM_COLOR a = 0, old_a = 0;
3846 concptr html_head[] = {
3847 "<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
3851 concptr html_foot[] = {
3853 "</body>\n</html>\n",
3859 Term_get_size(&wid, &hgt);
3861 /* File type is "TEXT" */
3862 FILE_TYPE(FILE_TYPE_TEXT);
3864 /* Append to the file */
3865 fff = my_fopen(filename, "w");
3871 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename);
3878 if (message) screen_save();
3879 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "htmldump.prf");
3880 tmpfff = my_fopen(buf, "r");
3883 for (i = 0; html_head[i]; i++)
3884 fputs(html_head[i], fff);
3889 while (!my_fgets(tmpfff, buf, sizeof(buf)))
3893 if (strncmp(buf, tags[0], strlen(tags[0])) == 0)
3898 if (strncmp(buf, tags[1], strlen(tags[1])) == 0)
3900 fprintf(fff, "%s\n", buf);
3905 /* Dump the screen */
3906 for (y = 0; y < hgt; y++)
3909 if (y != 0) fprintf(fff, "\n");
3912 for (x = 0; x < wid - 1; x++)
3915 /* Get the attr/char */
3916 (void)(Term_what(x, y, &a, &c));
3920 case '&': cc = "&"; break;
3921 case '<': cc = "<"; break;
3922 case '>': cc = ">"; break;
3924 case 0x1f: c = '.'; break;
3925 case 0x7f: c = (a == 0x09) ? '%' : '#'; break;
3930 if ((y == 0 && x == 0) || a != old_a)
3932 int rv = angband_color_table[a][1];
3933 int gv = angband_color_table[a][2];
3934 int bv = angband_color_table[a][3];
3935 fprintf(fff, "%s<font color=\"#%02x%02x%02x\">",
3936 ((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
3941 fprintf(fff, "%s", cc);
3943 fprintf(fff, "%c", c);
3947 fprintf(fff, "</font>");
3951 for (i = 0; html_foot[i]; i++)
3952 fputs(html_foot[i], fff);
3958 while (!my_fgets(tmpfff, buf, sizeof(buf)))
3962 if (strncmp(buf, tags[2], strlen(tags[2])) == 0)
3967 if (strncmp(buf, tags[3], strlen(tags[3])) == 0)
3969 fprintf(fff, "%s\n", buf);
3982 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
3991 * Hack -- save a screen dump to a file
3993 static void do_cmd_save_screen_html(void)
3995 char buf[1024], tmp[256] = "screen.html";
3997 if (!get_string(_("ファイル名: ", "File name: "), tmp, 80))
3999 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, tmp);
4003 do_cmd_save_screen_html_aux(buf, 1);
4008 * Redefinable "save_screen" action
4010 void (*screendump_aux)(void) = NULL;
4014 * Save a screen dump to a file
4015 * @param creature_ptr プレーヤーへの参照ポインタ
4018 void do_cmd_save_screen(player_type *creature_ptr)
4020 bool old_use_graphics = use_graphics;
4021 bool html_dump = FALSE;
4023 prt(_("記念撮影しますか? [(y)es/(h)tml/(n)o] ", "Save screen dump? [(y)es/(h)tml/(n)o] "), 0, 0);
4027 if (c == 'Y' || c == 'y')
4029 else if (c == 'H' || c == 'h')
4042 Term_get_size(&wid, &hgt);
4044 if (old_use_graphics)
4046 use_graphics = FALSE;
4048 creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
4054 do_cmd_save_screen_html();
4055 do_cmd_redraw(creature_ptr);
4058 /* Do we use a special screendump function ? */
4059 else if (screendump_aux)
4061 /* Dump the screen to a graphics file */
4062 (*screendump_aux)();
4064 else /* Dump the screen as text */
4068 SYMBOL_CODE c = ' ';
4071 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "dump.txt");
4073 /* File type is "TEXT" */
4074 FILE_TYPE(FILE_TYPE_TEXT);
4076 /* Append to the file */
4077 fff = my_fopen(buf, "w");
4081 msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
4088 /* Dump the screen */
4089 for (y = 0; y < hgt; y++)
4092 for (x = 0; x < wid - 1; x++)
4094 /* Get the attr/char */
4095 (void)(Term_what(x, y, &a, &c));
4105 fprintf(fff, "%s\n", buf);
4112 /* Dump the screen */
4113 for (y = 0; y < hgt; y++)
4116 for (x = 0; x < wid - 1; x++)
4118 /* Get the attr/char */
4119 (void)(Term_what(x, y, &a, &c));
4122 buf[x] = hack[a&0x0F];
4129 fprintf(fff, "%s\n", buf);
4136 msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved."));
4141 if (old_use_graphics)
4143 use_graphics = TRUE;
4145 creature_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
4151 * Check the status of "artifacts"
4153 static void do_cmd_knowledge_artifacts(player_type *player_ptr)
4163 GAME_TEXT file_name[1024];
4164 GAME_TEXT base_name[MAX_NLEN];
4168 /* Open a new file */
4169 fff = my_fopen_temp(file_name, 1024);
4173 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4178 /* Allocate the "who" array */
4179 C_MAKE(who, max_a_idx, ARTIFACT_IDX);
4181 /* Allocate the "okay" array */
4182 C_MAKE(okay, max_a_idx, bool);
4184 /* Scan the artifacts */
4185 for (k = 0; k < max_a_idx; k++)
4187 artifact_type *a_ptr = &a_info[k];
4192 /* Skip "empty" artifacts */
4193 if (!a_ptr->name) continue;
4195 /* Skip "uncreated" artifacts */
4196 if (!a_ptr->cur_num) continue;
4202 /* Check the dungeon */
4203 for (y = 0; y < player_ptr->current_floor_ptr->height; y++)
4205 for (x = 0; x < player_ptr->current_floor_ptr->width; x++)
4207 grid_type *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
4209 OBJECT_IDX this_o_idx, next_o_idx = 0;
4211 /* Scan all objects in the grid */
4212 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
4215 o_ptr = &player_ptr->current_floor_ptr->o_list[this_o_idx];
4216 next_o_idx = o_ptr->next_o_idx;
4218 /* Ignore non-artifacts */
4219 if (!object_is_fixed_artifact(o_ptr)) continue;
4221 /* Ignore known items */
4222 if (object_is_known(o_ptr)) continue;
4224 /* Note the artifact */
4225 okay[o_ptr->name1] = FALSE;
4230 /* Check the player_ptr->inventory_list and equipment */
4231 for (i = 0; i < INVEN_TOTAL; i++)
4233 object_type *o_ptr = &player_ptr->inventory_list[i];
4235 /* Ignore non-objects */
4236 if (!o_ptr->k_idx) continue;
4238 /* Ignore non-artifacts */
4239 if (!object_is_fixed_artifact(o_ptr)) continue;
4241 /* Ignore known items */
4242 if (object_is_known(o_ptr)) continue;
4244 /* Note the artifact */
4245 okay[o_ptr->name1] = FALSE;
4248 for (k = 0; k < max_a_idx; k++)
4250 if (okay[k]) who[n++] = k;
4253 ang_sort(who, &why, n, ang_sort_art_comp, ang_sort_art_swap);
4255 /* Scan the artifacts */
4256 for (k = 0; k < n; k++)
4258 artifact_type *a_ptr = &a_info[who[k]];
4259 strcpy(base_name, _("未知の伝説のアイテム", "Unknown Artifact"));
4261 /* Obtain the base object type */
4262 z = lookup_kind(a_ptr->tval, a_ptr->sval);
4271 /* Create fake object */
4272 object_prep(q_ptr, z);
4274 /* Make it an artifact */
4275 q_ptr->name1 = (byte)who[k];
4277 /* Display as if known */
4278 q_ptr->ident |= IDENT_STORE;
4280 /* Describe the artifact */
4281 object_desc(base_name, q_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4284 /* Hack -- Build the artifact name */
4285 fprintf(fff, _(" %s\n", " The %s\n"), base_name);
4288 /* Free the "who" array */
4289 C_KILL(who, max_a_idx, ARTIFACT_IDX);
4291 /* Free the "okay" array */
4292 C_KILL(okay, max_a_idx, bool);
4295 /* Display the file contents */
4296 show_file(TRUE, file_name, _("既知の伝説のアイテム", "Artifacts Seen"), 0, 0);
4302 * Display known uniques
4303 * With "XTRA HACK UNIQHIST" (Originally from XAngband)
4305 static void do_cmd_knowledge_uniques(void)
4312 GAME_TEXT file_name[1024];
4315 int n_alive_surface = 0;
4316 int n_alive_over100 = 0;
4317 int n_alive_total = 0;
4320 for (IDX i = 0; i < 10; i++) n_alive[i] = 0;
4322 /* Open a new file */
4323 fff = my_fopen_temp(file_name, 1024);
4327 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4332 /* Allocate the "who" array */
4333 C_MAKE(who, max_r_idx, MONRACE_IDX);
4335 /* Scan the monsters */
4337 for (IDX i = 1; i < max_r_idx; i++)
4339 monster_race *r_ptr = &r_info[i];
4342 if (!r_ptr->name) continue;
4344 /* Require unique monsters */
4345 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
4347 /* Only display "known" uniques */
4348 if (!cheat_know && !r_ptr->r_sights) continue;
4350 /* Only print rarity <= 100 uniques */
4351 if (!r_ptr->rarity || ((r_ptr->rarity > 100) && !(r_ptr->flags1 & RF1_QUESTOR))) continue;
4353 /* Only "alive" uniques */
4354 if (r_ptr->max_num == 0) continue;
4358 lev = (r_ptr->level - 1) / 10;
4362 if (max_lev < lev) max_lev = lev;
4364 else n_alive_over100++;
4366 else n_alive_surface++;
4368 /* Collect "appropriate" monsters */
4372 /* Sort the array by dungeon depth of monsters */
4373 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
4375 if (n_alive_surface)
4377 fprintf(fff, _(" 地上 生存: %3d体\n", " Surface alive: %3d\n"), n_alive_surface);
4378 n_alive_total += n_alive_surface;
4381 for (IDX i = 0; i <= max_lev; i++)
4383 fprintf(fff, _("%3d-%3d階 生存: %3d体\n", "Level %3d-%3d alive: %3d\n"), 1 + i * 10, 10 + i * 10, n_alive[i]);
4384 n_alive_total += n_alive[i];
4387 if (n_alive_over100)
4389 fprintf(fff, _("101- 階 生存: %3d体\n", "Level 101- alive: %3d\n"), n_alive_over100);
4390 n_alive_total += n_alive_over100;
4395 fputs(_("--------- -----------\n", "------------- ----------\n"), fff);
4396 fprintf(fff, _(" 合計 生存: %3d体\n\n", " Total alive: %3d\n\n"), n_alive_total);
4400 fputs(_("現在は既知の生存ユニークはいません。\n", "No known uniques alive.\n"), fff);
4403 /* Scan the monster races */
4404 for (int k = 0; k < n; k++)
4406 monster_race *r_ptr = &r_info[who[k]];
4407 fprintf(fff, _(" %s (レベル%d)\n", " %s (level %d)\n"), r_name + r_ptr->name, (int)r_ptr->level);
4410 /* Free the "who" array */
4411 C_KILL(who, max_r_idx, s16b);
4414 /* Display the file contents */
4415 show_file(TRUE, file_name, _("まだ生きているユニーク・モンスター", "Alive Uniques"), 0, 0);
4421 * Display weapon-exp
4423 static void do_cmd_knowledge_weapon_exp(player_type *creature_ptr)
4427 GAME_TEXT file_name[1024];
4430 /* Open a new file */
4432 fff = my_fopen_temp(file_name, 1024);
4435 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4440 for (int i = 0; i < 5; i++)
4442 for (int num = 0; num < 64; num++)
4444 for (KIND_OBJECT_IDX j = 0; j < max_k_idx; j++)
4446 object_kind *k_ptr = &k_info[j];
4448 if ((k_ptr->tval != TV_SWORD - i) || (k_ptr->sval != num)) continue;
4449 if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON || k_ptr->sval == SV_HARP)) continue;
4451 weapon_exp = creature_ptr->weapon_exp[4 - i][num];
4453 fprintf(fff, "%-25s ", tmp);
4454 if (weapon_exp >= s_info[creature_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
4455 else fprintf(fff, " ");
4456 fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
4457 if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
4466 /* Display the file contents */
4467 show_file(TRUE, file_name, _("武器の経験値", "Weapon Proficiency"), 0, 0);
4473 * @brief 魔法の経験値を表示するコマンドのメインルーチン
4477 static void do_cmd_knowledge_spell_exp(player_type *creature_ptr)
4483 const magic_type *s_ptr;
4485 GAME_TEXT file_name[1024];
4487 /* Open a new file */
4488 fff = my_fopen_temp(file_name, 1024);
4491 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4496 if (creature_ptr->realm1 != REALM_NONE)
4498 fprintf(fff, _("%sの魔法書\n", "%s Spellbook\n"), realm_names[creature_ptr->realm1]);
4499 for (SPELL_IDX i = 0; i < 32; i++)
4501 if (!is_magic(creature_ptr->realm1))
4503 s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][i];
4507 s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][i];
4510 if (s_ptr->slevel >= 99) continue;
4511 spell_exp = creature_ptr->spell_exp[i];
4512 exp_level = spell_exp_level(spell_exp);
4513 fprintf(fff, "%-25s ", exe_spell(creature_ptr, creature_ptr->realm1, i, SPELL_NAME));
4514 if (creature_ptr->realm1 == REALM_HISSATSU)
4515 fprintf(fff, "[--]");
4518 if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
4519 else fprintf(fff, " ");
4520 fprintf(fff, "%s", exp_level_str[exp_level]);
4523 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
4528 if (creature_ptr->realm2 != REALM_NONE)
4530 fprintf(fff, _("%sの魔法書\n", "\n%s Spellbook\n"), realm_names[creature_ptr->realm2]);
4531 for (SPELL_IDX i = 0; i < 32; i++)
4533 if (!is_magic(creature_ptr->realm1))
4535 s_ptr = &technic_info[creature_ptr->realm2 - MIN_TECHNIC][i];
4539 s_ptr = &mp_ptr->info[creature_ptr->realm2 - 1][i];
4542 if (s_ptr->slevel >= 99) continue;
4544 spell_exp = creature_ptr->spell_exp[i + 32];
4545 exp_level = spell_exp_level(spell_exp);
4546 fprintf(fff, "%-25s ", exe_spell(creature_ptr, creature_ptr->realm2, i, SPELL_NAME));
4547 if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
4548 else fprintf(fff, " ");
4549 fprintf(fff, "%s", exp_level_str[exp_level]);
4550 if (cheat_xtra) fprintf(fff, " %d", spell_exp);
4557 /* Display the file contents */
4558 show_file(TRUE, file_name, _("魔法の経験値", "Spell Proficiency"), 0, 0);
4564 * @brief スキル情報を表示するコマンドのメインルーチン /
4568 static void do_cmd_knowledge_skill_exp(player_type *creature_ptr)
4570 char file_name[1024];
4571 char skill_name[GINOU_TEMPMAX][20] =
4573 _("マーシャルアーツ", "Martial Arts "),
4574 _("二刀流 ", "Dual Wielding "),
4575 _("乗馬 ", "Riding "),
4579 /* Open a new file */
4581 fff = my_fopen_temp(file_name, 1024);
4584 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4590 for (int i = 0; i < GINOU_TEMPMAX; i++)
4592 skill_exp = creature_ptr->skill_exp[i];
4593 fprintf(fff, "%-20s ", skill_name[i]);
4594 if (skill_exp >= s_info[creature_ptr->pclass].s_max[i]) fprintf(fff, "!");
4595 else fprintf(fff, " ");
4596 fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
4597 if (cheat_xtra) fprintf(fff, " %d", skill_exp);
4603 /* Display the file contents */
4604 show_file(TRUE, file_name, _("技能の経験値", "Miscellaneous Proficiency"), 0, 0);
4610 * @brief 現在のペットを表示するコマンドのメインルーチン /
4611 * Display current pets
4612 * @param creature_ptr プレーヤーへの参照ポインタ
4615 static void do_cmd_knowledge_pets(player_type *creature_ptr)
4617 /* Open a new file */
4618 GAME_TEXT file_name[1024];
4620 fff = my_fopen_temp(file_name, 1024);
4623 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4628 /* Process the monsters (backwards) */
4629 monster_type *m_ptr;
4630 GAME_TEXT pet_name[MAX_NLEN];
4632 for (int i = creature_ptr->current_floor_ptr->m_max - 1; i >= 1; i--)
4634 m_ptr = &creature_ptr->current_floor_ptr->m_list[i];
4636 /* Ignore "dead" monsters */
4637 if (!monster_is_valid(m_ptr)) continue;
4639 /* Calculate "upkeep" for pets */
4640 if (!is_pet(m_ptr)) continue;
4643 monster_desc(pet_name, m_ptr, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
4644 fprintf(fff, "%s (%s)\n", pet_name, look_mon_desc(m_ptr, 0x00));
4647 int show_upkeep = calculate_upkeep(creature_ptr);
4649 fprintf(fff, "----------------------------------------------\n");
4651 fprintf(fff, " 合計: %d 体のペット\n", t_friends);
4653 fprintf(fff, " Total: %d pet%s.\n", t_friends, (t_friends == 1 ? "" : "s"));
4655 fprintf(fff, _(" 維持コスト: %d%% MP\n", " Upkeep: %d%% mana.\n"), show_upkeep);
4659 /* Display the file contents */
4660 show_file(TRUE, file_name, _("現在のペット", "Current Pets"), 0, 0);
4666 * @brief 現在のペットを表示するコマンドのメインルーチン /
4669 * @note the player ghosts are ignored.
4671 static void do_cmd_knowledge_kill_count(void)
4673 /* Open a new file */
4675 GAME_TEXT file_name[1024];
4676 fff = my_fopen_temp(file_name, 1024);
4680 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
4685 /* Allocate the "who" array */
4687 C_MAKE(who, max_r_idx, MONRACE_IDX);
4691 /* Monsters slain */
4692 for (int kk = 1; kk < max_r_idx; kk++)
4694 monster_race *r_ptr = &r_info[kk];
4696 if (r_ptr->flags1 & (RF1_UNIQUE))
4698 bool dead = (r_ptr->max_num == 0);
4707 MONSTER_NUMBER this_monster = r_ptr->r_pkills;
4709 if (this_monster > 0)
4711 total += this_monster;
4717 fprintf(fff,_("あなたはまだ敵を倒していない。\n\n", "You have defeated no enemies yet.\n\n"));
4720 fprintf(fff,"あなたは%ld体の敵を倒している。\n\n", (long int)total);
4722 fprintf(fff,"You have defeated %ld %s.\n\n", (long int)total, (total == 1) ? "enemy" : "enemies");
4728 /* Scan the monsters */
4730 for (MONRACE_IDX i = 1; i < max_r_idx; i++)
4732 monster_race *r_ptr = &r_info[i];
4734 /* Use that monster */
4735 if (r_ptr->name) who[n++] = i;
4738 /* Sort the array by dungeon depth of monsters */
4740 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
4742 /* Scan the monster races */
4743 for (int k = 0; k < n; k++)
4745 monster_race *r_ptr = &r_info[who[k]];
4747 if (r_ptr->flags1 & (RF1_UNIQUE))
4749 bool dead = (r_ptr->max_num == 0);
4753 fprintf(fff, " %s\n", (r_name + r_ptr->name));
4760 MONSTER_NUMBER this_monster = r_ptr->r_pkills;
4762 if (this_monster <= 0) continue;
4765 /* p,tは人と数える by ita */
4766 if (my_strchr("pt", r_ptr->d_char))
4767 fprintf(fff, " %3d 人の %s\n", (int)this_monster, r_name + r_ptr->name);
4769 fprintf(fff, " %3d 体の %s\n", (int)this_monster, r_name + r_ptr->name);
4773 if (my_strstr(r_name + r_ptr->name, "coins"))
4775 fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
4779 fprintf(fff, " 1 %s\n", (r_name + r_ptr->name));
4785 strcpy(ToPlural, (r_name + r_ptr->name));
4786 plural_aux(ToPlural);
4787 fprintf(fff, " %d %s\n", This, ToPlural);
4790 total += this_monster;
4793 fprintf(fff,"----------------------------------------------\n");
4795 fprintf(fff," 合計: %lu 体を倒した。\n", (unsigned long int)total);
4797 fprintf(fff," Total: %lu creature%s killed.\n", (unsigned long int)total, (total == 1 ? "" : "s"));
4800 /* Free the "who" array */
4801 C_KILL(who, max_r_idx, s16b);
4804 /* Display the file contents */
4805 show_file(TRUE, file_name, _("倒した敵の数", "Kill Count"), 0, 0);
4811 * @brief モンスター情報リスト中のグループを表示する /
4812 * Display the object groups.
4816 * @param per_page リストの表示行
4817 * @param grp_idx グループのID配列
4818 * @param group_text グループ名の文字列配列
4819 * @param grp_cur 現在の選択ID
4820 * @param grp_top 現在の選択リスト最上部ID
4823 static void display_group_list(int col, int row, int wid, int per_page, IDX grp_idx[], concptr group_text[], int grp_cur, int grp_top)
4825 /* Display lines until done */
4826 for (int i = 0; i < per_page && (grp_idx[i] >= 0); i++)
4828 /* Get the group index */
4829 int grp = grp_idx[grp_top + i];
4831 /* Choose a color */
4832 TERM_COLOR attr = (grp_top + i == grp_cur) ? TERM_L_BLUE : TERM_WHITE;
4834 /* Erase the entire line */
4835 Term_erase(col, row + i, wid);
4837 /* Display the group label */
4838 c_put_str(attr, group_text[grp], row + i, col);
4844 * Move the cursor in a browser window
4846 static void browser_cursor(char ch, int *column, IDX *grp_cur, int grp_cnt,
4847 IDX *list_cur, int list_cnt)
4852 IDX list = *list_cur;
4854 /* Extract direction */
4857 /* Hack -- scroll up full screen */
4862 /* Hack -- scroll down full screen */
4867 d = get_keymap_dir(ch);
4872 /* Diagonals - hack */
4873 if ((ddx[d] > 0) && ddy[d])
4878 Term_get_size(&wid, &hgt);
4880 browser_rows = hgt - 8;
4882 /* Browse group list */
4887 /* Move up or down */
4888 grp += ddy[d] * (browser_rows - 1);
4891 if (grp >= grp_cnt) grp = grp_cnt - 1;
4892 if (grp < 0) grp = 0;
4893 if (grp != old_grp) list = 0;
4896 /* Browse sub-list list */
4899 /* Move up or down */
4900 list += ddy[d] * browser_rows;
4903 if (list >= list_cnt) list = list_cnt - 1;
4904 if (list < 0) list = 0;
4916 if (col < 0) col = 0;
4917 if (col > 1) col = 1;
4924 /* Browse group list */
4929 /* Move up or down */
4933 if (grp >= grp_cnt) grp = grp_cnt - 1;
4934 if (grp < 0) grp = 0;
4935 if (grp != old_grp) list = 0;
4938 /* Browse sub-list list */
4941 /* Move up or down */
4942 list += (IDX)ddy[d];
4945 if (list >= list_cnt) list = list_cnt - 1;
4946 if (list < 0) list = 0;
4957 static void display_visual_list(int col, int row, int height, int width, TERM_COLOR attr_top, byte char_left)
4961 /* Clear the display lines */
4962 for (i = 0; i < height; i++)
4964 Term_erase(col, row + i, width);
4967 /* Bigtile mode uses double width */
4968 if (use_bigtile) width /= 2;
4970 /* Display lines until done */
4971 for (i = 0; i < height; i++)
4973 /* Display columns until done */
4974 for (j = 0; j < width; j++)
4976 TERM_LEN x = col + j;
4977 TERM_LEN y = row + i;
4979 /* Bigtile mode uses double width */
4980 if (use_bigtile) x += j;
4982 TERM_COLOR ia = attr_top + i;
4983 SYMBOL_CODE ic = char_left + j;
4985 /* Ignore illegal characters */
4986 if (ia > 0x7f || ic > 0xff || ic < ' ' ||
4987 (!use_graphics && ic > 0x7f))
4993 /* Force correct code for both ASCII character and tile */
4994 if (c & 0x80) a |= 0x80;
4996 /* Display symbol */
4997 Term_queue_bigchar(x, y, a, c, 0, 0);
5004 * Place the cursor at the collect position for visual mode
5006 static void place_visual_list_cursor(TERM_LEN col, TERM_LEN row, TERM_COLOR a, byte c, TERM_COLOR attr_top, byte char_left)
5008 int i = (a & 0x7f) - attr_top;
5009 int j = c - char_left;
5011 TERM_LEN x = col + j;
5012 TERM_LEN y = row + i;
5014 /* Bigtile mode uses double width */
5015 if (use_bigtile) x += j;
5017 /* Place the cursor */
5023 * Clipboard variables for copy&paste in visual mode
5025 static TERM_COLOR attr_idx = 0;
5026 static SYMBOL_CODE char_idx = 0;
5028 /* Hack -- for feature lighting */
5029 static TERM_COLOR attr_idx_feat[F_LIT_MAX];
5030 static SYMBOL_CODE char_idx_feat[F_LIT_MAX];
5033 * Do visual mode command -- Change symbols
5035 static bool visual_mode_command(char ch, bool *visual_list_ptr,
5036 int height, int width,
5037 TERM_COLOR *attr_top_ptr, byte *char_left_ptr,
5038 TERM_COLOR *cur_attr_ptr, SYMBOL_CODE *cur_char_ptr, bool *need_redraw)
5040 static TERM_COLOR attr_old = 0;
5041 static SYMBOL_CODE char_old = 0;
5046 if (*visual_list_ptr)
5049 *cur_attr_ptr = attr_old;
5050 *cur_char_ptr = char_old;
5051 *visual_list_ptr = FALSE;
5059 if (*visual_list_ptr)
5062 *visual_list_ptr = FALSE;
5063 *need_redraw = TRUE;
5071 if (!*visual_list_ptr)
5073 *visual_list_ptr = TRUE;
5075 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
5076 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
5078 attr_old = *cur_attr_ptr;
5079 char_old = *cur_char_ptr;
5090 /* Set the visual */
5091 attr_idx = *cur_attr_ptr;
5092 char_idx = *cur_char_ptr;
5094 /* Hack -- for feature lighting */
5095 for (i = 0; i < F_LIT_MAX; i++)
5097 attr_idx_feat[i] = 0;
5098 char_idx_feat[i] = 0;
5105 if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow TERM_DARK text */
5108 *cur_attr_ptr = attr_idx;
5109 *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
5110 if (!*visual_list_ptr) *need_redraw = TRUE;
5116 *cur_char_ptr = char_idx;
5117 *char_left_ptr = MAX(0, *cur_char_ptr - 10);
5118 if (!*visual_list_ptr) *need_redraw = TRUE;
5124 if (*visual_list_ptr)
5127 int d = get_keymap_dir(ch);
5128 TERM_COLOR a = (*cur_attr_ptr & 0x7f);
5129 SYMBOL_CODE c = *cur_char_ptr;
5131 if (use_bigtile) eff_width = width / 2;
5132 else eff_width = width;
5134 /* Restrict direction */
5135 if ((a == 0) && (ddy[d] < 0)) d = 0;
5136 if ((c == 0) && (ddx[d] < 0)) d = 0;
5137 if ((a == 0x7f) && (ddy[d] > 0)) d = 0;
5138 if ((c == 0xff) && (ddx[d] > 0)) d = 0;
5140 a += (TERM_COLOR)ddy[d];
5141 c += (SYMBOL_CODE)ddx[d];
5143 /* Force correct code for both ASCII character and tile */
5144 if (c & 0x80) a |= 0x80;
5146 /* Set the visual */
5151 /* Move the frame */
5152 if ((ddx[d] < 0) && *char_left_ptr > MAX(0, (int)c - 10)) (*char_left_ptr)--;
5153 if ((ddx[d] > 0) && *char_left_ptr + eff_width < MIN(0xff, (int)c + 10)) (*char_left_ptr)++;
5154 if ((ddy[d] < 0) && *attr_top_ptr > MAX(0, (int)(a & 0x7f) - 4)) (*attr_top_ptr)--;
5155 if ((ddy[d] > 0) && *attr_top_ptr + height < MIN(0x7f, (a & 0x7f) + 4)) (*attr_top_ptr)++;
5161 /* Visual mode command is not used */
5167 * Display the monsters in a group.
5169 static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
5170 int mon_cur, int mon_top, bool visual_only)
5174 /* Display lines until done */
5175 for (i = 0; i < per_page && (mon_idx[mon_top + i] >= 0); i++)
5179 /* Get the race index */
5180 MONRACE_IDX r_idx = mon_idx[mon_top + i] ;
5182 /* Access the race */
5183 monster_race *r_ptr = &r_info[r_idx];
5185 /* Choose a color */
5186 attr = ((i + mon_top == mon_cur) ? TERM_L_BLUE : TERM_WHITE);
5188 /* Display the name */
5189 c_prt(attr, (r_name + r_ptr->name), row + i, col);
5191 /* Hack -- visual_list mode */
5194 c_prt(attr, format("%02x/%02x", r_ptr->x_attr, r_ptr->x_char), row + i, (current_world_ptr->wizard || visual_only) ? 56 : 61);
5197 if (current_world_ptr->wizard || visual_only)
5199 c_prt(attr, format("%d", r_idx), row + i, 62);
5202 /* Erase chars before overwritten by the race letter */
5203 Term_erase(69, row + i, 255);
5205 /* Display symbol */
5206 Term_queue_bigchar(use_bigtile ? 69 : 70, row + i, r_ptr->x_attr, r_ptr->x_char, 0, 0);
5211 if (!(r_ptr->flags1 & RF1_UNIQUE))
5212 put_str(format("%5d", r_ptr->r_pkills), row + i, 73);
5214 c_put_str((r_ptr->max_num == 0 ? TERM_L_DARK : TERM_WHITE),
5215 (r_ptr->max_num == 0 ? _("死亡", " dead") : _("生存", "alive")), row + i, 74);
5219 /* Clear remaining lines */
5220 for (; i < per_page; i++)
5222 Term_erase(col, row + i, 255);
5228 * todo 引数の詳細について加筆求む
5229 * Display known monsters.
5230 * @param creature_ptr プレーヤーへの参照ポインタ
5231 * @param need_redraw 画面の再描画が必要な時TRUE
5232 * @param visual_only ???
5233 * @param direct_r_idx モンスターID
5236 static void do_cmd_knowledge_monsters(player_type *creature_ptr, bool *need_redraw, bool visual_only, IDX direct_r_idx)
5239 Term_get_size(&wid, &hgt);
5241 /* Allocate the "mon_idx" array */
5243 C_MAKE(mon_idx, max_r_idx, MONRACE_IDX);
5249 bool visual_list = FALSE;
5250 TERM_COLOR attr_top = 0;
5253 int browser_rows = hgt - 8;
5254 if (direct_r_idx < 0)
5256 mode = visual_only ? 0x03 : 0x01;
5258 /* Check every group */
5260 for (IDX i = 0; monster_group_text[i] != NULL; i++)
5262 /* Measure the label */
5263 len = strlen(monster_group_text[i]);
5265 /* Save the maximum length */
5266 if (len > max) max = len;
5268 /* See if any monsters are known */
5269 if ((monster_group_char[i] == ((char *) -1L)) || collect_monsters(creature_ptr, i, mon_idx, mode))
5271 /* Build a list of groups with known monsters */
5272 grp_idx[grp_cnt++] = i;
5280 mon_idx[0] = direct_r_idx;
5283 /* Terminate the list */
5286 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
5287 &attr_top, &char_left, &r_info[direct_r_idx].x_attr, &r_info[direct_r_idx].x_char, need_redraw);
5290 /* Terminate the list */
5291 grp_idx[grp_cnt] = -1;
5293 mode = visual_only ? 0x02 : 0x00;
5294 IDX old_grp_cur = -1;
5305 monster_race *r_ptr;
5310 prt(format(_("%s - モンスター", "%s - monsters"), !visual_only ? _("知識", "Knowledge") : _("表示", "Visuals")), 2, 0);
5311 if (direct_r_idx < 0) prt(_("グループ", "Group"), 4, 0);
5312 prt(_("名前", "Name"), 4, max + 3);
5313 if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 62);
5314 prt(_("文字", "Sym"), 4, 67);
5315 if (!visual_only) prt(_("殺害数", "Kills"), 4, 72);
5317 for (IDX i = 0; i < 78; i++)
5319 Term_putch(i, 5, TERM_WHITE, '=');
5322 if (direct_r_idx < 0)
5324 for (IDX i = 0; i < browser_rows; i++)
5326 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
5333 if (direct_r_idx < 0)
5335 /* Scroll group list */
5336 if (grp_cur < grp_top) grp_top = grp_cur;
5337 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
5339 /* Display a list of monster groups */
5340 display_group_list(0, 6, max, browser_rows, grp_idx, monster_group_text, grp_cur, grp_top);
5342 if (old_grp_cur != grp_cur)
5344 old_grp_cur = grp_cur;
5346 /* Get a list of monsters in the current group */
5347 mon_cnt = collect_monsters(creature_ptr, grp_idx[grp_cur], mon_idx, mode);
5350 /* Scroll monster list */
5351 while (mon_cur < mon_top)
5352 mon_top = MAX(0, mon_top - browser_rows/2);
5353 while (mon_cur >= mon_top + browser_rows)
5354 mon_top = MIN(mon_cnt - browser_rows, mon_top + browser_rows/2);
5359 /* Display a list of monsters in the current group */
5360 display_monster_list(max + 3, 6, browser_rows, mon_idx, mon_cur, mon_top, visual_only);
5366 /* Display a monster name */
5367 display_monster_list(max + 3, 6, 1, mon_idx, mon_cur, mon_top, visual_only);
5369 /* Display visual list below first monster */
5370 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
5374 prt(format(_("<方向>%s%s%s, ESC", "<dir>%s%s%s, ESC"),
5375 (!visual_list && !visual_only) ? _(", 'r'で思い出を見る", ", 'r' to recall") : "",
5376 visual_list ? _(", ENTERで決定", ", ENTER to accept") : _(", 'v'でシンボル変更", ", 'v' for visuals"),
5377 (attr_idx || char_idx) ? _(", 'c', 'p'でペースト", ", 'c', 'p' to paste") : _(", 'c'でコピー", ", 'c' to copy")),
5380 /* Get the current monster */
5381 r_ptr = &r_info[mon_idx[mon_cur]];
5385 /* Mega Hack -- track this monster race */
5386 if (mon_cnt) monster_race_track(mon_idx[mon_cur]);
5392 place_visual_list_cursor(max + 3, 7, r_ptr->x_attr, r_ptr->x_char, attr_top, char_left);
5396 Term_gotoxy(0, 6 + (grp_cur - grp_top));
5400 Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
5405 /* Do visual mode command if needed */
5406 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))
5408 if (direct_r_idx >= 0)
5433 /* Recall on screen */
5434 if (!visual_list && !visual_only && (mon_idx[mon_cur] > 0))
5436 screen_roff(mon_idx[mon_cur], 0);
5447 /* Move the cursor */
5448 browser_cursor(ch, &column, &grp_cur, grp_cnt, &mon_cur, mon_cnt);
5455 /* Free the "mon_idx" array */
5456 C_KILL(mon_idx, max_r_idx, MONRACE_IDX);
5461 * Display the objects in a group.
5463 static void display_object_list(int col, int row, int per_page, IDX object_idx[],
5464 int object_cur, int object_top, bool visual_only)
5468 /* Display lines until done */
5469 for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++)
5471 GAME_TEXT o_name[MAX_NLEN];
5474 object_kind *flavor_k_ptr;
5476 /* Get the object index */
5477 KIND_OBJECT_IDX k_idx = object_idx[object_top + i];
5479 /* Access the object */
5480 object_kind *k_ptr = &k_info[k_idx];
5482 /* Choose a color */
5483 TERM_COLOR attr = ((k_ptr->aware || visual_only) ? TERM_WHITE : TERM_SLATE);
5484 byte cursor = ((k_ptr->aware || visual_only) ? TERM_L_BLUE : TERM_BLUE);
5487 if (!visual_only && k_ptr->flavor)
5489 /* Appearance of this object is shuffled */
5490 flavor_k_ptr = &k_info[k_ptr->flavor];
5494 /* Appearance of this object is very normal */
5495 flavor_k_ptr = k_ptr;
5498 attr = ((i + object_top == object_cur) ? cursor : attr);
5500 if (!k_ptr->flavor || (!visual_only && k_ptr->aware))
5503 strip_name(o_name, k_idx);
5508 strcpy(o_name, k_name + flavor_k_ptr->flavor_name);
5511 /* Display the name */
5512 c_prt(attr, o_name, row + i, col);
5514 /* Hack -- visual_list mode */
5517 c_prt(attr, format("%02x/%02x", flavor_k_ptr->x_attr, flavor_k_ptr->x_char), row + i, (current_world_ptr->wizard || visual_only) ? 64 : 68);
5520 if (current_world_ptr->wizard || visual_only)
5522 c_prt(attr, format("%d", k_idx), row + i, 70);
5525 a = flavor_k_ptr->x_attr;
5526 c = flavor_k_ptr->x_char;
5528 /* Display symbol */
5529 Term_queue_bigchar(use_bigtile ? 76 : 77, row + i, a, c, 0, 0);
5532 /* Clear remaining lines */
5533 for (; i < per_page; i++)
5535 Term_erase(col, row + i, 255);
5540 * Describe fake object
5542 static void desc_obj_fake(KIND_OBJECT_IDX k_idx)
5545 object_type object_type_body;
5546 o_ptr = &object_type_body;
5548 object_prep(o_ptr, k_idx);
5550 /* It's fully know */
5551 o_ptr->ident |= IDENT_KNOWN;
5553 /* Track the object */
5554 /* object_actual_track(o_ptr); */
5556 /* Hack - mark as fake */
5557 /* term_obj_real = FALSE; */
5560 if (screen_object(o_ptr, SCROBJ_FAKE_OBJECT | SCROBJ_FORCE_DETAIL)) return;
5562 msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
5568 * Display known objects
5570 static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx)
5572 IDX object_old, object_top;
5575 OBJECT_IDX *object_idx;
5577 bool visual_list = FALSE;
5578 TERM_COLOR attr_top = 0;
5583 Term_get_size(&wid, &hgt);
5585 int browser_rows = hgt - 8;
5587 /* Allocate the "object_idx" array */
5588 C_MAKE(object_idx, max_k_idx, KIND_OBJECT_IDX);
5593 if (direct_k_idx < 0)
5595 mode = visual_only ? 0x03 : 0x01;
5597 /* Check every group */
5598 for (IDX i = 0; object_group_text[i] != NULL; i++)
5600 /* Measure the label */
5601 len = strlen(object_group_text[i]);
5603 /* Save the maximum length */
5604 if (len > max) max = len;
5606 /* See if any monsters are known */
5607 if (collect_objects(i, object_idx, mode))
5609 /* Build a list of groups with known monsters */
5610 grp_idx[grp_cnt++] = i;
5619 object_kind *k_ptr = &k_info[direct_k_idx];
5620 object_kind *flavor_k_ptr;
5622 if (!visual_only && k_ptr->flavor)
5624 /* Appearance of this object is shuffled */
5625 flavor_k_ptr = &k_info[k_ptr->flavor];
5629 /* Appearance of this object is very normal */
5630 flavor_k_ptr = k_ptr;
5633 object_idx[0] = direct_k_idx;
5634 object_old = direct_k_idx;
5637 /* Terminate the list */
5640 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
5641 &attr_top, &char_left, &flavor_k_ptr->x_attr, &flavor_k_ptr->x_char, need_redraw);
5644 /* Terminate the list */
5645 grp_idx[grp_cnt] = -1;
5647 mode = visual_only ? 0x02 : 0x00;
5648 IDX old_grp_cur = -1;
5651 IDX object_cur = object_top = 0;
5657 object_kind *k_ptr, *flavor_k_ptr;
5664 prt(format("%s - アイテム", !visual_only ? "知識" : "表示"), 2, 0);
5665 if (direct_k_idx < 0) prt("グループ", 4, 0);
5666 prt("名前", 4, max + 3);
5667 if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 70);
5670 prt(format("%s - objects", !visual_only ? "Knowledge" : "Visuals"), 2, 0);
5671 if (direct_k_idx < 0) prt("Group", 4, 0);
5672 prt("Name", 4, max + 3);
5673 if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 70);
5677 for (IDX i = 0; i < 78; i++)
5679 Term_putch(i, 5, TERM_WHITE, '=');
5682 if (direct_k_idx < 0)
5684 for (IDX i = 0; i < browser_rows; i++)
5686 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
5693 if (direct_k_idx < 0)
5695 /* Scroll group list */
5696 if (grp_cur < grp_top) grp_top = grp_cur;
5697 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
5699 /* Display a list of object groups */
5700 display_group_list(0, 6, max, browser_rows, grp_idx, object_group_text, grp_cur, grp_top);
5702 if (old_grp_cur != grp_cur)
5704 old_grp_cur = grp_cur;
5706 /* Get a list of objects in the current group */
5707 object_cnt = collect_objects(grp_idx[grp_cur], object_idx, mode);
5710 /* Scroll object list */
5711 while (object_cur < object_top)
5712 object_top = MAX(0, object_top - browser_rows/2);
5713 while (object_cur >= object_top + browser_rows)
5714 object_top = MIN(object_cnt - browser_rows, object_top + browser_rows/2);
5719 /* Display a list of objects in the current group */
5720 display_object_list(max + 3, 6, browser_rows, object_idx, object_cur, object_top, visual_only);
5724 object_top = object_cur;
5726 /* Display a list of objects in the current group */
5727 display_object_list(max + 3, 6, 1, object_idx, object_cur, object_top, visual_only);
5729 /* Display visual list below first object */
5730 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
5733 /* Get the current object */
5734 k_ptr = &k_info[object_idx[object_cur]];
5736 if (!visual_only && k_ptr->flavor)
5738 /* Appearance of this object is shuffled */
5739 flavor_k_ptr = &k_info[k_ptr->flavor];
5743 /* Appearance of this object is very normal */
5744 flavor_k_ptr = k_ptr;
5749 prt(format("<方向>%s%s%s, ESC",
5750 (!visual_list && !visual_only) ? ", 'r'で詳細を見る" : "",
5751 visual_list ? ", ENTERで決定" : ", 'v'でシンボル変更",
5752 (attr_idx || char_idx) ? ", 'c', 'p'でペースト" : ", 'c'でコピー"),
5755 prt(format("<dir>%s%s%s, ESC",
5756 (!visual_list && !visual_only) ? ", 'r' to recall" : "",
5757 visual_list ? ", ENTER to accept" : ", 'v' for visuals",
5758 (attr_idx || char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"),
5764 /* Mega Hack -- track this object */
5765 if (object_cnt) object_kind_track(object_idx[object_cur]);
5767 /* The "current" object changed */
5768 if (object_old != object_idx[object_cur])
5772 /* Remember the "current" object */
5773 object_old = object_idx[object_cur];
5779 place_visual_list_cursor(max + 3, 7, flavor_k_ptr->x_attr, flavor_k_ptr->x_char, attr_top, char_left);
5783 Term_gotoxy(0, 6 + (grp_cur - grp_top));
5787 Term_gotoxy(max + 3, 6 + (object_cur - object_top));
5792 /* Do visual mode command if needed */
5793 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))
5795 if (direct_k_idx >= 0)
5820 /* Recall on screen */
5821 if (!visual_list && !visual_only && (grp_cnt > 0))
5823 desc_obj_fake(object_idx[object_cur]);
5831 /* Move the cursor */
5832 browser_cursor(ch, &column, &grp_cur, grp_cnt, &object_cur, object_cnt);
5838 /* Free the "object_idx" array */
5839 C_KILL(object_idx, max_k_idx, KIND_OBJECT_IDX);
5844 * Display the features in a group.
5846 static void display_feature_list(int col, int row, int per_page, FEAT_IDX *feat_idx,
5847 FEAT_IDX feat_cur, FEAT_IDX feat_top, bool visual_only, int lighting_level)
5849 int lit_col[F_LIT_MAX], i, j;
5850 int f_idx_col = use_bigtile ? 62 : 64;
5852 /* Correct columns 1 and 4 */
5853 lit_col[F_LIT_STANDARD] = use_bigtile ? (71 - F_LIT_MAX) : 71;
5854 for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
5855 lit_col[i] = lit_col[F_LIT_STANDARD] + 2 + (i - F_LIT_NS_BEGIN) * 2 + (use_bigtile ? i : 0);
5857 /* Display lines until done */
5858 for (i = 0; i < per_page && (feat_idx[feat_top + i] >= 0); i++)
5861 FEAT_IDX f_idx = feat_idx[feat_top + i];
5862 feature_type *f_ptr = &f_info[f_idx];
5863 int row_i = row + i;
5865 /* Choose a color */
5866 attr = ((i + feat_top == feat_cur) ? TERM_L_BLUE : TERM_WHITE);
5868 /* Display the name */
5869 c_prt(attr, f_name + f_ptr->name, row_i, col);
5871 /* Hack -- visual_list mode */
5874 /* Display lighting level */
5875 c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row_i, col + 1 + strlen(f_name + f_ptr->name));
5877 c_prt(attr, format("%02x/%02x", f_ptr->x_attr[lighting_level], f_ptr->x_char[lighting_level]), row_i, f_idx_col - ((current_world_ptr->wizard || visual_only) ? 6 : 2));
5879 if (current_world_ptr->wizard || visual_only)
5881 c_prt(attr, format("%d", f_idx), row_i, f_idx_col);
5884 /* Display symbol */
5885 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);
5887 Term_putch(lit_col[F_LIT_NS_BEGIN], row_i, TERM_SLATE, '(');
5888 for (j = F_LIT_NS_BEGIN + 1; j < F_LIT_MAX; j++)
5890 Term_putch(lit_col[j], row_i, TERM_SLATE, '/');
5892 Term_putch(lit_col[F_LIT_MAX - 1] + (use_bigtile ? 3 : 2), row_i, TERM_SLATE, ')');
5894 /* Mega-hack -- Use non-standard colour */
5895 for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
5897 Term_queue_bigchar(lit_col[j] + 1, row_i, f_ptr->x_attr[j], f_ptr->x_char[j], 0, 0);
5901 /* Clear remaining lines */
5902 for (; i < per_page; i++)
5904 Term_erase(col, row + i, 255);
5910 * Interact with feature visuals.
5912 static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level)
5914 TERM_COLOR attr_old[F_LIT_MAX];
5915 (void)C_WIPE(attr_old, F_LIT_MAX, TERM_COLOR);
5916 SYMBOL_CODE char_old[F_LIT_MAX];
5917 (void)C_WIPE(char_old, F_LIT_MAX, SYMBOL_CODE);
5920 Term_get_size(&wid, &hgt);
5922 /* Allocate the "feat_idx" array */
5924 C_MAKE(feat_idx, max_f_idx, FEAT_IDX);
5930 FEAT_IDX grp_idx[100];
5931 TERM_COLOR attr_top = 0;
5932 bool visual_list = FALSE;
5934 TERM_LEN browser_rows = hgt - 8;
5935 if (direct_f_idx < 0)
5937 /* Check every group */
5938 for (FEAT_IDX i = 0; feature_group_text[i] != NULL; i++)
5940 /* Measure the label */
5941 len = strlen(feature_group_text[i]);
5943 /* Save the maximum length */
5944 if (len > max) max = len;
5946 /* See if any features are known */
5947 if (collect_features(i, feat_idx, 0x01))
5949 /* Build a list of groups with known features */
5950 grp_idx[grp_cnt++] = i;
5958 feature_type *f_ptr = &f_info[direct_f_idx];
5960 feat_idx[0] = direct_f_idx;
5963 /* Terminate the list */
5966 (void)visual_mode_command('v', &visual_list, browser_rows - 1, wid - (max + 3),
5967 &attr_top, &char_left, &f_ptr->x_attr[*lighting_level], &f_ptr->x_char[*lighting_level], need_redraw);
5969 for (FEAT_IDX i = 0; i < F_LIT_MAX; i++)
5971 attr_old[i] = f_ptr->x_attr[i];
5972 char_old[i] = f_ptr->x_char[i];
5976 /* Terminate the list */
5977 grp_idx[grp_cnt] = -1;
5979 FEAT_IDX old_grp_cur = -1;
5980 FEAT_IDX grp_cur = 0;
5981 FEAT_IDX grp_top = 0;
5982 FEAT_IDX feat_cur = 0;
5983 FEAT_IDX feat_top = 0;
5984 TERM_LEN column = 0;
5987 TERM_COLOR *cur_attr_ptr;
5988 SYMBOL_CODE *cur_char_ptr;
5992 feature_type *f_ptr;
5998 prt(_("表示 - 地形", "Visuals - features"), 2, 0);
5999 if (direct_f_idx < 0) prt(_("グループ", "Group"), 4, 0);
6000 prt(_("名前", "Name"), 4, max + 3);
6003 if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 62);
6004 prt(_("文字 ( l/ d)", "Sym ( l/ d)"), 4, 66);
6008 if (current_world_ptr->wizard || visual_only) prt("Idx", 4, 64);
6009 prt(_("文字 (l/d)", "Sym (l/d)"), 4, 68);
6012 for (FEAT_IDX i = 0; i < 78; i++)
6014 Term_putch(i, 5, TERM_WHITE, '=');
6017 if (direct_f_idx < 0)
6019 for (FEAT_IDX i = 0; i < browser_rows; i++)
6021 Term_putch(max + 1, 6 + i, TERM_WHITE, '|');
6028 if (direct_f_idx < 0)
6030 /* Scroll group list */
6031 if (grp_cur < grp_top) grp_top = grp_cur;
6032 if (grp_cur >= grp_top + browser_rows) grp_top = grp_cur - browser_rows + 1;
6034 /* Display a list of feature groups */
6035 display_group_list(0, 6, max, browser_rows, grp_idx, feature_group_text, grp_cur, grp_top);
6037 if (old_grp_cur != grp_cur)
6039 old_grp_cur = grp_cur;
6041 /* Get a list of features in the current group */
6042 feat_cnt = collect_features(grp_idx[grp_cur], feat_idx, 0x00);
6045 /* Scroll feature list */
6046 while (feat_cur < feat_top)
6047 feat_top = MAX(0, feat_top - browser_rows/2);
6048 while (feat_cur >= feat_top + browser_rows)
6049 feat_top = MIN(feat_cnt - browser_rows, feat_top + browser_rows/2);
6054 /* Display a list of features in the current group */
6055 display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, visual_only, F_LIT_STANDARD);
6059 feat_top = feat_cur;
6061 /* Display a list of features in the current group */
6062 display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, visual_only, *lighting_level);
6064 /* Display visual list below first object */
6065 display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
6069 prt(format(_("<方向>%s, 'd'で標準光源効果%s, ESC", "<dir>%s, 'd' for default lighting%s, ESC"),
6070 visual_list ? _(", ENTERで決定, 'a'で対象明度変更", ", ENTER to accept, 'a' for lighting level") : _(", 'v'でシンボル変更", ", 'v' for visuals"),
6071 (attr_idx || char_idx) ? _(", 'c', 'p'でペースト", ", 'c', 'p' to paste") : _(", 'c'でコピー", ", 'c' to copy")),
6074 /* Get the current feature */
6075 f_ptr = &f_info[feat_idx[feat_cur]];
6076 cur_attr_ptr = &f_ptr->x_attr[*lighting_level];
6077 cur_char_ptr = &f_ptr->x_char[*lighting_level];
6081 place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
6085 Term_gotoxy(0, 6 + (grp_cur - grp_top));
6089 Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
6094 if (visual_list && ((ch == 'A') || (ch == 'a')))
6096 int prev_lighting_level = *lighting_level;
6100 if (*lighting_level <= 0) *lighting_level = F_LIT_MAX - 1;
6101 else (*lighting_level)--;
6105 if (*lighting_level >= F_LIT_MAX - 1) *lighting_level = 0;
6106 else (*lighting_level)++;
6109 if (f_ptr->x_attr[prev_lighting_level] != f_ptr->x_attr[*lighting_level])
6110 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
6112 if (f_ptr->x_char[prev_lighting_level] != f_ptr->x_char[*lighting_level])
6113 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
6118 else if ((ch == 'D') || (ch == 'd'))
6120 TERM_COLOR prev_x_attr = f_ptr->x_attr[*lighting_level];
6121 byte prev_x_char = f_ptr->x_char[*lighting_level];
6123 apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char);
6127 if (prev_x_attr != f_ptr->x_attr[*lighting_level])
6128 attr_top = MAX(0, (f_ptr->x_attr[*lighting_level] & 0x7f) - 5);
6130 if (prev_x_char != f_ptr->x_char[*lighting_level])
6131 char_left = MAX(0, f_ptr->x_char[*lighting_level] - 10);
6133 else *need_redraw = TRUE;
6138 /* Do visual mode command if needed */
6139 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))
6143 /* Restore previous visual settings */
6145 for (FEAT_IDX i = 0; i < F_LIT_MAX; i++)
6147 f_ptr->x_attr[i] = attr_old[i];
6148 f_ptr->x_char[i] = char_old[i];
6155 if (direct_f_idx >= 0) flag = TRUE;
6156 else *lighting_level = F_LIT_STANDARD;
6159 /* Preserve current visual settings */
6162 for (FEAT_IDX i = 0; i < F_LIT_MAX; i++)
6164 attr_old[i] = f_ptr->x_attr[i];
6165 char_old[i] = f_ptr->x_char[i];
6167 *lighting_level = F_LIT_STANDARD;
6174 for (FEAT_IDX i = 0; i < F_LIT_MAX; i++)
6176 attr_idx_feat[i] = f_ptr->x_attr[i];
6177 char_idx_feat[i] = f_ptr->x_char[i];
6186 /* Allow TERM_DARK text */
6187 for (FEAT_IDX i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
6189 if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
6190 if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
6208 /* Move the cursor */
6209 browser_cursor(ch, &column, &grp_cur, grp_cnt, &feat_cur, feat_cnt);
6215 /* Free the "feat_idx" array */
6216 C_KILL(feat_idx, max_f_idx, FEAT_IDX);
6221 * List wanted monsters
6222 * @param creature_ptr プレーヤーへの参照ポインタ
6225 static void do_cmd_knowledge_kubi(player_type *creature_ptr)
6227 /* Open a new file */
6229 GAME_TEXT file_name[1024];
6230 fff = my_fopen_temp(file_name, 1024);
6233 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6240 bool listed = FALSE;
6242 fprintf(fff, _("今日のターゲット : %s\n", "Today target : %s\n"),
6243 (creature_ptr->today_mon ? r_name + r_info[creature_ptr->today_mon].name : _("不明", "unknown")));
6245 fprintf(fff, _("賞金首リスト\n", "List of wanted monsters\n"));
6246 fprintf(fff, "----------------------------------------------\n");
6248 for (int i = 0; i < MAX_KUBI; i++)
6250 if (current_world_ptr->bounty_r_idx[i] <= 10000)
6252 fprintf(fff,"%s\n", r_name + r_info[current_world_ptr->bounty_r_idx[i]].name);
6259 fprintf(fff,"\n%s\n", _("賞金首はもう残っていません。", "There is no more wanted monster."));
6265 /* Display the file contents */
6266 show_file(TRUE, file_name, _("賞金首の一覧", "Wanted monsters"), 0, 0);
6271 * List virtues & status
6273 static void do_cmd_knowledge_virtues(player_type *creature_ptr)
6275 /* Open a new file */
6277 GAME_TEXT file_name[1024];
6278 fff = my_fopen_temp(file_name, 1024);
6281 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6288 fprintf(fff, _("現在の属性 : %s\n\n", "Your alighnment : %s\n\n"), your_alignment(creature_ptr));
6289 dump_virtues(creature_ptr, fff);
6294 /* Display the file contents */
6295 show_file(TRUE, file_name, _("八つの徳", "Virtues"), 0, 0);
6302 static void do_cmd_knowledge_dungeon(void)
6304 /* Open a new file */
6306 GAME_TEXT file_name[1024];
6307 fff = my_fopen_temp(file_name, 1024);
6310 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6317 for (int i = 1; i < current_world_ptr->max_d_idx; i++)
6321 if (!d_info[i].maxdepth) continue;
6322 if (!max_dlv[i]) continue;
6323 if (d_info[i].final_guardian)
6325 if (!r_info[d_info[i].final_guardian].max_num) seiha = TRUE;
6327 else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE;
6329 fprintf(fff, _("%c%-12s : %3d 階\n", "%c%-16s : level %3d\n"), seiha ? '!' : ' ', d_name + d_info[i].name, (int)max_dlv[i]);
6335 /* Display the file contents */
6336 show_file(TRUE, file_name, _("今までに入ったダンジョン", "Dungeon"), 0, 0);
6341 * List virtues & status
6344 static void do_cmd_knowledge_stat(player_type *creature_ptr)
6346 /* Open a new file */
6348 GAME_TEXT file_name[1024];
6349 fff = my_fopen_temp(file_name, 1024);
6352 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6357 int percent = (int)(((long)creature_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) /
6358 (2 * creature_ptr->hitdie +
6359 ((PY_MAX_LEVEL - 1 + 3) * (creature_ptr->hitdie + 1))));
6361 if (creature_ptr->knowledge & KNOW_HPRATE)
6362 fprintf(fff, _("現在の体力ランク : %d/100\n\n", "Your current Life Rating is %d/100.\n\n"), percent);
6363 else fprintf(fff, _("現在の体力ランク : ???\n\n", "Your current Life Rating is ???.\n\n"));
6365 fprintf(fff, _("能力の最大値\n\n", "Limits of maximum stats\n\n"));
6366 for (int v_nr = 0; v_nr < A_MAX; v_nr++)
6368 if ((creature_ptr->knowledge & KNOW_STAT) || creature_ptr->stat_max[v_nr] == creature_ptr->stat_max_max[v_nr]) fprintf(fff, "%s 18/%d\n", stat_names[v_nr], creature_ptr->stat_max_max[v_nr] - 18);
6369 else fprintf(fff, "%s ???\n", stat_names[v_nr]);
6372 dump_yourself(creature_ptr, fff);
6375 /* Display the file contents */
6376 show_file(TRUE, file_name, _("自分に関する情報", "HP-rate & Max stat"), 0, 0);
6382 * todo player_typeではなくQUEST_IDXを引数にすべきかもしれない
6383 * Print all active quests
6384 * @param creature_ptr プレーヤーへの参照ポインタ
6387 static void do_cmd_knowledge_quests_current(player_type *creature_ptr, FILE *fff)
6390 char rand_tmp_str[120] = "\0";
6391 GAME_TEXT name[MAX_NLEN];
6392 monster_race *r_ptr;
6393 int rand_level = 100;
6396 fprintf(fff, _("《遂行中のクエスト》\n", "< Current Quest >\n"));
6398 for (QUEST_IDX i = 1; i < max_q_idx; i++)
6400 bool is_no_print = quest[i].status != QUEST_STATUS_TAKEN;
6401 is_no_print &= (quest[i].status != QUEST_STATUS_STAGE_COMPLETED) || (quest[i].type != QUEST_TYPE_TOWER);
6402 is_no_print &= quest[i].status == QUEST_STATUS_COMPLETED;
6406 /* Set the quest number temporary */
6407 QUEST_IDX old_quest = creature_ptr->current_floor_ptr->inside_quest;
6409 /* Clear the text */
6410 for (int j = 0; j < 10; j++) quest_text[j][0] = '\0';
6411 quest_text_line = 0;
6413 creature_ptr->current_floor_ptr->inside_quest = i;
6415 /* Get the quest text */
6416 init_flags = INIT_SHOW_TEXT;
6418 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
6420 /* Reset the old quest number */
6421 creature_ptr->current_floor_ptr->inside_quest = old_quest;
6423 /* No info from "silent" quests */
6424 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
6428 if (quest[i].type != QUEST_TYPE_RANDOM)
6430 char note[80] = "\0";
6432 if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_STAGE_COMPLETED)
6434 switch (quest[i].type)
6436 case QUEST_TYPE_KILL_LEVEL:
6437 case QUEST_TYPE_KILL_ANY_LEVEL:
6438 r_ptr = &r_info[quest[i].r_idx];
6439 strcpy(name, r_name + r_ptr->name);
6440 if (quest[i].max_num > 1)
6443 sprintf(note, " - %d 体の%sを倒す。(あと %d 体)",
6444 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
6447 sprintf(note, " - kill %d %s, have killed %d.",
6448 (int)quest[i].max_num, name, (int)quest[i].cur_num);
6452 sprintf(note, _(" - %sを倒す。", " - kill %s."), name);
6455 case QUEST_TYPE_FIND_ARTIFACT:
6458 artifact_type *a_ptr = &a_info[quest[i].k_idx];
6460 object_type *q_ptr = &forge;
6461 KIND_OBJECT_IDX k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
6462 object_prep(q_ptr, k_idx);
6463 q_ptr->name1 = quest[i].k_idx;
6464 q_ptr->ident = IDENT_STORE;
6465 object_desc(name, q_ptr, OD_NAME_ONLY);
6467 sprintf(note, _("\n - %sを見つけ出す。", "\n - Find out %s."), name);
6469 case QUEST_TYPE_FIND_EXIT:
6470 sprintf(note, _(" - 出口に到達する。", " - Reach to Exit."));
6473 case QUEST_TYPE_KILL_NUMBER:
6475 sprintf(note, " - %d 体のモンスターを倒す。(あと %d 体)",
6476 (int)quest[i].max_num, (int)(quest[i].max_num - quest[i].cur_num));
6478 sprintf(note, " - Kill %d monsters, have killed %d.",
6479 (int)quest[i].max_num, (int)quest[i].cur_num);
6483 case QUEST_TYPE_KILL_ALL:
6484 case QUEST_TYPE_TOWER:
6485 sprintf(note, _(" - 全てのモンスターを倒す。", " - Kill all monsters."));
6490 /* Print the quest info */
6491 sprintf(tmp_str, _(" %s (危険度:%d階相当)%s\n", " %s (Danger level: %d)%s\n"),
6492 quest[i].name, (int)quest[i].level, note);
6494 fputs(tmp_str, fff);
6496 if (quest[i].status == QUEST_STATUS_COMPLETED)
6498 sprintf(tmp_str, _(" クエスト達成 - まだ報酬を受けとってない。\n", " Quest Completed - Unrewarded\n"));
6499 fputs(tmp_str, fff);
6504 while (quest_text[k][0] && k < 10)
6506 fprintf(fff, " %s\n", quest_text[k]);
6513 /* QUEST_TYPE_RANDOM */
6514 if (quest[i].level >= rand_level)
6518 rand_level = quest[i].level;
6520 if (max_dlv[DUNGEON_ANGBAND] < rand_level) continue;
6522 /* Print the quest info */
6523 r_ptr = &r_info[quest[i].r_idx];
6524 strcpy(name, r_name + r_ptr->name);
6526 if (quest[i].max_num <= 1)
6528 sprintf(rand_tmp_str, _(" %s (%d 階) - %sを倒す。\n", " %s (Dungeon level: %d)\n Kill %s.\n"),
6529 quest[i].name, (int)quest[i].level, name);
6534 sprintf(rand_tmp_str, " %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
6535 quest[i].name, (int)quest[i].level,
6536 (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num));
6540 sprintf(rand_tmp_str, " %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
6541 quest[i].name, (int)quest[i].level,
6542 (int)quest[i].max_num, name, (int)quest[i].cur_num);
6546 /* Print the current random quest */
6547 if (rand_tmp_str[0]) fputs(rand_tmp_str, fff);
6549 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
6553 static bool do_cmd_knowledge_quests_aux(FILE *fff, floor_type *floor_ptr, IDX q_idx)
6556 char playtime_str[16];
6557 quest_type* const q_ptr = &quest[q_idx];
6559 if (is_fixed_quest_idx(q_idx))
6561 /* Set the quest number temporary */
6562 IDX old_quest = floor_ptr->inside_quest;
6564 floor_ptr->inside_quest = q_idx;
6567 init_flags = INIT_NAME_ONLY;
6569 process_dungeon_file("q_info.txt", 0, 0, 0, 0);
6571 /* Reset the old quest number */
6572 floor_ptr->inside_quest = old_quest;
6574 /* No info from "silent" quests */
6575 if (q_ptr->flags & QUEST_FLAG_SILENT) return FALSE;
6578 strnfmt(playtime_str, sizeof(playtime_str), "%02d:%02d:%02d",
6579 q_ptr->comptime/(60*60), (q_ptr->comptime/60)%60, q_ptr->comptime%60);
6581 if (is_fixed_quest_idx(q_idx) && q_ptr->r_idx)
6583 /* Print the quest info */
6585 _(" %-35s (危険度:%3d階相当) - レベル%2d - %s\n",
6586 " %-35s (Danger level: %3d) - level %2d - %s\n"),
6587 q_ptr->name, (int)q_ptr->level, q_ptr->complev, playtime_str);
6588 fputs(tmp_str, fff);
6592 /* Print the quest info */
6593 if (q_ptr->complev == 0)
6596 _(" %-35s (%3d階) - 不戦勝 - %s\n",
6597 " %-35s (Dungeon level: %3d) - Unearned - %s\n"),
6598 r_name + r_info[q_ptr->r_idx].name,
6599 (int)q_ptr->level, playtime_str);
6604 _(" %-35s (%3d階) - レベル%2d - %s\n",
6605 " %-35s (Dungeon level: %3d) - level %2d - %s\n"),
6606 r_name + r_info[q_ptr->r_idx].name,
6612 fputs(tmp_str, fff);
6618 * Print all finished quests
6619 * @param creature_ptr プレーヤーへの参照ポインタ
6620 * @param fff セーブファイル (展開済?)
6621 * @param quest_num[] 受注したことのあるクエスト群
6624 void do_cmd_knowledge_quests_completed(player_type *creature_ptr, FILE *fff, QUEST_IDX quest_num[])
6626 fprintf(fff, _("《達成したクエスト》\n", "< Completed Quest >\n"));
6627 QUEST_IDX total = 0;
6628 for (QUEST_IDX i = 1; i < max_q_idx; i++)
6630 QUEST_IDX q_idx = quest_num[i];
6631 quest_type* const q_ptr = &quest[q_idx];
6633 if (q_ptr->status == QUEST_STATUS_FINISHED && do_cmd_knowledge_quests_aux(fff, creature_ptr->current_floor_ptr, q_idx))
6639 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
6644 * Print all failed quests
6645 * @param creature_ptr プレーヤーへの参照ポインタ
6646 * @param fff セーブファイル (展開済?)
6647 * @param quest_num[] 受注したことのあるクエスト群
6650 void do_cmd_knowledge_quests_failed(player_type *creature_ptr, FILE *fff, QUEST_IDX quest_num[])
6652 fprintf(fff, _("《失敗したクエスト》\n", "< Failed Quest >\n"));
6653 QUEST_IDX total = 0;
6654 for (QUEST_IDX i = 1; i < max_q_idx; i++)
6656 QUEST_IDX q_idx = quest_num[i];
6657 quest_type* const q_ptr = &quest[q_idx];
6659 if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) &&
6660 do_cmd_knowledge_quests_aux(fff, creature_ptr->current_floor_ptr, q_idx))
6666 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
6671 * Print all random quests
6673 static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
6675 fprintf(fff, _("《残りのランダムクエスト》\n", "< Remaining Random Quest >\n"));
6676 GAME_TEXT tmp_str[120];
6677 QUEST_IDX total = 0;
6678 for (QUEST_IDX i = 1; i < max_q_idx; i++)
6680 /* No info from "silent" quests */
6681 if (quest[i].flags & QUEST_FLAG_SILENT) continue;
6683 if ((quest[i].type == QUEST_TYPE_RANDOM) && (quest[i].status == QUEST_STATUS_TAKEN))
6687 /* Print the quest info */
6688 sprintf(tmp_str, _(" %s (%d階, %s)\n", " %s (%d, %s)\n"),
6689 quest[i].name, (int)quest[i].level, r_name+r_info[quest[i].r_idx].name);
6690 fputs(tmp_str, fff);
6694 if (!total) fprintf(fff, _(" なし\n", " Nothing.\n"));
6698 * Print quest status of all active quests
6699 * @param creature_ptr プレーヤーへの参照ポインタ
6702 static void do_cmd_knowledge_quests(player_type *creature_ptr)
6704 /* Open a new file */
6706 GAME_TEXT file_name[1024];
6707 fff = my_fopen_temp(file_name, 1024);
6710 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6715 /* Allocate Memory */
6717 C_MAKE(quest_num, max_q_idx, QUEST_IDX);
6719 /* Sort by compete level */
6720 for (IDX i = 1; i < max_q_idx; i++) quest_num[i] = i;
6722 ang_sort(quest_num, &dummy, max_q_idx, ang_sort_comp_quest_num, ang_sort_swap_quest_num);
6724 /* Dump Quest Information */
6725 do_cmd_knowledge_quests_current(creature_ptr, fff);
6727 do_cmd_knowledge_quests_completed(creature_ptr, fff, quest_num);
6729 do_cmd_knowledge_quests_failed(creature_ptr, fff, quest_num);
6730 if (current_world_ptr->wizard)
6733 do_cmd_knowledge_quests_wiz_random(fff);
6738 /* Display the file contents */
6739 show_file(TRUE, file_name, _("クエスト達成状況", "Quest status"), 0, 0);
6743 C_KILL(quest_num, max_q_idx, QUEST_IDX);
6750 static void do_cmd_knowledge_home(void)
6752 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
6754 /* Open a new file */
6756 GAME_TEXT file_name[1024];
6757 fff = my_fopen_temp(file_name, 1024);
6760 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6765 /* Print all homes in the different towns */
6767 st_ptr = &town_info[1].store[STORE_HOME];
6769 /* Home -- if anything there */
6770 if (st_ptr->stock_num)
6775 /* Header with name of the town */
6776 fprintf(fff, _(" [ 我が家のアイテム ]\n", " [Home Inventory]\n"));
6778 /* Dump all available items */
6779 concptr paren = ")";
6780 GAME_TEXT o_name[MAX_NLEN];
6781 for (int i = 0; i < st_ptr->stock_num; i++)
6784 if ((i % 12) == 0) fprintf(fff, "\n ( %d ページ )\n", x++);
6785 object_desc(o_name, &st_ptr->stock[i], 0);
6786 if (strlen(o_name) <= 80 - 3)
6788 fprintf(fff, "%c%s %s\n", I2A(i % 12), paren, o_name);
6794 for (n = 0, t = o_name; n < 80 - 3; n++, t++)
6795 if (iskanji(*t)) { t++; n++; }
6796 if (n == 81 - 3) n = 79 - 3; /* 最後が漢字半分 */
6798 fprintf(fff, "%c%s %.*s\n", I2A(i % 12), paren, n, o_name);
6799 fprintf(fff, " %.77s\n", o_name + n);
6802 object_desc(o_name, &st_ptr->stock[i], 0);
6803 fprintf(fff, "%c%s %s\n", I2A(i % 12), paren, o_name);
6807 /* Add an empty line */
6808 fprintf(fff, "\n\n");
6813 /* Display the file contents */
6814 show_file(TRUE, file_name, _("我が家のアイテム", "Home Inventory"), 0, 0);
6820 * Check the status of "autopick"
6822 static void do_cmd_knowledge_autopick(void)
6824 /* Open a new file */
6826 GAME_TEXT file_name[1024];
6827 fff = my_fopen_temp(file_name, 1024);
6830 msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name);
6837 fprintf(fff, _("自動破壊/拾いには何も登録されていません。", "No preference for auto picker/destroyer."));
6841 fprintf(fff, _(" 自動拾い/破壊には現在 %d行登録されています。\n\n",
6842 " There are %d registered lines for auto picker/destroyer.\n\n"), max_autopick);
6845 for (int k = 0; k < max_autopick; k++)
6848 byte act = autopick_list[k].action;
6849 if (act & DONT_AUTOPICK)
6851 tmp = _("放置", "Leave");
6853 else if (act & DO_AUTODESTROY)
6855 tmp = _("破壊", "Destroy");
6857 else if (act & DO_AUTOPICK)
6859 tmp = _("拾う", "Pickup");
6863 tmp = _("確認", "Query");
6866 if (act & DO_DISPLAY)
6867 fprintf(fff, "%11s", format("[%s]", tmp));
6869 fprintf(fff, "%11s", format("(%s)", tmp));
6871 tmp = autopick_line_from_entry(&autopick_list[k]);
6872 fprintf(fff, " %s", tmp);
6879 /* Display the file contents */
6880 show_file(TRUE, file_name, _("自動拾い/破壊 設定リスト", "Auto-picker/Destroyer"), 0, 0);
6886 * Interact with "knowledge"
6888 void do_cmd_knowledge(player_type *creature_ptr)
6891 bool need_redraw = FALSE;
6893 /* File type is "TEXT" */
6894 FILE_TYPE(FILE_TYPE_TEXT);
6897 /* Interact until done */
6902 /* Ask for a choice */
6903 prt(format(_("%d/2 ページ", "page %d/2"), (p+1)), 2, 65);
6904 prt(_("現在の知識を確認する", "Display current knowledge"), 3, 0);
6906 /* Give some choices */
6910 prt("(1) 既知の伝説のアイテム の一覧", 6, 5);
6911 prt("(2) 既知のアイテム の一覧", 7, 5);
6912 prt("(3) 既知の生きているユニーク・モンスター の一覧", 8, 5);
6913 prt("(4) 既知のモンスター の一覧", 9, 5);
6914 prt("(5) 倒した敵の数 の一覧", 10, 5);
6915 if (!vanilla_town) prt("(6) 賞金首 の一覧", 11, 5);
6916 prt("(7) 現在のペット の一覧", 12, 5);
6917 prt("(8) 我が家のアイテム の一覧", 13, 5);
6918 prt("(9) *鑑定*済み装備の耐性 の一覧", 14, 5);
6919 prt("(0) 地形の表示文字/タイル の一覧", 15, 5);
6923 prt("(a) 自分に関する情報 の一覧", 6, 5);
6924 prt("(b) 突然変異 の一覧", 7, 5);
6925 prt("(c) 武器の経験値 の一覧", 8, 5);
6926 prt("(d) 魔法の経験値 の一覧", 9, 5);
6927 prt("(e) 技能の経験値 の一覧", 10, 5);
6928 prt("(f) プレイヤーの徳 の一覧", 11, 5);
6929 prt("(g) 入ったダンジョン の一覧", 12, 5);
6930 prt("(h) 実行中のクエスト の一覧", 13, 5);
6931 prt("(i) 現在の自動拾い/破壊設定 の一覧", 14, 5);
6936 prt("(1) Display known artifacts", 6, 5);
6937 prt("(2) Display known objects", 7, 5);
6938 prt("(3) Display remaining uniques", 8, 5);
6939 prt("(4) Display known monster", 9, 5);
6940 prt("(5) Display kill count", 10, 5);
6941 if (!vanilla_town) prt("(6) Display wanted monsters", 11, 5);
6942 prt("(7) Display current pets", 12, 5);
6943 prt("(8) Display home inventory", 13, 5);
6944 prt("(9) Display *identified* equip.", 14, 5);
6945 prt("(0) Display terrain symbols.", 15, 5);
6949 prt("(a) Display about yourself", 6, 5);
6950 prt("(b) Display mutations", 7, 5);
6951 prt("(c) Display weapon proficiency", 8, 5);
6952 prt("(d) Display spell proficiency", 9, 5);
6953 prt("(e) Display misc. proficiency", 10, 5);
6954 prt("(f) Display virtues", 11, 5);
6955 prt("(g) Display dungeons", 12, 5);
6956 prt("(h) Display current quests", 13, 5);
6957 prt("(i) Display auto pick/destroy", 14, 5);
6961 prt(_("-続く-", "-more-"), 17, 8);
6962 prt(_("ESC) 抜ける", "ESC) Exit menu"), 21, 1);
6963 prt(_("SPACE) 次ページ", "SPACE) Next page"), 21, 30);
6964 /*prt("-) 前ページ", 21, 60);*/
6965 prt(_("コマンド:", "Command: "), 20, 0);
6968 if (i == ESCAPE) break;
6971 case ' ': /* Page change */
6975 case '1': /* Artifacts */
6976 do_cmd_knowledge_artifacts(creature_ptr);
6978 case '2': /* Objects */
6979 do_cmd_knowledge_objects(&need_redraw, FALSE, -1);
6981 case '3': /* Uniques */
6982 do_cmd_knowledge_uniques();
6984 case '4': /* Monsters */
6985 do_cmd_knowledge_monsters(creature_ptr, &need_redraw, FALSE, -1);
6987 case '5': /* Kill count */
6988 do_cmd_knowledge_kill_count();
6990 case '6': /* wanted */
6991 if (!vanilla_town) do_cmd_knowledge_kubi(creature_ptr);
6993 case '7': /* Pets */
6994 do_cmd_knowledge_pets(creature_ptr);
6996 case '8': /* Home */
6997 do_cmd_knowledge_home();
6999 case '9': /* Resist list */
7000 do_cmd_knowledge_inven(creature_ptr);
7002 case '0': /* Feature list */
7004 IDX lighting_level = F_LIT_STANDARD;
7005 do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
7009 case 'a': /* Max stat */
7010 do_cmd_knowledge_stat(creature_ptr);
7012 case 'b': /* Mutations */
7013 do_cmd_knowledge_mutations(creature_ptr);
7015 case 'c': /* weapon-exp */
7016 do_cmd_knowledge_weapon_exp(creature_ptr);
7018 case 'd': /* spell-exp */
7019 do_cmd_knowledge_spell_exp(creature_ptr);
7021 case 'e': /* skill-exp */
7022 do_cmd_knowledge_skill_exp(creature_ptr);
7024 case 'f': /* Virtues */
7025 do_cmd_knowledge_virtues(creature_ptr);
7027 case 'g': /* Dungeon */
7028 do_cmd_knowledge_dungeon();
7030 case 'h': /* Quests */
7031 do_cmd_knowledge_quests(creature_ptr);
7033 case 'i': /* Autopick */
7034 do_cmd_knowledge_autopick();
7036 default: /* Unknown option */
7044 if (need_redraw) do_cmd_redraw(creature_ptr);
7049 * Check on the status of an active quest
7050 * @param creature_ptr プレーヤーへの参照ポインタ
7053 void do_cmd_checkquest(player_type *creature_ptr)
7055 /* File type is "TEXT" */
7056 FILE_TYPE(FILE_TYPE_TEXT);
7060 do_cmd_knowledge_quests(creature_ptr);
7066 * Display the time and date
7067 * @param creature_ptr プレーヤーへの参照ポインタ
7070 void do_cmd_time(player_type *creature_ptr)
7073 extract_day_hour_min(&day, &hour, &min);
7075 int full = hour * 100 + min;
7081 strcpy(desc, _("変な時刻だ。", "It is a strange time."));
7084 if (day < MAX_DAYS) sprintf(day_buf, "%d", day);
7085 else strcpy(day_buf, "*****");
7087 msg_format(_("%s日目, 時刻は%d:%02d %sです。", "This is day %s. The time is %d:%02d %s."),
7088 day_buf, (hour % 12 == 0) ? 12 : (hour % 12), min, (hour < 12) ? "AM" : "PM");
7092 if (!randint0(10) || creature_ptr->image)
7094 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timefun_j.txt", "timefun.txt"));
7098 path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, _("timenorm_j.txt", "timenorm.txt"));
7101 /* Open this file */
7103 fff = my_fopen(buf, "rt");
7107 /* Find this time */
7108 while (!my_fgets(fff, buf, sizeof(buf)))
7110 /* Ignore comments */
7111 if (!buf[0] || (buf[0] == '#')) continue;
7113 /* Ignore invalid lines */
7114 if (buf[1] != ':') continue;
7116 /* Process 'Start' */
7119 /* Extract the starting time */
7120 start = atoi(buf + 2);
7122 /* Assume valid for an hour */
7130 /* Extract the ending time */
7131 end = atoi(buf + 2);
7135 /* Ignore incorrect range */
7136 if ((start > full) || (full > end)) continue;
7138 /* Process 'Description' */
7143 /* Apply the randomizer */
7144 if (!randint0(num)) strcpy(desc, buf + 2);