diff mm7_4.cpp @ 741:cd9ae9a2c99c

Слияние
author Ritor1
date Fri, 22 Mar 2013 19:59:03 +0600
parents 14cf77af15de 2f4e33c1ed24
children 4b06e19fcdbc
line wrap: on
line diff
--- a/mm7_4.cpp	Fri Mar 22 19:58:47 2013 +0600
+++ b/mm7_4.cpp	Fri Mar 22 19:59:03 2013 +0600
@@ -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];
       }
     }
   }
@@ -2574,6 +2577,7 @@
   float v26; // [sp+50h] [bp-8h]@3
   float v27; // [sp+54h] [bp-4h]@3
 
+  __debugbreak();
   v22 = 0;
   v1 = this->pMemBlocks[1]->pAlignedBlock;
   v2 = this->pMemBlocks[6]->pAlignedBlock;
@@ -4768,204 +4772,134 @@
 
 
 //----- (0049B04D) --------------------------------------------------------
-int stru154::_49B04D(ODMFace *a2, BSPVertexBuffer *a3)
+void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3)
 {
-  stru154 *v3; // edi@1
-  signed int v4; // eax@1
-  signed int result; // eax@9
-  signed int v6; // [sp-8h] [bp-18h]@8
+  //stru154 *v3; // edi@1
+  //signed int v4; // eax@1
+  //signed int result; // eax@9
+  //signed int v6; // [sp-8h] [bp-18h]@8
   Vec3_float_ v; // [sp+4h] [bp-Ch]@1
+  float v7;
 
   v.x = 0.0;
-  v3 = this;
   v.y = 0.0;
   v.z = 0.0;
-  _49B13D(a2, a3, &v, (float *)&a3);
-  v4 = 2;
-  if ( a2->pFacePlane.vNormal.z )
-  {
-    if ( !a2->pFacePlane.vNormal.x && !a2->pFacePlane.vNormal.y )
-      v4 = 1;
-  }
+  GetFacePlane(a2, a3, &v, &v7);
+
+  if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f)
+    polygonType = POLYGON_VerticalWall;
+  else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f &&
+           fabsf(a2->pFacePlane.vNormal.y) < 1e-6f)
+    polygonType = POLYGON_Floor;
   else
-  {
-    v4 = 0;
-  }
-  if ( v4 )
-  {
-    if ( v4 == 1 )
-      v6 = 3;
-    else
-      v6 = 4;
-    result = v6;
-  }
-  else
-  {
-    result = 1;
-  }
-  v3->face_plane.vNormal.x = v.x;
-  v3->face_plane.vNormal.y = v.y;
-  v3->face_plane.vNormal.z = v.z;
-  v3->face_plane.dist = *(float *)&a3;
-  v3->polygonType = (PolygonType)result;
-  return result;
+    polygonType = POLYGON_InBetweenFloorAndWall;
+
+  face_plane.vNormal.x = v.x;
+  face_plane.vNormal.y = v.y;
+  face_plane.vNormal.z = v.z;
+  face_plane.dist = v7;
 }
 
 //----- (0049B0C9) --------------------------------------------------------
-int stru154::_49B0C9(Vec3_float_ *pNormal, float dist)
+void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist)
 {
-  signed int v3; // esi@1
-  signed int result; // eax@9
-  double v5; // st7@12
-  double v6; // st6@12
-  double v7; // st5@12
-  signed int v8; // [sp+0h] [bp-4h]@8
-
-  v3 = 2;
-  if ( pNormal->z == 0.0 )
-  {
-    v3 = 0;
-  }
+  if (fabsf(pNormal->z) < 1e-6f)
+    polygonType = POLYGON_VerticalWall;
+  else if (fabsf(pNormal->x) < 1e-6f &&
+           fabsf(pNormal->y) < 1e-6f)
+    polygonType = POLYGON_Floor;
   else
-  {
-    if ( pNormal->x == 0.0 && pNormal->y == 0.0 )
-      v3 = 1;
-  }
-  if ( v3 )
-  {
-    if ( v3 == 1 )
-      v8 = 3;
-    else
-      v8 = 4;
-    result = v8;
-  }
-  else
-  {
-    result = 1;
-  }
-  v5 = pNormal->z;
-  v6 = pNormal->y;
-  v7 = pNormal->x;
-  this->polygonType = (PolygonType)result;
-  this->face_plane.vNormal.x = v7;
-  this->face_plane.dist = dist;
-  this->face_plane.vNormal.y = v6;
-  this->face_plane.vNormal.z = v5;
-  return result;
+    polygonType = POLYGON_InBetweenFloorAndWall;
+
+  face_plane.vNormal.x = pNormal->x;
+  face_plane.dist = dist;
+  face_plane.vNormal.y = pNormal->y;
+  face_plane.vNormal.z = pNormal->z;
 }
 
 //----- (0049B13D) --------------------------------------------------------
