changeset 371:d1d1e1daa7f7

Merge
author Nomad
date Fri, 22 Feb 2013 17:48:00 +0200
parents 7f817679b60e (current diff) 6e984a4a896f (diff)
children 6a2b4d1be013
files GUIWindow.h mm7_5.cpp
diffstat 7 files changed, 141 insertions(+), 369 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.h	Fri Feb 22 17:47:41 2013 +0200
+++ b/GUIWindow.h	Fri Feb 22 17:48:00 2013 +0200
@@ -226,7 +226,7 @@
   UIMSG_InventoryLeftClick = 0x78,
   UIMSG_SkillUp = 0x79,
   UIMSG_7A = 0x7A,
-  UIMSG_7B = 0x7B,
+  UIMSG_GameMenu_ReturnToGame = 0x7B,
   UIMSG_StartNewGame = 0x7C,
   UIMSG_Game_OpenLoadGameDialog = 0x7D,
   UIMSG_Game_OpenSaveGameDialog = 0x7E,
--- a/Player.cpp	Fri Feb 22 17:47:41 2013 +0200
+++ b/Player.cpp	Fri Feb 22 17:48:00 2013 +0200
@@ -1909,7 +1909,6 @@
   return result;
 }
 
-
 //----- (0049107D) --------------------------------------------------------
 int Player::GetBodybuilding()
 {
--- a/Texture.cpp	Fri Feb 22 17:47:41 2013 +0200
+++ b/Texture.cpp	Fri Feb 22 17:48:00 2013 +0200
@@ -169,12 +169,7 @@
 Texture *pTexture_RestUI_CurrentHourglassFrame; // idb
 
 
-unsigned int uTextureID_Optkb; // weak
-unsigned int uTextureID_Optkb_h; // weak
-unsigned int uTextureID_KeyResume1; // weak
-unsigned int uTextureID_Optkb_1; // weak
-unsigned int uTextureID_Optkb_2; // weak
-
+unsigned int uTextureID_Optkb[5];
 
 unsigned int uTextureID_507C10; // weak
 unsigned int uTextureID_507C14; // weak
@@ -186,15 +181,15 @@
 unsigned int uTextureID_507C50; // weak
 unsigned int uTextureID_507C54; // weak
 unsigned int uTextureID_507C58; // weak
-unsigned int uTextureID_ControlBG; // weak
-unsigned int uTextureID_Con_Smoo[3]; // weak
-unsigned int uTextureID_Con_ArrL; // weak
-unsigned int uTextureID_Con_ArrR; // weak
-unsigned int uTextureID_Option04; // weak
-unsigned int pTextureIDs_SoundLevels[10];
-unsigned int uTextureID_Option03; // weak
-unsigned int uTextureID_Option01;
-unsigned int uTextureID_Option02; // weak
+unsigned int uTextureID_ControlBG[23];
+//unsigned int uTextureID_Con_Smoo[3]; // weak
+//unsigned int uTextureID_Con_ArrL; // weak
+//unsigned int uTextureID_Con_ArrR; // weak
+//unsigned int uTextureID_Option04; // weak
+//unsigned int pTextureIDs_SoundLevels[10];
+//unsigned int uTextureID_Option03; // weak
+//unsigned int uTextureID_Option01;
+//unsigned int uTextureID_Option02; // weak
 
 
 unsigned int uTextureID_5118C8; // weak
--- a/Texture.h	Fri Feb 22 17:47:41 2013 +0200
+++ b/Texture.h	Fri Feb 22 17:48:00 2013 +0200
@@ -271,12 +271,7 @@
 extern Texture *pTexture_RestUI_CurrentHourglassFrame; // idb
 
 
-extern unsigned int uTextureID_Optkb; // weak
-extern unsigned int uTextureID_Optkb_h; // weak
-extern unsigned int uTextureID_KeyResume1; // weak
-extern unsigned int uTextureID_Optkb_1; // weak
-extern unsigned int uTextureID_Optkb_2; // weak
-
+extern unsigned int uTextureID_Optkb[5];
 
 extern unsigned int uTextureID_507C10; // weak
 extern unsigned int uTextureID_507C14; // weak
@@ -288,15 +283,15 @@
 extern unsigned int uTextureID_507C50; // weak
 extern unsigned int uTextureID_507C54; // weak
 extern unsigned int uTextureID_507C58; // weak
-extern unsigned int uTextureID_ControlBG; // weak
-extern unsigned int uTextureID_Con_Smoo[3]; // weak
-extern unsigned int uTextureID_Con_ArrL; // weak
-extern unsigned int uTextureID_Con_ArrR; // weak
-extern unsigned int uTextureID_Option04; // weak
-extern unsigned int pTextureIDs_SoundLevels[10];
-extern unsigned int uTextureID_Option03; // weak
-extern unsigned int uTextureID_Option01;
-extern unsigned int uTextureID_Option02; // weak
+extern unsigned int uTextureID_ControlBG[23]; // weak
+//extern unsigned int uTextureID_Con_Smoo[3]; // weak
+//extern unsigned int uTextureID_Con_ArrL; // weak
+//extern unsigned int uTextureID_Con_ArrR; // weak
+//extern unsigned int uTextureID_Option04; // weak
+//extern unsigned int pTextureIDs_SoundLevels[10];
+//extern unsigned int uTextureID_Option03; // weak
+//extern unsigned int uTextureID_Option01;
+//extern unsigned int uTextureID_Option02; // weak
 
 
 extern unsigned int uTextureID_5118C8; // weak
--- a/mm7_5.cpp	Fri Feb 22 17:47:41 2013 +0200
+++ b/mm7_5.cpp	Fri Feb 22 17:48:00 2013 +0200
@@ -386,7 +386,6 @@
               memset(&actor, 0, 0x344u);
               actor.uNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx;
               pActor = &actor;
-//_actor_init_dlg:
               pActor->InitializeDialogue(v0);
             }
           }
