diff SpriteObject.cpp @ 1643:7182930263b3

fixpoint functions renaming
author zipi
date Tue, 17 Sep 2013 19:24:23 +0100
parents 2d9c8f609a3c
children 35c1e4ff6ba7
line wrap: on
line diff
--- a/SpriteObject.cpp	Tue Sep 17 20:15:56 2013 +0200
+++ b/SpriteObject.cpp	Tue Sep 17 19:24:23 2013 +0100
@@ -82,11 +82,11 @@
     pSpriteObjects[v6].vVelocity.z = 0;
     if ( a4 )
     {
-      v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
-      a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
-      pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4);
-      pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4);
-      pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4);
+      v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
+      a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
+      pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
+      pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
+      pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
     }
     else
     {
@@ -107,11 +107,11 @@
     pSpriteObjects[v6].vVelocity.z = 0;
     if ( a4 )
     {
-      v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
-      a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
-      pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4);
-      pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4);
-      pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4);
+      v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
+      a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
+      pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
+      pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
+      pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
     }
     else
     {
@@ -132,11 +132,11 @@
     pSpriteObjects[v6].vVelocity.z = 0;
     if ( a4 )
     {
-      v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)) >> 16;
-      a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)) >> 16;
-      pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4);
-      pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4);
-      pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4);
+      v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)) >> 16;
+      a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)) >> 16;
+      pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
+      pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
+      pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
     }
     else
     {
@@ -157,11 +157,11 @@
     pSpriteObjects[v6].vVelocity.z = 0;
     if ( a4 )
     {
-      v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
-      a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
-      pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4);
-      pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4);
-      pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4);
+      v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
+      a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
+      pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
+      pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
+      pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
     }
     else
     {
@@ -182,11 +182,11 @@
     pSpriteObjects[v6].vVelocity.z = 0;
     if ( a4 )
     {
-      v13 = fixpoint_sub0(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
-      a5a = fixpoint_sub0(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
-      pSpriteObjects[v6].vVelocity.x = fixpoint_sub0(v13, a4);
-      pSpriteObjects[v6].vVelocity.y = fixpoint_sub0(a5a, a4);
-      pSpriteObjects[v6].vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(pitch), a4);
+      v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
+      a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
+      pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
+      pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
+      pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
     }
     else
     {
@@ -311,11 +311,11 @@
       v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
       v56 = abs(v51.y * v1->vVelocity.y + v51.z * v1->vVelocity.z + v51.x * v1->vVelocity.x) >> 16;
       //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
-      v1->vVelocity.x += fixpoint_sub0(v56, v51.x);
+      v1->vVelocity.x += fixpoint_mul(v56, v51.x);
       //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
-      v1->vVelocity.y += fixpoint_sub0(v56, v51.y);
+      v1->vVelocity.y += fixpoint_mul(v56, v51.y);
       //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
-      v1->vVelocity.z += fixpoint_sub0(v56, v51.z);
+      v1->vVelocity.z += fixpoint_mul(v56, v51.z);
 LABEL_12:
       v7 = v54;
       goto LABEL_13;
@@ -331,9 +331,9 @@
     if ( !(v2->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -v1->vVelocity.z >> 1, v1->vVelocity.z = v21, (signed __int16)v21 < 10) )
       v1->vVelocity.z = 0;
 
-    v1->vVelocity.x = fixpoint_sub0(58500, v1->vVelocity.x);
-    v1->vVelocity.y = fixpoint_sub0(58500, v1->vVelocity.y);
-    v1->vVelocity.z = fixpoint_sub0(58500, v1->vVelocity.z);
+    v1->vVelocity.x = fixpoint_mul(58500, v1->vVelocity.x);
+    v1->vVelocity.y = fixpoint_mul(58500, v1->vVelocity.y);
+    v1->vVelocity.z = fixpoint_mul(58500, v1->vVelocity.z);
 
     if ( (v1->vVelocity.y * v1->vVelocity.y + v1->vVelocity.x * v1->vVelocity.x) < 400 )
         {
@@ -503,12 +503,12 @@
         return;
       }
       //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16);
-      v1->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
+      v1->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
       //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
-      v1->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
+      v1->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
       //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
       v28 = LOWORD(stru_721530.uSectorID);
-      v1->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
+      v1->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
       v29 = v1->vPosition.z;
       v1->uSectorID = v28;
       stru_721530.field_70 += stru_721530.field_7C;
@@ -786,11 +786,11 @@
         return;
       }
       //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
-      pSpriteObject->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
+      pSpriteObject->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
       //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
-      pSpriteObject->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
+      pSpriteObject->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
       //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16;
-      pSpriteObject->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
+      pSpriteObject->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
       pSpriteObject->uSectorID = stru_721530.uSectorID;
       stru_721530.field_70 += stru_721530.field_7C;
       if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) )
