comparison LightmapBuilder.cpp @ 1980:c1c74df0a33e

changing most of auto types to their actual types
author Grumpy7
date Wed, 30 Oct 2013 00:47:37 -0700
parents 2c71fa8913d2
children d28d3c006077
comparison
equal deleted inserted replaced
1979:92dfa0cafbe3 1980:c1c74df0a33e
564 } 564 }
565 565
566 //----- (0045C7F6) -------------------------------------------------------- 566 //----- (0045C7F6) --------------------------------------------------------
567 bool LightmapBuilder::ApplyLights_IndoorFace(unsigned int uFaceID) 567 bool LightmapBuilder::ApplyLights_IndoorFace(unsigned int uFaceID)
568 { 568 {
569 auto pFace = &pIndoor->pFaces[uFaceID]; 569 BLVFace* pFace = &pIndoor->pFaces[uFaceID];
570 auto pSector = pIndoor->pSectors + pFace->uSectorID; 570 BLVSector* pSector = &pIndoor->pSectors[pFace->uSectorID];
571 571
572 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + pSector->uMinAmbientLightLevel) << 16; 572 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + pSector->uMinAmbientLightLevel) << 16;
573 573
574 uint uNumLightsApplied = 0; 574 uint uNumLightsApplied = 0;
575 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i) 575 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i)
583 for (uint i = 0; i < pSector->uNumLights; ++i) 583 for (uint i = 0; i < pSector->uNumLights; ++i)
584 { 584 {
585 if (uNumLightsApplied >= 20 ) 585 if (uNumLightsApplied >= 20 )
586 break; 586 break;
587 587
588 auto pLight = &pIndoor->pLights[pSector->pLights[i]]; 588 BLVLightMM7* pLight = &pIndoor->pLights[pSector->pLights[i]];
589 if (~pLight->uAtributes & 0x08) 589 if (~pLight->uAtributes & 0x08)
590 ApplyLight_BLV((StationaryLight *)pLight, pFace, &uFaceID, false, &byte_4E94D0); 590 ApplyLight_BLV((StationaryLight *)pLight, pFace, &uFaceID, false, &byte_4E94D0);
591 } 591 }
592 592
593 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) 593 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i)
621 (double)pLight->vPosition.y * a2->pFacePlane.vNormal.y + 621 (double)pLight->vPosition.y * a2->pFacePlane.vNormal.y +
622 (double)pLight->vPosition.x * a2->pFacePlane.vNormal.x + 622 (double)pLight->vPosition.x * a2->pFacePlane.vNormal.x +
623 a2->pFacePlane.dist; 623 a2->pFacePlane.dist;
624 if ((bLightBackfaces || v13 >= 0.0f) && fabsf(v13) <= pLight->uRadius) 624 if ((bLightBackfaces || v13 >= 0.0f) && fabsf(v13) <= pLight->uRadius)
625 { 625 {
626 auto slot = *pSlot; 626 unsigned int slot = *pSlot;
627 627
628 stru_F8AD28._blv_lights_radii[slot] = pLight->uRadius; 628 stru_F8AD28._blv_lights_radii[slot] = pLight->uRadius;
629 stru_F8AD28._blv_lights_inv_radii[slot] = 65536 / pLight->uRadius; 629 stru_F8AD28._blv_lights_inv_radii[slot] = 65536 / pLight->uRadius;
630 stru_F8AD28._blv_lights_xs[slot] = pLight->vPosition.x; 630 stru_F8AD28._blv_lights_xs[slot] = pLight->vPosition.x;
631 stru_F8AD28._blv_lights_ys[slot] = pLight->vPosition.y; 631 stru_F8AD28._blv_lights_ys[slot] = pLight->vPosition.y;
1430 arg4.x = 1.0f; 1430 arg4.x = 1.0f;
1431 arg4.y = 1.0f; 1431 arg4.y = 1.0f;
1432 arg4.z = 1.0f; 1432 arg4.z = 1.0f;
1433 if (indices) 1433 if (indices)
1434 { 1434 {
1435 for (auto i = indices; *i != -1; ++i) 1435 for (int* i = indices; *i != -1; ++i)
1436 { 1436 {
1437 v28 = &std__vector_000004[*i]; 1437 v28 = &std__vector_000004[*i];
1438 if ( !DrawLightmap(v28, &arg4, 0.0) ) 1438 if ( !DrawLightmap(v28, &arg4, 0.0) )
1439 Error("Invalid lightmap detected! (%u)", *i); 1439 Error("Invalid lightmap detected! (%u)", *i);
1440 } 1440 }
1441 } 1441 }
1442 else 1442 else
1443 { 1443 {
1444 for (auto i = 0; i < std__vector_000004_size; ++i) 1444 for (unsigned int i = 0; i < std__vector_000004_size; ++i)
1445 { 1445 {
1446 auto _a1 = &std__vector_000004[(int)i]; 1446 Lightmap* _a1 = &std__vector_000004[(int)i];
1447 if ( !DrawLightmap(_a1, &arg4, 0.0) ) 1447 if ( !DrawLightmap(_a1, &arg4, 0.0) )
1448 { 1448 {
1449 MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0); 1449 MessageBoxW(nullptr, L"Invalid lightmap detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:1238", 0);
1450 v35 = 5080812; 1450 v35 = 5080812;
1451 } 1451 }
1574 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); 1574 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE));
1575 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); 1575 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE));
1576 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); 1576 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE));
1577 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); 1577 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE));
1578 1578
1579 auto pTex = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"); 1579 IDirect3DTexture2* pTex = pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03");
1580 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTex)); 1580 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, pTex));
1581 1581
1582 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); 1582 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
1583 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); 1583 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE));
1584 1584