comparison mm7_5.cpp @ 1471:736973e11d11

sub_4075DB cleaned
author zipi
date Mon, 26 Aug 2013 20:59:51 +0100
parents bba0944c9b27
children 2395e99b89d0
comparison
equal deleted inserted replaced
1470:c987b5ed09af 1471:736973e11d11
4596 } 4596 }
4597 4597
4598 //----- (004075DB) -------------------------------------------------------- 4598 //----- (004075DB) --------------------------------------------------------
4599 bool __fastcall sub_4075DB(int a1, int a2, int a3, BLVFace *a4) 4599 bool __fastcall sub_4075DB(int a1, int a2, int a3, BLVFace *a4)
4600 { 4600 {
4601 BLVFace *v4; // eax@1
4602 unsigned int v5; // esi@1 4601 unsigned int v5; // esi@1
4603 signed int v6; // esi@2
4604 char v7; // zf@2 4602 char v7; // zf@2
4605 int v8; // edi@2 4603 int v8; // edi@2
4606 Vec3_short_ *v9; // ecx@3 4604 Vec3_short_ *v9; // ecx@3
4607 int v10; // edx@4 4605 int v10; // edx@4
4608 signed int v11; // esi@7
4609 Vec3_short_ *v12; // ecx@8 4606 Vec3_short_ *v12; // ecx@8
4610 int v13; // edx@9 4607 int v13; // edx@9
4611 signed int v14; // esi@11
4612 Vec3_short_ *v15; // ecx@12 4608 Vec3_short_ *v15; // ecx@12
4613 int v16; // edx@13 4609 int v16; // edx@13
4614 int v17; // eax@14
4615 bool v18; // esi@14 4610 bool v18; // esi@14
4616 int v19; // ecx@14 4611 int v19; // ecx@14
4617 int v20; // ecx@16 4612 int v20; // ecx@16
4618 int v21; // edx@16 4613 int v21; // edx@16
4619 int v22; // eax@17 4614 int v22; // eax@17
4620 signed int v23; // ebx@18 4615 signed int v23; // ebx@18
4621 int v24; // esi@20 4616 int v24; // esi@20
4622 signed int v25; // eax@22 4617 signed int v25; // eax@22
4623 signed __int64 v26; // qtt@22 4618 signed __int64 v26; // qtt@22
4624 bool result; // eax@25 4619 bool result; // eax@25
4625 int v28; // [sp+8h] [bp-14h]@14
4626 int v29; // [sp+10h] [bp-Ch]@14 4620 int v29; // [sp+10h] [bp-Ch]@14
4627 signed int a3a; // [sp+24h] [bp+8h]@14 4621 signed int a3a; // [sp+24h] [bp+8h]@14
4628 int a4a; // [sp+28h] [bp+Ch]@2 4622 int a4a; // [sp+28h] [bp+Ch]@2
4629 4623
4630 __debugbreak(); 4624 __debugbreak();
4631 4625
4632 v4 = a4;
4633 v5 = a4->uAttributes; 4626 v5 = a4->uAttributes;
4634 if ( v5 & 0x100 ) 4627 if ( v5 & FACE_XY_PLANE )
4635 { 4628 {
4636 v6 = 0;
4637 v7 = a4->uNumVertices == 0;
4638 a4a = a1; 4629 a4a = a1;
4639 v8 = a2; 4630 v8 = a2;
4640 if ( !v7 ) 4631 v9 = pIndoor->pVertices;
4641 { 4632 for(int i = 0; i < a4->uNumVertices; i++)
4642 v9 = pIndoor->pVertices; 4633 {
4643 do 4634 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x;
4644 { 4635 dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i+1]].y;
4645 dword_4F5D98_xs[v6] = v9[v4->pVertexIDs[v6]].x; 4636 }
4646 v10 = v4->pVertexIDs[v6++];
4647 dword_4F5CC4_ys[v6] = v9[v10].y;
4648 }
4649 while ( v6 < v4->uNumVertices );
4650 }
4651 } 4637 }
4652 else 4638 else
4653 { 4639 {
4654 v8 = a3; 4640 v8 = a3;
4655 if ( v5 & 0x200 ) 4641 if ( v5 & FACE_XY_PLANE )
4656 { 4642 {
4657 v11 = 0;
4658 v7 = a4->uNumVertices == 0;
4659 a4a = a1; 4643 a4a = a1;
4660 if ( !v7 ) 4644 v9 = pIndoor->pVertices;
4661 { 4645 for(int i = 0; i < a4->uNumVertices; i++)
4662 v12 = pIndoor->pVertices; 4646 {
4663 do 4647 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x;
4664 { 4648 dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i+1]].z;
4665 dword_4F5D98_xs[v11] = v12[v4->pVertexIDs[v11]].x; 4649 }
4666 v13 = v4->pVertexIDs[v11++];
4667 dword_4F5CC4_ys[v11] = v12[v13].z;
4668 }
4669 while ( v11 < v4->uNumVertices );
4670 }
4671 } 4650 }
4672 else 4651 else
4673 { 4652 {
4674 v14 = 0;
4675 v7 = a4->uNumVertices == 0;
4676 a4a = a2; 4653 a4a = a2;
4677 if ( !v7 ) 4654 v9 = pIndoor->pVertices;
4678 { 4655 for(int i = 0; i < a4->uNumVertices; i++)
4679 v15 = pIndoor->pVertices; 4656 {
4680 do 4657 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].y;
4681 { 4658 dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i+1]].z;
4682 dword_4F5D98_xs[v14] = v15[v4->pVertexIDs[v14]].y; 4659 }
4683 v16 = v4->pVertexIDs[v14++];
4684 dword_4F5CC4_ys[v14] = v15[v16].z;
4685 }
4686 while ( v14 < v4->uNumVertices );
4687 }
4688 } 4660 }
4689 } 4661 }
4690 v17 = v4->uNumVertices;
4691 a3a = 0; 4662 a3a = 0;
4692 dword_4F5D98_xs[v17] = dword_4F5D98_xs[0]; 4663 dword_4F5D98_xs[a4->uNumVertices] = dword_4F5D98_xs[0];
4693 dword_4F5CC4_ys[v17 + 1] = dword_4F5CC4_ys[1]; 4664 dword_4F5CC4_ys[a4->uNumVertices + 1] = dword_4F5CC4_ys[1];
4694 v28 = v17; 4665 for(int i = 0; i < a4->uNumVertices; i++)
4695 v18 = dword_4F5CC4_ys[1] >= v8;
4696 v19 = 0;
4697 v29 = 0;
4698 if ( v17 <= 0 )
4699 return 0;
4700 do
4701 { 4666 {
4702 if ( a3a >= 2 ) 4667 if ( a3a >= 2 )
4703 break; 4668 break;
4704 v20 = v19; 4669 if ( dword_4F5CC4_ys[i + 1] >= v8 ^ (dword_4F5CC4_ys[i + 2] >= v8) )
4705 v21 = dword_4F5CC4_ys[v20 + 2];
4706 if ( v18 ^ (v21 >= v8) )
4707 { 4670 {
4708 v22 = dword_4F5D98_xs[v20 + 1]; 4671 if( dword_4F5D98_xs[i + 1] >= a4a || dword_4F5D98_xs[i] >= a4a)
4709 if ( v22 >= a4a )
4710 v23 = 0;
4711 else
4712 v23 = 2;
4713 v24 = v23 | (dword_4F5D98_xs[v20] < a4a);
4714 if ( v24 != 3 )
4715 { 4672 {
4716 if ( !v24 4673 if ( (dword_4F5D98_xs[i + 1] >= a4a && dword_4F5D98_xs[i] >= a4a)
4717 || (v25 = v22 - dword_4F5D98_xs[v20], 4674 || (v25 = dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i],
4718 LODWORD(v26) = v25 << 16, 4675 LODWORD(v26) = v25 << 16,
4719 HIDWORD(v26) = v25 >> 16, 4676 HIDWORD(v26) = v25 >> 16,
4720 dword_4F5D98_xs[v20] 4677 dword_4F5D98_xs[i]
4721 + ((signed int)(((unsigned __int64)(v26 4678 + ((signed int)(((unsigned __int64)(v26
4722 / (v21 - dword_4F5CC4_ys[v20 + 1]) 4679 / (dword_4F5CC4_ys[i + 2] - dword_4F5CC4_ys[i + 1])
4723 * ((v8 - dword_4F5CC4_ys[v20 + 1]) << 16)) >> 16) 4680 * ((v8 - dword_4F5CC4_ys[i + 1]) << 16)) >> 16)
4724 + 32768) >> 16) >= a4a) ) 4681 + 32768) >> 16) >= a4a) )
4725 ++a3a; 4682 ++a3a;
4726 } 4683 }
4727 } 4684 }
4728 v18 = v21 >= v8;
4729 v19 = v29++ + 1;
4730 } 4685 }
4731 while ( v29 < v28 );
4732 result = 1; 4686 result = 1;
4733 if ( a3a != 1 ) 4687 if ( a3a != 1 )
4734 result = 0; 4688 result = 0;
4735 return result; 4689 return result;
4736 } 4690 }