@@ -415,7 +414,6 @@
               pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
             pGUIWindow_CurrentMenu->Release();
             uGameState = 4;
-LABEL_188:
             pCurrentScreen = SCREEN_GAME;
             viewparams->bRedrawGameUI = v0;
           }
@@ -425,7 +423,6 @@
             pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0);
             dword_6BE138 = 124;
           }
-//_release_tex_and_continue:
           stru_506E40.Release();
           continue;
         case UIMSG_Game_OpenLoadGameDialog:
@@ -453,11 +450,10 @@
           }
           else
           {
-            ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2u);// "Are you sure?  Click again to quit"
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure?  Click again to quit"
             pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0);
             dword_6BE138 = 132;
           }
-          //goto _release_tex_and_continue;
           stru_506E40.Release();
           continue;
         case UIMSG_80:
@@ -465,63 +461,25 @@
           pIcons_LOD->_4114F2();
           pGUIWindow_CurrentMenu->Release();
           pCurrentScreen = SCREEN_OPTIONS;
-          v162 = 0;
-          v148 = 0;
-          pWindowType = (WindowType)8;
-          //goto LABEL_439;
-          pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, pWindowType, v148, v162);
+          pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (WindowType)8, 0, 0);
           continue;
         case UIMSG_ArrowUp:
           --pSaveListPosition;
           if ( pSaveListPosition < 0 )
             pSaveListPosition = 0;
-          v163 = 0;
-          v8 = 199;
-          pButton2 = pBtnArrowUp;
-          //goto LABEL_60;
-          pWindowType1 = (WindowType)90;
-          v137 = 17;
-          v133 = 17;
-          v9 = 215;
-          //goto LABEL_733;
-          GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163);
+          GUIWindow::Create(215, 199, 17, 17, (WindowType)90, (int)pBtnArrowUp, 0);
           continue;
         case UIMSG_DownArrow:
           ++pSaveListPosition;
           if ( pSaveListPosition >= uMessageParam )
             pSaveListPosition = uMessageParam - 1;
-          v163 = 0;
-          v8 = 323;
-          pButton2 = pBtnDownArrow;
-//LABEL_60:
-          pWindowType1 = (WindowType)90;
-          v137 = 17;
-          v133 = 17;
-          v9 = 215;
-          //goto LABEL_733;
-          GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163);
+          GUIWindow::Create(215, 323, 17, 17, (WindowType)90, (int)pBtnDownArrow, 0);
           continue;
         case UIMSG_Cancel:
-          v163 = 0;
-          v8 = 302;
-          pButton2 = pBtnCancel;
-          v9 = 350;
-          pWindowType1 = (WindowType)96;
-          v137 = 42;
-          v133 = 106;
-          //goto LABEL_733;
-          GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163);
+          GUIWindow::Create(350, 302, 106, 42, (WindowType)96, (int)pBtnCancel, 0);
           continue;
         case UIMSG_LoadSlot:
-          v163 = 0;
-          v8 = 302;
-          pButton2 = pBtnLoadSlot;
-          v9 = 241;
-          pWindowType1 = (WindowType)94;
-          v137 = 42;
-          v133 = 106;
-          //goto LABEL_733;
-          GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163);
+          GUIWindow::Create(241, 302, 106, 42, (WindowType)94, (int)pBtnLoadSlot, 0);
           continue;
         case UIMSG_SelectLoadSlot:
           if ( pGUIWindow_CurrentMenu->field_40 == v0 )
@@ -566,19 +524,15 @@
             LoadGame(uLoadGameUI_SelectedSlot);
             uGameState = 3;
           }
-          //goto _release_tex_and_continue;
           stru_506E40.Release();
           continue;
         case UIMSG_SaveGame:
           if ( pGUIWindow_CurrentMenu->field_40 == v0 )
           {
             pKeyActionMap->_459ED1(0);
-            strcpy(
-              (char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot,
-              (const char *)pKeyActionMap->pPressedKeysBuffer);
+            strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer);
           }
           DoSavegame(uLoadGameUI_SelectedSlot);
-          //goto _release_tex_and_continue;
           stru_506E40.Release();
           continue;
         case UIMSG_Game_OpenSaveGameDialog:
@@ -586,75 +540,75 @@
           pCurrentScreen = SCREEN_SAVEGAME;
           GameUI_DrawSaveMenu();
           continue;
-        case UIMSG_Game_OpenOptionsDialog:
+        case UIMSG_Game_OpenOptionsDialog://Open
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           pGUIWindow_CurrentMenu->Release();
           viewparams->field_48 = v0;
           pCurrentScreen = SCREEN_OPTIONS;
