changeset 1171:28ee6610a3d2

SelectionFacetIntersectionList
author Ritor1
date Fri, 24 May 2013 10:53:33 +0600
parents 2e5220c27511
children d5dae0b4b98a
files Vis.cpp
diffstat 1 files changed, 16 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/Vis.cpp	Thu May 23 17:17:12 2013 +0600
+++ b/Vis.cpp	Fri May 24 10:53:33 2013 +0600
@@ -34,8 +34,8 @@
   RenderVertexSoft pRay[2]; // [sp+20h] [bp-70h]@17
   int v20; // [sp+84h] [bp-Ch]@10
 
-  static Vis_SelectionList static_DetermineFacetIntersection_stru_F8FE00;
-  static_DetermineFacetIntersection_stru_F8FE00.uNumPointers = 0;
+  static Vis_SelectionList SelectionFacetIntersectionList;//stru_F8FE00
+  SelectionFacetIntersectionList.uNumPointers = 0;
 
   static bool _init_flag = false;
   static RenderVertexSoft static_DetermineFacetIntersection_array_F8F200[64];
@@ -74,7 +74,6 @@
   pGame->pIndoorCameraD3D->ViewTransform(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices);
   pGame->pIndoorCameraD3D->Project(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices, 1);
 
-  //v15 = this;
   SortVectors_x(static_DetermineFacetIntersection_array_F8F200, 0, face->uNumVertices - 1);
   if (static_DetermineFacetIntersection_array_F8F200[0].vWorldViewPosition.x > pick_depth)
     return nullptr;
@@ -88,21 +87,21 @@
   CastPickRay(pRay, screenspace_center_x, screenspace_center_y, pick_depth);
 
   if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-    PickOutdoorFaces_Mouse(pick_depth, pRay, &static_DetermineFacetIntersection_stru_F8FE00, &vis_face_filter, true);
+    PickOutdoorFaces_Mouse(pick_depth, pRay, &SelectionFacetIntersectionList, &vis_face_filter, true);
   else if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
-    PickIndoorFaces_Mouse(pick_depth, pRay, &static_DetermineFacetIntersection_stru_F8FE00, &vis_face_filter);
+    PickIndoorFaces_Mouse(pick_depth, pRay, &SelectionFacetIntersectionList, &vis_face_filter);
   else assert(false);
 
-  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)
+  SelectionFacetIntersectionList.create_object_pointers();
+  sort_object_pointers(SelectionFacetIntersectionList.object_pointers, 0, SelectionFacetIntersectionList.uNumPointers - 1);
+  if (!SelectionFacetIntersectionList.uNumPointers)
     return nullptr;
 
-  if (!static_DetermineFacetIntersection_stru_F8FE00.sub_4C2551(2, a3))
+  if (!SelectionFacetIntersectionList.sub_4C2551(2, a3))
     return nullptr;
 
-  if (static_DetermineFacetIntersection_stru_F8FE00.uNumPointers)
-    return static_DetermineFacetIntersection_stru_F8FE00.object_pointers[0];
+  if (SelectionFacetIntersectionList.uNumPointers)
+    return SelectionFacetIntersectionList.object_pointers[0];
   else return nullptr;
 }
 // F91E08: using guessed type char static_DetermineFacetIntersection_byte_F91E08__init_flags;
@@ -894,18 +893,15 @@
 //----- (004C2551) --------------------------------------------------------
 Vis_ObjectInfo *Vis_SelectionList::sub_4C2551(int a2, int a3)
 {
-  unsigned int v3; // esi@1
+  //unsigned int v3; // esi@1
   signed int v4; // edx@1
   char *v5; // eax@2
   Vis_ObjectInfo *result; // eax@6
 
-  v3 = this->uNumPointers;
+  //v3 = this->uNumPointers;
   v4 = 0;
-  if ( (signed int)v3 <= 0 )
-  {
-LABEL_6:
-    result = 0;
-  }
+  if ( this->uNumPointers <= 0 )
+    return false;
   else
   {
     v5 = (char *)&this->object_pool[0].sZValue;
@@ -913,8 +909,8 @@
     {
       ++v4;
       v5 += 12;
-      if ( v4 >= (signed int)v3 )
-        goto LABEL_6;
+      if ( v4 >= this->uNumPointers )
+       return false;
     }
     result = &this->object_pool[v4];
   }