changeset 1226:33b30398e286

m
author Ritor1
date Fri, 07 Jun 2013 22:24:11 +0600
parents 42b41aaecd87
children 312e895a6439
files Indoor.cpp mm7_1.cpp mm7_4.cpp mm7_data.h
diffstat 4 files changed, 30 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Wed Jun 05 21:00:45 2013 +0600
+++ b/Indoor.cpp	Fri Jun 07 22:24:11 2013 +0600
@@ -768,7 +768,7 @@
             v7 = sub_423B5D(v1);
             if ( v7 )
             {
-              if ( sub_424829(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) )
+              if ( isVisibleRoom(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) )
               {
                 if ( v2->uPolygonType == 1 )
                 {
@@ -1384,7 +1384,7 @@
 //          face_min_screenspace_x <= p->uViewportZ &&
           face_max_screenspace_y >= p->uViewportY &&
           face_min_screenspace_y <= p->uViewportW &&
-          sub_424829(num_vertices, &nodes[num_nodes].field_C, &p->field_C, uFaceID))
+          isVisibleRoom(num_vertices, &nodes[num_nodes].field_C, &p->field_C, uFaceID))
         {
           //v17 = v39;
           v18 = pFace->uSectorID;
@@ -1546,7 +1546,7 @@
           && v23 <= *((short *)v20 + 2007)
           && v12 >= *((short *)v20 + 2006)
           && v22 <= *((short *)v20 + 2008)
-          && sub_424829(v10, &v3->nodes[v3->num_nodes].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) )
+          && isVisibleRoom(v10, &v3->nodes[v3->num_nodes].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) )
         {
           v16 = v21->uSectorID;
           if ( *((short *)v20 + 2004) == v16 )
@@ -1605,7 +1605,7 @@
         v3 = sub_423B5D(v2);
         if ( v3 )
         {
-          if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) )
+          if ( isVisibleRoom(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) )
           {
             v4 = stru_F8A590._viewport_space_y;
             v5 = pBLVRenderParams->pRenderTarget;
--- a/mm7_1.cpp	Wed Jun 05 21:00:45 2013 +0600
+++ b/mm7_1.cpp	Fri Jun 07 22:24:11 2013 +0600
@@ -2229,7 +2229,7 @@
 }
 
 //----- (00424829) --------------------------------------------------------
-bool sub_424829(int pNumVertices, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int uFaceID)
+bool isVisibleRoom(int pNumVertices, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int uFaceID)
 {
   //int v4; // edi@1
   //BspRenderer_stru2 *v5; // ebx@1
@@ -2308,9 +2308,11 @@
   //return true;
   if ( !pNumVertices )
     return false;
+
   v7 = stru_50B700._screen_space_y[0];
   v65 = 0;
   v8 = stru_50B700._screen_space_y[0];
+
   if ( !stru_50B700.field_0 )
   {
     v63 = 1;
@@ -2321,8 +2323,10 @@
     v63 = -1;
     v64 = 1;
   }
+
   if ( pNumVertices <= 1 )
     return false;
+
   for ( v6 = 1; v6 < pNumVertices; ++v6 )
   {
     if ( stru_50B700._screen_space_y[v6] >= v7 )
@@ -2336,12 +2340,15 @@
       v7 = stru_50B700._screen_space_y[v6];
     }
   }
+
   if ( v8 == v7 )
     return false;
+
   v10 = v65;
   a2->_viewport_space_y = v7;
   a2->_viewport_space_w = v8;
   v55 = v65;
+
   if ( pNumVertices > 0 )
   {
     //v11 = v65;
@@ -2366,6 +2373,7 @@
         break;
     }
   }
+
   v13 = v55 + v64;
   if ( v13 < pNumVertices )
   {
@@ -2376,12 +2384,14 @@
   {
     v13 -= pNumVertices;
   }
+
   if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] )
   {
     v62 = stru_50B700._screen_space_x[v55] << 16;
     v54 = ((stru_50B700._screen_space_x[v13] - stru_50B700._screen_space_x[v55]) << 16) / (stru_50B700._screen_space_y[v13] - stru_50B700._screen_space_y[v55]);
     a2->array_18[v7] = LOWORD(stru_50B700._screen_space_x[v55]);
   }
