changeset 118:a2715ce5cf17

sub_47F4D3
author Nomad
date Tue, 13 Nov 2012 17:37:06 +0200
parents a64b244da76c
children 2546de5c70dd acf7f12714a7 6d1f537a1346
files mm7_3.cpp
diffstat 1 files changed, 31 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_3.cpp	Tue Nov 13 17:29:38 2012 +0200
+++ b/mm7_3.cpp	Tue Nov 13 17:37:06 2012 +0200
@@ -9159,35 +9159,37 @@
 void __fastcall sub_47F4D3(int band1, int band2, int band3)
 {
   int v3; // edi@1
-  stru220 *v4; // esi@1
+  //stru220 *v4; // esi@1
   double v5; // ST2C_8@3
   double v6; // st7@3
-  double v7; // [sp+18h] [bp-28h]@3
-  double v8; // [sp+20h] [bp-20h]@2
+  //double v7; // [sp+18h] [bp-28h]@3
+  //double v8; // [sp+20h] [bp-20h]@2
   int v9; // [sp+34h] [bp-Ch]@1
   int v10; // [sp+38h] [bp-8h]@1
-  signed int band3a; // [sp+48h] [bp+8h]@2
-
-  v9 = band2 << 9;
+  //signed int band3a; // [sp+48h] [bp+8h]@2
+
+  v9 = band2 * 512;
   pOutdoorCamera->outdoor_grid_band_3 = band3;
-  v10 = band1 << 9;
-  v3 = band3 << 9;
-  pOutdoorCamera->uPickDepth = band3 << 9;
-  v4 = stru_76E5C8;                             // v4:  0 -> 65536
-  do
-  {
-    band3a = 256;
-    v8 = (double)(signed int)((char *)v4 + 256 - (int)stru_76E5C8);
-    do                                          // band3a: 0 -> 128
-    {
-      v5 = pow((double)band3a, 2.0);
-      v6 = pow(v8, 2.0);
-      *((float *)&v5 + 1) = sqrt(v6 + v5);
-      v7 = *((float *)&v5 + 1) + 6.7553994e15;
-      if ( SLODWORD(v7) >= v10 )
-      {
-        if ( SLODWORD(v7) >= v9 )
-          v4->field_0 = ((SLODWORD(v7) >= v3) - 1) & 2;
+  v10 = band1 * 512;
+  v3 = band3 * 512;
+  pOutdoorCamera->uPickDepth = band3 * 512;
+  //v4 = stru_76E5C8;                             // v4:  0 -> 65536
+  for (uint i = 0; i < 16384; ++i)
+  //do
+  {
+    auto v4 = stru_76E5C8 + i;
+    //band3a = 256;
+    //v8 = (double)(signed int)((char *)v4 + 256 - (int)stru_76E5C8);
+    for (uint j = 0; j < 128; ++j)                  // band3a: 0 -> 128
+    {
+      v5 = pow(j * 512 + 256, 2.0);
+      v6 = pow(i * 4 + 256, 2.0);
+      //*((float *)&v5 + 1) = sqrt(v6 + v5);
+      int v7 = floorf(sqrtf(v5 + v6) + 0.5f);//*((float *)&v5 + 1) + 6.7553994e15;
+      if (v7 >= v10)
+      {
+        if (v7 >= v9)
+          v4->field_0 = ((v7 >= v3) - 1) & 2;
         else
           v4->field_0 = 2;
       }
@@ -9195,13 +9197,13 @@
       {
         v4->field_0 = 1;
       }
-      band3a += 512;
-      v4->distance = LOWORD(v7);
+      //band3a += 512;
+      v4->distance = v7;
       ++v4;
     }
-    while ( band3a < 65792 );
-  }
-  while ( (signed int)v4 < (signed int)arary_77E5C8 );
+    //while ( band3a < 65792 );
+  }
+  //while ( (signed int)v4 < (signed int)arary_77E5C8 );
 }