OSDN Git Service

[Fix] #247のサブウィンドウ関連オプションをウィンドウズのメニュー処理に移行
authordis- <dis.rogue@gmail.com>
Tue, 23 Feb 2021 02:32:02 +0000 (11:32 +0900)
committerdis- <dis.rogue@gmail.com>
Tue, 23 Feb 2021 02:32:02 +0000 (11:32 +0900)
keep_subwindowsの所作はwindowsのみに影響があるので、ゲームメニューオプションにあるべきではなかった。
オプションからは削除し、メニュー処理として改めて実装する。
ウィンドウズ固有の処理なので、保存領域としてはHengband.INIを使用する。

src/angband.rc
src/game-option/game-play-options.c
src/game-option/game-play-options.h
src/game-option/option-types-table.c
src/game-option/option-types-table.h
src/main-win.c

index 69eb2c9..bedfb6b 100644 (file)
@@ -52,6 +52,8 @@ ANGBAND MENU
                        MENUITEM "\83T\83u\83E\83B\83\93\83h\83E 7", 227
                }
 
+               MENUITEM "\8fí\82É\83T\83u\83E\83B\83\93\83h\83E\82ð\95\\8e¦(&K)", 280
+
                MENUITEM SEPARATOR
 
                /*  POPUP "Bizarre Display"
index fd5e785..6b05332 100644 (file)
@@ -7,7 +7,6 @@ bool small_levels; /* Allow unusually small dungeon levels */
 bool always_small_levels; /* Always create unusually small dungeon levels */
 bool empty_levels; /* Allow empty 'on_defeat_arena_monster' levels */
 bool bound_walls_perm; /* Boundary walls become 'permanent wall' */
-bool keep_subwindows; /* Show sub-windows even when Hengband is not in focus */
 bool last_words; /* Leave last words when your character dies */
 bool auto_dump; /* Dump a character record automatically */
 bool auto_debug_save; /* Dump a debug savedata every key input */
index 4fca393..9884a15 100644 (file)
@@ -9,7 +9,6 @@ extern bool small_levels; /* Allow unusually small dungeon levels */
 extern bool always_small_levels; /* Always create unusually small dungeon levels */
 extern bool empty_levels; /* Allow empty 'on_defeat_arena_monster' levels */
 extern bool bound_walls_perm; /* Boundary walls become 'permanent wall' */
-extern bool keep_subwindows; /* Show sub-windows even when Hengband is not in focus */
 extern bool last_words; /* Leave last words when your character dies */
 extern bool auto_dump; /* Dump a character record automatically */
 extern bool auto_debug_save; /* Dump a debug savedata every key input */
index 5f87e98..9d654e9 100644 (file)
@@ -148,8 +148,6 @@ const option_type option_info[MAX_OPTION_INFO] = {
 
     { &bound_walls_perm, FALSE, OPT_PAGE_GAMEPLAY, 2, 1, "bound_walls_perm", _("ダンジョンの外壁を永久岩にする", "Boundary walls become 'permanent wall'") },
 
-    { &keep_subwindows, TRUE, OPT_PAGE_GAMEPLAY, 4, 8, "keep_subwindows", _("フォーカスが外れてもサブウィンドウを表示する", "Show sub-windows even when Hengband is not in focus") },
-
     { &last_words, TRUE, OPT_PAGE_GAMEPLAY, 0, 28, "last_words", _("キャラクターが死んだ時遺言をのこす", "Leave last words when your character dies") },
 
     { &auto_dump, FALSE, OPT_PAGE_GAMEPLAY, 4, 5, "auto_dump", _("自動的にキャラクターの記録をファイルに書き出す", "Dump a character record automatically") },
index 829a94a..28344f1 100644 (file)
@@ -22,7 +22,7 @@ typedef struct option_type {
     concptr o_desc;
 } option_type;
 
-#define MAX_OPTION_INFO 124
+#define MAX_OPTION_INFO 123
 #define MAX_CHEAT_OPTIONS 10
 #define MAX_AUTOSAVE_INFO 2
 
index 164057b..18e3912 100644 (file)
 #define IDM_WINDOW_D_HGT_6 276
 #define IDM_WINDOW_D_HGT_7 277
 
+#define IDM_WINDOW_KEEP_SUBWINDOWS 280
+
 #define IDM_OPTIONS_NO_GRAPHICS 400
 #define IDM_OPTIONS_OLD_GRAPHICS 401
 #define IDM_OPTIONS_NEW_GRAPHICS 402
@@ -448,6 +450,11 @@ static DIBINIT infMask;
  */
 static bool can_use_sound = FALSE;
 
+/*
+ * Show sub-windows even when Hengband is not in focus 
+ */
+static bool keep_subwindows = TRUE;
+
 #define SAMPLE_SOUND_MAX 16
 /*
  * An array of sound file names
@@ -834,6 +841,9 @@ static void save_prefs(void)
         WritePrivateProfileString("Angband", "SaveFile", savefile, ini_file);
     }
 
+    strcpy(buf, keep_subwindows ? "1" : "0");
+    WritePrivateProfileString("Angband", "KeepSubwindows", buf, ini_file);
+
     for (int i = 0; i < MAX_TERM_DATA; ++i) {
         save_prefs_aux(i);
     }
@@ -919,6 +929,7 @@ static void load_prefs(void)
         strncpy(savefile, tmp, strlen(tmp));
     }
 
+    keep_subwindows = (GetPrivateProfileInt("Angband", "KeepSubwindows", 0, ini_file) != 0);
     for (int i = 0; i < MAX_TERM_DATA; ++i) {
         load_prefs_aux(i);
     }
@@ -2250,6 +2261,8 @@ static void setup_menus(void)
             EnableMenuItem(hm, IDM_WINDOW_D_HGT_0 + i, MF_BYCOMMAND | MF_ENABLED);
         }
     }
+    EnableMenuItem(hm, IDM_WINDOW_KEEP_SUBWINDOWS, MF_BYCOMMAND | MF_ENABLED);
+    CheckMenuItem(hm, IDM_WINDOW_KEEP_SUBWINDOWS, (keep_subwindows ? MF_CHECKED : MF_UNCHECKED));
 
     EnableMenuItem(hm, IDM_OPTIONS_NO_GRAPHICS, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
     EnableMenuItem(hm, IDM_OPTIONS_OLD_GRAPHICS, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
@@ -2590,6 +2603,10 @@ static void process_menus(player_type *player_ptr, WORD wCmd)
         term_window_resize(td);
         break;
     }
+    case IDM_WINDOW_KEEP_SUBWINDOWS: {
+        keep_subwindows = !keep_subwindows;
+        break;
+    }
     case IDM_OPTIONS_NO_GRAPHICS: {
         if (!inkey_flag) {
             plog("You may not do that right now.");