changeset 832:dfd683c4f538

Hotkeys fixed Moved GUIButton.h to GUIWindow.h
author Nomad
date Wed, 27 Mar 2013 19:50:37 +0200
parents 9c3f28b31b4a
children b66abf8b7d50
files Actor.cpp Chest.cpp Events.cpp GUIButton.cpp GUIButton.h GUIWindow.cpp GUIWindow.h GameUIs.cpp Indoor.cpp Player.cpp UIBooks.cpp UICharacter.cpp UIHouses.cpp UIMainMenu.cpp UIOptions.cpp UIPartyCreation.cpp UIPopup.cpp UIRest.cpp UISaveLoad.cpp UiGame.cpp VideoPlayer.cpp Viewport.h mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp
diffstat 28 files changed, 885 insertions(+), 940 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/Actor.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -288,7 +288,7 @@
             LOBYTE(pFontArrus->uFontHeight) - 3,
             1,
             0,
-            0x88u,
+            UIMSG_SelectNPCDialogueOption,
             9u,
             0,
             "",
@@ -298,10 +298,10 @@
       }
     }
   }
-  pDialogueWindow->CreateButton(61u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-  pDialogueWindow->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-  pDialogueWindow->CreateButton(292u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-  pDialogueWindow->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
+  pDialogueWindow->CreateButton(61u, 424u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0);
+  pDialogueWindow->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0);
+  pDialogueWindow->CreateButton(292u, 424u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0);
+  pDialogueWindow->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0);
   if (v17 && uActiveCharacter && !v5->Hired())
   {
     if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21)
--- a/Chest.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/Chest.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -241,9 +241,9 @@
 
   pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Chest, uChestID, 0);
   pChestWindow = pGUIWindow_CurrentMenu;
-  pBtn_ExitCancel = pChestWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1,  0,  0x71u,  0, 0,  pGlobalTXT_LocalizationStrings[79],// Exit
+  pBtn_ExitCancel = pChestWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1,  0,  UIMSG_Escape,  0, 0,  pGlobalTXT_LocalizationStrings[79],// Exit
                  (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0),   0);
-  pChestWindow->CreateButton(7u, 8u, 460u, 343u, 1, 0, 0xCu, 0, 0, "", 0);
+  pChestWindow->CreateButton(7u, 8u, 460u, 343u, 1, 0, UIMSG_C, 0, 0, "", 0);
   pCurrentScreen = SCREEN_CHEST;
   pEventTimer->Pause();
   return 1;
--- a/Events.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/Events.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -5,7 +5,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Chest.h"
 #include "stru176.h"
@@ -601,11 +600,11 @@
                   {
                     pAudioPlayer->StopChannels(-1, -1);
                     window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0);
-                    window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-                    window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-                    window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-                    window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
-                    window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
+                    window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0);
+                    window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0);
+                    window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0);
+                    window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0);
+                    window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0);
                     current_npc_text = pNPCTopics[90].pText;
                   }
                 }
@@ -1386,11 +1385,11 @@
 					if ( uCurrentHouse_Animation != 167 )
 						v104 = EVT_DWORD(_evt->v5);
 					window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0);
-					window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, 0x6Eu, 1, 49, "", 0);
-					window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, 0x6Eu, 2, 50, "", 0);
-					window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, 0x6Eu, 3, 51, "", 0);
-					window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, 0x6Eu, 4, 52, "", 0);
-					window_SpeakInHouse->CreateButton(  0,   0,  0, 0, 1,  0, 0xB0u, 0, 9u, "", 0);
+					window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, 49, "", 0);
+					window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, 50, "", 0);
+					window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, 51, "", 0);
+					window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, 52, "", 0);
+					window_SpeakInHouse->CreateButton(  0,   0,  0, 0, 1,  0, UIMSG_CycleCharacters, 0, 9u, "", 0);
 					}
 				++curr_seq_num;
 				v4 = v124;
--- a/GUIButton.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/GUIButton.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -1,4 +1,3 @@
-#include "GUIButton.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
 #include "Allocator.h"
--- a/GUIButton.h	Wed Mar 27 15:04:59 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-#pragma once
-
-
-/*  156 */
-#pragma pack(push, 1)
-struct GUIButton
-{
-  char DrawLabel(const char *edx0, struct GUIFont *pFont, int a5, int *a9);
-
-  void Release();
-
-
-  unsigned int uX;
-  unsigned int uY;
-  unsigned int uWidth;
-  unsigned int uHeight;
-  unsigned int uZ;
-  unsigned int uW;
-  int uButtonType;
-  int field_1C;//may be pMessageType
-  unsigned int uControlID;
-  unsigned int uControlParam;
-  int field_28;
-  int field_2C_is_pushed;
-  GUIButton *pPrev;
-  GUIButton *pNext;
-  struct GUIWindow *pParent;
-  struct Texture *pTextures[5];
-  unsigned int uNumTextures;
-  unsigned __int8 uHotkey;
-  char pButtonName[32];
-  char field_75[71];
-};
-#pragma pack(pop)
-
-
-
-
-extern struct GUIButton *pBtn_CloseBook;
-extern struct GUIButton *pBtn_InstallRemoveSpell;
-extern struct GUIButton *pBtn_Autonotes_Instructors;
-extern struct GUIButton *pBtn_Autonotes_Misc;
-extern struct GUIButton *pBtn_Book_6;
-extern struct GUIButton *pBtn_Book_5;
-extern struct GUIButton *pBtn_Book_4;
-extern struct GUIButton *pBtn_Book_3;
-extern struct GUIButton *pBtn_Book_2;
-extern struct GUIButton *pBtn_Book_1;
-
-
-extern struct GUIButton *pPlayerCreationUI_BtnReset;
-extern struct GUIButton *pPlayerCreationUI_BtnOK;
-extern struct GUIButton *pBtn_ExitCancel;
-extern struct GUIButton *pBtn_YES;
-extern struct GUIButton *pPlayerCreationUI_BtnPlus;
-extern struct GUIButton *pPlayerCreationUI_BtnMinus;
-
-
-extern struct GUIButton *pButton_RestUI_Main;
-extern struct GUIButton *pButton_RestUI_Exit;
-extern struct GUIButton *pButton_RestUI_Wait5Minutes;
-extern struct GUIButton *pButton_RestUI_WaitUntilDawn;
-extern struct GUIButton *pButton_RestUI_Wait1Hour;
-
-
-extern struct GUIButton *pCharacterScreen_ExitBtn;
-extern struct GUIButton *pCharacterScreen_AwardsBtn;
-extern struct GUIButton *pCharacterScreen_InventoryBtn;
-extern struct GUIButton *pCharacterScreen_SkillsBtn;
-extern struct GUIButton *pCharacterScreen_StatsBtn;
-extern struct GUIButton *pCharacterScreen_DollBtn;
-extern struct GUIButton *pCharacterScreen_DetalizBtn;
-
-
-extern struct GUIButton *pBtn_NPCRight;
-extern struct GUIButton *pBtn_NPCLeft;
-extern struct GUIButton *pBtn_GameSettings;
-extern struct GUIButton *pBtn_QuickReference;
-extern struct GUIButton *pBtn_CastSpell;
-extern struct GUIButton *pBtn_Rest;
-extern struct GUIButton *pBtn_History;
-extern struct GUIButton *pBtn_Calendar;
-extern struct GUIButton *pBtn_Maps;
-extern struct GUIButton *pBtn_Autonotes;
-extern struct GUIButton *pBtn_Quests;
-
-
-extern struct GUIButton *pMainMenu_BtnExit;
-extern struct GUIButton *pMainMenu_BtnCredits;
-extern struct GUIButton *pMainMenu_BtnLoad;
-extern struct GUIButton *pMainMenu_BtnNew;
-
-
-extern struct GUIButton *pBtn_Up;
-extern struct GUIButton *pBtn_Down;
-extern struct GUIButton *ptr_507BA4;
-
-
-extern struct GUIWindow *pPrimaryWindow;
-extern struct GUIWindow *pChestWindow;
-extern struct GUIWindow *pDialogueWindow;
-extern struct GUIWindow *window_SpeakInHouse;
-extern struct GUIWindow *pGUIWindow_ScrollWindow;
-extern struct GUIWindow *ptr_507BC8;
-extern struct GUIWindow *pGUIWindow_CurrentMenu;
-extern struct GUIWindow *ptr_507BD0;
-extern struct GUIWindow *pGUIWindow_Settings;
-extern struct GUIWindow *ptr_507BDC;
-extern struct GUIWindow *pGUIWindow_EscMessageWindow;
-extern struct GUIWindow *pBooksWindow;
-extern struct GUIWindow *pGUIWindow2;
-
-
-extern struct GUIButton *pBtn_Resume;
-extern struct GUIButton *pBtn_QuitGame;
-extern struct GUIButton *pBtn_GameControls;
-extern struct GUIButton *pBtn_LoadGame;
-extern struct GUIButton *pBtn_SaveGame;
-extern struct GUIButton *pBtn_NewGame;
-
-extern struct GUIButton *pBtn_SliderRight;
-extern struct GUIButton *pBtn_SliderLeft;
-
-
-extern struct GUIButton *pBtnDownArrow;
-extern struct GUIButton *pBtnArrowUp;
-extern struct GUIButton *pBtnCancel;
-extern struct GUIButton *pBtnLoadSlot;
-
-
-extern GUIButton *pCreationUI_BtnPressRight2[4];
-extern GUIButton *pCreationUI_BtnPressLeft2[4];
-extern GUIButton *pCreationUI_BtnPressLeft[4];
-extern GUIButton *pCreationUI_BtnPressRight[4];
\ No newline at end of file
--- a/GUIWindow.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/GUIWindow.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -1,5 +1,4 @@
 #include "GUIWindow.h"
-#include "GUIButton.h"
 #include "GUIFont.h"
 #include "Party.h"
 #include "LOD.h"
@@ -469,7 +468,7 @@
   v1 = this;
   pAudioPlayer->StopChannels(-1, -1);
   InitializeBookFonts();
-  v1->CreateButton(0x1DBu, 0x1BDu, 0x9Eu, 0x22u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close
+  v1->CreateButton(0x1DBu, 0x1BDu, 0x9Eu, 0x22u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close
   pCurrentScreen = SCREEN_BOOKS;
   awards_count2 = 0;
   dword_506528 = 0;
@@ -484,8 +483,8 @@
       pTexture_50635C = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("sbmap", TEXTURE_16BIT_PALETTE)];
       pTex_tab_an_6b__zoom_on  = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-6b", TEXTURE_16BIT_PALETTE)];
       pTex_tab_an_6a__zoom_off = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-6a", TEXTURE_16BIT_PALETTE)];
-      pBtn_Book_1 = v1->CreateButton(415, 13, 39, 36, 1, 0, 0xB2u, 0, 0, pGlobalTXT_LocalizationStrings[375], 0);
-      pBtn_Book_2 = v1->CreateButton(415, 48, 39, 36, 1, 0, 0xB2u, 1, 0, pGlobalTXT_LocalizationStrings[523], 0);
+      pBtn_Book_1 = v1->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_B2, 0, 0, pGlobalTXT_LocalizationStrings[375], 0);
+      pBtn_Book_2 = v1->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_B2, 1, 0, pGlobalTXT_LocalizationStrings[523], 0);
       v17 = &pParty->pPlayers[_506348_current_lloyd_playerid];
       v23 = 1;
       v18 = v17->pActiveSkills[14];
