diff Indoor.cpp @ 666:a5750c94b022

BSP
author Ritor1
date Wed, 13 Mar 2013 17:08:21 +0600
parents 92bc2544249d
children ecfb1b3c9a39 ee978b573798
line wrap: on
line diff
--- a/Indoor.cpp	Wed Mar 13 10:13:02 2013 +0600
+++ b/Indoor.cpp	Wed Mar 13 17:08:21 2013 +0600
@@ -275,15 +275,15 @@
     for (uint i = 0; i < pBspRenderer->uNumFaceIDs; ++i)
     {
       v2 = pBspRenderer->pFaceIDs[2 * i + 1];
-      if ( pBspRenderer->field_FA8[v2].std__vector_0007A8 == -1 )
+      if ( pBspRenderer->pSectors[v2].std__vector_0007A8 == -1 )
       {
         v6 = 0;
         v3 = 0;
       }
       else
       {
-        v3 = pBspRenderer->field_FA8[v2].std__vector_0007AC;
-        v6 = pBspRenderer->field_FA8[v2].pVertices;
+        v3 = pBspRenderer->pSectors[v2].std__vector_0007AC;
+        v6 = pBspRenderer->pSectors[v2].pVertices;
       }
       IndoorLocation::ExecDraw_d3d(pBspRenderer->pFaceIDs[2 * i], v3, 4, v6);
     }
@@ -293,7 +293,7 @@
     for (uint j = 0; j < pBspRenderer->uNumFaceIDs; ++j )
     {
       v5 = pBspRenderer->pFaceIDs[2 * j];
-      pBLVRenderParams->field_7C = &pBspRenderer->field_FA8[pBspRenderer->pFaceIDs[2 * j + 1]].field_C;
+      pBLVRenderParams->field_7C = &pBspRenderer->pSectors[pBspRenderer->pFaceIDs[2 * j + 1]].field_C;
       IndoorLocation::ExecDraw_sw(v5);
     }
   }
