diff mm7_4.cpp @ 73:f6758e4c6506

Слияние
author Ritor1
date Sat, 27 Oct 2012 23:53:04 +0600
parents 636f4dbd156d efefae49c990
children 08ab7b5b85d8
line wrap: on
line diff
--- a/mm7_4.cpp	Sat Oct 27 23:52:40 2012 +0600
+++ b/mm7_4.cpp	Sat Oct 27 23:53:04 2012 +0600
@@ -2813,47 +2813,26 @@
 
 
 //----- (0048A959) --------------------------------------------------------
-unsigned int sub_48A959(int _this, float a2, float a3, float a4)
-{
-  int v4; // esi@1
-  double v5; // st6@1
-  double v6; // st6@1
-  __int64 v8; // [sp+14h] [bp-20h]@1
-  double v9; // [sp+1Ch] [bp-18h]@1
-  int a6; // [sp+24h] [bp-10h]@1
-  float v11; // [sp+28h] [bp-Ch]@1
-  float v12; // [sp+2Ch] [bp-8h]@1
-  float a1; // [sp+30h] [bp-4h]@1
-  float a2a; // [sp+3Ch] [bp+8h]@7
-  float a2b; // [sp+3Ch] [bp+8h]@7
-  float a2c; // [sp+3Ch] [bp+8h]@7
-  int a3a; // [sp+40h] [bp+Ch]@7
-
-  v4 = _this;
-  v8 = ((unsigned int)_this >> 16) & 0xFFi64;
-  v5 = (double)v8 * 0.0039215689;
-  v8 = (unsigned __int16)_this >> 8;
-  a1 = v5;
-  v6 = (double)v8;
-  v8 = _this & 0xFFi64;
-  v12 = v6 * 0.0039215689;
-  v11 = (double)v8 * 0.0039215689;
-  RGB2HSV((float *)&v8 + 1, (float *)&v9 + 1, a1, v12, v11, (float *)&a6);
-  if ( a2 != -1.0 )
-    HIDWORD(v8) = LODWORD(a2);
-  if ( a3 != -1.0 )
-    HIDWORD(v9) = LODWORD(a3);
-  if ( a4 != -1.0 )
-    a6 = LODWORD(a4);
-  HSV2RGB(&a1, &v12, &v11, *((float *)&v8 + 1), *((float *)&v9 + 1), *(float *)&a6);
-  a2a = a1 * 255.0;
-  *(double *)&v8 = a2a + 6.7553994e15;
-  a3a = v8;
-  a2b = v12 * 255.0;
-  *(double *)&v8 = a2b + 6.7553994e15;
-  a2c = v11 * 255.0;
-  v9 = a2c + 6.7553994e15;
-  return LODWORD(v9) | v4 & 0xFF000000 | (((unsigned int)v8 | (a3a << 8)) << 8);
+unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace)
+{
+  float r = ((uColor & 0x00FF0000) >> 16) / 255.0f,
+        g = ((uColor & 0x0000FF00) >> 8) / 255.0f,
+        b = (uColor & 0x000000FF) / 255.0f;
+
+  float h, s, v;
+  RGB2HSV(&h, &s, r, g, b, &v);
+
+  if ( h_replace != -1.0 )
+    h = h_replace;
+  if ( s_replace != -1.0 )
+    s = s_replace;
+  if ( v_replace != -1.0 )
+    v = v_replace;
+  HSV2RGB(&r, &g, &b, h, s, v);
+
+  return (((uint)floorf(r * 255.0f + 0.5f) & 0xFF) << 16) |
+         (((uint)floorf(g * 255.0f + 0.5f) & 0xFF) << 8) |
+         ((uint)floorf(b * 255.0f + 0.5f) & 0xFF);
 }
 
 
@@ -5454,8 +5433,8 @@
   //if (uPlayerCreationUI_ArrowAnim < 0)
   //  uPlayerCreationUI_ArrowAnim = 18;
 
-  v6 = LOBYTE(pFontCreate->uFontHeight) - 2;
-  v128 = LOBYTE(pFontCreate->uFontHeight) - 2;
+  v6 = pFontCreate->uFontHeight - 2;
+  v128 = pFontCreate->uFontHeight - 2;
   strcpy(Str1, pGlobalTXT_LocalizationStrings[205]);// "Skills"
   uNumLet = strlen(Str1) - 1;
   v134 = uNumLet;
@@ -7300,12 +7279,12 @@
         v2 = Dst.lpSurface;
 
 
-        for (uint y = 0; y < 480; ++y)
+        /*for (uint y = 0; y < 480; ++y)
         {
           auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch);
           for (uint x = 0; x < 640; ++x)
             pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask;
-        }
+        }*/
         
         auto pSrc = pRenderer->pTargetSurface;
         auto pDst = (__int16 *)Dst.lpSurface;
@@ -7344,9 +7323,16 @@
         v13 = v24;
 
         for (uint y = pViewport->uViewportY; y < pViewport->uViewportW; ++y)
-          memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2,
-                 pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16));
-        
+        {
+          //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2,
+          //       pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16));
+          for (uint x = pViewport->uViewportX; x < pViewport->uViewportZ; ++x)
+          {
+            if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask))
+              pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x];
+          }
+        }
+
               ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
 
        /* while ( 1 )