diff Vis.cpp @ 1035:306ec23b37df

004C1EE5 & other stuff
author Nomad
date Wed, 22 May 2013 14:12:51 +0200
parents c94d6a37d298
children 39f42990698f 010a844ef4a0
line wrap: on
line diff
--- a/Vis.cpp	Tue May 21 23:45:26 2013 +0200
+++ b/Vis.cpp	Wed May 22 14:12:51 2013 +0200
@@ -761,101 +761,55 @@
 //----- (004C1EE5) --------------------------------------------------------
 bool Vis::_4C1EE5_BLV_IntersectBModel_2(int *a1, int *a2, __int16 *a3, __int16 *a4, Vec3_short_ *a5, BLVFace *pFace)
 {
-  bool result; // eax@1
-  unsigned int v8; // ecx@1
-  Vec3_short_ *v9; // ecx@2
-  __int16 *v10; // edx@3
-  signed int v11; // ecx@4
-  char v12; // zf@6
-  Vec3_short_ *v13; // ecx@6
-  int v14; // edx@7
-  __int16 *v15; // edx@8
-  signed int v16; // ecx@9
-  int v17; // edx@11
-  __int16 *v18; // edx@12
-  signed int v19; // ecx@13
-  signed int a5a; // [sp+24h] [bp+18h]@2
-  signed int a5b; // [sp+24h] [bp+18h]@7
-  signed int a5c; // [sp+24h] [bp+18h]@11
+  if (pFace->uAttributes & FACE_XY_PLANE)
+  {
+    *a1 = a5->x;
+    *a2 = a5->y;
+
+    for (uint i = 0; i < pFace->uNumVertices; ++i)
+    {
+      a3[2 * i] = pFace->pXInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].x;
+      a3[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].x;
+
+      a4[2 * i] = pFace->pYInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].y;
+      a4[2 * i + 1] = pFace->pYInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].y;
+    }
+  }
+  else if (pFace->uAttributes & FACE_XZ_PLANE)
+  {
+    *a1 = a5->x;
+    *a2 = a5->z;
 
-  result = (bool)pFace;
-  v8 = pFace->uAttributes;
-  if ( BYTE1(v8) & 1 )
-  {
-    v9 = a5;
-    a5a = 0;
-    *a1 = v9->x;
-    *a2 = v9->y;
-    if ( pFace->uNumVertices )
+    for (uint i = 0; i < pFace->uNumVertices; ++i)
     {
-      v10 = a4 + 1;
-      do
-      {
-        v11 = a5a;
-        a3[2 * a5a] = pFace->pXInterceptDisplacements[a5a] + pIndoor->pVertices[pFace->pVertexIDs[a5a]].x;
-        *(v10 - 1) = pFace->pYInterceptDisplacements[v11] + pIndoor->pVertices[pFace->pVertexIDs[v11]].y;
-        *(__int16 *)((char *)v10 + (int)a3 - (int)a4) = pFace->pXInterceptDisplacements[v11 + 1]
-                                                            + pIndoor->pVertices[pFace->pVertexIDs[v11 + 1]].x;
-        ++a5a;
-        *v10 = pFace->pYInterceptDisplacements[v11 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v11 + 1]].y;
-        v10 += 2;
-      }
-      while ( a5a < pFace->uNumVertices );
+      a3[2 * i] = pFace->pXInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].x;
+      a3[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].x;
+
+      a4[2 * i] = pFace->pZInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].z;
+      a4[2 * i + 1] = pFace->pZInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].z;
+    }
+  }
+  else if (pFace->uAttributes & FACE_YZ_PLANE)
+  {
+    *a1 = a5->y;
+    *a2 = a5->z;
+
+    for (uint i = 0; i < pFace->uNumVertices; ++i)
+    {
+      a3[2 * i] = pFace->pYInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].y;
+      a3[2 * i + 1] = pFace->pYInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].y;
+
+      a4[2 * i] = pFace->pZInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].z;
+      a4[2 * i + 1] = pFace->pZInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].z;
     }
   }
   else
   {
-    v12 = (BYTE1(v8) & 2) == 0;
-    v13 = a5;
-    if ( v12 )
-    {
-      v17 = a5->y;
-      a5c = 0;
-      *a1 = v17;
-      *a2 = v13->z;
-      if ( pFace->uNumVertices )
-      {
-        v18 = a4 + 1;
-        do
-        {
-          v19 = a5c;
-          a3[2 * a5c] = pFace->pYInterceptDisplacements[a5c] + pIndoor->pVertices[pFace->pVertexIDs[a5c]].y;
-          *(v18 - 1) = pFace->pZInterceptDisplacements[v19] + pIndoor->pVertices[pFace->pVertexIDs[v19]].z;
-          *(__int16 *)((char *)v18 + (int)(char *)a3 - (char *)a4) = pFace->pYInterceptDisplacements[v19 + 1]
-                                                              + pIndoor->pVertices[pFace->pVertexIDs[v19 + 1]].y;
-          ++a5c;
-          *v18 = pFace->pZInterceptDisplacements[v19 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v19 + 1]].z;
-          v18 += 2;
-        }
-        while ( a5c < pFace->uNumVertices );
-      }
-    }
-    else
-    {
-      v14 = a5->x;
-      a5b = 0;
-      *a1 = v14;
-      *a2 = v13->z;
-      if ( pFace->uNumVertices )
-      {
-        v15 = a4 + 1;
-        do
-        {
-          v16 = a5b;
-          a3[2 * a5b] = pFace->pXInterceptDisplacements[a5b] + pIndoor->pVertices[pFace->pVertexIDs[a5b]].x;
-          *(v15 - 1) = pFace->pZInterceptDisplacements[v16] + pIndoor->pVertices[pFace->pVertexIDs[v16]].z;
-          *(__int16 *)((char *)v15 + (int)a3 - (int)a4) = pFace->pXInterceptDisplacements[v16 + 1]
-                                                              + pIndoor->pVertices[pFace->pVertexIDs[v16 + 1]].x;
-          ++a5b;
-          *v15 = pFace->pZInterceptDisplacements[v16 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v16 + 1]].z;
-          v15 += 2;
-        }
-        while ( a5b < pFace->uNumVertices );
-      }
-    }
+    assert(false);
+    return false;
   }
-  LOBYTE(result) = 1;
-  return result;
+
+  return true;
 }
 
 //----- (004C2186) --------------------------------------------------------