-          uTextureID_ControlBG = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE);
-          uTextureID_Con_Smoo[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE);
-          uTextureID_Con_Smoo[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE);
-          uTextureID_Con_ArrL = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
-          uTextureID_Con_ArrR = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
-          uTextureID_Con_Smoo[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE);
-          pTextureIDs_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
-          pTextureIDs_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE);
-          pTextureIDs_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE);
-          pTextureIDs_SoundLevels[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE);
-          pTextureIDs_SoundLevels[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE);
-          pTextureIDs_SoundLevels[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE);
-          pTextureIDs_SoundLevels[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE);
-          pTextureIDs_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE);
-          pTextureIDs_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE);
-          pTextureIDs_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE);
-          uTextureID_Option04 = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE);
-          uTextureID_Option03 = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE);
-          uTextureID_Option02 = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
-          uTextureID_Option01 = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[0] = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[3] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[2] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[4] = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[5] = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[1] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[19] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[10] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[11] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[12] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[13] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[14] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[15] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[16] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[17] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[18] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[9] = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE);
+          uTextureID_ControlBG[20] = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE);
+          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_Con_Smoo[2] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[2]].uTextureWidth : 24),
-            (uTextureID_Con_Smoo[2] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[2]].uTextureHeight : 26),
+            (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_Con_Smoo[1] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[1]].uTextureWidth : 24),
-            (uTextureID_Con_Smoo[1] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[1]].uTextureHeight : 26),
+            (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_Con_Smoo[0] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[0]].uTextureWidth : 24),
-            (uTextureID_Con_Smoo[0] != -1 ? pIcons_LOD->pTextures[uTextureID_Con_Smoo[0]].uTextureHeight : 26),
+            (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(0x14u, 0x12Fu,
-            (uTextureID_Option01 != -1 ? pIcons_LOD->pTextures[uTextureID_Option01].uTextureWidth : 24),
-            (uTextureID_Option01 != -1 ? pIcons_LOD->pTextures[uTextureID_Option01].uTextureHeight : 26),
+            (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);
           pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x12Fu,
-            (uTextureID_Option02 != -1 ? pIcons_LOD->pTextures[uTextureID_Option02].uTextureWidth : 24),
-            (uTextureID_Option02 != -1 ? pIcons_LOD->pTextures[uTextureID_Option02].uTextureHeight : 26),
+            (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);
           pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x145u,
-            (uTextureID_Option03 != -1 ? pIcons_LOD->pTextures[uTextureID_Option03].uTextureWidth : 24),
-            (uTextureID_Option03 != -1 ? pIcons_LOD->pTextures[uTextureID_Option03].uTextureHeight : 26),
+            (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);
           pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x145u,
-            (uTextureID_Option04 != -1 ? pIcons_LOD->pTextures[uTextureID_Option04].uTextureWidth : 24),
-            (uTextureID_Option04 != -1 ? pIcons_LOD->pTextures[uTextureID_Option04].uTextureHeight : 26),
+            (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,
-                         &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0);
+                         &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0);
           pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xA2u, 0x10u, 0x10u, v0, 0, 0x6Fu, 5, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 0);
+                         &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,
-                         &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0);
+                         &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0);
           pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xD8u, 0x10u, 0x10u, v0, 0, 0x70u, 5, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 0);
+                         &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,
-                         &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0);
+                         &pIcons_LOD->pTextures[uTextureID_ControlBG[4]], 0);
           pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0x10Eu, 0x10u, 0x10u, v0, 0, 0xBAu, 5u, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 0);
+                         &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,
             pGlobalTXT_LocalizationStrings[619],// "Return to Game"
@@ -662,17 +616,17 @@
           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);
           continue;
-        case UIMSG_OpenKeyMappingOptions:
+        case UIMSG_OpenKeyMappingOptions://Open
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           pGUIWindow_CurrentMenu->Release();
           viewparams->field_48 = 1;
           pCurrentScreen = SCREEN_KEYBOARD_OPTIONS;
-          uTextureID_Optkb = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE);
-          uTextureID_Optkb_h = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE);
-          uTextureID_KeyResume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
-          uTextureID_Optkb_1 = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE);
-          uTextureID_Optkb_2 = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE);
+          uTextureID_Optkb[0] = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE);
+          uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE);
+          uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
+          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);
@@ -695,15 +649,12 @@
           pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 0xDu, 0, "", 0);
           dword_506E68 = -1;
           KeyboardPageNum = 1;
-          memset(word_506E6C, 0, 0x1Cu);
-          word_506E6C[14] = 0;
+          memset(KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray));
+          //*(_WORD *)KeyButtonArray[28] = 0;
           memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
-          //goto LABEL_90;
           v1 = "";
           v0 = 1;
           continue;
-        //default:
-          //continue;
         case UIMSG_ChangeKeyButton:
           if ( dword_506E68 != -1 )
           {
@@ -741,18 +692,11 @@
             v18 = uAction++;
             v13 = uAction > 28;
             v12 = uAction - 28 < 0;
-            *((char *)word_506E6C + v18) = 0;
+            KeyButtonFlagChangesArray[v18] = 0;
           }
           while ( v12 ^ v13 );
-          v165 = 0;
-          v151 = 0;
-          v144 = 0;
-          v139 = 0;
-          v135 = -1;
-          v132 = 0;
-          v130 = 0;
-          v127 = 219;
-          goto _play_sound_and_continue;
+          pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0);
+          continue;
         case UIMSG_SelectKeyPage1:
           KeyboardPageNum = v0;
           continue;
@@ -801,19 +745,7 @@
                              &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);
