diff mm7_3.cpp @ 1436:883fea17dd9a

fix Sky continue
author Ritor1
date Sat, 06 Jul 2013 09:06:51 +0600
parents 8bfdc44cebfd
children 47975067d6a8
line wrap: on
line diff
--- a/mm7_3.cpp	Fri Jul 05 21:16:12 2013 +0600
+++ b/mm7_3.cpp	Sat Jul 06 09:06:51 2013 +0600
@@ -5981,7 +5981,7 @@
   //double v22; // st6@15
   //unsigned __int8 v23; // sf@15
   //unsigned __int8 v24; // of@15
-  stru148 _this; // [sp+14h] [bp-150h]@1
+  stru148 pSky; // [sp+14h] [bp-150h]@1
   //double v26; // [sp+120h] [bp-44h]@4
   //float v27; // [sp+128h] [bp-3Ch]@4
   float v28; // [sp+12Ch] [bp-38h]@2
@@ -6007,26 +6007,32 @@
 
   v30 = ((double)(pOutdoorCamera->int_fov_rad * pIndoorCamera->pos.z)
         / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);
-  v38 = pViewport->uScreenCenterY - 
-        pOutdoorCamera->int_fov_rad / (pOutdoorCamera->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) *
-        (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z);
-  _this._48607B(&stru_8019C8);
-  _this.ptr_38->_48694B();
-  _this.uTileBitmapID = pOutdoor->uSky_TextureID;
-  _this.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? &pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0);
+  v38 = pViewport->uScreenCenterY - pOutdoorCamera->int_fov_rad /
+       (pOutdoorCamera->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) *
+       (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z);
+
+  pSky._48607B(&stru_8019C8);
+  pSky.ptr_38->sky_48694B();
+  pSky.uTileBitmapID = pOutdoor->uSky_TextureID;//номер текстуры
+  pSky.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);//текстура неба
   if (pOutdoor->uSky_TextureID == -1)
     return;
 
-  _this.dimming_level = 0;
-  _this.uNumVertices = 4;
-  _this.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);
-  _this.v_18.y = 0;
-  _this.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);
-  _this.field_24 = 0x2000000;
-
-  _this.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;
-  _this.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
-
+  pSky.dimming_level = 0;//затемнение
+  pSky.uNumVertices = 4;//количество вершин
+
+  //tilt(наклон)---------------------------------------------------------------
+  pSky.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);
+  pSky.v_18.y = 0;
+  pSky.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);
+  //---------------------------------------------------------------------------
+
+  pSky.field_24 = 0x2000000;
+
+  pSky.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;
+  pSky.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
+  
+  //sky position(положение неба)----------------------------------------------
   array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X;
   array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y;
 
@@ -6038,9 +6044,10 @@
 
   array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X;
   array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y;
+  //--------------------------------------------------------------------------
 
   //pParty->sRotationY / 2048.0f
-    
+  // move sky(двидение неба)--------------include-----------------------------
     float t = (GetTickCount() % 96000) / 96000.0f;
     array_50AC10[0].u = t - pParty->sRotationY / 1024.0f;
     array_50AC10[0].v = t - pParty->sRotationX / 512.0f;
@@ -6053,23 +6060,25 @@
 
     array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f;
     array_50AC10[3].v = t - pParty->sRotationX / 512.0f;
-
-  v36 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5;
+  //--------------------------------------------------------------------------
+
+  //rotate skydome(вращение купола неба)--------------------------------------
+  v36 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5;//центр экрана
   v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5);
 
-  for (uint i = 0; i < _this.uNumVertices; ++i)
+  for (uint i = 0; i < pSky.uNumVertices; ++i)
   {
     v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f);
