Mercurial > mm7
comparison Render.cpp @ 186:d65528fc3bda
D3D constants, shore tiles, camera flags
author | Nomad |
---|---|
date | Fri, 15 Feb 2013 19:53:40 +0200 |
parents | f102bbff6fd8 |
children | 9b77686e2239 |
comparison
equal
deleted
inserted
replaced
185:16d257ffc802 | 186:d65528fc3bda |
---|---|
50 RenderVertexSoft array_50A2B0[50]; | 50 RenderVertexSoft array_50A2B0[50]; |
51 RenderVertexSoft array_50AC10[50]; | 51 RenderVertexSoft array_50AC10[50]; |
52 | 52 |
53 RenderVertexSoft array_73D150[20]; | 53 RenderVertexSoft array_73D150[20]; |
54 | 54 |
55 RenderVertexD3D3 arary_77E5C8[50]; | 55 RenderVertexD3D3 d3d_vertex_buffer[50]; |
56 | 56 |
57 RenderVertexSoft *ptr_801A04; | 57 RenderVertexSoft *ptr_801A04; |
58 RenderVertexSoft *ptr_801A08; | 58 RenderVertexSoft *ptr_801A08; |
59 | 59 |
60 RenderVertexSoft pVerticesSR_801A10[384]; | 60 RenderVertexSoft pVerticesSR_801A10[384]; |
133 v0 = false; | 133 v0 = false; |
134 pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface1, &pTexture1, true, false, 32u); | 134 pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface1, &pTexture1, true, false, 32u); |
135 pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface2, &pTexture2, true, false, 32u); | 135 pRenderer->pRenderD3D->CreateTexture(64u, 64u, &pSurface2, &pTexture2, true, false, 32u); |
136 | 136 |
137 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture1)); | 137 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture1)); |
138 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); | 138 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
139 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 2u)); | 139 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLOROP, 2u)); |
140 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); | 140 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_COLORARG1, 2u)); |
141 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); | 141 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, 2u)); |
142 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); | 142 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, 2u)); |
143 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 1u)); | 143 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, 1u)); |
144 | 144 |
145 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture2)); | 145 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture2)); |
146 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_ADDRESS, 3u)); | 146 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); |
147 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1u)); | 147 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1u)); |
148 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 7u)); | 148 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLOROP, 7u)); |
149 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG1, 2u)); | 149 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG1, 2u)); |
150 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG2, 1u)); | 150 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_COLORARG2, 1u)); |
151 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MAGFILTER, 2u)); | 151 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(1, D3DTSS_MAGFILTER, 2u)); |
1741 int v64; // [sp+57h] [bp-1h]@2 | 1741 int v64; // [sp+57h] [bp-1h]@2 |
1742 int v62; | 1742 int v62; |
1743 //struct IndoorCameraD3D *pIndoorCameraD3D; | 1743 //struct IndoorCameraD3D *pIndoorCameraD3D; |
1744 //RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6 | 1744 //RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6 |
1745 | 1745 |
1746 | |
1747 //warning: the game uses CW culling by default, ccw is incosistent | |
1748 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW); | |
1749 | |
1750 | |
1746 v63 = 0; | 1751 v63 = 0; |
1747 // basic optimizations | 1752 // basic optimizations |
1748 unsigned int uStartX, uEndX, | 1753 unsigned int uStartX, uEndX, |
1749 uStartZ, uEndZ; | 1754 uStartZ, uEndZ; |
1750 if (pIndoorCamera->sRotationY >= 0 && pIndoorCamera->sRotationY <= 1024) | 1755 if (pIndoorCamera->sRotationY >= 0 && pIndoorCamera->sRotationY <= 1024) |
1780 //pIndoorCameraD3D = pGame->pIndoorCameraD3D; | 1785 //pIndoorCameraD3D = pGame->pIndoorCameraD3D; |
1781 pGame->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1); | 1786 pGame->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1); |
1782 pGame->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); | 1787 pGame->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); |
1783 } | 1788 } |
1784 } | 1789 } |
1790 | |
1785 for (unsigned int z = uStartZ; z < uEndZ - 1; ++z) | 1791 for (unsigned int z = uStartZ; z < uEndZ - 1; ++z) |
1786 { | 1792 { |
1787 for (unsigned int x = uStartX; x < uEndX - 1; ++x) | 1793 for (unsigned int x = uStartX; x < uEndX - 1; ++x) |
1788 { | 1794 { |
1789 v8 = &array_77EC08[pOutdoorCamera->numStru148s]; | 1795 v8 = &array_77EC08[pOutdoorCamera->numStru148s]; |
1794 v8->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z); | 1800 v8->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z); |
1795 //v6 = v8->uTileBitmapID; | 1801 //v6 = v8->uTileBitmapID; |
1796 v8->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v8->uTileBitmapID]; | 1802 v8->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v8->uTileBitmapID]; |
1797 if (v8->uTileBitmapID == 0xFFFF) | 1803 if (v8->uTileBitmapID == 0xFFFF) |
1798 continue; | 1804 continue; |
1805 | |
1799 v8->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(x, z); | 1806 v8->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(x, z); |
1800 v8->field_32 = 0; | 1807 v8->field_32 = 0; |
1801 v8->field_59 = 1; | 1808 v8->field_59 = 1; |
1802 //v8->field_5D = (char)WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8a->vWorldPosition.z) / 2 + 0.5f)); | 1809 //v8->field_5D = (char)WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8a->vWorldPosition.z) / 2 + 0.5f)); |
1803 //v8->field_5C = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f));; | 1810 //v8->field_5C = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f));; |
1834 { | 1841 { |
1835 memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft)); | 1842 memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft)); |
1836 array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); | 1843 array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); |
1837 } | 1844 } |
1838 | 1845 |
1846 bool transparent = false; | |
1839 if ( v8->flags & 2 && v8->uTileBitmapID == pRenderer->field_1036AC_bitmapid ) | 1847 if ( v8->flags & 2 && v8->uTileBitmapID == pRenderer->field_1036AC_bitmapid ) |
1840 { | 1848 { |
1841 //v80 = false; | 1849 //v80 = false; |
1842 v6 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]; | 1850 v6 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]; |
1843 } | 1851 } |
1844 else | 1852 else |
1845 { | 1853 { |
1846 v6 = v8->uTileBitmapID; | 1854 v6 = v8->uTileBitmapID; |
1847 //v80 = true; | 1855 transparent = true; |
1848 } | 1856 } |
1849 | 1857 |
1850 assert(v6 < 1000); // many random crashes here | 1858 assert(v6 < 1000); // many random crashes here |
1851 pRenderer->DrawTerrainPolygon(v8, pBitmaps_LOD->pHardwareTextures[v6]); | 1859 |
1860 // for all shore tiles - draw a tile water under them since they're half-empty | |
1861 if (!strnicmp(pBitmaps_LOD->pTextures[v8->uTileBitmapID].pName, "wtrdr", 5)) // all shore tile filenames are wtrdrXXX | |
1862 { | |
1863 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); // no Z writing: the shore tile will be draw in the same place, so taking care about z-fighting | |
1864 pRenderer->DrawTerrainPolygon(v8->uNumVertices, v8, pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]], false, true); | |
1865 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); | |
1866 | |
1867 } | |
1868 | |
1869 pRenderer->DrawTerrainPolygon(v8->uNumVertices, v8, pBitmaps_LOD->pHardwareTextures[v6], transparent, true); | |
1870 | |
1871 | |
1852 --pOutdoorCamera->numStru148s; | 1872 --pOutdoorCamera->numStru148s; |
1853 --pOutdoorCamera->field_44; | 1873 --pOutdoorCamera->field_44; |
1854 } | 1874 } |
1855 } | 1875 } |
1856 } | 1876 } |
1994 while ( 1 ) | 2014 while ( 1 ) |
1995 { | 2015 { |
1996 v5 = abs(X);//v5 = 13108 | 2016 v5 = abs(X);//v5 = 13108 |
1997 v6 = abs(v83);//v6 = 13108 | 2017 v6 = abs(v83);//v6 = 13108 |
1998 --X; | 2018 --X; |
2019 __debugbreak(); // uncoment & refactor following large if | |
1999 v93 = (int)&stru_76E5C8[(v5 << 7) + v6]; | 2020 v93 = (int)&stru_76E5C8[(v5 << 7) + v6]; |
2000 /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), | 2021 /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), |
2001 v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), | 2022 v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), |
2002 ((a8 = v9, | 2023 ((a8 = v9, |
2003 pVertices = &pVerticesSR_801A10[1] + v7, | 2024 pVertices = &pVerticesSR_801A10[1] + v7, |
2166 //v78 = pBitmaps_LOD->pHardwareTextures[v39]; | 2187 //v78 = pBitmaps_LOD->pHardwareTextures[v39]; |
2167 v16->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v39];// Ritor1: It's temporary | 2188 v16->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v39];// Ritor1: It's temporary |
2168 v77 = (int)v16; | 2189 v77 = (int)v16; |
2169 //v76 = v16->uNumVertices; | 2190 //v76 = v16->uNumVertices; |
2170 //LABEL_161: | 2191 //LABEL_161: |
2171 pRenderer->DrawTerrainPolygon(v16, pBitmaps_LOD->pHardwareTextures[v39]);//pRenderer->DrawTerrainPolygon(v16->uNumVertices, v16, pBitmaps_LOD->pHardwareTextures[v39], false, v80); | 2192 pRenderer->DrawTerrainPolygon(v16->uNumVertices, v16, pBitmaps_LOD->pHardwareTextures[v39], false, v80); |
2172 goto LABEL_162; | 2193 goto LABEL_162; |
2173 } | 2194 } |
2174 v38 = v16; | 2195 v38 = v16; |
2175 LABEL_56: | 2196 LABEL_56: |
2176 v38->_4811A3(); | 2197 v38->_4811A3(); |
2310 else | 2331 else |
2311 { | 2332 { |
2312 v58 = v40->uTileBitmapID; | 2333 v58 = v40->uTileBitmapID; |
2313 v81 = 1; | 2334 v81 = 1; |
2314 } | 2335 } |
2315 pRenderer->DrawTerrainPolygon(v40, pBitmaps_LOD->pHardwareTextures[v58]); | 2336 pRenderer->DrawTerrainPolygon(v40->uNumVertices, v40, pBitmaps_LOD->pHardwareTextures[v58], 0, v81); |
2316 } | 2337 } |
2317 LABEL_112: | 2338 LABEL_112: |
2318 v59 = &array_77EC08[pOutdoorCamera->numStru148s]; | 2339 v59 = &array_77EC08[pOutdoorCamera->numStru148s]; |
2319 //a8 = (RenderVertexSoft *)&array_77EC08[pOutdoorCamera->numStru148s]; | 2340 //a8 = (RenderVertexSoft *)&array_77EC08[pOutdoorCamera->numStru148s]; |
2320 v59->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); | 2341 v59->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); |
2431 //v78 = pBitmaps_LOD->pHardwareTextures[v75]; | 2452 //v78 = pBitmaps_LOD->pHardwareTextures[v75]; |
2432 v71->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v75];// Ritor1: It's temporary | 2453 v71->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v75];// Ritor1: It's temporary |
2433 //v77 = (int)v71; | 2454 //v77 = (int)v71; |
2434 //v76 = v71->uNumVertices; | 2455 //v76 = v71->uNumVertices; |
2435 //goto LABEL_161; | 2456 //goto LABEL_161; |
2436 pRenderer->DrawTerrainPolygon(v71, pBitmaps_LOD->pHardwareTextures[v75]);//pRenderer->DrawTerrainPolygon(v76, (stru148 *)v71, v78, v79, v80); | 2457 pRenderer->DrawTerrainPolygon(v76, (stru148 *)v71, v78, v79, v80); |
2437 goto LABEL_162; | 2458 goto LABEL_162; |
2438 } | 2459 } |
2439 v38 = (stru148 *)v71; | 2460 v38 = (stru148 *)v71; |
2440 goto LABEL_56; | 2461 goto LABEL_56; |
2441 } | 2462 } |
4411 } | 4432 } |
4412 else | 4433 else |
4413 { | 4434 { |
4414 if ( !v54 || byte_4D864C && pGame->uFlags & 2 ) | 4435 if ( !v54 || byte_4D864C && pGame->uFlags & 2 ) |
4415 { | 4436 { |
4416 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u));//Режимы визуализации точечных спрайтов | 4437 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));//Режимы визуализации точечных спрайтов |
4417 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); | 4438 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); |
4418 if (bUsingSpecular) | 4439 if (bUsingSpecular) |
4419 { | 4440 { |
4420 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, true)); | 4441 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
4421 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); | 4442 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
4422 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1)); | 4443 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
4423 } | 4444 } |
4424 if ( (signed int)uNumVertices > 0 ) | 4445 if ( (signed int)uNumVertices > 0 ) |
4425 { | 4446 { |
4426 v45 = (char *)&array_50AC10[0].vWorldViewPosition; | 4447 v45 = (char *)&array_50AC10[0].vWorldViewPosition; |
4427 v57 = (int)&arary_77E5C8[0].pos.y; | 4448 v57 = (int)&d3d_vertex_buffer[0].pos.y; |
4428 v55 = uNumVertices; | 4449 v55 = uNumVertices; |
4429 do | 4450 do |
4430 { | 4451 { |
4431 a2 = GetActorTintColor(a3->field_58, 0, *(float *)v45, 0, 0); | 4452 a2 = GetActorTintColor(a3->field_58, 0, *(float *)v45, 0, 0); |
4432 pGame->_44EE30(a4, (int)&a2); | 4453 pGame->_44EE30(a4, (int)&a2); |
4456 while ( !v18 ); | 4477 while ( !v18 ); |
4457 } | 4478 } |
4458 pRenderD3D->pDevice->SetTexture(0, pTexture); | 4479 pRenderD3D->pDevice->SetTexture(0, pTexture); |
4459 pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 4480 pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
4460 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 4481 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
4461 arary_77E5C8, | 4482 d3d_vertex_buffer, |
4462 uNumVertices, | 4483 uNumVertices, |
4463 D3DDP_DONOTLIGHT); | 4484 D3DDP_DONOTLIGHT); |
4464 } | 4485 } |
4465 else | 4486 else |
4466 { | 4487 { |
4467 if ( (signed int)uNumVertices > 0 ) | 4488 if ( (signed int)uNumVertices > 0 ) |
4468 { | 4489 { |
4469 v9 = (ODMFace *)&arary_77E5C8[0].pos.y; | 4490 v9 = (ODMFace *)&d3d_vertex_buffer[0].pos.y; |
4470 v10 = (char *)&array_50AC10[0].vWorldViewPosition; | 4491 v10 = (char *)&array_50AC10[0].vWorldViewPosition; |
4471 a4 = (ODMFace *)&arary_77E5C8[0].pos.y; | 4492 a4 = (ODMFace *)&d3d_vertex_buffer[0].pos.y; |
4472 v56 = uNumVertices; | 4493 v56 = uNumVertices; |
4473 while ( 1 ) | 4494 while ( 1 ) |
4474 { | 4495 { |
4475 v11 = *(float *)v10 * 1000.0; | 4496 v11 = *(float *)v10 * 1000.0; |
4476 *((int *)v9 - 1) = *((int *)v10 + 3); | 4497 *((int *)v9 - 1) = *((int *)v10 + 3); |
4501 if ( v18 ) | 4522 if ( v18 ) |
4502 break; | 4523 break; |
4503 v9 = a4; | 4524 v9 = a4; |
4504 } | 4525 } |
4505 } | 4526 } |
4506 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); | 4527 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
4507 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); | 4528 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
4508 if (bUsingSpecular) | 4529 if (bUsingSpecular) |
4509 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); | 4530 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
4510 | 4531 |
4511 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | 4532 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
4512 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 4533 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
4513 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | 4534 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, |
4514 arary_77E5C8, | 4535 d3d_vertex_buffer, |
4515 uNumVertices, | 4536 uNumVertices, |
4516 D3DDP_DONOTLIGHT)); | 4537 D3DDP_DONOTLIGHT)); |
4517 //v50 = (const char *)v5->pRenderD3D->pDevice; | 4538 //v50 = (const char *)v5->pRenderD3D->pDevice; |
4518 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | 4539 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
4519 //(*(void (**)(void))(*(int *)v50 + 88))(); | 4540 //(*(void (**)(void))(*(int *)v50 + 88))(); |
4520 v53->_45D74F_MessWithLight(-1, 0); | 4541 v53->_45D74F_MessWithLight(-1, 0); |
4521 v23 = uNumVertices; | 4542 v23 = uNumVertices; |
4522 if ( (signed int)uNumVertices > 0 ) | 4543 if ( (signed int)uNumVertices > 0 ) |
4523 { | 4544 { |
4524 v24 = (char *)&arary_77E5C8[0].diffuse; | 4545 v24 = (char *)&d3d_vertex_buffer[0].diffuse; |
4525 do | 4546 do |
4526 { | 4547 { |
4527 *(int *)v24 = a2; | 4548 *(int *)v24 = a2; |
4528 v24 += 32; | 4549 v24 += 32; |
4529 --v23; | 4550 --v23; |
4530 } | 4551 } |
4531 while ( v23 ); | 4552 while ( v23 ); |
4532 } | 4553 } |
4533 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); | 4554 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); |
4534 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); | 4555 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
4535 if ( !pRenderer->bUsingSpecular ) | 4556 if ( !pRenderer->bUsingSpecular ) |
4536 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true)); | 4557 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
4537 | 4558 |
4538 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, true)); | 4559 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
4539 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 1)); | 4560 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); |
4540 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 3)); | 4561 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); |
4541 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 4562 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
4542 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | 4563 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, |
4543 arary_77E5C8, | 4564 d3d_vertex_buffer, |
4544 uNumVertices, | 4565 uNumVertices, |
4545 D3DDP_DONOTLIGHT)); | 4566 D3DDP_DONOTLIGHT)); |
4546 if (bUsingSpecular) | 4567 if (bUsingSpecular) |
4547 { | 4568 { |
4548 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true)); | 4569 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
4549 | 4570 |
4550 v33 = uNumVertices; | 4571 v33 = uNumVertices; |
4551 if ( (signed int)uNumVertices > 0 ) | 4572 if ( (signed int)uNumVertices > 0 ) |
4552 { | 4573 { |
4553 v34 = (char *)&arary_77E5C8[0].specular; | 4574 v34 = (char *)&d3d_vertex_buffer[0].specular; |
4554 do | 4575 do |
4555 { | 4576 { |
4556 v35 = *(int *)v34; | 4577 v35 = *(int *)v34; |
4557 *(int *)v34 = 0; | 4578 *(int *)v34 = 0; |
4558 v34 += 32; | 4579 v34 += 32; |
4560 *((int *)v34 - 9) = pRenderer->uFogColor | v35 & 0xFF000000; | 4581 *((int *)v34 - 9) = pRenderer->uFogColor | v35 & 0xFF000000; |
4561 } | 4582 } |
4562 while ( v33 ); | 4583 while ( v33 ); |
4563 } | 4584 } |
4564 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | 4585 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
4565 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6)); | 4586 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); |
4566 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 5)); | 4587 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); |
4567 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 4588 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
4568 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, | 4589 D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, |
4569 arary_77E5C8, | 4590 d3d_vertex_buffer, |
4570 uNumVertices, | 4591 uNumVertices, |
4571 D3DDP_DONOTLIGHT)); | 4592 D3DDP_DONOTLIGHT)); |
4572 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, true)); | 4593 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
4573 //v40 = pRenderer->pRenderD3D->pDevice->lpVtbl; | 4594 //v40 = pRenderer->pRenderD3D->pDevice->lpVtbl; |
4574 v41 = GetLevelFogColor(); | 4595 v41 = GetLevelFogColor(); |
4575 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF); | 4596 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF); |
4576 v6 = 0; | 4597 v6 = 0; |
4577 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); | 4598 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0); |
4578 } | 4599 } |
4579 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); | 4600 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
4580 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1)); | 4601 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
4581 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v6)); | 4602 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v6)); |
4582 } | 4603 } |
4583 } | 4604 } |
4584 } | 4605 } |
4585 } | 4606 } |
7205 unsigned int Render::GetActorTintColor(float a2, int a3, int a4, int a5, RenderBillboard *a6) | 7226 unsigned int Render::GetActorTintColor(float a2, int a3, int a4, int a5, RenderBillboard *a6) |
7206 { | 7227 { |
7207 return ::GetActorTintColor(a3, a4, a2, a5, a6); | 7228 return ::GetActorTintColor(a3, a4, a2, a5, a6); |
7208 } | 7229 } |
7209 | 7230 |
7210 void Render::DrawTerrainPolygon(stru148 *a3, IDirect3DTexture2 *pTexture)//new function | 7231 /*void Render::DrawTerrainPolygon_new(stru148 *a3, IDirect3DTexture2 *pTexture)//new function |
7211 { | 7232 { |
7212 int v5; // ebx@1 | 7233 int v5; // ebx@1 |
7213 int v6; // edi@1 | 7234 int v6; // edi@1 |
7214 int v8; // eax@7 | 7235 int v8; // eax@7 |
7215 float v9; // eax@12 | 7236 float v9; // eax@12 |
7265 return; | 7286 return; |
7266 | 7287 |
7267 | 7288 |
7268 | 7289 |
7269 | 7290 |
7270 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1); | 7291 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
7271 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); | 7292 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); |
7272 if (this->bUsingSpecular) | 7293 if (this->bUsingSpecular) |
7273 { | 7294 { |
7274 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1); | 7295 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); |
7275 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2); | 7296 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); |
7276 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1); | 7297 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); |
7277 } | 7298 } |
7278 | 7299 |
7279 pVertices[0].pos.x = array_50AC10[0].vWorldViewProjX; | 7300 pVertices[0].pos.x = array_50AC10[0].vWorldViewProjX; |
7280 pVertices[0].pos.y = array_50AC10[0].vWorldViewProjY; | 7301 pVertices[0].pos.y = array_50AC10[0].vWorldViewProjY; |
7281 pVertices[0].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[0].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); | 7302 pVertices[0].pos.z = 1.0 - 1.0 / (1000 * array_50AC10[0].vWorldViewPosition.x / (double)pOutdoorCamera->shading_dist_mist); |
7317 | 7338 |
7318 | 7339 |
7319 this->pRenderD3D->pDevice->SetTexture(0, pTexture); | 7340 this->pRenderD3D->pDevice->SetTexture(0, pTexture); |
7320 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, 6, D3DDP_DONOTLIGHT); | 7341 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, 6, D3DDP_DONOTLIGHT); |
7321 | 7342 |
7322 } | 7343 }*/ |
7344 | |
7323 //----- (004A26BC) -------------------------------------------------------- | 7345 //----- (004A26BC) -------------------------------------------------------- |
7324 void Render::DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, int a6, int a7) | 7346 void Render::DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders) |
7325 { | 7347 { |
7326 RenderVertexSoft *pVertices; // esi@0 | 7348 //RenderVertexSoft *pVertices; // esi@0 |
7327 int v7; // edi@1 | 7349 //int v7; // edi@1 |
7328 unsigned int v8; // ebx@1 | 7350 unsigned int v8; // ebx@1 |
7329 LightmapBuilder *v9; // esi@3 | 7351 LightmapBuilder *v9; // esi@3 |
7330 unsigned int v10; // edx@3 | 7352 unsigned int v10; // edx@3 |
7331 int v11; // eax@5 | 7353 int v11; // eax@5 |
7332 int v12; // eax@11 | 7354 int v12; // eax@11 |
7364 //IDirect3DDevice3Vtbl *v44; // ebx@28 | 7386 //IDirect3DDevice3Vtbl *v44; // ebx@28 |
7365 unsigned int v45; // eax@28 | 7387 unsigned int v45; // eax@28 |
7366 HRESULT v46; // eax@29 | 7388 HRESULT v46; // eax@29 |
7367 HRESULT v47; // eax@29 | 7389 HRESULT v47; // eax@29 |
7368 HRESULT v48; // eax@29 | 7390 HRESULT v48; // eax@29 |
7369 IDirect3DDevice3 *v49; // eax@35 | 7391 //IDirect3DDevice3 *v49; // eax@35 |
7370 //IDirect3DDevice3Vtbl *v50; // ecx@35 | 7392 //IDirect3DDevice3Vtbl *v50; // ecx@35 |
7371 int v51; // eax@40 | 7393 int v51; // eax@40 |
7372 char *v52; // esi@40 | 7394 char *v52; // esi@40 |
7373 double v53; // st7@42 | 7395 double v53; // st7@42 |
7374 double v54; // st7@42 | 7396 double v54; // st7@42 |
7375 signed int v55; // eax@42 | 7397 signed int v55; // eax@42 |
7376 int v56; // ecx@42 | 7398 int v56; // ecx@42 |
7377 double v57; // st7@42 | 7399 double v57; // st7@42 |
7378 float v58; // ST7C_4@43 | 7400 float v58; // ST7C_4@43 |
7379 int v59; // eax@43 | 7401 int v59; // eax@43 |
7380 signed int v60; // [sp+78h] [bp-14h]@31 | 7402 //signed int v60; // [sp+78h] [bp-14h]@31 |
7381 RenderVertexSoft *v61; // [sp+7Ch] [bp-10h]@3 | 7403 //RenderVertexSoft *v61; // [sp+7Ch] [bp-10h]@3 |
7382 const char *v62; // [sp+80h] [bp-Ch]@0 | 7404 const char *v62; // [sp+80h] [bp-Ch]@0 |
7383 const char *v63; // [sp+80h] [bp-Ch]@19 | 7405 const char *v63; // [sp+80h] [bp-Ch]@19 |
7384 int v64; // [sp+84h] [bp-8h]@0 | 7406 int v64; // [sp+84h] [bp-8h]@0 |
7385 LightmapBuilder *v65; // [sp+88h] [bp-4h]@3 | 7407 LightmapBuilder *v65; // [sp+88h] [bp-4h]@3 |
7386 unsigned int v66; // [sp+88h] [bp-4h]@40 | 7408 unsigned int v66; // [sp+88h] [bp-4h]@40 |
7387 unsigned int a6a; // [sp+A0h] [bp+14h]@11 | 7409 unsigned int a6a; // [sp+A0h] [bp+14h]@11 |
7388 | 7410 int a7; |
7389 v7 = (int)this; | 7411 |
7412 //v7 = (int)this; | |
7390 v8 = 0; | 7413 v8 = 0; |
7391 if ( !this->uNumD3DSceneBegins ) | 7414 if (!this->uNumD3DSceneBegins) |
7392 return; | 7415 return; |
7393 if ( uNumVertices < 3) | 7416 if ( uNumVertices < 3) |
7394 return; | 7417 return; |
7395 | 7418 |
7396 v61 = pVertices; | 7419 //v61 = pVertices; |
7420 | |
7397 /* v9 = pGame->pLightmapBuilder; | 7421 /* v9 = pGame->pLightmapBuilder; |
7398 v65 = v9; | 7422 v65 = v9; |
7399 v10 = v9->std__vector_000004_size;*/ | 7423 v10 = v9->std__vector_000004_size;*/ |
7400 if ( byte_4D864C && pGame->uFlags & 1 ) | 7424 if ( byte_4D864C && pGame->uFlags & 1 ) |
7401 { | 7425 { |
7402 v11 = GetActorTintColor(a4->field_58, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); | 7426 v11 = GetActorTintColor(a4->field_58, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); |
7403 pGame->pLightmapBuilder->_45D74F_MessWithLight(v11, 0); | 7427 pGame->pLightmapBuilder->_45D74F_MessWithLight(v11, 0); |
7404 } | 7428 } |
7405 else | 7429 else |
7406 { | 7430 { |
7407 if ( a6 || !pGame->pLightmapBuilder->std__vector_000004_size || | 7431 if (transparent || !pGame->pLightmapBuilder->std__vector_000004_size || |
7408 byte_4D864C && pGame->uFlags & 2 ) | 7432 byte_4D864C && pGame->uFlags & 2 ) |
7409 { | 7433 { |
7410 if ( (_BYTE)a7 ) | 7434 if (clampAtTextureBorders) |
7411 v60 = 3; | 7435 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP); |
7412 else | 7436 else |
7413 v60 = 1; | 7437 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
7414 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, v60); | 7438 |
7415 if ( a6 || this->bUsingSpecular ) | 7439 if (transparent || this->bUsingSpecular) |
7416 { | 7440 { |
7417 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1); | 7441 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); |
7418 v49 = this->pRenderD3D->pDevice; | 7442 if (transparent) |
7419 //v50 = v49->lpVtbl; | |
7420 if ( a6 ) | |
7421 { | 7443 { |
7422 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5); | 7444 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA); |
7423 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6); | 7445 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA); |
7446 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO); | |
7447 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); | |
7424 } | 7448 } |
7425 else | 7449 else |
7426 { | 7450 { |
7427 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2); | 7451 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); |
7428 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1); | 7452 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); |
7429 __debugbreak;//it's error | |
7430 } | 7453 } |
7431 | 7454 } |
7432 } | 7455 if (uNumVertices > 0) |
7433 if ( (signed int)uNumVertices > 0 ) | 7456 { |
7434 { | 7457 v51 = (int)&d3d_vertex_buffer[0].pos.y; |
7435 v51 = (int)&arary_77E5C8[0].pos.y; | |
7436 v52 = (char *)&array_50AC10[0].vWorldViewPosition; | 7458 v52 = (char *)&array_50AC10[0].vWorldViewPosition; |
7437 a7 = (int)&arary_77E5C8[0].pos.y; | 7459 a7 = (int)&d3d_vertex_buffer[0].pos.y; |
7438 v66 = uNumVertices; | 7460 v66 = uNumVertices; |
7439 while ( 1 ) | 7461 while ( 1 ) |
7440 { | 7462 { |
7441 v53 = *(float *)v52 * 1000.0; | 7463 v53 = *(float *)v52 * 1000.0; |
7442 *(int *)(v51 - 4) = *((int *)v52 + 3); | 7464 *(int *)(v51 - 4) = *((int *)v52 + 3); |
7468 break; | 7490 break; |
7469 v51 = a7; | 7491 v51 = a7; |
7470 } | 7492 } |
7471 } | 7493 } |
7472 this->pRenderD3D->pDevice->SetTexture(0, a5); | 7494 this->pRenderD3D->pDevice->SetTexture(0, a5); |
7473 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7495 this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, d3d_vertex_buffer, uNumVertices, 16); |
7474 arary_77E5C8, uNumVertices, 16); | 7496 if (transparent) |
7475 if ( a6 ) | 7497 { |
7476 { | 7498 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); |
7477 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); | 7499 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
7478 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); | 7500 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
7479 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); | |
7480 } | 7501 } |
7481 } | 7502 } |
7482 else | 7503 else |
7483 { | 7504 { |
7484 if ( (signed int)uNumVertices > 0 ) | 7505 if ( (signed int)uNumVertices > 0 ) |
7485 { | 7506 { |
7486 v12 = (int)&arary_77E5C8[0].pos.y; | 7507 v12 = (int)&d3d_vertex_buffer[0].pos.y; |
7487 v13 = (char *)&array_50AC10[0].vWorldViewPosition; | 7508 v13 = (char *)&array_50AC10[0].vWorldViewPosition; |
7488 a7 = (int)&arary_77E5C8[0].pos.y; | 7509 a7 = (int)&d3d_vertex_buffer[0].pos.y; |
7489 a6a = uNumVertices; | 7510 a6a = uNumVertices; |
7490 while ( 1 ) | 7511 while ( 1 ) |
7491 { | 7512 { |
7492 v14 = *(float *)v13 * 1000.0; | 7513 v14 = *(float *)v13 * 1000.0; |
7493 *(int *)(v12 - 4) = *((int *)v13 + 3); | 7514 *(int *)(v12 - 4) = *((int *)v13 + 3); |
7518 if ( v21 ) | 7539 if ( v21 ) |
7519 break; | 7540 break; |
7520 v12 = a7; | 7541 v12 = a7; |
7521 } | 7542 } |
7522 } | 7543 } |
7523 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); | 7544 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
7524 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); | 7545 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7525 if ( pRenderer->bUsingSpecular ) | 7546 if (pRenderer->bUsingSpecular) |
7526 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); | 7547 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
7527 | 7548 |
7528 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | 7549 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); |
7529 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 7550 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
7530 D3DPT_TRIANGLEFAN, | |
7531 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7551 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
7532 arary_77E5C8, | 7552 d3d_vertex_buffer, |
7533 uNumVertices, | 7553 uNumVertices, |
7534 16)); | 7554 16)); |
7535 //v63 = (const char *)v7->pRenderD3D->pDevice; | 7555 //v63 = (const char *)v7->pRenderD3D->pDevice; |
7536 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1)); | 7556 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
7537 //(*(void (**)(void))(*(int *)v63 + 88))(); | 7557 //(*(void (**)(void))(*(int *)v63 + 88))(); |
7538 pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); | 7558 pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); |
7539 v26 = uNumVertices; | 7559 v26 = uNumVertices; |
7540 if ( (signed int)uNumVertices > 0 ) | 7560 if ( (signed int)uNumVertices > 0 ) |
7541 { | 7561 { |
7542 v27 = (char *)&arary_77E5C8[0].diffuse; | 7562 v27 = (char *)&d3d_vertex_buffer[0].diffuse; |
7543 do | 7563 do |
7544 { | 7564 { |
7545 *(int *)v27 = -1; | 7565 *(int *)v27 = -1; |
7546 v27 += 32; | 7566 v27 += 32; |
7547 --v26; | 7567 --v26; |
7548 } | 7568 } |
7549 while ( v26 ); | 7569 while ( v26 ); |
7550 } | 7570 } |
7551 ErrD3D(pRenderD3D->pDevice->SetTexture(0, a5)); | 7571 ErrD3D(pRenderD3D->pDevice->SetTexture(0, a5)); |
7552 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); | 7572 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7553 if ( !pRenderer->bUsingSpecular ) | 7573 if ( !pRenderer->bUsingSpecular ) |
7554 { | 7574 { |
7555 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); | 7575 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
7556 } | 7576 } |
7557 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); | 7577 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
7558 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 1u)); | 7578 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); |
7559 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 3u)); | 7579 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); |
7560 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 7580 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
7561 D3DPT_TRIANGLEFAN, | |
7562 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7581 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
7563 arary_77E5C8, | 7582 d3d_vertex_buffer, |
7564 uNumVertices, | 7583 uNumVertices, |
7565 16)); | 7584 16)); |
7566 if ( pRenderer->bUsingSpecular ) | 7585 if ( pRenderer->bUsingSpecular ) |
7567 { | 7586 { |
7568 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); | 7587 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
7569 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | 7588 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); |
7570 v37 = uNumVertices; | 7589 v37 = uNumVertices; |
7571 if ( (signed int)uNumVertices > 0 ) | 7590 if ( (signed int)uNumVertices > 0 ) |
7572 { | 7591 { |
7573 v38 = (char *)&arary_77E5C8[0].specular; | 7592 v38 = (char *)&d3d_vertex_buffer[0].specular; |
7574 do | 7593 do |
7575 { | 7594 { |
7576 v39 = *(int *)v38; | 7595 v39 = *(int *)v38; |
7577 *(int *)v38 = 0; | 7596 *(int *)v38 = 0; |
7578 v38 += 32; | 7597 v38 += 32; |
7580 *((int *)v38 - 9) = pRenderer->uFogColor | v39 & 0xFF000000; | 7599 *((int *)v38 - 9) = pRenderer->uFogColor | v39 & 0xFF000000; |
7581 } | 7600 } |
7582 while ( v37 ); | 7601 while ( v37 ); |
7583 } | 7602 } |
7584 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));//problem | 7603 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));//problem |
7585 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6u)); | 7604 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_INVSRCALPHA)); |
7586 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 5u)); | 7605 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA)); |
7587 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 7606 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
7588 D3DPT_TRIANGLEFAN, | |
7589 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7607 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
7590 arary_77E5C8, | 7608 d3d_vertex_buffer, |
7591 uNumVertices, | 7609 uNumVertices, |
7592 16)); | 7610 16)); |
7593 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1)); | 7611 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
7594 //v44 = pRenderer->pRenderD3D->pDevice; | 7612 //v44 = pRenderer->pRenderD3D->pDevice; |
7595 v45 = GetLevelFogColor(); | 7613 v45 = GetLevelFogColor(); |
7596 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, v45 & 0xFFFFFF)); | 7614 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, v45 & 0xFFFFFF)); |
7597 v8 = 0; | 7615 v8 = 0; |
7598 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | 7616 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); |
7599 } | 7617 } |
7600 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); | 7618 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
7601 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); | 7619 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
7602 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v8)); | 7620 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v8)); |
7603 } | 7621 } |
7604 } | 7622 } |
7605 if ( pIndoorCamera->field_4C & 2 || pBLVRenderParams->uFlags & 2 ) | 7623 |
7606 pGame->pIndoorCameraD3D->debug_outline_d3d(arary_77E5C8, uNumVertices, 0xFFFFFFu, 0.0); | 7624 if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_D3D_OUTLINES || |
7625 pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_D3D_OUTLINES ) | |
7626 pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0); | |
7607 } | 7627 } |
7608 | 7628 |
7609 // 4A26BC: could not find valid save-restore pair for esi | 7629 // 4A26BC: could not find valid save-restore pair for esi |
7610 // 4D864C: using guessed type char byte_4D864C; | 7630 // 4D864C: using guessed type char byte_4D864C; |
7611 | 7631 |
7621 if (!this->uNumD3DSceneBegins) | 7641 if (!this->uNumD3DSceneBegins) |
7622 return; | 7642 return; |
7623 | 7643 |
7624 if (uNumVertices >= 3) | 7644 if (uNumVertices >= 3) |
7625 { | 7645 { |
7626 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1); | 7646 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
7627 if (this->bUsingSpecular) | 7647 if (this->bUsingSpecular) |
7628 { | 7648 { |
7629 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1); | 7649 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); |
7630 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2); | 7650 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); |
7631 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1); | 7651 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); |
7632 } | 7652 } |
7633 | 7653 |
7634 for (i = 0; i < uNumVertices; ++i) | 7654 for (i = 0; i < uNumVertices; ++i) |
7635 { | 7655 { |
7636 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; | 7656 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; |
7664 v4 = (int)this; | 7684 v4 = (int)this; |
7665 if ( !this->uNumD3DSceneBegins ) | 7685 if ( !this->uNumD3DSceneBegins ) |
7666 return; | 7686 return; |
7667 if ( uNumVertices >= 3 ) | 7687 if ( uNumVertices >= 3 ) |
7668 { | 7688 { |
7669 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1); | 7689 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
7670 if ( this->bUsingSpecular ) | 7690 if ( this->bUsingSpecular ) |
7671 { | 7691 { |
7672 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1); | 7692 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); |
7673 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2); | 7693 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); |
7674 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1); | 7694 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); |
7675 } | 7695 } |
7676 for (i = 0; i < uNumVertices; ++i) | 7696 for (i = 0; i < uNumVertices; ++i) |
7677 { | 7697 { |
7678 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; | 7698 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; |
7679 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; | 7699 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; |
7713 if ( this->uNumD3DSceneBegins ) | 7733 if ( this->uNumD3DSceneBegins ) |
7714 { | 7734 { |
7715 v4 = a2; | 7735 v4 = a2; |
7716 if ( a2 >= 3 ) | 7736 if ( a2 >= 3 ) |
7717 { | 7737 { |
7718 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1u)); | 7738 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7719 v5 = 31 - (a3->field_58 & 0x1F); | 7739 v5 = 31 - (a3->field_58 & 0x1F); |
7720 if ( v5 < pOutdoor->field_CBC_terrain_triangles_shade_type ) | 7740 if ( v5 < pOutdoor->field_CBC_terrain_triangles_shade_type ) |
7721 v5 = pOutdoor->field_CBC_terrain_triangles_shade_type; | 7741 v5 = pOutdoor->field_CBC_terrain_triangles_shade_type; |
7722 v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); | 7742 v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); |
7723 if ( a2 > 0 ) | 7743 if ( a2 > 0 ) |
7724 { | 7744 { |
7725 v7 = (char *)&arary_77E5C8[0].pos.y; | 7745 v7 = (char *)&d3d_vertex_buffer[0].pos.y; |
7726 v8 = (char *)&array_507D30[0].vWorldViewProjY; | 7746 v8 = (char *)&array_507D30[0].vWorldViewProjY; |
7727 do | 7747 do |
7728 { | 7748 { |
7729 v9 = *((float *)v8 - 4) * 0.061758894; | 7749 v9 = *((float *)v8 - 4) * 0.061758894; |
7730 v10 = *((int *)v8 - 1); | 7750 v10 = *((int *)v8 - 1); |
7742 *((float *)v7 - 7) = 1.0 - 1.0 / v9; | 7762 *((float *)v7 - 7) = 1.0 - 1.0 / v9; |
7743 } | 7763 } |
7744 while ( v4 ); | 7764 while ( v4 ); |
7745 } | 7765 } |
7746 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); | 7766 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
7747 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 7767 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
7748 D3DPT_TRIANGLEFAN, | |
7749 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7768 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
7750 arary_77E5C8, | 7769 d3d_vertex_buffer, |
7751 a2, | 7770 a2, |
7752 28)); | 7771 28)); |
7753 } | 7772 } |
7754 } | 7773 } |
7755 } | 7774 } |
7808 | 7827 |
7809 if (byte_4D864C && pGame->uFlags & 1) | 7828 if (byte_4D864C && pGame->uFlags & 1) |
7810 { | 7829 { |
7811 __debugbreak(); | 7830 __debugbreak(); |
7812 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); | 7831 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); |
7813 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1)); | 7832 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7814 if ( (signed int)uNumVertices > 0 ) | 7833 if ( (signed int)uNumVertices > 0 ) |
7815 { | 7834 { |
7816 v12 = (char *)&array_507D30[0].vWorldViewPosition; | 7835 v12 = (char *)&array_507D30[0].vWorldViewPosition; |
7817 v13 = (char *)&arary_77E5C8[0].pos.y; | 7836 v13 = (char *)&d3d_vertex_buffer[0].pos.y; |
7818 auto a7 = uNumVertices; | 7837 auto a7 = uNumVertices; |
7819 uint v18; | 7838 uint v18; |
7820 do | 7839 do |
7821 { | 7840 { |
7822 v14 = *(float *)v12 * 0.061758894; | 7841 v14 = *(float *)v12 * 0.061758894; |
7838 pHwTex = (IDirect3DTexture2 *)v19->uTextureHeight; | 7857 pHwTex = (IDirect3DTexture2 *)v19->uTextureHeight; |
7839 *((float *)v13 - 2) = *((float *)v12 - 5) / (double)(signed int)pHwTex; | 7858 *((float *)v13 - 2) = *((float *)v12 - 5) / (double)(signed int)pHwTex; |
7840 } | 7859 } |
7841 while ( !v18 ); | 7860 while ( !v18 ); |
7842 } | 7861 } |
7843 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1)); | 7862 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7844 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | 7863 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
7845 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 7864 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( |
7846 D3DPT_TRIANGLEFAN, | 7865 D3DPT_TRIANGLEFAN, |
7847 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7866 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
7848 arary_77E5C8, | 7867 d3d_vertex_buffer, |
7849 uNumVertices, | 7868 uNumVertices, |
7850 28)); | 7869 28)); |
7851 pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); | 7870 pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); |
7852 } | 7871 } |
7853 else | 7872 else |
7855 if (!pGame->pLightmapBuilder->std__vector_000004_size || | 7874 if (!pGame->pLightmapBuilder->std__vector_000004_size || |
7856 byte_4D864C && pGame->uFlags & 2) | 7875 byte_4D864C && pGame->uFlags & 2) |
7857 { | 7876 { |
7858 for (uint i = 0; i < uNumVertices; ++i) | 7877 for (uint i = 0; i < uNumVertices; ++i) |
7859 { | 7878 { |
7860 arary_77E5C8[i].pos.x = array_507D30[i].vWorldViewProjX; | 7879 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; |
7861 arary_77E5C8[i].pos.y = array_507D30[i].vWorldViewProjY; | 7880 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; |
7862 arary_77E5C8[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); | 7881 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); |
7863 arary_77E5C8[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; | 7882 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; |
7864 arary_77E5C8[i].diffuse = uCorrectedColor; | 7883 d3d_vertex_buffer[i].diffuse = uCorrectedColor; |
7865 arary_77E5C8[i].specular = 0; | 7884 d3d_vertex_buffer[i].specular = 0; |
7866 arary_77E5C8[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; | 7885 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; |
7867 arary_77E5C8[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; | 7886 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; |
7868 } | 7887 } |
7869 | 7888 |
7870 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1)); | 7889 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7871 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); | 7890 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
7872 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 7891 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
7873 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7892 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
7874 arary_77E5C8, | 7893 d3d_vertex_buffer, |
7875 uNumVertices, | 7894 uNumVertices, |
7876 28)); | 7895 28)); |
7877 } | 7896 } |
7878 else | 7897 else |
7879 { | 7898 { |
7880 __debugbreak(); | 7899 __debugbreak(); |
7881 if ( (signed int)uNumVertices > 0 ) | 7900 if ( (signed int)uNumVertices > 0 ) |
7882 { | 7901 { |
7883 v23 = pTex; | 7902 v23 = pTex; |
7884 v24 = (char *)&array_507D30[0].vWorldViewPosition; | 7903 v24 = (char *)&array_507D30[0].vWorldViewPosition; |
7885 v25 = (char *)&arary_77E5C8[0].pos.y; | 7904 v25 = (char *)&d3d_vertex_buffer[0].pos.y; |
7886 pTex = (Texture *)uNumVertices; | 7905 pTex = (Texture *)uNumVertices; |
7887 uint v18; | 7906 uint v18; |
7888 do | 7907 do |
7889 { | 7908 { |
7890 v26 = *(float *)v24 * 0.061758894; | 7909 v26 = *(float *)v24 * 0.061758894; |
7906 *((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight; | 7925 *((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight; |
7907 } | 7926 } |
7908 while ( !v18 ); | 7927 while ( !v18 ); |
7909 } | 7928 } |
7910 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); | 7929 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); |
7911 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1)); | 7930 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7912 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | 7931 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
7913 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 7932 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
7914 D3DPT_TRIANGLEFAN, | |
7915 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7933 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
7916 arary_77E5C8, | 7934 d3d_vertex_buffer, |
7917 uNumVertices, | 7935 uNumVertices, |
7918 28)); | 7936 28)); |
7919 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1)); | 7937 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1)); |
7920 pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); | 7938 pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); |
7921 v33 = uNumVertices; | 7939 v33 = uNumVertices; |
7922 if ( (signed int)uNumVertices > 0 ) | 7940 if ( (signed int)uNumVertices > 0 ) |
7923 { | 7941 { |
7924 v34 = (char *)&arary_77E5C8[0].diffuse; | 7942 v34 = (char *)&d3d_vertex_buffer[0].diffuse; |
7925 do | 7943 do |
7926 { | 7944 { |
7927 *(int *)v34 = uCorrectedColor; | 7945 *(int *)v34 = uCorrectedColor; |
7928 v34 += 32; | 7946 v34 += 32; |
7929 --v33; | 7947 --v33; |
7930 } | 7948 } |
7931 while ( v33 ); | 7949 while ( v33 ); |
7932 } | 7950 } |
7933 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); | 7951 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
7934 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 1)); | 7952 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7935 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); | 7953 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
7936 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, true)); | 7954 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
7937 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 1)); | 7955 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ZERO)); |
7938 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 3)); | 7956 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR)); |
7939 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 7957 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
7940 D3DPT_TRIANGLEFAN, | |
7941 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7958 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
7942 arary_77E5C8, | 7959 d3d_vertex_buffer, |
7943 uNumVertices, | 7960 uNumVertices, |
7944 28)); | 7961 28)); |
7945 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); | 7962 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
7946 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1)); | 7963 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
7947 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, false)); | 7964 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); |
7948 } | 7965 } |
7949 } | 7966 } |
7950 } | 7967 } |
7951 // 4D864C: using guessed type char byte_4D864C; | 7968 // 4D864C: using guessed type char byte_4D864C; |
7952 | 7969 |
8706 v29[2].texcoord.y = 1.0; | 8723 v29[2].texcoord.y = 1.0; |
8707 v29[3].pos.x = srcX - v17; | 8724 v29[3].pos.x = srcX - v17; |
8708 v29[3].pos.y = v18 + srcY; | 8725 v29[3].pos.y = v18 + srcY; |
8709 v29[3].texcoord.x = 0.0; | 8726 v29[3].texcoord.x = 0.0; |
8710 v29[3].texcoord.y = 0.0; | 8727 v29[3].texcoord.y = 0.0; |
8711 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); | 8728 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
8712 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); | 8729 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
8713 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u)); | 8730 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); |
8714 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0)); | 8731 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); |
8715 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); | 8732 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
8716 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1u)); | 8733 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
8717 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, a9)); | 8734 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, a9)); |
8718 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive( | 8735 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive( |
8719 D3DPT_TRIANGLEFAN, | 8736 D3DPT_TRIANGLEFAN, |
8720 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 8737 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
8721 v29, | 8738 v29, |
8722 4, | 8739 4, |
8723 24)); | 8740 24)); |
8724 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); | 8741 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); |
8725 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); | 8742 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
8726 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); | 8743 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
8727 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u)); | 8744 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); |
8728 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); | 8745 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
8729 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 2u)); | 8746 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); |
8730 } | 8747 } |
8731 | 8748 |
8732 | 8749 |
8733 //----- (004A4CC9) -------------------------------------------------------- | 8750 //----- (004A4CC9) -------------------------------------------------------- |
8734 void Render::_4A4CC9(stru6_stru1_indoor_sw_billboard *a1, int a2) | 8751 void Render::_4A4CC9(stru6_stru1_indoor_sw_billboard *a1, int a2) |
9184 v36[3].pos.z = 0.0; | 9201 v36[3].pos.z = 0.0; |
9185 v36[3].rhw = 1.0; | 9202 v36[3].rhw = 1.0; |
9186 v36[3].texcoord.x = 0.0; | 9203 v36[3].texcoord.x = 0.0; |
9187 v36[3].texcoord.y = 0.0; | 9204 v36[3].texcoord.y = 0.0; |
9188 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); | 9205 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); |
9189 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); | 9206 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
9190 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); | 9207 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
9191 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); | 9208 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
9192 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5u)); | 9209 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA)); |
9193 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6u)); | 9210 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); |
9194 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0)); | 9211 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); |
9195 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 8u)); | 9212 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS)); |
9196 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 9213 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( |
9197 D3DPT_TRIANGLEFAN, | 9214 D3DPT_TRIANGLEFAN, |
9198 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 9215 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
9199 v36, | 9216 v36, |
9200 4, | 9217 4, |
9201 28)); | 9218 28)); |
9202 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); | 9219 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
9203 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); | 9220 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
9204 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); | 9221 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); |
9205 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1u)); | 9222 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
9206 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u)); | 9223 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); |
9207 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, 2u)); | 9224 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESS)); |
9208 } | 9225 } |
9209 else | 9226 else |
9210 { | 9227 { |
9211 v40 = (1.0 - a3) * 65536.0; | 9228 v40 = (1.0 - a3) * 65536.0; |
9212 v39 = v40 + 6.7553994e15; | 9229 v39 = v40 + 6.7553994e15; |
11293 | 11310 |
11294 | 11311 |
11295 //----- (004A1C1E) -------------------------------------------------------- | 11312 //----- (004A1C1E) -------------------------------------------------------- |
11296 void DoRenderBillboards_D3D() | 11313 void DoRenderBillboards_D3D() |
11297 { | 11314 { |
11298 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3u)); | 11315 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); |
11299 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); | 11316 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
11300 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); | 11317 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
11301 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | 11318 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
11302 | 11319 |
11303 /*if (pRenderer->uNumBillboardsToDraw) | 11320 /*if (pRenderer->uNumBillboardsToDraw) |
11304 { | 11321 { |
11305 auto p = &pRenderer->pBillboardRenderListD3D[0]; | 11322 auto p = &pRenderer->pBillboardRenderListD3D[0]; |
11346 } | 11363 } |
11347 | 11364 |
11348 if (pRenderer->bFogEnabled) | 11365 if (pRenderer->bFogEnabled) |
11349 { | 11366 { |
11350 pRenderer->bFogEnabled = false; | 11367 pRenderer->bFogEnabled = false; |
11351 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1)); | 11368 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
11352 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); | 11369 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); |
11353 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | 11370 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); |
11354 } | 11371 } |
11355 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 2)); | 11372 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); |
11356 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1)); | 11373 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE)); |
11357 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 0)); | 11374 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); |
11358 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2u)); | 11375 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
11359 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1u)); | 11376 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); |
11360 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1u)); | 11377 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); |
11361 } | 11378 } |
11362 | 11379 |
11363 | 11380 |
11364 | 11381 |
11365 | 11382 |
11372 case RenderBillboardD3D::Transparent: | 11389 case RenderBillboardD3D::Transparent: |
11373 { | 11390 { |
11374 if (pRenderer->bFogEnabled) | 11391 if (pRenderer->bFogEnabled) |
11375 { | 11392 { |
11376 pRenderer->bFogEnabled = false; | 11393 pRenderer->bFogEnabled = false; |
11377 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 1u)); | 11394 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE)); |
11378 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); | 11395 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, GetLevelFogColor() & 0xFFFFFF)); |
11379 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); | 11396 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); |
11380 } | 11397 } |
11381 | 11398 |
11382 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5)); | 11399 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA)); |
11383 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6u)); | 11400 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA)); |
11384 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 1)); | 11401 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); |
11385 } | 11402 } |
11386 break; | 11403 break; |
11387 | 11404 |
11388 case RenderBillboardD3D::Opaque_1: | 11405 case RenderBillboardD3D::Opaque_1: |
11389 case RenderBillboardD3D::Opaque_2: | 11406 case RenderBillboardD3D::Opaque_2: |
11392 if (pRenderer->bUsingSpecular) | 11409 if (pRenderer->bUsingSpecular) |
11393 { | 11410 { |
11394 if (!pRenderer->bFogEnabled) | 11411 if (!pRenderer->bFogEnabled) |
11395 { | 11412 { |
11396 pRenderer->bFogEnabled = true; | 11413 pRenderer->bFogEnabled = true; |
11397 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0)); | 11414 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE)); |
11398 } | 11415 } |
11399 } | 11416 } |
11400 | 11417 |
11401 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); | 11418 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
11402 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 2u)); | 11419 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); |
11403 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, 0)); | 11420 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); |
11404 } | 11421 } |
11405 break; | 11422 break; |
11406 | 11423 |
11407 default: | 11424 default: |
11408 Log::Warning(L"SetBillboardBlendOptions: invalid opacity type (%u)", a1); | 11425 Log::Warning(L"SetBillboardBlendOptions: invalid opacity type (%u)", a1); |