Mercurial > mm7
diff mm7_3.cpp @ 1427:1987f2cca08f
m
author | Ritor1 |
---|---|
date | Thu, 01 Aug 2013 09:26:05 +0600 |
parents | 5930342f092b |
children | 6de9c1316852 |
line wrap: on
line diff
--- a/mm7_3.cpp Tue Jul 30 15:14:46 2013 +0600 +++ b/mm7_3.cpp Thu Aug 01 09:26:05 2013 +0600 @@ -5361,14 +5361,12 @@ int v9; // eax@4 int v10; // ebx@4 signed __int64 v11; // qax@6 - //double v12; // st7@6 int v13; // edi@6 int v14; // ecx@6 - //int v15; // eax@8 int v16; // eax@12 - signed __int64 v17; // qtt@13 + //signed __int64 v17; // qtt@13 signed int pShading; // ecx@13 - struct Polygon pSky; // [sp+14h] [bp-150h]@1 + struct Polygon pSkyPolygon; // [sp+14h] [bp-150h]@1 float v28; // [sp+12Ch] [bp-38h]@2 int v29; // [sp+130h] [bp-34h]@4 int v30; // [sp+134h] [bp-30h]@1 @@ -5376,11 +5374,11 @@ int v33; // [sp+140h] [bp-24h]@2 int v34; // [sp+144h] [bp-20h]@1 int v35; // [sp+148h] [bp-1Ch]@4 - int v36; // [sp+14Ch] [bp-18h]@2 + int screen_center_x; // [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 + //int v40; // [sp+160h] [bp-4h]@7 extern bool new_sky; if (new_sky) @@ -5390,48 +5388,59 @@ } v30 = ((double)(pOutdoorCamera->int_fov_rad * pIndoorCamera->pos.z) - / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY); + / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);//184 изменяется при подъёме на высоту 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);//текстура неба + (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z);//61 / 184 / 310 изменяется при наклоне камеры + + pSkyPolygon.Create_48607B(&stru_8019C8); + pSkyPolygon.ptr_38->Inverse_sky_48694B();//maybe creating skydome(возможно создание купола неба) + pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//номер текстуры + pSkyPolygon.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);//текстура неба if (pOutdoor->uSky_TextureID == -1) return; - pSky.dimming_level = 0;//затемнение - pSky.uNumVertices = 4;//количество вершин - - //centering(центруем)--------------------------------------------------------------- - pSky.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);//-3216 - pSky.v_18.y = 0; - pSky.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);//-65457 - //--------------------------------------------------------------------------- - - pSky.field_24 = 0x2000000; - - pSky.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; - pSky.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; + pSkyPolygon.dimming_level = 0;//затемнение + pSkyPolygon.uNumVertices = 4;//количество вершин + + //centering(центруем)--наклон камеры ----------------------------------------// + pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);//-3216, вверх: -28020, вниз: 22078 + pSkyPolygon.v_18.y = 0; + pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);//-65457, вверх: -59244, вниз: -61705 + //---------------------------------------------------------------------------// + + pSkyPolygon.field_24 = 0x2000000; + + pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;//60928 + pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; //sky position(положение неба)---------------------------------------------- - array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X; - array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y; - - array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X; - array_50AC10[1].vWorldViewProjY = v38; - - array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X; - array_50AC10[2].vWorldViewProjY = v38; - - array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; - array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y; + // X + // 0._____________________________.3 + // |8,8 468,8 | + // | | + // | | + // Y| | + // | | + // |8,? 468,? | + // 1._____________________________.2 + // + + array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X;//8 + array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y;//8 + + array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X;//8 + array_50AC10[1].vWorldViewProjY = v38;//61 / 184 / 310 + + array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X;//468 + array_50AC10[2].vWorldViewProjY = v38;//61 / 184 / 310 + + array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X;//468 + array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y;//8 //-------------------------------------------------------------------------- //pParty->sRotationY / 2048.0f - // move sky(двидение неба)--------------include----------------------------- + // 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; @@ -5444,25 +5453,31 @@ array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f; array_50AC10[3].v = t - pParty->sRotationX / 512.0f; - //-------------------------------------------------------------------------- + //--------------------------------------------------------------------------// //rotate skydome(вращение купола неба)-------------------------------------- - v36 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5;//центр экрана 230 - v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5);//214 - - for (uint i = 0; i < pSky.uNumVertices; ++i) + // В игре принята своя система измерения углов. Полный угол в 2П радиан соответствует 65536 еденицам. Значению угла 0 соответствует + // направление на восток, значению 16384(0х4000) - на север и т.д.. + + //нахождение вектора взгляда------------------------------------------------ + //положение камеры---------------------------------------------------------- + screen_center_x = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;//центр экрана по X = 230 + v33 = 65536 / (signed int)(screen_center_x / tan(0.6457717418670654) + 0.5);//360 : (расстояние от экрана до камеры в пикселях) = 214 + //-------------------------------------------------------------------------- + + for (uint i = 0; i < pSkyPolygon.uNumVertices; ++i) { v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f);//8 - v39 = (unsigned __int64)(pSky.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;//0 - v8 = v39 + pSky.ptr_38->field_C;//0 - - v39 = (unsigned __int64)(pSky.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;//0 - v36 = v39 + pSky.ptr_38->field_18;//65536 - - v9 = (unsigned __int64)(pSky.v_18.z * v33 * (v30 - v29)) / 65536;//27917 - v10 = pSky.v_18.x + v9;//24701 - v39 = pSky.v_18.x + v9;//24701 - if ( pSky.v_18.x + v9 > 0 ) + v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;//0 + v8 = v39 + pSkyPolygon.ptr_38->field_C;//0 + + v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;//0 + screen_center_x = v39 + pSkyPolygon.ptr_38->field_18;//65536 + + v9 = (unsigned __int64)(pSkyPolygon.v_18.z * v33 * (v30 - v29)) / 65536;//27917 + v10 = pSkyPolygon.v_18.x + v9;//24701 + v39 = pSkyPolygon.v_18.x + v9;//24701 + if ( pSkyPolygon.v_18.x + v9 > 0 ) { v10 = 0; v39 = 0; @@ -5471,73 +5486,71 @@ v38 = v10; //v12 = array_50AC10[i].vWorldViewProjY - 1.0; v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX); - v34 = -pSky.field_24; + v34 = -pSkyPolygon.field_24; v32 = (signed __int64)array_50AC10[i].vWorldViewProjY - 1.0; v14 = v33 * (v30 - v32); while ( 1 ) { - v40 = v14; + //v40 = v14; if ( !v10 ) { - v37 = pSky.v_18.z; - v16 = (unsigned __int64)(pSky.v_18.z * (signed __int64)v14) >> 16; + v37 = pSkyPolygon.v_18.z; + v16 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v14) >> 16; --v32; v14 += v33; - v10 = pSky.v_18.x + v16; - v39 = pSky.v_18.x + v16; - v38 = pSky.v_18.x + v16; + v10 = pSkyPolygon.v_18.x + v16; + v39 = pSkyPolygon.v_18.x + v16; + v38 = pSkyPolygon.v_18.x + v16; break; } - v37 = abs(v34 >> 14); + v37 = abs(v34 >> 14);//2048 if ( abs(v34 >> 14) <= abs(v10) || v32 <= pViewport->uViewportTL_Y ) { if ( v39 <= 0 ) break; } - v14 = v40; - v37 = pSky.v_18.z; - v16 = (unsigned __int64)(pSky.v_18.z * v14) >> 16; + //v14 = v40; + v37 = pSkyPolygon.v_18.z; + v16 = (unsigned __int64)(pSkyPolygon.v_18.z * v14) >> 16; --v32; v14 += v33; - v10 = pSky.v_18.x + v16; - v39 = pSky.v_18.x + v16; - v38 = pSky.v_18.x + v16; + v10 = pSkyPolygon.v_18.x + v16; + v39 = pSkyPolygon.v_18.x + v16; + v38 = pSkyPolygon.v_18.x + v16; break; } - LODWORD(v17) = v34 << 16; - HIDWORD(v17) = v34 >> 16; - pShading = v17 / v38; + pShading = fixpoint_div(v34, v38); if ( pShading < 0 ) pShading = pOutdoorCamera->shading_dist_mist; - v37 += ((unsigned __int64)(pSky.ptr_38->field_10 * v13) >> 16); - v36 += ((unsigned __int64)(pSky.ptr_38->field_1C * v13) >> 16); + v37 += ((unsigned __int64)(pSkyPolygon.ptr_38->field_10 * v13) >> 16); + screen_center_x += ((unsigned __int64)(pSkyPolygon.ptr_38->field_1C * v13) >> 16); v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, pShading) / 8; - v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v36, pShading) / 8; + screen_center_x = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(screen_center_x, pShading) / 8; //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; //array_50AC10[i].vWorldPosition.x = v36 / (pSky.pTexture->uTextureHeight * 65536.0); //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16); //array_50AC10[i].vWorldPosition.z = v35 / (pSky.pTexture->uTextureWidth * 65536.0); - //array_50AC10[i]._rhw = 1.0f / (v18 >> 16); - //array_50AC10[i].u = (double)v35 / (65536.0 * pSky.pTexture->uTextureWidth); - //array_50AC10[i].v = (double)v36 / (65536.0 * pSky.pTexture->uTextureHeight); + //array_50AC10[i]._rhw = 1.0f / (pShading >> 16); + //array_50AC10[i].u = (double)v35 / (65536.0 * pSkyPolygon.pTexture->uTextureWidth); + //array_50AC10[i].v = (double)screen_center_x / (65536.0 * pSkyPolygon.pTexture->uTextureHeight); //----------------------------------------------------------------------------------------- array_50AC10[i]._rhw = 1.0f; } //if ( i == _this.uNumVertices - 1 ) //{ - pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]); + pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[pSkyPolygon.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]); + pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[pSkyPolygon.uTileBitmapID]); //} } @@ -6195,7 +6208,7 @@ } //----- (0048607B) -------------------------------------------------------- -void Polygon::_48607B(stru149 *a2) +void Polygon::Create_48607B(stru149 *a2) { this->pTexture = 0; this->ptr_38 = a2; @@ -6337,29 +6350,17 @@ } //----- (0048694B) -------------------------------------------------------- -int stru149::sky_48694B() +void stru149::Inverse_sky_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; 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); } //----- (0044100D) --------------------------------------------------------