diff Indoor.cpp @ 1643:7182930263b3

fixpoint functions renaming
author zipi
date Tue, 17 Sep 2013 19:24:23 +0100
parents 8971dc85b8fb
children a395359afc8f
line wrap: on
line diff
--- a/Indoor.cpp	Tue Sep 17 20:15:56 2013 +0200
+++ b/Indoor.cpp	Tue Sep 17 19:24:23 2013 +0100
@@ -397,8 +397,8 @@
 
   _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed;
   //_this.fov_deg = 65;
-  //_this.vPosition.x = pParty->vPosition.x - fixpoint_sub0(stru_5C6E00->Cos(pParty->sRotationY), pParty->y_rotation_granularity);
-  //_this.vPosition.y = pParty->vPosition.y - fixpoint_sub0(stru_5C6E00->Sin(pParty->sRotationY), pParty->y_rotation_granularity);
+  //_this.vPosition.x = pParty->vPosition.x - fixpoint_mul(stru_5C6E00->Cos(pParty->sRotationY), pParty->y_rotation_granularity);
+  //_this.vPosition.y = pParty->vPosition.y - fixpoint_mul(stru_5C6E00->Sin(pParty->sRotationY), pParty->y_rotation_granularity);
   //_this.vPosition.z = pParty->vPosition.z + pParty->sEyelevel;
   //_this.sRotationX = pParty->sRotationX;
   //_this.sRotationY = pParty->sRotationY;
@@ -2573,16 +2573,16 @@
                         HIDWORD(v33) = v32 >> 16;*/
                         //fixpoint_div(v1->x - v2->x, v1->y - v2->y);
                         //_a58 = v33 / (v1->y - v2->y);
-                        //_a59 = fixpoint_sub0(_a58, sY - v2->y);
+                        //_a59 = fixpoint_mul(_a58, sY - v2->y);
             auto x_div_y = fixpoint_div(v1->x - v2->x, v1->y - v2->y);
-            auto res = fixpoint_sub0(x_div_y, sY - v2->y);  // a / b * c  - looks like projection 
+            auto res = fixpoint_mul(x_div_y, sY - v2->y);  // a / b * c  - looks like projection 
             if (res + v2->x > sX)
               ++v54;
           }
           else
           {
             auto x_div_y = fixpoint_div(v2->x - v1->x, v2->y - v1->y);
-            auto res = fixpoint_sub0(x_div_y, sY - v1->y);
+            auto res = fixpoint_mul(x_div_y, sY - v1->y);
 
             if (res + v1->x > sX)
               ++v54;
@@ -2593,7 +2593,7 @@
                         LODWORD(v33) = v32 << 16;
                         HIDWORD(v33) = v32 >> 16;
                         _a58 = v33 / (v2->y - v1->y);
-                        _a59 = fixpoint_sub0(_a58, sY - v1->y);
+                        _a59 = fixpoint_mul(_a58, sY - v1->y);
 
                         if (_a59 + pVertices[k].x > sX)
                           ++v54;*/
@@ -3445,9 +3445,9 @@
         }
         else
         {
-          v30 = v0->vPosition.x + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
-          v31 = v0->vPosition.y + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
-          v32 = v0->vPosition.z + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
+          v30 = v0->vPosition.x + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
+          v31 = v0->vPosition.y + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
+          v32 = v0->vPosition.z + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
         }
         v33 = collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &uFaceID);
         v34 = pIndoor->pFaces[uFaceID].uAttributes;
@@ -3472,12 +3472,12 @@
               goto LABEL_123;
             }
             //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
-            v0->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
+            v0->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
             //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
-            v0->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
+            v0->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
             //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16;
             v36 = stru_721530.uFaceID;
-            v0->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
+            v0->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
             v0->uSectorID = LOWORD(stru_721530.uSectorID);
             stru_721530.field_70 += stru_721530.field_7C;
             v37 = PID_ID(v36);
@@ -3491,8 +3491,8 @@
                   v45 = stru_5C6E00->Atan2(
                           v0->vPosition.x - pLevelDecorations[v37].vPosition.x,
                           v0->vPosition.y - pLevelDecorations[v37].vPosition.y);
-                  v0->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v45), _this);
-                  v0->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v45), _this);
+                  v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v45), _this);
+                  v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v45), _this);
                   goto LABEL_119;
                 }
                 if ( PID_TYPE(v36) == OBJECT_BModel)
@@ -3521,9 +3521,9 @@
                     if ( (stru_721530.speed >> 3) > v61 )
                       v61 = stru_721530.speed >> 3;
 
