changeset 1404:7cc3b01a92ac

ClearTextureList
author Ritor1
date Mon, 22 Jul 2013 14:49:12 +0600
parents d3c5f28a0ca5
children c0b273d33338
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, 45 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/Chest.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/Chest.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -228,7 +228,7 @@
       word_A750E0 = 5;
       word_A750E2 = uActiveCharacter;
     }
-    pIcons_LOD->_4114F2();
+    pIcons_LOD->ClearTextureList();
     dword_507CD8 = 0;
     return 0;
   }
--- a/GUIWindow.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/GUIWindow.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -304,7 +304,7 @@
 		pTexture_Dialogue_Background->Release();
 
 		pIcons_LOD->SyncLoadedFilesCount();
-		pIcons_LOD->_4114F2();
+		pIcons_LOD->ClearTextureList();
 		dword_5C35D4 = 0;
 		if ( bFlipOnExit )
 		{
--- a/LOD.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/LOD.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -131,64 +131,38 @@
 }
 
 //----- (004114F2) --------------------------------------------------------
-void LODFile_IconsBitmaps::_4114F2()
+void LODFile_IconsBitmaps::ClearTextureList()
 {
-  //LODFile_IconsBitmaps *v1; // esi@1
-  int *pTexturePacksCount; // eax@1
-  int v3; // ecx@1
-  int v4; // ecx@2
-  int v5; // edi@3
-  Texture *v6; // ebx@4
-  struct IDirect3DTexture2 **v7; // eax@5
-  struct IDirect3DTexture2 *v8; // eax@6
-  struct IDirectDrawSurface **v9; // eax@8
-  struct IDirectDrawSurface *v10; // eax@9
-  int v11; // eax@12
-
-  //v1 = this;
-  pTexturePacksCount = &this->uTexturePacksCount;
-  v3 = this->uTexturePacksCount;
-  if ( v3 )
+  if ( this->uTexturePacksCount )
   {
-    v4 = v3 - 1;
-    *pTexturePacksCount = v4;
-    if ( !v4 )
+    this->uTexturePacksCount--;
+    if ( !this->uTexturePacksCount )
     {
-      v5 = this->uNumLoadedFiles - 1;
-      if ( v5 >= this->uNumPrevLoadedFiles )
+      if ( (this->uNumLoadedFiles - 1) >= this->uNumPrevLoadedFiles )
       {
-        v6 = &this->pTextures[v5];
-        do
+        for ( uint i = this->uNumLoadedFiles - 1; i >= this->uNumPrevLoadedFiles; --i )
         {
-          v6->Release();
-          v7 = this->pHardwareTextures;
-          if ( v7 )
+          this->pTextures[i].Release();
+          if ( this->pHardwareTextures )
           {
-            v8 = v7[v5];
-            if ( v8 )
+            if ( this->pHardwareTextures[i] )
             {
-              v8->Release();
-              this->pHardwareTextures[v5] = 0;
+              this->pHardwareTextures[i]->Release();
+              this->pHardwareTextures[i] = 0;
             }
           }
-          v9 = this->pHardwareSurfaces;
-          if ( v9 )
+          if ( this->pHardwareSurfaces )
           {
-            v10 = v9[v5];
-            if ( v10 )
+            if ( this->pHardwareSurfaces[i] )
             {
-              v10->Release();
-              this->pHardwareSurfaces[v5] = 0;
+              this->pHardwareSurfaces[i]->Release();
+              this->pHardwareSurfaces[i] = 0;
             }
           }
-          --v5;
-          --v6;
         }
-        while ( v5 >= this->uNumPrevLoadedFiles );
       }
-      v11 = this->uNumPrevLoadedFiles;
+      this->uNumLoadedFiles = this->uNumPrevLoadedFiles;
       this->uNumPrevLoadedFiles = 0;
-      this->uNumLoadedFiles = v11;
     }
   }
 }
--- a/LOD.h	Fri Jul 19 17:22:49 2013 +0600
+++ b/LOD.h	Mon Jul 22 14:49:12 2013 +0600
@@ -159,7 +159,7 @@
   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 _4114F2();
