changeset 966:99ee5e590b16

Слияние
author Ritor1
date Tue, 07 May 2013 18:45:18 +0600
parents a6510526f791 (current diff) 0423c40d7e88 (diff)
children e655624e4b7c
files mm7_2.cpp
diffstat 10 files changed, 668 insertions(+), 529 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Tue May 07 18:44:23 2013 +0600
+++ b/GUIWindow.cpp	Tue May 07 18:45:18 2013 +0600
@@ -302,15 +302,15 @@
 //----- (0041C26A) --------------------------------------------------------
 void GUIWindow::Release()
 {
-  GUIWindow *v1; // esi@1
+  //GUIWindow *v1; // esi@1
   int i; // edi@20
-  GUIButton *v8; // eax@26
-  GUIButton *v9; // edi@27
-  int v10; // esi@28
-  int v11; // ecx@28
+  //GUIButton *v8; // eax@26
+  GUIButton *pNextBtn; // edi@27
+  //int v10; // esi@28
+  //int v11; // ecx@28
   int v12; // edx@29
 
-  v1 = this;
+  //v1 = this;
   if ( !this )
     return;
   
@@ -385,32 +385,30 @@
 		break;
 		}
   }
-  v8 = v1->pControlsHead;
-  if ( v8 )
+  //v8 = this->pControlsHead;
+  if ( this->pControlsHead )
   {
     do
     {
-      v9 = v8->pNext;
-      pAllocator->FreeChunk(v8);
-      v8 = v9;
+      pNextBtn = this->pControlsHead->pNext;
+      pAllocator->FreeChunk(this->pControlsHead);
+      this->pControlsHead = pNextBtn;
     }
-    while ( v9 );
+    while ( pNextBtn );
   }
-  v1->pControlsHead = 0;
-  v1->pControlsTail = 0;
-  v1->uNumControls = 0;
-  v1->eWindowType = WINDOW_null;
-  v10 = v1->numVisibleWindows;
-  v11 = uNumVisibleWindows;
-  while ( v10 < v11 )
+  this->pControlsHead = 0;
+  this->pControlsTail = 0;
+  this->uNumControls = 0;
+  this->eWindowType = WINDOW_null;
+  while ( this->numVisibleWindows < uNumVisibleWindows )
   {
-    v12 = pVisibleWindowsIdxs[v10 + 1];
-    pVisibleWindowsIdxs[v10] = v12;
-    --*((int *)&pTexture_PCX.field_18 + 21 * v12);
-    ++v10;
+    v12 = pVisibleWindowsIdxs[this->numVisibleWindows + 1];
+    pVisibleWindowsIdxs[this->numVisibleWindows] = v12;
+    --pWindowList[v12 - 1].numVisibleWindows;
+    ++this->numVisibleWindows;
   }
-  pVisibleWindowsIdxs[v11] = 0;
-  uNumVisibleWindows = v11 - 1;
+  pVisibleWindowsIdxs[uNumVisibleWindows] = 0;
+  uNumVisibleWindows = uNumVisibleWindows - 1;
 }
 
 
