Mercurial > mm7
changeset 2387:5f395dd759fb
Слияние
author | Ritor1 |
---|---|
date | Mon, 23 Jun 2014 23:45:57 +0600 |
parents | 41c36ecc9f32 (current diff) b842e1b77c8c (diff) |
children | 41025c0eb414 5d866ee28376 c4d286e4bb80 |
files | |
diffstat | 1 files changed, 168 insertions(+), 317 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Mon Jun 23 23:45:14 2014 +0600 +++ b/Indoor.cpp Mon Jun 23 23:45:57 2014 +0600 @@ -960,7 +960,7 @@ // BLVFaceExtra *v160; // ecx@149 //BLVFaceExtra *v161; // ecx@149 //signed int v162; // ebx@154 - //unsigned int v163; // ebx@157 + //unsigned int outz; // ebx@157 //unsigned int v164; // ebx@157 //unsigned int v165; // edx@158 //char *v166; // ecx@158 @@ -4142,97 +4142,50 @@ bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) { unsigned int v4; // esi@1 - Vec3_int_ v5; // ST08_12@2 - int v6; // edi@2 - int v7; // ebx@2 - int v8; // esi@2 + int dist_y; // edi@2 + int dist_z; // ebx@2 + int dist_x; // esi@2 signed int v9; // ecx@2 int v10; // eax@2 - int v11; // ecx@4 int v12; // eax@4 - int v13; // ebx@4 - int v14; // edx@6 -// char *v15; // edi@16 -// ODMFace *v16; // esi@19 int v17; // ST34_4@25 int v18; // ST38_4@25 int v19; // eax@25 char v20; // zf@25 int v21; // ebx@25 -// int v22; // eax@26 signed int v23; // edi@26 int v24; // ST34_4@30 - //signed __int64 v25; // qtt@31 - //int v26; // eax@31 Vec3_int_ v27; // ST08_12@37 Vec3_int_ v28; // ST08_12@37 - int v29; // edi@37 - int v30; // ebx@37 - int v31; // esi@37 signed int v32; // ecx@37 int v33; // eax@37 - int v34; // ecx@39 int v35; // eax@39 - int v36; // ebx@39 - int v37; // edx@41 - //char *v38; // edi@51 ODMFace *odm_face; // esi@54 int v40; // ebx@60 -// int v41; // eax@61 signed int v42; // edi@61 - //signed __int64 v43; // qtt@66 - //int v44; // eax@66 Vec3_int_ v45; // ST08_12@73 - int v46; // edi@73 - int v47; // ebx@73 - int v48; // esi@73 signed int v49; // ecx@73 int v50; // eax@73 int v51; // edx@75 int v52; // ecx@75 int v53; // eax@75 - int v54; // ebx@75 - int v55; // edi@77 - int v56; // ecx@77 - int v57; // eax@81 - int v58; // esi@81 int v59; // eax@90 - //BLVSector *v60; // edx@90 -// int v61; // ecx@90 BLVFace *face; // esi@91 int v63; // ST34_4@98 int v64; // ST30_4@98 int v65; // eax@98 int v66; // ebx@98 -// int v67; // eax@99 signed int v68; // edi@99 int v69; // ST2C_4@103 - //signed __int64 v70; // qtt@104 - //int v71; // eax@104 Vec3_int_ v72; // ST08_12@111 - Vec3_int_ v73; // ST08_12@111 - int v74; // edi@111 - int v75; // ebx@111 - int v76; // esi@111 signed int v77; // ecx@111 int v78; // eax@111 int v79; // edx@113 int v80; // ecx@113 int v81; // eax@113 - int v82; // ebx@113 - int v83; // edi@115 - int v84; // ecx@115 - int v85; // eax@119 - int v86; // esi@119 int v87; // ecx@128 -// BLVSector *v88; // eax@128 -// int v89; // ecx@128 - //BLVFace *v90; // esi@129 int v91; // ebx@136 -// int v92; // eax@137 signed int v93; // edi@137 - //signed __int64 v94; // qtt@142 - //int v95; // eax@142 Vec3_int_ v97; // [sp-18h] [bp-94h]@1 int v98; // [sp-Ch] [bp-88h]@88 int v99; // [sp-Ch] [bp-88h]@126 @@ -4240,21 +4193,13 @@ int v101; // [sp-8h] [bp-84h]@126 int v102; // [sp-4h] [bp-80h]@88 int v103; // [sp-4h] [bp-80h]@126 - //int v104; // [sp+Ch] [bp-70h]@13 - //int v105; // [sp+Ch] [bp-70h]@48 -// int v106; // [sp+10h] [bp-6Ch]@18 int v107; // [sp+10h] [bp-6Ch]@98 int v108; // [sp+10h] [bp-6Ch]@104 int v109; // [sp+18h] [bp-64h]@25 int v110; // [sp+18h] [bp-64h]@31 -// int i; // [sp+18h] [bp-64h]@90 -// int v112; // [sp+18h] [bp-64h]@128 signed int v113; // [sp+20h] [bp-5Ch]@1 signed int v114; // [sp+24h] [bp-58h]@1 - //unsigned __int64 a4; // [sp+28h] [bp-54h]@1 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1 - int v117; // [sp+34h] [bp-48h]@4 - int v118; // [sp+34h] [bp-48h]@39 int v119; // [sp+34h] [bp-48h]@75 int v120; // [sp+34h] [bp-48h]@113 int v121; // [sp+38h] [bp-44h]@4 @@ -4283,27 +4228,19 @@ int v144; // [sp+4Ch] [bp-30h]@113 int v145; // [sp+50h] [bp-2Ch]@5 int v146; // [sp+50h] [bp-2Ch]@40 - int v147; // [sp+50h] [bp-2Ch]@75 - int v148; // [sp+50h] [bp-2Ch]@113 int v149; // [sp+54h] [bp-28h]@4 int v150; // [sp+54h] [bp-28h]@39 - int v151; // [sp+54h] [bp-28h]@75 - int v152; // [sp+54h] [bp-28h]@113 -// int sDepth; // [sp+58h] [bp-24h]@17 -// int sDeptha; // [sp+58h] [bp-24h]@52 int sDepthb; // [sp+58h] [bp-24h]@90 -// char *a5; // [sp+5Ch] [bp-20h]@16 - //char *a5a; // [sp+5Ch] [bp-20h]@51 signed int a5b; // [sp+5Ch] [bp-20h]@83 signed int a5c; // [sp+5Ch] [bp-20h]@121 - //signed int v160; // [sp+60h] [bp-1Ch]@12 - //signed int v161; // [sp+60h] [bp-1Ch]@47 int v162; // [sp+60h] [bp-1Ch]@128 - int v163; // [sp+64h] [bp-18h]@2 + int outz; // [sp+64h] [bp-18h]@2 int outx; // [sp+68h] [bp-14h]@2 int outy; // [sp+6Ch] [bp-10h]@2 - int outz; // [sp+70h] [bp-Ch]@2 - Vec3_int_ pOut; // [sp+74h] [bp-8h]@2 + int sZ; // [sp+70h] [bp-Ch]@2 + int sX; // [sp+74h] [bp-8h]@2 + int sY; // [sp+78h] [bp-4h]@2 + //8bytes unused int ya; // [sp+84h] [bp+8h]@60 int yb; // [sp+84h] [bp+8h]@136 int ve; // [sp+88h] [bp+Ch]@60 @@ -4329,66 +4266,43 @@ a4_8 = stru_5C6E00->Atan2(v.x - x, v.y - z); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) { - Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); + Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &sX, &sY, &sZ); v45.z = v.z; v45.x = v.x; v45.y = v.y; - Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &v163); - v46 = outy - pOut.y; - v47 = v163 - outz; - v48 = outx - pOut.x; - v49 = integer_sqrt(v48 * v48 + v46 * v46 + v47 * v47); + Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &outz); + dist_y = outy - sY; + dist_z = outz - sZ; + dist_x = outx - sX; + v49 = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z); v50 = 65536; if ( v49 ) v50 = 65536 / v49; v51 = outx; - v143 = v48 * v50; - v52 = v46 * v50; - v53 = v47 * v50; - v54 = pOut.x; - v147 = v52; - v151 = v53; - v119 = pOut.x; - if ( pOut.x < outx ) - v123 = outx; - else - { - v119 = outx; - v123 = pOut.x; - } - v55 = pOut.y; - v56 = outy; - v127 = pOut.y; - if ( pOut.y < outy ) - v131 = outy; - else - { - v127 = outy; - v131 = pOut.y; - } - v57 = v163; - v58 = outz; - v135 = outz; - if ( outz < v163 ) - v139 = v163; - else - { - v135 = v163; - v139 = outz; - } - - //while ( !v114 ) + v143 = dist_x * v50; + v52 = dist_y * v50; + v53 = dist_z * v50; + + v123 = max(outx, sX); + v119 = min(outx, sX); + + v131 = max(outy, sY); + v127 = min(outy, sY); + + v139 = max(outz, sZ); + v135 = min(outz, sZ); + for ( a5b = 0; a5b < 2; a5b++ ) { if ( a5b ) { - v102 = outz; - v100 = pOut.y; - v98 = pOut.x; + v102 = sZ; + v100 = sY; + v98 = sX; } else { - v102 = v163; + v102 = outz; v100 = outy; v98 = outx; } @@ -4402,8 +4316,8 @@ { face = &pIndoor->pFaces[pIndoor->pSectors[v59].pFaceIDs[sDepthb]];// face = &pIndoor->pFaces[*(__int16 *)((char *)&pIndoor->pSectors->pWalls + v61)[sDepthb]] v63 = fixpoint_mul(v143, face->pFacePlane_old.vNormal.x); - v64 = fixpoint_mul(v151, face->pFacePlane_old.vNormal.z); - v65 = fixpoint_mul(v147, face->pFacePlane_old.vNormal.y); + v64 = fixpoint_mul(v53, face->pFacePlane_old.vNormal.z); + v65 = fixpoint_mul(v52, face->pFacePlane_old.vNormal.y); v20 = v63 + v64 + v65; v66 = v63 + v64 + v65; v107 = v63 + v64 + v65; @@ -4413,26 +4327,26 @@ || v135 > face->pBounding.z2 || v139 < face->pBounding.z1 || !v20 ) continue; - v68 = -(face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x - + pOut.y * face->pFacePlane_old.vNormal.y - + outz * face->pFacePlane_old.vNormal.z); + v68 = -(face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x + + sY * face->pFacePlane_old.vNormal.y + + sZ * face->pFacePlane_old.vNormal.z); if ( v66 <= 0 ) { - if ( face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x - + pOut.y * face->pFacePlane_old.vNormal.y - + outz * face->pFacePlane_old.vNormal.z < 0 ) + if ( face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x + + sY * face->pFacePlane_old.vNormal.y + + sZ * face->pFacePlane_old.vNormal.z < 0 ) continue; } else { - if ( face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x - + pOut.y * face->pFacePlane_old.vNormal.y - + outz * face->pFacePlane_old.vNormal.z > 0 ) + if ( face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x + + sY * face->pFacePlane_old.vNormal.y + + sZ * face->pFacePlane_old.vNormal.z > 0 ) continue; } - v69 = abs(-(face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x - + pOut.y * face->pFacePlane_old.vNormal.y - + outz * face->pFacePlane_old.vNormal.z )) >> 14; + v69 = abs(-(face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x + + sY * face->pFacePlane_old.vNormal.y + + sZ * face->pFacePlane_old.vNormal.z )) >> 14; if ( v69 <= abs(v66) ) { //LODWORD(v70) = v68 << 16; @@ -4442,9 +4356,9 @@ v108 = fixpoint_div(v68, v107); if ( v108 >= 0 ) { - if ( sub_4075DB(pOut.x + ((signed int)(fixpoint_mul(v108, v143) + 0x8000) >> 16), - pOut.y + ((signed int)(fixpoint_mul(v108, v147) + 0x8000) >> 16), - outz + ((signed int)(fixpoint_mul(v108, v151) + 0x8000) >> 16), + if ( sub_4075DB(sX + ((signed int)(fixpoint_mul(v108, v143) + 0x8000) >> 16), + sY + ((signed int)(fixpoint_mul(v108, v52) + 0x8000) >> 16), + sZ + ((signed int)(fixpoint_mul(v108, v53) + 0x8000) >> 16), face) ) { v114 = 1; @@ -4454,70 +4368,46 @@ } } } - v72.z = y; + + v72.z = y; v72.x = x; v72.y = z; - Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz); - v73.z = v.z; - v73.x = v.x; - v73.y = v.y; - Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163); - v74 = outy - pOut.y; - v75 = v163 - outz; - v76 = outx - pOut.x; - v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75); + Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &sX, &sY, &sZ); + Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v, &outx, &outy, &outz); + dist_y = outy - sY; + dist_z = outz - sZ; + dist_x = outx - sX; + v77 = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z); v78 = 65536; if ( v77 ) v78 = 65536 / v77; v79 = outx; - v144 = v76 * v78; - v80 = v74 * v78; - v81 = v75 * v78; - v82 = pOut.x; - v148 = v80; - v152 = v81; - v120 = pOut.x; - if ( pOut.x < outx ) - v124 = outx; - else - { - v120 = outx; - v124 = pOut.x; - } - v83 = pOut.y; - v84 = outy; - v128 = pOut.y; - if ( pOut.y < outy ) - v132 = outy; - else - { - v128 = outy; - v132 = pOut.y; - } - v85 = v163; - v86 = outz; - v136 = outz; - if ( outz < v163 ) - v140 = v163; - else - { - v136 = v163; - v140 = outz; - } - //while ( 1 ) + v144 = dist_x * v78; + v80 = dist_y * v78; + v81 = dist_z * v78; + + v120 = max(outx, sX); + v124 = min(outx, sX); + + v132 = max(outy, sY); + v128 = min(outy, sY); + + v140 = max(outz, sZ); + v136 = min(outz, sZ); + for ( a5c = 0; a5c < 2; a5c++ ) { if ( v113 ) return !v114 || !v113; if ( a5c ) { - v103 = outz; - v101 = pOut.y; - v99 = pOut.x; + v103 = sZ; + v101 = sY; + v99 = sX; } else { - v103 = v163; + v103 = outz; v101 = outy; v99 = outx; } @@ -4534,8 +4424,8 @@ { face = &pIndoor->pFaces[pIndoor->pSectors[v87].pFaceIDs[v162]]; yb = fixpoint_mul(v144, face->pFacePlane_old.vNormal.x); - v_4b = fixpoint_mul(v148, face->pFacePlane_old.vNormal.y); - vf = fixpoint_mul(v152, face->pFacePlane_old.vNormal.z); + v_4b = fixpoint_mul(v80, face->pFacePlane_old.vNormal.y); + vf = fixpoint_mul(v81, face->pFacePlane_old.vNormal.z); v20 = yb + vf + v_4b; v91 = yb + vf + v_4b; vc = yb + vf + v_4b; @@ -4545,27 +4435,27 @@ || v136 > face->pBounding.z2 || v140 < face->pBounding.z1 || !v20 ) continue; - //v92 = outz * face->pFacePlane_old.vNormal.z; - v93 = -(face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x - + pOut.y * face->pFacePlane_old.vNormal.y - + outz * face->pFacePlane_old.vNormal.z); + //v92 = sZ * face->pFacePlane_old.vNormal.z; + v93 = -(face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x + + sY * face->pFacePlane_old.vNormal.y + + sZ * face->pFacePlane_old.vNormal.z); if ( v91 <= 0 ) { - if ( face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x - + pOut.y * face->pFacePlane_old.vNormal.y - + outz * face->pFacePlane_old.vNormal.z < 0 ) + if ( face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x + + sY * face->pFacePlane_old.vNormal.y + + sZ * face->pFacePlane_old.vNormal.z < 0 ) continue; } else { - if ( face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x - + pOut.y * face->pFacePlane_old.vNormal.y - + outz * face->pFacePlane_old.vNormal.z > 0 ) + if ( face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x + + sY * face->pFacePlane_old.vNormal.y + + sZ * face->pFacePlane_old.vNormal.z > 0 ) continue; } - v_4c = abs(-(face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x - + pOut.y * face->pFacePlane_old.vNormal.y - + outz * face->pFacePlane_old.vNormal.z)) >> 14; + v_4c = abs(-(face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x + + sY * face->pFacePlane_old.vNormal.y + + sZ * face->pFacePlane_old.vNormal.z)) >> 14; if ( v_4c <= abs(v91) ) { //LODWORD(v94) = v93 << 16; @@ -4575,9 +4465,9 @@ vd = fixpoint_div(v93, vc); if ( vd >= 0 ) { - if ( sub_4075DB(pOut.x + ((signed int)(fixpoint_mul(vd, v144) + 0x8000) >> 16), - pOut.y + ((signed int)(fixpoint_mul(vd, v148) + 0x8000) >> 16), - outz + ((signed int)(fixpoint_mul(vd, v152) + 0x8000) >> 16), + if ( sub_4075DB(sX + ((signed int)(fixpoint_mul(vd, v144) + 0x8000) >> 16), + sY + ((signed int)(fixpoint_mul(vd, v80) + 0x8000) >> 16), + sZ + ((signed int)(fixpoint_mul(vd, v81) + 0x8000) >> 16), face) ) { v113 = 1; @@ -4590,52 +4480,31 @@ } else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) { - Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); - v5.z = v.z; - v5.x = v.x; - v5.y = v.y; - Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v5, &outx, &outy, &v163); - v6 = outy - pOut.y; - v7 = v163 - outz; - v8 = outx - pOut.x; - v9 = integer_sqrt(v8 * v8 + v6 * v6 + v7 * v7); + Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &sX, &sY, &sZ); + Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v, &outx, &outy, &outz); + dist_y = outy - sY; + dist_z = outz - sZ; + dist_x = outx - sX; + v9 = integer_sqrt(dist_x* dist_x+ dist_y* dist_y+ dist_z* dist_z); v10 = 65536; if ( v9 ) v10 = 65536 / v9; - v125 = v8 * v10; - v11 = v10; - v12 = v7 * v10; - v13 = pOut.x; - v117 = v12; - v121 = v6 * v11; - v149 = pOut.x; - if ( pOut.x < outx ) - v145 = outx; - else + v125 = dist_x* v10; + v12 = dist_z* v10; + v121 = dist_y* v10; + + v145 = max(outx, sX); + v149 = min(outx, sX); + + v137 = max(outy, sY); + v141 = min(outy, sY); + + v129 = max(outz, sZ); + v133 = min(outz, sZ); + + for ( uint model_id = 0; model_id < pOutdoor->uNumBModels; model_id++) { - v149 = outx; - v145 = pOut.x; - } - v14 = outy; - v141 = pOut.y; - if ( pOut.y < outy ) - v137 = outy; - else - { - v141 = outy; - v137 = pOut.y; - } - v133 = outz; - if ( outz < v163 ) - v129 = v163; - else - { - v133 = v163; - v129 = outz; - } - for ( uint model_id = 0; model_id < pOutdoor->uNumBModels; model_id++) - { - if ( sub_4088E9(pOut.x, pOut.y, outx, outy, pOutdoor->pBModels[model_id].vPosition.x, pOutdoor->pBModels[model_id].vPosition.y) + if ( sub_4088E9(sX, sY, outx, outy, pOutdoor->pBModels[model_id].vPosition.x, pOutdoor->pBModels[model_id].vPosition.y) <= pOutdoor->pBModels[model_id].sBoundingRadius + 128 ) { for ( uint face_id = 0; face_id < pOutdoor->pBModels[model_id].uNumFaces; ++face_id ) @@ -4643,7 +4512,7 @@ odm_face = &pOutdoor->pBModels[model_id].pFaces[face_id]; v17 = fixpoint_mul(v125, odm_face->pFacePlane.vNormal.x); v18 = fixpoint_mul(v121, odm_face->pFacePlane.vNormal.y); - v19 = fixpoint_mul(v117, odm_face->pFacePlane.vNormal.z); + v19 = fixpoint_mul(v12, odm_face->pFacePlane.vNormal.z); v20 = v17 + v18 + v19; v21 = v17 + v18 + v19; v109 = v17 + v18 + v19; @@ -4652,26 +4521,26 @@ || v133 > odm_face->pBoundingBox.z2 || v129 < odm_face->pBoundingBox.z1 || !v20 ) continue; - v23 = -(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x - + pOut.y * odm_face->pFacePlane.vNormal.y - + outz * odm_face->pFacePlane.vNormal.z); + v23 = -(odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x + + sY * odm_face->pFacePlane.vNormal.y + + sZ * odm_face->pFacePlane.vNormal.z); if ( v21 <= 0 ) { - if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x - + pOut.y * odm_face->pFacePlane.vNormal.y - + outz * odm_face->pFacePlane.vNormal.z < 0 ) + if ( odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x + + sY * odm_face->pFacePlane.vNormal.y + + sZ * odm_face->pFacePlane.vNormal.z < 0 ) continue; } else { - if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x - + pOut.y * odm_face->pFacePlane.vNormal.y - + outz * odm_face->pFacePlane.vNormal.z > 0 ) + if ( odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x + + sY * odm_face->pFacePlane.vNormal.y + + sZ * odm_face->pFacePlane.vNormal.z > 0 ) continue; } - v24 = abs(-(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x - + pOut.y * odm_face->pFacePlane.vNormal.y - + outz * odm_face->pFacePlane.vNormal.z)) >> 14; + v24 = abs(-(odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x + + sY * odm_face->pFacePlane.vNormal.y + + sZ * odm_face->pFacePlane.vNormal.z)) >> 14; if ( v24 <= abs(v21) ) { //LODWORD(v25) = v23 << 16; @@ -4681,9 +4550,9 @@ v110 = fixpoint_div(v23, v109); if ( v110 >= 0 ) { - if ( sub_4077F1(pOut.x + ((signed int)(fixpoint_mul(v110, v125) + 0x8000) >> 16), - pOut.y + ((signed int)(fixpoint_mul(v110, v121) + 0x8000) >> 16), - outz + ((signed int)(fixpoint_mul(v110, v117) + 0x8000) >> 16), + if ( sub_4077F1(sX + ((signed int)(fixpoint_mul(v110, v125) + 0x8000) >> 16), + sY + ((signed int)(fixpoint_mul(v110, v121) + 0x8000) >> 16), + sZ + ((signed int)(fixpoint_mul(v110, v12) + 0x8000) >> 16), odm_face, &pOutdoor->pBModels[model_id].pVertices) ) { @@ -4695,56 +4564,38 @@ } } } - v27.z = y; + + v27.z = y; v27.x = x; v27.y = z; - Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz); + Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &sX, &sY, &sZ); v28.z = v.z; v28.x = v.x; v28.y = v.y; - Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163); - v29 = outy - pOut.y; - v30 = v163 - outz; - v31 = outx - pOut.x; - v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30); + Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &outz); + dist_y = outy - sY; + dist_z = outz - sZ; + dist_x = outx - sX; + v32 = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z); v33 = 65536; if ( v32 ) v33 = 65536 / v32; - v126 = v31 * v33; - v34 = v33; - v35 = v30 * v33; - v36 = pOut.x; - v118 = v35; - v122 = v29 * v34; - v150 = pOut.x; - if ( pOut.x < outx ) - v146 = outx; - else - { - v150 = outx; - v146 = pOut.x; - } - v37 = outy; - v142 = pOut.y; - if ( pOut.y < outy ) - v138 = outy; - else - { - v142 = outy; - v138 = pOut.y; - } - v134 = outz; - if ( outz < v163 ) - v130 = v163; - else - { - v134 = v163; - v130 = outz; - } + v126 = dist_x * v33; + v35 = dist_z * v33; + v122 = dist_y * v33; + + v146 = max(outx, sX); + v150 = min(outx, sX); + + v138 = max(outy, sY); + v142 = min(outy, sY); + + v130 = max(outz, sZ); + v134 = min(outz, sZ); for ( uint model_id = 0; model_id < (signed int)pOutdoor->uNumBModels; ++model_id ) { - if ( sub_4088E9(pOut.x, pOut.y, outx, outy, pOutdoor->pBModels[model_id].vPosition.x, pOutdoor->pBModels[model_id].vPosition.y) + if ( sub_4088E9(sX, sY, outx, outy, pOutdoor->pBModels[model_id].vPosition.x, pOutdoor->pBModels[model_id].vPosition.y) <= pOutdoor->pBModels[model_id].sBoundingRadius + 128 ) { for ( uint face_id = 0; face_id < pOutdoor->pBModels[model_id].uNumFaces; ++face_id ) @@ -4752,35 +4603,35 @@ odm_face = &pOutdoor->pBModels[model_id].pFaces[face_id]; ya = fixpoint_mul(v126, odm_face->pFacePlane.vNormal.x); ve = fixpoint_mul(v122, odm_face->pFacePlane.vNormal.y); - v_4 = fixpoint_mul(v118, odm_face->pFacePlane.vNormal.z); - v20 = ya + ve + v_4; + v_4 = fixpoint_mul(v35, odm_face->pFacePlane.vNormal.z); + v20 = ya + ve + v_4 == 0; v40 = ya + ve + v_4; va = ya + ve + v_4; if ( v150 > odm_face->pBoundingBox.x2 || v146 < odm_face->pBoundingBox.x1 || v142 > odm_face->pBoundingBox.y2 || v138 < odm_face->pBoundingBox.y1 || v134 > odm_face->pBoundingBox.z2 || v130 < odm_face->pBoundingBox.z1 - || !v20 ) + || v20 ) continue; - v42 = -(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x - + pOut.y * odm_face->pFacePlane.vNormal.y - + outz * odm_face->pFacePlane.vNormal.z); + v42 = -(odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x + + sY * odm_face->pFacePlane.vNormal.y + + sZ * odm_face->pFacePlane.vNormal.z); if ( v40 <= 0 ) { - if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x - + pOut.y * odm_face->pFacePlane.vNormal.y - + outz * odm_face->pFacePlane.vNormal.z < 0 ) + if ( odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x + + sY * odm_face->pFacePlane.vNormal.y + + sZ * odm_face->pFacePlane.vNormal.z < 0 ) continue; } else { - if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x - + pOut.y * odm_face->pFacePlane.vNormal.y - + outz * odm_face->pFacePlane.vNormal.z > 0 ) + if ( odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x + + sY * odm_face->pFacePlane.vNormal.y + + sZ * odm_face->pFacePlane.vNormal.z > 0 ) continue; } - v_4a = abs(-(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x - + pOut.y * odm_face->pFacePlane.vNormal.y - + outz * odm_face->pFacePlane.vNormal.z )) >> 14; + v_4a = abs(-(odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x + + sY * odm_face->pFacePlane.vNormal.y + + sZ * odm_face->pFacePlane.vNormal.z )) >> 14; if ( v_4a <= abs(v40) ) { //LODWORD(v43) = v42 << 16; @@ -4789,9 +4640,9 @@ vb = fixpoint_div(v42, va); if ( vb >= 0 ) { - if ( sub_4077F1(pOut.x + ((signed int)(fixpoint_mul(vb, v126) + 0x8000) >> 16), - pOut.y + ((signed int)(fixpoint_mul(vb, v122) + 0x8000) >> 16), - outz + ((signed int)(fixpoint_mul(vb, v118) + 0x8000) >> 16), + if ( sub_4077F1(sX + ((signed int)(fixpoint_mul(vb, v126) + 0x8000) >> 16), + sY + ((signed int)(fixpoint_mul(vb, v122) + 0x8000) >> 16), + sZ + ((signed int)(fixpoint_mul(vb, v35) + 0x8000) >> 16), odm_face, &pOutdoor->pBModels[model_id].pVertices) ) {