@@ -503,7 +502,7 @@
           {
           do
               {
-              v1->CreateButton(pLloydsBeaconsPreviewXs[v19], pLloydsBeaconsPreviewYs[v19], 0x5Cu, 0x44u, 1, 180, 0xB3u, v19, 0, "", 0);
+              v1->CreateButton(pLloydsBeaconsPreviewXs[v19], pLloydsBeaconsPreviewYs[v19], 0x5Cu, 0x44u, 1, 180, UIMSG_B3, v19, 0, "", 0);
               ++v19;
               }
               while ( (signed int)v19 < v23 );
@@ -535,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, 183, i, 0, "", nullptr);
+        v1->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_B7, i, 0, "", nullptr);
       /*v16 = 0;
       do
           {
@@ -555,10 +554,10 @@
       pTex_tab_an_6a__zoom_off = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-6a", TEXTURE_16BIT_PALETTE)];
       pTex_tab_an_7a__zoot_off = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-7a", TEXTURE_16BIT_PALETTE)];
       pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on->uTextureWidth,
-          pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, 0x47u, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up"
+          pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, UIMSG_AutonotesBook, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up"
           pTex_tab_an_6b__zoom_on, 0);
       pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight,
-          pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, 0x47u, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down"
+          pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, UIMSG_AutonotesBook, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down"
           pTex_tab_an_7b__zoot_on, 0);
       awards_count = 0;
       memset(&achievedAwardsIndex, 0, 4000);
@@ -596,21 +595,21 @@
       pTexture_506370 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-4a", TEXTURE_16BIT_PALETTE)];
       pTexture_50636C = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-8b", TEXTURE_16BIT_PALETTE)];
       pTexture_506368 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-8a", TEXTURE_16BIT_PALETTE)];
-      pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 0x32u, 0x22u, 1, 0, 0x47u, 0xBu, 0,
+      pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 0xBu, 0,
           pGlobalTXT_LocalizationStrings[193], pTex_tab_an_6b__zoom_on, 0);
-      pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 0x32u, 0x22u, 1, 0, 0x47u, 0xAu, 0,
+      pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 0xAu, 0,
           pGlobalTXT_LocalizationStrings[192], pTex_tab_an_7b__zoot_on, 0);
-      pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 0x32u, 0x22u, 1, 0, 0x47u, 2u, 0,
+      pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 2u, 0,
           pGlobalTXT_LocalizationStrings[85], pTexture_506394, 0);// "Potion Notes"
-      pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 0x32u, 0x22u, 1, 0, 0x47u, 3u, 0,
+      pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 3u, 0,
           pGlobalTXT_LocalizationStrings[137], pTexture_50638C, 0);// "Fountain Notes"
-      pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 0x32u, 0x22u, 1, 0, 0x47u, 4u, 0,
+      pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 4u, 0,
           pGlobalTXT_LocalizationStrings[8], pTexture_506384, 0);// "Obelisk Notes"
-      pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 0x32u, 0x22u, 1, 0, 0x47u, 5u, 0,
+      pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 5u, 0,
           pGlobalTXT_LocalizationStrings[141], pTexture_50637C, 0);// "Seer Notes"
-      pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 0x32u, 0x22u, 1, 0, 0x47u, 6u, 0,
+      pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 6u, 0,
           pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0);// "Miscellaneous Notes"
-      v9 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 0x32u, 0x22u, 1, 0, 0x47u, 7u, 0,
+      v9 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 7u, 0,
           pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0);// "Instructors"
       v10 = dword_506528;
       pBtn_Autonotes_Instructors = v9;
@@ -650,17 +649,17 @@
       pTexture_506380 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tabEoff", TEXTURE_16BIT_PALETTE)];
       pTexture_50637C = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tabWon", TEXTURE_16BIT_PALETTE)];
       pTexture_506378 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tabWoff", TEXTURE_16BIT_PALETTE)];
-      pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 0x32u, 0x22u, 1, 0, 0x47u, 0, 0,
+      pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 0, 0,
           pGlobalTXT_LocalizationStrings[251], pTex_tab_an_6b__zoom_on, 0);// "Zoom In"
-      pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 0x32u, 0x22u, 1, 0, 0x47u, 1, 0,
+      pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 1, 0,
           pGlobalTXT_LocalizationStrings[252], pTex_tab_an_7b__zoot_on, 0);// "Zoom Out"
-      pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 0x32u, 0x22u, 1, 0, 0x47u, 2, 0,
+      pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 2, 0,
           pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up
-      pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 0x32u, 0x22u, 1, 0, 0x47u, 3, 0,
+      pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 3, 0,
           pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down
-      pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 0x32u, 0x22u, 1, 0, 0x47u, 4, 0,
+      pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 4, 0,
           pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right"
-      pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 0x32u, 0x22u, 1, 0, 0x47u, 5, 0,
+      pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 0x32u, 0x22u, 1, 0, UIMSG_AutonotesBook, 5, 0,
           pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left"
       }
       break;
@@ -687,7 +686,7 @@
           pTex_tab_an_6b__zoom_on->uTextureHeight,
           1,
           0,
-          0x47u,
+          UIMSG_AutonotesBook,
           0xBu,
           0,
           pGlobalTXT_LocalizationStrings[192],
@@ -700,7 +699,7 @@
           pTex_tab_an_7b__zoot_on->uTextureHeight,
           1,
           0,
-          0x47u,
+          UIMSG_AutonotesBook,
           0xAu,
           0,
           pGlobalTXT_LocalizationStrings[193],
@@ -982,37 +981,37 @@
                    pViewport->uViewportTL_Y +  pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos,  //dword_4E20D0
                    dword_506408[i + 1]->uTextureWidth,
                    dword_506408[i + 1]->uTextureHeight,
-                   1, 79, 0x56u, i, 0, "", 0);
+                   1, 79, UIMSG_SelectSpell, i, 0, "", 0);
       ++a2;
     //++v3;
   }
   //while ( (signed int)v3 < 11 );
 
-  CreateButton(0, 0, 0, 0, 1, 0, 0x33u, 0, 9u, "", 0);
+  CreateButton(0, 0, 0, 0, 1, 0, UIMSG_33, 0, 9u, "", 0);
   if ( a2 )
     _41D08F(a2, 0, 0, 0);
   if (pPlayer->pActiveSkills[PLAYER_SKILL_FIRE])
-    CreateButton(0x18Fu, 0xAu, 0x32u, 0x24u, 1, 0, 0x57u, 0, 0, aSpellSchoolNames[0], 0);
+    CreateButton(0x18Fu, 0xAu, 0x32u, 0x24u, 1, 0, UIMSG_OpenSpellbookPage, 0, 0, aSpellSchoolNames[0], 0);
   if (pPlayer->pActiveSkills[PLAYER_SKILL_AIR])
-    CreateButton(0x18Fu, 0x2Eu, 0x32u, 0x24u, 1, 0, 0x57u, 1u, 0, aSpellSchoolNames[1], 0);
+    CreateButton(0x18Fu, 0x2Eu, 0x32u, 0x24u, 1, 0, UIMSG_OpenSpellbookPage, 1u, 0, aSpellSchoolNames[1], 0);
   if (pPlayer->pActiveSkills[PLAYER_SKILL_WATER])
-    CreateButton(0x18Fu, 0x53u, 0x32u, 0x24u, 1, 0, 0x57u, 2u, 0, aSpellSchoolNames[2], 0);
+    CreateButton(0x18Fu, 0x53u, 0x32u, 0x24u, 1, 0, UIMSG_OpenSpellbookPage, 2u, 0, aSpellSchoolNames[2], 0);
   if (pPlayer->pActiveSkills[PLAYER_SKILL_EARTH])
-    CreateButton(0x18Fu, 0x79u, 0x32u, 0x24u, 1, 0, 0x57u, 3u, 0, aSpellSchoolNames[3], 0);
+    CreateButton(0x18Fu, 0x79u, 0x32u, 0x24u, 1, 0, UIMSG_OpenSpellbookPage, 3u, 0, aSpellSchoolNames[3], 0);
   if (pPlayer->pActiveSkills[PLAYER_SKILL_SPIRIT])
-    CreateButton(0x18Fu, 0x9Eu, 0x32u, 0x24u, 1, 0, 0x57u, 4u, 0, aSpellSchoolNames[4], 0);
+    CreateButton(0x18Fu, 0x9Eu, 0x32u, 0x24u, 1, 0, UIMSG_OpenSpellbookPage, 4u, 0, aSpellSchoolNames[4], 0);
   if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND])
-    CreateButton(0x190u, 0xC4u, 0x32u, 0x24u, 1, 0, 0x57u, 5u, 0, aSpellSchoolNames[5], 0);
+    CreateButton(0x190u, 0xC4u, 0x32u, 0x24u, 1, 0, UIMSG_OpenSpellbookPage, 5u, 0, aSpellSchoolNames[5], 0);
   if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY])
-    CreateButton(0x190u, 0xEAu, 0x32u, 0x24u, 1, 0, 0x57u, 6u, 0, aSpellSchoolNames[6], 0);
+    CreateButton(0x190u, 0xEAu, 0x32u, 0x24u, 1, 0, UIMSG_OpenSpellbookPage, 6u, 0, aSpellSchoolNames[6], 0);
   if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT])
-    CreateButton(0x190u, 0x10Fu, 0x32u, 0x24u, 1, 0, 0x57u, 7u, 0, aSpellSchoolNames[7], 0);
+    CreateButton(0x190u, 0x10Fu, 0x32u, 0x24u, 1, 0, UIMSG_OpenSpellbookPage, 7u, 0, aSpellSchoolNames[7], 0);
   if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK])
-    CreateButton(0x190u, 0x133u, 0x32u, 0x24u, 1, 0, 0x57u, 8u, 0, aSpellSchoolNames[8], 0);
-  CreateButton(0x1DCu, 0x1C2u, pTexture_506444->uTextureWidth, pTexture_506444->uTextureHeight, 1, 78, 0x58u, 0, 0, "", 0);
-  pBtn_InstallRemoveSpell = CreateButton(0x1DCu, 0x1C2u, 0x30u, 0x20u, 1, 78, 0x58u, 0, 0, "", pTexture_506444, 0);
-  CreateButton(0x231u, 0x1C2u, ptr_506440->uTextureWidth, ptr_506440->uTextureHeight, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], 0);
-  pBtn_CloseBook = CreateButton(0x231u, 0x1C2u, 0x30u, 0x20u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], ptr_506440, 0);
+    CreateButton(0x190u, 0x133u, 0x32u, 0x24u, 1, 0, UIMSG_OpenSpellbookPage, 8u, 0, aSpellSchoolNames[8], 0);
+  CreateButton(0x1DCu, 0x1C2u, pTexture_506444->uTextureWidth, pTexture_506444->uTextureHeight, 1, 78, UIMSG_58, 0, 0, "", 0);
+  pBtn_InstallRemoveSpell = CreateButton(0x1DCu, 0x1C2u, 0x30u, 0x20u, 1, 78, UIMSG_58, 0, 0, "", pTexture_506444, 0);
+  CreateButton(0x231u, 0x1C2u, ptr_506440->uTextureWidth, ptr_506440->uTextureHeight, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0);
+  pBtn_CloseBook = CreateButton(0x231u, 0x1C2u, 0x30u, 0x20u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], ptr_506440, 0);
 }
 // 50640C: using guessed type int dword_50640C[];
 
@@ -1666,7 +1665,7 @@
 
 //----- (0041D12F) --------------------------------------------------------
 GUIButton *GUIWindow::CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, 
-	int a6, int a7, unsigned int uControlID, unsigned int uControlParam, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...)
+	int a6, int a7, UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...)
 {
   GUIButton *pButton; // esi@1
   unsigned int v13; // eax@1
@@ -1697,8 +1696,8 @@
   pButton->field_2C_is_pushed = 0;
   pButton->uW = v17 + uHeight - 1;
   pButton->field_1C = a7;
-  pButton->uControlID = uControlID;
-  pButton->uControlParam = uControlParam;
+  pButton->msg = msg;
+  pButton->msg_param = msg_param;
   pButton->uHotkey = uHotkey;
   strlen(pName);
   strcpy(pButton->pButtonName, pName);
@@ -1790,7 +1789,7 @@
         case WINDOW_Dialogue:
           pMainScreenNum = pCurrentScreen;
           pCurrentScreen = SCREEN_NPC_DIALOGUE;
-          pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit"
+          pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit"
                          pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
           if ( pWindow->par1C != 1 )
           {
@@ -1801,7 +1800,7 @@
             {
               if ( speakingNPC->joins )
               {
-                pWindow->CreateButton(480, 130, 140, v11, 1, 0, 0x88u, 0xDu, 0, "", 0);
+                pWindow->CreateButton(480, 130, 140, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0xDu, 0, "", 0);
                 num_menu_buttons = 1;
               }
               if ( speakingNPC->evt_A )
@@ -1810,7 +1809,7 @@
                 {
                   v14 = NPC_EventProcessor(speakingNPC->evt_A);
                   if ( v14 == 1 || v14 == 2 )
-                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x13u, 0, "", 0);
+                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x13u, 0, "", 0);
                 }
               }
               if ( speakingNPC->evt_B )
@@ -1819,7 +1818,7 @@
                 {
                   v16 = NPC_EventProcessor(speakingNPC->evt_B);
                   if ( v16 == 1 || v16 == 2 )
-                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x14u, 0, "", 0);
+                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x14u, 0, "", 0);
                 }
               }
               if ( speakingNPC->evt_C )
@@ -1828,7 +1827,7 @@
                 {
                   v18 = NPC_EventProcessor(speakingNPC->evt_C);
                   if ( v18 == 1 || v18 == 2 )
-                    pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x15u, 0, "", 0);
+                    pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x15u, 0, "", 0);
                 }
               }
               if ( speakingNPC->evt_D )
@@ -1837,7 +1836,7 @@
                 {
                   v20 = NPC_EventProcessor(speakingNPC->evt_D);
                   if ( v20 == 1 || v20 == 2 )
-                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x16u, 0, "", 0);
+                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x16u, 0, "", 0);
                 }
               }
               if ( speakingNPC->evt_E )
@@ -1846,7 +1845,7 @@
                 {
                   v22 = NPC_EventProcessor(speakingNPC->evt_E);
                   if ( v22 == 1 || v22 == 2 )
-                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x17u, 0, "", 0);
+                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x17u, 0, "", 0);
                 }
               }
               if (speakingNPC->evt_F )
@@ -1855,7 +1854,7 @@
                 {
                   v24 = NPC_EventProcessor(speakingNPC->evt_F);
                   if ( v24 == 1 || v24 == 2 )
-                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x18u, 0, "", 0);
+                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x18u, 0, "", 0);
                 }
               }
             }
@@ -1863,15 +1862,15 @@
             {
               if ( speakingNPC->joins )
               {
-                pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, 0x88u, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Ïîäðîáíåå
+                pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Ïîäðîáíåå
                 if (speakingNPC->Hired())
                 {
                   sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Îòïóñòèòü
-                  pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x4Cu, 0, pTmpBuf, 0);
+                  pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf, 0);
                 }
                 else
                 {
-                  pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü
+                  pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü
                 }
                 num_menu_buttons = 2;
               }
@@ -1882,12 +1881,12 @@
         case WINDOW_ChangeLocation:
           pMainScreenNum = pCurrentScreen;
           pCurrentScreen = SCREEN_CHANGE_LOCATION;
-          pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, 0x5Bu, 0, 0x4Eu, pGlobalTXT_LocalizationStrings[156],//Îñòàòüñÿ â ýòîé îáëàñòè
+          pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_5B, 0, 0x4Eu, pGlobalTXT_LocalizationStrings[156],//Îñòàòüñÿ â ýòîé îáëàñòè
                          pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
-          pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, 0x5Au, 0, 0x59u, pWindow->Hint,
+          pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_OnTravelByFoot, 0, 0x59u, pWindow->Hint,
                          pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
-          pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, 0x5Au, 1u, 0x20u, pWindow->Hint, 0, 0, 0);
-          pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, 0x5Au, 1u, 0, pWindow->Hint, 0);
+          pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_OnTravelByFoot, 1u, 0x20u, pWindow->Hint, 0, 0, 0);
+          pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, UIMSG_OnTravelByFoot, 1u, 0, pWindow->Hint, 0);
           break;
         case WINDOW_SpellBook: // îêíî êíèãè çàêëîâ
           InitializeBookTextures();
@@ -1902,17 +1901,17 @@
       return pWindow;
     }
 //LABEL_62:
-    pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-    pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-    pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-    pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
-    pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
+    pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0);
+    pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0);
+    pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0);
+    pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0);
+    pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0);
     return pWindow;
   }
   if (eWindowType == WINDOW_HouseInterior)
   {
     pCurrentScreen = SCREEN_HOUSE;
-    pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[80],//Âûéòè èç çäàíèÿ
+    pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Âûéòè èç çäàíèÿ
                    pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
     v25 = uNumDialogueNPCPortraits;
     v26 = 0;
@@ -1939,7 +1938,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, 0x19Au, v26, 0, byte_591180[v26], 0, 0, 0);
+                                             0x3Fu, 0x49u, 1, 0, UIMSG_19A, v26, 0, byte_591180[v26], 0, 0, 0);
         ++v26;
         v25 = uNumDialogueNPCPortraits;
       }
@@ -1957,12 +1956,12 @@
     {
       pMainScreenNum = pCurrentScreen;
       pCurrentScreen = SCREEN_INPUT_BLV;
-      pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, 0x19Cu, 0, 0x4Eu, pGlobalTXT_LocalizationStrings[34],//Îòìåíà
-                     (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0);
-      pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, 0x19Bu, 0, 0x59u, pWindow->Hint,
-                     (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0);
-      pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, 0x19Bu, 1, 0x20u, pWindow->Hint, 0);
-      pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, 0x19Bu, 1u, 0, pWindow->Hint, 0);
+      pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_19C, 0, 0x4Eu, pGlobalTXT_LocalizationStrings[34],//Îòìåíà
+                     pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
+      pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 0x59u, pWindow->Hint,
+                     pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
+      pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, pWindow->Hint, 0);
+      pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, pWindow->Hint, 0);
       return pWindow;
     }
     if (eWindowType == WINDOW_1B)
@@ -1976,17 +1975,17 @@
     if (eWindowType == WINDOW_Scroll)
       //goto LABEL_62;
     {
-      pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-      pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-      pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-      pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
-      pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
+      pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0);
+      pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0);
+      pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0);
+      pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0);
+      pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0);
       return pWindow;
     }
     if (eWindowType == WINDOW_1F)
     {
       pMouse->SetCursorBitmap("MICON2");
-      pBtn_ExitCancel = pWindow->CreateButton(0x188u, 0x13Eu, 0x4Bu, 0x21u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],//Îòìåíà
+      pBtn_ExitCancel = pWindow->CreateButton(0x188u, 0x13Eu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Îòìåíà
                      (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0);
       ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2);//Âûáðàòü öåëü
       ++pIcons_LOD->uTexturePacksCount;
--- a/GUIWindow.h	Wed Mar 27 15:04:59 2013 +0200
+++ b/GUIWindow.h	Wed Mar 27 19:50:37 2013 +0200
@@ -1,5 +1,4 @@
 #pragma once
-#include "GUIButton.h"
 #include "Items.h"
 #include "Player.h"
 
@@ -7,6 +6,209 @@
 
 
 
+enum UIMessageType: unsigned __int32
+{
+  UIMSG_0 = 0,
+
+  UIMSG_ChangeGameState = 5,
+
+  UIMSG_A = 10,
+
+  UIMSG_C = 12,
+
+  UIMSG_E = 14,
+  UIMSG_F = 15,
+
+  UIMSG_11 = 17,
+
+  UIMSG_Attack = 23,
+
+  UIMSG_19 = 25,
+
+  UIMSG_1B = 27,
+  UIMSG_1C = 28,
+  UIMSG_PlayArcomage = 29,
+
+  UIMSG_31 = 49,
+  UIMSG_32 = 50,
+  UIMSG_33 = 51,
+  UIMSG_34 = 52,
+  UIMSG_35 = 53,
+  UIMSG_MainMenu_ShowPartyCreationWnd = 54,
+  UIMSG_MainMenu_ShowLoadWindow = 55,
+  UIMSG_ShowCredits = 56,
+  UIMSG_ExitToWindows = 57,
+  UIMSG_3A = 58,
+
+  UIMSG_PlayerCreationChangeName = 60,
+
+  UIMSG_PlayerCreationClickPlus = 62,
+  UIMSG_PlayerCreationClickMinus = 63,
+  UIMSG_PlayerCreationSelectActiveSkill = 64,
+  UIMSG_PlayerCreationSelectClass = 65,
+  UIMSG_PlayerCreationClickOK = 66,
+  UIMSG_PlayerCreationClickReset = 67,
+  UIMSG_44 = 68,
+  UIMSG_45 = 69,
+  UIMSG_46 = 70,
+  UIMSG_AutonotesBook = 71,
+  UIMSG_48 = 72,
+  UIMSG_49 = 73,
+  UIMSG_PlayerCreationRemoveUpSkill = 74,
+  UIMSG_PlayerCreationRemoveDownSkill = 75,
+
+  UIMSG_4E = 78,
+  UIMSG_SPellbook_ShowHightlightedSpellInfo = 79,
+
+  UIMSG_BuyInShop_Identify_Repair = 81,
+  UIMSG_LoadGame = 82,
+  UIMSG_SaveGame = 83,
+  UIMSG_54 = 84,
+  UIMSG_55 = 85,
+  UIMSG_SelectSpell = 86,
+  UIMSG_OpenSpellbookPage = 87,
+  UIMSG_58 = 88,
+
+  UIMSG_OnTravelByFoot = 90,
+  UIMSG_5B = 91,
+  UIMSG_ShowStatus_DateTime = 92,
+  UIMSG_ShowStatus_ManaHP = 93,
+  UIMSG_ShowStatus_Player = 94,
+  UIMSG_Wait5Minutes  = 95,
+  UIMSG_Wait1Hour = 96,
+  UIMSG_61 = 97,
+
+  UIMSG_ShowStatus_Food = 100,
+  UIMSG_ShowStatus_Funds = 101,
+
+  UIMSG_68 = 104,
+  UIMSG_69 = 105,
+  UIMSG_QuickReference = 106,
+  UIMSG_GameMenuButton = 107,
+
+  UIMSG_AlreadyResting = 109,
+  UIMSG_SelectCharacter = 110,
+  UIMSG_ChangeSoundVolume = 111,
+  UIMSG_ChangeMusicVolume = 112,
+  UIMSG_Escape = 113,
+  UIMSG_72 = 114,
+  UIMSG_73 = 115,
+  UIMSG_74 = 116,
+  UIMSG_75 = 117,
+  UIMSG_PlayerCreation_SelectAttribute = 118,
+
+  UIMSG_InventoryLeftClick = 120,
+  UIMSG_SkillUp = 121,
+  UIMSG_7A = 122,
+  UIMSG_GameMenu_ReturnToGame = 123,
+  UIMSG_StartNewGame = 124,
+  UIMSG_Game_OpenLoadGameDialog = 125,
+  UIMSG_Game_OpenSaveGameDialog = 126,
+  UIMSG_Game_OpenOptionsDialog = 127,
+  UIMSG_80 = 128,
+
+  UIMSG_SetGraphicsMode = 131,
+  UIMSG_Quit = 132,
+  UIMSG_85 = 133,
+  UIMSG_StartHireling1Dialogue = 134,
+  UIMSG_StartHireling2Dialogue = 135,
+  UIMSG_SelectNPCDialogueOption = 136,
+
+  UIMSG_8C = 140,
+  UIMSG_8D = 141,
+  UIMSG_CastSpellFromBook = 142,
+  UIMSG_8F = 143,
+  UIMSG_PlayerCreation_VoicePrev = 144,
+  UIMSG_PlayerCreation_VoiceNext = 145,
+  UIMSG_92 = 146,
+
+  UIMSG_StartNPCDialogue = 161,
+  UIMSG_ArrowUp = 162,
+  UIMSG_DownArrow = 163,
+  UIMSG_LoadSlot = 164,
+  UIMSG_SelectLoadSlot = 165,
+  UIMSG_Cancel = 166,
+  UIMSG_ExitRest = 167,
+  UIMSG_A8 = 168,
+  UIMSG_A9 = 169,
+  UIMSG_AA = 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_SetTurnSpeed = 184,
+  UIMSG_ToggleWalkSound = 185,
+  UIMSG_ChangeVoiceVolume = 186,
+  UIMSG_ToggleShowDamage = 187,
+  UIMSG_ScrollNPCPanel = 188,
+  UIMSG_BD = 189,
+  UIMSG_BE = 190,
+  UIMSG_BF = 191,
+  UIMSG_C0 = 192,
+  UIMSG_C1 = 192,
+  UIMSG_C2 = 192,
+
+  UIMSG_OnCastTownPortal = 195,
+  UIMSG_C4 = 196,
+  UIMSG_ShowFinalWindow = 197,
+  UIMSG_C6 = 198,
+  UIMSG_C7 = 199,
+  UIMSG_OpenQuestBook = 200,
+  UIMSG_OpenAutonotes = 201,
+  UIMSG_OpenMapBook = 202,
+  UIMSG_OpenCalendar = 203,
+  UIMSG_CC = 204,
+  UIMSG_CD = 205,
+  UIMSG_CE = 206,
+  UIMSG_CF = 207,
+  UIMSG_D0 = 208,
+  UIMSG_D1 = 209,
+  UIMSG_D2 = 210,
+  UIMSG_D3 = 211,
+  UIMSG_D4 = 212,
+  UIMSG_D5 = 213,
+  UIMSG_D6 = 214,
+
+  UIMSG_DD = 221,
+
+  UIMSG_OpenHistoryBook = 224,
+  UIMSG_ToggleAlwaysRun = 225,
+  UIMSG_ToggleFlipOnExit = 226,
+
+  UIMSG_16F = 367,
+  UIMSG_170 = 368,
+
+  UIMSG_Game_Action = 404,
+  UIMSG_SelectShopDialogueOption = 405,
+
+  UIMSG_OpenRestUI = 409,
+  UIMSG_19A = 410,
+  UIMSG_TransitionUI_Confirm = 411,
+  UIMSG_19C = 412,
+
+  UIMSG_OpenKeyMappingOptions = 415,
+  UIMSG_SelectKeyPage1 = 416,
+  UIMSG_SelectKeyPage2 = 417,
+  UIMSG_ResetKeyMapping = 418,
+  UIMSG_ChangeKeyButton = 419,
+
+  UIMSG_OpenVideoOptions = 421,
+  UIMSG_ToggleBloodsplats = 422,
+  UIMSG_ToggleColoredLights = 423,
+  UIMSG_ToggleTint = 424,
+  UIMSG_1A9 = 425,
+};
+
+
 /*  251 */
 enum MENU_STATE : __int32
 {
@@ -101,6 +303,9 @@
   WINDOW_HistoryBook = 0xE0,
 };
 