-int stru154::_49B13D(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *a3, float *a4)
+void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist)
 {
   ODMFace *v5; // ebx@1
-  int v6; // eax@1
-  unsigned __int16 *v7; // ebx@2
-  Vec3_int_ *v8; // eax@3
+  //int v6; // eax@1
+  //unsigned __int16 *v7; // ebx@2
+  //Vec3_int_ *v8; // eax@3
   Vec3_int_ *v9; // ecx@3
-  double v10; // st7@3
-  int v11; // ecx@3
+  //double v10; // st7@3
+  //int v11; // ecx@3
   Vec3_int_ *v12; // ecx@3
-  double v13; // st7@3
-  double v14; // st6@3
-  double v15; // st5@3
-  int v16; // ecx@3
+  //double v13; // st7@3
+  //double v14; // st6@3
+  //double v15; // st5@3
+  //int v16; // ecx@3
   Vec3_int_ *v17; // eax@3
-  double v18; // st5@3
+  //double v18; // st5@3
   Vec3_float_ *v19; // eax@3
-  int result; // eax@8
-  float v21; // ecx@10
-  double v22; // st7@10
-  double v23; // st6@10
+  //int result; // eax@8
+  //float v21; // ecx@10
+  //double v22; // st7@10
+  //double v23; // st6@10
   Vec3_float_ v2; // [sp+4h] [bp-64h]@3
-  float v25; // [sp+18h] [bp-50h]@3
+  //float v25; // [sp+18h] [bp-50h]@3
   float v26; // [sp+1Ch] [bp-4Ch]@3
   float v27; // [sp+20h] [bp-48h]@3
   float v28; // [sp+24h] [bp-44h]@3
-  float v29; // [sp+2Ch] [bp-3Ch]@3
-  float v30; // [sp+30h] [bp-38h]@3
-  float v31; // [sp+34h] [bp-34h]@3
-  float v32; // [sp+38h] [bp-30h]@3
-  float v33; // [sp+3Ch] [bp-2Ch]@3
+  //float v29; // [sp+2Ch] [bp-3Ch]@3
+  //float v30; // [sp+30h] [bp-38h]@3
+  //float v31; // [sp+34h] [bp-34h]@3
+  //float v32; // [sp+38h] [bp-30h]@3
+  //float v33; // [sp+3Ch] [bp-2Ch]@3
   Vec3_float_ v1; // [sp+40h] [bp-28h]@1
-  float v35; // [sp+4Ch] [bp-1Ch]@3
-  float v36; // [sp+50h] [bp-18h]@3
-  float v37; // [sp+54h] [bp-14h]@3
+  //float v35; // [sp+4Ch] [bp-1Ch]@3
+  //float v36; // [sp+50h] [bp-18h]@3
+  //float v37; // [sp+54h] [bp-14h]@3
   Vec3_float_ v38; // [sp+58h] [bp-10h]@3
-  int v39; // [sp+64h] [bp-4h]@1
-
-  v39 = 0;
+  //int v39; // [sp+64h] [bp-4h]@1
+
+  //v39 = 0;
   v1.x = 0.0;
   v5 = pFace;
-  v6 = pFace->uNumVertices;
+  //v6 = pFace->uNumVertices;
   v1.y = 0.0;
   v1.z = 0.0;
-  if ( v6 - 1 <= 0 )
-  {
-LABEL_8:
-    a3->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) * 0.000015259022 + (double)(v5->pFacePlane.vNormal.x >> 16);
-    a3->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) * 0.000015259022 + (double)(v5->pFacePlane.vNormal.y >> 16);
-    a3->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) * 0.000015259022 + (double)(v5->pFacePlane.vNormal.z >> 16);
-    result = (int)a4;
-    *a4 = (double)(v5->pFacePlane.dist & 0xFFFF) * 0.000015259022 + (double)(v5->pFacePlane.dist >> 16);
-  }
-  else
-  {
-    v7 = &pFace->pVertexIDs[1];
-    while ( 1 )
-    {
-      v8 = pVertices->pVertices;
-      v9 = &v8[*(v7 - 1)];
-      v35 = (double)v9->x;
-      v36 = (double)v9->y;
-      v10 = (double)v9->z;
-      v11 = *v7;
-      v37 = v10;
-      v12 = &v8[v11];
-      v13 = (double)v12->x;
-      v14 = (double)v12->y;
-      v15 = (double)v12->z;
-      v16 = v7[1];
-      v25 = v15;
-      v17 = &v8[v16];
-      v18 = (double)v17->x;
-      v29 = (double)v17->y;
-      v30 = (double)v17->z;
-      v31 = v13 - v35;
-      v32 = v14 - v36;
-      v33 = v25 - v37;
-      v1.x = v31;
-      v26 = v18 - v13;
-      v1.y = v32;
-      v27 = v29 - v14;
-      v1.z = v33;
-      v28 = v30 - v25;
+
+  if (pFace->uNumVertices >= 2)
+  {
+    int i = 0;
+    while ( i < pFace->uNumVertices - 2 )
+    {
+      v9 = &pVertices->pVertices[pFace->pVertexIDs[i]];
+      v12 = &pVertices->pVertices[pFace->pVertexIDs[i + 1]];
+      v17 = &pVertices->pVertices[pFace->pVertexIDs[i + 2]];
+
+      v1.x = v12->x - v9->x;
+      v26 = v17->x - v12->x;
+      v1.y = v12->y - v9->y;
+      v27 = v17->y - v12->y;
+      v1.z = v12->z - v9->z;
+      v28 = v17->z - v12->z;
       v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28);
       v38.x = v19->x;
       v38.y = v19->y;
       v38.z = v19->z;
-      if ( v38.x != 0.0 )
-        break;
-      if ( v38.y != 0.0 || v38.z != 0.0 )
-        break;
-      ++v39;
-      ++v7;
-      if ( v39 >= pFace->uNumVertices - 1 )
-      {
-        v5 = pFace;
-        goto LABEL_8;
-      }
-    }
-    v38.Normalize();
-    v21 = v38.y;
-    a3->x = v38.x;
-    v22 = v37 * v38.z;
-    v23 = v36 * v38.y;
-    a3->y = v21;
-    a3->z = v38.z;
-    result = (int)a4;
-    *a4 = -(v22 + v23 + v35 * v38.x);
-  }
-  return result;
+      if ( v38.x != 0.0  || v38.y != 0.0 || v38.z != 0.0)
+      {
+        v38.Normalize();
+
+        pOutNormal->x = v38.x;
+        pOutNormal->y = v38.y;
+        pOutNormal->z = v38.z;
+
+        *pOutDist = -(v9->x * v38.x + v9->y * v38.y + v9->z * v38.z);
+        return;
+      }
+    }
+  }
+
+  pOutNormal->x = (double)(v5->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.x >> 16);
+  pOutNormal->y = (double)(v5->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.y >> 16);
+  pOutNormal->z = (double)(v5->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.vNormal.z >> 16);
+  *pOutDist = (double)(v5->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(v5->pFacePlane.dist >> 16);
 }
 
 
