Mercurial > mm7
comparison Render.cpp @ 1991:012fcb1f223a
Merge
author | Grumpy7 |
---|---|
date | Sun, 03 Nov 2013 01:20:06 -0800 |
parents | ef4dcee1b4a1 |
children | 157fd2831567 |
comparison
equal
deleted
inserted
replaced
1990:84fa3c83d63f | 1991:012fcb1f223a |
---|---|
1199 RenderD3D__DevInfo *v2; // eax@1 | 1199 RenderD3D__DevInfo *v2; // eax@1 |
1200 | 1200 |
1201 v2 = new RenderD3D__DevInfo[4];// 4 items | 1201 v2 = new RenderD3D__DevInfo[4];// 4 items |
1202 *pOutDevices = v2; | 1202 *pOutDevices = v2; |
1203 memset(v2, 0, 0xA0u); | 1203 memset(v2, 0, 0xA0u); |
1204 DirectDrawEnumerateA((LPDDENUMCALLBACKA)RenderD3D__DeviceEnumerator, *pOutDevices); | 1204 DirectDrawEnumerateExA((LPDDENUMCALLBACKEXA)RenderD3D__DeviceEnumerator, *pOutDevices, DDENUM_ATTACHEDSECONDARYDEVICES); |
1205 } | 1205 } |
1206 | 1206 |
1207 //----- (0049DC58) -------------------------------------------------------- | 1207 //----- (0049DC58) -------------------------------------------------------- |
1208 RenderD3D::RenderD3D() | 1208 RenderD3D::RenderD3D() |
1209 { | 1209 { |
2104 this->window = window; | 2104 this->window = window; |
2105 bStartInWindow = bWindowed; | 2105 bStartInWindow = bWindowed; |
2106 //windowed_mode_width = windowed_width; | 2106 //windowed_mode_width = windowed_width; |
2107 //windowed_mode_height = windowed_height; | 2107 //windowed_mode_height = windowed_height; |
2108 | 2108 |
2109 uDesiredDirect3DDevice = 0;//ReadWindowsRegistryInt("D3D Device", 1); | 2109 uDesiredDirect3DDevice = ReadWindowsRegistryInt("D3D Device", 0); |
2110 | 2110 |
2111 bUseColoredLights = bColoredLights;//ReadWindowsRegistryInt("Colored Lights", 0); | 2111 bUseColoredLights = bColoredLights;//ReadWindowsRegistryInt("Colored Lights", 0); |
2112 uLevelOfDetail = uDetailLevel;//ReadWindowsRegistryInt("Detail Level", 1); | 2112 uLevelOfDetail = uDetailLevel;//ReadWindowsRegistryInt("Detail Level", 1); |
2113 | 2113 |
2114 this->bTinting = bTinting; | 2114 this->bTinting = bTinting; |
3182 { | 3182 { |
3183 if ( !v7->bIsDeviceCompatible ) | 3183 if ( !v7->bIsDeviceCompatible ) |
3184 Error("There aren't any D3D devices to create."); | 3184 Error("There aren't any D3D devices to create."); |
3185 | 3185 |
3186 v8 = pRenderD3D->CreateDevice(0, 0, window->GetApiHandle()); | 3186 v8 = pRenderD3D->CreateDevice(0, 0, window->GetApiHandle()); |
3187 uAcquiredDirect3DDevice = 0; | 3187 uAcquiredDirect3DDevice = 1; |
3188 } | 3188 } |
3189 } | 3189 } |
3190 if ( !v8 ) | 3190 if ( !v8 ) |
3191 Error("D3Drend->Init failed."); | 3191 Error("D3Drend->Init failed."); |
3192 | 3192 |
4994 | 4994 |
4995 //----- (00479A53) -------------------------------------------------------- | 4995 //----- (00479A53) -------------------------------------------------------- |
4996 void Render::DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID) | 4996 void Render::DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID) |
4997 { | 4997 { |
4998 BLVFace *pFace; // esi@1 | 4998 BLVFace *pFace; // esi@1 |
4999 //unsigned int v3; // edi@1 | |
5000 //PolygonType v4; // al@1 | |
5001 double v5; // st7@3 | 4999 double v5; // st7@3 |
5002 signed __int64 v6; // qax@3 | 5000 signed __int64 v6; // qax@3 |
5003 //PolygonType v7; // cl@3 | |
5004 //int v8; // esi@7 | |
5005 //int v9; // eax@7 | |
5006 //unsigned int v10; // eax@7 | |
5007 //double v11; // st6@7 | |
5008 int v12; // edx@7 | 5001 int v12; // edx@7 |
5009 int v13; // eax@7 | 5002 int v13; // eax@7 |
5010 //char *v14; // esi@8 | |
5011 void *v15; // ecx@9 | 5003 void *v15; // ecx@9 |
5012 //int v16; // eax@9 | |
5013 int v17; // edi@9 | 5004 int v17; // edi@9 |
5014 double v18; // st7@9 | 5005 double v18; // st7@9 |
5015 signed int v19; // ebx@9 | 5006 signed int v19; // ebx@9 |
5016 void *v20; // ecx@9 | 5007 void *v20; // ecx@9 |
5017 int v21; // ebx@11 | 5008 int v21; // ebx@11 |
5018 int v22; // eax@14 | 5009 int v22; // eax@14 |
5019 signed __int64 v23; // qtt@16 | 5010 signed __int64 v23; // qtt@16 |
5020 double v24; // st7@16 | 5011 double v24; // st7@16 |
5021 unsigned __int8 v25; // sf@16 | 5012 unsigned __int8 v25; // sf@16 |
5022 unsigned __int8 v26; // of@16 | 5013 unsigned __int8 v26; // of@16 |
5023 //Render *v27; // ecx@17 | |
5024 double v28; // st7@20 | 5014 double v28; // st7@20 |
5025 char *v29; // ebx@20 | 5015 char *v29; // ebx@20 |
5026 char *v30; // edx@20 | 5016 char *v30; // edx@20 |
5027 unsigned __int8 v31; // c0@21 | 5017 unsigned __int8 v31; // c0@21 |
5028 unsigned __int8 v32; // c3@21 | 5018 unsigned __int8 v32; // c3@21 |
5045 RenderVertexSoft *v49; // ebx@41 | 5035 RenderVertexSoft *v49; // ebx@41 |
5046 void *v50; // edi@43 | 5036 void *v50; // edi@43 |
5047 double v51; // st7@46 | 5037 double v51; // st7@46 |
5048 RenderVertexSoft *v52; // edx@46 | 5038 RenderVertexSoft *v52; // edx@46 |
5049 void *v53; // edi@48 | 5039 void *v53; // edi@48 |
5050 //char *v54; // ebx@52 | |
5051 //unsigned int v55; // eax@53 | |
5052 //unsigned int v56; // eax@55 | |
5053 //int v57; // ST10_4@55 | |
5054 //Texture *v58; // eax@55 | |
5055 signed int v59; // [sp-4h] [bp-178h]@17 | 5040 signed int v59; // [sp-4h] [bp-178h]@17 |
5056 struct Polygon *v60; // [sp+0h] [bp-174h]@17 | 5041 struct Polygon *v60; // [sp+0h] [bp-174h]@17 |
5057 IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 | 5042 IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17 |
5058 struct Polygon pSkyPoligon; // [sp+14h] [bp-160h]@6 | 5043 struct Polygon pSkyPolygon; // [sp+14h] [bp-160h]@6 |
5059 unsigned int v63; // [sp+120h] [bp-54h]@7 | 5044 unsigned int v63; // [sp+120h] [bp-54h]@7 |
5060 //double v64; // [sp+124h] [bp-50h]@7 | |
5061 unsigned int v65; // [sp+128h] [bp-4Ch]@1 | 5045 unsigned int v65; // [sp+128h] [bp-4Ch]@1 |
5062 unsigned int v66; // [sp+12Ch] [bp-48h]@7 | 5046 unsigned int v66; // [sp+12Ch] [bp-48h]@7 |
5063 float v67; // [sp+130h] [bp-44h]@7 | 5047 //float v67; // [sp+130h] [bp-44h]@7 |
5064 //__int64 v68; // [sp+134h] [bp-40h]@3 | |
5065 __int64 v69; // [sp+13Ch] [bp-38h]@3 | 5048 __int64 v69; // [sp+13Ch] [bp-38h]@3 |
5066 int v70; // [sp+144h] [bp-30h]@3 | 5049 int v70; // [sp+144h] [bp-30h]@3 |
5067 int X; // [sp+148h] [bp-2Ch]@9 | 5050 int X; // [sp+148h] [bp-2Ch]@9 |
5068 int v72; // [sp+14Ch] [bp-28h]@7 | 5051 int v72; // [sp+14Ch] [bp-28h]@7 |
5069 float v73; // [sp+150h] [bp-24h]@16 | 5052 float v73; // [sp+150h] [bp-24h]@16 |
5075 void *v79; // [sp+168h] [bp-Ch]@9 | 5058 void *v79; // [sp+168h] [bp-Ch]@9 |
5076 float v80; // [sp+16Ch] [bp-8h]@3 | 5059 float v80; // [sp+16Ch] [bp-8h]@3 |
5077 const void *v81; // [sp+170h] [bp-4h]@7 | 5060 const void *v81; // [sp+170h] [bp-4h]@7 |
5078 | 5061 |
5079 pFace = &pIndoor->pFaces[uFaceID]; | 5062 pFace = &pIndoor->pFaces[uFaceID]; |
5063 //for floor and wall------------------- | |
5080 if (pFace->uPolygonType == POLYGON_InBetweenFloorAndWall || pFace->uPolygonType == POLYGON_Floor) | 5064 if (pFace->uPolygonType == POLYGON_InBetweenFloorAndWall || pFace->uPolygonType == POLYGON_Floor) |
5081 { | 5065 { |
5082 int v69 = (GetTickCount() / 32) - pGame->pIndoorCameraD3D->vPartyPos.x; | 5066 int v69 = (GetTickCount() / 32) - pGame->pIndoorCameraD3D->vPartyPos.x; |
5083 int v55 = (GetTickCount() / 32) + pGame->pIndoorCameraD3D->vPartyPos.y; | 5067 int v55 = (GetTickCount() / 32) + pGame->pIndoorCameraD3D->vPartyPos.y; |
5084 for (uint i = 0; i < uNumVertices; ++i) | 5068 for (uint i = 0; i < uNumVertices; ++i) |
5087 array_507D30[i].v = (v55 + array_507D30[i].v) * 0.25f; | 5071 array_507D30[i].v = (v55 + array_507D30[i].v) * 0.25f; |
5088 } | 5072 } |
5089 pRenderer->DrawIndoorPolygon(uNumVertices, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), -1, 0); | 5073 pRenderer->DrawIndoorPolygon(uNumVertices, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), -1, 0); |
5090 return; | 5074 return; |
5091 } | 5075 } |
5092 | 5076 //--------------------------------------- |
5093 //*(float *)&v74 = (double)pBLVRenderParams->uViewportCenterY; | 5077 v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pGame->pIndoorCameraD3D->vPartyPos.z)//179 |
5094 v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pGame->pIndoorCameraD3D->vPartyPos.z) | |
5095 / (((double)pBLVRenderParams->fov_rad_fixpoint + 16192.0) | 5078 / (((double)pBLVRenderParams->fov_rad_fixpoint + 16192.0) |
5096 * 65536.0) | 5079 * 65536.0) |
5097 + (double)pBLVRenderParams->uViewportCenterY); | 5080 + (double)pBLVRenderParams->uViewportCenterY); |
5098 v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064; | 5081 v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064;//0 |
5099 //*(float *)&v75 = v5; | 5082 v6 = (signed __int64)((double)pBLVRenderParams->uViewportCenterY//183 |
5100 v6 = (signed __int64)((double)pBLVRenderParams->uViewportCenterY | |
5101 - (double)pBLVRenderParams->fov_rad_fixpoint | 5083 - (double)pBLVRenderParams->fov_rad_fixpoint |
5102 / ((cos(v5) * 16192.0 + 0.0000001) | 5084 / ((cos(v5) * 16192.0 + 0.0000001) |
5103 * 65535.0) | 5085 * 65535.0) |
5104 * (sin(v5) * -16192.0 - (double)pGame->pIndoorCameraD3D->vPartyPos.z)); | 5086 * (sin(v5) * -16192.0 - (double)pGame->pIndoorCameraD3D->vPartyPos.z)); |
5105 | 5087 |
5106 | 5088 pSkyPolygon.Create_48607B(&stru_8019C8); |
5107 stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); | 5089 pSkyPolygon.ptr_38->_48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); |
5108 pSkyPoligon.Create_48607B(&stru_8019C8); | 5090 pSkyPolygon.uTileBitmapID = pFace->uBitmapID; |
5109 pSkyPoligon.uTileBitmapID = pFace->uBitmapID; | 5091 |
5110 | 5092 pSkyPolygon.pTexture = pBitmaps_LOD->GetTexture(pSkyPolygon.uTileBitmapID); |
5111 pSkyPoligon.pTexture = pBitmaps_LOD->GetTexture(pSkyPoligon.uTileBitmapID); | 5093 if ( !pSkyPolygon.pTexture ) |
5112 if ( !pSkyPoligon.pTexture ) | |
5113 return; | 5094 return; |
5114 | 5095 |
5115 pSkyPoligon.dimming_level = 0; | 5096 pSkyPolygon.dimming_level = 0; |
5116 pSkyPoligon.uNumVertices = uNumVertices; | 5097 pSkyPolygon.uNumVertices = uNumVertices; |
5117 pSkyPoligon.v_18.y = 0; | 5098 |
5118 pSkyPoligon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16); | 5099 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16); |
5119 pSkyPoligon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16); | 5100 pSkyPolygon.v_18.y = 0; |
5101 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16); | |
5102 | |
5120 memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices])); | 5103 memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices])); |
5121 pSkyPoligon.field_24 = 0x2000000; | 5104 pSkyPolygon.field_24 = 0x2000000; |
5122 | 5105 |
5123 extern float _calc_fov(int viewport_width, int angle_degree); | 5106 extern float _calc_fov(int viewport_width, int angle_degree); |
5124 //v64 = (double)(signed int)(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX) * 0.5; | 5107 //v64 = (double)(signed int)(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX) * 0.5; |
5125 //v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); | 5108 //v72 = 65536 / (signed int)(signed __int64)(v64 / tan(0.6457717418670654) + 0.5); |
5126 v72 = 65536.0f / _calc_fov(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX, 74); | 5109 v72 = 65536.0f / _calc_fov(pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX, 74); |
5127 v12 = pSkyPoligon.pTexture->uWidthMinus1; | 5110 v12 = pSkyPolygon.pTexture->uWidthMinus1; |
5128 v13 = pSkyPoligon.pTexture->uHeightMinus1; | 5111 v13 = pSkyPolygon.pTexture->uHeightMinus1; |
5129 v67 = 1.0 / (double)pSkyPoligon.pTexture->uTextureWidth; | 5112 //v67 = 1.0 / (double)pSkyPolygon.pTexture->uTextureWidth; |
5130 v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; | 5113 v63 = 224 * pMiscTimer->uTotalGameTimeElapsed & v13; |
5131 v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; | 5114 v66 = 224 * pMiscTimer->uTotalGameTimeElapsed & v12; |
5132 v78 = 0; | 5115 v78 = 0; |
5133 v81 = 0; | 5116 v81 = 0; |
5134 float v68 = 1.0 / (double)pSkyPoligon.pTexture->uTextureHeight; | 5117 float v68 = 1.0 / (double)pSkyPolygon.pTexture->uTextureHeight; |
5135 if ( (signed int)pSkyPoligon.uNumVertices <= 0 ) | 5118 if ( (signed int)pSkyPolygon.uNumVertices <= 0 ) |
5136 { | 5119 { |
5137 LABEL_17: | 5120 pRenderer->DrawIndoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, |
5138 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID]; | 5121 pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); |
5139 //v27 = pRenderer; | 5122 return; |
5140 v60 = &pSkyPoligon; | |
5141 v59 = pSkyPoligon.uNumVertices; | |
5142 goto LABEL_18; | |
5143 } | 5123 } |
5144 | 5124 |
5145 //v14 = (char *)&array_507D30[0].vWorldViewProjY; | 5125 //v14 = (char *)&array_507D30[0].vWorldViewProjY; |
5146 int _507D30_idx = 0; | 5126 int _507D30_idx = 0; |
5147 while ( 2 ) | 5127 while ( 2 ) |
5148 { | 5128 { |
5149 v15 = (void *)(v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY)); | 5129 //v15 = (void *)(v72 * (v70 - (int)array_507D30[_507D30_idx].vWorldViewProjY)); |
5150 v77 = (unsigned __int64)(pSkyPoligon.ptr_38->viewing_angle_from_west_east * (signed __int64)(signed int)v15) >> 16; | 5130 v77 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_west_east * (signed __int64)(v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16; |
5151 v74 = v77 + pSkyPoligon.ptr_38->angle_from_north; | 5131 v74 = v77 + pSkyPolygon.ptr_38->angle_from_north; |
5152 v77 = (int)v15; | 5132 |
5153 v77 = (unsigned __int64)(pSkyPoligon.ptr_38->viewing_angle_from_north_south * (signed __int64)(signed int)v15) >> 16; | 5133 v77 = (unsigned __int64)(pSkyPolygon.ptr_38->viewing_angle_from_north_south * (signed __int64)(v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16; |
5154 v79 = v15; | 5134 v75 = (RenderVertexSoft *)(v77 + pSkyPolygon.ptr_38->angle_from_east); |
5155 v75 = (RenderVertexSoft *)(v77 + pSkyPoligon.ptr_38->angle_from_east); | 5135 |
5156 v79 = (void *)((unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v15) >> 16); | 5136 v79 = (void *)(((unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v72 * (v70 - array_507D30[_507D30_idx].vWorldViewProjY))) >> 16); |
5157 v17 = v72 * (pBLVRenderParams->uViewportCenterX - (int)array_507D30[_507D30_idx].vWorldViewProjX); | 5137 v17 = v72 * (pBLVRenderParams->uViewportCenterX - (int)array_507D30[_507D30_idx].vWorldViewProjX); |
5158 v18 = array_507D30[_507D30_idx].vWorldViewProjY - 1.0; | 5138 v18 = array_507D30[_507D30_idx].vWorldViewProjY - 1.0; |
5159 v19 = -pSkyPoligon.field_24; | 5139 v19 = -pSkyPolygon.field_24; |
5160 v77 = -pSkyPoligon.field_24; | 5140 v77 = -pSkyPolygon.field_24; |
5161 X = (int)((char *)v79 + pSkyPoligon.v_18.x); | 5141 X = (int)((char *)v79 + pSkyPolygon.v_18.x); |
5162 LODWORD(v76) = (signed __int64)v18; | 5142 LODWORD(v76) = (signed __int64)v18; |
5163 v20 = (void *)(v72 * (v70 - LODWORD(v76))); | 5143 v20 = (void *)(v72 * (v70 - LODWORD(v76))); |
5164 while ( 1 ) | 5144 while ( 1 ) |
5165 { | 5145 { |
5166 v79 = v20; | 5146 v79 = v20; |
5172 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) | 5152 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) |
5173 break; | 5153 break; |
5174 v19 = v77; | 5154 v19 = v77; |
5175 v20 = v79; | 5155 v20 = v79; |
5176 LABEL_14: | 5156 LABEL_14: |
5177 v79 = (void *)((unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v20) >> 16); | 5157 v79 = (void *)((unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(signed int)v20) >> 16); |
5178 v22 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v20) >> 16; | 5158 v22 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(signed int)v20) >> 16; |
5179 --LODWORD(v76); | 5159 --LODWORD(v76); |
5180 v20 = (char *)v20 + v72; | 5160 v20 = (char *)v20 + v72; |
5181 X = v22 + pSkyPoligon.v_18.x; | 5161 X = v22 + pSkyPolygon.v_18.x; |
5182 v78 = 1; | 5162 v78 = 1; |
5183 } | 5163 } |
5184 if ( !v78 ) | 5164 if ( !v78 ) |
5185 { | 5165 { |
5186 LODWORD(v23) = v77 << 16; | 5166 LODWORD(v23) = v77 << 16; |
5187 HIDWORD(v23) = v77 >> 16; | 5167 HIDWORD(v23) = v77 >> 16;//v23 = 0xfffffe0000000000 |
5188 v79 = (void *)(v23 / X); | 5168 int i = HIDWORD(v23) / X; |
5169 v79 = (void *)(v23 / X);//X = FFFF96A3(FFFF9014) | |
5189 v77 = v17; | 5170 v77 = v17; |
5190 v77 = v17; | 5171 v77 = v17; |
5191 LODWORD(v76) = v74 + ((unsigned __int64)(pSkyPoligon.ptr_38->angle_from_west * (signed __int64)v17) >> 16); | 5172 |
5192 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(pSkyPoligon.ptr_38->angle_from_south * (signed __int64)v17) >> 16)); | 5173 LODWORD(v76) = v74 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v17) >> 16); |
5174 LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); | |
5175 //v24 = (double)SLODWORD(v80) * 0.000015259022; | |
5176 array_507D30[_507D30_idx].u = ((double)SLODWORD(v80) * 0.000015259022) * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth); | |
5177 | |
5178 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v17) >> 16)); | |
5179 LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); | |
5180 array_507D30[_507D30_idx].v = ((double)SLODWORD(v80) * 0.000015259022) * v68; | |
5181 | |
5193 v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; | 5182 v77 = (unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16; |
5194 LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; | 5183 LODWORD(v73) = (unsigned __int64)((signed int)v75 * v23 / X) >> 16; |
5195 //v14 += 48; | 5184 //v14 += 48; |
5196 LODWORD(v80) = v66 + ((signed int)((unsigned __int64)(SLODWORD(v76) * v23 / X) >> 16) >> 4); | |
5197 v81 = (char *)v81 + 1; | 5185 v81 = (char *)v81 + 1; |
5198 v24 = (double)SLODWORD(v80) * 0.000015259022; | 5186 //v26 = __OFSUB__((int)v81, pSkyPolygon.uNumVertices); |
5199 LODWORD(v80) = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v23 / X) >> 16) >> 4); | 5187 //v25 = (signed int)((char *)v81 - pSkyPolygon.uNumVertices) < 0; |
5200 v26 = __OFSUB__((int)v81, pSkyPoligon.uNumVertices); | |
5201 v25 = (signed int)((char *)v81 - pSkyPoligon.uNumVertices) < 0; | |
5202 array_507D30[_507D30_idx].u = v24 * v67; | |
5203 array_507D30[_507D30_idx].v = (double)SLODWORD(v80) * 0.000015259022 * v68; | |
5204 array_507D30[_507D30_idx]._rhw = 65536.0 / (double)(signed int)v79; | 5188 array_507D30[_507D30_idx]._rhw = 65536.0 / (double)(signed int)v79; |
5189 /* | |
5190 v18 = v17 / v38; | |
5191 if ( v18 < 0 ) | |
5192 v18 = pODMRenderParams->shading_dist_mist; | |
5193 | |
5194 v37 = v35 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v13) >> 16); | |
5195 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + ((signed int)((unsigned __int64)(v37 * (signed __int64)v18) >> 16) >> 3); | |
5196 array_50AC10[i].u = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureWidth * 65536.0); | |
5197 | |
5198 v36 = v36 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v13) >> 16); | |
5199 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + ((signed int)((unsigned __int64)(v36 * (signed __int64)v18) >> 16) >> 3); | |
5200 array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0); | |
5201 | |
5202 array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist | |
5203 array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16); | |
5204 */ | |
5205 _507D30_idx++; | 5205 _507D30_idx++; |
5206 if ( !(v25 ^ v26) ) | 5206 if ( (int)v81 >= pSkyPolygon.uNumVertices ) |
5207 goto LABEL_17; | 5207 { |
5208 pRenderer->DrawIndoorSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, | |
5209 pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); | |
5210 return; | |
5211 } | |
5208 continue; | 5212 continue; |
5209 } | 5213 } |
5210 break; | 5214 break; |
5211 } | 5215 } |
5212 LODWORD(v73) = 0; | 5216 LODWORD(v73) = 0; |
5213 v80 = v76; | 5217 v80 = v76; |
5214 if ( (signed int)pSkyPoligon.uNumVertices > 0 ) | 5218 if ( (signed int)pSkyPolygon.uNumVertices > 0 ) |
5215 { | 5219 { |
5216 v28 = (double)SLODWORD(v76); | 5220 v28 = (double)SLODWORD(v76); |
5217 LODWORD(v76) = (int)(char *)array_50AC10 + 28; | 5221 LODWORD(v76) = (int)(char *)array_50AC10 + 28; |
5218 v29 = (char *)&array_50AC10[0].vWorldViewProjX; | 5222 v29 = (char *)&array_50AC10[0].vWorldViewProjX; |
5219 v30 = (char *)&array_507D30[1].vWorldViewProjY; | 5223 v30 = (char *)&array_507D30[1].vWorldViewProjY; |
5220 v79 = array_50AC10; | 5224 v79 = array_50AC10; |
5221 v81 = array_507D30; | 5225 v81 = array_507D30; |
5222 v78 = pSkyPoligon.uNumVertices; | 5226 v78 = pSkyPolygon.uNumVertices; |
5223 do | 5227 do |
5224 { | 5228 { |
5225 v31 = v28 < *((float *)v30 - 12); | 5229 v31 = v28 < *((float *)v30 - 12); |
5226 v32 = v28 == *((float *)v30 - 12); | 5230 v32 = v28 == *((float *)v30 - 12); |
5227 ++LODWORD(v73); | 5231 ++LODWORD(v73); |
5260 v65 = v77 >> 14; | 5264 v65 = v77 >> 14; |
5261 HIDWORD(v69) = LODWORD(v73); | 5265 HIDWORD(v69) = LODWORD(v73); |
5262 do | 5266 do |
5263 { | 5267 { |
5264 v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); | 5268 v35 = (const void *)(v72 * (v70 - (unsigned __int64)(signed __int64)*(float *)v34)); |
5265 v78 = pSkyPoligon.ptr_38->viewing_angle_from_west_east; | 5269 v78 = pSkyPolygon.ptr_38->viewing_angle_from_west_east; |
5266 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); | 5270 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); |
5267 v36 = (int)((char *)v81 + pSkyPoligon.ptr_38->angle_from_north); | 5271 v36 = (int)((char *)v81 + pSkyPolygon.ptr_38->angle_from_north); |
5268 v81 = v35; | 5272 v81 = v35; |
5269 v74 = v36; | 5273 v74 = v36; |
5270 v78 = pSkyPoligon.ptr_38->viewing_angle_from_north_south; | 5274 v78 = pSkyPolygon.ptr_38->viewing_angle_from_north_south; |
5271 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); | 5275 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v35) >> 16); |
5272 v78 = (int)v35; | 5276 v78 = (int)v35; |
5273 v75 = (RenderVertexSoft *)((char *)v81 + pSkyPoligon.ptr_38->angle_from_east); | 5277 v75 = (RenderVertexSoft *)((char *)v81 + pSkyPolygon.ptr_38->angle_from_east); |
5274 v81 = (const void *)pSkyPoligon.v_18.z; | 5278 v81 = (const void *)pSkyPolygon.v_18.z; |
5275 v78 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)(signed int)v35) >> 16; | 5279 v78 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(signed int)v35) >> 16; |
5276 v37 = (const void *)(v72 | 5280 v37 = (const void *)(v72 |
5277 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); | 5281 * (pBLVRenderParams->uViewportCenterX - (unsigned __int64)(signed __int64)*((float *)v34 - 1))); |
5278 v38 = (signed __int64)(*(float *)v34 - 1.0); | 5282 v38 = (signed __int64)(*(float *)v34 - 1.0); |
5279 v81 = 0; | 5283 v81 = 0; |
5280 LODWORD(v76) = v38; | 5284 LODWORD(v76) = v38; |
5289 break; | 5293 break; |
5290 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) | 5294 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) |
5291 break; | 5295 break; |
5292 v39 = v78; | 5296 v39 = v78; |
5293 LABEL_36: | 5297 LABEL_36: |
5294 v78 = pSkyPoligon.v_18.z; | 5298 v78 = pSkyPolygon.v_18.z; |
5295 v41 = (unsigned __int64)(pSkyPoligon.v_18.z * (signed __int64)v39) >> 16; | 5299 v41 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v39) >> 16; |
5296 --LODWORD(v76); | 5300 --LODWORD(v76); |
5297 v39 += v72; | 5301 v39 += v72; |
5298 X = v41 + pSkyPoligon.v_18.x; | 5302 X = v41 + pSkyPolygon.v_18.x; |
5299 v81 = (const void *)1; | 5303 v81 = (const void *)1; |
5300 } | 5304 } |
5301 if ( v81 ) | 5305 if ( v81 ) |
5302 { | 5306 { |
5303 v79 = (void *)pSkyPoligon.v_18.z; | 5307 v79 = (void *)pSkyPolygon.v_18.z; |
5304 v78 = 2 * LODWORD(v76); | 5308 v78 = 2 * LODWORD(v76); |
5305 v81 = (const void *)((unsigned __int64)(pSkyPoligon.v_18.z | 5309 v81 = (const void *)((unsigned __int64)(pSkyPolygon.v_18.z |
5306 * (signed __int64)(signed int)(signed __int64)(((double)v70 | 5310 * (signed __int64)(signed int)(signed __int64)(((double)v70 |
5307 - ((double)(2 * LODWORD(v76)) | 5311 - ((double)(2 * LODWORD(v76)) |
5308 - *(float *)v34)) | 5312 - *(float *)v34)) |
5309 * (double)v72)) >> 16); | 5313 * (double)v72)) >> 16); |
5310 X = (int)((char *)v81 + pSkyPoligon.v_18.x); | 5314 X = (int)((char *)v81 + pSkyPolygon.v_18.x); |
5311 } | 5315 } |
5312 LODWORD(v42) = v77 << 16; | 5316 LODWORD(v42) = v77 << 16; |
5313 HIDWORD(v42) = v77 >> 16; | 5317 HIDWORD(v42) = v77 >> 16; |
5314 v79 = (void *)(v42 / X); | 5318 v79 = (void *)(v42 / X); |
5315 v81 = v37; | 5319 v81 = v37; |
5316 v78 = pSkyPoligon.ptr_38->angle_from_west; | 5320 v78 = pSkyPolygon.ptr_38->angle_from_west; |
5317 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); | 5321 v81 = (const void *)((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); |
5318 v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); | 5322 v43 = v74 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16); |
5319 v74 = (unsigned int)v37; | 5323 v74 = (unsigned int)v37; |
5320 LODWORD(v76) = v43; | 5324 LODWORD(v76) = v43; |
5321 v78 = pSkyPoligon.ptr_38->angle_from_south; | 5325 v78 = pSkyPolygon.ptr_38->angle_from_south; |
5322 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); | 5326 v75 = (RenderVertexSoft *)((char *)v75 + ((unsigned __int64)(v78 * (signed __int64)(signed int)v37) >> 16)); |
5323 v74 = (unsigned __int64)(v43 * v42 / X) >> 16; | 5327 v74 = (unsigned __int64)(v43 * v42 / X) >> 16; |
5324 v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); | 5328 v81 = (const void *)((unsigned __int64)((signed int)v75 * v42 / X) >> 16); |
5325 v34 += 48; | 5329 v34 += 48; |
5326 v78 = v66 + ((signed int)v74 >> 4); | 5330 v78 = v66 + ((signed int)v74 >> 4); |
5327 v44 = HIDWORD(v69)-- == 1; | 5331 v44 = HIDWORD(v69)-- == 1; |
5328 v45 = (double)v78 * 0.000015259022; | 5332 v45 = (double)v78 * 0.000015259022; |
5329 v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); | 5333 v78 = v63 + ((signed int)((unsigned __int64)((signed int)v75 * v42 / X) >> 16) >> 4); |
5330 *((float *)v34 - 10) = v45 * v67; | 5334 *((float *)v34 - 10) = v45 * (1.0 / (double)pSkyPolygon.pTexture->uTextureWidth); |
5331 *((float *)v34 - 9) = (double)v78 * 0.000015259022 * v68; | 5335 *((float *)v34 - 9) = (double)v78 * 0.000015259022 * v68; |
5332 v46 = (double)(signed int)v79; | 5336 v46 = (double)(signed int)v79; |
5333 *((float *)v34 - 16) = 0.000015258789 * v46; | 5337 *((float *)v34 - 16) = 0.000015258789 * v46; |
5334 *((float *)v34 - 11) = 65536.0 / v46; | 5338 *((float *)v34 - 11) = 65536.0 / v46; |
5335 } | 5339 } |
5354 ++v49; | 5358 ++v49; |
5355 --HIDWORD(v69); | 5359 --HIDWORD(v69); |
5356 } | 5360 } |
5357 while ( HIDWORD(v69) ); | 5361 while ( HIDWORD(v69) ); |
5358 } | 5362 } |
5359 pSkyPoligon.uNumVertices = v47; | 5363 pSkyPolygon.uNumVertices = v47; |
5360 pRenderer->DrawIndoorSkyPolygon(v47, &pSkyPoligon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID]); | 5364 pRenderer->DrawIndoorSkyPolygon(v47, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); |
5361 *(float *)&v74 = 0.0; | 5365 *(float *)&v74 = 0.0; |
5362 if ( SLODWORD(v73) > 0 ) | 5366 if ( SLODWORD(v73) > 0 ) |
5363 { | 5367 { |
5364 v51 = (double)SLODWORD(v80); | 5368 v51 = (double)SLODWORD(v80); |
5365 v75 = array_507D30; | 5369 v75 = array_507D30; |
5366 v52 = array_50AC10; | 5370 v52 = array_50AC10; |
5367 v80 = v73; | 5371 for ( v80 = v73; v80; --v80 ) |
5368 do | |
5369 { | 5372 { |
5370 if ( v51 <= v52->vWorldViewProjY ) | 5373 if ( v51 <= v52->vWorldViewProjY ) |
5371 { | 5374 { |
5372 v53 = v75; | 5375 v53 = v75; |
5373 ++v74; | 5376 ++v74; |
5374 ++v75; | 5377 ++v75; |
5375 memcpy(v53, v52, 0x30u); | 5378 memcpy(v53, v52, 0x30u); |
5376 } | 5379 } |
5377 ++v52; | 5380 ++v52; |
5378 --LODWORD(v80); | 5381 //--LODWORD(v80); |
5379 } | 5382 } |
5380 while ( v80 != 0.0 ); | 5383 //while ( v80 != 0.0 ); |
5381 } | 5384 } |
5382 pSkyPoligon.uNumVertices = v74; | 5385 pRenderer->DrawIndoorSkyPolygon(v74, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); |
5383 v61 = pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPoligon.uTileBitmapID]; | |
5384 v60 = &pSkyPoligon; | |
5385 v59 = v74; | |
5386 //v27 = pRenderer; | |
5387 LABEL_18: | |
5388 pRenderer->DrawIndoorSkyPolygon(v59, v60, v61); | |
5389 } | 5386 } |
5390 | 5387 |
5391 | 5388 |
5392 //----- (004A2FC0) -------------------------------------------------------- | 5389 //----- (004A2FC0) -------------------------------------------------------- |
5393 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) | 5390 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) |