@@ -322,17 +322,17 @@
     {
       v1 = pBLVRenderParams->pRenderTarget;
       v6 = 0;
-      if ( (signed int)pBspRenderer->std__vector_000FA8 > 0 )
+      if ( (signed int)pBspRenderer->pNumSectors > 0 )
       {
         v7 = 0;
-        v2 = (char *)&pBspRenderer->field_FA8[0].field_C._viewport_space_w;
+        v2 = (char *)&pBspRenderer->pSectors[0].field_C._viewport_space_w;
         do
         {
           v3 = *((int *)v2 - 1);
           v4 = pRenderer->uTargetSurfacePitch * *((int *)v2 - 1);
           if ( v3 <= *(int *)v2 )
           {
-            v5 = (char *)&pBspRenderer->field_FA8[0].field_C.array_3D8[v3 + v7];
+            v5 = (char *)&pBspRenderer->pSectors[0].field_C.array_3D8[v3 + v7];
             do
             {
               v1[v4 + *((short *)v5 - 480)] = 255;
@@ -347,7 +347,7 @@
           v7 += 1126;
           v2 += 2252;
         }
-        while ( v6 < (signed int)pBspRenderer->std__vector_000FA8 );
+        while ( v6 < (signed int)pBspRenderer->pNumSectors );
       }
     }
   }
@@ -1276,14 +1276,14 @@
   //v3 = uFaceID;
   //v4 = this;
   //v5 = &pIndoor->pFaces[uFaceID];
-  field_FA8[std__vector_000FA8].std__vector_0007A8 = -1;
+  pSectors[pNumSectors].std__vector_0007A8 = -1;
   //v39 = &pIndoor->pFaces[uFaceID];
 
   auto pFace = &pIndoor->pFaces[uFaceID];
 
   if (pFace->TwoSided())
   {
-    auto p = &field_FA8[a2];
+    auto p = &pSectors[a2];
     //v6 = (int)((char *)this + 2252 * a2);
     //a0 = v6;
     if (p->uFaceID == uFaceID)
@@ -1301,20 +1301,20 @@
                                        + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 )
       {
         v7 = pFace->uSectorID;
-        if ( field_FA8[0].uSectorID == v7 )
+        if ( pSectors[0].uSectorID == v7 )
           v7 = pFace->uBackSectorID;
-        field_FA8[std__vector_000FA8].uSectorID = v7;
-        field_FA8[std__vector_000FA8].uFaceID = uFaceID;
-        field_FA8[std__vector_000FA8].uViewportX = pBLVRenderParams->uViewportX;
-        field_FA8[std__vector_000FA8].uViewportZ = pBLVRenderParams->uViewportZ;
-        field_FA8[std__vector_000FA8].uViewportY = pBLVRenderParams->uViewportY;
-        field_FA8[std__vector_000FA8].uViewportW = pBLVRenderParams->uViewportW;
-        field_FA8[std__vector_000FA8++].field_C._43F9E1(
+        pSectors[pNumSectors].uSectorID = v7;
+        pSectors[pNumSectors].uFaceID = uFaceID;
+        pSectors[pNumSectors].uViewportX = pBLVRenderParams->uViewportX;
+        pSectors[pNumSectors].uViewportZ = pBLVRenderParams->uViewportZ;
+        pSectors[pNumSectors].uViewportY = pBLVRenderParams->uViewportY;
+        pSectors[pNumSectors].uViewportW = pBLVRenderParams->uViewportW;
+        pSectors[pNumSectors++].field_C._43F9E1(
           pBLVRenderParams->uViewportX,
           pBLVRenderParams->uViewportY,
           pBLVRenderParams->uViewportZ,
           pBLVRenderParams->uViewportW);
-        sub_440639(std__vector_000FA8 - 1);
+        sub_440639(pNumSectors - 1);
         return;
       }
       //v5 = v39;
@@ -1361,26 +1361,24 @@
             a2 <= p->uViewportZ &&
             v12 >= p->uViewportY &&
             v37 <= p->uViewportW &&
-            sub_424829(v10, &field_FA8[std__vector_000FA8].field_C, &p->field_C, uFaceID))
+            sub_424829(v10, &pSectors[pNumSectors].field_C, &p->field_C, uFaceID))
         {
           //v17 = v39;
           v18 = pFace->uSectorID;
           if (p->uSectorID == v18 )
             v18 = pFace->uBackSectorID;
-          field_FA8[std__vector_000FA8].uSectorID = v18;
-          field_FA8[std__vector_000FA8].uFaceID = uFaceID;
-          field_FA8[std__vector_000FA8].uViewportX = pBLVRenderParams->uViewportX;
-          field_FA8[std__vector_000FA8].uViewportZ = pBLVRenderParams->uViewportZ;
-          field_FA8[std__vector_000FA8].uViewportY = pBLVRenderParams->uViewportY;
-          field_FA8[std__vector_000FA8].uViewportW = pBLVRenderParams->uViewportW;
+          pSectors[pNumSectors].uSectorID = v18;
+          pSectors[pNumSectors].uFaceID = uFaceID;
+          pSectors[pNumSectors].uViewportX = pBLVRenderParams->uViewportX;
+          pSectors[pNumSectors].uViewportZ = pBLVRenderParams->uViewportZ;
+          pSectors[pNumSectors].uViewportY = pBLVRenderParams->uViewportY;
+          pSectors[pNumSectors].uViewportW = pBLVRenderParams->uViewportW;
           //v38 = pGame->pStru10Instance;
           //a0a = pGame->pIndoorCameraD3D;
           if (p->std__vector_0007A8 == -1 )
           {
-            v29 = pGame->pStru10Instance->_49C681_DrawDebugStuff(
-                    pFace,
-                    field_FA8[std__vector_000FA8].std__vector_0007AC,
-                    field_FA8[std__vector_000FA8].pVertices);
+            v29 = pGame->pStru10Instance->_49C681_DrawDebugStuff(pFace, pSectors[pNumSectors].std__vector_0007AC,
+                    pSectors[pNumSectors].pVertices);
           }
           else
           {
@@ -1415,21 +1413,18 @@
               4,
               0,
               0);
-            v29 = pGame->pStru10Instance->_49C5DA(
-                    pFace,
-                    static_subAddFaceToRenderList_d3d_stru_F79E08,
-                    &a2,
-                    field_FA8[std__vector_000FA8].std__vector_0007AC,
-                    field_FA8[std__vector_000FA8].pVertices);
+            v29 = pGame->pStru10Instance->_49C5DA(pFace, static_subAddFaceToRenderList_d3d_stru_F79E08, &a2,
+                    pSectors[pNumSectors].std__vector_0007AC,
+                    pSectors[pNumSectors].pVertices);
           }
           if ( v29 )
           {
-            field_FA8[std__vector_000FA8].std__vector_0007A8 = uFaceID;
-            v30 = std__vector_000FA8;
+            pSectors[pNumSectors].std__vector_0007A8 = uFaceID;
+            v30 = pNumSectors;
             if ( v30 < 150 )
             {
               v31 = v30 + 1;
-              std__vector_000FA8 = v31;
+              pNumSectors = v31;
               sub_440639(v31 - 1);
             }
           }
