changeset 1405:c0b273d33338

RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
author Ritor1
date Mon, 22 Jul 2013 15:23:43 +0600
parents 7cc3b01a92ac
children d071e0e9ba75 468f434a8d8a
files Chest.cpp GUIWindow.cpp LOD.cpp LOD.h Party.cpp Player.cpp SaveLoad.cpp UI/Books/UISpellBook.cpp UI/UIBooks.cpp UI/UIMainMenu.cpp UI/UIPartyCreation.cpp mm7_2.cpp mm7_5.cpp
diffstat 13 files changed, 56 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/Chest.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/Chest.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -228,7 +228,7 @@
       word_A750E0 = 5;
       word_A750E2 = uActiveCharacter;
     }
-    pIcons_LOD->ClearTextureList();
+    pIcons_LOD->RemoveTexturesPackFromTextureList();
     dword_507CD8 = 0;
     return 0;
   }
--- a/GUIWindow.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/GUIWindow.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -304,7 +304,7 @@
 		pTexture_Dialogue_Background->Release();
 
 		pIcons_LOD->SyncLoadedFilesCount();
-		pIcons_LOD->ClearTextureList();
+		pIcons_LOD->RemoveTexturesPackFromTextureList();
 		dword_5C35D4 = 0;
 		if ( bFlipOnExit )
 		{
--- a/LOD.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/LOD.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -74,64 +74,42 @@
     field_ECA0 = uNumLoadedSprites;
 }
 
-
-
 //----- (004355F7) --------------------------------------------------------
-void LODFile_IconsBitmaps::_4355F7()
+void LODFile_IconsBitmaps::RemoveTexturesFromTextureList()
 {
-  LODFile_IconsBitmaps *v1; // esi@1
-  int v2; // edi@2
-  Texture *v3; // ebp@3
-  struct IDirect3DTexture2 **v4; // eax@4
-  struct IDirect3DTexture2 *v5; // eax@5
-  struct IDirectDrawSurface **v6; // eax@7
-  struct IDirectDrawSurface *v7; // eax@8
-  int v8; // eax@11
-
-  v1 = this;
   if ( this->uTexturePacksCount )
   {
-    v2 = this->uNumLoadedFiles - 1;
-    if ( v2 >= this->uNumPrevLoadedFiles )
+    if ( (this->uNumLoadedFiles - 1) >= this->uNumPrevLoadedFiles )
     {
-      v3 = &this->pTextures[v2];
-      do
+      for ( uint i = this->uNumLoadedFiles - 1; i >= this->uNumPrevLoadedFiles; --i )
       {
-        v3->Release();
-        v4 = v1->pHardwareTextures;
-        if ( v4 )
+        this->pTextures[i].Release();
+        if ( this->pHardwareTextures )
         {
-          v5 = v4[v2];
-          if ( v5 )
+          if ( this->pHardwareTextures[i] )
           {
-            v5->Release();
-            v1->pHardwareTextures[v2] = 0;
+            this->pHardwareTextures[i]->Release();
+            this->pHardwareTextures[i] = 0;
           }
         }
-        v6 = v1->pHardwareSurfaces;
-        if ( v6 )
+        if ( this->pHardwareSurfaces )
         {
-          v7 = v6[v2];
-          if ( v7 )
+          if ( this->pHardwareSurfaces[i] )
           {
-            v7->Release();
-            v1->pHardwareSurfaces[v2] = 0;
+            this->pHardwareSurfaces[i]->Release();
+            this->pHardwareSurfaces[i] = 0;
           }
         }
-        --v2;
-        --v3;
       }
-      while ( v2 >= v1->uNumPrevLoadedFiles );
     }
-    v8 = v1->uNumPrevLoadedFiles;
-    v1->uNumPrevLoadedFiles = 0;
-    v1->uNumLoadedFiles = v8;
-    v1->uTexturePacksCount = 0;
+    this->uNumLoadedFiles = this->uNumPrevLoadedFiles;
+    this->uNumPrevLoadedFiles = 0;
+    this->uTexturePacksCount = 0;
   }
 }
 
 //----- (004114F2) --------------------------------------------------------