+struct GUIButton;
+struct Texture;
+
 /*  155 */
 #pragma pack(push, 1)
 struct GUIWindow
@@ -112,7 +317,7 @@
   }
 
   GUIButton *CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int a6, int a7, 
-	         unsigned int uControlID, unsigned int uControlParam, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...);
+	                      UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...);
   void DrawFlashingInputCursor(signed int a3, int a4, struct GUIFont *a2);
   int DrawTextInRect(GUIFont *a2, unsigned int uX, unsigned int uY, unsigned int uColor, const char *Str1, int Source, int a8);
   char DrawText(GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor);
@@ -163,171 +368,6 @@
 
 
 
-enum UIMessageType
-{
-  UIMSG_00 = 0x0,
-  UIMSG_ChangeGameState = 0x5,
-  UIMSG_A = 0xA,
-  UIMSG_C = 0xC,
-  UIMSG_E = 0xE,
-  UIMSG_F = 0xF,
-  UIMSG_11 = 0x11,
-  UIMSG_Attack = 23,
-  UIMSG_19 = 0x19,
-  UIMSG_1B = 0x1B,
-  UIMSG_1C = 0x1C,
-  UIMSG_PlayArcomage = 0x1D,
-  UIMSG_33 = 0x33,
-  UIMSG_MainMenu_ShowPartyCreationWnd = 0x36,
-  UIMSG_MainMenu_ShowLoadWindow = 0x37,
-  UIMSG_ShowCredits = 0x38,
-  UIMSG_ExitToWindows = 0x39,
-  UIMSG_3A = 0x3A,
-  UIMSG_PlayerCreationChangeName = 0x3C,
-  UIMSG_PlayerCreationClickPlus = 0x3E,
-  UIMSG_PlayerCreationClickMinus = 0x3F,
-  UIMSG_PlayerCreationSelectActiveSkill = 0x40,
-  UIMSG_PlayerCreationSelectClass = 0x41,
-  UIMSG_PlayerCreationClickOK = 0x42,
-  UIMSG_PlayerCreationClickReset = 0x43,
-  UIMSG_45 = 0x45,
-  UIMSG_46 = 0x46,
-  UIMSG_AutonotesBook = 0x47,
-  UIMSG_PlayerCreationRemoveUpSkill = 0x4A,
-  UIMSG_PlayerCreationRemoveDownSkill = 0x4B,
-  UIMSG_4E = 0x4E,
-  UIMSG_SPellbook_ShowHightlightedSpellInfo = 0x4F,
-  UIMSG_BuyInShop_Identify_Repair = 0x51,
-  UIMSG_LoadGame = 0x52,
-  UIMSG_SaveGame = 0x53,
-  UIMSG_54 = 0x54,
-  UIMSG_55 = 0x55,
-  UIMSG_SelectSpell = 0x56,
-  UIMSG_57 = 0x57,
-  UIMSG_58 = 0x58,
-  UIMSG_OnTravelByFoot = 0x5A,
-  UIMSG_5B = 0x5B,
-  UIMSG_ShowStatus_DateTime = 0x5C,
-  UIMSG_ShowStatus_ManaHP = 0x5D,
-  UIMSG_ShowStatus_Player = 0x5E,
-  UIMSG_Wait5Minutes  = 0x5F,
-  UIMSG_Wait1Hour = 0x60,
-  UIMSG_61 = 0x61,
-  UIMSG_ShowStatus_Food = 0x64,
-  UIMSG_ShowStatus_Funds = 0x65,
-  UIMSG_68 = 0x68,
-  UIMSG_69 = 0x69,
-  UIMSG_QuickReference = 0x6A,
-  UIMSG_GameMenuButton = 0x6B,
-  UIMSG_AlreadyResting = 0x6D,
-  UIMSG_SelectCharacter = 0x6E,
-  UIMSG_ChangeSoundVolume = 0x6F,
-  UIMSG_ChangeMusicVolume = 0x70,
-  UIMSG_Escape = 0x71,
-  UIMSG_72 = 0x72,
-  UIMSG_73 = 0x73,
-  UIMSG_74 = 0x74,
-  UIMSG_75 = 0x75,
-  UIMSG_PlayerCreation_SelectAttribute = 0x76,
-  UIMSG_InventoryLeftClick = 0x78,
-  UIMSG_SkillUp = 0x79,
-  UIMSG_7A = 0x7A,
-  UIMSG_GameMenu_ReturnToGame = 0x7B,
-  UIMSG_StartNewGame = 0x7C,
-  UIMSG_Game_OpenLoadGameDialog = 0x7D,
-  UIMSG_Game_OpenSaveGameDialog = 0x7E,
-  UIMSG_Game_OpenOptionsDialog = 0x7F,
-  UIMSG_80 = 0x80,
-  UIMSG_SetGraphicsMode = 0x83,
-  UIMSG_Quit = 0x84,
-  UIMSG_85 = 0x85,
-  UIMSG_StartHireling1Dialogue = 0x86,
-  UIMSG_StartHireling2Dialogue = 0x87,
-  UIMSG_SelectNPCDialogueOption = 0x88,
-  UIMSG_8C = 0x8C,
-  UIMSG_8D = 0x8D,
-  UIMSG_CastSpellFromBook = 0x8E,
-  UIMSG_8F = 0x8F,
-  UIMSG_PlayerCreation_VoicePrev = 0x90,
-  UIMSG_PlayerCreation_VoiceNext = 0x91,
-  UIMSG_92 = 0x92,
-  UIMSG_StartNPCDialogue = 0xA1,
-  UIMSG_ArrowUp = 0xA2,
-  UIMSG_DownArrow = 0xA3,
-  UIMSG_LoadSlot = 0xA4,
-  UIMSG_SelectLoadSlot = 0xA5,
-  UIMSG_Cancel = 0xA6,
-  UIMSG_ExitRest = 0xA7,
-  UIMSG_A8 = 0xA8,
-  UIMSG_A9 = 0xA9,
-  UIMSG_AA = 0xAA,
-  UIMSG_PlayerCreation_FacePrev = 0xAB,
-  UIMSG_PlayerCreation_FaceNext = 0xAC,
-  UIMSG_AD = 0xAD,
-  UIMSG_AE = 0xAE,
-  UIMSG_ClickNPCTopic = 0xAF,
-  UIMSG_CycleCharacters = 0xB0,
-  UIMSG_B1 = 0xB1,
-  UIMSG_B2 = 0xB2,
-  UIMSG_B3 = 0xB3,
-  UIMSG_B4 = 0xB4,
-  UIMSG_B5 = 0xB5,
-  UIMSG_B6 = 0xB6,
-  UIMSG_B7 = 0xB7,
-  UIMSG_SetTurnSpeed = 0xB8,
-  UIMSG_ToggleWalkSound = 0xB9,
-  UIMSG_ChangeVoiceVolume = 0xBA,
-  UIMSG_ToggleShowDamage = 0xBB,
-  UIMSG_ScrollNPCPanel = 0xBC,
-  UIMSG_BD = 0xBD,
-  UIMSG_BE = 0xBE,
-  UIMSG_BF = 0xBF,
-  UIMSG_C0 = 0xC0,
-  UIMSG_C1 = 0xC1,
-  UIMSG_C2 = 0xC2,
-  UIMSG_OnCastTownPortal = 0xC3,
-  UIMSG_C4 = 0xC4,
-  UIMSG_ShowFinalWindow = 0xC5,
-  UIMSG_C6 = 0xC6,
-  UIMSG_C7 = 0xC7,
-  UIMSG_OpenQuestBook = 0xC8,
-  UIMSG_OpenAutonotes = 0xC9,
-  UIMSG_OpenMapBook = 0xCA,
-  UIMSG_OpenCalendar = 0xCB,
-  UIMSG_CC = 0xCC,
-  UIMSG_CD = 0xCD,
-  UIMSG_CE = 0xCE,
-  UIMSG_CF = 0xCF,
-  UIMSG_D0 = 0xD0,
-  UIMSG_D1 = 0xD1,
-  UIMSG_D2 = 0xD2,
-  UIMSG_D3 = 0xD3,
-  UIMSG_D4 = 0xD4,
-  UIMSG_D5 = 0xD5,
-  UIMSG_D6 = 0xD6,
-  UIMSG_DD = 0xDD,
-  UIMSG_OpenHistoryBook = 0xE0,
-  UIMSG_ToggleAlwaysRun = 0xE1,
-  UIMSG_ToggleFlipOnExit = 0xE2,
-  UIMSG_16F = 0x16F,
-  UIMSG_170 = 0x170,
-  UIMSG_Game_Action = 0x194,
-  UIMSG_SelectShopDialogueOption = 0x195,
-  UIMSG_OpenRestUI = 0x199,
-  UIMSG_19A = 0x19A,
-  UIMSG_TransitionUI_Confirm = 0x19B,
-  UIMSG_19C = 0x19C,
-  UIMSG_OpenKeyMappingOptions = 0x19F,
-  UIMSG_SelectKeyPage1 = 0x1A0,
-  UIMSG_SelectKeyPage2 = 0x1A1,
-  UIMSG_ResetKeyMapping = 0x1A2,
-  UIMSG_ChangeKeyButton = 0x1A3,
-  UIMSG_OpenVideoOptions = 0x1A5,
-  UIMSG_ToggleBloodsplats = 0x1A6,
-  UIMSG_ToggleColoredLights = 0x1A7,
-  UIMSG_ToggleTint = 0x1A8,
-  UIMSG_1A9 = 0x1A9,
-};
 
 enum CURRENT_SCREEN
 {
@@ -435,4 +475,166 @@
 const char *__fastcall CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType);
 char __cdecl CharacterUI_SkillsTab_ShowHint();
 char __cdecl CharacterUI_StatsTab_ShowHint();
-char __fastcall CharacterUI_StatsTab_Draw(unsigned int uPlayerID); // idb
\ No newline at end of file
+char __fastcall CharacterUI_StatsTab_Draw(unsigned int uPlayerID); // idb
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#pragma pack(push, 1)
+struct GUIButton
+{
+  char DrawLabel(const char *edx0, struct GUIFont *pFont, int a5, int *a9);
+
+  void Release();
+
+
+  unsigned int uX;
+  unsigned int uY;
+  unsigned int uWidth;
+  unsigned int uHeight;
+  unsigned int uZ;
+  unsigned int uW;
+  int uButtonType;
+  int field_1C;//may be pMessageType
+  UIMessageType msg;
+  unsigned int  msg_param;
+  int field_28;
+  int field_2C_is_pushed;
+  GUIButton *pPrev;
+  GUIButton *pNext;
+  struct GUIWindow *pParent;
+  struct Texture *pTextures[5];
+  unsigned int uNumTextures;
+  unsigned __int8 uHotkey;
+  char pButtonName[32];
+  char field_75[71];
+};
+#pragma pack(pop)
+
+
+
+
+extern struct GUIButton *pBtn_CloseBook;
+extern struct GUIButton *pBtn_InstallRemoveSpell;
+extern struct GUIButton *pBtn_Autonotes_Instructors;
+extern struct GUIButton *pBtn_Autonotes_Misc;
+extern struct GUIButton *pBtn_Book_6;
+extern struct GUIButton *pBtn_Book_5;
+extern struct GUIButton *pBtn_Book_4;
+extern struct GUIButton *pBtn_Book_3;
+extern struct GUIButton *pBtn_Book_2;
+extern struct GUIButton *pBtn_Book_1;
+
+
+extern struct GUIButton *pPlayerCreationUI_BtnReset;
+extern struct GUIButton *pPlayerCreationUI_BtnOK;
+extern struct GUIButton *pBtn_ExitCancel;
+extern struct GUIButton *pBtn_YES;
+extern struct GUIButton *pPlayerCreationUI_BtnPlus;
+extern struct GUIButton *pPlayerCreationUI_BtnMinus;
+
+
+extern struct GUIButton *pButton_RestUI_Main;
+extern struct GUIButton *pButton_RestUI_Exit;
+extern struct GUIButton *pButton_RestUI_Wait5Minutes;
+extern struct GUIButton *pButton_RestUI_WaitUntilDawn;
+extern struct GUIButton *pButton_RestUI_Wait1Hour;
+
+
+extern struct GUIButton *pCharacterScreen_ExitBtn;
+extern struct GUIButton *pCharacterScreen_AwardsBtn;
+extern struct GUIButton *pCharacterScreen_InventoryBtn;
+extern struct GUIButton *pCharacterScreen_SkillsBtn;
+extern struct GUIButton *pCharacterScreen_StatsBtn;
+extern struct GUIButton *pCharacterScreen_DollBtn;
+extern struct GUIButton *pCharacterScreen_DetalizBtn;
+
+
+extern struct GUIButton *pBtn_NPCRight;
+extern struct GUIButton *pBtn_NPCLeft;
+extern struct GUIButton *pBtn_GameSettings;
+extern struct GUIButton *pBtn_QuickReference;
+extern struct GUIButton *pBtn_CastSpell;
+extern struct GUIButton *pBtn_Rest;
+extern struct GUIButton *pBtn_History;
+extern struct GUIButton *pBtn_Calendar;
+extern struct GUIButton *pBtn_Maps;
+extern struct GUIButton *pBtn_Autonotes;
+extern struct GUIButton *pBtn_Quests;
+
+
+extern struct GUIButton *pMainMenu_BtnExit;
+extern struct GUIButton *pMainMenu_BtnCredits;
+extern struct GUIButton *pMainMenu_BtnLoad;
+extern struct GUIButton *pMainMenu_BtnNew;
+
+
+extern struct GUIButton *pBtn_Up;
+extern struct GUIButton *pBtn_Down;
+extern struct GUIButton *ptr_507BA4;
+
+
+extern struct GUIWindow *pPrimaryWindow;
+extern struct GUIWindow *pChestWindow;
+extern struct GUIWindow *pDialogueWindow;
+extern struct GUIWindow *window_SpeakInHouse;
+extern struct GUIWindow *pGUIWindow_ScrollWindow;
+extern struct GUIWindow *ptr_507BC8;
+extern struct GUIWindow *pGUIWindow_CurrentMenu;
+extern struct GUIWindow *ptr_507BD0;
+extern struct GUIWindow *pGUIWindow_Settings;
+extern struct GUIWindow *ptr_507BDC;
+extern struct GUIWindow *pGUIWindow_EscMessageWindow;
+extern struct GUIWindow *pBooksWindow;
+extern struct GUIWindow *pGUIWindow2;
+
+
+extern struct GUIButton *pBtn_Resume;
+extern struct GUIButton *pBtn_QuitGame;
+extern struct GUIButton *pBtn_GameControls;
+extern struct GUIButton *pBtn_LoadGame;
+extern struct GUIButton *pBtn_SaveGame;
+extern struct GUIButton *pBtn_NewGame;
+
+extern struct GUIButton *pBtn_SliderRight;
+extern struct GUIButton *pBtn_SliderLeft;
+
+
+extern struct GUIButton *pBtnDownArrow;
+extern struct GUIButton *pBtnArrowUp;
+extern struct GUIButton *pBtnCancel;
+extern struct GUIButton *pBtnLoadSlot;
+
+
+extern GUIButton *pCreationUI_BtnPressRight2[4];
+extern GUIButton *pCreationUI_BtnPressLeft2[4];
+extern GUIButton *pCreationUI_BtnPressLeft[4];
+extern GUIButton *pCreationUI_BtnPressRight[4];
\ No newline at end of file
--- a/GameUIs.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/GameUIs.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -122,21 +122,21 @@
   }
   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->CreateButton(21, 198, 191, 18, 1, 0, 0xA5, 0, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, 0xA5, 1, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, 0xA5, 2, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, 0xA5, 3, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, 0xA5, 4, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, 0xA5, 5, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, 0xA5, 6, 0, "", 0);
-  pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, 0xA4, 0, 0, "",
-                 (Texture *)(uTextureID_LS_ != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_LS_] : 0), 0);
-  pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, 0xA6, 0, 0, "",
-                 (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0), 0);
-  pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, 0xA2, 0, 0, "",
-                 (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0);
-  pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 0x143, 0x11, 0x11, 1, 0, 0xA3, uNumSavegameFiles, 0, "",
-         (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0);
+  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);
+  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, 0x143, 0x11, 0x11, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "",
+         pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0);
 
 }
 
@@ -222,19 +222,19 @@
   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->CreateButton(21u, 198u, 0xBFu, 0x12u, 1, 0, 0xA5u, 0, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 218u, 0xBFu, 0x12u, 1, 0, 0xA5u, 1u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 238u, 0xBFu, 0x12u, 1, 0, 0xA5u, 2u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 258u, 0xBFu, 0x12u, 1, 0, 0xA5u, 3u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 278u, 0xBFu, 0x12u, 1, 0, 0xA5u, 4u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 298u, 0xBFu, 0x12u, 1, 0, 0xA5u, 5u, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(21u, 318u, 0xBFu, 0x12u, 1, 0, 0xA5u, 6u, 0, "", 0);
-  pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0x69u, 0x28u, 1, 0, 0xA4u, 0, 0, "",
+  pGUIWindow_CurrentMenu->CreateButton(21u, 198u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21u, 218u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 1u, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21u, 238u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 2u, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21u, 258u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 3u, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21u, 278u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 4u, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21u, 298u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 5u, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(21u, 318u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 6u, 0, "", 0);
+  pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0x69u, 0x28u, 1, 0, UIMSG_LoadSlot, 0, 0, "",
                  (Texture *)(uTextureID_LS_ != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_LS_] : 0), 0);
