-/* File: main-win.c */
-
-/*
- * Copyright (c) 1997 Ben Harrison, Skirmantas Kligys, and others
- *
- * This software may be copied and distributed for educational, research,
- * and not for profit purposes provided that this copyright and statement
- * are included in all such copies.
- */
-
-
-/*
- * This file helps Angband work with Windows computers.
- *
- * To use this file, use an appropriate "Makefile" or "Project File",
- * make sure that "WINDOWS" and/or "WIN32" are defined somewhere, and
- * make sure to obtain various extra files as described below.
- *
- * The official compilation uses the CodeWarrior Pro compiler, which
- * includes a special project file and precompilable header file.
- *
- *
- * See also "main-dos.c" and "main-ibm.c".
- *
- *
- * The "lib/user/pref-win.prf" file contains keymaps, macro definitions,
- * and/or color redefinitions.
- *
- * The "lib/user/font-win.prf" contains attr/char mappings for use with the
- * normal "lib/xtra/font/*.fon" font files.
- *
- * The "lib/user/graf-win.prf" contains attr/char mappings for use with the
- * special "lib/xtra/graf/*.bmp" bitmap files, which are activated by a menu
- * item.
- *
- *
- * Compiling this file, and using the resulting executable, requires
- * several extra files not distributed with the standard Angband code.
- * If "USE_GRAPHICS" is defined, then "readdib.h" and "readdib.c" must
- * be placed into "src/", and the "8X8.BMP" bitmap file must be placed
- * into "lib/xtra/graf". In any case, some "*.fon" files (including
- * "8X13.FON" if nothing else) must be placed into "lib/xtra/font/".
- * If "USE_SOUND" is defined, then some special library (for example,
- * "winmm.lib") may need to be linked in, and desired "*.WAV" sound
- * files must be placed into "lib/xtra/sound/". All of these extra
- * files can be found in the "ext-win" archive.
- *
- *
- * The "Term_xtra_win_clear()" function should probably do a low-level
- * clear of the current window, and redraw the borders and other things,
- * if only for efficiency. XXX XXX XXX
- *
- * A simpler method is needed for selecting the "tile size" for windows.
- * XXX XXX XXX
- *
- * The various "warning" messages assume the existance of the "screen.w"
- * window, I think, and only a few calls actually check for its existance,
- * this may be okay since "NULL" means "on top of all windows". (?) The
- * user must never be allowed to "hide" the main window, or the "menubar"
- * will disappear. XXX XXX XXX
- *
- * Special "Windows Help Files" can be placed into "lib/xtra/help/" for
- * use with the "winhelp.exe" program. These files *may* be available
- * at the ftp site somewhere, but I have not seen them. XXX XXX XXX
- *
- *
- * Initial framework (and most code) by Ben Harrison (benh@phial.com).
- *
- * Original code by Skirmantas Kligys (kligys@scf.usc.edu).
- *
- * Additional code by Ross E Becker (beckerr@cis.ohio-state.edu),
- * and Chris R. Martin (crm7479@tam2000.tamu.edu).
- */
+/*!
+* @file main-win.c
+* @brief Windows版固有実装(メインエントリポイント含む)
+* @date 2018/03/16
+* @author Hengband Team
+* @detail
+*
+* <h3>概要</h3>
+* Windows98かその前後の頃を起点としたAPI実装。
+* 各種のゲームエンジンは無論、
+* DirectXといった昨今描画に標準的となったライブラリも用いていない。
+* タイルの描画処理などについては、現在動作の詳細を検証中。
+*
+* <h3>フォーク元の概要</h3>
+* <p>
+* Copyright (c) 1997 Ben Harrison, Skirmantas Kligys, and others
+*
+* This software may be copied and distributed for educational, research,
+* and not for profit purposes provided that this copyright and statement
+* are included in all such copies.
+* </p>
+* <p>
+* This file helps Angband work with Windows computers.
+*
+* To use this file, use an appropriate "Makefile" or "Project File",
+* make sure that "WINDOWS" and/or "WIN32" are defined somewhere, and
+* make sure to obtain various extra files as described below.
+*
+* The official compilation uses the CodeWarrior Pro compiler, which
+* includes a special project file and precompilable header file.
+* </p>
+*
+* <p>
+* <del>See also "main-dos.c" and "main-ibm.c".</del>
+* </p>
+*
+* <p>
+* The "lib/user/pref-win.prf" file contains keymaps, macro definitions,
+* and/or color redefinitions.
+* </p>
+*
+* <p>
+* The "lib/user/font-win.prf" contains attr/char mappings for use with the
+* normal "lib/xtra/font/*.fon" font files.
+* </p>
+*
+* <p>
+* The "lib/user/graf-win.prf" contains attr/char mappings for use with the
+* special "lib/xtra/graf/*.bmp" bitmap files, which are activated by a menu
+* item.
+* </p>
+*
+* <p>
+* Compiling this file, and using the resulting executable, requires
+* several extra files not distributed with the standard Angband code.
+* If "USE_GRAPHICS" is defined, then "readdib.h" and "readdib.c" must
+* be placed into "src/", and the "8X8.BMP" bitmap file must be placed
+* into "lib/xtra/graf". In any case, some "*.fon" files (including
+* "8X13.FON" if nothing else) must be placed into "lib/xtra/font/".
+* If "USE_SOUND" is defined, then some special library (for example,
+* "winmm.lib") may need to be linked in, and desired "*.WAV" sound
+* files must be placed into "lib/xtra/sound/". All of these extra
+* files can be found in the "ext-win" archive.
+* </p>
+*
+* <p>
+* The "Term_xtra_win_clear()" function should probably do a low-level
+* clear of the current window, and redraw the borders and other things,
+* if only for efficiency.
+* </p>
+*
+* <p>
+* A simpler method is needed for selecting the "tile size" for windows.
+* </p>
+*
+* <p>
+* The various "warning" messages assume the existance of the "screen.w"
+* window, I think, and only a few calls actually check for its existance,
+* this may be okay since "NULL" means "on top of all windows". (?) The
+* user must never be allowed to "hide" the main window, or the "menubar"
+* will disappear.
+* </p>
+*
+* <p>
+* Special "Windows Help Files" can be placed into "lib/xtra/help/" for
+* use with the "winhelp.exe" program. These files *may* be available
+* at the ftp site somewhere, but I have not seen them.
+* </p>
+*
+* <p>
+* Initial framework (and most code) by Ben Harrison (benh@phial.com).
+*
+* Original code by Skirmantas Kligys (kligys@scf.usc.edu).
+*
+* Additional code by Ross E Becker (beckerr@cis.ohio-state.edu),
+* and Chris R. Martin (crm7479@tam2000.tamu.edu).
+* </p>
+*/
#include "angband.h"
-
+#include "view-mainwindow.h"
#ifdef WINDOWS
-
+#include <windows.h>
#include <direct.h>
+#include <locale.h>
+#include "z-term.h"
/*
* Extract the "WIN32" flag from the compiler
#define IDM_FILE_OPEN 101
#define IDM_FILE_SAVE 110
#define IDM_FILE_SCORE 120
+#define IDM_FILE_MOVIE 121
#define IDM_FILE_EXIT 130
#define IDM_WINDOW_VIS_0 200
#define IDM_WINDOW_D_HGT_6 276
#define IDM_WINDOW_D_HGT_7 277
-#define IDM_OPTIONS_NO_GRAPHICS 400
-#define IDM_OPTIONS_OLD_GRAPHICS 401
-#define IDM_OPTIONS_NEW_GRAPHICS 402
-#define IDM_OPTIONS_BIGTILE 409
-#define IDM_OPTIONS_SOUND 410
-#define IDM_OPTIONS_SAVER 420
-#define IDM_OPTIONS_MAP 430
-#define IDM_OPTIONS_BG 440
-#define IDM_OPTIONS_OPEN_BG 441
+#define IDM_OPTIONS_NO_GRAPHICS 400
+#define IDM_OPTIONS_OLD_GRAPHICS 401
+#define IDM_OPTIONS_NEW_GRAPHICS 402
+#define IDM_OPTIONS_NEW2_GRAPHICS 403
+#define IDM_OPTIONS_BIGTILE 409
+#define IDM_OPTIONS_SOUND 410
+#define IDM_OPTIONS_MUSIC 411
+#define IDM_OPTIONS_SAVER 420
+#define IDM_OPTIONS_MAP 430
+#define IDM_OPTIONS_BG 440
+#define IDM_OPTIONS_OPEN_BG 441
#define IDM_DUMP_SCREEN_HTML 450
#define IDM_HELP_CONTENTS 901
-
-
-/*
- * This may need to be removed for some compilers XXX XXX XXX
- */
-#define STRICT
-
/*
* Exclude parts of WINDOWS.H that are not needed
*/
#endif
/*
- * Hack -- Fake declarations from "dos.h" XXX XXX XXX
+ * Hack -- Fake declarations from "dos.h"
*/
#ifdef WIN32
#define INVALID_FILE_NAME (DWORD)0xFFFFFFFF
#else /* WIN32 */
#define FA_LABEL 0x08 /* Volume label */
#define FA_DIREC 0x10 /* Directory */
-unsigned _cdecl _dos_getfileattr(const char *, unsigned *);
+unsigned _cdecl _dos_getfileattr(concptr , unsigned *);
#endif /* WIN32 */
/*
*/
typedef struct _term_data term_data;
-/*
- * Extra "term" data
- *
+/*!
+ * @struct _term_data
+ * @brief ターム情報構造体 / Extra "term" data
+ * @details
+ * <p>
+ * pos_x / pos_y は各タームの左上点座標を指す。
+ * </p>
+ * <p>
+ * tile_wid / tile_hgt は[ウィンドウ]メニューのタイルの幅/高さを~を
+ * 1ドットずつ調整するステータスを指す。
+ * また、フォントを変更すると都度自動調整される。
+ * </p>
+ * <p>
* Note the use of "font_want" for the names of the font file requested by
* the user, and the use of "font_file" for the currently active font file.
*
* The "font_file" is uppercased, and takes the form "8X13.FON", while
* "font_want" can be in almost any form as long as it could be construed
* as attempting to represent the name of a font.
+ * </p>
*/
struct _term_data
{
term t;
-
- cptr s;
-
+ concptr s;
HWND w;
-
DWORD dwStyle;
DWORD dwExStyle;
uint keys;
+ TERM_LEN rows; /* int -> uint */
+ TERM_LEN cols;
- uint rows; /* int -> uint */
- uint cols;
-
- uint pos_x;
- uint pos_y;
+ uint pos_x; //!< タームの左上X座標
+ uint pos_y; //!< タームの左上Y座標
uint size_wid;
uint size_hgt;
uint size_ow1;
uint size_oh2;
bool size_hack;
-
bool xtra_hack;
-
bool visible;
-
bool bizarre;
-
- cptr font_want;
-
- cptr font_file;
-
+ concptr font_want;
+ concptr font_file;
HFONT font_id;
-
- uint font_wid;
- uint font_hgt;
-
- uint tile_wid;
- uint tile_hgt;
+ int font_wid; //!< フォント横幅
+ int font_hgt; //!< フォント縦幅
+ int tile_wid; //!< タイル横幅
+ int tile_hgt; //!< タイル縦幅
uint map_tile_wid;
uint map_tile_hgt;
bool map_active;
-#ifdef JP
+#if 1 /* #ifdef JP */
LOGFONT lf;
#endif
bool posfix;
-/* bg */
-#if 0
- char *bgfile;
- int use_bg;
-#endif
};
+#define MAX_TERM_DATA 8 //!< Maximum number of windows
-/*
- * Maximum number of windows XXX XXX XXX
- */
-#define MAX_TERM_DATA 8
-
-/*
- * An array of term_data's
- */
-static term_data data[MAX_TERM_DATA];
+static term_data data[MAX_TERM_DATA]; //!< An array of term_data's
+static term_data *my_td; //!< Hack -- global "window creation" pointer
+POINT normsize; //!< Remember normal size of main window when maxmized
/*
- * Hack -- global "window creation" pointer
+ * was main window maximized on previous playing
*/
-static term_data *my_td;
+bool win_maximized = FALSE;
/*
* game in progress
/* bg */
static HBITMAP hBG = NULL;
-static int use_bg = 0;
-static char bg_bitmap_file[1024] = "bg.bmp";
+static int use_bg = 0; //!< 背景使用フラグ、1なら私用。
+static char bg_bitmap_file[1024] = "bg.bmp"; //!< 現在の背景ビットマップファイル名。
#ifdef USE_SAVER
#ifdef USE_GRAPHICS
-/*
+/*!
+ * 現在使用中のタイルID(0ならば未使用)
* Flag set once "graphics" has been initialized
*/
-static bool can_use_graphics = FALSE;
+static byte_hack current_graphics_mode = 0;
/*
* The global bitmap
static bool can_use_sound = FALSE;
#define SAMPLE_MAX 8
-
/*
* An array of sound file names
*/
-static cptr sound_file[SOUND_MAX][SAMPLE_MAX];
+static concptr sound_file[SOUND_MAX][SAMPLE_MAX];
#endif /* USE_SOUND */
+
+#ifdef USE_MUSIC
+
+#define SAMPLE_MUSIC_MAX 16
+static concptr music_file[MUSIC_BASIC_MAX][SAMPLE_MUSIC_MAX];
+static concptr dungeon_music_file[1000][SAMPLE_MUSIC_MAX];
+static concptr town_music_file[1000][SAMPLE_MUSIC_MAX];
+static concptr quest_music_file[1000][SAMPLE_MUSIC_MAX];
+static bool can_use_music = FALSE;
+
+static MCI_OPEN_PARMS mop;
+static char mci_device_type[256];
+
+int current_music_type = 0;
+int current_music_id = 0;
+
+#endif /* USE_MUSIC */
+
+
/*
* Full path to ANGBAND.INI
*/
-static cptr ini_file = NULL;
+static concptr ini_file = NULL;
/*
* Name of application
*/
-static cptr AppName = "ANGBAND";
+static concptr AppName = "ANGBAND";
/*
* Name of sub-window type
*/
-static cptr AngList = "AngList";
+static concptr AngList = "AngList";
/*
* Directory names
*/
-static cptr ANGBAND_DIR_XTRA_GRAF;
-static cptr ANGBAND_DIR_XTRA_SOUND;
-static cptr ANGBAND_DIR_XTRA_HELP;
-#ifndef JP
-static cptr ANGBAND_DIR_XTRA_FONT;
+static concptr ANGBAND_DIR_XTRA_GRAF;
+static concptr ANGBAND_DIR_XTRA_SOUND;
+static concptr ANGBAND_DIR_XTRA_MUSIC;
+static concptr ANGBAND_DIR_XTRA_HELP;
+#if 0 /* #ifndef JP */
+static concptr ANGBAND_DIR_XTRA_FONT;
#endif
#ifdef USE_MUSIC
-static cptr ANGBAND_DIR_XTRA_MUSIC;
+static concptr ANGBAND_DIR_XTRA_MUSIC;
#endif
*/
static bool Term_no_press = FALSE;
-
/*
- * The "simple" color values
- *
+ * Copy and paste
+ */
+static bool mouse_down = FALSE;
+static bool paint_rect = FALSE;
+static TERM_LEN mousex = 0, mousey = 0;
+static TERM_LEN oldx, oldy;
+
+
+/*!
+ * @brief The "simple" color values
+ * @details
* See "main-ibm.c" for original table information
- *
* The entries below are taken from the "color bits" defined above.
- *
* Note that many of the choices below suck, but so do crappy monitors.
*/
static BYTE win_pal[256] =
};
#endif
+
+/* Function prototype */
+
+static bool is_already_running(void);
+
+
/* bg */
static void delete_bg(void)
{
hBG = LoadImage(NULL, bmfile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if (!hBG) {
-#ifdef JP
- plog_fmt("ÊÉ»æÍÑ¥Ó¥Ã¥È¥Þ¥Ã¥× '%s' ¤òÆɤ߹þ¤á¤Þ¤»¤ó¡£", bmfile);
-#else
- plog_fmt("Can't load the bitmap file '%s'.", bmfile);
-#endif
+ plog_fmt(_("壁紙用ビットマップ '%s' を読み込めません。", "Can't load the bitmap file '%s'."), bmfile);
use_bg = 0;
return 0;
}
-#if 0 /* gomi */
- HDC wnddc, dcimage, dcbg;
- HBITMAP bmimage, bmimage_old, bmbg_old;
- int i, j;
-
- delete_bg();
-
- wnddc = GetDC(hwnd);
- dcimage = CreateCompatibleDC(wnddc);
- dcbg = CreateCompatibleDC(wnddc);
-
- bmimage = LoadImage(NULL, "bg.bmp", LR_LOADFROMFILE, 0, 0, 0);
- if (!bmimage) quit("bg.bmp¤¬Æɤߤ³¤á¤Ê¤¤¡ª");
- bmimage_old = SelectObject(dcimage, bmimage);
-
- CreateCompatibleBitmap();
-
- ReleaseDC(hwnd, wnddc);
-#endif
use_bg = 1;
return 1;
}
/*
* Hack -- given a pathname, point at the filename
*/
-static cptr extract_file_name(cptr s)
+static concptr extract_file_name(concptr s)
{
- cptr p;
+ concptr p;
/* Start at the end */
p = s + strlen(s) - 1;
*
* Return a pointer to a static buffer holding the capitalized base name.
*/
-#ifndef JP
+#if 0 /* #ifndef JP */
static char *analyze_font(char *path, int *wp, int *hp)
{
int wid, hgt;
/* Save results */
(*wp) = wid;
(*hp) = hgt;
-
- /* Result */
return (p);
}
#endif
/*
* Check for existance of a file
*/
-static bool check_file(cptr s)
+static bool check_file(concptr s)
{
char path[1024];
/*
* Check for existance of a directory
*/
-static bool check_dir(cptr s)
+static bool check_dir(concptr s)
{
int i;
/*
* Validate a file
*/
-static void validate_file(cptr s)
+static void validate_file(concptr s)
{
/* Verify or fail */
if (!check_file(s))
{
-#ifdef JP
- quit_fmt("ɬÍפʥե¡¥¤¥ë[%s]¤¬¸«¤¢¤¿¤ê¤Þ¤»¤ó¡£", s);
-#else
- quit_fmt("Cannot find required file:\n%s", s);
-#endif
-
+ quit_fmt(_("必要なファイル[%s]が見あたりません。", "Cannot find required file:\n%s"), s);
}
}
/*
* Validate a directory
*/
-static void validate_dir(cptr s, bool vital)
+static void validate_dir(concptr s, bool vital)
{
/* Verify or fail */
if (!check_dir(s))
/* This directory contains needed data */
if (vital)
{
-#ifdef JP
- quit_fmt("ɬÍפʥǥ£¥ì¥¯¥È¥ê[%s]¤¬¸«¤¢¤¿¤ê¤Þ¤»¤ó¡£", s);
-#else
- quit_fmt("Cannot find required directory:\n%s", s);
-#endif
-
+ quit_fmt(_("必要なディレクトリ[%s]が見あたりません。", "Cannot find required directory:\n%s"), s);
}
/* Attempt to create this directory */
else if (mkdir(s))
}
-/*
- * Get the "size" for a window
+/*!
+ * @brief (Windows版固有実装)Get the "size" for a window
*/
static void term_getsize(term_data *td)
{
RECT rc;
-
- int wid, hgt;
-
- /* Paranoia */
+ TERM_LEN wid, hgt;
if (td->cols < 1) td->cols = 1;
if (td->rows < 1) td->rows = 1;
rc.top = 0;
rc.bottom = rc.top + hgt;
- /* XXX XXX XXX */
/* rc.right += 1; */
/* rc.bottom += 1; */
/*
* Write the "prefs" for a single term
*/
-static void save_prefs_aux(term_data *td, cptr sec_name)
+static void save_prefs_aux(int i)
{
+ term_data *td = &data[i];
+ GAME_TEXT sec_name[128];
char buf[1024];
RECT rc;
-
- /* Paranoia */
+ WINDOWPLACEMENT lpwndpl;
if (!td->w) return;
+ /* Make section name */
+ sprintf(sec_name, "Term-%d", i);
+
/* Visible */
- strcpy(buf, td->visible ? "1" : "0");
- WritePrivateProfileString(sec_name, "Visible", buf, ini_file);
+ if (i > 0)
+ {
+ strcpy(buf, td->visible ? "1" : "0");
+ WritePrivateProfileString(sec_name, "Visible", buf, ini_file);
+ }
/* Font */
#ifdef JP
- strcpy(buf, td->lf.lfFaceName[0]!='\0' ? td->lf.lfFaceName : "£Í£Ó ¥´¥·¥Ã¥¯");
+ strcpy(buf, td->lf.lfFaceName[0]!='\0' ? td->lf.lfFaceName : "ï¼ï¼³ ã\82´ã\82·ã\83\83ã\82¯");
#else
+#if 0
strcpy(buf, td->font_file ? td->font_file : "8X13.FON");
+#else
+ strcpy(buf, td->lf.lfFaceName[0]!='\0' ? td->lf.lfFaceName : "Courier");
+#endif
#endif
WritePrivateProfileString(sec_name, "Font", buf, ini_file);
-#ifdef JP
+#if 1 /* #ifdef JP */
wsprintf(buf, "%d", td->lf.lfWidth);
WritePrivateProfileString(sec_name, "FontWid", buf, ini_file);
wsprintf(buf, "%d", td->lf.lfHeight);
wsprintf(buf, "%d", td->tile_hgt);
WritePrivateProfileString(sec_name, "TileHgt", buf, ini_file);
+ /* Get window placement and dimensions */
+ lpwndpl.length = sizeof(WINDOWPLACEMENT);
+ GetWindowPlacement(td->w, &lpwndpl);
+
+ /* Acquire position in *normal* mode (not minimized) */
+ rc = lpwndpl.rcNormalPosition;
+
/* Window size (x) */
- wsprintf(buf, "%d", td->cols);
+ if (i == 0) wsprintf(buf, "%d", normsize.x);
+ else wsprintf(buf, "%d", td->cols);
WritePrivateProfileString(sec_name, "NumCols", buf, ini_file);
/* Window size (y) */
- wsprintf(buf, "%d", td->rows);
+ if (i == 0) wsprintf(buf, "%d", normsize.y);
+ else wsprintf(buf, "%d", td->rows);
WritePrivateProfileString(sec_name, "NumRows", buf, ini_file);
+ /* Maxmized (only main window) */
+ if (i == 0)
+ {
+ strcpy(buf, IsZoomed(td->w) ? "1" : "0");
+ WritePrivateProfileString(sec_name, "Maximized", buf, ini_file);
+ }
+
/* Acquire position */
GetWindowRect(td->w, &rc);
WritePrivateProfileString(sec_name, "PositionY", buf, ini_file);
/* Window Z position */
- strcpy(buf, td->posfix ? "1" : "0");
- WritePrivateProfileString(sec_name, "PositionFix", buf, ini_file);
+ if (i > 0)
+ {
+ strcpy(buf, td->posfix ? "1" : "0");
+ WritePrivateProfileString(sec_name, "PositionFix", buf, ini_file);
+ }
}
/*
* Write the "prefs"
- *
* We assume that the windows have all been initialized
*/
static void save_prefs(void)
strcpy(buf, arg_sound ? "1" : "0");
WritePrivateProfileString("Angband", "Sound", buf, ini_file);
+ /* Save the "arg_sound" flag */
+ strcpy(buf, arg_music ? "1" : "0");
+ WritePrivateProfileString("Angband", "Music", buf, ini_file);
+
/* bg */
strcpy(buf, use_bg ? "1" : "0");
WritePrivateProfileString("Angband", "BackGround", buf, ini_file);
/* Save window prefs */
for (i = 0; i < MAX_TERM_DATA; ++i)
{
- term_data *td = &data[i];
-
- sprintf(buf, "Term-%d", i);
-
- save_prefs_aux(td, buf);
+ save_prefs_aux(i);
}
}
/*
* Load the "prefs" for a single term
*/
-static void load_prefs_aux(term_data *td, cptr sec_name)
+static void load_prefs_aux(int i)
{
+ term_data *td = &data[i];
+ GAME_TEXT sec_name[128];
char tmp[1024];
- int wid, hgt;
+ int wid, hgt, posx, posy;
+ int dispx = GetSystemMetrics( SM_CXVIRTUALSCREEN);
+ int dispy = GetSystemMetrics( SM_CYVIRTUALSCREEN);
+ posx=0;
+ posy=0;
+
+ /* Make section name */
+ sprintf(sec_name, "Term-%d", i);
+
+ /* Make section name */
+ sprintf(sec_name, "Term-%d", i);
/* Visible */
- td->visible = (GetPrivateProfileInt(sec_name, "Visible", td->visible, ini_file) != 0);
+ if (i > 0)
+ {
+ td->visible = (GetPrivateProfileInt(sec_name, "Visible", td->visible, ini_file) != 0);
+ }
/* Desired font, with default */
#ifdef JP
- GetPrivateProfileString(sec_name, "Font", "£Í£Ó ¥´¥·¥Ã¥¯", tmp, 127, ini_file);
+ GetPrivateProfileString(sec_name, "Font", "ï¼ï¼³ ã\82´ã\82·ã\83\83ã\82¯", tmp, 127, ini_file);
#else
+#if 0
GetPrivateProfileString(sec_name, "Font", "8X13.FON", tmp, 127, ini_file);
+#else
+ GetPrivateProfileString(sec_name, "Font", "Courier", tmp, 127, ini_file);
+#endif
#endif
td->bizarre = (GetPrivateProfileInt(sec_name, "Bizarre", td->bizarre, ini_file) != 0);
/* Analyze font, save desired font name */
-#ifdef JP
+#if 1 /* #ifdef JP */
td->font_want = string_make(tmp);
hgt = 15; wid = 0;
td->lf.lfWidth = GetPrivateProfileInt(sec_name, "FontWid", wid, ini_file);
/* Tile size */
-#ifdef JP
+#if 1 /* #ifdef JP */
td->tile_wid = GetPrivateProfileInt(sec_name, "TileWid", td->lf.lfWidth, ini_file);
td->tile_hgt = GetPrivateProfileInt(sec_name, "TileHgt", td->lf.lfHeight, ini_file);
#else
/* Window size */
td->cols = GetPrivateProfileInt(sec_name, "NumCols", td->cols, ini_file);
td->rows = GetPrivateProfileInt(sec_name, "NumRows", td->rows, ini_file);
+ normsize.x = td->cols; normsize.y = td->rows;
+
+ /* Window size */
+ if (i == 0)
+ {
+ win_maximized = (GetPrivateProfileInt(sec_name, "Maximized", win_maximized, ini_file) != 0);
+ }
/* Window position */
- td->pos_x = GetPrivateProfileInt(sec_name, "PositionX", td->pos_x, ini_file);
- td->pos_y = GetPrivateProfileInt(sec_name, "PositionY", td->pos_y, ini_file);
+ posx = GetPrivateProfileInt(sec_name, "PositionX", posx, ini_file);
+ posy = GetPrivateProfileInt(sec_name, "PositionY", posy, ini_file);
+ td->pos_x = MIN(MAX(0, posx), dispx-128);
+ td->pos_y = MIN(MAX(0, posy), dispy-128);
/* Window Z position */
- td->posfix = GetPrivateProfileInt(sec_name, "PositionFix", td->posfix, ini_file);
+ if (i > 0)
+ {
+ td->posfix = (GetPrivateProfileInt(sec_name, "PositionFix", td->posfix, ini_file) != 0);
+ }
}
{
int i;
- char buf[1024];
-
/* Extract the "arg_graphics" flag */
- arg_graphics = GetPrivateProfileInt("Angband", "Graphics", GRAPHICS_NONE, ini_file);
+ arg_graphics = (byte_hack)GetPrivateProfileInt("Angband", "Graphics", GRAPHICS_NONE, ini_file);
/* Extract the "arg_bigtile" flag */
- arg_bigtile = GetPrivateProfileInt("Angband", "Bigtile", FALSE, ini_file);
+ arg_bigtile = (GetPrivateProfileInt("Angband", "Bigtile", FALSE, ini_file) != 0);
use_bigtile = arg_bigtile;
/* Extract the "arg_sound" flag */
arg_sound = (GetPrivateProfileInt("Angband", "Sound", 0, ini_file) != 0);
+ /* Extract the "arg_sound" flag */
+ arg_music = (GetPrivateProfileInt("Angband", "Music", 0, ini_file) != 0);
+
/* bg */
use_bg = GetPrivateProfileInt("Angband", "BackGround", 0, ini_file);
GetPrivateProfileString("Angband", "BackGroundBitmap", "bg.bmp", bg_bitmap_file, 1023, ini_file);
/* Load window prefs */
for (i = 0; i < MAX_TERM_DATA; ++i)
{
- term_data *td = &data[i];
-
- sprintf(buf, "Term-%d", i);
-
- load_prefs_aux(td, buf);
+ load_prefs_aux(i);
}
}
-#ifdef USE_SOUND
+#if defined(USE_SOUND) || defined(USE_MUSIC)
/*
- * XXX XXX XXX - Taken from files.c.
+ * - Taken from files.c.
*
* Extract "tokens" from a buffer
*
*/
static s16b tokenize_whitespace(char *buf, s16b num, char **tokens)
{
- int k = 0;
-
+ s16b k = 0;
char *s = buf;
-
/* Process */
while (k < num)
{
char *t;
/* Skip leading whitespace */
- for ( ; *s && isspace(*s); ++s) /* loop */;
+ for ( ; *s && iswspace(*s); ++s) /* loop */;
/* All done */
if (!*s) break;
/* Find next whitespace, if any */
- for (t = s; *t && !isspace(*t); ++t) /* loop */;
+ for (t = s; *t && !iswspace(*t); ++t) /* loop */;
/* Nuke and advance (if necessary) */
if (*t) *t++ = '\0';
return (k);
}
+#endif /* USE_SOUND || USE_MUSIC */
+
+#ifdef USE_SOUND
+
static void load_sound_prefs(void)
{
int i, j, num;
char *zz[SAMPLE_MAX];
/* Access the sound.cfg */
+
path_build(ini_path, 1024, ANGBAND_DIR_XTRA_SOUND, "sound.cfg");
for (i = 0; i < SOUND_MAX; i++)
#endif /* USE_SOUND */
+#ifdef USE_MUSIC
+
+static void load_music_prefs(void)
+{
+ int i, j, num;
+ char tmp[1024];
+ char ini_path[1024];
+ char wav_path[1024];
+ char *zz[SAMPLE_MAX];
+ char key[80];
+
+ /* Access the music.cfg */
+
+ path_build(ini_path, 1024, ANGBAND_DIR_XTRA_MUSIC, "music.cfg");
+
+ GetPrivateProfileString("Device", "type", "", mci_device_type, 256, ini_path);
+
+ for (i = 0; i < MUSIC_BASIC_MAX; i++)
+ {
+ GetPrivateProfileString("Basic", angband_music_basic_name[i], "", tmp, 1024, ini_path);
+
+ num = tokenize_whitespace(tmp, SAMPLE_MUSIC_MAX, zz);
+
+ for (j = 0; j < num; j++)
+ {
+ /* Access the sound */
+ path_build(wav_path, 1024, ANGBAND_DIR_XTRA_MUSIC, zz[j]);
+
+ /* Save the sound filename, if it exists */
+ if (check_file(wav_path))
+ music_file[i][j] = string_make(zz[j]);
+ }
+ }
+
+ for (i = 0; i < max_d_idx; i++)
+ {
+ sprintf(key, "dungeon%03d", i);
+ GetPrivateProfileString("Dungeon", key, "", tmp, 1024, ini_path);
+
+ num = tokenize_whitespace(tmp, SAMPLE_MUSIC_MAX, zz);
+
+ for (j = 0; j < num; j++)
+ {
+ /* Access the sound */
+ path_build(wav_path, 1024, ANGBAND_DIR_XTRA_MUSIC, zz[j]);
+
+ /* Save the sound filename, if it exists */
+ if (check_file(wav_path))
+ dungeon_music_file[i][j] = string_make(zz[j]);
+ }
+ }
+
+ for (i = 0; i < max_q_idx; i++)
+ {
+ sprintf(key, "quest%03d", i);
+ GetPrivateProfileString("Quest", key, "", tmp, 1024, ini_path);
+
+ num = tokenize_whitespace(tmp, SAMPLE_MUSIC_MAX, zz);
+
+ for (j = 0; j < num; j++)
+ {
+ /* Access the sound */
+ path_build(wav_path, 1024, ANGBAND_DIR_XTRA_MUSIC, zz[j]);
+
+ /* Save the sound filename, if it exists */
+ if (check_file(wav_path))
+ quest_music_file[i][j] = string_make(zz[j]);
+ }
+ }
+
+ for (i = 0; i < 1000; i++) /*!< @todo 町最大数指定 */
+ {
+ sprintf(key, "town%03d", i);
+ GetPrivateProfileString("Town", key, "", tmp, 1024, ini_path);
+
+ num = tokenize_whitespace(tmp, SAMPLE_MUSIC_MAX, zz);
+
+ for (j = 0; j < num; j++)
+ {
+ /* Access the sound */
+ path_build(wav_path, 1024, ANGBAND_DIR_XTRA_MUSIC, zz[j]);
+
+ /* Save the sound filename, if it exists */
+ if (check_file(wav_path))
+ town_music_file[i][j] = string_make(zz[j]);
+ }
+ }
+
+
+}
+
+#endif /* USE_MUSIC */
+
/*
* Create the new global palette based on the bitmap palette
* (if any), and the standard 16 entry palette derived from
if ((nEntries == 0) || (nEntries > 220))
{
/* Warn the user */
-#ifdef JP
- plog("²èÌ̤ò16¥Ó¥Ã¥È¤«24¥Ó¥Ã¥È¥«¥é¡¼¥â¡¼¥É¤Ë¤·¤Æ²¼¤µ¤¤¡£");
-#else
- plog("Please switch to high- or true-color mode.");
-#endif
-
+ plog(_("画面を16ビットか24ビットカラーモードにして下さい。", "Please switch to high- or true-color mode."));
/* Cleanup */
rnfree(lppe, lppeSize);
/* Create a new palette, or fail */
hNewPal = CreatePalette(pLogPal);
-#ifdef JP
- if (!hNewPal) quit("¥Ñ¥ì¥Ã¥È¤òºîÀ®¤Ç¤¤Þ¤»¤ó¡ª");
-#else
- if (!hNewPal) quit("Cannot create palette!");
-#endif
-
+ if (!hNewPal) quit(_("パレットを作成できません!", "Cannot create palette!"));
/* Free the palette */
rnfree(pLogPal, pLogPalSize);
SelectPalette(hdc, hNewPal, 0);
i = RealizePalette(hdc);
ReleaseDC(td->w, hdc);
-#ifdef JP
- if (i == 0) quit("¥Ñ¥ì¥Ã¥È¤ò¥·¥¹¥Æ¥à¥¨¥ó¥È¥ê¤Ë¥Þ¥Ã¥×¤Ç¤¤Þ¤»¤ó¡ª");
-#else
- if (i == 0) quit("Cannot realize palette!");
-#endif
+ if (i == 0) quit(_("パレットをシステムエントリにマップできません!", "Cannot realize palette!"));
/* Sub-windows */
#ifdef USE_GRAPHICS
-/*
- * Initialize graphics
+/*!
+ * @brief グラフィクスを初期化する / Initialize graphics
+ * @details
+ * <ul>
+ * <li>メニュー[オプション]>[グラフィクス]が「なし」以外の時に描画処理を初期化する。</li>
+ * <li>呼び出されるタイミングはロード時、及び同メニューで「なし」以外に変更される毎になる。</li>
+ * </ul>
*/
static bool init_graphics(void)
{
/* Initialize once */
- /* if (can_use_graphics != arg_graphics) */
- {
- char buf[1024];
- int wid, hgt;
- cptr name;
+ char buf[1024];
+ BYTE wid, hgt, twid, thgt, ox, oy;
+ concptr name;
- if (arg_graphics == GRAPHICS_ADAM_BOLT)
- {
- wid = 16;
- hgt = 16;
+ if (arg_graphics == GRAPHICS_ADAM_BOLT)
+ {
+ wid = 16;
+ hgt = 16;
+ twid = 16;
+ thgt = 16;
+ ox = 0;
+ oy = 0;
+ name = "16X16.BMP";
+
+ ANGBAND_GRAF = "new";
+ }
+ else if (arg_graphics == GRAPHICS_HENGBAND)
+ {
+ /*! @todo redraw
+ wid = 64;
+ hgt = 64;
+ twid = 32;
+ thgt = 32;
+ ox = -16;
+ oy = -24;
+ name = "64X64.BMP";
+ */
+
+ wid = 32;
+ hgt = 32;
+ twid = 32;
+ thgt = 32;
+ ox = 0;
+ oy = 0;
+ name = "32X32.BMP";
+
+ ANGBAND_GRAF = "ne2";
+ }
+ else
+ {
+ wid = 8;
+ hgt = 8;
+ twid = 8;
+ thgt = 8;
+ ox = 0;
+ oy = 0;
+ name = "8X8.BMP";
+ ANGBAND_GRAF = "old";
+ }
- name = "16X16.BMP";
+ /* Access the bitmap file */
+ path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, name);
- ANGBAND_GRAF = "new";
- }
- else
- {
- wid = 8;
- hgt = 8;
+ /* Load the bitmap or quit */
+ if (!ReadDIB(data[0].w, buf, &infGraph))
+ {
+ plog_fmt(_("ビットマップ '%s' を読み込めません。", "Cannot read bitmap file '%s'"), name);
+ return (FALSE);
+ }
- name = "8X8.BMP";
- ANGBAND_GRAF = "old";
- }
+ /* Save the new sizes */
+ infGraph.CellWidth = wid;
+ infGraph.CellHeight = hgt;
+ infGraph.TileWidth = twid;
+ infGraph.TileHeight = thgt;
+ infGraph.OffsetX = ox;
+ infGraph.OffsetY = oy;
- /* Access the bitmap file */
- path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, name);
+ if (arg_graphics == GRAPHICS_ADAM_BOLT)
+ {
+ /* Access the mask file */
+ path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, "mask.bmp");
/* Load the bitmap or quit */
- if (!ReadDIB(data[0].w, buf, &infGraph))
+ if (!ReadDIB(data[0].w, buf, &infMask))
{
-#ifdef JP
- plog_fmt("¥Ó¥Ã¥È¥Þ¥Ã¥× '%s' ¤òÆɤ߹þ¤á¤Þ¤»¤ó¡£", name);
-#else
- plog_fmt("Cannot read bitmap file '%s'", name);
-#endif
-
+ plog_fmt("Cannot read bitmap file '%s'", buf);
return (FALSE);
}
+ }
+ if (arg_graphics == GRAPHICS_HENGBAND)
+ {
+ /* Access the mask file */
+ path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, "mask32.bmp");
- /* Save the new sizes */
- infGraph.CellWidth = wid;
- infGraph.CellHeight = hgt;
-
- if (arg_graphics == GRAPHICS_ADAM_BOLT)
+ /* Load the bitmap or quit */
+ if (!ReadDIB(data[0].w, buf, &infMask))
{
- /* Access the mask file */
- path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_GRAF, "mask.bmp");
-
- /* Load the bitmap or quit */
- if (!ReadDIB(data[0].w, buf, &infMask))
- {
- plog_fmt("Cannot read bitmap file '%s'", buf);
- return (FALSE);
- }
+ plog_fmt("Cannot read bitmap file '%s'", buf);
+ return (FALSE);
}
+ }
- /* Activate a palette */
- if (!new_palette())
- {
- /* Free bitmap XXX XXX XXX */
+ /* Activate a palette */
+ if (!new_palette())
+ {
+ /* Free bitmap */
- /* Oops */
-#ifdef JP
- plog("¥Ñ¥ì¥Ã¥È¤ò¼Â¸½¤Ç¤¤Þ¤»¤ó¡ª");
-#else
- plog("Cannot activate palette!");
-#endif
+ plog(_("パレットを実現できません!", "Cannot activate palette!"));
+ return (FALSE);
+ }
- return (FALSE);
- }
+ /* Graphics available */
+ current_graphics_mode = arg_graphics;
+ return (current_graphics_mode);
+}
+#endif /* USE_GRAPHICS */
+
+
+#ifdef USE_MUSIC
+/*
+ * Initialize music
+ */
+static bool init_music(void)
+{
+ /* Initialize once */
+ if (!can_use_music)
+ {
+ /* Load the prefs */
+ load_music_prefs();
- /* Graphics available */
- can_use_graphics = arg_graphics;
+ /* Sound available */
+ can_use_music = TRUE;
}
+ return (can_use_music);
+}
- /* Result */
- return (can_use_graphics);
+/*
+ * Hack -- Stop a music
+ */
+static void stop_music(void)
+{
+ mciSendCommand(mop.wDeviceID, MCI_STOP, 0, 0);
+ mciSendCommand(mop.wDeviceID, MCI_CLOSE, 0, 0);
}
-#endif /* USE_GRAPHICS */
+#endif /* USE_MUSIC */
#ifdef USE_SOUND
/*
/* Sound available */
can_use_sound = TRUE;
}
-
- /* Result */
return (can_use_sound);
}
#endif /* USE_SOUND */
*
* Note that the "font name" must be capitalized!!!
*/
-static errr term_force_font(term_data *td, cptr path)
+static errr term_force_font(term_data *td, concptr path)
{
int wid, hgt;
-#ifndef JP
+#if 0 /* #ifndef JP */
int i;
char *base;
char buf[1024];
/* Forget the old font (if needed) */
if (td->font_id) DeleteObject(td->font_id);
-#ifdef JP
+#if 1 /* #ifdef JP */
/* Unused */
(void)path;
*/
static void term_change_font(term_data *td)
{
-#ifdef JP
+#if 1 /* #ifdef JP */
CHOOSEFONT cf;
memset(&cf, 0, sizeof(cf));
}
+void Term_inversed_area(HWND hWnd, int x, int y, int w, int h)
+{
+ HDC hdc;
+ HPEN oldPen;
+ HBRUSH myBrush, oldBrush;
+
+ term_data *td = (term_data *)GetWindowLong(hWnd, 0);
+ int tx = td->size_ow1 + x * td->tile_wid;
+ int ty = td->size_oh1 + y * td->tile_hgt;
+ int tw = w * td->tile_wid - 1;
+ int th = h * td->tile_hgt - 1;
+
+ hdc = GetDC(hWnd);
+ myBrush = CreateSolidBrush(RGB(255, 255, 255));
+ oldBrush = SelectObject(hdc, myBrush);
+ oldPen = SelectObject(hdc, GetStockObject(NULL_PEN) );
+
+ PatBlt(hdc, tx, ty, tw, th, PATINVERT);
+
+ SelectObject(hdc, oldBrush);
+ SelectObject(hdc, oldPen);
+}
#endif
-/*
- * Interact with the User
+/*!
+ * @brief //!< Windows版ユーザ設定項目実装部(実装必須) /Interact with the User
*/
static errr Term_user_win(int n)
{
{
int i;
-
/* Simple color */
if (colors16)
{
if (arg_sound && !init_sound())
{
/* Warning */
-#ifdef JP
- plog("¥µ¥¦¥ó¥É¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó¡ª");
-#else
- plog("Cannot initialize sound!");
-#endif
-
+ plog(_("サウンドを初期化できません!", "Cannot initialize sound!"));
/* Cannot enable */
arg_sound = FALSE;
#endif
+#ifdef USE_MUSIC
+
+ /* Handle "arg_sound" */
+ if (use_music != arg_music)
+ {
+ /* Initialize (if needed) */
+ if (arg_music && !init_music())
+ {
+ /* Warning */
+ plog(_("BGMを初期化できません!", "Cannot initialize BGM!"));
+ /* Cannot enable */
+ arg_music = FALSE;
+ }
+
+ /* Change setting */
+ use_music = arg_music;
+
+ if(!arg_music) stop_music();
+ else select_floor_music();
+
+ }
+
+#endif
+
#ifdef USE_GRAPHICS
if (arg_graphics && !init_graphics())
{
/* Warning */
-#ifdef JP
- plog("¥°¥é¥Õ¥£¥Ã¥¯¥¹¤ò½é´ü²½¤Ç¤¤Þ¤»¤ó!");
-#else
- plog("Cannot initialize graphics!");
-#endif
-
+ plog(_("グラフィックスを初期化できません!", "Cannot initialize graphics!"));
/* Cannot enable */
arg_graphics = GRAPHICS_NONE;
term_data *td = &data[i];
/* Update resized windows */
- if ((td->cols != (uint)td->t.wid) || (td->rows != (uint)td->t.hgt))
+ if ((td->cols != td->t.wid) || (td->rows != td->t.hgt))
{
/* Activate */
Term_activate(&td->t);
/* Redraw the contents */
Term_redraw();
-
- /* Restore */
Term_activate(old);
}
}
/*
* Hack -- clear the screen
*
- * Make this more efficient XXX XXX XXX
+ * Make this more efficient
*/
static errr Term_xtra_win_clear(void)
{
if (i == 0) return (1);
/* Build the path */
- path_build(buf, 1024, ANGBAND_DIR_XTRA_SOUND, sound_file[v][Rand_simple(i)]);
+ path_build(buf, 1024, ANGBAND_DIR_XTRA_SOUND, sound_file[v][Rand_external(i)]);
#ifdef WIN32
#else /* USE_SOUND */
- /* Oops */
return (1);
#endif /* USE_SOUND */
}
+/*
+ * Hack -- play a music
+ */
+static errr Term_xtra_win_music(int n, int v)
+{
+#ifdef USE_MUSIC
+ int i = 0;
+ char buf[1024];
+#endif /* USE_MUSIC */
+
+ /* Sound disabled */
+
+ if(!use_music) return (1);
+
+ /* Illegal sound */
+ if(n == TERM_XTRA_MUSIC_BASIC && ((v < 0) || (v >= MUSIC_BASIC_MAX))) return (1);
+ else if(v < 0 || v >= 1000) return(1); /*!< TODO */
+
+#ifdef USE_MUSIC
+
+ switch(n)
+ {
+ case TERM_XTRA_MUSIC_BASIC:
+ for (i = 0; i < SAMPLE_MAX; i++) if(!music_file[v][i]) break;
+ break;
+ case TERM_XTRA_MUSIC_DUNGEON:
+ for (i = 0; i < SAMPLE_MAX; i++) if(!dungeon_music_file[v][i]) break;
+ break;
+ case TERM_XTRA_MUSIC_QUEST:
+ for (i = 0; i < SAMPLE_MAX; i++) if(!quest_music_file[v][i]) break;
+ break;
+ case TERM_XTRA_MUSIC_TOWN:
+ for (i = 0; i < SAMPLE_MAX; i++) if(!town_music_file[v][i]) break;
+ break;
+ }
+
+ /* No sample */
+ if (i == 0)
+ {
+ //mciSendCommand(mop.wDeviceID, MCI_STOP, 0, 0);
+ //mciSendCommand(mop.wDeviceID, MCI_CLOSE, 0, 0);
+ return (1);
+ }
+
+ switch(n)
+ {
+ case TERM_XTRA_MUSIC_BASIC:
+ for (i = 0; i < SAMPLE_MAX; i++) if(!music_file[v][i]) break;
+ break;
+ case TERM_XTRA_MUSIC_DUNGEON:
+ for (i = 0; i < SAMPLE_MAX; i++) if(!dungeon_music_file[v][i]) break;
+ break;
+ case TERM_XTRA_MUSIC_QUEST:
+ for (i = 0; i < SAMPLE_MAX; i++) if(!quest_music_file[v][i]) break;
+ break;
+ case TERM_XTRA_MUSIC_TOWN:
+ for (i = 0; i < SAMPLE_MAX; i++) if(!town_music_file[v][i]) break;
+ break;
+ }
+
+ /* No sample */
+ if (i == 0)
+ {
+ mciSendCommand(mop.wDeviceID, MCI_STOP, 0, 0);
+ mciSendCommand(mop.wDeviceID, MCI_CLOSE, 0, 0);
+ return (1);
+ }
+
+ switch(n)
+ {
+ case TERM_XTRA_MUSIC_BASIC:
+ path_build(buf, 1024, ANGBAND_DIR_XTRA_MUSIC, music_file[v][Rand_external(i)]);
+ break;
+ case TERM_XTRA_MUSIC_DUNGEON:
+ path_build(buf, 1024, ANGBAND_DIR_XTRA_MUSIC, dungeon_music_file[v][Rand_external(i)]);
+ break;
+ case TERM_XTRA_MUSIC_QUEST:
+ path_build(buf, 1024, ANGBAND_DIR_XTRA_MUSIC, quest_music_file[v][Rand_external(i)]);
+ break;
+ case TERM_XTRA_MUSIC_TOWN:
+ path_build(buf, 1024, ANGBAND_DIR_XTRA_MUSIC, town_music_file[v][Rand_external(i)]);
+ break;
+ }
+
+ if(current_music_type == n && current_music_id == v)
+ {
+ return (0);
+ }
+ current_music_type = n;
+ current_music_id = v;
+
+#ifdef WIN32
+
+ mop.lpstrDeviceType = mci_device_type;
+ mop.lpstrElementName = buf;
+ mciSendCommand(mop.wDeviceID, MCI_STOP, 0, 0);
+ mciSendCommand(mop.wDeviceID, MCI_CLOSE, 0, 0);
+ mciSendCommand(mop.wDeviceID, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD)&mop);
+ mciSendCommand(mop.wDeviceID, MCI_SEEK, MCI_SEEK_TO_START, 0);
+ mciSendCommand(mop.wDeviceID, MCI_PLAY, MCI_NOTIFY, (DWORD)&mop);
+ return (0);
+
+#endif /* WIN32 */
+
+#else /* USE_MUSIC */
+
+ return (1);
+
+#endif /* USE_MUSIC */
+
+}
+
/*
* Delay for "x" milliseconds
return (Term_xtra_win_noise());
}
+ /* Play a music */
+ case TERM_XTRA_MUSIC_BASIC:
+ case TERM_XTRA_MUSIC_DUNGEON:
+ case TERM_XTRA_MUSIC_QUEST:
+ case TERM_XTRA_MUSIC_TOWN:
+ {
+ return (Term_xtra_win_music(n, v));
+ }
+
/* Make a special sound */
case TERM_XTRA_SOUND:
{
}
}
- /* Oops */
return 1;
}
*
* One would think there is a more efficient method for telling a window
* what color it should be using to draw with, but perhaps simply changing
- * it every time is not too inefficient. XXX XXX XXX
+ * it every time is not too inefficient.
*/
-static errr Term_text_win(int x, int y, int n, byte a, const char *s)
+static errr Term_text_win(int x, int y, int n, TERM_COLOR a, concptr s)
{
term_data *td = (term_data*)(Term->data);
RECT rc;
HDC hdc;
-
-#ifdef JP
+#if 1 /* #ifdef JP */
static HBITMAP WALL;
static HBRUSH myBrush, oldBrush;
static HPEN oldPen;
for (i = 0; i < n; i++)
{
#ifdef JP
- if (use_bigtile && *(s+i)=="¢£"[0] && *(s+i+1)=="¢£"[1])
+ if (use_bigtile && *(s+i)=="■"[0] && *(s+i+1)=="■"[1])
{
rc.right += td->font_wid;
rc.left += 2 * td->tile_wid;
rc.right += 2 * td->tile_wid;
}
- else if ( iskanji(*(s+i)) ) /* £²¥Ð¥¤¥Èʸ»ú */
+ else if ( iskanji(*(s+i)) ) /* 2バイト文字 */
{
rc.right += td->font_wid;
/* Dump the text */
rc.right -= td->font_wid;
/* Advance */
- i++;
- rc.left += 2 * td->tile_wid;
- rc.right += 2 * td->tile_wid;
- } else if (*(s+i)==127){
+ i++;
+ rc.left += 2 * td->tile_wid;
+ rc.right += 2 * td->tile_wid;
+ } else if (*(s+i)==127){
+ oldBrush = SelectObject(hdc, myBrush);
+ oldPen = SelectObject(hdc, GetStockObject(NULL_PEN) );
+
+ /* Dump the wall */
+ Rectangle(hdc, rc.left, rc.top, rc.right+1, rc.bottom+1);
+
+ SelectObject(hdc, oldBrush);
+ SelectObject(hdc, oldPen);
+
+ /* Advance */
+ rc.left += td->tile_wid;
+ rc.right += td->tile_wid;
+ } else {
+ /* Dump the text */
+ ExtTextOut(hdc, rc.left, rc.top, ETO_CLIPPED, &rc, s+i, 1, NULL);
+
+ /* Advance */
+ rc.left += td->tile_wid;
+ rc.right += td->tile_wid;
+ }
+#else
+#if 1
+ if (*(s+i)==127){
oldBrush = SelectObject(hdc, myBrush);
oldPen = SelectObject(hdc, GetStockObject(NULL_PEN) );
rc.left += td->tile_wid;
rc.right += td->tile_wid;
#endif
+#endif
}
}
*
* If "graphics" is not available, we simply "wipe" the given grids.
*/
-static errr Term_pict_win(int x, int y, int n, const byte *ap, const char *cp, const byte *tap, const char *tcp)
+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)
{
term_data *td = (term_data*)(Term->data);
#ifdef USE_GRAPHICS
int i;
- int x1, y1, w1, h1;
- int x2, y2, w2, h2, tw2;
- int x3, y3;
+ TERM_LEN x1, y1, w1, h1, tw1, th1;
+ TERM_LEN x2, y2, w2, h2, tw2 = 0;
+ TERM_LEN x3, y3;
- HDC hdcMask;
+ HDC hdcMask = NULL;
HDC hdc;
HDC hdcSrc;
HBITMAP hbmSrcOld;
-
- /* Paranoia */
if (!use_graphics)
{
/* Erase the grids */
/* Size of bitmap cell */
w1 = infGraph.CellWidth;
h1 = infGraph.CellHeight;
+ tw1 = infGraph.TileWidth;
+ th1 = infGraph.TileHeight;
/* Size of window cell */
if (td->map_active)
}
/* Location of window cell */
- x2 = x * w2 + td->size_ow1;
- y2 = y * h2 + td->size_oh1;
+ x2 = x * w2 + td->size_ow1 + infGraph.OffsetX;
+ y2 = y * h2 + td->size_oh1 + infGraph.OffsetY;
/* Info */
hdc = GetDC(td->w);
hdcSrc = CreateCompatibleDC(hdc);
hbmSrcOld = SelectObject(hdcSrc, infGraph.hBitmap);
- if (arg_graphics == GRAPHICS_ADAM_BOLT)
+ if (arg_graphics == GRAPHICS_ADAM_BOLT || arg_graphics == GRAPHICS_HENGBAND)
{
hdcMask = CreateCompatibleDC(hdc);
SelectObject(hdcMask, infMask.hBitmap);
/* Draw attr/char pairs */
for (i = 0; i < n; i++, x2 += w2)
{
- byte a = ap[i];
+ TERM_COLOR a = ap[i];
char c = cp[i];
+
/* Extract picture */
int row = (a & 0x7F);
int col = (c & 0x7F);
x1 = col * w1;
y1 = row * h1;
- if (arg_graphics == GRAPHICS_ADAM_BOLT)
+ if (arg_graphics == GRAPHICS_ADAM_BOLT || arg_graphics == GRAPHICS_HENGBAND)
{
x3 = (tcp[i] & 0x7F) * w1;
y3 = (tap[i] & 0x7F) * h1;
+ tw2 = tw2 * w1 / tw1;
+ h2 = h2 * h1 / th1;
/* Perfect size */
- if ((w1 == tw2) && (h1 == h2))
+ if ((tw1 == tw2) && (th1 == h2))
{
/* Copy the terrain picture from the bitmap to the window */
BitBlt(hdc, x2, y2, tw2, h2, hdcSrc, x3, y3, SRCCOPY);
SetStretchBltMode(hdc, COLORONCOLOR);
/* Copy the terrain picture from the bitmap to the window */
- StretchBlt(hdc, x2, y2, tw2, h2, hdcSrc, x3, y3, w1, h1, SRCCOPY);
+ StretchBlt(hdc, x2, y2, tw2, h2, hdcMask, x3, y3, w1, h1, SRCAND);
+
+ StretchBlt(hdc, x2, y2, tw2, h2, hdcSrc, x3, y3, w1, h1, SRCPAINT);
/* Only draw if terrain and overlay are different */
if ((x1 != x3) || (y1 != y3))
SelectObject(hdcSrc, hbmSrcOld);
DeleteDC(hdcSrc);
- if (arg_graphics == GRAPHICS_ADAM_BOLT)
+ if (arg_graphics == GRAPHICS_ADAM_BOLT || arg_graphics == GRAPHICS_HENGBAND)
{
/* Release */
SelectObject(hdcMask, hbmSrcOld);
static void windows_map(void)
{
term_data *td = &data[0];
- byte a, c;
- int x, min_x, max_x;
- int y, min_y, max_y;
+ TERM_COLOR a;
+ char c;
+ TERM_LEN x, min_x, max_x;
+ TERM_LEN y, min_y, max_y;
- byte ta, tc;
+ TERM_COLOR ta;
+ char tc;
/* Only in graphics mode */
if (!use_graphics) return;
-
- /* Clear screen */
Term_xtra_win_clear();
td->map_tile_wid = (td->tile_wid * td->cols) / MAX_WID;
{
min_x = 0;
min_y = 0;
- max_x = cur_wid;
- max_y = cur_hgt;
+ max_x = current_floor_ptr->width;
+ max_y = current_floor_ptr->height;
}
/* Draw the map */
}
/* Hilite the player */
- Term_curs_win(px - min_x, py - min_y);
+ Term_curs_win(p_ptr->x - min_x, p_ptr->y - min_y);
/* Wait for a keypress, flush key buffer */
Term_inkey(&c, TRUE, TRUE);
* to over-ride selected values, then create the windows, and fonts.
*
* Must use SW_SHOW not SW_SHOWNA, since on 256 color display
- * must make active to realize the palette. XXX XXX XXX
+ * must make active to realize the palette.
*/
static void init_windows(void)
{
term_data *td;
-#ifndef JP
+#if 0 /* #ifndef JP */
char buf[1024];
#endif
td = &data[0];
WIPE(td, term_data);
#ifdef JP
- td->s = "ÊѶòÈÚÅÜ";
+ td->s = "変愚蛮怒";
#else
td->s = angband_term_name[0];
#endif
td->pos_x = 7 * 30;
td->pos_y = 7 * 20;
td->posfix = FALSE;
-
-#ifdef JP
+#if 1 /* #ifdef JP */
td->bizarre = TRUE;
#endif
/* Sub windows */
td->pos_x = (7 - i) * 30;
td->pos_y = (7 - i) * 20;
td->posfix = FALSE;
-#ifdef JP
+#if 1 /* #ifdef JP */
td->bizarre = TRUE;
#endif
}
{
td = &data[i];
-#ifdef JP
+#if 1 /* #ifdef JP */
strncpy(td->lf.lfFaceName, td->font_want, LF_FACESIZE);
- td->lf.lfCharSet = SHIFTJIS_CHARSET;
+ td->lf.lfCharSet = DEFAULT_CHARSET;
td->lf.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
/* Activate the chosen font */
term_force_font(td, NULL);
- td->tile_wid = td->font_wid;
- td->tile_hgt = td->font_hgt;
+ if(!td->tile_wid) td->tile_wid = td->font_wid;
+ if(!td->tile_hgt) td->tile_hgt = td->font_hgt;
#else
/* Access the standard font file */
path_build(buf, sizeof(buf), ANGBAND_DIR_XTRA_FONT, td->font_want);
/* Force the use of that font */
(void)term_force_font(td, buf);
- /* Oops */
td->tile_wid = 8;
td->tile_hgt = 13;
td->size_wid, td->size_hgt,
HWND_DESKTOP, NULL, hInstance, NULL);
my_td = NULL;
-#ifdef JP
- if (!td->w) quit("¥µ¥Ö¥¦¥£¥ó¥É¥¦¤ËºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿");
-#else
- if (!td->w) quit("Failed to create sub-window");
-#endif
-
+ if (!td->w) quit(_("サブウィンドウに作成に失敗しました", "Failed to create sub-window"));
if (td->visible)
{
td->size_wid, td->size_hgt,
HWND_DESKTOP, NULL, hInstance, NULL);
my_td = NULL;
-#ifdef JP
- if (!td->w) quit("¥á¥¤¥ó¥¦¥£¥ó¥É¥¦¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿");
-#else
- if (!td->w) quit("Failed to create Angband window");
-#endif
-
+ if (!td->w) quit(_("メインウィンドウの作成に失敗しました", "Failed to create Angband window"));
term_data_link(td);
angband_term[0] = &td->t;
+ normsize.x = td->cols;
+ normsize.y = td->rows;
/* Activate the main window */
- SetActiveWindow(td->w);
+ if (win_maximized) ShowWindow(td->w, SW_SHOWMAXIMIZED);
+ else ShowWindow(td->w, SW_SHOW);
/* Bring main window back to top */
SetWindowPos(td->w, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- /* New palette XXX XXX XXX */
+ /* New palette */
(void)new_palette();
(arg_graphics == GRAPHICS_ORIGINAL ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(hm, IDM_OPTIONS_NEW_GRAPHICS,
(arg_graphics == GRAPHICS_ADAM_BOLT ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(hm, IDM_OPTIONS_NEW2_GRAPHICS,
+ (arg_graphics == GRAPHICS_HENGBAND ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(hm, IDM_OPTIONS_BIGTILE,
(arg_bigtile ? MF_CHECKED : MF_UNCHECKED));
+ CheckMenuItem(hm, IDM_OPTIONS_MUSIC,
+ (arg_music ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(hm, IDM_OPTIONS_SOUND,
(arg_sound ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(hm, IDM_OPTIONS_BG,
{
if (!initialized)
{
-#ifdef JP
- plog("¤Þ¤À½é´ü²½Ãæ¤Ç¤¹...");
-#else
- plog("You cannot do that yet...");
-#endif
-
+ plog(_("まだ初期化中です...", "You cannot do that yet..."));
}
else if (game_in_progress)
{
-#ifdef JP
- plog("¥×¥ì¥¤Ãæ¤Ï¿·¤·¤¤¥²¡¼¥à¤ò»Ï¤á¤ë¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¡ª");
-#else
- plog("You can't start a new game while you're still playing!");
-#endif
-
+ plog(_("プレイ中は新しいゲームを始めることができません!", "You can't start a new game while you're still playing!"));
}
else
{
{
if (!initialized)
{
-#ifdef JP
- plog("¤Þ¤À½é´ü²½Ãæ¤Ç¤¹...");
-#else
- plog("You cannot do that yet...");
-#endif
-
+ plog(_("まだ初期化中です...", "You cannot do that yet..."));
}
else if (game_in_progress)
{
-#ifdef JP
- plog("¥×¥ì¥¤Ãæ¤Ï¥²¡¼¥à¤ò¥í¡¼¥É¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¡ª");
-#else
- plog("You can't open a new game while you're still playing!");
-#endif
-
+ plog(_("プレイ中はゲームをロードすることができません!", "You can't open a new game while you're still playing!"));
}
else
{
{
if (game_in_progress && character_generated)
{
- /* Paranoia */
if (!can_save)
{
-#ifdef JP
- plog("º£¤Ï¥»¡¼¥Ö¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£");
-#else
- plog("You may not do that right now.");
-#endif
-
+ plog(_("今はセーブすることは出来ません。", "You may not do that right now."));
break;
}
}
else
{
-#ifdef JP
- plog("º£¡¢¥»¡¼¥Ö¤¹¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¡£");
-#else
- plog("You may not do that right now.");
-#endif
-
+ plog(_("今、セーブすることは出来ません。", "You may not do that right now."));
}
break;
}
{
if (game_in_progress && character_generated)
{
- /* Paranoia */
if (!can_save)
{
-#ifdef JP
- plog("º£¤Ï½ªÎ»¤Ç¤¤Þ¤»¤ó¡£");
-#else
- plog("You may not do that right now.");
-#endif
-
+ plog(_("今は終了できません。", "You may not do that right now."));
break;
}
}
else
{
- /* Save Screen */
screen_save();
-
- /* Clear screen */
Term_clear();
/* Display the scores */
/* Forget the high score fd */
highscore_fd = -1;
-
- /* Load screen */
screen_load();
/* Hack - Flush it */
break;
}
-
- case IDM_WINDOW_VIS_0:
+ /* Open game */
+ case IDM_FILE_MOVIE:
{
-#ifdef JP
- plog("¥á¥¤¥ó¥¦¥£¥ó¥É¥¦¤ÏÈóɽ¼¨¤Ë¤Ç¤¤Þ¤»¤ó¡ª");
-#else
- plog("You are not allowed to do that!");
-#endif
+ if (!initialized)
+ {
+ plog(_("まだ初期化中です...", "You cannot do that yet..."));
+ }
+ else if (game_in_progress)
+ {
+ plog(_("プレイ中はムービーをロードすることができません!", "You can't open a movie while you're playing!"));
+ }
+ else
+ {
+ memset(&ofn, 0, sizeof(ofn));
+ ofn.lStructSize = sizeof(ofn);
+ ofn.hwndOwner = data[0].w;
+ ofn.lpstrFilter = "Angband Movie Files (*.amv)\0*.amv\0";
+ ofn.nFilterIndex = 1;
+ ofn.lpstrFile = savefile;
+ ofn.nMaxFile = 1024;
+ ofn.lpstrInitialDir = ANGBAND_DIR_USER;
+ ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
+
+ if (GetOpenFileName(&ofn))
+ {
+ /* Load 'savefile' */
+ prepare_browse_movie_aux(savefile);
+ play_game(FALSE);
+ quit(NULL);
+ return;
+ }
+ }
+ break;
+ }
+ case IDM_WINDOW_VIS_0:
+ {
+ plog(_("メインウィンドウは非表示にできません!", "You are not allowed to do that!"));
break;
}
case IDM_OPTIONS_NO_GRAPHICS:
{
- /* Paranoia */
if (!inkey_flag)
{
plog("You may not do that right now.");
case IDM_OPTIONS_OLD_GRAPHICS:
{
- /* Paranoia */
if (!inkey_flag)
{
plog("You may not do that right now.");
case IDM_OPTIONS_NEW_GRAPHICS:
{
- /* Paranoia */
if (!inkey_flag)
{
plog("You may not do that right now.");
break;
}
- case IDM_OPTIONS_BIGTILE:
+ case IDM_OPTIONS_NEW2_GRAPHICS:
{
- term_data *td = &data[0];
+ if (!inkey_flag)
+ {
+ plog("You may not do that right now.");
+ break;
+ }
+
+ /* Toggle "arg_graphics" */
+ if (arg_graphics != GRAPHICS_HENGBAND)
+ {
+ arg_graphics = GRAPHICS_HENGBAND;
+
+ /* React to changes */
+ Term_xtra_win_react();
+
+ /* Hack -- Force redraw */
+ Term_key_push(KTRL('R'));
+ }
+
+ break;
+ }
- /* Paranoia */
+ case IDM_OPTIONS_BIGTILE:
+ {
+ td = &data[0];
if (!inkey_flag)
{
plog("You may not do that right now.");
break;
}
+ case IDM_OPTIONS_MUSIC:
+ {
+ if (!inkey_flag)
+ {
+ plog("You may not do that right now.");
+ break;
+ }
+
+ /* Toggle "arg_sound" */
+ arg_music = !arg_music;
+
+ /* React to changes */
+ Term_xtra_win_react();
+
+ /* Hack -- Force redraw */
+ Term_key_push(KTRL('R'));
+
+ break;
+ }
+
case IDM_OPTIONS_SOUND:
{
- /* Paranoia */
if (!inkey_flag)
{
plog("You may not do that right now.");
/* bg */
case IDM_OPTIONS_BG:
{
- /* Paranoia */
if (!inkey_flag)
{
plog("You may not do that right now.");
/* bg */
case IDM_OPTIONS_OPEN_BG:
{
- /* Paranoia */
if (!inkey_flag)
{
plog("You may not do that right now.");
ofn.lpstrFile = bg_bitmap_file;
ofn.nMaxFile = 1023;
ofn.lpstrInitialDir = NULL;
-#ifdef JP
- ofn.lpstrTitle = "ÊÉ»æ¤òÁª¤ó¤Ç¤Í¡£";
-#else
- ofn.lpstrTitle = "Choose wall paper.";
-#endif
+ ofn.lpstrTitle = _("壁紙を選んでね。", "Choose wall paper.");
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
if (GetOpenFileName(&ofn))
ofn.nMaxFile = 1023;
ofn.lpstrDefExt = "html";
ofn.lpstrInitialDir = NULL;
-#ifdef JP
- ofn.lpstrTitle = "HTML¤Ç¥¹¥¯¥ê¡¼¥ó¥À¥ó¥×¤òÊݸ";
-#else
- ofn.lpstrTitle = "Save screen dump as HTML.";
-#endif
+ ofn.lpstrTitle = _("HTMLでスクリーンダンプを保存", "Save screen dump as HTML.");
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
if (GetSaveFileName(&ofn))
if (hwndSaver)
{
- /* Push the window to the bottom XXX XXX XXX */
+ /* Push the window to the bottom */
SetWindowPos(hwndSaver, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
else
{
-#ifdef JP
- plog("¥¦¥£¥ó¥É¥¦¤òºîÀ®½ÐÍè¤Þ¤»¤ó");
-#else
- plog("Failed to create saver window");
-#endif
-
+ plog(_("ウィンドウを作成出来ません", "Failed to create saver window"));
}
}
break;
}
else
{
-#ifdef JP
- plog_fmt("¥Ø¥ë¥×¥Õ¥¡¥¤¥ë[%s]¤¬¸«ÉÕ¤«¤ê¤Þ¤»¤ó¡£", tmp);
- plog("Âå¤ï¤ê¤Ë¥ª¥ó¥é¥¤¥ó¥Ø¥ë¥×¤ò»ÈÍѤ·¤Æ¤¯¤À¤µ¤¤¡£");
-#else
- plog_fmt("Cannot find help file: %s", tmp);
- plog("Use the online help files instead.");
-#endif
-
+ plog_fmt(_("ヘルプファイル[%s]が見付かりません。", "Cannot find help file: %s"), tmp);
+ plog(_("代わりにオンラインヘルプを使用してください。", "Use the online help files instead."));
}
break;
#else /* HTML_HELP */
}
else
{
-#ifdef JP
- plog_fmt("¥Ø¥ë¥×¥Õ¥¡¥¤¥ë[%s]¤¬¸«ÉÕ¤«¤ê¤Þ¤»¤ó¡£", tmp);
- plog("Âå¤ï¤ê¤Ë¥ª¥ó¥é¥¤¥ó¥Ø¥ë¥×¤ò»ÈÍѤ·¤Æ¤¯¤À¤µ¤¤¡£");
-#else
- plog_fmt("Cannot find help file: %s", tmp);
- plog("Use the online help files instead.");
-#endif
+ plog_fmt(_("ヘルプファイル[%s]が見付かりません。", "Cannot find help file: %s"), tmp);
+ plog(_("代わりにオンラインヘルプを使用してください。", "Use the online help files instead."));
}
break;
LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam)
#else /* __MWERKS__ */
-LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,
- WPARAM wParam, LPARAM lParam)
+LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#endif /* __MWERKS__ */
{
PAINTSTRUCT ps;
/* Handle message */
switch (uMsg)
{
- /* XXX XXX XXX */
case WM_NCCREATE:
{
SetWindowLong(hWnd, 0, (LONG)(my_td));
break;
}
- /* XXX XXX XXX */
case WM_CREATE:
{
+#ifdef USE_MUSIC
+ mop.dwCallback=(DWORD)hWnd;
+#endif
return 0;
}
return 0;
}
+#ifdef USE_MUSIC
+ case MM_MCINOTIFY:
+ {
+ if(wParam == MCI_NOTIFY_SUCCESSFUL)
+ {
+ mciSendCommand(mop.wDeviceID, MCI_SEEK, MCI_SEEK_TO_START, 0);
+ mciSendCommand(mop.wDeviceID, MCI_PLAY, MCI_NOTIFY, (DWORD)&mop);
+ }
+ return 0;
+ }
+#endif
+
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
{
return 0;
}
+ case WM_LBUTTONDOWN:
+ {
+ mousex = MIN(LOWORD(lParam) / td->tile_wid, td->cols - 1);
+ mousey = MIN(HIWORD(lParam) / td->tile_hgt, td->rows - 1);
+ mouse_down = TRUE;
+ oldx = mousex;
+ oldy = mousey;
+ return 0;
+ }
+
+ case WM_LBUTTONUP:
+ {
+ HGLOBAL hGlobal;
+ LPSTR lpStr;
+ int j, sz;
+ TERM_LEN dx = abs(oldx - mousex) + 1;
+ TERM_LEN dy = abs(oldy - mousey) + 1;
+ TERM_LEN ox = (oldx > mousex) ? mousex : oldx;
+ TERM_LEN oy = (oldy > mousey) ? mousey : oldy;
+
+ mouse_down = FALSE;
+ paint_rect = FALSE;
+
+#ifdef JP
+ sz = (dx + 3) * dy;
+#else
+ sz = (dx + 2) * dy;
+#endif
+ hGlobal = GlobalAlloc(GHND, sz + 1);
+ if (hGlobal == NULL) return 0;
+ lpStr = (LPSTR)GlobalLock(hGlobal);
+
+ for (i = 0; i < dy; i++)
+ {
+#ifdef JP
+ char *s;
+ char **scr = data[0].t.scr->c;
+
+ C_MAKE(s, (dx + 1), char);
+ strncpy(s, &scr[oy + i][ox], dx);
+
+ if (ox > 0)
+ {
+ if (iskanji(scr[oy + i][ox - 1])) s[0] = ' ';
+ }
+
+ if (ox + dx < data[0].cols)
+ {
+ if (iskanji(scr[oy + i][ox + dx - 1])) s[dx - 1] = ' ';
+ }
+
+ for (j = 0; j < dx; j++)
+ {
+ if (s[j] == 127) s[j] = '#';
+ *lpStr++ = s[j];
+ }
+#else
+ for (j = 0; j < dx; j++)
+ {
+ *lpStr++ = data[0].t.scr->c[oy + i][ox + j];
+ }
+#endif
+ if (dy > 1)
+ {
+ *lpStr++ = '\r';
+ *lpStr++ = '\n';
+ }
+ }
+
+ GlobalUnlock(hGlobal);
+ if (OpenClipboard(hWnd) == 0)
+ {
+ GlobalFree(hGlobal);
+ return 0;
+ }
+ EmptyClipboard();
+ SetClipboardData(CF_TEXT, hGlobal);
+ CloseClipboard();
+
+ Term_redraw();
+
+ return 0;
+ }
+
+ case WM_MOUSEMOVE:
+ {
+ if (mouse_down)
+ {
+ int dx, dy;
+ int cx = MIN(LOWORD(lParam) / td->tile_wid, td->cols - 1);
+ int cy = MIN(HIWORD(lParam) / td->tile_hgt, td->rows - 1);
+ int ox, oy;
+
+ if (paint_rect)
+ {
+ dx = abs(oldx - mousex) + 1;
+ dy = abs(oldy - mousey) + 1;
+ ox = (oldx > mousex) ? mousex : oldx;
+ oy = (oldy > mousey) ? mousey : oldy;
+ Term_inversed_area(hWnd, ox, oy, dx, dy);
+ }
+ else
+ {
+ paint_rect = TRUE;
+ }
+
+ dx = abs(cx - mousex) + 1;
+ dy = abs(cy - mousey) + 1;
+ ox = (cx > mousex) ? mousex : cx;
+ oy = (cy > mousey) ? mousey : cy;
+ Term_inversed_area(hWnd, ox, oy, dx, dy);
+
+ oldx = cx;
+ oldy = cy;
+ }
+ return 0;
+ }
+
case WM_INITMENU:
{
setup_menus();
{
if (!can_save)
{
-#ifdef JP
- plog("º£¤Ï½ªÎ»¤Ç¤¤Þ¤»¤ó¡£");
-#else
- plog("You may not do that right now.");
-#endif
+ plog(_("今は終了できません。", "You may not do that right now."));
return 0;
}
/* Mega-Hack -- Delay death */
if (p_ptr->chp < 0) p_ptr->is_dead = FALSE;
+ do_cmd_write_nikki(NIKKI_GAMESTART, 0, _("----ゲーム中断----", "---- Save and Exit Game ----"));
/* Hardcode panic save */
p_ptr->panic_save = 1;
signals_ignore_tstp();
/* Indicate panic save */
-#ifdef JP
- (void)strcpy(p_ptr->died_from, "(¶ÛµÞ¥»¡¼¥Ö)");
-#else
- (void)strcpy(p_ptr->died_from, "(panic save)");
-#endif
+ (void)strcpy(p_ptr->died_from, _("(緊急セーブ)", "(panic save)"));
/* Panic save */
(void)save_player();
case SIZE_MAXIMIZED:
{
- /* fall through XXX XXX XXX */
+ /* fall through */
}
case SIZE_RESTORED:
{
- uint cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;
- uint rows = (HIWORD(lParam) - td->size_oh1) / td->tile_hgt;
+ TERM_LEN cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;
+ TERM_LEN rows = (HIWORD(lParam) - td->size_oh1) / td->tile_hgt;
/* New size */
if ((td->cols != cols) || (td->rows != rows))
td->cols = cols;
td->rows = rows;
+ if (!IsZoomed(td->w) && !IsIconic(td->w))
+ {
+ normsize.x = td->cols;
+ normsize.y = td->rows;
+ }
+
/* Activate */
Term_activate(&td->t);
case WM_ACTIVATEAPP:
{
+ if (IsIconic(td->w)) break;
+
for (i = 1; i < MAX_TERM_DATA; i++)
{
if(data[i].visible)
/* Process message */
switch (uMsg)
{
- /* XXX XXX XXX */
case WM_NCCREATE:
{
SetWindowLong(hWnd, 0, (LONG)(my_td));
break;
}
- /* XXX XXX XXX */
case WM_CREATE:
{
return 0;
case WM_SIZE:
{
- uint cols;
- uint rows;
+ TERM_LEN cols;
+ TERM_LEN rows;
/* this message was sent before WM_NCCREATE */
if (!td) return 1;
/* HACK - Redraw all windows */
p_ptr->window = 0xFFFFFFFF;
- window_stuff();
+ handle_stuff();
}
td->size_hack = FALSE;
/* Process */
switch (uMsg)
{
- /* XXX XXX XXX */
case WM_NCCREATE:
{
break;
}
}
- /* Oops */
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
/*
* Display warning message (see "z-util.c")
*/
-static void hack_plog(cptr str)
+static void hack_plog(concptr str)
{
/* Give a warning */
if (str)
{
#ifdef JP
- MessageBox(NULL, str, "·Ù¹ð¡ª",
+ MessageBox(NULL, str, "警告!",
MB_ICONEXCLAMATION | MB_OK);
#else
MessageBox(NULL, str, "Warning",
/*
* Display error message and quit (see "z-util.c")
*/
-static void hack_quit(cptr str)
+static void hack_quit(concptr str)
{
/* Give a warning */
if (str)
{
#ifdef JP
- MessageBox(NULL, str, "¥¨¥é¡¼¡ª",
+ MessageBox(NULL, str, "エラー!",
MB_ICONEXCLAMATION | MB_OK | MB_ICONSTOP);
#else
MessageBox(NULL, str, "Error",
/*
* Display warning message (see "z-util.c")
*/
-static void hook_plog(cptr str)
+static void hook_plog(concptr str)
{
/* Warning */
if (str)
{
#ifdef JP
- MessageBox(data[0].w, str, "·Ù¹ð¡ª",
+ MessageBox(data[0].w, str, "警告!",
MB_ICONEXCLAMATION | MB_OK);
#else
MessageBox(data[0].w, str, "Warning",
/*
* Display error message and quit (see "z-util.c")
*/
-static void hook_quit(cptr str)
+static void hook_quit(concptr str)
{
int i;
if (str)
{
#ifdef JP
- MessageBox(data[0].w, str, "¥¨¥é¡¼¡ª",
+ MessageBox(data[0].w, str, "エラー!",
MB_ICONEXCLAMATION | MB_OK | MB_ICONSTOP);
#else
MessageBox(data[0].w, str, "Error",
save_prefs();
- /*** Could use 'Term_nuke_win()' XXX XXX XXX */
+ /*** Could use 'Term_nuke_win()' */
/* Destroy all windows */
for (i = MAX_TERM_DATA - 1; i >= 0; --i)
/* Get program name with full path */
GetModuleFileName(hInstance, path, 512);
- /* Save the "program name" XXX XXX XXX */
+ /* Save the "program name" */
argv0 = path;
/* Get the name of the "*.ini" file */
validate_dir(ANGBAND_DIR_XTRA, TRUE);
/* Build the filename */
-#ifdef JP
- path_build(path, sizeof(path), ANGBAND_DIR_FILE, "news_j.txt");
-#else
- path_build(path, sizeof(path), ANGBAND_DIR_FILE, "news.txt");
-#endif
-
+ path_build(path, sizeof(path), ANGBAND_DIR_FILE, _("news_j.txt", "news.txt"));
/* Hack -- Validate the "news.txt" file */
validate_file(path);
-#ifndef JP
+#if 0 /* #ifndef JP */
/* Build the "font" path */
path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "font");
/* validate_dir(ANGBAND_DIR_XTRA_HELP); */
}
+/*!
+ * @brief (Windows固有)変愚蛮怒が起動済かどうかのチェック
+ */
+static bool is_already_running(void)
+{
+ bool result = FALSE;
+ HANDLE hMutex;
+
+ hMutex = CreateMutex(NULL, TRUE, VERSION_NAME);
+ if (GetLastError() == ERROR_ALREADY_EXISTS)
+ {
+ result = TRUE;
+ }
+ return result;
+}
+
+/*!
+ * @brief (Windows固有)Windowsアプリケーションとしてのエントリポイント
+ */
int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
LPSTR lpCmdLine, int nCmdShow)
{
HDC hdc;
MSG msg;
+ setlocale(LC_ALL, "ja_JP.utf8");
+
/* Unused */
(void)nCmdShow;
/* Save globally */
hInstance = hInst;
+
+
+ /* Prevent multiple run */
+ if (is_already_running())
+ {
+ MessageBox(NULL,
+ _("変愚蛮怒はすでに起動しています。", "Hengband is already running."),
+ _("エラー!", "Error") ,
+ MB_ICONEXCLAMATION | MB_OK | MB_ICONSTOP);
+ return FALSE;
+ }
- /* Initialize */
if (hPrevInst == NULL)
{
wc.style = CS_CLASSDC;
/* Catch nasty signals */
signals_init();
- /* Initialize */
+ Term_activate(term_screen);
init_angband();
/* We are now initialized */
initialized = TRUE;
-
#ifdef CHUUKEI
if(lpCmdLine[0] == '-'){
switch(lpCmdLine[1])
quit(NULL);
return 0;
}
+ case 'X':
+ case 'x':
+ {
+ if (!lpCmdLine[2]) break;
+ prepare_browse_movie(&lpCmdLine[2]);
+ play_game(FALSE);
+ quit(NULL);
+ return 0;
+ }
}
}
#endif
#endif
/* Prompt the user */
-#ifdef JP
- prt("[¥Õ¥¡¥¤¥ë] ¥á¥Ë¥å¡¼¤Î [¿·µ¬] ¤Þ¤¿¤Ï [³«¤¯] ¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£", 23, 8);
-#else
- prt("[Choose 'New' or 'Open' from the 'File' menu]", 23, 17);
-#endif
+ prt(_("[ファイル] メニューの [新規] または [開く] を選択してください。", "[Choose 'New' or 'Open' from the 'File' menu]"), 23, _(8, 17));
Term_fresh();
TranslateMessage(&msg);
DispatchMessage(&msg);
}
-
- /* Paranoia */
quit(NULL);
-
- /* Paranoia */
return (0);
}