Mercurial > might-and-magic-trilogy
changeset 133:b07ebaa9a30d
Слияние
author | Ritor1 |
---|---|
date | Tue, 13 Nov 2012 20:37:07 +0600 |
parents | 8981a63bb559 (current diff) 918dca162239 (diff) |
children | 6d1f537a1346 |
files | Indoor.cpp |
diffstat | 10 files changed, 80 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Wed Nov 07 23:47:35 2012 +0600 +++ b/Indoor.cpp Tue Nov 13 20:37:07 2012 +0600 @@ -47,8 +47,8 @@ stru320 stru_F8AD28; // idb stru337 stru_F81018; stru167_wrap array_5118E8; -stru170_stru2 stru_F8A590; -stru170 *pStru170 = new stru170; // idb +BspRenderer_stru2 stru_F8A590; +BspRenderer *pBspRenderer = new BspRenderer; // idb stru141 stru_721530; stru352 stru_F83B80[480]; @@ -110,15 +110,15 @@ floorf(pParty->flt_TorchlightColorB + 0.5f), byte_4E94D0); } - PrepareWallsRenderList_BLV(); + PrepareBspRenderList_BLV(); PrepareItemsRenderList_BLV(); PrepareActorRenderList_BLV(); v6 = 0; - for ( i = 0; i < pStru170->uNumVisibleNotEmptySectors; ++i ) + for ( i = 0; i < pBspRenderer->uNumVisibleNotEmptySectors; ++i ) { - v7 = pStru170->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6]; + v7 = pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6]; v12 = 0; - v8 = &pIndoor->pSectors[pStru170->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6]]; + v8 = &pIndoor->pSectors[pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6]]; v9 = v8->pDecorationIDs; if ( v8->uNumDecorations > 0 ) { @@ -271,28 +271,28 @@ if (bD3D) { pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); - for (uint i = 0; i < pStru170->uNumFaceIDs; ++i) + for (uint i = 0; i < pBspRenderer->uNumFaceIDs; ++i) { - v2 = pStru170->pFaceIDs[2 * i + 1]; - if ( pStru170->field_FA8[v2].std__vector_0007A8 == -1 ) + v2 = pBspRenderer->pFaceIDs[2 * i + 1]; + if ( pBspRenderer->field_FA8[v2].std__vector_0007A8 == -1 ) { v6 = 0; v3 = 0; } else { - v3 = pStru170->field_FA8[v2].std__vector_0007AC; - v6 = pStru170->field_FA8[v2].pVertices; + v3 = pBspRenderer->field_FA8[v2].std__vector_0007AC; + v6 = pBspRenderer->field_FA8[v2].pVertices; } - IndoorLocation::ExecDraw_d3d(pStru170->pFaceIDs[2 * i], v3, 4, v6); + IndoorLocation::ExecDraw_d3d(pBspRenderer->pFaceIDs[2 * i], v3, 4, v6); } } else { - for (uint j = 0; j < pStru170->uNumFaceIDs; ++j ) + for (uint j = 0; j < pBspRenderer->uNumFaceIDs; ++j ) { - v5 = pStru170->pFaceIDs[2 * j]; - pBLVRenderParams->field_7C = &pStru170->field_FA8[pStru170->pFaceIDs[2 * j + 1]].field_C; + v5 = pBspRenderer->pFaceIDs[2 * j]; + pBLVRenderParams->field_7C = &pBspRenderer->field_FA8[pBspRenderer->pFaceIDs[2 * j + 1]].field_C; IndoorLocation::ExecDraw_sw(v5); } } @@ -321,17 +321,17 @@ { v1 = pBLVRenderParams->pRenderTarget; v6 = 0; - if ( (signed int)pStru170->std__vector_000FA8 > 0 ) + if ( (signed int)pBspRenderer->std__vector_000FA8 > 0 ) { v7 = 0; - v2 = (char *)&pStru170->field_FA8[0].field_C._viewport_space_w; + v2 = (char *)&pBspRenderer->field_FA8[0].field_C._viewport_space_w; do { v3 = *((int *)v2 - 1); v4 = pRenderer->uTargetSurfacePitch * *((int *)v2 - 1); if ( v3 <= *(int *)v2 ) { - v5 = (char *)&pStru170->field_FA8[0].field_C.array_3D8[v3 + v7]; + v5 = (char *)&pBspRenderer->field_FA8[0].field_C.array_3D8[v3 + v7]; do { v1[v4 + *((short *)v5 - 480)] = 255; @@ -346,7 +346,7 @@ v7 += 1126; v2 += 2252; } - while ( v6 < (signed int)pStru170->std__vector_000FA8 ); + while ( v6 < (signed int)pBspRenderer->std__vector_000FA8 ); } } } @@ -1259,7 +1259,7 @@ //----- (004B0EA8) -------------------------------------------------------- -void stru170::PrepareFaceRenderList_d3d(int a2, unsigned int uFaceID) +void BspRenderer::PrepareFaceRenderList_d3d(int a2, unsigned int uFaceID) { //unsigned int v3; // edx@1 //stru170 *v4; // ebx@1 @@ -1477,9 +1477,9 @@ //----- (004AFB86) -------------------------------------------------------- -void stru170::PrepareFaceRenderList_sw(int a2, unsigned int uFaceID) +void BspRenderer::PrepareFaceRenderList_sw(int a2, unsigned int uFaceID) { - stru170 *v3; // ebx@1 + BspRenderer *v3; // ebx@1 BLVFace *v4; // eax@1 char *v5; // ecx@2 unsigned __int16 v6; // ax@11 @@ -1582,7 +1582,7 @@ && v23 <= *((short *)v20 + 2007) && v12 >= *((short *)v20 + 2006) && v22 <= *((short *)v20 + 2008) - && sub_424829(v10, &v3->field_FA8[v3->std__vector_000FA8].field_C, (stru170_stru2 *)(v20 + 4020), uFaceID) ) + && sub_424829(v10, &v3->field_FA8[v3->std__vector_000FA8].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) ) { v16 = v21->uSectorID; if ( *((short *)v20 + 2004) == v16 ) @@ -1629,15 +1629,15 @@ int v6; // ecx@7 int v7; // esi@8 - for ( i = 0; i < (signed int)pStru170->uNumFaceIDs; ++i ) + for ( i = 0; i < (signed int)pBspRenderer->uNumFaceIDs; ++i ) { - v1 = pStru170->pFaceIDs[2 * i]; + v1 = pBspRenderer->pFaceIDs[2 * i]; if ( v1 >= 0 ) { if ( v1 < (signed int)pIndoor->uNumFaces ) { - v2 = pStru170->pFaceIDs[2 * i]; - pBLVRenderParams->field_7C = &pStru170->field_FA8[pStru170->pFaceIDs[2 * i + 1]].field_C; + v2 = pBspRenderer->pFaceIDs[2 * i]; + pBLVRenderParams->field_7C = &pBspRenderer->field_FA8[pBspRenderer->pFaceIDs[2 * i + 1]].field_C; v3 = sub_423B5D(v2); if ( v3 ) {
--- a/Indoor.h Wed Nov 07 23:47:35 2012 +0600 +++ b/Indoor.h Tue Nov 13 20:37:07 2012 +0600 @@ -556,7 +556,7 @@ int field_70; int uViewportCenterX; int uViewportCenterY; - struct stru170_stru2 *field_7C; + struct BspRenderer_stru2 *field_7C; unsigned int uNumFacesRenderedThisFrame; int field_84; int field_88;
--- a/Indoor_stuff.h Wed Nov 07 23:47:35 2012 +0600 +++ b/Indoor_stuff.h Tue Nov 13 20:37:07 2012 +0600 @@ -6,7 +6,7 @@ /* 165 */ #pragma pack(push, 1) -struct stru170_stru2 +struct BspRenderer_stru2 { void _43F9E1(__int16 x, int y, __int16 z, int w); @@ -20,27 +20,27 @@ __int16 array_3D8[480]; }; #pragma pack(pop) -extern stru170_stru2 stru_F8A590; +extern BspRenderer_stru2 stru_F8A590; /* 164 */ #pragma pack(push, 1) -struct stru170_stru0 +struct BspRenderer_stru0 { //----- (0043F2BF) -------------------------------------------------------- - inline stru170_stru0() + inline BspRenderer_stru0() { //_eh_vector_constructor_iterator_(std__vector_0007AC, 24, 4, // (void (__thiscall *)(void *))IndoorCameraD3D_Vec4::IndoorCameraD3D_Vec4, // (void (__thiscall *)(void *))IndoorCameraD3D_Vec4::dtor); - for (int i = 0; i < 4; ++i) - pVertices[i].flt_2C = 0.0f; + //for (int i = 0; i < 4; ++i) + // pVertices[i].flt_2C = 0.0f; } //----- (0043F2A9) -------------------------------------------------------- - ~stru170_stru0() + ~BspRenderer_stru0() { //_eh_vector_destructor_iterator_(this->std__vector_0007AC, 24, 4, IndoorCameraD3D_Vec4::dtor); } @@ -51,7 +51,7 @@ unsigned __int16 uViewportZ; unsigned __int16 uViewportW; __int16 field_A; - stru170_stru2 field_C; + BspRenderer_stru2 field_C; unsigned __int16 uFaceID; __int16 field_7A6; unsigned int std__vector_0007A8; @@ -66,10 +66,10 @@ /* 163 */ #pragma pack(push, 1) -struct stru170 +struct BspRenderer { //----- (0043F282) -------------------------------------------------------- - inline stru170() + inline BspRenderer() { // _eh_vector_constructor_iterator_(field_FA8, 2252, 150, // (void (__thiscall *)(void *))stru170_stru0::stru170_stru0, @@ -87,14 +87,14 @@ __int16 pFaceIDs[150]; char field_130[3700]; unsigned int std__vector_000FA8; - stru170_stru0 field_FA8[150]; + BspRenderer_stru0 field_FA8[150]; unsigned int uNumVisibleNotEmptySectors; unsigned __int16 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[6]; }; #pragma pack(pop) -extern struct stru170 *pStru170; // idb +extern struct BspRenderer *pBspRenderer; // idb
--- a/OSAPI.cpp Wed Nov 07 23:47:35 2012 +0600 +++ b/OSAPI.cpp Tue Nov 13 20:37:07 2012 +0600 @@ -5,6 +5,7 @@ OSVersion *pVersion = nullptr; + //----- (00462C94) -------------------------------------------------------- int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE, wchar_t *lpCmdLine, int nShowCmd) {
--- a/Vis.cpp Wed Nov 07 23:47:35 2012 +0600 +++ b/Vis.cpp Tue Nov 13 20:37:07 2012 +0600 @@ -359,9 +359,9 @@ v5 = 0; thisa = this; v17 = 0; - for ( a1.flt_2C = 0.0; v17 < (signed int)pStru170->uNumFaceIDs; ++v17 ) + for ( a1.flt_2C = 0.0; v17 < (signed int)pBspRenderer->uNumFaceIDs; ++v17 ) { - v6 = pStru170->pFaceIDs[2 * v5]; + v6 = pBspRenderer->pFaceIDs[2 * v5]; if ( v6 >= 0 ) { if ( v6 < (signed int)pIndoor->uNumFaces ) @@ -1991,9 +1991,9 @@ result = 0; thisa = this; - for ( i = 0; i < (signed int)pStru170->uNumFaceIDs; ++i ) + for ( i = 0; i < (signed int)pBspRenderer->uNumFaceIDs; ++i ) { - v5 = pStru170->pFaceIDs[2 * result]; + v5 = pBspRenderer->pFaceIDs[2 * result]; if ( v5 >= 0 ) { if ( v5 < (signed int)pIndoor->uNumFaces )
--- a/mm7_1.cpp Wed Nov 07 23:47:35 2012 +0600 +++ b/mm7_1.cpp Tue Nov 13 20:37:07 2012 +0600 @@ -7153,10 +7153,10 @@ //----- (00424829) -------------------------------------------------------- -bool __fastcall sub_424829(int a1, stru170_stru2 *a2, stru170_stru2 *a3, int a4) +bool sub_424829(int a1, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int a4) { int v4; // edi@1 - stru170_stru2 *v5; // ebx@1 + BspRenderer_stru2 *v5; // ebx@1 int v6; // eax@3 int v7; // esi@5 int v8; // edx@5 @@ -7190,7 +7190,7 @@ __int16 v36; // dx@67 __int16 v37; // di@67 __int16 v38; // dx@67 - stru170_stru2 *v39; // ecx@69 + BspRenderer_stru2 *v39; // ecx@69 int v40; // edx@69 int v41; // edi@70 __int16 *v42; // eax@76 @@ -7210,7 +7210,7 @@ __int16 *v57; // [sp+14h] [bp-2Ch]@76 __int16 *v58; // [sp+14h] [bp-2Ch]@81 __int16 *v59; // [sp+14h] [bp-2Ch]@87 - stru170_stru2 *v60; // [sp+18h] [bp-28h]@1 + BspRenderer_stru2 *v60; // [sp+18h] [bp-28h]@1 int v61; // [sp+1Ch] [bp-24h]@29 int v62; // [sp+20h] [bp-20h]@0 signed int v63; // [sp+24h] [bp-1Ch]@3
--- a/mm7_3.cpp Wed Nov 07 23:47:35 2012 +0600 +++ b/mm7_3.cpp Tue Nov 13 20:37:07 2012 +0600 @@ -12880,31 +12880,33 @@ //----- (0043F953) -------------------------------------------------------- -void PrepareWallsRenderList_BLV() -{ - pStru170->uNumFaceIDs = 0; - if ( pBLVRenderParams->uPartySectorID ) - { - pStru170->field_FA8[0].uSectorID = pBLVRenderParams->uPartySectorID; - pStru170->field_FA8[0].uViewportW = pBLVRenderParams->uViewportW; - pStru170->field_FA8[0].uViewportZ = pBLVRenderParams->uViewportZ; - pStru170->field_FA8[0].uViewportY = pBLVRenderParams->uViewportY; - pStru170->field_FA8[0].uViewportX = pBLVRenderParams->uViewportX; - pStru170->field_FA8[0].field_C._43F9E1( +void PrepareBspRenderList_BLV() +{ + pBspRenderer->uNumFaceIDs = 0; + + if (pBLVRenderParams->uPartySectorID) + { + pBspRenderer->field_FA8[0].uSectorID = pBLVRenderParams->uPartySectorID; + pBspRenderer->field_FA8[0].uViewportW = pBLVRenderParams->uViewportW; + pBspRenderer->field_FA8[0].uViewportZ = pBLVRenderParams->uViewportZ; + pBspRenderer->field_FA8[0].uViewportY = pBLVRenderParams->uViewportY; + pBspRenderer->field_FA8[0].uViewportX = pBLVRenderParams->uViewportX; + pBspRenderer->field_FA8[0].field_C._43F9E1( pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); - pStru170->field_FA8[0].uFaceID = -1; - pStru170->field_FA8[0].std__vector_0007A8 = -1; - pStru170->std__vector_000FA8 = 1; + pBspRenderer->field_FA8[0].uFaceID = -1; + pBspRenderer->field_FA8[0].std__vector_0007A8 = -1; + pBspRenderer->std__vector_000FA8 = 1; sub_440639(0); } - pStru170->MakeVisibleSectorList(); + + pBspRenderer->MakeVisibleSectorList(); } //----- (0043F9E1) -------------------------------------------------------- -void stru170_stru2::_43F9E1(__int16 x, int y, __int16 z, int w) +void BspRenderer_stru2::_43F9E1(__int16 x, int y, __int16 z, int w) { _viewport_space_y = y; _viewport_space_w = w; @@ -13257,7 +13259,7 @@ v1 = a1; v2 = 0; - v3 = &pIndoor->pSectors[pStru170->field_FA8[a1].uSectorID]; + v3 = &pIndoor->pSectors[pBspRenderer->field_FA8[a1].uSectorID]; if ( pRenderer->pRenderD3D ) { if ( v3->uNumNonBSPFaces > 0 ) @@ -13265,7 +13267,7 @@ do { Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]); - pStru170->PrepareFaceRenderList_d3d(v1, v3->pFaceIDs[v2++]); + pBspRenderer->PrepareFaceRenderList_d3d(v1, v3->pFaceIDs[v2++]); } while ( v2 < v3->uNumNonBSPFaces ); } @@ -13275,7 +13277,7 @@ if ( v3->uNumNonBSPFaces > 0 ) { do - pStru170->PrepareFaceRenderList_sw(v1, v3->pFaceIDs[v2++]); + pBspRenderer->PrepareFaceRenderList_sw(v1, v3->pFaceIDs[v2++]); while ( v2 < v3->uNumNonBSPFaces ); } } @@ -13296,12 +13298,12 @@ __int16 v9; // di@18 int v10; // [sp+10h] [bp-Ch]@1 bool v11; // [sp+14h] [bp-8h]@5 - stru170_stru0 *v12; // [sp+18h] [bp-4h]@1 + BspRenderer_stru0 *v12; // [sp+18h] [bp-4h]@1 Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode); v10 = a1; - v12 = &pStru170->field_FA8[a1]; + v12 = &pBspRenderer->field_FA8[a1]; while ( 1 ) { v2 = &pIndoor->pSectors[v12->uSectorID]; @@ -13328,12 +13330,12 @@ if ( pRenderer->pRenderD3D ) { while ( v7 < v8 ) - pStru170->PrepareFaceRenderList_d3d(v10, v2->pFaceIDs[v7++]); + pBspRenderer->PrepareFaceRenderList_d3d(v10, v2->pFaceIDs[v7++]); } else { while ( v7 < v8 ) - pStru170->PrepareFaceRenderList_sw(v10, v2->pFaceIDs[v7++]); + pBspRenderer->PrepareFaceRenderList_sw(v10, v2->pFaceIDs[v7++]); } v9 = v11 ? v3->uFront : v3->uBack; if ( v9 == -1 )
--- a/mm7_4.cpp Wed Nov 07 23:47:35 2012 +0600 +++ b/mm7_4.cpp Tue Nov 13 20:37:07 2012 +0600 @@ -15158,12 +15158,12 @@ byte_4E94D3); } v12 = 0; - if ( pStru170->uNumVisibleNotEmptySectors <= 0 ) + if ( pBspRenderer->uNumVisibleNotEmptySectors <= 0 ) continue; - while (pStru170->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) + while (pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v12] != p->uSectorID) { ++v12; - if ( v12 >= pStru170->uNumVisibleNotEmptySectors ) + if ( v12 >= pBspRenderer->uNumVisibleNotEmptySectors ) goto _continue; } if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1a, a2, a3, &x, &y, &z, 1)
--- a/mm7_5.cpp Wed Nov 07 23:47:35 2012 +0600 +++ b/mm7_5.cpp Tue Nov 13 20:37:07 2012 +0600 @@ -8901,7 +8901,7 @@ //----- (0043F333) -------------------------------------------------------- -void stru170::MakeVisibleSectorList() +void BspRenderer::MakeVisibleSectorList() { int v6; // ebx@3
--- a/mm7_data.h Wed Nov 07 23:47:35 2012 +0600 +++ b/mm7_data.h Tue Nov 13 20:37:07 2012 +0600 @@ -1908,7 +1908,7 @@ void __cdecl sub_423B4A(); int __fastcall sub_423B5D(unsigned int uFaceID); signed int __fastcall sub_424579(int uFaceID, struct stru320 *a2); -bool __fastcall sub_424829(int a1, struct stru170_stru2 *a2, struct stru170_stru2 *a3, int a4); +bool sub_424829(int a1, struct BspRenderer_stru2 *a2, struct BspRenderer_stru2 *a3, int a4); signed int __fastcall sr_424CD7(unsigned int uVertexID); // idb signed int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID); // idb signed int __fastcall sr_4250FE(unsigned int uVertexID); // idb @@ -1974,7 +1974,7 @@ void __cdecl MessWithBillboards_BLV(); int __fastcall _43F55F_get_billboard_light_level(struct RenderBillboard *a1, int uBaseLightLevel); int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z); -void PrepareWallsRenderList_BLV(); +void PrepareBspRenderList_BLV(); void __fastcall PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID); void PrepareActorRenderList_BLV(); void PrepareItemsRenderList_BLV();