Mercurial > mm7
diff OSWindow.cpp @ 2061:b2a434d65344
GAME_SETTINGS_* defines introduced
DEBUG_SETTINGS_* defines introduced
author | Nomad |
---|---|
date | Mon, 02 Dec 2013 15:13:49 +0200 |
parents | 71a814f4482a |
children | 259df09dfb50 |
line wrap: on
line diff
--- a/OSWindow.cpp Mon Dec 02 17:00:58 2013 +0600 +++ b/OSWindow.cpp Mon Dec 02 15:13:49 2013 +0200 @@ -269,7 +269,7 @@ case WM_ACTIVATEAPP: if ( wparam && (GetForegroundWindow() == api_handle || GetForegroundWindow() == hInsertCDWindow) ) { - if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) + if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) { dword_4E98BC_bApplicationActive = 1; if ( pRenderer->bWindowMode ) @@ -281,7 +281,7 @@ if (bitsPerPixel != 16 || planes != 1) Error(pGlobalTXT_LocalizationStrings[62]); } - BYTE1(dword_6BE364_game_settings_1) &= 0xFEu; + dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_APP_INACTIVE; if ( pArcomageGame->bGameInProgress ) { @@ -289,12 +289,12 @@ } else { - if ( BYTE1(dword_6BE364_game_settings_1) & 2 ) - BYTE1(dword_6BE364_game_settings_1) &= 0xFDu; + if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0200_EVENT_TIMER) + dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0200_EVENT_TIMER; else pEventTimer->Resume(); - if ( BYTE1(dword_6BE364_game_settings_1) & 4 ) - BYTE1(dword_6BE364_game_settings_1) &= 0xFBu; + if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0400_MISC_TIMER) + dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0400_MISC_TIMER; else pMiscTimer->Resume(); @@ -312,7 +312,7 @@ } else { - if (!(dword_6BE364_game_settings_1 & 0x100)) + if (!(dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)) { dword_4E98BC_bApplicationActive = 0; if ( (pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) && pVideoPlayer->bPlayingMovie ) @@ -321,13 +321,13 @@ if (/*pRenderer->bUserDirect3D && */pRenderer->uAcquiredDirect3DDevice == 1) SetWindowPos(api_handle, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); ClipCursor(0); - dword_6BE364_game_settings_1 |= 0x100u; + dword_6BE364_game_settings_1 |= GAME_SETTINGS_APP_INACTIVE; if ( pEventTimer->bPaused ) - BYTE1(dword_6BE364_game_settings_1) |= 2u; + dword_6BE364_game_settings_1 |= GAME_SETTINGS_0200_EVENT_TIMER; else pEventTimer->Pause(); if ( pMiscTimer->bPaused ) - BYTE1(dword_6BE364_game_settings_1) |= 4u; + dword_6BE364_game_settings_1 |= GAME_SETTINGS_0400_MISC_TIMER; else pMiscTimer->Pause(); @@ -401,8 +401,7 @@ if (!RegisterClassExW(&wcxw)) return false; - api_handle = CreateWindowExW(0, wcxw.lpszClassName, title, - 0, + api_handle = CreateWindowExW(0, wcxw.lpszClassName, title, 0, 0, 0, window_width, window_height, nullptr, nullptr, wcxw.hInstance, this); if (!api_handle) @@ -411,15 +410,6 @@ return false; } - HDC hDC = GetDC(NULL); - int bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL); - int planes = GetDeviceCaps(hDC, PLANES); - ReleaseDC(NULL, hDC); - if (bitsPerPixel != 16 || planes != 1) - { - SetColorDepth(16); - } - SetWindowedMode(window_width, window_height); Show(); @@ -440,7 +430,7 @@ OSWindow *OSWindow::Create(const wchar_t *title, int window_width, int window_height) { - OSWindow* window = new OSWindow; + auto window = new OSWindow; if (window) if (!window->Initialize(title, window_width, window_height)) { @@ -800,39 +790,3 @@ return true; } - -bool OSWindow::SetColorDepth(int bit) -{ - DEVMODE dm; - if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm)) - { - Log::Warning(L"EnumDisplaySettings failed: %d\n", GetLastError()); - return false; - } - - dm.dmSize = sizeof(DEVMODE); - dm.dmBitsPerPel = bit; - dm.dmFields = DM_BITSPERPEL; - if (ChangeDisplaySettings(&dm, CDS_TEST) != DISP_CHANGE_SUCCESSFUL) - { - Log::Warning(L"Illegal graphics mode: %d\n", GetLastError()); - return false; - } - if (ChangeDisplaySettings(&dm, 0) == DISP_CHANGE_SUCCESSFUL) - { - ChangedColorDepth = true; - } -} - -void OSWindow::Delete() -{ - Deinitialize(); -} - -void OSWindow::Deinitialize() -{ - if( ChangedColorDepth ) - { - SetColorDepth(32); - } -} \ No newline at end of file