# HG changeset patch # User Ritor1 # Date 1369972473 -21600 # Node ID 0158f383b49242586e6bdf1c4b401b64f93873cb # Parent d5dae0b4b98a67c52f68538da274767bce541d5a m diff -r d5dae0b4b98a -r 0158f383b492 Vis.cpp --- a/Vis.cpp Fri May 24 10:53:46 2013 +0600 +++ b/Vis.cpp Fri May 31 09:54:33 2013 +0600 @@ -27,7 +27,7 @@ //----- (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 @@ -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) { @@ -97,7 +97,7 @@ if (!SelectionFacetIntersectionList.uNumPointers) return nullptr; - if (!SelectionFacetIntersectionList.sub_4C2551(2, a3)) + if (!SelectionFacetIntersectionList.sub_4C2551(VisObjectType_Face, pid)) return nullptr; if (SelectionFacetIntersectionList.uNumPointers) @@ -899,30 +899,39 @@ } //----- (004C2551) -------------------------------------------------------- -Vis_ObjectInfo *Vis_SelectionList::sub_4C2551(int a2, int a3) +Vis_ObjectInfo *Vis_SelectionList::sub_4C2551(int pVisObjectType, int pid) { //unsigned int v3; // esi@1 - signed int v4; // edx@1 - char *v5; // eax@2 - Vis_ObjectInfo *result; // eax@6 + //signed int v4; // edx@1 + //char *v5; // eax@2 + //Vis_ObjectInfo *result; // eax@6 //v3 = this->uNumPointers; - v4 = 0; + if ( this->uNumPointers > 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]; + } + } + return false; + /*v4 = 0; if ( this->uNumPointers <= 0 ) return false; else { - v5 = (char *)&this->object_pool[0].sZValue; - while ( *((int *)v5 + 1) != a2 || (*(int *)v5 & 0xFFFF) != a3 ) + //v5 = (char *)&this->object_pool[0].sZValue; + while ( this->object_pool[v4].object_type != a2 || (this->object_pool[v4].sZValue & 0xFFFF) != a3 ) { ++v4; - v5 += 12; + //v5 += 12; if ( v4 >= this->uNumPointers ) return false; } result = &this->object_pool[v4]; } - return result; + return result;*/ } //----- (004C2591) -------------------------------------------------------- @@ -966,58 +975,62 @@ //----- (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 v9; // ebx@4 int v10; // ebx@6 Vis_ObjectInfo *v11; // eax@7 - Vis *thisa; // [sp+4h] [bp-4h]@1 + //Vis *thisa; // [sp+4h] [bp-4h]@1 Vis_ObjectInfo *a3a; // [sp+14h] [bp+Ch]@2 - v4 = left; - v5 = right; - thisa = this; - if ( right > left ) + //v4 = left; + //v5 = right; + //thisa = this; + if ( right > left )//left == 0 { - do + //do + for ( left; right > left; ++left ) { - v6 = v4 - 1; - a3a = pPointers[v5]; - for ( i = v5; ; pPointers[i] = v11 ) + v6 = left; + //a3a = pPointers[right]; + for ( i = right; ; pPointers[i] = v11 ) { v8 = a3a->sZValue; LOWORD(v8) = 0; - do + + //do + while ( pPointers[v6]->sZValue < pPointers[right]->sZValue ); { ++v6; - v9 = pPointers[v6]->sZValue; - LOWORD(v9) = 0; + //v9 = pPointers[v6]->sZValue; + //LOWORD(v9) = 0; } - while ( v9 < (unsigned int)v8 ); + 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 ); + //while ( right > left ); } }