changeset 742:bd611ae85d27

PickItemInBlv
author Ritor1
date Fri, 22 Mar 2013 23:41:47 +0600
parents cd9ae9a2c99c
children 353ff9ea11e6
files Vis.cpp
diffstat 1 files changed, 31 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/Vis.cpp	Fri Mar 22 19:59:03 2013 +0600
+++ b/Vis.cpp	Fri Mar 22 23:41:47 2013 +0600
@@ -28,25 +28,8 @@
 {
   char *v4; // eax@4
   signed int v5; // ecx@4
-  //BLVFace *v6; // ecx@7
-  //unsigned int v7; // edi@7
-  Vec3_short_ *v8; // eax@9
-  char *v9; // edx@9
-  signed int v10; // esi@10
-  //Vec3_int_ **v11; // edx@13
-  //char *v12; // eax@13
-  //double v13; // st7@14
-  //signed int v14; // ebx@14
-  //Vis *v15; // ebx@15
-  //Vis_ObjectInfo *result; // eax@21
-  //Vis_ObjectInfo *v17; // ecx@24
   RenderVertexSoft pRay[2]; // [sp+20h] [bp-70h]@17
   int v20; // [sp+84h] [bp-Ch]@10
-  //int v21; // [sp+88h] [bp-8h]@16
-  //int v22; // [sp+8Ch] [bp-4h]@16
-  signed int v23; // [sp+98h] [bp+8h]@7
-
-  //auto ecx0 = this;
 
   static Vis_SelectionList static_sub_4C1026_stru_F8FE00;
   static_sub_4C1026_stru_F8FE00.uNumPointers = 0;
@@ -60,28 +43,16 @@
       static_sub_4C1026_array_F8F200[i].flt_2C = 0.0f;
   }
 
-  //v6 = a2;
-  v23 = 0;
-  //v7 = face->uNumVertices;
   if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
   {
-    __debugbreak(); // refactor for BLV picking
     if ( (signed int)face->uNumVertices > 0 )
     {
-      v8 = pIndoor->pVertices;
-      v9 = (char *)&static_sub_4C1026_array_F8F200[0].vWorldPosition.y;
-      do
+      for ( int i = 0; i < face->uNumVertices; i++)
       {
-        v10 = v23++;
-        v20 = v8[face->pVertexIDs[v10]].x;
-        *((float *)v9 - 1) = (double)v20;
-        v20 = v8[face->pVertexIDs[v10]].y;
-        *(float *)v9 = (double)v20;
-        v9 += 48;
-        v20 = v8[face->pVertexIDs[v10]].z;
-        *((float *)v9 - 11) = (double)v20;
+        static_sub_4C1026_array_F8F200[i].vWorldPosition.x = (double)pIndoor->pVertices[face->pVertexIDs[i]].x;
+        static_sub_4C1026_array_F8F200[i].vWorldPosition.y = (double)pIndoor->pVertices[face->pVertexIDs[i]].y;
+        static_sub_4C1026_array_F8F200[i].vWorldPosition.z = (double)pIndoor->pVertices[face->pVertexIDs[i]].z;
       }
-      while ( v23 < (signed int)face->uNumVertices );
     }
   }
   else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
