diff mm7_5.cpp @ 368:df09db095ef1

Слияние
author Ritor1
date Fri, 22 Feb 2013 09:12:01 +0600
parents 0f35f908547f
children 6e984a4a896f 7f817679b60e
line wrap: on
line diff
--- a/mm7_5.cpp	Fri Feb 22 09:11:48 2013 +0600
+++ b/mm7_5.cpp	Fri Feb 22 09:12:01 2013 +0600
@@ -592,12 +592,12 @@
           pGUIWindow_CurrentMenu->Release();
           viewparams->field_48 = v0;
           pCurrentScreen = SCREEN_OPTIONS;
-          uTextureID_507C60 = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C6C = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C68 = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C70 = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C74 = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C64[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE);
+          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);
@@ -608,71 +608,59 @@
           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_507C84 = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE);
-          uTextureID_507CB0 = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE);
-          uTextureID_507CB8 = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
-          uTextureID_507CB4 = pIcons_LOD->LoadTexture("option01", 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);
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x16u, 0x10Eu,
-            (uTextureID_507C6C != -1 ? pIcons_LOD->pTextures[uTextureID_507C6C].uTextureWidth : 24),
-            (uTextureID_507C6C != -1 ? pIcons_LOD->pTextures[uTextureID_507C6C].uTextureHeight : 26),
+            (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),
             v0, 0, 0xB8u, 0x80u, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x5Du, 0x10Eu,
-            (uTextureID_507C68 != -1 ? pIcons_LOD->pTextures[uTextureID_507C68].uTextureWidth : 24),
-            (uTextureID_507C68 != -1 ? pIcons_LOD->pTextures[uTextureID_507C68].uTextureHeight : 26),
+            (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),
             v0, 0, 0xB8u, 0x40u, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0xA4u, 0x10Eu,
-            (uTextureID_507C64[0] != -1 ? pIcons_LOD->pTextures[uTextureID_507C64[0]].uTextureWidth : 24),
-            (uTextureID_507C64[0] != -1 ? pIcons_LOD->pTextures[uTextureID_507C64[0]].uTextureHeight : 26),
+            (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),
             v0, 0, 0xB8u, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x12Fu,
-            (uTextureID_507CB4 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB4].uTextureWidth : 24),
-            (uTextureID_507CB4 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB4].uTextureHeight : 26),
+            (uTextureID_Option01 != -1 ? pIcons_LOD->pTextures[uTextureID_Option01].uTextureWidth : 24),
+            (uTextureID_Option01 != -1 ? pIcons_LOD->pTextures[uTextureID_Option01].uTextureHeight : 26),
             v0, 0, 0xB9u, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x12Fu,
-            (uTextureID_507CB8 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB8].uTextureWidth : 24),
-            (uTextureID_507CB8 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB8].uTextureHeight : 26),
+            (uTextureID_Option02 != -1 ? pIcons_LOD->pTextures[uTextureID_Option02].uTextureWidth : 24),
+            (uTextureID_Option02 != -1 ? pIcons_LOD->pTextures[uTextureID_Option02].uTextureHeight : 26),
             v0, 0, 0xBBu, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x145u,
-            (uTextureID_507CB0 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB0].uTextureWidth : 24),
-            (uTextureID_507CB0 != -1 ? pIcons_LOD->pTextures[uTextureID_507CB0].uTextureHeight : 26),
+            (uTextureID_Option03 != -1 ? pIcons_LOD->pTextures[uTextureID_Option03].uTextureWidth : 24),
+            (uTextureID_Option03 != -1 ? pIcons_LOD->pTextures[uTextureID_Option03].uTextureHeight : 26),
             v0, 0, 0xE1u, 0, 0, v1, 0);
           pGUIWindow_CurrentMenu->CreateButton(0x80u, 0x145u,
-            (uTextureID_507C84 != -1 ? pIcons_LOD->pTextures[uTextureID_507C84].uTextureWidth : 24),
-            (uTextureID_507C84 != -1 ? pIcons_LOD->pTextures[uTextureID_507C84].uTextureHeight : 26),
+            (uTextureID_Option04 != -1 ? pIcons_LOD->pTextures[uTextureID_Option04].uTextureWidth : 24),
+            (uTextureID_Option04 != -1 ? pIcons_LOD->pTextures[uTextureID_Option04].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_507C70], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0);
           pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xA2u, 0x10u, 0x10u, v0, 0, 0x6Fu, 5, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_507C74], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 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_507C70], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0);
           pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0xD8u, 0x10u, 0x10u, v0, 0, 0x70u, 5, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_507C74], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 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_507C70], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrL], 0);
           pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0x1B3u, 0x10Eu, 0x10u, 0x10u, v0, 0, 0xBAu, 5u, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_507C74], 0);