-  pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(0x15Eu, 0x12Eu, 0x69u, 0x28u, 1, 0, 0xA6u, 0, 0, "",
+  pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(0x15Eu, 0x12Eu, 0x69u, 0x28u, 1, 0, UIMSG_Cancel, 0, 0, "",
                  (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0), 0);
-  pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0xC7u, 0x11u, 0x11u, 1, 0, 0xA2u, 0, 0, "",
+  pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0xC7u, 0x11u, 0x11u, 1, 0, UIMSG_ArrowUp, 0, 0, "",
          (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0);
-  pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0x143u, 0x11u, 0x11u, 1, 0, 0xA3u, 0x22u, 0, "",
+  pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0x143u, 0x11u, 0x11u, 1, 0, UIMSG_DownArrow, 0x22u, 0, "",
          (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0);
 }
\ No newline at end of file
--- a/Indoor.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/Indoor.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -24,7 +24,6 @@
 #include "MapInfo.h"
 #include "IndoorCamera.h"
 #include "GUIWindow.h"
-#include "GUIButton.h"
 #include "GUIFont.h"
 
 #include "mm7_data.h"
--- a/Player.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/Player.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "Texture.h"
 #include "AudioPlayer.h"
 #include "Party.h"
-#include "GUIButton.h"
 #include "Log.h"
 #include "LOD.h"
 #include "Monsters.h" 
--- a/UIBooks.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/UIBooks.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
--- a/UICharacter.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/UICharacter.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -3759,9 +3758,9 @@
     v0 = uActiveCharacter;
     dword_507CC0 = uActiveCharacter;
     for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
+    {
+        if ( pButton->msg == UIMSG_InventoryLeftClick )
         {
-        if ( pButton->uControlID == 120 )
-            {
             dword_50698C = pButton->uX;
             dword_506988 = pButton->uY;
             dword_506984 = pButton->uZ;
@@ -3787,7 +3786,7 @@
             v3 = v3 + v4 - 3;
             ++a2;
             ++v12;
-            pGUIWindow_CurrentMenu->CreateButton(0x18u, v3, 0xCCu, v4 - 3, 3, *v14 | 0x8000, 0x79u, *v14, 0, "", 0, 0);
+            pGUIWindow_CurrentMenu->CreateButton(0x18u, v3, 0xCCu, v4 - 3, 3, *v14 | 0x8000, UIMSG_SkillUp, *v14, 0, "", 0, 0);
             v2 = pFontLucida;
             }
         ++v14;
@@ -3804,7 +3803,7 @@
                 v6 = LOBYTE(v2->uFontHeight);
                 v5 = v5 + v6 - 3;
                 ++a2;
-                pGUIWindow_CurrentMenu->CreateButton(0x18u, v5, 0xCCu, v6 - 3, 3, *v15 | 0x8000, 0x79u, *v15, 0, "", 0, 0);
+                pGUIWindow_CurrentMenu->CreateButton(0x18u, v5, 0xCCu, v6 - 3, 3, *v15 | 0x8000, UIMSG_SkillUp, *v15, 0, "", 0, 0);
                 v2 = pFontLucida;
                 }
             ++v15;
@@ -3821,7 +3820,7 @@
                     v7 = v7 + v8 - 3;
                     ++a2;
                     ++v13;
-                    pGUIWindow_CurrentMenu->CreateButton(0xF6u, v7, 0xCCu, v8 - 3, 3, *v16 | 0x8000, 0x79u, *v16, 0, "", 0, 0);
+                    pGUIWindow_CurrentMenu->CreateButton(0xF6u, v7, 0xCCu, v8 - 3, 3, *v16 | 0x8000, UIMSG_SkillUp, *v16, 0, "", 0, 0);
                     v2 = pFontLucida;
                     }
                 ++v16;
@@ -3838,7 +3837,7 @@
                         v10 = LOBYTE(v2->uFontHeight);
                         v9 = v9 + v10 - 3;
                         ++a2;
-                        pGUIWindow_CurrentMenu->CreateButton(0xF6u, v9, 0xCCu, v10 - 3, 3, *v17 | 0x8000, 0x79u, *v17, 0, "", 0, 0);
+                        pGUIWindow_CurrentMenu->CreateButton(0xF6u, v9, 0xCCu, v10 - 3, 3, *v17 | 0x8000, UIMSG_SkillUp, *v17, 0, "", 0, 0);
                         v2 = pFontLucida;
                         }
                     ++v17;
--- a/UIHouses.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/UIHouses.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -7,7 +7,6 @@
 #include "LOD.h"
 #include "Mouse.h"
 #include "GUIWindow.h"
-#include "GUIButton.h"
 #include "GUIFont.h"
 #include "Events2D.h"
 #include "Overlays.h"
@@ -724,9 +723,9 @@
 		}
 		pDialogueWindow->Release();
 		pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
-		pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
+		pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
 					                                    pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
-		pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr);
+		pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
 //	LABEL_10:
 		//v3 = dword_F8B198;
 		v8 = window_SpeakInHouse;
@@ -742,9 +741,9 @@
 		//LABEL_9:
 			pDialogueWindow->Release();
 			pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
-			pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
+			pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
 						                                    pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
-			pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr);
+			pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
 	//	LABEL_10:
 			//v3 = dword_F8B198;
 			v8 = window_SpeakInHouse;
@@ -2546,7 +2545,7 @@
       while ( 1 )
       {
         pButton = pDialogueWindow->GetControl(pNumActiveItem);
-        if ( pButton->uControlParam == 15 )
+        if ( pButton->msg_param == 15 )
         {
           v46 = pTextHeight;
           pButton->uHeight = pTextHeight;
@@ -2554,7 +2553,7 @@
           v41 = v46 + 145;
           pButton->uW = v41;
         }
-        else if ( pButton->uControlParam == 16 )
+        else if ( pButton->msg_param == 16 )
         {
           v44 = v88;
           v45 = pTextHeight + v36 + 146;
@@ -2563,7 +2562,7 @@
           v41 = v45 + v44 - 1;
           pButton->uW = v41;
         }
-        else if ( pButton->uControlParam == 96 )
+        else if ( pButton->msg_param == 96 )
         {
           v42 = pTextHeight + v88 + 2 * v36 + 146;
           v43 = v82;
@@ -2572,7 +2571,7 @@
           v41 = v43 + v42 - 1;
           pButton->uW = v41;
         }
-        else if ( pButton->uControlParam == 101 )
+        else if ( pButton->msg_param == 101 )
         {
           v39 = pTextHeight + 3 * v36 + pTextHeight + v88 + 146;
           v40 = v87;
@@ -2690,7 +2689,7 @@
       {
         do
         {
-          v12 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
+          v12 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36;
           if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v12] && !pPlayer->pActiveSkills[v12] )
           {
             all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v12], &dialog_window, 0, 0);
@@ -2714,7 +2713,7 @@
             do
             {
               pButton = pDialogueWindow->GetControl(pItemNum);
-              v17 = pButton->uControlParam - 36;
+              v17 = pButton->msg_param - 36;
               if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v17] || pPlayer->pActiveSkills[v17] )
               {
                 pButton->uW = 0;
@@ -3283,7 +3282,7 @@
       }
       do
       {
-        v35 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
+        v35 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36;
         if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] )
         {
           all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0);
@@ -3314,7 +3313,7 @@
         do
         {
           pButton = pDialogueWindow->GetControl(pItemNum);
-          v40 = pButton->uControlParam - 36;
+          v40 = pButton->msg_param - 36;
           if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] )
           {
             pButton->uW = 0;
@@ -3852,7 +3851,7 @@
       }
       do
       {
-        v8 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36;
+        v8 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36;
         if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] )
         {
           all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0);
@@ -3885,7 +3884,7 @@
           do
           {
             pButton = pDialogueWindow->GetControl(pItemNum);
-            v13 = pButton->uControlParam - 36;
+            v13 = pButton->msg_param - 36;
             if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] )
             {
               pButton->uW = 0;
@@ -4523,7 +4522,7 @@
             {
             do
                 {
-                v41 = v37->GetControl(v39)->uControlParam - 36;
+                v41 = v37->GetControl(v39)->msg_param - 36;
                 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] )
                     {
                     v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
@@ -4550,7 +4549,7 @@
                             {
                             v44 = v37->GetControl(v152);
                             v45 = v44;
-                            v46 = v44->uControlParam - 36;
+                            v46 = v44->msg_param - 36;
                             if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] )
                                 {
                                 v45->uW = 0;
@@ -4830,7 +4829,7 @@
             }
         do
             {
-            v23 = v20->GetControl(v21)->uControlParam;
+            v23 = v20->GetControl(v21)->msg_param;
             if ( v23 == 18 )
                 {
                 v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
@@ -4881,7 +4880,7 @@
                     {
                     v27 = v20->GetControl(v62);
                     v28 = v27;
-                    v29 = v27->uControlParam;
+                    v29 = v27->msg_param;
                     if ( v29 == 18 )
                         break;
 
@@ -5040,7 +5039,7 @@
                             goto LABEL_78;
                         do
                             {
-                            v9 = v4->GetControl(v62)->uControlParam - 36;
+                            v9 = v4->GetControl(v62)->msg_param - 36;
                             if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] )
                                 {
                                 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0);
@@ -5070,7 +5069,7 @@
                                         {
                                         v14 = v12->GetControl(v62);
                                         v15 = v14;
-                                        v16 = v14->uControlParam - 36;
+                                        v16 = v14->msg_param - 36;
                                         if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] )
                                             {
                                             v15->uW = 0;
@@ -5441,7 +5440,7 @@
               goto LABEL_76;
             do
             {
-              v17 = v13->GetControl(v15)->uControlParam - 36;
+              v17 = v13->GetControl(v15)->msg_param - 36;
               if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] && !pPlayers[uActiveCharacter]->pActiveSkills[v17] )
               {
                 v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0);
@@ -5469,7 +5468,7 @@
                 {
                   v20 = v13->GetControl(_v1);
                   v21 = v20;
-                  v22 = v20->uControlParam - 36;
+                  v22 = v20->msg_param - 36;
                   if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v22] || pPlayers[uActiveCharacter]->pActiveSkills[v22] )
                   {
                     v21->uW = 0;
@@ -5619,7 +5618,7 @@
         v45 = pShopOptions;
         do
         {
-          if ( v43->GetControl(v73)->uControlParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
+          if ( v43->GetControl(v73)->msg_param == HOUSE_DIALOGUE_TRAININGHALL_TRAIN )
           {
             //v46 = pPlayers[uActiveCharacter]->uLevel;
             if (pPlayers[uActiveCharacter]->uLevel >= v68)
@@ -5899,7 +5898,7 @@
             goto LABEL_140;
           do
           {
-            v36 = v31->GetControl(v34)->uControlParam - 36;
+            v36 = v31->GetControl(v34)->msg_param - 36;
             if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] )
             {
               v37 = pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0);
@@ -5941,7 +5940,7 @@
             {
               v39 = v31->GetControl(v118);
               v40 = v39;
-              v41 = v39->uControlParam - 36;
+              v41 = v39->msg_param - 36;
               if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v41] || _this->pActiveSkills[v41] )
               {
                 v40->uW = 0;
--- a/UIMainMenu.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/UIMainMenu.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -155,39 +154,39 @@
     uTextureID_BUTTMAKE2 = pIcons_LOD->LoadTexture("BUTTMAKE2", TEXTURE_16BIT_PALETTE);
 
     pPrimaryWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
-    pPrimaryWindow->CreateButton(7u, 8u, 0x1CCu, 0x157u, 1, 0, 0xAu, 0, 0, "", 0);
-    pPrimaryWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-    pPrimaryWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-    pPrimaryWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-    pPrimaryWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
-    pPrimaryWindow->CreateButton(0x18u, 0x194u, 5u, 0x31u, 1, 93, 0, 1u, 0, "", 0);
-    pPrimaryWindow->CreateButton(0x8Bu, 0x194u, 5u, 0x31u, 1, 93, 0, 2u, 0, "", 0);
-    pPrimaryWindow->CreateButton(0xFFu, 0x194u, 5u, 0x31u, 1, 93, 0, 3u, 0, "", 0);
-    pPrimaryWindow->CreateButton(0x172u, 0x194u, 5u, 0x31u, 1, 93, 0, 4u, 0, "", 0);
-    pPrimaryWindow->CreateButton(0x61u, 0x194u, 5u, 0x31u, 1, 93, 0, 1u, 0, "", 0);
-    pPrimaryWindow->CreateButton(0xD4u, 0x194u, 5u, 0x31u, 1, 93, 0, 2u, 0, "", 0);
-    pPrimaryWindow->CreateButton(0x148u, 0x194u, 5u, 0x31u, 1, 93, 0, 3u, 0, "", 0);
-    pPrimaryWindow->CreateButton(0x1BBu, 0x194u, 5u, 0x31u, 1, 93, 0, 4u, 0, "", 0);
+    pPrimaryWindow->CreateButton(7u, 8u, 0x1CCu, 0x157u, 1, 0, UIMSG_A, 0, 0, "", 0);
+    pPrimaryWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 1, 0x31u, "", 0);
+    pPrimaryWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 2, 0x32u, "", 0);
+    pPrimaryWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 3, 0x33u, "", 0);
+    pPrimaryWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 4, 0x34u, "", 0);
+    pPrimaryWindow->CreateButton(0x18u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 1u, 0, "", 0);
+    pPrimaryWindow->CreateButton(0x8Bu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 2u, 0, "", 0);
+    pPrimaryWindow->CreateButton(0xFFu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 3u, 0, "", 0);
+    pPrimaryWindow->CreateButton(0x172u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 4u, 0, "", 0);
+    pPrimaryWindow->CreateButton(0x61u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 1u, 0, "", 0);
+    pPrimaryWindow->CreateButton(0xD4u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 2u, 0, "", 0);
+    pPrimaryWindow->CreateButton(0x148u, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 3u, 0, "", 0);
+    pPrimaryWindow->CreateButton(0x1BBu, 0x194u, 5u, 0x31u, 1, 93, UIMSG_0, 4u, 0, "", 0);
 
     uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE);
     v6 = (Texture *)(uTextureID_ib_td1_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0);
     v8 = pKeyActionMap->GetActionVKey(INPUT_Quest);
-    pBtn_Quests = pPrimaryWindow->CreateButton(0x1EBu, 0x161u, v6->uTextureWidth, v6->uTextureHeight, 1, 0, 0xC8u, 0, v8, pGlobalTXT_LocalizationStrings[174], v6, 0); //Quests
+    pBtn_Quests = pPrimaryWindow->CreateButton(0x1EBu, 0x161u, v6->uTextureWidth, v6->uTextureHeight, 1, 0, UIMSG_OpenQuestBook, 0, v8, pGlobalTXT_LocalizationStrings[174], v6, 0); //Quests
 
     uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE);
     v10 = (Texture *)(uTextureID_ib_td2_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0);
     v12 = pKeyActionMap->GetActionVKey(INPUT_Autonotes);
-    pBtn_Autonotes = pPrimaryWindow->CreateButton(0x20Fu, 0x161u, v10->uTextureWidth, v10->uTextureHeight, 1, 0, 0xC9u, 0, v12, pGlobalTXT_LocalizationStrings[154], v10, 0);//Autonotes
+    pBtn_Autonotes = pPrimaryWindow->CreateButton(0x20Fu, 0x161u, v10->uTextureWidth, v10->uTextureHeight, 1, 0, UIMSG_OpenAutonotes, 0, v12, pGlobalTXT_LocalizationStrings[154], v10, 0);//Autonotes
 
     v14 = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE);
     v15 = (Texture *)(v14 != -1 ? &pIcons_LOD->pTextures[v14] : 0);
     v17 = pKeyActionMap->GetActionVKey(INPUT_Mapbook);
-    pBtn_Maps = pPrimaryWindow->CreateButton(0x222u, 0x161u, v15->uTextureWidth, v15->uTextureHeight, 1, 0, 0xCAu, 0, v17, pGlobalTXT_LocalizationStrings[139], v15, 0); //Maps
+    pBtn_Maps = pPrimaryWindow->CreateButton(0x222u, 0x161u, v15->uTextureWidth, v15->uTextureHeight, 1, 0, UIMSG_OpenMapBook, 0, v17, pGlobalTXT_LocalizationStrings[139], v15, 0); //Maps
 
     uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE);
     v20 = (Texture *)(uTextureID_ib_td4_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td4_A] : 0);
     v22 = pKeyActionMap->GetActionVKey(INPUT_TimeCal);
-    pBtn_Calendar = pPrimaryWindow->CreateButton(0x23Au, 0x161u, v20->uTextureWidth, v20->uTextureHeight, 1, 0, 0xCBu, 0, v22,
+    pBtn_Calendar = pPrimaryWindow->CreateButton(0x23Au, 0x161u, v20->uTextureWidth, v20->uTextureHeight, 1, 0, UIMSG_OpenCalendar, 0, v22,
         pGlobalTXT_LocalizationStrings[78],//Calendar
         v20, 0);
 
@@ -195,7 +194,7 @@
     pBtn_History = pPrimaryWindow->CreateButton(0x258u, 0x169u,
         (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureWidth : 24),
         (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureHeight : 26),
-        1, 0, 0xE0u, 0, 0x48u, pGlobalTXT_LocalizationStrings[602],//History
+        1, 0, UIMSG_OpenHistoryBook, 0, 0x48u, pGlobalTXT_LocalizationStrings[602],//History
         (Texture *)(uTextureID_ib_td5_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0), 0);
 
     bFlashAutonotesBook = 0;
@@ -204,54 +203,54 @@
 
     v24 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn];
     v28 = pKeyActionMap->GetActionVKey(INPUT_ZoomIn);
-    pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, v24->uTextureWidth, v24->uTextureHeight, 2, 0, 0x170u, 0, v28, pGlobalTXT_LocalizationStrings[252], // Zoom In
+    pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, v24->uTextureWidth, v24->uTextureHeight, 2, 0, UIMSG_170, 0, v28, pGlobalTXT_LocalizationStrings[252], // Zoom In
         v24, 0);
     v29 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut];
     v33 = pKeyActionMap->GetActionVKey(INPUT_ZoomOut);
-    pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, v29->uTextureWidth, v29->uTextureHeight, 2, 0, 0x16Fu, 0, v33, pGlobalTXT_LocalizationStrings[251], // Zoom Out
+    pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, v29->uTextureWidth, v29->uTextureHeight, 2, 0, UIMSG_16F, 0, v33, pGlobalTXT_LocalizationStrings[251], // Zoom Out
         v29, 0);
