Mercurial > mm7
changeset 2382:8c00bd4573a8
sub_407A1C - fixing wrongly identified structure variable
author | zipi |
---|---|
date | Sun, 22 Jun 2014 13:58:46 +0100 |
parents | cb84b457527c |
children | 342b73a61a60 |
files | Indoor.cpp |
diffstat | 1 files changed, 156 insertions(+), 153 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Sun Jun 22 12:56:25 2014 +0100 +++ b/Indoor.cpp Sun Jun 22 13:58:46 2014 +0100 @@ -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,7 +4142,7 @@ bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) { unsigned int v4; // esi@1 - Vec3_int_ v5; // ST08_12@2 + //Vec3_int_ v5; // ST08_12@2 int v6; // edi@2 int v7; // ebx@2 int v8; // esi@2 @@ -4299,11 +4299,14 @@ //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 + //Vec3_int_ pOut; // [sp+74h] [bp-8h]@2 + int sX; + int sY; + //8bytes unused int ya; // [sp+84h] [bp+8h]@60 int yb; // [sp+84h] [bp+8h]@136 int ve; // [sp+88h] [bp+Ch]@60 @@ -4329,14 +4332,14 @@ 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; + Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &outz); + v46 = outy - sY; + v47 = outz - sZ; + v48 = outx - sX; v49 = integer_sqrt(v48 * v48 + v46 * v46 + v47 * v47); v50 = 65536; if ( v49 ) @@ -4345,36 +4348,36 @@ v143 = v48 * v50; v52 = v46 * v50; v53 = v47 * v50; - v54 = pOut.x; + v54 = sX; v147 = v52; v151 = v53; - v119 = pOut.x; - if ( pOut.x < outx ) + v119 = sX; + if ( sX < outx ) v123 = outx; else { v119 = outx; - v123 = pOut.x; + v123 = sX; } - v55 = pOut.y; + v55 = sY; v56 = outy; - v127 = pOut.y; - if ( pOut.y < outy ) + v127 = sY; + if ( sY < outy ) v131 = outy; else { v127 = outy; - v131 = pOut.y; + v131 = sY; } - v57 = v163; - v58 = outz; - v135 = outz; - if ( outz < v163 ) - v139 = v163; + v57 = outz; + v58 = sZ; + v135 = sZ; + if ( sZ < outz ) + v139 = outz; else { - v135 = v163; - v139 = outz; + v135 = outz; + v139 = sZ; } //while ( !v114 ) @@ -4382,13 +4385,13 @@ { 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; } @@ -4413,26 +4416,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 +4445,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, v147) + 0x8000) >> 16), + sZ + ((signed int)(fixpoint_mul(v108, v151) + 0x8000) >> 16), face) ) { v114 = 1; @@ -4457,14 +4460,14 @@ 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); + Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &sX, &sY, &sZ); 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; + Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &outz); + v74 = outy - sY; + v75 = outz - sZ; + v76 = outx - sX; v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75); v78 = 65536; if ( v77 ) @@ -4473,36 +4476,36 @@ v144 = v76 * v78; v80 = v74 * v78; v81 = v75 * v78; - v82 = pOut.x; + v82 = sX; v148 = v80; v152 = v81; - v120 = pOut.x; - if ( pOut.x < outx ) + v120 = sX; + if ( sX < outx ) v124 = outx; else { v120 = outx; - v124 = pOut.x; + v124 = sX; } - v83 = pOut.y; + v83 = sY; v84 = outy; - v128 = pOut.y; - if ( pOut.y < outy ) + v128 = sY; + if ( sY < outy ) v132 = outy; else { v128 = outy; - v132 = pOut.y; + v132 = sY; } - v85 = v163; - v86 = outz; - v136 = outz; - if ( outz < v163 ) - v140 = v163; + v85 = outz; + v86 = sZ; + v136 = sZ; + if ( sZ < outz ) + v140 = outz; else { - v136 = v163; - v140 = outz; + v136 = outz; + v140 = sZ; } //while ( 1 ) for ( a5c = 0; a5c < 2; a5c++ ) @@ -4511,13 +4514,13 @@ 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; } @@ -4545,27 +4548,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 +4578,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, v148) + 0x8000) >> 16), + sZ + ((signed int)(fixpoint_mul(vd, v152) + 0x8000) >> 16), face) ) { v113 = 1; @@ -4590,14 +4593,14 @@ } 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; + Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &sX, &sY, &sZ); + //v5.z = v.z; + //v5.x = v.x; + //v5.y = v.y; + Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v, &outx, &outy, &outz); + v6 = outy - sY; + v7 = outz - sZ; + v8 = outx - sX; v9 = integer_sqrt(v8 * v8 + v6 * v6 + v7 * v7); v10 = 65536; if ( v9 ) @@ -4605,37 +4608,37 @@ v125 = v8 * v10; v11 = v10; v12 = v7 * v10; - v13 = pOut.x; + v13 = sX; v117 = v12; v121 = v6 * v11; - v149 = pOut.x; - if ( pOut.x < outx ) + v149 = sX; + if ( sX < outx ) v145 = outx; else { v149 = outx; - v145 = pOut.x; + v145 = sX; } v14 = outy; - v141 = pOut.y; - if ( pOut.y < outy ) + v141 = sY; + if ( sY < outy ) v137 = outy; else { v141 = outy; - v137 = pOut.y; + v137 = sY; } - v133 = outz; - if ( outz < v163 ) - v129 = v163; + v133 = sZ; + if ( sZ < outz ) + v129 = outz; else { - v133 = v163; - v129 = outz; + v133 = outz; + v129 = sZ; } 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 ) @@ -4652,26 +4655,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 +4684,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, v117) + 0x8000) >> 16), odm_face, &pOutdoor->pBModels[model_id].pVertices) ) { @@ -4698,14 +4701,14 @@ 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; + Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &outz); + v29 = outy - sY; + v30 = outz - sZ; + v31 = outx - sX; v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30); v33 = 65536; if ( v32 ) @@ -4713,38 +4716,38 @@ v126 = v31 * v33; v34 = v33; v35 = v30 * v33; - v36 = pOut.x; + v36 = sX; v118 = v35; v122 = v29 * v34; - v150 = pOut.x; - if ( pOut.x < outx ) + v150 = sX; + if ( sX < outx ) v146 = outx; else { v150 = outx; - v146 = pOut.x; + v146 = sX; } v37 = outy; - v142 = pOut.y; - if ( pOut.y < outy ) + v142 = sY; + if ( sY < outy ) v138 = outy; else { v142 = outy; - v138 = pOut.y; + v138 = sY; } - v134 = outz; - if ( outz < v163 ) - v130 = v163; + v134 = sZ; + if ( sZ < outz ) + v130 = outz; else { - v134 = v163; - v130 = outz; + v134 = outz; + v130 = 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 ) @@ -4761,26 +4764,26 @@ || v134 > odm_face->pBoundingBox.z2 || v130 < odm_face->pBoundingBox.z1 || !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 +4792,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, v118) + 0x8000) >> 16), odm_face, &pOutdoor->pBModels[model_id].pVertices) ) {