Mercurial > mm7
diff LightmapBuilder.cpp @ 1394:8ea496564034
Some LightmapBuilder renames.
author | Nomad |
---|---|
date | Thu, 18 Jul 2013 16:51:35 +0200 |
parents | cc9a3a24d61d |
children | c9e3b93ec570 |
line wrap: on
line diff
--- a/LightmapBuilder.cpp Thu Jul 18 16:11:57 2013 +0200 +++ b/LightmapBuilder.cpp Thu Jul 18 16:51:35 2013 +0200 @@ -1577,14 +1577,14 @@ } //----- (0045D73F) -------------------------------------------------------- -void LightmapBuilder::DrawLightmaps(int a2) +void LightmapBuilder::DrawLightmapsType(int type) { - if ( a2 == 2 ) - DoDrawLightmaps(); + if (type == 2) + Draw_183808_Lightmaps(); } //----- (0045D74F) -------------------------------------------------------- -char LightmapBuilder::_45D74F_MessWithLight(int a2, int *a3) +bool LightmapBuilder::DrawLightmaps(int *indices) { //char v3; // zf@1 IDirect3DDevice3 *v4; // eax@2 @@ -1596,7 +1596,7 @@ HRESULT v10; // eax@8 HRESULT v11; // eax@8 HRESULT v12; // eax@8 - int *v13; // eax@8 + //int *v13; // eax@8 //float v14; // ecx@15 //IDirect3DDevice3 *v15; // eax@21 //HRESULT v16; // eax@21 @@ -1613,79 +1613,65 @@ Lightmap *v28; // [sp+50h] [bp-38h]@2 int v29; // [sp+54h] [bp-34h]@2 //float v30; // [sp+58h] [bp-30h]@2 - int arg4; // [sp+68h] [bp-20h]@8 - float v32; // [sp+6Ch] [bp-1Ch]@8 - float v33; // [sp+70h] [bp-18h]@8 + Vec3_float_ arg4; + //int arg4; // [sp+68h] [bp-20h]@8 + //float v32; // [sp+6Ch] [bp-1Ch]@8 + //float v33; // [sp+70h] [bp-18h]@8 int v34; // [sp+74h] [bp-14h]@19 int v35; // [sp+78h] [bp-10h]@2 - int *v36; // [sp+7Ch] [bp-Ch]@10 + //int *v36; // [sp+7Ch] [bp-Ch]@10 //int a1; // [sp+80h] [bp-8h]@12 //float v38; // [sp+84h] [bp-4h]@1 if (std__vector_000004_size == 0) return 1; - __debugbreak(); - //v30 = 0.0; - //v4 = pRenderer->pRenderD3D->pDevice; - ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3)); - //v6 = (char *)stru_69BD44.c_str(); - //if ( !stru_69BD44.c_str() ) - // v6 = (char *)&dword_4D86F0; - v7 = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"); - if ( pRenderer->bUsingSpecular ) - pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0); - if ( !byte_4D864C || !(pGame->uFlags & 1) ) - { + + ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP)); + + v7 = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"); + if ( pRenderer->bUsingSpecular ) + pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE); + + if ( !byte_4D864C || !(pGame->uFlags & GAME_FLAGS_1_01) ) + { ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, v7)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); - v13 = a3; - v33 = 1.0; - v32 = 1.0; - *(float *)&arg4 = 1.0; - if ( a3 ) + + arg4.x = 1.0f; + arg4.y = 1.0f; + arg4.z = 1.0f; + if (indices) { - if ( *a3 != -1 ) + for (auto i = indices; *i != -1; ++i) { - v36 = a3; - do - { - v28 = &std__vector_000004[*v13]; - if ( !DrawLightmap(v28, (Vec3_float_ *)&arg4, 0.0) ) - assert(false && "Invalid lightmap detected!"); - v13 = v36 + 1; - v36 = v13; - } - while ( *v13 != -1 ); + v28 = &std__vector_000004[*i]; + if ( !DrawLightmap(v28, &arg4, 0.0) ) + assert(false && "Invalid lightmap detected!"); } } else { - v36 = 0; - if (std__vector_000004_size > 0 ) + for (auto i = 0; i < std__vector_000004_size; ++i) { - while ( 1 ) - { - auto _a1 = &std__vector_000004[(int)v36]; - if ( !DrawLightmap(_a1, (Vec3_float_ *)&arg4, 0.0) ) + auto _a1 = &std__vector_000004[(int)i]; + if ( !DrawLightmap(_a1, &arg4, 0.0) ) { MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0); v35 = 5080812; } - v36 = (int *)((char *)v36 + 1); - if ( (signed int)v36 >= std__vector_000004_size) - break; - } } } + ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); - } + } + if ( pRenderer->bUsingSpecular ) { //LODWORD(v30) = 1; @@ -1701,12 +1687,12 @@ ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); } - return 1; + return true; } //----- (0045DA56) -------------------------------------------------------- -bool LightmapBuilder::DrawLightmaps2(float z_bias) +bool LightmapBuilder::DoDraw_183808_Lightmaps(float z_bias) { Vec3_float_ v; // [sp+Ch] [bp-1Ch]@2 v.z = 1.0; @@ -1791,7 +1777,7 @@ } //----- (0045DCA9) -------------------------------------------------------- -void LightmapBuilder::DoDrawLightmaps() +void LightmapBuilder::Draw_183808_Lightmaps() { if (!std__vector_183808_size) return; @@ -1810,7 +1796,7 @@ ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); - DrawLightmaps2(0.00050000002); + DoDraw_183808_Lightmaps(0.00050000002); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO));