changeset 2061:b2a434d65344

GAME_SETTINGS_* defines introduced DEBUG_SETTINGS_* defines introduced
author Nomad
date Mon, 02 Dec 2013 15:13:49 +0200
parents 72177f3603da
children 74f06d8a8017 259df09dfb50
files Game.cpp Indoor.cpp OSWindow.cpp OSWindow.h Outdoor.cpp Player.cpp Render.cpp SaveLoad.cpp UI/UIHouses.cpp UI/UIMainMenu.cpp UI/UIPartyCreation.cpp VideoPlayer.cpp _deleted.cpp mm7_2.cpp mm7_3.cpp mm7_data.cpp mm7_data.h
diffstat 17 files changed, 112 insertions(+), 197 deletions(-) [+]
line wrap: on
line diff
--- a/Game.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/Game.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -304,7 +304,6 @@
   if (bLoading)
   {
     pParty->Reset();
-    dword_6BE340 = 0;
     uGameState = GAME_STATE_PLAYING;
     LoadGame(uLoadGameUI_SelectedSlot);
   }
@@ -333,8 +332,7 @@
     }
     DoPrepareWorld(bLoading, 1);
     pEventTimer->Resume();
-    dword_6BE364_game_settings_1 |= 0x80;
-    dword_6BE340 = 2;
+    dword_6BE364_game_settings_1 |= GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME;
     // uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
     pCurrentScreen = SCREEN_GAME;
 
@@ -351,7 +349,7 @@
         TranslateMessage(&Msg);
         DispatchMessageA(&Msg);
       }
-      if (dword_6BE364_game_settings_1 & 0x0100 )
+      if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
       {
         WaitMessage();
         continue;
@@ -382,10 +380,9 @@
       {
         if ( !pEventTimer->bTackGameTime )
           _494035_timed_effects__water_walking_damage__etc();
-        if ( dword_6BE364_game_settings_1 & 1 )
-        {
-          dword_6BE364_game_settings_1 &= 0xFFFFFFFEu;
-        }
+
+        if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0001)
+          dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0001;
         else
         {
           UpdateActorAI();
@@ -547,7 +544,6 @@
     }
     while (!game_finished);
 
-    dword_6BE340 = 0;
     pEventTimer->Pause();
     ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
     if ( uGameState == GAME_STATE_LOADING_GAME )
@@ -754,7 +750,6 @@
     WriteWindowsRegistryInt("window X", window->GetX());
     WriteWindowsRegistryInt("window Y", window->GetY());
   }
-  window->Delete();
   WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
   pItemsTable->Release();
   pNPCStats->Release();
@@ -3049,7 +3044,7 @@
           sub_42FBDD();
           SaveGame(1, 0);
           strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename);
-          dword_6BE364_game_settings_1 |= 1;
+          dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
           uGameState = GAME_STATE_2;
           //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C];
           v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related;
@@ -3157,7 +3152,7 @@
               SaveGame(1, 0);
               OnMapLeave();
               strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]);
-              dword_6BE364_game_settings_1 |= 1;
+              dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
               uGameState = GAME_STATE_2;
               _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X;
               _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y;
@@ -3238,7 +3233,7 @@
                   {
                     SaveGame(1, 0);
                     OnMapLeave();
-                    dword_6BE364_game_settings_1 |= 1;
+                    dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
                     uGameState = GAME_STATE_2;
                     strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename);
                     dword_5B65C0 = 1;
@@ -3421,7 +3416,7 @@
               if ( (signed int)pNPCData3 < (signed int)pNPCData4 )
               {
                 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]);
-                dword_6BE364_game_settings_1 |= 1u;
+                dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
                 uGameState = GAME_STATE_2;
                 OnMapLeave();
                 continue;
@@ -4608,7 +4603,7 @@
             ModalWindow_Release();
             break;
           }
-          if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) )
+          if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_4000))
             break;
           v15 = 1;
           pVideoPlayer->bStopBeforeSchedule = 1;
--- a/Indoor.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/Indoor.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -2138,8 +2138,8 @@
     }
   }
 
