diff Vis.cpp @ 916:897b10712a1a

UIShop_Buy_Identify_Repair little clean and rename
author Ritor1
date Thu, 25 Apr 2013 17:37:00 +0600
parents f4394e320312
children e4383e6dfbef
line wrap: on
line diff
--- a/Vis.cpp	Tue Apr 23 09:18:22 2013 +0600
+++ b/Vis.cpp	Thu Apr 25 17:37:00 2013 +0600
@@ -24,23 +24,23 @@
 
 
 //----- (004C1026) --------------------------------------------------------
-Vis_ObjectInfo *Vis::_4C1026(BLVFace *face, unsigned int a3, float pick_depth)
+Vis_ObjectInfo *Vis::DetermineFacetIntersection(BLVFace *face, unsigned int a3, float pick_depth)
 {
   char *v4; // eax@4
   signed int v5; // ecx@4
   RenderVertexSoft pRay[2]; // [sp+20h] [bp-70h]@17
   int v20; // [sp+84h] [bp-Ch]@10
 
-  static Vis_SelectionList static_sub_4C1026_stru_F8FE00;
-  static_sub_4C1026_stru_F8FE00.uNumPointers = 0;
+  static Vis_SelectionList static_DetermineFacetIntersection_stru_F8FE00;
+  static_DetermineFacetIntersection_stru_F8FE00.uNumPointers = 0;
 
   static bool _init_flag = false;
-  static RenderVertexSoft static_sub_4C1026_array_F8F200[64];
+  static RenderVertexSoft static_DetermineFacetIntersection_array_F8F200[64];
   if (!_init_flag)
   {
     _init_flag = true;
     for (uint i = 0; i < 64; ++i)
-      static_sub_4C1026_array_F8F200[i].flt_2C = 0.0f;
+      static_DetermineFacetIntersection_array_F8F200[i].flt_2C = 0.0f;
   }
 
   if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
@@ -49,9 +49,9 @@
     {
       for ( int i = 0; i < face->uNumVertices; i++)
       {
-        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;
+        static_DetermineFacetIntersection_array_F8F200[i].vWorldPosition.x = (double)pIndoor->pVertices[face->pVertexIDs[i]].x;
+        static_DetermineFacetIntersection_array_F8F200[i].vWorldPosition.y = (double)pIndoor->pVertices[face->pVertexIDs[i]].y;
+        static_DetermineFacetIntersection_array_F8F200[i].vWorldPosition.z = (double)pIndoor->pVertices[face->pVertexIDs[i]].z;
       }
     }
   }
@@ -61,48 +61,48 @@
     auto v = (Vec3_int_ *)pOutdoor->pBModels[bmodel_id].pVertices.pVertices;
     for (uint i = 0; i < face->uNumVertices; ++i)
     {
-      static_sub_4C1026_array_F8F200[i].vWorldPosition.x = v[face->pVertexIDs[i]].x;
-      static_sub_4C1026_array_F8F200[i].vWorldPosition.y = v[face->pVertexIDs[i]].y;
-      static_sub_4C1026_array_F8F200[i].vWorldPosition.z = v[face->pVertexIDs[i]].z;
+      static_DetermineFacetIntersection_array_F8F200[i].vWorldPosition.x = v[face->pVertexIDs[i]].x;
+      static_DetermineFacetIntersection_array_F8F200[i].vWorldPosition.y = v[face->pVertexIDs[i]].y;
+      static_DetermineFacetIntersection_array_F8F200[i].vWorldPosition.z = v[face->pVertexIDs[i]].z;
     }
   }
   else assert(false);
 
-  pGame->pIndoorCameraD3D->ViewTransform(static_sub_4C1026_array_F8F200, face->uNumVertices);
-  pGame->pIndoorCameraD3D->Project(static_sub_4C1026_array_F8F200, face->uNumVertices, 1);
+  pGame->pIndoorCameraD3D->ViewTransform(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices);
+  pGame->pIndoorCameraD3D->Project(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices, 1);
 
   //v15 = this;
-  SortVectors_x(static_sub_4C1026_array_F8F200, 0, face->uNumVertices - 1);
-  if (static_sub_4C1026_array_F8F200[0].vWorldViewPosition.x > pick_depth)
+  SortVectors_x(static_DetermineFacetIntersection_array_F8F200, 0, face->uNumVertices - 1);
+  if (static_DetermineFacetIntersection_array_F8F200[0].vWorldViewPosition.x > pick_depth)
     return nullptr;
 
   float screenspace_center_x,
         screenspace_center_y;
-  GetPolygonScreenSpaceCenter(static_sub_4C1026_array_F8F200, face->uNumVertices, &screenspace_center_x, &screenspace_center_y);
-  if (IsPolygonOccludedByBillboard(static_sub_4C1026_array_F8F200, face->uNumVertices, screenspace_center_x, screenspace_center_y))
+  GetPolygonScreenSpaceCenter(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices, &screenspace_center_x, &screenspace_center_y);
+  if (IsPolygonOccludedByBillboard(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices, screenspace_center_x, screenspace_center_y))
     return nullptr;
 
   CastPickRay(pRay, screenspace_center_x, screenspace_center_y, pick_depth);
 
   if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-    PickOutdoorFaces_Mouse(pick_depth, pRay, &static_sub_4C1026_stru_F8FE00, &vis_face_filter, true);
