comparison LightmapBuilder.cpp @ 1390:613c77e51e38

Messed with spell effects drawing a bit.
author Nomad
date Thu, 18 Jul 2013 04:08:20 +0200
parents 1803172dffd9
children cc9a3a24d61d
comparison
equal deleted inserted replaced
1389:4dc34f7acb0b 1390:613c77e51e38
1 #include <assert.h>
2
1 #include "LightmapBuilder.h" 3 #include "LightmapBuilder.h"
2 #include "Game.h" 4 #include "Game.h"
3 #include "stru314.h" 5 #include "stru314.h"
4 #include "Outdoor.h" 6 #include "Outdoor.h"
5 #include "Outdoor_stuff.h" 7 #include "Outdoor_stuff.h"
1582 } 1584 }
1583 1585
1584 //----- (0045D74F) -------------------------------------------------------- 1586 //----- (0045D74F) --------------------------------------------------------
1585 char LightmapBuilder::_45D74F_MessWithLight(int a2, int *a3) 1587 char LightmapBuilder::_45D74F_MessWithLight(int a2, int *a3)
1586 { 1588 {
1587 char v3; // zf@1 1589 //char v3; // zf@1
1588 IDirect3DDevice3 *v4; // eax@2 1590 IDirect3DDevice3 *v4; // eax@2
1589 HRESULT v5; // eax@2 1591 HRESULT v5; // eax@2
1590 //char *v6; // eax@2 1592 //char *v6; // eax@2
1591 struct IDirect3DTexture2 *v7; // edi@4 1593 struct IDirect3DTexture2 *v7; // edi@4
1592 HRESULT v8; // eax@8 1594 HRESULT v8; // eax@8
1593 HRESULT v9; // eax@8 1595 HRESULT v9; // eax@8
1594 HRESULT v10; // eax@8 1596 HRESULT v10; // eax@8
1595 HRESULT v11; // eax@8 1597 HRESULT v11; // eax@8
1596 HRESULT v12; // eax@8 1598 HRESULT v12; // eax@8
1597 int *v13; // eax@8 1599 int *v13; // eax@8
1598 float v14; // ecx@15 1600 //float v14; // ecx@15
1599 IDirect3DDevice3 *v15; // eax@21 1601 //IDirect3DDevice3 *v15; // eax@21
1600 HRESULT v16; // eax@21 1602 //HRESULT v16; // eax@21
1601 IDirect3DDevice3 *v17; // eax@21 1603 //IDirect3DDevice3 *v17; // eax@21
1602 HRESULT v18; // eax@21 1604 //HRESULT v18; // eax@21
1603 IDirect3DDevice3 *v19; // eax@21 1605 //IDirect3DDevice3 *v19; // eax@21
1604 HRESULT v20; // eax@21 1606 //HRESULT v20; // eax@21
1605 IDirect3DDevice3 *v21; // eax@21 1607 //IDirect3DDevice3 *v21; // eax@21
1606 HRESULT v22; // eax@21 1608 //HRESULT v22; // eax@21
1607 //IDirect3DDevice3 *v23; // eax@23 1609 //IDirect3DDevice3 *v23; // eax@23
1608 std::string v25; // [sp+44h] [bp-44h]@12 1610 std::string v25; // [sp+44h] [bp-44h]@12
1609 signed int v26; // [sp+48h] [bp-40h]@21 1611 signed int v26; // [sp+48h] [bp-40h]@21
1610 signed int v27; // [sp+4Ch] [bp-3Ch]@21 1612 signed int v27; // [sp+4Ch] [bp-3Ch]@21
1611 Lightmap *v28; // [sp+50h] [bp-38h]@2 1613 Lightmap *v28; // [sp+50h] [bp-38h]@2
1615 float v32; // [sp+6Ch] [bp-1Ch]@8 1617 float v32; // [sp+6Ch] [bp-1Ch]@8
1616 float v33; // [sp+70h] [bp-18h]@8 1618 float v33; // [sp+70h] [bp-18h]@8
1617 int v34; // [sp+74h] [bp-14h]@19 1619 int v34; // [sp+74h] [bp-14h]@19
1618 int v35; // [sp+78h] [bp-10h]@2 1620 int v35; // [sp+78h] [bp-10h]@2
1619 int *v36; // [sp+7Ch] [bp-Ch]@10 1621 int *v36; // [sp+7Ch] [bp-Ch]@10
1620 int a1; // [sp+80h] [bp-8h]@12 1622 //int a1; // [sp+80h] [bp-8h]@12
1621 float v38; // [sp+84h] [bp-4h]@1 1623 //float v38; // [sp+84h] [bp-4h]@1
1622 1624
1623 v3 = this->std__vector_000004_size == 0; 1625 if (std__vector_000004_size == 0)
1624 LODWORD(v38) = (int)this; 1626 return 1;
1625 if ( !v3 ) 1627
1626 { 1628 __debugbreak();
1627 //v30 = 0.0; 1629 //v30 = 0.0;
1628 //v4 = pRenderer->pRenderD3D->pDevice; 1630 //v4 = pRenderer->pRenderD3D->pDevice;
1629 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3u)); 1631 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3));
1630 //v6 = (char *)stru_69BD44.c_str(); 1632 //v6 = (char *)stru_69BD44.c_str();
1631 //if ( !stru_69BD44.c_str() ) 1633 //if ( !stru_69BD44.c_str() )
1632 // v6 = (char *)&dword_4D86F0; 1634 // v6 = (char *)&dword_4D86F0;
1633 v7 = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"); 1635 v7 = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03");
1634 if ( pRenderer->bUsingSpecular ) 1636 if ( pRenderer->bUsingSpecular )
1649 if ( *a3 != -1 ) 1651 if ( *a3 != -1 )
1650 { 1652 {
1651 v36 = a3; 1653 v36 = a3;
1652 do 1654 do
1653 { 1655 {
1654 v28 = (Lightmap *)(3100 * *v13 + LODWORD(v38) + 4); 1656 v28 = &std__vector_000004[*v13];
1655 if ( !DrawLightmap(v28, (Vec3_float_ *)&arg4, 0.0) ) 1657 if ( !DrawLightmap(v28, (Vec3_float_ *)&arg4, 0.0) )
1656 { 1658 assert(false && "Invalid lightmap detected!");
1657 MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1230", 0);
1658 a1 = 5080812;
1659 }
1660 v13 = v36 + 1; 1659 v13 = v36 + 1;
1661 v36 = v13; 1660 v36 = v13;
1662 } 1661 }
1663 while ( *v13 != -1 ); 1662 while ( *v13 != -1 );
1664 } 1663 }
1665 } 1664 }
1666 else 1665 else
1667 { 1666 {
1668 v14 = v38;
1669 v36 = 0; 1667 v36 = 0;
1670 if ( *(unsigned int *)(LODWORD(v38) + 1587204) > 0 ) 1668 if (std__vector_000004_size > 0 )
1671 { 1669 {
1672 a1 = LODWORD(v38) + 4;
1673 while ( 1 ) 1670 while ( 1 )
1674 { 1671 {
1675 if ( !DrawLightmap((Lightmap *)a1, (Vec3_float_ *)&arg4, 0.0) ) 1672 auto _a1 = &std__vector_000004[(int)v36];
1673 if ( !DrawLightmap(_a1, (Vec3_float_ *)&arg4, 0.0) )
1676 { 1674 {
1677 MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0); 1675 MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0);
1678 v35 = 5080812; 1676 v35 = 5080812;
1679 } 1677 }
1680 v36 = (int *)((char *)v36 + 1); 1678 v36 = (int *)((char *)v36 + 1);
1681 a1 += 3100; 1679 if ( (signed int)v36 >= std__vector_000004_size)
1682 if ( (signed int)v36 >= *(unsigned int *)(LODWORD(v38) + 1587204) )
1683 break; 1680 break;
1684 v14 = v38;
1685 } 1681 }
1686 } 1682 }
1687 } 1683 }
1688 v15 = pRenderer->pRenderD3D->pDevice; 1684 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
1689 ErrD3D(v15->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); 1685 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO));
1690 ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); 1686 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE));
1691 ErrD3D(v15->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE)); 1687 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
1692 ErrD3D(v15->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE));
1693 } 1688 }
1694 if ( pRenderer->bUsingSpecular ) 1689 if ( pRenderer->bUsingSpecular )
1695 { 1690 {
1696 //LODWORD(v30) = 1; 1691 //LODWORD(v30) = 1;
1697 //v29 = 28; 1692 //v29 = 28;
1703 //v28 = (Lightmap *)v23; 1698 //v28 = (Lightmap *)v23;
1704 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, pRenderer->uFogColor)); 1699 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, pRenderer->uFogColor));
1705 //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice; 1700 //v28 = (Lightmap *)pRenderer->pRenderD3D->pDevice;
1706 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0)); 1701 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, 0));
1707 } 1702 }
1708 } 1703
1709 return 1; 1704 return 1;
1710 } 1705 }
1711 1706
1712 1707
1713 //----- (0045DA56) -------------------------------------------------------- 1708 //----- (0045DA56) --------------------------------------------------------