changeset 962:0423c40d7e88

UpdateWindows and pWindow->Release
author Ritor1
date Tue, 07 May 2013 17:32:23 +0600
parents 5a12082c803d
children 99ee5e590b16 96f7beed452f
files GUIWindow.cpp GUIWindow.h UIRest.cpp mm7_5.cpp
diffstat 4 files changed, 453 insertions(+), 289 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Mon May 06 17:33:40 2013 +0600
+++ b/GUIWindow.cpp	Tue May 07 17:32:23 2013 +0600
@@ -404,7 +404,7 @@
   {
     v12 = pVisibleWindowsIdxs[this->numVisibleWindows + 1];
     pVisibleWindowsIdxs[this->numVisibleWindows] = v12;
-    --*((int *)&pTexture_PCX.field_18 + 21 * v12);
+    --pWindowList[v12 - 1].numVisibleWindows;
     ++this->numVisibleWindows;
   }
   pVisibleWindowsIdxs[uNumVisibleWindows] = 0;
@@ -1720,7 +1720,7 @@
   unsigned int uNextFreeWindowID; // ebp@1
   //int *v8; // eax@1
   //GUIWindow *pWindow; // esi@4
-  int v10; // eax@4
+  //int v10; // eax@4
   unsigned int v11; // ebx@15
   NPCData *speakingNPC; // ebp@15
   int v14; // eax@20
@@ -1749,9 +1749,9 @@
   pWindow->uFrameW = uY + uHeight - 1;
   pWindow->ptr_1C = (void *)pButton;
   pWindow->Hint = (char *)a5;
-  v10 = uNumVisibleWindows;
+  //v10 = uNumVisibleWindows;
   pWindow->uFrameX = uX;
-  ++v10;
+  //++v10;
   pWindow->uFrameY = uY;
   pWindow->uFrameHeight = uHeight;
   pWindow->eWindowType = eWindowType;
--- a/GUIWindow.h	Mon May 06 17:33:40 2013 +0600
+++ b/GUIWindow.h	Tue May 07 17:32:23 2013 +0600
@@ -275,16 +275,16 @@
   WINDOW_CastSpell = 27,
   WINDOW_Scroll = 0x1E,
   WINDOW_CastSpell_InInventory = 31,
-  WINDOW_FinalWindow = 0x46,
-  WINDOW_50 = 0x50,
-  WINDOW_59 = 0x59,
-  WINDOW_Button = 90,
-  WINDOW_CharactersButton = 91,
-  WINDOW_VoiceSwitcherButton = 92,
-  WINDOW_5D = 0x5D,
+  WINDOW_FinalWindow = 70,
+  WINDOW_50 = 80,
+  WINDOW_59 = 89,
+  WINDOW_PressedButton2 = 90,
+  WINDOW_CharactersPressedButton = 91,
+  WINDOW_PressedButton = 92,
+  WINDOW_5D = 93,
   WINDOW_SaveLoadBtn = 94,
-  WINDOW_LoadGame_CancelBtn = 0x5F,
-  WINDOW_ExitRestWindow = 96,
+  WINDOW_LoadGame_CancelBtn = 95,
+  WINDOW_CloseRestWindowBtn = 96,
   WINDOW_ExitCharacterWindow = 97,
   WINDOW_RestWindow = 0x62,
   WINDOW_BooksWindow = 99,
--- a/UIRest.cpp	Mon May 06 17:33:40 2013 +0600
+++ b/UIRest.cpp	Tue May 07 17:32:23 2013 +0600
@@ -60,15 +60,12 @@
         }
     pEventTimer->Pause();
     if ( dword_506F14 != 2 )
-        GUIWindow::Create(518u, 450u, 0, 0, WINDOW_Button, (int)pBtn_Rest, 0);
+        GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0);
     _506F18_num_hours_to_sleep = 0;
     dword_506F14 = 0;
     uRestUI_FoodRequiredToRest = 2;
     if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-        uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(
-        pParty->vPosition.x,
-        pParty->vPosition.y,
-        pParty->vPosition.z);
+        uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
     if ( PartyHasDragon() )
         {
         v0 = pParty->pPlayers;//[0].uClass;
@@ -223,7 +220,7 @@
             }
         else
         {
-          GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_ExitRestWindow,
+          GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn,
            (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);
         }
     }
\ No newline at end of file
--- a/mm7_5.cpp	Mon May 06 17:33:40 2013 +0600
+++ b/mm7_5.cpp	Tue May 07 17:32:23 2013 +0600
@@ -448,16 +448,16 @@
           --pSaveListPosition;
           if ( pSaveListPosition < 0 )
             pSaveListPosition = 0;