-  if (dword_6BE364_game_settings_1 & 0x2000 )
-    _i = 29030400;
+  if (dword_6BE364_game_settings_1 & GAME_SETTINGS_2000 )
+    _i = 0x1BAF800;
   bool _a = false;
   if ( a3 - dlv.uLastRepawnDay >= _i && _stricmp(pCurrentMapName, "d29.dlv") )
     _a = true;
@@ -3697,12 +3697,12 @@
     Error("Attempt to open new level before clearing old");
   if ( v6 == 1 )
     Error("Out of memory loading indoor level");
-  if ( !(dword_6BE364_game_settings_1 & 0x2000) )
+  if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) )
   {
     InitializeActors();
     InitializeSpriteObjects();
   }
-  BYTE1(dword_6BE364_game_settings_1) &= 0xDFu;
+  dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000;
   if ( !v39 )
     pDest = 0;
   if ( pDest == 1 )
--- 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
--- a/OSWindow.h	Mon Dec 02 17:00:58 2013 +0600
+++ b/OSWindow.h	Mon Dec 02 15:13:49 2013 +0200
@@ -6,7 +6,6 @@
 {
   public:
     static OSWindow *Create(const wchar_t *title, int window_width, int window_height);
-    void Delete();
 
     void SetFullscreenMode();
     void SetWindowedMode(int new_window_width, int new_window_height);
@@ -40,14 +39,11 @@
 
   protected:
     bool Initialize(const wchar_t *title, int window_width, int window_height);
-	void Deinitialize();
-	bool SetColorDepth(int bit);
     bool WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result);
 
     HWND    api_handle;
 
   private:
-    bool ChangedColorDepth;
     static LPARAM __stdcall WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
 
     HMENU CreateDebugMenuPanel();
--- a/Outdoor.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/Outdoor.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -2112,8 +2112,8 @@
     }
   }
 
-  if ( BYTE1(dword_6BE364_game_settings_1) & 0x20 )
-    pNumItems = 29030400;
+  if (dword_6BE364_game_settings_1 & GAME_SETTINGS_2000)
+    pNumItems = 0x1BAF800;
   if ( Str2 )
   {
     memset(Dst, 0, 0x3C8u);
--- a/Player.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/Player.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -7349,7 +7349,7 @@
       case 5: damageType = 4; //yes, the original just assigned the value 4
         break;   
     }
-    if ( !(dword_6BE368_debug_settings_2 & 0x10) )
+    if ( !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE) )
     {
       dmgToReceive = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType);
       if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime > 0 )
@@ -7386,7 +7386,7 @@
           }
         }
       }
-      if ( !(dword_6BE368_debug_settings_2 & 0x10)
+      if ( !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE)
         && actorPtr->pMonsterInfo.uSpecialAttackType
         && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackLevel )
       {
@@ -7541,7 +7541,7 @@
           damageType = 4;
           break;
       }
-      if ( !(dword_6BE368_debug_settings_2 & 0x10) )
+      if ( !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE) )
       {
         int reflectedDmg = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType);
         if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime > 0 )
@@ -7580,7 +7580,7 @@
         }
       }
       if ( !dmgSource
-        && !(dword_6BE368_debug_settings_2 & 0x10)
+        && !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE)
         && actorPtr->pMonsterInfo.uSpecialAttackType
         && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackLevel )
       {
--- a/Render.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/Render.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -8273,19 +8273,19 @@
   const char *v8; // [sp-4h] [bp-28h]@33
   struct tagRECT Rect; // [sp+14h] [bp-10h]@15
 
-  if ( !pRenderer->bWindowMode && (dword_6BE364_game_settings_1 & 2) )
+  /*if ( !pRenderer->bWindowMode && (dword_6BE364_game_settings_1 & 2) )
   {
     ModalWindow(pGlobalTXT_LocalizationStrings[62], UIMSG_0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window."
     return;
-  }
+  }*/
   if ( pRenderer->bWindowMode || !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible )
   {
     if ( pEventTimer->bPaused )
-      BYTE1(dword_6BE364_game_settings_1) |= 8u;
+      dword_6BE364_game_settings_1 |= GAME_SETTINGS_0800;
     else
       pEventTimer->Pause();
     if ( pMiscTimer->bPaused )
-      BYTE1(dword_6BE364_game_settings_1) |= 0x10u;
+      dword_6BE364_game_settings_1 |= GAME_SETTINGS_1000;
     else
       pMiscTimer->Pause();
     pMouse->bActive = 0;
@@ -8370,18 +8370,16 @@
     pMouse->bActive = true;
     if ( pVideoPlayer->AnyMovieLoaded() )
       pVideoPlayer->SelectMovieType();
-    if (dword_6BE364_game_settings_1 & 0x0800 )
-      BYTE1(dword_6BE364_game_settings_1) &= 0xF7u;
+    if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0800)
+      dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0800;
     else
       pEventTimer->Resume();
-    if ( BYTE1(dword_6BE364_game_settings_1) & 0x10 )
-      BYTE1(dword_6BE364_game_settings_1) &= 0xEFu;
+    if (dword_6BE364_game_settings_1 & GAME_SETTINGS_1000)
+      dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_1000;
     else
       pMiscTimer->Resume();
   }
 }