@@ -329,53 +300,45 @@
 void Vis::PickIndoorFaces_Mouse(float fDepth, RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter)
 {
   int v5; // eax@1
-  signed int v6; // edi@2
-  signed int v7; // esi@4
+  signed int pFaceID; // edi@2
   int v8; // ecx@7
   int v9; // eax@7
   unsigned int *pNumPointers; // eax@7
   unsigned int v11; // ecx@7
   Vis_ObjectInfo *v12; // edi@7
   RenderVertexSoft a1; // [sp+Ch] [bp-44h]@1
-  BLVFace *v14; // [sp+3Ch] [bp-14h]@7
+  BLVFace *pFace; // [sp+3Ch] [bp-14h]@7
   void *v15; // [sp+40h] [bp-10h]@7
-  int v16; // [sp+44h] [bp-Ch]@7
   int v17; // [sp+48h] [bp-8h]@1
-  Vis *thisa; // [sp+4Ch] [bp-4h]@1
-
- 
-  __debugbreak(); // refactor for BLV picking
 
   v5 = 0;
-  thisa = this;
   v17 = 0;
   for ( a1.flt_2C = 0.0; v17 < (signed int)pBspRenderer->num_faces; ++v17 )
   {
-    v6 = pBspRenderer->faces[v5].uFaceID;
-    if ( v6 >= 0 )
+    pFaceID = pBspRenderer->faces[v5].uFaceID;
+    if ( pFaceID >= 0 )
     {
-      if ( v6 < (signed int)pIndoor->uNumFaces )
+      if ( pFaceID < (signed int)pIndoor->uNumFaces )
       {
-        v7 = v6;
-        if ( is_part_of_selection(&pIndoor->pFaces[v6], filter) )
+        if ( is_part_of_selection(&pIndoor->pFaces[pFaceID], filter) )
         {
-          if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[v7]) )
+          if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) )
           {
-            if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[v7], 0xFFFFFFFFu) )
+            if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[pFaceID], 0xFFFFFFFFu) )
             {
-              pGame->pIndoorCameraD3D->ViewTransform(&a1, 1u);
+              pGame->pIndoorCameraD3D->ViewTransform(&a1, 1);
               v9 = _48B561_mess_with_scaling_along_z(/*v8, */a1.vWorldViewPosition.x);
               LOWORD(v9) = 0;
-              v15 = (void *)((8 * v6 | 6) + v9);
+              v15 = (void *)((8 * pFaceID | 6) + v9);
               pNumPointers = &list->uNumPointers;
-              v16 = 2;
-              v11 = list->uNumPointers;
-              v14 = &pIndoor->pFaces[v7];
-              v12 = &list->object_pool[v11];
-              v12->object = &pIndoor->pFaces[v7];
+              //v16 = 2;
+              //v11 = list->uNumPointers;
+              pFace = &pIndoor->pFaces[pFaceID];
+              v12 = &list->object_pool[list->uNumPointers];
+              v12->object = &pIndoor->pFaces[pFaceID];
               v12 = (Vis_ObjectInfo *)((char *)v12 + 4);
               v12->object = v15;
-              v12->sZValue = v16;
+              v12->sZValue = 2;
               ++*pNumPointers;
             }
           }
@@ -1837,33 +1800,28 @@
 void Vis::PickIndoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter)
 {
   int result; // eax@1
-  signed int v5; // esi@2
-  BLVFace *v6; // edi@4
+  signed int pFaceID; // esi@2
+  BLVFace *pFace; // edi@4
   unsigned int v7; // eax@6
   Vis_ObjectInfo *v8; // eax@6
-  //int v9; // ST18_4@7
-  //unsigned int v10; // ST1C_4@7
-  //unsigned int v11; // ecx@7
   signed int i; // [sp+18h] [bp-8h]@1
-  Vis *thisa; // [sp+1Ch] [bp-4h]@1
 
   result = 0;
-  thisa = this;
   for ( i = 0; i < (signed int)pBspRenderer->num_faces; ++i )
   {
-    v5 = pBspRenderer->faces[result].uFaceID;
-    if ( v5 >= 0 )
+    pFaceID = pBspRenderer->faces[result].uFaceID;
+    if ( pFaceID >= 0 )
     {
-      if ( v5 < (signed int)pIndoor->uNumFaces )
+      if ( pFaceID < (signed int)pIndoor->uNumFaces )
       {
-        v6 = &pIndoor->pFaces[v5];
-        if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[v5]) )
+        pFace = &pIndoor->pFaces[pFaceID];
+        if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) )
         {
-          if ( is_part_of_selection(v6, filter) )
+          if ( is_part_of_selection(pFace, filter) )
           {
-            v7 = 8 * v5;
-            LOBYTE(v7) = 8 * v5 | OBJECT_BModel;
-            v8 = _4C1026(v6, v7, pick_depth);
+            v7 = 8 * pFaceID;
+            LOBYTE(v7) = 8 * pFaceID | OBJECT_BModel;
+            v8 = _4C1026(pFace, v7, pick_depth);
             if ( v8 )
               list->AddObject(v8->object, v8->object_type, v8->sZValue);
           }