-          GUIWindow::Create(215, 199, 17, 17, WINDOW_Button, (int)pBtnArrowUp, 0);
+          GUIWindow::Create(215, 199, 17, 17, WINDOW_PressedButton2, (int)pBtnArrowUp, 0);
           continue;
         case UIMSG_DownArrow:
           ++pSaveListPosition;
           if ( pSaveListPosition >= uMessageParam )
             pSaveListPosition = uMessageParam - 1;
-          GUIWindow::Create(215, 323, 17, 17, WINDOW_Button, (int)pBtnDownArrow, 0);
+          GUIWindow::Create(215, 323, 17, 17, WINDOW_PressedButton2, (int)pBtnDownArrow, 0);
           continue;
         case UIMSG_Cancel:
-          GUIWindow::Create(350, 302, 106, 42, WINDOW_ExitRestWindow, (int)pBtnCancel, 0);
+          GUIWindow::Create(350, 302, 106, 42, WINDOW_CloseRestWindowBtn, (int)pBtnCancel, 0);
           continue;
         case UIMSG_SaveLoadBtn:
           GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0);
@@ -742,7 +742,7 @@
             }
             v19 = (double)(signed int)uGammaPos * 0.1 + 0.6;
             pGame->pGammaController->Initialize(v19);
-            GUIWindow::Create(21, 161, 0, 0, WINDOW_Button, (int)pBtn_SliderLeft, v0);
+            GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0);
             pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0);
             continue;
           }
@@ -753,7 +753,7 @@
             {
               v21 = (double)(signed int)uGammaPos * 0.1 + 0.6;
               pGame->pGammaController->Initialize(v21);
-              GUIWindow::Create(213, 161, 0, 0, WINDOW_Button, (int)pBtn_SliderRight, v0);
+              GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v0);
               pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0);
               continue;
             }
@@ -782,7 +782,7 @@
             --uMusicVolimeMultiplier;
             if ( (char)uMusicVolimeMultiplier < 1 )
               uMusicVolimeMultiplier = 0;
-            GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_Button, (int)pBtn_SliderLeft, v0);
+            GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0);
             if ( uMusicVolimeMultiplier )
               pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0);
             pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f);
@@ -793,7 +793,7 @@
             ++uMusicVolimeMultiplier;
             if ( (char)uMusicVolimeMultiplier > 9 )
               uMusicVolimeMultiplier = 9;
-            GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_Button, (int)pBtn_SliderRight, v0);
+            GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v0);
             if ( uMusicVolimeMultiplier )
               pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0);
             pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f);
@@ -812,7 +812,7 @@
             --uSoundVolumeMultiplier;
             if ( (char)uSoundVolumeMultiplier < 1 )
               uSoundVolumeMultiplier = 0;
-            GUIWindow::Create(243, 162, 0, 0, WINDOW_Button, (int)pBtn_SliderLeft, v0);
+            GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0);
             pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
             pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0);
             continue;
@@ -825,7 +825,7 @@
             v168 = v0;
             v24 = 435;
             //v154 = (int)pBtn_SliderRight;
-            GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_Button, (int)pBtn_SliderRight, v168);
+            GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v168);
             pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
             pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0);
             continue;
@@ -854,7 +854,7 @@
             --uVoicesVolumeMultiplier;
             if ( (char)uVoicesVolumeMultiplier < 1 )
               uVoicesVolumeMultiplier = 0;
-            GUIWindow::Create(243, 270, 0, 0, WINDOW_Button, (int)pBtn_SliderLeft, v0);
+            GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0);
             if ( !uVoicesVolumeMultiplier )
               continue;
             pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
@@ -865,7 +865,7 @@
             ++uVoicesVolumeMultiplier;
             if ( (char)uVoicesVolumeMultiplier > 8 )
               uVoicesVolumeMultiplier = 9;
-            GUIWindow::Create(435, 270, 0, 0, WINDOW_Button, (int)pBtn_SliderRight, v0);
+            GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v0);
             if ( !uVoicesVolumeMultiplier )
               continue;
             pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
@@ -1468,7 +1468,7 @@
             if ( !pGUIWindow_Settings )//Draw Menu
             {
               dword_6BE138 = -1;
-              GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_Button, (int)pBtn_GameSettings, v0);
+              GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, v0);
               pEventTimer->Pause();
               pAudioPlayer->StopChannels(-1, -1);
               ++pIcons_LOD->uTexturePacksCount;