-// 6BE364: using guessed type int dword_6BE364_game_settings_1;
-// A74C88: using guessed type int dword_A74C88;
 
 
 //----- (004524D8) --------------------------------------------------------
--- a/SaveLoad.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/SaveLoad.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -213,7 +213,7 @@
     Error("Unable to find: %s!", header.pLocationName);
 
   strcpy(pCurrentMapName, header.pLocationName);
-  dword_6BE364_game_settings_1 |= 0x2001;
+  dword_6BE364_game_settings_1 |= GAME_SETTINGS_2000 | GAME_SETTINGS_0001;
 
   for (uint i = 0; i < uNumSavegameFiles; ++i)
     pSavegameThumbnails[i].Release();
--- a/UI/UIHouses.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/UI/UIHouses.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -1544,7 +1544,7 @@
           SaveGame(1, 0);
           strcpy(pCurrentMapName, pMapStats->pInfos[pTravel->uMapInfoID].pFilename);
 
-          dword_6BE364_game_settings_1 |= 1u;
+          dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
           _5B65B8_npcdata_hiword_house_or_other = 0;
           dword_5B65BC = 0;
           _5B65B4_npcdata_loword_house_or_other = pTravel->arrival_rot_y;
--- a/UI/UIMainMenu.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/UI/UIMainMenu.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -270,7 +270,7 @@
       TranslateMessage(&Msg);
       DispatchMessageA(&Msg);
     }
-    if ( BYTE1(dword_6BE364_game_settings_1) & 1 )
+    if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
     {
       WaitMessage();
     }
@@ -302,50 +302,3 @@
   cred_texture.Release();
   return MENU_MAIN;     // return MENU_Main
 }
-/*MENU_STATE MainMenuUI_Credits_Loop()//NewTitle
-{
-  MSG Msg;
-  GUIWindow credit_window;
-  RGBTexture mm6title_texture;
-
-  if ( pMessageQueue_50CBD0->uNumMessages )
-    pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-  ++pIcons_LOD->uTexturePacksCount;
-  if ( !pIcons_LOD->uNumPrevLoadedFiles )
-    pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-
-  //pAudioPlayer->PlayMusicTrack(MUSIC_Credits);
-
-  mm6title_texture.Load("newtitle.pcx", 0);
-  pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0);
-  pCurrentScreen = SCREEN_CREATORS;
-  SetCurrentMenuID(MENU_CREDITSPROC);
-
-  do
-  {
-    while ( PeekMessageA(&Msg, 0, 0, 0, 1) )
-    {
-      if ( Msg.message == 18 )
-        Game_DeinitializeAndTerminate(0);
-      TranslateMessage(&Msg);
-      DispatchMessageA(&Msg);
-    }
-    if ( BYTE1(dword_6BE364_game_settings_1) & 1 )
-    {
-      WaitMessage();
-    }
-    else
-    {
-      pRenderer->BeginScene();
-      pRenderer->DrawTextureRGB(0, 0, &mm6title_texture);
-      pRenderer->EndScene();
-      pRenderer->Present();
-      pCurrentScreen = SCREEN_GAME;
-      GUI_MainMenuMessageProc();
-    }
-  }
-  while ( GetCurrentMenuID() == MENU_CREDITSPROC );
-  //pAudioPlayer->_4AA258(1);
-  mm6title_texture.Release();
-  return MENU_MAIN;     // return MENU_Main
-}*/
\ No newline at end of file
--- a/UI/UIPartyCreation.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/UI/UIPartyCreation.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -583,7 +583,7 @@
       TranslateMessage(&Msg);
       DispatchMessageA(&Msg);
     }
