diff mm7_3.cpp @ 1643:7182930263b3

fixpoint functions renaming
author zipi
date Tue, 17 Sep 2013 19:24:23 +0100
parents 8971dc85b8fb
children bac69d9157b6
line wrap: on
line diff
--- a/mm7_3.cpp	Tue Sep 17 20:15:56 2013 +0200
+++ b/mm7_3.cpp	Tue Sep 17 19:24:23 2013 +0100
@@ -794,22 +794,22 @@
   else
     v7 = pEventTimer->dt_in_some_format;
 
-  v8 = fixpoint_sub0(v7, speed) - v2->field_70; // speed * dt - something
+  v8 = fixpoint_mul(v7, speed) - v2->field_70; // speed * dt - something
   v2->field_6C = v8;
   if ( v8 > 0 )
   {
-    v10 = fixpoint_sub0(v8, v2->direction.x) + v2->normal.x;
+    v10 = fixpoint_mul(v8, v2->direction.x) + v2->normal.x;
     v2->field_4C = v10;
     v2->normal2.x = v10;
-    v11 = fixpoint_sub0(v2->field_6C, v2->direction.y) + v2->normal.y;
+    v11 = fixpoint_mul(v2->field_6C, v2->direction.y) + v2->normal.y;
     v2->field_50 = v11;
     v2->normal2.y = v11;
-    v2->normal2.z = fixpoint_sub0(v2->field_6C, v2->direction.z) + v2->normal.z;
+    v2->normal2.z = fixpoint_mul(v2->field_6C, v2->direction.z) + v2->normal.z;
     v12 = v2->position.z;
     v13 = v2->normal.x;
     v14 = v2->normal2.x;
     v15 = v2->prolly_normal_d;
-    v16 = v12 + fixpoint_sub0(v2->field_6C, v2->direction.z);
+    v16 = v12 + fixpoint_mul(v2->field_6C, v2->direction.z);
     v28 = v16;
     v2->field_54 = v16;
     v17 = v13;
@@ -991,21 +991,21 @@
       if ( v8 > 1000 )
         v8 = 1000;
 
-      v0->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v0->uYawAngle), v8);
-      v0->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v0->uYawAngle), v8);
+      v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v0->uYawAngle), v8);
+      v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v0->uYawAngle), v8);
       if ( uIsFlying )
       {
-        v0->vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(v0->uPitchAngle), v8);
+        v0->vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(v0->uPitchAngle), v8);
       }
       //v7 = v68;
     }
     else
     {
-      v0->vVelocity.x = fixpoint_sub0(55000, v0->vVelocity.x);
-      v0->vVelocity.y = fixpoint_sub0(55000, v0->vVelocity.y);
+      v0->vVelocity.x = fixpoint_mul(55000, v0->vVelocity.x);
+      v0->vVelocity.y = fixpoint_mul(55000, v0->vVelocity.y);
       if ( uIsFlying )
       {
-        v0->vVelocity.z = fixpoint_sub0(55000, v0->vVelocity.z);
+        v0->vVelocity.z = fixpoint_mul(55000, v0->vVelocity.z);
       }
     }
     if ( v0->vPosition.z < v5 )
@@ -1028,9 +1028,9 @@
         v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20;
         int v73 = abs(v62.x * v0->vVelocity.x + v62.z * v0->vVelocity.z + v62.y * v0->vVelocity.y) >> 16;
         //v72b = v21;
-        v0->vVelocity.x += fixpoint_sub0(v73, v62.x);
-        v0->vVelocity.y += fixpoint_sub0(v73, v62.y);
-        v0->vVelocity.z += fixpoint_sub0(v73, v62.z);
+        v0->vVelocity.x += fixpoint_mul(v73, v62.x);
+        v0->vVelocity.y += fixpoint_mul(v73, v62.y);
+        v0->vVelocity.z += fixpoint_mul(v73, v62.z);
         //v17 = 0;
       }
     }
@@ -1097,7 +1097,7 @@
       }
       v71 = i > 1;
       if ( stru_721530.field_7C < stru_721530.field_6C )
-        v70 = fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
+        v70 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
       //v34 = 0;
       v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
       v36 = ODM_GetFloorLevel(stru_721530.normal2.x,
@@ -1130,12 +1130,12 @@
         v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1;
         break;
       }
-      //v72b = fixpoint_sub0(stru_721530.field_7C, stru_721530.field_58.x);
-      v0->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
+      //v72b = fixpoint_mul(stru_721530.field_7C, stru_721530.field_58.x);
+      v0->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
       //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.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);
       //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
-      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);
       v38 = stru_721530.uFaceID;
       stru_721530.field_70 += stru_721530.field_7C;
 	  v39 = PID_ID(v38);
@@ -1193,8 +1193,8 @@
                   v0->vPosition.x - pLevelDecorations[v39].vPosition.x,
                   v0->vPosition.y - pLevelDecorations[v39].vPosition.y);
           v49 = v48;
-          v0->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v48), v47);
-          v0->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v48), v47);
+          v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v48), v47);
+          v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v48), v47);
           break;
         case OBJECT_BModel:
           v40 = &pOutdoor->pBModels[v38 >> 9];
@@ -1221,9 +1221,9 @@
               if ( (stru_721530.speed >> 3) > v72b )
                 v72b = stru_721530.speed >> 3;
 
-              v0->vVelocity.x += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.x);
-              v0->vVelocity.y += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.y);
-              v0->vVelocity.z += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.z);
+              v0->vVelocity.x += fixpoint_mul(v72b, v41->pFacePlane.vNormal.x);
+              v0->vVelocity.y += fixpoint_mul(v72b, v41->pFacePlane.vNormal.y);
+              v0->vVelocity.z += fixpoint_mul(v72b, v41->pFacePlane.vNormal.z);
               if ( v42 != 4 )
               {
                 v45 = v0->vPosition.z;
@@ -1245,9 +1245,9 @@
           break;
       }
 