+                         &pIcons_LOD->pTextures[uTextureID_Con_ArrR], 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"
             0);
           pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x8Cu, 0xD6u, 0x28u, v0, 0, 0x19Fu, 0, 0x4Bu, v1, 0);
-          pTexture = 0;
-          v150 = v1;
-          v143 = 86;
-          v138 = 0;
-          v134 = 421;
-          v131 = 0;
-          v129 = v0;
-          v126 = 40;
-          v124 = 214;
-          v122 = 194;
-          v120 = 19;
-          //goto LABEL_117;
-          pGUIWindow_CurrentMenu->CreateButton(v120, v122, v124, v126, v129, v131, v134, v138, v143, v150, pTexture);
+          pGUIWindow_CurrentMenu->CreateButton(19, 194, 214, 40, v0, 0, 421, 0, 86, v1, 0);
           continue;
         case UIMSG_OpenKeyMappingOptions:
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -680,11 +668,11 @@
           pGUIWindow_CurrentMenu->Release();
           viewparams->field_48 = 1;
           pCurrentScreen = SCREEN_KEYBOARD_OPTIONS;
-          uTextureID_507BF4 = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE);
-          uTextureID_507BF8 = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE);
-          uTextureID_507BFC = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C00 = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE);
-          uTextureID_507C04 = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE);
+          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);
           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);
@@ -706,7 +694,7 @@
           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);
           dword_506E68 = -1;
-          dword_506F08 = 1;
+          KeyboardPageNum = 1;
           memset(word_506E6C, 0, 0x1Cu);
           word_506E6C[14] = 0;
           memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
@@ -716,11 +704,14 @@
           continue;
         //default:
           //continue;
-        case UIMSG_1A3:
+        case UIMSG_ChangeKeyButton:
           if ( dword_506E68 != -1 )
-            goto LABEL_623;
+          {
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
+          }
           v14 = uMessageParam;
-          if ( dword_506F08 != v0 )
+          if ( KeyboardPageNum != v0 )
             v14 = uMessageParam + 14;
           dword_506E68 = v14;
           pKeyActionMap->EnterText(0, v0, pGUIWindow_CurrentMenu);
@@ -762,11 +753,11 @@
           v130 = 0;
           v127 = 219;
           goto _play_sound_and_continue;
-        case UIMSG_1A0:
-          dword_506F08 = v0;
-          continue;
-        case UIMSG_1A1:
-          dword_506F08 = 2;
+        case UIMSG_SelectKeyPage1:
+          KeyboardPageNum = v0;
+          continue;
+        case UIMSG_SelectKeyPage2:
+          KeyboardPageNum = 2;
           continue;
         case UIMSG_OpenVideoOptions:
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -1348,7 +1339,7 @@
                       pEventTimer->Resume();
                       continue;
                     case SCREEN_OPTIONS:
-                      thisa = (signed int)&uTextureID_507C60;
+                      thisa = (signed int)&uTextureID_ControlBG;
                       do
                       {
                         if ( *(int *)thisa )
@@ -1356,7 +1347,7 @@
                         thisa += 4;
                       }
                       while ( thisa < (signed int)&dword_507CBC );
-                      memset(&uTextureID_507C60, 0, 0x5Cu);
+                      memset(&uTextureID_ControlBG, 0, 0x5Cu);
                       pIcons_LOD->_40F9C5();
                       WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
                       WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
@@ -1437,7 +1428,7 @@
                         ++v32;
                         if ( v32 >= 28 )
                         {
-                          thisb = (signed int)&uTextureID_507BF4;
+                          thisb = (signed int)&uTextureID_Optkb;
                           do
                           {
                             if ( *(int *)thisb )
@@ -1445,7 +1436,7 @@
                             thisb += 4;
                           }
                           while ( thisb < (signed int)&dword_507C08 );
-                          memset(&uTextureID_507BF4, 0, 0x14u);
+                          memset(&uTextureID_Optkb, 0, 0x14u);
                           pIcons_LOD->_40F9C5();
                           uAction = 0;
                           do
@@ -1479,7 +1470,8 @@
                           break;
                         }
                       }