@@ -477,7 +475,7 @@
   num_achieved_awards = 0; 
   switch (v1->par1C)
       {
-  case WINDOW_Lloyd:{
+  case WINDOW_LloydsBeacon:{
       byte_506360 = 0;
       pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("lb_bordr", TEXTURE_16BIT_PALETTE);
       pTexture_LloydBeacons[0] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE);
@@ -485,8 +483,8 @@
       pTex_tab_an_6b__zoom_on  = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
       pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
 
-      pBtn_Book_1 = v1->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_B2, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon
-      pBtn_Book_2 = v1->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_B2, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon
+      pBtn_Book_1 = v1->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon
+      pBtn_Book_2 = v1->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon
 
       v17 = &pParty->pPlayers[_506348_current_lloyd_playerid];
       v23 = 1;
@@ -505,7 +503,7 @@
           {
           do
               {
-              v1->CreateButton(pLloydsBeaconsPreviewXs[v19], pLloydsBeaconsPreviewYs[v19], 0x5Cu, 0x44u, 1, 180, UIMSG_B3, v19, 0, "", 0);
+              v1->CreateButton(pLloydsBeaconsPreviewXs[v19], pLloydsBeaconsPreviewYs[v19], 0x5Cu, 0x44u, 1, 180, UIMSG_InstallBeacon, v19, 0, "", 0);
               ++v19;
               }
               while ( (signed int)v19 < v23 );
@@ -536,7 +534,7 @@
       pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr("tphell", TEXTURE_16BIT_PALETTE);
 
       for (uint i = 0; i < 6; ++i)
-        v1->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_B7, i, 0, "", nullptr);
+        v1->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_ClickTownInTP, i, 0, "", nullptr);
       /*v16 = 0;
       do
           {
@@ -1722,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
@@ -1751,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;
@@ -1921,7 +1919,7 @@
         sprintfex(byte_591180[v26], v29, v30);
         HouseNPCData[v26 + 7] = (NPCData *)pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26],
                                                                  pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26],
-                                             0x3Fu, 0x49u, 1, 0, UIMSG_19A, v26, 0, byte_591180[v26], 0, 0, 0);
+                                             0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26], 0, 0, 0);
         v25 = uNumDialogueNPCPortraits;
       }
     }
@@ -1943,7 +1941,7 @@
                         pWindow->CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, pWindow->Hint, 0);
       return pWindow;
     }
-    if (eWindowType == WINDOW_1B)
+    if (eWindowType == WINDOW_CastSpell)
     {
       pEventTimer->Pause();
       pAudioPlayer->StopChannels(-1, -1);
--- a/GUIWindow.h	Tue May 07 18:44:23 2013 +0600
+++ b/GUIWindow.h	Tue May 07 18:45:18 2013 +0600
@@ -23,7 +23,7 @@
 
   UIMSG_Attack = 23,
 
-  UIMSG_19 = 25,
+  UIMSG_CastQuickSpell = 25,
 
   UIMSG_1B = 27,
   UIMSG_1C = 28,
@@ -49,8 +49,8 @@
   UIMSG_PlayerCreationClickOK = 66,
   UIMSG_PlayerCreationClickReset = 67,
   UIMSG_44 = 68,
-  UIMSG_45 = 69,
-  UIMSG_46 = 70,
+  UIMSG_CastSpell_SPIRIT_Preservation = 69,
+  UIMSG_CastSpell_SmallShot = 70,
   UIMSG_AutonotesBook = 71,
   UIMSG_48 = 72,
   UIMSG_49 = 73,
@@ -114,8 +114,8 @@
   UIMSG_StartHireling2Dialogue = 135,
   UIMSG_SelectNPCDialogueOption = 136,
 
-  UIMSG_8C = 140,
-  UIMSG_8D = 141,
+  UIMSG_CastSpell_GreatShot = 140,
+  UIMSG_CastSpell_8D = 141,
   UIMSG_CastSpellFromBook = 142,
   UIMSG_8F = 143,
   UIMSG_PlayerCreation_VoicePrev = 144,
@@ -125,33 +125,33 @@
   UIMSG_StartNPCDialogue = 161,
   UIMSG_ArrowUp = 162,
   UIMSG_DownArrow = 163,
-  UIMSG_LoadSlot = 164,
+  UIMSG_SaveLoadBtn = 164,
   UIMSG_SelectLoadSlot = 165,
   UIMSG_Cancel = 166,
   UIMSG_ExitRest = 167,
   UIMSG_ClickExitCharacterWindowBtn = 168,
-  UIMSG_A9 = 169,
-  UIMSG_AA = 170,
+  UIMSG_ClickAwardsUpBtn = 169,
+  UIMSG_ClickAwardsDownBtn = 170,
   UIMSG_PlayerCreation_FacePrev = 171,
   UIMSG_PlayerCreation_FaceNext = 172,
   UIMSG_AD = 173,
   UIMSG_AE = 174,
   UIMSG_ClickNPCTopic = 175,
   UIMSG_CycleCharacters = 176,
-  UIMSG_B1 = 177,
-  UIMSG_B2 = 178,
-  UIMSG_B3 = 179,
-  UIMSG_B4 = 180,
-  UIMSG_B5 = 181,
-  UIMSG_B6 = 182,
-  UIMSG_B7 = 183,
+  UIMSG_OnCastLloydsBeacon = 177,
+  UIMSG_LloydsBeacon_FlippingBtn = 178,
+  UIMSG_InstallBeacon = 179,
+  UIMSG_HintBeaconSlot = 180,
+  UIMSG_CloseAfterInstallBeacon = 181,
+  UIMSG_HintTownPortal = 182,
+  UIMSG_ClickTownInTP = 183,
   UIMSG_SetTurnSpeed = 184,
   UIMSG_ToggleWalkSound = 185,
   UIMSG_ChangeVoiceVolume = 186,
   UIMSG_ToggleShowDamage = 187,
   UIMSG_ScrollNPCPanel = 188,
   UIMSG_BD = 189,
-  UIMSG_BE = 190,
+  UIMSG_CastSpell_BE = 190,
   UIMSG_BF = 191,
   UIMSG_C0 = 192,
   UIMSG_C1 = 192,
@@ -191,7 +191,7 @@
   UIMSG_SelectShopDialogueOption = 405,
 
   UIMSG_RentRoom = 409,
-  UIMSG_19A = 410,
+  UIMSG_ClickHouseNPCPortrait = 410,
   UIMSG_TransitionUI_Confirm = 411,
   UIMSG_TransitionWindowCloseBtn = 412,
 
@@ -221,7 +221,7 @@
   MENU_CREATEPARTY = 0x6,
   MENU_NAMEPANELESC = 0x7,
   MENU_CREDITSPROC = 0x8,
-  MENU_LOADINGPROC = 0x9,
+  MENU_LoadingProcInMainMenu = 0x9,
   MENU_10 = 0xA,
   MENU_CREDITSCLOSE = 0xB,
 };
@@ -254,12 +254,12 @@
 enum WindowType: unsigned __int32
 {
   WINDOW_null = 0,
-  WINDOW_MainMenu = 0x1,
-  WINDOW_3 = 0x3,
-  WINDOW_CharacterRecord = 0x4,
-  WINDOW_Options = 0x6,
+  WINDOW_MainMenu = 1,
+  WINDOW_OptionsButtons = 3,
+  WINDOW_CharacterRecord = 4,
+  WINDOW_Options = 6,
   WINDOW_8 = 8,
-  WINDOW_Book = 0x9,
+  WINDOW_Book = 9,
   WINDOW_Dialogue = 10,
   WINDOW_QuickReference = 12,
   WINDOW_F = 15,
@@ -268,23 +268,23 @@
   WINDOW_SpellBook = 0x12,
   WINDOW_GreetingNPC = 19,
   WINDOW_Chest = 0x14,
-  WINDOW_17 = 23,
+  WINDOW_SaveLoadButtons = 23,
   WINDOW_MainMenu_Load = 0x18,
   WINDOW_HouseInterior = 0x19,
   WINDOW_Transition = 26,
-  WINDOW_1B = 27,
+  WINDOW_CastSpell = 27,
   WINDOW_Scroll = 0x1E,
   WINDOW_CastSpell_InInventory = 31,
-  WINDOW_FinalWindow = 0x46,
-  WINDOW_50 = 0x50,
-  WINDOW_59 = 0x59,
-  WINDOW_5A = 90,
-  WINDOW_5B = 91,
-  WINDOW_VoiceSwitcherButton = 92,
-  WINDOW_5D = 0x5D,
-  WINDOW_5E = 94,
-  WINDOW_LoadGame_CancelBtn = 0x5F,
-  WINDOW_ExitRestWindow = 96,
+  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 = 95,
+  WINDOW_CloseRestWindowBtn = 96,
   WINDOW_ExitCharacterWindow = 97,
   WINDOW_RestWindow = 0x62,
   WINDOW_BooksWindow = 99,
@@ -295,7 +295,7 @@
   WINDOW_68 = 104,
   WINDOW_KeyMappingOptions = 0x69,
   WINDOW_VideoOptions = 0x6A,
-  WINDOW_Lloyd = 0xB1,
+  WINDOW_LloydsBeacon = 177,
   WINDOW_TownPortal = 195,
   WINDOW_QuestBook = 200,
   WINDOW_AutonotesBook = 0xC9,
--- a/Game.cpp	Tue May 07 18:44:23 2013 +0600
+++ b/Game.cpp	Tue May 07 18:45:18 2013 +0600
@@ -270,7 +270,7 @@
   MSG Msg; // [sp+28h] [bp-3Ch]@20
   char Source[64]; // [sp+44h] [bp-20h]@76
 
-  bLoading = uCurrentMenuID == MENU_LOADINGPROC;
+  bLoading = uCurrentMenuID == MENU_LoadingProcInMainMenu;
   SetCurrentMenuID((MENU_STATE)-1);
   if (bLoading)
   {
--- a/UIBooks.cpp	Tue May 07 18:44:23 2013 +0600
+++ b/UIBooks.cpp	Tue May 07 18:45:18 2013 +0600
@@ -1525,7 +1525,7 @@
   pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
   switch ((enum WindowType)uBook)
   {
-    case WINDOW_Lloyd:         DrawLloydBeaconsScreen(); break;
+    case WINDOW_LloydsBeacon:  DrawLloydBeaconsScreen(); break;
     case WINDOW_TownPortal:    DrawTownPortalScreen();   break;
     case WINDOW_QuestBook:     DrawBook_Quests();        break;
     case WINDOW_AutonotesBook: DrawBook_Autonotes();     break;
--- a/UIRest.cpp	Tue May 07 18:44:23 2013 +0600
+++ b/UIRest.cpp	Tue May 07 18:45:18 2013 +0600
@@ -60,15 +60,12 @@
         }
     pEventTimer->Pause();
     if ( dword_506F14 != 2 )
-        GUIWindow::Create(518u, 450u, 0, 0, WINDOW_5A, (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/UISaveLoad.cpp	Tue May 07 18:44:23 2013 +0600
+++ b/UISaveLoad.cpp	Tue May 07 18:45:18 2013 +0600
@@ -92,7 +92,7 @@
   TargetColor(0xFF, 0xFF, 0xFF);
   TargetColor(0xFF, 0xFF, 0x9B);
   pRenderer->BeginScene();
-  if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LOADINGPROC )
+  if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu )
   {
     pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave));
     if ( a4 )
@@ -196,7 +196,7 @@
     if ( pGUIWindow_CurrentMenu->field_40 == 3 )
       pGUIWindow_CurrentMenu->field_40 = 0;
   }
-  if (GetCurrentMenuID() == MENU_LOADINGPROC)
+  if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
   {
     //v18 = pGlobalTXT_LocalizationStrings[135];
     v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//""
@@ -379,7 +379,7 @@
     pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0);
     pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0);
     pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0);
-    pBtnLoadSlot  = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_LoadSlot, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0);
+    pBtnLoadSlot  = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0);
     pBtnCancel    = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0);
     pBtnArrowUp   = pGUIWindow_CurrentMenu->CreateButton(215, 199,  17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0);
     pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323,  17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0);
@@ -464,7 +464,7 @@
     uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE);
     uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE);
     uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE);
-    pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_17, 0, 0);
+    pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SaveLoadButtons, 0, 0);
     pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0);
     pGUIWindow_CurrentMenu->CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0);
     pGUIWindow_CurrentMenu->CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0);
@@ -472,7 +472,7 @@
     pGUIWindow_CurrentMenu->CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0);
     pGUIWindow_CurrentMenu->CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0);
     pGUIWindow_CurrentMenu->CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0);
-    pBtnLoadSlot  = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_LoadSlot, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0);
+    pBtnLoadSlot  = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0);
     pBtnCancel    = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0);
     pBtnArrowUp   = pGUIWindow_CurrentMenu->CreateButton(215, 199,  17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0);
     pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323,  17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0);
--- a/mm7_1.cpp	Tue May 07 18:44:23 2013 +0600
+++ b/mm7_1.cpp	Tue May 07 18:45:18 2013 +0600
@@ -1292,7 +1292,7 @@
     if ( uActiveCharacter
       && sub_427769_spell(pPlayers[uActiveCharacter]->uQuickSpell))
     {
-      pMessageQueue_50CBD0->AddMessage(UIMSG_19, 0, 0);
+      pMessageQueue_50CBD0->AddMessage(UIMSG_CastQuickSpell, 0, 0);
       /*&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
       pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)25;
 LABEL_41:
--- a/mm7_2.cpp	Tue May 07 18:44:23 2013 +0600
+++ b/mm7_2.cpp	Tue May 07 18:45:18 2013 +0600
@@ -866,7 +866,7 @@
         do
         {
           HouseNPCData[v2 + 7] = (NPCData *)window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2],
-                                              0x3Fu, 0x49u, 1, 0, UIMSG_19A, v2, 0, byte_591180[v2], 0, 0, 0);
+                                              0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v2, 0, byte_591180[v2], 0, 0, 0);
           v1 = uNumDialogueNPCPortraits;
           ++v2;
           //v3 += 100;
@@ -6702,7 +6702,7 @@
         pAsyncMouse->_46B736_consume_click_lists(1);
       if (GetCurrentMenuID() != MENU_MAIN)
       {
-        if (GetCurrentMenuID() == MENU_LOADINGPROC)
+        if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
         {
           pIcons_LOD->_4114F2();
           pGUIWindow_CurrentMenu->Release();
@@ -9524,14 +9524,13 @@
          CreditsMenu__Loop();
          break;
         }
-        if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LOADINGPROC)
+        if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
         {
           uGameState = 0;
         }
         else
-         __debugbreak();
-         {
-        /*  if (GetCurrentMenuID() != MENU_10)
+        {
+          if (GetCurrentMenuID() != MENU_10)
             goto LABEL_49;
           pMouse->Activate(0);
           if (pAsyncMouse)
@@ -9557,20 +9556,19 @@
           if (pAsyncMouse)
             pAsyncMouse->Resume();
           if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard )
-            pAsyncKeyboard->Resume();*/
+            pAsyncKeyboard->Resume();
         }
 //LABEL_48:
         pGame->Loop();
 LABEL_49:
         if ( uGameState == 3 )
-          __debugbreak();
-        /*{
+        {
           v12 = 5;
           SetCurrentMenuID((MENU_STATE)v12);
           //goto LABEL_21;
           uGameState = 0;
           continue;
-        }*/
+        }
         if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU )
         {
           SetCurrentMenuID(MENU_NEWGAME);
@@ -9868,7 +9866,7 @@
     case MENU_CREATEPARTY: return L"MENU_CREATEPARTY";
     case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC";
     case MENU_CREDITSPROC: return L"MENU_CREDITSPROC";
-    case MENU_LOADINGPROC: return L"MENU_LOADINGPROC";
+    case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu";
     case MENU_10:          return L"MENU_10";
     case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE";
     default:               return L"unk";
--- a/mm7_5.cpp	Tue May 07 18:44:23 2013 +0600
+++ b/mm7_5.cpp	Tue May 07 18:45:18 2013 +0600
@@ -200,7 +200,7 @@
   //unsigned int v151; // [sp-4h] [bp-600h]@107
   int v152; // [sp-4h] [bp-600h]@121
   int v153; // [sp-4h] [bp-600h]@135
-  int v154; // [sp-4h] [bp-600h]@149
+  //int v154; // [sp-4h] [bp-600h]@149
   int v155; // [sp-4h] [bp-600h]@165
   int v156; // [sp-4h] [bp-600h]@204
   //const char *v157; // [sp-4h] [bp-600h]@444
@@ -383,7 +383,7 @@
         case UIMSG_SelectNPCDialogueOption:
           OnSelectNPCDialogueOption((DIALOGUE_TYPE)uMessageParam);
           continue;
-        case UIMSG_19A:
+        case UIMSG_ClickHouseNPCPortrait:
           _4B4224_UpdateNPCTopics(uMessageParam);
           continue;
         case UIMSG_StartNewGame:
@@ -448,19 +448,19 @@
           --pSaveListPosition;
           if ( pSaveListPosition < 0 )
             pSaveListPosition = 0;
-          GUIWindow::Create(215, 199, 17, 17, WINDOW_5A, (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_5A, (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);
-          continue;
-        case UIMSG_LoadSlot:
-          GUIWindow::Create(241, 302, 106, 42, WINDOW_5E, (int)pBtnLoadSlot, 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);
           continue;
         case UIMSG_SelectLoadSlot:
           if ( pGUIWindow_CurrentMenu->field_40 == v0 )
@@ -470,11 +470,11 @@
             v10 = pSaveListPosition + uMessageParam;
             if ( dword_6BE138 == pSaveListPosition + uMessageParam )
             {
-              pMessageQueue_50CBD0->AddMessage(UIMSG_LoadSlot, 0, 0);
+              pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0);
               pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0);
               /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
               {
-                pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_LoadSlot;
+                pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_SaveLoadBtn;
                 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
                 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
                 //v11 = pMessageQueue_50CBD0->uNumMessages + 1;
@@ -742,7 +742,7 @@
             }
             v19 = (double)(signed int)uGammaPos * 0.1 + 0.6;
             pGame->pGammaController->Initialize(v19);
-            GUIWindow::Create(21, 161, 0, 0, WINDOW_5A, (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_5A, (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_5A, (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_5A, (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_5A, (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;
@@ -824,8 +824,8 @@
               uSoundVolumeMultiplier = 9;
             v168 = v0;
             v24 = 435;
-            v154 = (int)pBtn_SliderRight;
-            GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_5A, v154, v168);
+            //v154 = (int)pBtn_SliderRight;
+            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_5A, (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_5A, (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,14 +1468,14 @@
             if ( !pGUIWindow_Settings )//Draw Menu
             {
               dword_6BE138 = -1;
-              GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_5A, (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;
               pCurrentScreen = v0;
               if ( !pIcons_LOD->uNumPrevLoadedFiles )
                 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-              pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_3, 0, 0);
+              pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0);
               uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
               uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
               uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
@@ -1523,7 +1523,7 @@
         case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel
           if ( uMessageParam )
           {
-            GUIWindow::Create(626, 179, 0, 0, WINDOW_5A, (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_5A, (int)pBtn_NPCLeft, 0);
+            GUIWindow::Create(469, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCLeft, 0);
             if ( pParty->field_709 )
             {
               --pParty->field_709;
@@ -1720,7 +1720,7 @@
           continue;
         case UIMSG_5B:
           goto LABEL_387;
-        case UIMSG_BE:
+        case UIMSG_CastSpell_BE:
           if ( pRenderer->pRenderD3D )
           {
             LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val();
@@ -1825,8 +1825,8 @@
           unk_50C9A0 = 0;
           back_to_game();
           continue;
-        case UIMSG_45:
-        case UIMSG_8D:
+        case UIMSG_CastSpell_SPIRIT_Preservation:
+        case UIMSG_CastSpell_8D:
         case UIMSG_8F:
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -1903,17 +1903,17 @@
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, uMessageParam);
         continue;
 
-        case UIMSG_B1:
+        case UIMSG_OnCastLloydsBeacon:
           pAudioPlayer->StopChannels(-1, -1);
-          pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, 117, 0);
+          pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_LloydsBeacon, 0);
         continue;
 
-        case UIMSG_B2:
+        case UIMSG_LloydsBeacon_FlippingBtn:
           bRecallingBeacon = uMessageParam;
           v127 = uMessageParam + 204;
           pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
           continue;
-        case UIMSG_B4:
+        case UIMSG_HintBeaconSlot:
           if ( !pGUIWindow_CurrentMenu )
             continue;
           pPlayer = pPlayers[_506348_current_lloyd_playerid + 1];
@@ -1942,7 +1942,7 @@
           sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s"
           sub_41C0B8_set_status_string(pTmpBuf);
           continue;
-        case UIMSG_B5:
+        case UIMSG_CloseAfterInstallBeacon:
           dword_50CDC8 = v0;
           //goto LABEL_453;
           pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
@@ -1953,7 +1953,7 @@
           *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
           ++pMessageQueue_50CBD0->uNumMessages;*/
           continue;
-        case UIMSG_B3:
+        case UIMSG_InstallBeacon:
           pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1];
           pNPCData4 = (NPCData *)&pPlayer9->pInstalledBeacons[uMessageParam];
           if ( !*(_QWORD *)&pNPCData4->pName && bRecallingBeacon )
@@ -2040,7 +2040,7 @@
             HIWORD(pNPCData4->uProfession) = thisg;
           }
           continue;
-        case UIMSG_B7:
+        case UIMSG_ClickTownInTP:
           if ( uMessageParam )
           {
             switch ( uMessageParam )
@@ -2117,7 +2117,7 @@
           if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63) )
             return;
           goto LABEL_486;
-        case UIMSG_B6:
+        case UIMSG_HintTownPortal:
           if ( uMessageParam )
           {
             switch ( uMessageParam )
@@ -2341,7 +2341,7 @@
           v1 = "";
           v0 = 1;
           continue;
-        case UIMSG_19:
+        case UIMSG_CastQuickSpell:
           if ( bUnderwater == 1 )
           {
             ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
@@ -2357,8 +2357,8 @@
           }
           _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter);
           continue;
-        case UIMSG_46:
-        case UIMSG_8C:
+        case UIMSG_CastSpell_SmallShot://FireBlow, Lightning, Ice Lightning, Swarm, hand hammer
+        case UIMSG_CastSpell_GreatShot://Fireball, Spraying poison and other
           if ( pRenderer->pRenderD3D )
           {
             v81 = pGame->pVisInstance->get_picked_object_zbuf_val();
@@ -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_5A,
+          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_5A,
+          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_5A,
+          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_5A, (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_5A, (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_5A, (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_5A, (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;
@@ -2895,12 +2895,12 @@
           if ( pMouse->GetCursorPos(&v211)->y > 178 )
             dword_50651C = -1;
           continue;
-        case UIMSG_A9:
-          GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_5B, (int)pBtn_Up, 0);
+        case UIMSG_ClickAwardsUpBtn:
+          GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0);
           dword_506548 = v0;
           continue;
-        case UIMSG_AA:
-          GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_5B, (int)pBtn_Down, 0);
+        case UIMSG_ClickAwardsDownBtn:
+          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_5B, (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_5B, (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_5B, (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_5B, (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_5A, (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_5A, (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_5A, (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_5A, (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_5A, (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_5A, (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_5A, (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_5A, (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_5A, (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_5A, (int)pPlayerCreationUI_BtnReset, 0);
+          GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0);
           pParty->Reset();
           break;
         case UIMSG_PlayerCreationRemoveUpSkill:
@@ -3506,7 +3506,7 @@
         case UIMSG_LoadGame:
           if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
             break;
-          SetCurrentMenuID(MENU_LOADINGPROC);
+          SetCurrentMenuID(MENU_LoadingProcInMainMenu);
           break;
         case UIMSG_SelectLoadSlot:
             //main menu save/load wnd   clicking on savegame lines
@@ -3518,7 +3518,7 @@
               v26 = uNum + pSaveListPosition;
               if ( dword_6BE138 == uNum + pSaveListPosition )
               {
-                pMessageQueue_50CBD0->AddMessage(UIMSG_LoadSlot, 0, 0);
+                pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0);
                 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0);
               }
               uLoadGameUI_SelectedSlot = v26;
@@ -3532,8 +3532,8 @@
               pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
           }
           break;
-        case UIMSG_LoadSlot:
-          GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)pBtnLoadSlot, 0);
+        case UIMSG_SaveLoadBtn:
+          GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0);
           break;
         case UIMSG_DownArrow:
           ++pSaveListPosition;
@@ -3542,7 +3542,7 @@
           if ( pSaveListPosition < 1 )
             pSaveListPosition = 0;
           pWindow = pGUIWindow_CurrentMenu;
-          GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_5A, (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_5A, (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_5A, (int)pMainMenu_BtnNew, 0);
-          SetCurrentMenuID(MENU_LOADINGPROC);
+          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_5A, (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:
@@ -9674,7 +9674,7 @@
 //----- (00410DEC) --------------------------------------------------------
 unsigned int __cdecl DrawLloydBeaconsScreen()
 {
-  Player *v0; // esi@1
+  Player *pPlayer; // esi@1
   char *v1; // eax@1
   unsigned __int16 v2; // ax@6
   unsigned int result; // eax@11
@@ -9689,14 +9689,8 @@
   char *v12; // eax@19
   char *v13; // ecx@22
   int v14; // eax@27
-  unsigned int v15; // [sp-10h] [bp-98h]@25
-  unsigned __int16 v16; // [sp-Ch] [bp-94h]@25
-  int v17; // [sp-8h] [bp-90h]@21
-  char *v18; // [sp-8h] [bp-90h]@25
   Texture *v19; // [sp-4h] [bp-8Ch]@4
-  char *v20; // [sp-4h] [bp-8Ch]@21
-  unsigned int v21; // [sp-4h] [bp-8Ch]@25
-  GUIWindow v22; // [sp+Ch] [bp-7Ch]@1
+  GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1
   unsigned int v23; // [sp+64h] [bp-24h]@14
   __int64 v24; // [sp+68h] [bp-20h]@14
   unsigned int v25; // [sp+70h] [bp-18h]@13
@@ -9706,19 +9700,19 @@
   RGBTexture *v29; // [sp+80h] [bp-8h]@12
   int uNumMaxBeacons; // [sp+84h] [bp-4h]@6
 
-  v0 = &pParty->pPlayers[_506348_current_lloyd_playerid];
+  pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid];
   pRenderer->DrawTextureIndexed(8u, 8u, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]);
   v1 = pGlobalTXT_LocalizationStrings[523];     // Recall Beacon
-  v22.uFrameX = game_viewport_x;
-  v22.uFrameY = game_viewport_y;
-  v22.uFrameWidth = 428;
-  v22.uFrameHeight = game_viewport_height;
-  v22.uFrameZ = 435;
-  v22.uFrameW = game_viewport_w;
+  pWindow.uFrameX = game_viewport_x;
+  pWindow.uFrameY = game_viewport_y;
+  pWindow.uFrameWidth = 428;
+  pWindow.uFrameHeight = game_viewport_height;
+  pWindow.uFrameZ = 435;
+  pWindow.uFrameW = game_viewport_w;
   if ( !bRecallingBeacon )
     v1 = pGlobalTXT_LocalizationStrings[375];   // Set Beacon
   sprintf(pTmpBuf, "%s", v1);
-  v22.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf, 3u);
+  pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf, 3u);
   if ( bRecallingBeacon )
   {
     pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on);
@@ -9730,7 +9724,7 @@
     v19 = pTex_tab_an_6b__zoom_on;
   }
   pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19);
-  v2 = v0->pActiveSkills[14];
+  v2 = pPlayer->pActiveSkills[14];
   uNumMaxBeacons = 1;
   if ( HIBYTE(v2) & 1 || (v2 & 0x80u) != 0 )
   {
@@ -9746,33 +9740,26 @@
   if ( uNumMaxBeacons > 0 )
   {
     v29 = pSavegameThumbnails;
-    v28 = v0->pInstalledBeacons;
+    v28 = pPlayer->pInstalledBeacons;
     while ( 1 )
     {
-      v22.uFrameWidth = 92;
+      pWindow.uFrameWidth = 92;
       v4 = result;
-      v22.uFrameHeight = 68;
+      pWindow.uFrameHeight = 68;
       v5 = pLloydsBeaconsPreviewXs[result];
-      v22.uFrameY = pLloydsBeaconsPreviewYs[result];
-      v25 = v22.uFrameY;
-      v22.uFrameX = v5;
-      v22.uFrameW = v22.uFrameY + 67;
+      pWindow.uFrameY = pLloydsBeaconsPreviewYs[result];
+      v25 = pWindow.uFrameY;
+      pWindow.uFrameX = v5;
+      pWindow.uFrameW = pWindow.uFrameY + 67;
       v6 = v29->pPixels == 0;
-      v22.uFrameZ = v5 + 91;
+      pWindow.uFrameZ = v5 + 91;
       if ( !v6 )
         break;
       if ( !bRecallingBeacon )
       {
-        pRenderer->DrawTextureTransparent(
-          pLloydsBeacons_SomeXs[v4],
-          pLloydsBeacons_SomeYs[v4],
-          pTexture_CurrentBook);
-        v21 = 3;
-        v18 = pGlobalTXT_LocalizationStrings[19];
-        v16 = 1;
-        v14 = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &v22, 0, 0);
-        v15 = (signed int)v22.uFrameHeight / 2 - v14 / 2;
-        goto LABEL_28;
+        pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook);
+        v14 = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0);
+        pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - v14 / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);
       }
 LABEL_29:
       ++v29;
@@ -9781,16 +9768,13 @@
       if ( v27 >= uNumMaxBeacons )
         goto LABEL_30;
     }
-    pRenderer->DrawTextureTransparent(
-      pLloydsBeacons_SomeXs[v4],
-      pLloydsBeacons_SomeYs[v4],
-      pTexture_CurrentBook);
+    pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook);
     pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[v4], pLloydsBeaconsPreviewYs[v4], v29);
     v7 = v28;
     Str = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(v28->field_18))].pName;
-    v8 = pSpellFont->CalcTextHeight(Str, &v22, 0, 0);
-    v22.uFrameY += -6 - v8;
-    v22.DrawTitleText(pSpellFont, 0, 0, 1u, Str, 3u);
+    v8 = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0);
+    pWindow.uFrameY += -6 - v8;
+    pWindow.DrawTitleText(pSpellFont, 0, 0, 1u, Str, 3u);
     v9 = v7->uBeaconTime - pParty->uTimePlayed;
     LODWORD(v24) = LODWORD(v7->uBeaconTime) - LODWORD(pParty->uTimePlayed);
     HIDWORD(v24) = HIDWORD(v9);
@@ -9802,18 +9786,9 @@
       v13 = pGlobalTXT_LocalizationStrings[57]; // Days
       if ( v11 > 1 )
       {
-LABEL_24:
-        v20 = v13;
-        v17 = v11 + 1;
-LABEL_25:
-        sprintf(pTmpBuf, "%lu %s", v17, v20);
-        v21 = 3;
-        v18 = pTmpBuf;
-        v16 = 1;
-        v22.uFrameY = v25 + v22.uFrameHeight + 4;
-        v15 = 0;
-LABEL_28:
-        v22.DrawTitleText(pSpellFont, 0, v15, v16, v18, v21);
+        sprintf(pTmpBuf, "%lu %s", v11 + 1, v13);
+        pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
+        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3);
         goto LABEL_29;
       }
     }
@@ -9825,13 +9800,17 @@
           v12 = pGlobalTXT_LocalizationStrings[109];// Hour
         else
           v12 = pGlobalTXT_LocalizationStrings[110];// Hours
-        v20 = v12;
-        v17 = v10 + 1;
-        goto LABEL_25;
+        sprintf(pTmpBuf, "%lu %s", v10 + 1, v12);
+        pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
+        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3);
+        goto LABEL_29;
       }
     }
     v13 = pGlobalTXT_LocalizationStrings[56];   // Day
