diff Indoor.cpp @ 795:472ca68386d4

more stru10 & stru9
author Nomad
date Mon, 25 Mar 2013 14:23:40 +0200
parents 4a00901e063c
children e95389c8680a
line wrap: on
line diff
--- a/Indoor.cpp	Mon Mar 25 11:58:38 2013 +0200
+++ b/Indoor.cpp	Mon Mar 25 14:23:40 2013 +0200
@@ -271,9 +271,9 @@
 void IndoorLocation::ExecDraw(bool bD3D)
 {
   int v2; // eax@3
-  IndoorCameraD3D_Vec4 *v3; // edx@4
-  unsigned int v5; // ecx@9
-  RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4
+  //IndoorCameraD3D_Vec4 *v3; // edx@4
+  //unsigned int v5; // ecx@9
+  //RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4
 
   if (bD3D)
   {
@@ -281,27 +281,16 @@
     for (uint i = 0; i < pBspRenderer->num_faces; ++i)
     {
       v2 = pBspRenderer->faces[i].uNodeID;
-      if ( pBspRenderer->nodes[v2].std__vector_0007A8 == -1 )
-      {
-        v6 = 0;
-        v3 = 0;
-      }
+      if (pBspRenderer->nodes[v2].viewing_portal_id == -1)
+        IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, nullptr, 4, nullptr);
       else
-      {
-        v3 = pBspRenderer->nodes[v2].std__vector_0007AC;
-        v6 = pBspRenderer->nodes[v2].pPortalBounding;
-      }
-      IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, v3, 4, v6);
+        IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, pBspRenderer->nodes[v2].std__vector_0007AC, 4, pBspRenderer->nodes[v2].pPortalBounding);
     }
   }
-  else
+  else for (uint j = 0; j < pBspRenderer->num_faces; ++j )
   {
-    for (uint j = 0; j < pBspRenderer->num_faces; ++j )
-    {
-      v5 = pBspRenderer->faces[j].uFaceID;
-      pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[j].uNodeID].field_C;
-      IndoorLocation::ExecDraw_sw(v5);
-    }
+    pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[j].uNodeID].field_C;
+    IndoorLocation::ExecDraw_sw(pBspRenderer->faces[j].uFaceID);
   }
 }
 
@@ -517,7 +506,7 @@
     if (!pVertices ||
         (pGame->pStru9Instance->_498377(pPortalBounding, 4u, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) )
     {
-      if (pGame->pIndoorCameraD3D->_437285_prolly_colide_vertices_against_frustrum(static_vertices_F7C228, &uNumVerticesa,
+      if (pGame->pIndoorCameraD3D->CalcPortalShape(static_vertices_F7C228, &uNumVerticesa,
                      static_vertices_F7B628, pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum, 4, false, 0) != 1 || uNumVerticesa )
       {
         a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel);
@@ -1273,7 +1262,7 @@
   //double v27; // st7@47
   //signed int v28; // ST28_4@47
   char v29; // al@48
-  signed int v30; // eax@51
+  //signed int v30; // eax@51
   //int v31; // eax@52
   //unsigned int v32; // eax@55
   //__int16 v33; // cx@56
@@ -1287,7 +1276,7 @@
   //v3 = uFaceID;
   //v4 = this;
   //v5 = &pIndoor->pFaces[uFaceID];
-  nodes[num_nodes].std__vector_0007A8 = -1;
+  nodes[num_nodes].viewing_portal_id = -1;
   //v39 = &pIndoor->pFaces[uFaceID];
 
   auto pFace = &pIndoor->pFaces[uFaceID];
@@ -1420,57 +1409,40 @@
           nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW;
           //v38 = pGame->pStru10Instance;
           //a0a = pGame->pIndoorCameraD3D;
-          if (p->std__vector_0007A8 == -1 )
+          v29 = false;
+          if (p->viewing_portal_id == -1)
           {
-            v29 = pGame->pStru10Instance->MessWithPortal(pFace, nodes[num_nodes].std__vector_0007AC, nodes[num_nodes].pPortalBounding);
+            v29 = pGame->pStru10Instance->CalcPortalShape(pFace, nodes[num_nodes].std__vector_0007AC, nodes[num_nodes].pPortalBounding);
           }
           else
           {
             static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F7AA08[64];
             static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F79E08[64];
 
-            //v23 = 0;
-            unsigned int a2 = pFace->uNumVertices;
             for (uint k = 0; k < pFace->uNumVertices; ++k)
             {
-              //v24 = (char *)&static_subAddFaceToRenderList_d3d_stru_F7AA08[0].vWorldPosition.z;
-              //do
-              //{
-                //v25 = pFace->pVertexIDs[k];
-                //v26 = &pIndoor->pVertices[pFace->pVertexIDs[k]];
-                auto pVertex = &pIndoor->pVertices[pFace->pVertexIDs[k]];
-                //v27 = (double)v26->z;
-                //v28 = v26->y;
-                //v17 = v39;
-                static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.x = pVertex->x;
-                static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.y = pVertex->y;
-                static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.z = pVertex->z;
-                //v24 += 48;
-              //}
-              //while ( v23 < a2 );
+              static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.x = pIndoor->pVertices[pFace->pVertexIDs[k]].x;
+              static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[k]].y;
+              static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[k]].z;
             }
-            pGame->pIndoorCameraD3D->_437285_prolly_colide_vertices_against_frustrum(
-              static_subAddFaceToRenderList_d3d_stru_F7AA08,
-              &a2,
-              static_subAddFaceToRenderList_d3d_stru_F79E08,
-              p->std__vector_0007AC,
-              4,
-              0,
-              0);
-            v29 = pGame->pStru10Instance->_49C5DA(pFace, static_subAddFaceToRenderList_d3d_stru_F79E08, (int *)&a2,
-                    nodes[num_nodes].std__vector_0007AC,
-                    nodes[num_nodes].pPortalBounding);
+
+
+            unsigned int a2 = pFace->uNumVertices;
+            pGame->pIndoorCameraD3D->CalcPortalShape(static_subAddFaceToRenderList_d3d_stru_F7AA08,
+                                                     &a2,
+                                                     static_subAddFaceToRenderList_d3d_stru_F79E08,
+                                                     p->std__vector_0007AC, 4, 0, 0);
+
+            v29 = pGame->pStru10Instance->_49C5DA(pFace, static_subAddFaceToRenderList_d3d_stru_F79E08, &a2,
+                                                  nodes[num_nodes].std__vector_0007AC,
+                                                  nodes[num_nodes].pPortalBounding);
           }
           if ( v29 )
           {
-            nodes[num_nodes].std__vector_0007A8 = uFaceID;
-            v30 = num_nodes;
-            if ( v30 < 150 )
-            {
-              //v31 = v30 + 1;
-              num_nodes = v30 + 1;
-              AddBspNodeToRenderList(v30);
-            }
+            assert(num_nodes < 150);
+
+            nodes[num_nodes].viewing_portal_id = uFaceID;
+            AddBspNodeToRenderList(++num_nodes - 1);
           }
           if (pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_SW_OUTLINES)
             pGame->pIndoorCameraD3D->PrepareAndDrawDebugOutline(pFace, 0x1E1EFF);