+  void ClearTextureList();
   void _4355F7();
   void _inlined_sub0();
   void _inlined_sub1();
--- a/Party.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/Party.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -1238,7 +1238,7 @@
         pTexture_RestUI_CurrentHourglassFrame->Release();
       pTexture_RestUI_CurrentHourglassFrame = 0;
       pTexture_RestUI_CurrentSkyFrame = 0;
-      pIcons_LOD->_4114F2();
+      pIcons_LOD->ClearTextureList();
       pIcons_LOD->SyncLoadedFilesCount();
       pCurrentScreen = SCREEN_GAME;
       viewparams->bRedrawGameUI = 1;
--- a/Player.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/Player.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -6198,7 +6198,7 @@
             {
             pMouse->RemoveHoldingItem();
             pGUIWindow_CurrentMenu->Release();
-            pIcons_LOD->_4114F2();
+            pIcons_LOD->ClearTextureList();
             pCurrentScreen = SCREEN_GAME;
             viewparams->bRedrawGameUI = 1;
             _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0);
--- a/SaveLoad.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/SaveLoad.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -222,7 +222,7 @@
   for (uint i = 0; i < uNumSavegameFiles; ++i)
     pSavegameThumbnails[i].Release();
 
-  pIcons_LOD->_4114F2();
+  pIcons_LOD->ClearTextureList();
   pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
   pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
   if (uTurnSpeed)
--- a/UI/Books/UISpellBook.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/UI/Books/UISpellBook.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -61,7 +61,7 @@
     pAutonoteFont = nullptr;
     pTexture_mapbordr->Release();
     pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
-    pIcons_LOD->_4114F2();
+    pIcons_LOD->ClearTextureList();
     dword_506364 = 0;
     }
 
--- a/UI/UIBooks.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/UI/UIBooks.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -142,7 +142,7 @@
     pTextures_tabs[i][1]->Release();
   }
   pAudioPlayer->PlaySound(SOUND_CloseBook, 0, 0, -1, 0, 0, 0, 0);
-  pIcons_LOD->_4114F2();
+  pIcons_LOD->ClearTextureList();
 }
 
 
--- a/UI/UIMainMenu.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/UI/UIMainMenu.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -352,7 +352,7 @@
             pAllocator->FreeChunk(pFontQuick);
             pAllocator->FreeChunk(pFontCChar);
             pWindow_MainMenu->Release();
-            pIcons_LOD->_4114F2();
+            pIcons_LOD->ClearTextureList();
             pTexture.Release();
             pTexture2.Release();
             return MENU_MAIN;     // return MENU_Main
--- a/UI/UIPartyCreation.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/UI/UIPartyCreation.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -741,7 +741,7 @@
   }
   pTexture_PCX.Release();
   pGUIWindow_CurrentMenu->Release();
-  pIcons_LOD->_4114F2();
+  pIcons_LOD->ClearTextureList();
 
   int v1 = 0;
   memset(v20, 0, 32);
--- a/mm7_2.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/mm7_2.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -3475,7 +3475,7 @@
       {
         if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
         {
-          pIcons_LOD->_4114F2();
+          pIcons_LOD->ClearTextureList();
           pGUIWindow_CurrentMenu->Release();
           pGUIWindow_CurrentMenu = 0;
           pCurrentScreen = SCREEN_GAME;
@@ -3534,7 +3534,7 @@
     pGUIWindow2 = 0;
   }
   pWindow_MainMenu->Release();
-  pIcons_LOD->_4114F2();
+  pIcons_LOD->ClearTextureList();
 }
 
 //----- (004637EB) --------------------------------------------------------
