Mercurial > mm7
changeset 1242:30df39a3aa92
Merge
author | Gloval |
---|---|
date | Mon, 10 Jun 2013 00:09:36 +0400 |
parents | ae812777b1d4 (current diff) 353cb3ad9725 (diff) |
children | 6279bf7a4d1a |
files | |
diffstat | 4 files changed, 106 insertions(+), 130 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Mon Jun 10 00:09:21 2013 +0400 +++ b/Indoor.cpp Mon Jun 10 00:09:36 2013 +0400 @@ -1312,8 +1312,6 @@ return; } - - if (p->uFaceID == uFaceID) return; if (!node_id && @@ -1337,10 +1335,8 @@ nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ; nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY; nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW; - nodes[num_nodes].field_C._43F9E1(pBLVRenderParams->uViewportX, - pBLVRenderParams->uViewportY, - pBLVRenderParams->uViewportZ, - pBLVRenderParams->uViewportW); + nodes[num_nodes].field_C._43F9E1(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, + pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); AddBspNodeToRenderList(++num_nodes - 1); return; } @@ -1381,7 +1377,7 @@ //savegame: qw , 0Bh and 0x1D4h //problem here when standing near/on portal, condition is false because of face_min_screenspace_x > p->uViewportZ if (face_max_screenspace_x >= p->uViewportX && -// face_min_screenspace_x <= p->uViewportZ && + face_min_screenspace_x <= p->uViewportZ && face_max_screenspace_y >= p->uViewportY && face_min_screenspace_y <= p->uViewportW && sub_424829(num_vertices, &nodes[num_nodes].field_C, &p->field_C, uFaceID))
--- a/Viewport.cpp Mon Jun 10 00:09:21 2013 +0400 +++ b/Viewport.cpp Mon Jun 10 00:09:36 2013 +0400 @@ -180,61 +180,59 @@ //----- (00443365) -------------------------------------------------------- void ViewingParams::_443365() - { - - Vec3_short_ *v3; // eax@4 - Vec3_short_ *v6; // eax@12 - int minimum_y; // [sp+10h] [bp-10h]@2 - int maximum_y; // [sp+14h] [bp-Ch]@2 - int minimum_x; // [sp+18h] [bp-8h]@2 - int maximum_x; // [sp+1Ch] [bp-4h]@2 +{ + Vec3_short_ *v3; // eax@4 + Vec3_short_ *v6; // eax@12 + int minimum_y; // [sp+10h] [bp-10h]@2 + int maximum_y; // [sp+14h] [bp-Ch]@2 + int minimum_x; // [sp+18h] [bp-8h]@2 + int maximum_x; // [sp+1Ch] [bp-4h]@2 - - InitGrayPalette(); - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { - minimum_x = 0x40000000; - minimum_y = 0x40000000; + InitGrayPalette(); + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + minimum_x = 0x40000000; + minimum_y = 0x40000000; - maximum_x = -0x40000000; - maximum_y = -0x40000000; - for (int i=0; i<pIndoor->pMapOutlines->uNumOutlines; ++i) - { - v3 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace1ID]; + maximum_x = -0x40000000; + maximum_y = -0x40000000; + for (int i=0; i<pIndoor->pMapOutlines->uNumOutlines; ++i) + { + v3 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace1ID]; - if ( v3->x < minimum_x ) - minimum_x = v3->x; - if ( v3->x > maximum_x ) - maximum_x = v3->x; - if ( v3->y < minimum_y ) - minimum_y = v3->x; - if ( v3->y > maximum_y ) - maximum_y = v3->x; + if ( v3->x < minimum_x ) + minimum_x = v3->x; + if ( v3->x > maximum_x ) + maximum_x = v3->x; + if ( v3->y < minimum_y ) + minimum_y = v3->x; + if ( v3->y > maximum_y ) + maximum_y = v3->x; - v6 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace2ID]; + v6 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace2ID]; + + if ( v6->x < minimum_x ) + minimum_x = v3->x; + if ( v6->x > maximum_x ) + maximum_x = v3->x; - if ( v6->x < minimum_x ) - minimum_x = v3->x; - if ( v6->x > maximum_x ) - maximum_x = v3->x; - - if ( v6->y < minimum_y ) - minimum_y = v3->y; - if ( v6->y > maximum_y ) - maximum_y = v3->y; - } + if ( v6->y < minimum_y ) + minimum_y = v3->y; + if ( v6->y > maximum_y ) + maximum_y = v3->y; + } - uMinimapZoom = 1024; - indoor_center_x = (signed int)(minimum_x + maximum_x) / 2; - field_28 = 10; - indoor_center_y = (signed int)(minimum_y + maximum_y) / 2; - } - else - { - indoor_center_x = 0; - indoor_center_y = 0; - uMinimapZoom = _576E2C_current_minimap_zoom; - field_28 = dword_576E28; - } - field_2C = 384; - } \ No newline at end of file + uMinimapZoom = 1024; + indoor_center_x = (signed int)(minimum_x + maximum_x) / 2; + field_28 = 10; + indoor_center_y = (signed int)(minimum_y + maximum_y) / 2; + } + else + { + indoor_center_x = 0; + indoor_center_y = 0; + uMinimapZoom = _576E2C_current_minimap_zoom; + field_28 = dword_576E28; + } + field_2C = 384; +} \ No newline at end of file
--- a/mm7_1.cpp Mon Jun 10 00:09:21 2013 +0400 +++ b/mm7_1.cpp Mon Jun 10 00:09:36 2013 +0400 @@ -1487,7 +1487,7 @@ //----- (00423B5D) -------------------------------------------------------- int __fastcall sub_423B5D(unsigned int uFaceID) { - BLVFace *v1; // ebx@1 + BLVFace *pFace; // ebx@1 Vec3_short_ *v2; // esi@1 //int v3; // ST28_4@1 __int16 v4; // ST2C_2@1 @@ -1577,45 +1577,39 @@ signed int id; // [sp+24h] [bp-4h]@51 signed int ie; // [sp+24h] [bp-4h]@61 - v1 = &pIndoor->pFaces[uFaceID]; + pFace = &pIndoor->pFaces[uFaceID]; //this = pGame->pIndoorCameraD3D; - v2 = &pIndoor->pVertices[v1->pVertexIDs[0]]; + v2 = &pIndoor->pVertices[pFace->pVertexIDs[0]]; //v3 = *(_DWORD *)&v2->x; v4 = v2->z; //v5 = 0; - if ( v1->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) - + v1->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) - + v1->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) + if ( pFace->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) + + pFace->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) + + pFace->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) { stru_50B700.field_0 = 1; } else { stru_50B700.field_0 = 0; - if ( !v1->Portal() ) + if ( !pFace->Portal() ) return 0; } //v66 = v1->uNumVertices; - for (uint i = 0; i < v1->uNumVertices; ++i) + for (uint i = 0; i < pFace->uNumVertices; ++i) { - auto v6 = &pIndoor->pVertices[v1->pVertexIDs[i]]; - pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( - v6->x, - v6->y, - v6->z, - &stru_50B700._view_transformed_xs[i], - &stru_50B700._view_transformed_zs[i], - &stru_50B700._view_transformed_ys[i], - 0); + auto v6 = &pIndoor->pVertices[pFace->pVertexIDs[i]]; + pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(v6->x, v6->y, v6->z, + &stru_50B700._view_transformed_xs[i], &stru_50B700._view_transformed_zs[i], &stru_50B700._view_transformed_ys[i], 0); } //v7 = v1->uNumVertices; //v8 = 0; - if (v1->uNumVertices <= 0) + if (pFace->uNumVertices <= 0) return 0; bool bFound = false; - for (uint i = 0; i < v1->uNumVertices; ++i) + for (uint i = 0; i < pFace->uNumVertices; ++i) if (stru_50B700._view_transformed_xs[i] >= 0x80000u) { bFound = true; @@ -1625,12 +1619,12 @@ return 0; v79 = 0; - stru_50B700._view_transformed_xs[v1->uNumVertices] = stru_50B700._view_transformed_xs[0]; - stru_50B700._view_transformed_zs[v1->uNumVertices] = stru_50B700._view_transformed_zs[0]; - stru_50B700._view_transformed_ys[v1->uNumVertices] = stru_50B700._view_transformed_ys[0]; + stru_50B700._view_transformed_xs[pFace->uNumVertices] = stru_50B700._view_transformed_xs[0]; + stru_50B700._view_transformed_zs[pFace->uNumVertices] = stru_50B700._view_transformed_zs[0]; + stru_50B700._view_transformed_ys[pFace->uNumVertices] = stru_50B700._view_transformed_ys[0]; thisa = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u; //int i = 1; - for (uint i = 1; i <= v1->uNumVertices; ++i) + for (uint i = 1; i <= pFace->uNumVertices; ++i) { v10 = stru_50B700._view_transformed_xs[i]; v81 = v10 >= (signed int)0x80000u;
--- a/mm7_3.cpp Mon Jun 10 00:09:21 2013 +0400 +++ b/mm7_3.cpp Mon Jun 10 00:09:36 2013 +0400 @@ -11018,10 +11018,8 @@ pBspRenderer->nodes[0].uViewportZ = pBLVRenderParams->uViewportZ; pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY; pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX; - pBspRenderer->nodes[0].field_C._43F9E1(pBLVRenderParams->uViewportX, - pBLVRenderParams->uViewportY, - pBLVRenderParams->uViewportZ, - pBLVRenderParams->uViewportW); + pBspRenderer->nodes[0].field_C._43F9E1(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, + pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); pBspRenderer->nodes[0].uFaceID = -1; pBspRenderer->nodes[0].viewing_portal_id = -1; pBspRenderer->num_nodes = 1; @@ -11386,85 +11384,75 @@ //----- (00440639) -------------------------------------------------------- void AddBspNodeToRenderList(unsigned int node_id) { - //int v1; // ebx@1 - signed int v2; // edi@1 - BLVSector *v3; // esi@1 - - //v1 = sector_id; - v2 = 0; - v3 = &pIndoor->pSectors[pBspRenderer->nodes[node_id].uSectorID]; + BLVSector *pSector; // esi@1 + + pSector = &pIndoor->pSectors[pBspRenderer->nodes[node_id].uSectorID]; if ( pRenderer->pRenderD3D ) { - for (uint i = 0; i < v3->uNumNonBSPFaces; ++i) + for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i) //Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]); - pBspRenderer->AddFaceToRenderList_d3d(node_id, v3->pFaceIDs[i]); - } - else - { - if ( v3->uNumNonBSPFaces > 0 ) - { - do - pBspRenderer->AddFaceToRenderList_sw(node_id, v3->pFaceIDs[v2++]); - while ( v2 < v3->uNumNonBSPFaces ); - } - } - if ( v3->field_0 & 0x10 ) - sub_4406BC(node_id, v3->uFirstBSPNode); + pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[i]); + } + else + { + for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i) + pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[i]); + } + if ( pSector->field_0 & 0x10 ) + sub_4406BC(node_id, pSector->uFirstBSPNode); } //----- (004406BC) -------------------------------------------------------- void __fastcall sub_4406BC(unsigned int node_id, unsigned int uFirstNode) { - BLVSector *v2; // esi@2 - BSPNode *v3; // edi@2 - BLVFace *v4; // eax@2 + BLVSector *pSector; // esi@2 + BSPNode *pNode; // edi@2 + BLVFace *pFace; // eax@2 int v5; // ecx@2 __int16 v6; // ax@6 int v7; // ebp@10 int v8; // ebx@10 __int16 v9; // di@18 //int v10; // [sp+10h] [bp-Ch]@1 - bool v11; // [sp+14h] [bp-8h]@5 - BspRenderer_stru0 *v12; // [sp+18h] [bp-4h]@1 + //bool v11; // [sp+14h] [bp-8h]@5 + BspRenderer_stru0 *node; // [sp+18h] [bp-4h]@1 //Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode); //v10 = a1; - v12 = &pBspRenderer->nodes[node_id]; + node = &pBspRenderer->nodes[node_id]; while ( 1 ) { - v2 = &pIndoor->pSectors[v12->uSectorID]; - v3 = &pIndoor->pNodes[uFirstNode]; - v4 = &pIndoor->pFaces[v2->pFaceIDs[v3->uCoplanarOffset]]; - v5 = v4->pFacePlane_old.dist - + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x - + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y - + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z; - if (v4->Portal() && v4->uSectorID != v12->uSectorID ) + pSector = &pIndoor->pSectors[node->uSectorID]; + pNode = &pIndoor->pNodes[uFirstNode]; + pFace = &pIndoor->pFaces[pSector->pFaceIDs[pNode->uCoplanarOffset]]; + v5 = pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x + + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z; + if (pFace->Portal() && pFace->uSectorID != node->uSectorID ) v5 = -v5; - v11 = v5 > 0; + //v11 = v5 > 0; if ( v5 <= 0 ) - v6 = v3->uFront; + v6 = pNode->uFront; else - v6 = v3->uBack; + v6 = pNode->uBack; if ( v6 != -1 ) sub_4406BC(node_id, v6); - v7 = v3->uCoplanarOffset; - v8 = v7 + v3->uCoplanarSize; + v7 = pNode->uCoplanarOffset; + v8 = v7 + pNode->uCoplanarSize; //Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]); if ( pRenderer->pRenderD3D ) { while ( v7 < v8 ) - pBspRenderer->AddFaceToRenderList_d3d(node_id, v2->pFaceIDs[v7++]); + pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[v7++]); } else { while ( v7 < v8 ) - pBspRenderer->AddFaceToRenderList_sw(node_id, v2->pFaceIDs[v7++]); - } - v9 = v11 ? v3->uFront : v3->uBack; + pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[v7++]); + } + v9 = v5 > 0 ? pNode->uFront : pNode->uBack; if ( v9 == -1 ) break; uFirstNode = v9;