changeset 666:a5750c94b022

BSP
author Ritor1
date Wed, 13 Mar 2013 17:08:21 +0600
parents 92bc2544249d
children 8c6c41037c39 9824e2eeee30 ee978b573798
files Indoor.cpp Indoor_stuff.h mm7_3.cpp mm7_5.cpp
diffstat 4 files changed, 73 insertions(+), 79 deletions(-) [+]
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 )
         {
--- a/Indoor_stuff.h	Wed Mar 13 10:13:02 2013 +0600
+++ b/Indoor_stuff.h	Wed Mar 13 17:08:21 2013 +0600
@@ -75,7 +75,7 @@
    //    (void (__thiscall *)(void *))stru170_stru0::stru170_stru0,
    //    (void (__thiscall *)(void *))stru170_stru0::dtor);
     uNumFaceIDs = 0;
-    std__vector_000FA8 = 0;
+    pNumSectors = 0;
     uNumVisibleNotEmptySectors = 0;
   }
 
@@ -85,10 +85,10 @@
   void DrawFaceOutlines();
 
   unsigned int uNumFaceIDs;
-  __int16 pFaceIDs[150];
-  char field_130[3700];
-  unsigned int std__vector_000FA8;
-  BspRenderer_stru0 field_FA8[150];
+  __int16 pFaceIDs[2000];
+  //char field_130[3700];
+  unsigned int pNumSectors;
+  BspRenderer_stru0 pSectors[150];
   unsigned int uNumVisibleNotEmptySectors;
   unsigned __int16 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[6];
 };
--- a/mm7_3.cpp	Wed Mar 13 10:13:02 2013 +0600
+++ b/mm7_3.cpp	Wed Mar 13 17:08:21 2013 +0600
@@ -11148,19 +11148,19 @@
 
   if (pBLVRenderParams->uPartySectorID)
   {
-    pBspRenderer->field_FA8[0].uSectorID = pBLVRenderParams->uPartySectorID;
-    pBspRenderer->field_FA8[0].uViewportW = pBLVRenderParams->uViewportW;
-    pBspRenderer->field_FA8[0].uViewportZ = pBLVRenderParams->uViewportZ;
-    pBspRenderer->field_FA8[0].uViewportY = pBLVRenderParams->uViewportY;
-    pBspRenderer->field_FA8[0].uViewportX = pBLVRenderParams->uViewportX;
-    pBspRenderer->field_FA8[0].field_C._43F9E1(
+    pBspRenderer->pSectors[0].uSectorID = pBLVRenderParams->uPartySectorID;
+    pBspRenderer->pSectors[0].uViewportW = pBLVRenderParams->uViewportW;
+    pBspRenderer->pSectors[0].uViewportZ = pBLVRenderParams->uViewportZ;
+    pBspRenderer->pSectors[0].uViewportY = pBLVRenderParams->uViewportY;
+    pBspRenderer->pSectors[0].uViewportX = pBLVRenderParams->uViewportX;
+    pBspRenderer->pSectors[0].field_C._43F9E1(
       pBLVRenderParams->uViewportX,
       pBLVRenderParams->uViewportY,
       pBLVRenderParams->uViewportZ,
       pBLVRenderParams->uViewportW);
-    pBspRenderer->field_FA8[0].uFaceID = -1;
-    pBspRenderer->field_FA8[0].std__vector_0007A8 = -1;
-    pBspRenderer->std__vector_000FA8 = 1;
+    pBspRenderer->pSectors[0].uFaceID = -1;
+    pBspRenderer->pSectors[0].std__vector_0007A8 = -1;
+    pBspRenderer->pNumSectors = 1;
     sub_440639(0);
   }
 
@@ -11524,7 +11524,7 @@
 
   v1 = a1;
   v2 = 0;
-  v3 = &pIndoor->pSectors[pBspRenderer->field_FA8[a1].uSectorID];
+  v3 = &pIndoor->pSectors[pBspRenderer->pSectors[a1].uSectorID];
   if ( pRenderer->pRenderD3D )
   {
     for (uint i = 0; i < v3->uNumNonBSPFaces; ++i)
@@ -11562,7 +11562,7 @@
   //Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode);
 
   v10 = a1;
-  v12 = &pBspRenderer->field_FA8[a1];
+  v12 = &pBspRenderer->pSectors[a1];
   while ( 1 )
   {
     v2 = &pIndoor->pSectors[v12->uSectorID];
--- a/mm7_5.cpp	Wed Mar 13 10:13:02 2013 +0600
+++ b/mm7_5.cpp	Wed Mar 13 17:08:21 2013 +0600
@@ -9251,22 +9251,21 @@
   int v6; // ebx@3
 
   uNumVisibleNotEmptySectors = 0;
-  for (uint i = 0; i < std__vector_000FA8; ++i)
+  for (uint i = 0; i < pNumSectors; ++i)
   {
       v6 = 0;
       if (!uNumVisibleNotEmptySectors)
       {
-//LABEL_7:
-        pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = field_FA8[i].uSectorID;
+        pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = pSectors[i].uSectorID;
       }
       else
       {
-        while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != field_FA8[i].uSectorID )
+        while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != pSectors[i].uSectorID )
         {
           ++v6;
           if ( v6 >= uNumVisibleNotEmptySectors)
           {
-            pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = field_FA8[i].uSectorID;
+            pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = pSectors[i].uSectorID;
             continue;
           }
         }