-      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);
 
       ++v69;
       if ( v69 >= 100 )
@@ -1696,37 +1696,37 @@
         break;
 
       case PARTY_StrafeLeft:
-        v2 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2);
-        v1 += fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2);
+        v2 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2);
+        v1 += fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2);
         v78 = 1;
         break;
       case PARTY_StrafeRight:
-        v2 += fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2);
-        v1 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2);
+        v2 += fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2);
+        v1 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2);
         v78 = 1;
         break;
       case PARTY_WalkForward:
-        v2 += fixpoint_sub0(stru_5C6E00->Cos(angle), 5 * v81 * fWalkSpeedMultiplier);
-        v1 += fixpoint_sub0(stru_5C6E00->Sin(angle), 5 * v81 * fWalkSpeedMultiplier);
+        v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 5 * v81 * fWalkSpeedMultiplier);
+        v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 5 * v81 * fWalkSpeedMultiplier);
         v78 = 1;
         break;
       case PARTY_WalkBackward:
-        v2 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier);
-        v1 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier);
+        v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier);
+        v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier);
         v78 = 1;
         break;
       case PARTY_RunForward:
-        v2 += fixpoint_sub0(stru_5C6E00->Cos(angle), 2 * v81 * fWalkSpeedMultiplier);
-        v1 += fixpoint_sub0(stru_5C6E00->Sin(angle), 2 * v81 * fWalkSpeedMultiplier);
+        v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 2 * v81 * fWalkSpeedMultiplier);
+        v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 2 * v81 * fWalkSpeedMultiplier);
         v72 = 1;
         break;
       case PARTY_RunBackward:
         //v32 = stru_5C6E00->SinCos(angle);
         //v33 = (double)v81;
         //v88 = (double)v81;
-        v2 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier);
+        v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier);
         //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
-        v1 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier);
+        v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier);
         v72 = 1;
         break;
       case PARTY_LookUp:
@@ -2693,10 +2693,10 @@
     }
     else
     {
-      _angle_x = pX + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
-      _angle_y = pY + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
-      pModel = (BSPModel *)fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
-      v40 = fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z) + pZ;
+      _angle_x = pX + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
+      _angle_y = pY + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
+      pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
+      v40 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z) + pZ;
     }
     v122 = v40;
     ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
@@ -5448,8 +5448,8 @@
 
     v37 += ((unsigned __int64)(pSkyPolygon.ptr_38->field_10 * v13) >> 16);
     screen_center_x += ((unsigned __int64)(pSkyPolygon.ptr_38->field_1C * v13) >> 16);
-    v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, pShading) / 8;
-    screen_center_x = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(screen_center_x, pShading) / 8;
+    v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, pShading) / 8;
+    screen_center_x = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(screen_center_x, pShading) / 8;
 
     //array_50AC10[i].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist;
     //array_50AC10[i].vWorldPosition.x = v36 / (pSky.pTexture->uTextureHeight * 65536.0);
@@ -6067,7 +6067,7 @@
       v15 = grid_x2 - a1;
       v13 = grid_z1 - a2;
     }
-    return v14 + v8 + fixpoint_sub0(v13, (v10 - v8) * 128) + fixpoint_sub0(v15, (v9 - v8) * 128);
+    return v14 + v8 + fixpoint_mul(v13, (v10 - v8) * 128) + fixpoint_mul(v15, (v9 - v8) * 128);
   }
   else
     return y_x1z1;
@@ -6155,10 +6155,10 @@
   v24 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.y - pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.x;
   if (pGame->pIndoorCameraD3D->sRotationX)
   {
-    this->field_0_party_dir_x = fixpoint_sub0(v11, pGame->pIndoorCameraD3D->int_cosine_x) +
-                                fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x);
+    this->field_0_party_dir_x = fixpoint_mul(v11, pGame->pIndoorCameraD3D->int_cosine_x) +
+                                fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x);
     this->field_4_party_dir_y = v24;
-    this->field_8_party_dir_z = fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_sub0(v11, v27);
+    this->field_8_party_dir_z = fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27);
   }
   else
   {
@@ -6169,31 +6169,31 @@
 
   if (pGame->pIndoorCameraD3D->sRotationX)
   {
-    v17 = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7);
-
-    this->field_C = fixpoint_sub0(v17, v25) + fixpoint_sub0(a4, v27);
-    this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7);
-    this->field_14 = fixpoint_sub0(a4, v25) - fixpoint_sub0(v17, v27);
+    v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7);
+
+    this->field_C = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27);
+    this->field_10 = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7);
+    this->field_14 = fixpoint_mul(a4, v25) - fixpoint_mul(v17, v27);
   }
   else
   {
-    this->field_C = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7);
-    this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7);
+    this->field_C = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7);
+    this->field_10 = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7);
     this->field_14 = a4;
   }
 
   if (pGame->pIndoorCameraD3D->sRotationX)
   {
-    v19 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7);
-
-    this->field_18 = fixpoint_sub0(v19, v25) + fixpoint_sub0(a7, v27);
-    this->field_1C = fixpoint_sub0(a6, v9) - fixpoint_sub0(a5, v7);
-    this->field_20 = fixpoint_sub0(a7, v25) - fixpoint_sub0(v19, v27);
+    v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7);
+
+    this->field_18 = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27);
+    this->field_1C = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7);
+    this->field_20 = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27);
   }
   else
   {
-    this->field_18 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7);
-    this->field_1C = fixpoint_sub0(a6, v9) - fixpoint_sub0(a5, v7);
+    this->field_18 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7);
+    this->field_1C = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7);
     this->field_20 = a7;
   }