diff mm7_3.cpp @ 1640:afc1c3514dd5

Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
author Nomad
date Tue, 17 Sep 2013 17:40:59 +0200
parents ccde94f02b75
children 466c5e15f524
line wrap: on
line diff
--- a/mm7_3.cpp	Tue Sep 17 15:40:36 2013 +0200
+++ b/mm7_3.cpp	Tue Sep 17 17:40:59 2013 +0200
@@ -4061,41 +4061,41 @@
         v4 = *(float *)(v3 - 4);
         LODWORD(v37) = *(int *)v3;
         LODWORD(v36) = *(int *)(v3 + 4);
-        if ( pBLVRenderParams->sPartyRotX )
+        if (pGame->pIndoorCameraD3D->sRotationX)
         {
-          v5 = v4 - (double)pBLVRenderParams->vPartyPos.x;
-          v6 = v37 - (double)pBLVRenderParams->vPartyPos.y;
-          if ( pRenderer->pRenderD3D )
-          {
+          v5 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
+          v6 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
+          //if ( pRenderer->pRenderD3D )
+          //{
             v41 = pBLVRenderParams->fSineY * v6 + pBLVRenderParams->fCosineY * v5;
             v7 = pBLVRenderParams->fSineY * v5 - pBLVRenderParams->fCosineY * v6;
-          }
+          /*}
           else
           {
             v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6;
             v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6;
-          }
+          }*/
           v8 = v7;
-          v9 = v36 - (double)pBLVRenderParams->vPartyPos.z;
+          v9 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
           v10 = pBLVRenderParams->fCosineNegX * v41 - pBLVRenderParams->fSineNegX * v9;
           v11 = v8;
           v12 = pBLVRenderParams->fCosineNegX * v9 + pBLVRenderParams->fSineNegX * v41;
         }
         else
         {
-          v42 = v4 - (double)pBLVRenderParams->vPartyPos.x;
-          v39 = v37 - (double)pBLVRenderParams->vPartyPos.y;
-          if ( pRenderer->pRenderD3D )
-          {
+          v42 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
+          v39 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
+          //if ( pRenderer->pRenderD3D )
+          //{
             v10 = pBLVRenderParams->fSineY * v39 + pBLVRenderParams->fCosineY * v42;
             v11 = pBLVRenderParams->fSineY * v42 - pBLVRenderParams->fCosineY * v39;
-          }
+          /*}
           else
           {
             v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39;
             v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39;
-          }
-          v12 = v36 - (double)pBLVRenderParams->vPartyPos.z;
+          }*/
+          v12 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
         }
         v13 = v12;
         ++v2;
@@ -4115,29 +4115,29 @@
     v31 = 3;
     do
     {
-      v40 = (double)stru_5C6E00->Cos(pODMRenderParams->rotation_x) * 0.0000152587890625;
-      v32 = (double)stru_5C6E00->Sin(pODMRenderParams->rotation_x) * 0.0000152587890625;
-      v34 = (double)stru_5C6E00->Cos(pODMRenderParams->rotation_y) * 0.0000152587890625;
-      v33 = (double)stru_5C6E00->Sin(pODMRenderParams->rotation_y) * 0.0000152587890625;
+      v40 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
+      v32 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
+      v34 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
+      v33 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
       //v16 = stru_5C6E00->Sin(pODMRenderParams->rotation_y);
       LODWORD(v38) = *(int *)v15;
       //UNDEF(v17);
-      v20 = *((float *)v15 - 1) - (double)pODMRenderParams->vPartyPos.x;
+      v20 = *((float *)v15 - 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
       //if ( v19 | v18 )
-	  if (pODMRenderParams->vPartyPos.x == 0)
+	  if (pGame->pIndoorCameraD3D->vPartyPos.x == 0)
       {
         v27 = v20;
         LODWORD(v35) = *((int *)v15 + 1);
-        v28 = v38 - (double)pODMRenderParams->vPartyPos.y;
+        v28 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
         v25 = v33 * v28 + v34 * v27;
         v26 = v34 * v28 - v33 * v27;
       }
       else
       {
         v21 = v20;
-        v22 = v38 - (double)pODMRenderParams->vPartyPos.y;
+        v22 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
         v23 = v33 * v22 + v34 * v21;
-        v24 = *((float *)v15 + 1) - (double)pODMRenderParams->vPartyPos.z;
+        v24 = *((float *)v15 + 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
         v25 = v32 * v24 + v40 * v23;
         v26 = v34 * v22 - v33 * v21;
         v35 = v40 * v24 - v32 * v23;
@@ -4710,15 +4710,15 @@
   angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 >> 1;
   //v14 = uModelID;
   v2 = &pOutdoor->pBModels[uModelID];
-  v3 = v2->vBoundingCenter.x - pODMRenderParams->vPartyPos.x;
-  v4 = v2->vBoundingCenter.y - pODMRenderParams->vPartyPos.y;
-  v5 = stru_5C6E00->Cos(pODMRenderParams->rotation_y);
-  v21 = stru_5C6E00->Sin(pODMRenderParams->rotation_y);
-  v18 = stru_5C6E00->Cos(pODMRenderParams->rotation_x);
-  stru_5C6E00->Sin(pODMRenderParams->rotation_x);
+  v3 = v2->vBoundingCenter.x - pGame->pIndoorCameraD3D->vPartyPos.x;
+  v4 = v2->vBoundingCenter.y - pGame->pIndoorCameraD3D->vPartyPos.y;
+  v5 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY);
+  v21 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY);
+  v18 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX);
+  stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX);
   v6 = v5;
   v17 = v3 * v5 + v4 * v21;
