OSDN Git Service

can_use_graphics を current_graphics_mode に改名し、バグ回避のため型変更。 / Rename can_use_graphics...
authorDeskull <desull@users.sourceforge.jp>
Fri, 16 Mar 2018 11:53:31 +0000 (20:53 +0900)
committerDeskull <desull@users.sourceforge.jp>
Fri, 16 Mar 2018 11:53:31 +0000 (20:53 +0900)
src/main-win.c

index a0079b2..dd33b15 100644 (file)
@@ -377,15 +377,26 @@ unsigned _cdecl _dos_getfileattr(const char *, unsigned *);
  */\r
 typedef struct _term_data term_data;\r
 \r
-/*\r
- * Extra "term" data\r
- *\r
+/*!\r
+ * @struct _term_data\r
+ * @brief ターム情報構造体 / Extra "term" data\r
+ * @details\r
+ * <p>\r
+ * pos_x / pos_y は各タームの左上点座標を指す。\r
+ * </p>\r
+ * <p>\r
+ * tile_wid / tile_hgt は[ウィンドウ]メニューのタイルの幅/高さを~を\r
+ * 1ドットずつ調整するステータスを指す。\r
+ * また、フォントを変更すると都度自動調整される。\r
+ * </p>\r
+ * <p>\r
  * Note the use of "font_want" for the names of the font file requested by\r
  * the user, and the use of "font_file" for the currently active font file.\r
  *\r
  * The "font_file" is uppercased, and takes the form "8X13.FON", while\r
  * "font_want" can be in almost any form as long as it could be construed\r
  * as attempting to represent the name of a font.\r
+ * </p>\r
  */\r
 struct _term_data\r
 {\r
@@ -403,8 +414,8 @@ struct _term_data
        TERM_POSITION rows;     /* int -> uint */\r
        TERM_POSITION cols;\r
 \r
-       uint pos_x;\r
-       uint pos_y;\r
+       uint pos_x; //!< タームの左上X座標\r
+       uint pos_y; //!< タームの左上Y座標\r
        uint size_wid;\r
        uint size_hgt;\r
        uint size_ow1;\r
@@ -426,11 +437,11 @@ struct _term_data
 \r
        HFONT font_id;\r
 \r
-       int font_wid;\r
-       int font_hgt;\r
+       int font_wid;  //!< フォント横幅\r
+       int font_hgt;  //!< フォント縦幅\r
 \r
-       int tile_wid;\r
-       int tile_hgt;\r
+       int tile_wid;  //!< タイル横幅\r
+       int tile_hgt;  //!< タイル縦幅\r
 \r
        uint map_tile_wid;\r
        uint map_tile_hgt;\r
@@ -517,8 +528,8 @@ static HPALETTE hPal;
 \r
 /* bg */\r
 static HBITMAP hBG = NULL;\r
-static int use_bg = 0;\r
-static char bg_bitmap_file[1024] = "bg.bmp";\r
+static int use_bg = 0; //!< 背景使用フラグ、1なら私用。\r
+static char bg_bitmap_file[1024] = "bg.bmp"; //!< 現在の背景ビットマップファイル名。\r
 \r
 #ifdef USE_SAVER\r
 \r
@@ -532,10 +543,11 @@ static HWND hwndSaver;
 \r
 #ifdef USE_GRAPHICS\r
 \r
-/*\r
+/*!\r
+ * 現在使用中のタイルID(0ならば未使用)\r
  * Flag set once "graphics" has been initialized\r
  */\r
-static bool can_use_graphics = FALSE;\r
+static byte_hack current_graphics_mode = 0;\r
 \r
 /*\r
  * The global bitmap\r
@@ -1706,123 +1718,125 @@ static int new_palette(void)
 \r
 \r
 #ifdef USE_GRAPHICS\r
-/*\r
- * Initialize graphics\r
+/*!\r
+ * @brief グラフィクスを初期化する / Initialize graphics\r
+ * @details\r
+ * <ul>\r
+ * <li>メニュー[オプション]>[グラフィクス]が「なし」以外の時に描画処理を初期化する。</li>\r
+ * <li>呼び出されるタイミングはロード時、及び同メニューで「なし」以外に変更される毎になる。</li>\r
+ * </ul>\r
  */\r
 static bool init_graphics(void)\r
 {\r
        /* Initialize once */\r
-       /* if (can_use_graphics != arg_graphics) */\r
-       {\r
-               char buf[1024];\r
-               BYTE wid, hgt, twid, thgt, ox, oy;\r
-               cptr name;\r
+       char buf[1024];\r
+       BYTE wid, hgt, twid, thgt, ox, oy;\r
+       cptr name;\r
 \r
-               if (arg_graphics == GRAPHICS_ADAM_BOLT)\r
-               {\r
-                       wid = 16;\r
-                       hgt = 16;\r
-                       twid = 16;\r
-                       thgt = 16;\r
-                       ox = 0;\r
-                       oy = 0;\r
-                       name = "16X16.BMP";\r
-\r
-                       ANGBAND_GRAF = "new";\r
-               }\r
-               else if (arg_graphics == GRAPHICS_HENGBAND)\r
-               {\r
-                       /*! @todo redraw \r
-                       wid = 64;\r
-                       hgt = 64;\r
-                       twid = 32;\r
-                       thgt = 32;\r
-                       ox = -16;\r
-                       oy = -24;\r
-                       name = "64X64.BMP";\r
-                       */\r
-\r
-                       wid = 32;\r
-                       hgt = 32;\r
-                       twid = 32;\r
-                       thgt = 32;\r
-                       ox = 0;\r
-                       oy = 0;\r
-                       name = "32X32.BMP";\r
-\r
-                       ANGBAND_GRAF = "ne2";\r
-               }\r
-               else\r
-               {\r
-                       wid = 8;\r
-                       hgt = 8;\r
-                       twid = 8;\r
-                       thgt = 8;\r
-                       ox = 0;\r
-                       oy = 0;\r
-                       name = "8X8.BMP";\r
-                       ANGBAND_GRAF = "old";\r
-               }\r
+       if (arg_graphics == GRAPHICS_ADAM_BOLT)\r
+       {\r
+               wid = 16;\r
+               hgt = 16;\r
+               twid = 16;\r
+               thgt = 16;\r
+               ox = 0;\r
+               oy = 0;\r
+               name = "16X16.BMP";\r
+\r
+               ANGBAND_GRAF = "new";\r
+       }\r
+       else if (arg_graphics == GRAPHICS_HENGBAND)\r
+       {\r
+               /*! @todo redraw\r
+               wid = 64;\r
+               hgt = 64;\r
+               twid = 32;\r
+               thgt = 32;\r
+               ox = -16;\r
+               oy = -24;\r
+               name = "64X64.BMP";\r
+               */\r
+\r
+               wid = 32;\r
+               hgt = 32;\r
+               twid = 32;\r
+               thgt = 32;\r
+               ox = 0;\r
+               oy = 0;\r
+               name = "32X32.BMP";\r
+\r
+               ANGBAND_GRAF = "ne2";\r
+       }\r
+       else\r
+       {\r
+               wid = 8;\r
+               hgt = 8;\r
+               twid = 8;\r
+               thgt = 8;\r
+               ox = 0;\r
+               oy = 0;\r
+               name = "8X8.BMP";\r
+               ANGBAND_GRAF = "old";\r
+       }\r
 \r
-               /* Access the bitmap file */\r
-               path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, name);\r
+       /* Access the bitmap file */\r
+       path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, name);\r
 \r
-               /* Load the bitmap or quit */\r
-               if (!ReadDIB(data[0].w, buf, &infGraph))\r
-               {\r
-                       plog_fmt(_("ビットマップ '%s' を読み込めません。", "Cannot read bitmap file '%s'"), name);\r
-                       return (FALSE);\r
-               }\r
+       /* Load the bitmap or quit */\r
+       if (!ReadDIB(data[0].w, buf, &infGraph))\r
+       {\r
+               plog_fmt(_("ビットマップ '%s' を読み込めません。", "Cannot read bitmap file '%s'"), name);\r
+               return (FALSE);\r
+       }\r
 \r
-               /* Save the new sizes */\r
-               infGraph.CellWidth = wid;\r
-               infGraph.CellHeight = hgt;\r
-               infGraph.TileWidth = twid;\r
-               infGraph.TileHeight = thgt;\r
-               infGraph.OffsetX = ox;\r
-               infGraph.OffsetY = oy;\r
+       /* Save the new sizes */\r
+       infGraph.CellWidth = wid;\r
+       infGraph.CellHeight = hgt;\r
+       infGraph.TileWidth = twid;\r
+       infGraph.TileHeight = thgt;\r
+       infGraph.OffsetX = ox;\r
+       infGraph.OffsetY = oy;\r
 \r
-               if (arg_graphics == GRAPHICS_ADAM_BOLT)\r
-               {\r
-                       /* Access the mask file */\r
-                       path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, "mask.bmp");\r
+       if (arg_graphics == GRAPHICS_ADAM_BOLT)\r
+       {\r
+               /* Access the mask file */\r
+               path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, "mask.bmp");\r
 \r
-                       /* Load the bitmap or quit */\r
-                       if (!ReadDIB(data[0].w, buf, &infMask))\r
-                       {\r
-                               plog_fmt("Cannot read bitmap file '%s'", buf);\r
-                               return (FALSE);\r
-                       }\r
-               }\r
-               if (arg_graphics == GRAPHICS_HENGBAND)\r
+               /* Load the bitmap or quit */\r
+               if (!ReadDIB(data[0].w, buf, &infMask))\r
                {\r
-                       /* Access the mask file */\r
-                       path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, "mask32.bmp");\r
-\r
-                       /* Load the bitmap or quit */\r
-                       if (!ReadDIB(data[0].w, buf, &infMask))\r
-                       {\r
-                               plog_fmt("Cannot read bitmap file '%s'", buf);\r
-                               return (FALSE);\r
-                       }\r
+                       plog_fmt("Cannot read bitmap file '%s'", buf);\r
+                       return (FALSE);\r
                }\r
