Mercurial > mm7
comparison stru10.cpp @ 684:08b6d89d6a10
Слияние
author | Ritor1 |
---|---|
date | Fri, 15 Mar 2013 18:29:06 +0600 |
parents | d4497b76a863 ecfb1b3c9a39 |
children | 483fa38be9a6 |
comparison
equal
deleted
inserted
replaced
683:d4497b76a863 | 684:08b6d89d6a10 |
---|---|
1 #include <assert.h> | |
2 | |
1 #include "stru10.h" | 3 #include "stru10.h" |
2 #include "Render.h" | 4 #include "Render.h" |
3 #include "Indoor.h" | 5 #include "Indoor.h" |
4 #include "Game.h" | 6 #include "Game.h" |
5 #include "Party.h" | 7 #include "Party.h" |
438 if (pFace->uAttributes & 0x0200) | 440 if (pFace->uAttributes & 0x0200) |
439 { | 441 { |
440 for (uint i = 0; i < pFace->uNumVertices; ++i) | 442 for (uint i = 0; i < pFace->uNumVertices; ++i) |
441 { | 443 { |
442 v46[i].x = pIndoor->pVertices[pFace->pVertexIDs[i]].x + pFace->pXInterceptDisplacements[i]; | 444 v46[i].x = pIndoor->pVertices[pFace->pVertexIDs[i]].x + pFace->pXInterceptDisplacements[i]; |
443 v46[i].y = pIndoor->pVertices[pFace->pVertexIDs[i]].y + pFace->pZInterceptDisplacements[i]; | 445 v46[i].y = pIndoor->pVertices[pFace->pVertexIDs[i]].z + pFace->pZInterceptDisplacements[i]; |
444 v46[i].c = i; | 446 v46[i].c = i; |
445 } | 447 } |
446 } | 448 } |
447 if (pFace->uAttributes & 0x0400) | 449 if (pFace->uAttributes & 0x0400) |
448 { | 450 { |
449 for (uint i = 0; i < pFace->uNumVertices; ++i) | 451 for (uint i = 0; i < pFace->uNumVertices; ++i) |
450 { | 452 { |
451 v46[i].x = pIndoor->pVertices[pFace->pVertexIDs[i]].x + pFace->pYInterceptDisplacements[i]; | 453 v46[i].x = pIndoor->pVertices[pFace->pVertexIDs[i]].y + pFace->pYInterceptDisplacements[i]; |
452 v46[i].y = pIndoor->pVertices[pFace->pVertexIDs[i]].y + pFace->pZInterceptDisplacements[i]; | 454 v46[i].y = pIndoor->pVertices[pFace->pVertexIDs[i]].z + pFace->pZInterceptDisplacements[i]; |
453 v46[i].c = i; | 455 v46[i].c = i; |
454 } | 456 } |
455 } | 457 } |
456 | 458 |
457 float x_min = FLT_MAX; | 459 float x_min = FLT_MAX; |
581 a1.z = 0.0f; | 583 a1.z = 0.0f; |
582 | 584 |
583 var_28 = 1; | 585 var_28 = 1; |
584 var_24 = 0; | 586 var_24 = 0; |
585 } | 587 } |
588 else assert(false); | |
586 | 589 |
587 | 590 |
588 float arg_4; | 591 float arg_4; |
589 float var_18; | 592 float var_18; |
590 float var_4; | 593 float var_4; |
593 //v8 = _ESI->uAttributes; | 596 //v8 = _ESI->uAttributes; |
594 //_ECX = pFaceBounding; | 597 //_ECX = pFaceBounding; |
595 //__asm { fld 0.5 } | 598 //__asm { fld 0.5 } |
596 if (pFace->uAttributes & 0x0100) | 599 if (pFace->uAttributes & 0x0100) |
597 { | 600 { |
601 /*arg_4 = ([2].x + [0].x) * flt_4D84F0 | |
602 var_18 = ([3].y + [1].y) * flt_4D84F0 | |
603 | |
604 fld dword ptr [ecx+94h] | |
605 fadd dword ptr [ecx+34h] | |
606 fmul st, st(1) | |
607 fstp [ebp+var_18] | |
608 fld dword ptr [ecx+68h] | |
609 fadd dword ptr [ecx+8] | |
610 fmul st, st(1) | |
611 fstp [ebp+var_4] | |
612 fld [ebp+arg4] | |
613 fsub dword ptr [ecx] | |
614 fstp [ebp+a3] | |
615 fld [ebp+var_18] | |
616 fsub dword ptr [ecx+34h] | |
617 fstp [ebp+var_8]*/ | |
618 | |
619 | |
598 arg_4 = (pFaceBounding[0].vWorldPosition.x + pFaceBounding[2].vWorldPosition.x) / 2; | 620 arg_4 = (pFaceBounding[0].vWorldPosition.x + pFaceBounding[2].vWorldPosition.x) / 2; |
599 var_18 = (pFaceBounding[3].vWorldPosition.y + pFaceBounding[1].vWorldPosition.y) / 2; | 621 var_18 = (pFaceBounding[3].vWorldPosition.y + pFaceBounding[1].vWorldPosition.y) / 2; |
600 var_4 = (pFaceBounding[0].vWorldPosition.z + pFaceBounding[2].vWorldPosition.z) / 2; | 622 var_4 = (pFaceBounding[0].vWorldPosition.z + pFaceBounding[2].vWorldPosition.z) / 2; |
601 | 623 |
602 a3 = arg_4 - pFaceBounding[0].vWorldPosition.x; | 624 a3 = arg_4 - pFaceBounding[0].vWorldPosition.x; |
629 a3 /= a1.y; | 651 a3 /= a1.y; |
630 } | 652 } |
631 } | 653 } |
632 | 654 |
633 | 655 |
634 if ( byte_4D864C && pGame->uFlags & 8 ) | 656 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS) |
635 { | 657 { |
636 RenderVertexSoft v26; // [sp+40h] [bp-60h]@20 | 658 RenderVertexSoft v26; // [sp+40h] [bp-60h]@20 |
637 v26.vWorldPosition.x = arg_4; | 659 v26.vWorldPosition.x = arg_4; |
638 v26.vWorldPosition.y = v32; | 660 v26.vWorldPosition.y = v32; |
639 v26.vWorldPosition.z = v35; | 661 v26.vWorldPosition.z = v35; |
672 return false; | 694 return false; |
673 | 695 |
674 | 696 |
675 if ( byte_4D864C ) | 697 if ( byte_4D864C ) |
676 { | 698 { |
677 if ( pGame->uFlags & 8 ) | 699 if ( pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS) |
678 { | 700 { |
679 RenderVertexSoft v25; // [sp+10h] [bp-90h]@20 | 701 RenderVertexSoft v25; // [sp+10h] [bp-90h]@20 |
680 RenderVertexSoft v26; // [sp+40h] [bp-60h]@20 | 702 RenderVertexSoft v26; // [sp+40h] [bp-60h]@20 |
681 | 703 |
682 v25.vWorldPosition.x = arg_4; | 704 v25.vWorldPosition.x = arg_4; |
703 memcpy(&v25, arg0 + 1, sizeof(RenderVertexSoft)); | 725 memcpy(&v25, arg0 + 1, sizeof(RenderVertexSoft)); |
704 memcpy(arg0 + 1, arg0 + 3, sizeof(RenderVertexSoft)); | 726 memcpy(arg0 + 1, arg0 + 3, sizeof(RenderVertexSoft)); |
705 memcpy(arg0 + 3, &v25, sizeof(RenderVertexSoft)); | 727 memcpy(arg0 + 3, &v25, sizeof(RenderVertexSoft)); |
706 } | 728 } |
707 | 729 |
708 if ( byte_4D864C && pGame->uFlags & 8 ) | 730 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS) |
709 { | 731 { |
710 RenderVertexSoft v26; // [sp+40h] [bp-60h]@20 | 732 RenderVertexSoft v26; // [sp+40h] [bp-60h]@20 |
711 if ( !LOBYTE(field_4) ) | 733 if ( !LOBYTE(field_4) ) |
712 { | 734 { |
713 v26.vWorldPosition.x = pParty->vPosition.x; | 735 v26.vWorldPosition.x = pParty->vPosition.x; |
739 } | 761 } |
740 | 762 |
741 //----- (0049C5DA) -------------------------------------------------------- | 763 //----- (0049C5DA) -------------------------------------------------------- |
742 char stru10::_49C5DA(BLVFace *a2, RenderVertexSoft *a3, int *a4, IndoorCameraD3D_Vec4 *a5, RenderVertexSoft *a6) | 764 char stru10::_49C5DA(BLVFace *a2, RenderVertexSoft *a3, int *a4, IndoorCameraD3D_Vec4 *a5, RenderVertexSoft *a6) |
743 { | 765 { |
744 stru10 *v6; // edi@1 | 766 //stru10 *v6; // edi@1 |
745 float *v7; // eax@1 | 767 //char *v7; // eax@1 |
746 signed int v8; // ecx@1 | 768 //signed int v8; // ecx@1 |
747 IndoorCameraD3D *pIndoorCamera; // esi@3 | 769 //IndoorCameraD3D *v9; // esi@3 |
748 char result; // al@6 | 770 char result; // al@6 |
749 RenderVertexSoft a4a[4]; // [sp+Ch] [bp-C0h]@1 | 771 RenderVertexSoft a4a[4]; // [sp+Ch] [bp-C0h]@1 |
750 | 772 |
751 v6 = this; | 773 /*v6 = this; |
752 v7 = &a4a[0].flt_2C; | 774 v7 = (char *)&a4a[0].flt_2C; |
753 v8 = 4; | 775 v8 = 4; |
754 do | 776 do |
755 { | 777 { |
756 *v7 = 0.0; | 778 *(float *)v7 = 0.0; |
757 v7 += 12; | 779 v7 += 48; |
758 --v8; | 780 --v8; |
759 } | 781 } |
760 while ( v8 ); | 782 while ( v8 ); |
761 //pIndoorCamera = pGame->pIndoorCameraD3D; | 783 v9 = pGame->pIndoorCameraD3D;*/ |
762 _49CE9E(a2, a3, *a4, a4a); | 784 _49CE9E(a2, a3, *a4, a4a); |
763 if ( byte_4D864C && pGame->uFlags & 8 ) | 785 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS) |
764 pGame->pIndoorCameraD3D->debug_outline_sw(a4a, 4, 0xFF1E1Eu, 0.00009999999747378752); | 786 pGame->pIndoorCameraD3D->debug_outline_sw(a4a, 4u, 0xFF1E1Eu, 0.000099999997); |
765 result = _49C9E3(a2, a4a, 4u, a6); | 787 result = _49C9E3(a2, a4a, 4u, a6); |
766 if ( result ) | 788 if ( result ) |
767 result = _49C720(a6, a5); | 789 result = _49C720(a6, a5); |
768 return result; | 790 return result; |
769 } | 791 } |
773 char stru10::_49C681_DrawDebugStuff(BLVFace *pFace, IndoorCameraD3D_Vec4 *a3, RenderVertexSoft *pArrayOf4) | 795 char stru10::_49C681_DrawDebugStuff(BLVFace *pFace, IndoorCameraD3D_Vec4 *a3, RenderVertexSoft *pArrayOf4) |
774 { | 796 { |
775 RenderVertexSoft pBounding[4]; // [sp+Ch] [bp-C0h]@1 | 797 RenderVertexSoft pBounding[4]; // [sp+Ch] [bp-C0h]@1 |
776 | 798 |
777 CalcPolygonBoundingBox(pFace, pBounding); | 799 CalcPolygonBoundingBox(pFace, pBounding); |
778 if ( byte_4D864C && pGame->uFlags & 8 ) | 800 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS) |
779 pGame->pIndoorCameraD3D->debug_outline_sw(pBounding, 4, 0xFF1E1E, 0.000099999997); | 801 pGame->pIndoorCameraD3D->debug_outline_sw(pBounding, 4, 0xFF1E1E, 0.000099999997); |
780 if (_49C9E3(pFace, pBounding, 4, pArrayOf4)) | 802 if (_49C9E3(pFace, pBounding, 4, pArrayOf4)) |
781 return _49C720(pArrayOf4, a3); | 803 return _49C720(pArrayOf4, a3); |
782 return false; | 804 return false; |
783 } | 805 } |
875 } | 897 } |
876 | 898 |
877 //----- (0049C8DC) -------------------------------------------------------- | 899 //----- (0049C8DC) -------------------------------------------------------- |
878 bool stru10::_49C8DC(RenderVertexSoft *arg0, Vec3_float_ *a2, float *a3) | 900 bool stru10::_49C8DC(RenderVertexSoft *arg0, Vec3_float_ *a2, float *a3) |
879 { | 901 { |
880 double v4; // st7@1 | 902 //double v4; // st7@1 |
881 double v5; // st6@1 | 903 //double v5; // st6@1 |
882 double v6; // st5@1 | 904 //double v6; // st5@1 |
883 Vec3_float_ *result; // eax@1 | 905 Vec3_float_ *result; // eax@1 |
884 __int16 v8; // fps@3 | 906 __int16 v8; // fps@3 |
885 char v9; // c0@3 | 907 char v9; // c0@3 |
886 char v10; // c2@3 | 908 char v10; // c2@3 |
887 char v11; // c3@3 | 909 char v11; // c3@3 |
888 float v12; // ecx@5 | 910 float v12; // ecx@5 |
889 double v13; // st7@5 | 911 double v13; // st7@5 |
890 double v14; // st6@5 | 912 double v14; // st6@5 |
891 Vec3_float_ v1; // [sp+8h] [bp-3Ch]@1 | 913 Vec3_float_ v1; // [sp+8h] [bp-3Ch]@1 |
892 Vec3_float_ v2; // [sp+14h] [bp-30h]@1 | 914 Vec3_float_ v2; // [sp+14h] [bp-30h]@1 |
893 float v17; // [sp+24h] [bp-20h]@1 | 915 //float v17; // [sp+24h] [bp-20h]@1 |
894 float v18; // [sp+28h] [bp-1Ch]@1 | 916 //float v18; // [sp+28h] [bp-1Ch]@1 |
895 float v19; // [sp+2Ch] [bp-18h]@1 | 917 //float v19; // [sp+2Ch] [bp-18h]@1 |
896 float v20; // [sp+30h] [bp-14h]@1 | 918 //float v20; // [sp+30h] [bp-14h]@1 |
897 float v21; // [sp+34h] [bp-10h]@1 | 919 //float v21; // [sp+34h] [bp-10h]@1 |
898 Vec3_float_ a1; // [sp+38h] [bp-Ch]@1 | 920 Vec3_float_ a1; // [sp+38h] [bp-Ch]@1 |
899 | 921 |
900 v19 = arg0->vWorldPosition.x; | 922 //v19 = arg0->vWorldPosition.x; |
901 v20 = arg0->vWorldPosition.y; | 923 //v20 = arg0->vWorldPosition.y; |
902 v21 = arg0->vWorldPosition.z; | 924 //v21 = arg0->vWorldPosition.z; |
903 v4 = arg0[1].vWorldPosition.x; | 925 //v4 = arg0[1].vWorldPosition.x; |
904 v5 = arg0[1].vWorldPosition.y; | 926 //v5 = arg0[1].vWorldPosition.y; |
905 v2.z = arg0[1].vWorldPosition.z; | 927 //v2.z = arg0[1].vWorldPosition.z; |
906 v6 = arg0[2].vWorldPosition.x; | 928 //v6 = arg0[2].vWorldPosition.x; |
907 v17 = arg0[2].vWorldPosition.y; | 929 //v17 = arg0[2].vWorldPosition.y; |
908 v18 = arg0[2].vWorldPosition.z; | 930 //v18 = arg0[2].vWorldPosition.z; |
909 a1.x = v4 - v19; | 931 //a1.x = v4 - v19; |
910 a1.y = v5 - v20; | 932 //a1.y = v5 - v20; |
911 a1.z = v2.z - v21; | 933 //a1.z = v2.z - v21; |
912 LODWORD(v1.x) = (int)a1.x; | 934 v1.x = arg0[1].vWorldPosition.x - arg0[0].vWorldPosition.x; |
913 v1.y = a1.y; | 935 v1.y = arg0[1].vWorldPosition.y - arg0[0].vWorldPosition.y; |
914 v1.z = a1.z; | 936 v1.z = arg0[1].vWorldPosition.z - arg0[0].vWorldPosition.z; |
915 a1.x = v6 - v4; | 937 |
916 a1.y = v17 - v5; | 938 a1.x = arg0[2].vWorldPosition.x - arg0[1].vWorldPosition.x; |
917 a1.z = v18 - v2.z; | 939 a1.y = arg0[2].vWorldPosition.y - arg0[1].vWorldPosition.y; |
940 a1.z = arg0[2].vWorldPosition.z - arg0[1].vWorldPosition.z; | |
941 | |
918 result = Vec3_float_::Cross(&v1, &v2, a1.x, a1.y, a1.z); | 942 result = Vec3_float_::Cross(&v1, &v2, a1.x, a1.y, a1.z); |
919 a1.x = result->x; | 943 a1.x = result->x; |
920 a1.y = result->y; | 944 a1.y = result->y; |
921 a1.z = result->z; | 945 a1.z = result->z; |
922 if ( a1.x != 0.0 | 946 if ( a1.x != 0.0 |
924 || (/*UNDEF(v8),*/ v9 = a1.z < 0.0, v10 = 0, v11 = a1.z == 0.0, /*BYTE1(result) = HIBYTE(v8),*/ a1.z != 0.0) ) | 948 || (/*UNDEF(v8),*/ v9 = a1.z < 0.0, v10 = 0, v11 = a1.z == 0.0, /*BYTE1(result) = HIBYTE(v8),*/ a1.z != 0.0) ) |
925 { | 949 { |
926 a1.Normalize(); | 950 a1.Normalize(); |
927 v12 = a1.y; | 951 v12 = a1.y; |
928 a2->x = a1.x; | 952 a2->x = a1.x; |
929 v13 = v21 * a1.z; | 953 v13 = arg0[0].vWorldPosition.z * a1.z; |
930 v14 = v20 * a1.y; | 954 v14 = arg0[0].vWorldPosition.y * a1.y; |
931 a2->y = v12; | 955 a2->y = v12; |
932 a2->z = a1.z; | 956 a2->z = a1.z; |
933 result = (Vec3_float_ *)a3; | 957 result = (Vec3_float_ *)a3; |
934 *a3 = -(v13 + v14 + v19 * a1.x); | 958 *a3 = -(v13 + v14 + arg0[0].vWorldPosition.x * a1.x); |
935 return true; | 959 return true; |
936 } | 960 } |
937 return false; | 961 return false; |
938 } | 962 } |