@@ -1523,7 +1523,7 @@
         case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel
           if ( uMessageParam )
           {
-            GUIWindow::Create(626, 179, 0, 0, WINDOW_Button, (int)pBtn_NPCRight, 0);
+            GUIWindow::Create(626, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCRight, 0);
             v37 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + (unsigned __int8)pParty->field_70A - 2;
             if ( (unsigned __int8)pParty->field_709 < v37 )
             {
@@ -1534,7 +1534,7 @@
           }
           else
           {
-            GUIWindow::Create(469, 179, 0, 0, WINDOW_Button, (int)pBtn_NPCLeft, 0);
+            GUIWindow::Create(469, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCLeft, 0);
             if ( pParty->field_709 )
             {
               --pParty->field_709;
@@ -2475,7 +2475,7 @@
             _42ECB5_PlayerAttacksActor();
           continue;
         case UIMSG_ExitRest:
-          GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_ExitRestWindow, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest"
+          GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest"
           continue;
         case UIMSG_Wait5Minutes:
           if ( dword_506F14 == 2 )
@@ -2484,7 +2484,7 @@
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             continue;
           }
-          GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_Button,
+          GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2,
             (int)pButton_RestUI_Wait5Minutes, (int)pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes"
           dword_506F14 = v0;
           _506F18_num_hours_to_sleep = 5;
@@ -2496,7 +2496,7 @@
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             continue;
           }
-          GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_Button,
+          GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2,
             (int)pButton_RestUI_Wait1Hour, (int)pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour"
           dword_506F14 = v0;
           _506F18_num_hours_to_sleep = 60;
@@ -2642,7 +2642,7 @@
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             continue;
           }
-          GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_Button,
+          GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2,
             (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn"
           v97 = _494820_training_time(pParty->uCurrentHour);
           dword_506F14 = v0;
@@ -2686,7 +2686,7 @@
           v0 = 1;
           continue;
         case UIMSG_ClickInstallRemoveQuickSpellBtn:
-          GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_Button, (int)pBtn_InstallRemoveSpell, 0);
+          GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0);
           if ( !uActiveCharacter )
             continue;
           pPlayer10 = pPlayers[uActiveCharacter];
@@ -2822,7 +2822,7 @@
               if ( !pCurrentScreen )
                 //goto LABEL_693;
               {
-                GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_Button, (int)pBtn_CastSpell, 0);
+                GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
                 pCurrentScreen = SCREEN_SPELL_BOOK;
                 pEventTimer->Pause();
                 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0);
@@ -2836,7 +2836,7 @@
                  || pCurrentScreen > SCREEN_67) )
               {
                 pGUIWindow_CurrentMenu->Release();
-                GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_Button, (int)pBtn_CastSpell, 0);
+                GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
                 pCurrentScreen = SCREEN_SPELL_BOOK;
                 pEventTimer->Pause();
                 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0);
@@ -2855,7 +2855,7 @@
           ++pIcons_LOD->uTexturePacksCount;
           if ( !pIcons_LOD->uNumPrevLoadedFiles )
             pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-          GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_Button, (int)pBtn_QuickReference, 0);
+          GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0);
           viewparams->bRedrawGameUI = v0;
           pEventTimer->Pause();
           pAudioPlayer->StopChannels(-1, -1);
@@ -2879,7 +2879,7 @@
           pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117);
           free((void *)uNumSeconds);
           stru_506E40._40E55E("gamma.pcx", 0);
-          GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0);
+          GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton, (int)pBtn_GameSettings, 0);
 //LABEL_453:
           /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
             continue;
@@ -2896,11 +2896,11 @@
             dword_50651C = -1;
           continue;
         case UIMSG_ClickAwardsUpBtn:
-          GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersButton, (int)pBtn_Up, 0);
+          GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0);
           dword_506548 = v0;
           continue;
         case UIMSG_ClickAwardsDownBtn:
-          GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersButton, (int)pBtn_Down, 0);
+          GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0);
           dword_506544 = v0;
           continue;
         case UIMSG_ChangeDetaliz:
@@ -2934,14 +2934,14 @@
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
           sub_4196A0();
           sub_419379();
-          GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersButton, (int)pCharacterScreen_StatsBtn, 0);
+          GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0);
           continue;
         case UIMSG_ClickSkillsBtn:
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101;
           sub_4196A0();
           sub_419379();
           CharacterUI_SkillScreen_Draw();
-          GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersButton, (int)pCharacterScreen_SkillsBtn, 0);
+          GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0);
           continue;
         case UIMSG_SkillUp:
           pPlayer4 = pPlayers[uActiveCharacter];
@@ -2970,7 +2970,7 @@
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
           sub_419379();
           sub_4196A0();
-          GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersButton, (int)pCharacterScreen_InventoryBtn, 0);
+          GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0);
           continue;
         case UIMSG_ClickExitCharacterWindowBtn:
           GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0);
@@ -2980,7 +2980,7 @@
           sub_4196A0();
           sub_419220();
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102;
-          GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersButton, (int)pCharacterScreen_AwardsBtn, 0);
+          GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0);
           FillAwardsData();
           continue;
         case UIMSG_AutonotesBook:
@@ -3035,7 +3035,7 @@
               dword_50652C = v0;
               break;
           }
-          GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, v0);
+          GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, v0);
           continue;
         case UIMSG_SelectCharacter:
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -3183,7 +3183,7 @@
           if ( pCurrentScreen )
             continue;
           pParty->uFlags |= 2u;
-          GUIWindow::Create(0x207u, 0x88u, 0, 0, WINDOW_Button, (int)pBtn_ZoomOut, 0);
+          GUIWindow::Create(0x207u, 0x88u, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0);
           uNumSeconds = 131072;
           v118 = 2 * viewparams->uMinimapZoom;
           ++viewparams->field_28;
@@ -3213,7 +3213,7 @@
           if ( pCurrentScreen )
             continue;
           pParty->uFlags |= 2u;
-          GUIWindow::Create(0x23Eu, 0x88u, 0, 0, WINDOW_Button, (int)pBtn_ZoomIn, 0);
+          GUIWindow::Create(0x23Eu, 0x88u, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0);
           uNumSeconds = 32768;
           v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16;
           --viewparams->field_28;
@@ -3356,19 +3356,19 @@
       switch (pUIMessageType) // For buttons of window MainMenu
       {
         case UIMSG_MainMenu_ShowPartyCreationWnd:
-          GUIWindow::Create(495, 172, 0, 0, WINDOW_Button, (int)pMainMenu_BtnNew, 0);
+          GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0);
           SetCurrentMenuID(MENU_NEWGAME);
           break;
         case UIMSG_MainMenu_ShowLoadWindow:
-          GUIWindow::Create(495, 227, 0, 0, WINDOW_Button, (int)pMainMenu_BtnLoad, 0);
+          GUIWindow::Create(495, 227, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnLoad, 0);
           SetCurrentMenuID(MENU_SAVELOAD);
           break;
         case UIMSG_ShowCredits:
-          GUIWindow::Create(495, 282, 0, 0, WINDOW_Button, (int)pMainMenu_BtnCredits, 0);
+          GUIWindow::Create(495, 282, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnCredits, 0);
           SetCurrentMenuID(MENU_CREDITS);
           break;
         case UIMSG_ExitToWindows:
-          GUIWindow::Create(495, 337, 0, 0, WINDOW_Button, (int)pMainMenu_BtnExit, 0);
+          GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0);
           SetCurrentMenuID(MENU_FINISHED);
           break;
         case UIMSG_PlayerCreation_SelectAttribute:
@@ -3386,7 +3386,7 @@
           }
           while (player->GetSexByVoice() != sex);
           pButton = pCreationUI_BtnPressLeft2[uNum];
-          GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1);
+          GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1);
           pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
           player->PlaySound(SPEECH_PickMe, 0);
           break;
@@ -3400,7 +3400,7 @@
             }
             while (player->GetSexByVoice() != sex);
             pButton = pCreationUI_BtnPressRight2[uNum];
-            GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pButton, 1);
+            GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1);
             pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
             player->PlaySound(SPEECH_PickMe, 0);
             break;
@@ -3419,7 +3419,7 @@
           pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
                                                     % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
           uPlayerCreationUI_SelectedCharacter = v25;
-          GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressLeft[v25], 1);
+          GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], 1);
           //v0 = pAudioPlayer;
           pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0);
           pPlayer->PlaySound(SPEECH_PickMe, 0);
@@ -3437,19 +3437,19 @@
           pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
                                                     % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
           uPlayerCreationUI_SelectedCharacter = v21;
-          GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_VoiceSwitcherButton, (int)pCreationUI_BtnPressRight[v21], 1);
+          GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], 1);
           //v0 = pAudioPlayer;
           pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
           pPlayer->PlaySound(SPEECH_PickMe, 0);
           //v1 = (char *)pParty->pPlayers;
           break;
         case UIMSG_PlayerCreationClickPlus:
-          GUIWindow::Create(613, 393, 0, 0, WINDOW_Button, (int)pPlayerCreationUI_BtnPlus, 1);
+          GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, 1);
           pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
           pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0);
           break;
         case UIMSG_PlayerCreationClickMinus:
-          GUIWindow::Create(523, 393, 0, 0, WINDOW_Button, (int)pPlayerCreationUI_BtnMinus, 1);
+          GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, 1);
           pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
           pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0);
           break;
@@ -3467,14 +3467,14 @@
           pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
           break;
         case UIMSG_PlayerCreationClickOK:
-          GUIWindow::Create(580, 431, 0, 0, WINDOW_Button, (int)pPlayerCreationUI_BtnOK, 0);
+          GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0);
           if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() )
             GameUI_Footer_TimeLeft = GetTickCount() + 4000;
           else
             uGameState = 6;
           break;
         case UIMSG_PlayerCreationClickReset:
-          GUIWindow::Create(527, 431, 0, 0, WINDOW_Button, (int)pPlayerCreationUI_BtnReset, 0);
+          GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0);
           pParty->Reset();
           break;
         case UIMSG_PlayerCreationRemoveUpSkill:
@@ -3542,7 +3542,7 @@
           if ( pSaveListPosition < 1 )
             pSaveListPosition = 0;
           pWindow = pGUIWindow_CurrentMenu;
-          GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_Button, (int)pBtnDownArrow, 0);
+          GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_PressedButton2, (int)pBtnDownArrow, 0);
           break;
         case UIMSG_Cancel:
           GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0);
@@ -3552,14 +3552,14 @@
           if ( pSaveListPosition < 0 )
             pSaveListPosition = 0;
           pWindow = pGUIWindow_CurrentMenu;
-          GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_Button, (int)pBtnArrowUp, 0);
+          GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_PressedButton2, (int)pBtnArrowUp, 0);
           break;
         case UIMSG_AD:
-          GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_Button, (int)pMainMenu_BtnNew, 0);
+          GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0);
           SetCurrentMenuID(MENU_LoadingProcInMainMenu);
           break;
         case UIMSG_AE:
-          GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_Button, (int)pMainMenu_BtnExit, 0);
+          GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0);
           SetCurrentMenuID(MENU_10);
           break;
         case UIMSG_Escape:
@@ -10286,241 +10286,408 @@
     pWindowType = pWindow->eWindowType;
     switch (pWindow->eWindowType)
     {
-      case WINDOW_MainMenu_Load:
+      case WINDOW_OptionsButtons://3
+      {
+        pTexture = (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0);
+        pY = pViewport->uViewportTL_Y;
+        pX = pViewport->uViewportTL_X;
+        pRenderer->DrawTextureIndexed(pX, pY, pTexture);
+        viewparams->bRedrawGameUI = 1;
+        continue;
+      }
+      case WINDOW_CharacterRecord://4
+      {
+        CharacterUI_CharacterScreen_Draw(uActiveCharacter);
+        continue;
+      }
+      case WINDOW_Options://6
+      {
+        DrawGameOptions();
+        continue;
+      }
+      case WINDOW_Book://9
+      {
+        DrawCurrentBook((unsigned int)pWindow->ptr_1C);
+        continue;
+      }
+      case WINDOW_Dialogue://10
+      {
+        DrawDialogueUI();
+        continue;
+      }
+      case WINDOW_QuickReference://12
+      {
+        QuickRefDraw();
+        continue;
+      }
+      case WINDOW_Rest://16
+      {
+        RestUI_Draw();
+        continue;
+      }
+      case WINDOW_ChangeLocation://17
+      {
+        TravelUI_Draw();
+        continue;
+      }
+      case WINDOW_SpellBook://18
+      {
+        DrawSpellBookContent();
+        continue;
+      }
+      case WINDOW_GreetingNPC://19
+      {
+        DrawBranchlessDialogueUI();
+        continue;
+      }
+      case WINDOW_Chest://20
+      {
+        if ( pCurrentScreen == SCREEN_CHEST )
+        {
+          Chest::DrawChestUI((unsigned int)pWindow->ptr_1C);
+        }
+        else if ( pCurrentScreen == SCREEN_F )
+        {
+          pRenderer->ClearZBuffer(0, 479);
+          draw_leather();
+          CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
+          pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY,
+             (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0));
+        }
+        continue;
+      }
+      case WINDOW_SaveLoadButtons://23
+      {
+        sub_4606FE();
+        continue;
+      }
+      case WINDOW_MainMenu_Load://24
       {
         GameUI_MainMenu_DrawLoad();
-        break;
-      }
-      case WINDOW_SaveLoadBtn:
+        continue;
+      }
+      case WINDOW_HouseInterior://25
+      {
+        pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager();
+        if ( !window_SpeakInHouse )
+          continue;
+        v10 = window_SpeakInHouse->ptr_1C;
+        if ( (signed int)v10 >= 53 )
+          continue;
+        if ( pParty->field_3C._shop_ban_times[(signed int)v10] <=pParty->uTimePlayed )
+        {
+          if ( (signed int)v10 < 53 )
+          {
+            pParty->field_3C._shop_ban_times[(signed int)v10] = 0;
+          }
+          continue;
+        }
+        pNumMessages = pMessageQueue_50CBD0->uNumMessages;
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+        continue;
+      }
+      case WINDOW_Transition://26
+      {
+        TransitionUI_Draw();
+        continue;
+      }
+      case WINDOW_Scroll://30
+      {
+        CreateScrollWindow();
+        continue;
+      }
+      case WINDOW_CastSpell_InInventory://31
+      {
+        pRenderer->ClearZBuffer(0, 479);
+        draw_leather();
+        CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
+        CharacterUI_DrawPaperdoll(uActiveCharacter);
+        pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY,
+            (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0));
+        continue;
+      }
+      case WINDOW_FinalWindow://70
+      {
+        sub_41420D_press_esc();
+        continue;
+      }
+      case WINDOW_50://80
+      {
+        v27 = TargetColor(255, 255, 255);
+        if ( ptr_507BD0->field_40 == 1 )
+        {
+          ptr_507BD0->DrawMessageBox(0);
+          ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
+          v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
+          ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate);
+          continue;
+        }
+        if ( ptr_507BD0->field_40 == 2 )
+        {
+          //v29 = pMessageQueue_50CBD0->uNumMessages;
+          pWindow->field_40 = 0;
+          /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
+          {
+            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)(int)ptr_507BD0->ptr_1C;
+            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
+            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
+            ++pMessageQueue_50CBD0->uNumMessages;
+          }*/
+          pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0);
+          pEventTimer->Resume();
+          ptr_507BD0->Release();
+          pCurrentScreen = 0;
+          viewparams->bRedrawGameUI = 1;
+          continue;
+        }
+        if ( ptr_507BD0->field_40 == 3 )
+        {
+          pWindow->field_40 = 0;
+          pEventTimer->Resume();
+          ptr_507BD0->Release();
+          continue;
+        }
+      }
+      case WINDOW_59://89
+      {
+        pWindow->DrawMessageBox(0);
+        pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
+        pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
+        if ( !pKeyActionMap->field_204 )
+        {
+          ItemGen2.Reset();
+          pWindow->Release();
+          pEventTimer->Resume();
+          pCurrentScreen = 0;
+          viewparams->bRedrawGameUI = 1;
+          v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+          if ( v26 > 0 )
+          {
+            if ( v26 < 800 )
+            {
+              ItemGen2.uAttributes |= 1u;
+              ItemGen2.uItemID = v26;
+              if ( pItemsTable->pItems[v26].uEquipType == 12 )
+              {
+                ItemGen2.uNumCharges = rand() % 6 + pItemsTable->pItems[ItemGen2.uItemID].uDamageMod + 1;
+                ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges);
+              }
+              else
+              {
+                if ( v26 >= 221 && v26 < 271 )
+                  ItemGen2.uEnchantmentType = rand() % 10 + 1;
+              }
+              pItemsTable->SetSpecialBonus(&ItemGen2);
+              pParty->SetHoldingItem(&ItemGen2);
+            }
+          }
+        }
+        continue;
+      }
+      case WINDOW_PressedButton2://90
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        if ( pButton->uX >= 0 && pButton->uX <= 640 )
+        {
+          if ( pButton->uY >= 0 && pButton->uY <= 480 )
+          {
+            pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
+            viewparams->bRedrawGameUI = 1;
+            if ( pWindow->Hint )
+            {
+              v24 = pWindow->Hint == (char *)1;
+              if ( !v24 )
+                pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
+            }
+            pWindow->Release();
+            continue;
+          }
+        }
+        viewparams->bRedrawGameUI = 1;
+        if ( pWindow->Hint )
+        {
+          v24 = pWindow->Hint == (char *)1;
+          if ( !v24 )
+            pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
+        }
+        pWindow->Release();
+        continue;
+      }
+      case WINDOW_CharactersPressedButton://91
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
+        viewparams->bRedrawGameUI = 1;
+        if ( pWindow->Hint )
+        {
+          v24 = pWindow->Hint == (char *)1;
+          if ( !v24 )
+            pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
+        }
+        pWindow->Release();
+        continue;
+      }
+      case WINDOW_PressedButton://92
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
+        viewparams->bRedrawGameUI = 1;
+        if ( pWindow->Hint )
+        {
+          v24 = pWindow->Hint == (char *)1;
+          if ( !v24 )
+            pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
+        }
+        pWindow->Release();
+        continue;
+      }
+      case WINDOW_5D://93
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
+        viewparams->bRedrawGameUI = 1;
+        pWindow->Release();
+        continue;
+      }
+      case WINDOW_SaveLoadBtn://94
       {
         if (pWindow->Hint != (char *)1)
           pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
-        auto pGUIButton3 = (GUIButton *)pWindow->ptr_1C;
-        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton3->pTextures[0]);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
         pHint = pWindow->Hint;
         viewparams->bRedrawGameUI = 1;
         if ( pHint && pHint != (char *)1 )
-          pGUIButton3->DrawLabel(pHint, pFontCreate, 0, 0);
+          pButton->DrawLabel(pHint, pFontCreate, 0, 0);
         pWindow->Release();
         if (pCurrentScreen == SCREEN_SAVEGAME)
           pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0);
         else
           pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0);