--- a/mm7_5.cpp	Fri Jul 19 17:22:49 2013 +0600
+++ b/mm7_5.cpp	Mon Jul 22 14:49:12 2013 +0600
@@ -390,7 +390,7 @@
           if ( dword_6BE138 == 124 || uMessageParam )
           {
             pIcons_LOD->SyncLoadedFilesCount();
-            pIcons_LOD->_4114F2();
+            pIcons_LOD->ClearTextureList();
             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->_4114F2();
+          pIcons_LOD->ClearTextureList();
           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->_4114F2();
+            pIcons_LOD->ClearTextureList();
             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->_4114F2();
+          pIcons_LOD->ClearTextureList();
           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->_4114F2();
+                  pIcons_LOD->ClearTextureList();
                   if ( pGUIWindow_Settings )
                   {
                     if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1031,7 +1031,7 @@
                   switch ( pCurrentScreen )
                   {
                     case SCREEN_CASTING:
-                      pIcons_LOD->_4114F2();
+                      pIcons_LOD->ClearTextureList();
                       if ( some_active_character )
                       {
                         uActiveCharacter = some_active_character;
@@ -1110,7 +1110,7 @@
                       continue;
                     case SCREEN_SAVEGAME:
                     case SCREEN_LOADGAME:
-                      pIcons_LOD->_4114F2();
+                      pIcons_LOD->ClearTextureList();
                       //crt_deconstruct_ptr_6A0118();
                       stru_506E40.Release();
                       break;
@@ -1120,7 +1120,7 @@
                     case SCREEN_CHEST:
                       pWindow2 = pChestWindow;
                       pWindow2->Release();
-                      pIcons_LOD->_4114F2();
+                      pIcons_LOD->ClearTextureList();
                       pCurrentScreen = SCREEN_GAME;
                       viewparams->bRedrawGameUI = 1;
                       pEventTimer->Resume();
@@ -1129,7 +1129,7 @@
 						__debugbreak();
                       pWindow2 = ptr_507BC8;
                       pWindow2->Release();
-                      pIcons_LOD->_4114F2();
+                      pIcons_LOD->ClearTextureList();
                       pCurrentScreen = SCREEN_GAME;
                       viewparams->bRedrawGameUI = 1;
                       pEventTimer->Resume();
@@ -1167,9 +1167,9 @@
                       break;
                     case SCREEN_MENU:
                       pIcons_LOD->SyncLoadedFilesCount();
-                      pIcons_LOD->_4114F2();
+                      pIcons_LOD->ClearTextureList();
                       pIcons_LOD->SyncLoadedFilesCount();
-                      pIcons_LOD->_4114F2();
+                      pIcons_LOD->ClearTextureList();
                       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->_4114F2();
+                      pIcons_LOD->ClearTextureList();
                       _506F18_num_minutes_to_sleep = 0;
                       dword_506F14 = 0;
                       dword_507B94 = 1;
@@ -1291,7 +1291,7 @@
 						__debugbreak();
                       pGUIWindow_CurrentMenu->Release();
                       pCurrentScreen = SCREEN_HOUSE;
-                      pIcons_LOD->_4114F2();
+                      pIcons_LOD->ClearTextureList();
                       continue;
                     case SCREEN_HOUSE:
                       if ( uDialogueType )
@@ -1393,7 +1393,7 @@
                     case SCREEN_CHARACTERS:
                       CharacterUI_ReleaseButtons();
                       sub_419379();
-                      pIcons_LOD->_4114F2();
+                      pIcons_LOD->ClearTextureList();
                       if ( pGUIWindow_Settings )
                       {
                         if ( pCurrentScreen == SCREEN_CHARACTERS )
@@ -1480,7 +1480,7 @@
                 }
                 CharacterUI_ReleaseButtons();
                 sub_419379();
-                pIcons_LOD->_4114F2();
+                pIcons_LOD->ClearTextureList();
               }
               if ( pGUIWindow_Settings )
               {
@@ -2745,7 +2745,7 @@
                   pEventTimer->Resume();
                   viewparams->bRedrawGameUI = 1;
                   pCurrentScreen = SCREEN_GAME;
-                  pIcons_LOD->_4114F2();
+                  pIcons_LOD->ClearTextureList();
                   v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage;
                   /*if ( dword_50C9E8 < 40 )
                   {
@@ -3547,7 +3547,7 @@
           }
           if ( pCurrentScreen == SCREEN_LOADGAME )
           {
-            pIcons_LOD->_4114F2();
+            pIcons_LOD->ClearTextureList();
             //crt_deconstruct_ptr_6A0118();
             pTexture_PCX.Release();
             pTexture_PCX.Load("title.pcx", 0);