diff mm7_4.cpp @ 730:79ad0526166c

Some data movements.
author Nomad
date Fri, 22 Mar 2013 10:52:19 +0200
parents 8323734d58c8
children de482c901171
line wrap: on
line diff
--- a/mm7_4.cpp	Fri Mar 22 00:27:11 2013 +0200
+++ b/mm7_4.cpp	Fri Mar 22 10:52:19 2013 +0200
@@ -268,7 +268,13 @@
   signed int v54; // [sp+30h] [bp-10h]@41
   signed int v55; // [sp+34h] [bp-Ch]@1
 
-  LOG_DECOMPILATION_WARNING();
+  //LOG_DECOMPILATION_WARNING();
+
+  static int blv_floor_id[50]; // 00721200
+  static int blv_floor_level[50]; // 007212C8
+
+  static __int16 word_721390_ys[104]; // idb
+  static __int16 word_721460_xs[104]; // idb
 
   auto pSector = &pIndoor->pSectors[uSectorID];
   v55 = 1;
@@ -283,16 +289,16 @@
     {
       for (uint j = 0; j < pFloor->uNumVertices; ++j)
       {
-        word_721460[2 * j] =     pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x;
-        word_721460[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x;
-        word_721390[2 * j] =     pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y;
-        word_721390[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y;
+        word_721460_xs[2 * j] =     pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x;
+        word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x;
+        word_721390_ys[2 * j] =     pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y;
+        word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y;
       }
       v44 = 2 * pFloor->uNumVertices;
-      word_721460[2 * pFloor->uNumVertices] = word_721460[0];
-      word_721390[2 * pFloor->uNumVertices] = word_721390[0];
-
-      v48 = word_721390[0] >= y;
+      word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0];
+      word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0];
+
+      v48 = word_721390_ys[0] >= y;
       v53 = 0;
       if ( pFloor->uNumVertices > 0 )
       {
@@ -300,36 +306,33 @@
         {
           if ( v53 >= 2 )
             break;
-          v50 = word_721390[i + 1] >= y;
-          if ( v48 == v50 )
+          v50 = word_721390_ys[i + 1] >= y;
+
+          v13 = i;
+          if ( v48 != v50 )
           {
-            v13 = i;
-          }
-          else
-          {
-            v13 = i;
-            v14 = word_721460[i + 1] >= x ? 0 : 2;
-            v15 = v14 | word_721460[i] < x;
+            v14 = word_721460_xs[i + 1] >= x ? 0 : 2;
+            v15 = v14 | word_721460_xs[i] < x;
 
             if ( !v15)
               ++v53;
             else
             {
-              //v16 = word_721390[i];
-              v17 = word_721390[i + 1] - word_721390[i];
-              v18 = y - word_721390[i];
+              //v16 = word_721390_ys[i];
+              v17 = word_721390_ys[i + 1] - word_721390_ys[i];
+              v18 = y - word_721390_ys[i];
               LODWORD(v19) = v18 << 16;
               HIDWORD(v19) = v18 >> 16;
-              if ((signed int)(((unsigned __int64)(((signed int)word_721460[i + 1] - (signed int)word_721460[i]) * v19 / v17) >> 16) + word_721460[i]) >= x)
+              if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v19 / v17) >> 16) + word_721460_xs[i]) >= x)
                 ++v53;
             }
             /*if ( v15 != 3 )
             {
               if ( !v15 )
               {
-                LODWORD(v19) = (y - word_721390[i]) << 16;
-                HIDWORD(v19) = (y - word_721390[i]) >> 16;
-                v16 = ((((word_721460[i + 1] - word_721460[i]) * v19 / (word_721390[i + 1] - word_721390[i])) >> 16) + word_721460[i]);
+                LODWORD(v19) = (y - word_721390_ys[i]) << 16;
+                HIDWORD(v19) = (y - word_721390_ys[i]) >> 16;
+                v16 = ((((word_721460_xs[i + 1] - word_721460_xs[i]) * v19 / (word_721390_ys[i + 1] - word_721390_ys[i])) >> 16) + word_721460_xs[i]);
                 if ( v16 >= x)
                   ++v53;
               }
@@ -352,7 +355,7 @@
           }
           v22 = v55++;
           blv_floor_level[v22] = v21;
-          dword_721200[v22] = pSector->pFloors[i];
+          blv_floor_id[v22] = pSector->pFloors[i];
         }
       }
     }
@@ -371,38 +374,38 @@
       {
         for (uint j = 0; j < portal->uNumVertices; ++j)
         {
-          word_721460[2 * j] =     portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x;
-          word_721460[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x;
-          word_721390[2 * j] =     portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y;
-          word_721390[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y;
-        }
-        word_721460[2 * portal->uNumVertices] = word_721460[0];
-        word_721390[2 * portal->uNumVertices] = word_721390[0];
+          word_721460_xs[2 * j] =     portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x;
+          word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x;
+          word_721390_ys[2 * j] =     portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y;
+          word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y;
+        }
+        word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0];
+        word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0];
         v54 = 0;
-        v49 = word_721390[0] >= y;
+        v49 = word_721390_ys[0] >= y;
         if ( portal->uNumVertices > 0 )
         {
           for ( int i = 0; i < 2 * portal->uNumVertices; ++i )
           {
             if ( v54 >= 2 )
               break;
-            v47 = word_721390[i + 1] >= y;
+            v47 = word_721390_ys[i + 1] >= y;
             if ( v49 != v47 )
             {
-              v28 = word_721460[i + 1] >= x ? 0 : 2;
-              v29 = v28 | word_721460[i] < x;
+              v28 = word_721460_xs[i + 1] >= x ? 0 : 2;
+              v29 = v28 | word_721460_xs[i] < x;
               if ( v29 != 3 )
               {
                 if ( !v29 )
                   ++v54;
                 else
                 {
-                  //v30 = word_721390[v27];
-                  v31 = word_721390[i + 1] - word_721390[i];
-                  v32 = y - word_721390[i];
+                  //v30 = word_721390_ys[v27];
+                  v31 = word_721390_ys[i + 1] - word_721390_ys[i];
+                  v32 = y - word_721390_ys[i];
                   LODWORD(v33) = v32 << 16;
                   HIDWORD(v33) = v32 >> 16;
-                  if ((signed int)(((unsigned __int64)(((signed int)word_721460[i + 1] - (signed int)word_721460[i]) * v33 / v31) >> 16) + word_721460[i]) >= x)
+                  if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v33 / v31) >> 16) + word_721460_xs[i]) >= x)
                     ++v54;
                 }
               }
@@ -415,7 +418,7 @@
               break;
             v34 = v55++;
             blv_floor_level[v34] = -29000;
-            dword_721200[v34] = pSector->pPortals[i];
+            blv_floor_id[v34] = pSector->pPortals[i];
           }
         }
       }
@@ -423,12 +426,12 @@
   }
   if ( v55 == 1 )
   {
-    *pFaceID = dword_721200[0];
+    *pFaceID = blv_floor_id[0];
     return blv_floor_level[0];
   }
   if ( !v55 )
     return -30000;
-  *pFaceID = dword_721200[0];
+  *pFaceID = blv_floor_id[0];
   //result = blv_floor_level[0];
   if ( v55 > 1 )
   {
@@ -439,13 +442,13 @@
         if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 )
           continue;
         blv_floor_level[0] = blv_floor_level[v35];
-        *pFaceID = dword_721200[v35];
+        *pFaceID = blv_floor_id[v35];
         continue;
       }
       if ( blv_floor_level[v35] < blv_floor_level[0] )
       {
         blv_floor_level[0] = blv_floor_level[v35];
-        *pFaceID = dword_721200[v35];
+        *pFaceID = blv_floor_id[v35];
       }
     }
   }