Mercurial > mm7
comparison Engine/Graphics/Render.cpp @ 2532:9ec6b8be16fe
Mobile light
author | Ritor1 |
---|---|
date | Mon, 19 Jan 2015 22:39:03 +0600 |
parents | f6de3e15d4a5 |
children | 1bcadc6dd203 |
comparison
equal
deleted
inserted
replaced
2531:f6de3e15d4a5 | 2532:9ec6b8be16fe |
---|---|
923 unsigned int v6; // edi@9 | 923 unsigned int v6; // edi@9 |
924 int v7; // eax@9 | 924 int v7; // eax@9 |
925 SpriteFrame *frame; // eax@9 | 925 SpriteFrame *frame; // eax@9 |
926 unsigned __int16 *v10; // eax@9 | 926 unsigned __int16 *v10; // eax@9 |
927 int v13; // ecx@9 | 927 int v13; // ecx@9 |
928 int v14; // ecx@20 | 928 char r; // ecx@20 |
929 char v15; // dl@20 | 929 char g; // dl@20 |
930 signed int v16; // eax@20 | 930 char b_; // eax@20 |
931 int v17; // eax@23 | 931 int v17; // eax@23 |
932 int v18; // ecx@24 | 932 int v18; // ecx@24 |
933 int v19; // eax@24 | 933 int v19; // eax@24 |
934 int v20; // ecx@24 | 934 int v20; // ecx@24 |
935 int v21; // ebx@26 | 935 int v21; // ebx@26 |
1039 v38 |= 4; | 1039 v38 |= 4; |
1040 if ( frame->uFlags & 0x40000 ) | 1040 if ( frame->uFlags & 0x40000 ) |
1041 v38 |= 0x40; | 1041 v38 |= 0x40; |
1042 if ( frame->uFlags & 0x20000 ) | 1042 if ( frame->uFlags & 0x20000 ) |
1043 LOBYTE(v38) = v38 | 0x80; | 1043 LOBYTE(v38) = v38 | 0x80; |
1044 | |
1045 //for light | |
1044 if ( frame->uGlowRadius ) | 1046 if ( frame->uGlowRadius ) |
1045 { | 1047 { |
1046 if ( pRenderD3D && bUseColoredLights ) | 1048 r = 255; |
1049 g = 255; | |
1050 b_ = 255; | |
1051 if ( /*pRenderD3D &&*/ bUseColoredLights ) | |
1047 { | 1052 { |
1048 v14 = /*255;//*/decor_desc->uColoredLightRed; | 1053 r = /*255;//*/decor_desc->uColoredLightRed; |
1049 v15 = /*255;//*/decor_desc->uColoredLightGreen; | 1054 g = /*255;//*/decor_desc->uColoredLightGreen; |
1050 v16 = /*255;//*/decor_desc->uColoredLightBlue; | 1055 b_ = /*255;//*/decor_desc->uColoredLightBlue; |
1051 } | 1056 } |
1052 else | 1057 pStationaryLightsStack->AddLight(pLevelDecorations[i].vPosition.x, |
1053 { | 1058 pLevelDecorations[i].vPosition.y, |
1054 v16 = 255; | 1059 pLevelDecorations[i].vPosition.z + decor_desc->uDecorationHeight / 2, |
1055 v14 = 255; | 1060 frame->uGlowRadius, r, g, b_, _4E94D0_light_type); |
1056 v15 = 255; | 1061 }//for light |
1057 } | 1062 |
1058 pStationaryLightsStack->AddLight(pLevelDecorations[i].vPosition.x, pLevelDecorations[i].vPosition.y, pLevelDecorations[i].vPosition.z + decor_desc->uDecorationHeight / 2, | |
1059 frame->uGlowRadius, v14, v15, v16, _4E94D0_light_type); | |
1060 } | |
1061 v17 = (pLevelDecorations[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; | 1063 v17 = (pLevelDecorations[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; |
1062 if (pGame->pIndoorCameraD3D->sRotationX) | 1064 if (pGame->pIndoorCameraD3D->sRotationX) |
1063 { | 1065 { |
1064 v40 = (pLevelDecorations[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; | 1066 v40 = (pLevelDecorations[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; |
1065 v18 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pGame->pIndoorCameraD3D->int_sine_y); | 1067 v18 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pGame->pIndoorCameraD3D->int_sine_y); |
5146 } | 5148 } |
5147 } | 5149 } |
5148 pRenderer->DrawIndoorSkyPolygon(pNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); | 5150 pRenderer->DrawIndoorSkyPolygon(pNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]); |
5149 } | 5151 } |
5150 | 5152 |
5151 | |
5152 //----- (004A2FC0) -------------------------------------------------------- | 5153 //----- (004A2FC0) -------------------------------------------------------- |
5153 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) | 5154 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) |
5154 { | 5155 { |
5155 if (!uNumD3DSceneBegins || uNumVertices < 3) | 5156 if (!uNumD3DSceneBegins || uNumVertices < 3) |
5156 return; | 5157 return; |
5157 | 5158 |
5158 //auto a3 = pFace; | |
5159 //auto a6 = uPackedID; | |
5160 //v59 = pGame->pLightmapBuilder; | |
5161 //v9 = v59->std__vector_000004_size; | |
5162 | |
5163 int sCorrectedColor = uColor; | 5159 int sCorrectedColor = uColor; |
5160 | |
5164 if (pGame->pLightmapBuilder->std__vector_000004_size) | 5161 if (pGame->pLightmapBuilder->std__vector_000004_size) |
5165 sCorrectedColor = -1; | 5162 sCorrectedColor = -1; |
5166 pGame->AlterGamma_BLV(pFace, &sCorrectedColor); | 5163 pGame->AlterGamma_BLV(pFace, &sCorrectedColor); |
5167 | 5164 |
5168 | |
5169 if (pFace->uAttributes & FACE_OUTLINED) | 5165 if (pFace->uAttributes & FACE_OUTLINED) |
5170 { | 5166 { |
5171 // int color; | |
5172 if (GetTickCount() % 300 >= 150) | 5167 if (GetTickCount() % 300 >= 150) |
5173 uColor = sCorrectedColor = 0xFF20FF20; | 5168 uColor = sCorrectedColor = 0xFF20FF20; |
5174 else uColor = sCorrectedColor = 0xFF109010; | 5169 else |
5170 uColor = sCorrectedColor = 0xFF109010; | |
5175 } | 5171 } |
5176 | 5172 |
5177 if (byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01_lightmap_related) | 5173 if (byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01_lightmap_related) |
5178 { | 5174 { |
5179 __debugbreak(); | 5175 __debugbreak(); |
5191 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | 5187 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; |
5192 } | 5188 } |
5193 | 5189 |
5194 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 5190 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
5195 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | 5191 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
5196 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 5192 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
5197 D3DPT_TRIANGLEFAN, | |
5198 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 5193 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
5199 d3d_vertex_buffer, | 5194 d3d_vertex_buffer, uNumVertices, 28)); |
5200 uNumVertices, | |
5201 28)); | |
5202 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); | 5195 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
5203 } | 5196 } |
5204 else | 5197 else |
5205 { | 5198 { |
5206 if (!pGame->pLightmapBuilder->std__vector_000004_size || | 5199 if (!pGame->pLightmapBuilder->std__vector_000004_size || byte_4D864C && pGame->uFlags & 2) |
5207 byte_4D864C && pGame->uFlags & 2) | |
5208 { | 5200 { |
5209 for (uint i = 0; i < uNumVertices; ++i) | 5201 for (uint i = 0; i < uNumVertices; ++i) |
5210 { | 5202 { |
5211 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | 5203 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; |
5212 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | 5204 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; |
5220 | 5212 |
5221 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 5213 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
5222 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); | 5214 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
5223 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 5215 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
5224 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 5216 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
5225 d3d_vertex_buffer, | 5217 d3d_vertex_buffer, uNumVertices, 28)); |
5226 uNumVertices, | |
5227 28)); | |
5228 } | 5218 } |
5229 else | 5219 else |
5230 { | 5220 { |
5231 for (uint i = 0; i < uNumVertices; ++i) | 5221 for (uint i = 0; i < uNumVertices; ++i) |
5232 { | 5222 { |
5237 d3d_vertex_buffer[i].diffuse = uColor; | 5227 d3d_vertex_buffer[i].diffuse = uColor; |
5238 d3d_vertex_buffer[i].specular = 0; | 5228 d3d_vertex_buffer[i].specular = 0; |
5239 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | 5229 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; |
5240 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | 5230 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; |
5241 } | 5231 } |
5242 //__debugbreak(); | 5232 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
5243 //if ( (signed int)uNumVertices > 0 ) | 5233 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
5244 //{ | 5234 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
5245 //v23 = pTex; | 5235 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
5246 //v24 = (char *)&array_507D30[0].vWorldViewPosition; | 5236 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
5247 //v25 = (char *)&d3d_vertex_buffer[0].pos.y; | 5237 d3d_vertex_buffer, uNumVertices, 28)); |
5248 //pTex = (Texture *)uNumVertices; | 5238 |
5249 //uint v18; | 5239 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
5250 //do | 5240 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
5251 //{ | 5241 |
5252 //v26 = *(float *)v24 * 0.061758894; | 5242 for (uint i = 0; i < uNumVertices; ++i) |
5253 //v27 = *((int *)v24 + 3); | 5243 d3d_vertex_buffer[i].diffuse = sCorrectedColor; |
5254 //*((int *)v25 + 4) = 0; | 5244 |
5255 //*((int *)v25 - 1) = v27; | 5245 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
5256 //*(int *)v25 = *((int *)v24 + 4); | 5246 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
5257 //*((int *)v25 + 3) = uColor; | 5247 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
5258 //v25 += 32; | 5248 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
5259 //*((float *)v25 - 7) = 1.0 - 1.0 / v26; | 5249 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); |
5260 //v28 = 1.0 / *(float *)v24; | 5250 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); |
5261 //v24 += 48; | 5251 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
5262 //v18 = pTex == (Texture *)1; | 5252 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
5263 //pTex = (Texture *)((char *)pTex - 1); | 5253 d3d_vertex_buffer, uNumVertices, 28)); |
5264 //*((float *)v25 - 6) = v28; | 5254 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
5265 //a3 = (BLVFace *)v23->uTextureWidth; | 5255 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
5266 //*((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth; | 5256 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); |
5267 //a3 = (BLVFace *)v23->uTextureHeight; | |
5268 //*((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight; | |
5269 //} | |
5270 //while ( !v18 ); | |
5271 //} | |
5272 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); | |
5273 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
5274 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | |
5275 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
5276 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
5277 d3d_vertex_buffer, | |
5278 uNumVertices, | |
5279 28)); | |
5280 | |
5281 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | |
5282 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); | |
5283 | |
5284 for (uint i = 0; i < uNumVertices; ++i) | |
5285 d3d_vertex_buffer[i].diffuse = sCorrectedColor; | |
5286 /*v33 = uNumVertices; | |
5287 if ( (signed int)uNumVertices > 0 ) | |
5288 { | |
5289 v34 = (char *)&d3d_vertex_buffer[0].diffuse; | |
5290 do | |
5291 { | |
5292 *(int *)v34 = uCorrectedColor; | |
5293 v34 += 32; | |
5294 --v33; | |
5295 } | |
5296 while ( v33 ); | |
5297 }*/ | |
5298 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); | |
5299 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | |
5300 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); | |
5301 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | |
5302 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); | |
5303 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); | |
5304 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
5305 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
5306 d3d_vertex_buffer, | |
5307 uNumVertices, | |
5308 28)); | |
5309 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | |
5310 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
5311 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); | |
5312 } | 5257 } |
5313 } | 5258 } |
5314 } | 5259 } |
5315 // 4D864C: using guessed type char byte_4D864C; | 5260 // 4D864C: using guessed type char byte_4D864C; |
5316 | 5261 |
8969 | 8914 |
8970 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | 8915 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
8971 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | 8916 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
8972 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | 8917 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
8973 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | 8918 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); |
8974 | |
8975 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"))); | 8919 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"))); |
8976 | |
8977 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | 8920 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
8978 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | 8921 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); |
8979 } | 8922 } |
8980 | 8923 |
8981 | 8924 |
9014 v13[0].pos.z = v6; | 8957 v13[0].pos.z = v6; |
9015 v13[1].pos.z = v6; | 8958 v13[1].pos.z = v6; |
9016 v13[0].diffuse = sDiffuseBegin; | 8959 v13[0].diffuse = sDiffuseBegin; |
9017 v13[1].diffuse = sDiffuseEnd; | 8960 v13[1].diffuse = sDiffuseEnd; |
9018 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | 8961 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
9019 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 8962 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_LINELIST, |
9020 D3DPT_LINELIST, | |
9021 452, | 8963 452, |
9022 v13, | 8964 v13, |
9023 2, | 8965 2, |
9024 16)); | 8966 16)); |
9025 } | 8967 } |
9094 | 9036 |
9095 | 9037 |
9096 //----- (0049C095) -------------------------------------------------------- | 9038 //----- (0049C095) -------------------------------------------------------- |
9097 void Render::DrawDecal(Decal *pDecal, float z_bias) | 9039 void Render::DrawDecal(Decal *pDecal, float z_bias) |
9098 { | 9040 { |
9099 signed int v21; // [sp+Ch] [bp-864h]@15 | 9041 signed int dwFlags; // [sp+Ch] [bp-864h]@15 |
9100 RenderVertexD3D3 pVerticesD3D[64]; // [sp+20h] [bp-850h]@6 | 9042 RenderVertexD3D3 pVerticesD3D[64]; // [sp+20h] [bp-850h]@6 |
9101 | 9043 |
9102 if (pDecal->uNumVertices < 3) | 9044 if (pDecal->uNumVertices < 3) |
9103 { | 9045 { |
9104 Log::Warning(L"Decal has < 3 vertices"); | 9046 Log::Warning(L"Decal has < 3 vertices"); |
9125 | 9067 |
9126 uint uFinalR = floorf(uTintR / 255.0 * color_mult * uDecalColorMultR + 0.0f), | 9068 uint uFinalR = floorf(uTintR / 255.0 * color_mult * uDecalColorMultR + 0.0f), |
9127 uFinalG = floorf(uTintG / 255.0 * color_mult * uDecalColorMultG + 0.0f), | 9069 uFinalG = floorf(uTintG / 255.0 * color_mult * uDecalColorMultG + 0.0f), |
9128 uFinalB = floorf(uTintB / 255.0 * color_mult * uDecalColorMultB + 0.0f); | 9070 uFinalB = floorf(uTintB / 255.0 * color_mult * uDecalColorMultB + 0.0f); |
9129 | 9071 |
9130 | |
9131 float v15; | 9072 float v15; |
9132 if (fabs(z_bias) < 1e-5) | 9073 if (fabs(z_bias) < 1e-5) |
9133 v15 = 1.0 - 1.0 / ((1.0f / pGame->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0); | 9074 v15 = 1.0 - 1.0 / ((1.0f / pGame->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0); |
9134 else | 9075 else |
9135 { | 9076 { |
9136 v15 = 1.0 - 1.0 / ((1.0f / pGame->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0) - z_bias; | 9077 v15 = 1.0 - 1.0 / ((1.0f / pGame->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0) - z_bias; |
9137 if (v15 < 0.000099999997) | 9078 if (v15 < 0.000099999997) |
9138 v15 = 0.000099999997; | 9079 v15 = 0.000099999997; |
9139 } | 9080 } |
9140 | |
9141 pVerticesD3D[i].pos.z = v15; | |
9142 | 9081 |
9143 pVerticesD3D[i].pos.x = pDecal->pVertices[i].vWorldViewProjX; | 9082 pVerticesD3D[i].pos.x = pDecal->pVertices[i].vWorldViewProjX; |
9144 pVerticesD3D[i].pos.y = pDecal->pVertices[i].vWorldViewProjY; | 9083 pVerticesD3D[i].pos.y = pDecal->pVertices[i].vWorldViewProjY; |
9084 pVerticesD3D[i].pos.z = v15; | |
9085 | |
9086 pVerticesD3D[i].rhw = 1.0 / pDecal->pVertices[i].vWorldViewPosition.x; | |
9087 pVerticesD3D[i].diffuse = (uFinalR << 16) | (uFinalG << 8) | uFinalB; | |
9088 pVerticesD3D[i].specular = 0; | |
9089 | |
9145 pVerticesD3D[i].texcoord.x = pDecal->pVertices[i].u; | 9090 pVerticesD3D[i].texcoord.x = pDecal->pVertices[i].u; |
9146 pVerticesD3D[i].texcoord.y = pDecal->pVertices[i].v; | 9091 pVerticesD3D[i].texcoord.y = pDecal->pVertices[i].v; |
9147 pVerticesD3D[i].diffuse = (uFinalR << 16) | (uFinalG << 8) | uFinalB; | |
9148 pVerticesD3D[i].specular = 0; | |
9149 pVerticesD3D[i].rhw = 1.0 / pDecal->pVertices[i].vWorldViewPosition.x; | |
9150 } | 9092 } |
9151 | 9093 |
9152 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | 9094 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
9153 v21 = D3DDP_DONOTLIGHT | D3DDP_DONOTCLIP | D3DDP_DONOTUPDATEEXTENTS; | 9095 dwFlags = D3DDP_DONOTLIGHT | D3DDP_DONOTCLIP | D3DDP_DONOTUPDATEEXTENTS; |
9154 else | 9096 else |
9155 v21 = D3DDP_DONOTLIGHT; | 9097 dwFlags = D3DDP_DONOTLIGHT; |
9156 | 9098 |
9157 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 9099 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
9158 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 9100 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
9159 pVerticesD3D, | 9101 pVerticesD3D, pDecal->uNumVertices, dwFlags)); |
9160 pDecal->uNumVertices, | |
9161 v21)); | |
9162 } | 9102 } |
9163 | 9103 |
9164 | 9104 |
9165 void Render::DrawSpecialEffectsQuad(const RenderVertexD3D3 *vertices, IDirect3DTexture2 *texture) | 9105 void Render::DrawSpecialEffectsQuad(const RenderVertexD3D3 *vertices, IDirect3DTexture2 *texture) |
9166 { | 9106 { |