diff Render.cpp @ 1922:e60d9df73428

DrawIndoorPolygonSky
author Ritor1
date Wed, 23 Oct 2013 17:13:23 +0600
parents ab1c03cc2219
children f92e0bab7c78
line wrap: on
line diff
--- a/Render.cpp	Wed Oct 23 15:27:25 2013 +0600
+++ b/Render.cpp	Wed Oct 23 17:13:23 2013 +0600
@@ -5007,7 +5007,7 @@
 
 
 //----- (00479A53) --------------------------------------------------------
-void Render::DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID)
+void Render::DrawIndoorPolygonSky(unsigned int uNumVertices, unsigned int uFaceID)
 {
   BLVFace *pFace; // esi@1
   //unsigned int v3; // edi@1
@@ -5034,7 +5034,7 @@
   double v24; // st7@16
   unsigned __int8 v25; // sf@16
   unsigned __int8 v26; // of@16
-  Render *v27; // ecx@17
+  //Render *v27; // ecx@17
   double v28; // st7@20
   char *v29; // ebx@20
   char *v30; // edx@20
@@ -5069,7 +5069,7 @@
   signed int v59; // [sp-4h] [bp-178h]@17
   struct Polygon *v60; // [sp+0h] [bp-174h]@17
   IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17
-  struct Polygon v62; // [sp+14h] [bp-160h]@6
+  struct Polygon pSkyPoligon; // [sp+14h] [bp-160h]@6
   unsigned int v63; // [sp+120h] [bp-54h]@7
   //double v64; // [sp+124h] [bp-50h]@7
   unsigned int v65; // [sp+128h] [bp-4Ch]@1
@@ -5104,55 +5104,55 @@
     return;
   }
 
-  *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY;
+  //*(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY;
   v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pGame->pIndoorCameraD3D->vPartyPos.z)
                        / (((double)pBLVRenderParams->fov_rad_fixpoint + 16192.0)
                         * 65536.0)
-                       + *(float *)&v74);
+                       + (double)pBLVRenderParams->uViewportCenterY);
   v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064;
-  *(float *)&v75 = v5;
-  v6 = (signed __int64)(*(float *)&v74
+  //*(float *)&v75 = v5;
+  v6 = (signed __int64)((double)pBLVRenderParams->uViewportCenterY
                       - (double)pBLVRenderParams->fov_rad_fixpoint
                       / ((cos(v5) * 16192.0 + 0.0000001)
                        * 65535.0)
-                      * (sin(*(float *)&v75) * -16192.0 - (double)pGame->pIndoorCameraD3D->vPartyPos.z));
+                      * (sin(v5) * -16192.0 - (double)pGame->pIndoorCameraD3D->vPartyPos.z));
 
 
   stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0);
-  v62.Create_48607B(&stru_8019C8);
-  v62.uTileBitmapID = pFace->uBitmapID;
-
-  v62.pTexture = pBitmaps_LOD->GetTexture(v62.uTileBitmapID);
-  if ( !v62.pTexture )
+  pSkyPoligon.Create_48607B(&stru_8019C8);
+  pSkyPoligon.uTileBitmapID = pFace->uBitmapID;
+
+  pSkyPoligon.pTexture = pBitmaps_LOD->GetTexture(pSkyPoligon.uTileBitmapID);
+  if ( !pSkyPoligon.pTexture )
     return;
 
-  v62.dimming_level = 0;
-  v62.uNumVertices = uNumVertices;
-  v62.v_18.y = 0;
-  v62.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
-  v62.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);
+  pSkyPoligon.dimming_level = 0;
+  pSkyPoligon.uNumVertices = uNumVertices;
+  pSkyPoligon.v_18.y = 0;
+  pSkyPoligon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
+  pSkyPoligon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);
   memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices]));
-  v62.field_24 = 0x2000000;
+  pSkyPoligon.field_24 = 0x2000000;
 
   extern float _calc_fov(int viewport_width, int angle_degree);
   //v64 = (double)(signed int)(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX) * 0.5;
   //v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5);
   v72 = 65536.0f / _calc_fov(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX, 74);
-  v12 = v62.pTexture->uWidthMinus1;
-  v13 = v62.pTexture->uHeightMinus1;
-  v67 = 1.0 / (double)v62.pTexture->uTextureWidth;
+  v12 = pSkyPoligon.pTexture->uWidthMinus1;
+  v13 = pSkyPoligon.pTexture->uHeightMinus1;
+  v67 = 1.0 / (double)pSkyPoligon.pTexture->uTextureWidth;
   v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13;
   v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12;
   v78 = 0;
   v81 = 0;