-void LODFile_IconsBitmaps::ClearTextureList()
+void LODFile_IconsBitmaps::RemoveTexturesPackFromTextureList()
 {
   if ( this->uTexturePacksCount )
   {
--- a/LOD.h	Mon Jul 22 14:49:12 2013 +0600
+++ b/LOD.h	Mon Jul 22 15:23:43 2013 +0600
@@ -159,8 +159,8 @@
   int _410522(struct Texture *pDst, const char *pContainer, unsigned int uTextureType);
   void SetupPalettes(unsigned int uTargetRBits, unsigned int uTargetGBits, unsigned int uTargetBBits);
   void ReleaseAll2();
-  void ClearTextureList();
-  void _4355F7();
+  void RemoveTexturesPackFromTextureList();
+  void RemoveTexturesFromTextureList();
   void _inlined_sub0();
   void _inlined_sub1();
   void _inlined_sub2();
--- a/Party.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/Party.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -1238,7 +1238,7 @@
         pTexture_RestUI_CurrentHourglassFrame->Release();
       pTexture_RestUI_CurrentHourglassFrame = 0;
       pTexture_RestUI_CurrentSkyFrame = 0;
-      pIcons_LOD->ClearTextureList();
+      pIcons_LOD->RemoveTexturesPackFromTextureList();
       pIcons_LOD->SyncLoadedFilesCount();
       pCurrentScreen = SCREEN_GAME;
       viewparams->bRedrawGameUI = 1;
--- a/Player.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/Player.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -6198,7 +6198,7 @@
             {
             pMouse->RemoveHoldingItem();
             pGUIWindow_CurrentMenu->Release();
-            pIcons_LOD->ClearTextureList();
+            pIcons_LOD->RemoveTexturesPackFromTextureList();
             pCurrentScreen = SCREEN_GAME;
             viewparams->bRedrawGameUI = 1;
             _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0);
--- a/SaveLoad.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/SaveLoad.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -222,7 +222,7 @@
   for (uint i = 0; i < uNumSavegameFiles; ++i)
     pSavegameThumbnails[i].Release();
 
-  pIcons_LOD->ClearTextureList();
+  pIcons_LOD->RemoveTexturesPackFromTextureList();
   pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
   pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
   if (uTurnSpeed)
@@ -568,7 +568,7 @@
     pNew_LOD->_4621A7();
   else
     ShowStatusBarString(pGlobalTXT_LocalizationStrings[583], 2u);// "No saving in the Arena"
-  pIcons_LOD->_4355F7();
+  pIcons_LOD->RemoveTexturesFromTextureList();
   pEventTimer->Resume();
   ShowStatusBarString(pGlobalTXT_LocalizationStrings[656], 2u);// "Game Saved!"
   viewparams->bRedrawGameUI = true;
--- a/UI/Books/UISpellBook.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/UI/Books/UISpellBook.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -61,7 +61,7 @@
     pAutonoteFont = nullptr;
     pTexture_mapbordr->Release();
     pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
-    pIcons_LOD->ClearTextureList();
+    pIcons_LOD->RemoveTexturesPackFromTextureList();
     dword_506364 = 0;
     }
 
--- a/UI/UIBooks.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/UI/UIBooks.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -142,7 +142,7 @@
     pTextures_tabs[i][1]->Release();
   }
   pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
-  pIcons_LOD->ClearTextureList();
+  pIcons_LOD->RemoveTexturesPackFromTextureList();
 }
 
 
--- a/UI/UIMainMenu.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/UI/UIMainMenu.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -352,7 +352,7 @@
             pAllocator->FreeChunk(pFontQuick);
             pAllocator->FreeChunk(pFontCChar);
             pWindow_MainMenu->Release();
-            pIcons_LOD->ClearTextureList();
+            pIcons_LOD->RemoveTexturesPackFromTextureList();
             pTexture.Release();
             pTexture2.Release();
             return MENU_MAIN;     // return MENU_Main
--- a/UI/UIPartyCreation.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/UI/UIPartyCreation.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -741,7 +741,7 @@
   }
   pTexture_PCX.Release();
   pGUIWindow_CurrentMenu->Release();
-  pIcons_LOD->ClearTextureList();
+  pIcons_LOD->RemoveTexturesPackFromTextureList();
 
   int v1 = 0;
   memset(v20, 0, 32);
--- a/mm7_2.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/mm7_2.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -3475,7 +3475,7 @@
       {
         if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
         {
-          pIcons_LOD->ClearTextureList();
+          pIcons_LOD->RemoveTexturesPackFromTextureList();
           pGUIWindow_CurrentMenu->Release();
           pGUIWindow_CurrentMenu = 0;
           pCurrentScreen = SCREEN_GAME;
@@ -3534,7 +3534,7 @@
     pGUIWindow2 = 0;
   }
   pWindow_MainMenu->Release();
-  pIcons_LOD->ClearTextureList();
+  pIcons_LOD->RemoveTexturesPackFromTextureList();
 }
 
 //----- (004637EB) --------------------------------------------------------
