-/* File: main-win.c */\r
-\r
-/*\r
- * Copyright (c) 1997 Ben Harrison, Skirmantas Kligys, and others\r
- *\r
- * This software may be copied and distributed for educational, research,\r
- * and not for profit purposes provided that this copyright and statement\r
- * are included in all such copies.\r
- */\r
-\r
-\r
-/*\r
- * This file helps Angband work with Windows computers.\r
- *\r
- * To use this file, use an appropriate "Makefile" or "Project File",\r
- * make sure that "WINDOWS" and/or "WIN32" are defined somewhere, and\r
- * make sure to obtain various extra files as described below.\r
- *\r
- * The official compilation uses the CodeWarrior Pro compiler, which\r
- * includes a special project file and precompilable header file.\r
- *\r
- *\r
- * See also "main-dos.c" and "main-ibm.c".\r
- *\r
- *\r
- * The "lib/user/pref-win.prf" file contains keymaps, macro definitions,\r
- * and/or color redefinitions.\r
- *\r
- * The "lib/user/font-win.prf" contains attr/char mappings for use with the\r
- * normal "lib/xtra/font/*.fon" font files.\r
- *\r
- * The "lib/user/graf-win.prf" contains attr/char mappings for use with the\r
- * special "lib/xtra/graf/*.bmp" bitmap files, which are activated by a menu\r
- * item.\r
- *\r
- *\r
- * Compiling this file, and using the resulting executable, requires\r
- * several extra files not distributed with the standard Angband code.\r
- * If "USE_GRAPHICS" is defined, then "readdib.h" and "readdib.c" must\r
- * be placed into "src/", and the "8X8.BMP" bitmap file must be placed\r
- * into "lib/xtra/graf". In any case, some "*.fon" files (including\r
- * "8X13.FON" if nothing else) must be placed into "lib/xtra/font/".\r
- * If "USE_SOUND" is defined, then some special library (for example,\r
- * "winmm.lib") may need to be linked in, and desired "*.WAV" sound\r
- * files must be placed into "lib/xtra/sound/". All of these extra\r
- * files can be found in the "ext-win" archive.\r
- *\r
- *\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
- *\r
- * A simpler method is needed for selecting the "tile size" for windows.\r
- * XXX XXX XXX\r
- *\r
- * The various "warning" messages assume the existance of the "screen.w"\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
- *\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
- *\r
- *\r
- * Initial framework (and most code) by Ben Harrison (benh@phial.com).\r
- *\r
- * Original code by Skirmantas Kligys (kligys@scf.usc.edu).\r
- *\r
- * Additional code by Ross E Becker (beckerr@cis.ohio-state.edu),\r
- * and Chris R. Martin (crm7479@tam2000.tamu.edu).\r
- */\r
+/*!\r
+* @file main-win.c\r
+* @brief Windows版固有実装(メインエントリポイント含む)\r
+* @date 2018/03/16\r
+* @author Hengband Team\r
+* @detail\r
+*\r
+* <h3>概要</h3>\r
+* Windows98かその前後の頃を起点としたAPI実装。\r
+* 各種のゲームエンジンは無論、\r
+* DirectXといった昨今描画に標準的となったライブラリも用いていない。\r
+* タイルの描画処理などについては、現在動作の詳細を検証中。\r
+*\r
+* <h3>フォーク元の概要</h3>\r
+* <p>\r
+* Copyright (c) 1997 Ben Harrison, Skirmantas Kligys, and others\r
+*\r
+* This software may be copied and distributed for educational, research,\r
+* and not for profit purposes provided that this copyright and statement\r
+* are included in all such copies.\r
+* </p>\r
+* <p>\r
+* This file helps Angband work with Windows computers.\r
+*\r
+* To use this file, use an appropriate "Makefile" or "Project File",\r
+* make sure that "WINDOWS" and/or "WIN32" are defined somewhere, and\r
+* make sure to obtain various extra files as described below.\r
+*\r
+* The official compilation uses the CodeWarrior Pro compiler, which\r
+* includes a special project file and precompilable header file.\r
+* </p>\r
+*\r
+* <p>\r
+* <del>See also "main-dos.c" and "main-ibm.c".</del>\r
+* </p>\r
+*\r
+* <p>\r
+* The "lib/user/pref-win.prf" file contains keymaps, macro definitions,\r
+* and/or color redefinitions.\r
+* </p>\r
+*\r
+* <p>\r
+* The "lib/user/font-win.prf" contains attr/char mappings for use with the\r
+* normal "lib/xtra/font/*.fon" font files.\r
+* </p>\r
+*\r
+* <p>\r
+* The "lib/user/graf-win.prf" contains attr/char mappings for use with the\r
+* special "lib/xtra/graf/*.bmp" bitmap files, which are activated by a menu\r
+* item.\r
+* </p>\r
+*\r
+* <p>\r
+* Compiling this file, and using the resulting executable, requires\r
+* several extra files not distributed with the standard Angband code.\r
+* If "USE_GRAPHICS" is defined, then "readdib.h" and "readdib.c" must\r
+* be placed into "src/", and the "8X8.BMP" bitmap file must be placed\r
+* into "lib/xtra/graf". In any case, some "*.fon" files (including\r
+* "8X13.FON" if nothing else) must be placed into "lib/xtra/font/".\r
+* If "USE_SOUND" is defined, then some special library (for example,\r
+* "winmm.lib") may need to be linked in, and desired "*.WAV" sound\r
+* files must be placed into "lib/xtra/sound/". All of these extra\r
+* files can be found in the "ext-win" archive.\r
+* </p>\r
+*\r
+* <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. \r
+* </p>\r
+*\r
+* <p>\r
+* A simpler method is needed for selecting the "tile size" for windows.\r
+* </p>\r
+*\r
+* <p>\r
+* The various "warning" messages assume the existance of the "screen.w"\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. \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. \r
+* </p>\r
+*\r
+* <p>\r
+* Initial framework (and most code) by Ben Harrison (benh@phial.com).\r
+*\r
+* Original code by Skirmantas Kligys (kligys@scf.usc.edu).\r
+*\r
+* Additional code by Ross E Becker (beckerr@cis.ohio-state.edu),\r
+* and Chris R. Martin (crm7479@tam2000.tamu.edu).\r
+* </p>\r
+*/\r
\r
#include "angband.h"\r
\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
*/\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
- uint rows; /* int -> uint */\r
- uint 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
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
- uint font_wid;\r
- uint font_hgt;\r
-\r
- uint tile_wid;\r
- uint 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
\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
\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
\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
/*\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
#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
/*\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
*/\r
static bool mouse_down = FALSE;\r
static bool paint_rect = FALSE;\r
-static int mousex = 0, mousey = 0;\r
-static int 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
};\r
#endif\r
\r
+\r
+/* Function prototype */\r
+\r
+static bool is_already_running(void);\r
+\r
+\r
/* bg */\r
static void delete_bg(void)\r
{\r
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
/*\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
/* Save results */\r
(*wp) = wid;\r
(*hp) = hgt;\r
-\r
- /* Result */\r
return (p);\r
}\r
#endif\r
/*\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
/*\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
/*\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
/*\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
}\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
rc.top = 0;\r
rc.bottom = rc.top + hgt;\r
\r
- /* XXX XXX XXX */\r
/* rc.right += 1; */\r
/* rc.bottom += 1; */\r
\r
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
\r
/*\r
* Write the "prefs"\r
- *\r
* We assume that the windows have all been initialized\r
*/\r
static void save_prefs(void)\r
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
/* Window size */\r
if (i == 0)\r
{\r
- win_maximized = GetPrivateProfileInt(sec_name, "Maximized", win_maximized, ini_file);\r
+ win_maximized = (GetPrivateProfileInt(sec_name, "Maximized", win_maximized, ini_file) != 0);\r
}\r
\r
/* Window position */\r
/* Window Z position */\r
if (i > 0)\r
{\r
- td->posfix = GetPrivateProfileInt(sec_name, "PositionFix", td->posfix, ini_file);\r
+ td->posfix = (GetPrivateProfileInt(sec_name, "PositionFix", td->posfix, ini_file) != 0);\r
}\r
}\r
\r
int i;\r
\r
/* Extract the "arg_graphics" flag */\r
- arg_graphics = GetPrivateProfileInt("Angband", "Graphics", GRAPHICS_NONE, ini_file);\r
+ arg_graphics = (byte_hack)GetPrivateProfileInt("Angband", "Graphics", GRAPHICS_NONE, ini_file);\r
\r
/* Extract the "arg_bigtile" flag */\r
- arg_bigtile = GetPrivateProfileInt("Angband", "Bigtile", FALSE, ini_file);\r
+ arg_bigtile = (GetPrivateProfileInt("Angband", "Bigtile", FALSE, ini_file) != 0);\r
use_bigtile = arg_bigtile;\r
\r
/* Extract the "arg_sound" flag */\r
#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
*/\r
static s16b tokenize_whitespace(char *buf, s16b num, char **tokens)\r
{\r
- int k = 0;\r
-\r
+ s16b k = 0;\r
char *s = buf;\r
\r
-\r
/* Process */\r
while (k < num)\r
{\r
}\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
\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
- int 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
+ /* Activate a palette */\r
+ if (!new_palette())\r
+ {\r
+ /* Free bitmap */\r
\r
- /* Graphics available */\r
- can_use_graphics = arg_graphics;\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
/* Sound available */\r
can_use_music = TRUE;\r
}\r
-\r
- /* Result */\r
return (can_use_music);\r
}\r
\r
/* Sound available */\r
can_use_sound = TRUE;\r
}\r
-\r
- /* Result */\r
return (can_use_sound);\r
}\r
#endif /* USE_SOUND */\r
*\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
#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
{\r
int i;\r
\r
-\r
/* Simple color */\r
if (colors16)\r
{\r
term_data *td = &data[i];\r
\r
/* Update resized windows */\r
- if ((td->cols != (uint)td->t.wid) || (td->rows != (uint)td->t.hgt))\r
+ if ((td->cols != td->t.wid) || (td->rows != td->t.hgt))\r
{\r
/* Activate */\r
Term_activate(&td->t);\r
\r
/* Redraw the contents */\r
Term_redraw();\r
-\r
- /* Restore */\r
Term_activate(old);\r
}\r
}\r
/*\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
\r
#else /* USE_SOUND */\r
\r
- /* Oops */\r
return (1);\r
\r
#endif /* USE_SOUND */\r
}\r
}\r
\r
- /* Oops */\r
return 1;\r
}\r
\r
*\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
*\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
/* 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
static void windows_map(void)\r
{\r
term_data *td = &data[0];\r
- byte a, c;\r
- int x, min_x, max_x;\r
- int y, min_y, max_y;\r
+ TERM_COLOR a;\r
+ char c;\r
+ TERM_LEN x, min_x, max_x;\r
+ TERM_LEN y, min_y, max_y;\r
\r
- byte ta, tc;\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
* 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
/* 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
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
}\r
else\r
{\r
- /* Save Screen */\r
screen_save();\r
-\r
- /* Clear screen */\r
Term_clear();\r
\r
/* Display the scores */\r
\r
/* Forget the high score fd */\r
highscore_fd = -1;\r
-\r
- /* Load screen */\r
screen_load();\r
\r
/* Hack - Flush it */\r
\r
case IDM_OPTIONS_BIGTILE:\r
{\r
- term_data *td = &data[0];\r
+ td = &data[0];\r
\r
/* Paranoia */\r
if (!inkey_flag)\r
\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
}\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
}\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
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
/* 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
{\r
HGLOBAL hGlobal;\r
LPSTR lpStr;\r
- int i, j, sz;\r
- int dx = abs(oldx - mousex) + 1;\r
- int dy = abs(oldy - mousey) + 1;\r
- int ox = (oldx > mousex) ? mousex : oldx;\r
- int oy = (oldy > mousey) ? mousey : oldy;\r
+ int j, sz;\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
\r
case SIZE_MAXIMIZED:\r
{\r
- /* fall through XXX XXX XXX */\r
+ /* fall through */\r
}\r
\r
case SIZE_RESTORED:\r
{\r
- uint cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;\r
- uint 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
/* 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
\r
case WM_SIZE:\r
{\r
- uint cols;\r
- uint rows;\r
+ TERM_LEN cols;\r
+ TERM_LEN rows;\r
\r
/* this message was sent before WM_NCCREATE */\r
if (!td) return 1;\r
\r
/* HACK - Redraw all windows */\r
p_ptr->window = 0xFFFFFFFF;\r
- window_stuff();\r
+ handle_stuff();\r
}\r
\r
td->size_hack = FALSE;\r
/* Process */\r
switch (uMsg)\r
{\r
- /* XXX XXX XXX */\r
case WM_NCCREATE:\r
{\r
break;\r
}\r
}\r
\r
- /* Oops */\r
return DefWindowProc(hWnd, uMsg, wParam, lParam);\r
}\r
\r
/*\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
/*\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
/*\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
/*\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
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
/* 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
/* validate_dir(ANGBAND_DIR_XTRA_HELP); */\r
}\r
\r
-bool is_already_running()\r
+/*!\r
+ * @brief (Windows固有)変愚蛮怒が起動済かどうかのチェック\r
+ */\r
+static bool is_already_running(void)\r
{\r
bool result = FALSE;\r
HANDLE hMutex;\r
}\r
\r
\r
+/*!\r
+ * @brief (Windows固有)Windowsアプリケーションとしてのエントリポイント\r
+ */\r
int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,\r
LPSTR lpCmdLine, int nCmdShow)\r
{\r
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
return FALSE;\r
}\r
\r
- /* Initialize */\r
if (hPrevInst == NULL)\r
{\r
wc.style = CS_CLASSDC;\r
/* Catch nasty signals */\r
signals_init();\r
\r
- /* Initialize */\r
Term_activate(term_screen);\r
init_angband();\r
\r