-                    v0->vVelocity.x += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.x);
-                    v0->vVelocity.y += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.y);
-                    v0->vVelocity.z += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.z);
+                    v0->vVelocity.x += fixpoint_mul(v61, v38->pFacePlane_old.vNormal.x);
+                    v0->vVelocity.y += fixpoint_mul(v61, v38->pFacePlane_old.vNormal.y);
+                    v0->vVelocity.z += fixpoint_mul(v61, v38->pFacePlane_old.vNormal.z);
                     v41 = v38->uPolygonType;
                     if ( v41 != 4 && v41 != 3 )
                     {
@@ -3547,9 +3547,9 @@
                     EventProcessor(pIndoor->pFaceExtras[v38->uFaceExtraID].uEventID, 0, 1);
                 }
 LABEL_119:
-                v0->vVelocity.x = fixpoint_sub0(58500, v0->vVelocity.x);
-                v0->vVelocity.y = fixpoint_sub0(58500, v0->vVelocity.y);
-                v0->vVelocity.z = fixpoint_sub0(58500, v0->vVelocity.z);
+                v0->vVelocity.x = fixpoint_mul(58500, v0->vVelocity.x);
+                v0->vVelocity.y = fixpoint_mul(58500, v0->vVelocity.y);
+                v0->vVelocity.z = fixpoint_mul(58500, v0->vVelocity.z);
                 v22 = 0;
                 goto LABEL_120;
               }
@@ -4070,7 +4070,7 @@
           else
           {
             auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]);
-            auto res = fixpoint_sub0((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b);
+            auto res = fixpoint_mul((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b);
 
             if (res + word_721460_xs[j] >= x)
                 ++v53;
@@ -4088,7 +4088,7 @@
           }
           else
           {
-            v21 = fixpoint_sub0(pFloor->zCalc1, x) + fixpoint_sub0(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16);
+            v21 = fixpoint_mul(pFloor->zCalc1, x) + fixpoint_mul(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16);
           }
           blv_floor_level[v55] = v21;
           blv_floor_id[v55] = pSector->pFloors[i];
@@ -4141,7 +4141,7 @@
                 else
                 {
                   auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]);
-                  auto res = fixpoint_sub0(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b);
+                  auto res = fixpoint_mul(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b);
                   if (res + word_721460_xs[j] >= x)
                     ++v54;
                 }
@@ -5164,9 +5164,9 @@
   {
     v16 = v8 * -pGame->pIndoorCameraD3D->vPartyPos.x + v29 * -pGame->pIndoorCameraD3D->vPartyPos.y;
     v17 = -65536 * pGame->pIndoorCameraD3D->vPartyPos.z;
-    this->field_0_party_dir_x = fixpoint_sub0(v16, v28) + fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v9);
+    this->field_0_party_dir_x = fixpoint_mul(v16, v28) + fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v9);
     this->field_4_party_dir_y = v8 * -pGame->pIndoorCameraD3D->vPartyPos.y - v29 * -pGame->pIndoorCameraD3D->vPartyPos.x;
-    this->field_8_party_dir_z = fixpoint_sub0(v17, v28) - fixpoint_sub0(v16, v9);
+    this->field_8_party_dir_z = fixpoint_mul(v17, v28) - fixpoint_mul(v16, v9);
   }
   else
   {
@@ -5177,31 +5177,31 @@
 
   if (pGame->pIndoorCameraD3D->sRotationX)
   {
-    v19 = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29);
-
-    this->field_C = fixpoint_sub0(v19, v28) + fixpoint_sub0(a4, v9);
-    this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29);
-    this->field_14 = fixpoint_sub0(a4, v28) - fixpoint_sub0(v19, v9);
+    v19 = fixpoint_mul(a2, v8) + fixpoint_mul(a3, v29);
+
+    this->field_C = fixpoint_mul(v19, v28) + fixpoint_mul(a4, v9);
+    this->field_10 = fixpoint_mul(a3, v8) - fixpoint_mul(a2, v29);
+    this->field_14 = fixpoint_mul(a4, v28) - fixpoint_mul(v19, v9);
   }
   else
   {
-    this->field_C = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29);
-    this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29);
+    this->field_C = fixpoint_mul(a2, v8) + fixpoint_mul(a3, v29);
+    this->field_10 = fixpoint_mul(a3, v8) - fixpoint_mul(a2, v29);
     this->field_14 = a4;
   }
 
   if (pGame->pIndoorCameraD3D->sRotationX)
   {
-    v21 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29);
-
-    this->field_18 = fixpoint_sub0(v21, v28) + fixpoint_sub0(a7, v9);
-    this->field_1C = fixpoint_sub0(a6, v8) - fixpoint_sub0(a5, v29);
-    this->field_20 = fixpoint_sub0(a7, v28) - fixpoint_sub0(v21, v9);
+    v21 = fixpoint_mul(a5, v8) + fixpoint_mul(a6, v29);
+
+    this->field_18 = fixpoint_mul(v21, v28) + fixpoint_mul(a7, v9);
+    this->field_1C = fixpoint_mul(a6, v8) - fixpoint_mul(a5, v29);
+    this->field_20 = fixpoint_mul(a7, v28) - fixpoint_mul(v21, v9);
   }
   else
   {
-    this->field_18 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29);
-    this->field_1C = fixpoint_sub0(a6, v8) - fixpoint_sub0(a5, v29);
+    this->field_18 = fixpoint_mul(a5, v8) + fixpoint_mul(a6, v29);
+    this->field_1C = fixpoint_mul(a6, v8) - fixpoint_mul(a5, v29);
     this->field_20 = a7;
   }
 
