changeset 129:fe45d65251a5

Слияние
author Ritor1
date Sun, 04 Nov 2012 17:04:05 +0600
parents 32805a956f49 (current diff) 67f843a23f8b (diff)
children 7b12505a23c0
files Outdoor.cpp
diffstat 2 files changed, 35 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/Outdoor.cpp	Sun Nov 04 17:03:51 2012 +0600
+++ b/Outdoor.cpp	Sun Nov 04 17:04:05 2012 +0600
@@ -2045,53 +2045,47 @@
     pNumItems = 29030400;
   if ( Str2 )
   {
-    __debugbreak();
-    //memset(Dst, 0, 0x3C8u);
-    //memset(Src, 0, 0x3C8u);
-    //goto LABEL_112;
+    memset(Dst, 0, 0x3C8u);
+    memset(Src, 0, 0x3C8u);
+    goto LABEL_112;
   }
   //v81 = ddm.uLastRepawnDay;
-  if ( (unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay )
+  if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay)
   {
-    __debugbreak();
-    /*
     memcpy(Dst, pSrc, 0x3C8u);
     memcpy(Src, pSrc + 968, 0x3C8u);
 LABEL_112:
     free(pSrcMem);
-    v25 = Str2 == 0;
+
     ddm.uLastRepawnDay = (int)File;
-    if ( v25 )
+    if (Str2 == 0)
       ++ddm.uNumRespawns;
     v108 = 0;
     *(int *)thisa = 1;
-    v151 = (int)pGames_LOD->FindContainer(pContainer, v108);
-    fread(&header, 0x10u, 1u, (FILE *)v151);
-    pFilename = (char *)header.uCompressedSize;
-    pDestLen = header.uDecompressedSize;
-    v82 = malloc(header.uDecompressedSize);
-    v149 = v82;
-    if ( (unsigned int)pFilename <= pDestLen )
+    v39 = pGames_LOD->FindContainer(Str, 0);
+    fread(&header, 0x10, 1u, v39);
+    //pFilename = (char *)header.uCompressedSize;
+    //pDestLen = header.uDecompressedSize;
+    //v82 = malloc(header.uDecompressedSize);
+    pSrcMem = (unsigned char *)malloc(header.uDecompressedSize);
+    //v149 = v82;
+    if (header.uCompressedSize == header.uDecompressedSize)
+      fread(pSrcMem, header.uDecompressedSize, 1, v39);
+    else if (header.uCompressedSize < header.uDecompressedSize)
     {
-      if ( pFilename == (const char *)pDestLen )
-      {
-        fread(v82, pDestLen, 1u, (FILE *)v151);
-      }
-      else
-      {
-        uSourceLen = malloc((size_t)pFilename);
-        fread(uSourceLen, (size_t)pFilename, 1u, (FILE *)v151);
-        zlib::MemUnzip(v82, &pDestLen, uSourceLen, (unsigned int)pFilename);
-        free(uSourceLen);
-      }
+      auto compressedMem = malloc(header.uCompressedSize);
+      fread(compressedMem, header.uCompressedSize, 1u, v39);
+
+      uint actualDecompressedSize = header.uDecompressedSize;
+      zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize);
+      free(compressedMem);
     }
     else
-    {
-          MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0);
-    }
-    v74 = (int)((char *)v82 + 40);
+      MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0);
+
+    pSrc = pSrcMem + 40;
     goto LABEL_120;
-    */
+
   }
   *(int *)thisa = 0;
 LABEL_120:
@@ -2108,7 +2102,6 @@
 
   if ( *(int *)thisa )
   {
-    __debugbreak();
     memcpy(array_528, Dst, 0x3C8u);
     memcpy(array_8F0, Src, 0x3C8u);
   }
--- a/PaletteManager.cpp	Sun Nov 04 17:03:51 2012 +0600
+++ b/PaletteManager.cpp	Sun Nov 04 17:04:05 2012 +0600
@@ -329,7 +329,7 @@
 
   v2 = this;
   v3 = (char *)this + 768 * a2;
-  if ( this->field_267AD3 || this->field_267AD4 || this->field_267AD5 )
+  if (pPalette_tintColor[0] || pPalette_tintColor[1] || pPalette_tintColor[2])
   {
     v8 = 0;
     i = 0;
@@ -338,13 +338,13 @@
       v9 = (float *)((char *)v63 + v8);
       v10 = (float *)((char *)a6 + v8);
       v11 = (float *)((char *)v64 + v8);
-      v12 = v2->field_267AD4;
-      LODWORD(v75) = v2->field_267AD5 + (unsigned __int8)v3[2];
+      v12 = pPalette_tintColor[1];
+      LODWORD(v75) = pPalette_tintColor[2] + (unsigned __int8)v3[2];
       v13 = v12 + (unsigned __int8)v3[1];
       LODWORD(v14) = (unsigned __int8)*v3;
       v15 = (double)SLODWORD(v75) * 0.00196078431372549;
       LODWORD(v75) = v13;
-      LODWORD(v75) = LODWORD(v14) + v2->field_267AD3;
+      LODWORD(v75) = LODWORD(v14) + pPalette_tintColor[0];
       v16 = (double)v13 * 0.00196078431372549;
       v17 = (double)SLODWORD(v75) * 0.00196078431372549;
       RGB2HSV(v11, v9, v17, v16, v15, v10);
@@ -500,12 +500,12 @@
     i += 4;
   }
   while ( v18 ^ v19 );
-  v45 = v2->field_267AD0;
-  if ( v45 || v2->field_267AD1 || v2->field_267AD2 )
+  v45 = pPalette_mistColor[0];
+  if (v45 || pPalette_mistColor[1] || pPalette_mistColor[2])
   {
     v46 = (double)v45;
-    v80 = v2->field_267AD1;
-    v47 = v2->field_267AD2;
+    v80 = pPalette_mistColor[1];
+    v47 = pPalette_mistColor[2];
     v70 = v46 * 0.00392156862745098;
     *((float *)&v71 + 1) = (double)v80 * 0.00392156862745098;
     v75 = (double)v47 * 0.00392156862745098;
@@ -538,7 +538,7 @@
         a2a = a2a * 31.0;
         a3 = a3 * 31.0;
       }
-      if ( v2->field_267AD0 || v2->field_267AD1 || v2->field_267AD2 )
+      if (pPalette_mistColor[0] || pPalette_mistColor[1] || pPalette_mistColor[2])
       {
         v55 = (double)v72 * 0.03225806451612903;
         v52 = (signed __int64)((double)(1 << v2->uNumTargetRBits) * v70 * v55 + a1 * (1.0 - v55));