comparison mm7_3.cpp @ 676:ecfb1b3c9a39

BLV: when standing right on the portal (orange wall) everything looks fine
author Nomad
date Fri, 15 Mar 2013 04:13:24 +0200
parents 92c1e1250e7c
children c0bfb386b15f
comparison
equal deleted inserted replaced
675:92c1e1250e7c 676:ecfb1b3c9a39
136 } 136 }
137 while ( 1 ) 137 while ( 1 )
138 { 138 {
139 v11 = v9->pFloors[v10]; 139 v11 = v9->pFloors[v10];
140 v12 = &pIndoor->pFaces[v11]; 140 v12 = &pIndoor->pFaces[v11];
141 if ( v12->TwoSided() 141 if ( v12->Portal()
142 || stru_721530.sMaxX > v12->pBounding.x2 142 || stru_721530.sMaxX > v12->pBounding.x2
143 || stru_721530.sMinX < v12->pBounding.x1 143 || stru_721530.sMinX < v12->pBounding.x1
144 || stru_721530.sMaxY > v12->pBounding.y2 144 || stru_721530.sMaxY > v12->pBounding.y2
145 || stru_721530.sMinY < v12->pBounding.y1 145 || stru_721530.sMinY < v12->pBounding.y1
146 || stru_721530.sMaxZ > v12->pBounding.z2 146 || stru_721530.sMaxZ > v12->pBounding.z2
3793 || (v5 = (unsigned __int64)(a2->x * (signed __int64)a4->pFacePlane_old.vNormal.x) >> 16, 3793 || (v5 = (unsigned __int64)(a2->x * (signed __int64)a4->pFacePlane_old.vNormal.x) >> 16,
3794 a4b = (unsigned __int64)(a2->y * (signed __int64)a4->pFacePlane_old.vNormal.y) >> 16, 3794 a4b = (unsigned __int64)(a2->y * (signed __int64)a4->pFacePlane_old.vNormal.y) >> 16,
3795 v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16, 3795 v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16,
3796 v7 = v5 + v6 + a4b, 3796 v7 = v5 + v6 + a4b,
3797 (v16 = v5 + v6 + a4b) == 0) 3797 (v16 = v5 + v6 + a4b) == 0)
3798 || v7 > 0 && !v4->TwoSided()) 3798 || v7 > 0 && !v4->Portal())
3799 return 0; 3799 return 0;
3800 v8 = v4->pFacePlane_old.vNormal.z * a1->z; 3800 v8 = v4->pFacePlane_old.vNormal.z * a1->z;
3801 v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x); 3801 v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x);
3802 if ( v7 <= 0 ) 3802 if ( v7 <= 0 )
3803 { 3803 {
3853 v12 = (unsigned __int64)(a8 * (signed __int64)a2->pFacePlane_old.vNormal.z) >> 16, 3853 v12 = (unsigned __int64)(a8 * (signed __int64)a2->pFacePlane_old.vNormal.z) >> 16,
3854 v13 = v10 + v12 + v11 == 0, 3854 v13 = v10 + v12 + v11 == 0,
3855 v14 = v10 + v12 + v11, 3855 v14 = v10 + v12 + v11,
3856 v22 = v10 + v12 + v11, 3856 v22 = v10 + v12 + v11,
3857 v13) 3857 v13)
3858 || v14 > 0 && !a2->TwoSided()) 3858 || v14 > 0 && !a2->Portal())
3859 return 0; 3859 return 0;
3860 v15 = a4 * a2->pFacePlane_old.vNormal.y; 3860 v15 = a4 * a2->pFacePlane_old.vNormal.y;
3861 v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z); 3861 v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z);
3862 if ( v14 <= 0 ) 3862 if ( v14 <= 0 )
3863 { 3863 {
11142 11142
11143 11143
11144 //----- (0043F953) -------------------------------------------------------- 11144 //----- (0043F953) --------------------------------------------------------
11145 void PrepareBspRenderList_BLV() 11145 void PrepareBspRenderList_BLV()
11146 { 11146 {
11147 pBspRenderer->uNumFaceIDs = 0; 11147 pBspRenderer->num_faces = 0;
11148 11148
11149 if (pBLVRenderParams->uPartySectorID) 11149 if (pBLVRenderParams->uPartySectorID)
11150 { 11150 {
11151 pBspRenderer->pSectors[0].uSectorID = pBLVRenderParams->uPartySectorID; 11151 pBspRenderer->nodes[0].uSectorID = pBLVRenderParams->uPartySectorID;
11152 pBspRenderer->pSectors[0].uViewportW = pBLVRenderParams->uViewportW; 11152 pBspRenderer->nodes[0].uViewportW = pBLVRenderParams->uViewportW;
11153 pBspRenderer->pSectors[0].uViewportZ = pBLVRenderParams->uViewportZ; 11153 pBspRenderer->nodes[0].uViewportZ = pBLVRenderParams->uViewportZ;
11154 pBspRenderer->pSectors[0].uViewportY = pBLVRenderParams->uViewportY; 11154 pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY;
11155 pBspRenderer->pSectors[0].uViewportX = pBLVRenderParams->uViewportX; 11155 pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX;
11156 pBspRenderer->pSectors[0].field_C._43F9E1( 11156 pBspRenderer->nodes[0].field_C._43F9E1(pBLVRenderParams->uViewportX,
11157 pBLVRenderParams->uViewportX, 11157 pBLVRenderParams->uViewportY,
11158 pBLVRenderParams->uViewportY, 11158 pBLVRenderParams->uViewportZ,
11159 pBLVRenderParams->uViewportZ, 11159 pBLVRenderParams->uViewportW);
11160 pBLVRenderParams->uViewportW); 11160 pBspRenderer->nodes[0].uFaceID = -1;
11161 pBspRenderer->pSectors[0].uFaceID = -1; 11161 pBspRenderer->nodes[0].std__vector_0007A8 = -1;
11162 pBspRenderer->pSectors[0].std__vector_0007A8 = -1; 11162 pBspRenderer->num_nodes = 1;
11163 pBspRenderer->pNumSectors = 1; 11163 AddBspNodeToRenderList(0);
11164 sub_440639(0);
11165 } 11164 }
11166 11165
11167 pBspRenderer->MakeVisibleSectorList(); 11166 pBspRenderer->MakeVisibleSectorList();
11168 } 11167 }
11169 11168
11175 11174
11176 for (uint i = 0; i < 480; ++i) 11175 for (uint i = 0; i < 480; ++i)
11177 { 11176 {
11178 if ( i < y || i > w ) 11177 if ( i < y || i > w )
11179 { 11178 {
11179 array_18[i] = 640;
11180 array_3D8[i] = -1; 11180 array_3D8[i] = -1;
11181 array_18[i] = 640;
11182 } 11181 }
11183 else 11182 else
11184 { 11183 {
11185 array_18[i] = x; 11184 array_18[i] = x;
11186 array_3D8[i] = z; 11185 array_3D8[i] = z;
11514 } 11513 }
11515 11514
11516 11515
11517 11516
11518 //----- (00440639) -------------------------------------------------------- 11517 //----- (00440639) --------------------------------------------------------
11519 void __fastcall sub_440639(int a1) 11518 void AddBspNodeToRenderList(unsigned int node_id)
11520 { 11519 {
11521 int v1; // ebx@1 11520 //int v1; // ebx@1
11522 signed int v2; // edi@1 11521 signed int v2; // edi@1
11523 BLVSector *v3; // esi@1 11522 BLVSector *v3; // esi@1
11524 11523
11525 v1 = a1; 11524 //v1 = sector_id;
11526 v2 = 0; 11525 v2 = 0;
11527 v3 = &pIndoor->pSectors[pBspRenderer->pSectors[a1].uSectorID]; 11526 v3 = &pIndoor->pSectors[pBspRenderer->nodes[node_id].uSectorID];
11528 if ( pRenderer->pRenderD3D ) 11527 if ( pRenderer->pRenderD3D )
11529 { 11528 {
11530 for (uint i = 0; i < v3->uNumNonBSPFaces; ++i) 11529 for (uint i = 0; i < v3->uNumNonBSPFaces; ++i)
11531 //Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]); 11530 //Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]);
11532 pBspRenderer->AddFaceToRenderList_d3d(v1, v3->pFaceIDs[i]); 11531 pBspRenderer->AddFaceToRenderList_d3d(node_id, v3->pFaceIDs[i]);
11533 } 11532 }
11534 else 11533 else
11535 { 11534 {
11536 if ( v3->uNumNonBSPFaces > 0 ) 11535 if ( v3->uNumNonBSPFaces > 0 )
11537 { 11536 {
11538 do 11537 do
11539 pBspRenderer->AddFaceToRenderList_sw(v1, v3->pFaceIDs[v2++]); 11538 pBspRenderer->AddFaceToRenderList_sw(node_id, v3->pFaceIDs[v2++]);
11540 while ( v2 < v3->uNumNonBSPFaces ); 11539 while ( v2 < v3->uNumNonBSPFaces );
11541 } 11540 }
11542 } 11541 }
11543 if ( v3->field_0 & 0x10 ) 11542 if ( v3->field_0 & 0x10 )
11544 sub_4406BC(v1, v3->uFirstBSPNode); 11543 sub_4406BC(node_id, v3->uFirstBSPNode);
11545 } 11544 }
11546 11545
11547 //----- (004406BC) -------------------------------------------------------- 11546 //----- (004406BC) --------------------------------------------------------
11548 void __fastcall sub_4406BC(int a1, unsigned int uFirstNode) 11547 void __fastcall sub_4406BC(unsigned int node_id, unsigned int uFirstNode)
11549 { 11548 {
11550 BLVSector *v2; // esi@2 11549 BLVSector *v2; // esi@2
11551 BSPNode *v3; // edi@2 11550 BSPNode *v3; // edi@2
11552 BLVFace *v4; // eax@2 11551 BLVFace *v4; // eax@2
11553 int v5; // ecx@2 11552 int v5; // ecx@2
11554 __int16 v6; // ax@6 11553 __int16 v6; // ax@6
11555 int v7; // ebp@10 11554 int v7; // ebp@10
11556 int v8; // ebx@10 11555 int v8; // ebx@10
11557 __int16 v9; // di@18 11556 __int16 v9; // di@18
11558 int v10; // [sp+10h] [bp-Ch]@1 11557 //int v10; // [sp+10h] [bp-Ch]@1
11559 bool v11; // [sp+14h] [bp-8h]@5 11558 bool v11; // [sp+14h] [bp-8h]@5
11560 BspRenderer_stru0 *v12; // [sp+18h] [bp-4h]@1 11559 BspRenderer_stru0 *v12; // [sp+18h] [bp-4h]@1
11561 11560
11562 //Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode); 11561 //Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode);
11563 11562
11564 v10 = a1; 11563 //v10 = a1;
11565 v12 = &pBspRenderer->pSectors[a1]; 11564 v12 = &pBspRenderer->nodes[node_id];
11566 while ( 1 ) 11565 while ( 1 )
11567 { 11566 {
11568 v2 = &pIndoor->pSectors[v12->uSectorID]; 11567 v2 = &pIndoor->pSectors[v12->uSectorID];
11569 v3 = &pIndoor->pNodes[uFirstNode]; 11568 v3 = &pIndoor->pNodes[uFirstNode];
11570 v4 = &pIndoor->pFaces[v2->pFaceIDs[v3->uCoplanarOffset]]; 11569 v4 = &pIndoor->pFaces[v2->pFaceIDs[v3->uCoplanarOffset]];
11571 v5 = v4->pFacePlane_old.dist 11570 v5 = v4->pFacePlane_old.dist
11572 + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x 11571 + pBLVRenderParams->vPartyPos.x * v4->pFacePlane_old.vNormal.x
11573 + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y 11572 + pBLVRenderParams->vPartyPos.y * v4->pFacePlane_old.vNormal.y
11574 + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z; 11573 + pBLVRenderParams->vPartyPos.z * v4->pFacePlane_old.vNormal.z;
11575 if (v4->TwoSided() && v4->uSectorID != v12->uSectorID ) 11574 if (v4->Portal() && v4->uSectorID != v12->uSectorID )
11576 v5 = -v5; 11575 v5 = -v5;
11577 v11 = v5 > 0; 11576 v11 = v5 > 0;
11578 if ( v5 <= 0 ) 11577 if ( v5 <= 0 )
11579 v6 = v3->uFront; 11578 v6 = v3->uFront;
11580 else 11579 else
11581 v6 = v3->uBack; 11580 v6 = v3->uBack;
11582 if ( v6 != -1 ) 11581 if ( v6 != -1 )
11583 sub_4406BC(v10, v6); 11582 sub_4406BC(node_id, v6);
11584 v7 = v3->uCoplanarOffset; 11583 v7 = v3->uCoplanarOffset;
11585 v8 = v7 + v3->uCoplanarSize; 11584 v8 = v7 + v3->uCoplanarSize;
11586 11585
11587 //Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]); 11586 //Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]);
11588 11587
11589 if ( pRenderer->pRenderD3D ) 11588 if ( pRenderer->pRenderD3D )
11590 { 11589 {
11591 while ( v7 < v8 ) 11590 while ( v7 < v8 )
11592 pBspRenderer->AddFaceToRenderList_d3d(v10, v2->pFaceIDs[v7++]); 11591 pBspRenderer->AddFaceToRenderList_d3d(node_id, v2->pFaceIDs[v7++]);
11593 } 11592 }
11594 else 11593 else
11595 { 11594 {
11596 while ( v7 < v8 ) 11595 while ( v7 < v8 )
11597 pBspRenderer->AddFaceToRenderList_sw(v10, v2->pFaceIDs[v7++]); 11596 pBspRenderer->AddFaceToRenderList_sw(node_id, v2->pFaceIDs[v7++]);
11598 } 11597 }
11599 v9 = v11 ? v3->uFront : v3->uBack; 11598 v9 = v11 ? v3->uFront : v3->uBack;
11600 if ( v9 == -1 ) 11599 if ( v9 == -1 )
11601 break; 11600 break;
11602 uFirstNode = v9; 11601 uFirstNode = v9;