-    if ( BYTE1(dword_6BE364_game_settings_1) & 1 )
+    if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
     {
       WaitMessage();
     }
--- a/VideoPlayer.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/VideoPlayer.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -362,7 +362,7 @@
 
   v4 = a2;
   pName = pMovieName;
-  if ( !(dword_6BE364_game_settings_1 & 0x44) )
+  if ( !(dword_6BE364_game_settings_1 & (GAME_SETTINGS_NO_HOUSE_ANIM | GAME_SETTINGS_NO_INTRO)) )
   {
     if ( a2 == 2 )
       v4 = 0;
--- a/_deleted.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/_deleted.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -13629,7 +13629,7 @@
     case WM_ACTIVATEAPP:
       if ( wParam && (GetForegroundWindow() == hWnd || 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 )
@@ -13641,7 +13641,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 )
           {
@@ -13649,12 +13649,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();
 
@@ -13672,7 +13672,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 )
@@ -13682,13 +13682,13 @@
           if (pRenderer->uAcquiredDirect3DDevice == 1)
             SetWindowPos(hWnd, (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();
 
--- a/mm7_2.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/mm7_2.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -695,7 +695,7 @@
 }
 
 //----- (004BF91E) --------------------------------------------------------
-unsigned int  GameOverMenu(void *ecx0)
+unsigned int GameOverMenu(void *ecx0)
 {
   const char *v1; // eax@2
   unsigned int result; // eax@3
@@ -725,7 +725,7 @@
   RGBTexture _this; // [sp+Ch] [bp-C4h]@1
   //RGBTexture::RGBTexture(&this);
 
-  BYTE1(dword_6BE364_game_settings_1) &= 0xBFu;
+  dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_4000;
   bGameoverLoop = 1;
   pVideoPlayer->bStopBeforeSchedule = 0;
   pAudioPlayer->StopChannels(-1, -1);
@@ -810,7 +810,7 @@
   pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf.data(), 3u);
   sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23);
   pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight, 1u, pTmpBuf.data(), 3u);
-  BYTE1(dword_6BE364_game_settings_1) |= 0x40u;
+  dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
   pRenderer->EndScene();
   pRenderer->Present();
   if ( pRenderer->pRenderD3D )
@@ -2982,9 +2982,9 @@
 
   pGameLoadingUI_ProgressBar->Progress();
 
-  if ( dword_6BE368_debug_settings_2 & 4 )
+  if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_ACTORS)
     uNumActors = 0;
-  if ( dword_6BE368_debug_settings_2 & 8 )
+  if ( dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DECORATIONS)
     uNumLevelDecorations = 0;
   init_event_triggers();
 
@@ -3068,19 +3068,20 @@
       pWindow = pGUIWindow_CurrentMenu;
     }
 
-    for (MSG msg; PeekMessage(&msg, 0, 0, 0, PM_REMOVE);)
+    for (MSG msg; PeekMessageW(&msg, 0, 0, 0, PM_REMOVE);)
     {
       if (msg.message == WM_QUIT)
         Game_DeinitializeAndTerminate(0);
       TranslateMessage(&msg);
-      DispatchMessage(&msg);
+      DispatchMessageW(&msg);
     }
-    if (dword_6BE364_game_settings_1 & 0x0100)
+
+    if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
     {
       WaitMessage();
+      continue;
     }
-    else
-    {
+
       pRenderer->BeginScene();
       pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
 
@@ -3136,7 +3137,6 @@
       }
       pRenderer->EndScene();
       pRenderer->Present();
-    }
   }
   GUI_MainMenuMessageProc();
   pRenderer->BeginScene();
@@ -3987,7 +3987,7 @@
 
 
   
