Mercurial > mm7
comparison Indoor.cpp @ 1297:5450af4f57ef
moving files mm7_x ending
author | Ritor1 |
---|---|
date | Wed, 19 Jun 2013 17:06:58 +0600 |
parents | 86a83e12d795 |
children | 18665b8f66b2 13b7be8b06a0 |
comparison
equal
deleted
inserted
replaced
1296:c423f946dc99 | 1297:5450af4f57ef |
---|---|
40 #include "Sprites.h" | 40 #include "Sprites.h" |
41 #include "Game.h" | 41 #include "Game.h" |
42 #include "stru6.h" | 42 #include "stru6.h" |
43 #include "ParticleEngine.h" | 43 #include "ParticleEngine.h" |
44 #include "Outdoor_stuff.h" | 44 #include "Outdoor_stuff.h" |
45 | 45 #include "texts.h" |
46 | 46 #include "GUIWindow.h" |
47 | 47 |
48 | 48 |
49 | 49 |
50 | 50 |
51 | 51 |
5885 v31 = (unsigned __int64)(v30 * (signed __int64)v24) >> 16; | 5885 v31 = (unsigned __int64)(v30 * (signed __int64)v24) >> 16; |
5886 result = (unsigned __int64)(v7->field_1C * (signed __int64)v7->field_4_party_dir_y) >> 16; | 5886 result = (unsigned __int64)(v7->field_1C * (signed __int64)v7->field_4_party_dir_y) >> 16; |
5887 v7->field_28 = v31 + result + ((unsigned __int64)(v7->field_20 * (signed __int64)v7->field_8) >> 16); | 5887 v7->field_28 = v31 + result + ((unsigned __int64)(v7->field_20 * (signed __int64)v7->field_8) >> 16); |
5888 return result; | 5888 return result; |
5889 } | 5889 } |
5890 //----- (00407A1C) -------------------------------------------------------- | |
5891 bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) | |
5892 { | |
5893 unsigned int v4; // esi@1 | |
5894 Vec3_int_ v5; // ST08_12@2 | |
5895 int v6; // edi@2 | |
5896 int v7; // ebx@2 | |
5897 int v8; // esi@2 | |
5898 signed int v9; // ecx@2 | |
5899 int v10; // eax@2 | |
5900 int v11; // ecx@4 | |
5901 int v12; // eax@4 | |
5902 int v13; // ebx@4 | |
5903 int v14; // edx@6 | |
5904 char *v15; // edi@16 | |
5905 ODMFace *v16; // esi@19 | |
5906 int v17; // ST34_4@25 | |
5907 int v18; // ST38_4@25 | |
5908 int v19; // eax@25 | |
5909 char v20; // zf@25 | |
5910 int v21; // ebx@25 | |
5911 int v22; // eax@26 | |
5912 signed int v23; // edi@26 | |
5913 int v24; // ST34_4@30 | |
5914 signed __int64 v25; // qtt@31 | |
5915 int v26; // eax@31 | |
5916 Vec3_int_ v27; // ST08_12@37 | |
5917 Vec3_int_ v28; // ST08_12@37 | |
5918 int v29; // edi@37 | |
5919 int v30; // ebx@37 | |
5920 int v31; // esi@37 | |
5921 signed int v32; // ecx@37 | |
5922 int v33; // eax@37 | |
5923 int v34; // ecx@39 | |
5924 int v35; // eax@39 | |
5925 int v36; // ebx@39 | |
5926 int v37; // edx@41 | |
5927 char *v38; // edi@51 | |
5928 ODMFace *v39; // esi@54 | |
5929 int v40; // ebx@60 | |
5930 int v41; // eax@61 | |
5931 signed int v42; // edi@61 | |
5932 signed __int64 v43; // qtt@66 | |
5933 int v44; // eax@66 | |
5934 Vec3_int_ v45; // ST08_12@73 | |
5935 int v46; // edi@73 | |
5936 int v47; // ebx@73 | |
5937 int v48; // esi@73 | |
5938 signed int v49; // ecx@73 | |
5939 int v50; // eax@73 | |
5940 int v51; // edx@75 | |
5941 int v52; // ecx@75 | |
5942 int v53; // eax@75 | |
5943 int v54; // ebx@75 | |
5944 int v55; // edi@77 | |
5945 int v56; // ecx@77 | |
5946 int v57; // eax@81 | |
5947 int v58; // esi@81 | |
5948 int v59; // eax@90 | |
5949 BLVSector *v60; // edx@90 | |
5950 int v61; // ecx@90 | |
5951 BLVFace *v62; // esi@91 | |
5952 int v63; // ST34_4@98 | |
5953 int v64; // ST30_4@98 | |
5954 int v65; // eax@98 | |
5955 int v66; // ebx@98 | |
5956 int v67; // eax@99 | |
5957 signed int v68; // edi@99 | |
5958 int v69; // ST2C_4@103 | |
5959 signed __int64 v70; // qtt@104 | |
5960 int v71; // eax@104 | |
5961 Vec3_int_ v72; // ST08_12@111 | |
5962 Vec3_int_ v73; // ST08_12@111 | |
5963 int v74; // edi@111 | |
5964 int v75; // ebx@111 | |
5965 int v76; // esi@111 | |
5966 signed int v77; // ecx@111 | |
5967 int v78; // eax@111 | |
5968 int v79; // edx@113 | |
5969 int v80; // ecx@113 | |
5970 int v81; // eax@113 | |
5971 int v82; // ebx@113 | |
5972 int v83; // edi@115 | |
5973 int v84; // ecx@115 | |
5974 int v85; // eax@119 | |
5975 int v86; // esi@119 | |
5976 int v87; // ecx@128 | |
5977 BLVSector *v88; // eax@128 | |
5978 int v89; // ecx@128 | |
5979 BLVFace *v90; // esi@129 | |
5980 int v91; // ebx@136 | |
5981 int v92; // eax@137 | |
5982 signed int v93; // edi@137 | |
5983 signed __int64 v94; // qtt@142 | |
5984 int v95; // eax@142 | |
5985 Vec3_int_ v97; // [sp-18h] [bp-94h]@1 | |
5986 int v98; // [sp-Ch] [bp-88h]@88 | |
5987 int v99; // [sp-Ch] [bp-88h]@126 | |
5988 int v100; // [sp-8h] [bp-84h]@88 | |
5989 int v101; // [sp-8h] [bp-84h]@126 | |
5990 int v102; // [sp-4h] [bp-80h]@88 | |
5991 int v103; // [sp-4h] [bp-80h]@126 | |
5992 int v104; // [sp+Ch] [bp-70h]@13 | |
5993 int v105; // [sp+Ch] [bp-70h]@48 | |
5994 int v106; // [sp+10h] [bp-6Ch]@18 | |
5995 int v107; // [sp+10h] [bp-6Ch]@98 | |
5996 int v108; // [sp+10h] [bp-6Ch]@104 | |
5997 int v109; // [sp+18h] [bp-64h]@25 | |
5998 int v110; // [sp+18h] [bp-64h]@31 | |
5999 int i; // [sp+18h] [bp-64h]@90 | |
6000 int v112; // [sp+18h] [bp-64h]@128 | |
6001 signed int v113; // [sp+20h] [bp-5Ch]@1 | |
6002 signed int v114; // [sp+24h] [bp-58h]@1 | |
6003 unsigned __int64 a4; // [sp+28h] [bp-54h]@1 | |
6004 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1 | |
6005 int v117; // [sp+34h] [bp-48h]@4 | |
6006 int v118; // [sp+34h] [bp-48h]@39 | |
6007 int v119; // [sp+34h] [bp-48h]@75 | |
6008 int v120; // [sp+34h] [bp-48h]@113 | |
6009 int v121; // [sp+38h] [bp-44h]@4 | |
6010 int v122; // [sp+38h] [bp-44h]@39 | |
6011 int v123; // [sp+38h] [bp-44h]@76 | |
6012 int v124; // [sp+38h] [bp-44h]@114 | |
6013 int v125; // [sp+3Ch] [bp-40h]@4 | |
6014 int v126; // [sp+3Ch] [bp-40h]@39 | |
6015 int v127; // [sp+3Ch] [bp-40h]@77 | |
6016 int v128; // [sp+3Ch] [bp-40h]@115 | |
6017 int v129; // [sp+40h] [bp-3Ch]@11 | |
6018 int v130; // [sp+40h] [bp-3Ch]@46 | |
6019 int v131; // [sp+40h] [bp-3Ch]@78 | |
6020 int v132; // [sp+40h] [bp-3Ch]@116 | |
6021 int v133; // [sp+44h] [bp-38h]@10 | |
6022 int v134; // [sp+44h] [bp-38h]@45 | |
6023 int v135; // [sp+44h] [bp-38h]@81 | |
6024 int v136; // [sp+44h] [bp-38h]@119 | |
6025 int v137; // [sp+48h] [bp-34h]@7 | |
6026 int v138; // [sp+48h] [bp-34h]@42 | |
6027 int v139; // [sp+48h] [bp-34h]@82 | |
6028 int v140; // [sp+48h] [bp-34h]@120 | |
6029 int v141; // [sp+4Ch] [bp-30h]@6 | |
6030 int v142; // [sp+4Ch] [bp-30h]@41 | |
6031 int v143; // [sp+4Ch] [bp-30h]@75 | |
6032 int v144; // [sp+4Ch] [bp-30h]@113 | |
6033 int v145; // [sp+50h] [bp-2Ch]@5 | |
6034 int v146; // [sp+50h] [bp-2Ch]@40 | |
6035 int v147; // [sp+50h] [bp-2Ch]@75 | |
6036 int v148; // [sp+50h] [bp-2Ch]@113 | |
6037 int v149; // [sp+54h] [bp-28h]@4 | |
6038 int v150; // [sp+54h] [bp-28h]@39 | |
6039 int v151; // [sp+54h] [bp-28h]@75 | |
6040 int v152; // [sp+54h] [bp-28h]@113 | |
6041 int sDepth; // [sp+58h] [bp-24h]@17 | |
6042 int sDeptha; // [sp+58h] [bp-24h]@52 | |
6043 int sDepthb; // [sp+58h] [bp-24h]@90 | |
6044 char *a5; // [sp+5Ch] [bp-20h]@16 | |
6045 char *a5a; // [sp+5Ch] [bp-20h]@51 | |
6046 signed int a5b; // [sp+5Ch] [bp-20h]@83 | |
6047 signed int a5c; // [sp+5Ch] [bp-20h]@121 | |
6048 signed int v160; // [sp+60h] [bp-1Ch]@12 | |
6049 signed int v161; // [sp+60h] [bp-1Ch]@47 | |
6050 int v162; // [sp+60h] [bp-1Ch]@128 | |
6051 int v163; // [sp+64h] [bp-18h]@2 | |
6052 int outx; // [sp+68h] [bp-14h]@2 | |
6053 int outy; // [sp+6Ch] [bp-10h]@2 | |
6054 int outz; // [sp+70h] [bp-Ch]@2 | |
6055 Vec3_int_ pOut; // [sp+74h] [bp-8h]@2 | |
6056 int ya; // [sp+84h] [bp+8h]@60 | |
6057 int yb; // [sp+84h] [bp+8h]@136 | |
6058 int ve; // [sp+88h] [bp+Ch]@60 | |
6059 int va; // [sp+88h] [bp+Ch]@60 | |
6060 int vb; // [sp+88h] [bp+Ch]@66 | |
6061 int vf; // [sp+88h] [bp+Ch]@136 | |
6062 int vc; // [sp+88h] [bp+Ch]@136 | |
6063 int vd; // [sp+88h] [bp+Ch]@142 | |
6064 int v_4; // [sp+8Ch] [bp+10h]@60 | |
6065 int v_4a; // [sp+8Ch] [bp+10h]@65 | |
6066 int v_4b; // [sp+8Ch] [bp+10h]@136 | |
6067 int v_4c; // [sp+8Ch] [bp+10h]@141 | |
6068 int v_8; // [sp+90h] [bp+14h]@53 | |
6069 | |
6070 a4 = __PAIR__(z, x); | |
6071 v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); | |
6072 v114 = 0; | |
6073 v97.z = y; | |
6074 v113 = 0; | |
6075 a4_8 = v4; | |
6076 *(_QWORD *)&v97.x = a4; | |
6077 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
6078 { | |
6079 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
6080 v45.z = v.z; | |
6081 *(_QWORD *)&v45.x = *(_QWORD *)&v; | |
6082 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &v163); | |
6083 v46 = outy - pOut.y; | |
6084 v47 = v163 - outz; | |
6085 v48 = outx - pOut.x; | |
6086 v49 = integer_sqrt(v48 * v48 + v46 * v46 + v47 * v47); | |
6087 v50 = 65536; | |
6088 if ( v49 ) | |
6089 v50 = 65536 / v49; | |
6090 v51 = outx; | |
6091 v143 = v48 * v50; | |
6092 v52 = v46 * v50; | |
6093 v53 = v47 * v50; | |
6094 v54 = pOut.x; | |
6095 v147 = v52; | |
6096 v151 = v53; | |
6097 v119 = pOut.x; | |
6098 if ( pOut.x < outx ) | |
6099 { | |
6100 v123 = outx; | |
6101 } | |
6102 else | |
6103 { | |
6104 v119 = outx; | |
6105 v123 = pOut.x; | |
6106 } | |
6107 v55 = pOut.y; | |
6108 v56 = outy; | |
6109 v127 = pOut.y; | |
6110 if ( pOut.y < outy ) | |
6111 { | |
6112 v131 = outy; | |
6113 } | |
6114 else | |
6115 { | |
6116 v127 = outy; | |
6117 v131 = pOut.y; | |
6118 } | |
6119 v57 = v163; | |
6120 v58 = outz; | |
6121 v135 = outz; | |
6122 if ( outz < v163 ) | |
6123 { | |
6124 v139 = v163; | |
6125 } | |
6126 else | |
6127 { | |
6128 v135 = v163; | |
6129 v139 = outz; | |
6130 } | |
6131 a5b = 0; | |
6132 while ( !v114 ) | |
6133 { | |
6134 if ( a5b ) | |
6135 { | |
6136 v102 = v58; | |
6137 v100 = v55; | |
6138 v98 = v54; | |
6139 } | |
6140 else | |
6141 { | |
6142 v102 = v57; | |
6143 v100 = v56; | |
6144 v98 = v51; | |
6145 } | |
6146 v59 = pIndoor->GetSector(v98, v100, v102); | |
6147 v60 = pIndoor->pSectors; | |
6148 v61 = 116 * v59; | |
6149 sDepthb = 0; | |
6150 for ( i = 116 * v59; | |
6151 sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v61) | |
6152 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61); | |
6153 ++sDepthb ) | |
6154 { | |
6155 v62 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]]; | |
6156 if ( v62->Portal() | |
6157 || v119 > v62->pBounding.x2 | |
6158 || v123 < v62->pBounding.x1 | |
6159 || v127 > v62->pBounding.y2 | |
6160 || v131 < v62->pBounding.y1 | |
6161 || v135 > v62->pBounding.z2 | |
6162 || v139 < v62->pBounding.z1 | |
6163 || (v63 = (unsigned __int64)(v143 * (signed __int64)v62->pFacePlane_old.vNormal.x) >> 16, | |
6164 v64 = (unsigned __int64)(v151 * (signed __int64)v62->pFacePlane_old.vNormal.z) >> 16, | |
6165 v65 = (unsigned __int64)(v147 * (signed __int64)v62->pFacePlane_old.vNormal.y) >> 16, | |
6166 v20 = v63 + v64 + v65 == 0, | |
6167 v66 = v63 + v64 + v65, | |
6168 v107 = v63 + v64 + v65, | |
6169 v20) ) | |
6170 goto LABEL_107; | |
6171 v67 = outz * v62->pFacePlane_old.vNormal.z; | |
6172 v68 = -(v62->pFacePlane_old.dist | |
6173 + v67 | |
6174 + pOut.y * v62->pFacePlane_old.vNormal.y | |
6175 + pOut.x * v62->pFacePlane_old.vNormal.x); | |
6176 if ( v66 <= 0 ) | |
6177 { | |
6178 if ( v62->pFacePlane_old.dist | |
6179 + v67 | |
6180 + pOut.y * v62->pFacePlane_old.vNormal.y | |
6181 + pOut.x * v62->pFacePlane_old.vNormal.x < 0 ) | |
6182 goto LABEL_107; | |
6183 } | |
6184 else | |
6185 { | |
6186 if ( v62->pFacePlane_old.dist | |
6187 + v67 | |
6188 + pOut.y * v62->pFacePlane_old.vNormal.y | |
6189 + pOut.x * v62->pFacePlane_old.vNormal.x > 0 ) | |
6190 goto LABEL_107; | |
6191 } | |
6192 v69 = abs(-(v62->pFacePlane_old.dist | |
6193 + v67 | |
6194 + pOut.y * v62->pFacePlane_old.vNormal.y | |
6195 + pOut.x * v62->pFacePlane_old.vNormal.x)) >> 14; | |
6196 if ( v69 <= abs(v66) ) | |
6197 { | |
6198 LODWORD(v70) = v68 << 16; | |
6199 HIDWORD(v70) = v68 >> 16; | |
6200 v71 = v70 / v107; | |
6201 v108 = v70 / v107; | |
6202 if ( v71 >= 0 ) | |
6203 { | |
6204 if ( sub_4075DB( | |
6205 pOut.x + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v143) >> 16) + 32768) >> 16), | |
6206 pOut.y + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v147) >> 16) + 32768) >> 16), | |
6207 outz + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v151) >> 16) + 32768) >> 16), | |
6208 v62) ) | |
6209 { | |
6210 v114 = 1; | |
6211 break; | |
6212 } | |
6213 } | |
6214 } | |
6215 v61 = i; | |
6216 LABEL_107: | |
6217 v60 = pIndoor->pSectors; | |
6218 } | |
6219 ++a5b; | |
6220 if ( a5b >= 2 ) | |
6221 break; | |
6222 v57 = v163; | |
6223 v56 = outy; | |
6224 v51 = outx; | |
6225 v58 = outz; | |
6226 v55 = pOut.y; | |
6227 v54 = pOut.x; | |
6228 } | |
6229 v72.z = y; | |
6230 *(_QWORD *)&v72.x = a4; | |
6231 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz); | |
6232 v73.z = v.z; | |
6233 *(_QWORD *)&v73.x = *(_QWORD *)&v; | |
6234 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163); | |
6235 v74 = outy - pOut.y; | |
6236 v75 = v163 - outz; | |
6237 v76 = outx - pOut.x; | |
6238 v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75); | |
6239 v78 = 65536; | |
6240 if ( v77 ) | |
6241 v78 = 65536 / v77; | |
6242 v79 = outx; | |
6243 v144 = v76 * v78; | |
6244 v80 = v74 * v78; | |
6245 v81 = v75 * v78; | |
6246 v82 = pOut.x; | |
6247 v148 = v80; | |
6248 v152 = v81; | |
6249 v120 = pOut.x; | |
6250 if ( pOut.x < outx ) | |
6251 { | |
6252 v124 = outx; | |
6253 } | |
6254 else | |
6255 { | |
6256 v120 = outx; | |
6257 v124 = pOut.x; | |
6258 } | |
6259 v83 = pOut.y; | |
6260 v84 = outy; | |
6261 v128 = pOut.y; | |
6262 if ( pOut.y < outy ) | |
6263 { | |
6264 v132 = outy; | |
6265 } | |
6266 else | |
6267 { | |
6268 v128 = outy; | |
6269 v132 = pOut.y; | |
6270 } | |
6271 v85 = v163; | |
6272 v86 = outz; | |
6273 v136 = outz; | |
6274 if ( outz < v163 ) | |
6275 { | |
6276 v140 = v163; | |
6277 } | |
6278 else | |
6279 { | |
6280 v136 = v163; | |
6281 v140 = outz; | |
6282 } | |
6283 a5c = 0; | |
6284 while ( 1 ) | |
6285 { | |
6286 if ( v113 ) | |
6287 return !v114 || !v113; | |
6288 if ( a5c ) | |
6289 { | |
6290 v103 = v86; | |
6291 v101 = v83; | |
6292 v99 = v82; | |
6293 } | |
6294 else | |
6295 { | |
6296 v103 = v85; | |
6297 v101 = v84; | |
6298 v99 = v79; | |
6299 } | |
6300 v87 = pIndoor->GetSector(v99, v101, v103); | |
6301 v88 = pIndoor->pSectors; | |
6302 v89 = 116 * v87; | |
6303 v162 = 0; | |
6304 v112 = v89; | |
6305 if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) | |
6306 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 ) | |
6307 break; | |
6308 LABEL_148: | |
6309 ++a5c; | |
6310 if ( a5c >= 2 ) | |
6311 return !v114 || !v113; | |
6312 v85 = v163; | |
6313 v84 = outy; | |
6314 v79 = outx; | |
6315 v86 = outz; | |
6316 v83 = pOut.y; | |
6317 v82 = pOut.x; | |
6318 } | |
6319 while ( 1 ) | |
6320 { | |
6321 v90 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v88->pWalls + v89))[v162]]; | |
6322 if ( v90->Portal() | |
6323 || v120 > v90->pBounding.x2 | |
6324 || v124 < v90->pBounding.x1 | |
6325 || v128 > v90->pBounding.y2 | |
6326 || v132 < v90->pBounding.y1 | |
6327 || v136 > v90->pBounding.z2 | |
6328 || v140 < v90->pBounding.z1 | |
6329 || (yb = (unsigned __int64)(v144 * (signed __int64)v90->pFacePlane_old.vNormal.x) >> 16, | |
6330 v_4b = (unsigned __int64)(v148 * (signed __int64)v90->pFacePlane_old.vNormal.y) >> 16, | |
6331 vf = (unsigned __int64)(v152 * (signed __int64)v90->pFacePlane_old.vNormal.z) >> 16, | |
6332 v20 = yb + vf + v_4b == 0, | |
6333 v91 = yb + vf + v_4b, | |
6334 vc = yb + vf + v_4b, | |
6335 v20) ) | |
6336 goto LABEL_145; | |
6337 v92 = outz * v90->pFacePlane_old.vNormal.z; | |
6338 v93 = -(v90->pFacePlane_old.dist | |
6339 + v92 | |
6340 + pOut.y * v90->pFacePlane_old.vNormal.y | |
6341 + pOut.x * v90->pFacePlane_old.vNormal.x); | |
6342 if ( v91 <= 0 ) | |
6343 { | |
6344 if ( v90->pFacePlane_old.dist | |
6345 + v92 | |
6346 + pOut.y * v90->pFacePlane_old.vNormal.y | |
6347 + pOut.x * v90->pFacePlane_old.vNormal.x < 0 ) | |
6348 goto LABEL_145; | |
6349 } | |
6350 else | |
6351 { | |
6352 if ( v90->pFacePlane_old.dist | |
6353 + v92 | |
6354 + pOut.y * v90->pFacePlane_old.vNormal.y | |
6355 + pOut.x * v90->pFacePlane_old.vNormal.x > 0 ) | |
6356 goto LABEL_145; | |
6357 } | |
6358 v_4c = abs(-(v90->pFacePlane_old.dist | |
6359 + v92 | |
6360 + pOut.y * v90->pFacePlane_old.vNormal.y | |
6361 + pOut.x * v90->pFacePlane_old.vNormal.x)) >> 14; | |
6362 if ( v_4c <= abs(v91) ) | |
6363 { | |
6364 LODWORD(v94) = v93 << 16; | |
6365 HIDWORD(v94) = v93 >> 16; | |
6366 v95 = v94 / vc; | |
6367 vd = v94 / vc; | |
6368 if ( v95 >= 0 ) | |
6369 { | |
6370 if ( sub_4075DB( | |
6371 pOut.x + ((signed int)(((unsigned __int64)(vd * (signed __int64)v144) >> 16) + 32768) >> 16), | |
6372 pOut.y + ((signed int)(((unsigned __int64)(vd * (signed __int64)v148) >> 16) + 32768) >> 16), | |
6373 outz + ((signed int)(((unsigned __int64)(vd * (signed __int64)v152) >> 16) + 32768) >> 16), | |
6374 v90) ) | |
6375 { | |
6376 v113 = 1; | |
6377 goto LABEL_148; | |
6378 } | |
6379 } | |
6380 } | |
6381 v89 = v112; | |
6382 LABEL_145: | |
6383 v88 = pIndoor->pSectors; | |
6384 ++v162; | |
6385 if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) | |
6386 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) ) | |
6387 goto LABEL_148; | |
6388 } | |
6389 } | |
6390 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
6391 v5.z = v.z; | |
6392 *(_QWORD *)&v5.x = *(_QWORD *)&v; | |
6393 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v5, &outx, &outy, &v163); | |
6394 v6 = outy - pOut.y; | |
6395 v7 = v163 - outz; | |
6396 v8 = outx - pOut.x; | |
6397 v9 = integer_sqrt(v8 * v8 + v6 * v6 + v7 * v7); | |
6398 v10 = 65536; | |
6399 if ( v9 ) | |
6400 v10 = 65536 / v9; | |
6401 v125 = v8 * v10; | |
6402 v11 = v10; | |
6403 v12 = v7 * v10; | |
6404 v13 = pOut.x; | |
6405 v117 = v12; | |
6406 v121 = v6 * v11; | |
6407 v149 = pOut.x; | |
6408 if ( pOut.x < outx ) | |
6409 { | |
6410 v145 = outx; | |
6411 } | |
6412 else | |
6413 { | |
6414 v149 = outx; | |
6415 v145 = pOut.x; | |
6416 } | |
6417 v14 = outy; | |
6418 v141 = pOut.y; | |
6419 if ( pOut.y < outy ) | |
6420 { | |
6421 v137 = outy; | |
6422 } | |
6423 else | |
6424 { | |
6425 v141 = outy; | |
6426 v137 = pOut.y; | |
6427 } | |
6428 v133 = outz; | |
6429 if ( outz < v163 ) | |
6430 { | |
6431 v129 = v163; | |
6432 } | |
6433 else | |
6434 { | |
6435 v133 = v163; | |
6436 v129 = outz; | |
6437 } | |
6438 v160 = 0; | |
6439 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
6440 { | |
6441 v104 = 0; | |
6442 while ( 1 ) | |
6443 { | |
6444 v15 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
6445 a5 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
6446 if ( sub_4088E9(v13, pOut.y, outx, v14, pOutdoor->pBModels[v104].vPosition.x, pOutdoor->pBModels[v104].vPosition.y) <= pOutdoor->pBModels[v104].sBoundingRadius + 128 ) | |
6447 { | |
6448 sDepth = 0; | |
6449 if ( *((int *)v15 + 2) > 0 ) | |
6450 break; | |
6451 } | |
6452 LABEL_36: | |
6453 ++v160; | |
6454 ++v104; | |
6455 if ( v160 >= (signed int)pOutdoor->uNumBModels ) | |
6456 goto LABEL_37; | |
6457 v14 = outy; | |
6458 v13 = pOut.x; | |
6459 } | |
6460 v106 = 0; | |
6461 while ( 1 ) | |
6462 { | |
6463 v16 = (ODMFace *)(v106 + *((int *)a5 + 4)); | |
6464 if ( v149 > v16->pBoundingBox.x2 | |
6465 || v145 < v16->pBoundingBox.x1 | |
6466 || v141 > v16->pBoundingBox.y2 | |
6467 || v137 < v16->pBoundingBox.y1 | |
6468 || v133 > v16->pBoundingBox.z2 | |
6469 || v129 < v16->pBoundingBox.z1 | |
6470 || (v17 = (unsigned __int64)(v125 * (signed __int64)v16->pFacePlane.vNormal.x) >> 16, | |
6471 v18 = (unsigned __int64)(v121 * (signed __int64)v16->pFacePlane.vNormal.y) >> 16, | |
6472 v19 = (unsigned __int64)(v117 * (signed __int64)v16->pFacePlane.vNormal.z) >> 16, | |
6473 v20 = v17 + v18 + v19 == 0, | |
6474 v21 = v17 + v18 + v19, | |
6475 v109 = v17 + v18 + v19, | |
6476 v20) ) | |
6477 goto LABEL_33; | |
6478 v22 = pOut.y * v16->pFacePlane.vNormal.y; | |
6479 v23 = -(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x); | |
6480 if ( v21 <= 0 ) | |
6481 { | |
6482 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x < 0 ) | |
6483 goto LABEL_33; | |
6484 } | |
6485 else | |
6486 { | |
6487 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x > 0 ) | |
6488 goto LABEL_33; | |
6489 } | |
6490 v24 = abs(-(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x)) >> 14; | |
6491 if ( v24 <= abs(v21) ) | |
6492 { | |
6493 LODWORD(v25) = v23 << 16; | |
6494 HIDWORD(v25) = v23 >> 16; | |
6495 v26 = v25 / v109; | |
6496 v110 = v25 / v109; | |
6497 if ( v26 >= 0 ) | |
6498 { | |
6499 if ( sub_4077F1( | |
6500 pOut.x + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v125) >> 16) + 32768) >> 16), | |
6501 pOut.y + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v121) >> 16) + 32768) >> 16), | |
6502 outz + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v117) >> 16) + 32768) >> 16), | |
6503 v16, | |
6504 (BSPVertexBuffer *)a5) ) | |
6505 { | |
6506 v114 = 1; | |
6507 goto LABEL_36; | |
6508 } | |
6509 } | |
6510 } | |
6511 LABEL_33: | |
6512 ++sDepth; | |
6513 v106 += 308; | |
6514 if ( sDepth >= *((int *)a5 + 2) ) | |
6515 goto LABEL_36; | |
6516 } | |
6517 } | |
6518 LABEL_37: | |
6519 v27.z = y; | |
6520 *(_QWORD *)&v27.x = a4; | |
6521 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz); | |
6522 v28.z = v.z; | |
6523 *(_QWORD *)&v28.x = *(_QWORD *)&v; | |
6524 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163); | |
6525 v29 = outy - pOut.y; | |
6526 v30 = v163 - outz; | |
6527 v31 = outx - pOut.x; | |
6528 v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30); | |
6529 v33 = 65536; | |
6530 if ( v32 ) | |
6531 v33 = 65536 / v32; | |
6532 v126 = v31 * v33; | |
6533 v34 = v33; | |
6534 v35 = v30 * v33; | |
6535 v36 = pOut.x; | |
6536 v118 = v35; | |
6537 v122 = v29 * v34; | |
6538 v150 = pOut.x; | |
6539 if ( pOut.x < outx ) | |
6540 { | |
6541 v146 = outx; | |
6542 } | |
6543 else | |
6544 { | |
6545 v150 = outx; | |
6546 v146 = pOut.x; | |
6547 } | |
6548 v37 = outy; | |
6549 v142 = pOut.y; | |
6550 if ( pOut.y < outy ) | |
6551 { | |
6552 v138 = outy; | |
6553 } | |
6554 else | |
6555 { | |
6556 v142 = outy; | |
6557 v138 = pOut.y; | |
6558 } | |
6559 v134 = outz; | |
6560 if ( outz < v163 ) | |
6561 { | |
6562 v130 = v163; | |
6563 } | |
6564 else | |
6565 { | |
6566 v134 = v163; | |
6567 v130 = outz; | |
6568 } | |
6569 v161 = 0; | |
6570 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
6571 { | |
6572 v105 = 0; | |
6573 while ( 1 ) | |
6574 { | |
6575 v38 = (char *)&pOutdoor->pBModels[v105].pVertices; | |
6576 a5a = (char *)&pOutdoor->pBModels[v105].pVertices; | |
6577 if ( sub_4088E9(v36, pOut.y, outx, v37, pOutdoor->pBModels[v105].vPosition.x, pOutdoor->pBModels[v105].vPosition.y) <= pOutdoor->pBModels[v105].sBoundingRadius + 128 ) | |
6578 { | |
6579 sDeptha = 0; | |
6580 if ( *((int *)v38 + 2) > 0 ) | |
6581 break; | |
6582 } | |
6583 LABEL_71: | |
6584 ++v161; | |
6585 ++v105; | |
6586 if ( v161 >= (signed int)pOutdoor->uNumBModels ) | |
6587 return !v114 || !v113; | |
6588 v37 = outy; | |
6589 v36 = pOut.x; | |
6590 } | |
6591 v_8 = 0; | |
6592 while ( 1 ) | |
6593 { | |
6594 v39 = (ODMFace *)(v_8 + *((int *)a5a + 4)); | |
6595 if ( v150 > v39->pBoundingBox.x2 | |
6596 || v146 < v39->pBoundingBox.x1 | |
6597 || v142 > v39->pBoundingBox.y2 | |
6598 || v138 < v39->pBoundingBox.y1 | |
6599 || v134 > v39->pBoundingBox.z2 | |
6600 || v130 < v39->pBoundingBox.z1 | |
6601 || (ya = (unsigned __int64)(v126 * (signed __int64)v39->pFacePlane.vNormal.x) >> 16, | |
6602 ve = (unsigned __int64)(v122 * (signed __int64)v39->pFacePlane.vNormal.y) >> 16, | |
6603 v_4 = (unsigned __int64)(v118 * (signed __int64)v39->pFacePlane.vNormal.z) >> 16, | |
6604 v20 = ya + ve + v_4 == 0, | |
6605 v40 = ya + ve + v_4, | |
6606 va = ya + ve + v_4, | |
6607 v20) ) | |
6608 goto LABEL_68; | |
6609 v41 = pOut.y * v39->pFacePlane.vNormal.y; | |
6610 v42 = -(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x); | |
6611 if ( v40 <= 0 ) | |
6612 { | |
6613 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x < 0 ) | |
6614 goto LABEL_68; | |
6615 } | |
6616 else | |
6617 { | |
6618 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x > 0 ) | |
6619 goto LABEL_68; | |
6620 } | |
6621 v_4a = abs(-(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x)) >> 14; | |
6622 if ( v_4a <= abs(v40) ) | |
6623 { | |
6624 LODWORD(v43) = v42 << 16; | |
6625 HIDWORD(v43) = v42 >> 16; | |
6626 v44 = v43 / va; | |
6627 vb = v43 / va; | |
6628 if ( v44 >= 0 ) | |
6629 { | |
6630 if ( sub_4077F1( | |
6631 pOut.x + ((signed int)(((unsigned __int64)(vb * (signed __int64)v126) >> 16) + 32768) >> 16), | |
6632 pOut.y + ((signed int)(((unsigned __int64)(vb * (signed __int64)v122) >> 16) + 32768) >> 16), | |
6633 outz + ((signed int)(((unsigned __int64)(vb * (signed __int64)v118) >> 16) + 32768) >> 16), | |
6634 v39, | |
6635 (BSPVertexBuffer *)a5a) ) | |
6636 { | |
6637 v113 = 1; | |
6638 goto LABEL_71; | |
6639 } | |
6640 } | |
6641 } | |
6642 LABEL_68: | |
6643 ++sDeptha; | |
6644 v_8 += 308; | |
6645 if ( sDeptha >= *((int *)a5a + 2) ) | |
6646 goto LABEL_71; | |
6647 } | |
6648 } | |
6649 return !v114 || !v113; | |
6650 } | |
6651 //----- (0043F333) -------------------------------------------------------- | |
6652 void BspRenderer::MakeVisibleSectorList() | |
6653 { | |
6654 int v6; // ebx@3 | |
6655 | |
6656 uNumVisibleNotEmptySectors = 0; | |
6657 for (uint i = 0; i < num_nodes; ++i) | |
6658 { | |
6659 if (!uNumVisibleNotEmptySectors) | |
6660 { | |
6661 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; | |
6662 continue; | |
6663 } | |
6664 | |
6665 v6 = 0; | |
6666 while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != nodes[i].uSectorID ) | |
6667 { | |
6668 ++v6; | |
6669 if ( v6 >= uNumVisibleNotEmptySectors) | |
6670 { | |
6671 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; | |
6672 } | |
6673 } | |
6674 | |
6675 } | |
6676 } | |
6677 //----- (0046A334) -------------------------------------------------------- | |
6678 char __fastcall DoInteractionWithTopmostZObject(int a1, int a2) | |
6679 { | |
6680 int v2; // edx@1 | |
6681 BLVFace *v4; // eax@9 | |
6682 unsigned int v5; // ecx@9 | |
6683 unsigned __int16 v6; // ax@11 | |
6684 //ODMFace *v7; // eax@16 | |
6685 LevelDecoration *v8; // esi@19 | |
6686 __int16 v9; // ax@19 | |
6687 int v10; // eax@22 | |
6688 int v11; // ecx@22 | |
6689 int v12; // edi@23 | |
6690 Actor *v13; // esi@23 | |
6691 unsigned __int16 v14; // ax@23 | |
6692 unsigned __int16 v15; // ax@33 | |
6693 const char *v16; // eax@34 | |
6694 int v17; // edi@36 | |
6695 int v18; // eax@36 | |
6696 ItemGen *v19; // esi@39 | |
6697 unsigned int v20; // eax@39 | |
6698 int v21; // ecx@40 | |
6699 std::string v22; // [sp-18h] [bp-2Ch]@5 | |
6700 const char *v23; // [sp-8h] [bp-1Ch]@5 | |
6701 int v24; // [sp-4h] [bp-18h]@5 | |
6702 char v25; // [sp+8h] [bp-Ch]@5 | |
6703 int v26; // [sp+Ch] [bp-8h]@1 | |
6704 int a3; // [sp+13h] [bp-1h]@5 | |
6705 | |
6706 v26 = a2; | |
6707 v2 = a1; | |
6708 switch ( PID_TYPE(a1) ) | |
6709 { | |
6710 case OBJECT_Item: // take the item | |
6711 v17 = PID_ID(a1); | |
6712 v26 = PID_ID(a1); | |
6713 v18 = PID_ID(a1); | |
6714 if ( pObjectList->pObjects[pSpriteObjects[v18].uObjectDescID].uFlags & 0x10 | |
6715 || v17 >= 1000 | |
6716 || !pSpriteObjects[v18].uObjectDescID ) | |
6717 return 1; | |
6718 v19 = &pSpriteObjects[v18].stru_24; | |
6719 v20 = pSpriteObjects[v18].stru_24.uItemID; | |
6720 if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD) | |
6721 { | |
6722 party_finds_gold(v19->uSpecEnchantmentType, 0); | |
6723 viewparams->bRedrawGameUI = 1; | |
6724 v21 = v17; | |
6725 } | |
6726 else | |
6727 { | |
6728 if ( pParty->pPickedItem.uItemID ) | |
6729 return 1; | |
6730 v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName; | |
6731 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v24); | |
6732 ShowStatusBarString(pTmpBuf2.data(), 2u); | |
6733 if ( v19->uItemID == 506 ) | |
6734 _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u); | |
6735 if ( v19->uItemID == 455 ) | |
6736 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u); | |
6737 if ( !pParty->AddItem(v19) ) | |
6738 pParty->SetHoldingItem(v19); | |
6739 v21 = v26; | |
6740 } | |
6741 SpriteObject::OnInteraction(v21); | |
6742 break; | |
6743 | |
6744 case OBJECT_Actor: | |
6745 v12 = PID_ID(a1); | |
6746 v13 = &pActors[PID_ID(a1)]; | |
6747 v14 = v13->uAIState; | |
6748 if ( v14 == 4 || v14 == 17 ) | |
6749 return 1; | |
6750 if ( v14 == 5 ) | |
6751 { | |
6752 stru_50C198.LootActor(&pActors[PID_ID(a1)]); | |
6753 } | |
6754 else | |
6755 { | |
6756 if ( !v13->GetActorsRelation(0) && !(BYTE2(v13->uAttributes) & 8) && v13->CanAct() ) | |
6757 { | |
6758 Actor::AI_FaceObject(v12, 4u, 0, 0); | |
6759 if ( v13->sNPC_ID ) | |
6760 { | |
6761 pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v12, 0); | |
6762 } | |
6763 else | |
6764 { | |
6765 v15 = pNPCStats->pGroups_copy[v13->uGroup]; | |
6766 if ( v15 ) | |
6767 { | |
6768 v16 = pNPCStats->pCatchPhrases[v15]; | |
6769 if ( v16 ) | |
6770 { | |
6771 pParty->uFlags |= 2u; | |
6772 strcpy(byte_5B0938.data(), v16); | |
6773 sub_4451A8_press_any_key(0, 0, 0); | |
6774 } | |
6775 } | |
6776 } | |
6777 } | |
6778 } | |
6779 break; | |
6780 | |
6781 case OBJECT_Decoration: | |
6782 v8 = &pLevelDecorations[PID_ID(a1)]; | |
6783 v9 = v8->field_16_event_id; | |
6784 if ( v9 ) | |
6785 { | |
6786 EventProcessor(v9, a1, 1); | |
6787 LOBYTE(v8->field_2) |= 8u; | |
6788 } | |
6789 else | |
6790 { | |
6791 if ( !pLevelDecorations[PID_ID(a1)].IsInteractive() ) | |
6792 return 1; | |
6793 v10 = v8->_idx_in_stru123; | |
6794 v24 = 1; | |
6795 v11 = stru_5E4C90._decor_events[v10 - 75] + 380; | |
6796 activeLevelDecoration = v8; | |
6797 EventProcessor(v11, 0, 1); | |
6798 activeLevelDecoration = NULL; | |
6799 } | |
6800 break; | |
6801 | |
6802 default: | |
6803 MessageBoxW(nullptr, L"Warning: Invalid ID reached!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Mouse.cpp:2020", 0); | |
6804 return 1; | |
6805 | |
6806 case OBJECT_BModel: | |
6807 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
6808 { | |
6809 int bmodel_id = a1 >> 9, | |
6810 face_id = PID_ID(a1) & 0x3F; | |
6811 if (bmodel_id >= pOutdoor->uNumBModels) | |
6812 return 1; | |
6813 auto face = &pOutdoor->pBModels[bmodel_id].pFaces[face_id]; | |
6814 if (face->uAttributes & 0x100000 || face->sCogTriggeredID == 0 ) | |
6815 return 1; | |
6816 EventProcessor((signed __int16)face->sCogTriggeredID, v2, 1); | |
6817 } | |
6818 else | |
6819 { | |
6820 v4 = &pIndoor->pFaces[PID_ID(a1)]; | |
6821 v5 = v4->uAttributes; | |
6822 if ( !(v5 & 0x2000000) ) | |
6823 { | |
6824 ShowNothingHereStatus(); | |
6825 return 1; | |
6826 } | |
6827 if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 ) | |
6828 return 1; | |
6829 if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) | |
6830 EventProcessor((signed __int16)v6, v2, 1); | |
6831 } | |
6832 return 0; | |
6833 break; | |
6834 } | |
6835 return 0; | |
6836 } | |
6837 //----- (0046BDF1) -------------------------------------------------------- | |
6838 void __cdecl BLV_UpdateUserInputAndOther() | |
6839 { | |
6840 UpdateObjects(); | |
6841 BLV_ProcessPartyActions(); | |
6842 UpdateActors_BLV(); | |
6843 BLV_UpdateDoors(); | |
6844 check_event_triggers(); | |
6845 } | |
6846 //----- (00424829) -------------------------------------------------------- | |
6847 bool sub_424829(int pNumVertices, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int uFaceID) | |
6848 { | |
6849 //int v4; // edi@1 | |
6850 //BspRenderer_stru2 *v5; // ebx@1 | |
6851 int v6; // eax@3 | |
6852 int min_y; // esi@5 | |
6853 int max_y; // edx@5 | |
6854 //int v9; // ecx@6 | |
6855 int v10; // eax@12 | |
6856 //int v11; // edi@13 | |
6857 //int v12; // edx@18 | |
6858 int v13; // eax@22 | |
6859 //int v14; // edi@28 | |
6860 int v15; // ecx@29 | |
6861 //int v16; // edi@30 | |
6862 //int v17; // edx@35 | |
6863 int v18; // eax@39 | |
6864 int v19; // eax@44 | |
6865 int v20; // ecx@44 | |
6866 //int v21; // edi@45 | |
6867 int v22; // edi@46 | |
6868 //__int16 *v23; // ecx@47 | |
6869 int v24; // edx@48 | |
6870 //int v25; // eax@50 | |
6871 int v26; // eax@55 | |
6872 signed int v27; // edi@55 | |
6873 //int v28; // edx@56 | |
6874 int v29; // edx@57 | |
6875 //int v30; // eax@59 | |
6876 int v31; // eax@64 | |
6877 signed int v32; // edi@64 | |
6878 //int v33; // edx@65 | |
6879 int v34; // eax@66 | |
6880 int v35; // dx@66 | |
6881 __int16 v36; // dx@67 | |
6882 __int16 v37; // di@67 | |
6883 __int16 v38; // dx@67 | |
6884 //BspRenderer_stru2 *v39; // ecx@69 | |
6885 //int v40; // edx@69 | |
6886 //int v41; // edi@70 | |
6887 //__int16 *v42; // eax@76 | |
6888 //__int16 *v43; // eax@81 | |
6889 //__int16 *v45; // eax@87 | |
6890 int v46; // edx@87 | |
6891 //__int16 v47; // cx@88 | |
6892 //int v48; // eax@93 | |
6893 int v49; // esi@93 | |
6894 //__int16 *v50; // ecx@94 | |
6895 //int v51; // eax@95 | |
6896 //int v52; // eax@97 | |
6897 int v53; // [sp+Ch] [bp-34h]@44 | |
6898 int v54; // [sp+10h] [bp-30h]@0 | |
6899 int v55; // [sp+14h] [bp-2Ch]@12 | |
6900 //__int16 *v56; // [sp+14h] [bp-2Ch]@47 | |
6901 //__int16 v57; // [sp+14h] [bp-2Ch]@76 | |
6902 //__int16 v58; // [sp+14h] [bp-2Ch]@81 | |
6903 int v59; // [sp+14h] [bp-2Ch]@87 | |
6904 //BspRenderer_stru2 *v60; // [sp+18h] [bp-28h]@1 | |
6905 int v61; // [sp+1Ch] [bp-24h]@29 | |
6906 int v62; // [sp+20h] [bp-20h]@0 | |
6907 signed int v63; // [sp+24h] [bp-1Ch]@3 | |
6908 signed int v64; // [sp+28h] [bp-18h]@3 | |
6909 int v65; // [sp+2Ch] [bp-14h]@5 | |
6910 //int v66; // [sp+2Ch] [bp-14h]@39 | |
6911 //int v67; // [sp+30h] [bp-10h]@22 | |
6912 int v68; // [sp+34h] [bp-Ch]@12 | |
6913 int v69; // [sp+34h] [bp-Ch]@29 | |
6914 int v70; // [sp+34h] [bp-Ch]@46 | |
6915 int v71; // [sp+34h] [bp-Ch]@75 | |
6916 int v72; // [sp+34h] [bp-Ch]@80 | |
6917 //int v73; // [sp+38h] [bp-8h]@11 | |
6918 //int v74; // [sp+3Ch] [bp-4h]@1 | |
6919 //int a3a; // [sp+48h] [bp+8h]@76 | |
6920 //int a3b; // [sp+48h] [bp+8h]@87 | |
6921 | |
6922 //try graphic engine with function returning 1 always, and without | |
6923 //return true; | |
6924 if ( pNumVertices <= 1 ) | |
6925 return false; | |
6926 min_y = stru_50B700._screen_space_y[0]; | |
6927 v65 = 0; | |
6928 max_y = stru_50B700._screen_space_y[0]; | |
6929 if ( !stru_50B700.field_0 ) | |
6930 { | |
6931 v63 = 1; | |
6932 v64 = -1; | |
6933 } | |
6934 else | |
6935 { | |
6936 v63 = -1; | |
6937 v64 = 1; | |
6938 } | |
6939 | |
6940 for ( v6 = 1; v6 < pNumVertices; ++v6 ) | |
6941 { | |
6942 if ( stru_50B700._screen_space_y[v6] >= min_y ) | |
6943 { | |
6944 if ( stru_50B700._screen_space_y[v6] > max_y ) | |
6945 max_y = stru_50B700._screen_space_y[v6]; | |
6946 } | |
6947 if ( stru_50B700._screen_space_y[v6] < min_y ) | |
6948 { | |
6949 v65 = v6; | |
6950 min_y = stru_50B700._screen_space_y[v6]; | |
6951 } | |
6952 } | |
6953 if ( max_y == min_y ) | |
6954 return false; | |
6955 | |
6956 v10 = v65; | |
6957 a2->_viewport_space_y = min_y; | |
6958 a2->_viewport_space_w = max_y; | |
6959 v55 = v65; | |
6960 | |
6961 for ( v68 = 0; v68 < pNumVertices; ++v68 ) | |
6962 { | |
6963 v10 += v64; | |
6964 if ( v10 < pNumVertices ) | |
6965 { | |
6966 if ( v10 < 0 ) | |
6967 v10 += pNumVertices; | |
6968 } | |
6969 else | |
6970 v10 -= pNumVertices; | |
6971 if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v65] ) | |
6972 { | |
6973 v55 = v10; | |
6974 v65 = v10; | |
6975 } | |
6976 if ( stru_50B700._screen_space_y[v10] == max_y ) | |
6977 break; | |
6978 } | |
6979 v13 = v55 + v64; | |
6980 if ( v13 < pNumVertices ) | |
6981 { | |
6982 if ( v13 < 0 ) | |
6983 v13 += pNumVertices; | |
6984 } | |
6985 else | |
6986 v13 -= pNumVertices; | |
6987 if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] ) | |
6988 { | |
6989 v62 = stru_50B700._screen_space_x[v55] << 16; | |
6990 v54 = ((stru_50B700._screen_space_x[v13] - stru_50B700._screen_space_x[v55]) << 16) / (stru_50B700._screen_space_y[v13] - stru_50B700._screen_space_y[v55]); | |
6991 a2->viewport_left_side[min_y] = LOWORD(stru_50B700._screen_space_x[v55]); | |
6992 } | |
6993 v15 = v65; | |
6994 v61 = v65; | |
6995 | |
6996 for ( v69 = 0; v69 < pNumVertices; ++v69 ) | |
6997 { | |
6998 v15 += v63; | |
6999 if ( v15 < pNumVertices ) | |
7000 { | |
7001 if ( v15 < 0 ) | |
7002 v15 += pNumVertices; | |
7003 } | |
7004 else | |
7005 v15 -= pNumVertices; | |
7006 if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v65] ) | |
7007 { | |
7008 v61 = v15; | |
7009 v65 = v15; | |
7010 } | |
7011 if ( stru_50B700._screen_space_y[v15] == max_y ) | |
7012 break; | |
7013 } | |
7014 v18 = v63 + v61; | |
7015 if ( v18 < pNumVertices ) | |
7016 { | |
7017 if ( v18 < 0 ) | |
7018 v18 += pNumVertices; | |
7019 } | |
7020 else | |
7021 v18 -= pNumVertices; | |
7022 v19 = v18; | |
7023 v20 = v61; | |
7024 if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] ) | |
7025 { | |
7026 v61 = stru_50B700._screen_space_x[v20] << 16; | |
7027 v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20]; | |
7028 a2->viewport_right_side[max_y] = LOWORD(stru_50B700._screen_space_x[v20]); | |
7029 } | |
7030 v22 = min_y; | |
7031 if ( min_y <= max_y ) | |
7032 { | |
7033 //v56 = &a2->array_3D8[v7]; | |
7034 //v23 = &a2->array_18[v7]; | |
7035 for ( v70 = min_y; v70 <= max_y; ++v70 ) | |
7036 { | |
7037 v24 = v13; | |
7038 if ( v22 >= stru_50B700._screen_space_y[v13] && v22 != max_y ) | |
7039 { | |
7040 v13 = v64 + v13; | |
7041 if ( v13 < pNumVertices ) | |
7042 { | |
7043 if ( v13 < 0 ) | |
7044 v13 += pNumVertices; | |
7045 } | |
7046 else | |
7047 v13 -= pNumVertices; | |
7048 v26 = v13; | |
7049 //v27 = stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; | |
7050 if ( stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24] > 0 ) | |
7051 { | |
7052 v54 = ((stru_50B700._screen_space_x[v26] - stru_50B700._screen_space_x[v24]) << 16) / stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; | |
7053 v62 = stru_50B700._screen_space_x[v24] << 16; | |
7054 } | |
7055 } | |
7056 v29 = v18; | |
7057 if ( v70 >= stru_50B700._screen_space_y[v18] && v70 != max_y ) | |
7058 { | |
7059 v18 += v63; | |
7060 if ( v18 < pNumVertices ) | |
7061 { | |
7062 if ( v18 < 0 ) | |
7063 v18 += pNumVertices; | |
7064 } | |
7065 else | |
7066 v18 -= pNumVertices; | |
7067 v31 = v18; | |
7068 //v32 = stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; | |
7069 if ( stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29] > 0 ) | |
7070 { | |
7071 v53 = ((stru_50B700._screen_space_x[v31] - stru_50B700._screen_space_x[v29]) << 16) / stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; | |
7072 v61 = stru_50B700._screen_space_x[v29] << 16; | |
7073 } | |
7074 } | |
7075 //v34 = (char *)a2->array_18 - (char *)a2->array_3D8; | |
7076 //v35 = *(__int16 *)((char *)&a2->array_3D8[v70] + v34); | |
7077 //v35 = HIWORD(v62); | |
7078 a2->viewport_left_side[v70] = HIWORD(v62); | |
7079 a2->viewport_right_side[v70] = HIWORD(v61); | |
7080 //v34 = &a2->array_3D8[v70]; | |
7081 //v35 = a2->array_3D8[v70]; | |
7082 if ( a2->viewport_left_side[v70] > a2->viewport_right_side[v70] ) | |
7083 { | |
7084 v36 = a2->viewport_left_side[v70] ^ a2->viewport_right_side[v70]; | |
7085 v37 = a2->viewport_right_side[v70]; | |
7086 a2->viewport_left_side[v70] = v36; | |
7087 v38 = v37 ^ v36; | |
7088 a2->viewport_left_side[v70] ^= v38; | |
7089 a2->viewport_right_side[v70] = v38; | |
7090 } | |
7091 //++v56; | |
7092 v62 += v54; | |
7093 v22 = v70 + 1; | |
7094 v61 += v53; | |
7095 //++v23; | |
7096 } | |
7097 } | |
7098 if ( max_y < a3->_viewport_space_y ) | |
7099 return false; | |
7100 if ( min_y > a3->_viewport_space_w ) | |
7101 return false; | |
7102 if ( min_y < a3->_viewport_space_y ) | |
7103 min_y = a3->_viewport_space_y; | |
7104 if ( max_y > a3->_viewport_space_w ) | |
7105 max_y = a3->_viewport_space_w; | |
7106 if ( min_y <= max_y ) | |
7107 { | |
7108 //a3a = (char *)a2 - (char *)a3; | |
7109 //v42 = &a3->array_3D8[v7]; | |
7110 //v57 = *(__int16 *)((char *)v42 + a3a); | |
7111 for ( v71 = min_y; v71 <= max_y; ++v71 ) | |
7112 { | |
7113 if ( a2->viewport_left_side[v71] >= a3->viewport_left_side[v71] && a2->viewport_left_side[v71] <= a3->viewport_right_side[v71] ) | |
7114 break; | |
7115 //++v57; | |
7116 ++min_y; | |
7117 //++v42; | |
7118 } | |
7119 } | |
7120 if ( max_y < min_y ) | |
7121 return false; | |
7122 //a3a = (char *)a2 - (char *)a3; | |
7123 //v43 = &a3->array_3D8[v8]; | |
7124 //v58 = *(__int16 *)((char *)v43 + a3a); | |
7125 for ( v72 = max_y; v72 >= min_y; --v72 ) | |
7126 { | |
7127 if ( a2->viewport_right_side[v72] >= a3->viewport_left_side[v72] && a2->viewport_left_side[v72] <= a3->viewport_right_side[v72] ) | |
7128 break; | |
7129 //--v58; | |
7130 --max_y; | |
7131 //--v43; | |
7132 //v8 = v8; | |
7133 } | |
7134 if ( min_y >= max_y ) | |
7135 return false; | |
7136 //a3b = (char *)a3 - (char *)a2; | |
7137 v59 = min_y; | |
7138 //v45 = &a2->array_18[v7]; | |
7139 | |
7140 for ( v46 = max_y - min_y + 1; v46; --v46 ) | |
7141 { | |
7142 //v47 = *(__int16 *)((char *)v45 + a3b); | |
7143 if ( a2->viewport_left_side[v59] < a3->viewport_left_side[v59] ) | |
7144 a2->viewport_left_side[v59] = a3->viewport_left_side[v59]; | |
7145 if ( a2->viewport_right_side[v59] > a3->viewport_right_side[v59] ) | |
7146 a2->viewport_right_side[v59] = a3->viewport_right_side[v59]; | |
7147 ++v59; | |
7148 //++v45; | |
7149 } | |
7150 a2->_viewport_space_y = min_y; | |
7151 a2->_viewport_space_w = max_y; | |
7152 a2->field_8 = a2->viewport_left_side[min_y]; | |
7153 //v48 = a2->viewport_right_side[v7]; | |
7154 a2->field_10 = min_y; | |
7155 a2->field_14 = min_y; | |
7156 a2->field_C = a2->viewport_right_side[min_y]; | |
7157 v49 = min_y + 1; | |
7158 if ( v49 <= max_y ) | |
7159 { | |
7160 //v50 = &a2->array_3D8[v49]; | |
7161 for ( v49; v49 <= max_y; ++v49 ) | |
7162 { | |
7163 //v51 = a2->array_18[v49]; | |
7164 if ( a2->viewport_left_side[v49] < a2->field_8 ) | |
7165 { | |
7166 a2->field_8 = a2->viewport_left_side[v49]; | |
7167 a2->field_10 = v49; | |
7168 } | |
7169 if ( a2->viewport_right_side[v49] > a2->field_C ) | |
7170 { | |
7171 a2->field_C = a2->viewport_right_side[v49]; | |
7172 a2->field_14 = v49; | |
7173 } | |
7174 //++v50; | |
7175 } | |
7176 } | |
7177 return true; | |
7178 } | |
7179 //----- (00423B5D) -------------------------------------------------------- | |
7180 int __fastcall sub_423B5D(unsigned int uFaceID) | |
7181 { | |
7182 BLVFace *pFace; // ebx@1 | |
7183 Vec3_short_ *v2; // esi@1 | |
7184 //int v3; // ST28_4@1 | |
7185 //__int16 v4; // ST2C_2@1 | |
7186 signed int v5; // esi@1 | |
7187 //Vec3_short_ *v6; // eax@4 | |
7188 signed int v7; // edi@5 | |
7189 signed int v8; // eax@5 | |
7190 signed int v9; // ecx@10 | |
7191 int v10; // eax@10 | |
7192 int v11; // edx@11 | |
7193 int v12; // ST28_4@12 | |
7194 signed int v13; // edx@12 | |
7195 signed __int64 v14; // qtt@12 | |
7196 char *v15; // ebx@12 | |
7197 int v16; // ST28_4@14 | |
7198 signed int v17; // eax@14 | |
7199 signed __int64 v18; // qtt@14 | |
7200 signed int v19; // edx@15 | |
7201 signed int v20; // edx@17 | |
7202 signed int v21; // ebx@19 | |
7203 signed int v22; // esi@20 | |
7204 int v23; // edi@21 | |
7205 int v24; // eax@21 | |
7206 int v25; // eax@22 | |
7207 int v26; // eax@22 | |
7208 signed int v27; // ST30_4@24 | |
7209 signed __int64 v28; // qtt@24 | |
7210 int v29; // ST18_4@25 | |
7211 int v30; // eax@26 | |
7212 int v31; // eax@27 | |
7213 int v32; // eax@27 | |
7214 signed int v33; // ST30_4@29 | |
7215 signed __int64 v34; // qtt@29 | |
7216 int v35; // ST30_4@30 | |
7217 signed int v36; // edi@31 | |
7218 unsigned int v37; // eax@31 | |
7219 bool v38; // edx@31 | |
7220 int v39; // ecx@31 | |
7221 int v40; // ecx@32 | |
7222 int v41; // esi@32 | |
7223 int v42; // eax@34 | |
7224 signed int v43; // ebx@41 | |
7225 unsigned int v44; // eax@41 | |
7226 signed int v45; // ecx@42 | |
7227 int v46; // esi@42 | |
7228 int v47; // eax@44 | |
7229 signed int v48; // edi@51 | |
7230 unsigned int v49; // eax@51 | |
7231 bool v50; // edx@51 | |
7232 int v51; // ecx@51 | |
7233 int v52; // ecx@52 | |
7234 int v53; // esi@52 | |
7235 int v54; // eax@54 | |
7236 int v55; // ebx@61 | |
7237 unsigned int v56; // eax@61 | |
7238 signed int v57; // ecx@62 | |
7239 int v58; // esi@62 | |
7240 int v59; // eax@64 | |
7241 char v61; // zf@72 | |
7242 signed int v62; // edx@75 | |
7243 int v63; // ecx@76 | |
7244 int v64; // esi@76 | |
7245 int v65; // ecx@83 | |
7246 signed int v66; // [sp+14h] [bp-14h]@3 | |
7247 int v67; // [sp+14h] [bp-14h]@34 | |
7248 int v68; // [sp+14h] [bp-14h]@44 | |
7249 int v69; // [sp+14h] [bp-14h]@54 | |
7250 int v70; // [sp+14h] [bp-14h]@64 | |
7251 signed int v71; // [sp+14h] [bp-14h]@75 | |
7252 IndoorCameraD3D *_this; // [sp+18h] [bp-10h]@1 | |
7253 bool thisa; // [sp+18h] [bp-10h]@9 | |
7254 int thisb; // [sp+18h] [bp-10h]@12 | |
7255 int thisc; // [sp+18h] [bp-10h]@20 | |
7256 bool thisd; // [sp+18h] [bp-10h]@41 | |
7257 bool thise; // [sp+18h] [bp-10h]@61 | |
7258 int thisf; // [sp+18h] [bp-10h]@74 | |
7259 signed int v79; // [sp+1Ch] [bp-Ch]@9 | |
7260 int v80; // [sp+1Ch] [bp-Ch]@76 | |
7261 bool v81; // [sp+20h] [bp-8h]@10 | |
7262 bool v82; // [sp+20h] [bp-8h]@32 | |
7263 bool v83; // [sp+20h] [bp-8h]@42 | |
7264 bool v84; // [sp+20h] [bp-8h]@52 | |
7265 bool v85; // [sp+20h] [bp-8h]@62 | |
7266 signed int v86; // [sp+24h] [bp-4h]@9 | |
7267 signed int v87; // [sp+24h] [bp-4h]@19 | |
7268 signed int v88; // [sp+24h] [bp-4h]@31 | |
7269 signed int v89; // [sp+24h] [bp-4h]@41 | |
7270 signed int v90; // [sp+24h] [bp-4h]@51 | |
7271 signed int v91; // [sp+24h] [bp-4h]@61 | |
7272 | |
7273 pFace = &pIndoor->pFaces[uFaceID]; | |
7274 _this = pGame->pIndoorCameraD3D; | |
7275 v2 = &pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]]; | |
7276 //v3 = *(_DWORD *)pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x; | |
7277 //v4 = pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z; | |
7278 v5 = 0; | |
7279 if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) | |
7280 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) | |
7281 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) | |
7282 { | |
7283 stru_50B700.field_0 = 1; | |
7284 } | |
7285 else | |
7286 { | |
7287 stru_50B700.field_0 = 0; | |
7288 if ( !(pFace->uAttributes & 1) ) | |
7289 return 0; | |
7290 } | |
7291 v66 = pFace->uNumVertices; | |
7292 if ( (signed int)pFace->uNumVertices > 0 ) | |
7293 { | |
7294 do | |
7295 { | |
7296 //v6 = &pIndoor->pVertices[pFace->pVertexIDs[v5]]; | |
7297 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( | |
7298 pIndoor->pVertices[pFace->pVertexIDs[v5]].x, | |
7299 pIndoor->pVertices[pFace->pVertexIDs[v5]].y, | |
7300 pIndoor->pVertices[pFace->pVertexIDs[v5]].z, | |
7301 &stru_50B700._view_transformed_xs[v5 + 3], | |
7302 &stru_50B700._view_transformed_zs[v5 + 3], | |
7303 &stru_50B700._view_transformed_ys[v5 + 3], | |
7304 0); | |
7305 ++v5; | |
7306 } | |
7307 while ( v5 < v66 ); | |
7308 } | |
7309 v7 = v66; | |
7310 v8 = 0; | |
7311 if ( v66 <= 0 ) | |
7312 return 0; | |
7313 do | |
7314 { | |
7315 if ( stru_50B700._view_transformed_xs[v8 + 3] >= 524288 ) | |
7316 break; | |
7317 ++v8; | |
7318 } | |
7319 while ( v8 < v66 ); | |
7320 if ( v8 >= v66 ) | |
7321 return 0; | |
7322 v79 = 0; | |
7323 stru_50B700._view_transformed_xs[v66 + 3] = stru_50B700._view_transformed_xs[3]; | |
7324 stru_50B700._view_transformed_zs[v66 + 3] = stru_50B700._view_transformed_zs[3]; | |
7325 stru_50B700._view_transformed_ys[v66 + 3] = stru_50B700._view_transformed_ys[3]; | |
7326 thisa = stru_50B700._view_transformed_xs[3] >= 524288; | |
7327 v86 = 1; | |
7328 if ( v66 >= 1 ) | |
7329 { | |
7330 do | |
7331 { | |
7332 v9 = v86; | |
7333 v10 = stru_50B700._view_transformed_xs[v86 + 3]; | |
7334 v81 = v10 >= 524288; | |
7335 if ( thisa ^ v81 ) | |
7336 { | |
7337 v11 = stru_50B700._view_transformed_xs[v9 + 2]; | |
7338 if ( v10 >= 524288 ) | |
7339 { | |
7340 v12 = v10 - v11; | |
7341 v13 = 524288 - v11; | |
7342 LODWORD(v14) = v13 << 16; | |
7343 HIDWORD(v14) = v13 >> 16; | |
7344 v15 = (char *)&stru_50B700._view_transformed_ys[v9 + 2]; | |
7345 stru_50B700._view_transformed_zs[v79] = ((unsigned __int64)((stru_50B700._view_transformed_zs[v9 + 3] | |
7346 - stru_50B700._view_transformed_zs[v9 + 2]) | |
7347 * v14 | |
7348 / v12) >> 16) | |
7349 + stru_50B700._view_transformed_zs[v9 + 2]; | |
7350 thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[v9 + 3] - stru_50B700._view_transformed_ys[v9 + 2]) | |
7351 * v14 | |
7352 / v12) >> 16; | |
7353 } | |
7354 else | |
7355 { | |
7356 v16 = v11 - v10; | |
7357 v17 = 524288 - v10; | |
7358 LODWORD(v18) = v17 << 16; | |
7359 HIDWORD(v18) = v17 >> 16; | |
7360 v15 = (char *)&stru_50B700._view_transformed_ys[v9 + 3]; | |
7361 stru_50B700._view_transformed_zs[v79] = ((unsigned __int64)((stru_50B700._view_transformed_zs[v9 + 2] | |
7362 - stru_50B700._view_transformed_zs[v9 + 3]) | |
7363 * v18 | |
7364 / v16) >> 16) | |
7365 + stru_50B700._view_transformed_zs[v9 + 3]; | |
7366 thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[v9 + 2] - stru_50B700._view_transformed_ys[v9 + 3]) | |
7367 * v18 | |
7368 / v16) >> 16; | |
7369 } | |
7370 v19 = v79++; | |
7371 v7 = v66; | |
7372 stru_50B700._view_transformed_ys[v19] = thisb + *(_DWORD *)v15; | |
7373 stru_50B700._view_transformed_xs[v19] = 524288; | |
7374 } | |
7375 if ( v81 ) | |
7376 { | |
7377 v20 = v79++; | |
7378 stru_50B700._view_transformed_xs[v20] = stru_50B700._view_transformed_xs[v9 + 3]; | |
7379 stru_50B700._view_transformed_zs[v20] = stru_50B700._view_transformed_zs[v9 + 3]; | |
7380 stru_50B700._view_transformed_ys[v20] = stru_50B700._view_transformed_ys[v9 + 3]; | |
7381 } | |
7382 ++v86; | |
7383 thisa = v81; | |
7384 } | |
7385 while ( v86 <= v7 ); | |
7386 } | |
7387 v87 = 0; | |
7388 v21 = v79; | |
7389 stru_50B700._view_transformed_xs[v79] = stru_50B700._view_transformed_xs[0]; | |
7390 stru_50B700._view_transformed_zs[v79] = stru_50B700._view_transformed_zs[0]; | |
7391 for ( stru_50B700._view_transformed_ys[v79] = stru_50B700._view_transformed_ys[0]; | |
7392 v87 < v79; | |
7393 stru_50B700._screen_space_y[v22 + 12] = pBLVRenderParams->uViewportCenterY - v35 ) | |
7394 { | |
7395 v22 = v87; | |
7396 thisc = abs(stru_50B700._view_transformed_xs[v87]); | |
7397 if ( abs(stru_50B700._view_transformed_zs[v87]) >> 13 <= thisc ) | |
7398 { | |
7399 v27 = stru_50B700._view_transformed_zs[v22]; | |
7400 LODWORD(v28) = v27 << 16; | |
7401 HIDWORD(v28) = v27 >> 16; | |
7402 v26 = v28 / stru_50B700._view_transformed_xs[v22]; | |
7403 v23 = 0; | |
7404 } | |
7405 else | |
7406 { | |
7407 v23 = 0; | |
7408 v24 = 0; | |
7409 if ( stru_50B700._view_transformed_zs[v22] >= 0 ) | |
7410 { | |
7411 LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; | |
7412 v26 = ((v24 - 1) & 0xFF800000) + 4194304; | |
7413 } | |
7414 else | |
7415 { | |
7416 LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; | |
7417 v25 = v24 - 1; | |
7418 v26 = (v25 & 0x800000) - 4194304; | |
7419 } | |
7420 } | |
7421 v29 = stru_50B700._view_transformed_ys[v22]; | |
7422 stru_50B700._screen_space_x[v22 + 12] = v26; | |
7423 if ( abs(v29) >> 13 <= thisc ) | |
7424 { | |
7425 v33 = stru_50B700._view_transformed_ys[v22]; | |
7426 LODWORD(v34) = v33 << 16; | |
7427 HIDWORD(v34) = v33 >> 16; | |
7428 v32 = v34 / stru_50B700._view_transformed_xs[v22]; | |
7429 } | |
7430 else | |
7431 { | |
7432 v30 = 0; | |
7433 if ( stru_50B700._view_transformed_ys[v22] >= v23 ) | |
7434 { | |
7435 LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; | |
7436 v32 = ((v30 - 1) & 0xFF800000) + 4194304; | |
7437 } | |
7438 else | |
7439 { | |
7440 LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; | |
7441 v31 = v30 - 1; | |
7442 v32 = (v31 & 0x800000) - 4194304; | |
7443 } | |
7444 } | |
7445 stru_50B700._screen_space_y[v22 + 12] = v32; | |
7446 stru_50B700._screen_space_x[v22 + 12] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) | |
7447 * (signed __int64)stru_50B700._screen_space_x[v22 + 12]) >> 16; | |
7448 v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._screen_space_y[v22 + 12]) >> 16; | |
7449 stru_50B700._screen_space_x[v22 + 12] = pBLVRenderParams->uViewportCenterX - stru_50B700._screen_space_x[v22 + 12]; | |
7450 ++v87; | |
7451 } | |
7452 v36 = 0; | |
7453 stru_50B700._screen_space_x[v21 + 12] = stru_50B700._screen_space_x[12]; | |
7454 stru_50B700._screen_space_y[v21 + 12] = stru_50B700._screen_space_y[12]; | |
7455 v37 = pBLVRenderParams->uViewportX; | |
7456 v38 = stru_50B700._screen_space_x[12] < (signed int)pBLVRenderParams->uViewportX; | |
7457 LOBYTE(v38) = stru_50B700._screen_space_x[12] >= (signed int)pBLVRenderParams->uViewportX; | |
7458 v39 = 1; | |
7459 v88 = 1; | |
7460 if ( v79 < 1 ) | |
7461 return 0; | |
7462 do | |
7463 { | |
7464 v40 = v39; | |
7465 v41 = stru_50B700._screen_space_x[v40 + 12]; | |
7466 v82 = v41 >= (signed int)v37; | |
7467 if ( v38 ^ v82 ) | |
7468 { | |
7469 if ( v41 >= (signed int)v37 ) | |
7470 { | |
7471 v67 = (signed int)(v37 - stru_50B700._screen_space_x[v40 + 11]) | |
7472 * (signed __int64)(stru_50B700._screen_space_y[v40 + 12] - stru_50B700._screen_space_y[v40 + 11]) | |
7473 / (v41 - stru_50B700._screen_space_x[v40 + 11]); | |
7474 v42 = stru_50B700._screen_space_y[v40 + 11]; | |
7475 } | |
7476 else | |
7477 { | |
7478 v67 = (signed int)(v37 - v41) | |
7479 * (signed __int64)(stru_50B700._screen_space_y[v40 + 11] - stru_50B700._screen_space_y[v40 + 12]) | |
7480 / (stru_50B700._screen_space_x[v40 + 11] - v41); | |
7481 v42 = stru_50B700._screen_space_y[v40 + 12]; | |
7482 } | |
7483 ++v36; | |
7484 stru_50B700._screen_space_y[v36 + 8] = v67 + v42; | |
7485 v37 = pBLVRenderParams->uViewportX; | |
7486 stru_50B700._screen_space_x[v36 + 8] = pBLVRenderParams->uViewportX; | |
7487 } | |
7488 v38 = v82; | |
7489 if ( v82 ) | |
7490 { | |
7491 stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[v40 + 12]; | |
7492 stru_50B700._screen_space_y[v36++ + 9] = stru_50B700._screen_space_y[v40 + 12]; | |
7493 } | |
7494 v39 = v88++ + 1; | |
7495 } | |
7496 while ( v88 <= v79 ); | |
7497 if ( !v36 | |
7498 || (v43 = 0, | |
7499 stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[9], | |
7500 stru_50B700._screen_space_y[v36 + 9] = stru_50B700._screen_space_y[9], | |
7501 v44 = pBLVRenderParams->uViewportZ, | |
7502 thisd = stru_50B700._screen_space_x[9] <= (signed int)pBLVRenderParams->uViewportZ, | |
7503 v89 = 1, | |
7504 v36 < 1) ) | |
7505 return 0; | |
7506 do | |
7507 { | |
7508 v45 = v89; | |
7509 v46 = stru_50B700._screen_space_x[v89 + 9]; | |
7510 v83 = v46 <= (signed int)v44; | |
7511 if ( thisd ^ v83 ) | |
7512 { | |
7513 if ( v46 <= (signed int)v44 ) | |
7514 { | |
7515 v68 = (signed int)(v44 - stru_50B700._screen_space_x[v45 + 8]) | |
7516 * (signed __int64)(stru_50B700._screen_space_y[v45 + 9] - stru_50B700._screen_space_y[v45 + 8]) | |
7517 / (v46 - stru_50B700._screen_space_x[v45 + 8]); | |
7518 v47 = stru_50B700._screen_space_y[v45 + 8]; | |
7519 } | |
7520 else | |
7521 { | |
7522 v68 = (signed int)(v44 - v46) | |
7523 * (signed __int64)(stru_50B700._screen_space_y[v45 + 8] - stru_50B700._screen_space_y[v45 + 9]) | |
7524 / (stru_50B700._screen_space_x[v45 + 8] - v46); | |
7525 v47 = stru_50B700._screen_space_y[v45 + 9]; | |
7526 } | |
7527 ++v43; | |
7528 stru_50B700._screen_space_y[v43 + 5] = v68 + v47; | |
7529 v44 = pBLVRenderParams->uViewportZ; | |
7530 stru_50B700._screen_space_x[v43 + 5] = pBLVRenderParams->uViewportZ; | |
7531 } | |
7532 if ( v83 ) | |
7533 { | |
7534 stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[v45 + 9]; | |
7535 stru_50B700._screen_space_y[v43++ + 6] = stru_50B700._screen_space_y[v45 + 9]; | |
7536 } | |
7537 ++v89; | |
7538 thisd = v83; | |
7539 } | |
7540 while ( v89 <= v36 ); | |
7541 if ( !v43 | |
7542 || (v48 = 0, | |
7543 stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[6], | |
7544 stru_50B700._screen_space_y[v43 + 6] = stru_50B700._screen_space_y[6], | |
7545 v49 = pBLVRenderParams->uViewportY, | |
7546 v50 = stru_50B700._screen_space_y[6] < (signed int)pBLVRenderParams->uViewportY, | |
7547 LOBYTE(v50) = stru_50B700._screen_space_y[6] >= (signed int)pBLVRenderParams->uViewportY, | |
7548 v51 = 1, | |
7549 v90 = 1, | |
7550 v43 < 1) ) | |
7551 return 0; | |
7552 do | |
7553 { | |
7554 v52 = v51; | |
7555 v53 = stru_50B700._screen_space_y[v52 + 6]; | |
7556 v84 = v53 >= (signed int)v49; | |
7557 if ( v50 ^ v84 ) | |
7558 { | |
7559 if ( v53 >= (signed int)v49 ) | |
7560 { | |
7561 v69 = (signed int)(v49 - stru_50B700._screen_space_y[v52 + 5]) | |
7562 * (signed __int64)(stru_50B700._screen_space_x[v52 + 6] - stru_50B700._screen_space_x[v52 + 5]) | |
7563 / (v53 - stru_50B700._screen_space_y[v52 + 5]); | |
7564 v54 = stru_50B700._screen_space_x[v52 + 5]; | |
7565 } | |
7566 else | |
7567 { | |
7568 v69 = (signed int)(v49 - v53) | |
7569 * (signed __int64)(stru_50B700._screen_space_x[v52 + 5] - stru_50B700._screen_space_x[v52 + 6]) | |
7570 / (stru_50B700._screen_space_y[v52 + 5] - v53); | |
7571 v54 = stru_50B700._screen_space_x[v52 + 6]; | |
7572 } | |
7573 ++v48; | |
7574 stru_50B700._screen_space_x[v48 + 2] = v69 + v54; | |
7575 v49 = pBLVRenderParams->uViewportY; | |
7576 stru_50B700._screen_space_y[v48 + 2] = pBLVRenderParams->uViewportY; | |
7577 } | |
7578 v50 = v84; | |
7579 if ( v84 ) | |
7580 { | |
7581 stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[v52 + 6]; | |
7582 stru_50B700._screen_space_y[v48++ + 3] = stru_50B700._screen_space_y[v52 + 6]; | |
7583 } | |
7584 v51 = v90++ + 1; | |
7585 } | |
7586 while ( v90 <= v43 ); | |
7587 if ( !v48 | |
7588 || (v55 = 0, | |
7589 stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[3], | |
7590 stru_50B700._screen_space_y[v48 + 3] = stru_50B700._screen_space_y[3], | |
7591 v56 = pBLVRenderParams->uViewportW, | |
7592 thise = stru_50B700._screen_space_y[3] <= (signed int)pBLVRenderParams->uViewportW, | |
7593 v91 = 1, | |
7594 v48 < 1) ) | |
7595 return 0; | |
7596 do | |
7597 { | |
7598 v57 = v91; | |
7599 v58 = stru_50B700._screen_space_y[v91 + 3]; | |
7600 v85 = v58 <= (signed int)v56; | |
7601 if ( thise ^ v85 ) | |
7602 { | |
7603 if ( v58 <= (signed int)v56 ) | |
7604 { | |
7605 v70 = (signed int)(v56 - stru_50B700._screen_space_y[v57 + 2]) | |
7606 * (signed __int64)(stru_50B700._screen_space_x[v57 + 3] - stru_50B700._screen_space_x[v57 + 2]) | |
7607 / (v58 - stru_50B700._screen_space_y[v57 + 2]); | |
7608 v59 = stru_50B700._screen_space_x[v57 + 2]; | |
7609 } | |
7610 else | |
7611 { | |
7612 v70 = (signed int)(v56 - v58) | |
7613 * (signed __int64)(stru_50B700._screen_space_x[v57 + 2] - stru_50B700._screen_space_x[v57 + 3]) | |
7614 / (stru_50B700._screen_space_y[v57 + 2] - v58); | |
7615 v59 = stru_50B700._screen_space_x[v57 + 3]; | |
7616 } | |
7617 ++v55; | |
7618 //stru_50B700._screen_space_y[v55 + 59] = v70 + v59; | |
7619 stru_50B700._screen_space_x[v55 - 1] = v70 + v59; | |
7620 v56 = pBLVRenderParams->uViewportW; | |
7621 //stru_50B700._view_transformed_xs[v55 + 47] = pBLVRenderParams->uViewportW; | |
7622 stru_50B700._screen_space_y[v55 - 1] = pBLVRenderParams->uViewportW; | |
7623 } | |
7624 if ( v85 ) | |
7625 { | |
7626 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[v57 + 3]; | |
7627 stru_50B700._screen_space_y[v55++] = stru_50B700._screen_space_y[v57 + 3]; | |
7628 } | |
7629 ++v91; | |
7630 thise = v85; | |
7631 } | |
7632 while ( v91 <= v48 ); | |
7633 if ( !v55 ) | |
7634 return 0; | |
7635 v61 = pRenderer->pRenderD3D == 0; | |
7636 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; | |
7637 stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; | |
7638 if ( v61 && v55 > 3 ) | |
7639 { | |
7640 stru_50B700._screen_space_x[v55 + 1] = stru_50B700._screen_space_x[1]; | |
7641 stru_50B700._screen_space_y[v55 + 1] = stru_50B700._screen_space_y[1]; | |
7642 thisf = 2 * (stru_50B700.field_0 != 0) - 1; | |
7643 if ( v55 > 0 ) | |
7644 { | |
7645 v62 = 1; | |
7646 v71 = 1; | |
7647 do | |
7648 { | |
7649 v63 = v62 - 1; | |
7650 v64 = v62 + 1; | |
7651 v80 = v62 + 1; | |
7652 if ( v62 - 1 >= v55 ) | |
7653 v63 -= v55; | |
7654 if ( v62 >= v55 ) | |
7655 v62 -= v55; | |
7656 if ( v64 >= v55 ) | |
7657 v64 -= v55; | |
7658 if ( thisf | |
7659 * ((stru_50B700._screen_space_y[v64] - stru_50B700._screen_space_y[v63]) | |
7660 * (stru_50B700._screen_space_x[v62] - stru_50B700._screen_space_x[v63]) | |
7661 - (stru_50B700._screen_space_y[v62] - stru_50B700._screen_space_y[v63]) | |
7662 * (stru_50B700._screen_space_x[v64] - stru_50B700._screen_space_x[v63])) < 0 ) | |
7663 { | |
7664 v62 = v80; | |
7665 v71 = v80; | |
7666 } | |
7667 else | |
7668 { | |
7669 v62 = v71; | |
7670 v65 = v71; | |
7671 if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) | |
7672 { | |
7673 memcpy( | |
7674 &stru_50B700._screen_space_y[v65], | |
7675 &stru_50B700._screen_space_y[v65 + 1], | |
7676 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); | |
7677 memcpy( | |
7678 &stru_50B700._screen_space_x[v65], | |
7679 &stru_50B700._screen_space_x[v65 + 1], | |
7680 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); | |
7681 } | |
7682 --v55; | |
7683 } | |
7684 } | |
7685 while ( v62 - 1 < v55 ); | |
7686 } | |
7687 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; | |
7688 stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; | |
7689 } | |
7690 return v55; | |
7691 } |