1 #include "cmd-io/cmd-gameoption.h"
2 #include "autopick/autopick.h"
3 #include "cmd-io/cmd-autopick.h"
4 #include "cmd-io/cmd-dump.h"
5 #include "core/player-redraw-types.h"
6 #include "core/show-file.h"
7 #include "core/window-redrawer.h"
8 #include "game-option/game-play-options.h"
9 #include "game-option/keymap-directory-getter.h"
10 #include "game-option/option-flags.h"
11 #include "game-option/option-types-table.h"
12 #include "game-option/special-options.h"
13 #include "io/input-key-acceptor.h"
14 #include "io/write-diary.h"
15 #include "main/sound-of-music.h"
16 #include "system/game-option-types.h"
17 #include "term/gameterm.h"
18 #include "term/screen-processor.h"
19 #include "term/term-color-types.h"
20 #include "util/int-char-converter.h"
21 #include "util/string-processor.h"
22 #include "view/display-messages.h"
23 #include "world/world.h"
33 static opts option_fields[OPT_NUM] = {
34 { '1', _(" キー入力 オプション", "Input Options"), 3 },
35 { '2', _(" マップ画面 オプション", "Map Screen Options"), 4 },
36 { '3', _(" テキスト表示 オプション", "Text Display Options"), 5 },
37 { '4', _(" ゲームプレイ オプション", "Game-Play Options"), 6 },
38 { '5', _(" 行動中止関係 オプション", "Disturbance Options"), 7 },
39 { '6', _(" 簡易自動破壊 オプション", "Easy Auto-Destroyer Options"), 8 },
40 { 'r', _(" プレイ記録 オプション", "Play record Options"), 9 },
42 { 'p', _("自動拾いエディタ", "Auto-picker/destroyer editor"), 11 },
43 { 'd', _(" 基本ウェイト量 ", "Base Delay Factor"), 12 },
44 { 'h', _("低ヒットポイント", "Hitpoint Warning"), 13 },
45 { 'm', _(" 低魔力色閾値 ", "Mana Color Threshold"), 14 },
46 { 'a', _(" 自動セーブ オプション", "Autosave Options"), 15 },
47 { 'w', _("ウインドウフラグ", "Window Flags"), 16 },
49 { 'b', _(" 初期 オプション (参照のみ)", "Birth Options (Browse Only)"), 18 },
50 { 'c', _(" 詐欺 オプション", "Cheat Options"), 19 },
54 * @brief セーブ頻度ターンの次の値を返す
55 * @param current 現在のセーブ頻度ターン値
58 static s16b toggle_frequency(s16b current)
85 * @brief 自動セーブオプションを変更するコマンドのメインルーチン
89 static void do_cmd_options_autosave(player_type *player_ptr, concptr info)
97 _("%s ( リターンで次へ, y/n でセット, F で頻度を入力, ESC で決定 ) ", "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) "), info);
99 for (i = 0; i < n; i++) {
105 buf, "%-48s: %s (%s)", autosave_info[i].o_desc, (*autosave_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")), autosave_info[i].o_text);
106 c_prt(a, buf, i + 2, 0);
109 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
110 move_cursor(k + 2, 50);
135 (*autosave_info[k].o_var) = TRUE;
143 (*autosave_info[k].o_var) = FALSE;
150 autosave_freq = toggle_frequency(autosave_freq);
151 prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0);
156 (void)show_file(player_ptr, TRUE, _("joption.txt#Autosave", "option.txt#Autosave"), NULL, 0, 0);
170 * @brief ウィンドウオプションを変更するコマンドのメインルーチン /
171 * Modify the "window" options
174 static void do_cmd_options_win(player_type *player_ptr)
183 for (j = 0; j < 8; j++) {
184 old_flag[j] = window_flag[j];
189 prt(_("ウィンドウ・フラグ (<方向>で移動, tでチェンジ, y/n でセット, ESC)", "Window Flags (<dir>, t, y, n, ESC) "), 0, 0);
190 for (j = 0; j < 8; j++) {
192 concptr s = angband_term_name[j];
196 term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s);
199 for (i = 0; i < 16; i++) {
201 concptr str = window_flag_desc[i];
206 str = _("(未使用)", "(Unused option)");
208 term_putstr(0, i + 5, -1, a, str);
209 for (j = 0; j < 8; j++) {
212 if ((i == y) && (j == x))
215 if (window_flag[j] & (1L << i))
218 term_putch(35 + j * 5, i + 5, a, c);
222 term_gotoxy(35 + x * 5, y + 5);
231 for (j = 0; j < 8; j++) {
232 window_flag[j] &= ~(1L << y);
235 for (i = 0; i < 16; i++) {
236 window_flag[x] &= ~(1L << i);
245 window_flag[x] |= (1L << y);
250 window_flag[x] &= ~(1L << y);
254 (void)show_file(player_ptr, TRUE, _("joption.txt#Window", "option.txt#Window"), NULL, 0, 0);
259 d = get_keymap_dir(ch);
260 x = (x + ddx[d] + 8) % 8;
261 y = (y + ddy[d] + 16) % 16;
268 for (j = 0; j < 8; j++) {
269 term_type *old = Term;
270 if (!angband_term[j])
273 if (window_flag[j] == old_flag[j])
276 term_activate(angband_term[j]);
284 * @brief チートオプションを変更するコマンドのメインルーチン
285 * Interact with some options for cheating
286 * @param info 表示メッセージ
289 static void do_cmd_options_cheat(player_type *player_ptr, concptr info)
292 int i, k = 0, n = MAX_CHEAT_OPTIONS;
297 sprintf(buf, _("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info);
301 /* 詐欺オプションをうっかりいじってしまう人がいるようなので注意 */
302 prt(" << 注意 >>", 11, 0);
303 prt(" 詐欺オプションを一度でも設定すると、スコア記録が残らなくなります!", 12, 0);
304 prt(" 後に解除してもダメですので、勝利者を目指す方はここのオプションはい", 13, 0);
305 prt(" じらないようにして下さい。", 14, 0);
307 for (i = 0; i < n; i++) {
312 sprintf(buf, "%-48s: %s (%s)", cheat_info[i].o_desc, (*cheat_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")), cheat_info[i].o_text);
313 c_prt(a, buf, i + 2, 0);
316 move_cursor(k + 2, 50);
318 dir = get_keymap_dir(ch);
319 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
341 if (!current_world_ptr->noscore)
342 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0,
343 _("詐欺オプションをONにして、スコアを残せなくなった。", "gave up sending score to use cheating options."));
345 current_world_ptr->noscore |= (cheat_info[k].o_set * 256 + cheat_info[k].o_bit);
346 (*cheat_info[k].o_var) = TRUE;
353 (*cheat_info[k].o_var) = FALSE;
358 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), cheat_info[k].o_text);
359 (void)show_file(player_ptr, TRUE, buf, NULL, 0, 0);
372 * @brief ビットセットからゲームオプションを展開する / Extract option variables from bit sets
375 void extract_option_vars(void)
377 for (int i = 0; option_info[i].o_desc; i++) {
378 int os = option_info[i].o_set;
379 int ob = option_info[i].o_bit;
380 if (option_info[i].o_var) {
381 if (option_flag[os] & (1L << ob)) {
382 (*option_info[i].o_var) = TRUE;
384 (*option_info[i].o_var) = FALSE;
391 * @brief 標準オプションを変更するコマンドのメインルーチン /
392 * Set or unset various options.
396 * The user must use the "Ctrl-R" command to "adapt" to changes
397 * in any options which control "visual" aspects of the game.
400 void do_cmd_options(player_type *player_ptr)
408 if (!current_world_ptr->noscore && !allow_debug_opts)
412 prt(_("[ オプションの設定 ]", "Game options"), 1, 0);
414 for (i = 0; i < n; i++) {
418 term_putstr(5, option_fields[i].row, -1, a, format("(%c) %s", toupper(option_fields[i].key), option_fields[i].name));
421 prt(_("<方向>で移動, Enterで決定, ESCでキャンセル, ?でヘルプ: ", "Move to <dir>, Select to Enter, Cancel to ESC, ? to help: "), 21, 0);
422 skey = inkey_special(TRUE);
423 if (!(skey & SKEY_MASK))
431 if (angband_strchr("\n\r ", k)) {
432 k = option_fields[y].key;
436 for (i = 0; i < n; i++) {
437 if (tolower(k) == option_fields[i].key)
450 if (skey == SKEY_DOWN)
452 y = (y + ddy[d] + n) % n;
462 do_cmd_options_aux(player_ptr, OPT_PAGE_INPUT, _("キー入力オプション", "Input Options"));
466 do_cmd_options_aux(player_ptr, OPT_PAGE_MAPSCREEN, _("マップ画面オプション", "Map Screen Options"));
470 do_cmd_options_aux(player_ptr, OPT_PAGE_TEXT, _("テキスト表示オプション", "Text Display Options"));
474 do_cmd_options_aux(player_ptr, OPT_PAGE_GAMEPLAY, _("ゲームプレイ・オプション", "Game-Play Options"));
478 do_cmd_options_aux(player_ptr, OPT_PAGE_DISTURBANCE, _("行動中止関係のオプション", "Disturbance Options"));
482 do_cmd_options_aux(player_ptr, OPT_PAGE_AUTODESTROY, _("簡易自動破壊オプション", "Easy Auto-Destroyer Options"));
487 do_cmd_options_aux(player_ptr, OPT_PAGE_PLAYRECORD, _("プレイ記録オプション", "Play-record Options"));
492 do_cmd_options_aux(player_ptr, OPT_PAGE_BIRTH,
493 (!current_world_ptr->wizard || !allow_debug_opts) ? _("初期オプション(参照のみ)", "Birth Options(browse only)")
494 : _("初期オプション((*)はスコアに影響)", "Birth Options ((*)) affect score"));
498 if (!current_world_ptr->noscore && !allow_debug_opts) {
503 do_cmd_options_cheat(player_ptr, _("詐欺師は決して勝利できない!", "Cheaters never win"));
508 do_cmd_options_autosave(player_ptr, _("自動セーブ", "Autosave"));
513 do_cmd_options_win(player_ptr);
514 player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MESSAGE | PW_OVERHEAD | PW_MONSTER | PW_OBJECT | PW_SNAPSHOT | PW_DUNGEON
520 do_cmd_edit_autopick(player_ptr);
526 prt(_("コマンド: 基本ウェイト量", "Command: Base Delay Factor"), 19, 0);
528 int msec = delay_factor * delay_factor * delay_factor;
529 prt(format(_("現在のウェイト: %d (%dミリ秒)", "Current base delay factor: %d (%d msec)"), delay_factor, msec), 22, 0);
530 prt(_("ウェイト (0-9) ESCで決定: ", "Delay Factor (0-9 or ESC to accept): "), 20, 0);
535 (void)show_file(player_ptr, TRUE, _("joption.txt#BaseDelay", "option.txt#BaseDelay"), NULL, 0, 0);
537 } else if (isdigit(k))
538 delay_factor = D2I(k);
548 prt(_("コマンド: 低ヒットポイント警告", "Command: Hitpoint Warning"), 19, 0);
550 prt(format(_("現在の低ヒットポイント警告: %d0%%", "Current hitpoint warning: %d0%%"), hitpoint_warn), 22, 0);
551 prt(_("低ヒットポイント警告 (0-9) ESCで決定: ", "Hitpoint Warning (0-9 or ESC to accept): "), 20, 0);
556 (void)show_file(player_ptr, TRUE, _("joption.txt#Hitpoint", "option.txt#Hitpoint"), NULL, 0, 0);
558 } else if (isdigit(k))
559 hitpoint_warn = D2I(k);
569 prt(_("コマンド: 低魔力色閾値", "Command: Mana Color Threshold"), 19, 0);
571 prt(format(_("現在の低魔力色閾値: %d0%%", "Current mana color threshold: %d0%%"), mana_warn), 22, 0);
572 prt(_("低魔力閾値 (0-9) ESCで決定: ", "Mana color Threshold (0-9 or ESC to accept): "), 20, 0);
577 (void)show_file(player_ptr, TRUE, _("joption.txt#Manapoint", "option.txt#Manapoint"), NULL, 0, 0);
579 } else if (isdigit(k))
588 (void)show_file(player_ptr, TRUE, _("joption.txt", "option.txt"), NULL, 0, 0);
601 player_ptr->redraw |= (PR_EQUIPPY);
605 * @brief 標準オプションを変更するコマンドのサブルーチン /
606 * Interact with some options
607 * @param page オプションページ番号
608 * @param info 表示メッセージ
611 void do_cmd_options_aux(player_type *player_ptr, int page, concptr info)
614 int i, k = 0, n = 0, l;
617 bool browse_only = (page == OPT_PAGE_BIRTH) && current_world_ptr->character_generated && (!current_world_ptr->wizard || !allow_debug_opts);
619 for (i = 0; i < 24; i++)
622 for (i = 0; option_info[i].o_desc; i++) {
623 if (option_info[i].o_page == page)
630 sprintf(buf, _("%s (リターン:次, %sESC:終了, ?:ヘルプ) ", "%s (RET:next, %s, ?:help) "), info,
631 browse_only ? _("", "ESC:exit") : _("y/n:変更, ", "y/n:change, ESC:accept"));
633 if (page == OPT_PAGE_AUTODESTROY)
634 c_prt(TERM_YELLOW, _("以下のオプションは、簡易自動破壊を使用するときのみ有効", "Following options will protect items from easy auto-destroyer."), 6,
637 for (i = 0; i < n; i++) {
642 sprintf(buf, "%-48s: %s (%.19s)", option_info[opt[i]].o_desc, (*option_info[opt[i]].o_var ? _("はい ", "yes") : _("いいえ", "no ")),
643 option_info[opt[i]].o_text);
644 if ((page == OPT_PAGE_AUTODESTROY) && i > 2)
645 c_prt(a, buf, i + 5, 0);
647 c_prt(a, buf, i + 2, 0);
650 if ((page == OPT_PAGE_AUTODESTROY) && (k > 2))
655 move_cursor(k + 2 + l, 50);
657 dir = get_keymap_dir(ch);
658 if ((dir == 2) || (dir == 4) || (dir == 6) || (dir == 8))
682 (*option_info[opt[k]].o_var) = TRUE;
691 (*option_info[opt[k]].o_var) = FALSE;
698 (*option_info[opt[k]].o_var) = !(*option_info[opt[k]].o_var);
702 strnfmt(buf, sizeof(buf), _("joption.txt#%s", "option.txt#%s"), option_info[opt[k]].o_text);
703 (void)show_file(player_ptr, TRUE, buf, NULL, 0, 0);