OSDN Git Service

[Refactor] #37353 spells.hにスペルに関する共通定義を追加。。 / Add common definition to spells.h.
[hengband/hengband.git] / src / main-win.c
index a0079b2..f56c787 100644 (file)
 * <p>\r
 * The "Term_xtra_win_clear()" function should probably do a low-level\r
 * clear of the current window, and redraw the borders and other things,\r
-* if only for efficiency.  XXX XXX XXX\r
+* if only for efficiency.  \r
 * </p>\r
 *\r
 * <p>\r
 * A simpler method is needed for selecting the "tile size" for windows.\r
-* XXX XXX XXX\r
 * </p>\r
 *\r
 * <p>\r
 * window, I think, and only a few calls actually check for its existance,\r
 * this may be okay since "NULL" means "on top of all windows". (?)  The\r
 * user must never be allowed to "hide" the main window, or the "menubar"\r
-* will disappear.  XXX XXX XXX\r
+* will disappear.  \r
 * </p>\r
 *\r
 * <p>\r
 * Special "Windows Help Files" can be placed into "lib/xtra/help/" for\r
 * use with the "winhelp.exe" program.  These files *may* be available\r
-* at the ftp site somewhere, but I have not seen them.  XXX XXX XXX\r
+* at the ftp site somewhere, but I have not seen them.  \r
 * </p>\r
 *\r
 * <p>\r
 \r
 #define IDM_HELP_CONTENTS       901\r
 \r
-\r
-\r
-/*\r
- * This may need to be removed for some compilers XXX XXX XXX\r
- */\r
-#if 0\r
-#define STRICT\r
-#endif\r
-\r
 /*\r
  * Exclude parts of WINDOWS.H that are not needed\r
  */\r
 #endif\r
 \r
 /*\r
- * Hack -- Fake declarations from "dos.h" XXX XXX XXX\r
+ * Hack -- Fake declarations from "dos.h" \r
  */\r
 #ifdef WIN32\r
 #define INVALID_FILE_NAME (DWORD)0xFFFFFFFF\r
 #else /* WIN32 */\r
 #define FA_LABEL    0x08        /* Volume label */\r
 #define FA_DIREC    0x10        /* Directory */\r
-unsigned _cdecl _dos_getfileattr(const char *, unsigned *);\r
+unsigned _cdecl _dos_getfileattr(concptr , unsigned *);\r
 #endif /* WIN32 */\r
 \r
 /*\r
@@ -377,34 +367,41 @@ 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
        term t;\r
-\r
-       cptr s;\r
-\r
+       concptr s;\r
        HWND w;\r
-\r
        DWORD dwStyle;\r
        DWORD dwExStyle;\r
 \r
        uint keys;\r
+       TERM_LEN rows;  /* int -> uint */\r
+       TERM_LEN cols;\r
 \r
-       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
@@ -413,24 +410,16 @@ struct _term_data
        uint size_oh2;\r
 \r
        bool size_hack;\r
-\r
        bool xtra_hack;\r
-\r
        bool visible;\r
-\r
        bool bizarre;\r
-\r
-       cptr font_want;\r
-\r
-       cptr font_file;\r
-\r
+       concptr font_want;\r
+       concptr font_file;\r
        HFONT font_id;\r
-\r
-       int font_wid;\r
-       int font_hgt;\r
-\r
-       int tile_wid;\r
-       int tile_hgt;\r
+       int font_wid;  //!< フォント横幅\r
+       int font_hgt;  //!< フォント縦幅\r
+       int tile_wid;  //!< タイル横幅\r
+       int tile_hgt;  //!< タイル縦幅\r
 \r
        uint map_tile_wid;\r
        uint map_tile_hgt;\r
@@ -442,33 +431,13 @@ struct _term_data
 \r
        bool posfix;\r
 \r
-/* bg */\r
-#if 0\r
-       char *bgfile;\r
-       int use_bg;\r
-#endif\r
 };\r
 \r
