diff Render.cpp @ 2119:014c672b6d87

sky continue
author Ritor1
date Tue, 24 Dec 2013 17:32:33 +0600
parents 68fbaf45ef66
children 3eab5530cc94
line wrap: on
line diff
--- a/Render.cpp	Mon Dec 23 23:39:26 2013 +0600
+++ b/Render.cpp	Tue Dec 24 17:32:33 2013 +0600
@@ -9087,7 +9087,7 @@
   signed __int64 v17; // qtt@13
   signed int v18; // ecx@13
   struct Polygon pSkyPolygon; // [sp+14h] [bp-150h]@1
-  double v26; // [sp+120h] [bp-44h]@4
+  //double v26; // [sp+120h] [bp-44h]@4
   int v30; // [sp+134h] [bp-30h]@1
   int v32; // [sp+13Ch] [bp-28h]@6
   int v33; // [sp+140h] [bp-24h]@2
@@ -9099,11 +9099,11 @@
   int v39; // [sp+15Ch] [bp-8h]@4
   int v40; // [sp+160h] [bp-4h]@7
 
-  v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z)
+  v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z)//244
                        / ((double)pODMRenderParams->int_fov_rad + 8192.0)
-                       + (double)(pViewport->uScreenCenterY + 7));//include "+ 7"
-  v34 = cos((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064) * 0x2000;//(double)pODMRenderParams->shading_dist_mist
-  v38 = (signed __int64)((double)(pViewport->uScreenCenterY + 7)
+                       + (double)(pViewport->uScreenCenterY));
+  v34 = cos((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064) * 0x2000;//(double)pODMRenderParams->shading_dist_mist, 8192
+  v38 = (signed __int64)((double)(pViewport->uScreenCenterY)//247
                        - (double)pODMRenderParams->int_fov_rad
                        / (v34 + 0.0000001)
                        * (sin((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064)
@@ -9117,10 +9117,10 @@
   {
     pSkyPolygon.dimming_level = 0;
     pSkyPolygon.uNumVertices = 4;
-  //centering(центруем)--наклон камеры ----------------------------------------
-    pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
+  //centering(центруем)-----------------------------------------------------------------
+    pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);//-3216
     pSkyPolygon.v_18.y = 0;
-    pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);
+    pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);//-65457
   
   //sky wiew position(положение неба на экране)------------------------------------------
   //                X
@@ -9133,58 +9133,57 @@
   //  |8,351                468,351 |
   // 1._____________________________.2
   // 
-    array_50AC10[0].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;
-    array_50AC10[0].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;
-
-    array_50AC10[1].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;
-    array_50AC10[1].vWorldViewProjY = (double)v38;
-
-    array_50AC10[2].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;
-    array_50AC10[2].vWorldViewProjY = (double)v38;
-
-    array_50AC10[3].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;
-    array_50AC10[3].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;
-
-    pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;
-    pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
-
-    pSkyPolygon.field_24 = 0x2000000u;
-    v33 = 65536 / (signed int)(signed __int64)(((double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5) / tan(0.6457717418670654) + 0.5);
+    array_50AC10[0].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;//8
+    array_50AC10[0].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;//8
+
+    array_50AC10[1].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;//8
+    array_50AC10[1].vWorldViewProjY = (double)v38;//247
+
+    array_50AC10[2].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;//468
+    array_50AC10[2].vWorldViewProjY = (double)v38;//247
+
+    array_50AC10[3].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;//468
+    array_50AC10[3].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;//8
+
+    pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;//7168
+    pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;//7168
+
+    pSkyPolygon.field_24 = 0x2000000u;//maybe attributes
+    v33 = 65536 / (signed int)(signed __int64)(((double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2) / tan(0.6457717418670654) + 0.5);//214
     for ( uint i = 0; i < pSkyPolygon.uNumVertices; ++i )
     {
-      v26 = array_50AC10[i].vWorldViewProjY + 6.7553994e15;
       //rotate skydome(вращение купола неба)--------------------------------------
       // В игре принята своя система измерения углов. Полный угол (180). Значению угла 0 соответствует 
       // направление на север и/или юг (либо на восток и/или запад), значению 65536 еденицам(0х10000) соответствует угол 90.
-	  // две переменные хранят данные по углу обзора. field_14 по западу и востоку. field_20 по югу и северу
+      // две переменные хранят данные по углу обзора. field_14 по западу и востоку. field_20 по югу и северу
       // от -25080 до 25080
-      v39 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
-      v35 = v39 + pSkyPolygon.ptr_38->angle_from_north;
-
-      v39 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
-      v36 = v39 + pSkyPolygon.ptr_38->angle_from_east;
-
-      v38 = pSkyPolygon.v_18.z;
-      v9 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
-      v10 = pSkyPolygon.v_18.x + v9;
-      v39 = pSkyPolygon.v_18.x + v9;
-      if ( pSkyPolygon.v_18.x + v9 > 0 )
+      v39 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(v33 * (v30 - floor(array_50AC10[i].vWorldViewProjY + 0.5)))) >> 16;//0
+      v35 = v39 + pSkyPolygon.ptr_38->angle_from_north;//-45190
+
+      v39 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(v33 * (v30 - floor(array_50AC10[i].vWorldViewProjY + 0.f)))) >> 16;//0
+      v36 = v39 + pSkyPolygon.ptr_38->angle_from_east;//47464
+
+      v38 = pSkyPolygon.v_18.z;//-65457
+      v9 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(v33 * (v30 - floor(array_50AC10[i].vWorldViewProjY + 0.5)))) >> 16;//-50444
+      v10 = pSkyPolygon.v_18.x + v9;//-53660
+      v39 = pSkyPolygon.v_18.x + v9;//-53660
+      if ( v10 > 0 )
       {
         v10 = 0;
         v39 = 0;
       }
-      v38 = v10;
-      v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);
-      v34 = -pSkyPolygon.field_24;
-      v32 = (signed __int64)array_50AC10[i].vWorldViewProjX;
-      v14 = v33 * (v30 - (signed __int64)array_50AC10[i].vWorldViewProjX);
+      v38 = v10;//-53660
+      v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);//49220
+      v34 = -pSkyPolygon.field_24;//-33554432
+      v32 = (signed __int64)array_50AC10[i].vWorldViewProjX - 1.0;//7
+      v14 = v33 * (v30 - v32);//50718
       while ( 1 )
       {
-        v40 = v14;
+        v40 = v14;//50718
         if ( !v10 )
           goto LABEL_12;
-        v37 = abs((int)v34 >> 14);
-        v15 = abs(v10);
+        v37 = abs((int)v34 >> 14);//2048
+        v15 = abs(v10);//53660
         if ( v37 <= v15 || v32 <= (signed int)pViewport->uViewportTL_Y )
         {
           if ( v39 <= 0 )
@@ -9201,23 +9200,23 @@
         v38 = pSkyPolygon.v_18.x + v16;
       }
       LODWORD(v17) = LODWORD(v34) << 16;
-      HIDWORD(v17) = v34 >> 16;
+      HIDWORD(v17) = v34 >> 16;//-2199023255552
       //v40 = v17 / v38;
-      v18 = v17 / v38;
+      v18 = v17 / v38;//39869157
       if ( v18 < 0 )
         v18 = pODMRenderParams->shading_dist_mist;
-      v37 = v35 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v13) >> 16);
-      v35 = 224 * pMiscTimer->uTotalGameTimeElapsed
+      v37 = v35 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v13) >> 16);//-80838
+      v35 = 224 * pMiscTimer->uTotalGameTimeElapsed//-4328844
           + ((signed int)((unsigned __int64)(v37 * (signed __int64)v18) >> 16) >> 3);
-      array_50AC10[i].u = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureWidth * 65536.0);
-
-      v36 = v36 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v13) >> 16);
-      v35 = 224 * pMiscTimer->uTotalGameTimeElapsed
+      array_50AC10[i].u = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureWidth * 65536.0);//-0.12900960
+
+      v36 = v36 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v13) >> 16);//13524
+      v35 = 224 * pMiscTimer->uTotalGameTimeElapsed//2846856
          + ((signed int)((unsigned __int64)(v36 * (signed __int64)v18) >> 16) >> 3);
-      array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0);
-
-      array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist
-      array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16);
+      array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0);//0.084842920
+
+      array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist 8192
+      array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16);//0.0016447369
     }
     pRenderer->DrawOutdoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
     array_50AC10[0].vWorldViewProjY = (double)v38;