comparison mm7_3.cpp @ 1436:883fea17dd9a

fix Sky continue
author Ritor1
date Sat, 06 Jul 2013 09:06:51 +0600
parents 8bfdc44cebfd
children 47975067d6a8
comparison
equal deleted inserted replaced
1435:94e4c3ef9b8e 1436:883fea17dd9a
5979 //double v20; // st6@15 5979 //double v20; // st6@15
5980 //double v21; // st7@15 5980 //double v21; // st7@15
5981 //double v22; // st6@15 5981 //double v22; // st6@15
5982 //unsigned __int8 v23; // sf@15 5982 //unsigned __int8 v23; // sf@15
5983 //unsigned __int8 v24; // of@15 5983 //unsigned __int8 v24; // of@15
5984 stru148 _this; // [sp+14h] [bp-150h]@1 5984 stru148 pSky; // [sp+14h] [bp-150h]@1
5985 //double v26; // [sp+120h] [bp-44h]@4 5985 //double v26; // [sp+120h] [bp-44h]@4
5986 //float v27; // [sp+128h] [bp-3Ch]@4 5986 //float v27; // [sp+128h] [bp-3Ch]@4
5987 float v28; // [sp+12Ch] [bp-38h]@2 5987 float v28; // [sp+12Ch] [bp-38h]@2
5988 int v29; // [sp+130h] [bp-34h]@4 5988 int v29; // [sp+130h] [bp-34h]@4
5989 int v30; // [sp+134h] [bp-30h]@1 5989 int v30; // [sp+134h] [bp-30h]@1
6005 return; 6005 return;
6006 } 6006 }
6007 6007
6008 v30 = ((double)(pOutdoorCamera->int_fov_rad * pIndoorCamera->pos.z) 6008 v30 = ((double)(pOutdoorCamera->int_fov_rad * pIndoorCamera->pos.z)
6009 / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY); 6009 / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);
6010 v38 = pViewport->uScreenCenterY - 6010 v38 = pViewport->uScreenCenterY - pOutdoorCamera->int_fov_rad /
6011 pOutdoorCamera->int_fov_rad / (pOutdoorCamera->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) * 6011 (pOutdoorCamera->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) *
6012 (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z); 6012 (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z);
6013 _this._48607B(&stru_8019C8); 6013
6014 _this.ptr_38->_48694B(); 6014 pSky._48607B(&stru_8019C8);
6015 _this.uTileBitmapID = pOutdoor->uSky_TextureID; 6015 pSky.ptr_38->sky_48694B();
6016 _this.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? &pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0); 6016 pSky.uTileBitmapID = pOutdoor->uSky_TextureID;//номер текстуры
6017 pSky.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);//текстура неба
6017 if (pOutdoor->uSky_TextureID == -1) 6018 if (pOutdoor->uSky_TextureID == -1)
6018 return; 6019 return;
6019 6020
6020 _this.dimming_level = 0; 6021 pSky.dimming_level = 0;//затемнение
6021 _this.uNumVertices = 4; 6022 pSky.uNumVertices = 4;//количество вершин
6022 _this.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16); 6023
6023 _this.v_18.y = 0; 6024 //tilt(наклон)---------------------------------------------------------------
6024 _this.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16); 6025 pSky.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);
6025 _this.field_24 = 0x2000000; 6026 pSky.v_18.y = 0;
6026 6027 pSky.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);
6027 _this.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; 6028 //---------------------------------------------------------------------------
6028 _this.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; 6029
6029 6030 pSky.field_24 = 0x2000000;
6031
6032 pSky.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;
6033 pSky.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
6034
6035 //sky position(положение неба)----------------------------------------------
6030 array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X; 6036 array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X;
6031 array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y; 6037 array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y;
6032 6038
6033 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X; 6039 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X;
6034 array_50AC10[1].vWorldViewProjY = v38; 6040 array_50AC10[1].vWorldViewProjY = v38;
6036 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X; 6042 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X;
6037 array_50AC10[2].vWorldViewProjY = v38; 6043 array_50AC10[2].vWorldViewProjY = v38;
6038 6044
6039 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; 6045 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X;
6040 array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y; 6046 array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y;
6047 //--------------------------------------------------------------------------
6041 6048
6042 //pParty->sRotationY / 2048.0f 6049 //pParty->sRotationY / 2048.0f
6043 6050 // move sky(двидение неба)--------------include-----------------------------
6044 float t = (GetTickCount() % 96000) / 96000.0f; 6051 float t = (GetTickCount() % 96000) / 96000.0f;
6045 array_50AC10[0].u = t - pParty->sRotationY / 1024.0f; 6052 array_50AC10[0].u = t - pParty->sRotationY / 1024.0f;
6046 array_50AC10[0].v = t - pParty->sRotationX / 512.0f; 6053 array_50AC10[0].v = t - pParty->sRotationX / 512.0f;
6047 6054
6048 array_50AC10[1].u = t - pParty->sRotationY / 1024.0f; 6055 array_50AC10[1].u = t - pParty->sRotationY / 1024.0f;
6051 array_50AC10[2].u = 1 + t - pParty->sRotationY / 1024.0f; 6058 array_50AC10[2].u = 1 + t - pParty->sRotationY / 1024.0f;
6052 array_50AC10[2].v = 1 + t - pParty->sRotationX / 512.0f; 6059 array_50AC10[2].v = 1 + t - pParty->sRotationX / 512.0f;
6053 6060
6054 array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f; 6061 array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f;
6055 array_50AC10[3].v = t - pParty->sRotationX / 512.0f; 6062 array_50AC10[3].v = t - pParty->sRotationX / 512.0f;
6056 6063 //--------------------------------------------------------------------------
6057 v36 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5; 6064
6065 //rotate skydome(вращение купола неба)--------------------------------------
6066 v36 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5;//центр экрана
6058 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5); 6067 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5);
6059 6068
6060 for (uint i = 0; i < _this.uNumVertices; ++i) 6069 for (uint i = 0; i < pSky.uNumVertices; ++i)
6061 { 6070 {
6062 v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f); 6071 v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f);
6063 v39 = (unsigned __int64)(_this.ptr_38->field_14 * v33 * (v30 - v29)) / 65536; 6072 v39 = (unsigned __int64)(pSky.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;
6064 v8 = v39 + _this.ptr_38->field_C; 6073 v8 = v39 + pSky.ptr_38->field_C;
6065 6074
6066 v39 = (unsigned __int64)(_this.ptr_38->field_20 * v33 * (v30 - v29)) / 65536; 6075 v39 = (unsigned __int64)(pSky.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;
6067 v36 = v39 + _this.ptr_38->field_18; 6076 v36 = v39 + pSky.ptr_38->field_18;
6068 6077
6069 v9 = (unsigned __int64)(_this.v_18.z * v33 * (v30 - v29)) / 65536; 6078 v9 = (unsigned __int64)(pSky.v_18.z * v33 * (v30 - v29)) / 65536;
6070 v10 = _this.v_18.x + v9; 6079 v10 = pSky.v_18.x + v9;
6071 v39 = _this.v_18.x + v9; 6080 v39 = pSky.v_18.x + v9;
6072 if ( _this.v_18.x + v9 > 0 ) 6081 if ( pSky.v_18.x + v9 > 0 )
6073 { 6082 {
6074 v10 = 0; 6083 v10 = 0;
6075 v39 = 0; 6084 v39 = 0;
6076 } 6085 }
6077 //v11 = (signed __int64)array_50AC10[i].vWorldViewProjX; 6086 //v11 = (signed __int64)array_50AC10[i].vWorldViewProjX;
6078 v38 = v10; 6087 v38 = v10;
6079 v12 = array_50AC10[i].vWorldViewProjY - 1.0; 6088 v12 = array_50AC10[i].vWorldViewProjY - 1.0;
6080 v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX); 6089 v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);
6081 v34 = -_this.field_24; 6090 v34 = -pSky.field_24;
6082 v32 = (signed __int64)v12; 6091 v32 = (signed __int64)v12;
6083 v14 = v33 * (v30 - v32); 6092 v14 = v33 * (v30 - v32);
6084 while ( 1 ) 6093 while ( 1 )
6085 { 6094 {
6086 //v40 = v14; 6095 //v40 = v14;
6087 if ( !v10 ) 6096 if ( !v10 )
6088 { 6097 {
6089 v37 = _this.v_18.z; 6098 v37 = pSky.v_18.z;
6090 v16 = (unsigned __int64)(_this.v_18.z * (signed __int64)v14) >> 16; 6099 v16 = (unsigned __int64)(pSky.v_18.z * (signed __int64)v14) >> 16;
6091 --v32; 6100 --v32;
6092 v14 += v33; 6101 v14 += v33;
6093 v10 = _this.v_18.x + v16; 6102 v10 = pSky.v_18.x + v16;
6094 v39 = _this.v_18.x + v16; 6103 v39 = pSky.v_18.x + v16;
6095 v38 = _this.v_18.x + v16; 6104 v38 = pSky.v_18.x + v16;
6096 break; 6105 break;
6097 } 6106 }
6098 v37 = abs(v34 >> 14); 6107 v37 = abs(v34 >> 14);
6099 v15 = abs(v10); 6108 v15 = abs(v10);
6100 if ( v37 <= v15 || v32 <= pViewport->uViewportTL_Y ) 6109 if ( v37 <= v15 || v32 <= pViewport->uViewportTL_Y )
6101 { 6110 {
6102 if ( v39 <= 0 ) 6111 if ( v39 <= 0 )
6103 break; 6112 break;
6104 } 6113 }
6105 //v14 = v40; 6114 //v14 = v40;
6106 v37 = _this.v_18.z; 6115 v37 = pSky.v_18.z;
6107 v16 = (unsigned __int64)(_this.v_18.z * v14) >> 16; 6116 v16 = (unsigned __int64)(pSky.v_18.z * v14) >> 16;
6108 --v32; 6117 --v32;
6109 v14 += v33; 6118 v14 += v33;
6110 v10 = _this.v_18.x + v16; 6119 v10 = pSky.v_18.x + v16;
6111 v39 = _this.v_18.x + v16; 6120 v39 = pSky.v_18.x + v16;
6112 v38 = _this.v_18.x + v16; 6121 v38 = pSky.v_18.x + v16;
6113 break; 6122 break;
6114 } 6123 }
6115 LODWORD(v17) = v34 << 16; 6124 LODWORD(v17) = v34 << 16;
6116 HIDWORD(v17) = v34 >> 16; 6125 HIDWORD(v17) = v34 >> 16;
6117 v18 = v17 / v38; 6126 v18 = v17 / v38;
6118 if ( v18 < 0 ) 6127 if ( v18 < 0 )
6119 v18 = pOutdoorCamera->shading_dist_mist; 6128 v18 = pOutdoorCamera->shading_dist_mist;
6120 6129
6121 v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16); 6130 v37 += ((unsigned __int64)(pSky.ptr_38->field_10 * v13) >> 16);
6122 v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16); 6131 v36 += ((unsigned __int64)(pSky.ptr_38->field_1C * v13) >> 16);
6123 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, v18) / 8; 6132 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, v18) / 8;
6124 v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v36, v18) / 8; 6133 v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v36, v18) / 8;
6125 6134
6126 //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; 6135 //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
6127 //array_50AC10[i].vWorldPosition.x = v36 / (_this.pTexture->uTextureHeight * 65536.0); 6136 //array_50AC10[i].vWorldPosition.x = v36 / (_this.pTexture->uTextureHeight * 65536.0);
6128 //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16); 6137 //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16);
6129 //array_50AC10[i].vWorldPosition.z = v35 / (_this.pTexture->uTextureWidth * 65536.0); 6138 //array_50AC10[i].vWorldPosition.z = v35 / (_this.pTexture->uTextureWidth * 65536.0);
6130 //array_50AC10[i]._rhw = 1.0f / (v18 >> 16); 6139 //array_50AC10[i]._rhw = 1.0f / (v18 >> 16);
6131 //array_50AC10[i].u = (double)v35 / (65536.0 * _this.pTexture->uTextureWidth); 6140 //array_50AC10[i].u = (double)v35 / (65536.0 * _this.pTexture->uTextureWidth);
6132 //array_50AC10[i].v = (double)v36 / (65536.0 * _this.pTexture->uTextureHeight); 6141 //array_50AC10[i].v = (double)v36 / (65536.0 * _this.pTexture->uTextureHeight);
6133 //float t = (GetTickCount() % 96000) / 96000.0f; 6142 //-----------------------------------------------------------------------------------------
6143
6134 array_50AC10[i]._rhw = 1.0f; 6144 array_50AC10[i]._rhw = 1.0f;
6135 //array_50AC10[i].u = t; 6145 }
6136 //array_50AC10[i].v = t; 6146 //if ( i == _this.uNumVertices - 1 )
6137 } 6147 //{
6138 //if ( i == _this.uNumVertices - 1 ) 6148 pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]);
6139 //{ 6149
6140 pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); 6150 array_50AC10[0].vWorldViewProjY = v38;
6141 6151 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
6142 array_50AC10[0].vWorldViewProjY = v38; 6152 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
6143 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0; 6153 array_50AC10[3].vWorldViewProjY = v38;
6144 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0; 6154
6145 array_50AC10[3].vWorldViewProjY = v38; 6155 pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]);
6146 6156 //}
6147 pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
6148 //return;
6149 //}
6150 } 6157 }
6151 6158
6152 //----- (00479A53) -------------------------------------------------------- 6159 //----- (00479A53) --------------------------------------------------------
6153 void __fastcall _479A53_draw_some_blv_poly(unsigned int uNumVertices, unsigned int uFaceID) 6160 void __fastcall _479A53_draw_some_blv_poly(unsigned int uNumVertices, unsigned int uFaceID)
6154 { 6161 {
10533 this->field_28 = v29 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); 10540 this->field_28 = v29 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16);
10534 return result; 10541 return result;
10535 } 10542 }
10536 10543
10537 //----- (0048694B) -------------------------------------------------------- 10544 //----- (0048694B) --------------------------------------------------------
10538 int stru149::_48694B() 10545 void stru149::sky_48694B()
10539 { 10546 {
10540 int v1; // eax@1
10541 int v2; // ST04_4@1
10542 int v3; // ST00_4@1
10543 int v4; // eax@1
10544 int v5; // ST0C_4@1
10545 int result; // eax@1
10546
10547 v1 = this->field_C;
10548 this->field_18 = -this->field_18; 10547 this->field_18 = -this->field_18;
10549 this->field_1C = -this->field_1C; 10548 this->field_1C = -this->field_1C;
10550 this->field_20 = -this->field_20; 10549 this->field_20 = -this->field_20;
10551 v2 = (unsigned __int64)(v1 * (signed __int64)this->field_0_party_dir_x) >> 16; 10550 this->field_24 = (unsigned __int64)(this->field_C * (signed __int64)this->field_0_party_dir_x) >> 16
10552 v3 = this->field_18;
10553 v4 = this->field_0_party_dir_x;
10554 this->field_24 = v2
10555 + ((unsigned __int64)(this->field_10 * (signed __int64)this->field_4_party_dir_y) >> 16) 10551 + ((unsigned __int64)(this->field_10 * (signed __int64)this->field_4_party_dir_y) >> 16)
10556 + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16); 10552 + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16);
10557 v5 = (unsigned __int64)(v3 * (signed __int64)v4) >> 16; 10553 this->field_28 = (unsigned __int64)(this->field_18 * (signed __int64)this->field_0_party_dir_x) >> 16
10558 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; 10554 + (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16
10559 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); 10555 + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16);
10560 return result;
10561 } 10556 }
10562 10557
10563 //----- (00486B4E) -------------------------------------------------------- 10558 //----- (00486B4E) --------------------------------------------------------
10564 char __fastcall sr_sub_486B4E_push_outdoor_edges(RenderVertexSoft *a1, int *a2, int *a3, stru148 *a4)//maybe DrawPolygonSW 10559 char __fastcall sr_sub_486B4E_push_outdoor_edges(RenderVertexSoft *a1, int *a2, int *a3, stru148 *a4)//maybe DrawPolygonSW
10565 { 10560 {