-                      goto LABEL_623;
+                      pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+                      continue;
                     case SCREEN_REST:
                       if ( dword_506F14 )
                       {
@@ -1726,31 +1718,31 @@
               if ( !pIcons_LOD->uNumPrevLoadedFiles )
                 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
               pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)3, 0, 0);
-              uTextureID_507944 = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
-              uTextureID_507940 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
-              uTextureID_50793C = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
-              uTextureID_507938 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE);
-              uTextureID_507934 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE);
-              uTextureID_507930 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
-              uTextureID_50792C = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE);
+              uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
+              uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
+              uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
+              uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE);
+              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,
                              pGlobalTXT_LocalizationStrings[614],// "New Game"
-                             (Texture *)(uTextureID_507940 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507940] : 0), 0);
+                             (Texture *)(uTextureID_New1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_New1] : 0), 0);
               pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, v0, 0, 0x7Eu, 0, 0x53u,
                              pGlobalTXT_LocalizationStrings[615],// "Save Game"
-                             (Texture *)(uTextureID_507938 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507938] : 0), 0);
+                             (Texture *)(uTextureID_Save1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Save1] : 0), 0);
               pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, v0, 0, 0x7Du, 0, 0x4Cu,
                              pGlobalTXT_LocalizationStrings[616],// "Load Game"
-                             (Texture *)(uTextureID_50793C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50793C] : 0), 0);
+                             (Texture *)(uTextureID_Load1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Load1] : 0), 0);
               pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, v0, 0, 0x7Fu, 0, 0x43u,
                              pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:""
-                             (Texture *)(uTextureID_507934 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507934] : 0), 0);
+                             (Texture *)(uTextureID_Controls1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Controls1] : 0), 0);
               pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, v0, 0, 0x84u, 0, 0x51u,
                              pGlobalTXT_LocalizationStrings[618],// "Quit"
-                             (Texture *)(uTextureID_50792C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50792C] : 0), 0);
+                             (Texture *)(uTextureID_Quit1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Quit1] : 0), 0);
               pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, v0, 0, 0x7Bu, 0, 0x52u,
                              pGlobalTXT_LocalizationStrings[619],// "Return to Game"
-                             (Texture *)(uTextureID_507930 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507930] : 0), 0);
+                             (Texture *)(uTextureID_Resume1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Resume1] : 0), 0);
               pGUIWindow_CurrentMenu->_41D08F(6, v0, 0, 0);
               viewparams->field_48 = v0;
               stru_506E40.Release();
@@ -2609,7 +2601,11 @@
           continue;
         case UIMSG_19:
           if ( bUnderwater == 1 )
-            goto LABEL_682;
+          {
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
+          }
           if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) )
             //goto LABEL_90;
           {
@@ -2617,13 +2613,7 @@
             v0 = 1;
             continue;
           }
-          v79 = pPlayer2->uQuickSpell;
-          v175 = uActiveCharacter;
-          v159 = 0;
-          v147 = 0;
-          v80 = uActiveCharacter - 1;
-          //goto LABEL_679;
-          _42777D_CastSpell_UseWand_ShootArrow(v79, v80, v147, v159, v175);
+          _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter);
           continue;
         case UIMSG_46:
         case UIMSG_8C:
@@ -2760,7 +2750,9 @@
             //goto LABEL_621;
           {
             v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            goto LABEL_622;
+            ShowStatusBarString(v96, 2);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, (enum WindowType)90,
             (int)pButton_RestUI_Wait5Minutes, (int)pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes"
@@ -2772,7 +2764,9 @@
             //goto LABEL_621;
           {
             v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            goto LABEL_622;
+            ShowStatusBarString(v96, 2);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, (enum WindowType)90,
             (int)pButton_RestUI_Wait1Hour, (int)pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour"
@@ -2865,7 +2859,9 @@
             //goto LABEL_621;
           {
             v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            goto LABEL_622;
+            ShowStatusBarString(v96, 2);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest )
           {
@@ -2945,7 +2941,9 @@
           {
 //LABEL_621:
             v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            goto LABEL_622;
+            ShowStatusBarString(v96, 2);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, (enum WindowType)90,
             (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn"
@@ -3155,11 +3153,7 @@
             continue;
           if ( bUnderwater == 1 )
           {
-LABEL_682:
-            v96 = pGlobalTXT_LocalizationStrings[652];// "You can not do that while you are underwater!"
-LABEL_622:
-            ShowStatusBarString(v96, 2u);
-LABEL_623:
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
             v165 = 0;
             v151 = 0;
             v144 = 0;
@@ -8787,13 +8781,13 @@
   {
     v229 = pPlayer->pEquipment.uMainHand;
     v9 = (int)&pPlayer->pInventoryItems[v8-1];
-    v10 = pBodyComplection << 7;
+   // v10 = pBodyComplection << 7;
     v218 = v9;
     v11 = *(int *)v9;
     v12 = *(int *)v9;
     v13 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[v12].uEquipX;
     a2a = v13;
-    a3a = pPaperdoll_BodyY + *(int *)((char *)&paperdoll_Weapon[0][1][1] + v10) - pItemsTable->pItems[v12].uEquipY;
+    a3a = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[v12].uEquipY;
     if ( v11 == 64 )
       v166 = "item64v1";
     else
@@ -13056,7 +13050,7 @@
 }
 
 //----- (00410B28) --------------------------------------------------------
-void __thiscall DrawSpellDescriptionPopup(void *_this)
+void __thiscall DrawSpellDescriptionPopup(int spell_index)
 {
   Player *v1; // edi@1
   SpellInfo *v2; // esi@1
@@ -13067,14 +13061,14 @@
   char *v7; // ST44_4@12
   unsigned __int16 v8; // ax@12
   GUIWindow a1; // [sp+Ch] [bp-68h]@4
-  void *v10; // [sp+60h] [bp-14h]@1
+  int v10; // [sp+60h] [bp-14h]@1
   POINT a2; // [sp+64h] [bp-10h]@1
   int v12; // [sp+6Ch] [bp-8h]@4
   int v13; // [sp+70h] [bp-4h]@4
 
   v1 = pPlayers[uActiveCharacter];
-  v10 = _this;
-  v2 = &pSpellStats->pInfos[(signed int)((char *)_this + 11 * v1->lastOpenedSpellbookPage) + 1];
+  v10 = spell_index;
+  v2 = &pSpellStats->pInfos[spell_index + 11 * v1->lastOpenedSpellbookPage + 1];
   if ( pMouse->GetCursorPos(&a2)->y <= 250 )
     v3 = pMouse->GetCursorPos(&a2)->y + 30;
   else
@@ -13086,10 +13080,10 @@
   a1.uFrameZ = 417;
   a1.uFrameW = v3 + 67;
   a1.Hint = 0;
-  a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);
-  v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);
-  v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);
-  v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);
+  a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]);
+  v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]);
+  v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]);
+  v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]);
   v5 = a2.y;
   if ( v13 > a2.y )
     v5 = v13;
@@ -13097,25 +13091,20 @@
     v5 = v12;
   if ( v4 > v5 )
     v5 = v4;
-  sprintf(
-    pTmpBuf2,
+  sprintf(  pTmpBuf2,
     "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
     v2->pDescription,
-    pGlobalTXT_LocalizationStrings[431],
-    v5 + 3,
-    v5 + 10,
+    pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL],
+    v5 + 3, v5 + 10,
     v2->pBasicSkillDesc,
-    pGlobalTXT_LocalizationStrings[433],
-    v5 + 3,
-    v5 + 10,
+    pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT],
+    v5 + 3,  v5 + 10,
     v2->pExpertSkillDesc,
-    pGlobalTXT_LocalizationStrings[432],
-    v5 + 3,
-    v5 + 10,
+    pGlobalTXT_LocalizationStrings[LOCSTR_MASTER],
+    v5 + 3, v5 + 10,
     v2->pMasterSkillDesc,
-    pGlobalTXT_LocalizationStrings[96],
-    v5 + 3,
-    v5 + 10,
+    pGlobalTXT_LocalizationStrings[LOCSTR_GRAND],
+    v5 + 3,  v5 + 10,
     v2->pGrandmasterSkillDesc);
   v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0);
   a1.uFrameHeight += v6;
@@ -13134,13 +13123,11 @@
   a1.uFrameWidth = 108;
   a1.uFrameZ = a1.uFrameX + 107;
   a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->lastOpenedSpellbookPage + 12], 3u);
-  sprintf(
-    pTmpBuf,
-    "%s\n%d",
-    pGlobalTXT_LocalizationStrings[522],
-    *(&pSpellDatas[0].field_12 //temp_fix field_14
-    + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6)
-    + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage)));
+  sprintf( pTmpBuf,  "%s\n%d",    pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST],
+	  pSpellDatas[spell_index + 11 * v1->lastOpenedSpellbookPage + 1].mana_per_skill[v1->pActiveSkills[v1->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]);
+  //  *(&[0].field_12 //temp_fix field_14
+   // + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6)
+   // + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage)));
   a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3u);
   dword_507B00_spell_info_to_draw_in_popup = 0;
 }