-              pTexture = 0;
-              v150 = v1;
-              v143 = 0;
-              v138 = 0;
-              v134 = 425;
-              v131 = 0;
-              v129 = 1;
-              v126 = 18;
-              v124 = 170;
-              v122 = 162;
-              v120 = 42;
-//LABEL_117:
-              pGUIWindow_CurrentMenu->CreateButton(v120, v122, v124, v126, v129, v131, v134, v138, v143, v150, pTexture);
+              pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, 425, 0, 0, v1, 0);
             }
           }
           continue;
@@ -824,37 +756,14 @@
             if ( (uGammaPos -- -1) < 0 )
             {
               uGammaPos = 0;
-              //goto LABEL_128;
-              v165 = 0;
-              v151 = 0;
-              v144 = 0;
-              v139 = 0;
-              v135 = -1;
-              v132 = 0;
-              v130 = 0;
-              v127 = 21;
-              goto _play_sound_and_continue;
+              pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0);
+              continue;
             }
             v19 = (double)(signed int)uGammaPos * 0.1 + 0.6;
             pGame->pGammaController->Initialize(v19);
-            v166 = v0;
-            v152 = (int)pBtn_SliderLeft;
-            pWindowType2 = (WindowType)90;
-            v140 = 0;
-            v136 = 0;
-            v20 = 21;
-            //goto LABEL_122;
-            GUIWindow::Create(v20, 0xA1u, v136, v140, pWindowType2, v152, v166);
-            //goto LABEL_128;
-            v165 = 0;
-            v151 = 0;
-            v144 = 0;
-            v139 = 0;
-            v135 = -1;
-            v132 = 0;
-            v130 = 0;
-            v127 = 21;
-            goto _play_sound_and_continue;
+            GUIWindow::Create(21, 161, 0, 0, (WindowType)90, (int)pBtn_SliderLeft, v0);
+            pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           if ( uMessageParam == 5 )
           {
@@ -863,24 +772,9 @@
             {
               v21 = (double)(signed int)uGammaPos * 0.1 + 0.6;
               pGame->pGammaController->Initialize(v21);
-              v20 = 213;
-              v166 = v0;
-              v152 = (int)pBtn_SliderRight;
-              pWindowType2 = (WindowType)90;
-              v140 = 0;
-              v136 = 0;
-//LABEL_122:
-              GUIWindow::Create(v20, 0xA1u, v136, v140, pWindowType2, v152, v166);
-              //goto LABEL_128;
-              v165 = 0;
-              v151 = 0;
-              v144 = 0;
-              v139 = 0;
-              v135 = -1;
-              v132 = 0;
-              v130 = 0;
-              v127 = 21;
-              goto _play_sound_and_continue;
+              GUIWindow::Create(213, 161, 0, 0, (WindowType)90, (int)pBtn_SliderRight, v0);
+              pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0);
+              continue;
             }
             uGammaPos = 9;
           }
@@ -890,16 +784,8 @@
             v22 = (double)(signed int)uGammaPos * 0.1 + 0.6;
             pGame->pGammaController->Initialize(v22);
           }
-//LABEL_128:
-          v165 = 0;
-          v151 = 0;
-          v144 = 0;
-          v139 = 0;
-          v135 = -1;
-          v132 = 0;
-          v130 = 0;
-          v127 = 21;
-          goto _play_sound_and_continue;
+          pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0);
+          continue;
         case UIMSG_ToggleBloodsplats:
           pGame->ToggleFlags2(0x20u);
           continue;
@@ -915,12 +801,7 @@
             --uMusicVolimeMultiplier;
             if ( (char)uMusicVolimeMultiplier < 1 )
               uMusicVolimeMultiplier = 0;
-            v167 = v0;
-            v23 = 243;
-            v153 = (int)pBtn_SliderLeft;
-//LABEL_136:
-            GUIWindow::Create(v23, 0xD8u, 0, 0, (enum WindowType)90, v153, v167);
-            //goto LABEL_143;
+            GUIWindow::Create(243, 0xD8u, 0, 0, (enum WindowType)90, (int)pBtn_SliderLeft, v0);
             if ( uMusicVolimeMultiplier )
               pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0);
             pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f);
@@ -931,12 +812,7 @@
             ++uMusicVolimeMultiplier;
             if ( (char)uMusicVolimeMultiplier > 9 )
               uMusicVolimeMultiplier = 9;
-            v167 = v0;
-            v23 = 435;
-            v153 = (int)pBtn_SliderRight;
-            //goto LABEL_136;
-            GUIWindow::Create(v23, 0xD8u, 0, 0, (enum WindowType)90, v153, v167);
-            //goto LABEL_143;
+            GUIWindow::Create(435, 0xD8u, 0, 0, (enum WindowType)90, (int)pBtn_SliderRight, v0);
             if ( uMusicVolimeMultiplier )
               pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0);
             pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f);
@@ -945,13 +821,12 @@
           uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;
           if ( (char)uMusicVolimeMultiplier > 9 )
             uMusicVolimeMultiplier = 9;
-//LABEL_143:
           if ( uMusicVolimeMultiplier )
             pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
           pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
           continue;
         case UIMSG_ChangeSoundVolume:
-          if ( uMessageParam == 4 )//reduce sound level
+          if ( uMessageParam == 4 )//reduce sound level button left
           {
             --uSoundVolumeMultiplier;
             if ( (char)uSoundVolumeMultiplier < 1 )
@@ -961,7 +836,7 @@
             pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0);
             continue;
           }
