1 #include "cmd-io/cmd-diary.h"
2 #include "cmd-io/diary-subtitle-table.h"
3 #include "core/show-file.h"
4 #include "game-option/play-record-options.h"
5 #include "main/sound-of-music.h"
6 #include "io/chuukei.h"
7 #include "io/files-util.h"
8 #include "io/input-key-acceptor.h"
9 #include "io/write-diary.h"
10 #include "player/player-personality.h"
11 #include "util/angband-files.h"
12 #include "view/display-messages.h"
13 #include "world/world.h"
16 * @brief 日記のタイトル表記と内容出力
17 * @param creature_ptr プレーヤーへの参照ポインタ
20 static void display_diary(player_type *creature_ptr)
22 char diary_title[256];
23 GAME_TEXT file_name[MAX_NLEN];
26 sprintf(file_name, _("playrecord-%s.txt", "playrec-%s.txt"), savefile_base);
27 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
29 if (creature_ptr->pclass == CLASS_WARRIOR || creature_ptr->pclass == CLASS_MONK || creature_ptr->pclass == CLASS_SAMURAI || creature_ptr->pclass == CLASS_BERSERKER)
30 strcpy(tmp, subtitle[randint0(MAX_SUBTITLE - 1)]);
31 else if (IS_WIZARD_CLASS(creature_ptr))
32 strcpy(tmp, subtitle[randint0(MAX_SUBTITLE - 1) + 1]);
33 else strcpy(tmp, subtitle[randint0(MAX_SUBTITLE - 2) + 1]);
36 sprintf(diary_title, "「%s%s%sの伝説 -%s-」", ap_ptr->title, ap_ptr->no ? "の" : "", creature_ptr->name, tmp);
38 sprintf(diary_title, "Legend of %s %s '%s'", ap_ptr->title, creature_ptr->name, tmp);
41 (void)show_file(creature_ptr, FALSE, buf, diary_title, -1, 0);
46 * @brief 日記に任意の内容を表記するコマンドのメインルーチン /
49 static void add_diary_note(player_type *creature_ptr)
52 char bunshou[80] = "\0";
53 if (get_string(_("内容: ", "diary note: "), tmp, 79))
56 exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 0, bunshou);
61 * @brief 最後に取得したアイテムの情報を日記に追加するメインルーチン /
64 static void do_cmd_last_get(player_type *creaute_ptr)
66 if (record_o_name[0] == '\0') return;
69 sprintf(buf, _("%sの入手を記録します。", "Do you really want to record getting %s? "), record_o_name);
70 if (!get_check(buf)) return;
72 GAME_TURN turn_tmp = current_world_ptr->game_turn;
73 current_world_ptr->game_turn = record_turn;
74 sprintf(buf, _("%sを手に入れた。", "discover %s."), record_o_name);
75 exe_write_diary(creaute_ptr, DIARY_DESCRIPTION, 0, buf);
76 current_world_ptr->game_turn = turn_tmp;
81 * @brief ファイル中の全日記記録を消去する /
84 static void do_cmd_erase_diary(void)
86 GAME_TEXT file_name[MAX_NLEN];
90 if (!get_check(_("本当に記録を消去しますか?", "Do you really want to delete all your record? "))) return;
91 sprintf(file_name, _("playrecord-%s.txt", "playrec-%s.txt"), savefile_base);
92 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, file_name);
95 fff = angband_fopen(buf, "w");
99 msg_format(_("記録を消去しました。", "deleted record."));
103 msg_format(_("%s の消去に失敗しました。", "failed to delete %s."), buf);
112 * @param crerature_ptr プレーヤーへの参照ポインタ
115 void do_cmd_diary(player_type *creature_ptr)
122 prt(_("[ 記録の設定 ]", "[ Play Record ]"), 2, 0);
123 prt(_("(1) 記録を見る", "(1) Display your record"), 4, 5);
124 prt(_("(2) 文章を記録する", "(2) Add record"), 5, 5);
125 prt(_("(3) 直前に入手又は鑑定したものを記録する", "(3) Record the last item you got or identified"), 6, 5);
126 prt(_("(4) 記録を消去する", "(4) Delete your record"), 7, 5);
127 prt(_("(R) プレイ動画を記録する/中止する", "(R) Record playing movie / or stop it"), 9, 5);
128 prt(_("コマンド:", "Command: "), 18, 0);
130 if (i == ESCAPE) break;
135 display_diary(creature_ptr);
138 add_diary_note(creature_ptr);
141 do_cmd_last_get(creature_ptr);
144 do_cmd_erase_diary();
148 prepare_movie_hooks();