comparison mm7_5.cpp @ 1472:2395e99b89d0

sub_4077F1 cleaned, and fixed previous mistake in cleaning
author zipi
date Mon, 26 Aug 2013 21:40:29 +0100
parents 736973e11d11
children 5a29caf9b79d
comparison
equal deleted inserted replaced
1471:736973e11d11 1472:2395e99b89d0
4622 int a4a; // [sp+28h] [bp+Ch]@2 4622 int a4a; // [sp+28h] [bp+Ch]@2
4623 4623
4624 __debugbreak(); 4624 __debugbreak();
4625 4625
4626 v5 = a4->uAttributes; 4626 v5 = a4->uAttributes;
4627 v9 = pIndoor->pVertices;
4627 if ( v5 & FACE_XY_PLANE ) 4628 if ( v5 & FACE_XY_PLANE )
4628 { 4629 {
4629 a4a = a1; 4630 a4a = a1;
4630 v8 = a2; 4631 v8 = a2;
4631 v9 = pIndoor->pVertices;
4632 for(int i = 0; i < a4->uNumVertices; i++) 4632 for(int i = 0; i < a4->uNumVertices; i++)
4633 { 4633 {
4634 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x; 4634 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x;
4635 dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i+1]].y; 4635 dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i]].y;
4636 } 4636 }
4637 } 4637 }
4638 else 4638 else
4639 { 4639 {
4640 v8 = a3; 4640 v8 = a3;
4641 if ( v5 & FACE_XY_PLANE ) 4641 if ( v5 & FACE_XY_PLANE )
4642 { 4642 {
4643 a4a = a1; 4643 a4a = a1;
4644 v9 = pIndoor->pVertices;
4645 for(int i = 0; i < a4->uNumVertices; i++) 4644 for(int i = 0; i < a4->uNumVertices; i++)
4646 { 4645 {
4647 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x; 4646 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x;
4648 dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i+1]].z; 4647 dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i]].z;
4649 } 4648 }
4650 } 4649 }
4651 else 4650 else
4652 { 4651 {
4653 a4a = a2; 4652 a4a = a2;
4654 v9 = pIndoor->pVertices;
4655 for(int i = 0; i < a4->uNumVertices; i++) 4653 for(int i = 0; i < a4->uNumVertices; i++)
4656 { 4654 {
4657 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].y; 4655 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].y;
4658 dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i+1]].z; 4656 dword_4F5CC4_ys[i+1] = v9[a4->pVertexIDs[i]].z;
4659 } 4657 }
4660 } 4658 }
4661 } 4659 }
4662 a3a = 0; 4660 a3a = 0;
4663 dword_4F5D98_xs[a4->uNumVertices] = dword_4F5D98_xs[0]; 4661 dword_4F5D98_xs[a4->uNumVertices] = dword_4F5D98_xs[0];
4690 } 4688 }
4691 4689
4692 //----- (004077F1) -------------------------------------------------------- 4690 //----- (004077F1) --------------------------------------------------------
4693 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5) 4691 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5)
4694 { 4692 {
4695 ODMFace *v5; // eax@1 4693 //ODMFace *v5; // eax@1
4696 unsigned int v6; // esi@1 4694 Vec3_short_ *v9;
4695 unsigned int v5; // esi@1
4697 signed int v7; // edi@1 4696 signed int v7; // edi@1
4698 char v8; // zf@2 4697 //char v8; // zf@2
4699 unsigned __int16 *v9; // edx@3 4698 //unsigned __int16 *v9; // edx@3
4700 int v10; // ecx@4 4699 int v10; // ecx@4
4701 unsigned __int16 *v11; // edx@8 4700 unsigned __int16 *v11; // edx@8
4702 int v12; // ecx@9 4701 int v12; // ecx@9
4703 int v13; // edx@12 4702 int v13; // edx@12
4704 int v14; // ecx@13 4703 int v14; // ecx@13
4716 int a4a; // [sp+28h] [bp+Ch]@2 4715 int a4a; // [sp+28h] [bp+Ch]@2
4717 signed int a5a; // [sp+2Ch] [bp+10h]@14 4716 signed int a5a; // [sp+2Ch] [bp+10h]@14
4718 4717
4719 __debugbreak(); 4718 __debugbreak();
4720 4719
4721 v5 = a4; 4720 v5 = a4->uAttributes;
4722 v6 = a4->uAttributes; 4721 v9 = a5->pVertices;
4723 v7 = 0; 4722 if ( v5 & FACE_XY_PLANE )
4724 if ( v6 & 0x100 )
4725 { 4723 {
4726 v8 = a4->uNumVertices == 0;
4727 a4a = a1; 4724 a4a = a1;
4728 a3 = a2; 4725 a3 = a2;
4729 if ( !v8 ) 4726 for(int i = 0; i < a4->uNumVertices; i++)
4730 { 4727 {
4731 v9 = v5->pVertexIDs; 4728 dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x;
4732 do 4729 dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].y;
4733 { 4730 }
4734 ++v7;
4735 dword_4F5BF4_xs[v7] = a5->pVertices[*v9].x;
4736 v10 = *v9;
4737 ++v9;
4738 dword_4F5B24_ys[v7] = a5->pVertices[v10].y;
4739 }
4740 while ( v7 < v5->uNumVertices );
4741 }
4742 } 4731 }
4743 else 4732 else
4744 { 4733 {
4745 if ( v6 & 0x200 ) 4734 if ( v5 & FACE_XY_PLANE )
4746 { 4735 {
4747 v8 = a4->uNumVertices == 0;
4748 a4a = a1; 4736 a4a = a1;
4749 if ( !v8 ) 4737 for(int i = 0; i < a4->uNumVertices; i++)
4750 { 4738 {
4751 v11 = v5->pVertexIDs; 4739 dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x;
4752 do 4740 dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z;
4753 { 4741 }
4754 ++v7;
4755 dword_4F5BF4_xs[v7] = a5->pVertices[*v11].x;
4756 v12 = *v11;
4757 ++v11;
4758 dword_4F5B24_ys[v7] = a5->pVertices[v12].z;
4759 }
4760 while ( v7 < v5->uNumVertices );
4761 }
4762 } 4742 }
4763 else 4743 else
4764 { 4744 {
4765 v8 = a4->uNumVertices == 0;
4766 a4a = a2; 4745 a4a = a2;
4767 if ( !v8 ) 4746 for(int i = 0; i < a4->uNumVertices; i++)
4768 { 4747 {
4769 v13 = (int)v5->pVertexIDs; 4748 dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].y;
4770 do 4749 dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z;
4771 { 4750 }
4772 ++v7;
4773 dword_4F5BF4_xs[v7] = a5->pVertices[*(short *)v13].y;
4774 v14 = *(short *)v13;
4775 v13 += 2;
4776 dword_4F5B24_ys[v7] = a5->pVertices[v14].z;
4777 }
4778 while ( v7 < v5->uNumVertices );
4779 }
4780 } 4751 }
4781 } 4752 }
4782 v15 = v5->uNumVertices;
4783 a5a = 0; 4753 a5a = 0;
4784 dword_4F5BF4_xs[v15 + 1] = dword_4F5BF4_xs[1]; 4754 dword_4F5BF4_xs[a4->uNumVertices + 1] = dword_4F5BF4_xs[1];
4785 dword_4F5B24_ys[v15 + 1] = dword_4F5B24_ys[1]; 4755 dword_4F5B24_ys[a4->uNumVertices + 1] = dword_4F5B24_ys[1];
4786 v25 = 0; 4756 for(int i = 0; i < a4->uNumVertices; i++)
4787 v16 = dword_4F5B24_ys[1] >= a3;
4788 if ( v15 <= 0 )
4789 return 0;
4790 do
4791 { 4757 {
4792 if ( a5a >= 2 ) 4758 if ( a5a >= 2 )
4793 break; 4759 break;
4794 v17 = v25; 4760 if ( dword_4F5B24_ys[i + 1] >= a3 ^ (dword_4F5B24_ys[i + 2] >= a3) )
4795 v18 = dword_4F5B24_ys[v25 + 2];
4796 if ( v16 ^ (v18 >= a3) )
4797 { 4761 {
4798 v19 = dword_4F5BF4_xs[v17 + 2]; 4762 if( dword_4F5BF4_xs[i + 2] >= a4a || dword_4F5BF4_xs[i] >= a4a)
4799 if ( v19 >= a4a )
4800 v20 = 0;
4801 else
4802 v20 = 2;
4803 v21 = v20 | (dword_4F5BF4_xs[v17 + 1] < a4a);
4804 if ( v21 != 3 )
4805 { 4763 {
4806 if ( !v21 4764 if ( (dword_4F5BF4_xs[i + 2] >= a4a && dword_4F5BF4_xs[i + 1] >= a4a)
4807 || (v22 = v19 - dword_4F5BF4_xs[v17 + 1], 4765 || (v25 = dword_4F5BF4_xs[i + 2] - dword_4F5BF4_xs[i + 1],
4808 LODWORD(v23) = v22 << 16, 4766 LODWORD(v23) = v25 << 16,
4809 HIDWORD(v23) = v22 >> 16, 4767 HIDWORD(v23) = v25 >> 16,
4810 dword_4F5BF4_xs[v17 + 1] 4768 dword_4F5BF4_xs[i + 1]
4811 + ((signed int)(((unsigned __int64)(v23 4769 + ((signed int)(((unsigned __int64)(v23
4812 / (v18 - dword_4F5B24_ys[v17 + 1]) 4770 / (dword_4F5B24_ys[i + 2] - dword_4F5B24_ys[i + 1])
4813 * ((a3 - dword_4F5B24_ys[v17 + 1]) << 16)) >> 16) 4771 * ((a3 - dword_4F5B24_ys[i + 1]) << 16)) >> 16)
4814 + 32768) >> 16) >= a4a) ) 4772 + 32768) >> 16) >= a4a) )
4815 ++a5a; 4773 ++a5a;
4816 } 4774 }
4817 } 4775 }
4818 ++v25;
4819 v16 = v18 >= a3;
4820 } 4776 }
4821 while ( v25 < v15 );
4822 result = 1; 4777 result = 1;
4823 if ( a5a != 1 ) 4778 if ( a5a != 1 )
4824 result = 0; 4779 result = 0;
4825 return result; 4780 return result;
4781
4826 } 4782 }
4827 4783
4828 //----- (004088E9) -------------------------------------------------------- 4784 //----- (004088E9) --------------------------------------------------------
4829 int __fastcall sub_4088E9(int x1, int y1, int x2, int y2, int x3, int y3) 4785 int __fastcall sub_4088E9(int x1, int y1, int x2, int y2, int x3, int y3)
4830 { 4786 {