-    goto LABEL_24;
+    sprintf(pTmpBuf, "%lu %s", v11 + 1, v13);
+    pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
+    pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3);
+    goto LABEL_29;
   }
 LABEL_30:
   if ( byte_506360 )
@@ -9839,13 +9818,13 @@
     /*result = pMessageQueue_50CBD0->uNumMessages;
     if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
     {
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)181;
+      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CloseAfterInstallBeacon;
       pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
       result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
       *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
       ++pMessageQueue_50CBD0->uNumMessages;
     }*/
-    pMessageQueue_50CBD0->AddMessage(UIMSG_B5, 0, 0);
+    pMessageQueue_50CBD0->AddMessage(UIMSG_CloseAfterInstallBeacon, 0, 0);
   }
   return result;
 }
@@ -10307,241 +10286,408 @@
     pWindowType = pWindow->eWindowType;
     switch (pWindow->eWindowType)
     {
-		case WINDOW_MainMenu_Load:
-			{
-			GameUI_MainMenu_DrawLoad();
-			break;
-			}
-		case WINDOW_5E: // window that initiates savegame loading
-			{
-			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]);
-			pHint = pWindow->Hint;
-			viewparams->bRedrawGameUI = 1;
-			if ( pHint && pHint != (char *)1 )
-				pGUIButton3->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_3:
-			{
-			pTexture = (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0);//pWindowType == 3 (0x3)
-			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_17:
-			{
-			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]);
+      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();
+        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;
-            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);
+            if ( pWindow->Hint )
+            {
+              v24 = pWindow->Hint == (char *)1;
+              if ( !v24 )
+                pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
             }