-          if ( uMessageParam == 5 )//Increase sound level 
+          if ( uMessageParam == 5 )//Increase sound level button right
           {
             ++uSoundVolumeMultiplier;
             if ( (char)uSoundVolumeMultiplier > 8 )
@@ -969,34 +844,17 @@
             v168 = v0;
             v24 = 435;
             v154 = (int)pBtn_SliderRight;
-            //goto LABEL_150;
             GUIWindow::Create(v24, 0xA2u, 0, 0, (enum WindowType)90, v154, v168);
-            //goto LABEL_157;
             pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
-            v165 = 0;
-            v151 = 0;
-            v144 = 0;
-            v139 = 0;
-            v135 = -1;
-            v132 = 0;
-            v130 = -1;
-            v127 = 218;
-            goto _play_sound_and_continue;
+            pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17;
           if ( (char)uSoundVolumeMultiplier > 8 )
             uSoundVolumeMultiplier = 9;
-//LABEL_157:
           pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
-          v165 = 0;
-          v151 = 0;
-          v144 = 0;
-          v139 = 0;
-          v135 = -1;
-          v132 = 0;
-          v130 = -1;
-          v127 = 218;
-          goto _play_sound_and_continue;
+          pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0);
+          continue;
         case UIMSG_ToggleFlipOnExit:
           bFlipOnExit = bFlipOnExit == 0;
           continue;
@@ -1015,62 +873,30 @@
             --uVoicesVolumeMultiplier;
             if ( (char)uVoicesVolumeMultiplier < 1 )
               uVoicesVolumeMultiplier = 0;
-            v169 = v0;
-            v25 = 243;
-            v155 = (int)pBtn_SliderLeft;
-//LABEL_166:
-            GUIWindow::Create(v25, 0x10Eu, 0, 0, (enum WindowType)90, v155, v169);
-            //goto LABEL_173;
+            GUIWindow::Create(243, 270, 0, 0, (enum WindowType)90, (int)pBtn_SliderLeft, v0);
             if ( !uVoicesVolumeMultiplier )
               continue;
-            v165 = 0;
-            v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f;
-            v144 = 0;
-            v139 = 0;
-            v135 = -1;
-            v132 = 0;
-            v130 = -1;
-            v127 = 5788;
-            goto _play_sound_and_continue;
+            pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
+            continue;
           }
           if ( uMessageParam == 5 )
           {
             ++uVoicesVolumeMultiplier;
             if ( (char)uVoicesVolumeMultiplier > 8 )
               uVoicesVolumeMultiplier = 9;
-            v169 = v0;
-            v25 = 435;
-            v155 = (int)pBtn_SliderRight;
-            //goto LABEL_166;
-            GUIWindow::Create(v25, 0x10Eu, 0, 0, (enum WindowType)90, v155, v169);
-            //goto LABEL_173;
+            GUIWindow::Create(435, 270, 0, 0, (enum WindowType)90, (int)pBtn_SliderRight, v0);
             if ( !uVoicesVolumeMultiplier )
               continue;
-            v165 = 0;
-            v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f;
-            v144 = 0;
-            v139 = 0;
-            v135 = -1;
-            v132 = 0;
-            v130 = -1;
-            v127 = 5788;
-            goto _play_sound_and_continue;
+            pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
+            continue;
           }
           uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17;
           if ( (char)uVoicesVolumeMultiplier > 8 )
             uVoicesVolumeMultiplier = 9;
-//LABEL_173:
           if ( !uVoicesVolumeMultiplier )
             continue;
-          v165 = 0;
-          v151 = pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f;
-          v144 = 0;
-          v139 = 0;
-          v135 = -1;
-          v132 = 0;
-          v130 = -1;
-          v127 = 5788;
-          goto _play_sound_and_continue;
+            pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
+            continue;
         case UIMSG_SetTurnSpeed:
           if ( uMessageParam )
             pParty->sRotationY = uMessageParam * pParty->sRotationY / uMessageParam;
@@ -1080,7 +906,6 @@
           if ( !bUseLoResSprites )
           {
             byte_6BE388_graphicsmode = uMessageParam;
-//LABEL_184:
             MM7Initialization();
             continue;
           }
@@ -1096,16 +921,18 @@
                 continue;
               byte_6BE388_graphicsmode = 1;
             }
-            //goto LABEL_184;
             MM7Initialization();
             continue;
           }
           ModalWindow(pNPCTopics[453].pText, 0);
           continue;
-        case UIMSG_7B:
+        case UIMSG_GameMenu_ReturnToGame:
           pGUIWindow_CurrentMenu->Release();
           pEventTimer->Resume();
-          goto LABEL_188;
+          pCurrentScreen = SCREEN_GAME;
+          viewparams->bRedrawGameUI = v0;
+          stru_506E40.Release();
+          continue;
         case UIMSG_OpenQuestBook:
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -1137,14 +964,8 @@
           viewparams->sPartyPosX = pParty->vPosition.x;
           viewparams->sPartyPosZ = pParty->vPosition.y;
           pAudioPlayer->StopChannels(-1, -1);