-    pPrimaryWindow->CreateButton(0x1E1u, 0, 0x99u, 0x43u, 1, 92, 0, 0, 0, "", 0);
-    pPrimaryWindow->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, 0x86u, 0, 0x35u, "", 0);
-    pPrimaryWindow->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x87u, 0, 0x36u, "", 0);
-    pPrimaryWindow->CreateButton(0x1DCu, 0x142u, 0x4Du, 0x11u, 1, 100, 0, 0, 0, "", 0);
-    pPrimaryWindow->CreateButton(0x22Bu, 0x142u, 0x4Du, 0x11u, 1, 101, 0, 0, 0, "", 0);
+    pPrimaryWindow->CreateButton(0x1E1u, 0, 0x99u, 0x43u, 1, 92, UIMSG_0, 0, 0, "", 0);
+    pPrimaryWindow->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, UIMSG_StartHireling1Dialogue, 0, 0x35u, "", 0);
+    pPrimaryWindow->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, UIMSG_StartHireling2Dialogue, 0, 0x36u, "", 0);
+    pPrimaryWindow->CreateButton(0x1DCu, 0x142u, 0x4Du, 0x11u, 1, 100, UIMSG_0, 0, 0, "", 0);
+    pPrimaryWindow->CreateButton(0x22Bu, 0x142u, 0x4Du, 0x11u, 1, 101, UIMSG_0, 0, 0, "", 0);
     pBtn_CastSpell = pPrimaryWindow->CreateButton(0x1DCu, 0x1C2u,
         (uTextureID_Btn_CastSpell != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_CastSpell].uTextureWidth : 24),
         (uTextureID_Btn_CastSpell != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_CastSpell].uTextureHeight : 26),
-        1, 0, 0x69u, 0, 0x43u, pGlobalTXT_LocalizationStrings[38],
+        1, 0, UIMSG_69, 0, 0x43u, pGlobalTXT_LocalizationStrings[38],
         (Texture *)(uTextureID_Btn_CastSpell != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_CastSpell] : 0),
         0);
     pBtn_Rest = pPrimaryWindow->CreateButton(0x206u, 0x1C2u,
         (uTextureID_Btn_Rest != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_Rest].uTextureWidth : 24),
         (uTextureID_Btn_Rest != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_Rest].uTextureHeight : 26),
-        1, 0, 0x68u, 0, 0x52u, pGlobalTXT_LocalizationStrings[182],
+        1, 0, UIMSG_68, 0, 0x52u, pGlobalTXT_LocalizationStrings[182],
         (Texture *)(uTextureID_Btn_Rest != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_Rest] : 0), 0);
     pBtn_QuickReference = pPrimaryWindow->CreateButton(0x230u, 0x1C2u,
         (uTextureID_Btn_QuickReference != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_QuickReference].uTextureWidth : 24),
         (uTextureID_Btn_QuickReference != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_QuickReference].uTextureHeight : 26),
-        1, 0, 0x6Au, 0, 0x5Au, pGlobalTXT_LocalizationStrings[173],
+        1, 0, UIMSG_QuickReference, 0, 0x5Au, pGlobalTXT_LocalizationStrings[173],
         (Texture *)(uTextureID_Btn_QuickReference != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_QuickReference] : 0), 0);
     pBtn_GameSettings = pPrimaryWindow->CreateButton(0x25Au, 0x1C2u,
         (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureWidth : 24),
         (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureHeight : 26),
-        1, 0, 0x6Bu, 0, 0, pGlobalTXT_LocalizationStrings[93],
+        1, 0, UIMSG_GameMenuButton, 0, 0, pGlobalTXT_LocalizationStrings[93],
         (Texture *)(uTextureID_Btn_GameSettings != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_GameSettings] : 0), 0);
     pBtn_NPCLeft = pPrimaryWindow->CreateButton(0x1D5u, 0xB2u,
         (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureWidth : 24),
         (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureHeight : 26),
-        1, 0, 0xBCu, 0, 0, "",
-        (Texture *)(uTextureID_Btn_NPCLeft != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft] : 0), 0);
+        1, 0, UIMSG_ScrollNPCPanel, 0, 0, "",
+        pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0);
     pBtn_NPCRight = pPrimaryWindow->CreateButton(0x272u, 0xB2u,
         (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureWidth : 24),
         (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureHeight : 26),
-        1, 0, 0xBCu, 1u, 0, "",
-        (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0), 0);
+        1, 0, UIMSG_ScrollNPCPanel, 1u, 0, "",
+        pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0);
     LoadPartyBuffIcons();
-    }
+}
 
-    //----- (004979D2) --------------------------------------------------------
-    MENU_STATE __cdecl CreditsMenu__Loop()
-        {
+//----- (004979D2) --------------------------------------------------------
+MENU_STATE __cdecl CreditsMenu__Loop()
+{
         char *v0; // eax@5
         char *v1; // edi@5
         FILE *pFile; // eax@5
@@ -330,7 +329,7 @@
             pColor2, pString, pTexture2.pPixels, (signed __int16)pTexture2.uWidth);
         free(pString);
         pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr);
-        pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, 0x71u, 0, 0x1Bu, "", 0);
+        pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 0x1Bu, "", 0);
         pCurrentScreen = SCREEN_CREATORS;
         SetCurrentMenuID(MENU_CREDITSPROC);
         do
--- a/UIOptions.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/UIOptions.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
--- a/UIPartyCreation.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/UIPartyCreation.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -630,85 +629,85 @@
   uXa = 8;
   do
   {
-    pGUIWindow_CurrentMenu->CreateButton(uXa, 120u, 145u, 25u, 1, 0, 0x3Cu, uControlParama, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXa, 120u, 145u, 25u, 1, 0, UIMSG_PlayerCreationChangeName, uControlParama, 0, "", 0);
     uXa += 158;
     ++uControlParama;
   }
   while ( (signed int)uXa < 640 );