-        break;
-      }
-      case WINDOW_OptionsButtons:
-      {
-			pTexture = (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0);
-			pY = pViewport->uViewportTL_Y;
-			pX = pViewport->uViewportTL_X;
-			pRenderer->DrawTextureIndexed(pX, pY, pTexture);
-			viewparams->bRedrawGameUI = 1;
-			break;
-			}
-		case WINDOW_CharacterRecord:
-			{
-			CharacterUI_CharacterScreen_Draw(uActiveCharacter);
-			break;
-			}
-		case WINDOW_Options:
-			{
-			DrawGameOptions();
-			break;
-			}
-		case WINDOW_Book:
-			{
-			DrawCurrentBook((unsigned int)pWindow->ptr_1C);
-			break;
-			}
-		case WINDOW_QuickReference:
-			{
-            QuickRefDraw();
-			break;
-			}
-		case WINDOW_Rest:
-	    {
-			RestUI_Draw();
-			break;
-		}
-		case WINDOW_Dialogue:
-			{
-			DrawDialogueUI();
-			break;
-			}
-		case WINDOW_ChangeLocation:
-			{
-            TravelUI_Draw();
-			break;
-			}
-		case WINDOW_SpellBook:
-			{
-			DrawSpellBookContent();
-			break;
-			}
-		case WINDOW_GreetingNPC:
-			{
-			DrawBranchlessDialogueUI();
-			break;
-			}
-		case WINDOW_Transition:
-			{
-			TransitionUI_Draw();
-			break;
-			}
-		case WINDOW_Scroll:
-			{
-			CreateScrollWindow();
-			break;
-			}
-		case WINDOW_FinalWindow:
-			{
-			sub_41420D_press_esc();
-			break;
-			}
-		case WINDOW_VideoOptions:
-			{
-			GameMenuUI_DrawVideoOptions();
-			break;
-			}
-		case WINDOW_KeyMappingOptions:
-			{
-			GameMenuUI_DrawKeyBindings();
-			break;
-			}
-		case WINDOW_SaveLoadButtons:
-			{
-			sub_4606FE();
-			break;
-			}
-		case WINDOW_CastSpell_InInventory:
-			{
-            pRenderer->ClearZBuffer(0, 479);
-            draw_leather();
-            CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
-            CharacterUI_DrawPaperdoll(uActiveCharacter);
-            pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY,
-                (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0));
-			break;
-			}
-		case WINDOW_RestWindow:
-			{	
-			memset(&GUIButton2, 0, 0xBCu);//pWindowType == 98 (0x62) WINDOW_RestWindow
-			GUIButton2.uZ = 197;
-			GUIButton2.uW = 197;
-			GUIButton2.uX = 27;
-			GUIButton2.uY = 161;
-			GUIButton2.uWidth = 171;
-			GUIButton2.uHeight = 37;
-			GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent;
-			pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
-			pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15));
-			viewparams->bRedrawGameUI = 1;
-			GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);//Отдых и лечение 8 часов
-			GUIButton2.pParent = 0;
-			pGUIWindow2 = pWindow;
-			pGUIWindow2->Release();
-			break;
-			}
-		case WINDOW_ExitRestWindow:
-			{
-			if ( pWindow->Hint != (char *)1 )
-				pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
-			pGUIButton = (GUIButton *)pWindow->ptr_1C;
-			pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]);
-			pHint = pWindow->Hint;
-			viewparams->bRedrawGameUI = 1;
-			if ( pHint && pHint != (char *)1 )
-				pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0);
-			pWindow->Release();
-			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-			break;
-			}
-		case WINDOW_ExitCharacterWindow:
-			{
-			if ( pWindow->Hint != (char *)1 )
-				pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
-			pButton = (GUIButton *)pWindow->ptr_1C;
-			pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
-			pHint = pWindow->Hint;
-			viewparams->bRedrawGameUI = 1;
-			if ( pHint && pHint != (char *)1 )
-				pButton->DrawLabel(pHint, pFontCreate, 0, 0);
-			pWindow->Release();
-			pNumMessages = pMessageQueue_50CBD0->uNumMessages;
-			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-			break;
-			}
-		case WINDOW_BooksWindow:
-			{
-			pButton = (GUIButton *)pWindow->ptr_1C;
-            pY = pWindow->uFrameY;
-            pX = pWindow->uFrameX;
-			pRenderer->DrawTextureIndexed(pX, pY, pButton->pTextures[0]);
-            viewparams->bRedrawGameUI = 1;
-            break;
-			}
-		case WINDOW_CharacterWindow_Inventory:
-			{
-            pWindow->DrawMessageBox(0);
-            pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
-            pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
-            if ( !pKeyActionMap->field_204 )
-            {
-                ItemGen2.Reset();
-                pWindow->Release();
-                pEventTimer->Resume();
-                pCurrentScreen = SCREEN_GAME;
-                viewparams->bRedrawGameUI = 1;
-                v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
-                if ( v39 > 0 )
-                {
-                if ( v39 < 800 )
-                    SpawnActor(v39);
-                }
-            }
-			break;
-			}
-		case WINDOW_Chest:
-			{
-            if ( pCurrentScreen == SCREEN_CHEST )
-            {
-	            Chest::DrawChestUI((unsigned int)pWindow->ptr_1C);
-            }
-            else if ( pCurrentScreen == SCREEN_F )
-			{
-				pRenderer->ClearZBuffer(0, 479);
-				draw_leather();
-				CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
-				pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY,
-				(Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0));
-			}
-			break;
-			}
-		case WINDOW_HouseInterior:
-			{
-	        pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager();
-			if ( !window_SpeakInHouse )
-			  continue;
-			v10 = window_SpeakInHouse->ptr_1C;
-			if ( (signed int)v10 >= 53 )
-			  continue;
-			if ( pParty->field_3C._shop_ban_times[(signed int)v10] <=pParty->uTimePlayed )
-			{
-			  if ( (signed int)v10 < 53 )
-			  {
-				  pParty->field_3C._shop_ban_times[(signed int)v10] = 0;
-			  }
-			  continue;
-			}
-			pNumMessages = pMessageQueue_50CBD0->uNumMessages;
-			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-			break;
-			}
-		default:
-			{
-			break;
-			}
-	}
+        continue;
+      }
+      case WINDOW_LoadGame_CancelBtn://95
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
+        viewparams->bRedrawGameUI = 1;
+        if ( pWindow->Hint && pWindow->Hint != (char *)1 )
+          pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
+        pWindow->Release();
+        /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
+        {
+          pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
+          pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
+          *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
+          ++pMessageQueue_50CBD0->uNumMessages;
+          continue;
+        }*/
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+        continue;
+      }
+      case WINDOW_CloseRestWindowBtn://96
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
+        pGUIButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]);
+        pHint = pWindow->Hint;
+        viewparams->bRedrawGameUI = 1;
+        if ( pHint && pHint != (char *)1 )
+          pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0);
+        pWindow->Release();
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+        continue;
+      }
+      case WINDOW_ExitCharacterWindow://97
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
+        pHint = pWindow->Hint;
+        viewparams->bRedrawGameUI = 1;
+        if ( pHint && pHint != (char *)1 )
+          pButton->DrawLabel(pHint, pFontCreate, 0, 0);
+        pWindow->Release();
+        pNumMessages = pMessageQueue_50CBD0->uNumMessages;
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+        continue;
+      }
+      case WINDOW_RestWindow://98
+      {
+        memset(&GUIButton2, 0, 0xBCu);
+        GUIButton2.uZ = 197;
+        GUIButton2.uW = 197;
+        GUIButton2.uX = 27;
+        GUIButton2.uY = 161;
+        GUIButton2.uWidth = 171;
+        GUIButton2.uHeight = 37;
+        GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent;
+        pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
+        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15));
+        viewparams->bRedrawGameUI = 1;
+        GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);//Отдых и лечение 8 часов
+        GUIButton2.pParent = 0;
+        pGUIWindow2 = pWindow;
+        pGUIWindow2->Release();
+        continue;
+      }
+      case WINDOW_BooksWindow://99
+      {
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pY = pWindow->uFrameY;
+        pX = pWindow->uFrameX;
+        pRenderer->DrawTextureIndexed(pX, pY, pButton->pTextures[0]);
+        viewparams->bRedrawGameUI = 1;
+        continue;
+      }
+      case WINDOW_CharacterWindow_Inventory://103
+      {
+        pWindow->DrawMessageBox(0);
+        pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
+        pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
+        if ( !pKeyActionMap->field_204 )
+        {
+          ItemGen2.Reset();
+          pWindow->Release();
+          pEventTimer->Resume();
+          pCurrentScreen = SCREEN_GAME;
+          viewparams->bRedrawGameUI = 1;
+          v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+          if ( v39 > 0 )
+          {
+            if ( v39 < 800 )
+              SpawnActor(v39);
+          }
+        }
+        continue;
+      }
+      case WINDOW_KeyMappingOptions://105
+      {
+        GameMenuUI_DrawKeyBindings();
+        continue;
+      }
+      case WINDOW_VideoOptions://106
+      {
+        GameMenuUI_DrawVideoOptions();
+        continue;
+      }
+      default:
+      {
+        continue;
+      }
+    }
   }
   if ( GetCurrentMenuID() == -1 )
     GameUI_DrawFoodAndGold();