-          pWindow = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0);
-          v27 = 353;
-          v28 = 546;
-          v170 = 0;
-          v156 = (int)pBtn_Maps;
-          //goto LABEL_210;
-          pGUIWindow_CurrentMenu = pWindow;
-          pBooksWindow = GUIWindow::Create(v28, v27, 0, 0, (enum WindowType)99, v156, v170);
+          pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0);
+          pBooksWindow = GUIWindow::Create(546, 353, 0, 0, (enum WindowType)99, (int)pBtn_Maps, 0);
           continue;
         case UIMSG_OpenCalendar:
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -1153,14 +974,8 @@
             pGUIWindow_CurrentMenu->Release();
           pEventTimer->Pause();
           pAudioPlayer->StopChannels(-1, -1);
-          pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0);
-          v27 = 354;
-          v28 = 570;
-          v170 = 0;
-          v156 = (int)pBtn_Calendar;
-//LABEL_210:
-          pGUIWindow_CurrentMenu = pWindow;
-          pBooksWindow = GUIWindow::Create(v28, v27, 0, 0, (enum WindowType)99, v156, v170);
+          pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0);
+          pBooksWindow = GUIWindow::Create(570, 354, 0, 0, (enum WindowType)99, (int)pBtn_Calendar, 0);
           continue;
         case UIMSG_OpenHistoryBook:
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -1173,7 +988,7 @@
           pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, (enum WindowType)99, (int)pBtn_History, 0);
           bFlashHistoryBook = 0;
           continue;
-        case UIMSG_Escape:// нажатие Escape
+        case UIMSG_Escape:// нажатие Escape and return to game
           back_to_game();
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -1181,11 +996,9 @@
           {
             if ( pCurrentScreen >= SCREEN_CHANGE_LOCATION && (pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_QUICK_REFERENCE) )
             {
-//LABEL_229:
               if ( dword_50CDC8 )
                 goto LABEL_232;
               CloseWindowBackground();
-              //goto LABEL_231;
               uMessageParam = v0;
               goto LABEL_232;
             }
@@ -1193,22 +1006,18 @@
           else
           {
             if ( pCurrentScreen >= SCREEN_E || pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHEST )
-			{
-              //goto LABEL_229;
+            {
               if ( dword_50CDC8 )
                 goto LABEL_232;
               CloseWindowBackground();
-              //goto LABEL_231;
               uMessageParam = v0;
               goto LABEL_232;
-			}
+            }
             if ( pCurrentScreen == SCREEN_HOUSE && !dword_50CDC8 && !dword_5C35C8 )
             {
               CloseWindowBackground();
               dword_5C35C8 = 0;
-//LABEL_231:
               uMessageParam = v0;
-              goto LABEL_232;
             }
           }
 LABEL_232:
@@ -1249,7 +1058,6 @@
                         dword_50C9A8 = 0;
                         ptr_50C9A4 = 0;
                       }
-                      //goto LABEL_322;
                       if ( pGUIWindow_Settings )
                       {
                        if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1282,7 +1090,6 @@
                       //crt_deconstruct_ptr_6A0118();
                       pBooksWindow = 0;
                       pEventTimer->Resume();
-                      //goto LABEL_322;
                       if ( pGUIWindow_Settings )
                       {
                         if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1314,7 +1121,6 @@
                     case SCREEN_LOADGAME:
                       pIcons_LOD->_4114F2();
                       //crt_deconstruct_ptr_6A0118();
-                      //goto LABEL_291;
                       stru_506E40.Release();
                       break;
                     case SCREEN_F:
@@ -1322,7 +1128,6 @@
                       continue;
                     case SCREEN_CHEST:
                       pWindow2 = pChestWindow;
-                      //goto LABEL_249;
                       pWindow2->Release();
                       pIcons_LOD->_4114F2();
                       pCurrentScreen = SCREEN_GAME;
@@ -1331,14 +1136,13 @@
                       continue;
                     case SCREEN_19:
                       pWindow2 = ptr_507BC8;
-//LABEL_249:
                       pWindow2->Release();
                       pIcons_LOD->_4114F2();
                       pCurrentScreen = SCREEN_GAME;
                       viewparams->bRedrawGameUI = v0;
                       pEventTimer->Resume();
                       continue;
-                    case SCREEN_OPTIONS:
+                    case SCREEN_OPTIONS://Close
                       thisa = (signed int)&uTextureID_ControlBG;
                       do
                       {
@@ -1360,9 +1164,7 @@
                       if ( !uTurnSpeed )
                       {
                         v171 = 3;
-                        //goto LABEL_261;
                         v30 = v171;
-                        //goto LABEL_262;
                         v31 = "TurnDelta";
                         WriteWindowsRegistryInt(v31, v30);
                         stru_506E40.Release();
@@ -1371,26 +1173,20 @@
                       if ( uTurnSpeed == 64 )
                       {
                         v171 = 2;
-//LABEL_261:
                         v30 = v171;
-                        //goto LABEL_262;
                         v31 = "TurnDelta";
                         WriteWindowsRegistryInt(v31, v30);
                         stru_506E40.Release();
                         break;
                       }
                       if ( uTurnSpeed != 128 )
-                        //goto LABEL_291;
                         {
                           stru_506E40.Release();
                           break;
                         }
                       v30 = v0;
-//LABEL_262:
                       v31 = "TurnDelta";
-//LABEL_263:
                       WriteWindowsRegistryInt(v31, v30);
-//LABEL_291:
                       stru_506E40.Release();
                       break;
                     case SCREEN_MENU:
@@ -1398,7 +1194,6 @@
                       pIcons_LOD->_4114F2();
                       pIcons_LOD->_40F9C5();
                       pIcons_LOD->_4114F2();
-                      //goto LABEL_291;
                       stru_506E40.Release();
                       break;
                     case SCREEN_VIDEO_OPTIONS:
@@ -1409,21 +1204,19 @@
                         WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pGame->uFlags2) >> 5) & 1);
                       }
                       if ( pRenderer->bWindowMode )
