diff Outdoor.cpp @ 2132:49de109bbab5

SavePCXScreenshot() continue
author Ritor1
date Sun, 29 Dec 2013 01:26:15 +0600
parents de5cdcb03fda
children 4c0c475917dd
line wrap: on
line diff
--- a/Outdoor.cpp	Sat Dec 28 16:49:21 2013 +0600
+++ b/Outdoor.cpp	Sun Dec 29 01:26:15 2013 +0600
@@ -1001,7 +1001,6 @@
   signed int result; // eax@2
   unsigned __int16 *v5; // edx@3
   double v6; // st7@3
-  char v7; // bl@3
   int v8; // eax@3
   int v9; // eax@4
   int v10; // eax@5
@@ -1012,10 +1011,6 @@
   signed int v15; // ecx@10
   char v16[256]; // [sp+4h] [bp-124h]@9
   unsigned __int16 *v17; // [sp+104h] [bp-24h]@3
-  unsigned int v18; // [sp+108h] [bp-20h]@3
-  unsigned int v19; // [sp+10Ch] [bp-1Ch]@3
-  unsigned int v20; // [sp+110h] [bp-18h]@3
-  unsigned int v21; // [sp+114h] [bp-14h]@3
   float v22; // [sp+118h] [bp-10h]@3
   float v23; // [sp+11Ch] [bp-Ch]@3
   int i; // [sp+120h] [bp-8h]@3
@@ -1025,23 +1020,25 @@
   float a3a; // [sp+138h] [bp+10h]@7
   int a3b; // [sp+138h] [bp+10h]@9
 
+  int num_r_bits = 5;
+  int num_g_bits = 6;
+  int num_b_bits = 5;
+
+  int r_mask = 0xF800;
+  int g_mask = 0x7E0;
+  int b_mask = 0x1F;
+
   if ( pRenderer->pRenderD3D )
-  {
     result = 0;
-  }
   else
   {
+    __debugbreak();
     v5 = PaletteManager::Get_Dark_or_Red_LUT(a2, 0, 1);
     v6 = 0.0;
-    v7 = LOBYTE(pRenderer->uTargetBBits);
-    v19 = pRenderer->uTargetRMask;
-    v21 = pRenderer->uTargetGMask;
     v22 = 0.0;
-    v20 = pRenderer->uTargetBMask;
     v8 = 0;
     v17 = v5;
     v23 = 0.0;
-    v18 = pRenderer->uTargetBBits;
     a2a = 0;
     for ( i = 0; i < a3; ++i )
     {
@@ -1049,11 +1046,11 @@
       if ( v9 )
       {
         v10 = v5[v9];
-        v6 = v6 + (double)((signed int)(v19 & v10) >> (LOBYTE(pRenderer->uTargetBBits) + LOBYTE(pRenderer->uTargetGBits)));
+        v6 = v6 + (double)((signed int)(r_mask & v10) >> (num_b_bits + num_g_bits));
         ++a2a;
-        v25 = v20 & v10;
-        v22 = (double)((signed int)(v21 & v10) >> SLOBYTE(pRenderer->uTargetBBits)) + v22;
-        v23 = (double)(signed int)(v20 & v10) + v23;
+        v25 = b_mask & v10;
+        v22 = (double)((signed int)(g_mask & v10) >> num_b_bits) + v22;
+        v23 = (double)(signed int)(b_mask & v10) + v23;
       }
       v8 = i + 1;
     }
@@ -1062,16 +1059,15 @@
     v25 = (signed __int64)(a3a * v22);
     i = (signed __int64)(a3a * v23);
     v12 = 0;
-    a2b = pRenderer->uTargetBBits + pRenderer->uTargetGBits;
+    a2b = num_b_bits + num_g_bits;
     while ( 1 )
     {
       v13 = v17[v12];
-      a3b = abs((__int64)(signed __int64)(v11 * v6) - ((signed int)(v19 & v17[v12]) >> a2b));
-      BYTE3(a3b) = abs((signed)v25 - ((signed int)(v21 & v13) >> v7)) + a3b;
-      v16[v12++] = abs((signed)i - (signed)(v20 & v13)) + BYTE3(a3b);
+      a3b = abs((__int64)(signed __int64)(v11 * v6) - ((signed int)(r_mask & v17[v12]) >> a2b));
+      BYTE3(a3b) = abs((signed)v25 - ((signed int)(g_mask & v13) >> num_b_bits)) + a3b;
+      v16[v12++] = abs((signed)i - (signed)(b_mask & v13)) + BYTE3(a3b);
       if ( v12 >= 256 )
         break;
-      v7 = v18;
     }
     result = 0;
     v14 = (char *)&pPaletteManager->field_D1600[42][23][116];