-  if (dword_6BE364_game_settings_1 & 2 || !(dword_6BE368_debug_settings_2 & 1))// 
+  if (dword_6BE364_game_settings_1 & 2 || !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_RUN_IN_WIDOW))// 
                                                 //   color depth != 16
                                                 // or
                                                 //   not in window
@@ -4034,7 +4034,7 @@
   pVideoPlayer = new VideoPlayer();
   pVideoPlayer->Initialize(window);
 
-  dword_6BE364_game_settings_1 |= 0x4000;
+  dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
 
     switch ( uTurnSpeed )
     {
@@ -4324,10 +4324,10 @@
   bool bNoMargareth = false;
   if (pCmdLine && *pCmdLine)
   {
-    if (wcsstr(pCmdLine, L"-usedefs"))
-      bDebugResouces = 1;
+    //if (wcsstr(pCmdLine, L"-usedefs"))
+    //  bDebugResouces = 1;
     if (wcsstr(pCmdLine, L"-window"))
-      dword_6BE368_debug_settings_2 |= 1u;
+      dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW;
 
     if (wcsstr(pCmdLine, L"-nointro"))
       bNoIntro = true;//dword_6BE364_game_settings_1 |= 4;
@@ -4341,7 +4341,7 @@
       bWalkSound = false;//dword_6BE364_game_settings_1 |= 0x20;
     if (wcsstr(pCmdLine, L"-novideo"))
     {
-      dword_6BE364_game_settings_1 |= 0x40;
+      dword_6BE364_game_settings_1 |= GAME_SETTINGS_NO_HOUSE_ANIM;
       bNoVideo = true;
     }
     if (wcsstr(pCmdLine, L"-nocd"))
@@ -4375,7 +4375,7 @@
     SetUserInterface(PartyAlignment_Neutral, false);
     ShowIntroVideo_and_LoadingScreen();
     WriteWindowsRegistryInt("Ran once", 1);
-    dword_6BE364_game_settings_1 |= 0x4000;
+    dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
     pGame->InitializeGammaController();
     SecondaryInitialization();
     pRenderer->SetRasterClipRect(0, 0, 639, 479);
@@ -4543,19 +4543,19 @@
 
 
   if (GetPrivateProfileIntW(L"debug", L"nomonster", 0, pIniFilename))
-    dword_6BE368_debug_settings_2 |= 4;
+    dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_ACTORS;
   if (bUseRegistry)
     v1 = ReadWindowsRegistryInt("startinwindow", 0);
   else
     v1 = GetPrivateProfileIntW(L"debug", L"startinwindow", 0, pIniFilename);
   if (v1)
-    dword_6BE368_debug_settings_2 |= 1;
+    dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW;
   if (GetPrivateProfileIntW(L"debug", L"showFR", 0, pIniFilename))
-    dword_6BE368_debug_settings_2 |= 2;
+    dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_0002_SHOW_FR;
   if (GetPrivateProfileIntW(L"debug", L"nodamage", 0, pIniFilename))
-    dword_6BE368_debug_settings_2 |= 0x10;
+    dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_DAMAGE;
   if (GetPrivateProfileIntW(L"debug", L"nodecoration", 0, pIniFilename))
-    dword_6BE368_debug_settings_2 |= 8;
+    dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_DECORATIONS;
 
   wchar_t pStartingMapNameW[1024];
   GetPrivateProfileStringW(L"file", L"startmap", L"out01.odm", pStartingMapNameW, 0x20u, pIniFilename);
@@ -4990,19 +4990,18 @@
 //----- (0046BDC0) --------------------------------------------------------
 void  UpdateUserInput_and_MapSpecificStuff()
 {
-  if ( dword_6BE364_game_settings_1 & 0x80 )
+  if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME)
   {
-    LOBYTE(dword_6BE364_game_settings_1) = dword_6BE364_game_settings_1 & 0x7F;
+    dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME;
+    return;
   }
-  else
-  {
+
     if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
       BLV_UpdateUserInputAndOther();
     else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
         ODM_UpdateUserInputAndOther();
 
     area_of_effect__damage_evaluate();
-  }
 }
 
 //----- (0046BFFA) --------------------------------------------------------
--- a/mm7_3.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/mm7_3.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -3820,12 +3820,12 @@
     (unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1,
     v3,
     (int)&thisa);
-  if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x20) )
+  if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) )
   {
     InitializeActors();
     InitializeSpriteObjects();
   }