@@ -5454,327 +5388,6 @@
 
 
 
-//----- (004AC1C9) --------------------------------------------------------
-int __thiscall sub_4AC1C9(unsigned int _this, Vec4_int_ *a2)
-{
-  unsigned int v2; // esi@1
-  __int16 v3; // di@1
-  signed int v4; // ebx@1
-  int v5; // ecx@3
-  Vec4_int_ *v6; // eax@10
-  Vec4_int_ *v7; // esi@14
-  int result; // eax@16
-  char *v9; // esi@16
-  Vec4_int_ a1; // [sp+Ch] [bp-34h]@10
-  Vec4_int_ v11; // [sp+1Ch] [bp-24h]@14
-  Vec4_int_ Dst; // [sp+2Ch] [bp-14h]@1
-  int v13; // [sp+3Ch] [bp-4h]@1
-
-  v2 = _this;
-  v3 = sub_4382BC(_this);
-  v13 = sub_4383ED();
-  v4 = 0;
-  memset(&Dst, 0, 0x10u);
-  if ( v3 < 0 )
-    goto LABEL_19;
-  if ( (signed int)v2 > 0 )
-  {
-    if ( (signed int)v2 > 150 )
-    {
-      v5 = (int)a2;
-    }
-    else
-    {
-      v5 = 4000 * v2;
-      v4 = 1;
-    }
-  }
-  else
-  {
-    v5 = 4000 * dword_4F031C[(unsigned __int16)v3];
-  }
-  if ( v13 & 0x10 && !v4 )
-  {
-    if ( v2 )
-      v6 = sub_4AC4FD_get_cpu_clocks_rdtsc(v5, &a1);
-    else
-      v6 = sub_4AC33A_get_cpu_clocks_QPC(v5, &a1);
-    goto LABEL_14;
-  }
-  if ( (unsigned __int16)v3 < 3u )
-  {
-LABEL_19:
-    v7 = &Dst;
-    goto LABEL_16;
-  }
-  v6 = sub_4AC277(v5, &a1);
-LABEL_14:
-  v11.x = v6->x;
-  v11.y = v6->y;
-  v11.z = v6->z;
-  v11.w = v6->w;
-  v7 = &v11;
-LABEL_16:
-  result = (int)a2;
-  a2->x = v7->x;
-  v9 = (char *)&v7->y;
-  a2->y = *(int *)v9;
-  v9 += 4;
-  a2->z = *(int *)v9;
-  a2->w = *((int *)v9 + 1);
-  return result;
-}
-// 4F031C: using guessed type int dword_4F031C[];
-
-//----- (004AC277) --------------------------------------------------------
-Vec4_int_ *__thiscall sub_4AC277(unsigned int _this, Vec4_int_ *a2)
-{
-  __debugbreak();
-  return 0;
-  /*signed int v2; // esi@1
-  signed __int16 v4; // bx@3
-  int v10; // esi@8
-  int v11; // eax@10
-  Vec4_int_ *result; // eax@13
-  Vec4_int_ Dst; // [sp+8h] [bp-30h]@1
-  LARGE_INTEGER Frequency; // [sp+18h] [bp-20h]@1
-  LARGE_INTEGER PerformanceCount; // [sp+20h] [bp-18h]@3
-  LARGE_INTEGER v16; // [sp+28h] [bp-10h]@5
-  int v17; // [sp+30h] [bp-8h]@1
-  int v18; // [sp+34h] [bp-4h]@2
-
-  v17 = _this;
-  v2 = -1;
-  memset(&Dst, 0, 0x10u);
-  if ( QueryPerformanceFrequency(&Frequency) )
-  {
-    v18 = 10;
-    do
-    {
-      QueryPerformanceCounter(&PerformanceCount);
-      _EAX = -2147483648;
-      v4 = 4000;
-      do
-      {
-        __asm { bsf     ecx, eax }
-        --v4;
-      }
-      while ( v4 );
-      QueryPerformanceCounter(&v16);
-      if ( (signed int)v16.s.LowPart - (signed int)PerformanceCount.s.LowPart < (unsigned int)v2 )
-        v2 = v16.s.LowPart - PerformanceCount.s.LowPart;
-      --v18;
-    }
-    while ( v18 );
-    v10 = 100000 * v2 / (Frequency.s.LowPart / 0xA);
-    if ( v10 % Frequency.s.LowPart > Frequency.s.LowPart >> 1 )
-      ++v10;
-    v11 = v17 / (unsigned int)v10;
-    Dst.z = v17 / (unsigned int)v10;
-    if ( v17 % (unsigned int)v10 > (unsigned int)v10 >> 1 )
-      ++v11;
-    Dst.x = v17;
-    Dst.y = v10;
-    Dst.w = v11;
-  }
-  result = a2;
-  a2->x = Dst.x;
-  a2->y = Dst.y;
-  a2->z = Dst.z;
-  a2->w = Dst.w;
-  return result;*/
-}
-
-//----- (004AC33A) --------------------------------------------------------
-Vec4_int_ *__thiscall sub_4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1)
-{
-  __debugbreak();
-  return 0;
-  /*int v2; // esi@1
-  int v3; // ebx@1
-  unsigned __int64 v4; // qax@4
-  unsigned __int64 v5; // qax@7
-  DWORD v6; // edi@7
-  DWORD v7; // eax@7
-  unsigned int v8; // ecx@10
-  unsigned __int64 v9; // qax@10
-  unsigned int v10; // edi@10
-  int v11; // eax@14
-  unsigned int v12; // ecx@19
-  Vec4_int_ *result; // eax@24
-  int Dst; // [sp+Ch] [bp-4Ch]@1
-  int v15; // [sp+10h] [bp-48h]@23
-  int v16; // [sp+14h] [bp-44h]@21
-  int v17; // [sp+18h] [bp-40h]@21
-  LARGE_INTEGER Frequency; // [sp+1Ch] [bp-3Ch]@1
-  LARGE_INTEGER PerformanceCount; // [sp+24h] [bp-34h]@2
-  LARGE_INTEGER v20; // [sp+2Ch] [bp-2Ch]@2
-  int v21; // [sp+34h] [bp-24h]@2
-  int v22; // [sp+38h] [bp-20h]@2
-  int v23; // [sp+3Ch] [bp-1Ch]@4
-  int v24; // [sp+40h] [bp-18h]@7
-  int nPriority; // [sp+44h] [bp-14h]@2
-  unsigned int v26; // [sp+48h] [bp-10h]@1
-  unsigned int v27; // [sp+4Ch] [bp-Ch]@1
-  HANDLE hThread; // [sp+50h] [bp-8h]@1
-  int v29; // [sp+54h] [bp-4h]@1
-
-  v2 = 0;
-  v3 = 0;
-  v29 = 0;
-  v27 = 0;
-  v26 = 0;
-  hThread = GetCurrentThread();
-  memset(&Dst, 0, 0x10u);
-  if ( QueryPerformanceFrequency(&Frequency) )
-  {
-    do
-    {
-      ++v29;
-      v22 = v2;
-      v21 = v3;
-      QueryPerformanceCounter(&PerformanceCount);
-      v20 = PerformanceCount;
-      nPriority = GetThreadPriority(hThread);
-      if ( nPriority != 2147483647 )
-        SetThreadPriority(hThread, 15);
-      while ( v20.s.LowPart - PerformanceCount.s.LowPart < 0x32 )
-      {
-        QueryPerformanceCounter(&v20);
-        v4 = __rdtsc();
-        v23 = v4;
-      }
-      PerformanceCount = v20;
-      do
-      {
-        QueryPerformanceCounter(&v20);
-        v5 = __rdtsc();
-        v24 = v5;
-        v6 = v20.s.LowPart;
-        v7 = PerformanceCount.s.LowPart;
-      }
-      while ( v20.s.LowPart - PerformanceCount.s.LowPart < 0x3E8 );
-      if ( nPriority != 2147483647 )
-      {
-        SetThreadPriority(hThread, nPriority);
-        v7 = PerformanceCount.s.LowPart;
-        v6 = v20.s.LowPart;
-      }
-      v8 = v24 - v23;
-      v27 += v24 - v23;
-      v9 = (100000 * v6 - 100000 * v7) / (Frequency.s.LowPart / 0xA);
-      v10 = v9;
-      v26 += v9;
-      if ( v9 % Frequency.s.LowPart > Frequency.s.LowPart >> 1 )
-        v10 = v9 + 1;
-      v3 = v8 / v10;
-      if ( v8 % v10 > v10 >> 1 )
-        v3 = v8 / v10 + 1;
-      v2 = v21;
-      v11 = v3 + v22 + v21;
-    }
-    while ( v29 < 3
-         || v29 < 20
-         && ((unsigned int)(3 * v3 - v11) > 3 || (unsigned int)(3 * v21 - v11) > 3 || (unsigned int)(3 * v22 - v11) > 3) );
-    v12 = 10 * v27 / v26;
-    if ( 100 * v27 / v26 - 10 * v12 >= 6 )
-      ++v12;
-    v16 = v27 / v26;
-    v17 = v27 / v26;
-    if ( v12 - 10 * v27 / v26 >= 6 )
-      v17 = v27 / v26 + 1;
-    v15 = v26;
-    Dst = v27;
-  }
-  result = a1;
-  a1->x = Dst;
-  a1->y = v15;
-  a1->z = v16;
-  a1->w = v17;
-  return result;*/
-}
-
-//----- (004AC4FD) --------------------------------------------------------
-Vec4_int_ *__thiscall sub_4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1)
-{
-  __debugbreak();
-  return 0;
-  /*int v2; // eax@1
-  int v3; // eax@4
-  bool v4; // eax@5
-  unsigned __int64 v5; // kr00_8@8
-  int v6; // edi@9
-  int v7; // eax@9
-  bool v8; // eax@10
-  unsigned __int64 v9; // kr08_8@13
-  unsigned int v10; // eax@15
-  Vec4_int_ *result; // eax@17
-  int Dst; // [sp+Ch] [bp-2Ch]@1
-  int v13; // [sp+10h] [bp-28h]@17
-  int v14; // [sp+14h] [bp-24h]@15
-  int v15; // [sp+18h] [bp-20h]@17
-  unsigned int v16; // [sp+1Ch] [bp-1Ch]@8
-  unsigned int v17; // [sp+20h] [bp-18h]@8
-  unsigned int v18; // [sp+24h] [bp-14h]@13
-  int nPriority; // [sp+28h] [bp-10h]@1
-  __int64 v20; // [sp+2Ch] [bp-Ch]@1
-  int v21; // [sp+34h] [bp-4h]@3
-
-  HIDWORD(v20) = GetCurrentThread();
-  memset(&Dst, 0, 0x10u);
-  v2 = GetThreadPriority(HIDWORD(v20));
-  nPriority = v2;
-  if ( v2 != 0x7FFFFFFF )
-    SetThreadPriority(HIDWORD(v20), v2 + 1);
-  __outbyte(0x70u, 0);
-  v21 = __inbyte(0x71u);
-  do
-  {
-    __outbyte(0x70u, 0);
-    LODWORD(v20) = __inbyte(0x71u);
-    v3 = v20 - v21;
-    if ( (signed int)v20 >= v21 )
-      v4 = v3 > 0;
-    else
-      v4 = v3 + 10;
-  }
-  while ( !v4 );
-  v5 = __rdtsc();
-  v16 = HIDWORD(v5);
-  v17 = v5;
-  do
-  {
-    __outbyte(0x70u, 0);
-    v21 = __inbyte(0x71u);
-    v6 = v21;
-    v7 = v21 - v20;
-    if ( v21 >= (signed int)v20 )
-      v8 = v7 > 0;
-    else
-      v8 = v7 + 10;
-  }
-  while ( !v8 );
-  v9 = __rdtsc();
-  v18 = HIDWORD(v9);
-  v21 = v9;
-  if ( nPriority != 0x7FFFFFFF )
-    SetThreadPriority(HIDWORD(v20), nPriority);
-  nPriority = v21;
-  *(__int64 *)((char *)&v20 + 4) = __PAIR__(v18, v21) - __PAIR__(v16, v17);
-  Dst = HIDWORD(v20);
-  v10 = HIDWORD(v20) / 0xF4240;
-  v14 = HIDWORD(v20) / 0xF4240;
-  if ( HIDWORD(v20) / 0x186A0 - 10 * HIDWORD(v20) / 0xF4240 >= 6 )
-    ++v10;
-  v15 = v10;
-  result = a1;
-  v13 = 1000000 * v6 - 1000000 * v20;
-  a1->x = Dst;
-  a1->y = v13;
-  a1->z = v14;
-  a1->w = v15;
-  return result;*/
-}