diff Indoor.cpp @ 834:95d9727412c9

Слияние
author Ritor1
date Wed, 27 Mar 2013 21:24:24 +0600
parents 9c3f28b31b4a
children dfd683c4f538
line wrap: on
line diff
--- a/Indoor.cpp	Wed Mar 27 21:24:13 2013 +0600
+++ b/Indoor.cpp	Wed Mar 27 21:24:24 2013 +0600
@@ -28,6 +28,7 @@
 #include "GUIFont.h"
 
 #include "mm7_data.h"
+#include "MM7.h"
 
 
 
@@ -533,54 +534,45 @@
         if (pDecalBuilder->uNumDecals > 0)
           pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID);
 
-        if (pFace->Fluid() &&
-            pFace->uBitmapID == pRenderer->hd_water_tile_id )
-        {
-          v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
-          v27 = pBitmaps_LOD->pHardwareTextures[v23];
-          if (pFace->uAttributes & FACE_DO_NOT_LIGHT)
-            _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID);
-          else
-            pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | OBJECT_BModel, v17, 0);
-          return;
-        }
         if (pFace->Fluid())
         {
-          //auto v24 = GetTickCount() / 4;
-          //auto v25 = v24 - stru_5C6E00->uIntegerHalfPi;
-          uint eightSeconds = GetTickCount() % 8000;
-          float angle = (eightSeconds / 8000.0f) * 2 * 3.1415f;
-
-          //animte lava back and forth
-          for (uint i = 0; i < uNumVerticesa; ++i)
-            //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8));
-            array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle);
-          v23 = pFace->uBitmapID;
-          v27 = pBitmaps_LOD->pHardwareTextures[v23];
-          if (pFace->uAttributes & FACE_DO_NOT_LIGHT)
-            _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID);
+          if (pFace->uBitmapID == pRenderer->hd_water_tile_id)
+          {
+            v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
+            v27 = pBitmaps_LOD->pHardwareTextures[v23];
+          }
           else
-            pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | OBJECT_BModel, v17, 0);
-          return;
+          {
+            //auto v24 = GetTickCount() / 4;
+            //auto v25 = v24 - stru_5C6E00->uIntegerHalfPi;
+            uint eightSeconds = GetTickCount() % 8000;
+            float angle = (eightSeconds / 8000.0f) * 2 * 3.1415f;
+
+            //animte lava back and forth
+            for (uint i = 0; i < uNumVerticesa; ++i)
+              //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8));
+              array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle);
+            v23 = pFace->uBitmapID;
+            v27 = pBitmaps_LOD->pHardwareTextures[v23];
+          }
         }
         else if (pFace->uAttributes & 0x4000)
         {
           v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_);
           v27 = pBitmaps_LOD->pHardwareTextures[v23];
-          if (pFace->uAttributes & FACE_DO_NOT_LIGHT)
-            _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID);
-          else
-            pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | OBJECT_BModel, v17, 0);
-          return;
         }
-        v17 = 0xFFFFFFFF;
-        v23 = pFace->uBitmapID;
-        v27 = pBitmaps_LOD->pHardwareTextures[v23];
+        else
+        {
+          v17 = 0xFFD0D0D0;
+          v23 = pFace->uBitmapID;
+          v27 = pBitmaps_LOD->pHardwareTextures[v23];
+        }
+
         if (pFace->uAttributes & FACE_DO_NOT_LIGHT)
           _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID);
         else
-          pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | OBJECT_BModel, v17, 0);
-        return;;
+          pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, PID(OBJECT_BModel, uFaceID), v17, 0);
+        return;
       }
     }
   }
@@ -1291,6 +1283,7 @@
   //v39 = &pIndoor->pFaces[uFaceID];
 
   auto pFace = &pIndoor->pFaces[uFaceID];
+  auto p = &nodes[node_id];
 
   if (!pFace->Portal())
   {
@@ -1302,9 +1295,8 @@
     return;
   }
 
-    auto p = &nodes[node_id];
-    //v6 = (int)((char *)this + 2252 * a2);
-    //a0 = v6;
+
+
     if (p->uFaceID == uFaceID)
       return;
     if (!node_id &&
@@ -1316,8 +1308,8 @@
         pBLVRenderParams->vPartyPos.z <= pFace->pBounding.z2 + 16 )
     {
       if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x
-                                       + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y
-                                       + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane
+                                          + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y
+                                          + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 ) // we sure are standing at the portal plane
       {
         v7 = pFace->uSectorID;
         if ( nodes[0].uSectorID == v7 )  // draw back sector
@@ -1328,11 +1320,11 @@
         nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ;
         nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY;
         nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW;
-        nodes[num_nodes++].field_C._43F9E1(pBLVRenderParams->uViewportX,
-                                           pBLVRenderParams->uViewportY,
-                                           pBLVRenderParams->uViewportZ,
-                                           pBLVRenderParams->uViewportW);
-        AddBspNodeToRenderList(num_nodes - 1);
+        nodes[num_nodes].field_C._43F9E1(pBLVRenderParams->uViewportX,
+                                         pBLVRenderParams->uViewportY,
+                                         pBLVRenderParams->uViewportZ,
+                                         pBLVRenderParams->uViewportW);
+        AddBspNodeToRenderList(++num_nodes - 1);
         return;
       }
       //v5 = v39;
@@ -1368,40 +1360,7 @@
       if (face_max_screenspace_y < _50B9D8_screen_space_y[i])
         face_max_screenspace_y = _50B9D8_screen_space_y[i];
     }
-      //v10 = sub_423B5D(uFaceID);
-      //v34 = v10;
-      //if ( v10 )
-      //{
-       /* v11 = _50BAC8_screen_space_x[0];
-        v12 = _50B9D8_screen_space_y[0];
-        a2 = _50BAC8_screen_space_x[0];
-        v13 = 1;
-        v37 = _50B9D8_screen_space_y[0];
-        if ( v10 > 1 )
-        {
-          do
-          {
-            v14 = _50BAC8_screen_space_x[v13];
-            if ( v14 < a2 )
-              a2 = _50BAC8_screen_space_x[v13];
-            if ( v14 > v11 )
-              v11 = v14;
-            v15 = _50B9D8_screen_space_y[v13];
-            if ( v15 < v37 )
-              v37 = _50B9D8_screen_space_y[v13];
-            if ( v15 > v12 )
-              v12 = _50B9D8_screen_space_y[v13];
-            v10 = v34;
-            ++v13;
-          }
-          while ( v13 < v34 );
-        }
-        //v16 = a0;
-        if (v11 >= p->uViewportX &&
-            a2 <= p->uViewportZ &&
-            v12 >= p->uViewportY &&
-            v37 <= p->uViewportW &&
-            sub_424829(v10, &nodes[num_nodes].field_C, &p->field_C, uFaceID))*/
+
       if (face_max_screenspace_x >= p->uViewportX &&
           face_min_screenspace_x <= p->uViewportZ &&
           face_max_screenspace_y >= p->uViewportY &&