@@ -801,8 +801,8 @@
         v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y);
         v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x,
                 pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y);
-        pSpriteObject->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v23), v40);
-        pSpriteObject->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v23), v40);
+        pSpriteObject->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v23), v40);
+        pSpriteObject->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v23), v40);
       }
       else
       {
@@ -816,9 +816,9 @@
                                                                     + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16;
           if ( (stru_721530.speed >> 3) > v42 )
             v42 = stru_721530.speed >> 3;
-          pSpriteObject->vVelocity.x += 2 * fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.x);
-          pSpriteObject->vVelocity.y += 2 * fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.y);
-          v39 = fixpoint_sub0(v42, v16->pFacePlane_old.vNormal.z);
+          pSpriteObject->vVelocity.x += 2 * fixpoint_mul(v42, v16->pFacePlane_old.vNormal.x);
+          pSpriteObject->vVelocity.y += 2 * fixpoint_mul(v42, v16->pFacePlane_old.vNormal.y);
+          v39 = fixpoint_mul(v42, v16->pFacePlane_old.vNormal.z);
           if ( v16->pFacePlane_old.vNormal.z <= 32000 )
           {
             v22 = 2 * v39;
@@ -826,7 +826,7 @@
           else
           {
             pSpriteObject->vVelocity.z += v39;
-            v22 = fixpoint_sub0(32000, v39);
+            v22 = fixpoint_mul(32000, v39);
           }
           pSpriteObject->vVelocity.z += v22;
           if ( BYTE3(v16->uAttributes) & 0x10 )
@@ -861,9 +861,9 @@
 LABEL_63:
       //v2 = v37;
 LABEL_64:
-      pSpriteObject->vVelocity.x = fixpoint_sub0(58500, pSpriteObject->vVelocity.x);
-      pSpriteObject->vVelocity.y = fixpoint_sub0(58500, pSpriteObject->vVelocity.y);
-      pSpriteObject->vVelocity.z = fixpoint_sub0(58500, pSpriteObject->vVelocity.z);
+      pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
+      pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
+      pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
       ++uFaceID;
       v28 = __OFSUB__(uFaceID, 100);
       v27 = uFaceID - 100 < 0;
@@ -893,9 +893,9 @@
         pSpriteObject->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
       v8 = 0;
     }
-    pSpriteObject->vVelocity.x = fixpoint_sub0(58500, pSpriteObject->vVelocity.x);
-    pSpriteObject->vVelocity.y = fixpoint_sub0(58500, pSpriteObject->vVelocity.y);
-    pSpriteObject->vVelocity.z = fixpoint_sub0(58500, pSpriteObject->vVelocity.z);
+    pSpriteObject->vVelocity.x = fixpoint_mul(58500, pSpriteObject->vVelocity.x);
+    pSpriteObject->vVelocity.y = fixpoint_mul(58500, pSpriteObject->vVelocity.y);
+    pSpriteObject->vVelocity.z = fixpoint_mul(58500, pSpriteObject->vVelocity.z);
     v9 = pSpriteObject->vVelocity.x;
     if ( v9 * v9 + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y < 400 )
     {