+
   v15 = v65;
   v61 = v65;
   if ( pNumVertices > 0 )
@@ -2408,6 +2418,7 @@
         break;
     }
   }
+
   v18 = v63 + v61;
   if ( v18 < pNumVertices )
   {
@@ -2419,6 +2430,7 @@
     v18 -= pNumVertices;
   }
   v19 = v18;
+
   v20 = v61;
   if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] )
   {
@@ -2426,6 +2438,7 @@
     v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20];
     a2->array_3D8[v8] = LOWORD(stru_50B700._screen_space_x[v20]);
   }
+
   v22 = v7;
   if ( v7 <= v8 )
   {
@@ -2498,25 +2511,28 @@
       //++v23;
     }
   }
+
   if ( v8 < a3->_viewport_space_y )
     return false;
   if ( v7 > a3->_viewport_space_w )
     return false;
+
   if ( v7 < a3->_viewport_space_y )
     v7 = a3->_viewport_space_y;
   if ( v8 > a3->_viewport_space_w )
     v8 = a3->_viewport_space_w;
+
   if ( v7 <= v8 )
   {
     //a3a = (char *)a2 - (char *)a3;
     //v42 = &a3->array_3D8[v7];
     //v57 = *(__int16 *)((char *)v42 + a3a);
-    for ( v71 = v7; v71 <= v8; ++v71 )
+    for ( v7; v7 <= v8; ++v7 )
     {
-      if ( a2->array_18[v71] >= a3->array_18[v71] && a2->array_18[v71] <= a3->array_3D8[v71] )
+      if ( a2->array_18[v7] >= a3->array_18[v7] && a2->array_18[v7] <= a3->array_3D8[v7] )
         break;
       //++v57;
-      ++v7;
+      //++v7;
       //++v42;
     }
   }
@@ -2525,12 +2541,12 @@
   //a3a = (char *)a2 - (char *)a3;
   //v43 = &a3->array_3D8[v8];
   //v58 = *(__int16 *)((char *)v43 + a3a);
-  for ( v72 = v8; v72 >= v7; --v72 )
+  for ( v8; v8 >= v7; --v8 )
   {
-    if ( a2->array_3D8[v72] >= a3->array_18[v72] && a2->array_18[v72] <= a3->array_3D8[v72] )
+    if ( a2->array_3D8[v8] >= a3->array_18[v8] && a2->array_18[v8] <= a3->array_3D8[v8] )
       break;
     //--v58;
-    --v8;
+    //--v8;
     //--v43;
     //v8 = v8;
   }
--- a/mm7_4.cpp	Wed Jun 05 21:00:45 2013 +0600
+++ b/mm7_4.cpp	Fri Jun 07 22:24:11 2013 +0600
@@ -4476,7 +4476,7 @@
         result = sub_423B5D(sFaceID);
         if ( result )
         {
-          result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2);
+          result = isVisibleRoom(result, &stru_F8A590, pBLVRenderParams->field_7C, v2);
           if ( result )
           {
             result = (int)v3->GetTexture();
@@ -4941,7 +4941,7 @@
       v59 = sub_423B5D(uFaceID);
       v3 = v59;
     }
-    if ( v3 && (pRenderer->pRenderD3D || sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) )
+    if ( v3 && (pRenderer->pRenderD3D || isVisibleRoom(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) )
     {
       v4 = v2->GetTexture();
       v5 = 0;
--- a/mm7_data.h	Wed Jun 05 21:00:45 2013 +0600
+++ b/mm7_data.h	Fri Jun 07 22:24:11 2013 +0600
@@ -1270,7 +1270,7 @@
 void __cdecl sub_423B4A();
 int __fastcall sub_423B5D(unsigned int uFaceID);
 signed int __fastcall sub_424579(int uFaceID, struct stru320 *a2);
-bool sub_424829(int pNumVertices, struct BspRenderer_stru2 *a2, struct BspRenderer_stru2 *a3, int uFaceID);
+bool isVisibleRoom(int pNumVertices, struct BspRenderer_stru2 *a2, struct BspRenderer_stru2 *a3, int uFaceID);
 signed int __fastcall sr_424CD7(unsigned int uVertexID); // idb
 signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID); // idb
 signed int __fastcall sr_4250FE(unsigned int uVertexID); // idb