Mercurial > mm7
changeset 1174:05247ad19710
Слияние
author | Ritor1 |
---|---|
date | Fri, 31 May 2013 09:54:44 +0600 |
parents | 0158f383b492 (diff) f87e7d1aa9ec (current diff) |
children | 9e3bacdbec56 |
files | Vis.cpp |
diffstat | 1 files changed, 61 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/Vis.cpp Fri May 31 00:49:13 2013 +0200 +++ b/Vis.cpp Fri May 31 09:54:44 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 SelectionFacetIntersectionList;//stru_F8FE00 + SelectionFacetIntersectionList.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) { @@ -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(VisObjectType_Face, pid)) 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; @@ -376,8 +375,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 +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 + //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 ) + //v3 = this->uNumPointers; + 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]; + } } + 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; - if ( v4 >= (signed int)v3 ) - goto LABEL_6; + //v5 += 12; + if ( v4 >= this->uNumPointers ) + return false; } result = &this->object_pool[v4]; } - return result; + return result;*/ } //----- (004C2591) -------------------------------------------------------- @@ -972,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 ); } }