Mercurial > mm7
changeset 1394:8ea496564034
Some LightmapBuilder renames.
author | Nomad |
---|---|
date | Thu, 18 Jul 2013 16:51:35 +0200 |
parents | 28f87f5234a1 |
children | 8d4ec56416ef |
files | Chest.cpp GUIWindow.cpp Game.cpp Game.h Indoor.cpp LightmapBuilder.cpp LightmapBuilder.h Render.cpp |
diffstat | 8 files changed, 61 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/Chest.cpp Thu Jul 18 16:11:57 2013 +0200 +++ b/Chest.cpp Thu Jul 18 16:51:35 2013 +0200 @@ -285,18 +285,18 @@ chest_offs_y = pChestPixelOffsetY[chestBitmapId]; chestWidthCells = pChestWidthsByType[chestBitmapId]; chestHeghtCells = pChestHeightsByType[chestBitmapId]; - sprintf(pTmpBuf.data(), "chest%02d", pChestList->pChests[chestBitmapId].uTextureID); + sprintfex(pTmpBuf.data(), "chest%02d", pChestList->pChests[chestBitmapId].uTextureID); v5 = pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); pRenderer->DrawTextureIndexed(8u, 8u, pIcons_LOD->GetTexture(v5)); - for (item_counter = 0; item_counter< chestWidthCells * chestHeghtCells; ++item_counter) + for (item_counter = 0; item_counter < chestWidthCells * chestHeghtCells; ++item_counter) { chest_item_index = pChests[uChestID].pInventoryIndices[item_counter]; if ( chest_item_index > 0 ) { item_texture_id = pIcons_LOD->LoadTexture( //pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName, - pItemsTable->pItems[pChests[uChestID].igChestItems[chest_item_index-1].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pItemsTable->pItems[pChests[uChestID].igChestItems[chest_item_index - 1].uItemID].pIconName, TEXTURE_16BIT_PALETTE); item_texture = pIcons_LOD->GetTexture(item_texture_id); itemPixelWidth = item_texture->uTextureWidth; itemPixelHeght = item_texture->uTextureHeight; @@ -522,7 +522,6 @@ //----- (0042013E) -------------------------------------------------------- void Chest::PlaceItemAt( unsigned int put_cell_pos, unsigned int item_at_cell, signed int uChestID ) { - int uItemID; // edi@1 int v6; // edx@4 unsigned int v7; // eax@5
--- a/GUIWindow.cpp Thu Jul 18 16:11:57 2013 +0200 +++ b/GUIWindow.cpp Thu Jul 18 16:51:35 2013 +0200 @@ -1156,7 +1156,7 @@ v8 = pGlobalTXT_LocalizationStrings[57]; if ( v18 <= 1 ) v8 = pGlobalTXT_LocalizationStrings[56]; - sprintf(pTmpBuf2.data(), "%d %s ", v18, v8); + sprintfex(pTmpBuf2.data(), "%d %s ", v18, v8); strcat(pTmpBuf.data(), pTmpBuf2.data()); } if ( v7 ) @@ -1165,7 +1165,7 @@ v9 = pGlobalTXT_LocalizationStrings[109]; else v9 = pGlobalTXT_LocalizationStrings[110]; - sprintf(pTmpBuf2.data(), "%d %s ", v7, v9); + sprintfex(pTmpBuf2.data(), "%d %s ", v7, v9); strcat(pTmpBuf.data(), pTmpBuf2.data()); } if ( v16 && !v18 ) @@ -1174,7 +1174,7 @@ v10 = pGlobalTXT_LocalizationStrings[437];//"Minute" else v10 = pGlobalTXT_LocalizationStrings[436]; //"Minutes" - sprintf(pTmpBuf2.data(), "%d %s ", v16, v10); + sprintfex(pTmpBuf2.data(), "%d %s ", v16, v10); strcat(pTmpBuf.data(), pTmpBuf2.data()); } if ( v17 && !v7 ) @@ -1183,7 +1183,7 @@ v11 = pGlobalTXT_LocalizationStrings[439]; //"Second" else v11 = pGlobalTXT_LocalizationStrings[438]; //"Seconds" - sprintf(pTmpBuf2.data(), "%d %s ", v17, v11); + sprintfex(pTmpBuf2.data(), "%d %s ", v17, v11); strcat(pTmpBuf.data(), pTmpBuf2.data()); } v12 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
--- a/Game.cpp Thu Jul 18 16:11:57 2013 +0200 +++ b/Game.cpp Thu Jul 18 16:51:35 2013 +0200 @@ -130,7 +130,7 @@ if (pRenderer->pRenderD3D) { pDecalBuilder->DrawBloodsplats(); - pGame->pLightmapBuilder->DrawLightmaps(2); + pGame->pLightmapBuilder->DrawLightmapsType(2); } } }
--- a/Game.h Thu Jul 18 16:11:57 2013 +0200 +++ b/Game.h Thu Jul 18 16:51:35 2013 +0200 @@ -2,6 +2,7 @@ #include "VectorTypes.h" +#define GAME_FLAGS_1_01 0x01 #define GAME_FLAGS_1_DRAW_BLV_DEBUGS 0x08 #define GAME_FLAGS_2_SATURATE_LIGHTMAPS 0x02 #define GAME_FLAGS_2_ALTER_GRAVITY 0x08
--- a/Indoor.cpp Thu Jul 18 16:11:57 2013 +0200 +++ b/Indoor.cpp Thu Jul 18 16:51:35 2013 +0200 @@ -584,7 +584,7 @@ } else { - v17 = 0xFFD0D0D0; + v17 = 0xFF808080; v23 = pFace->uBitmapID; v27 = pBitmaps_LOD->pHardwareTextures[v23]; }
--- 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));
--- a/LightmapBuilder.h Thu Jul 18 16:11:57 2013 +0200 +++ b/LightmapBuilder.h Thu Jul 18 16:51:35 2013 +0200 @@ -35,11 +35,11 @@ virtual ~LightmapBuilder() //----- (0045BBAA) {} - void DoDrawLightmaps(); + void Draw_183808_Lightmaps(); bool DrawLightmap(Lightmap *a1, Vec3_float_ *pColorMult, float z_bias); - bool DrawLightmaps2(float a2); - char _45D74F_MessWithLight(int a2, int *a3); - void DrawLightmaps(int a2); + bool DoDraw_183808_Lightmaps(float a2); + bool DrawLightmaps(int *indices = nullptr); + void DrawLightmapsType(int type); bool DrawDebugOutlines(char bit_one_for_list1__bit_two_for_list2); double _45D643(struct Edge *a1, float a2); int _45D426(struct Span *a1, struct Edge **a2, unsigned int a3, struct Edge *a4, int a5);
--- a/Render.cpp Thu Jul 18 16:11:57 2013 +0200 +++ b/Render.cpp Thu Jul 18 16:51:35 2013 +0200 @@ -2473,10 +2473,10 @@ if ( v7->std__vector_000004_size) a2 = 0xFFFFFFFF; pGame->AlterGamma_ODM(a4, &a2); - if ( byte_4D864C && pGame->uFlags & 1 ) + if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) { v8 = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); - v7->_45D74F_MessWithLight(v8, 0); + v7->DrawLightmaps(/*v8, 0*/); } else { @@ -2568,7 +2568,7 @@ //v50 = (const char *)v5->pRenderD3D->pDevice; ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); //(*(void (**)(void))(*(int *)v50 + 88))(); - v53->_45D74F_MessWithLight(-1, 0); + v53->DrawLightmaps(/*-1, 0*/); for (uint i = 0; i < uNumVertices; ++i) { d3d_vertex_buffer[i].diffuse = a2; @@ -5378,10 +5378,10 @@ /* v9 = pGame->pLightmapBuilder; v65 = v9; v10 = v9->std__vector_000004_size;*/ - if ( byte_4D864C && pGame->uFlags & 1 ) + if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) { v11 = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); - pGame->pLightmapBuilder->_45D74F_MessWithLight(v11, 0); + pGame->pLightmapBuilder->DrawLightmaps(/*v11, 0*/); } else { @@ -5475,7 +5475,7 @@ //v63 = (const char *)v7->pRenderD3D->pDevice; ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); //(*(void (**)(void))(*(int *)v63 + 88))(); - pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); + pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); for (uint i = 0; i < uNumVertices; ++i) { d3d_vertex_buffer[i].diffuse = -1; @@ -6103,7 +6103,7 @@ else uColor = uCorrectedColor = 0xFF109010; } - if (byte_4D864C && pGame->uFlags & 1) + if (byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01) { __debugbreak(); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); @@ -6128,7 +6128,7 @@ d3d_vertex_buffer, uNumVertices, 28)); - pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); + pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); } else { @@ -6208,7 +6208,7 @@ 28)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); - pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0); + pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); for (uint i = 0; i < uNumVertices; ++i) d3d_vertex_buffer[i].diffuse = uCorrectedColor;