comparison Render.cpp @ 1925:f4d5082b4a39

Merge
author Nomad
date Wed, 23 Oct 2013 15:37:51 +0200
parents 8cd321994943 f92e0bab7c78
children 68f2d9d3a1d9
comparison
equal deleted inserted replaced
1924:8cd321994943 1925:f4d5082b4a39
4923 } 4923 }
4924 // 4A26BC: could not find valid save-restore pair for esi 4924 // 4A26BC: could not find valid save-restore pair for esi
4925 // 4D864C: using guessed type char byte_4D864C; 4925 // 4D864C: using guessed type char byte_4D864C;
4926 4926
4927 //----- (004A2DA3) -------------------------------------------------------- 4927 //----- (004A2DA3) --------------------------------------------------------
4928 void Render::DrawSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture) 4928 void Render::DrawOutdoorSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture)
4929 { 4929 {
4930 int v7; // eax@7 4930 int v7; // eax@7
4931 4931
4932 if ( !this->uNumD3DSceneBegins ) 4932 if ( !this->uNumD3DSceneBegins )
4933 return; 4933 return;
4960 pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); 4960 pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
4961 } 4961 }
4962 } 4962 }
4963 4963
4964 //----- (004A2ED5) -------------------------------------------------------- 4964 //----- (004A2ED5) --------------------------------------------------------
4965 void Render::_4A2ED5(signed int a2, struct Polygon *a3, IDirect3DTexture2 *pHwTex) 4965 void Render::DrawIndoorSkyPolygon(signed int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture)
4966 { 4966 {
4967 signed int v4; // edi@2 4967 signed int v4; // edi@2
4968 int v5; // eax@3 4968 int v5; // eax@3
4969 int v6; // edx@5 4969 int v6; // edx@5
4970 RenderVertexD3D3 *v7; // eax@6 4970 RenderVertexD3D3 *v7; // eax@6
4973 //int v10; // ebx@7 4973 //int v10; // ebx@7
4974 //int v11; // ebx@7 4974 //int v11; // ebx@7
4975 4975
4976 if ( this->uNumD3DSceneBegins ) 4976 if ( this->uNumD3DSceneBegins )
4977 { 4977 {
4978 v4 = a2; 4978 v4 = uNumVertices;
4979 if ( a2 >= 3 ) 4979 if ( uNumVertices >= 3 )
4980 { 4980 {
4981 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); 4981 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));
4982 v5 = 31 - (a3->dimming_level & 0x1F); 4982 v5 = 31 - (pSkyPolygon->dimming_level & 0x1F);
4983 if ( v5 < pOutdoor->max_terrain_dimming_level ) 4983 if ( v5 < pOutdoor->max_terrain_dimming_level )
4984 v5 = pOutdoor->max_terrain_dimming_level; 4984 v5 = pOutdoor->max_terrain_dimming_level;
4985 v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); 4985 v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8);
4986 for (uint i = 0; i < a2; ++i) 4986 for (uint i = 0; i < uNumVertices; ++i)
4987 { 4987 {
4988 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; 4988 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX;
4989 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; 4989 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY;
4990 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / array_507D30[i].vWorldViewPosition.y; 4990 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / array_507D30[i].vWorldViewPosition.y;
4991 d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw; 4991 d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw;
4993 d3d_vertex_buffer[i].specular = 0; 4993 d3d_vertex_buffer[i].specular = 0;
4994 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u; 4994 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u;
4995 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v; 4995 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v;
4996 } 4996 }
4997 4997
4998 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); 4998 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture));
4999 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 4999 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
5000 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, 5000 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
5001 d3d_vertex_buffer, 5001 d3d_vertex_buffer,
5002 a2, 5002 uNumVertices,
5003 28)); 5003 28));
5004 } 5004 }
5005 } 5005 }
5006 } 5006 }
5007 5007
5008
5009 //----- (00479A53) -------------------------------------------------------- 5008 //----- (00479A53) --------------------------------------------------------
5010 void Render::DrawIndoorPolygonNoLight(unsigned int uNumVertices, unsigned int uFaceID) 5009 void Render::DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID)
5011 { 5010 {
5012 BLVFace *pFace; // esi@1 5011 BLVFace *pFace; // esi@1
5013 //unsigned int v3; // edi@1 5012 //unsigned int v3; // edi@1
5014 //PolygonType v4; // al@1 5013 //PolygonType v4; // al@1
5015 double v5; // st7@3 5014 double v5; // st7@3
5032 int v22; // eax@14 5031 int v22; // eax@14
5033 signed __int64 v23; // qtt@16 5032 signed __int64 v23; // qtt@16
5034 double v24; // st7@16 5033 double v24; // st7@16
5035 unsigned __int8 v25; // sf@16 5034 unsigned __int8 v25; // sf@16
5036 unsigned __int8 v26; // of@16 5035 unsigned __int8 v26; // of@16
5037 Render *v27; // ecx@17 5036 //Render *v27; // ecx@17
5038 double v28; // st7@20 5037 double v28; // st7@20
5039 char *v29; // ebx@20 5038 char *v29; // ebx@20
5040 char *v30; // edx@20 5039 char *v30; // edx@20
5041 unsigned __int8 v31; // c0@21 5040 unsigned __int8 v31; // c0@21
5042 unsigned __int8 v32; // c3@21 5041 unsigned __int8 v32; // c3@21
5067 //int v57; // ST10_4@55 5066 //int v57; // ST10_4@55
5068 //Texture *v58; // eax@55 5067 //Texture *v58; // eax@55
5069 signed int v59; // [sp-4h] [bp-178h]@17 5068 signed int v59; // [sp-4h] [bp-178h]@17
5070 struct Polygon *v60; // [sp+0h] [bp-174h]@17 5069 struct Polygon *v60; // [sp+0h] [bp-174h]@17
5071 IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 5070 IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17
5072 struct Polygon v62; // [sp+14h] [bp-160h]@6 5071 struct Polygon pSkyPoligon; // [sp+14h] [bp-160h]@6
5073 unsigned int v63; // [sp+120h] [bp-54h]@7 5072 unsigned int v63; // [sp+120h] [bp-54h]@7
5074 //double v64; // [sp+124h] [bp-50h]@7 5073 //double v64; // [sp+124h] [bp-50h]@7
5075 unsigned int v65; // [sp+128h] [bp-4Ch]@1 5074 unsigned int v65; // [sp+128h] [bp-4Ch]@1
5076 unsigned int v66; // [sp+12Ch] [bp-48h]@7 5075 unsigned int v66; // [sp+12Ch] [bp-48h]@7
5077 float v67; // [sp+130h] [bp-44h]@7 5076 float v67; // [sp+130h] [bp-44h]@7
5102 } 5101 }
5103 pRenderer->DrawIndoorPolygon(uNumVertices, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), -1, 0); 5102 pRenderer->DrawIndoorPolygon(uNumVertices, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), -1, 0);
5104 return; 5103 return;
5105 } 5104 }
5106 5105
5107 *(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; 5106 //*(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY;
5108 v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pGame->pIndoorCameraD3D->vPartyPos.z) 5107 v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pGame->pIndoorCameraD3D->vPartyPos.z)
5109 / (((double)pBLVRenderParams->fov_rad_fixpoint + 16192.0) 5108 / (((double)pBLVRenderParams->fov_rad_fixpoint + 16192.0)
5110 * 65536.0) 5109 * 65536.0)
5111 + *(float *)&v74); 5110 + (double)pBLVRenderParams->uViewportCenterY);
5112 v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064; 5111 v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064;
5113 *(float *)&v75 = v5; 5112 //*(float *)&v75 = v5;
5114 v6 = (signed __int64)(*(float *)&v74 5113 v6 = (signed __int64)((double)pBLVRenderParams->uViewportCenterY
5115 - (double)pBLVRenderParams->fov_rad_fixpoint 5114 - (double)pBLVRenderParams->fov_rad_fixpoint
5116 / ((cos(v5) * 16192.0 + 0.0000001) 5115 / ((cos(v5) * 16192.0 + 0.0000001)
5117 * 65535.0) 5116 * 65535.0)
5118 * (sin(*(float *)&v75) * -16192.0 - (double)pGame->pIndoorCameraD3D->vPartyPos.z)); 5117 * (sin(v5) * -16192.0 - (double)pGame->pIndoorCameraD3D->vPartyPos.z));
5119 5118
5120 5119
5121 stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); 5120 stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0);
5122 v62.Create_48607B(&stru_8019C8); 5121 pSkyPoligon.Create_48607B(&stru_8019C8);
5123 v62.uTileBitmapID = pFace->uBitmapID; 5122 pSkyPoligon.uTileBitmapID = pFace->uBitmapID;
5124 5123
5125 v62.pTexture = pBitmaps_LOD->GetTexture(v62.uTileBitmapID); 5124 pSkyPoligon.pTexture = pBitmaps_LOD->GetTexture(pSkyPoligon.uTileBitmapID);
5126 if ( !v62.pTexture ) 5125 if ( !pSkyPoligon.pTexture )
5127 return; 5126 return;
5128 5127
5129 v62.dimming_level = 0; 5128 pSkyPoligon.dimming_level = 0;
5130 v62.uNumVertices = uNumVertices; 5129 pSkyPoligon.uNumVertices = uNumVertices;
5131 v62.v_18.y = 0; 5130 pSkyPoligon.v_18.y = 0;
5132 v62.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16); 5131 pSkyPoligon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
5133 v62.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16); 5132 pSkyPoligon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);
5134 memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices])); 5133 memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices]));
5135 v62.field_24 = 0x2000000; 5134 pSkyPoligon.field_24 = 0x2000000;
5136 5135
5137 extern float _calc_fov(int viewport_width, int angle_degree); 5136 extern float _calc_fov(int viewport_width, int angle_degree);
5138 //v64 = (double)(signed int)(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX) * 0.5; 5137 //v64 = (double)(signed int)(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX) * 0.5;
5139 //v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); 5138 //v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5);
5140 v72 = 65536.0f / _calc_fov(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX, 74); 5139 v72 = 65536.0f / _calc_fov(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX, 74);
5141 v12 = v62.pTexture->uWidthMinus1; 5140 v12 = pSkyPoligon.pTexture->uWidthMinus1;
5142 v13 = v62.pTexture->uHeightMinus1; 5141 v13 = pSkyPoligon.pTexture->uHeightMinus1;
5143 v67 = 1.0 / (double)v62.pTexture->uTextureWidth; 5142 v67 = 1.0 / (double)pSkyPoligon.pTexture->uTextureWidth;
5144 v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; 5143 v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13;
5145 v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; 5144 v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12;
5146 v78 = 0; 5145 v78 = 0;
5147 v81 = 0; 5146 v81 = 0;
5148 float v68 = 1.0 / (double)v62.pTexture->uTextureHeight; 5147 float v68 = 1.0 / (double)pSkyPoligon.pTexture->uTextureHeight;
5149 if ( (signed int)v62.uNumVertices <= 0 ) 5148 if ( (signed int)pSkyPoligon.uNumVertices <= 0 )
5150 { 5149 {
5151 LABEL_17: 5150 LABEL_17:
5152 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; 5151 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID];
5153 v27 = pRenderer; 5152 //v27 = pRenderer;
5154 v60 = &v62; 5153 v60 = &pSkyPoligon;
5155 v59 = v62.uNumVertices; 5154 v59 = pSkyPoligon.uNumVertices;
5156 goto LABEL_18; 5155 goto LABEL_18;
5157 } 5156 }
5158 5157
5159 //v14 = (char *)&array_507D30[0].vWorldViewProjY; 5158 //v14 = (char *)&array_507D30[0].vWorldViewProjY;
5160 int _507D30_idx = 0; 5159 int _507D30_idx = 0;
5161 while ( 2 ) 5160 while ( 2 )
5162 { 5161 {
5163 v15 = (void *)(v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY)); 5162 v15 = (void *)(v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY));
5164 v77 = (unsigned __int64)(v62.ptr_38->viewing_angle_from_west_east * (signed __int64)(signed int)v15) >> 16; 5163 v77 = (unsigned __int64)(pSkyPoligon.ptr_38->viewing_angle_from_west_east * (signed __int64)(signed int)v15) >> 16;
5165 v74 = v77 + v62.ptr_38->angle_from_north; 5164 v74 = v77 + pSkyPoligon.ptr_38->angle_from_north;
5166 v77 = (int)v15; 5165 v77 = (int)v15;
5167 v77 = (unsigned __int64)(v62.ptr_38->viewing_angle_from_north_south * (signed __int64)(signed int)v15) >> 16; 5166 v77 = (unsigned __int64)(pSkyPoligon.ptr_38->viewing_angle_from_north_south * (signed __int64)(signed int)v15) >> 16;
5168 v79 = v15; 5167 v79 = v15;
5169 v75 = (RenderVertexSoft *)(v77 + v62.ptr_38->angle_from_east); 5168 v75 = (RenderVertexSoft *)(v77 + pSkyPoligon.ptr_38->angle_from_east);
5170 v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v15) >> 16); 5169 v79 = (void *)((unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v15) >> 16);
5171 v17 = v72 * (pBLVRenderParams->uViewportCenterX - (int)array_507D30[_507D30_idx].vWorldViewProjX); 5170 v17 = v72 * (pBLVRenderParams->uViewportCenterX - (int)array_507D30[_507D30_idx].vWorldViewProjX);
5172 v18 = array_507D30[_507D30_idx].vWorldViewProjY - 1.0; 5171 v18 = array_507D30[_507D30_idx].vWorldViewProjY - 1.0;
5173 v19 = -v62.field_24; 5172 v19 = -pSkyPoligon.field_24;
5174 v77 = -v62.field_24; 5173 v77 = -pSkyPoligon.field_24;
5175 X = (int)((char *)v79 + v62.v_18.x); 5174 X = (int)((char *)v79 + pSkyPoligon.v_18.x);
5176 LODWORD(v76) = (signed __int64)v18; 5175 LODWORD(v76) = (signed __int64)v18;
5177 v20 = (void *)(v72 * (v70 - LODWORD(v76))); 5176 v20 = (void *)(v72 * (v70 - LODWORD(v76)));
5178 while ( 1 ) 5177 while ( 1 )
5179 { 5178 {
5180 v79 = v20; 5179 v79 = v20;
5186 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) 5185 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y )
5187 break; 5186 break;
5188 v19 = v77; 5187 v19 = v77;
5189 v20 = v79; 5188 v20 = v79;
5190 LABEL_14: 5189 LABEL_14:
5191 v79 = (void *)((unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16); 5190 v79 = (void *)((unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v20) >> 16);
5192 v22 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v20) >> 16; 5191 v22 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v20) >> 16;
5193 --LODWORD(v76); 5192 --LODWORD(v76);
5194 v20 = (char *)v20 + v72; 5193 v20 = (char *)v20 + v72;
5195 X = v22 + v62.v_18.x; 5194 X = v22 + pSkyPoligon.v_18.x;
5196 v78 = 1; 5195 v78 = 1;
5197 } 5196 }
5198 if ( !v78 ) 5197 if ( !v78 )
5199 { 5198 {
5200 LODWORD(v23) = v77 << 16; 5199 LODWORD(v23) = v77 << 16;
5201 HIDWORD(v23) = v77 >> 16; 5200 HIDWORD(v23) = v77 >> 16;
5202 v79 = (void *)(v23 / X); 5201 v79 = (void *)(v23 / X);
5203 v77 = v17; 5202 v77 = v17;
5204 v77 = v17; 5203 v77 = v17;
5205 LODWORD(v76) = v74 + ((unsigned __int64)(v62.ptr_38->angle_from_west * (signed __int64)v17) >> 16); 5204 LODWORD(v76) = v74 + ((unsigned __int64)(pSkyPoligon.ptr_38->angle_from_west * (signed __int64)v17) >> 16);
5206 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v62.ptr_38->angle_from_south * (signed __int64)v17) >> 16)); 5205 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(pSkyPoligon.ptr_38->angle_from_south * (signed __int64)v17) >> 16));
5207 v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; 5206 v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16;
5208 LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; 5207 LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16;
5209 //v14 += 48; 5208 //v14 += 48;
5210 LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); 5209 LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4);
5211 v81 = (char *)v81 + 1; 5210 v81 = (char *)v81 + 1;
5212 v24 = (double)SLODWORD(v80) * 0.000015259022; 5211 v24 = (double)SLODWORD(v80) * 0.000015259022;
5213 LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); 5212 LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4);
5214 v26 = __OFSUB__((int)v81, v62.uNumVertices); 5213 v26 = __OFSUB__((int)v81, pSkyPoligon.uNumVertices);
5215 v25 = (signed int)((char *)v81 - v62.uNumVertices) < 0; 5214 v25 = (signed int)((char *)v81 - pSkyPoligon.uNumVertices) < 0;
5216 array_507D30[_507D30_idx].u = v24 * v67; 5215 array_507D30[_507D30_idx].u = v24 * v67;
5217 array_507D30[_507D30_idx].v = (double)SLODWORD(v80) * 0.000015259022 * v68; 5216 array_507D30[_507D30_idx].v = (double)SLODWORD(v80) * 0.000015259022 * v68;
5218 array_507D30[_507D30_idx]._rhw = 65536.0 / (double)(signed int)v79; 5217 array_507D30[_507D30_idx]._rhw = 65536.0 / (double)(signed int)v79;
5219 _507D30_idx++; 5218 _507D30_idx++;
5220 if ( !(v25 ^ v26) ) 5219 if ( !(v25 ^ v26) )
5223 } 5222 }
5224 break; 5223 break;
5225 } 5224 }
5226 LODWORD(v73) = 0; 5225 LODWORD(v73) = 0;
5227 v80 = v76; 5226 v80 = v76;
5228 if ( (signed int)v62.uNumVertices > 0 ) 5227 if ( (signed int)pSkyPoligon.uNumVertices > 0 )
5229 { 5228 {
5230 v28 = (double)SLODWORD(v76); 5229 v28 = (double)SLODWORD(v76);
5231 LODWORD(v76) = (int)(char *)array_50AC10 + 28; 5230 LODWORD(v76) = (int)(char *)array_50AC10 + 28;
5232 v29 = (char *)&array_50AC10[0].vWorldViewProjX; 5231 v29 = (char *)&array_50AC10[0].vWorldViewProjX;
5233 v30 = (char *)&array_507D30[1].vWorldViewProjY; 5232 v30 = (char *)&array_507D30[1].vWorldViewProjY;
5234 v79 = array_50AC10; 5233 v79 = array_50AC10;
5235 v81 = array_507D30; 5234 v81 = array_507D30;
5236 v78 = v62.uNumVertices; 5235 v78 = pSkyPoligon.uNumVertices;
5237 do 5236 do
5238 { 5237 {
5239 v31 = v28 < *((float *)v30 - 12); 5238 v31 = v28 < *((float *)v30 - 12);
5240 v32 = v28 == *((float *)v30 - 12); 5239 v32 = v28 == *((float *)v30 - 12);
5241 ++LODWORD(v73); 5240 ++LODWORD(v73);
5274 v65 = v77 >> 14; 5273 v65 = v77 >> 14;
5275 HIDWORD(v69) = LODWORD(v73); 5274 HIDWORD(v69) = LODWORD(v73);
5276 do 5275 do
5277 { 5276 {
5278 v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); 5277 v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34));
5279 v78 = v62.ptr_38->viewing_angle_from_west_east; 5278 v78 = pSkyPoligon.ptr_38->viewing_angle_from_west_east;
5280 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); 5279 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
5281 v36 = (int)((char *)v81 + v62.ptr_38->angle_from_north); 5280 v36 = (int)((char *)v81 + pSkyPoligon.ptr_38->angle_from_north);
5282 v81 = v35; 5281 v81 = v35;
5283 v74 = v36; 5282 v74 = v36;
5284 v78 = v62.ptr_38->viewing_angle_from_north_south; 5283 v78 = pSkyPoligon.ptr_38->viewing_angle_from_north_south;
5285 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); 5284 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16);
5286 v78 = (int)v35; 5285 v78 = (int)v35;
5287 v75 = (RenderVertexSoft *)((char *)v81 + v62.ptr_38->angle_from_east); 5286 v75 = (RenderVertexSoft *)((char *)v81 + pSkyPoligon.ptr_38->angle_from_east);
5288 v81 = (const void *)v62.v_18.z; 5287 v81 = (const void *)pSkyPoligon.v_18.z;
5289 v78 = (unsigned __int64)(v62.v_18.z * (signed __int64)(signed int)v35) >> 16; 5288 v78 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v35) >> 16;
5290 v37 = (const void *)(v72 5289 v37 = (const void *)(v72
5291 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); 5290 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1)));
5292 v38 = (signed __int64)(*(float *)v34 - 1.0); 5291 v38 = (signed __int64)(*(float *)v34 - 1.0);
5293 v81 = 0; 5292 v81 = 0;
5294 LODWORD(v76) = v38; 5293 LODWORD(v76) = v38;
5303 break; 5302 break;
5304 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) 5303 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y )
5305 break; 5304 break;
5306 v39 = v78; 5305 v39 = v78;
5307 LABEL_36: 5306 LABEL_36:
5308 v78 = v62.v_18.z; 5307 v78 = pSkyPoligon.v_18.z;
5309 v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; 5308 v41 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)v39) >> 16;
5310 --LODWORD(v76); 5309 --LODWORD(v76);
5311 v39 += v72; 5310 v39 += v72;
5312 X = v41 + v62.v_18.x; 5311 X = v41 + pSkyPoligon.v_18.x;
5313 v81 = (const void *)1; 5312 v81 = (const void *)1;
5314 } 5313 }
5315 if ( v81 ) 5314 if ( v81 )
5316 { 5315 {
5317 v79 = (void *)v62.v_18.z; 5316 v79 = (void *)pSkyPoligon.v_18.z;
5318 v78 = 2 * LODWORD(v76); 5317 v78 = 2 * LODWORD(v76);
5319 v81 = (const void *)((unsigned __int64)(v62.v_18.z 5318 v81 = (const void *)((unsigned __int64)(pSkyPoligon.v_18.z
5320 * (signed __int64)(signed int)(signed __int64)(((double)v70 5319 * (signed __int64)(signed int)(signed __int64)(((double)v70
5321 - ((double)(2 * LODWORD(v76)) 5320 - ((double)(2 * LODWORD(v76))
5322 - *(float *)v34)) 5321 - *(float *)v34))
5323 * (double)v72)) >> 16); 5322 * (double)v72)) >> 16);
5324 X = (int)((char *)v81 + v62.v_18.x); 5323 X = (int)((char *)v81 + pSkyPoligon.v_18.x);
5325 } 5324 }
5326 LODWORD(v42) = v77 << 16; 5325 LODWORD(v42) = v77 << 16;
5327 HIDWORD(v42) = v77 >> 16; 5326 HIDWORD(v42) = v77 >> 16;
5328 v79 = (void *)(v42 / X); 5327 v79 = (void *)(v42 / X);
5329 v81 = v37; 5328 v81 = v37;
5330 v78 = v62.ptr_38->angle_from_west; 5329 v78 = pSkyPoligon.ptr_38->angle_from_west;
5331 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); 5330 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16);
5332 v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); 5331 v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16);
5333 v74 = (unsigned int)v37; 5332 v74 = (unsigned int)v37;
5334 LODWORD(v76) = v43; 5333 LODWORD(v76) = v43;
5335 v78 = v62.ptr_38->angle_from_south; 5334 v78 = pSkyPoligon.ptr_38->angle_from_south;
5336 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); 5335 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16));
5337 v74 = (unsigned __int64)(v43 * v42 / X) >> 16; 5336 v74 = (unsigned __int64)(v43 * v42 / X) >> 16;
5338 v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); 5337 v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16);
5339 v34 += 48; 5338 v34 += 48;
5340 v78 = v66 + ((signed int)v74 >> 4); 5339 v78 = v66 + ((signed int)v74 >> 4);
5368 ++v49; 5367 ++v49;
5369 --HIDWORD(v69); 5368 --HIDWORD(v69);
5370 } 5369 }
5371 while ( HIDWORD(v69) ); 5370 while ( HIDWORD(v69) );
5372 } 5371 }
5373 v62.uNumVertices = v47; 5372 pSkyPoligon.uNumVertices = v47;
5374 pRenderer->_4A2ED5(v47, &v62, pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]); 5373 pRenderer->DrawIndoorSkyPolygon(v47, &pSkyPoligon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID]);
5375 *(float *)&v74 = 0.0; 5374 *(float *)&v74 = 0.0;
5376 if ( SLODWORD(v73) > 0 ) 5375 if ( SLODWORD(v73) > 0 )
5377 { 5376 {
5378 v51 = (double)SLODWORD(v80); 5377 v51 = (double)SLODWORD(v80);
5379 v75 = array_507D30; 5378 v75 = array_507D30;
5391 ++v52; 5390 ++v52;
5392 --LODWORD(v80); 5391 --LODWORD(v80);
5393 } 5392 }
5394 while ( v80 != 0.0 ); 5393 while ( v80 != 0.0 );
5395 } 5394 }
5396 v62.uNumVertices = v74; 5395 pSkyPoligon.uNumVertices = v74;
5397 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)v62.uTileBitmapID]; 5396 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID];
5398 v60 = &v62; 5397 v60 = &pSkyPoligon;
5399 v59 = v74; 5398 v59 = v74;
5400 v27 = pRenderer; 5399 //v27 = pRenderer;
5401 LABEL_18: 5400 LABEL_18:
5402 v27->_4A2ED5(v59, v60, v61); 5401 pRenderer->DrawIndoorSkyPolygon(v59, v60, v61);
5403 } 5402 }
5404 5403
5405 5404
5406 //----- (004A2FC0) -------------------------------------------------------- 5405 //----- (004A2FC0) --------------------------------------------------------
5407 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) 5406 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8)
8883 v9 = pTextureFrameTable->GetFrameTexture(v9, pEventTimer->uTotalGameTimeElapsed); 8882 v9 = pTextureFrameTable->GetFrameTexture(v9, pEventTimer->uTotalGameTimeElapsed);
8884 pFaceTexture = pBitmaps_LOD->GetTexture(v9); 8883 pFaceTexture = pBitmaps_LOD->GetTexture(v9);
8885 array_77EC08[pODMRenderParams->uNumPolygons].pTexture = pFaceTexture; 8884 array_77EC08[pODMRenderParams->uNumPolygons].pTexture = pFaceTexture;
8886 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_FLUID) 8885 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_FLUID)
8887 array_77EC08[pODMRenderParams->uNumPolygons].flags |= 2; 8886 array_77EC08[pODMRenderParams->uNumPolygons].flags |= 2;
8888 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_DO_NOT_LIGHT ) 8887 if (pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & FACE_INDOOR_SKY )
8889 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4; 8888 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4;
8890 if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & 4 ) 8889 if ( pOutdoor->pBModels[model_id].pFaces[face_id].uAttributes & 4 )
8891 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4; 8890 HIBYTE(array_77EC08[pODMRenderParams->uNumPolygons].flags) |= 4;
8892 else 8891 else
8893 { 8892 {
9044 } 9043 }
9045 } 9044 }
9046 return; 9045 return;
9047 } 9046 }
9048 //----- (00479543) -------------------------------------------------------- 9047 //----- (00479543) --------------------------------------------------------
9049 void Render::DrawSkyD3D() 9048 void Render::DrawOutdoorSkyD3D()
9050 { 9049 {
9051 int v9; // eax@4 9050 int v9; // eax@4
9052 int v10; // ebx@4 9051 int v10; // ebx@4
9053 int v13; // edi@6 9052 int v13; // edi@6
9054 int v14; // ecx@6 9053 int v14; // ecx@6
9187 array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0); 9186 array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0);
9188 9187
9189 array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist 9188 array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist
9190 array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16); 9189 array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16);
9191 } 9190 }
9192 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); 9191 pRenderer->DrawOutdoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
9193 array_50AC10[0].vWorldViewProjY = (double)v38; 9192 array_50AC10[0].vWorldViewProjY = (double)v38;
9194 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0; 9193 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
9195 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0; 9194 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
9196 array_50AC10[3].vWorldViewProjY = (double)v38; 9195 array_50AC10[3].vWorldViewProjY = (double)v38;
9197 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); 9196 pRenderer->DrawOutdoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
9198 return; 9197 return;
9199 } 9198 }
9200 } 9199 }
9201 //----- (004226C2) -------------------------------------------------------- 9200 //----- (004226C2) --------------------------------------------------------
9202 bool PauseGameDrawing() 9201 bool PauseGameDrawing()