--- a/mm7_5.cpp	Mon Jul 22 14:49:12 2013 +0600
+++ b/mm7_5.cpp	Mon Jul 22 15:23:43 2013 +0600
@@ -390,7 +390,7 @@
           if ( dword_6BE138 == 124 || uMessageParam )
           {
             pIcons_LOD->SyncLoadedFilesCount();
-            pIcons_LOD->ClearTextureList();
+            pIcons_LOD->RemoveTexturesPackFromTextureList();
             if ( pMessageQueue_50CBD0->uNumMessages )
               pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
             pGUIWindow_CurrentMenu->Release();
@@ -408,7 +408,7 @@
           continue;
         case UIMSG_Game_OpenLoadGameDialog:
           pIcons_LOD->SyncLoadedFilesCount();
-          pIcons_LOD->ClearTextureList();
+          pIcons_LOD->RemoveTexturesPackFromTextureList();
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           pGUIWindow_CurrentMenu->Release();
@@ -419,7 +419,7 @@
           if ( dword_6BE138 == 132 || uMessageParam )
           {
             pIcons_LOD->SyncLoadedFilesCount();
-            pIcons_LOD->ClearTextureList();
+            pIcons_LOD->RemoveTexturesPackFromTextureList();
             if ( pMessageQueue_50CBD0->uNumMessages )
               pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
             pGUIWindow_CurrentMenu->Release();
@@ -440,7 +440,7 @@
         case UIMSG_80:
 			__debugbreak();
           pIcons_LOD->SyncLoadedFilesCount();
-          pIcons_LOD->ClearTextureList();
+          pIcons_LOD->RemoveTexturesPackFromTextureList();
           pGUIWindow_CurrentMenu->Release();
           pCurrentScreen = SCREEN_OPTIONS;
           pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_8, 0, 0);
@@ -994,7 +994,7 @@
               {
                 if ( pCurrentScreen == SCREEN_QUICK_REFERENCE )
                 {
-                  pIcons_LOD->ClearTextureList();
+                  pIcons_LOD->RemoveTexturesPackFromTextureList();
                   if ( pGUIWindow_Settings )
                   {
                     if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1020,7 +1020,7 @@
                   pEventTimer->Resume();
                   pCurrentScreen = SCREEN_GAME;
                   viewparams->bRedrawGameUI = 1;
-                  pIcons_LOD->_4355F7();
+                  pIcons_LOD->RemoveTexturesFromTextureList();
                   continue;
                 }
               }
@@ -1031,7 +1031,7 @@
                   switch ( pCurrentScreen )
                   {
                     case SCREEN_CASTING:
-                      pIcons_LOD->ClearTextureList();
+                      pIcons_LOD->RemoveTexturesPackFromTextureList();
                       if ( some_active_character )
                       {
                         uActiveCharacter = some_active_character;
@@ -1074,7 +1074,7 @@
                        pEventTimer->Resume();
                        pCurrentScreen = SCREEN_GAME;
                        viewparams->bRedrawGameUI = 1;
-                       pIcons_LOD->_4355F7();
+                       pIcons_LOD->RemoveTexturesFromTextureList();
                        continue;
                     case SCREEN_BOOKS:
                       pBooksWindow->Release();
@@ -1106,11 +1106,11 @@
                       pEventTimer->Resume();
                       pCurrentScreen = SCREEN_GAME;
                       viewparams->bRedrawGameUI = 1;
-                      pIcons_LOD->_4355F7();
+                      pIcons_LOD->RemoveTexturesFromTextureList();
                       continue;
                     case SCREEN_SAVEGAME:
                     case SCREEN_LOADGAME:
-                      pIcons_LOD->ClearTextureList();
+                      pIcons_LOD->RemoveTexturesPackFromTextureList();
                       //crt_deconstruct_ptr_6A0118();
                       stru_506E40.Release();
                       break;
@@ -1120,7 +1120,7 @@
                     case SCREEN_CHEST:
                       pWindow2 = pChestWindow;
                       pWindow2->Release();
-                      pIcons_LOD->ClearTextureList();
+                      pIcons_LOD->RemoveTexturesPackFromTextureList();
                       pCurrentScreen = SCREEN_GAME;
                       viewparams->bRedrawGameUI = 1;
                       pEventTimer->Resume();
@@ -1129,7 +1129,7 @@
 						__debugbreak();
                       pWindow2 = ptr_507BC8;
                       pWindow2->Release();
-                      pIcons_LOD->ClearTextureList();
+                      pIcons_LOD->RemoveTexturesPackFromTextureList();
                       pCurrentScreen = SCREEN_GAME;
                       viewparams->bRedrawGameUI = 1;
                       pEventTimer->Resume();
@@ -1167,9 +1167,9 @@
                       break;
                     case SCREEN_MENU:
                       pIcons_LOD->SyncLoadedFilesCount();
-                      pIcons_LOD->ClearTextureList();
+                      pIcons_LOD->RemoveTexturesPackFromTextureList();
                       pIcons_LOD->SyncLoadedFilesCount();
-                      pIcons_LOD->ClearTextureList();
+                      pIcons_LOD->RemoveTexturesPackFromTextureList();
                       stru_506E40.Release();
                       break;
                     case SCREEN_VIDEO_OPTIONS:
@@ -1256,7 +1256,7 @@
                       pTexture_RestUI_CurrentHourglassFrame = 0;
                       pTexture_RestUI_CurrentSkyFrame = 0;
                       pIcons_LOD->SyncLoadedFilesCount();
-                      pIcons_LOD->ClearTextureList();
+                      pIcons_LOD->RemoveTexturesPackFromTextureList();
                       _506F18_num_minutes_to_sleep = 0;
                       dword_506F14 = 0;
                       dword_507B94 = 1;
@@ -1285,13 +1285,13 @@
                        pEventTimer->Resume();
                        pCurrentScreen = SCREEN_GAME;
                        viewparams->bRedrawGameUI = 1;
-                       pIcons_LOD->_4355F7();
+                       pIcons_LOD->RemoveTexturesFromTextureList();
                        continue;
                     case SCREEN_E:
 						__debugbreak();
                       pGUIWindow_CurrentMenu->Release();
                       pCurrentScreen = SCREEN_HOUSE;
-                      pIcons_LOD->ClearTextureList();
+                      pIcons_LOD->RemoveTexturesPackFromTextureList();
                       continue;
                     case SCREEN_HOUSE:
                       if ( uDialogueType )
@@ -1335,7 +1335,7 @@
                       pEventTimer->Resume();
                       pCurrentScreen = SCREEN_GAME;
                       viewparams->bRedrawGameUI = true;
-                      pIcons_LOD->_4355F7();
+                      pIcons_LOD->RemoveTexturesFromTextureList();
                       continue;
                     case SCREEN_INPUT_BLV://click escape
                       if ( uCurrentHouse_Animation == 153 )
@@ -1393,7 +1393,7 @@
                     case SCREEN_CHARACTERS:
                       CharacterUI_ReleaseButtons();
                       sub_419379();
-                      pIcons_LOD->ClearTextureList();
+                      pIcons_LOD->RemoveTexturesPackFromTextureList();
                       if ( pGUIWindow_Settings )
                       {
                         if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1419,7 +1419,7 @@
                       pEventTimer->Resume();
                       pCurrentScreen = SCREEN_GAME;
                       viewparams->bRedrawGameUI = true;
-                      pIcons_LOD->_4355F7();
+                      pIcons_LOD->RemoveTexturesFromTextureList();
                       continue;
                     default:
                       if ( pGUIWindow_Settings )
@@ -1447,7 +1447,7 @@
                       pEventTimer->Resume();
                       pCurrentScreen = SCREEN_GAME;
                       viewparams->bRedrawGameUI = 1;
-                      pIcons_LOD->_4355F7();
+                      pIcons_LOD->RemoveTexturesFromTextureList();
                       continue;
                   }
                   if ( pGUIWindow_Settings )
@@ -1475,12 +1475,12 @@
                   pEventTimer->Resume();
                   pCurrentScreen = SCREEN_GAME;
                   viewparams->bRedrawGameUI = true;
-                  pIcons_LOD->_4355F7();
+                  pIcons_LOD->RemoveTexturesFromTextureList();
                   continue;
                 }
                 CharacterUI_ReleaseButtons();
                 sub_419379();
-                pIcons_LOD->ClearTextureList();
+                pIcons_LOD->RemoveTexturesPackFromTextureList();
               }
               if ( pGUIWindow_Settings )
               {
@@ -1507,7 +1507,7 @@
               pEventTimer->Resume();
               pCurrentScreen = SCREEN_GAME;
               viewparams->bRedrawGameUI = true;
-              pIcons_LOD->_4355F7();
+              pIcons_LOD->RemoveTexturesFromTextureList();
               continue;
             }
             if ( !pGUIWindow_Settings )//Draw Menu
@@ -2745,7 +2745,7 @@
                   pEventTimer->Resume();
                   viewparams->bRedrawGameUI = 1;
                   pCurrentScreen = SCREEN_GAME;
-                  pIcons_LOD->ClearTextureList();
+                  pIcons_LOD->RemoveTexturesPackFromTextureList();
                   v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage;
                   /*if ( dword_50C9E8 < 40 )
                   {
@@ -3547,7 +3547,7 @@
           }
           if ( pCurrentScreen == SCREEN_LOADGAME )
           {
-            pIcons_LOD->ClearTextureList();
+            pIcons_LOD->RemoveTexturesPackFromTextureList();
             //crt_deconstruct_ptr_6A0118();
             pTexture_PCX.Release();
             pTexture_PCX.Load("title.pcx", 0);