comparison mm7_1.cpp @ 50:fde5c5acb66e

BLV render
author Nomad
date Tue, 23 Oct 2012 23:38:05 +0200
parents 8a8dd0164b12
children 4211cceb3813
comparison
equal deleted inserted replaced
47:8a8dd0164b12 50:fde5c5acb66e
6392 //----- (00423B5D) -------------------------------------------------------- 6392 //----- (00423B5D) --------------------------------------------------------
6393 int __fastcall sub_423B5D(unsigned int uFaceID) 6393 int __fastcall sub_423B5D(unsigned int uFaceID)
6394 { 6394 {
6395 BLVFace *v1; // ebx@1 6395 BLVFace *v1; // ebx@1
6396 Vec3_short_ *v2; // esi@1 6396 Vec3_short_ *v2; // esi@1
6397 int v3; // ST28_4@1 6397 //int v3; // ST28_4@1
6398 __int16 v4; // ST2C_2@1 6398 __int16 v4; // ST2C_2@1
6399 signed int v5; // esi@1 6399 //signed int v5; // esi@1
6400 Vec3_short_ *v6; // eax@4 6400 //Vec3_short_ *v6; // eax@4
6401 signed int v7; // edi@5 6401 //signed int v7; // edi@5
6402 signed int v8; // eax@5 6402 //signed int v8; // eax@5
6403 signed int i_; // ecx@10 6403 //signed int i_; // ecx@10
6404 int v10; // eax@10 6404 int v10; // eax@10
6405 int v11; // edx@11 6405 int v11; // edx@11
6406 int v12; // ST28_4@12 6406 int v12; // ST28_4@12
6407 signed int v13; // edx@12 6407 signed int v13; // edx@12
6408 signed __int64 v14; // qtt@12 6408 signed __int64 v14; // qtt@12
6415 signed int v21; // ebx@19 6415 signed int v21; // ebx@19
6416 signed int v22; // esi@20 6416 signed int v22; // esi@20
6417 int v23; // edi@21 6417 int v23; // edi@21
6418 int v24; // eax@21 6418 int v24; // eax@21
6419 int v25; // eax@22 6419 int v25; // eax@22
6420 signed int v26; // ST30_4@24 6420 int v26; // eax@22
6421 signed __int64 v27; // qtt@24 6421 signed int v27; // ST30_4@24
6422 int v28; // ST18_4@25 6422 signed __int64 v28; // qtt@24
6423 int v29; // eax@26 6423 int v29; // ST18_4@25
6424 int v30; // eax@27 6424 int v30; // eax@26
6425 signed int v31; // ST30_4@29 6425 int v31; // eax@27
6426 signed __int64 v32; // qtt@29 6426 int v32; // eax@27
6427 int v33; // ST30_4@30 6427 signed int v33; // ST30_4@29
6428 signed int v34; // edi@31 6428 signed __int64 v34; // qtt@29
6429 unsigned int v35; // eax@31 6429 int v35; // ST30_4@30
6430 bool v36; // edx@31 6430 signed int v36; // edi@31
6431 int v37; // ecx@31 6431 unsigned int v37; // eax@31
6432 int v38; // ecx@32 6432 bool v38; // edx@31
6433 int v39; // esi@32 6433 int v39; // ecx@31
6434 int v40; // eax@34 6434 int v40; // ecx@32
6435 signed int v41; // ebx@41 6435 int v41; // esi@32
6436 unsigned int v42; // eax@41 6436 int v42; // eax@34
6437 signed int v43; // ecx@42 6437 signed int v43; // ebx@41
6438 int v44; // esi@42 6438 unsigned int v44; // eax@41
6439 int v45; // eax@44 6439 signed int v45; // ecx@42
6440 signed int v46; // edi@51 6440 int v46; // esi@42
6441 unsigned int v47; // eax@51 6441 int v47; // eax@44
6442 bool v48; // edx@51 6442 signed int v48; // edi@51
6443 int v49; // ecx@51 6443 unsigned int v49; // eax@51
6444 int v50; // ecx@52 6444 bool v50; // edx@51
6445 signed int v51; // esi@52 6445 int v51; // ecx@51
6446 int v52; // eax@54 6446 int v52; // ecx@52
6447 int v53; // ebx@61 6447 signed int v53; // esi@52
6448 unsigned int v54; // eax@61 6448 int v54; // eax@54
6449 signed int v55; // ecx@62 6449 int v55; // ebx@61
6450 int v56; // esi@62 6450 unsigned int v56; // eax@61
6451 int v57; // eax@64 6451 signed int v57; // ecx@62
6452 char v59; // zf@72 6452 int v58; // esi@62
6453 signed int v60; // edx@75 6453 int v59; // eax@64
6454 int v61; // ecx@76 6454 char v61; // zf@72
6455 int v62; // esi@76 6455 signed int v62; // edx@75
6456 int v63; // ecx@83 6456 int v63; // ecx@76
6457 signed int v64; // [sp+14h] [bp-14h]@3 6457 int v64; // esi@76
6458 int v65; // [sp+14h] [bp-14h]@34 6458 int v65; // ecx@83
6459 int v66; // [sp+14h] [bp-14h]@44 6459 //signed int v66; // [sp+14h] [bp-14h]@3
6460 int v67; // [sp+14h] [bp-14h]@54 6460 int v67; // [sp+14h] [bp-14h]@34
6461 int v68; // [sp+14h] [bp-14h]@64 6461 int v68; // [sp+14h] [bp-14h]@44
6462 signed int v69; // [sp+14h] [bp-14h]@75 6462 int v69; // [sp+14h] [bp-14h]@54
6463 IndoorCameraD3D *_this; // [sp+18h] [bp-10h]@1 6463 int v70; // [sp+14h] [bp-14h]@64
6464 signed int v71; // [sp+14h] [bp-14h]@75
6464 bool thisa; // [sp+18h] [bp-10h]@9 6465 bool thisa; // [sp+18h] [bp-10h]@9
6465 int thisb; // [sp+18h] [bp-10h]@12 6466 int thisb; // [sp+18h] [bp-10h]@12
6466 int thisc; // [sp+18h] [bp-10h]@20 6467 int thisc; // [sp+18h] [bp-10h]@20
6467 bool thisd; // [sp+18h] [bp-10h]@41 6468 bool thisd; // [sp+18h] [bp-10h]@41
6468 bool thise; // [sp+18h] [bp-10h]@61 6469 bool thise; // [sp+18h] [bp-10h]@61
6469 int thisf; // [sp+18h] [bp-10h]@74 6470 int thisf; // [sp+18h] [bp-10h]@74
6470 signed int v77; // [sp+1Ch] [bp-Ch]@9 6471 signed int v79; // [sp+1Ch] [bp-Ch]@9
6471 int v78; // [sp+1Ch] [bp-Ch]@76 6472 int v80; // [sp+1Ch] [bp-Ch]@76
6472 bool v79; // [sp+20h] [bp-8h]@10 6473 bool v81; // [sp+20h] [bp-8h]@10
6473 bool v80; // [sp+20h] [bp-8h]@32 6474 bool v82; // [sp+20h] [bp-8h]@32
6474 bool v81; // [sp+20h] [bp-8h]@42 6475 bool v83; // [sp+20h] [bp-8h]@42
6475 bool v82; // [sp+20h] [bp-8h]@52 6476 bool v84; // [sp+20h] [bp-8h]@52
6476 bool v83; // [sp+20h] [bp-8h]@62 6477 bool v85; // [sp+20h] [bp-8h]@62
6477 signed int i; // [sp+24h] [bp-4h]@9 6478 //signed int i; // [sp+24h] [bp-4h]@9
6478 signed int ia; // [sp+24h] [bp-4h]@19 6479 signed int ia; // [sp+24h] [bp-4h]@19
6479 signed int ib; // [sp+24h] [bp-4h]@31 6480 signed int ib; // [sp+24h] [bp-4h]@31
6480 signed int ic; // [sp+24h] [bp-4h]@41 6481 signed int ic; // [sp+24h] [bp-4h]@41
6481 signed int id; // [sp+24h] [bp-4h]@51 6482 signed int id; // [sp+24h] [bp-4h]@51
6482 signed int ie; // [sp+24h] [bp-4h]@61 6483 signed int ie; // [sp+24h] [bp-4h]@61
6483 6484
6484 v1 = &pIndoor->pFaces[uFaceID]; 6485 v1 = &pIndoor->pFaces[uFaceID];
6485 _this = pGame->pIndoorCameraD3D; 6486 //this = pGame->pIndoorCameraD3D;
6486 v2 = &pIndoor->pVertices[*v1->pVertexIDs]; 6487 v2 = &pIndoor->pVertices[*v1->pVertexIDs];
6487 v3 = *(int *)&v2->x; 6488 //v3 = *(_DWORD *)&v2->x;
6488 v4 = v2->z; 6489 v4 = v2->z;
6489 v5 = 0; 6490 //v5 = 0;
6490 if ( v1->pFacePlane_old.vNormal.x * ((signed __int16)v3 - pBLVRenderParams->vPartyPos.x) 6491 if ( v1->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x)
6491 + v1->pFacePlane_old.vNormal.y * (SHIWORD(v3) - pBLVRenderParams->vPartyPos.y) 6492 + v1->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y)
6492 + v1->pFacePlane_old.vNormal.z * (v4 - pBLVRenderParams->vPartyPos.z) < 0 ) 6493 + v1->pFacePlane_old.vNormal.z * (v4 - pBLVRenderParams->vPartyPos.z) < 0 )
6493 { 6494 {
6494 dword_50B700 = 1; 6495 dword_50B700 = 1;
6495 } 6496 }
6496 else 6497 else
6497 { 6498 {
6498 dword_50B700 = 0; 6499 dword_50B700 = 0;
6499 if ( !(v1->uAttributes & 1) ) 6500 if ( !(v1->uAttributes & 1) )
6500 return 0; 6501 return 0;
6501 } 6502 }
6502 v64 = v1->uNumVertices; 6503 //v66 = v1->uNumVertices;
6503 if ( (signed int)v1->uNumVertices > 0 ) 6504 for (uint i = 0; i < v1->uNumVertices; ++i)
6504 { 6505 {
6505 do 6506 auto v6 = &pIndoor->pVertices[v1->pVertexIDs[i]];
6506 { 6507 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(
6507 v6 = &pIndoor->pVertices[v1->pVertexIDs[v5]];
6508 _this->ApplyViewTransform_TrueIfStillVisible(
6509 v6->x, 6508 v6->x,
6510 v6->y, 6509 v6->y,
6511 v6->z, 6510 v6->z,
6512 &_50B924_view_transformed_xs[v5], 6511 &_50B924_view_transformed_xs[i],
6513 &_50B834_view_transformed_zs[v5], 6512 &_50B834_view_transformed_zs[i],
6514 &_50B744_view_transformed_ys[v5], 6513 &_50B744_view_transformed_ys[i],
6515 0); 6514 0);
6516 ++v5; 6515 }
6517 } 6516
6518 while ( v5 < v64 ); 6517 //v7 = v1->uNumVertices;
6519 } 6518 //v8 = 0;
6520 v7 = v64; 6519 if (v1->uNumVertices <= 0)
6521 v8 = 0;
6522 if ( v64 <= 0 )
6523 return 0; 6520 return 0;
6524 do 6521
6525 { 6522 bool bFound = false;
6526 if ( _50B924_view_transformed_xs[v8] >= 524288 ) 6523 for (uint i = 0; i < v1->uNumVertices; ++i)
6524 if (_50B924_view_transformed_xs[i] >= 0x80000u)
6525 {
6526 bFound = true;
6527 break; 6527 break;
6528 ++v8; 6528 }
6529 } 6529 if (!bFound)
6530 while ( v8 < v64 );
6531 if ( v8 >= v64 )
6532 return 0; 6530 return 0;
6533 v77 = 0; 6531
6534 _50B924_view_transformed_xs[v64] = _50B924_view_transformed_xs[0]; 6532 v79 = 0;
6535 _50B834_view_transformed_zs[v64] = _50B834_view_transformed_zs[0]; 6533 _50B924_view_transformed_xs[v1->uNumVertices] = _50B924_view_transformed_xs[0];
6536 _50B744_view_transformed_ys[v64] = _50B744_view_transformed_ys[0]; 6534 _50B834_view_transformed_zs[v1->uNumVertices] = _50B834_view_transformed_zs[0];
6537 thisa = _50B924_view_transformed_xs[0] >= 524288; 6535 _50B744_view_transformed_ys[v1->uNumVertices] = _50B744_view_transformed_ys[0];
6538 i = 1; 6536 thisa = _50B924_view_transformed_xs[0] >= 0x80000u;
6539 if ( v64 >= 1 ) 6537 //int i = 1;
6540 { 6538 for (uint i = 1; i < v1->uNumVertices; ++i)
6541 do 6539 {
6542 {
6543 i_ = i;
6544 v10 = _50B924_view_transformed_xs[i]; 6540 v10 = _50B924_view_transformed_xs[i];
6545 v79 = v10 >= 524288; 6541 v81 = v10 >= (signed int)0x80000u;
6546 if ( thisa ^ v79 ) 6542 if ( thisa ^ v81 )
6547 { 6543 {
6548 v11 = _50B924_view_transformed_xs_minus1[i_]; 6544 v11 = _50B924_view_transformed_xs[i - 1];
6549 if ( v10 >= 524288 ) 6545 if ( v10 >= (signed int)0x80000u )
6550 { 6546 {
6551 v12 = v10 - v11; 6547 v12 = v10 - v11;
6552 v13 = 524288 - v11; 6548 v13 = 0x80000 - v11;
6553 LODWORD(v14) = v13 << 16; 6549 LODWORD(v14) = v13 << 16;
6554 HIDWORD(v14) = v13 >> 16; 6550 HIDWORD(v14) = v13 >> 16;
6555 v15 = &_50B744_view_transformed_ys_minus1[i_]; 6551 v15 = &_50B744_view_transformed_ys[i - 1];
6556 dword_50B828[v77] = ((unsigned __int64)((_50B834_view_transformed_zs[i_] - _50B834_view_transformed_zs_minus1[i_]) 6552 dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i] - _50B834_view_transformed_zs[i - 1])
6557 * v14 6553 * v14
6558 / v12) >> 16) 6554 / v12) >> 16)
6559 + _50B834_view_transformed_zs_minus1[i_]; 6555 + _50B834_view_transformed_zs[i - 1];
6560 thisb = (unsigned __int64)((_50B744_view_transformed_ys[i_] - _50B744_view_transformed_ys_minus1[i_]) * v14 / v12) >> 16; 6556 thisb = (unsigned __int64)((_50B744_view_transformed_ys[i] - _50B744_view_transformed_ys[i - 1]) * v14 / v12) >> 16;
6561 } 6557 }
6562 else 6558 else
6563 { 6559 {
6564 v16 = v11 - v10; 6560 v16 = v11 - v10;
6565 v17 = 524288 - v10; 6561 v17 = 0x80000 - v10;
6566 LODWORD(v18) = v17 << 16; 6562 LODWORD(v18) = v17 << 16;
6567 HIDWORD(v18) = v17 >> 16; 6563 HIDWORD(v18) = v17 >> 16;
6568 v15 = &_50B744_view_transformed_ys[i_]; 6564 v15 = &_50B744_view_transformed_ys[i];
6569 dword_50B828[v77] = ((unsigned __int64)((_50B834_view_transformed_zs_minus1[i_] - _50B834_view_transformed_zs[i_]) 6565 dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i - 1] - _50B834_view_transformed_zs[i])
6570 * v18 6566 * v18
6571 / v16) >> 16) 6567 / v16) >> 16)
6572 + _50B834_view_transformed_zs[i_]; 6568 + _50B834_view_transformed_zs[i];
6573 thisb = (unsigned __int64)((_50B744_view_transformed_ys_minus1[i_] - _50B744_view_transformed_ys[i_]) * v18 / v16) >> 16; 6569 thisb = (unsigned __int64)((_50B744_view_transformed_ys[i - 1] - _50B744_view_transformed_ys[i]) * v18 / v16) >> 16;
6574 } 6570 }
6575 v19 = v77++; 6571 v19 = v79++;
6576 v7 = v64; 6572 //v7 = v66;
6577 dword_50B738[v19] = thisb + *v15; 6573 dword_50B738[v19] = thisb + *v15;
6578 dword_50B918[v19] = 524288; 6574 dword_50B918[v19] = 0x80000u;
6579 } 6575 }
6580 if ( v79 ) 6576 if ( v81 )
6581 { 6577 {
6582 v20 = v77++; 6578 v20 = v79++;
6583 dword_50B918[v20] = _50B924_view_transformed_xs[i_]; 6579 dword_50B918[v20] = _50B924_view_transformed_xs[i];
6584 dword_50B828[v20] = _50B834_view_transformed_zs[i_]; 6580 dword_50B828[v20] = _50B834_view_transformed_zs[i];
6585 dword_50B738[v20] = _50B744_view_transformed_ys[i_]; 6581 dword_50B738[v20] = _50B744_view_transformed_ys[i];
6586 } 6582 }
6587 ++i; 6583 //++i;
6588 thisa = v79; 6584 thisa = v81;
6589 }
6590 while ( i <= v7 );
6591 } 6585 }
6592 ia = 0; 6586 ia = 0;
6593 v21 = v77; 6587 v21 = v79;
6594 dword_50B918[v77] = dword_50B918[0]; 6588 dword_50B918[v79] = dword_50B918[0];
6595 dword_50B828[v77] = dword_50B828[0]; 6589 dword_50B828[v79] = dword_50B828[0];
6596 for ( dword_50B738[v77] = dword_50B738[0]; ia < v77; dword_50BA08[v22] = pBLVRenderParams->uViewportCenterY - v33 ) 6590 for ( dword_50B738[v79] = dword_50B738[0]; ia < v79; dword_50BA08[v22] = pBLVRenderParams->uViewportCenterY - v35 )
6597 { 6591 {
6598 v22 = ia; 6592 v22 = ia;
6599 thisc = abs(dword_50B918[ia]); 6593 thisc = abs(dword_50B918[ia]);
6600 if ( abs(dword_50B828[ia]) >> 13 <= thisc ) 6594 if ( abs(dword_50B828[ia]) >> 13 <= thisc )
6601 { 6595 {
6602 v26 = dword_50B828[v22]; 6596 v27 = dword_50B828[v22];
6603 LODWORD(v27) = v26 << 16; 6597 LODWORD(v28) = v27 << 16;
6604 HIDWORD(v27) = v26 >> 16; 6598 HIDWORD(v28) = v27 >> 16;
6605 v25 = v27 / dword_50B918[v22]; 6599 v26 = v28 / dword_50B918[v22];
6606 v23 = 0; 6600 v23 = 0;
6607 } 6601 }
6608 else 6602 else
6609 { 6603 {
6610 v23 = 0; 6604 v23 = 0;
6611 v24 = 0; 6605 v24 = 0;
6612 if ( dword_50B828[v22] >= 0 ) 6606 if ( dword_50B828[v22] >= 0 )
6613 { 6607 {
6614 LOBYTE(v24) = dword_50B918[v22] >= 0; 6608 LOBYTE(v24) = dword_50B918[v22] >= 0;
6615 v25 = ((v24 - 1) & 0xFF800000) + 0x400000; 6609 v26 = ((v24 - 1) & 0xFF800000) + 0x400000;
6616 } 6610 }
6617 else 6611 else
6618 { 6612 {
6619 LOBYTE(v24) = dword_50B918[v22] >= 0; 6613 LOBYTE(v24) = dword_50B918[v22] >= 0;
6620 v25 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & (v24 - 1)) - 4194304; 6614 v25 = v24 - 1;
6621 } 6615 v26 = (v25 & 0x800000) - 0x400000;
6622 } 6616 }
6623 v28 = dword_50B738[v22]; 6617 }
6624 dword_50BAF8_xs[v22] = v25; 6618 v29 = dword_50B738[v22];
6625 if ( abs(v28) >> 13 <= thisc ) 6619 dword_50BAF4_xs[v22 + 1] = v26;
6626 { 6620 if ( abs(v29) >> 13 <= thisc )
6627 v31 = dword_50B738[v22]; 6621 {
6628 LODWORD(v32) = v31 << 16; 6622 v33 = dword_50B738[v22];
6629 HIDWORD(v32) = v31 >> 16; 6623 LODWORD(v34) = v33 << 16;
6630 v30 = v32 / dword_50B918[v22]; 6624 HIDWORD(v34) = v33 >> 16;
6625 v32 = v34 / dword_50B918[v22];
6631 } 6626 }
6632 else 6627 else
6633 { 6628 {
6634 v29 = 0; 6629 v30 = 0;
6635 if ( dword_50B738[v22] >= v23 ) 6630 if ( dword_50B738[v22] >= v23 )
6636 { 6631 {
6637 LOBYTE(v29) = dword_50B918[v22] >= v23; 6632 LOBYTE(v30) = dword_50B918[v22] >= v23;
6638 v30 = ((v29 - 1) & 0xFF800000) + 4194304; 6633 v32 = ((v30 - 1) & 0xFF800000) + 0x400000;
6639 } 6634 }
6640 else 6635 else
6641 { 6636 {
6642 LOBYTE(v29) = dword_50B918[v22] >= v23; 6637 LOBYTE(v30) = dword_50B918[v22] >= v23;
6643 v30 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & (v29 - 1)) - 4194304; 6638 v31 = v30 - 1;
6644 } 6639 v32 = (v31 & 0x800000) - 0x400000;
6645 } 6640 }
6646 dword_50BA08[v22] = v30; 6641 }
6647 dword_50BAF8_xs[v22] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BAF8_xs[v22]) >> 16; 6642 dword_50BA08[v22] = v32;
6648 v33 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08[v22]) >> 16; 6643 dword_50BAF4_xs[v22 + 1] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)
6649 dword_50BAF8_xs[v22] = pBLVRenderParams->uViewportCenterX - dword_50BAF8_xs[v22]; 6644 * (signed __int64)dword_50BAF4_xs[v22 + 1]) >> 16;
6645 v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08[v22]) >> 16;
6646 dword_50BAF4_xs[v22 + 1] = pBLVRenderParams->uViewportCenterX - dword_50BAF4_xs[v22 + 1];
6650 ++ia; 6647 ++ia;
6651 } 6648 }
6652 v34 = 0; 6649 v36 = 0;
6653 dword_50BAF8_xs[v21] = dword_50BAF8_xs[0]; 6650 dword_50BAF4_xs[v21 + 1] = dword_50BAF4_xs[1];
6654 dword_50BA08[v21] = dword_50BA08[0]; 6651 dword_50BA08[v21] = dword_50BA08[0];
6655 v35 = pBLVRenderParams->uViewportX; 6652 v37 = pBLVRenderParams->uViewportX;
6656 v36 = dword_50BAF8_xs[0] < (signed int)pBLVRenderParams->uViewportX; 6653 v38 = dword_50BAF4_xs[1] < (signed int)pBLVRenderParams->uViewportX;
6657 LOBYTE(v36) = dword_50BAF8_xs[0] >= (signed int)pBLVRenderParams->uViewportX; 6654 LOBYTE(v38) = dword_50BAF4_xs[1] >= (signed int)pBLVRenderParams->uViewportX;
6658 v37 = 1; 6655 v39 = 1;
6659 ib = 1; 6656 ib = 1;
6660 if ( v77 < 1 ) 6657 if ( v79 < 1 )
6661 return 0; 6658 return 0;
6662 do 6659 do
6663 { 6660 {
6664 v38 = v37; 6661 v40 = v39;
6665 v39 = dword_50BAF8_xs[v38]; 6662 v41 = dword_50BAF4_xs[v40 + 1];
6666 v80 = v39 >= (signed int)v35; 6663 v82 = v41 >= (signed int)v37;
6667 if ( v36 ^ v80 ) 6664 if ( v38 ^ v82 )
6668 { 6665 {
6669 if ( v39 >= (signed int)v35 ) 6666 if ( v41 >= (signed int)v37 )
6670 { 6667 {
6671 v65 = (signed int)(v35 - dword_50BAF4[v38]) 6668 v67 = (signed int)(v37 - dword_50BAF4_xs[v40])
6672 * (signed __int64)(dword_50BA08[v38] - dword_50B9F8[v38 + 3]) 6669 * (signed __int64)(dword_50BA08[v40] - dword_50B9F8[v40 + 3])
6673 / (v39 - dword_50BAF4[v38]); 6670 / (v41 - dword_50BAF4_xs[v40]);
6674 v40 = dword_50B9F8[v38 + 3]; 6671 v42 = dword_50B9F8[v40 + 3];
6675 } 6672 }
6676 else 6673 else
6677 { 6674 {
6678 v65 = (signed int)(v35 - v39) 6675 v67 = (signed int)(v37 - v41)
6679 * (signed __int64)(dword_50B9F8[v38 + 3] - dword_50BA08[v38]) 6676 * (signed __int64)(dword_50B9F8[v40 + 3] - dword_50BA08[v40])
6680 / (dword_50BAF4[v38] - v39); 6677 / (dword_50BAF4_xs[v40] - v41);
6681 v40 = dword_50BA08[v38]; 6678 v42 = dword_50BA08[v40];
6682 } 6679 }
6683 ++v34; 6680 ++v36;
6684 dword_50B9F8[v34] = v65 + v40; 6681 dword_50B9F8[v36] = v67 + v42;
6685 v35 = pBLVRenderParams->uViewportX; 6682 v37 = pBLVRenderParams->uViewportX;
6686 dword_50BAE8[v34] = pBLVRenderParams->uViewportX; 6683 dword_50BAE8_xs[v36] = pBLVRenderParams->uViewportX;
6687 } 6684 }
6688 v36 = v80; 6685 v38 = v82;
6689 if ( v80 ) 6686 if ( v82 )
6690 { 6687 {
6691 dword_50BAEC_xs[v34] = dword_50BAF8_xs[v38]; 6688 dword_50BAE8_xs[v36 + 1] = dword_50BAF4_xs[v40 + 1];
6692 dword_50B9F8[v34++ + 1] = dword_50BA08[v38]; 6689 dword_50B9F8[v36++ + 1] = dword_50BA08[v40];
6693 } 6690 }
6694 v37 = ib++ + 1; 6691 v39 = ib++ + 1;
6695 } 6692 }
6696 while ( ib <= v77 ); 6693 while ( ib <= v79 );
6697 if ( !v34 6694
6698 || (v41 = 0, 6695 if ( !v36
6699 dword_50BAEC_xs[v34] = dword_50BAEC_xs[0], 6696 || (v43 = 0,
6700 dword_50B9F8[v34 + 1] = dword_50B9F8[1], 6697 dword_50BAE8_xs[v36 + 1] = dword_50BAE8_xs[1],
6701 v42 = pBLVRenderParams->uViewportZ, 6698 dword_50B9F8[v36 + 1] = dword_50B9F8[1],
6702 thisd = dword_50BAEC_xs[0] <= (signed int)pBLVRenderParams->uViewportZ, 6699 v44 = pBLVRenderParams->uViewportZ,
6700 thisd = dword_50BAE8_xs[1] <= (signed int)pBLVRenderParams->uViewportZ,
6703 ic = 1, 6701 ic = 1,
6704 v34 < 1) ) 6702 v36 < 1) )
6703 return 0;
6704
6705 do
6706 {
6707 v45 = ic;
6708 v46 = dword_50BAE8_xs[ic + 1];
6709 v83 = v46 <= (signed int)v44;
6710 if ( thisd ^ v83 )
6711 {
6712 if ( v46 <= (signed int)v44 )
6713 {
6714 v68 = (signed int)(v44 - dword_50BAE8_xs[v45])
6715 * (signed __int64)(dword_50B9F8[v45 + 1] - dword_50B9F8[v45])
6716 / (v46 - dword_50BAE8_xs[v45]);
6717 v47 = dword_50B9F8[v45];
6718 }
6719 else
6720 {
6721 v68 = (signed int)(v44 - v46)
6722 * (signed __int64)(dword_50B9F8[v45] - dword_50B9F8[v45 + 1])
6723 / (dword_50BAE8_xs[v45] - v46);
6724 v47 = dword_50B9F8[v45 + 1];
6725 }
6726 ++v43;
6727 dword_50B9EC[v43] = v68 + v47;
6728 v44 = pBLVRenderParams->uViewportZ;
6729 dword_50BADC_xs[v43] = pBLVRenderParams->uViewportZ;
6730 }
6731 if ( v83 )
6732 {
6733 dword_50BAE0[v43] = dword_50BAE8_xs[v45 + 1];
6734 dword_50B9F0[v43++] = dword_50B9F8[v45 + 1];
6735 }
6736 ++ic;
6737 thisd = v83;
6738 }
6739 while ( ic <= v36 );
6740 if ( !v43
6741 || (v48 = 0,
6742 dword_50BAE0[v43] = dword_50BAE0[0],
6743 dword_50B9F0[v43] = dword_50B9F0[0],
6744 v49 = pBLVRenderParams->uViewportY,
6745 v50 = dword_50B9F0[0] < (signed int)pBLVRenderParams->uViewportY,
6746 LOBYTE(v50) = dword_50B9F0[0] >= (signed int)pBLVRenderParams->uViewportY,
6747 v51 = 1,
6748 id = 1,
6749 v43 < 1) )
6705 return 0; 6750 return 0;
6706 do 6751 do
6707 { 6752 {
6708 v43 = ic; 6753 v52 = v51;
6709 v44 = dword_50BAEC_xs[ic]; 6754 v53 = dword_50B9F0[v52];
6710 v81 = v44 <= (signed int)v42; 6755 v84 = v53 >= (signed int)v49;
6711 if ( thisd ^ v81 ) 6756 if ( v50 ^ v84 )
6712 { 6757 {
6713 if ( v44 <= (signed int)v42 ) 6758 if ( v53 >= (signed int)v49 )
6714 { 6759 {
6715 v66 = (signed int)(v42 - dword_50BAE8[v43]) 6760 v69 = (signed int)(v49 - dword_50B9EC[v52])
6716 * (signed __int64)(dword_50B9F8[v43 + 1] - dword_50B9F8[v43]) 6761 * (signed __int64)(dword_50BAE0[v52] - dword_50BADC_xs[v52])
6717 / (v44 - dword_50BAE8[v43]); 6762 / (v53 - dword_50B9EC[v52]);
6718 v45 = dword_50B9F8[v43]; 6763 v54 = dword_50BADC_xs[v52];
6719 } 6764 }
6720 else 6765 else
6721 { 6766 {
6722 v66 = (signed int)(v42 - v44) 6767 v69 = (signed int)(v49 - v53)
6723 * (signed __int64)(dword_50B9F8[v43] - dword_50B9F8[v43 + 1]) 6768 * (signed __int64)(dword_50BADC_xs[v52] - dword_50BAE0[v52])
6724 / (dword_50BAE8[v43] - v44); 6769 / (dword_50B9EC[v52] - v53);
6725 v45 = dword_50B9F8[v43 + 1]; 6770 v54 = dword_50BAE0[v52];
6726 } 6771 }
6727 ++v41; 6772 ++v48;
6728 dword_50B9EC[v41] = v66 + v45; 6773 dword_50BAD0[v48] = v69 + v54;
6729 v42 = pBLVRenderParams->uViewportZ; 6774 v49 = pBLVRenderParams->uViewportY;
6730 dword_50BADC_xs[v41] = pBLVRenderParams->uViewportZ; 6775 dword_50B9E0_ys[v48] = pBLVRenderParams->uViewportY;
6731 } 6776 }
6732 if ( v81 ) 6777 v50 = v84;
6733 { 6778 if ( v84 )
6734 dword_50BAE0[v41] = dword_50BAEC_xs[v43]; 6779 {
6735 dword_50B9F0[v41++] = dword_50B9F8[v43 + 1]; 6780 dword_50BAD4[v48] = dword_50BAE0[v52];
6736 } 6781 dword_50B9E0_ys[v48++ + 1] = dword_50B9F0[v52];
6737 ++ic; 6782 }
6738 thisd = v81; 6783 v51 = id++ + 1;
6739 } 6784 }
6740 while ( ic <= v34 ); 6785 while ( id <= v43 );
6741 if ( !v41 6786 if ( !v48
6742 || (v46 = 0, 6787 || (v55 = 0,
6743 dword_50BAE0[v41] = dword_50BAE0[0], 6788 dword_50BAD4[v48] = dword_50BAD4[0],
6744 dword_50B9F0[v41] = dword_50B9F0[0], 6789 dword_50B9E0_ys[v48 + 1] = dword_50B9E0_ys[1],
6745 v47 = pBLVRenderParams->uViewportY, 6790 v56 = pBLVRenderParams->uViewportW,
6746 v48 = dword_50B9F0[0] < (signed int)pBLVRenderParams->uViewportY, 6791 thise = dword_50B9E0_ys[1] <= (signed int)pBLVRenderParams->uViewportW,
6747 LOBYTE(v48) = dword_50B9F0[0] >= (signed int)pBLVRenderParams->uViewportY, 6792 ie = 1,
6748 v49 = 1, 6793 v48 < 1) )
6749 id = 1,
6750 v41 < 1) )
6751 return 0; 6794 return 0;
6752 do 6795 do
6753 { 6796 {
6754 v50 = v49; 6797 v57 = ie;
6755 v51 = dword_50B9F0[v50]; 6798 v58 = dword_50B9E0_ys[ie + 1];
6756 v82 = v51 >= (signed int)v47; 6799 v85 = v58 <= (signed int)v56;
6757 if ( v48 ^ v82 ) 6800 if ( thise ^ v85 )
6758 { 6801 {
6759 if ( v51 >= (signed int)v47 ) 6802 if ( v58 <= (signed int)v56 )
6760 { 6803 {
6761 v67 = (signed int)(v47 - dword_50B9EC[v50]) 6804 v70 = (signed int)(v56 - dword_50B9E0_ys[v57])
6762 * (signed __int64)(dword_50BAE0[v50] - dword_50BADC_xs[v50]) 6805 * (signed __int64)(dword_50BAD4[v57] - dword_50BAD0[v57])
6763 / (v51 - dword_50B9EC[v50]); 6806 / (v58 - dword_50B9E0_ys[v57]);
6764 v52 = dword_50BADC_xs[v50]; 6807 v59 = dword_50BAD0[v57];
6765 } 6808 }
6766 else 6809 else
6767 { 6810 {
6768 v67 = (signed int)(v47 - v51) 6811 v70 = (signed int)(v56 - v58)
6769 * (signed __int64)(dword_50BADC_xs[v50] - dword_50BAE0[v50]) 6812 * (signed __int64)(dword_50BAD0[v57] - dword_50BAD4[v57])
6770 / (dword_50B9EC[v50] - v51); 6813 / (dword_50B9E0_ys[v57] - v58);
6771 v52 = dword_50BAE0[v50]; 6814 v59 = dword_50BAD4[v57];
6772 } 6815 }
6773 ++v46; 6816 ++v55;
6774 dword_50BAD0[v46] = v67 + v52; 6817 dword_50BAC4[v55] = v70 + v59;
6775 v47 = pBLVRenderParams->uViewportY; 6818 v56 = pBLVRenderParams->uViewportW;
6776 dword_50B9E0_ys[v46] = pBLVRenderParams->uViewportY; 6819 unk_50B9D4[v55] = pBLVRenderParams->uViewportW;
6777 } 6820 }
6778 v48 = v82; 6821 if ( v85 )
6779 if ( v82 ) 6822 {
6780 { 6823 dword_50BAC8[v55] = dword_50BAD4[v57];
6781 dword_50BAD4[v46] = dword_50BAE0[v50]; 6824 dword_50B9D8_ys[v55++] = dword_50B9E0_ys[v57 + 1];
6782 dword_50B9E0_ys[v46++ + 1] = dword_50B9F0[v50]; 6825 }
6783 } 6826 ++ie;
6784 v49 = id++ + 1; 6827 thise = v85;
6785 } 6828 }
6786 while ( id <= v41 ); 6829 while ( ie <= v48 );
6787 if ( !v46 6830 if ( !v55 )
6788 || (v53 = 0,
6789 dword_50BAD4[v46] = dword_50BAD4[0],
6790 dword_50B9E0_ys[v46 + 1] = dword_50B9E0_ys[1],
6791 v54 = pBLVRenderParams->uViewportW,
6792 thise = dword_50B9E0_ys[1] <= (signed int)pBLVRenderParams->uViewportW,
6793 ie = 1,
6794 v46 < 1) )
6795 return 0; 6831 return 0;
6796 do 6832 v61 = pRenderer->pRenderD3D == 0;
6797 { 6833 dword_50BAC8[v55] = dword_50BAC8[0];
6798 v55 = ie; 6834 dword_50B9D8_ys[v55] = dword_50B9D8_ys[0];
6799 v56 = dword_50B9E0_ys[ie + 1]; 6835 if ( v61 && v55 > 3 )
6800 v83 = v56 <= (signed int)v54; 6836 {
6801 if ( thise ^ v83 ) 6837 dword_50BAC8[v55 + 1] = dword_50BAC8[1];
6802 { 6838 dword_50B9D8_ys[v55 + 1] = dword_50B9D8_ys[1];
6803 if ( v56 <= (signed int)v54 )
6804 {
6805 v68 = (signed int)(v54 - dword_50B9E0_ys[v55])
6806 * (signed __int64)(dword_50BAD4[v55] - dword_50BAD0[v55])
6807 / (v56 - dword_50B9E0_ys[v55]);
6808 v57 = dword_50BAD0[v55];
6809 }
6810 else
6811 {
6812 v68 = (signed int)(v54 - v56)
6813 * (signed __int64)(dword_50BAD0[v55] - dword_50BAD4[v55])
6814 / (dword_50B9E0_ys[v55] - v56);
6815 v57 = dword_50BAD4[v55];
6816 }
6817 ++v53;
6818 dword_50BAC4[v53] = v68 + v57;
6819 v54 = pBLVRenderParams->uViewportW;
6820 unk_50B9D4[v53] = pBLVRenderParams->uViewportW;
6821 }
6822 if ( v83 )
6823 {
6824 dword_50BAC8[v53] = dword_50BAD4[v55];
6825 dword_50B9D8_ys[v53++] = dword_50B9E0_ys[v55 + 1];
6826 }
6827 ++ie;
6828 thise = v83;
6829 }
6830 while ( ie <= v46 );
6831 if ( !v53 )
6832 return 0;
6833 v59 = pRenderer->pRenderD3D == 0;
6834 dword_50BAC8[v53] = dword_50BAC8[0];
6835 dword_50B9D8_ys[v53] = dword_50B9D8_ys[0];
6836 if ( v59 && v53 > 3 )
6837 {
6838 dword_50BAC8[v53 + 1] = dword_50BAC8[1];
6839 dword_50B9D8_ys[v53 + 1] = dword_50B9D8_ys[1];
6840 thisf = 2 * (dword_50B700 != 0) - 1; 6839 thisf = 2 * (dword_50B700 != 0) - 1;
6841 if ( v53 > 0 ) 6840 if ( v55 > 0 )
6842 { 6841 {
6843 v60 = 1; 6842 v62 = 1;
6844 v69 = 1; 6843 v71 = 1;
6845 do 6844 do
6846 { 6845 {
6847 v61 = v60 - 1; 6846 v63 = v62 - 1;
6848 v62 = v60 + 1; 6847 v64 = v62 + 1;
6849 v78 = v60 + 1; 6848 v80 = v62 + 1;
6850 if ( v60 - 1 >= v53 ) 6849 if ( v62 - 1 >= v55 )
6851 v61 -= v53; 6850 v63 -= v55;
6852 if ( v60 >= v53 ) 6851 if ( v62 >= v55 )
6853 v60 -= v53; 6852 v62 -= v55;
6854 if ( v62 >= v53 ) 6853 if ( v64 >= v55 )
6855 v62 -= v53; 6854 v64 -= v55;
6856 if ( thisf 6855 if ( thisf
6857 * ((dword_50B9D8_ys[v62] - dword_50B9D8_ys[v61]) * (dword_50BAC8[v60] - dword_50BAC8[v61]) 6856 * ((dword_50B9D8_ys[v64] - dword_50B9D8_ys[v63]) * (dword_50BAC8[v62] - dword_50BAC8[v63])
6858 - (dword_50B9D8_ys[v60] - dword_50B9D8_ys[v61]) * (dword_50BAC8[v62] - dword_50BAC8[v61])) < 0 ) 6857 - (dword_50B9D8_ys[v62] - dword_50B9D8_ys[v63]) * (dword_50BAC8[v64] - dword_50BAC8[v63])) < 0 )
6859 { 6858 {
6860 v60 = v78; 6859 v62 = v80;
6861 v69 = v78; 6860 v71 = v80;
6862 } 6861 }
6863 else 6862 else
6864 { 6863 {
6865 v60 = v69; 6864 v62 = v71;
6866 v63 = v69; 6865 v65 = v71;
6867 if ( v69 < v53 || (v63 = v69 - v53, v69 - v53 < v53) ) 6866 if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) )
6868 { 6867 {
6869 memcpy(&dword_50B9D8_ys[v63], &dword_50B9D8_ys[v63 + 1], 4 * ((unsigned int)(4 * (v53 - v63)) >> 2)); 6868 memcpy(&dword_50B9D8_ys[v65], &dword_50B9D8_ys[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2));
6870 memcpy(&dword_50BAC8[v63], &dword_50BAC8[v63 + 1], 4 * ((unsigned int)(4 * (v53 - v63)) >> 2)); 6869 memcpy(&dword_50BAC8[v65], &dword_50BAC8[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2));
6871 } 6870 }
6872 --v53; 6871 --v55;
6873 } 6872 }
6874 } 6873 }
6875 while ( v60 - 1 < v53 ); 6874 while ( v62 - 1 < v55 );
6876 } 6875 }
6877 dword_50BAC8[v53] = dword_50BAC8[0]; 6876 dword_50BAC8[v55] = dword_50BAC8[0];
6878 dword_50B9D8_ys[v53] = dword_50B9D8_ys[0]; 6877 dword_50B9D8_ys[v55] = dword_50B9D8_ys[0];
6879 } 6878 }
6880 return v53; 6879 return v55;
6881 } 6880 }
6882 6881
6883 6882
6884 //----- (00424579) -------------------------------------------------------- 6883 //----- (00424579) --------------------------------------------------------
6885 int __fastcall sub_424579(int uFaceID, stru320 *a2) 6884 int __fastcall sub_424579(int uFaceID, stru320 *a2)