changeset 1138:f947bedb2859

Слияние
author Ritor1
date Sat, 01 Jun 2013 10:32:31 +0600
parents 62c759bc49f7 (diff) d98415be04ca (current diff)
children a3ad3f38a7da
files Arcomage.cpp Vis.cpp Vis.h mm7_2.cpp
diffstat 4 files changed, 51 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/Arcomage.cpp	Fri May 31 23:38:43 2013 +0200
+++ b/Arcomage.cpp	Sat Jun 01 10:32:31 2013 +0600
@@ -1602,7 +1602,7 @@
     while ( v2 );
     v0 += 47;
   }
-  while ( (signed int)v0 < (signed int)&pArcomageGame->msg.pt.y );
+  while ( (signed int)v0 < 2 );//(signed int)&pArcomageGame->msg.pt.y );
   v4 = 0;
   do
   {
@@ -1616,7 +1616,7 @@
     *v7 = 1;
     dword_505314[v4] = dword_505554[v6];
     result = byte_5054E8[v6];
-    array_4FAC10[9].field_4[v4++ + 4232] = result;
+    array_4FAC10[9].field_4[v4++ + 4232] = result;// pArcomageGame
   }
   while ( v4 < 108 );
   dword_4FABC8 = 0;
@@ -5801,7 +5801,7 @@
     v5->_40DFD1();
     ++v5;
   }
-  while ( (signed int)v5 < (signed int)&unk_5052C8 );
+  while ( (signed int)v5 < 10 );//(signed int)&unk_5052C8 );
   dword_4FABBC = -1;
   amuint_4FAA4C = -1;
   byte_4FAA74 = 0;
--- a/Vis.cpp	Fri May 31 23:38:43 2013 +0200
+++ b/Vis.cpp	Sat Jun 01 10:32:31 2013 +0600
@@ -27,15 +27,15 @@
 
 
 //----- (004C1026) --------------------------------------------------------
-Vis_ObjectInfo *Vis::DetermineFacetIntersection(BLVFace *face, unsigned int a3, float pick_depth)
+Vis_ObjectInfo *Vis::DetermineFacetIntersection(BLVFace *face, unsigned int pid, 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_DetermineFacetIntersection_stru_F8FE00;
-  static_DetermineFacetIntersection_stru_F8FE00.uNumPointers = 0;
+  static Vis_SelectionList SelectedPointersList;
+  SelectedPointersList.uNumPointers = 0;
 
   static bool _init_flag = false;
   static RenderVertexSoft static_DetermineFacetIntersection_array_F8F200[64];
@@ -60,7 +60,7 @@
   }
   else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
   {
-    uint bmodel_id = a3 >> 9;
+    uint bmodel_id = pid >> 9;
     auto v = (Vec3_int_ *)pOutdoor->pBModels[bmodel_id].pVertices.pVertices;
     for (uint i = 0; i < face->uNumVertices; ++i)
     {
@@ -88,21 +88,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, &SelectedPointersList, &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, &SelectedPointersList, &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)
+  SelectedPointersList.create_object_pointers();
+  sort_object_pointers(SelectedPointersList.object_pointers, 0, SelectedPointersList.uNumPointers - 1);
+  if (!SelectedPointersList.uNumPointers)
     return nullptr;
 
-  if (!static_DetermineFacetIntersection_stru_F8FE00.sub_4C2551(2, a3))
+  if (!SelectedPointersList.SelectionPointers(VisObjectType_Face, pid))
     return nullptr;
 
-  if (static_DetermineFacetIntersection_stru_F8FE00.uNumPointers)
-    return static_DetermineFacetIntersection_stru_F8FE00.object_pointers[0];
+  if (SelectedPointersList.uNumPointers)
+    return SelectedPointersList.object_pointers[0];
   else return nullptr;
 }
 // F91E08: using guessed type char static_DetermineFacetIntersection_byte_F91E08__init_flags;
