changeset 1187:02e2a5c1ebc0

BspRernderer refactoring continued
author Ritor1
date Fri, 07 Jun 2013 11:30:29 +0600
parents b542660e7302
children 9541e9d1e5fa
files Indoor.cpp mm7_1.cpp
diffstat 2 files changed, 38 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Wed Jun 05 17:40:17 2013 +0600
+++ b/Indoor.cpp	Fri Jun 07 11:30:29 2013 +0600
@@ -302,11 +302,11 @@
     pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
     for (uint i = 0; i < pBspRenderer->num_faces; ++i)
     {
-      v2 = pBspRenderer->faces[i].uNodeID;
-      //if (pBspRenderer->nodes[v2].viewing_portal_id == -1)
+      //v2 = pBspRenderer->faces[i].uNodeID;
+      if (pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].viewing_portal_id == -1)
         IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, nullptr, 4, nullptr);
-      //else
-        //IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, pBspRenderer->nodes[v2].std__vector_0007AC, 4, pBspRenderer->nodes[v2].pPortalBounding);
+      else
+        IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].std__vector_0007AC, 4, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].pPortalBounding);
     }
   }
   else for (uint j = 0; j < pBspRenderer->num_faces; ++j )
@@ -521,7 +521,7 @@
     }
 
     if (!pVertices ||
-        (pGame->pStru9Instance->_498377(pPortalBounding, 4u, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) )
+        (pGame->pStru9Instance->_498377(pPortalBounding, 4, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) )
     {
       if (pGame->pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa,
                      static_vertices_F7B628, pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa )
--- a/mm7_1.cpp	Wed Jun 05 17:40:17 2013 +0600
+++ b/mm7_1.cpp	Fri Jun 07 11:30:29 2013 +0600
@@ -2306,7 +2306,7 @@
 
   //try graphic engine with function returning 1 always, and without
   //return true;
-  if ( !pNumVertices )
+  if ( pNumVertices <= 1 )
     return false;
   v7 = stru_50B700._screen_space_y[0];
   v65 = 0;
@@ -2321,8 +2321,7 @@
     v63 = -1;
     v64 = 1;
   }
-  if ( pNumVertices <= 1 )
-    return false;
+
   for ( v6 = 1; v6 < pNumVertices; ++v6 )
   {
     if ( stru_50B700._screen_space_y[v6] >= v7 )
@@ -2338,33 +2337,29 @@
   }
   if ( v8 == v7 )
     return false;
+
   v10 = v65;
   a2->_viewport_space_y = v7;
   a2->_viewport_space_w = v8;
   v55 = v65;
-  if ( pNumVertices > 0 )
+
+  for ( v68 = 0; v68 < pNumVertices; ++v68 )
   {
-    //v11 = v65;
-    for ( v68 = 0; v68 < pNumVertices; ++v68 )
+    v10 += v64;
+    if ( v10 < pNumVertices )
     {
-      v10 += v64;
-      if ( v10 < pNumVertices )
-      {
-        if ( v10 < 0 )
-          v10 += pNumVertices;
-      }
-      else
-      {
-        v10 -= pNumVertices;
-      }
-      if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v65] )
-      {
-        v55 = v10;
-        v65 = v10;
-      }
-      if ( stru_50B700._screen_space_y[v10] == v8 )
-        break;
+      if ( v10 < 0 )
+        v10 += pNumVertices;
     }
+    else
+      v10 -= pNumVertices;
+    if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v65] )
+    {
+      v55 = v10;
+      v65 = v10;
+    }
+    if ( stru_50B700._screen_space_y[v10] == v8 )
+      break;
   }
   v13 = v55 + v64;
   if ( v13 < pNumVertices )
@@ -2373,9 +2368,7 @@
       v13 += pNumVertices;
   }
   else
-  {
     v13 -= pNumVertices;
-  }
   if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] )
   {
     v62 = stru_50B700._screen_space_x[v55] << 16;
@@ -2384,29 +2377,24 @@
   }
   v15 = v65;
   v61 = v65;
-  if ( pNumVertices > 0 )
+
+  for ( v69 = 0; v69 < pNumVertices; ++v69 )
   {
-    //v16 = v65;
-    for ( v69 = 0; v69 < pNumVertices; ++v69 )
+    v15 += v63;
+    if ( v15 < pNumVertices )
     {
-      v15 += v63;
-      if ( v15 < pNumVertices )
-      {
-        if ( v15 < 0 )
-          v15 += pNumVertices;
-      }
-      else
-      {
-        v15 -= pNumVertices;
-      }
-      if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v65] )
-      {
-        v61 = v15;
-        v65 = v15;
-      }
-      if ( stru_50B700._screen_space_y[v15] == v8 )
-        break;
+      if ( v15 < 0 )
+        v15 += pNumVertices;
     }
+    else
+      v15 -= pNumVertices;
+    if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v65] )
+    {
+      v61 = v15;
+      v65 = v15;
+    }
+    if ( stru_50B700._screen_space_y[v15] == v8 )
+      break;
   }
   v18 = v63 + v61;
   if ( v18 < pNumVertices )
@@ -2415,9 +2403,7 @@
       v18 += pNumVertices;
   }
   else
-  {
     v18 -= pNumVertices;
-  }
   v19 = v18;
   v20 = v61;
   if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] )
@@ -2443,9 +2429,7 @@
             v13 += pNumVertices;
         }
         else
-        {
           v13 -= pNumVertices;
-        }
         v26 = v13;
         //v27 = stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24];
         if ( stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24] > 0 )
@@ -2464,9 +2448,7 @@
             v18 += pNumVertices;
         }
         else
-        {
           v18 -= pNumVertices;
-        }
         v31 = v18;
         //v32 = stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29];
         if ( stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29] > 0 )