Mercurial > mm7
comparison Render.cpp @ 2013:bb1e7b0780d8
DrawIndoorSky
author | Ritor1 |
---|---|
date | Thu, 07 Nov 2013 09:18:58 +0600 |
parents | 079f2abf54e4 |
children | 7a2fc95f3b99 |
comparison
equal
deleted
inserted
replaced
1999:079f2abf54e4 | 2013:bb1e7b0780d8 |
---|---|
5042 IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 | 5042 IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 |
5043 struct Polygon pSkyPolygon; // [sp+14h] [bp-160h]@6 | 5043 struct Polygon pSkyPolygon; // [sp+14h] [bp-160h]@6 |
5044 unsigned int v63; // [sp+120h] [bp-54h]@7 | 5044 unsigned int v63; // [sp+120h] [bp-54h]@7 |
5045 unsigned int v65; // [sp+128h] [bp-4Ch]@1 | 5045 unsigned int v65; // [sp+128h] [bp-4Ch]@1 |
5046 unsigned int v66; // [sp+12Ch] [bp-48h]@7 | 5046 unsigned int v66; // [sp+12Ch] [bp-48h]@7 |
5047 //float v67; // [sp+130h] [bp-44h]@7 | |
5048 __int64 v69; // [sp+13Ch] [bp-38h]@3 | 5047 __int64 v69; // [sp+13Ch] [bp-38h]@3 |
5049 int v70; // [sp+144h] [bp-30h]@3 | 5048 int v70; // [sp+144h] [bp-30h]@3 |
5050 int X; // [sp+148h] [bp-2Ch]@9 | 5049 int X; // [sp+148h] [bp-2Ch]@9 |
5051 int v72; // [sp+14Ch] [bp-28h]@7 | 5050 int v72; // [sp+14Ch] [bp-28h]@7 |
5052 float v73; // [sp+150h] [bp-24h]@16 | 5051 float v73; // [sp+150h] [bp-24h]@16 |
5059 void *v79; // [sp+168h] [bp-Ch]@9 | 5058 void *v79; // [sp+168h] [bp-Ch]@9 |
5060 float v80; // [sp+16Ch] [bp-8h]@3 | 5059 float v80; // [sp+16Ch] [bp-8h]@3 |
5061 const void *v81; // [sp+170h] [bp-4h]@7 | 5060 const void *v81; // [sp+170h] [bp-4h]@7 |
5062 | 5061 |
5063 pFace = &pIndoor->pFaces[uFaceID]; | 5062 pFace = &pIndoor->pFaces[uFaceID]; |
5064 //for floor and wall(for example Selesta)------------------- | 5063 //for floor and wall(for example Celesta)------------------- |
5065 if (pFace->uPolygonType == POLYGON_InBetweenFloorAndWall || pFace->uPolygonType == POLYGON_Floor) | 5064 if (pFace->uPolygonType == POLYGON_InBetweenFloorAndWall || pFace->uPolygonType == POLYGON_Floor) |
5066 { | 5065 { |
5067 int v69 = (GetTickCount() / 32) - pGame->pIndoorCameraD3D->vPartyPos.x; | 5066 int v69 = (GetTickCount() / 32) - pGame->pIndoorCameraD3D->vPartyPos.x; |
5068 int v55 = (GetTickCount() / 32) + pGame->pIndoorCameraD3D->vPartyPos.y; | 5067 int v55 = (GetTickCount() / 32) + pGame->pIndoorCameraD3D->vPartyPos.y; |
5069 for (uint i = 0; i < uNumVertices; ++i) | 5068 for (uint i = 0; i < uNumVertices; ++i) |
5103 | 5102 |
5104 memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices])); | 5103 memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices])); |
5105 pSkyPolygon.field_24 = 0x2000000; | 5104 pSkyPolygon.field_24 = 0x2000000; |
5106 | 5105 |
5107 extern float _calc_fov(int viewport_width, int angle_degree); | 5106 extern float _calc_fov(int viewport_width, int angle_degree); |
5108 //v64 = (double)(signed int)(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX) * 0.5; | |
5109 //v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); | |
5110 v72 = 65536.0f / _calc_fov(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX, 74); | 5107 v72 = 65536.0f / _calc_fov(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX, 74); |
5111 v12 = pSkyPolygon.pTexture->uWidthMinus1; | 5108 v12 = pSkyPolygon.pTexture->uWidthMinus1; |
5112 v13 = pSkyPolygon.pTexture->uHeightMinus1; | 5109 v13 = pSkyPolygon.pTexture->uHeightMinus1; |
5113 //v67 = 1.0 / (double)pSkyPolygon.pTexture->uTextureWidth; | |
5114 v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; | 5110 v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; |
5115 v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; | 5111 v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; |
5116 v78 = 0; | 5112 v78 = 0; |
5117 //v81 = 0; | |
5118 float v68 = 1.0 / (double)pSkyPolygon.pTexture->uTextureHeight; | 5113 float v68 = 1.0 / (double)pSkyPolygon.pTexture->uTextureHeight; |
5119 if ( (signed int)pSkyPolygon.uNumVertices <= 0 ) | 5114 if ( (signed int)pSkyPolygon.uNumVertices <= 0 ) |
5120 return; | 5115 return; |
5121 | 5116 |
5122 int _507D30_idx = 0; | 5117 int _507D30_idx = 0; |
5123 for ( _507D30_idx; _507D30_idx < pSkyPolygon.uNumVertices; _507D30_idx++ ) | 5118 for ( _507D30_idx; _507D30_idx < pSkyPolygon.uNumVertices; _507D30_idx++ ) |
5124 { | 5119 { |
5125 //v15 = (void *)(v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY)); | |
5126 v77 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16; | 5120 v77 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16; |
5127 v74 = v77 + pSkyPolygon.ptr_38->angle_from_north; | 5121 v74 = v77 + pSkyPolygon.ptr_38->angle_from_north; |
5128 | 5122 |
5129 v77 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16; | 5123 v77 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16; |
5130 v74_ = v77 + pSkyPolygon.ptr_38->angle_from_east; | 5124 v74_ = v77 + pSkyPolygon.ptr_38->angle_from_east; |
5172 array_507D30[_507D30_idx].v = ((double)SLODWORD(v80) * 0.000015259022) * v68; | 5166 array_507D30[_507D30_idx].v = ((double)SLODWORD(v80) * 0.000015259022) * v68; |
5173 | 5167 |
5174 v77 = (unsigned __int64)(SLODWORD(s) * (v23 / X)) >> 16; | 5168 v77 = (unsigned __int64)(SLODWORD(s) * (v23 / X)) >> 16; |
5175 LODWORD(v73) = (unsigned __int64)(SLODWORD(s2) * (v23 / X)) >> 16; | 5169 LODWORD(v73) = (unsigned __int64)(SLODWORD(s2) * (v23 / X)) >> 16; |
5176 array_507D30[_507D30_idx]._rhw = 65536.0 / (double)(signed int)v79; | 5170 array_507D30[_507D30_idx]._rhw = 65536.0 / (double)(signed int)v79; |
5177 | |
5178 //if ( (int)v81 >= pSkyPolygon.uNumVertices ) | |
5179 //{ | |
5180 // pRenderer->DrawIndoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, | |
5181 // pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); | |
5182 // return; | |
5183 //} | |
5184 continue; | 5171 continue; |
5185 } | 5172 } |
5186 break; | 5173 break; |
5187 } | 5174 } |
5188 if ( _507D30_idx >= pSkyPolygon.uNumVertices ) | 5175 if ( _507D30_idx >= pSkyPolygon.uNumVertices ) |
5226 i++; | 5213 i++; |
5227 } | 5214 } |
5228 } | 5215 } |
5229 if ( SLODWORD(v73) <= 0 ) | 5216 if ( SLODWORD(v73) <= 0 ) |
5230 goto LABEL_40; | 5217 goto LABEL_40; |
5231 //v34 = (char *)&array_50AC10[0].vWorldViewProjY; | |
5232 uint j = 0; | 5218 uint j = 0; |
5233 v65 = v77 >> 14; | 5219 v65 = v77 >> 14; |
5234 //HIDWORD(v69) = LODWORD(v73); | |
5235 for ( int t = (int)LODWORD(v73); t > 1; t-- ) | 5220 for ( int t = (int)LODWORD(v73); t > 1; t-- ) |
5236 { | 5221 { |
5237 v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)array_50AC10[j].vWorldViewProjY)); | 5222 v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)array_50AC10[j].vWorldViewProjY)); |
5238 | 5223 |
5239 //v78 = pSkyPolygon.ptr_38->viewing_angle_from_west_east; | |
5240 v81 = (const void *)((unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(signed int)v35) >> 16); | 5224 v81 = (const void *)((unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(signed int)v35) >> 16); |
5241 v36 = (int)((char *)v81 + pSkyPolygon.ptr_38->angle_from_north); | 5225 v36 = (int)((char *)v81 + pSkyPolygon.ptr_38->angle_from_north); |
5242 | 5226 |
5243 v81 = v35; | 5227 v81 = v35; |
5244 v74 = v36; | 5228 v74 = v36; |
5245 //v78 = pSkyPolygon.ptr_38->viewing_angle_from_north_south; | |
5246 v81 = (const void *)((unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(signed int)v35) >> 16); | 5229 v81 = (const void *)((unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(signed int)v35) >> 16); |
5247 v78 = (int)v35; | 5230 v78 = (int)v35; |
5248 v75 = (RenderVertexSoft *)((char *)v81 + pSkyPolygon.ptr_38->angle_from_east); | 5231 v75 = (RenderVertexSoft *)((char *)v81 + pSkyPolygon.ptr_38->angle_from_east); |
5249 v81 = (const void *)pSkyPolygon.v_18.z; | 5232 v81 = (const void *)pSkyPolygon.v_18.z; |
5250 v78 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(signed int)v35) >> 16; | 5233 v78 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(signed int)v35) >> 16; |
5287 LODWORD(v42) = v77 << 16; | 5270 LODWORD(v42) = v77 << 16; |
5288 HIDWORD(v42) = v77 >> 16; | 5271 HIDWORD(v42) = v77 >> 16; |
5289 v79 = (void *)(v42 / X); | 5272 v79 = (void *)(v42 / X); |
5290 v81 = v37; | 5273 v81 = v37; |
5291 | 5274 |
5292 //v78 = pSkyPolygon.ptr_38->angle_from_west; | |
5293 v81 = (const void *)((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)(signed int)v37) >> 16); | 5275 v81 = (const void *)((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)(signed int)v37) >> 16); |
5294 v43 = v74 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)(signed int)v37) >> 16); | 5276 v43 = v74 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)(signed int)v37) >> 16); |
5295 v74 = (unsigned int)v37; | 5277 v74 = (unsigned int)v37; |
5296 LODWORD(v76) = v43; | 5278 LODWORD(v76) = v43; |
5297 | 5279 |
5298 //v78 = pSkyPolygon.ptr_38->angle_from_south; | |
5299 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)(signed int)v37) >> 16)); | 5280 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)(signed int)v37) >> 16)); |
5300 v74 = (unsigned __int64)(v43 * v42 / X) >> 16; | 5281 v74 = (unsigned __int64)(v43 * v42 / X) >> 16; |
5301 v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); | 5282 v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); |
5302 | 5283 |
5303 //v34 += 48; | |
5304 v78 = v66 + ((signed int)v74 >> 4); | 5284 v78 = v66 + ((signed int)v74 >> 4); |
5305 //v44 = HIDWORD(v69)-- == 1; | |
5306 v45 = (double)v78 * 0.000015259022; | 5285 v45 = (double)v78 * 0.000015259022; |
5307 v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); | 5286 v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); |
5308 array_50AC10[j].u = v45 * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth); | 5287 array_50AC10[j].u = v45 * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth); |
5309 array_50AC10[j].v = (double)v78 * 0.000015259022 * v68; | 5288 array_50AC10[j].v = (double)v78 * 0.000015259022 * v68; |
5310 //v46 = (double)(signed int)v79; | |
5311 array_50AC10[j].vWorldViewPosition.x = 0.000015258789 * (double)(signed int)v79; | 5289 array_50AC10[j].vWorldViewPosition.x = 0.000015258789 * (double)(signed int)v79; |
5312 array_50AC10[j]._rhw = 65536.0 / (double)(signed int)v79; | 5290 array_50AC10[j]._rhw = 65536.0 / (double)(signed int)v79; |
5313 ++j; | 5291 ++j; |
5314 } | 5292 } |
5315 //while ( !v44 ); | |
5316 LABEL_40: | 5293 LABEL_40: |
5317 uint i = 0; | 5294 uint i = 0; |
5318 if ( SLODWORD(v73) > 0 ) | 5295 if ( SLODWORD(v73) > 0 ) |
5319 { | 5296 { |
5320 v48 = (double)SLODWORD(v80); | 5297 v48 = (double)SLODWORD(v80); |
5342 } | 5319 } |
5343 } | 5320 } |
5344 } | 5321 } |
5345 pRenderer->DrawIndoorSkyPolygon(pNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); | 5322 pRenderer->DrawIndoorSkyPolygon(pNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); |
5346 } | 5323 } |
5347 | |
5348 | 5324 |
5349 //----- (004A2FC0) -------------------------------------------------------- | 5325 //----- (004A2FC0) -------------------------------------------------------- |
5350 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) | 5326 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) |
5351 { | 5327 { |
5352 //Render *v8; // edi@1 | 5328 //Render *v8; // edi@1 |