-                        //goto LABEL_291;
                         {
                           stru_506E40.Release();
                           break;
                         }
                       v30 = uGammaPos;
                       v31 = "GammaPos";
-                      //goto LABEL_263;
                       WriteWindowsRegistryInt(v31, v30);
                       stru_506E40.Release();
                       break;
-                    case SCREEN_KEYBOARD_OPTIONS:
+                    case SCREEN_KEYBOARD_OPTIONS://Return to game
                       v197 = 1;
                       v32 = 0;
-                      while ( *((char *)word_506E6C + v32) != 1 )
+                      while ( KeyButtonFlagChangesArray[v32] != 1 )
                       {
                         ++v32;
                         if ( v32 >= 28 )
@@ -1465,13 +1258,11 @@
                           }
                           while ( uAction < 28 );
                           pKeyActionMap->StoreMappings();
-                          //goto LABEL_291;
                           stru_506E40.Release();
                           break;
                         }
                       }
-                      pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
-                      continue;
+                      break;
                     case SCREEN_REST:
                       if ( dword_506F14 )
                       {
@@ -1490,7 +1281,6 @@
                       _506F18_num_hours_to_sleep = 0;
                       dword_506F14 = 0;
                       dword_507B94 = v0;
-                      //goto LABEL_322;
                       if ( pGUIWindow_Settings )
                       {
                         if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1540,7 +1330,6 @@
                       pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 814, 0, -1, 0, 0, 0, 0);
                       pVideoPlayer->Unload();
                       pGUIWindow_CurrentMenu = window_SpeakInHouse;
-                      //goto LABEL_322;
                       if ( pGUIWindow_Settings )
                       {
                         if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1572,7 +1361,6 @@
                       if ( uCurrentHouse_Animation == 153 )
                         HousePlaySomeSound(0x99u, 3);
                       pVideoPlayer->Unload();
-                      //goto LABEL_306;
                       if ( dword_5B65CC )
                       {
                         pParty->field_709 = 0;
@@ -1583,7 +1371,6 @@
                       }
                       goto LABEL_317;
                     case SCREEN_NPC_DIALOGUE:
-//LABEL_306:
                       if ( dword_5B65CC )
                       {
                         pParty->field_709 = 0;
@@ -1613,7 +1400,6 @@
                     case SCREEN_CHARACTERS:
                       goto LABEL_319;
                     default:
-                      //goto LABEL_322;
                       if ( pGUIWindow_Settings )
                       {
                         if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1642,7 +1428,6 @@
                       pIcons_LOD->_4355F7();
                       continue;
                   }
-                  //goto LABEL_322;
                   if ( pGUIWindow_Settings )
                   {
                     if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1677,7 +1462,6 @@
 LABEL_321:
                 pIcons_LOD->_4114F2();
               }
-//LABEL_322:
               if ( pGUIWindow_Settings )
               {
                 if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1752,7 +1536,6 @@
               stru_506E40._40E55E("gamma.pcx", 0);
               continue;
             }
-            //goto LABEL_333;
             pWindow3->Release();
             pGUIWindow_Settings = 0;
             pMouse->SetCursorBitmap("MICON1");
@@ -14795,7 +14578,7 @@
   if ( pGUIWindow_CurrentMenu->field_40 == 2 )
   {
     pPrevVirtualCidesMapping[dword_506E68] = pKeyActionMap->pPressedKeysBuffer[0];
-    memset(word_506E6C, 0, 0x1Cu);
+    memset(&KeyButtonFlagChangesArray, 0, sizeof(KeyButtonFlagChangesArray));
     v4 = 0;
     do
     {
@@ -14804,8 +14587,8 @@
       {
         if ( v4 != v5 && pPrevVirtualCidesMapping[v4] == pPrevVirtualCidesMapping[v5] )
         {
-          *((char *)word_506E6C + v4) = 1;
-          *((char *)word_506E6C + v5) = 1;
+          KeyButtonFlagChangesArray[v4] = 1;
+          KeyButtonFlagChangesArray[v5] = 1;
         }
         ++v5;
       }
@@ -14816,10 +14599,10 @@
     dword_506E68 = -1;
     v3->field_40 = 0;
   }
-  pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_Optkb != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb] : 0));
+  pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_Optkb[0] != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb[0]] : 0));
   if ( KeyboardPageNum == 1 )
   {
-    pRenderer->DrawTextureIndexed(0x13, 0x12E, (Texture *)(uTextureID_Optkb_1 != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb_1] : 0));
+    pRenderer->DrawTextureIndexed(0x13, 0x12E, (Texture *)(uTextureID_Optkb[3] != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb[3]] : 0));
     pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, ascii_4E2D5C, 0, 0, 0);
     v6 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]);
     v7 = sub_414D24(0);