-  float v68 = 1.0 / (double)v62.pTexture->uTextureHeight;
-  if ( (signed int)v62.uNumVertices <= 0 )
+  float v68 = 1.0 / (double)pSkyPoligon.pTexture->uTextureHeight;
+  if ( (signed int)pSkyPoligon.uNumVertices <= 0 )
   {
 LABEL_17:
-    v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID];
-    v27 = pRenderer;
-    v60 = &v62;
-    v59 = v62.uNumVertices;
+    v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID];
+    //v27 = pRenderer;
+    v60 = &pSkyPoligon;
+    v59 = pSkyPoligon.uNumVertices;
     goto LABEL_18;
   }
 
@@ -5161,18 +5161,18 @@
   while ( 2 )
   {
     v15 = (void *)(v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY));
-    v77 = (unsigned __int64)(v62.ptr_38->viewing_angle_from_west_east * (signed __int64)(signed int)v15) >> 16;
-    v74 = v77 + v62.ptr_38->angle_from_north;
+    v77 = (unsigned __int64)(pSkyPoligon.ptr_38->viewing_angle_from_west_east * (signed __int64)(signed int)v15) >> 16;
+    v74 = v77 + pSkyPoligon.ptr_38->angle_from_north;
     v77 = (int)v15;
-    v77 = (unsigned __int64)(v62.ptr_38->viewing_angle_from_north_south * (signed __int64)(signed int)v15) >> 16;
+    v77 = (unsigned __int64)(pSkyPoligon.ptr_38->viewing_angle_from_north_south * (signed __int64)(signed int)v15) >> 16;
     v79 = v15;
-    v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->angle_from_east);
-    v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16);
+    v75 = (RenderVertexSoft *)(v77 + pSkyPoligon.ptr_38->angle_from_east);
+    v79 = (void *)((unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v15) >> 16);
     v17 = v72 * (pBLVRenderParams->uViewportCenterX - (int)array_507D30[_507D30_idx].vWorldViewProjX);
     v18 = array_507D30[_507D30_idx].vWorldViewProjY - 1.0;
-    v19 = -v62.field_24;
-    v77 = -v62.field_24;
-    X = (int)((char *)v79 + v62.v_18.x);
+    v19 = -pSkyPoligon.field_24;
+    v77 = -pSkyPoligon.field_24;
+    X = (int)((char *)v79 + pSkyPoligon.v_18.x);
     LODWORD(v76) = (signed __int64)v18;
     v20 = (void *)(v72 * (v70 - LODWORD(v76)));
     while ( 1 )
@@ -5188,11 +5188,11 @@
       v19 = v77;
       v20 = v79;
 LABEL_14:
-      v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16);
-      v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16;
+      v79 = (void *)((unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v20) >> 16);
+      v22 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v20) >> 16;
       --LODWORD(v76);
       v20 = (char *)v20 + v72;
-      X = v22 + v62.v_18.x;
+      X = v22 + pSkyPoligon.v_18.x;
       v78 = 1;
     }
     if ( !v78 )
@@ -5202,8 +5202,8 @@
       v79 = (void *)(v23 / X);
       v77 = v17;
       v77 = v17;
-      LODWORD(v76) = v74 + ((unsigned __int64)(v62.ptr_38->angle_from_west * (signed __int64)v17) >> 16);
-      v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v62.ptr_38->angle_from_south * (signed __int64)v17) >> 16));
+      LODWORD(v76) = v74 + ((unsigned __int64)(pSkyPoligon.ptr_38->angle_from_west * (signed __int64)v17) >> 16);
+      v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(pSkyPoligon.ptr_38->angle_from_south * (signed __int64)v17) >> 16));
       v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16;
       LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16;
       //v14 += 48;
@@ -5211,8 +5211,8 @@
       v81 = (char *)v81 + 1;
       v24 = (double)SLODWORD(v80) * 0.000015259022;
       LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4);
-      v26 = __OFSUB__((int)v81, v62.uNumVertices);
-      v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0;
+      v26 = __OFSUB__((int)v81, pSkyPoligon.uNumVertices);
+      v25 = (signed int)((char *)v81 - pSkyPoligon.uNumVertices) < 0;
       array_507D30[_507D30_idx].u = v24 * v67;
       array_507D30[_507D30_idx].v = (double)SLODWORD(v80) * 0.000015259022 * v68;
       array_507D30[_507D30_idx]._rhw = 65536.0 / (double)(signed int)v79;
@@ -5225,7 +5225,7 @@
   }
   LODWORD(v73) = 0;
   v80 = v76;
