X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 271 (tree) |
|---|---|
| Time | 2021-03-23 01:03:42 |
| Author | |
iniファイルを読み込むクラスを実装、iniファイルにより解像度を指定・変更できるように。
| @@ -47,6 +47,9 @@ | ||
| 47 | 47 | FrameskipFlag = false; |
| 48 | 48 | AnotherGunsightFlag = false; |
| 49 | 49 | strcpy(PlayerName, ""); |
| 50 | + | |
| 51 | + ScreenWidth = 0; | |
| 52 | + ScreenHeight = 0; | |
| 50 | 53 | } |
| 51 | 54 | |
| 52 | 55 | //! @brief ディストラクタ |
| @@ -55,8 +58,9 @@ | ||
| 55 | 58 | |
| 56 | 59 | //! @brief 設定ファイルを読み込む |
| 57 | 60 | //! @param fname ファイル名 |
| 61 | +//! @param fname ファイル名2(.ini) | |
| 58 | 62 | //! @return 成功:0 失敗:1 |
| 59 | -int Config::LoadFile(char *fname) | |
| 63 | +int Config::LoadFile(char *fname, char *fname2) | |
| 60 | 64 | { |
| 61 | 65 | FILE *fp; |
| 62 | 66 | char buf; |
| @@ -131,6 +135,47 @@ | ||
| 131 | 135 | //ログに出力 |
| 132 | 136 | OutputLog.WriteLog(LOG_COMPLETE, "", ""); |
| 133 | 137 | #endif |
| 138 | + | |
| 139 | + | |
| 140 | +#ifdef ENABLE_ADDCONFIG | |
| 141 | + INIFileInterface INIConfig; | |
| 142 | + int mode; | |
| 143 | + | |
| 144 | +#ifdef ENABLE_DEBUGLOG | |
| 145 | + //ログに出力 | |
| 146 | + OutputLog.WriteLog(LOG_LOAD, "設定ファイル(.ini)", fname2); | |
| 147 | +#endif | |
| 148 | + | |
| 149 | + INIConfig.LoadINIFile(fname2); | |
| 150 | + | |
| 151 | + //解像度取得 | |
| 152 | + mode = INIConfig.GetINIFileInt("Graphics", "WindowSize", -1, NULL); | |
| 153 | + switch(mode){ | |
| 154 | + case 0: ScreenWidth = 640; ScreenHeight = 480; break; | |
| 155 | + case 1: ScreenWidth = 800; ScreenHeight = 600; break; | |
| 156 | + case 2: ScreenWidth = 1024; ScreenHeight = 768; break; | |
| 157 | + case 3: ScreenWidth = 1280; ScreenHeight = 960; break; | |
| 158 | + case 4: ScreenWidth = 1600; ScreenHeight = 1200; break; | |
| 159 | + case 10: ScreenWidth = 1280; ScreenHeight = 720; break; | |
| 160 | + case 11: ScreenWidth = 1600; ScreenHeight = 900; break; | |
| 161 | + case 12: ScreenWidth = 1920; ScreenHeight = 1080; break; | |
| 162 | + case 13: ScreenWidth = 2560; ScreenHeight = 1440; break; | |
| 163 | + case 14: ScreenWidth = 3840; ScreenHeight = 2160; break; | |
| 164 | + default: ScreenWidth = DEFAULT_SCREEN_WIDTH; ScreenHeight = DEFAULT_SCREEN_HEIGHT; break; | |
| 165 | + } | |
| 166 | + | |
| 167 | + INIConfig.ReleaseINIFile(); | |
| 168 | + | |
| 169 | +#ifdef ENABLE_DEBUGLOG | |
| 170 | + //ログに出力 | |
| 171 | + OutputLog.WriteLog(LOG_COMPLETE, "", ""); | |
| 172 | +#endif | |
| 173 | + | |
| 174 | +#else | |
| 175 | + ScreenWidth = DEFAULT_SCREEN_WIDTH; | |
| 176 | + ScreenHeight = DEFAULT_SCREEN_HEIGHT; | |
| 177 | +#endif | |
| 178 | + | |
| 134 | 179 | return 0; |
| 135 | 180 | } |
| 136 | 181 |
| @@ -245,6 +290,9 @@ | ||
| 245 | 290 | FrameskipFlag = false; |
| 246 | 291 | AnotherGunsightFlag = false; |
| 247 | 292 | strcpy(PlayerName, "xopsplayer"); |
| 293 | + | |
| 294 | + ScreenWidth = DEFAULT_SCREEN_WIDTH; | |
| 295 | + ScreenHeight = DEFAULT_SCREEN_HEIGHT; | |
| 248 | 296 | } |
| 249 | 297 | |
| 250 | 298 | //! @brief オリジナルキーコードを取得 |
| @@ -501,3 +549,17 @@ | ||
| 501 | 549 | |
| 502 | 550 | return out; |
| 503 | 551 | } |
| 552 | + | |
| 553 | +//! @brief 画面解像度(幅)を取得 | |
| 554 | +//! @return 値 | |
| 555 | +int Config::GetScreenWidth() | |
| 556 | +{ | |
| 557 | + return ScreenWidth; | |
| 558 | +} | |
| 559 | + | |
| 560 | +//! @brief 画面解像度(高さ)を取得 | |
| 561 | +//! @return 値 | |
| 562 | +int Config::GetScreenHeight() | |
| 563 | +{ | |
| 564 | + return ScreenHeight; | |
| 565 | +} | |
| \ No newline at end of file |
| @@ -78,10 +78,13 @@ | ||
| 78 | 78 | bool AnotherGunsightFlag; //!< 別の照準を使用 |
| 79 | 79 | char PlayerName[MAX_PLAYERNAME]; //!< プレイヤー名 |
| 80 | 80 | |
| 81 | + int ScreenWidth; //!< 画面解像度(幅) | |
| 82 | + int ScreenHeight; //!< 画面解像度(高さ) | |
| 83 | + | |
| 81 | 84 | public: |
| 82 | 85 | Config(); |
| 83 | 86 | ~Config(); |
| 84 | - int LoadFile(char *fname); | |
| 87 | + int LoadFile(char *fname, char *fname2); | |
| 85 | 88 | int SaveFile(char *fname); |
| 86 | 89 | void SetDefaultConfig(); |
| 87 | 90 | int GetKeycode(int id); |
| @@ -105,6 +108,9 @@ | ||
| 105 | 108 | int GetPlayerName(char *out_str); |
| 106 | 109 | void SetPlayerName(char *in_str); |
| 107 | 110 | char* GetOriginalkeycodeString(int code); |
| 111 | + | |
| 112 | + int GetScreenWidth(); | |
| 113 | + int GetScreenHeight(); | |
| 108 | 114 | }; |
| 109 | 115 | |
| 110 | 116 | #endif |
| \ No newline at end of file |
| @@ -218,13 +218,13 @@ | ||
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | //HUD 現在持っている武器を描画する座標 |
| 221 | - HUD_myweapon_x[0] = SCREEN_WIDTH - 140.0f; | |
| 222 | - HUD_myweapon_y[0] = SCREEN_HEIGHT - 40.0f; | |
| 221 | + HUD_myweapon_x[0] = GameConfig.GetScreenWidth() - 140.0f; | |
| 222 | + HUD_myweapon_y[0] = GameConfig.GetScreenHeight() - 40.0f; | |
| 223 | 223 | HUD_myweapon_z[0] = 0.86f; |
| 224 | 224 | |
| 225 | 225 | //HUD 予備の武器を描画する座標 |
| 226 | - HUD_myweapon_x[1] = SCREEN_WIDTH - 72.0f; | |
| 227 | - HUD_myweapon_y[1] = SCREEN_HEIGHT - 25.0f; | |
| 226 | + HUD_myweapon_x[1] = GameConfig.GetScreenWidth() - 72.0f; | |
| 227 | + HUD_myweapon_y[1] = GameConfig.GetScreenHeight() - 25.0f; | |
| 228 | 228 | HUD_myweapon_z[1] = 0.93f; |
| 229 | 229 | |
| 230 | 230 |
| @@ -409,7 +409,7 @@ | ||
| 409 | 409 | } |
| 410 | 410 | //フォント名:MS ゴシック サイズ:18 |
| 411 | 411 | //if( FAILED( D3DXCreateFont( pd3dDevice, -18, 0, FW_NORMAL, 1, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, |
| 412 | - if( FAILED( D3DXCreateFont( pd3dDevice, (int)(((float)SCREEN_HEIGHT / 480) * -18), 0, FW_NORMAL, 1, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, | |
| 412 | + if( FAILED( D3DXCreateFont( pd3dDevice, (int)(((float)GameConfig.GetScreenHeight() / 480) * -18), 0, FW_NORMAL, 1, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, | |
| 413 | 413 | DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "MS ゴシック", &pxmsfont) ) |
| 414 | 414 | ){ |
| 415 | 415 | return 1; |
| @@ -1107,7 +1107,7 @@ | ||
| 1107 | 1107 | D3DXVec3Unproject(&p1, &p1, &pViewport, &matProj, &matWorldV, &matWorld); |
| 1108 | 1108 | |
| 1109 | 1109 | //size = size * 0.3f; |
| 1110 | - size = size * (0.0004f*SCREEN_HEIGHT*SCREEN_HEIGHT - 0.92f*SCREEN_HEIGHT + 650.0f) / 1000.f; | |
| 1110 | + size = size * (0.0004f*GameConfig.GetScreenHeight()*GameConfig.GetScreenHeight() - 0.92f*GameConfig.GetScreenHeight() + 650.0f) / 1000.f; | |
| 1111 | 1111 | |
| 1112 | 1112 | //行列計算 |
| 1113 | 1113 | D3DXMatrixTranslation(&matWorld1, p1.x, p1.y, p1.z); |
| @@ -1788,8 +1788,8 @@ | ||
| 1788 | 1788 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DMSFontText()関数と同等です。 |
| 1789 | 1789 | void D3DGraphics::Draw2DMSFontTextScaling(int x, int y, char *str, int color) |
| 1790 | 1790 | { |
| 1791 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 1792 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 1791 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 1792 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 1793 | 1793 | |
| 1794 | 1794 | Draw2DMSFontText((int)(scaling_x * x), (int)(scaling_y * y), str, color); |
| 1795 | 1795 | } |
| @@ -1835,8 +1835,8 @@ | ||
| 1835 | 1835 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DMSFontTextCenter()関数と同等です。 |
| 1836 | 1836 | void D3DGraphics::Draw2DMSFontTextCenterScaling(int x, int y, int w, int h, char *str, int color) |
| 1837 | 1837 | { |
| 1838 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 1839 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 1838 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 1839 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 1840 | 1840 | |
| 1841 | 1841 | Draw2DMSFontTextCenter((int)(scaling_x * x), (int)(scaling_y * y), w, h, str, color); |
| 1842 | 1842 | } |
| @@ -1971,8 +1971,8 @@ | ||
| 1971 | 1971 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DTextureFontText()関数と同等です。 |
| 1972 | 1972 | void D3DGraphics::Draw2DTextureFontTextScaling(int x, int y, char *str, int color, int fontwidth, int fontheight) |
| 1973 | 1973 | { |
| 1974 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 1975 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 1974 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 1975 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 1976 | 1976 | |
| 1977 | 1977 | Draw2DTextureFontText((int)(scaling_x * x), (int)(scaling_y * y), str, color, (int)(scaling_x * fontwidth), (int)(scaling_x * fontheight)); |
| 1978 | 1978 | } |
| @@ -1987,7 +1987,7 @@ | ||
| 1987 | 1987 | //! @attention 文字を二重に重ねて立体感を出さないと見にくくなります。 |
| 1988 | 1988 | void D3DGraphics::Draw2DTextureFontTextCenter(int x, int y, char *str, int color, int fontwidth, int fontheight) |
| 1989 | 1989 | { |
| 1990 | - Draw2DTextureFontText((SCREEN_WIDTH - strlen(str)*fontwidth)/2 + x, y, str, color, fontwidth, fontheight); | |
| 1990 | + Draw2DTextureFontText((GameConfig.GetScreenWidth() - strlen(str)*fontwidth)/2 + x, y, str, color, fontwidth, fontheight); | |
| 1991 | 1991 | } |
| 1992 | 1992 | |
| 1993 | 1993 | //! @brief 中央寄せに文字を表示(テクスチャフォント使用)【スケーリング機能付き】 |
| @@ -2000,8 +2000,8 @@ | ||
| 2000 | 2000 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DTextureFontTextCenter()関数と同等です。 |
| 2001 | 2001 | void D3DGraphics::Draw2DTextureFontTextCenterScaling(int x, int y, char *str, int color, int fontwidth, int fontheight) |
| 2002 | 2002 | { |
| 2003 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 2004 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 2003 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 2004 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 2005 | 2005 | |
| 2006 | 2006 | Draw2DTextureFontTextCenter((int)(scaling_x * x), (int)(scaling_y * y), str, color, (int)(scaling_x * fontwidth), (int)(scaling_x * fontheight)); |
| 2007 | 2007 | } |
| @@ -2233,8 +2233,8 @@ | ||
| 2233 | 2233 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DBox()関数と同等です。 |
| 2234 | 2234 | void D3DGraphics::Draw2DBoxScaling(int x1, int y1, int x2, int y2, int color) |
| 2235 | 2235 | { |
| 2236 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 2237 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 2236 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 2237 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 2238 | 2238 | |
| 2239 | 2239 | Draw2DBox((int)(scaling_x * x1), (int)(scaling_y * y1), (int)(scaling_x * x2), (int)(scaling_y * y2), color); |
| 2240 | 2240 | } |
| @@ -2304,8 +2304,8 @@ | ||
| 2304 | 2304 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DTexture()関数と同等です。 |
| 2305 | 2305 | void D3DGraphics::Draw2DTextureScaling(int x, int y, int id, int width, int height, float alpha) |
| 2306 | 2306 | { |
| 2307 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 2308 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 2307 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 2308 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 2309 | 2309 | |
| 2310 | 2310 | Draw2DTexture((int)(scaling_x * x), (int)(scaling_y * y), id, (int)(scaling_x * width), (int)(scaling_y * height), alpha); |
| 2311 | 2311 | } |
| @@ -188,7 +188,7 @@ | ||
| 188 | 188 | //システムフォント用意 |
| 189 | 189 | //フォント名:MS ゴシック サイズ:18 |
| 190 | 190 | //SystemFont = CreateFont(18, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "MS ゴシック"); |
| 191 | - SystemFont = CreateFont((int)(((float)SCREEN_HEIGHT / 480) * 18), 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "MS ゴシック"); | |
| 191 | + SystemFont = CreateFont((int)(((float)GameConfig.GetScreenHeight() / 480) * 18), 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "MS ゴシック"); | |
| 192 | 192 | //フォント名:MS ゴシック サイズ:12 |
| 193 | 193 | SystemSmallFont = CreateFont(12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "MS ゴシック"); |
| 194 | 194 |
| @@ -205,13 +205,13 @@ | ||
| 205 | 205 | |
| 206 | 206 | |
| 207 | 207 | //HUD 現在持っている武器を描画する座標 |
| 208 | - HUD_myweapon_x[0] = SCREEN_WIDTH - 140.0f; | |
| 209 | - HUD_myweapon_y[0] = SCREEN_HEIGHT - 40.0f; | |
| 208 | + HUD_myweapon_x[0] = GameConfig.GetScreenWidth() - 140.0f; | |
| 209 | + HUD_myweapon_y[0] = GameConfig.GetScreenHeight() - 40.0f; | |
| 210 | 210 | HUD_myweapon_z[0] = 0.86f; |
| 211 | 211 | |
| 212 | 212 | //HUD 予備の武器を描画する座標 |
| 213 | - HUD_myweapon_x[1] = SCREEN_WIDTH - 72.0f; | |
| 214 | - HUD_myweapon_y[1] = SCREEN_HEIGHT - 25.0f; | |
| 213 | + HUD_myweapon_x[1] = GameConfig.GetScreenWidth() - 72.0f; | |
| 214 | + HUD_myweapon_y[1] = GameConfig.GetScreenHeight() - 25.0f; | |
| 215 | 215 | HUD_myweapon_z[1] = 0.93f; |
| 216 | 216 | |
| 217 | 217 |
| @@ -318,7 +318,7 @@ | ||
| 318 | 318 | //システムフォント用意 |
| 319 | 319 | //フォント名:MS ゴシック サイズ:18 |
| 320 | 320 | //SystemFont = CreateFont(18, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "MS ゴシック"); |
| 321 | - SystemFont = CreateFont((int)(((float)SCREEN_HEIGHT / 480) * 18), 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "MS ゴシック"); | |
| 321 | + SystemFont = CreateFont((int)(((float)GameConfig.GetScreenHeight() / 480) * 18), 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "MS ゴシック"); | |
| 322 | 322 | //フォント名:MS ゴシック サイズ:12 |
| 323 | 323 | SystemSmallFont = CreateFont(12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "MS ゴシック"); |
| 324 | 324 |
| @@ -1849,12 +1849,12 @@ | ||
| 1849 | 1849 | |
| 1850 | 1850 | if( rotation == true ){ |
| 1851 | 1851 | screenX = HUD_myweapon_x[0]; |
| 1852 | - screenY = SCREEN_HEIGHT - HUD_myweapon_y[0]; | |
| 1852 | + screenY = GameConfig.GetScreenHeight() - HUD_myweapon_y[0]; | |
| 1853 | 1853 | screenZ = HUD_myweapon_z[0]; |
| 1854 | 1854 | } |
| 1855 | 1855 | else{ |
| 1856 | 1856 | screenX = HUD_myweapon_x[1]; |
| 1857 | - screenY = SCREEN_HEIGHT - HUD_myweapon_y[1]; | |
| 1857 | + screenY = GameConfig.GetScreenHeight() - HUD_myweapon_y[1]; | |
| 1858 | 1858 | screenZ = HUD_myweapon_z[1]; |
| 1859 | 1859 | } |
| 1860 | 1860 |
| @@ -1871,7 +1871,7 @@ | ||
| 1871 | 1871 | gluUnProject(screenX, screenY, screenZ, modelview, projection, viewport, &objX, &objY, &objZ); |
| 1872 | 1872 | |
| 1873 | 1873 | //size = size * 0.3f; |
| 1874 | - size = size * (0.0004f*SCREEN_HEIGHT*SCREEN_HEIGHT - 0.92f*SCREEN_HEIGHT + 650.0f) / 1000.f; | |
| 1874 | + size = size * (0.0004f*GameConfig.GetScreenHeight()*GameConfig.GetScreenHeight() - 0.92f*GameConfig.GetScreenHeight() + 650.0f) / 1000.f; | |
| 1875 | 1875 | |
| 1876 | 1876 | //行列計算 |
| 1877 | 1877 | glTranslated(objX, objY, objZ); |
| @@ -2450,8 +2450,8 @@ | ||
| 2450 | 2450 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DMSFontText()関数と同等です。 |
| 2451 | 2451 | void D3DGraphics::Draw2DMSFontTextScaling(int x, int y, char *str, int color) |
| 2452 | 2452 | { |
| 2453 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 2454 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 2453 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 2454 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 2455 | 2455 | |
| 2456 | 2456 | Draw2DMSFontText((int)(scaling_x * x), (int)(scaling_y * y), str, color); |
| 2457 | 2457 | } |
| @@ -2468,7 +2468,7 @@ | ||
| 2468 | 2468 | //未使用引数対策 |
| 2469 | 2469 | UNREFERENCED_PARAMETER(h); |
| 2470 | 2470 | |
| 2471 | - int fonthalfsize = (int)(((float)SCREEN_HEIGHT / 480) * 9); | |
| 2471 | + int fonthalfsize = (int)(((float)GameConfig.GetScreenHeight() / 480) * 9); | |
| 2472 | 2472 | |
| 2473 | 2473 | //Draw2DMSFontText(x + (w/2 - (StrMaxLineLen(str)*9/2)), y, str, color); |
| 2474 | 2474 | Draw2DMSFontText(x + (w/2 - (StrMaxLineLen(str)*fonthalfsize/2)), y, str, color); |
| @@ -2484,8 +2484,8 @@ | ||
| 2484 | 2484 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DMSFontTextCenter()関数と同等です。 |
| 2485 | 2485 | void D3DGraphics::Draw2DMSFontTextCenterScaling(int x, int y, int w, int h, char *str, int color) |
| 2486 | 2486 | { |
| 2487 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 2488 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 2487 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 2488 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 2489 | 2489 | |
| 2490 | 2490 | Draw2DMSFontTextCenter((int)(scaling_x * x), (int)(scaling_y * y), w, h, str, color); |
| 2491 | 2491 | } |
| @@ -2688,8 +2688,8 @@ | ||
| 2688 | 2688 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DTextureFontText()関数と同等です。 |
| 2689 | 2689 | void D3DGraphics::Draw2DTextureFontTextScaling(int x, int y, char *str, int color, int fontwidth, int fontheight) |
| 2690 | 2690 | { |
| 2691 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 2692 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 2691 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 2692 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 2693 | 2693 | |
| 2694 | 2694 | Draw2DTextureFontText((int)(scaling_x * x), (int)(scaling_y * y), str, color, (int)(scaling_x * fontwidth), (int)(scaling_x * fontheight)); |
| 2695 | 2695 | } |
| @@ -2704,7 +2704,7 @@ | ||
| 2704 | 2704 | //! @attention 文字を二重に重ねて立体感を出さないと見にくくなります。 |
| 2705 | 2705 | void D3DGraphics::Draw2DTextureFontTextCenter(int x, int y, char *str, int color, int fontwidth, int fontheight) |
| 2706 | 2706 | { |
| 2707 | - Draw2DTextureFontText((SCREEN_WIDTH - strlen(str)*fontwidth)/2 + x, y, str, color, fontwidth, fontheight); | |
| 2707 | + Draw2DTextureFontText((GameConfig.GetScreenWidth() - strlen(str)*fontwidth)/2 + x, y, str, color, fontwidth, fontheight); | |
| 2708 | 2708 | } |
| 2709 | 2709 | |
| 2710 | 2710 | //! @brief 中央寄せに文字を表示(テクスチャフォント使用)【スケーリング機能付き】 |
| @@ -2717,8 +2717,8 @@ | ||
| 2717 | 2717 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DTextureFontTextCenter()関数と同等です。 |
| 2718 | 2718 | void D3DGraphics::Draw2DTextureFontTextCenterScaling(int x, int y, char *str, int color, int fontwidth, int fontheight) |
| 2719 | 2719 | { |
| 2720 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 2721 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 2720 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 2721 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 2722 | 2722 | |
| 2723 | 2723 | Draw2DTextureFontTextCenter((int)(scaling_x * x), (int)(scaling_y * y), str, color, (int)(scaling_x * fontwidth), (int)(scaling_x * fontheight)); |
| 2724 | 2724 | } |
| @@ -2971,8 +2971,8 @@ | ||
| 2971 | 2971 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DBox()関数と同等です。 |
| 2972 | 2972 | void D3DGraphics::Draw2DBoxScaling(int x1, int y1, int x2, int y2, int color) |
| 2973 | 2973 | { |
| 2974 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 2975 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 2974 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 2975 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 2976 | 2976 | |
| 2977 | 2977 | Draw2DBox((int)(scaling_x * x1), (int)(scaling_y * y1), (int)(scaling_x * x2), (int)(scaling_y * y2), color); |
| 2978 | 2978 | } |
| @@ -3053,8 +3053,8 @@ | ||
| 3053 | 3053 | //! @attention 640x480相当の解像度から現解像度へスケーリングします。それ以外はDraw2DTexture()関数と同等です。 |
| 3054 | 3054 | void D3DGraphics::Draw2DTextureScaling(int x, int y, int id, int width, int height, float alpha) |
| 3055 | 3055 | { |
| 3056 | - float scaling_x = (float)SCREEN_HEIGHT / 480;//(float)SCREEN_WIDTH / 640; | |
| 3057 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 3056 | + float scaling_x = (float)GameConfig.GetScreenHeight() / 480;//(float)GameConfig.GetScreenWidth() / 640; | |
| 3057 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 3058 | 3058 | |
| 3059 | 3059 | Draw2DTexture((int)(scaling_x * x), (int)(scaling_y * y), id, (int)(scaling_x * width), (int)(scaling_y * height), alpha); |
| 3060 | 3060 | } |
| @@ -3083,7 +3083,7 @@ | ||
| 3083 | 3083 | unsigned char header[54]; |
| 3084 | 3084 | unsigned char pixel[3]; |
| 3085 | 3085 | |
| 3086 | - unsigned char *dataBuffer = new unsigned char [SCREEN_WIDTH * SCREEN_HEIGHT * 3]; | |
| 3086 | + unsigned char *dataBuffer = new unsigned char [GameConfig.GetScreenWidth() * GameConfig.GetScreenHeight() * 3]; | |
| 3087 | 3087 | |
| 3088 | 3088 | //デバイスコンテキスト設定 |
| 3089 | 3089 | hDC = GetDC(hWnd); |
| @@ -3090,7 +3090,7 @@ | ||
| 3090 | 3090 | wglMakeCurrent(hDC, hGLRC); |
| 3091 | 3091 | |
| 3092 | 3092 | //バッファに格納 |
| 3093 | - glReadPixels(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, GL_RGB, GL_UNSIGNED_BYTE, dataBuffer); | |
| 3093 | + glReadPixels(0, 0, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), GL_RGB, GL_UNSIGNED_BYTE, dataBuffer); | |
| 3094 | 3094 | |
| 3095 | 3095 | //ファイルを保存する |
| 3096 | 3096 | fp = fopen(filename, "wb"); |
| @@ -3106,24 +3106,24 @@ | ||
| 3106 | 3106 | header[0x00] = 'B'; |
| 3107 | 3107 | header[0x01] = 'M'; |
| 3108 | 3108 | header[0x0E] = 40; |
| 3109 | - header[0x12] = (unsigned char)(SCREEN_WIDTH&0x000000FF); | |
| 3110 | - header[0x13] = (unsigned char)((SCREEN_WIDTH&0x0000FF00) >> 8); | |
| 3111 | - header[0x14] = (unsigned char)((SCREEN_WIDTH&0x00FF0000) >> 16); | |
| 3112 | - header[0x15] = (unsigned char)((SCREEN_WIDTH&0xFF000000) >> 24); | |
| 3113 | - header[0x16] = (unsigned char)(SCREEN_HEIGHT&0x000000FF); | |
| 3114 | - header[0x17] = (unsigned char)((SCREEN_HEIGHT&0x0000FF00) >> 8); | |
| 3115 | - header[0x18] = (unsigned char)((SCREEN_HEIGHT&0x00FF0000) >> 16); | |
| 3116 | - header[0x19] = (unsigned char)((SCREEN_HEIGHT&0xFF000000) >> 24); | |
| 3109 | + header[0x12] = (unsigned char)(GameConfig.GetScreenWidth()&0x000000FF); | |
| 3110 | + header[0x13] = (unsigned char)((GameConfig.GetScreenWidth()&0x0000FF00) >> 8); | |
| 3111 | + header[0x14] = (unsigned char)((GameConfig.GetScreenWidth()&0x00FF0000) >> 16); | |
| 3112 | + header[0x15] = (unsigned char)((GameConfig.GetScreenWidth()&0xFF000000) >> 24); | |
| 3113 | + header[0x16] = (unsigned char)(GameConfig.GetScreenHeight()&0x000000FF); | |
| 3114 | + header[0x17] = (unsigned char)((GameConfig.GetScreenHeight()&0x0000FF00) >> 8); | |
| 3115 | + header[0x18] = (unsigned char)((GameConfig.GetScreenHeight()&0x00FF0000) >> 16); | |
| 3116 | + header[0x19] = (unsigned char)((GameConfig.GetScreenHeight()&0xFF000000) >> 24); | |
| 3117 | 3117 | header[0x1C] = 24; |
| 3118 | 3118 | |
| 3119 | 3119 | //ヘッダーを書き込む |
| 3120 | 3120 | fwrite(header, 1, 54, fp); |
| 3121 | 3121 | |
| 3122 | - for(int h=0; h<SCREEN_HEIGHT; h++){ | |
| 3123 | - for(int w=0; w<SCREEN_WIDTH; w++){ | |
| 3124 | - pixel[2] = dataBuffer[(h*SCREEN_WIDTH+w)*3 + 0]; | |
| 3125 | - pixel[1] = dataBuffer[(h*SCREEN_WIDTH+w)*3 + 1]; | |
| 3126 | - pixel[0] = dataBuffer[(h*SCREEN_WIDTH+w)*3 + 2]; | |
| 3122 | + for(int h=0; h<GameConfig.GetScreenHeight(); h++){ | |
| 3123 | + for(int w=0; w<GameConfig.GetScreenWidth(); w++){ | |
| 3124 | + pixel[2] = dataBuffer[(h*GameConfig.GetScreenWidth()+w)*3 + 0]; | |
| 3125 | + pixel[1] = dataBuffer[(h*GameConfig.GetScreenWidth()+w)*3 + 1]; | |
| 3126 | + pixel[0] = dataBuffer[(h*GameConfig.GetScreenWidth()+w)*3 + 2]; | |
| 3127 | 3127 | |
| 3128 | 3128 | fwrite(&pixel, 1, 3, fp); |
| 3129 | 3129 | } |
| @@ -1362,7 +1362,227 @@ | ||
| 1362 | 1362 | return filename[id]; |
| 1363 | 1363 | } |
| 1364 | 1364 | |
| 1365 | +//! @brief コンストラクタ | |
| 1366 | +INIFileInterface::INIFileInterface() | |
| 1367 | +{ | |
| 1368 | + inifp = NULL; | |
| 1369 | +} | |
| 1365 | 1370 | |
| 1371 | +//! @brief ディストラクタ | |
| 1372 | +INIFileInterface::~INIFileInterface() | |
| 1373 | +{ | |
| 1374 | + ReleaseINIFile(); | |
| 1375 | +} | |
| 1376 | + | |
| 1377 | +//! @brief INIファイルを読み込む | |
| 1378 | +//! @param fname ファイル名 | |
| 1379 | +//! @return 成功:false 失敗:true | |
| 1380 | +//! @attention 既にINIファイルを読み込んでいる場合、ReleaseINIFile()関数を使うまで本関数は失敗します。 | |
| 1381 | +bool INIFileInterface::LoadINIFile(char *fname) | |
| 1382 | +{ | |
| 1383 | + if( inifp != NULL ){ return true; } | |
| 1384 | + | |
| 1385 | +#ifdef ENABLE_PATH_DELIMITER_SLASH | |
| 1386 | + //パス区切り文字を変換 | |
| 1387 | + fname = ChangePathDelimiter(fname); | |
| 1388 | +#endif | |
| 1389 | + | |
| 1390 | + inifp = fopen(fname, "rb"); | |
| 1391 | + if( inifp == NULL ){ return true; } | |
| 1392 | + | |
| 1393 | + return false; | |
| 1394 | +} | |
| 1395 | + | |
| 1396 | +//! @brief 文字列を取得 | |
| 1397 | +//! @param sectionname セクション名(NULL可) | |
| 1398 | +//! @param keyname キー名 | |
| 1399 | +//! @param defaultvalue デフォルト値 | |
| 1400 | +//! @param errorcode エラーコードを取得するポインタ(NULL可) | |
| 1401 | +//! @return 値 | |
| 1402 | +//! @attention ファイルが開かれていないか キーが見つからなければ、デフォルト値を返します。 | |
| 1403 | +//! @note エラーコード 1:ファイルが開かれていない、2:値が見つからない | |
| 1404 | +char* INIFileInterface::GetINIFileString(char *sectionname, char *keyname, char *defaultvalue, int *errorcode) | |
| 1405 | +{ | |
| 1406 | + int state = 0; | |
| 1407 | + char readline[256]; | |
| 1408 | + char buf[256]; | |
| 1409 | + | |
| 1410 | + //ファイルが読み込まれていなければ失敗 | |
| 1411 | + if( inifp == NULL ){ | |
| 1412 | + if( errorcode != NULL ){ *errorcode = 1; } | |
| 1413 | + return defaultvalue; | |
| 1414 | + } | |
| 1415 | + | |
| 1416 | + fseek(inifp, 0, SEEK_SET); | |
| 1417 | + strcpy(readline, ""); | |
| 1418 | + | |
| 1419 | + //セクション名が未指定ならば、セクション名判定を無効化 | |
| 1420 | + if( sectionname == NULL ){ | |
| 1421 | + state = 1; | |
| 1422 | + } | |
| 1423 | + else if( sectionname[0] == '\0' ){ | |
| 1424 | + state = 1; | |
| 1425 | + } | |
| 1426 | + | |
| 1427 | + while( fgets(readline, 256, inifp) != NULL ){ | |
| 1428 | + //コメント行なら無効 | |
| 1429 | + if( readline[0] == ';' ){ continue; } | |
| 1430 | + | |
| 1431 | + //セクション名判定 | |
| 1432 | + if( state == 0 ){//if( sectionname != NULL ){ | |
| 1433 | + char str[64]; | |
| 1434 | + sprintf(str, "[%s]", sectionname); | |
| 1435 | + strcpy(buf, readline); | |
| 1436 | + buf[ strlen(str) ] = '\0'; | |
| 1437 | + if( strcmp(buf, str) == 0 ){ | |
| 1438 | + state = 1; | |
| 1439 | + continue; | |
| 1440 | + } | |
| 1441 | + } | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + //キー名判定 | |
| 1445 | + if( state == 1 ){ | |
| 1446 | + //一文字目が"["なら無効 | |
| 1447 | + if( readline[0] == '[' ){ break; } | |
| 1448 | + | |
| 1449 | + char readline2[256]; | |
| 1450 | + int strcnt = 0; | |
| 1451 | + int quotationmode = 0; | |
| 1452 | + char str[64]; | |
| 1453 | + | |
| 1454 | + //スペース/コメント/"" などがない文字を生成 | |
| 1455 | + strcpy(readline2, ""); | |
| 1456 | + for(int i=0; i<(int)strlen(readline); i++){ | |
| 1457 | + if( (readline[i] == '\r')||(readline[i] == '\n') ){ break; } | |
| 1458 | + | |
| 1459 | + if( quotationmode == 0 ){ | |
| 1460 | + if( (readline[i] == ' ')||(readline[i] == '\t') ){ continue; } | |
| 1461 | + if( readline[i] == ';' ){ break; } | |
| 1462 | + | |
| 1463 | + if( readline[i] == '\'' ){ | |
| 1464 | + quotationmode = 1; | |
| 1465 | + continue; | |
| 1466 | + } | |
| 1467 | + if( readline[i] == '"' ){ | |
| 1468 | + quotationmode = 2; | |
| 1469 | + continue; | |
| 1470 | + } | |
| 1471 | + } | |
| 1472 | + if( (quotationmode == 1)&&(readline[i] == '\'') ){ | |
| 1473 | + quotationmode = 0; | |
| 1474 | + continue; | |
| 1475 | + } | |
| 1476 | + if( (quotationmode == 2)&&(readline[i] == '"') ){ | |
| 1477 | + quotationmode = 0; | |
| 1478 | + continue; | |
| 1479 | + } | |
| 1480 | + | |
| 1481 | + readline2[strcnt] = readline[i]; | |
| 1482 | + readline2[strcnt+1] = '\0'; | |
| 1483 | + strcnt += 1; | |
| 1484 | + } | |
| 1485 | + | |
| 1486 | + //"="の後ろの文字を取得し判定 | |
| 1487 | + sprintf(str, "%s=", keyname); | |
| 1488 | + strcpy(buf, readline2); | |
| 1489 | + buf[ strlen(str) ] = '\0'; | |
| 1490 | + if( strcmp(buf, str) == 0 ){ | |
| 1491 | + state = 1; | |
| 1492 | + | |
| 1493 | + //値を返す | |
| 1494 | + return &(readline2[strlen(str)]); | |
| 1495 | + } | |
| 1496 | + } | |
| 1497 | + } | |
| 1498 | + | |
| 1499 | + //値が見つからなければエラーを返す | |
| 1500 | + if( errorcode != NULL ){ *errorcode = 2; } | |
| 1501 | + return defaultvalue; | |
| 1502 | +} | |
| 1503 | + | |
| 1504 | +//! @brief int値を取得 | |
| 1505 | +//! @param sectionname セクション名(NULL可) | |
| 1506 | +//! @param keyname キー名 | |
| 1507 | +//! @param defaultvalue デフォルト値 | |
| 1508 | +//! @param errorcode エラーコードを取得するポインタ(NULL可) | |
| 1509 | +//! @return 値 | |
| 1510 | +//! @attention ファイルが開かれていないか キーが見つからなければ、デフォルト値を返します。 | |
| 1511 | +//! @note エラーコード 1:ファイルが開かれていない、2:値が見つからない | |
| 1512 | +int INIFileInterface::GetINIFileInt(char *sectionname, char *keyname, int defaultvalue, int *errorcode) | |
| 1513 | +{ | |
| 1514 | + char defaultint[64]; | |
| 1515 | + char buf[64]; | |
| 1516 | + | |
| 1517 | + sprintf(defaultint, "%d", defaultvalue); | |
| 1518 | + strcpy(buf, GetINIFileString(sectionname, keyname, defaultint, errorcode)); | |
| 1519 | + return atoi(buf); | |
| 1520 | +} | |
| 1521 | + | |
| 1522 | +//! @brief float値を取得 | |
| 1523 | +//! @param sectionname セクション名(NULL可) | |
| 1524 | +//! @param keyname キー名 | |
| 1525 | +//! @param defaultvalue デフォルト値 | |
| 1526 | +//! @param errorcode エラーコードを取得するポインタ(NULL可) | |
| 1527 | +//! @return 値 | |
| 1528 | +//! @attention ファイルが開かれていないか キーが見つからなければ、デフォルト値を返します。 | |
| 1529 | +//! @note エラーコード 1:ファイルが開かれていない、2:値が見つからない | |
| 1530 | +float INIFileInterface::GetINIFileFloat(char *sectionname, char *keyname, float defaultvalue, int *errorcode) | |
| 1531 | +{ | |
| 1532 | + char defaultfloat[64]; | |
| 1533 | + char buf[64]; | |
| 1534 | + | |
| 1535 | + sprintf(defaultfloat, "%f", defaultvalue); | |
| 1536 | + strcpy(buf, GetINIFileString(sectionname, keyname, defaultfloat, errorcode)); | |
| 1537 | + for(int i=strlen(buf)-1; i>0; i--){ | |
| 1538 | + if( buf[i] == 'f' ){ buf[i] = '\0'; } | |
| 1539 | + if( buf[i] == 'F' ){ buf[i] = '\0'; } | |
| 1540 | + } | |
| 1541 | + return (float)atof(buf); | |
| 1542 | +} | |
| 1543 | + | |
| 1544 | +//! @brief bool値を取得 | |
| 1545 | +//! @param sectionname セクション名(NULL可) | |
| 1546 | +//! @param keyname キー名 | |
| 1547 | +//! @param defaultvalue デフォルト値 | |
| 1548 | +//! @param errorcode エラーコードを取得するポインタ(NULL可) | |
| 1549 | +//! @return 値 | |
| 1550 | +//! @attention ファイルが開かれていないか キーが見つからなければ、デフォルト値を返します。 | |
| 1551 | +//! @note エラーコード 1:ファイルが開かれていない、2:値が見つからない | |
| 1552 | +bool INIFileInterface::GetINIFileBool(char *sectionname, char *keyname, bool defaultvalue, int *errorcode) | |
| 1553 | +{ | |
| 1554 | + char defaultbool[64]; | |
| 1555 | + char buf[64]; | |
| 1556 | + | |
| 1557 | + if( defaultvalue == false ){ | |
| 1558 | + strcpy(defaultbool, "false"); | |
| 1559 | + } | |
| 1560 | + else{ | |
| 1561 | + strcpy(defaultbool, "true"); | |
| 1562 | + } | |
| 1563 | + strcpy(buf, GetINIFileString(sectionname, keyname, defaultbool, errorcode)); | |
| 1564 | + for(int j=0; j<=(int)strlen(buf); j++){ if(('A'<=buf[j])&&(buf[j]<='Z')){ buf[j] += 32; } } | |
| 1565 | + if( strcmp(buf, "false") == 0 ){ | |
| 1566 | + return false; | |
| 1567 | + } | |
| 1568 | + else if( strcmp(buf, "0") == 0 ){ | |
| 1569 | + return false; | |
| 1570 | + } | |
| 1571 | + //else{ | |
| 1572 | + return true; | |
| 1573 | + //} | |
| 1574 | +} | |
| 1575 | + | |
| 1576 | +//! @brief INIファイルを解放 | |
| 1577 | +void INIFileInterface::ReleaseINIFile() | |
| 1578 | +{ | |
| 1579 | + if( inifp == NULL ){ return; } | |
| 1580 | + | |
| 1581 | + fclose(inifp); | |
| 1582 | + inifp = NULL; | |
| 1583 | +} | |
| 1584 | + | |
| 1585 | + | |
| 1366 | 1586 | //! @brief fgets()用 改行コードを取り除く |
| 1367 | 1587 | //! @param str 文字列 |
| 1368 | 1588 | //! @return 置き換えあり:0 置き換えなし:1 |
| @@ -220,6 +220,23 @@ | ||
| 220 | 220 | char *GetFileName(int id); |
| 221 | 221 | }; |
| 222 | 222 | |
| 223 | +//! @brief INIファイルを管理するクラス | |
| 224 | +//! @details INIファイルを管理します。 | |
| 225 | +class INIFileInterface | |
| 226 | +{ | |
| 227 | + FILE *inifp; //!< ファイルポインタ | |
| 228 | + | |
| 229 | +public: | |
| 230 | + INIFileInterface(); | |
| 231 | + ~INIFileInterface(); | |
| 232 | + bool LoadINIFile(char *fname); | |
| 233 | + char* GetINIFileString(char *sectionname, char *keyname, char *defaultvalue, int *errorcode); | |
| 234 | + int GetINIFileInt(char *sectionname, char *keyname, int defaultvalue, int *errorcode); | |
| 235 | + float GetINIFileFloat(char *sectionname, char *keyname, float defaultvalue, int *errorcode); | |
| 236 | + bool GetINIFileBool(char *sectionname, char *keyname, bool defaultvalue, int *errorcode); | |
| 237 | + void ReleaseINIFile(); | |
| 238 | +}; | |
| 239 | + | |
| 223 | 240 | int DeleteLinefeed(char str[]); |
| 224 | 241 | bool CheckFullPath(char *path); |
| 225 | 242 | void GetFileDirectory(char *path, char *dir); |
| @@ -379,9 +379,9 @@ | ||
| 379 | 379 | { |
| 380 | 380 | float effect = 0.0f; |
| 381 | 381 | |
| 382 | - //float scaling_x = (float)SCREEN_WIDTH / 640; | |
| 383 | - float scaling_y = (float)SCREEN_HEIGHT / 480; | |
| 384 | - int swidth = (int)((float)SCREEN_WIDTH / SCREEN_HEIGHT * 480); | |
| 382 | + //float scaling_x = (float)GameConfig.GetScreenWidth() / 640; | |
| 383 | + float scaling_y = (float)GameConfig.GetScreenHeight() / 480; | |
| 384 | + int swidth = (int)((float)GameConfig.GetScreenWidth() / GameConfig.GetScreenHeight() * 480); | |
| 385 | 385 | |
| 386 | 386 | //ブラックアウト設定 |
| 387 | 387 | if( framecnt < (int)(1.0f*GAMEFPS) ){ |
| @@ -396,11 +396,11 @@ | ||
| 396 | 396 | if( (int)(15.0f*GAMEFPS) <= framecnt ){ |
| 397 | 397 | effect = 1.0f; |
| 398 | 398 | } |
| 399 | - d3dg->Draw2DBox(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, d3dg->GetColorCode(0.0f,0.0f,0.0f,effect)); | |
| 399 | + d3dg->Draw2DBox(0, 0, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), d3dg->GetColorCode(0.0f,0.0f,0.0f,effect)); | |
| 400 | 400 | |
| 401 | 401 | //上下の黒縁描画 |
| 402 | - d3dg->Draw2DBox(0, 0, SCREEN_WIDTH, (int)(scaling_y * 40), d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 403 | - d3dg->Draw2DBox(0, SCREEN_HEIGHT - (int)(scaling_y * 40), SCREEN_WIDTH, SCREEN_HEIGHT, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 402 | + d3dg->Draw2DBox(0, 0, GameConfig.GetScreenWidth(), (int)(scaling_y * 40), d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 403 | + d3dg->Draw2DBox(0, GameConfig.GetScreenHeight() - (int)(scaling_y * 40), GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 404 | 404 | |
| 405 | 405 | //プロジェクト名 |
| 406 | 406 | if( ((int)(0.5f*GAMEFPS) < framecnt)&&(framecnt < (int)(4.0f*GAMEFPS)) ){ |
| @@ -561,8 +561,8 @@ | ||
| 561 | 561 | //サウンド初期化 |
| 562 | 562 | GameSound->InitWorldSound(); |
| 563 | 563 | |
| 564 | - mainmenu_mouseX = SCREEN_WIDTH/2; | |
| 565 | - mainmenu_mouseY = SCREEN_HEIGHT/2; | |
| 564 | + mainmenu_mouseX = GameConfig.GetScreenWidth()/2; | |
| 565 | + mainmenu_mouseY = GameConfig.GetScreenHeight()/2; | |
| 566 | 566 | mainmenu_mouseY_old = mainmenu_mouseY; |
| 567 | 567 | |
| 568 | 568 | //ミッションのスクロールバーの設定 |
| @@ -604,9 +604,9 @@ | ||
| 604 | 604 | //マウス座標を取得 |
| 605 | 605 | inputCtrl->GetMouseMovement(&mainmenu_mouseX, &mainmenu_mouseY); |
| 606 | 606 | if( mainmenu_mouseX < 0 ){ mainmenu_mouseX = 0; } |
| 607 | - if( mainmenu_mouseX > SCREEN_WIDTH-1 ){ mainmenu_mouseX = SCREEN_WIDTH-1; } | |
| 607 | + if( mainmenu_mouseX > GameConfig.GetScreenWidth()-1 ){ mainmenu_mouseX = GameConfig.GetScreenWidth()-1; } | |
| 608 | 608 | if( mainmenu_mouseY < 0 ){ mainmenu_mouseY = 0; } |
| 609 | - if( mainmenu_mouseY > SCREEN_HEIGHT-1 ){ mainmenu_mouseY = SCREEN_HEIGHT-1; } | |
| 609 | + if( mainmenu_mouseY > GameConfig.GetScreenHeight()-1 ){ mainmenu_mouseY = GameConfig.GetScreenHeight()-1; } | |
| 610 | 610 | |
| 611 | 611 | if( modescreen == 0 ){ |
| 612 | 612 | //スクロールバーを処理し情報取得 |
| @@ -759,7 +759,7 @@ | ||
| 759 | 759 | int color; |
| 760 | 760 | float effect; |
| 761 | 761 | |
| 762 | - int swidth = (int)((float)SCREEN_WIDTH / SCREEN_HEIGHT * 480); | |
| 762 | + int swidth = (int)((float)GameConfig.GetScreenWidth() / GameConfig.GetScreenHeight() * 480); | |
| 763 | 763 | |
| 764 | 764 | //ゲームのバージョン情報表示 |
| 765 | 765 | d3dg->Draw2DTextureFontTextScaling(swidth - 118+1, 75+1, GAMEVERSION, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 18, 22); |
| @@ -916,10 +916,10 @@ | ||
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | //マウスカーソル表示(赤線) |
| 919 | - d3dg->Draw2DBox(0, mainmenu_mouseY-1, SCREEN_WIDTH, mainmenu_mouseY+1, d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 920 | - d3dg->Draw2DBox(mainmenu_mouseX-1, 0, mainmenu_mouseX+1, SCREEN_HEIGHT, d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 921 | - d3dg->Draw2DLine(0, mainmenu_mouseY, SCREEN_WIDTH, mainmenu_mouseY, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 922 | - d3dg->Draw2DLine(mainmenu_mouseX, 0, mainmenu_mouseX, SCREEN_HEIGHT, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 919 | + d3dg->Draw2DBox(0, mainmenu_mouseY-1, GameConfig.GetScreenWidth(), mainmenu_mouseY+1, d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 920 | + d3dg->Draw2DBox(mainmenu_mouseX-1, 0, mainmenu_mouseX+1, GameConfig.GetScreenHeight(), d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 921 | + d3dg->Draw2DLine(0, mainmenu_mouseY, GameConfig.GetScreenWidth(), mainmenu_mouseY, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 922 | + d3dg->Draw2DLine(mainmenu_mouseX, 0, mainmenu_mouseX, GameConfig.GetScreenHeight(), d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 923 | 923 | |
| 924 | 924 | //ゲームのロゴマーク描画 |
| 925 | 925 | d3dg->Draw2DTextureScaling(20, 25, gametitle, 480, 80, 1.0f); |
| @@ -931,7 +931,7 @@ | ||
| 931 | 931 | else{ |
| 932 | 932 | effect = 0.0f; |
| 933 | 933 | } |
| 934 | - d3dg->Draw2DBox(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, d3dg->GetColorCode(0.0f,0.0f,0.0f,effect)); | |
| 934 | + d3dg->Draw2DBox(0, 0, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), d3dg->GetColorCode(0.0f,0.0f,0.0f,effect)); | |
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | #ifdef ENABLE_MENUOPTIONS |
| @@ -1245,7 +1245,7 @@ | ||
| 1245 | 1245 | //Cancel |
| 1246 | 1246 | if( Options_p2LinkTextID == 2 ){ |
| 1247 | 1247 | //設定ファイル読み直す |
| 1248 | - if( GameConfig.LoadFile("config.dat") == 1 ){ | |
| 1248 | + if( GameConfig.LoadFile("config.dat", "config-openxops.ini") == 1 ){ | |
| 1249 | 1249 | //MainWindow.ErrorInfo("config data open failed"); |
| 1250 | 1250 | //return 1; |
| 1251 | 1251 | } |
| @@ -1638,9 +1638,9 @@ | ||
| 1638 | 1638 | |
| 1639 | 1639 | //固定文字表示 |
| 1640 | 1640 | d3dg->Draw2DTextureFontTextCenterScaling(0, 30, "BRIEFING", d3dg->GetColorCode(1.0f,1.0f,0.0f,effectA), 60, 42); |
| 1641 | - d3dg->Draw2DTextureFontText(SCREEN_WIDTH - 210 - effectB_sizeW*20/2, SCREEN_HEIGHT - 37 - effectB_sizeH/2, | |
| 1641 | + d3dg->Draw2DTextureFontText(GameConfig.GetScreenWidth() - 210 - effectB_sizeW*20/2, GameConfig.GetScreenHeight() - 37 - effectB_sizeH/2, | |
| 1642 | 1642 | "LEFT CLICK TO BEGIN", d3dg->GetColorCode(1.0f,1.0f,1.0f,effectB), effectB_sizeW, effectB_sizeH); |
| 1643 | - d3dg->Draw2DTextureFontText(SCREEN_WIDTH - 210 - 18*20/2, SCREEN_HEIGHT - 37 - 26/2, "LEFT CLICK TO BEGIN", d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 18, 26); | |
| 1643 | + d3dg->Draw2DTextureFontText(GameConfig.GetScreenWidth() - 210 - 18*20/2, GameConfig.GetScreenHeight() - 37 - 26/2, "LEFT CLICK TO BEGIN", d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 18, 26); | |
| 1644 | 1644 | |
| 1645 | 1645 | //ブリーフィング画像描画 |
| 1646 | 1646 | if( TwoTexture == false ){ |
| @@ -2810,43 +2810,43 @@ | ||
| 2810 | 2810 | |
| 2811 | 2811 | //レッドフラッシュ描画 |
| 2812 | 2812 | if( (redflash_flag == true)&&(Camera_Debugmode == false) ){ |
| 2813 | - d3dg->Draw2DBox(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 2813 | + d3dg->Draw2DBox(0, 0, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 2814 | 2814 | redflash_flag = false; |
| 2815 | 2815 | } |
| 2816 | 2816 | |
| 2817 | 2817 | //スコープ描画 |
| 2818 | 2818 | if( (Camera_F1mode == false)&&(Camera_Debugmode == false)&&(myHuman->GetScopeMode() != 0) ){ |
| 2819 | - if( ((float)SCREEN_WIDTH / SCREEN_HEIGHT) > 1.5f ){ | |
| 2820 | - int swidth = (int)((float)SCREEN_HEIGHT * 1.333f)+1; | |
| 2821 | - d3dg->Draw2DTexture((SCREEN_WIDTH-swidth)/2, 0, Resource.GetScopeTexture(), swidth, SCREEN_HEIGHT, 1.0f); | |
| 2822 | - d3dg->Draw2DBox(0, 0, (SCREEN_WIDTH-swidth)/2, SCREEN_HEIGHT, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2823 | - d3dg->Draw2DBox(SCREEN_WIDTH - (SCREEN_WIDTH-swidth)/2, 0, SCREEN_WIDTH, SCREEN_HEIGHT, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2819 | + if( ((float)GameConfig.GetScreenWidth() / GameConfig.GetScreenHeight()) > 1.5f ){ | |
| 2820 | + int swidth = (int)((float)GameConfig.GetScreenHeight() * 1.333f)+1; | |
| 2821 | + d3dg->Draw2DTexture((GameConfig.GetScreenWidth()-swidth)/2, 0, Resource.GetScopeTexture(), swidth, GameConfig.GetScreenHeight(), 1.0f); | |
| 2822 | + d3dg->Draw2DBox(0, 0, (GameConfig.GetScreenWidth()-swidth)/2, GameConfig.GetScreenHeight(), d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2823 | + d3dg->Draw2DBox(GameConfig.GetScreenWidth() - (GameConfig.GetScreenWidth()-swidth)/2, 0, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2824 | 2824 | } |
| 2825 | 2825 | else{ |
| 2826 | - d3dg->Draw2DTexture(0, 0, Resource.GetScopeTexture(), SCREEN_WIDTH, SCREEN_HEIGHT, 1.0f); | |
| 2826 | + d3dg->Draw2DTexture(0, 0, Resource.GetScopeTexture(), GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), 1.0f); | |
| 2827 | 2827 | } |
| 2828 | 2828 | |
| 2829 | 2829 | if( myHuman->GetScopeMode() == 1 ){ |
| 2830 | - d3dg->Draw2DLine(SCREEN_WIDTH/2-49, SCREEN_HEIGHT/2, SCREEN_WIDTH/2-4, SCREEN_HEIGHT/2, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2831 | - d3dg->Draw2DLine(SCREEN_WIDTH/2+4, SCREEN_HEIGHT/2, SCREEN_WIDTH/2+49, SCREEN_HEIGHT/2, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2832 | - d3dg->Draw2DLine(SCREEN_WIDTH/2, SCREEN_HEIGHT/2-49, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2833 | - d3dg->Draw2DLine(SCREEN_WIDTH/2, SCREEN_HEIGHT/2+4, SCREEN_WIDTH/2, SCREEN_HEIGHT/2+49, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2834 | - d3dg->Draw2DBox(SCREEN_WIDTH/2-50, SCREEN_HEIGHT/2-1, SCREEN_WIDTH/2+50, SCREEN_HEIGHT/2+1, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.5f)); | |
| 2835 | - d3dg->Draw2DBox(SCREEN_WIDTH/2-1, SCREEN_HEIGHT/2-50, SCREEN_WIDTH/2+1, SCREEN_HEIGHT/2+50, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.5f)); | |
| 2830 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2-49, GameConfig.GetScreenHeight()/2, GameConfig.GetScreenWidth()/2-4, GameConfig.GetScreenHeight()/2, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2831 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2+4, GameConfig.GetScreenHeight()/2, GameConfig.GetScreenWidth()/2+49, GameConfig.GetScreenHeight()/2, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2832 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight()/2-49, GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight()/2-4, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2833 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight()/2+4, GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight()/2+49, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2834 | + d3dg->Draw2DBox(GameConfig.GetScreenWidth()/2-50, GameConfig.GetScreenHeight()/2-1, GameConfig.GetScreenWidth()/2+50, GameConfig.GetScreenHeight()/2+1, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.5f)); | |
| 2835 | + d3dg->Draw2DBox(GameConfig.GetScreenWidth()/2-1, GameConfig.GetScreenHeight()/2-50, GameConfig.GetScreenWidth()/2+1, GameConfig.GetScreenHeight()/2+50, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.5f)); | |
| 2836 | 2836 | } |
| 2837 | 2837 | if( myHuman->GetScopeMode() == 2 ){ |
| 2838 | 2838 | int w; |
| 2839 | - if( ((float)SCREEN_WIDTH / SCREEN_HEIGHT) > 1.5f ){ | |
| 2840 | - int swidth = (int)((float)SCREEN_HEIGHT * 1.333f)+1; | |
| 2841 | - w = 140 + (SCREEN_WIDTH-swidth)/2; | |
| 2839 | + if( ((float)GameConfig.GetScreenWidth() / GameConfig.GetScreenHeight()) > 1.5f ){ | |
| 2840 | + int swidth = (int)((float)GameConfig.GetScreenHeight() * 1.333f)+1; | |
| 2841 | + w = 140 + (GameConfig.GetScreenWidth()-swidth)/2; | |
| 2842 | 2842 | } |
| 2843 | 2843 | else{ |
| 2844 | 2844 | w = 140; |
| 2845 | 2845 | } |
| 2846 | - d3dg->Draw2DLine(w, SCREEN_HEIGHT/2, SCREEN_WIDTH -w, SCREEN_HEIGHT/2, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2847 | - d3dg->Draw2DLine(SCREEN_WIDTH/2, 60, SCREEN_WIDTH/2, SCREEN_HEIGHT -60, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2848 | - d3dg->Draw2DBox(w, SCREEN_HEIGHT/2-1, SCREEN_WIDTH -w, SCREEN_HEIGHT/2+1, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.5f)); | |
| 2849 | - d3dg->Draw2DBox(SCREEN_WIDTH/2-1, 60, SCREEN_WIDTH/2+1, SCREEN_HEIGHT -60, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.5f)); | |
| 2846 | + d3dg->Draw2DLine(w, GameConfig.GetScreenHeight()/2, GameConfig.GetScreenWidth() -w, GameConfig.GetScreenHeight()/2, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2847 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2, 60, GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight() -60, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2848 | + d3dg->Draw2DBox(w, GameConfig.GetScreenHeight()/2-1, GameConfig.GetScreenWidth() -w, GameConfig.GetScreenHeight()/2+1, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.5f)); | |
| 2849 | + d3dg->Draw2DBox(GameConfig.GetScreenWidth()/2-1, 60, GameConfig.GetScreenWidth()/2+1, GameConfig.GetScreenHeight() -60, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.5f)); | |
| 2850 | 2850 | } |
| 2851 | 2851 | } |
| 2852 | 2852 |
| @@ -2863,22 +2863,22 @@ | ||
| 2863 | 2863 | |
| 2864 | 2864 | //上 |
| 2865 | 2865 | if( CollD.CheckALLBlockInside(camera_x + cos(camera_rx)*cos(camera_ry + addang) * adddist, camera_y + sin(camera_ry + addang) * adddist, camera_z + sin(camera_rx)*cos(camera_ry + addang) * adddist) == true ){ |
| 2866 | - d3dg->Draw2DBox(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT/2, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2866 | + d3dg->Draw2DBox(0, 0, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight()/2, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2867 | 2867 | } |
| 2868 | 2868 | |
| 2869 | 2869 | //下 |
| 2870 | 2870 | if( CollD.CheckALLBlockInside(camera_x + cos(camera_rx)*cos(camera_ry - addang) * adddist, camera_y + sin(camera_ry - addang) * adddist, camera_z + sin(camera_rx)*cos(camera_ry - addang) * adddist) == true ){ |
| 2871 | - d3dg->Draw2DBox(0, SCREEN_HEIGHT/2, SCREEN_WIDTH, SCREEN_HEIGHT, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2871 | + d3dg->Draw2DBox(0, GameConfig.GetScreenHeight()/2, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2872 | 2872 | } |
| 2873 | 2873 | |
| 2874 | 2874 | //左 |
| 2875 | 2875 | if( CollD.CheckALLBlockInside(camera_x + cos(camera_rx + addang)*cos(camera_ry) * adddist, camera_y + sin(camera_ry) * adddist, camera_z + sin(camera_rx + addang)*cos(camera_ry) * adddist) == true ){ |
| 2876 | - d3dg->Draw2DBox(0, 0, SCREEN_WIDTH/2, SCREEN_HEIGHT, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2876 | + d3dg->Draw2DBox(0, 0, GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight(), d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2877 | 2877 | } |
| 2878 | 2878 | |
| 2879 | 2879 | //右 |
| 2880 | 2880 | if( CollD.CheckALLBlockInside(camera_x + cos(camera_rx - addang)*cos(camera_ry) * adddist, camera_y + sin(camera_ry) * adddist, camera_z + sin(camera_rx - addang)*cos(camera_ry) * adddist) == true ){ |
| 2881 | - d3dg->Draw2DBox(SCREEN_WIDTH/2, 0, SCREEN_WIDTH, SCREEN_HEIGHT, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2881 | + d3dg->Draw2DBox(GameConfig.GetScreenWidth()/2, 0, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 2882 | 2882 | } |
| 2883 | 2883 | } |
| 2884 | 2884 |
| @@ -2911,8 +2911,8 @@ | ||
| 2911 | 2911 | //int speed = (int)(fps / (1000.0f/GAMEFRAMEMS) * 100); |
| 2912 | 2912 | //sprintf(str, "PROCESSING SPEED %d%%", speed); |
| 2913 | 2913 | sprintf(str, "fps:%.2f", fps); |
| 2914 | - d3dg->Draw2DTextureFontText(SCREEN_WIDTH - strlen(str)*10 - 5 +1, 5+1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 10, 14); | |
| 2915 | - d3dg->Draw2DTextureFontText(SCREEN_WIDTH - strlen(str)*10 - 5, 5, str, d3dg->GetColorCode(1.0f,0.5f,0.0f,1.0f), 10, 14); | |
| 2914 | + d3dg->Draw2DTextureFontText(GameConfig.GetScreenWidth() - strlen(str)*10 - 5 +1, 5+1, str, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f), 10, 14); | |
| 2915 | + d3dg->Draw2DTextureFontText(GameConfig.GetScreenWidth() - strlen(str)*10 - 5, 5, str, d3dg->GetColorCode(1.0f,0.5f,0.0f,1.0f), 10, 14); | |
| 2916 | 2916 | |
| 2917 | 2917 | //HUD表示・モードA |
| 2918 | 2918 | if( Camera_F2mode == 0 ){ |
| @@ -2920,17 +2920,17 @@ | ||
| 2920 | 2920 | //"ウエエエエエエオ" |
| 2921 | 2921 | stru[0] = 0xB3; stru[1] = 0xB4; stru[2] = 0xB4; stru[3] = 0xB4; stru[4] = 0xB4; |
| 2922 | 2922 | stru[5] = 0xB4; stru[6] = 0xB4; stru[7] = 0xB5; stru[8] = '\0'; |
| 2923 | - d3dg->Draw2DTextureFontText(15, SCREEN_HEIGHT - 105, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 2923 | + d3dg->Draw2DTextureFontText(15, GameConfig.GetScreenHeight() - 105, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 2924 | 2924 | //"テトトトトトトナ" |
| 2925 | 2925 | for(int i=0; stru[i] != 0x00; i++){ stru[i] += 0x10; } |
| 2926 | - d3dg->Draw2DTextureFontText(15, SCREEN_HEIGHT - 105 +32, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 2926 | + d3dg->Draw2DTextureFontText(15, GameConfig.GetScreenHeight() - 105 +32, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 2927 | 2927 | //"ウエエカキキキクケ" |
| 2928 | 2928 | stru[0] = 0xB3; stru[1] = 0xB4; stru[2] = 0xB4; stru[3] = 0xB6; stru[4] = 0xB7; |
| 2929 | 2929 | stru[5] = 0xB7; stru[6] = 0xB7; stru[7] = 0xB8; stru[8] = 0xB9; stru[9] = '\0'; |
| 2930 | - d3dg->Draw2DTextureFontText(15, SCREEN_HEIGHT - 55, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 2930 | + d3dg->Draw2DTextureFontText(15, GameConfig.GetScreenHeight() - 55, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 2931 | 2931 | //"テトトニヌヌヌネノ" |
| 2932 | 2932 | for(int i=0; stru[i] != 0x00; i++){ stru[i] += 0x10; } |
| 2933 | - d3dg->Draw2DTextureFontText(15, SCREEN_HEIGHT - 55 +32, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 2933 | + d3dg->Draw2DTextureFontText(15, GameConfig.GetScreenHeight() - 55 +32, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 2934 | 2934 | |
| 2935 | 2935 | //右下エリア用文字コード設定 |
| 2936 | 2936 | stru[0] = 0xB0;//'ー'; |
| @@ -2955,24 +2955,24 @@ | ||
| 2955 | 2955 | if( stru[i] == 'A' ){ stru[i] = 0xBB; } //'サ' |
| 2956 | 2956 | if( stru[i] == 'B' ){ stru[i] = 0xBA; } //'コ' |
| 2957 | 2957 | } |
| 2958 | - d3dg->Draw2DTextureFontText(25, SCREEN_HEIGHT - 96, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 23, 24); | |
| 2958 | + d3dg->Draw2DTextureFontText(25, GameConfig.GetScreenHeight() - 96, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 23, 24); | |
| 2959 | 2959 | |
| 2960 | 2960 | //HP表示 |
| 2961 | 2961 | if( hp >= 80 ){ |
| 2962 | - d3dg->Draw2DTextureFontText(23, SCREEN_HEIGHT - 45, "STATE", statecolor, 18, 24); | |
| 2963 | - d3dg->Draw2DTextureFontText(155, SCREEN_HEIGHT - 45, "FINE", statecolor, 18, 24); | |
| 2962 | + d3dg->Draw2DTextureFontText(23, GameConfig.GetScreenHeight() - 45, "STATE", statecolor, 18, 24); | |
| 2963 | + d3dg->Draw2DTextureFontText(155, GameConfig.GetScreenHeight() - 45, "FINE", statecolor, 18, 24); | |
| 2964 | 2964 | } |
| 2965 | 2965 | else if( hp >= 40 ){ |
| 2966 | - d3dg->Draw2DTextureFontText(23, SCREEN_HEIGHT - 45, "STATE", statecolor, 18, 24); | |
| 2967 | - d3dg->Draw2DTextureFontText(135, SCREEN_HEIGHT - 45, "CAUTION", statecolor, 18, 24); | |
| 2966 | + d3dg->Draw2DTextureFontText(23, GameConfig.GetScreenHeight() - 45, "STATE", statecolor, 18, 24); | |
| 2967 | + d3dg->Draw2DTextureFontText(135, GameConfig.GetScreenHeight() - 45, "CAUTION", statecolor, 18, 24); | |
| 2968 | 2968 | } |
| 2969 | 2969 | else if( hp > 0 ){ |
| 2970 | - d3dg->Draw2DTextureFontText(23, SCREEN_HEIGHT - 45, "STATE", statecolor, 18, 24); | |
| 2971 | - d3dg->Draw2DTextureFontText(140, SCREEN_HEIGHT - 45, "DANGER", statecolor, 18, 24); | |
| 2970 | + d3dg->Draw2DTextureFontText(23, GameConfig.GetScreenHeight() - 45, "STATE", statecolor, 18, 24); | |
| 2971 | + d3dg->Draw2DTextureFontText(140, GameConfig.GetScreenHeight() - 45, "DANGER", statecolor, 18, 24); | |
| 2972 | 2972 | } |
| 2973 | 2973 | else{ |
| 2974 | - d3dg->Draw2DTextureFontText(23, SCREEN_HEIGHT - 45, "STATE", statecolor, 18, 24); | |
| 2975 | - d3dg->Draw2DTextureFontText(155, SCREEN_HEIGHT - 45, "DEAD", statecolor, 18, 24); | |
| 2974 | + d3dg->Draw2DTextureFontText(23, GameConfig.GetScreenHeight() - 45, "STATE", statecolor, 18, 24); | |
| 2975 | + d3dg->Draw2DTextureFontText(155, GameConfig.GetScreenHeight() - 45, "DEAD", statecolor, 18, 24); | |
| 2976 | 2976 | } |
| 2977 | 2977 | |
| 2978 | 2978 | //武器名表示 |
| @@ -2982,14 +2982,14 @@ | ||
| 2982 | 2982 | //HUD表示・モードB |
| 2983 | 2983 | if( Camera_F2mode == 1 ){ |
| 2984 | 2984 | //画面周りの線 |
| 2985 | - d3dg->Draw2DLine(0, 0, SCREEN_WIDTH-1, 0, statecolor); | |
| 2986 | - d3dg->Draw2DLine(SCREEN_WIDTH-1, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, statecolor); | |
| 2987 | - d3dg->Draw2DLine(0, 0, 0, SCREEN_HEIGHT-1, statecolor); | |
| 2988 | - d3dg->Draw2DLine(0, SCREEN_HEIGHT-1, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, statecolor); | |
| 2985 | + d3dg->Draw2DLine(0, 0, GameConfig.GetScreenWidth()-1, 0, statecolor); | |
| 2986 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()-1, 0, GameConfig.GetScreenWidth()-1, GameConfig.GetScreenHeight()-1, statecolor); | |
| 2987 | + d3dg->Draw2DLine(0, 0, 0, GameConfig.GetScreenHeight()-1, statecolor); | |
| 2988 | + d3dg->Draw2DLine(0, GameConfig.GetScreenHeight()-1, GameConfig.GetScreenWidth()-1, GameConfig.GetScreenHeight()-1, statecolor); | |
| 2989 | 2989 | |
| 2990 | 2990 | //武器名表示 |
| 2991 | - d3dg->Draw2DBox(8, SCREEN_HEIGHT - 32, 227, SCREEN_HEIGHT - 7, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.3f)); | |
| 2992 | - d3dg->Draw2DTextureFontText(10, SCREEN_HEIGHT - 30, weaponname, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 16, 20); | |
| 2991 | + d3dg->Draw2DBox(8, GameConfig.GetScreenHeight() - 32, 227, GameConfig.GetScreenHeight() - 7, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.3f)); | |
| 2992 | + d3dg->Draw2DTextureFontText(10, GameConfig.GetScreenHeight() - 30, weaponname, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 16, 20); | |
| 2993 | 2993 | } |
| 2994 | 2994 | |
| 2995 | 2995 | //レーダー描画 |
| @@ -3004,8 +3004,8 @@ | ||
| 3004 | 3004 | float effectA = 1.0f; |
| 3005 | 3005 | if( message_cnt < (int)(0.2f*GAMEFPS) ){ effectA = GetEffectAlpha(message_cnt, 1.0f, 0.2f, 0.0f, false); } |
| 3006 | 3006 | if( (int)((TOTAL_EVENTENT_SHOWMESSEC-0.2f)*GAMEFPS) < message_cnt ){ effectA = GetEffectAlpha(message_cnt, 1.0f, 0.2f, (TOTAL_EVENTENT_SHOWMESSEC - 0.2f), true); } |
| 3007 | - d3dg->Draw2DMSFontTextCenterScaling(0 +1, 340 +1, SCREEN_WIDTH, 140, messtr, d3dg->GetColorCode(0.1f,0.1f,0.1f,effectA)); | |
| 3008 | - d3dg->Draw2DMSFontTextCenterScaling(0, 340, SCREEN_WIDTH, 140, messtr, d3dg->GetColorCode(1.0f,1.0f,1.0f,effectA)); | |
| 3007 | + d3dg->Draw2DMSFontTextCenterScaling(0 +1, 340 +1, GameConfig.GetScreenWidth(), 140, messtr, d3dg->GetColorCode(0.1f,0.1f,0.1f,effectA)); | |
| 3008 | + d3dg->Draw2DMSFontTextCenterScaling(0, 340, GameConfig.GetScreenWidth(), 140, messtr, d3dg->GetColorCode(1.0f,1.0f,1.0f,effectA)); | |
| 3009 | 3009 | } |
| 3010 | 3010 | |
| 3011 | 3011 | #ifdef ENABLE_DEBUGCONSOLE |
| @@ -3041,24 +3041,24 @@ | ||
| 3041 | 3041 | float alpha = 1.0f - (float)ErrorRange/40.0f; |
| 3042 | 3042 | if( alpha < 0.0f ){ alpha = 0.0f; } |
| 3043 | 3043 | |
| 3044 | - d3dg->Draw2DLine(SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2+4, d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 3045 | - d3dg->Draw2DLine(SCREEN_WIDTH/2-15, SCREEN_HEIGHT/2+15, SCREEN_WIDTH/2-19, SCREEN_HEIGHT/2+19, d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 3046 | - d3dg->Draw2DLine(SCREEN_WIDTH/2+15, SCREEN_HEIGHT/2+15, SCREEN_WIDTH/2+19, SCREEN_HEIGHT/2+19, d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 3047 | - d3dg->Draw2DLine(SCREEN_WIDTH/2-4, SCREEN_HEIGHT/2+4, SCREEN_WIDTH/2+4, SCREEN_HEIGHT/2+4, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 3044 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight()/2, GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight()/2+4, d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 3045 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2-15, GameConfig.GetScreenHeight()/2+15, GameConfig.GetScreenWidth()/2-19, GameConfig.GetScreenHeight()/2+19, d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 3046 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2+15, GameConfig.GetScreenHeight()/2+15, GameConfig.GetScreenWidth()/2+19, GameConfig.GetScreenHeight()/2+19, d3dg->GetColorCode(1.0f,0.0f,0.0f,0.5f)); | |
| 3047 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2-4, GameConfig.GetScreenHeight()/2+4, GameConfig.GetScreenWidth()/2+4, GameConfig.GetScreenHeight()/2+4, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 3048 | 3048 | |
| 3049 | - d3dg->Draw2DLine(SCREEN_WIDTH/2-4 - ErrorRange, SCREEN_HEIGHT/2-4 - ErrorRange/2, SCREEN_WIDTH/2-4 - ErrorRange, SCREEN_HEIGHT/2+4 + ErrorRange/2, d3dg->GetColorCode(1.0f,0.0f,0.0f,alpha)); | |
| 3050 | - d3dg->Draw2DLine(SCREEN_WIDTH/2+4 + ErrorRange, SCREEN_HEIGHT/2-4 - ErrorRange/2, SCREEN_WIDTH/2+4 + ErrorRange, SCREEN_HEIGHT/2+4 + ErrorRange/2, d3dg->GetColorCode(1.0f,0.0f,0.0f,alpha)); | |
| 3049 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2-4 - ErrorRange, GameConfig.GetScreenHeight()/2-4 - ErrorRange/2, GameConfig.GetScreenWidth()/2-4 - ErrorRange, GameConfig.GetScreenHeight()/2+4 + ErrorRange/2, d3dg->GetColorCode(1.0f,0.0f,0.0f,alpha)); | |
| 3050 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2+4 + ErrorRange, GameConfig.GetScreenHeight()/2-4 - ErrorRange/2, GameConfig.GetScreenWidth()/2+4 + ErrorRange, GameConfig.GetScreenHeight()/2+4 + ErrorRange/2, d3dg->GetColorCode(1.0f,0.0f,0.0f,alpha)); | |
| 3051 | 3051 | } |
| 3052 | 3052 | else{ //標準型 |
| 3053 | - d3dg->Draw2DLine(SCREEN_WIDTH/2-13, SCREEN_HEIGHT/2, SCREEN_WIDTH/2-3, SCREEN_HEIGHT/2, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 3054 | - d3dg->Draw2DLine(SCREEN_WIDTH/2+13, SCREEN_HEIGHT/2, SCREEN_WIDTH/2+3, SCREEN_HEIGHT/2, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 3055 | - d3dg->Draw2DLine(SCREEN_WIDTH/2, SCREEN_HEIGHT/2-13, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-3, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 3056 | - d3dg->Draw2DLine(SCREEN_WIDTH/2, SCREEN_HEIGHT/2+13, SCREEN_WIDTH/2, SCREEN_HEIGHT/2+3, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 3053 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2-13, GameConfig.GetScreenHeight()/2, GameConfig.GetScreenWidth()/2-3, GameConfig.GetScreenHeight()/2, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 3054 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2+13, GameConfig.GetScreenHeight()/2, GameConfig.GetScreenWidth()/2+3, GameConfig.GetScreenHeight()/2, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 3055 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight()/2-13, GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight()/2-3, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 3056 | + d3dg->Draw2DLine(GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight()/2+13, GameConfig.GetScreenWidth()/2, GameConfig.GetScreenHeight()/2+3, d3dg->GetColorCode(1.0f,0.0f,0.0f,1.0f)); | |
| 3057 | 3057 | |
| 3058 | 3058 | stru[0] = 0xBD; stru[1] = '\0'; //"ス" |
| 3059 | - d3dg->Draw2DTextureFontTextCenter(ErrorRange * -1, SCREEN_HEIGHT/2 - 16, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 3059 | + d3dg->Draw2DTextureFontTextCenter(ErrorRange * -1, GameConfig.GetScreenHeight()/2 - 16, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 3060 | 3060 | stru[0] = 0xBE; stru[1] = '\0'; //"セ" |
| 3061 | - d3dg->Draw2DTextureFontTextCenter(ErrorRange, SCREEN_HEIGHT/2 - 16, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 3061 | + d3dg->Draw2DTextureFontTextCenter(ErrorRange, GameConfig.GetScreenHeight()/2 - 16, (char*)stru, d3dg->GetColorCode(1.0f,1.0f,1.0f,0.5f), 32, 32); | |
| 3062 | 3062 | } |
| 3063 | 3063 | } |
| 3064 | 3064 | } |
| @@ -3166,7 +3166,7 @@ | ||
| 3166 | 3166 | else{ |
| 3167 | 3167 | effect = 0.0f; |
| 3168 | 3168 | } |
| 3169 | - d3dg->Draw2DBox(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, d3dg->GetColorCode(0.0f,0.0f,0.0f,effect)); | |
| 3169 | + d3dg->Draw2DBox(0, 0, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), d3dg->GetColorCode(0.0f,0.0f,0.0f,effect)); | |
| 3170 | 3170 | |
| 3171 | 3171 | //終了時の文字表示 |
| 3172 | 3172 | if( end_framecnt > 0 ){ |
| @@ -3246,7 +3246,7 @@ | ||
| 3246 | 3246 | void maingame::RenderRadar() |
| 3247 | 3247 | { |
| 3248 | 3248 | int RadarSize = 200; //レーダーの描画サイズ |
| 3249 | - int RadarPosX = SCREEN_WIDTH - RadarSize - 10; //レーダーの描画 X座標(左上基準) | |
| 3249 | + int RadarPosX = GameConfig.GetScreenWidth() - RadarSize - 10; //レーダーの描画 X座標(左上基準) | |
| 3250 | 3250 | int RadarPosY = 110; //レーダーの描画 Y座標(左上基準) |
| 3251 | 3251 | float RadarWorldR = 300.0f; //レーダーにポイントする距離 |
| 3252 | 3252 |
| @@ -4516,7 +4516,7 @@ | ||
| 4516 | 4516 | void maingame::RenderConsole() |
| 4517 | 4517 | { |
| 4518 | 4518 | //下地 |
| 4519 | - d3dg->Draw2DBox(0, 0, SCREEN_WIDTH, (MAX_CONSOLELINES+1)*17 + 5 + 5, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.75f)); | |
| 4519 | + d3dg->Draw2DBox(0, 0, GameConfig.GetScreenWidth(), (MAX_CONSOLELINES+1)*17 + 5 + 5, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.75f)); | |
| 4520 | 4520 | |
| 4521 | 4521 | //表示中の文字 |
| 4522 | 4522 | for(int i=0; i<MAX_CONSOLELINES; i++){ |
| @@ -32,10 +32,10 @@ | ||
| 32 | 32 | #ifndef GAMEMAIN_H |
| 33 | 33 | #define GAMEMAIN_H |
| 34 | 34 | |
| 35 | -#define MAINMENU_X (SCREEN_WIDTH - 360) //!< メニューの表示 X座標(左上基準) | |
| 36 | -#define MAINMENU_Y (SCREEN_HEIGHT - 340) //!< メニューの表示 Y座標(〃) | |
| 37 | -#define TOTAL_MENUITEMS 8 //!< メニュー1画面に表示するミッション数 | |
| 38 | -#define MAINMENU_H (TOTAL_MENUITEMS+2)*30 + 25 //!< メニューの表示サイズ・高さ | |
| 35 | +#define MAINMENU_X (GameConfig.GetScreenWidth() - 360) //!< メニューの表示 X座標(左上基準) | |
| 36 | +#define MAINMENU_Y (GameConfig.GetScreenHeight() - 340) //!< メニューの表示 Y座標(〃) | |
| 37 | +#define TOTAL_MENUITEMS 8 //!< メニュー1画面に表示するミッション数 | |
| 38 | +#define MAINMENU_H (TOTAL_MENUITEMS+2)*30 + 25 //!< メニューの表示サイズ・高さ | |
| 39 | 39 | #define MAINMENU_OPTION_X 10 //!< メニューの表示 オプション項目リンクのX座標(左上基準) |
| 40 | 40 | #define MAINMENU_OPTION_Y (MAINMENU_Y+MAINMENU_H - 16) //!< メニューの表示 オプション項目リンクのY座標(〃) |
| 41 | 41 |
| @@ -42,10 +42,10 @@ | ||
| 42 | 42 | #define INPUT_ARROWKEYS_ANGLE DegreeToRadian(4) //!< 方向キーでの回転角度 |
| 43 | 43 | #define INPUT_F1NUMKEYS_ANGLE DegreeToRadian(2) //!< 三人称視点でのテンキーの回転角度 |
| 44 | 44 | |
| 45 | -#define HUDA_WEAPON_POSX (SCREEN_WIDTH - 255) //!< 武器情報を描画する領域・X座標 | |
| 46 | -#define HUDA_WEAPON_POSY (SCREEN_HEIGHT - 98) //!< 武器情報を描画する領域・Y座標 | |
| 47 | -#define HUDA_WEAPON_SIZEW 8 //!< 武器情報を描画する領域・横サイズ(32ピクセルの配置個数) | |
| 48 | -#define HUDA_WEAPON_SIZEH 3 //!< 武器情報を描画する領域・縦サイズ(32ピクセルの配置個数) | |
| 45 | +#define HUDA_WEAPON_POSX (GameConfig.GetScreenWidth() - 255) //!< 武器情報を描画する領域・X座標 | |
| 46 | +#define HUDA_WEAPON_POSY (GameConfig.GetScreenHeight() - 98) //!< 武器情報を描画する領域・Y座標 | |
| 47 | +#define HUDA_WEAPON_SIZEW 8 //!< 武器情報を描画する領域・横サイズ(32ピクセルの配置個数) | |
| 48 | +#define HUDA_WEAPON_SIZEH 3 //!< 武器情報を描画する領域・縦サイズ(32ピクセルの配置個数) | |
| 49 | 49 | |
| 50 | 50 | #define VIEW_HEIGHT 19.0f //!< 視点の高さ |
| 51 | 51 | #define VIEW_DIST 0.1f //!< 中心から視点までの距離 |
| @@ -69,21 +69,21 @@ | ||
| 69 | 69 | #include "main.h" |
| 70 | 70 | |
| 71 | 71 | #ifdef ENABLE_MENUOPTIONS |
| 72 | - #define OPTIONS_P1_W 340 //!< オプション画面 No.1 幅 | |
| 73 | - #define OPTIONS_P1_H (30*6) //!< オプション画面 No.1 高さ | |
| 74 | - #define OPTIONS_P1_X (SCREEN_WIDTH - 360) //!< オプション画面 No.1 X座標 | |
| 75 | - #define OPTIONS_P1_Y (MAINMENU_Y+MAINMENU_H - OPTIONS_P1_H - 24) //!< オプション画面 No.1 Y座標 | |
| 76 | - #define OPTIONS_P1_DATAS 3 //!< オプション画面 No.1 リンクテキストの数 | |
| 77 | - #define OPTIONS_P2_W 600 //!< オプション画面 No.2 幅 | |
| 78 | - #define OPTIONS_P2_H 360 //!< オプション画面 No.2 高さ | |
| 79 | - #define OPTIONS_P2_X ((SCREEN_WIDTH - OPTIONS_P2_W)/2) //!< オプション画面 No.2 X座標 | |
| 80 | - #define OPTIONS_P2_Y (105 + (SCREEN_HEIGHT-105 - OPTIONS_P2_H)/2) //!< オプション画面 No.2 Y座標 | |
| 81 | - #define OPTIONS_P2_DATAS 32 //!< オプション画面 No.2 リンクテキストの数 | |
| 82 | - #define OPTIONS_P3_W 600 //!< オプション画面 No.3 幅 | |
| 83 | - #define OPTIONS_P3_H 320 //!< オプション画面 No.3 高さ | |
| 84 | - #define OPTIONS_P3_X ((SCREEN_WIDTH - OPTIONS_P3_W)/2) //!< オプション画面 No.3 X座標 | |
| 85 | - #define OPTIONS_P3_Y (105 + (SCREEN_HEIGHT-105 - OPTIONS_P3_H)/2) //!< オプション画面 No.3 Y座標 | |
| 86 | - #define OPTIONS_P3_DATAS 1 //!< オプション画面 No.3 リンクテキストの数 | |
| 72 | + #define OPTIONS_P1_W 340 //!< オプション画面 No.1 幅 | |
| 73 | + #define OPTIONS_P1_H (30*6) //!< オプション画面 No.1 高さ | |
| 74 | + #define OPTIONS_P1_X (GameConfig.GetScreenWidth() - 360) //!< オプション画面 No.1 X座標 | |
| 75 | + #define OPTIONS_P1_Y (MAINMENU_Y+MAINMENU_H - OPTIONS_P1_H - 24) //!< オプション画面 No.1 Y座標 | |
| 76 | + #define OPTIONS_P1_DATAS 3 //!< オプション画面 No.1 リンクテキストの数 | |
| 77 | + #define OPTIONS_P2_W 600 //!< オプション画面 No.2 幅 | |
| 78 | + #define OPTIONS_P2_H 360 //!< オプション画面 No.2 高さ | |
| 79 | + #define OPTIONS_P2_X ((GameConfig.GetScreenWidth() - OPTIONS_P2_W)/2) //!< オプション画面 No.2 X座標 | |
| 80 | + #define OPTIONS_P2_Y (105 + (GameConfig.GetScreenHeight()-105 - OPTIONS_P2_H)/2) //!< オプション画面 No.2 Y座標 | |
| 81 | + #define OPTIONS_P2_DATAS 32 //!< オプション画面 No.2 リンクテキストの数 | |
| 82 | + #define OPTIONS_P3_W 600 //!< オプション画面 No.3 幅 | |
| 83 | + #define OPTIONS_P3_H 320 //!< オプション画面 No.3 高さ | |
| 84 | + #define OPTIONS_P3_X ((GameConfig.GetScreenWidth() - OPTIONS_P3_W)/2) //!< オプション画面 No.3 X座標 | |
| 85 | + #define OPTIONS_P3_Y (105 + (GameConfig.GetScreenHeight()-105 - OPTIONS_P3_H)/2) //!< オプション画面 No.3 Y座標 | |
| 86 | + #define OPTIONS_P3_DATAS 1 //!< オプション画面 No.3 リンクテキストの数 | |
| 87 | 87 | #if (GRAPHIC_ENGINE == 0)||(GRAPHIC_ENGINE == 1) |
| 88 | 88 | #define OPTIONS_LICENSELINE 26 //!< ライセンス文の行数 |
| 89 | 89 | #elif GRAPHIC_ENGINE == 8 |
| @@ -391,8 +391,8 @@ | ||
| 391 | 391 | POINT point; |
| 392 | 392 | |
| 393 | 393 | //ウィンドウ座標の中央を求める |
| 394 | - point.x = SCREEN_WIDTH/2; | |
| 395 | - point.y = SCREEN_HEIGHT/2; | |
| 394 | + point.x = GameConfig.GetScreenWidth()/2; | |
| 395 | + point.y = GameConfig.GetScreenHeight()/2; | |
| 396 | 396 | |
| 397 | 397 | #if INPUT_INTERFACE == 0 |
| 398 | 398 | //前回の座標を書き換え |
| @@ -169,7 +169,7 @@ | ||
| 169 | 169 | #endif |
| 170 | 170 | |
| 171 | 171 | //設定ファイル読み込み |
| 172 | - if( GameConfig.LoadFile("config.dat") == 1 ){ | |
| 172 | + if( GameConfig.LoadFile("config.dat", "config-openxops.ini") == 1 ){ | |
| 173 | 173 | #ifndef ENABLE_AUTOCREATECONFIG |
| 174 | 174 | MainWindow.ErrorInfo("config data open failed"); |
| 175 | 175 | return 1; |
| @@ -185,7 +185,7 @@ | ||
| 185 | 185 | |
| 186 | 186 | #ifdef ENABLE_DEBUGLOG |
| 187 | 187 | //ログに出力 |
| 188 | - sprintf(infostr, "解像度:%d x %d", SCREEN_WIDTH, SCREEN_HEIGHT); | |
| 188 | + sprintf(infostr, "解像度:%d x %d", GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight()); | |
| 189 | 189 | OutputLog.WriteLog(LOG_CHECK, "環境", infostr); |
| 190 | 190 | if( GameConfig.GetFullscreenFlag() == false ){ |
| 191 | 191 | OutputLog.WriteLog(LOG_CHECK, "環境", "ウィンドウモード:ウィンドウ"); |
| @@ -197,7 +197,7 @@ | ||
| 197 | 197 | |
| 198 | 198 | //ウィンドウ初期化 |
| 199 | 199 | MainWindow.SetParam(hPrevInstance, nCmdShow); |
| 200 | - MainWindow.InitWindow(GAMENAME, SCREEN_WIDTH, SCREEN_HEIGHT, GameConfig.GetFullscreenFlag()); | |
| 200 | + MainWindow.InitWindow(GAMENAME, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), GameConfig.GetFullscreenFlag()); | |
| 201 | 201 | |
| 202 | 202 | //基本的な初期化処理 |
| 203 | 203 | #ifdef ENABLE_AUTOLOADMIF |
| @@ -46,12 +46,12 @@ | ||
| 46 | 46 | #pragma warning(disable:4996) //VC++警告防止 |
| 47 | 47 | |
| 48 | 48 | //定数 |
| 49 | -#define GAMENAME "OpenXOPS" //!< ゲーム名 | |
| 50 | -#define GAMEVERSION "1.055p" //!< ゲームのバージョン | |
| 51 | -#define GAMEFRAMEMS 30 //!< フレームあたりの処理時間(ms) | |
| 49 | +#define GAMENAME "OpenXOPS" //!< ゲーム名 | |
| 50 | +#define GAMEVERSION "1.055p" //!< ゲームのバージョン | |
| 51 | +#define GAMEFRAMEMS 30 //!< フレームあたりの処理時間(ms) | |
| 52 | 52 | #define GAMEFPS (1000.0f/GAMEFRAMEMS) //!< FPS(フレームレート) 1000 / 30 = 33.333[FPS] |
| 53 | -#define SCREEN_WIDTH 640 //!< スクリーンの幅 | |
| 54 | -#define SCREEN_HEIGHT 480 //!< スクリーンの高さ | |
| 53 | +#define DEFAULT_SCREEN_WIDTH 640 //!< スクリーンの幅 | |
| 54 | +#define DEFAULT_SCREEN_HEIGHT 480 //!< スクリーンの高さ | |
| 55 | 55 | |
| 56 | 56 | #define MAX_ADDONLIST 128 //!< ADDONを読み込む最大数 |
| 57 | 57 |
| @@ -75,6 +75,7 @@ | ||
| 75 | 75 | //#define ENABLE_AUTOCREATECONFIG //!< config.datが見つからない場合、同ファイルを自動生成する。 |
| 76 | 76 | //#define ENABLE_PATH_DELIMITER_SLASH //!< パス区切り文字を、'\'から‘/’へ変換する。 |
| 77 | 77 | #define ENABLE_AUTOLOADMIF //!< .mifが引数に指定された場合、自動的にロードする(コメント化で機能無効) |
| 78 | +#define ENABLE_ADDCONFIG //!< iniファイルによる追加設定を取得する(コメント化で機能無効) | |
| 78 | 79 | |
| 79 | 80 | //windows.hを使用しないならば |
| 80 | 81 | #ifndef _MAX_PATH |
| @@ -95,10 +95,10 @@ | ||
| 95 | 95 | { |
| 96 | 96 | if( d3dg->StartRender() ){ return true; } |
| 97 | 97 | |
| 98 | - d3dg->Draw2DBox(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 98 | + d3dg->Draw2DBox(0, 0, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), d3dg->GetColorCode(0.0f,0.0f,0.0f,1.0f)); | |
| 99 | 99 | d3dg->Draw2DTextureFontText(10, 10, "hello world !", d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 20, 32); |
| 100 | 100 | |
| 101 | - d3dg->ScreenBrightness(SCREEN_WIDTH, SCREEN_HEIGHT, GameConfig.GetBrightness()); | |
| 101 | + d3dg->ScreenBrightness(GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), GameConfig.GetBrightness()); | |
| 102 | 102 | |
| 103 | 103 | return d3dg->EndRender(); |
| 104 | 104 | } |
| @@ -194,12 +194,12 @@ | ||
| 194 | 194 | { |
| 195 | 195 | if( d3dg->StartRender() ){ return true; } |
| 196 | 196 | |
| 197 | - d3dg->Draw2DTexture(0, 0, gametitle, SCREEN_WIDTH, SCREEN_HEIGHT, 0.4f); | |
| 198 | - d3dg->Draw2DBox(11, 11, SCREEN_WIDTH - 10, SCREEN_HEIGHT - 10, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.75f)); | |
| 197 | + d3dg->Draw2DTexture(0, 0, gametitle, GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), 0.4f); | |
| 198 | + d3dg->Draw2DBox(11, 11, GameConfig.GetScreenWidth() - 10, GameConfig.GetScreenHeight() - 10, d3dg->GetColorCode(0.0f,0.0f,0.0f,0.75f)); | |
| 199 | 199 | |
| 200 | 200 | Render2D(); |
| 201 | 201 | |
| 202 | - d3dg->ScreenBrightness(SCREEN_WIDTH, SCREEN_HEIGHT, GameConfig.GetBrightness()); | |
| 202 | + d3dg->ScreenBrightness(GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), GameConfig.GetBrightness()); | |
| 203 | 203 | |
| 204 | 204 | return d3dg->EndRender(); |
| 205 | 205 | } |
| @@ -259,7 +259,7 @@ | ||
| 259 | 259 | Render3D(); |
| 260 | 260 | Render2D(); |
| 261 | 261 | |
| 262 | - d3dg->ScreenBrightness(SCREEN_WIDTH, SCREEN_HEIGHT, GameConfig.GetBrightness()); | |
| 262 | + d3dg->ScreenBrightness(GameConfig.GetScreenWidth(), GameConfig.GetScreenHeight(), GameConfig.GetBrightness()); | |
| 263 | 263 | |
| 264 | 264 | return d3dg->EndRender(); |
| 265 | 265 | } |
| \ No newline at end of file |