changeset 2120:3eab5530cc94

DrawOutdoorSkyD3D fix and cleaned
author Ritor1
date Tue, 24 Dec 2013 22:41:25 +0600
parents 014c672b6d87
children f6e59446c133
files Render.cpp mm7_5.cpp
diffstat 2 files changed, 38 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/Render.cpp	Tue Dec 24 17:32:33 2013 +0600
+++ b/Render.cpp	Tue Dec 24 22:41:25 2013 +0600
@@ -9087,7 +9087,6 @@
   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
   int v30; // [sp+134h] [bp-30h]@1
   int v32; // [sp+13Ch] [bp-28h]@6
   int v33; // [sp+140h] [bp-24h]@2
@@ -9097,13 +9096,12 @@
   int v37; // [sp+154h] [bp-10h]@8
   int v38; // [sp+158h] [bp-Ch]@1
   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)//244
+
+  v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z)
                        / ((double)pODMRenderParams->int_fov_rad + 8192.0)
                        + (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
+  v38 = (signed __int64)((double)(pViewport->uScreenCenterY)
                        - (double)pODMRenderParams->int_fov_rad
                        / (v34 + 0.0000001)
                        * (sin((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064)
@@ -9118,9 +9116,9 @@
     pSkyPolygon.dimming_level = 0;
     pSkyPolygon.uNumVertices = 4;
   //centering(центруем)-----------------------------------------------------------------
-    pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);//-3216
+    pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
     pSkyPolygon.v_18.y = 0;
-    pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);//-65457
+    pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);
   
   //sky wiew position(положение неба на экране)------------------------------------------
   //                X
@@ -9149,7 +9147,7 @@
     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
+    v33 = 65536 / (signed int)(signed __int64)(((double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2) / tan(0.6457717418670654) + 0.5);
     for ( uint i = 0; i < pSkyPolygon.uNumVertices; ++i )
     {
       //rotate skydome(вращение купола неба)--------------------------------------
@@ -9157,72 +9155,60 @@
       // направление на север и/или юг (либо на восток и/или запад), значению 65536 еденицам(0х10000) соответствует угол 90.
       // две переменные хранят данные по углу обзора. field_14 по западу и востоку. field_20 по югу и северу
       // от -25080 до 25080
-      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
+      v39 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(v33 * (v30 - floor(array_50AC10[i].vWorldViewProjY + 0.5)))) >> 16;
+      v35 = v39 + pSkyPolygon.ptr_38->angle_from_north;
+
+      v39 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(v33 * (v30 - floor(array_50AC10[i].vWorldViewProjY + 0.f)))) >> 16;
+      v36 = v39 + pSkyPolygon.ptr_38->angle_from_east;
+
+      v9 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(v33 * (v30 - floor(array_50AC10[i].vWorldViewProjY + 0.5)))) >> 16;
+      v10 = pSkyPolygon.v_18.x + v9;
       if ( v10 > 0 )
-      {
         v10 = 0;
-        v39 = 0;
-      }
-      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
+      v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);
+      v34 = -pSkyPolygon.field_24;
+      v32 = (signed __int64)array_50AC10[i].vWorldViewProjY - 1.0;
+      v14 = v33 * (v30 - v32);
       while ( 1 )
       {
-        v40 = v14;//50718
-        if ( !v10 )
-          goto LABEL_12;
-        v37 = abs((int)v34 >> 14);//2048
-        v15 = abs(v10);//53660
-        if ( v37 <= v15 || v32 <= (signed int)pViewport->uViewportTL_Y )
+        if ( v10 )
         {
-          if ( v39 <= 0 )
-            break;
+          v37 = abs((int)v34 >> 14);
+          v15 = abs(v10);
+          if ( v37 <= v15 || v32 <= (signed int)pViewport->uViewportTL_Y )
+          {
+            if ( v10 <= 0 )
+              break;
+          }
         }
-        v14 = v40;
-LABEL_12:
-        v37 = pSkyPolygon.v_18.z;
         v16 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v14) >> 16;
         --v32;
         v14 += v33;
         v10 = pSkyPolygon.v_18.x + v16;
-        v39 = pSkyPolygon.v_18.x + v16;
-        v38 = pSkyPolygon.v_18.x + v16;
       }
       LODWORD(v17) = LODWORD(v34) << 16;
-      HIDWORD(v17) = v34 >> 16;//-2199023255552
-      //v40 = v17 / v38;
-      v18 = v17 / v38;//39869157
+      HIDWORD(v17) = v34 >> 16;
+      v18 = v17 / v10;
       if ( v18 < 0 )
         v18 = pODMRenderParams->shading_dist_mist;
-      v37 = v35 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v13) >> 16);//-80838
-      v35 = 224 * pMiscTimer->uTotalGameTimeElapsed//-4328844
+      v37 = v35 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v13) >> 16);
+      v35 = 224 * pMiscTimer->uTotalGameTimeElapsed
           + ((signed int)((unsigned __int64)(v37 * (signed __int64)v18) >> 16) >> 3);
-      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
+      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
          + ((signed int)((unsigned __int64)(v36 * (signed __int64)v18) >> 16) >> 3);
-      array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0);//0.084842920
+      array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0);
 
       array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist 8192
-      array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16);//0.0016447369
+      array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16);
     }
     pRenderer->DrawOutdoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
-    array_50AC10[0].vWorldViewProjY = (double)v38;
+    array_50AC10[0].vWorldViewProjY = (double)v10;
     array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
     array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
-    array_50AC10[3].vWorldViewProjY = (double)v38;
+    array_50AC10[3].vWorldViewProjY = (double)v10;
     pRenderer->DrawOutdoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
     return;
   }
--- a/mm7_5.cpp	Tue Dec 24 17:32:33 2013 +0600
+++ b/mm7_5.cpp	Tue Dec 24 22:41:25 2013 +0600
@@ -255,7 +255,6 @@
   double v3; // st7@1
   double result; // st7@6
 
-  __debugbreak();//Ritor1
   v3 = (double)a1;
   for ( v2 = 0; v2 < 5; ++v2 )
   {