@@ -5535,9 +5535,9 @@
           if ( v108 >= 0 )
           {
             if ( sub_4075DB(
-                   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),
+                   pOut.x + ((signed int)(fixpoint_mul(v108, v143) + 32768) >> 16),
+                   pOut.y + ((signed int)(fixpoint_mul(v108, v147) + 32768) >> 16),
+                   outz + ((signed int)(fixpoint_mul(v108, v151) + 32768) >> 16),
                    v62) )
             {
               v114 = 1;
@@ -5661,9 +5661,9 @@
         || v132 < v90->pBounding.y1
         || v136 > v90->pBounding.z2
         || v140 < v90->pBounding.z1
-        || (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),
+        || (yb = fixpoint_mul(v144, v90->pFacePlane_old.vNormal.x),
+            v_4b = fixpoint_mul(v148, v90->pFacePlane_old.vNormal.y),
+            vf = fixpoint_mul(v152, v90->pFacePlane_old.vNormal.z),
             v20 = yb + vf + v_4b == 0,
             v91 = yb + vf + v_4b,
             vc = yb + vf + v_4b,
@@ -5704,9 +5704,9 @@
         if ( vd >= 0 )
         {
           if ( sub_4075DB(
-                 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),
+                 pOut.x + ((signed int)(fixpoint_mul(vd, v144) + 32768) >> 16),
+                 pOut.y + ((signed int)(fixpoint_mul(vd, v148) + 32768) >> 16),
+                 outz + ((signed int)(fixpoint_mul(vd, v152) + 32768) >> 16),
                  v90) )
           {
             v113 = 1;
@@ -5804,9 +5804,9 @@
         || v137 < v16->pBoundingBox.y1
         || v133 > v16->pBoundingBox.z2
         || v129 < v16->pBoundingBox.z1
-        || (v17 = fixpoint_sub0(v125, v16->pFacePlane.vNormal.x),
-            v18 = fixpoint_sub0(v121, v16->pFacePlane.vNormal.y),
-            v19 = fixpoint_sub0(v117, v16->pFacePlane.vNormal.z),
+        || (v17 = fixpoint_mul(v125, v16->pFacePlane.vNormal.x),
+            v18 = fixpoint_mul(v121, v16->pFacePlane.vNormal.y),
+            v19 = fixpoint_mul(v117, v16->pFacePlane.vNormal.z),
             v20 = v17 + v18 + v19 == 0,
             v21 = v17 + v18 + v19,
             v109 = v17 + v18 + v19,
@@ -5835,9 +5835,9 @@
         if ( v110 >= 0 )
         {
           if ( sub_4077F1(
-                 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),
+                 pOut.x + ((signed int)(fixpoint_mul(v110, v125) + 32768) >> 16),
+                 pOut.y + ((signed int)(fixpoint_mul(v110, v121) + 32768) >> 16),
+                 outz + ((signed int)(fixpoint_mul(v110, v117) + 32768) >> 16),
                  v16,
                  (BSPVertexBuffer *)a5) )
           {
@@ -5938,9 +5938,9 @@
         || v138 < v39->pBoundingBox.y1
         || v134 > v39->pBoundingBox.z2
         || v130 < v39->pBoundingBox.z1
-        || (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),
+        || (ya = fixpoint_mul(v126, v39->pFacePlane.vNormal.x),
+            ve = fixpoint_mul(v122, v39->pFacePlane.vNormal.y),
+            v_4 = fixpoint_mul(v118, v39->pFacePlane.vNormal.z),
             v20 = ya + ve + v_4 == 0,
             v40 = ya + ve + v_4,
             va = ya + ve + v_4,
@@ -5968,9 +5968,9 @@
         if ( vb >= 0 )
         {
           if ( sub_4077F1(
-                 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),
+                 pOut.x + ((signed int)(fixpoint_mul(vb, v126) + 32768) >> 16),
+                 pOut.y + ((signed int)(fixpoint_mul(vb, v122) + 32768) >> 16),
+                 outz + ((signed int)(fixpoint_mul(vb, v118) + 32768) >> 16),
                  v39,
                  (BSPVertexBuffer *)a5a) )
           {