changeset 2384:f784ffc9a758

sub_407A1C - removed unused variables and commented lines
author zipi
date Sun, 22 Jun 2014 14:57:47 +0100
parents 342b73a61a60
children b842e1b77c8c
files Indoor.cpp
diffstat 1 files changed, 35 insertions(+), 251 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Sun Jun 22 14:39:50 2014 +0100
+++ b/Indoor.cpp	Sun Jun 22 14:57:47 2014 +0100
@@ -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 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,29 +4228,18 @@
   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 outz; // [sp+64h] [bp-18h]@2
   int outx; // [sp+68h] [bp-14h]@2
   int outy; // [sp+6Ch] [bp-10h]@2
-  int sZ; // [sp+70h] [bp-Ch]@2
-  //Vec3_int_ pOut; // [sp+74h] [bp-8h]@2
-  int sX;
-  int sY;
+  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
@@ -4337,54 +4271,17 @@
     v45.x = v.x;
     v45.y = v.y;
     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);
+    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 = sX;
-    v147 = v52;
-    v151 = v53;
-
-	/*
-    v119 = sX;
-    if ( sX < outx )
-      v123 = outx;
-    else
-    {
-      v119 = outx;
-      v123 = sX;
-    }
-    //v55 = sY;
-    //v56 = outy;
-    
-	v127 = sY;
-    if ( sY < outy )
-      v131 = outy;
-    else
-    {
-      v127 = outy;
-      v131 = sY;
-    }
-    
-	//v57 = outz;
-    //v58 = sZ;
-    
-	v135 = sZ;
-    if ( sZ < outz )
-      v139 = outz;
-    else
-    {
-      v135 = outz;
-      v139 = sZ;
-    }
-    */
+	v143 = dist_x * v50;
+	v52 = dist_y * v50;
+	v53 = dist_z * v50;
 
 	v123 = max(outx, sX);
 	v119 = min(outx, sX);
@@ -4395,7 +4292,6 @@
 	v139 = max(outz, sZ);
 	v135 = min(outz, sZ);
 
-    //while ( !v114 )
     for ( a5b = 0; a5b < 2; a5b++ )
     {
       if ( a5b )
@@ -4420,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;
@@ -4461,8 +4357,8 @@
           if ( v108 >= 0 )
           {
             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),
+                            sY + ((signed int)(fixpoint_mul(v108, v52) + 0x8000) >> 16),
+                              sZ + ((signed int)(fixpoint_mul(v108, v53) + 0x8000) >> 16),
                             face) )
             {
               v114 = 1;
@@ -4477,59 +4373,18 @@
     v72.x = x;
     v72.y = z;
     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, &outz);
-    v74 = outy - sY;
-    v75 = outz - sZ;
-    v76 = outx - sX;
-    v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75);
+    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 = sX;
-    v148 = v80;
-    v152 = v81;
-
-	/*
-    v120 = sX;
-    if ( sX < outx )
-      v124 = outx;
-    else
-    {
-      v120 = outx;
-      v124 = sX;
-    }
-
-    //v83 = sY;
-    //v84 = outy;
-    
-	v128 = sY;
-    if ( sY < outy )
-      v132 = outy;
-    else
-    {
-      v128 = outy;
-      v132 = sY;
-    }
-    
-	//v85 = outz;
-    //v86 = sZ;
-    
-	v136 = sZ;
-    if ( sZ < outz )
-      v140 = outz;
-    else
-    {
-      v136 = outz;
-      v140 = sZ;
-    }
-    */
+	v144 = dist_x * v78;
+	v80 = dist_y * v78;
+	v81 = dist_z * v78;
 
 	v120 = max(outx, sX);
 	v124 = min(outx, sX);
@@ -4540,7 +4395,6 @@
 	v140 = max(outz, sZ);
 	v136 = min(outz, sZ);
 
-	//while ( 1 )
     for ( a5c = 0; a5c < 2; a5c++ )
     {
       if ( v113 )
@@ -4570,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;
@@ -4612,8 +4466,8 @@
         if ( vd >= 0 )
         {
           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),
+                          sY + ((signed int)(fixpoint_mul(vd, v80) + 0x8000) >> 16),
+                            sZ + ((signed int)(fixpoint_mul(vd, v81) + 0x8000) >> 16),
                           face) )
           {
             v113 = 1;
@@ -4627,9 +4481,6 @@
   else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
   {
     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);
     dist_y = outy - sY;
     dist_z = outz - sZ;
@@ -4639,42 +4490,9 @@
     if ( v9 )
       v10 = 65536 / v9;
     v125 = dist_x* v10;
-    //v11 = v10;
     v12 = dist_z* v10;
-	//v13 = sX;
-    //v117 = v12;
     v121 = dist_y* v10;
 
-	/*
-	v149 = sX;
-    if ( sX < outx )
-      v145 = outx;
-    else
-    {
-      v149 = outx;
-      v145 = sX;
-    }
-
-	//v14 = outy;
-	v141 = sY;
-	if (sY < outy)
-		v137 = outy;
-	else
-	{
-		v141 = outy;
-		v137 = sY;
-	}
-
-	v133 = sZ;
-	if (sZ < outz)
-		v129 = outz;
-	else
-	{
-		v133 = outz;
-		v129 = sZ;
-	}
-	*/
-
 	v145 = max(outx, sX);
 	v149 = min(outx, sX);
 
@@ -4755,51 +4573,17 @@
     v28.x = v.x;
     v28.y = v.y;
     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);
+	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 = sX;
-    v118 = v35;
-    v122 = v29 * v34;
-    
-	/*
-	v150 = sX;
-    if ( sX < outx )
-      v146 = outx;
-    else
-    {
-      v150 = outx;
-      v146 = sX;
-    }
-    	
-	//v37 = outy;
+	v126 = dist_x * v33;
+	v35 = dist_z * v33;
+    v122 = dist_y * v33;
     
-	v142 = sY;
-    if ( sY < outy )
-      v138 = outy;
-    else
-    {
-      v142 = outy;
-      v138 = sY;
-    }
-    
-	v134 = sZ;
-    if ( sZ < outz )
-      v130 = outz;
-    else
-    {
-      v134 = outz;
-      v130 = sZ;
-    }
-	*/
-
 	v146 = max(outx, sX);
 	v150 = min(outx, sX);
 
@@ -4819,7 +4603,7 @@
           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);
+          v_4 = fixpoint_mul(v35, odm_face->pFacePlane.vNormal.z);
           v20 = ya + ve + v_4;
           v40 = ya + ve + v_4;
           va = ya + ve + v_4;
@@ -4858,7 +4642,7 @@
             {
               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),
+                                sZ + ((signed int)(fixpoint_mul(vb, v35) + 0x8000) >> 16),
                               odm_face,
                               &pOutdoor->pBModels[model_id].pVertices) )
               {