@@ -14882,7 +14665,7 @@
   }
   else
   {
-    pRenderer->DrawTextureIndexed(0x7F, 0x12E, (Texture *)(uTextureID_Optkb_2 != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb_2] : 0));
+    pRenderer->DrawTextureIndexed(0x7F, 0x12E, (Texture *)(uTextureID_Optkb[4] != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb[4]] : 0));
     pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, ascii_4E2CDC, 0, 0, 0);
     v33 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]);
     v34 = sub_414D24(14);
@@ -14969,7 +14752,7 @@
   }
   else
   {
-    if ( *((char *)word_506E6C + v1) )
+    if ( KeyButtonFlagChangesArray[v1] )
       result = dword_507C08;
   }
   return result;
@@ -15046,7 +14829,7 @@
   signed int v0; // eax@1
 
   pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0));
-  pRenderer->DrawTextureIndexed(8, 132, (Texture *)(uTextureID_ControlBG != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG] : 0));
+  pRenderer->DrawTextureIndexed(8, 132, (Texture *)(uTextureID_ControlBG[0] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[0]] : 0));
   v0 = 0;
   if ( uTurnSpeed == 128 )
   {
@@ -15057,21 +14840,21 @@
     if ( uTurnSpeed == 64 )
       v0 = 1;
   }
-  pRenderer->DrawTextureIndexed(BtnTurnCoord[v0], 270, (Texture *)(uTextureID_Con_Smoo[v0] != -1 ? &pIcons_LOD->pTextures[uTextureID_Con_Smoo[v0]] : 0));
+  pRenderer->DrawTextureIndexed(BtnTurnCoord[v0], 270, (Texture *)(uTextureID_ControlBG[v0 + 1] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[v0 + 1]] : 0));
   if ( bWalkSound )
-    pRenderer->DrawTextureIndexed(20, 303, (Texture *)(uTextureID_Option01 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option01] : 0));
+    pRenderer->DrawTextureIndexed(20, 303, (Texture *)(uTextureID_ControlBG[21] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[21]] : 0));
   if ( bShowDamage )
-    pRenderer->DrawTextureIndexed(128, 303, (Texture *)(uTextureID_Option02 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option02] : 0));
+    pRenderer->DrawTextureIndexed(128, 303, (Texture *)(uTextureID_ControlBG[22] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[22]] : 0));
   if ( bFlipOnExit )
-    pRenderer->DrawTextureIndexed(128, 325, (Texture *)(uTextureID_Option04 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option04] : 0));
+    pRenderer->DrawTextureIndexed(128, 325, (Texture *)(uTextureID_ControlBG[9] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[9]] : 0));
   if ( bAlwaysRun )
-    pRenderer->DrawTextureIndexed(20, 325, (Texture *)(uTextureID_Option03 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option03] : 0));
+    pRenderer->DrawTextureIndexed(20, 325, (Texture *)(uTextureID_ControlBG[20] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[20]] : 0));
   pRenderer->DrawTextureIndexed(17 * (char)uSoundVolumeMultiplier + 265, 162,
-    (Texture *)(pTextureIDs_SoundLevels[(char)uSoundVolumeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uSoundVolumeMultiplier]] : 0));
+    (Texture *)(uTextureID_ControlBG[(char)uSoundVolumeMultiplier + 10] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[(char)uSoundVolumeMultiplier + 10]] : 0));
   pRenderer->DrawTextureIndexed(17 * (char)uMusicVolimeMultiplier + 265, 216,
-    (Texture *)(pTextureIDs_SoundLevels[(char)uMusicVolimeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uMusicVolimeMultiplier]] : 0));
+    (Texture *)(uTextureID_ControlBG[(char)uMusicVolimeMultiplier + 10] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[(char)uMusicVolimeMultiplier + 10]] : 0));
   pRenderer->DrawTextureIndexed(17 * (char)uVoicesVolumeMultiplier + 265, 270,
-    (Texture *)(pTextureIDs_SoundLevels[(char)uVoicesVolumeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uVoicesVolumeMultiplier]] : 0));
+    (Texture *)(uTextureID_ControlBG[(char)uVoicesVolumeMultiplier + 10] != -1 ? &pIcons_LOD->pTextures[uTextureID_ControlBG[(char)uVoicesVolumeMultiplier + 10]] : 0));
 }
 
 
--- a/mm7_data.cpp	Fri Feb 22 17:47:41 2013 +0200
+++ b/mm7_data.cpp	Fri Feb 22 17:48:00 2013 +0200
@@ -1779,7 +1779,7 @@
 int dword_506988; // weak
 int dword_50698C; // weak
 int dword_506E68; // weak
-__int16 word_506E6C[18]; // weak
+char KeyButtonFlagChangesArray[28]; // weak
 unsigned int pPrevVirtualCidesMapping[27];
 int KeyboardPageNum; // weak
 int dword_506F0C[777]; // idb
--- a/mm7_data.h	Fri Feb 22 17:47:41 2013 +0200
+++ b/mm7_data.h	Fri Feb 22 17:48:00 2013 +0200
@@ -1182,7 +1182,7 @@
 extern int dword_506988; // weak
 extern int dword_50698C; // weak
 extern int dword_506E68; // weak
-extern __int16 word_506E6C[18]; // weak
+extern char KeyButtonFlagChangesArray[28]; // weak
 extern unsigned int pPrevVirtualCidesMapping[27];
 extern int KeyboardPageNum; // weak
 extern int dword_506F0C[]; // idb