changeset 1380:635500df9320

Слияние
author Ritor1
date Tue, 16 Jul 2013 14:11:43 +0600
parents db3769ae574c (current diff) 1fb9f4b9b6a7 (diff)
children 729635c2bb40
files Indoor.cpp
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Tue Jul 16 14:11:35 2013 +0600
+++ b/Indoor.cpp	Tue Jul 16 14:11:43 2013 +0600
@@ -6831,6 +6831,7 @@
   check_event_triggers();
 }
 //----- (00424829) --------------------------------------------------------
+// Finds out if current portal can be seen through the previous portal
 bool PortalFrustrum(int pNumVertices, BspRenderer_PortalViewportData *far_portal, BspRenderer_PortalViewportData *near_portal, int uFaceID)
 {
   int min_y; // esi@5
@@ -6887,16 +6888,15 @@
   //get min and max y for portal(     y  )
   for ( uint i = 1; i < pNumVertices; ++i )
   {
-    if ( PortalFace._screen_space_y[i] >= min_y )
-    {
-      if ( PortalFace._screen_space_y[i] > max_y )
-        max_y = PortalFace._screen_space_y[i];
-    }
-    else
+    if (PortalFace._screen_space_y[i] < min_y)
     {
       min_y_ID = i;
       min_y = PortalFace._screen_space_y[i];
     }
+    else if (PortalFace._screen_space_y[i] > max_y)
+    {
+      max_y = PortalFace._screen_space_y[i];
+    }
   }
   if ( max_y == min_y )
     return false;
@@ -6937,8 +6937,9 @@
   if ( PortalFace._screen_space_y[v13] != PortalFace._screen_space_y[min_y_ID2] )
   {
     v62 = PortalFace._screen_space_x[min_y_ID2] << 16;
-    v54 = ((PortalFace._screen_space_x[v13] - PortalFace._screen_space_x[min_y_ID2]) << 16) / (PortalFace._screen_space_y[v13] - PortalFace._screen_space_y[min_y_ID2]);
-    far_portal->viewport_left_side[min_y] = PortalFace._screen_space_x[min_y_ID2];
+    v54 = ((PortalFace._screen_space_x[v13] - PortalFace._screen_space_x[min_y_ID2]) << 16) /
+           (PortalFace._screen_space_y[v13] - PortalFace._screen_space_y[min_y_ID2]);
+    far_portal->viewport_left_side[min_y] = (short)PortalFace._screen_space_x[min_y_ID2];
   }
   //****************************************************************************************************************************************
   //
@@ -6975,8 +6976,9 @@
   if ( PortalFace._screen_space_y[v19] != PortalFace._screen_space_y[v61] )
   {
     v61 = PortalFace._screen_space_x[v20] << 16;
-    v53 = ((PortalFace._screen_space_x[v19] - PortalFace._screen_space_x[v20]) << 16) / PortalFace._screen_space_y[v19] - PortalFace._screen_space_y[v20];
-    far_portal->viewport_right_side[max_y] = PortalFace._screen_space_x[v20];
+    v53 = ((PortalFace._screen_space_x[v19] - PortalFace._screen_space_x[v20]) << 16) /
+           (PortalFace._screen_space_y[v19] - PortalFace._screen_space_y[v20]);
+    far_portal->viewport_right_side[max_y] = (short)PortalFace._screen_space_x[v20];
   }
   //****************************************************************************************************************************************
   v22 = min_y;
@@ -6998,7 +7000,7 @@
         v26 = v13;
         if ( PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24] > 0 )
         {
-          v54 = ((PortalFace._screen_space_x[v26] - PortalFace._screen_space_x[v24]) << 16) / PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24];
+          v54 = ((PortalFace._screen_space_x[v26] - PortalFace._screen_space_x[v24]) << 16) / (PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24]);
           v62 = PortalFace._screen_space_x[v24] << 16;
         }
       }
@@ -7016,7 +7018,7 @@
         v31 = v18;
         if ( PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29] > 0 )
         {
-          v53 = ((PortalFace._screen_space_x[v31] - PortalFace._screen_space_x[v29]) << 16) / PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29];
+          v53 = ((PortalFace._screen_space_x[v31] - PortalFace._screen_space_x[v29]) << 16) / (PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29]);
           v61 = PortalFace._screen_space_x[v29] << 16;
         }
       }