-    v39 = (unsigned __int64)(_this.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;
-    v8 = v39 + _this.ptr_38->field_C;
-
-    v39 = (unsigned __int64)(_this.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;
-    v36 = v39 + _this.ptr_38->field_18;
-
-    v9 = (unsigned __int64)(_this.v_18.z * v33 * (v30 - v29)) / 65536;
-    v10 = _this.v_18.x + v9;
-    v39 = _this.v_18.x + v9;
-    if ( _this.v_18.x + v9 > 0 )
+    v39 = (unsigned __int64)(pSky.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;
+    v8 = v39 + pSky.ptr_38->field_C;
+
+    v39 = (unsigned __int64)(pSky.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;
+    v36 = v39 + pSky.ptr_38->field_18;
+
+    v9 = (unsigned __int64)(pSky.v_18.z * v33 * (v30 - v29)) / 65536;
+    v10 = pSky.v_18.x + v9;
+    v39 = pSky.v_18.x + v9;
+    if ( pSky.v_18.x + v9 > 0 )
     {
       v10 = 0;
       v39 = 0;
@@ -6078,7 +6087,7 @@
     v38 = v10;
     v12 = array_50AC10[i].vWorldViewProjY - 1.0;
     v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);
-    v34 = -_this.field_24;
+    v34 = -pSky.field_24;
     v32 = (signed __int64)v12;
     v14 = v33 * (v30 - v32);
     while ( 1 )
@@ -6086,13 +6095,13 @@
       //v40 = v14;
       if ( !v10 )
       {
-        v37 = _this.v_18.z;
-        v16 = (unsigned __int64)(_this.v_18.z * (signed __int64)v14) >> 16;
+        v37 = pSky.v_18.z;
+        v16 = (unsigned __int64)(pSky.v_18.z * (signed __int64)v14) >> 16;
         --v32;
         v14 += v33;
-        v10 = _this.v_18.x + v16;
-        v39 = _this.v_18.x + v16;
-        v38 = _this.v_18.x + v16;
+        v10 = pSky.v_18.x + v16;
+        v39 = pSky.v_18.x + v16;
+        v38 = pSky.v_18.x + v16;
         break;
       }
       v37 = abs(v34 >> 14);
@@ -6103,13 +6112,13 @@
           break;
       }
       //v14 = v40;
-      v37 = _this.v_18.z;
-      v16 = (unsigned __int64)(_this.v_18.z * v14) >> 16;
+      v37 = pSky.v_18.z;
+      v16 = (unsigned __int64)(pSky.v_18.z * v14) >> 16;
       --v32;
       v14 += v33;
-      v10 = _this.v_18.x + v16;
-      v39 = _this.v_18.x + v16;
-      v38 = _this.v_18.x + v16;
+      v10 = pSky.v_18.x + v16;
+      v39 = pSky.v_18.x + v16;
+      v38 = pSky.v_18.x + v16;
       break;
     }
     LODWORD(v17) = v34 << 16;
@@ -6118,8 +6127,8 @@
     if ( v18 < 0 )
       v18 = pOutdoorCamera->shading_dist_mist;
 
-    v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16);
-    v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16);
+    v37 += ((unsigned __int64)(pSky.ptr_38->field_10 * v13) >> 16);
+    v36 += ((unsigned __int64)(pSky.ptr_38->field_1C * v13) >> 16);
     v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, v18) / 8;
     v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v36, v18) / 8;
 
@@ -6130,23 +6139,21 @@
     //array_50AC10[i]._rhw = 1.0f / (v18 >> 16);
     //array_50AC10[i].u = (double)v35 / (65536.0 * _this.pTexture->uTextureWidth);
     //array_50AC10[i].v = (double)v36 / (65536.0 * _this.pTexture->uTextureHeight);
-    //float t = (GetTickCount() % 96000) / 96000.0f;
+  //-----------------------------------------------------------------------------------------
+
     array_50AC10[i]._rhw = 1.0f;
-    //array_50AC10[i].u = t;
-    //array_50AC10[i].v = t;
-  }
-    //if ( i  == _this.uNumVertices - 1 )
-    //{
-      pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
-
-      array_50AC10[0].vWorldViewProjY = 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 = v38;
-
-      pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
-      //return;
-    //}
+  }
+  //if ( i  == _this.uNumVertices - 1 )
+  //{
+    pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]);
+
+    array_50AC10[0].vWorldViewProjY = 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 = v38;
+
+    pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]);
+  //}
 }
 
 //----- (00479A53) --------------------------------------------------------
@@ -10535,29 +10542,17 @@
 }
 
 //----- (0048694B) --------------------------------------------------------
-int stru149::_48694B()
-{
-  int v1; // eax@1
-  int v2; // ST04_4@1
-  int v3; // ST00_4@1
-  int v4; // eax@1
-  int v5; // ST0C_4@1
-  int result; // eax@1
-
-  v1 = this->field_C;
+void stru149::sky_48694B()
+{
   this->field_18 = -this->field_18;
   this->field_1C = -this->field_1C;
   this->field_20 = -this->field_20;
-  v2 = (unsigned __int64)(v1 * (signed __int64)this->field_0_party_dir_x) >> 16;
-  v3 = this->field_18;
-  v4 = this->field_0_party_dir_x;
-  this->field_24 = v2
+  this->field_24 = (unsigned __int64)(this->field_C * (signed __int64)this->field_0_party_dir_x) >> 16
                  + ((unsigned __int64)(this->field_10 * (signed __int64)this->field_4_party_dir_y) >> 16)
                  + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16);
-  v5 = (unsigned __int64)(v3 * (signed __int64)v4) >> 16;
-  result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16;
-  this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16);
-  return result;
+  this->field_28 = (unsigned __int64)(this->field_18 * (signed __int64)this->field_0_party_dir_x) >> 16
+                 + (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16
+                 + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16);
 }
 
 //----- (00486B4E) --------------------------------------------------------