@@ -376,8 +376,6 @@
     auto bmodel = &pOutdoor->pBModels[i];
     for (uint j = 0; j < bmodel->uNumFaces; ++j)
     {
-		//if ( i == 1 && j == 30 )//
-            //__debugbreak();//
       auto face = &bmodel->pFaces[j];
       if (is_part_of_selection(face, filter))
       {
@@ -902,33 +900,17 @@
 }
 
 //----- (004C2551) --------------------------------------------------------
-Vis_ObjectInfo *Vis_SelectionList::sub_4C2551(int a2, int a3)
+Vis_ObjectInfo *Vis_SelectionList::SelectionPointers(int pVisObjectType, int pid)
 {
-  unsigned int v3; // esi@1
-  signed int v4; // edx@1
-  char *v5; // eax@2
-  Vis_ObjectInfo *result; // eax@6
-
-  v3 = this->uNumPointers;
-  v4 = 0;
-  if ( (signed int)v3 <= 0 )
+  if ( this->uNumPointers > 0 )
   {
-LABEL_6:
-    result = 0;
+    for ( uint i = 0; i < this->uNumPointers; ++i )
+    {
+      if ( this->object_pool[i].object_type == pVisObjectType && (this->object_pool[i].sZValue & 0xFFFF) == pid )
+        return &this->object_pool[i];
+    }
   }
-  else
-  {
-    v5 = (char *)&this->object_pool[0].sZValue;
-    while ( *((int *)v5 + 1) != a2 || (*(int *)v5 & 0xFFFF) != a3 )
-    {
-      ++v4;
-      v5 += 12;
-      if ( v4 >= (signed int)v3 )
-        goto LABEL_6;
-    }
-    result = &this->object_pool[v4];
-  }
-  return result;
+  return false;
 }
 
 //----- (004C2591) --------------------------------------------------------
@@ -972,56 +954,56 @@
 //----- (004C264A) --------------------------------------------------------
 void Vis::sort_object_pointers(Vis_ObjectInfo **pPointers, int left, int right)
 {
-  int v4; // edx@1
-  int v5; // ebx@1
+  //int v4; // edx@1
+  //int v5; // ebx@1
   int v6; // esi@2
   signed int i; // ecx@2
-  int v8; // eax@3
-  int v9; // ebx@4
-  int v10; // ebx@6
+  //int v8; // eax@3
+  //int v9; // ebx@4
+  //int v10; // ebx@6
   Vis_ObjectInfo *v11; // eax@7
-  Vis *thisa; // [sp+4h] [bp-4h]@1
-  Vis_ObjectInfo *a3a; // [sp+14h] [bp+Ch]@2
+  //Vis *thisa; // [sp+4h] [bp-4h]@1
+  //Vis_ObjectInfo *a3a; // [sp+14h] [bp+Ch]@2
 
-  v4 = left;
-  v5 = right;
-  thisa = this;
+  //v4 = left;
+  //v5 = right;
+  //thisa = this;
   if ( right > left )
   {
     do
     {
-      v6 = v4 - 1;
-      a3a = pPointers[v5];
-      for ( i = v5; ; pPointers[i] = v11 )
+      v6 = left - 1;
+      //a3a = pPointers[right];
+      for ( i = right; ; pPointers[i] = v11 )
       {
-        v8 = a3a->sZValue;
-        LOWORD(v8) = 0;
+        //v8 = a3a->sZValue;
+        //LOWORD(v8) = 0;
         do
         {
           ++v6;
-          v9 = pPointers[v6]->sZValue;
-          LOWORD(v9) = 0;
+          //v9 = pPointers[v6]->sZValue;
+          //LOWORD(v9) = 0;
         }
-        while ( v9 < (unsigned int)v8 );
+        while ( pPointers[v6]->sZValue < pPointers[right]->sZValue );
         do
         {
           if ( i < 1 )
             break;
           --i;
-          v10 = pPointers[i]->sZValue;
-          LOWORD(v10) = 0;
+          //v10 = pPointers[i]->sZValue;
+          //LOWORD(v10) = 0;
         }
-        while ( v10 > (unsigned int)v8 );
+        while ( pPointers[i]->sZValue > pPointers[right]->sZValue );
         v11 = pPointers[v6];
         if ( v6 >= i )
           break;
         pPointers[v6] = pPointers[i];
       }
-      v5 = right;
+      //v5 = right;
       pPointers[v6] = pPointers[right];
       pPointers[right] = v11;
-      sort_object_pointers(pPointers, v4, v6 - 1);
-      v4 = v6 + 1;
+      sort_object_pointers(pPointers, left, v6 - 1);
+      left = v6 + 1;
     }
     while ( right > v6 + 1 );
   }
--- a/Vis.h	Fri May 31 23:38:43 2013 +0200
+++ b/Vis.h	Sat Jun 01 10:32:31 2013 +0600
@@ -60,7 +60,7 @@
   Vis_SelectionList();
   //----- (004C0585) --------------------------------------------------------
   ~Vis_SelectionList() {}
-  Vis_ObjectInfo *sub_4C2551(int a2, int a3);
+  Vis_ObjectInfo *SelectionPointers(int a2, int a3);
   void            create_object_pointers(PointerCreationType type = All);
 
   inline void AddObject(void *object, VisObjectType type, int packed_zval)
--- a/mm7_2.cpp	Fri May 31 23:38:43 2013 +0200
+++ b/mm7_2.cpp	Sat Jun 01 10:32:31 2013 +0600
@@ -9643,13 +9643,13 @@
       if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
       {
         int bmodel_id = a1 >> 9,
-            face_id = PID_ID(a1) &0x3F;
+            face_id = PID_ID(a1) & 0x3F;
         if (bmodel_id >= pOutdoor->uNumBModels)
           return 1;
         auto face = &pOutdoor->pBModels[bmodel_id].pFaces[face_id];
-        if (face->uAttributes & 0x100000 || (v6 = face->sCogTriggeredID) == 0 )
+        if (face->uAttributes & 0x100000 || face->sCogTriggeredID == 0 )
           return 1;
-        EventProcessor((signed __int16)v6, v2, 1);
+        EventProcessor((signed __int16)face->sCogTriggeredID, v2, 1);
       }
       else
       {