-            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;
-			}
-	}
+            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);
+        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 )
+          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);
+        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();
@@ -11472,43 +11618,15 @@
         i->uX = 0;
       }
     }
-    pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(
-                   0x1B6u,
-                   0x2Eu,
-                   (uTextureID_ar_up_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_up_up].uTextureWidth : 24),
+    pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(438, 46, (uTextureID_ar_up_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_up_up].uTextureWidth : 24),
                    (uTextureID_ar_up_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_up_up].uTextureHeight : 26),
-                   1,
-                   0,
-                   UIMSG_A9, 0,
-                   0,
-                   "",
-                   (Texture *)(uTextureID_ar_up_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_up] : 0),
-                   uTextureID_ar_up_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_dn] : 0,
-                   0);
-    pBtn_Down = pGUIWindow_CurrentMenu->CreateButton(
-                   0x1B6u,
-                   0x124u,
-                   (uTextureID_ar_dn_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_dn_up].uTextureWidth : 24),
+                   1, 0, UIMSG_ClickAwardsUpBtn, 0, 0, "", (Texture *)(uTextureID_ar_up_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_up] : 0),
+                   uTextureID_ar_up_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_dn] : 0, 0);
+    pBtn_Down = pGUIWindow_CurrentMenu->CreateButton(438, 292, (uTextureID_ar_dn_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_dn_up].uTextureWidth : 24),
                    (uTextureID_ar_dn_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_dn_up].uTextureHeight : 26),