@@ -13669,15 +13656,16 @@
           }
           if ( v6->pLevelOfDetail0 )
           {
-            v7 =  (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
-            v19 = pViewport->uViewportY + pIconPos[v7].Ypos;
-            v17 = pViewport->uViewportX + pIconPos[v7].Xpos;
+			v7 = v0->lastOpenedSpellbookPage;
+           // v7 =  (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
+            v19 = pViewport->uViewportY +  pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos;
+            v17 = pViewport->uViewportX +  pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos;
             if ( BYTE1(v6->pBits) & 2 )
               pRenderer->DrawTextureTransparent(v17, v19, v6);
             else
               pRenderer->DrawTextureIndexed(v17, v19, v6);
-            v8 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
-            pRenderer->_4A612A(pIconPos[v8].Xpos,pIconPos[v8].Ypos, v23, v4);
+            pRenderer->_4A612A(pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos,
+				               pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos, v23, v4);
           }
         }
       }
@@ -13693,9 +13681,10 @@
     if ( v11->pLevelOfDetail0 )
     {
       v21 = dword_5063D8[v10];
-      v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]);
-      v20 = pViewport->uViewportY + pIconPos[v12].Ypos;
-      v18 = pViewport->uViewportX + pIconPos[v12].Xpos;
+	  v12 = v0->lastOpenedSpellbookPage;
+    //  v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]);
+      v20 = pViewport->uViewportY +  pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos;
+      v18 = pViewport->uViewportX +  pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos;
       if ( BYTE1(v11->pBits) & 2 )
         pRenderer->DrawTextureTransparent(v18, v20, v21);
       else
@@ -14832,16 +14821,10 @@
     dword_506E68 = -1;
     v3->field_40 = 0;
   }
-  pRenderer->DrawTextureIndexed(
-    8u,
-    8u,
-    (Texture *)(uTextureID_507BF4 != -1 ? &pIcons_LOD->pTextures[uTextureID_507BF4] : 0));
-  if ( dword_506F08 == 1 )
-  {
-    pRenderer->DrawTextureIndexed(
-      0x13u,
-      0x12Eu,
-      (Texture *)(uTextureID_507C00 != -1 ? &pIcons_LOD->pTextures[uTextureID_507C00] : 0));
+  pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_Optkb != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb] : 0));
+  if ( KeyboardPageNum == 1 )
+  {
+    pRenderer->DrawTextureIndexed(0x13, 0x12E, (Texture *)(uTextureID_Optkb_1 != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb_1] : 0));
     pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, ascii_4E2D5C, 0, 0, 0);
     v6 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[0]);
     v7 = sub_414D24(0);
@@ -14904,10 +14887,7 @@
   }
   else
   {
-    pRenderer->DrawTextureIndexed(
-      0x7Fu,
-      0x12Eu,
-      (Texture *)(uTextureID_507C04 != -1 ? &pIcons_LOD->pTextures[uTextureID_507C04] : 0));
+    pRenderer->DrawTextureIndexed(0x7F, 0x12E, (Texture *)(uTextureID_Optkb_2 != -1 ? &pIcons_LOD->pTextures[uTextureID_Optkb_2] : 0));
     pGUIWindow_CurrentMenu->DrawText(pFontLucida, 23, 142, v0, ascii_4E2CDC, 0, 0, 0);
     v33 = pKeyActionMap->GetVKeyDisplayName(pPrevVirtualCidesMapping[14]);
     v34 = sub_414D24(14);
@@ -15066,18 +15046,12 @@
 
 
 //----- (00414F82) --------------------------------------------------------
-void __cdecl sub_414F82_DrawGameOptions()
+void __cdecl DrawGameOptions()
 {
   signed int v0; // eax@1
 
-  pRenderer->DrawTextureIndexed(
-    8u,
-    8u,
-    (Texture *)(uTextureID_507944 != -1 ? &pIcons_LOD->pTextures[uTextureID_507944] : 0));
-  pRenderer->DrawTextureIndexed(
-    8u,
-    0x84u,
-    (Texture *)(uTextureID_507C60 != -1 ? &pIcons_LOD->pTextures[uTextureID_507C60] : 0));
+  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));
   v0 = 0;
   if ( uTurnSpeed == 128 )
   {
@@ -15088,41 +15062,20 @@
     if ( uTurnSpeed == 64 )
       v0 = 1;
   }
