diff SpriteObject.cpp @ 1546:9a6567c6c76c

stru141 & misc cleaning
author Nomad
date Sat, 07 Sep 2013 21:55:02 +0200
parents c4ab816fcc5e
children 2d9c8f609a3c
line wrap: on
line diff
--- a/SpriteObject.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/SpriteObject.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -310,12 +310,12 @@
       ODM_GetTerrainNormalAt(v12, v11, &v51);
       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 += (unsigned int)(v56 * v51.x) >> 16;
-      v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
-      v1->vVelocity.y += (unsigned int)(v56 * v51.y) >> 16;
-      v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
-      v1->vVelocity.z += (unsigned int)(v56 * v51.z) >> 16;
+      //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
+      v1->vVelocity.x += fixpoint_sub0(v56, v51.x);
+      //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
+      v1->vVelocity.y += fixpoint_sub0(v56, v51.y);
+      //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
+      v1->vVelocity.z += fixpoint_sub0(v56, v51.z);
 LABEL_12:
       v7 = v54;
       goto LABEL_13;
@@ -395,22 +395,22 @@
     stru_721530.field_0 = 0;
     v55 = 0;
     stru_721530.prolly_normal_d = v2->uRadius;
-    stru_721530.field_C = v2->uHeight;
-    stru_721530.field_8 = 0;
+    stru_721530.height = v2->uHeight;
+    stru_721530.field_8_radius = 0;
     stru_721530.field_70 = 0;
     while ( 1 )
     {
-      stru_721530.field_34.x = v1->vPosition.x;
-      stru_721530.normal.x = stru_721530.field_34.x;
+      stru_721530.position.x = v1->vPosition.x;
+      stru_721530.normal.x = stru_721530.position.x;
       v15 = v1->vPosition.y;
       stru_721530.uSectorID = 0;
-      stru_721530.field_34.y = v15;
+      stru_721530.position.y = v15;
       stru_721530.normal.y = v15;
-      stru_721530.field_34.z = v1->vPosition.z + stru_721530.prolly_normal_d + 1;
-      stru_721530.normal.z = stru_721530.field_34.z;
-      stru_721530.field_1C = v1->vVelocity.x;
-      stru_721530.field_20 = v1->vVelocity.y;
-      stru_721530.field_24 = v1->vVelocity.z;
+      stru_721530.position.z = v1->vPosition.z + stru_721530.prolly_normal_d + 1;
+      stru_721530.normal.z = stru_721530.position.z;
+      stru_721530.velocity.x = v1->vVelocity.x;
+      stru_721530.velocity.y = v1->vVelocity.y;
+      stru_721530.velocity.z = v1->vVelocity.z;
       if ( stru_721530._47050A(0) )
         return;
       _46E889_collide_against_bmodels(0);
@@ -502,13 +502,13 @@
             }
         return;
       }
-      v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16);
-      v1->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
-      v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
-      v1->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
-      v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
+      //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);
+      //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);
+      //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
       v28 = LOWORD(stru_721530.uSectorID);
-      v1->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
+      v1->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
       v29 = v1->vPosition.z;
       v1->uSectorID = v28;
       stru_721530.field_70 += stru_721530.field_7C;
@@ -530,14 +530,13 @@
         {
           v56 = abs(v32->pFacePlane.vNormal.z * v1->vVelocity.z + v32->pFacePlane.vNormal.y * v1->vVelocity.y
                                                                 + v32->pFacePlane.vNormal.x * v1->vVelocity.x) >> 16;
-          if ( stru_721530.field_64 >> 3 > v56 )
-            v56 = stru_721530.field_64 >> 3;
+          if ( (stru_721530.speed >> 3) > v56 )
+            v56 = stru_721530.speed >> 3;
           v57 = v32->pFacePlane.vNormal.x;
           v57 = (unsigned __int64)(v56 * (signed __int64)v57) >> 16;
           v58 = v32->pFacePlane.vNormal.y;
           v58 = (unsigned __int64)(v56 * (signed __int64)v58) >> 16;
-          v60 = v32->pFacePlane.vNormal.z;
-          v60 = ((unsigned __int64)(v56 * (signed __int64)(signed int)v60) >> 16);
+          v60 = ((unsigned __int64)(v56 * (signed __int64)v32->pFacePlane.vNormal.z) >> 16);
           v1->vVelocity.x += 2 * v57;
           v1->vVelocity.y += 2 * v58;
           if ( v32->pFacePlane.vNormal.z <= 32000 )
@@ -612,7 +611,7 @@
   int v9; // ecx@16
   __int16 v10; // di@18
   char v11; // al@19
-  int v12; // eax@25
+  //int v12; // eax@25
   int v13; // eax@31
   int v14; // ebx@34
   signed int v15; // ebx@46
@@ -671,22 +670,22 @@
     stru_721530.field_0 = v8;
     uFaceID = v8;
     stru_721530.prolly_normal_d = pObject->uRadius;
-    v12 = pObject->uHeight;
+
     stru_721530.field_84 = -1;
-    stru_721530.field_C = v12;
-    stru_721530.field_8 = v8;
+    stru_721530.height = pObject->uHeight;
+    stru_721530.field_8_radius = v8;
     stru_721530.field_70 = v8;
     while ( 1 )
     {
-      stru_721530.field_34.x = pSpriteObject->vPosition.x;
-      stru_721530.normal.x = stru_721530.field_34.x;
-      stru_721530.field_34.y = pSpriteObject->vPosition.y;
-      stru_721530.normal.y = stru_721530.field_34.y;
-      stru_721530.field_34.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1;
-      stru_721530.normal.z = stru_721530.field_34.z;
-      stru_721530.field_1C = pSpriteObject->vVelocity.x;
-      stru_721530.field_20 = pSpriteObject->vVelocity.y;
-      stru_721530.field_24 = pSpriteObject->vVelocity.z;
+      stru_721530.position.x = pSpriteObject->vPosition.x;
+      stru_721530.normal.x = stru_721530.position.x;
+      stru_721530.position.y = pSpriteObject->vPosition.y;
+      stru_721530.normal.y = stru_721530.position.y;
+      stru_721530.position.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1;
+      stru_721530.normal.z = stru_721530.position.z;
+      stru_721530.velocity.x = pSpriteObject->vVelocity.x;
+      stru_721530.velocity.y = pSpriteObject->vVelocity.y;
+      stru_721530.velocity.z = pSpriteObject->vVelocity.z;
       stru_721530.uSectorID = pSpriteObject->uSectorID;
       if ( stru_721530._47050A(v8) )
         return;
@@ -786,12 +785,12 @@
         pGame->pParticleEngine->AddParticle(&Dst);
         return;
       }
-      v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
-      pSpriteObject->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
-      v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
-      pSpriteObject->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
-      v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
-      pSpriteObject->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
+      //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);
+      //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);
+      //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->uSectorID = LOWORD(stru_721530.uSectorID);
       stru_721530.field_70 += stru_721530.field_7C;
       if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) )
@@ -822,8 +821,8 @@
         {
           v42 = abs(v16->pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x + v16->pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z
                                                                     + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16;
-          if ( stru_721530.field_64 >> 3 > v42 )
-            v42 = stru_721530.field_64 >> 3;
+          if ( (stru_721530.speed >> 3) > v42 )
+            v42 = stru_721530.speed >> 3;
           v40 = v16->pFacePlane_old.vNormal.x;
           v40 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16;
           v41 = v16->pFacePlane_old.vNormal.y;