+#define MAX_TERM_DATA 8        //!< Maximum number of windows \r
 \r
-/*\r
- * Maximum number of windows XXX XXX XXX\r
- */\r
-#define MAX_TERM_DATA 8\r
-\r
-/*\r
- * An array of term_data's\r
- */\r
-static term_data data[MAX_TERM_DATA];\r
-\r
-/*\r
- * Hack -- global "window creation" pointer\r
- */\r
-static term_data *my_td;\r
-\r
-/*\r
- * Remember normal size of main window when maxmized\r
- */\r
-POINT normsize;\r
+static term_data data[MAX_TERM_DATA]; //!< An array of term_data's\r
+static term_data *my_td; //!< Hack -- global "window creation" pointer\r
+POINT normsize; //!< Remember normal size of main window when maxmized\r
 \r
 /*\r
  * was main window maximized on previous playing\r
@@ -517,8 +486,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 +501,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
@@ -561,7 +531,7 @@ static bool can_use_sound = FALSE;
 /*\r
  * An array of sound file names\r
  */\r
-static cptr sound_file[SOUND_MAX][SAMPLE_MAX];\r
+static concptr sound_file[SOUND_MAX][SAMPLE_MAX];\r
 \r
 #endif /* USE_SOUND */\r
 \r
@@ -570,10 +540,10 @@ static cptr sound_file[SOUND_MAX][SAMPLE_MAX];
 #ifdef USE_MUSIC\r
 \r
 #define SAMPLE_MUSIC_MAX 16\r
-static cptr music_file[MUSIC_BASIC_MAX][SAMPLE_MUSIC_MAX];\r
-static cptr dungeon_music_file[1000][SAMPLE_MUSIC_MAX];\r
-static cptr town_music_file[1000][SAMPLE_MUSIC_MAX];\r
-static cptr quest_music_file[1000][SAMPLE_MUSIC_MAX];\r
+static concptr music_file[MUSIC_BASIC_MAX][SAMPLE_MUSIC_MAX];\r
+static concptr dungeon_music_file[1000][SAMPLE_MUSIC_MAX];\r
+static concptr town_music_file[1000][SAMPLE_MUSIC_MAX];\r
+static concptr quest_music_file[1000][SAMPLE_MUSIC_MAX];\r
 static bool can_use_music = FALSE;\r
 \r
 static MCI_OPEN_PARMS mop;\r
@@ -588,30 +558,30 @@ int current_music_id = 0;
 /*\r
  * Full path to ANGBAND.INI\r
  */\r
-static cptr ini_file = NULL;\r
+static concptr ini_file = NULL;\r
 \r
 /*\r
  * Name of application\r
  */\r
-static cptr AppName = "ANGBAND";\r
+static concptr AppName = "ANGBAND";\r
 \r
 /*\r
  * Name of sub-window type\r
  */\r
-static cptr AngList = "AngList";\r
+static concptr AngList = "AngList";\r
 \r
 /*\r
  * Directory names\r
  */\r
-static cptr ANGBAND_DIR_XTRA_GRAF;\r
-static cptr ANGBAND_DIR_XTRA_SOUND;\r
-static cptr ANGBAND_DIR_XTRA_MUSIC;\r
-static cptr ANGBAND_DIR_XTRA_HELP;\r
+static concptr ANGBAND_DIR_XTRA_GRAF;\r
+static concptr ANGBAND_DIR_XTRA_SOUND;\r
+static concptr ANGBAND_DIR_XTRA_MUSIC;\r
+static concptr ANGBAND_DIR_XTRA_HELP;\r
 #if 0 /* #ifndef JP */\r
-static cptr ANGBAND_DIR_XTRA_FONT;\r
+static concptr ANGBAND_DIR_XTRA_FONT;\r
 #endif\r
 #ifdef USE_MUSIC\r
-static cptr ANGBAND_DIR_XTRA_MUSIC;\r
+static concptr ANGBAND_DIR_XTRA_MUSIC;\r
 #endif\r
 \r
 \r