-  BYTE1(dword_6BE364_game_settings_1) &= 0xDFu;
+  dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000;
   //v5 = 0;
   if ( !v2 )
     thisa = 0;
--- a/mm7_data.cpp	Mon Dec 02 17:00:58 2013 +0600
+++ b/mm7_data.cpp	Mon Dec 02 15:13:49 2013 +0200
@@ -1191,11 +1191,10 @@
 float flt_6BE150_look_up_down_dangle = 1.0f; // weak
 //HWND hWnd; // idb
 class OSWindow *window = nullptr;
-int dword_6BE340; // weak
 char pCurrentMapName[32]; // idb
 unsigned int uLevelMapStatsID;
-int dword_6BE364_game_settings_1 = 0; // weak
-int dword_6BE368_debug_settings_2 = 0; // weak
+int dword_6BE364_game_settings_1 = 0;
+int dword_6BE368_debug_settings_2 = 0;
 unsigned __int8 bUseLoResSprites = false;
 unsigned __int8 bUseRegistry = true;
 unsigned __int8 bCanLoadFromCD = false;
@@ -1215,7 +1214,6 @@
 int _702AC0_unused = 0; // weak
 int _702AC4_unused = 0; // weak
 char _702ACC_unused = 0; // weak
-int bDebugResouces; // weak
 unsigned int bNoVideo = false;
 bool bNoIntro = false;
 bool bNoLogo = false;
--- a/mm7_data.h	Mon Dec 02 17:00:58 2013 +0600
+++ b/mm7_data.h	Mon Dec 02 15:13:49 2013 +0200
@@ -840,11 +840,34 @@
 //extern char *pCmdLine;
 //extern HWND hWnd; // idb
 extern class OSWindow *window;
-extern int dword_6BE340; // weak
 extern char pCurrentMapName[32]; // idb
 extern unsigned int uLevelMapStatsID;
-extern int dword_6BE364_game_settings_1; // weak
-extern int dword_6BE368_debug_settings_2; // weak
+
+
+#define GAME_SETTINGS_0001                            0x0001
+#define GAME_SETTINGS_INVALID_RESOLUTION              0x0002
+#define GAME_SETTINGS_NO_INTRO                        0x0004
+#define GAME_SETTINGS_NO_LOGO                         0x0008
+#define GAME_SETTINGS_NO_SOUND                        0x0010
+#define GAME_SETTINGS_NO_WALK_SOUND                   0x0020
+#define GAME_SETTINGS_NO_HOUSE_ANIM                   0x0040
+#define GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME 0x0080
+#define GAME_SETTINGS_APP_INACTIVE                    0x0100
+#define GAME_SETTINGS_0200_EVENT_TIMER                0x0200
+#define GAME_SETTINGS_0400_MISC_TIMER                 0x0400
+#define GAME_SETTINGS_0800                            0x0800
+#define GAME_SETTINGS_1000                            0x1000
+#define GAME_SETTINGS_2000                            0x2000
+#define GAME_SETTINGS_4000                            0x4000
+extern int dword_6BE364_game_settings_1;  // GAME_SETTINGS_*
+
+#define DEBUG_SETTINGS_RUN_IN_WIDOW     0x0001
+#define DEBUG_SETTINGS_0002_SHOW_FR     0x0002
+#define DEBUG_SETTINGS_NO_ACTORS        0x0004
+#define DEBUG_SETTINGS_NO_DECORATIONS   0x0008
+#define DEBUG_SETTINGS_NO_DAMAGE        0x0010
+extern int dword_6BE368_debug_settings_2; // DEBUG_SETTINGS_*
+
 extern unsigned __int8 bUseLoResSprites;
 extern unsigned __int8 bUseRegistry;
 extern unsigned __int8 bCanLoadFromCD;
@@ -864,7 +887,6 @@
 extern int _702AC0_unused; // weak
 extern int _702AC4_unused; // weak
 extern char _702ACC_unused; // weak
-extern int bDebugResouces; // weak
 extern unsigned int bNoVideo;
 extern bool bNoIntro;
 extern bool bNoLogo;