-                   1,
-                   0,
-                   UIMSG_AA, 0,
-                   0,
-                   "",
-                   (Texture *)(uTextureID_ar_dn_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_up] : 0),
-                   uTextureID_ar_dn_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_dn] : 0,
-                   0);
-    ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(
-                   0x1B8u,
-                   0x3Eu,
-                   0x10u,
-                   0xE8u,
-                   1,
-                   0,
-                   UIMSG_C0, 0,
-                   0,
-                   "",
-                   0);
+                   1, 0, UIMSG_ClickAwardsDownBtn, 0, 0, "", (Texture *)(uTextureID_ar_dn_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_up] : 0),
+                   uTextureID_ar_dn_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_dn] : 0, 0);
+    ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(440, 62, 16, 232, 1, 0, UIMSG_C0, 0, 0, "", 0);
   }
 }
 
--- a/mm7_6.cpp	Tue May 07 18:44:23 2013 +0600
+++ b/mm7_6.cpp	Tue May 07 18:45:18 2013 +0600
@@ -2150,26 +2150,50 @@
 
         case SPELL_SPIRIT_BLESS:
           if (a4 && ~a4 & 0x01C0)
-            goto LABEL_25;
+            //goto LABEL_25;
+          {
+            a5 |= 0x0002;
+            break;
+          }
           else if ((player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0);
-            goto LABEL_25;
+            //goto LABEL_25;
+          {
+            a5 |= 0x0002;
+            break;
+          }
           break;
 
         case SPELL_SPIRIT_PRESERVATION:
           v9 = a4;
           if ( !a4 )
             v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT];