+    PickOutdoorFaces_Mouse(pick_depth, pRay, &static_DetermineFacetIntersection_stru_F8FE00, &vis_face_filter, true);
   else if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
-    PickIndoorFaces_Mouse(pick_depth, pRay, &static_sub_4C1026_stru_F8FE00, &vis_face_filter);
+    PickIndoorFaces_Mouse(pick_depth, pRay, &static_DetermineFacetIntersection_stru_F8FE00, &vis_face_filter);
   else assert(false);
 
-  static_sub_4C1026_stru_F8FE00.create_object_pointers();
-  sort_object_pointers(static_sub_4C1026_stru_F8FE00.object_pointers, 0, static_sub_4C1026_stru_F8FE00.uNumPointers - 1);
-  if (!static_sub_4C1026_stru_F8FE00.uNumPointers)
+  static_DetermineFacetIntersection_stru_F8FE00.create_object_pointers();
+  sort_object_pointers(static_DetermineFacetIntersection_stru_F8FE00.object_pointers, 0, static_DetermineFacetIntersection_stru_F8FE00.uNumPointers - 1);
+  if (!static_DetermineFacetIntersection_stru_F8FE00.uNumPointers)
     return nullptr;
 
-  if (!static_sub_4C1026_stru_F8FE00.sub_4C2551(2, a3))
+  if (!static_DetermineFacetIntersection_stru_F8FE00.sub_4C2551(2, a3))
     return nullptr;
 
-  if (static_sub_4C1026_stru_F8FE00.uNumPointers)
-    return static_sub_4C1026_stru_F8FE00.object_pointers[0];
+  if (static_DetermineFacetIntersection_stru_F8FE00.uNumPointers)
+    return static_DetermineFacetIntersection_stru_F8FE00.object_pointers[0];
   else return nullptr;
 }
-// F91E08: using guessed type char static_sub_4C1026_byte_F91E08__init_flags;
+// F91E08: using guessed type char static_DetermineFacetIntersection_byte_F91E08__init_flags;
 
 //----- (004C12C3) --------------------------------------------------------
 bool Vis::IsPolygonOccludedByBillboard(RenderVertexSoft *vertices, int num_vertices, float x, float y)
@@ -214,7 +214,7 @@
 {
   for (uint i = 0; i < pRenderer->uNumBillboardsToDraw; ++i)
   {
-    auto d3d_billboard = pRenderer->pBillboardRenderListD3D + i;
+    auto d3d_billboard = &pRenderer->pBillboardRenderListD3D[i];
     if (is_part_of_selection((void *)i, filter) && IsPointInsideD3DBillboard(d3d_billboard, fX, fY))
     {
       if (DoesRayIntersectBillboard(fPickDepth, i))
@@ -366,7 +366,7 @@
     auto bmodel = &pOutdoor->pBModels[i];
     for (uint j = 0; j < bmodel->uNumFaces; ++j)
     {
-      auto face = bmodel->pFaces + j;
+      auto face = &bmodel->pFaces[j];
       if (is_part_of_selection(face, filter))
       {
         BLVFace blv_face;
@@ -375,7 +375,7 @@
         RenderVertexSoft intersection;
         if (Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &intersection, &blv_face, i))
         {
-          pGame->pIndoorCameraD3D->ViewTransform(&intersection, 1u);
+          pGame->pIndoorCameraD3D->ViewTransform(&intersection, 1);
           int v13 = _48B561_mess_with_scaling_along_z(/*v12, */intersection.vWorldViewPosition.x);
           v13 += PID(OBJECT_BModel, j | (i << 6));
 
@@ -1819,7 +1819,7 @@
         {
           if ( is_part_of_selection(pFace, filter) )
           {
-            v8 = _4C1026(pFace, PID(OBJECT_BModel, pFaceID), pick_depth);
+            v8 = DetermineFacetIntersection(pFace, PID(OBJECT_BModel, pFaceID), pick_depth);
             if ( v8 )
               list->AddObject(v8->object, v8->object_type, v8->sZValue);
           }
@@ -1844,7 +1844,7 @@
     auto bmodel = pOutdoor->pBModels + i;
     for (uint j = 0; j < bmodel->uNumFaces; ++j)
     {
-      auto face = bmodel->pFaces + j;
+      auto face = &bmodel->pFaces[j];
 
       if (is_part_of_selection(face, filter) )
       {
@@ -1852,7 +1852,7 @@
         blv_face.FromODM(face);
 
         int pid = PID(OBJECT_BModel, j | (i << 6));
-        if (auto object_info = _4C1026(&blv_face, pid, pick_depth))
+        if (auto object_info = DetermineFacetIntersection(&blv_face, pid, pick_depth))
           list->AddObject(object_info->object, object_info->object_type, object_info->sZValue);
       }
     }