# HG changeset patch # User Ritor1 # Date 1370316916 -21600 # Node ID ce5ff6d32200636ed42c407357381c63f4f42267 # Parent dac817fbf85a1aa34d4404a3c4f3d1eb7e0f2b0c m diff -r dac817fbf85a -r ce5ff6d32200 Vis.cpp --- a/Vis.cpp Mon Jun 03 09:32:05 2013 +0600 +++ b/Vis.cpp Tue Jun 04 09:35:16 2013 +0600 @@ -34,8 +34,8 @@ RenderVertexSoft pRay[2]; // [sp+20h] [bp-70h]@17 int v20; // [sp+84h] [bp-Ch]@10 - static Vis_SelectionList SelectionFacetIntersectionList;//stru_F8FE00 - SelectionFacetIntersectionList.uNumPointers = 0; + static Vis_SelectionList SelectedPointersList;//stru_F8FE00 + SelectedPointersList.uNumPointers = 0; static bool _init_flag = false; static RenderVertexSoft static_DetermineFacetIntersection_array_F8F200[64]; @@ -87,21 +87,21 @@ CastPickRay(pRay, screenspace_center_x, screenspace_center_y, pick_depth); if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - PickOutdoorFaces_Mouse(pick_depth, pRay, &SelectionFacetIntersectionList, &vis_face_filter, true); + PickOutdoorFaces_Mouse(pick_depth, pRay, &SelectedPointersList, &vis_face_filter, true); else if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - PickIndoorFaces_Mouse(pick_depth, pRay, &SelectionFacetIntersectionList, &vis_face_filter); + PickIndoorFaces_Mouse(pick_depth, pRay, &SelectedPointersList, &vis_face_filter); else assert(false); - SelectionFacetIntersectionList.create_object_pointers(); - sort_object_pointers(SelectionFacetIntersectionList.object_pointers, 0, SelectionFacetIntersectionList.uNumPointers - 1); - if (!SelectionFacetIntersectionList.uNumPointers) + SelectedPointersList.create_object_pointers(); + sort_object_pointers(SelectedPointersList.object_pointers, 0, SelectedPointersList.uNumPointers - 1); + if (!SelectedPointersList.uNumPointers) return nullptr; - if (!SelectionFacetIntersectionList.sub_4C2551(VisObjectType_Face, pid)) + if (!SelectedPointersList.SelectionPointers(VisObjectType_Face, pid)) return nullptr; - if (SelectionFacetIntersectionList.uNumPointers) - return SelectionFacetIntersectionList.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; @@ -899,7 +899,7 @@ } //----- (004C2551) -------------------------------------------------------- -Vis_ObjectInfo *Vis_SelectionList::sub_4C2551(int pVisObjectType, int pid) +Vis_ObjectInfo *Vis_SelectionList::SelectionPointers(int pVisObjectType, int pid) { //unsigned int v3; // esi@1 //signed int v4; // edx@1 @@ -975,62 +975,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 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 - //v4 = left; - //v5 = right; - //thisa = this; - if ( right > left )//left == 0 + v4 = left; + v5 = right; + if ( right > left ) { - //do - for ( left; right > left; ++left ) + do { - v6 = left; - //a3a = pPointers[right]; - for ( i = right; ; pPointers[i] = v11 ) + v6 = v4 - 1; + a3a = pPointers[v5]; + for ( i = v5; ; pPointers[i] = v11 ) { v8 = a3a->sZValue; LOWORD(v8) = 0; - - //do - while ( pPointers[v6]->sZValue < pPointers[right]->sZValue ); + do { ++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 ( pPointers[i]->sZValue > pPointers[right]->sZValue ); - + while ( v10 > (unsigned int)v8 ); 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, left, v6 - 1); - //left = v6 + 1; + sort_object_pointers(pPointers, v4, v6 - 1); + v4 = v6 + 1; } - //while ( right > left ); + while ( right > v6 + 1 ); } }