-          goto LABEL_18;
+          //goto LABEL_18;
+          v10 = SkillToMastery(v9);
+          v12 = __OFSUB__(v10, 3);
+          v11 = ((v10 - 3) & 0x80000000u) != 0;
+          //goto LABEL_24;
+          if ( v11 ^ v12 )
+          {
+            a5 |= 0x0002;
+            break;
+          }
+          break;
 
         case SPELL_DARK_PAIN_REFLECTION:
           v9 = a4;
           if ( !a4 )
             v9 = player->pActiveSkills[PLAYER_SKILL_DARK];
-LABEL_18:
+//LABEL_18:
           v10 = SkillToMastery(v9);
           v12 = __OFSUB__(v10, 3);
           v11 = ((v10 - 3) & 0x80000000u) != 0;
-          goto LABEL_24;
+          //goto LABEL_24;
+          if ( v11 ^ v12 )
+          {
+            a5 |= 0x0002;
+            break;
+          }
+          break;
 
         case SPELL_BODY_HAMMERHANDS:
           v13 = a4;
@@ -2178,9 +2202,13 @@
           v14 = SkillToMastery(v13);
           v12 = __OFSUB__(v14, 4);
           v11 = ((v14 - 4) & 0x80000000u) != 0;
-LABEL_24:
+//LABEL_24:
           if ( v11 ^ v12 )