-  pCreationUI_BtnPressLeft[0] = pGUIWindow_CurrentMenu->CreateButton(10, 32, 11, 13, 1, 0, 0xABu, 0, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft[1] = pGUIWindow_CurrentMenu->CreateButton(169, 32, 11, 13, 1, 0, 0xABu, 1, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft[2] = pGUIWindow_CurrentMenu->CreateButton(327, 32, 11, 13, 1, 0, 0xABu, 2, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft[3] = pGUIWindow_CurrentMenu->CreateButton(486, 32, 11, 13, 1, 0, 0xABu, 3, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressRight[0] = pGUIWindow_CurrentMenu->CreateButton(74, 32, 11, 13, 1, 0, 0xACu, 0, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight[1] = pGUIWindow_CurrentMenu->CreateButton(233, 32, 11, 13, 1, 0, 0xACu, 1, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight[2] = pGUIWindow_CurrentMenu->CreateButton(391, 32, 11, 13, 1, 0, 0xACu, 2, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight[3] = pGUIWindow_CurrentMenu->CreateButton(549, 32, 11, 13, 1, 0, 0xACu, 3, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressLeft2[0] = pGUIWindow_CurrentMenu->CreateButton(10, 103, 11, 13, 1, 0, 0x90u, 0, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft2[1] = pGUIWindow_CurrentMenu->CreateButton(169, 103, 11, 13, 1, 0, 0x90u, 1, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft2[2] = pGUIWindow_CurrentMenu->CreateButton(327, 103, 11, 13, 1, 0, 0x90u, 2, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressLeft2[3] = pGUIWindow_CurrentMenu->CreateButton(486, 103, 11, 13, 1, 0, 0x90u, 3, 0, "", pTexture_presleft, 0);
-  pCreationUI_BtnPressRight2[0] = pGUIWindow_CurrentMenu->CreateButton(74, 103, 11, 13, 1, 0, 0x91u, 0, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight2[1] = pGUIWindow_CurrentMenu->CreateButton(233, 103, 11, 13, 1, 0, 0x91u, 1, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight2[2] = pGUIWindow_CurrentMenu->CreateButton(391, 103, 11, 13, 1, 0, 0x91u, 2, 0, "", pTexture_pressrigh, 0);
-  pCreationUI_BtnPressRight2[3] = pGUIWindow_CurrentMenu->CreateButton(549, 103, 11, 13, 1, 0, 0x91u, 3, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressLeft[0] = pGUIWindow_CurrentMenu->CreateButton(10, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev, 0, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[1] = pGUIWindow_CurrentMenu->CreateButton(169, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev, 1, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[2] = pGUIWindow_CurrentMenu->CreateButton(327, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev, 2, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft[3] = pGUIWindow_CurrentMenu->CreateButton(486, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev, 3, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressRight[0] = pGUIWindow_CurrentMenu->CreateButton(74, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext, 0, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight[1] = pGUIWindow_CurrentMenu->CreateButton(233, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext, 1, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight[2] = pGUIWindow_CurrentMenu->CreateButton(391, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext, 2, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight[3] = pGUIWindow_CurrentMenu->CreateButton(549, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext, 3, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressLeft2[0] = pGUIWindow_CurrentMenu->CreateButton(10, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 0, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft2[1] = pGUIWindow_CurrentMenu->CreateButton(169, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 1, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft2[2] = pGUIWindow_CurrentMenu->CreateButton(327, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 2, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressLeft2[3] = pGUIWindow_CurrentMenu->CreateButton(486, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 3, 0, "", pTexture_presleft, 0);
+  pCreationUI_BtnPressRight2[0] = pGUIWindow_CurrentMenu->CreateButton(74, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 0, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight2[1] = pGUIWindow_CurrentMenu->CreateButton(233, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 1, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight2[2] = pGUIWindow_CurrentMenu->CreateButton(391, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 2, 0, "", pTexture_pressrigh, 0);
+  pCreationUI_BtnPressRight2[3] = pGUIWindow_CurrentMenu->CreateButton(549, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 3, 0, "", pTexture_pressrigh, 0);
   uControlParamb = 0;
   uXb = 8;
   do
   {
-    pGUIWindow_CurrentMenu->CreateButton(uXb, 308, 150, v0, 1, 0, 0x48u, uControlParamb, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uXb, v0 + 308, 150, v0, 1, 0, 0x49u, uControlParamb, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uXb, 2 * v0 + 308, 150u, v0, 1, 0, 0x4Au, uControlParamb, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uXb, 3 * v0 + 308, 150u, v0, 1, 0, 0x4Bu, uControlParamb, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXb, 308, 150, v0, 1, 0, UIMSG_48, uControlParamb, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXb, v0 + 308, 150, v0, 1, 0, UIMSG_49, uControlParamb, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXb, 2 * v0 + 308, 150u, v0, 1, 0, UIMSG_PlayerCreationRemoveUpSkill, uControlParamb, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXb, 3 * v0 + 308, 150u, v0, 1, 0, UIMSG_PlayerCreationRemoveDownSkill, uControlParamb, 0, "", 0);
     uXb += 158;
     ++uControlParamb;
   }
   while ( (signed int)uXb < 640 );
-  pGUIWindow_CurrentMenu->CreateButton(5u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 0, 0x31u, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(163u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 1u, 0x32u, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(321u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 2u, 0x33u, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(479u, 21u, 0x99u, 0x16Du, 1, 0, 0x76u, 3u, 0x34u, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(5u, 21u, 0x99u, 0x16Du, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 0, 0x31u, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(163u, 21u, 0x99u, 0x16Du, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 1u, 0x32u, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(321u, 21u, 0x99u, 0x16Du, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 2u, 0x33u, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(479u, 21u, 0x99u, 0x16Du, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 3u, 0x34u, "", 0);
   uXc = 23;
   uControlParamc = 2;
   do
   {
-    pGUIWindow_CurrentMenu->CreateButton(uXc, 169, 120, 20, 1, 0, 0, uControlParamc - 2, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uXc, v0 + 169, 120, 20, 1, 0, 0, uControlParamc - 1, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uXc, 2 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uXc, 3 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 1, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uXc, 4 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 2, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uXc, 5 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 3, 0, "", 0);
-    pGUIWindow_CurrentMenu->CreateButton(uXc, 6 * v0 + 169, 120, 20, 1, 0, 0, uControlParamc + 4, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 169, 120, 20, 1, 0, UIMSG_0, uControlParamc - 2, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc - 1, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 2 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 3 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc + 1, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 4 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc + 2, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 5 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc + 3, 0, "", 0);
+    pGUIWindow_CurrentMenu->CreateButton(uXc, 6 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc + 4, 0, "", 0);
     uControlParamc += 7;
     uXc += 158;
   }
   while ( (signed int)uControlParamc < 30 );
   pGUIWindow_CurrentMenu->_41D08F(28, 0, 7, 40);
-  pGUIWindow_CurrentMenu->CreateButton(323, 417, 65, v0, 1, 0, 0x41, 0, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(323, v0 + 417, 65, v0, 1, 0, 0x41, 0xC, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(323, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 0x14, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(388, 417, 65, v0, 1, 0, 0x41, 0x18, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(388, v0 + 417, 65, v0, 1, 0, 0x41, 0x1C, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(388, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 0x20, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(453, 417, 65, v0, 1, 0, 0x41, 0x10, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(453, v0 + 417, 65, v0, 1, 0, 0x41, 8, 0, "", 0);
-  pGUIWindow_CurrentMenu->CreateButton(453, 2 * v0 + 417, 65, v0, 1, 0, 0x41, 4, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(323, 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(323, v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0xC, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(323, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x14, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(388, 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x18, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(388, v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x1C, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(388, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x20, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(453, 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x10, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(453, v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 8, 0, "", 0);
+  pGUIWindow_CurrentMenu->CreateButton(453, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 4, 0, "", 0);
   uControlParamd = 0;
   do
   {
     uXd = -5;
     if ( uControlParamd <= 3 )
       uXd = 0;
-    pGUIWindow_CurrentMenu->CreateButton(100 * (uControlParamd / 3) + uXd + 17, v0 * (uControlParamd % 3) + 417, 100, v0, 1, 0, 0x40,
+    pGUIWindow_CurrentMenu->CreateButton(100 * (uControlParamd / 3) + uXd + 17, v0 * (uControlParamd % 3) + 417, 100, v0, 1, 0, UIMSG_PlayerCreationSelectActiveSkill,
       uControlParamd, 0, "", 0);
     ++uControlParamd;
   }
   while ( uControlParamd < 9 );
-  pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, 0x42, 0, 0xD, "",
+  pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickOK, 0, 0xD, "",
                               (Texture *)(uTextureID_BUTTMAKE != -1 ? &pIcons_LOD->pTextures[uTextureID_BUTTMAKE] : 0), 0);
-  pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, 0x43, 0, 0x43, "",
+  pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickReset, 0, 0x43, "",
                                  (Texture *)(uTextureID_BUTTMAKE2 != -1 ? &pIcons_LOD->pTextures[uTextureID_BUTTMAKE2] : 0), 0);
-  pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, 0x3F, 0, 0x2D, "", pTexture_buttminu, 0);
-  pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, 0x3E, 1, 0x2B, "", pTexture_buttplus, 0);
+  pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickMinus, 0, 0x2D, "", pTexture_buttminu, 0);
+  pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickPlus, 1, 0x2B, "", pTexture_buttplus, 0);
   pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL);
 }
 // 4E28F8: using guessed type int pCurrentScreen;
--- a/UIPopup.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/UIPopup.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -1594,14 +1593,14 @@
         {
         for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )
             {
-            if ( i->uControlID == 121
+            if ( i->msg == UIMSG_SkillUp
                 && (signed int)v0 >= (signed int)i->uX
                 && (signed int)v0 <= (signed int)i->uZ
                 && (signed int)v1 >= (signed int)i->uY
                 && (signed int)v1 <= (signed int)i->uW )
                 {
-                v3 = CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)i->uControlParam);
-                sub_4179BC_draw_tooltip(pSkillNames[i->uControlParam], v3);
+                v3 = CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)i->msg_param);
+                sub_4179BC_draw_tooltip(pSkillNames[i->msg_param], v3);
                 v1 = pY;
                 v0 = pX;
                 }
@@ -1928,9 +1927,14 @@
         dword_507B00_spell_info_to_draw_in_popup = 0;
         }
     // 507B00: using guessed type int dword_507B00_spell_info_to_draw_in_popup;
-    //----- (00416D62) --------------------------------------------------------
-    void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(Vec2_int_ *_this)
-        {
+
+
+
+
+
+//----- (00416D62) --------------------------------------------------------
+void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(Vec2_int_ *_this)
+{
         signed int pPlayerNum; // eax@12
         char *v2; // eax@32
         void *v3; // ecx@52
@@ -1945,7 +1949,7 @@
         GUIButton *pButton; // esi@84
         unsigned int v13; // ecx@85
         char *pStr; // edi@85
-        signed int pControlID; // eax@92
+        //signed int pControlID; // eax@92
         int v16; // eax@95
         int v17; // eax@96
         PLAYER_SKILL_TYPE v18; // eax@98
@@ -2218,50 +2222,49 @@
                 if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ
                     && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW )
                     {
-                    pControlID = pButton->uControlID;
-                    switch ( pControlID )
-                        {
-                    case 0: //stats info
-                        pWindow.Hint = pAttributeDescriptions[(signed int)pButton->uControlParam % 7];
-                        pStr = aAttributeNames[(signed int)pButton->uControlParam % 7];
+                    switch ( pButton->msg )
+                    {
+                    case UIMSG_0: //stats info
+                        pWindow.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7];
+                        pStr = aAttributeNames[(signed int)pButton->msg_param % 7];
                         break;
-                    case 62: //Plus button info 
+                    case UIMSG_PlayerCreationClickPlus: //Plus button info 
                         pStr = pGlobalTXT_LocalizationStrings[670];//Äîáàâèòü
                         pWindow.Hint = pGlobalTXT_LocalizationStrings[671];//"Äîáàâëÿåò î÷êî ê âûäåëåííîìó íàâûêó, çàáèðàÿ åãî èç íàêîïèòåëÿ î÷êîâ"
                         break;
-                    case 63: //Minus button info
+                    case UIMSG_PlayerCreationClickMinus: //Minus button info
                         pStr = pGlobalTXT_LocalizationStrings[668];//Âû÷åñòü
                         pWindow.Hint = pGlobalTXT_LocalizationStrings[669];//"Âû÷èòàåò î÷êî èç âûäåëåííîãî íàâûêà, âîçâðàùàÿ åãî â íàêîïèòåëü î÷êîâ"
                         break;
-                    case 64: //Available skill button info
-                        v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->uControlParam + 4);
+                    case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info
+                        v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4);
                         pStr = pSkillNames[v18];
                         pWindow.Hint = pSkillDesc[v18];
                         break;
-                    case 65: //Available Class Info
-                        pWindow.Hint = pClassDescriptions[pButton->uControlParam];
-                        pStr = pClassNames[pButton->uControlParam];
+                    case UIMSG_PlayerCreationSelectClass: //Available Class Info
+                        pWindow.Hint = pClassDescriptions[pButton->msg_param];
+                        pStr = pClassNames[pButton->msg_param];
                         break;
-                    case 66: //OK Info
+                    case UIMSG_PlayerCreationClickOK: //OK Info
                         pWindow.Hint = pGlobalTXT_LocalizationStrings[664];//Ùåëêíèòå çäåñü äëÿ óòâåðæäåíèÿ ñîñòàâà îòðÿäà è ïðîäîëæåíèÿ èãðû.
                         pStr = pGlobalTXT_LocalizationStrings[665];//Êíîïêà ÎÊ
                         break;
-                    case 67: //Clear info
+                    case UIMSG_PlayerCreationClickReset: //Clear info
                         pWindow.Hint = pGlobalTXT_LocalizationStrings[666];//Ñáðàñûâàåò âñå ïàðàìåòðû è íàâûêè îòðÿäà.
                         pStr = pGlobalTXT_LocalizationStrings[667];//Êíîïêà Î÷èñòèòü
                         break;
-                    case 118: // Character info
-                        pStr = pParty->pPlayers[pButton->uControlParam].pName;
-                        pWindow.Hint = pClassDescriptions[pParty->pPlayers[pButton->uControlParam].classType];
+                    case UIMSG_PlayerCreation_SelectAttribute: // Character info
+                        pStr = pParty->pPlayers[pButton->msg_param].pName;
+                        pWindow.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType];
                         break;
                         }
-                    if ( pControlID > 68 && pControlID <= 75 ) //Sellected skills info
+                    if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info
                         {
-                        pSkillId = pParty->pPlayers[pButton->uControlParam].GetSkillIdxByOrder(pControlID - 72);
+                        pSkillId = pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48);
                         pY = 0;
                         if ( (signed int)pSkillId < 37 )
                             {
-                            pSkillInfo = CharacterUI_GetSkillDescText(pButton->uControlParam, (PLAYER_SKILL_TYPE)pSkillId);
+                            pSkillInfo = CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pSkillId);
                             strcpy(pTmpBuf2, pSkillInfo);
                             pWindow.Hint = pTmpBuf2;
                             pStr = pSkillNames[pSkillId];
--- a/UIRest.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/UIRest.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -115,7 +114,7 @@
         37u,
         1,
         0,
-        0xA7u,
+        UIMSG_ExitRest,
         0,
         0,
         "",
@@ -128,7 +127,7 @@
         37u,
         1,
         0,
-        0x61u,
+        UIMSG_61,
         0,
         0x52u,
         "",
@@ -141,7 +140,7 @@
         33u,
         1,
         0,
-        0x6Du,
+        UIMSG_AlreadyResting,
         0,
         0x44u,
         "",
@@ -154,7 +153,7 @@
         33u,
         1,
         0,
-        0x60u,
+        UIMSG_Wait1Hour,
         0,
         0x48u,
         "",
@@ -167,7 +166,7 @@
         33u,
         1,
         0,
-        0x5Fu,
+        UIMSG_Wait5Minutes,
         0,
         0x4Du,
         "",
--- a/UISaveLoad.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/UISaveLoad.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
--- a/UiGame.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/UiGame.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -292,7 +291,7 @@
   char v3; // dl@1
   GUIWindow *v4; // ecx@2
   GUIButton *result; // eax@2
-  int v6; // edx@12
+  //int v6; // edx@12
 
   v1 = toupper(uHotkey);
   v2 = uNumVisibleWindows;
@@ -306,8 +305,7 @@
       {
         if ( result->uHotkey == v3 )
         {
-          v6 = result->uControlParam;
-          pMessageQueue_50CBD0->AddMessage((UIMessageType)result->uControlID, v6, 0);
+          pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0);
           /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
           {
             pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID;
@@ -511,7 +509,7 @@
   unsigned __int8 v9; // c0@23
   unsigned __int8 v10; // c3@23
   enum UIMessageType pMessageType1; // esi@24
-  int v12; // edx@25
+  //int v12; // edx@25
   char *v13; // ecx@28
   int v14; // eax@41
   ItemGen *pItemGen; // ecx@44
@@ -535,9 +533,9 @@
   //unsigned __int8 v33; // c0@109
   //unsigned __int8 v34; // c3@109
   enum UIMessageType pMessageType2; // esi@110
-  int v36; // edx@111
+  //int v36; // edx@111
   enum UIMessageType pMessageType3; // edx@117
-  int v38; // ecx@118
+  //int v38; // ecx@118
   const char *v39; // [sp-8h] [bp-E8h]@20
   char *v40; // [sp-8h] [bp-E8h]@83
   int v41; // [sp-4h] [bp-E4h]@20
@@ -858,16 +856,7 @@
 				pMessageType1 = (UIMessageType)pButton->field_1C;
 				if ( pMessageType1 )
 				{
-				  v12 = pButton->uControlParam;
-				  pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0);
-				  /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-				  {
-					pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1;
-					pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12;
-					*(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-	//LABEL_27:
-					++pMessageQueue_50CBD0->uNumMessages;
-				  }*/
+				  pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
 				}
 	//LABEL_28:
 				v13 = pButton->pButtonName;
@@ -888,22 +877,10 @@
 				{
 				  if ( (double)(signed int)pButton->uHeight != 0.0 )
 				  {
-					//UNDEF(v8);
-					//if ( v9 | v10 )
-					  //goto LABEL_24;
-					//{
 					  pMessageType1 = (UIMessageType)pButton->field_1C;
 					  if ( pMessageType1 )
 					  {
-						v12 = pButton->uControlParam;
-						pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0);
-						/*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-						{
-						  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1;
-						  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12;
-						  *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-						  ++pMessageQueue_50CBD0->uNumMessages;
-						}*/
+						pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
 					  }
 					  v13 = pButton->pButtonName;
 					  sub_41C0B8_set_status_string(v13);
@@ -923,7 +900,7 @@
 				{
 	//LABEL_19:
 				  pPlayer = pPlayers[uActiveCharacter];
-				  v5 = LOBYTE(pPlayer->pActiveSkills[pButton->uControlParam]);
+				  v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]);
 				  v6 = pPlayer->uSkillPoints;
 				  v7 = (v5 & 0x3F) + 1;
 				  if ( v6 < v7 )
@@ -1066,15 +1043,8 @@
               uLastPointedObjectID = 1;
               return;
             }
-            v38 = pButton->uControlParam;
-            /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-            {
-              pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType3;
-              pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v38;
-              *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-              ++pMessageQueue_50CBD0->uNumMessages;
-            }*/
-            pMessageQueue_50CBD0->AddMessage(pMessageType3, v38, 0);
+
+            pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0);
             //goto LABEL_131;
             uLastPointedObjectID = 1;
             return;
@@ -1098,22 +1068,8 @@
                 //{
                   pMessageType2 = (UIMessageType)pButton->field_1C;
                   if ( pMessageType2 != 0 )
-                  {
-                    v36 = pButton->uControlParam;
-                    if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-                    {
-                      pMessageQueue_50CBD0->AddMessage(pMessageType2, v36, 0);
-                      /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType2;
-                      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v36;
-                      *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-                      //goto LABEL_27;
-                      ++pMessageQueue_50CBD0->uNumMessages;*/
-                      v13 = pButton->pButtonName;
-                      sub_41C0B8_set_status_string(v13);
-                      uLastPointedObjectID = 1;
-                      return;
-                    }
-                  }
+                      pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0);
+
                   //goto LABEL_28;
                   v13 = pButton->pButtonName;
                   sub_41C0B8_set_status_string(v13);
@@ -1133,7 +1089,7 @@
               //goto LABEL_19;
             {
               pPlayer = pPlayers[uActiveCharacter];
-              v5 = LOBYTE(pPlayer->pActiveSkills[pButton->uControlParam]);
+              v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]);
               v6 = pPlayer->uSkillPoints;
               v7 = (v5 & 0x3F) + 1;
               if ( v6 < v7 )
@@ -1291,41 +1247,41 @@
   pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308,
                                 (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureWidth : 24),
                                 (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureHeight : 26),
-                                1, 0, 0x73u, 0, 0x53u, pGlobalTXT_LocalizationStrings[216],// Stats
+                                1, 0, UIMSG_73, 0, 0x53u, pGlobalTXT_LocalizationStrings[216],// Stats
                                 (Texture *)(papredoll_dbrds[10] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[10]] : 0),
                                 papredoll_dbrds[9] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[9]] : 0, 0);
   pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308,
                                  (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureWidth : 24),
                                  (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureHeight : 26),
-                                 1, 0, 0x72u, 0, 0x4Bu, pGlobalTXT_LocalizationStrings[205],//Skills
+                                 1, 0, UIMSG_72, 0, 0x4Bu, pGlobalTXT_LocalizationStrings[205],//Skills
                                  (Texture *)(papredoll_dbrds[8] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[8]] : 0),
                                  papredoll_dbrds[7] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[7]] : 0, 0);
   pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308,
                                     (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureWidth : 24),
                                     (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureHeight : 26),
-                                    1, 0, 0x74u, 0, 0x49u, pGlobalTXT_LocalizationStrings[120], //Inventory
+                                    1, 0, UIMSG_74, 0, 0x49u, pGlobalTXT_LocalizationStrings[120], //Inventory
                                     (Texture *)(papredoll_dbrds[6] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[6]] : 0),
                                     papredoll_dbrds[5] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[5]] : 0, 0);
   pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308,
                                  (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureWidth : 24),
                                  (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureHeight : 26),
-                                 1, 0, 0x75u, 0, 0x41u, pGlobalTXT_LocalizationStrings[22], //Awards
+                                 1, 0, UIMSG_75, 0, 0x41u, pGlobalTXT_LocalizationStrings[22], //Awards
                                  (Texture *)(papredoll_dbrds[4] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[4]] : 0),
                                  papredoll_dbrds[3] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[3]] : 0, 0);
   pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308,
                  (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureWidth : 24),
                  (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureHeight : 26),
-                 1, 0, 0xA8u, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit
+                 1, 0, UIMSG_A8, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit
                  (Texture *)(papredoll_dbrds[2] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[2]] : 0),
                  papredoll_dbrds[1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[1]] : 0, 0);
-  pWindow->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, 0x78u, 0, 0, "", 0);
-  pCharacterScreen_DetalizBtn = pWindow->CreateButton(0x258u, 0x12Cu, 0x1Eu, 0x1Eu, 1, 0, 0x55u, 0, 0, pGlobalTXT_LocalizationStrings[64], 0);
-  pCharacterScreen_DollBtn = pWindow->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, 0x85u, 0, 0, "", 0);
-  pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-  pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-  pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-  pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
-  pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
+  pWindow->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0);
+  pCharacterScreen_DetalizBtn = pWindow->CreateButton(0x258u, 0x12Cu, 0x1Eu, 0x1Eu, 1, 0, UIMSG_MainMenu_ShowLoadWindow, 0, 0, pGlobalTXT_LocalizationStrings[64], 0);
+  pCharacterScreen_DollBtn = pWindow->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_85, 0, 0, "", 0);
+  pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0);
+  pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0);
+  pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0);
+  pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0);
+  pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0);
   FillAwardsData();
   return pWindow;
 }
@@ -1333,7 +1289,7 @@
 
 //----- (004921C1) --------------------------------------------------------
 void GameUI_DrawPortraits(unsigned int _this)
-    {
+{
     Texture *pFace; // eax@10
     unsigned int v7; // eax@17
     PlayerFrame *pFrame; // eax@21
--- a/VideoPlayer.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/VideoPlayer.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -1130,10 +1130,10 @@
     {
       pAudioPlayer->PlaySound(SOUND_Invalid, 0, 0, -1, 0, 0, 0, 0);
       window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0);
-      window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-      window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-      window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-      window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
+      window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0);
+      window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0);
+      window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0);
+      window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0);
     }
     bGameoverLoop = 0;
   }
--- a/Viewport.h	Wed Mar 27 15:04:59 2013 +0200
+++ b/Viewport.h	Wed Mar 27 19:50:37 2013 +0200
@@ -39,6 +39,7 @@
   {
     draw_sw_outlines = false;
     draw_d3d_outlines = false;
+    field_4C = 0;
   }
 
   void CenterOnParty2();
--- a/mm7_1.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/mm7_1.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -12,7 +12,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -92,7 +91,7 @@
     }
     for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext )
     {
-      if ( j->uControlID == 120 )
+      if ( j->msg == UIMSG_InventoryLeftClick)
       {
         j->uX = dword_50698C;
         j->uY = dword_506988;
@@ -103,20 +102,6 @@
     }
   }
 }
-// 506980: using guessed type int dword_506980;
-// 506984: using guessed type int dword_506984;
-// 506988: using guessed type int dword_506988;
-// 50698C: using guessed type int dword_50698C;
-// 507CC0: using guessed type int dword_507CC0;
-// 50651C: using guessed type int dword_50651C;
-// 506520: using guessed type int dword_506520;
-// 506524: using guessed type int dword_506524;
-// 506528: using guessed type int dword_506528;
-// 506544: using guessed type int dword_506544;
-// 506548: using guessed type int dword_506548;
-// 723E80: using guessed type int dword_723E80_award_related[];
-// 723E84: using guessed type int dword_723E84[];
-// 5075E0: using guessed type int pVisibleWindowsIdxs[20];
 
 //----- (0041CD4F) --------------------------------------------------------
 bool __thiscall sub_41CD4F(unsigned int _this)
@@ -131,7 +116,7 @@
   char v8; // zf@21
   GUIButton *v9; // ecx@24
   int v10; // esi@24
-  int v11; // edx@26
+  //int v11; // edx@26
   int v12; // edx@28
   int v13; // esi@32
   GUIButton *v14; // eax@37
@@ -140,7 +125,7 @@
   int v18; // edx@50
   GUIButton *v19; // ecx@54
   int v20; // esi@54
-  int v21; // edx@56
+  //int v21; // edx@56
   int v22; // ecx@59
   int v23; // edx@59
   int v24; // ecx@60
@@ -193,16 +178,8 @@
 				  }
 				  while ( v13 );
 				}
-				v11 = v9->uControlParam;
-				/*if ( (signed int)v2 < 40 )
-				{
-				  pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v9->uControlID;
-				  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v11;
-				  *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
-				  v2 = pMessageQueue_50CBD0->uNumMessages + 1;
-				  ++pMessageQueue_50CBD0->uNumMessages;
-				}*/
-				pMessageQueue_50CBD0->AddMessage((UIMessageType)v9->uControlID, v11, v1);
+
+                pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, v1);
 				break;
 				}
 			case VK_RIGHT:
@@ -233,8 +210,7 @@
 					}
 					while ( v10 );
 				}
-				v11 = v9->uControlParam;
-				pMessageQueue_50CBD0->AddMessage((UIMessageType)v9->uControlID, v11, v1);
+				pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, v1);
 				break;				
 				}
 			case VK_DOWN:
@@ -258,8 +234,7 @@
 					}
 					while ( v20 );
 				}
-				v21 = v19->uControlParam;
-				pMessageQueue_50CBD0->AddMessage((UIMessageType)v19->uControlID, v21, v1);
+				pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, v1);
 				return 1;
 				}
 			case VK_SELECT:
@@ -327,15 +302,8 @@
 					}
 					while ( v25 );
 				}
-				v21 = v19->uControlParam;
-				/*if ( (signed int)v2 < 40 )
-				{
-				pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v19->uControlID;
-				pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v21;
-				*(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
-				++pMessageQueue_50CBD0->uNumMessages;
-				}*/
-				pMessageQueue_50CBD0->AddMessage((UIMessageType)v19->uControlID, v21, v1);
+
+				pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, v1);
 				return 1;
 				}
 			case VK_NEXT:
@@ -729,19 +697,19 @@
                  33u,
                  1,
                  0,
-                 0xA8u,
+                 UIMSG_A8,
                  0,
                  0,
                  pGlobalTXT_LocalizationStrings[79], // Close
                  (Texture *)(papredoll_dbrds[2] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[2]] : 0),
                  papredoll_dbrds[1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[1]] : 0,
                  0);
-  v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, 0x78u, 0, 0, "", 0);
-  pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, 0x85u, 0, 0, "", 0);
-  v2->CreateButton(61u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-  v2->CreateButton(177u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-  v2->CreateButton(292u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-  v2->CreateButton(407u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
+  v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0);
+  pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_85, 0, 0, "", 0);
+  v2->CreateButton(61u, 424u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0);
+  v2->CreateButton(177u, 424u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0);
+  v2->CreateButton(292u, 424u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0);
+  v2->CreateButton(407u, 424u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0);
   return v2;
 }
 
--- a/mm7_2.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/mm7_2.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -5,7 +5,6 @@
 #include "MapInfo.h"
 #include "Game.h"
 #include "GUIWindow.h"
-#include "GUIButton.h"
 #include "GUIFont.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -293,10 +292,10 @@
   uDialogueType = 83;
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0);
-  pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
+  pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
                  (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
-  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
-  pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0);
+  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
+  pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, UIMSG_0, 0x53u, 0, "", 0);
   pDialogueWindow->_41D08F(1, 1, 0, 2);
   dialog_menu_id = HOUSE_DIALOGUE_OTHER;
   v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102);
@@ -436,12 +435,12 @@
     pDialogueWindow->pControlsHead = 0;
     pDialogueWindow->pControlsTail = 0;
     pDialogueWindow->uNumControls = 0;
-    pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79],
+    pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79],
                    (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
-    pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x55u, 0, "", 0);
-    pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x56u, 0, "", 0);
-    pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x57u, 0, "", 0);
-    pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x58u, 0, "", 0);
+    pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x55u, 0, "", 0);
+    pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x56u, 0, "", 0);
+    pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x57u, 0, "", 0);
+    pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x58u, 0, "", 0);
     pDialogueWindow->_41D08F(4, 1, 0, 1);
   }
 }
@@ -808,10 +807,10 @@
 {
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0);
-  pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445,  169, 35, 1, 0,  0x71u,  0,  0,
+  pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445,  169, 35, 1, 0, UIMSG_Escape,  0,  0,
                  pGlobalTXT_LocalizationStrings[74],  //"End Conversation"
                  pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
-  pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0);
+  pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
 }
 
 //----- (004BD8B5) --------------------------------------------------------
@@ -898,7 +897,7 @@
         do
         {
           HouseNPCData[v2 + 7] = (NPCData *)window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2],
