diff Texture.cpp @ 6:82f81d5b7221

Слияние
author Серик@ПончиК
date Tue, 09 Oct 2012 20:00:24 +0600
parents ac0fb48cd27a
children 93bf1d5f6a6d 77de07f99e03
line wrap: on
line diff
--- a/Texture.cpp	Tue Oct 09 20:00:01 2012 +0600
+++ b/Texture.cpp	Tue Oct 09 20:00:24 2012 +0600
@@ -306,7 +306,7 @@
       v3->pTextures[i].uTextureID = pBitmaps_LOD->LoadTexture(v3->pTextures[i].pTextureName, TEXTURE_DEFAULT);
       auto pTex = (v3->pTextures[i].uTextureID != -1 ? &pBitmaps_LOD->pTextures[v3->pTextures[i].uTextureID] : 0);
       if (pTex)
-        pTex->palette = pPaletteManager->LoadPalette(pTex->palette);
+        pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1);
       result = (unsigned int)v3->pTextures;
       if ( !(*(char *)(result + i * 20 + 18) & 1) )
         break;
@@ -402,34 +402,34 @@
 //----- (0040F77C) --------------------------------------------------------
 void Texture::Release()
 {
-  Texture *v1; // esi@1
-  char v2; // zf@2
+  if (this)
+  {
+    pName[0] = 0;
 
-  v1 = this;
-  if ( this )
-  {
-    v2 = (pBits & 0x0400) == 0;
-    this->pName[0] = 0;
-    if ( v2 )
+    if (pBits & 0x0400)
     {
       pAllocator->FreeChunk(pLevelOfDetail0);
       pAllocator->FreeChunk(pPalette16);
       pAllocator->FreeChunk(pPalette24);
     }
-    v1->pLevelOfDetail0 = 0;
-    v1->pLevelOfDetail1 = 0;
-    v1->pLevelOfDetail2 = 0;
-    v1->pLevelOfDetail3 = 0;
-    v1->pPalette16 = 0;
-    v1->pPalette24 = 0;
-    v1->uSizeOfMaxLevelOfDetail = 0;
-    v1->uTextureSize = 0;
-    v1->uTextureHeight = 0;
-    v1->uTextureWidth = 0;
-    v1->uHeightLn2 = 0;
-    v1->uWidthLn2 = 0;
-    v1->palette = 0;
-    LOWORD(v1->pBits) = 0;
+
+    pLevelOfDetail0 = nullptr;
+    pLevelOfDetail1 = nullptr;
+    pLevelOfDetail2 = nullptr;
+    pLevelOfDetail3 = nullptr;
+
+    pPalette16 = nullptr;
+    pPalette24 = nullptr;
+
+    uSizeOfMaxLevelOfDetail = 0;
+    uTextureSize = 0;
+    uTextureHeight = 0;
+    uTextureWidth = 0;
+    uHeightLn2 = 0;
+    uWidthLn2 = 0;
+    palette_id1 = 0;
+    palette_id2 = 0;
+    pBits &= 0xFFFF0000;
   }
 }
 
@@ -506,20 +506,21 @@
 //----- (0040F5BE) --------------------------------------------------------
 Texture::Texture()
 {
-  this->pName[0] = 0;
-  this->uSizeOfMaxLevelOfDetail = 0;
-  this->uTextureSize = 0;
-  this->uTextureHeight = 0;
-  this->uTextureWidth = 0;
-  this->uHeightLn2 = 0;
-  this->uWidthLn2 = 0;
-  this->palette = 0;
-  this->pLevelOfDetail0 = 0;
-  this->pLevelOfDetail3 = 0;
-  this->pLevelOfDetail2 = 0;
-  this->pLevelOfDetail1 = 0;
-  this->pPalette16 = 0;
-  this->pPalette24 = 0;
+  pName[0] = 0;
+  uSizeOfMaxLevelOfDetail = 0;
+  uTextureSize = 0;
+  uTextureHeight = 0;
+  uTextureWidth = 0;
+  uHeightLn2 = 0;
+  uWidthLn2 = 0;
+  palette_id1 = 0;
+  palette_id2 = 0;
+  pLevelOfDetail0 = 0;
+  pLevelOfDetail3 = 0;
+  pLevelOfDetail2 = 0;
+  pLevelOfDetail1 = 0;
+  pPalette16 = 0;
+  pPalette24 = 0;
 }
 
 //----- (0040F414) --------------------------------------------------------