-            goto LABEL_25;
+            //goto LABEL_25;
+          {
+            a5 |= 0x0002;
+            break;
+          }
           break;
 
         case SPELL_EARTH_STONE_TO_FLESH:
@@ -2194,7 +2222,7 @@
         case SPELL_BODY_REGENERATION:
         case SPELL_BODY_CURE_POISON:
         case SPELL_BODY_CURE_DISEASE:
-LABEL_25:
+//LABEL_25:
           //v6 = a5 | 2;
           a5 |= 0x0002;
           break;
@@ -2246,11 +2274,11 @@
       {
         if ( pGUIWindow_Settings )
           return;
-        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_1B, (int)&pCastSpellInfo[result], 0);
-        pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 0, 0x31u, "", 0);
-        pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 1u, 0x32u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 2u, 0x33u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 3u, 0x34u, "", 0);
+        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
+        pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 0, 49, "", 0);
+        pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 1, 50, "", 0);
+        pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 2, 51, "", 0);
+        pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 3, 52, "", 0);
         sub_421B2C_PlaceInInventory_or_DropPickedItem();
         return;
       }
@@ -2259,8 +2287,8 @@
         if ( pGUIWindow_Settings )
           return;
 
-        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_1B, (int)&pCastSpellInfo[result], 0);
-        pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_46, 0, 0, "", 0);
+        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
+        pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_SmallShot, 0, 0, "", 0);
         sub_421B2C_PlaceInInventory_or_DropPickedItem();
         return;
       }
@@ -2269,8 +2297,8 @@
         if ( pGUIWindow_Settings )
           return;
 
-        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_1B, (int)&pCastSpellInfo[result], 0);
-        pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_BE, 0, 0, "", 0);
+        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
+        pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_BE, 0, 0, "", 0);
         sub_421B2C_PlaceInInventory_or_DropPickedItem();
         return;
       }
@@ -2291,17 +2319,17 @@
       {
         if ( pGUIWindow_Settings )
           return;
-        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_1B, (int)&pCastSpellInfo[result], 0);
-        pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 0, 0x31u, "", 0);
-        pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 1, 0x32u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 2, 0x33u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 3, 0x34u, "", 0);
-		pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_8C, 0, 0, "", NULL);
-		sub_421B2C_PlaceInInventory_or_DropPickedItem();
+        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
+        pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 0, 0x31u, "", 0);
+        pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 1, 0x32u, "", 0);
+        pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 2, 0x33u, "", 0);
+        pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 3, 0x34u, "", 0);
+        pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_GreatShot, 0, 0, "", NULL);
+        sub_421B2C_PlaceInInventory_or_DropPickedItem();
       }
       if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings )
       {
-        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_1B, (int)&pCastSpellInfo[result], 0);
+        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
         pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178,
                        pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth,
                        pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight,
@@ -5393,7 +5421,7 @@
 		if ( pPlayer->sMana >= (signed int)uRequiredMana )
 		{
 			pEventTimer->Pause();
-			pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0);
+			pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0);
 			qword_506350 = (signed int)v733;
 			_506348_current_lloyd_playerid = pCastSpell->uPlayerID;
 			::uRequiredMana = v319;
@@ -7625,7 +7653,7 @@
     CASE(UIMSG_StartNPCDialogue)
     CASE(UIMSG_ArrowUp)
     CASE(UIMSG_DownArrow)
-    CASE(UIMSG_LoadSlot)
+    CASE(UIMSG_SaveLoadBtn)
     CASE(UIMSG_SelectLoadSlot)
     CASE(UIMSG_Cancel)
     CASE(UIMSG_ExitRest)