@@ -631,17 +601,15 @@ static bool Term_no_press = FALSE;
  */\r
 static bool mouse_down = FALSE;\r
 static bool paint_rect = FALSE;\r
-static TERM_POSITION mousex = 0, mousey = 0;\r
-static TERM_POSITION oldx, oldy;\r
+static TERM_LEN mousex = 0, mousey = 0;\r
+static TERM_LEN oldx, oldy;\r
 \r
 \r
-/*\r
- * The "simple" color values\r
- *\r
+/*!\r
+ * @brief The "simple" color values\r
+ * @details\r
  * See "main-ibm.c" for original table information\r
- *\r
  * The entries below are taken from the "color bits" defined above.\r
- *\r
  * Note that many of the choices below suck, but so do crappy monitors.\r
  */\r
 static BYTE win_pal[256] =\r
@@ -813,25 +781,6 @@ static int init_bg(void)
                use_bg = 0;\r
                return 0;\r
        }\r
-#if 0 /* gomi */\r
-       HDC wnddc, dcimage, dcbg;\r
-       HBITMAP bmimage, bmimage_old, bmbg_old;\r
-       int i, j;\r
-\r
-       delete_bg();\r
-\r
-       wnddc = GetDC(hwnd);\r
-       dcimage = CreateCompatibleDC(wnddc);\r
-       dcbg = CreateCompatibleDC(wnddc);\r
-\r
-       bmimage = LoadImage(NULL, "bg.bmp", LR_LOADFROMFILE, 0, 0, 0);\r
-       if (!bmimage) quit("bg.bmpが読みこめない!");\r
-       bmimage_old = SelectObject(dcimage, bmimage);\r
-\r
-       CreateCompatibleBitmap();\r
-\r
-       ReleaseDC(hwnd, wnddc);\r
-#endif\r
        use_bg = 1;\r
        return 1;\r
 }\r
@@ -875,9 +824,9 @@ static void DrawBG(HDC hdc, RECT *r)
 /*\r
  * Hack -- given a pathname, point at the filename\r
  */\r
-static cptr extract_file_name(cptr s)\r
+static concptr extract_file_name(concptr s)\r
 {\r
-       cptr p;\r
+       concptr p;\r
 \r
        /* Start at the end */\r
        p = s + strlen(s) - 1;\r
@@ -931,8 +880,6 @@ static char *analyze_font(char *path, int *wp, int *hp)
        /* Save results */\r
        (*wp) = wid;\r
        (*hp) = hgt;\r
-\r
-       /* Result */\r
        return (p);\r
 }\r
 #endif\r
@@ -941,7 +888,7 @@ static char *analyze_font(char *path, int *wp, int *hp)
 /*\r
  * Check for existance of a file\r
  */\r
