diff Vis.cpp @ 1053:1c10b24a4159

BLV picky-blicky
author Nomad
date Thu, 23 May 2013 19:03:36 +0200
parents 05c62d166182
children 0e0f1192aa57
line wrap: on
line diff
--- a/Vis.cpp	Thu May 23 18:26:05 2013 +0200
+++ b/Vis.cpp	Thu May 23 19:03:36 2013 +0200
@@ -323,11 +323,12 @@
     {
       if ( pFaceID < (signed int)pIndoor->uNumFaces )
       {
-        if ( is_part_of_selection(&pIndoor->pFaces[pFaceID], filter) )
+        auto face = pIndoor->pFaces + pFaceID;
+        if ( is_part_of_selection(face, filter) )
         {
-          if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) )
+          if ( !pGame->pIndoorCameraD3D->IsCulled(face) )
           {
-            if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[pFaceID], 0xFFFFFFFFu) )
+            if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, face, 0xFFFFFFFFu) )
             {
               pGame->pIndoorCameraD3D->ViewTransform(&a1, 1);
               v9 = fixpoint_from_float(/*v8, */a1.vWorldViewPosition.x);
@@ -346,6 +347,12 @@
             }
           }
         }
+        
+        if (face->uAttributes & FACE_PICKED)
+          face->uAttributes |= FACE_OUTLINED;
+        else
+          face->uAttributes &= ~FACE_OUTLINED;
+        face->uAttributes &= ~FACE_PICKED;
       }
     }
     v5 = v17 + 1;
@@ -388,10 +395,11 @@
           list->AddObject(face, VisObjectType_Face, v13);
         }
 
-        if (blv_face.uAttributes & 0x80000000)
+        if (blv_face.uAttributes & FACE_PICKED)
           face->uAttributes |= FACE_OUTLINED;
         else
           face->uAttributes &= ~FACE_OUTLINED;
+        blv_face.uAttributes &= ~FACE_PICKED;
       }
     }
   }
@@ -613,8 +621,6 @@
       IntersectPoint.z < pFace->pBounding.z1 || IntersectPoint.z > pFace->pBounding.z2 )
     return false;
 
-  pFace->uAttributes |= 0x80000000;
-
   if (uModelID != -1)
     ODM_CreateIntersectFacesVertexCoordList(&a, &b, intersect_face_vertex_coords_list_a, intersect_face_vertex_coords_list_b,
                                 &IntersectPoint, pFace, uModelID);
@@ -659,6 +665,8 @@
 
   if ( v16 != 1 )
     return false;
+
+  pFace->uAttributes |= FACE_PICKED;
   return true;
 /*
   int v5; // esi@10