comparison 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
comparison
equal deleted inserted replaced
1909:18dacb49efe9 1911:af38275939cc
9043 } 9043 }
9044 } 9044 }
9045 } 9045 }
9046 return; 9046 return;
9047 } 9047 }
9048 //----- (00479543) --------------------------------------------------------
9049 void Render::DrawSkyD3D()
9050 {
9051 int v9; // eax@4
9052 int v10; // ebx@4
9053 int v13; // edi@6
9054 int v14; // ecx@6
9055 int v15; // eax@8
9056 int v16; // eax@12
9057 signed __int64 v17; // qtt@13
9058 signed int v18; // ecx@13
9059 struct Polygon pSkyPolygon; // [sp+14h] [bp-150h]@1
9060 double v26; // [sp+120h] [bp-44h]@4
9061 int v30; // [sp+134h] [bp-30h]@1
9062 int v32; // [sp+13Ch] [bp-28h]@6
9063 int v33; // [sp+140h] [bp-24h]@2
9064 signed __int64 v34; // [sp+144h] [bp-20h]@1
9065 int v35; // [sp+148h] [bp-1Ch]@4
9066 int v36; // [sp+14Ch] [bp-18h]@2
9067 int v37; // [sp+154h] [bp-10h]@8
9068 int v38; // [sp+158h] [bp-Ch]@1
9069 int v39; // [sp+15Ch] [bp-8h]@4
9070 int v40; // [sp+160h] [bp-4h]@7
9071
9072 v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z)
9073 / ((double)pODMRenderParams->int_fov_rad + 8192.0)
9074 + (double)(pViewport->uScreenCenterY + 7));//include "+ 7"
9075 v34 = cos((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064) * 0x2000;//(double)pODMRenderParams->shading_dist_mist
9076 v38 = (signed __int64)((double)(pViewport->uScreenCenterY + 7)
9077 - (double)pODMRenderParams->int_fov_rad
9078 / (v34 + 0.0000001)
9079 * (sin((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064)
9080 * (double)-0x2000//(double)pODMRenderParams->shading_dist_mist
9081 - (double)pGame->pIndoorCameraD3D->vPartyPos.z));
9082 pSkyPolygon.Create_48607B(&stru_8019C8);//заполняется ptr_38
9083 pSkyPolygon.ptr_38->_48694B_frustum_sky();
9084 pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//179(original 166)
9085 pSkyPolygon.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? (int)&pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0);
9086 if ( pSkyPolygon.pTexture )
9087 {
9088 pSkyPolygon.dimming_level = 0;
9089 pSkyPolygon.uNumVertices = 4;
9090 //centering(центруем)--наклон камеры ----------------------------------------
9091 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
9092 pSkyPolygon.v_18.y = 0;
9093 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);
9094
9095 //sky wiew position(положение неба на экране)------------------------------------------
9096 // X
9097 // 0._____________________________.3
9098 // |8,8 468,8 |
9099 // | |
9100 // | |
9101 // Y| |
9102 // | |
9103 // |8,351 468,351 |
9104 // 1._____________________________.2
9105 //
9106 array_50AC10[0].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;
9107 array_50AC10[0].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;
9108
9109 array_50AC10[1].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;
9110 array_50AC10[1].vWorldViewProjY = (double)v38;
9111
9112 array_50AC10[2].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;
9113 array_50AC10[2].vWorldViewProjY = (double)v38;
9114
9115 array_50AC10[3].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;
9116 array_50AC10[3].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;
9117
9118 pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;
9119 pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
9120
9121 pSkyPolygon.field_24 = 0x2000000u;
9122 v33 = 65536 / (signed int)(signed __int64)(((double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5) / tan(0.6457717418670654) + 0.5);
9123 for ( uint i = 0; i < pSkyPolygon.uNumVertices; ++i )
9124 {
9125 v26 = array_50AC10[i].vWorldViewProjY + 6.7553994e15;
9126 //rotate skydome(вращение купола неба)--------------------------------------
9127 // В игре принята своя система измерения углов. Полный угол (180). Значению угла 0 соответствует
9128 // направление на север и/или юг (либо на восток и/или запад), значению 65536 еденицам(0х10000) соответствует угол 90.
9129 // две переменные хранят данные по углу обзора. field_14 по западу и востоку. field_20 по югу и северу
9130 // от -25080 до 25080
9131 v39 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
9132 v35 = v39 + pSkyPolygon.ptr_38->angle_from_north;
9133
9134 v39 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
9135 v36 = v39 + pSkyPolygon.ptr_38->angle_from_east;
9136
9137 v38 = pSkyPolygon.v_18.z;
9138 v9 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
9139 v10 = pSkyPolygon.v_18.x + v9;
9140 v39 = pSkyPolygon.v_18.x + v9;
9141 if ( pSkyPolygon.v_18.x + v9 > 0 )
9142 {
9143 v10 = 0;
9144 v39 = 0;
9145 }
9146 v38 = v10;
9147 v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);
9148 v34 = -pSkyPolygon.field_24;
9149 v32 = (signed __int64)array_50AC10[i].vWorldViewProjX;
9150 v14 = v33 * (v30 - (signed __int64)array_50AC10[i].vWorldViewProjX);
9151 while ( 1 )
9152 {
9153 v40 = v14;
9154 if ( !v10 )
9155 goto LABEL_12;
9156 v37 = abs((int)v34 >> 14);
9157 v15 = abs(v10);
9158 if ( v37 <= v15 || v32 <= (signed int)pViewport->uViewportTL_Y )
9159 {
9160 if ( v39 <= 0 )
9161 break;
9162 }
9163 v14 = v40;
9164 LABEL_12:
9165 v37 = pSkyPolygon.v_18.z;
9166 v16 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v14) >> 16;
9167 --v32;
9168 v14 += v33;
9169 v10 = pSkyPolygon.v_18.x + v16;
9170 v39 = pSkyPolygon.v_18.x + v16;
9171 v38 = pSkyPolygon.v_18.x + v16;
9172 }
9173 LODWORD(v17) = LODWORD(v34) << 16;
9174 HIDWORD(v17) = v34 >> 16;
9175 //v40 = v17 / v38;
9176 v18 = v17 / v38;
9177 if ( v18 < 0 )
9178 v18 = pODMRenderParams->shading_dist_mist;
9179 v37 = v35 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v13) >> 16);
9180 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed
9181 + ((signed int)((unsigned __int64)(v37 * (signed __int64)v18) >> 16) >> 3);
9182 array_50AC10[i].u = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureWidth * 65536.0);
9183
9184 v36 = v36 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v13) >> 16);
9185 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed
9186 + ((signed int)((unsigned __int64)(v36 * (signed __int64)v18) >> 16) >> 3);
9187 array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0);
9188
9189 array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist
9190 array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16);
9191 }
9192 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
9193 array_50AC10[0].vWorldViewProjY = (double)v38;
9194 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
9195 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
9196 array_50AC10[3].vWorldViewProjY = (double)v38;
9197 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
9198 return;
9199 }
9200 }