-static bool check_file(cptr s)\r
+static bool check_file(concptr s)\r
 {\r
        char path[1024];\r
 \r
@@ -990,7 +937,7 @@ static bool check_file(cptr s)
 /*\r
  * Check for existance of a directory\r
  */\r
-static bool check_dir(cptr s)\r
+static bool check_dir(concptr s)\r
 {\r
        int i;\r
 \r
@@ -1047,7 +994,7 @@ static bool check_dir(cptr s)
 /*\r
  * Validate a file\r
  */\r
-static void validate_file(cptr s)\r
+static void validate_file(concptr s)\r
 {\r
        /* Verify or fail */\r
        if (!check_file(s))\r
@@ -1060,7 +1007,7 @@ static void validate_file(cptr s)
 /*\r
  * Validate a directory\r
  */\r
-static void validate_dir(cptr s, bool vital)\r
+static void validate_dir(concptr s, bool vital)\r
 {\r
        /* Verify or fail */\r
        if (!check_dir(s))\r
@@ -1079,14 +1026,13 @@ static void validate_dir(cptr s, bool vital)
 }\r
 \r
 \r
-/*\r
- * Get the "size" for a window\r
+/*!\r
+ * @brief (Windows版固有実装)Get the "size" for a window\r
  */\r
 static void term_getsize(term_data *td)\r
 {\r
        RECT rc;\r
-\r
-       int wid, hgt;\r
+       TERM_LEN wid, hgt;\r
 \r
        /* Paranoia */\r
        if (td->cols < 1) td->cols = 1;\r
@@ -1102,7 +1048,6 @@ static void term_getsize(term_data *td)
        rc.top = 0;\r
        rc.bottom = rc.top + hgt;\r
 \r
-       /* XXX XXX XXX */\r
        /* rc.right += 1; */\r
        /* rc.bottom += 1; */\r
 \r
@@ -1131,7 +1076,7 @@ static void term_getsize(term_data *td)
 static void save_prefs_aux(int i)\r
 {\r
        term_data *td = &data[i];\r
-       char sec_name[128];\r
+       GAME_TEXT sec_name[128];\r
        char buf[1024];\r
 \r
        RECT rc;\r
@@ -1229,7 +1174,6 @@ static void save_prefs_aux(int i)
 \r
 /*\r
  * Write the "prefs"\r
- *\r
  * We assume that the windows have all been initialized\r
  */\r
 static void save_prefs(void)\r
@@ -1274,7 +1218,7 @@ static void save_prefs(void)
 static void load_prefs_aux(int i)\r
 {\r
        term_data *td = &data[i];\r
-       char sec_name[128];\r
+       GAME_TEXT sec_name[128];\r
        char tmp[1024];\r
 \r
        int wid, hgt, posx, posy;\r
@@ -1391,7 +1335,7 @@ static void load_prefs(void)
 #if defined(USE_SOUND) || defined(USE_MUSIC)\r
 \r
 /*\r
- * XXX XXX XXX - Taken from files.c.\r
+ * - Taken from files.c.\r
  *\r
  * Extract "tokens" from a buffer\r
  *\r
@@ -1526,7 +1470,7 @@ static void load_music_prefs(void)
                }\r
        }\r
 \r
-       for (i = 0; i < 1000; i++) /*!< @todo クエスト最大数指定 */\r
+       for (i = 0; i < max_q_idx; i++)\r
        {\r
                sprintf(key, "quest%03d", i);\r
                GetPrivateProfileString("Quest", key, "", tmp, 1024, ini_path);\r
@@ -1706,123 +1650,122 @@ 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
+       concptr 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 */\r
+\r
+               plog(_("パレットを実現できません!", "Cannot activate palette!"));\r
+               return (FALSE);\r
        }\r
 \r
-       /* Result */\r
-       return (can_use_graphics);\r
+       /* Graphics available */\r
+       current_graphics_mode = arg_graphics;\r
+       return (current_graphics_mode);\r
 }\r
 #endif /* USE_GRAPHICS */\r
 \r
@@ -1842,8 +1785,6 @@ static bool init_music(void)
                /* Sound available */\r
                can_use_music = TRUE;\r
        }\r
-\r
-       /* Result */\r
        return (can_use_music);\r
 }\r
 \r
@@ -1873,8 +1814,6 @@ static bool init_sound(void)
                /* Sound available */\r
                can_use_sound = TRUE;\r
        }\r
-\r
-       /* Result */\r
        return (can_use_sound);\r
 }\r
 #endif /* USE_SOUND */\r
@@ -1907,7 +1846,7 @@ static void term_window_resize(term_data *td)
  *\r
  * Note that the "font name" must be capitalized!!!\r
  */\r
-static errr term_force_font(term_data *td, cptr path)\r
+static errr term_force_font(term_data *td, concptr path)\r
 {\r
        int wid, hgt;\r
 \r
@@ -2187,8 +2126,8 @@ static void Term_nuke_win(term *t)
 #endif\r
 \r
 \r
-/*\r
- * Interact with the User\r
+/*!\r
+ * @brief //!< Windows版ユーザ設定項目実装部(実装必須) /Interact with the User\r
  */\r
 static errr Term_user_win(int n)\r
 {\r
@@ -2207,7 +2146,6 @@ static errr Term_xtra_win_react(void)
 {\r
        int i;\r
 \r
-\r
        /* Simple color */\r
        if (colors16)\r
        {\r
@@ -2348,8 +2286,6 @@ static errr Term_xtra_win_react(void)
 \r
                        /* Redraw the contents */\r
                        Term_redraw();\r
-\r
-                       /* Restore */\r
                        Term_activate(old);\r
                }\r
        }\r
@@ -2416,7 +2352,7 @@ static errr Term_xtra_win_flush(void)
 /*\r
  * Hack -- clear the screen\r
  *\r
- * Make this more efficient XXX XXX XXX\r
+ * Make this more efficient \r
  */\r
 static errr Term_xtra_win_clear(void)\r
 {\r
@@ -2505,7 +2441,6 @@ static errr Term_xtra_win_sound(int v)
 \r
 #else /* USE_SOUND */\r
 \r
-       /* Oops */\r
        return (1);\r
 \r
 #endif /* USE_SOUND */\r
@@ -2727,7 +2662,6 @@ static errr Term_xtra_win(int n, int v)
                }\r
        }\r
 \r
-       /* Oops */\r
        return 1;\r
 }\r
 \r
@@ -2858,9 +2792,9 @@ static errr Term_wipe_win(int x, int y, int n)
  *\r
  * One would think there is a more efficient method for telling a window\r
  * what color it should be using to draw with, but perhaps simply changing\r
- * it every time is not too inefficient.  XXX XXX XXX\r
+ * it every time is not too inefficient.  \r
  */\r
-static errr Term_text_win(int x, int y, int n, byte a, const char *s)\r
+static errr Term_text_win(int x, int y, int n, TERM_COLOR a, concptr s)\r
 {\r
        term_data *td = (term_data*)(Term->data);\r
        RECT rc;\r
@@ -3053,16 +2987,16 @@ static errr Term_text_win(int x, int y, int n, byte a, const char *s)
  *\r
  * If "graphics" is not available, we simply "wipe" the given grids.\r
  */\r
-static errr Term_pict_win(int x, int y, int n, const byte *ap, const char *cp, const byte *tap, const char *tcp)\r
+static errr Term_pict_win(TERM_LEN x, TERM_LEN y, int n, const TERM_COLOR *ap, concptr cp, const TERM_COLOR *tap, concptr tcp)\r
 {\r
        term_data *td = (term_data*)(Term->data);\r
 \r
 #ifdef USE_GRAPHICS\r
 \r
        int i;\r
-       int x1, y1, w1, h1, tw1, th1;\r
-       int x2, y2, w2, h2, tw2 = 0;\r
-       int x3, y3;\r
+       TERM_LEN x1, y1, w1, h1, tw1, th1;\r
+       TERM_LEN x2, y2, w2, h2, tw2 = 0;\r
+       TERM_LEN x3, y3;\r
 \r
        HDC hdcMask = NULL;\r
 \r
@@ -3119,7 +3053,7 @@ static errr Term_pict_win(int x, int y, int n, const byte *ap, const char *cp, c
        /* Draw attr/char pairs */\r
        for (i = 0; i < n; i++, x2 += w2)\r
        {\r
-               byte a = ap[i];\r
+               TERM_COLOR a = ap[i];\r
                char c = cp[i];\r
 \r
 \r
@@ -3223,18 +3157,16 @@ static errr Term_pict_win(int x, int y, int n, const byte *ap, const char *cp, c
 static void windows_map(void)\r
 {\r
        term_data *td = &data[0];\r
-       byte a;\r
+       TERM_COLOR a;\r
        char c;\r
-       int x, min_x, max_x;\r
-       int y, min_y, max_y;\r
+       TERM_LEN x, min_x, max_x;\r
+       TERM_LEN y, min_y, max_y;\r
 \r
-       byte ta;\r
+       TERM_COLOR ta;\r
        char tc;\r
 \r
        /* Only in graphics mode */\r
        if (!use_graphics) return;\r
-\r
-       /* Clear screen */\r
        Term_xtra_win_clear();\r
 \r
        td->map_tile_wid = (td->tile_wid * td->cols) / MAX_WID;\r
@@ -3329,7 +3261,7 @@ static void term_data_link(term_data *td)
  * to over-ride selected values, then create the windows, and fonts.\r
  *\r
  * Must use SW_SHOW not SW_SHOWNA, since on 256 color display\r
- * must make active to realize the palette.  XXX XXX XXX\r
+ * must make active to realize the palette.  \r
  */\r
 static void init_windows(void)\r
 {\r
@@ -3434,7 +3366,6 @@ static void init_windows(void)
                        /* Force the use of that font */\r
                        (void)term_force_font(td, buf);\r
 \r
-                       /* Oops */\r
                        td->tile_wid = 8;\r
                        td->tile_hgt = 13;\r
 \r
@@ -3519,7 +3450,7 @@ static void init_windows(void)
        SetWindowPos(td->w, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);\r
 \r
 \r
-       /* New palette XXX XXX XXX */\r
+       /* New palette */\r
        (void)new_palette();\r
 \r
 \r
@@ -3947,10 +3878,7 @@ static void process_menus(WORD wCmd)
                        }\r
                        else\r
                        {\r
-                               /* Save Screen */\r
                                screen_save();\r
-\r
-                               /* Clear screen */\r
                                Term_clear();\r
 \r
                                /* Display the scores */\r
@@ -3961,8 +3889,6 @@ static void process_menus(WORD wCmd)
 \r
                                /* Forget the high score fd */\r
                                highscore_fd = -1;\r
-\r
-                               /* Load screen */\r
                                screen_load();\r
 \r
                                /* Hack - Flush it */\r
@@ -4489,7 +4415,7 @@ static void process_menus(WORD wCmd)
 \r
                                if (hwndSaver)\r
                                {\r
-                                       /* Push the window to the bottom XXX XXX XXX */\r
+                                       /* Push the window to the bottom */\r
                                        SetWindowPos(hwndSaver, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);\r
                                }\r
                                else\r
@@ -4519,14 +4445,8 @@ static void process_menus(WORD wCmd)
                        }\r
                        else\r
                        {\r
-#ifdef JP\r
-                               plog_fmt("ヘルプファイル[%s]が見付かりません。", tmp);\r
-                               plog("代わりにオンラインヘルプを使用してください。");\r
-#else\r
-                               plog_fmt("Cannot find help file: %s", tmp);\r
-                               plog("Use the online help files instead.");\r
-#endif\r
-\r
+                               plog_fmt(_("ヘルプファイル[%s]が見付かりません。", "Cannot find help file: %s"), tmp);\r
+                               plog(_("代わりにオンラインヘルプを使用してください。", "Use the online help files instead."));\r
                        }\r
                        break;\r
 #else /* HTML_HELP */\r
@@ -4540,13 +4460,8 @@ static void process_menus(WORD wCmd)
                        }\r
                        else\r
                        {\r
-#ifdef JP\r
-                               plog_fmt("ヘルプファイル[%s]が見付かりません。", tmp);\r
-                               plog("代わりにオンラインヘルプを使用してください。");\r
-#else\r
-                               plog_fmt("Cannot find help file: %s", tmp);\r
-                               plog("Use the online help files instead.");\r
-#endif\r
+                               plog_fmt(_("ヘルプファイル[%s]が見付かりません。", "Cannot find help file: %s"), tmp);\r
+                               plog(_("代わりにオンラインヘルプを使用してください。", "Use the online help files instead."));\r
 \r
                        }\r
                        break;\r
@@ -4653,8 +4568,7 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,
 LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,\r
                                  WPARAM wParam, LPARAM lParam)\r
 #else /* __MWERKS__ */\r
-LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,\r
-                                         WPARAM wParam, LPARAM lParam)\r
+LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\r
 #endif /* __MWERKS__ */\r
 {\r
        PAINTSTRUCT ps;\r
@@ -4673,14 +4587,12 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,
        /* Handle message */\r
        switch (uMsg)\r
        {\r
-               /* XXX XXX XXX */\r
                case WM_NCCREATE:\r
                {\r
                        SetWindowLong(hWnd, 0, (LONG)(my_td));\r
                        break;\r
                }\r
 \r
-               /* XXX XXX XXX */\r
                case WM_CREATE:\r
                {\r
 #ifdef USE_MUSIC\r
@@ -4765,10 +4677,10 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,
                        HGLOBAL hGlobal;\r
                        LPSTR lpStr;\r
                        int j, sz;\r
-                       TERM_POSITION dx = abs(oldx - mousex) + 1;\r
-                       TERM_POSITION dy = abs(oldy - mousey) + 1;\r
-                       TERM_POSITION ox = (oldx > mousex) ? mousex : oldx;\r
-                       TERM_POSITION oy = (oldy > mousey) ? mousey : oldy;\r
+                       TERM_LEN dx = abs(oldx - mousex) + 1;\r
+                       TERM_LEN dy = abs(oldy - mousey) + 1;\r
+                       TERM_LEN ox = (oldx > mousex) ? mousex : oldx;\r
+                       TERM_LEN oy = (oldy > mousey) ? mousey : oldy;\r
 \r
                        mouse_down = FALSE;\r
                        paint_rect = FALSE;\r
@@ -4968,13 +4880,13 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,
 \r
                                case SIZE_MAXIMIZED:\r
                                {\r
-                                       /* fall through XXX XXX XXX */\r
+                                       /* fall through */\r
                                }\r
 \r
                                case SIZE_RESTORED:\r
                                {\r
-                                       TERM_POSITION cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;\r
-                                       TERM_POSITION rows = (HIWORD(lParam) - td->size_oh1) / td->tile_hgt;\r
+                                       TERM_LEN cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;\r
+                                       TERM_LEN rows = (HIWORD(lParam) - td->size_oh1) / td->tile_hgt;\r
 \r
                                        /* New size */\r
                                        if ((td->cols != cols) || (td->rows != rows))\r
@@ -5111,14 +5023,12 @@ LRESULT FAR PASCAL AngbandListProc(HWND hWnd, UINT uMsg,
        /* Process message */\r
        switch (uMsg)\r
        {\r
-               /* XXX XXX XXX */\r
                case WM_NCCREATE:\r
                {\r
                        SetWindowLong(hWnd, 0, (LONG)(my_td));\r
                        break;\r
                }\r
 \r
-               /* XXX XXX XXX */\r
                case WM_CREATE:\r
                {\r
                        return 0;\r
@@ -5151,8 +5061,8 @@ LRESULT FAR PASCAL AngbandListProc(HWND hWnd, UINT uMsg,
 \r
                case WM_SIZE:\r
                {\r
-                       TERM_POSITION cols;\r
-                       TERM_POSITION rows;\r
+                       TERM_LEN cols;\r
+                       TERM_LEN rows;\r
                        \r
                        /* this message was sent before WM_NCCREATE */\r
                        if (!td) return 1;\r
@@ -5192,7 +5102,7 @@ LRESULT FAR PASCAL AngbandListProc(HWND hWnd, UINT uMsg,
 \r
                                /* HACK - Redraw all windows */\r
                                p_ptr->window = 0xFFFFFFFF;\r
-                               window_stuff();\r
+                               handle_stuff();\r
                        }\r
 \r
                        td->size_hack = FALSE;\r
@@ -5292,7 +5202,6 @@ LRESULT FAR PASCAL AngbandSaverProc(HWND hWnd, UINT uMsg,
        /* Process */\r
        switch (uMsg)\r
        {\r
-               /* XXX XXX XXX */\r
                case WM_NCCREATE:\r
                {\r
                        break;\r
@@ -5354,7 +5263,6 @@ LRESULT FAR PASCAL AngbandSaverProc(HWND hWnd, UINT uMsg,
                }\r
        }\r
 \r
-       /* Oops */\r
        return DefWindowProc(hWnd, uMsg, wParam, lParam);\r
 }\r
 \r
@@ -5370,7 +5278,7 @@ LRESULT FAR PASCAL AngbandSaverProc(HWND hWnd, UINT uMsg,
 /*\r
  * Display warning message (see "z-util.c")\r
  */\r
-static void hack_plog(cptr str)\r
+static void hack_plog(concptr str)\r
 {\r
        /* Give a warning */\r
        if (str)\r
@@ -5390,7 +5298,7 @@ static void hack_plog(cptr str)
 /*\r
  * Display error message and quit (see "z-util.c")\r
  */\r
-static void hack_quit(cptr str)\r
+static void hack_quit(concptr str)\r
 {\r
        /* Give a warning */\r
        if (str)\r
@@ -5423,7 +5331,7 @@ static void hack_quit(cptr str)
 /*\r
  * Display warning message (see "z-util.c")\r
  */\r
-static void hook_plog(cptr str)\r
+static void hook_plog(concptr str)\r
 {\r
        /* Warning */\r
        if (str)\r
@@ -5443,7 +5351,7 @@ static void hook_plog(cptr str)
 /*\r
  * Display error message and quit (see "z-util.c")\r
  */\r
-static void hook_quit(cptr str)\r
+static void hook_quit(concptr str)\r
 {\r
        int i;\r
 \r
@@ -5466,7 +5374,7 @@ static void hook_quit(cptr str)
        save_prefs();\r
 \r
 \r
-       /*** Could use 'Term_nuke_win()' XXX XXX XXX */\r
+       /*** Could use 'Term_nuke_win()' */\r
 \r
        /* Destroy all windows */\r
        for (i = MAX_TERM_DATA - 1; i >= 0; --i)\r
@@ -5521,7 +5429,7 @@ static void init_stuff(void)
        /* Get program name with full path */\r
        GetModuleFileName(hInstance, path, 512);\r
 \r
-       /* Save the "program name" XXX XXX XXX */\r
+       /* Save the "program name" */\r
        argv0 = path;\r
 \r
        /* Get the name of the "*.ini" file */\r
@@ -5651,6 +5559,9 @@ static void init_stuff(void)
        /* validate_dir(ANGBAND_DIR_XTRA_HELP); */\r
 }\r
 \r
+/*!\r
+ * @brief (Windows固有)変愚蛮怒が起動済かどうかのチェック\r
+ */\r
 static bool is_already_running(void)\r
 {\r
        bool result = FALSE;\r
@@ -5665,6 +5576,9 @@ static bool is_already_running(void)
 }\r
 \r
 \r
+/*!\r
+ * @brief (Windows固有)Windowsアプリケーションとしてのエントリポイント\r
+ */\r
 int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,\r
                       LPSTR lpCmdLine, int nCmdShow)\r
 {\r
@@ -5674,7 +5588,7 @@ int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
        HDC hdc;\r
        MSG msg;\r
 \r
-       setlocale( LC_ALL, "ja_JP" );\r
+       setlocale(LC_ALL, "ja_JP.utf8");\r
 \r
        /* Unused */\r
        (void)nCmdShow;\r
@@ -5693,7 +5607,6 @@ int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
                return FALSE;\r
        }\r
 \r
-       /* Initialize */\r
        if (hPrevInst == NULL)\r
        {\r
                wc.style         = CS_CLASSDC;\r
@@ -5808,7 +5721,6 @@ int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
        /* Catch nasty signals */\r
        signals_init();\r
 \r
-       /* Initialize */\r
        Term_activate(term_screen);\r
        init_angband();\r
 \r