comparison IndoorCameraD3D.cpp @ 2245:8817c398b792

for RasterLine2D
author Ritor1
date Tue, 25 Feb 2014 20:02:06 +0600
parents 3f375342de12
children aff7a7b072b7
comparison
equal deleted inserted replaced
2244:66c509997062 2245:8817c398b792
21 21
22 22
23 //----- (004361EF) -------------------------------------------------------- 23 //----- (004361EF) --------------------------------------------------------
24 IndoorCameraD3D::IndoorCameraD3D() 24 IndoorCameraD3D::IndoorCameraD3D()
25 { 25 {
26 IndoorCameraD3D *v1; // esi@1 26 this->field_108 = 0.0;
27 //double v2; // st7@1 27 this->field_138 = 0.0;
28 //double v3; // st6@1 28 this->field_168 = 0.0;
29 //double v4; // st5@1 29 this->field_198 = 0.0;
30 //double v5; // st7@1 30 this->field_1C8 = 0.0;
31 //double v6; // st6@1 31 this->field_1F8 = 0.0;
32 //double v7; // st5@1 32 this->field_228 = 0.0;
33 33 this->field_258 = 0.0;
34 v1 = this; 34 this->field_288 = 0.0;
35 //IndoorCameraD3D_Vec3::IndoorCameraD3D_Vec3(&this->field_4); 35 this->field_2B8 = 0.0;
36 //IndoorCameraD3D_Vec3::IndoorCameraD3D_Vec3(&v1->field_14); 36 this->field_2E8 = 0.0;
37 //IndoorCameraD3D_Vec3::IndoorCameraD3D_Vec3(&v1->field_24); 37 this->field_2BC = 0.0;
38 /*_eh_vector_constructor_iterator_(v1->std__vector_000034_prolly_frustrum, 38 this->field_2C0 = 0.0;
39 24, 39 this->field_2C4 = 0.0;
40 6, 40 this->field_318 = 0.0;
41 (void ( *)(void *))IndoorCameraD3D_Vec4::IndoorCameraD3D_Vec4, 41 this->field_2EC = 0.0;
42 (void ( *)(void *))IndoorCameraD3D_Vec4::dtor);*/ 42 this->field_2F0 = 0.0;
43 //v2 = 0;//(double)pBLVRenderParams->vPartyPos.z; 43 this->field_2F4 = 0.0;
44 //v3 = 0;//(double)pBLVRenderParams->vPartyPos.y; 44 this->field_348 = 0.0;
45 //v4 = 0;//(double)pBLVRenderParams->vPartyPos.x; 45 this->field_31C = 0.0;
46 v1->field_108 = 0.0; 46 this->field_320 = 0.0;
47 //v1->blv_party_x = 0; 47 this->field_324 = 0.0;
48 //v1->blv_party_y = 0; 48 this->field_378 = 0.0;
49 //v1->blv_party_z = 0; 49 this->field_34C = 0.0;
50 //v5 = 0;//(double)pBLVRenderParams->vPartyPos.z; 50 this->field_350 = 0.0;
51 //v6 = 0;//(double)pBLVRenderParams->vPartyPos.y; 51 this->field_354 = 0.0;
52 //v7 = 300;//(double)(pBLVRenderParams->vPartyPos.x + 300);
53 v1->field_138 = 0.0;
54 //v1->blv_party_x_2 = 300;
55 //v1->blv_party_y_2 = 0;
56 //v1->blv_party_z_2 = 0;
57 v1->field_168 = 0.0;
58 v1->field_198 = 0.0;
59 v1->field_1C8 = 0.0;
60 v1->field_1F8 = 0.0;
61 v1->field_228 = 0.0;
62 v1->field_258 = 0.0;
63 v1->field_288 = 0.0;
64 v1->field_2B8 = 0.0;
65 v1->field_2E8 = 0.0;
66 v1->field_2BC = 0.0;
67 v1->field_2C0 = 0.0;
68 v1->field_2C4 = 0.0;
69 v1->field_318 = 0.0;
70 v1->field_2EC = 0.0;
71 v1->field_2F0 = 0.0;
72 v1->field_2F4 = 0.0;
73 v1->field_348 = 0.0;
74 v1->field_31C = 0.0;
75 v1->field_320 = 0.0;
76 v1->field_324 = 0.0;
77 v1->field_378 = 0.0;
78 v1->field_34C = 0.0;
79 v1->field_350 = 0.0;
80 v1->field_354 = 0.0;
81 for (uint i = 0; i < 16384; ++i) 52 for (uint i = 0; i < 16384; ++i)
82 { 53 {
83 list_0037C[i].field_0 = 0; 54 list_0037C[i].field_0 = 0;
84 list_0037C[i].flt_30 = 0.0f; 55 list_0037C[i].flt_30 = 0.0f;
85 } 56 }
86
87 list_0037C_size = 0; 57 list_0037C_size = 0;
88 for (uint i = 0; i < 256; ++i) 58 for (uint i = 0; i < 256; ++i)
89 list_E0380[i].mm7__vector_000004_size = 0; 59 list_E0380[i].mm7__vector_000004_size = 0;
90 /*v10 = v1->list_E0380;
91 v12 = 256;
92 do
93 {
94 v10->mm7__vector_000004_size = 0;
95 //mm7__vector_constructor(
96 // v10->mm7__vector_000004,
97 // 48,
98 // 64,
99 // (int ( *)(int))IndoorCameraD3D_stru1::IndoorCameraD3D_stru1);
100 //++v10;
101 --v12;
102 }
103 while ( v12 );*/
104 list_E0380_size = 0; 60 list_E0380_size = 0;
105 //v1->vdestructor_ptr = &stru8_pvdtor;
106 } 61 }
107 62
108 63
109 //----- (0043643E) -------------------------------------------------------- 64 //----- (0043643E) --------------------------------------------------------
110 float IndoorCameraD3D::GetPickDepth() 65 float IndoorCameraD3D::GetPickDepth()
784 739
785 //----- (004378BA) -------------------------------------------------------- 740 //----- (004378BA) --------------------------------------------------------
786 void IndoorCameraD3D::MatrixMultiply(Matrix3x3_float_ *a1, Matrix3x3_float_ *a2, Matrix3x3_float_ *out) 741 void IndoorCameraD3D::MatrixMultiply(Matrix3x3_float_ *a1, Matrix3x3_float_ *a2, Matrix3x3_float_ *out)
787 { 742 {
788 float *v4; // ecx@1 743 float *v4; // ecx@1
789 float *v5; // eax@1
790 signed int v6; // ebx@1
791 float *v7; // edx@2
792 float *v8; // ecx@2
793 signed int v9; // edi@2
794 double v10; // st7@3 744 double v10; // st7@3
795 double v11; // st6@3 745 double v11; // st6@3
796 746
797 v4 = (float *)out; 747 v4 = (float *)out;
798 v5 = &a1->_12; 748 for ( uint i = 0; i < 3; i++ )
799 v6 = 3; 749 {
800 do 750 for ( uint j = 0; j < 3; j++ )
801 { 751 {
802 v7 = v4; 752 v10 = a2->v[2][j] * a1->v[i][2] + a2->v[0][j] * a1->v[i][0];
803 v8 = &a2->_21; 753 v11 = a2->v[1][j] * a1->v[i][1];
804 v9 = 3; 754 *v4 = v10 + v11;
805 do 755 ++v4;
806 { 756 }
807 v10 = v8[3] * v5[1] + *(v8 - 3) * *(v5 - 1); 757 }
808 v11 = *v8 * *v5;
809 ++v8;
810 *v7 = v10 + v11;
811 ++v7;
812 --v9;
813 }
814 while ( v9 );
815 v5 += 3;
816 --v6;
817 v4 = v7;
818 }
819 while ( v6 );
820 } 758 }
821 759
822 //----- (004376E7) -------------------------------------------------------- 760 //----- (004376E7) --------------------------------------------------------
823 void IndoorCameraD3D::CreateWorldMatrixAndSomeStuff() 761 void IndoorCameraD3D::CreateWorldMatrixAndSomeStuff()
824 { 762 {
944 } 882 }
945 883
946 //----- (00437376) -------------------------------------------------------- 884 //----- (00437376) --------------------------------------------------------
947 char IndoorCameraD3D::_437376(stru154 *thisa, RenderVertexSoft *a2, unsigned int *pOutNumVertices) 885 char IndoorCameraD3D::_437376(stru154 *thisa, RenderVertexSoft *a2, unsigned int *pOutNumVertices)
948 { 886 {
949 unsigned int v4; // ebx@1 887 //unsigned int v4; // ebx@1
950 RenderVertexSoft *v5; // edx@2 888 //RenderVertexSoft *v5; // edx@2
951 double v6; // st7@3 889 double v6; // st7@3
952 unsigned int v7; // edi@5 890 //unsigned int v7; // edi@5
953 signed int v8; // esi@6 891 signed int v8; // esi@6
954 int v9; // ebx@8 892 int v9; // ebx@8
955 int v10; // eax@8 893 int v10; // eax@8
956 int v11; // ecx@14 894 //int v11; // ecx@14
957 int v12; // eax@14 895 //int v12; // eax@14
958 int v13; // eax@15 896 int v13; // eax@15
959 signed int v14; // ebx@17 897 signed int v14; // ebx@17
960 RenderVertexSoft *v15; // eax@18 898 //RenderVertexSoft *v15; // eax@18
961 unsigned int *v16; // eax@20 899 unsigned int *v16; // eax@20
962 char result; // al@24 900 char result; // al@24
963 RenderVertexSoft v18; // [sp+Ch] [bp-34h]@2 901 RenderVertexSoft v18; // [sp+Ch] [bp-34h]@2
964 int v19; // [sp+3Ch] [bp-4h]@8 902 int v19; // [sp+3Ch] [bp-4h]@8
965 signed int thisb; // [sp+48h] [bp+8h]@6 903 signed int thisb; // [sp+48h] [bp+8h]@6
966 char a2_3; // [sp+4Fh] [bp+Fh]@5 904 bool a2_3; // [sp+4Fh] [bp+Fh]@5
967 905
968 v4 = *pOutNumVertices; 906 //v4 = *pOutNumVertices;
907 //v5 = a2;
908 memcpy(&v18, a2, sizeof(v18));
909 a2_3 = false;
910 memcpy(&a2[*pOutNumVertices], a2, sizeof(a2[*pOutNumVertices]));
911 memcpy(&a2[*pOutNumVertices + 1], &a2[1], sizeof(a2[*pOutNumVertices + 1]));
912 //v7 = *pOutNumVertices;
913
969 if ( (signed int)*pOutNumVertices <= 3 914 if ( (signed int)*pOutNumVertices <= 3
970 || ((v5 = a2, 915 || (((v18.vWorldPosition.z - (double)pGame->pIndoorCameraD3D->vPartyPos.z) * thisa->face_plane.vNormal.z
971 memcpy(&v18, a2, sizeof(v18)),
972 (v18.vWorldPosition.z - (double)pGame->pIndoorCameraD3D->vPartyPos.z) * thisa->face_plane.vNormal.z
973 + (v18.vWorldPosition.y - (double)pGame->pIndoorCameraD3D->vPartyPos.y) * thisa->face_plane.vNormal.y 916 + (v18.vWorldPosition.y - (double)pGame->pIndoorCameraD3D->vPartyPos.y) * thisa->face_plane.vNormal.y
974 + (v18.vWorldPosition.x - (double)pGame->pIndoorCameraD3D->vPartyPos.x) * thisa->face_plane.vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0), 917 + (v18.vWorldPosition.x - (double)pGame->pIndoorCameraD3D->vPartyPos.x) * thisa->face_plane.vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0),
975 a2_3 = 0,
976 memcpy(&v5[v4], v5, sizeof(v5[v4])),
977 memcpy(&v5[*pOutNumVertices + 1], &v5[1], sizeof(v5[*pOutNumVertices + 1])),
978 v7 = *pOutNumVertices,
979 (signed int)*pOutNumVertices <= 0) ) 918 (signed int)*pOutNumVertices <= 0) )
980 goto LABEL_28; 919 return 0;
981 v8 = 1; 920 v8 = 1;
982 for ( thisb = 1; ; v8 = thisb ) 921 for ( thisb = 1; thisb - 1 < (signed int)*pOutNumVertices; v8 = thisb )
983 { 922 {
984 v9 = v8 - 1; 923 v9 = v8 - 1;
985 v10 = v8 + 1; 924 v10 = v8 + 1;
986 v19 = v8 + 1; 925 v19 = v8 + 1;
987 if ( v8 - 1 >= (signed int)v7 ) 926 if ( v8 - 1 >= (signed int)*pOutNumVertices )
988 v9 -= v7; 927 v9 -= *pOutNumVertices;
989 if ( v8 >= (signed int)v7 ) 928 if ( v8 >= (signed int)*pOutNumVertices )
990 v8 -= v7; 929 v8 -= *pOutNumVertices;
991 if ( v19 >= (signed int)v7 ) 930 if ( v19 >= (signed int)*pOutNumVertices )
992 v10 = v19 - v7; 931 v10 = v19 - *pOutNumVertices;
993 v11 = (int)&v5[v10]; 932 //v11 = (int)&a2[v10];
994 v12 = (int)&v5[v9]; 933 //v12 = (int)&a2[v9];
995 if ( -0.009999999776482582 > ((v5[v8].vWorldViewProjX - *(float *)(v12 + 24)) 934 if ( -0.009999999776482582 > ((a2[v8].vWorldViewProjX - a2[v9].vWorldViewProjX)
996 * (*(float *)(v11 + 28) - *(float *)(v12 + 28)) 935 * (a2[v10].vWorldViewProjY - a2[v9].vWorldViewProjY)
997 - (v5[v8].vWorldViewProjY - *(float *)(v12 + 28)) 936 - (a2[v8].vWorldViewProjY - a2[v9].vWorldViewProjY)
998 * (*(float *)(v11 + 24) - *(float *)(v12 + 24))) 937 * (a2[v10].vWorldViewProjX - a2[v9].vWorldViewProjX))
999 * v6 ) 938 * v6 )
1000 { 939 {
1001 thisb = v19; 940 thisb = v19;
1002 v16 = pOutNumVertices; 941 v16 = pOutNumVertices;
1003 } 942 }
1004 else 943 else
1005 { 944 {
1006 v13 = thisb; 945 v13 = thisb;
1007 if ( thisb >= (signed int)v7 ) 946 if ( thisb >= (signed int)*pOutNumVertices )
1008 v13 = thisb - v7; 947 v13 = thisb - *pOutNumVertices;
1009 v14 = v13; 948 if ( v13 < (signed int)*pOutNumVertices )
1010 if ( v13 < (signed int)v7 )
1011 { 949 {
1012 v15 = &v5[v13]; 950 for ( v14 = v13; v14 < (signed int)*pOutNumVertices; ++v14 )
1013 do 951 memcpy(&a2[v14], &a2[v14 + 1], sizeof(a2[v14]));
1014 {
1015 memcpy(v15, &v15[1], 0x30u);
1016 ++v14;
1017 ++v15;
1018 }
1019 while ( v14 < (signed int)*pOutNumVertices );
1020 } 952 }
1021 v16 = pOutNumVertices; 953 v16 = pOutNumVertices;
1022 a2_3 = 1; 954 a2_3 = true;
1023 --*v16; 955 --*v16;
1024 } 956 }
1025 v7 = *v16; 957 *pOutNumVertices = *v16;
1026 if ( thisb - 1 >= (signed int)*v16 ) 958 //if ( thisb - 1 >= (signed int)*v16 )
1027 break; 959 //break;
1028 } 960 }
1029 if ( a2_3 ) 961 if ( a2_3 )
1030 result = 1; 962 return true;
1031 else 963 else
1032 LABEL_28: 964 return false;
1033 result = 0;
1034 return result;
1035 } 965 }
1036 966
1037 //----- (00437285) -------------------------------------------------------- 967 //----- (00437285) --------------------------------------------------------
1038 bool IndoorCameraD3D::CalcPortalShape(RenderVertexSoft *a1, unsigned int *pOutNumVertices, RenderVertexSoft *pVertices, IndoorCameraD3D_Vec4 *a4, signed int uNumVertices, char a6, int _unused) 968 bool IndoorCameraD3D::CalcPortalShape(RenderVertexSoft *a1, unsigned int *pOutNumVertices, RenderVertexSoft *pVertices, IndoorCameraD3D_Vec4 *a4, signed int uNumVertices, char a6, int _unused)
1039 { 969 {
1160 _unused); 1090 _unused);
1161 } 1091 }
1162 // 50F1E0: using guessed type char static_sub_4371C3_byte_50F1E0_init_flags; 1092 // 50F1E0: using guessed type char static_sub_4371C3_byte_50F1E0_init_flags;
1163 1093
1164 //----- (00437143) -------------------------------------------------------- 1094 //----- (00437143) --------------------------------------------------------
1165 int IndoorCameraD3D::_437143(unsigned int uNumInVertices, RenderVertexSoft *pOutVertices, RenderVertexSoft *pInVertices, unsigned int *pOutNumVertices) 1095 void IndoorCameraD3D::_437143(unsigned int uNumInVertices, RenderVertexSoft *pOutVertices, RenderVertexSoft *pInVertices, unsigned int *pOutNumVertices)
1166 { 1096 {
1167 unsigned int v5; // edi@1
1168 char *pOutVertices_; // edx@2
1169 char *v7; // eax@2
1170 unsigned int v8; // ebx@2
1171 double v9; // st7@3 1097 double v9; // st7@3
1172 double v10; // st6@3 1098
1173 int result; // eax@5 1099 uint i = 0;
1174 unsigned int a2a; // [sp+10h] [bp+Ch]@2 1100
1175 1101 for ( i; i < uNumInVertices; ++i )
1176 v5 = uNumInVertices; 1102 {
1177 if ( (signed int)uNumInVertices > 0 ) 1103 pInVertices[i]._rhw = 1.0 / (pInVertices[i].vWorldViewPosition.x + 0.0000001);
1178 { 1104 memcpy(&pOutVertices[i], &pInVertices[i], sizeof(pOutVertices[i]));
1179 pOutVertices_ = (char *)&pOutVertices->vWorldViewProjY; 1105 v9 = (double)pODMRenderParams->int_fov_rad * pInVertices[i]._rhw;
1180 v7 = (char *)&pInVertices->_rhw; 1106 pOutVertices[i].vWorldViewProjX = (double)pViewport->uScreenCenterX - v9 * pInVertices[i].vWorldViewPosition.y;
1181 v8 = (char *)pOutVertices - (char *)pInVertices; 1107 pOutVertices[i].vWorldViewProjY = (double)pViewport->uScreenCenterY - v9 * pInVertices[i].vWorldViewPosition.z;
1182 a2a = uNumInVertices; 1108 }
1183 do 1109 *pOutNumVertices = i;
1184 { 1110 return;
1185 *(float *)v7 = 1.0 / (*((float *)v7 - 5) + 0.0000001);
1186 memcpy(pOutVertices_ - 28, v7 - 32, 0x30u);
1187 v9 = (double)pODMRenderParams->int_fov_rad * *(float *)&v7[v8];
1188 v10 = (double)pViewport->uScreenCenterX - v9 * *((float *)v7 - 4);
1189 v7 += 48;
1190 *((float *)pOutVertices_ - 1) = v10;
1191 *(float *)pOutVertices_ = (double)pViewport->uScreenCenterY - v9 * *((float *)v7 - 15);
1192 pOutVertices_ += 48;
1193 --a2a;
1194 }
1195 while ( a2a );
1196 v5 = uNumInVertices;
1197 }
1198 result = (int)pOutNumVertices;
1199 *pOutNumVertices = v5;
1200 return result;
1201 } 1111 }
1202 1112
1203 //----- (00436F09) -------------------------------------------------------- 1113 //----- (00436F09) --------------------------------------------------------
1204 void IndoorCameraD3D::_436F09_mess_with_lightmap__clipflag_4(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices) 1114 void IndoorCameraD3D::_436F09_mess_with_lightmap__clipflag_4(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
1205 { 1115 {