-  if (pODMRenderParams->rotation_x)
+  if (pGame->pIndoorCameraD3D->sRotationX)
     v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16;
   v19 = v4 * v6 - v3 * v21;
   v7 = abs(v4);
@@ -5308,11 +5308,11 @@
     return;
   }
 
-  v30 = ((double)(pODMRenderParams->int_fov_rad * pODMRenderParams->vPartyPos.z)
+  v30 = ((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z)
         / ((double)pODMRenderParams->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);//184 изменяется при подъёме на высоту
   v38 = pViewport->uScreenCenterY - pODMRenderParams->int_fov_rad /
-       (pODMRenderParams->shading_dist_mist * cos(pODMRenderParams->rotation_x * 0.003066406352445483) + 0.0000001000000011686097) *
-       (pODMRenderParams->shading_dist_mist * -sin(pODMRenderParams->rotation_x * 0.003066406352445483) - pODMRenderParams->vPartyPos.z);//61 / 184 / 310 изменяется при наклоне камеры
+       (pODMRenderParams->shading_dist_mist *  cos(pGame->pIndoorCameraD3D->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) *
+       (pODMRenderParams->shading_dist_mist * -sin(pGame->pIndoorCameraD3D->sRotationX * 0.003066406352445483) - pGame->pIndoorCameraD3D->vPartyPos.z);//61 / 184 / 310 изменяется при наклоне камеры
 
   pSkyPolygon.Create_48607B(&stru_8019C8);
   pSkyPolygon.ptr_38->_48694B_frustum_sky();//maybe creating skydome(возможно создание купола неба)
@@ -5325,9 +5325,9 @@
   pSkyPolygon.uNumVertices = 4;//количество вершин
 
   //centering(центруем)--наклон камеры ----------------------------------------//
-  pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pODMRenderParams->rotation_x + 16);//-3216, вверх: -28020, вниз: 22078
+  pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);//-3216, вверх: -28020, вниз: 22078
   pSkyPolygon.v_18.y = 0;
-  pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pODMRenderParams->rotation_x + 16);//-65457, вверх: -59244, вниз: -61705
+  pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);//-65457, вверх: -59244, вниз: -61705
   //---------------------------------------------------------------------------//
 
   pSkyPolygon.field_24 = 0x2000000;
@@ -5558,8 +5558,8 @@
   strcpy(Source, &pFilename[v7]);
   strcpy(pOutdoor->pLevelFilename, Source);
   pWeather->Initialize();
-  pODMRenderParams->rotation_y = pParty->sRotationY;
-  pODMRenderParams->rotation_x = pParty->sRotationX;
+  pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY;
+  pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX;
   pODMRenderParams->RotationToInts();
   pOutdoor->UpdateSunlightVectors();
 
@@ -6156,23 +6156,23 @@
   //v8 = -pIndoorCamera->pos.y;
   v9 = pODMRenderParams->camera_rotation_y_int_cosine;
   //v26 = -pIndoorCamera->pos.z;
-  v11 = pODMRenderParams->camera_rotation_y_int_cosine * -pODMRenderParams->vPartyPos.x + pODMRenderParams->camera_rotation_y_int_sine * -pODMRenderParams->vPartyPos.y;
-  v24 = pODMRenderParams->camera_rotation_y_int_cosine * -pODMRenderParams->vPartyPos.y - pODMRenderParams->camera_rotation_y_int_sine * -pODMRenderParams->vPartyPos.x;
-  if (pODMRenderParams->rotation_x)
+  v11 = pODMRenderParams->camera_rotation_y_int_cosine * -pGame->pIndoorCameraD3D->vPartyPos.x + pODMRenderParams->camera_rotation_y_int_sine * -pGame->pIndoorCameraD3D->vPartyPos.y;
+  v24 = pODMRenderParams->camera_rotation_y_int_cosine * -pGame->pIndoorCameraD3D->vPartyPos.y - pODMRenderParams->camera_rotation_y_int_sine * -pGame->pIndoorCameraD3D->vPartyPos.x;
+  if (pGame->pIndoorCameraD3D->sRotationX)
   {
     this->field_0_party_dir_x = fixpoint_sub0(v11, pODMRenderParams->camera_rotation_x_int_cosine) +
-                                fixpoint_sub0((-pODMRenderParams->vPartyPos.z) << 16, pODMRenderParams->camera_rotation_x_int_sine);
+                                fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pODMRenderParams->camera_rotation_x_int_sine);
     this->field_4_party_dir_y = v24;
-    this->field_8_party_dir_z = fixpoint_sub0((-pODMRenderParams->vPartyPos.z) << 16, v25) - fixpoint_sub0(v11, v27);
+    this->field_8_party_dir_z = fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_sub0(v11, v27);
   }
   else
   {
     this->field_0_party_dir_x = v11;
     this->field_4_party_dir_y = v24;
-    this->field_8_party_dir_z = (-pODMRenderParams->vPartyPos.z) << 16;
-  }
-
-  if (pODMRenderParams->rotation_x)
+    this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
+  }
+
+  if (pGame->pIndoorCameraD3D->sRotationX)
   {
     v17 = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7);
 
@@ -6187,7 +6187,7 @@
     this->field_14 = a4;
   }
 
-  if (pODMRenderParams->rotation_x)
+  if (pGame->pIndoorCameraD3D->sRotationX)
   {
     v19 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7);