changeset 725:7037f22cd716

little continue
author Ritor1
date Fri, 22 Mar 2013 01:29:25 +0600
parents 737d7fec67f0
children 9d13d2ec35a6
files mm7_4.cpp mm7_data.cpp mm7_data.h
diffstat 3 files changed, 39 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_4.cpp	Thu Mar 21 16:09:59 2013 +0600
+++ b/mm7_4.cpp	Fri Mar 22 01:29:25 2013 +0600
@@ -330,14 +330,15 @@
             break;
           if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling )
           {
-            v21 = pIndoor->pVertices[*pFloor->pVertexIDs].z;
+            v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z;
           }
           else
           {
-            v21 = ((pFloor->zCalc1 * x) >> 16) + ((pFloor->zCalc2 * y) >> 16) + pFloor->zCalc3;
+            v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16)
+                + HIWORD(pFloor->zCalc3);
           }
           v22 = v55++;
-          dword_7212C8[v22] = v21;
+          blv_floor_level[v22] = v21;
           dword_721200[v22] = pSector->pFloors[i];
         }
       }
@@ -394,7 +395,7 @@
             if ( v55 >= 50 )
               break;
             v34 = v55++;
-            dword_7212C8[v34] = -29000;
+            blv_floor_level[v34] = -29000;
             dword_721200[v34] = pSector->pPortals[i];
           }
         }
@@ -404,32 +405,32 @@
   if ( v55 == 1 )
   {
     *pFaceID = dword_721200[0];
-    return dword_7212C8[0];
+    return blv_floor_level[0];
   }
   if ( !v55 )
     return -30000;
   *pFaceID = dword_721200[0];
-  result = dword_7212C8[0];
+  //result = blv_floor_level[0];
   if ( v55 > 1 )
   {
     for ( v35 = 1; v35 < v55; ++v35 )
     {
-      if ( result <= z + 5 )
-      {
-        if ( dword_7212C8[v35] >= result || dword_7212C8[v35] > z + 5 )
+      if ( blv_floor_level[0] <= z + 5 )
+      {
+        if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 )
           continue;
-        result = dword_7212C8[v35];
+        blv_floor_level[0] = blv_floor_level[v35];
         *pFaceID = dword_721200[v35];
         continue;
       }
-      if ( dword_7212C8[v35] < result )
-      {
-        result = dword_7212C8[v35];
+      if ( blv_floor_level[v35] < blv_floor_level[0] )
+      {
+        blv_floor_level[0] = blv_floor_level[v35];
         *pFaceID = dword_721200[v35];
       }
     }
   }
-  return result;
+  return blv_floor_level[0];
 }
 
 //----- (0046D49E) --------------------------------------------------------
@@ -468,11 +469,11 @@
   v46 = 1;
   dword_721160[0] = -1;
   dword_721110[0] = -1;
-  floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, a5, a7);
+  odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, a5, a7);
   if ( (signed int)pOutdoor->uNumBModels <= 0 )
   {
     *a6 = 0;
-    return floor_level[0];
+    return odm_floor_level[0];
   }
   v38 = 0;
   for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum )
@@ -538,9 +539,10 @@
                 if ( pFace->uPolygonType == POLYGON_Floor )
                   v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z;
                 else
-                  v24 = ((pFace->zCalc1 * X) >> 16) + ((pFace->zCalc2 * Y) >> 16) + pFace->zCalc3;
+                  v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16)
+                + HIWORD(pFace->zCalc3);
                 v25 = v46++;
-                floor_level[v25] = v24;
+                odm_floor_level[v25] = v24;
                 dword_721160[v25] = pBModelNum;
                 dword_721110[v25] = pFaceNum;
               }
@@ -555,41 +557,37 @@
   if ( v46 == 1 )
   {
     *a6 = 0;
-    return floor_level[0];
+    return odm_floor_level[0];
   }
   v27 = 0;
   if ( v46 <= 1 )
     *a6 = 0;
   else
   {
-    v28 = 0;
-    v29 = 1;
+    //v29 = 1;
     for ( v49 = 1; v49 < v46; ++v49 )
     {
-      if ( floor_level[v29] == floor_level[v28] )
+      if ( odm_floor_level[v49] == odm_floor_level[0] )
       {
         v27 = v49;
-        v28 = v29 * 4;
-        ++v29;
+        //++v29;
         break;
       }
-      if ( floor_level[v28] > Z + 5 )
-      {
-        if ( floor_level[v29] >= floor_level[v28] )
-        {
-          ++v29;
+      if ( odm_floor_level[0] > Z + 5 )
+      {
+        if ( odm_floor_level[v49] >= odm_floor_level[0] )
+        {
+          //++v29;
           break;
         }
         v27 = v49;
-        v28 = v29 * 4;
-        ++v29;
+        //++v29;
         break;
       }
-      if ( floor_level[v29] > floor_level[v28] && floor_level[v29] <= Z + 5 )
+      if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 )
       {
         v27 = v49;
-        v28 = v29 * 4;
-        ++v29;
+        //++v29;
       }
     }
     if ( !v27 )
@@ -604,11 +602,9 @@
     if ( v32->uAttributes & 0x10 )
       *a5 = 1;
   }
-  v33 = floor_level[v27];
-  result = floor_level[0];
-  if ( v33 >= floor_level[0] )
-    result = v33;
-  return result;
+  if ( odm_floor_level[v27] >= odm_floor_level[0] )
+    odm_floor_level[0] = odm_floor_level[v27];
+  return odm_floor_level[0];
 }
 
 //----- (0046D8E3) --------------------------------------------------------
--- a/mm7_data.cpp	Thu Mar 21 16:09:59 2013 +0600
+++ b/mm7_data.cpp	Fri Mar 22 01:29:25 2013 +0600
@@ -2040,9 +2040,9 @@
 __int16 word_721040[777]; // idb
 int dword_721110[777]; // idb
 int dword_721160[777]; // idb
-int floor_level[20]; // idb
+int odm_floor_level[20]; // idb
 int dword_721200[777]; // idb
-int dword_7212C8[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
--- a/mm7_data.h	Thu Mar 21 16:09:59 2013 +0600
+++ b/mm7_data.h	Fri Mar 22 01:29:25 2013 +0600
@@ -1557,9 +1557,9 @@
 extern __int16 word_721040[]; // idb
 extern int dword_721110[]; // idb
 extern int dword_721160[]; // idb
-extern int floor_level[20]; // idb dword_7211B0
+extern int odm_floor_level[20]; // idb dword_7211B0
 extern int dword_721200[]; // idb
-extern int dword_7212C8[]; // 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