diff mm7_5.cpp @ 948:5a2dbb00c399

Code cleaning.
author Nomad
date Wed, 01 May 2013 17:31:10 +0200
parents 016e3577865c
children c0d0656aa662
line wrap: on
line diff
--- a/mm7_5.cpp	Wed May 01 14:30:02 2013 +0200
+++ b/mm7_5.cpp	Wed May 01 17:31:10 2013 +0200
@@ -529,78 +529,76 @@
           pGUIWindow_CurrentMenu->Release();
           viewparams->field_48 = v0;
           pCurrentScreen = SCREEN_OPTIONS;
-          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);
+
+          options_menu_skin.uTextureID_Background     = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_TurnSpeed[2]   = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_TurnSpeed[1]   = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_TurnSpeed[0]   = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_ArrowLeft      = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_ArrowRight     = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_SoundLevels[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_SoundLevels[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_SoundLevels[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_SoundLevels[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_FlipOnExit     = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_AlwaysRun      = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_ShowDamage     = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
+          options_menu_skin.uTextureID_WalkSound      = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE);
+
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 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,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight,
+                                               v0, 0, UIMSG_SetTurnSpeed, 0x80, 0, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(93, 270,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->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,
+          pGUIWindow_CurrentMenu->CreateButton(164, 270,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight,
                                                v0, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0);
-          pGUIWindow_CurrentMenu->CreateButton(0x14u, 0x12Fu,
-                                               pIcons_LOD->GetTexture(uTextureID_ControlBG[21])->uTextureWidth,
-                                               pIcons_LOD->GetTexture(uTextureID_ControlBG[21])->uTextureHeight,
+
+          pGUIWindow_CurrentMenu->CreateButton(20, 303,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->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, 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, 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, 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, UIMSG_ChangeSoundVolume, 5, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0);
-          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, UIMSG_ChangeMusicVolume, 5, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 0);
-          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, UIMSG_ChangeVoiceVolume, 5u, 0, v1,
-                         &pIcons_LOD->pTextures[uTextureID_ControlBG[5]], 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, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0);
-          pGUIWindow_CurrentMenu->CreateButton(19, 194, 214, 40, v0, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0);
-          continue;
+          pGUIWindow_CurrentMenu->CreateButton(128, 303,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight,
+                                               v0, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(20, 325,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight,
+                                               v0, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0);
+          pGUIWindow_CurrentMenu->CreateButton(128, 325,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth,
+                                               pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight,
+                                               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->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
+          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, v0, 0, UIMSG_ChangeSoundVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
+          pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, v0, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0);
+
+          pBtn_SliderLeft  = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, v0, 0, UIMSG_ChangeMusicVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
+          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, v0, 0, UIMSG_ChangeMusicVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
+          pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, v0, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0);
+
+          pBtn_SliderLeft  = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, v0, 0, UIMSG_ChangeVoiceVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
+          pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, v0, 0, UIMSG_ChangeVoiceVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
+          pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, v0, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0);
+
+          pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, v0, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game"
+          pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 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 )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -1126,15 +1124,8 @@
                       pEventTimer->Resume();
                       continue;
                     case SCREEN_OPTIONS://Close
-                      thisa = (signed int)&uTextureID_ControlBG;
-                      do
-                      {
-                        if ( *(int *)thisa )
-                          pIcons_LOD->pTextures[*(int *)thisa].Release();
-                        thisa += 4;
-                      }
-                      while ( thisa < (signed int)&dword_507CBC );
-                      memset(&uTextureID_ControlBG, 0, 0x5Cu);
+                      options_menu_skin.Relaease();
+
                       pIcons_LOD->_40F9C5();
                       WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
                       WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
@@ -10486,7 +10477,7 @@
 			}
 		case WINDOW_Book:
 			{
-			SellectDrawBook((unsigned int)pWindow->ptr_1C);
+			DrawCurrentBook((unsigned int)pWindow->ptr_1C);
 			break;
 			}
 		case WINDOW_QuickReference: