comparison LightmapBuilder.cpp @ 1394:8ea496564034

Some LightmapBuilder renames.
author Nomad
date Thu, 18 Jul 2013 16:51:35 +0200
parents cc9a3a24d61d
children c9e3b93ec570
comparison
equal deleted inserted replaced
1393:28f87f5234a1 1394:8ea496564034
1575 LOBYTE(result) = 1; 1575 LOBYTE(result) = 1;
1576 return result; 1576 return result;
1577 } 1577 }
1578 1578
1579 //----- (0045D73F) -------------------------------------------------------- 1579 //----- (0045D73F) --------------------------------------------------------
1580 void LightmapBuilder::DrawLightmaps(int a2) 1580 void LightmapBuilder::DrawLightmapsType(int type)
1581 { 1581 {
1582 if ( a2 == 2 ) 1582 if (type == 2)
1583 DoDrawLightmaps(); 1583 Draw_183808_Lightmaps();
1584 } 1584 }
1585 1585
1586 //----- (0045D74F) -------------------------------------------------------- 1586 //----- (0045D74F) --------------------------------------------------------
1587 char LightmapBuilder::_45D74F_MessWithLight(int a2, int *a3) 1587 bool LightmapBuilder::DrawLightmaps(int *indices)
1588 { 1588 {
1589 //char v3; // zf@1 1589 //char v3; // zf@1
1590 IDirect3DDevice3 *v4; // eax@2 1590 IDirect3DDevice3 *v4; // eax@2
1591 HRESULT v5; // eax@2 1591 HRESULT v5; // eax@2
1592 //char *v6; // eax@2 1592 //char *v6; // eax@2
1594 HRESULT v8; // eax@8 1594 HRESULT v8; // eax@8
1595 HRESULT v9; // eax@8 1595 HRESULT v9; // eax@8
1596 HRESULT v10; // eax@8 1596 HRESULT v10; // eax@8
1597 HRESULT v11; // eax@8 1597 HRESULT v11; // eax@8
1598 HRESULT v12; // eax@8 1598 HRESULT v12; // eax@8
1599 int *v13; // eax@8 1599 //int *v13; // eax@8
1600 //float v14; // ecx@15 1600 //float v14; // ecx@15
1601 //IDirect3DDevice3 *v15; // eax@21 1601 //IDirect3DDevice3 *v15; // eax@21
1602 //HRESULT v16; // eax@21 1602 //HRESULT v16; // eax@21
1603 //IDirect3DDevice3 *v17; // eax@21 1603 //IDirect3DDevice3 *v17; // eax@21
1604 //HRESULT v18; // eax@21 1604 //HRESULT v18; // eax@21
1611 signed int v26; // [sp+48h] [bp-40h]@21 1611 signed int v26; // [sp+48h] [bp-40h]@21
1612 signed int v27; // [sp+4Ch] [bp-3Ch]@21 1612 signed int v27; // [sp+4Ch] [bp-3Ch]@21
1613 Lightmap *v28; // [sp+50h] [bp-38h]@2 1613 Lightmap *v28; // [sp+50h] [bp-38h]@2
1614 int v29; // [sp+54h] [bp-34h]@2 1614 int v29; // [sp+54h] [bp-34h]@2
1615 //float v30; // [sp+58h] [bp-30h]@2 1615 //float v30; // [sp+58h] [bp-30h]@2
1616 int arg4; // [sp+68h] [bp-20h]@8 1616 Vec3_float_ arg4;
1617 float v32; // [sp+6Ch] [bp-1Ch]@8 1617 //int arg4; // [sp+68h] [bp-20h]@8
1618 float v33; // [sp+70h] [bp-18h]@8 1618 //float v32; // [sp+6Ch] [bp-1Ch]@8
1619 //float v33; // [sp+70h] [bp-18h]@8
1619 int v34; // [sp+74h] [bp-14h]@19 1620 int v34; // [sp+74h] [bp-14h]@19
1620 int v35; // [sp+78h] [bp-10h]@2 1621 int v35; // [sp+78h] [bp-10h]@2
1621 int *v36; // [sp+7Ch] [bp-Ch]@10 1622 //int *v36; // [sp+7Ch] [bp-Ch]@10
1622 //int a1; // [sp+80h] [bp-8h]@12 1623 //int a1; // [sp+80h] [bp-8h]@12
1623 //float v38; // [sp+84h] [bp-4h]@1 1624 //float v38; // [sp+84h] [bp-4h]@1
1624 1625
1625 if (std__vector_000004_size == 0) 1626 if (std__vector_000004_size == 0)
1626 return 1; 1627 return 1;
1627 1628
1628 __debugbreak(); 1629
1629 //v30 = 0.0; 1630 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP));
1630 //v4 = pRenderer->pRenderD3D->pDevice; 1631
1631 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3)); 1632 v7 = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03");
1632 //v6 = (char *)stru_69BD44.c_str(); 1633 if ( pRenderer->bUsingSpecular )
1633 //if ( !stru_69BD44.c_str() ) 1634 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE);
1634 // v6 = (char *)&dword_4D86F0; 1635
1635 v7 = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"); 1636 if ( !byte_4D864C || !(pGame->uFlags & GAME_FLAGS_1_01) )
1636 if ( pRenderer->bUsingSpecular ) 1637 {
1637 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, 0);
1638 if ( !byte_4D864C || !(pGame->uFlags & 1) )
1639 {
1640 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); 1638 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE));
1641 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); 1639 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE));
1642 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, v7)); 1640 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, v7));
1643 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); 1641 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
1644 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); 1642 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE));
1645 v13 = a3; 1643
1646 v33 = 1.0; 1644 arg4.x = 1.0f;
1647 v32 = 1.0; 1645 arg4.y = 1.0f;
1648 *(float *)&arg4 = 1.0; 1646 arg4.z = 1.0f;
1649 if ( a3 ) 1647 if (indices)
1650 { 1648 {
1651 if ( *a3 != -1 ) 1649 for (auto i = indices; *i != -1; ++i)
1652 { 1650 {
1653 v36 = a3; 1651 v28 = &std__vector_000004[*i];
1654 do 1652 if ( !DrawLightmap(v28, &arg4, 0.0) )
1655 { 1653 assert(false && "Invalid lightmap detected!");
1656 v28 = &std__vector_000004[*v13];
1657 if ( !DrawLightmap(v28, (Vec3_float_ *)&arg4, 0.0) )
1658 assert(false && "Invalid lightmap detected!");
1659 v13 = v36 + 1;
1660 v36 = v13;
1661 }
1662 while ( *v13 != -1 );
1663 } 1654 }
1664 } 1655 }
1665 else 1656 else
1666 { 1657 {
1667 v36 = 0; 1658 for (auto i = 0; i < std__vector_000004_size; ++i)
1668 if (std__vector_000004_size > 0 )
1669 { 1659 {
1670 while ( 1 ) 1660 auto _a1 = &std__vector_000004[(int)i];
1671 { 1661 if ( !DrawLightmap(_a1, &arg4, 0.0) )
1672 auto _a1 = &std__vector_000004[(int)v36];
1673 if ( !DrawLightmap(_a1, (Vec3_float_ *)&arg4, 0.0) )
1674 { 1662 {
1675 MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0); 1663 MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0);
1676 v35 = 5080812; 1664 v35 = 5080812;
1677 } 1665 }
1678 v36 = (int *)((char *)v36 + 1);
1679 if ( (signed int)v36 >= std__vector_000004_size)
1680 break;
1681 }
1682 } 1666 }
1683 } 1667 }
1668
1684 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); 1669 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
1685 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); 1670 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO));
1686 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); 1671 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE));
1687 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); 1672 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
1688 } 1673 }
1674
1689 if ( pRenderer->bUsingSpecular ) 1675 if ( pRenderer->bUsingSpecular )
1690 { 1676 {
1691 //LODWORD(v30) = 1; 1677 //LODWORD(v30) = 1;
1692 //v29 = 28; 1678 //v29 = 28;
1693 //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice; 1679 //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice;
1699 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, pRenderer->uFogColor)); 1685 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, pRenderer->uFogColor));
1700 //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice; 1686 //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice;
1701 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); 1687 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0));
1702 } 1688 }
1703 1689
1704 return 1; 1690 return true;
1705 } 1691 }
1706 1692
1707 1693
1708 //----- (0045DA56) -------------------------------------------------------- 1694 //----- (0045DA56) --------------------------------------------------------
1709 bool LightmapBuilder::DrawLightmaps2(float z_bias) 1695 bool LightmapBuilder::DoDraw_183808_Lightmaps(float z_bias)
1710 { 1696 {
1711 Vec3_float_ v; // [sp+Ch] [bp-1Ch]@2 1697 Vec3_float_ v; // [sp+Ch] [bp-1Ch]@2
1712 v.z = 1.0; 1698 v.z = 1.0;
1713 v.y = 1.0; 1699 v.y = 1.0;
1714 v.x = 1.0; 1700 v.x = 1.0;
1789 1775
1790 return true; 1776 return true;
1791 } 1777 }
1792 1778
1793 //----- (0045DCA9) -------------------------------------------------------- 1779 //----- (0045DCA9) --------------------------------------------------------
1794 void LightmapBuilder::DoDrawLightmaps() 1780 void LightmapBuilder::Draw_183808_Lightmaps()
1795 { 1781 {
1796 if (!std__vector_183808_size) 1782 if (!std__vector_183808_size)
1797 return; 1783 return;
1798 1784
1799 if (pRenderer->bUsingSpecular) 1785 if (pRenderer->bUsingSpecular)
1808 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTex)); 1794 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTex));
1809 1795
1810 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); 1796 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
1811 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); 1797 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE));
1812 1798
1813 DrawLightmaps2(0.00050000002); 1799 DoDraw_183808_Lightmaps(0.00050000002);
1814 1800
1815 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); 1801 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
1816 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); 1802 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO));
1817 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); 1803 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE));
1818 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE)); 1804 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));