Mercurial > mm7
changeset 1556:e668660457dc
Some more cleaning
author | Nomad |
---|---|
date | Sat, 07 Sep 2013 22:38:53 +0200 |
parents | 9a6567c6c76c |
children | 6292a522d322 |
files | Game.cpp Indoor.cpp Math.h mm7_1.cpp |
diffstat | 4 files changed, 65 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/Game.cpp Sat Sep 07 21:55:02 2013 +0200 +++ b/Game.cpp Sat Sep 07 22:38:53 2013 +0200 @@ -71,7 +71,7 @@ int v4; // edi@26 //int v5; // eax@35 - uFlags2 &= 0xFFFFFFFDu; + uFlags2 &= ~0x02; if ( pParty->_497FC5_check_party_perception_against_level() ) uFlags2 |= 2u; pIndoorCamera->sRotationX = pParty->sRotationX;
--- a/Indoor.cpp Sat Sep 07 21:55:02 2013 +0200 +++ b/Indoor.cpp Sat Sep 07 22:38:53 2013 +0200 @@ -5224,8 +5224,8 @@ int v22; // eax@26 signed int v23; // edi@26 int v24; // ST34_4@30 - signed __int64 v25; // qtt@31 - int v26; // eax@31 + //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 @@ -5242,8 +5242,8 @@ int v40; // ebx@60 int v41; // eax@61 signed int v42; // edi@61 - signed __int64 v43; // qtt@66 - int v44; // eax@66 + //signed __int64 v43; // qtt@66 + //int v44; // eax@66 Vec3_int_ v45; // ST08_12@73 int v46; // edi@73 int v47; // ebx@73 @@ -5269,8 +5269,8 @@ int v67; // eax@99 signed int v68; // edi@99 int v69; // ST2C_4@103 - signed __int64 v70; // qtt@104 - int v71; // eax@104 + //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 @@ -5293,8 +5293,8 @@ int v91; // ebx@136 int v92; // eax@137 signed int v93; // edi@137 - signed __int64 v94; // qtt@142 - int v95; // eax@142 + //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 @@ -5393,7 +5393,8 @@ { Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); v45.z = v.z; - *(_QWORD *)&v45.x = *(_QWORD *)&v; + 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; @@ -5510,16 +5511,17 @@ + pOut.x * v62->pFacePlane_old.vNormal.x)) >> 14; if ( v69 <= abs(v66) ) { - LODWORD(v70) = v68 << 16; - HIDWORD(v70) = v68 >> 16; - v71 = v70 / v107; - v108 = v70 / v107; - if ( v71 >= 0 ) + //LODWORD(v70) = v68 << 16; + //HIDWORD(v70) = v68 >> 16; + //v71 = v70 / v107; + //v108 = v70 / v107; + v108 = fixpoint_div(v68, v107); + if ( v108 >= 0 ) { if ( sub_4075DB( - pOut.x + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v143) >> 16) + 32768) >> 16), - pOut.y + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v147) >> 16) + 32768) >> 16), - outz + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v151) >> 16) + 32768) >> 16), + pOut.x + ((signed int)(fixpoint_sub0(v108, v143) + 32768) >> 16), + pOut.y + ((signed int)(fixpoint_sub0(v108, v147) + 32768) >> 16), + outz + ((signed int)(fixpoint_sub0(v108, v151) + 32768) >> 16), v62) ) { v114 = 1; @@ -5643,9 +5645,9 @@ || v132 < v90->pBounding.y1 || v136 > v90->pBounding.z2 || v140 < v90->pBounding.z1 - || (yb = (unsigned __int64)(v144 * (signed __int64)v90->pFacePlane_old.vNormal.x) >> 16, - v_4b = (unsigned __int64)(v148 * (signed __int64)v90->pFacePlane_old.vNormal.y) >> 16, - vf = (unsigned __int64)(v152 * (signed __int64)v90->pFacePlane_old.vNormal.z) >> 16, + || (yb = fixpoint_sub0(v144, v90->pFacePlane_old.vNormal.x), + v_4b = fixpoint_sub0(v148, v90->pFacePlane_old.vNormal.y), + vf = fixpoint_sub0(v152, v90->pFacePlane_old.vNormal.z), v20 = yb + vf + v_4b == 0, v91 = yb + vf + v_4b, vc = yb + vf + v_4b, @@ -5678,16 +5680,17 @@ + pOut.x * v90->pFacePlane_old.vNormal.x)) >> 14; if ( v_4c <= abs(v91) ) { - LODWORD(v94) = v93 << 16; - HIDWORD(v94) = v93 >> 16; - v95 = v94 / vc; - vd = v94 / vc; - if ( v95 >= 0 ) + //LODWORD(v94) = v93 << 16; + //HIDWORD(v94) = v93 >> 16; + //v95 = v94 / vc; + //vd = v94 / vc; + vd = fixpoint_div(v93, vc); + if ( vd >= 0 ) { if ( sub_4075DB( - pOut.x + ((signed int)(((unsigned __int64)(vd * (signed __int64)v144) >> 16) + 32768) >> 16), - pOut.y + ((signed int)(((unsigned __int64)(vd * (signed __int64)v148) >> 16) + 32768) >> 16), - outz + ((signed int)(((unsigned __int64)(vd * (signed __int64)v152) >> 16) + 32768) >> 16), + pOut.x + ((signed int)(fixpoint_sub0(vd, v144) + 32768) >> 16), + pOut.y + ((signed int)(fixpoint_sub0(vd, v148) + 32768) >> 16), + outz + ((signed int)(fixpoint_sub0(vd, v152) + 32768) >> 16), v90) ) { v113 = 1; @@ -5706,7 +5709,8 @@ } Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); v5.z = v.z; - *(_QWORD *)&v5.x = *(_QWORD *)&v; + 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; @@ -5784,9 +5788,9 @@ || v137 < v16->pBoundingBox.y1 || v133 > v16->pBoundingBox.z2 || v129 < v16->pBoundingBox.z1 - || (v17 = (unsigned __int64)(v125 * (signed __int64)v16->pFacePlane.vNormal.x) >> 16, - v18 = (unsigned __int64)(v121 * (signed __int64)v16->pFacePlane.vNormal.y) >> 16, - v19 = (unsigned __int64)(v117 * (signed __int64)v16->pFacePlane.vNormal.z) >> 16, + || (v17 = fixpoint_sub0(v125, v16->pFacePlane.vNormal.x), + v18 = fixpoint_sub0(v121, v16->pFacePlane.vNormal.y), + v19 = fixpoint_sub0(v117, v16->pFacePlane.vNormal.z), v20 = v17 + v18 + v19 == 0, v21 = v17 + v18 + v19, v109 = v17 + v18 + v19, @@ -5807,16 +5811,17 @@ v24 = abs(-(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x)) >> 14; if ( v24 <= abs(v21) ) { - LODWORD(v25) = v23 << 16; - HIDWORD(v25) = v23 >> 16; - v26 = v25 / v109; - v110 = v25 / v109; - if ( v26 >= 0 ) + //LODWORD(v25) = v23 << 16; + //HIDWORD(v25) = v23 >> 16; + //v26 = v25 / v109; + //v110 = v25 / v109; + v110 = fixpoint_div(v23, v109); + if ( v110 >= 0 ) { if ( sub_4077F1( - pOut.x + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v125) >> 16) + 32768) >> 16), - pOut.y + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v121) >> 16) + 32768) >> 16), - outz + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v117) >> 16) + 32768) >> 16), + pOut.x + ((signed int)(fixpoint_sub0(v110, v125) + 32768) >> 16), + pOut.y + ((signed int)(fixpoint_sub0(v110, v121) + 32768) >> 16), + outz + ((signed int)(fixpoint_sub0(v110, v117) + 32768) >> 16), v16, (BSPVertexBuffer *)a5) ) { @@ -5917,9 +5922,9 @@ || v138 < v39->pBoundingBox.y1 || v134 > v39->pBoundingBox.z2 || v130 < v39->pBoundingBox.z1 - || (ya = (unsigned __int64)(v126 * (signed __int64)v39->pFacePlane.vNormal.x) >> 16, - ve = (unsigned __int64)(v122 * (signed __int64)v39->pFacePlane.vNormal.y) >> 16, - v_4 = (unsigned __int64)(v118 * (signed __int64)v39->pFacePlane.vNormal.z) >> 16, + || (ya = fixpoint_sub0(v126, v39->pFacePlane.vNormal.x), + ve = fixpoint_sub0(v122, v39->pFacePlane.vNormal.y), + v_4 = fixpoint_sub0(v118, v39->pFacePlane.vNormal.z), v20 = ya + ve + v_4 == 0, v40 = ya + ve + v_4, va = ya + ve + v_4, @@ -5940,16 +5945,16 @@ v_4a = abs(-(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x)) >> 14; if ( v_4a <= abs(v40) ) { - LODWORD(v43) = v42 << 16; - HIDWORD(v43) = v42 >> 16; - v44 = v43 / va; - vb = v43 / va; - if ( v44 >= 0 ) + //LODWORD(v43) = v42 << 16; + //HIDWORD(v43) = v42 >> 16; + //vb = v43 / va; + vb = fixpoint_div(v42, va); + if ( vb >= 0 ) { if ( sub_4077F1( - pOut.x + ((signed int)(((unsigned __int64)(vb * (signed __int64)v126) >> 16) + 32768) >> 16), - pOut.y + ((signed int)(((unsigned __int64)(vb * (signed __int64)v122) >> 16) + 32768) >> 16), - outz + ((signed int)(((unsigned __int64)(vb * (signed __int64)v118) >> 16) + 32768) >> 16), + pOut.x + ((signed int)(fixpoint_sub0(vb, v126) + 32768) >> 16), + pOut.y + ((signed int)(fixpoint_sub0(vb, v122) + 32768) >> 16), + outz + ((signed int)(fixpoint_sub0(vb, v118) + 32768) >> 16), v39, (BSPVertexBuffer *)a5a) ) {
--- a/Math.h Sat Sep 07 21:55:02 2013 +0200 +++ b/Math.h Sat Sep 07 22:38:53 2013 +0200 @@ -24,10 +24,10 @@ }; #pragma pack(pop) -int fixpoint_sub0(int, int); -int fixpoint_dot(int x1, int x2, int y1, int y2, int z1, int z2); -int fixpoint_div(int, int); -int fixpoint_mul(int, int); +__int64 fixpoint_sub0(int, int); +__int64 fixpoint_dot(int x1, int x2, int y1, int y2, int z1, int z2); +__int64 fixpoint_div(int, int); +__int64 fixpoint_mul(int, int); int fixpoint_from_float(float value); template <typename FloatType>
--- a/mm7_1.cpp Sat Sep 07 21:55:02 2013 +0200 +++ b/mm7_1.cpp Sat Sep 07 22:38:53 2013 +0200 @@ -48,12 +48,12 @@ //----- (004A1780) mm6_chinese--------------------------------------------- -int fixpoint_div(int a1, int a2) +__int64 fixpoint_div(int a1, int a2) { return ((__int64)a1 << 16) / a2; } -int fixpoint_mul(int a1, int a2) +__int64 fixpoint_mul(int a1, int a2) { return (((__int64)a1 << 16) * a2) >> 16; } @@ -62,12 +62,12 @@ //----- (0042EBBE) -------------------------------------------------------- //----- (004453C0) mm6----------------------------------------------------- //----- (004A1760) mm6_chinese--------------------------------------------- -int fixpoint_sub0(int a1, int a2) +__int64 fixpoint_sub0(int a1, int a2) { return ((__int64)a1 * (__int64)a2) >> 16; } -int fixpoint_dot(int x1, int x2, int y1, int y2, int z1, int z2) +__int64 fixpoint_dot(int x1, int x2, int y1, int y2, int z1, int z2) { return fixpoint_sub0(x1, x2) + fixpoint_sub0(y1, y2) +