@@ -1497,20 +1492,20 @@
                                        + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z) <= 589824 )
       {
         v6 = v21->uSectorID;
-        if ( v3->field_FA8[0].uSectorID == v6 )
+        if ( v3->pSectors[0].uSectorID == v6 )
           v6 = v21->uBackSectorID;
-        v3->field_FA8[v3->std__vector_000FA8].uSectorID = v6;
-        v3->field_FA8[v3->std__vector_000FA8].uFaceID = uFaceID;
-        v3->field_FA8[v3->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
-        v3->field_FA8[v3->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
-        v3->field_FA8[v3->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
-        v3->field_FA8[v3->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
-        v3->field_FA8[v3->std__vector_000FA8++].field_C._43F9E1(
+        v3->pSectors[v3->pNumSectors].uSectorID = v6;
+        v3->pSectors[v3->pNumSectors].uFaceID = uFaceID;
+        v3->pSectors[v3->pNumSectors].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
+        v3->pSectors[v3->pNumSectors].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
+        v3->pSectors[v3->pNumSectors].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
+        v3->pSectors[v3->pNumSectors].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
+        v3->pSectors[v3->pNumSectors++].field_C._43F9E1(
           SLOWORD(pBLVRenderParams->uViewportX),
           pBLVRenderParams->uViewportY,
           SLOWORD(pBLVRenderParams->uViewportZ),
           pBLVRenderParams->uViewportW);
-        v7 = v3->std__vector_000FA8 - 1;
+        v7 = v3->pNumSectors - 1;
         goto LABEL_14;
       }
       v4 = v21;
@@ -1556,22 +1551,22 @@
           && v23 <= *((short *)v20 + 2007)
           && v12 >= *((short *)v20 + 2006)
           && v22 <= *((short *)v20 + 2008)
-          && sub_424829(v10, &v3->field_FA8[v3->std__vector_000FA8].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) )
+          && sub_424829(v10, &v3->pSectors[v3->pNumSectors].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) )
         {
           v16 = v21->uSectorID;
           if ( *((short *)v20 + 2004) == v16 )
             v16 = v21->uBackSectorID;
-          v3->field_FA8[v3->std__vector_000FA8].uSectorID = v16;
-          v3->field_FA8[v3->std__vector_000FA8].uFaceID = uFaceID;
-          v3->field_FA8[v3->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
-          v3->field_FA8[v3->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
-          v3->field_FA8[v3->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
-          v3->field_FA8[v3->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
-          v17 = v3->std__vector_000FA8;
+          v3->pSectors[v3->pNumSectors].uSectorID = v16;
+          v3->pSectors[v3->pNumSectors].uFaceID = uFaceID;
+          v3->pSectors[v3->pNumSectors].uViewportX = LOWORD(pBLVRenderParams->uViewportX);
+          v3->pSectors[v3->pNumSectors].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ);
+          v3->pSectors[v3->pNumSectors].uViewportY = LOWORD(pBLVRenderParams->uViewportY);
+          v3->pSectors[v3->pNumSectors].uViewportW = LOWORD(pBLVRenderParams->uViewportW);
+          v17 = v3->pNumSectors;
           if ( v17 < 150 )
           {
             v18 = v17 + 1;
-            v3->std__vector_000FA8 = v18;
+            v3->pNumSectors = v18;
             v7 = v18 - 1;
 LABEL_14:
             sub_440639(v7);
@@ -1611,7 +1606,7 @@
       if ( v1 < (signed int)pIndoor->uNumFaces )
       {
         v2 = pBspRenderer->pFaceIDs[2 * i];
-        pBLVRenderParams->field_7C = &pBspRenderer->field_FA8[pBspRenderer->pFaceIDs[2 * i + 1]].field_C;
+        pBLVRenderParams->field_7C = &pBspRenderer->pSectors[pBspRenderer->pFaceIDs[2 * i + 1]].field_C;
         v3 = sub_423B5D(v2);
         if ( v3 )
         {