-                                              0x3Fu, 0x49u, 1, 0, 0x19Au, v2, 0, byte_591180[v2], 0, 0, 0);
+                                              0x3Fu, 0x49u, 1, 0, UIMSG_19A, v2, 0, byte_591180[v2], 0, 0, 0);
           v1 = uNumDialogueNPCPortraits;
           ++v2;
           //v3 += 100;
@@ -6941,7 +6940,7 @@
                 && pt.y >= (signed int)pButton->uY && pt.y <= (signed int)pButton->uW
                 && pWindow == pWindow_MainMenu )
            {
-            pControlParam = pButton->uControlParam;
+            pControlParam = pButton->msg_param;
             switch (pControlParam) // ïîäñâåòêà êíîïîê
             {
               case 0:
@@ -6988,7 +6987,7 @@
 //----- (004637EB) --------------------------------------------------------
 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
 {
-  unsigned int v4; // esi@1
+  //unsigned int v4; // esi@1
   Render *v5; // ecx@14
   HANDLE v6; // eax@32
   Keyboard *v7; // eax@33
@@ -7029,10 +7028,15 @@
   switch (Msg)
   {
     case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam);
+    case WM_CHAR:
+    {
+      if (!pKeyActionMap->_459F10(wParam) && !viewparams->field_4C)
+        GUI_HandleHotkey(wParam);
+    }
+    return DefWindowProcA(hWnd, Msg, wParam, lParam);
   };
   
 
-  v4 = lParam;
   if ( Msg > WM_SYSCOMMAND )
   {
     switch ( Msg )
@@ -7090,7 +7094,7 @@
           if ( pAsyncMouse != v32 )
             goto _def_wnd_proc;
           back_to_game();
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         if (pAsyncMouse)
           goto _def_wnd_proc;
@@ -7104,7 +7108,7 @@
           if (pAsyncMouse)
             goto _def_wnd_proc;
           pArcomageGame->stru1.field_0 = 7;
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         if ( pVideoPlayer->pVideoFrame.pPixels )
           pVideoPlayer->bStopBeforeSchedule = 1;
@@ -7129,7 +7133,7 @@
         if ( pAsyncMouse == (void *)v28 )
         {
           UI_OnMouseLeftClick(0);
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         goto _def_wnd_proc;
       case WM_RBUTTONDBLCLK:
@@ -7151,14 +7155,14 @@
           if (!pAsyncMouse)
           {
             sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0);
-            return DefWindowProcA(hWnd, Msg, wParam, v4);
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
           }
           goto _def_wnd_proc;
         }
         if (pAsyncMouse)
           goto _def_wnd_proc;
         pArcomageGame->stru1.field_0 = 8;
-        return DefWindowProcA(hWnd, Msg, wParam, v4);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_MBUTTONDOWN:
         if ( pRenderer->pRenderD3D )
         {
@@ -7166,14 +7170,14 @@
           {
             v34 = GetPickDepth();
             pGame->PickMouse(v34, (unsigned __int16)lParam, lParam >> 16, 1, &vis_sprite_filter_3, &vis_face_filter);
-            return DefWindowProcA(hWnd, Msg, wParam, v4);
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
           }
           goto _def_wnd_proc;
         }
         if ( !pGame )
           goto _def_wnd_proc;
         sub_417871(0);
-        return DefWindowProcA(hWnd, Msg, wParam, v4);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_MOUSEMOVE:
         if ( pArcomageGame->bGameInProgress )
         {
@@ -7195,7 +7199,7 @@
             goto _def_wnd_proc;
           pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16);
         }
-        return DefWindowProcA(hWnd, Msg, wParam, v4);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
     }
   }
   if ( Msg == WM_SYSCOMMAND )
@@ -7213,7 +7217,7 @@
         if (pVideoPlayer->AnyMovieLoaded() && pVideoPlayer->pBinkBuffer)
         {
           BinkBufferSetOffset(pVideoPlayer->pBinkBuffer, 0, 0);
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
       }
       goto _def_wnd_proc;
@@ -7225,16 +7229,7 @@
         if ( wParam == VK_CONTROL )
         {
           dword_507B98_ctrl_pressed = 0;
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
-        }
-        goto _def_wnd_proc;
-      }
-      if ( Msg == WM_CHAR )
-      {
-        if ( !pKeyActionMap->_459F10(wParam) && !viewparams->field_4C )
-        {
-          GUI_HandleHotkey(wParam);
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         goto _def_wnd_proc;
       }
@@ -7255,7 +7250,7 @@
           return 0;
         }
         if ( wParam != 40001 )
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
       }
       v38 = 0;
       v37 = 0;
@@ -7268,7 +7263,7 @@
     if ( dword_506E68 != -1 )
     {
       pKeyActionMap->_459F10(wParam);
-      return DefWindowProcA(hWnd, Msg, wParam, v4);
+      return DefWindowProcA(hWnd, Msg, wParam, lParam);
     }
     if ( !pArcomageGame->bGameInProgress )
     {
@@ -7598,12 +7593,11 @@
       if (pAsyncMouse)
       {
         pAsyncMouse->Suspend();
-        return DefWindowProcA(hWnd, Msg, wParam, v4);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       }
     }
 _def_wnd_proc:
-    v4 = lParam;
-    return DefWindowProcA(hWnd, Msg, wParam, v4);
+    return DefWindowProcA(hWnd, Msg, wParam, lParam);
   }
   if ( Msg != WM_KILLFOCUS )
   {
@@ -7631,12 +7625,12 @@
     goto _def_wnd_proc;
   }
   if ( ::hWnd != (HWND)wParam || (dword_4E98BC_bApplicationActive = 1, pRenderer->bWindowMode) || !pAsyncMouse )
-    return DefWindowProcA(hWnd, Msg, wParam, v4);
+    return DefWindowProcA(hWnd, Msg, wParam, lParam);
   pAsyncMouse->Resume();
   if ( !pAsyncMouse )
     goto _def_wnd_proc;
   pAsyncMouse->Clip();
-  return DefWindowProcA(hWnd, Msg, wParam, v4);
+  return DefWindowProcA(hWnd, Msg, wParam, lParam);
 }
 
 //----- (00464479) --------------------------------------------------------
--- a/mm7_3.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/mm7_3.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -4,7 +4,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -12494,10 +12493,10 @@
     dword_5C341C = v3;
     _591094_decoration = activeLevelDecoration;
     pGUIWindow2 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_GreetingNPC, a4, 0);
-    pGUIWindow2->CreateButton(61u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-    pGUIWindow2->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-    pGUIWindow2->CreateButton(292u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-    pGUIWindow2->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
+    pGUIWindow2->CreateButton(61u, 424u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0);
+    pGUIWindow2->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0);
+    pGUIWindow2->CreateButton(292u, 424u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0);
+    pGUIWindow2->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0);
   }
 }
 
@@ -12706,7 +12705,7 @@
     //v15 = v14;
     if ( !v14 )
       break;
-    v16 = v14->uControlParam;
+    v16 = v14->msg_param;
 
     if ( v16 > 88 )
       v14->pButtonName[0] = 0;
@@ -12734,7 +12733,7 @@
       if (!topic)
       {
         v14->pButtonName[0] = 0;
-        v14->uControlParam = 0;
+        v14->msg_param = 0;
       }
       else
         strcpy(v14->pButtonName, topic);
@@ -12748,7 +12747,7 @@
       if (!topic)
       {
         v14->pButtonName[0] = 0;
-        v14->uControlParam = 0;
+        v14->msg_param = 0;
       }
       else strcpy(v14->pButtonName, topic);
 	}
@@ -12759,7 +12758,7 @@
       if (!topic)
       {
         v14->pButtonName[0] = 0;
-        v14->uControlParam = 0;
+        v14->msg_param = 0;
       }
       else strcpy(v14->pButtonName, topic);
 	}
@@ -12770,7 +12769,7 @@
       if (!topic)
       {
         v14->pButtonName[0] = 0;
-        v14->uControlParam = 0;
+        v14->msg_param = 0;
       }
       else strcpy(v14->pButtonName, topic);
 	}
@@ -12781,7 +12780,7 @@
       if (!topic)
       {
         v14->pButtonName[0] = 0;
-        v14->uControlParam = 0;
+        v14->msg_param = 0;
       }
       else strcpy(v14->pButtonName, topic);
 	}
@@ -12792,7 +12791,7 @@
       if (!topic)
       {
         v14->pButtonName[0] = 0;
-        v14->uControlParam = 0;
+        v14->msg_param = 0;
       }
       else strcpy(v14->pButtonName, topic);
 	}
--- a/mm7_4.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/mm7_4.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -6,7 +6,6 @@
 #include "MapInfo.h"
 #include "Game.h"
 #include "GUIWindow.h"
-#include "GUIButton.h"
 #include "GUIFont.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -7341,7 +7340,7 @@
     while ( 1 )
     {
       v16 = v52.GetControl(v56);
-      v17 = v16->uControlParam;
+      v17 = v16->msg_param;
       pInString = (char *)v16;
       if ( (signed int)v17 > 24 )
       {
@@ -7398,7 +7397,7 @@
           v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23];
           if ( !v15 )
           {
-            v16->uControlParam = 0;
+            v16->msg_param = 0;
             v15 = "";
           }
           goto LABEL_49;
@@ -7418,7 +7417,7 @@
             v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb];
             if ( !v15 )
             {
-              v16->uControlParam = 0;
+              v16->msg_param = 0;
               v15 = "";
             }
             if ( uDialogueType != 84 )
@@ -7537,7 +7536,7 @@
 //----- (004B36CC) --------------------------------------------------------
 void CreateButtonInColumn( int column_pos, unsigned int control_id )
 {
-     pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30,  1,  0, 0x195u,  control_id,  0,   "",   0);
+     pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30,  1,  0, UIMSG_SelectShopDialogueOption,  control_id,  0,   "",   0);
 }
 
 //----- (004B3A72) --------------------------------------------------------
@@ -7798,10 +7797,10 @@
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0);
   if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) )
   {
-    pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, 136, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);
+    pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);
     v1 = 1;
   }
-  pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, 136, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü
+  pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü
   pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1);
 }
 
@@ -7813,10 +7812,10 @@
   ContractSelectText(pEventCode);
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0);
-  pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34],
-                 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
-  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
-  pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0);
+  pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], // Cancel
+                 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
+  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
+  pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0);
   pDialogueWindow->_41D08F(1, 1, 0, 2);
   dialog_menu_id = HOUSE_DIALOGUE_OTHER;
 }
@@ -7835,14 +7834,14 @@
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0);
   v2 = "";
-  pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u,  0x23u,   1,  0, 0x71u, 0,   0,
+  pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u,  0x23u,   1,  0, UIMSG_Escape, 0,   0,
                  pGlobalTXT_LocalizationStrings[34],
                  (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0),
                  0);
-  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
+  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
   if ( contract_approved )
     v2 = pGlobalTXT_LocalizationStrings[535];
-  pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0);
+  pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0);
   pDialogueWindow->_41D08F(1, 1, 0, 2);
   dialog_menu_id = HOUSE_DIALOGUE_OTHER;
 }
@@ -7859,18 +7858,18 @@
   v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0);
-  pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu,  0xA9u,   0x23u,  1,  0,  0x71u,  0,   0,
+  pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu,  0xA9u,   0x23u,  1,  0,  UIMSG_Escape,  0,   0,
                  pGlobalTXT_LocalizationStrings[34], //"Cancel"
                  (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0),
                  0);
-  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
+  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
   if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) )
   {
-    pDialogueWindow->CreateButton( 0x1E0u,  0xA0u,  0x8Cu,  0x1Eu,   1,  0,  0xAFu,  0x4Du,   0,
+    pDialogueWindow->CreateButton( 0x1E0u,  0xA0u,  0x8Cu,  0x1Eu,   1,  0,  UIMSG_ClickNPCTopic,  0x4Du,   0,
       pGlobalTXT_LocalizationStrings[407], 0);//"More Information"   
     v0 = 1;
   }
-  pDialogueWindow->CreateButton(  0x1E0u,  30 * v0 + 160,  0x8Cu,  0x1Eu,  1,  0,  0xAFu,  0x4Cu,  0,
+  pDialogueWindow->CreateButton(  0x1E0u,  30 * v0 + 160,  0x8Cu,  0x1Eu,  1,  0,  UIMSG_ClickNPCTopic,  0x4Cu,  0,
     pGlobalTXT_LocalizationStrings[406],  0); //"Hire"
   pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2);
   dialog_menu_id = HOUSE_DIALOGUE_OTHER;
@@ -7897,14 +7896,14 @@
     pDialogueWindow->Release();
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
     sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
-    pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu,
+    pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0x4Eu,
                    pGlobalTXT_LocalizationStrings[34],// "Cancel"
                    (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0);
-    pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u,  75u, 33u, 1, 0,  0xBFu,  1u,  0x59u,
+    pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u,  75u, 33u, 1, 0,  UIMSG_BF,  1u,  0x59u,
                    sHouseName,
                    (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0);
-    pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0,  0xBFu, 1u, 0x20u,  sHouseName, 0);
-    pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, 0xBFu, 1u, 0x59u, sHouseName, 0);
+    pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0,  UIMSG_BF, 1u, 0x20u,  sHouseName, 0);
+    pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, UIMSG_BF, 1u, 0x59u, sHouseName, 0);
   }
   else
   {
@@ -7919,10 +7918,10 @@
         ((GUIButton *)HouseNPCData[i + 7])->Release();
     }
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
-    pBtn_ExitCancel = pDialogueWindow->CreateButton(  471u,  445u,  169u, 35u,  1,   0, 0x71u,  0,  0,
+    pBtn_ExitCancel = pDialogueWindow->CreateButton(  471u,  445u,  169u, 35u,  1,   0, UIMSG_Escape,  0,  0,
                    pGlobalTXT_LocalizationStrings[74],// "End Conversation"
                    (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0),   0);
-    pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0);
+    pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
     if ( pDialogueNPCCount == 1 && dword_591080 )
     {
       sub_4B3B42(in_current_building_type);
@@ -7932,7 +7931,7 @@
       if ( v17->joins )
       {
         num_menu_buttons = 1;
-        pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0xAFu, 0xDu, 0, "", 0);
+        pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0xDu, 0, "", 0);
       }
       if ( v17->evt_A)
       {
@@ -7940,7 +7939,7 @@
         {
           v6 = NPC_EventProcessor(v17->evt_A);
           if ( v6 == 1 || v6 == 2 )
-            pDialogueWindow->CreateButton(  480u, 30 * num_menu_buttons++ + 160,  140u, 30u, 1, 0, 0xAFu, 0x13u,  0, "",  0);
+            pDialogueWindow->CreateButton(  480u, 30 * num_menu_buttons++ + 160,  140u, 30u, 1, 0, UIMSG_ClickNPCTopic, 0x13u,  0, "",  0);
         }
       }
       if ( v17->evt_B )
@@ -7949,7 +7948,7 @@
         {
           v8 = NPC_EventProcessor(v17->evt_B);
           if ( v8 == 1 || v8 == 2 )
-            pDialogueWindow->CreateButton( 480u,  30 * num_menu_buttons++ + 160,  140u, 30u,  1, 0,  0xAFu,  0x14u,  0, "",  0);
+            pDialogueWindow->CreateButton( 480u,  30 * num_menu_buttons++ + 160,  140u, 30u,  1, 0,  UIMSG_ClickNPCTopic,  0x14u,  0, "",  0);
         }
       }
       if ( v17->evt_C )
@@ -7958,7 +7957,7 @@
         {
           v10 = NPC_EventProcessor(v17->evt_C);
           if ( v10 == 1 || v10 == 2 )
-            pDialogueWindow->CreateButton(  480u,  30 * num_menu_buttons++ + 160,  140u, 30u,  1,  0, 0xAFu, 0x15u, 0, "",  0);
+            pDialogueWindow->CreateButton(  480u,  30 * num_menu_buttons++ + 160,  140u, 30u,  1,  0, UIMSG_ClickNPCTopic, 0x15u, 0, "",  0);
         }
       }
  
@@ -7968,7 +7967,7 @@
         {
           v12 = NPC_EventProcessor(v17->evt_D);
           if ( v12 == 1 || v12 == 2 )
-            pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160,  0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x16u,  0, "",  0);
+            pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160,  0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x16u,  0, "",  0);
         }
       }
       if ( v17->evt_E )
@@ -7977,7 +7976,7 @@
         {
           v14 = NPC_EventProcessor(v17->evt_E);
           if ( v14 == 1 || v14 == 2 )
-            pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160,  0x8Cu,  0x1Eu,  1,  0,  0xAFu, 0x17u,  0, "",  0);
+            pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160,  0x8Cu,  0x1Eu,  1,  0,  UIMSG_ClickNPCTopic, 0x17u,  0, "",  0);
         }
       }
       if ( v17->evt_F )
@@ -7986,7 +7985,7 @@
         {
           v16 = NPC_EventProcessor(v17->evt_F);
           if ( v16 == 1 || v16 == 2 )
-            pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160,  0x8Cu,  0x1Eu, 1, 0, 0xAFu, 0x18u, 0, "",  0);
+            pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160,  0x8Cu,  0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "",  0);
         }
       }
       pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2);