+       }\r
+       if (arg_graphics == GRAPHICS_HENGBAND)\r
+       {\r
+               /* Access the mask file */\r
+               path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, "mask32.bmp");\r
 \r
-               /* Activate a palette */\r
-               if (!new_palette())\r
+               /* Load the bitmap or quit */\r
+               if (!ReadDIB(data[0].w, buf, &infMask))\r
                {\r
-                       /* Free bitmap XXX XXX XXX */\r
-\r
-                       /* Oops */\r
-                       plog(_("パレットを実現できません!", "Cannot activate palette!"));\r
+                       plog_fmt("Cannot read bitmap file '%s'", buf);\r
                        return (FALSE);\r
                }\r
+       }\r
 \r
-               /* Graphics available */\r
-               can_use_graphics = arg_graphics;\r
+       /* Activate a palette */\r
+       if (!new_palette())\r
+       {\r
+               /* Free bitmap XXX XXX XXX */\r
+\r
+               /* Oops */\r
+               plog(_("パレットを実現できません!", "Cannot activate palette!"));\r
+               return (FALSE);\r
        }\r
 \r
+       /* Graphics available */\r
+       current_graphics_mode = arg_graphics;\r
+\r
        /* Result */\r
-       return (can_use_graphics);\r
+       return (current_graphics_mode);\r
 }\r
 #endif /* USE_GRAPHICS */\r
 \r