diff Render.cpp @ 1911:af38275939cc

which_player_to_attack rename and cleaning
author Ritor1
date Tue, 22 Oct 2013 15:52:01 +0600
parents 1a1c4040bee4
children ab1c03cc2219
line wrap: on
line diff
--- a/Render.cpp	Tue Oct 22 00:04:14 2013 -0700
+++ b/Render.cpp	Tue Oct 22 15:52:01 2013 +0600
@@ -9044,4 +9044,157 @@
     }
   }
   return;
+}
+//----- (00479543) --------------------------------------------------------
+void Render::DrawSkyD3D()
+{
+  int v9; // eax@4
+  int v10; // ebx@4
+  int v13; // edi@6
+  int v14; // ecx@6
+  int v15; // eax@8
+  int v16; // eax@12
+  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
+  signed __int64 v34; // [sp+144h] [bp-20h]@1
+  int v35; // [sp+148h] [bp-1Ch]@4
+  int v36; // [sp+14Ch] [bp-18h]@2
+  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)
+                       / ((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)pODMRenderParams->int_fov_rad
+                       / (v34 + 0.0000001)
+                       * (sin((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064)
+                        * (double)-0x2000//(double)pODMRenderParams->shading_dist_mist
+                        - (double)pGame->pIndoorCameraD3D->vPartyPos.z));
+  pSkyPolygon.Create_48607B(&stru_8019C8);//заполняется ptr_38
+  pSkyPolygon.ptr_38->_48694B_frustum_sky();
+  pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//179(original 166)
+  pSkyPolygon.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? (int)&pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0);
+  if ( pSkyPolygon.pTexture )
+  {
+    pSkyPolygon.dimming_level = 0;
+    pSkyPolygon.uNumVertices = 4;
+  //centering(центруем)--наклон камеры ----------------------------------------
+    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);
+  
+  //sky wiew position(положение неба на экране)------------------------------------------
+  //                X
+  // 0._____________________________.3
+  //  |8,8                    468,8 |
+  //  |                             |
+  //  |                             |
+  // Y|                             |
+  //  |                             |
+  //  |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);
+    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 по югу и северу
+      // от -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 )
+      {
+        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);
+      while ( 1 )
+      {
+        v40 = v14;
+        if ( !v10 )
+          goto LABEL_12;
+        v37 = abs((int)v34 >> 14);
+        v15 = abs(v10);
+        if ( v37 <= v15 || v32 <= (signed int)pViewport->uViewportTL_Y )
+        {
+          if ( v39 <= 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;
+      //v40 = v17 / v38;
+      v18 = v17 / v38;
+      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
+          + ((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
+         + ((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);
+    }
+    pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
+    array_50AC10[0].vWorldViewProjY = (double)v38;
+    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;
+    pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
+    return;
+  }
 }
\ No newline at end of file