@@ -8481,7 +8480,7 @@
     goto LABEL_40;
   do
   {
-    v11 = v8->GetControl(v35)->uControlParam - 36;
+    v11 = v8->GetControl(v35)->msg_param - 36;
     if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] )
     {
       v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
@@ -8517,7 +8516,7 @@
     do
     {
       v14 = v8->GetControl(v35);
-      v15 = v14->uControlParam - 36;
+      v15 = v14->msg_param - 36;
       if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] )
       {
         v16 = 0;
--- a/mm7_5.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/mm7_5.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -5,7 +5,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -554,54 +553,56 @@
           uTextureID_ControlBG[22] = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
           uTextureID_ControlBG[21] = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE);
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0);
-          pGUIWindow_CurrentMenu->CreateButton(0x16u, 0x10Eu,
-            (uTextureID_ControlBG[3] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[3]].uTextureWidth : 24),
-            (uTextureID_ControlBG[3] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[3]].uTextureHeight : 26),
-            v0, 0, 0xB8u, 0x80u, 0, v1, 0);
-          pGUIWindow_CurrentMenu->CreateButton(0x5Du, 0x10Eu,
-            (uTextureID_ControlBG[2] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[2]].uTextureWidth : 24),
-            (uTextureID_ControlBG[2] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[2]].uTextureHeight : 26),
-            v0, 0, 0xB8u, 0x40u, 0, v1, 0);
-          pGUIWindow_CurrentMenu->CreateButton(0xA4u, 0x10Eu,
-            (uTextureID_ControlBG[1] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[1]].uTextureWidth : 24),
-            (uTextureID_ControlBG[1] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[1]].uTextureHeight : 26),
-            v0, 0, 0xB8u, 0, 0, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(22, 270,
+                                               pIcons_LOD->GetTexture(uTextureID_ControlBG[3])->uTextureWidth,
+                                               pIcons_LOD->GetTexture(uTextureID_ControlBG[3])->uTextureHeight,
+                                               v0, 0,
+                                               UIMSG_SetTurnSpeed, 0x80,
+                                               0, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(0x5Du, 270,
+                                               pIcons_LOD->GetTexture(uTextureID_ControlBG[2])->uTextureWidth,
+                                               pIcons_LOD->GetTexture(uTextureID_ControlBG[2])->uTextureHeight,
+                                               v0, 0, UIMSG_SetTurnSpeed, 0x40u, 0, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(0xA4u, 270,
+                                               pIcons_LOD->GetTexture(uTextureID_ControlBG[1])->uTextureWidth,
+                                               pIcons_LOD->GetTexture(uTextureID_ControlBG[1])->uTextureHeight,
+                                               v0, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x12Fu,
-            (uTextureID_ControlBG[21] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[21]].uTextureWidth : 24),
-            (uTextureID_ControlBG[21] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[21]].uTextureHeight : 26),
-            v0, 0, 0xB9u, 0, 0, v1, 0);
+                                               pIcons_LOD->GetTexture(uTextureID_ControlBG[21])->uTextureWidth,
+                                               pIcons_LOD->GetTexture(uTextureID_ControlBG[21])->uTextureHeight,
+                                               v0, 0, UIMSG_ToggleWalkSound, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x12Fu,
             (uTextureID_ControlBG[22] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[22]].uTextureWidth : 24),
             (uTextureID_ControlBG[22] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[22]].uTextureHeight : 26),
-            v0, 0, 0xBBu, 0, 0, v1, 0);
+            v0, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x145u,
             (uTextureID_ControlBG[20] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[20]].uTextureWidth : 24),
             (uTextureID_ControlBG[20] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[20]].uTextureHeight : 26),
-            v0, 0, 0xE1u, 0, 0, v1, 0);
+            v0, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x145u,
             (uTextureID_ControlBG[9] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[9]].uTextureWidth : 24),
             (uTextureID_ControlBG[9] != -1 ? pIcons_LOD->pTextures[uTextureID_ControlBG[9]].uTextureHeight : 26),
-            v0, 0, 0xE2u, 0, 0, v1, 0);
-          pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, v0, 0, 111, 4, 0, v1,
+            v0, 0, UIMSG_ToggleFlipOnExit, 0, 0, v1, 0);
+          pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, v0, 0, UIMSG_ChangeSoundVolume, 4, 0, v1,
                          &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0);
-          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xA2u, 0x10u, 0x10u, v0, 0, 0x6Fu, 5, 0, v1,
+          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xA2u, 0x10u, 0x10u, v0, 0, UIMSG_ChangeSoundVolume, 5, 0, v1,
                          &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0);
-          pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xA2u, 0xACu, 0x11u, v0, 0, 0x6Fu, 0, 0, v1, 0);
-          pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0xD8u, 0x10u, 0x10u, v0, 0, 0x70u, 4, 0, v1,
+          pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xA2u, 0xACu, 0x11u, v0, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0);
+          pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0xD8u, 0x10u, 0x10u, v0, 0, UIMSG_ChangeMusicVolume, 4, 0, v1,
                          &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0);
-          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xD8u, 0x10u, 0x10u, v0, 0, 0x70u, 5, 0, v1,
+          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xD8u, 0x10u, 0x10u, v0, 0, UIMSG_ChangeMusicVolume, 5, 0, v1,
                          &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0);
-          pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xD8u, 0xACu, 0x11u, v0, 0, 0x70u, 0, 0, v1, 0);
-          pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0x10Eu, 0x10u, 0x10u, v0, 0, 0xBAu, 4, 0, v1,
+          pGUIWindow_CurrentMenu->CreateButton(0x107u, 0xD8u, 0xACu, 0x11u, v0, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0);
+          pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0xF3u, 0x10Eu, 0x10u, 0x10u, v0, 0, UIMSG_ChangeVoiceVolume, 4, 0, v1,
                          &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0);
-          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0x10Eu, 0x10u, 0x10u, v0, 0, 0xBAu, 5u, 0, v1,
+          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0x10Eu, 0x10u, 0x10u, v0, 0, UIMSG_ChangeVoiceVolume, 5u, 0, v1,
                          &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0);
-          pGUIWindow_CurrentMenu->CreateButton(0x107u, 0x10Eu, 0xACu, 0x11u, v0, 0, 0xBAu, 0, 0, v1, 0);
-          pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, 0x71u, 0, 0,
+          pGUIWindow_CurrentMenu->CreateButton(0x107u, 0x10Eu, 0xACu, 0x11u, v0, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, UIMSG_Escape, 0, 0,
             pGlobalTXT_LocalizationStrings[619],// "Return to Game"
             0);
-          pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x8Cu, 0xD6u, 0x28u, v0, 0, 0x19Fu, 0, 0x4Bu, v1, 0);
-          pGUIWindow_CurrentMenu->CreateButton(19, 194, 214, 40, v0, 0, 421, 0, 86, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x8Cu, 0xD6u, 0x28u, v0, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(19, 194, 214, 40, v0, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0);
           continue;
         case UIMSG_OpenKeyMappingOptions://Open
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -615,25 +616,25 @@
           uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE);
           uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE);
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0);
-          pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, 0x71u, 0, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A0u, 0, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A1u, 0, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, 0x1A2u, 0, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, 0x7Fu, 0, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, 0x1A3u, 0, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, 0x1A3u, 1u, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, 0x1A3u, 2u, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, 0x1A3u, 3u, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, 0x1A3u, 4u, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, 0x1A3u, 5u, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 6u, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, 0x1A3u, 7u, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, 0x1A3u, 8u, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, 0x1A3u, 9u, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, 0x1A3u, 0xAu, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, 0x1A3u, 0xBu, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, 0x1A3u, 0xCu, 0, "", 0);
-          pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 0xDu, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 1u, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 2u, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 3u, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, UIMSG_ChangeKeyButton, 4u, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 5u, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 6u, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 7u, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 8u, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0);
+          pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0);
           dword_506E68 = -1;
           KeyboardPageNum = 1;
           memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray));
@@ -716,23 +717,21 @@
           uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE);
           uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE);
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0);
-          pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, 0x71u, 0, 0, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, UIMSG_Escape, 0, 0, v1, 0);
           if ( pRenderer->pRenderD3D )
           {
-            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, v0, 0, 0x1A6u, 0, 0, v1, 0);
-            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, v0, 0, 0x1A7u, 0, 0, v1, 0);
-            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, v0, 0, 0x1A8u, 0, 0, v1, 0);
+            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleBloodsplats, 0, 0, v1, 0);
+            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleColoredLights, 0, 0, v1, 0);
+            pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleTint, 0, 0, v1, 0);
           }
           if ( !pRenderer->bWindowMode )
           {
             v0 = 1;
             if ( GammaController::IsGammaSupported() )
             {
-              pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, 0x1A9u, 4u, 0, v1,
-                             &pIcons_LOD->pTextures[uTextureID_507C20], 0);
-              pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, 0x1A9u, 5u, 0, v1,
-                             &pIcons_LOD->pTextures[uTextureID_507C24], 0);
-              pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, 425, 0, 0, v1, 0);
+              pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C20), 0);
+              pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C24), 0);
+              pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, v1, 0);
             }
           }
           continue;
@@ -1496,22 +1495,22 @@
               uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE);
               uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
               uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE);
-              pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, v0, 0, 0x7Cu, 0, 0x4Eu,
+              pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, v0, 0, UIMSG_StartNewGame, 0, 0x4Eu,
                              pGlobalTXT_LocalizationStrings[614],// "New Game"
                              pIcons_LOD->GetTexture(uTextureID_New1), 0);
-              pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, v0, 0, 0x7Eu, 0, 0x53u,
+              pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, v0, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u,
                              pGlobalTXT_LocalizationStrings[615],// "Save Game"
                              pIcons_LOD->GetTexture(uTextureID_Save1), 0);
-              pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, v0, 0, 0x7Du, 0, 0x4Cu,
+              pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, v0, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu,
                              pGlobalTXT_LocalizationStrings[616],// "Load Game"
                              pIcons_LOD->GetTexture(uTextureID_Load1), 0);
-              pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, v0, 0, 0x7Fu, 0, 0x43u,
+              pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, v0, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u,
                              pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:""
                              pIcons_LOD->GetTexture(uTextureID_Controls1), 0);
-              pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, v0, 0, 0x84u, 0, 0x51u,
+              pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, v0, 0, UIMSG_Quit, 0, 0x51u,
                              pGlobalTXT_LocalizationStrings[618],// "Quit"
                              pIcons_LOD->GetTexture(uTextureID_Quit1), 0);
-              pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, v0, 0, 0x7Bu, 0, 0x52u,
+              pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, v0, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u,
                              pGlobalTXT_LocalizationStrings[619],// "Return to Game"
                              pIcons_LOD->GetTexture(uTextureID_Resume1), 0);
               pGUIWindow_CurrentMenu->_41D08F(6, v0, 0, 0);
@@ -2845,7 +2844,7 @@
           v130 = 0;
           v127 = rand() % 2 + 204;
           goto _play_sound_and_continue;
-        case UIMSG_57:
+        case UIMSG_OpenSpellbookPage:
           if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage )
             continue;
           sub_41140B();
@@ -2982,7 +2981,7 @@
           pCurrentScreen = SCREEN_QUICK_REFERENCE;
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0);
           papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE);
-          pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, v0, 0, 0x71u, 0, 0,
+          pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, v0, 0, UIMSG_Escape, 0, 0,
                          pGlobalTXT_LocalizationStrings[79],// "Exit"
                          (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); //, v179);
           continue;
@@ -3044,10 +3043,10 @@
             v123 = 300;
             v121 = 600;
           }
-          pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, v0, 0, 0x55u, 0, 0,
+          pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, v0, 0, UIMSG_MainMenu_ShowLoadWindow, 0, 0,
                          pGlobalTXT_LocalizationStrings[64],// "Detail Toggle"
                          0);
-          pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, v0, 0, 0x85u, 0, 0, v1, 0);
+          pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, v0, 0, UIMSG_85, 0, 0, v1, 0);
           goto LABEL_422;
         case UIMSG_85:
           OnPaperdollLeftClick();
@@ -11593,7 +11592,7 @@
         pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
       }
       //v11 = i->uControlParam;
-      pMessageQueue_50CBD0->AddMessage((UIMessageType)i->uControlID, i->uControlParam, 0);
+      pMessageQueue_50CBD0->AddMessage(i->msg, i->msg_param, 0);
       return;
     }
     goto LABEL_45;
@@ -11842,7 +11841,7 @@
     dword_507CBC = 1;
     for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )
     {
-      if ( i->uControlID == 120 )
+      if ( i->msg == UIMSG_InventoryLeftClick )
       {
         dword_50698C = i->uX;
         dword_506988 = i->uY;
@@ -11861,8 +11860,7 @@
                    (uTextureID_ar_up_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_up_up].uTextureHeight : 26),
                    1,
                    0,
-                   0xA9u,
-                   0,
+                   UIMSG_A9, 0,
                    0,
                    "",
                    (Texture *)(uTextureID_ar_up_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_up] : 0),
@@ -11875,8 +11873,7 @@
                    (uTextureID_ar_dn_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_dn_up].uTextureHeight : 26),
                    1,
                    0,
-                   0xAAu,
-                   0,
+                   UIMSG_AA, 0,
                    0,
                    "",
                    (Texture *)(uTextureID_ar_dn_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_up] : 0),
@@ -11889,8 +11886,7 @@
                    0xE8u,
                    1,
                    0,
-                   0xC0u,
-                   0,
+                   UIMSG_C0, 0,
                    0,
                    "",
                    0);
@@ -11914,7 +11910,7 @@
     pBtn_Up = 0;
     for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )
     {
-      if ( i->uControlID == 120 )
+      if ( i->msg == UIMSG_InventoryLeftClick )
       {
         i->uX = dword_50698C;
         i->uY = dword_506988;
--- a/mm7_6.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/mm7_6.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -4,7 +4,6 @@
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
-#include "GUIButton.h"
 #include "GUIProgressBar.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -2094,19 +2093,19 @@
   unsigned int v14; // eax@23
   //stru277 *v15; // esi@27
   //stru277 *v16; // eax@28
-  GUIWindow *v17; // eax@43
-  GUIWindow *v18; // [sp-30h] [bp-48h]@44
-  unsigned int v19; // [sp-2Ch] [bp-44h]@44
-  unsigned int v20; // [sp-28h] [bp-40h]@44
-  unsigned int v21; // [sp-24h] [bp-3Ch]@44
-  unsigned int v22; // [sp-20h] [bp-38h]@44
-  int v23; // [sp-1Ch] [bp-34h]@44
-  int v24; // [sp-18h] [bp-30h]@44
-  unsigned int v25; // [sp-14h] [bp-2Ch]@43
-  unsigned int v26; // [sp-10h] [bp-28h]@43
-  unsigned __int8 v27; // [sp-Ch] [bp-24h]@43
-  char *v28; // [sp-8h] [bp-20h]@43
-  Texture *v29; // [sp-4h] [bp-1Ch]@43
+  //GUIWindow *v17; // eax@43
+  //GUIWindow *v18; // [sp-30h] [bp-48h]@44
+  //unsigned int v19; // [sp-2Ch] [bp-44h]@44
+  //unsigned int v20; // [sp-28h] [bp-40h]@44
+  //unsigned int v21; // [sp-24h] [bp-3Ch]@44
+  //unsigned int v22; // [sp-20h] [bp-38h]@44
+  //int v23; // [sp-1Ch] [bp-34h]@44
+  //int v24; // [sp-18h] [bp-30h]@44
+  //unsigned int v25; // [sp-14h] [bp-2Ch]@43
+  //unsigned int v26; // [sp-10h] [bp-28h]@43
+  //unsigned __int8 v27; // [sp-Ch] [bp-24h]@43
+  //char *v28; // [sp-8h] [bp-20h]@43
+  //Texture *v29; // [sp-4h] [bp-1Ch]@43
   //__int16 a3a; // [sp+10h] [bp-8h]@1
   //__int16 a2a; // [sp+14h] [bp-4h]@1
 
@@ -2288,10 +2287,10 @@
         if ( pGUIWindow_Settings )
           return;
         pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0);
-        pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 0, 0x31u, "", 0);
-        pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 1u, 0x32u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 2u, 0x33u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 3u, 0x34u, "", 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);
         sub_421B2C_PlaceInInventory_or_DropPickedItem();
         return;
       }
@@ -2299,23 +2298,9 @@
       {
         if ( pGUIWindow_Settings )
           return;
-        v17 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0);
-        v29 = 0;
-        v28 = "";
-        v27 = 0;
-        v26 = 0;
-        v25 = 70;
-LABEL_44:
-        v24 = 0;
-        v23 = 1;
-        v22 = 344;
-        v21 = game_viewport_width;
-        v20 = 8;
-        v19 = 8;
-        pGUIWindow_Settings = v17;
-        v18 = v17;
-LABEL_56:
-        v18->CreateButton(v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29);
+
+        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0);
+        pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_46, 0, 0, "", 0);
         sub_421B2C_PlaceInInventory_or_DropPickedItem();
         return;
       }
@@ -2323,13 +2308,11 @@
       {
         if ( pGUIWindow_Settings )
           return;
-        v17 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0);
-        v29 = 0;
-        v28 = "";
-        v27 = 0;
-        v26 = 0;
-        v25 = 190;
-        goto LABEL_44;
+
+        pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0);
+        pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_BE, 0, 0, "", 0);
+        sub_421B2C_PlaceInInventory_or_DropPickedItem();
+        return;
       }
       if ( (char)a5 < 0 )
       {
@@ -2349,44 +2332,36 @@
         if ( pGUIWindow_Settings )
           return;
         pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0);
-        pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 0, 0x31u, "", 0);
-        pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 1u, 0x32u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 2u, 0x33u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 3u, 0x34u, "", 0);
-		pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, 344, 1, 0, 140, 0, 0, "", NULL);
+        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();
       }
       if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings )
       {
         pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0);
-        pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(
-                       0x1D5u,
-                       0xB2u,
-                       (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureWidth : 24),
-                       (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureHeight : 26),
+        pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178,
+                       pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth,
+                       pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight,
                        1,
                        0,
-                       0xBCu,
-                       0,
+                       UIMSG_ScrollNPCPanel, 0,
                        0,
                        "",
-                       (Texture *)(uTextureID_Btn_NPCLeft != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft] : 0),
-                       0);
-        pBtn_NPCRight = pGUIWindow_Settings->CreateButton(
-                       0x272u,
-                       0xB2u,
-                       (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureWidth : 24),
-                       (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureHeight : 26),
+                       pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft), 0);
+        pBtn_NPCRight = pGUIWindow_Settings->CreateButton(626, 178,
+                       pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureWidth,
+                       pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight,
                        1,
                        0,
-                       0xBCu,
-                       1u,
+                       UIMSG_ScrollNPCPanel, 1,
                        0,
                        "",
-                       (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0),
-                       0);
-        pGUIWindow_Settings->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, 0x8Fu, 4u, 0x35u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x8Fu, 5u, 0x36u, "", 0);
+                       pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0);
+        pGUIWindow_Settings->CreateButton(0x1EBu, 149, 64, 74, 1, 0, UIMSG_8F, 4, 0x35u, "", 0);
+        pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_8F, 5, 0x36u, "", 0);
       }
     }
 }
@@ -8536,7 +8511,7 @@
 void __cdecl ProcessInputActions()
 {
   ActionQueue *pActionQueue; // esi@7
-  Keyboard *v3; // ecx@8
+  //Keyboard *v3; // ecx@8
   char v4; // al@9
   ActionQueue *v5; // ecx@19
   Player *v6; // ecx@86
@@ -8584,12 +8559,11 @@
     pActionQueue = pPartyActionQueue;
     while ( 1 )
     {
-      v3 = pGame->pKeyboardInstance;
       v17 = pKeyActionMap->pVirtualKeyCodesMapping[inputAction];
       if ( pKeyActionMap->pToggleTypes[inputAction] )
-        v4 = v3->WasKeyPressed(v17);
+        v4 = pKeyboard->WasKeyPressed(v17);
       else
-        v4 = v3->IsKeyBeingHeld(v17);
+        v4 = pKeyboard->IsKeyBeingHeld(v17);
       if ( v4 )
       {
         switch ( inputAction )