-  if ( (signed int)v62.uNumVertices > 0 )
+  if ( (signed int)pSkyPoligon.uNumVertices > 0 )
   {
     v28 = (double)SLODWORD(v76);
     LODWORD(v76) = (int)(char *)array_50AC10 + 28;
@@ -5233,7 +5233,7 @@
     v30 = (char *)&array_507D30[1].vWorldViewProjY;
     v79 = array_50AC10;
     v81 = array_507D30;
-    v78 = v62.uNumVertices;
+    v78 = pSkyPoligon.uNumVertices;
     do
     {
       v31 = v28 < *((float *)v30 - 12);
@@ -5276,17 +5276,17 @@
   do
   {
     v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34));
-    v78 = v62.ptr_38->viewing_angle_from_west_east;
+    v78 = pSkyPoligon.ptr_38->viewing_angle_from_west_east;
     v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
-    v36 = (int)((char *)v81 + v62.ptr_38->angle_from_north);
+    v36 = (int)((char *)v81 + pSkyPoligon.ptr_38->angle_from_north);
     v81 = v35;
     v74 = v36;
-    v78 = v62.ptr_38->viewing_angle_from_north_south;
+    v78 = pSkyPoligon.ptr_38->viewing_angle_from_north_south;
     v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
     v78 = (int)v35;
-    v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->angle_from_east);
-    v81 = (const void *)v62.v_18.z;
-    v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16;
+    v75 = (RenderVertexSoft *)((char *)v81 + pSkyPoligon.ptr_38->angle_from_east);
+    v81 = (const void *)pSkyPoligon.v_18.z;
+    v78 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v35) >> 16;
     v37 = (const void *)(v72
                        * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1)));
     v38 = (signed __int64)(*(float *)v34 - 1.0);
@@ -5305,34 +5305,34 @@
         break;
       v39 = v78;
 LABEL_36:
-      v78 = v62.v_18.z;
-      v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16;
+      v78 = pSkyPoligon.v_18.z;
+      v41 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)v39) >> 16;
       --LODWORD(v76);
       v39 += v72;
-      X = v41 + v62.v_18.x;
+      X = v41 + pSkyPoligon.v_18.x;
       v81 = (const void *)1;
     }
     if ( v81 )
     {
-      v79 = (void *)v62.v_18.z;
+      v79 = (void *)pSkyPoligon.v_18.z;
       v78 = 2 * LODWORD(v76);
-      v81 = (const void *)((unsigned __int64)(v62.v_18.z
+      v81 = (const void *)((unsigned __int64)(pSkyPoligon.v_18.z
                                             * (signed __int64)(signed int)(signed __int64)(((double)v70
                                                                                           - ((double)(2 * LODWORD(v76))
                                                                                            - *(float *)v34))
                                                                                          * (double)v72)) >> 16);
-      X = (int)((char *)v81 + v62.v_18.x);
+      X = (int)((char *)v81 + pSkyPoligon.v_18.x);
     }
     LODWORD(v42) = v77 << 16;
     HIDWORD(v42) = v77 >> 16;
     v79 = (void *)(v42 / X);
     v81 = v37;
-    v78 = v62.ptr_38->angle_from_west;
+    v78 = pSkyPoligon.ptr_38->angle_from_west;
     v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16);
     v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16);
     v74 = (unsigned int)v37;
     LODWORD(v76) = v43;
-    v78 = v62.ptr_38->angle_from_south;
+    v78 = pSkyPoligon.ptr_38->angle_from_south;
     v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16));
     v74 = (unsigned __int64)(v43 * v42 / X) >> 16;
     v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16);
@@ -5370,8 +5370,8 @@
     }
     while ( HIDWORD(v69) );
   }
-  v62.uNumVertices = v47;
-  pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]);
+  pSkyPoligon.uNumVertices = v47;
+  pRenderer->_4A2ED5(v47, &pSkyPoligon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID]);
   *(float *)&v74 = 0.0;
   if ( SLODWORD(v73) > 0 )
   {
@@ -5393,13 +5393,13 @@
     }
     while ( v80 != 0.0 );
   }
-  v62.uNumVertices = v74;
-  v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID];
-  v60 = &v62;
+  pSkyPoligon.uNumVertices = v74;
+  v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID];
+  v60 = &pSkyPoligon;
   v59 = v74;
-  v27 = pRenderer;
+  //v27 = pRenderer;
 LABEL_18:
-  v27->_4A2ED5(v59, v60, v61);
+  pRenderer->_4A2ED5(v59, v60, v61);
 }
 
 
@@ -8885,7 +8885,7 @@
             array_77EC08[pODMRenderParams->uNumPolygons].pTexture = pFaceTexture;
             if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_FLUID)
               array_77EC08[pODMRenderParams->uNumPolygons].flags |= 2;
-            if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_DO_NOT_LIGHT )
+            if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_INDOOR_SKY )
               HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4;
             if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & 4 )
               HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4;