-  pRenderer->DrawTextureIndexed(
-    dword_4E2910[v0],
-    0x10Eu,
-    (Texture *)(uTextureID_507C64[v0] != -1 ? &pIcons_LOD->pTextures[uTextureID_507C64[v0]] : 0));
+  pRenderer->DrawTextureIndexed(BtnTurnCoord[v0], 270, (Texture *)(uTextureID_Con_Smoo[v0] != -1 ? &pIcons_LOD->pTextures[uTextureID_Con_Smoo[v0]] : 0));
   if ( bWalkSound )
-    pRenderer->DrawTextureIndexed(
-      0x14u,
-      0x12Fu,
-      (Texture *)(uTextureID_507CB4 != -1 ? &pIcons_LOD->pTextures[uTextureID_507CB4] : 0));
+    pRenderer->DrawTextureIndexed(20, 303, (Texture *)(uTextureID_Option01 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option01] : 0));
   if ( bShowDamage )
-    pRenderer->DrawTextureIndexed(
-      0x80u,
-      0x12Fu,
-      (Texture *)(uTextureID_507CB8 != -1 ? &pIcons_LOD->pTextures[uTextureID_507CB8] : 0));
+    pRenderer->DrawTextureIndexed(128, 303, (Texture *)(uTextureID_Option02 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option02] : 0));
   if ( bFlipOnExit )
-    pRenderer->DrawTextureIndexed(
-      0x80u,
-      0x145u,
-      (Texture *)(uTextureID_507C84 != -1 ? &pIcons_LOD->pTextures[uTextureID_507C84] : 0));
+    pRenderer->DrawTextureIndexed(128, 325, (Texture *)(uTextureID_Option04 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option04] : 0));
   if ( bAlwaysRun )
-    pRenderer->DrawTextureIndexed(
-      0x14u,
-      0x145u,
-      (Texture *)(uTextureID_507CB0 != -1 ? &pIcons_LOD->pTextures[uTextureID_507CB0] : 0));
-  pRenderer->DrawTextureIndexed(
-    17 * (char)uSoundVolumeMultiplier + 265,
-    0xA2u,
+    pRenderer->DrawTextureIndexed(20, 325, (Texture *)(uTextureID_Option03 != -1 ? &pIcons_LOD->pTextures[uTextureID_Option03] : 0));
+  pRenderer->DrawTextureIndexed(17 * (char)uSoundVolumeMultiplier + 265, 162,
     (Texture *)(pTextureIDs_SoundLevels[(char)uSoundVolumeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uSoundVolumeMultiplier]] : 0));
-  pRenderer->DrawTextureIndexed(
-    17 * (char)uMusicVolimeMultiplier + 265,
-    0xD8u,
+  pRenderer->DrawTextureIndexed(17 * (char)uMusicVolimeMultiplier + 265, 216,
     (Texture *)(pTextureIDs_SoundLevels[(char)uMusicVolimeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uMusicVolimeMultiplier]] : 0));
-  pRenderer->DrawTextureIndexed(
-    17 * (char)uVoicesVolumeMultiplier + 265,
-    0x10Eu,
+  pRenderer->DrawTextureIndexed(17 * (char)uVoicesVolumeMultiplier + 265, 270,
     (Texture *)(pTextureIDs_SoundLevels[(char)uVoicesVolumeMultiplier] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_SoundLevels[(char)uVoicesVolumeMultiplier]] : 0));
 }
 
@@ -15859,7 +15812,7 @@
               }
               else if (pWindowType == WINDOW_Options)
               {
-                sub_414F82_DrawGameOptions();
+                DrawGameOptions();
               }
             }
             else if (pWindowType == WINDOW_CharacterRecord)
@@ -15868,7 +15821,7 @@
             }
             continue;
           }
-          pTexture = (Texture *)(uTextureID_507944 != -1 ? &pIcons_LOD->pTextures[uTextureID_507944] : 0);//pWindowType == 3 (0x3)
+          pTexture = (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0);//pWindowType == 3 (0x3)
           pY = pViewport->uViewportY;
           pX = pViewport->uViewportX;
           //goto LABEL_18;
@@ -16562,7 +16515,7 @@
             if ( pCurrentScreen == SCREEN_SPELL_BOOK )
             {
               if ( dword_507B00_spell_info_to_draw_in_popup )
-                DrawSpellDescriptionPopup((void *)(dword_507B00_spell_info_to_draw_in_popup - 1));
+                DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1);
             }
             goto LABEL_132;
           }