diff Indoor.cpp @ 68:fdacbc653945

BLV render: first image
author Nomad
date Sat, 27 Oct 2012 19:23:06 +0200
parents 5159d2e6f559
children 8453114181af
line wrap: on
line diff
--- a/Indoor.cpp	Fri Oct 26 03:43:05 2012 +0200
+++ b/Indoor.cpp	Sat Oct 27 19:23:06 2012 +0200
@@ -451,21 +451,21 @@
   //double v19; // st6@27
   //double v20; // st5@27
   //char v21; // dl@27
-  unsigned int v22; // eax@44
+  //unsigned int v22; // eax@44
   unsigned int v23; // eax@35
   DWORD v24; // eax@37
   int v25; // eax@38
-  char *v26; // edi@38
+  //char *v26; // edi@38
   IDirect3DTexture2 *v27; // eax@42
   Texture *v28; // [sp+Ch] [bp-1Ch]@15
-  int i; // [sp+10h] [bp-18h]@38
+  //int i; // [sp+10h] [bp-18h]@38
   //LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16
   //IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16
   //IndoorCameraD3D_Vec4 *a7; // [sp+1Ch] [bp-Ch]@1
   //unsigned int uFaceID_; // [sp+20h] [bp-8h]@1
   unsigned int uNumVerticesa; // [sp+24h] [bp-4h]@17
   int a4a; // [sp+34h] [bp+Ch]@25
-  unsigned int a4b; // [sp+34h] [bp+Ch]@38
+  //unsigned int a4b; // [sp+34h] [bp+Ch]@38
 
   //v4 = uFaceID;
   //a7 = pVertices;
@@ -505,10 +505,11 @@
       static_vertices_F7C228[i].u = (signed)pFace->pVertexUIDs[i];
       static_vertices_F7C228[i].v = (signed)pFace->pVertexUIDs[i];
     }
-            if ( !pVertices
-              || (pGame->pStru9Instance->_498377(a4, 4u, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) )
-            {
-              if ( pGame->pIndoorCameraD3D->_437285_prolly_colide_vertices_against_frustrum(
+
+    if (!pVertices ||
+        (pGame->pStru9Instance->_498377(a4, 4u, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) )
+    {
+      if (pGame->pIndoorCameraD3D->_437285_prolly_colide_vertices_against_frustrum(
                      static_vertices_F7C228,
                      &uNumVerticesa,
                      static_vertices_F7B628,
@@ -517,27 +518,28 @@
                      false,
                      0) != 1
                 || uNumVerticesa )
-              {
-                a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel);
-                v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8);
-                sub_4B0E07(uFaceID);
-                pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
-                pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
-                pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28);
-                pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0);
-                pGame->pLightmapBuilder->std__vector_000004_size = 0;
-                if (stru_F8AD28.uNumLightsApplied > 0 ||
-                    pDecalBuilder->uNumDecals > 0)
-                {
-                  stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x;
-                  stru_F7B60C.polygonType = pFace->uPolygonType;
-                  stru_F7B60C.face_plane.vNormal.y = pFace->pFacePlane.vNormal.y;
-                  stru_F7B60C.face_plane.vNormal.z = pFace->pFacePlane.vNormal.z;
-                  stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist;
-                }
-                if (stru_F8AD28.uNumLightsApplied > 0 &&
-                    !(pFace->uAttributes & 0x400000))
-                  pGame->pLightmapBuilder->ApplyLights(
+      {
+        a4a = SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel);
+        v17 = (248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | (((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) | ((248 - 8 * SHIWORD(stru_F8AD28.uCurrentAmbientLightLevel)) << 8)) << 8);
+        sub_4B0E07(uFaceID);
+        pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
+        pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
+        pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28);
+        pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0);
+        pGame->pLightmapBuilder->std__vector_000004_size = 0;
+        if (stru_F8AD28.uNumLightsApplied > 0 ||
+            pDecalBuilder->uNumDecals > 0)
+        {
+          stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x;
+          stru_F7B60C.polygonType = pFace->uPolygonType;
+          stru_F7B60C.face_plane.vNormal.y = pFace->pFacePlane.vNormal.y;
+          stru_F7B60C.face_plane.vNormal.z = pFace->pFacePlane.vNormal.z;
+          stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist;
+        }
+
+        if (stru_F8AD28.uNumLightsApplied > 0 &&
+            !(pFace->uAttributes & 0x400000))
+          pGame->pLightmapBuilder->ApplyLights(
                     &stru_F8AD28,
                     &stru_F7B60C,
                     uNumVerticesa,
@@ -545,8 +547,8 @@
                     pVertices,
                     0);
 
-                if (pDecalBuilder->uNumDecals > 0)
-                  pDecalBuilder->ApplyDecals(
+        if (pDecalBuilder->uNumDecals > 0)
+          pDecalBuilder->ApplyDecals(
                     a4a,
                     1,
                     &stru_F7B60C,
@@ -555,52 +557,44 @@
                     pVertices,
                     0,
                     pFace->uSectorID);
-                if (pFace->uAttributes & 0x10 &&
-                    pFace->uBitmapID == pRenderer->field_1036AC_bitmapid )
-                {
-                  v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
-                  goto LABEL_42;
-                }
-                if ( pFace->uAttributes & 0x10 )
-                {
-                  v24 = GetTickCount() >> 2;
-                  if ( (signed int)uNumVerticesa > 0 )
-                  {
-                    v25 = v24 - stru_5C6E00->uIntegerHalfPi;
-                    v26 = (char *)&array_507D30[0].v;
-                    a4b = uNumVerticesa;
-                    for ( i = v25; ; v25 = i )
-                    {
-                      *(float *)v26 = (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8))
-                                    + *(float *)v26;
-                      v26 += 48;
-                      --a4b;
-                      if ( !a4b )
-                        break;
-                    }
-                  }
-                }
-                else
-                {
-                  v22 = pFace->uAttributes;
-                  if ( BYTE1(v22) & 0x40 )
-                  {
-                    v23 = pTextureFrameTable->GetFrameTexture(
+
+        if (pFace->Animated() &&
+            pFace->uBitmapID == pRenderer->field_1036AC_bitmapid )
+        {
+          __debugbreak();
+          v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
+          goto LABEL_42;
+        }
+
+        if (pFace->Animated())
+        {
+          v24 = GetTickCount() / 4;
+          v25 = v24 - stru_5C6E00->uIntegerHalfPi;
+
+          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));
+
+          v23 = pFace->uBitmapID;
+          goto LABEL_42;
+        }
+        else
+        {
+          if (pFace->uAttributes & 0x4000)
+          {
+            v23 = pTextureFrameTable->GetFrameTexture(
                             pFace->uBitmapID,
                             pBLVRenderParams->field_0_timer_);
 LABEL_42:
                     v27 = pBitmaps_LOD->pHardwareTextures[v23];
-                    if ( BYTE2(pFace->uAttributes) & 0x40 )
-                      sub_479A53(uNumVerticesa, uFaceID);
+                    if (pFace->uAttributes & 0x400000)
+                      _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID);
                     else
                       pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | 6, v17, 0);
                     return;
-                  }
-                }
-                v23 = pFace->uBitmapID;
-                goto LABEL_42;
-              }
-            }
+          }
+        }
+      }
+    }
   }
 }