changeset 730:79ad0526166c

Some data movements.
author Nomad
date Fri, 22 Mar 2013 10:52:19 +0200
parents 8323734d58c8
children de482c901171
files GUIWindow.cpp Indoor.cpp mm7_4.cpp mm7_data.cpp mm7_data.h
diffstat 5 files changed, 52 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Fri Mar 22 00:27:11 2013 +0200
+++ b/GUIWindow.cpp	Fri Mar 22 10:52:19 2013 +0200
@@ -523,7 +523,7 @@
       pTexture_TownPortalIcons[2] = pIcons_LOD->LoadTexturePtr("tpwarlock", TEXTURE_16BIT_PALETTE);
       pTexture_TownPortalIcons[3] = pIcons_LOD->LoadTexturePtr("tpisland", TEXTURE_16BIT_PALETTE);
       pTexture_TownPortalIcons[4] = pIcons_LOD->LoadTexturePtr("tpheaven", TEXTURE_16BIT_PALETTE);
-      pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr( "tphell", TEXTURE_16BIT_PALETTE);
+      pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr("tphell", TEXTURE_16BIT_PALETTE);
 
       for (uint i = 0; i < 6; ++i)
         v1->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, 183, i, 0, "", nullptr);
--- a/Indoor.cpp	Fri Mar 22 00:27:11 2013 +0200
+++ b/Indoor.cpp	Fri Mar 22 10:52:19 2013 +0200
@@ -3227,8 +3227,8 @@
                             //LOWORD(v24) = v49->x;
                             //v49 = v24;
                             //v59 = v49->x;
-                   v25 = v1->x >= sX ? 0 : 2;  // BUG TODO TROLOLO
-                   v26 = v25 | v2->x < sX;     // SWAP v1 and v2 till the result's correct
+                   v25 = v1->x >= sX ? 0 : 2;
+                   v26 = v25 | v2->x < sX;
                    if ( v26 != 3 )
                    {
                     if (!v26)
--- 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];
       }
     }
   }
--- a/mm7_data.cpp	Fri Mar 22 00:27:11 2013 +0200
+++ b/mm7_data.cpp	Fri Mar 22 10:52:19 2013 +0200
@@ -2101,10 +2101,6 @@
 int dword_721110[777]; // idb
 int dword_721160[777]; // idb
 int odm_floor_level[20]; // idb
-int dword_721200[777]; // idb
-int blv_floor_level[50]; // idb dword_7212C8
-__int16 word_721390[104]; // idb
-__int16 word_721460[104]; // idb
 int blv_prev_party_x; // weak
 int blv_prev_party_z; // weak
 int blv_prev_party_y; // weak
--- a/mm7_data.h	Fri Mar 22 00:27:11 2013 +0200
+++ b/mm7_data.h	Fri Mar 22 10:52:19 2013 +0200
@@ -1560,10 +1560,6 @@
 extern int dword_721110[]; // idb
 extern int dword_721160[]; // idb
 extern int odm_floor_level[20]; // idb dword_7211B0
-extern int dword_721200[]; // idb
-extern int blv_floor_level[50]; // idb
-extern __int16 word_721390[]; // idb
-extern __int16 word_721460[]; // idb
 extern int blv_prev_party_x; // weak
 extern int blv_prev_party_z; // weak
 extern int blv_prev_party_y; // weak