diff SpriteObject.cpp @ 2068:a290d9fbdc95

ODM_GetFloorLevel small fix
author Ritor1
date Tue, 03 Dec 2013 16:35:57 +0600
parents 28cb79ae2f6f
children 52abdea20b9e
line wrap: on
line diff
--- a/SpriteObject.cpp	Tue Dec 03 09:22:28 2013 +0600
+++ b/SpriteObject.cpp	Tue Dec 03 16:35:57 2013 +0600
@@ -206,8 +206,8 @@
 //----- (00471C03) --------------------------------------------------------
 void SpriteObject::UpdateObject_fn0_ODM(unsigned int uLayingItemID)
 {
-  SpriteObject *v1; // esi@1
-  ObjectDesc *v2; // ebx@1
+  //SpriteObject *v1; // esi@1
+  ObjectDesc *object; // ebx@1
   signed int v3; // edx@1
   int v4; // ecx@1
   int v5; // ST04_4@1
@@ -268,26 +268,26 @@
   int v60; // [sp+A4h] [bp-4h]@11
 
   uLayingItemID_ = uLayingItemID;
-  v1 = &pSpriteObjects[uLayingItemID];
+  //v1 = &pSpriteObjects[uLayingItemID];
   v58 = 0;
-  v2 = &pObjectList->pObjects[v1->uObjectDescID];
-  v57 = IsTerrainSlopeTooHigh(v1->vPosition.x, v1->vPosition.y);
-  v3 = v1->vPosition.y;
-  v4 = v1->vPosition.x;
-  v5 = v2->uHeight;
+  object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
+  v57 = IsTerrainSlopeTooHigh(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y);
+  v3 = pSpriteObjects[uLayingItemID].vPosition.y;
+  v4 = pSpriteObjects[uLayingItemID].vPosition.x;
+  v5 = object->uHeight;
   v55 = 0;
-  v6 = ODM_GetFloorLevel(v4, v3, v1->vPosition.z, v5, &on_water, &v55, 0);
+  v6 = ODM_GetFloorLevel(v4, v3, pSpriteObjects[uLayingItemID].vPosition.z, v5, &on_water, &v55, 0);
   v7 = v6;
   v54 = v6;
   v8 = v6 + 1;
-  if ( v1->vPosition.z <= v6 + 1 )
+  if ( pSpriteObjects[uLayingItemID].vPosition.z <= v6 + 1 )
   {
     if ( on_water )
     {
       v9 = v6 + 60;
       if ( v55 )
         v9 = v7 + 30;
-      sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v9);
+      sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v9);
       SpriteObject::OnInteraction(uLayingItemID_);
     }
   }
@@ -295,60 +295,59 @@
   {
     v58 = 1;
   }
-  v10 = v2->uFlags;
-  if ( !(v2->uFlags & OBJECT_DESC_NO_GRAVITY) )
+  v10 = object->uFlags;
+  if ( !(object->uFlags & OBJECT_DESC_NO_GRAVITY) )
   {
     if ( v58 )
     {
-      v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
+      pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
       goto LABEL_13;
     }
     if ( v57 )
     {
-      v11 = v1->vPosition.y;
-      v12 = v1->vPosition.x;
-      v1->vPosition.z = v8;
+      v11 = pSpriteObjects[uLayingItemID].vPosition.y;
+      v12 = pSpriteObjects[uLayingItemID].vPosition.x;
+      pSpriteObjects[uLayingItemID].vPosition.z = v8;
       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;
+      pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
+      v56 = abs(v51.y * pSpriteObjects[uLayingItemID].vVelocity.y + v51.z * pSpriteObjects[uLayingItemID].vVelocity.z + v51.x * pSpriteObjects[uLayingItemID].vVelocity.x) >> 16;
       //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
-      v1->vVelocity.x += fixpoint_mul(v56, v51.x);
+      pSpriteObjects[uLayingItemID].vVelocity.x += fixpoint_mul(v56, v51.x);
       //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
-      v1->vVelocity.y += fixpoint_mul(v56, v51.y);
+      pSpriteObjects[uLayingItemID].vVelocity.y += fixpoint_mul(v56, v51.y);
       //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
-      v1->vVelocity.z += fixpoint_mul(v56, v51.z);
-LABEL_12:
+      pSpriteObjects[uLayingItemID].vVelocity.z += fixpoint_mul(v56, v51.z);
       v7 = v54;
       goto LABEL_13;
     }
     if ( v10 & 0x40 )
     {
-      if ( v1->vPosition.z < v7 )
-        v1->vPosition.z = v8;
+      if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 )
+        pSpriteObjects[uLayingItemID].vPosition.z = v8;
       if ( !_46BFFA_check_object_intercept(uLayingItemID_, 0) )
         return;
     }
-    v1->vPosition.z = v8;
-    if ( !(v2->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -v1->vVelocity.z >> 1, v1->vVelocity.z = v21, (signed __int16)v21 < 10) )
-      v1->vVelocity.z = 0;
+    pSpriteObjects[uLayingItemID].vPosition.z = v8;
+    if ( !(object->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -pSpriteObjects[uLayingItemID].vVelocity.z >> 1, pSpriteObjects[uLayingItemID].vVelocity.z = v21, (signed __int16)v21 < 10) )
+      pSpriteObjects[uLayingItemID].vVelocity.z = 0;
 
-    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);
+    pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x);
+    pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y);
+    pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z);
 
-    if ( (v1->vVelocity.y * v1->vVelocity.y + v1->vVelocity.x * v1->vVelocity.x) < 400 )
+    if ( (pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y + pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x) < 400 )
         {
 
-    v1->vVelocity.y = 0;
-    v1->vVelocity.x = 0;
+    pSpriteObjects[uLayingItemID].vVelocity.y = 0;
+    pSpriteObjects[uLayingItemID].vVelocity.x = 0;
     memset(&Dst, 0, 0x68u);
-    Dst.x = (double)v1->vPosition.x;
-    Dst.y = (double)v1->vPosition.y;
-    Dst.z = (double)v1->vPosition.z;
+    Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
+    Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
+    Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
     Dst.r = 0.0;
     Dst.g = 0.0;
     Dst.b = 0.0;
-    if (v2->uFlags & OBJECT_DESC_TRIAL_FIRE )
+    if (object->uFlags & OBJECT_DESC_TRIAL_FIRE )
     {
       Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
       Dst.uDiffuse = 0xFF3C1E;
@@ -357,7 +356,7 @@
       Dst.flt_28 = 1.0;
       pGame->pParticleEngine->AddParticle(&Dst);
     }
-    else if ( v2->uFlags & OBJECT_DESC_TRIAL_LINE)
+    else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE)
     {
 
         Dst.type = ParticleType_Line;
@@ -367,7 +366,7 @@
         Dst.flt_28 = 1.0;
         pGame->pParticleEngine->AddParticle(&Dst);
       }
-    else if ( v2->uFlags & OBJECT_DESC_TRIAL_PARTICLE )
+    else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE )
         {
       Dst.type = ParticleType_Bitmap | ParticleType_8;
       Dst.uDiffuse = rand();
@@ -380,49 +379,49 @@
         }
   }
 LABEL_13:
-  if ( v1->vPosition.z > v7
-    && (v13 = v1->vPosition.x, v13 >= -0x8000)
+  if ( pSpriteObjects[uLayingItemID].vPosition.z > v7
+    && (v13 = pSpriteObjects[uLayingItemID].vPosition.x, v13 >= -0x8000)
     && v13 <= 0x8000
-    && (v14 = v1->vPosition.y, v14 >= -0x8000)
+    && (v14 = pSpriteObjects[uLayingItemID].vPosition.y, v14 >= -0x8000)
     && v14 <= 0x8000
-    && v1->vPosition.z <= 13000
-    || !(v2->uFlags & OBJECT_DESC_INTERACTABLE) )
+    && pSpriteObjects[uLayingItemID].vPosition.z <= 13000
+    || !(object->uFlags & OBJECT_DESC_INTERACTABLE) )
     goto LABEL_92;
-  if ( v1->vPosition.z < v7 )
-    v1->vPosition.z = v8;
+  if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 )
+    pSpriteObjects[uLayingItemID].vPosition.z = v8;
   if ( _46BFFA_check_object_intercept(uLayingItemID_, 0) )
   {
 LABEL_92:
     stru_721530.field_0 = 0;
     v55 = 0;
-    stru_721530.prolly_normal_d = v2->uRadius;
-    stru_721530.height = v2->uHeight;
+    stru_721530.prolly_normal_d = object->uRadius;
+    stru_721530.height = object->uHeight;
     stru_721530.field_8_radius = 0;
     stru_721530.field_70 = 0;
     while ( 1 )
     {
-      stru_721530.position.x = v1->vPosition.x;
+      stru_721530.position.x = pSpriteObjects[uLayingItemID].vPosition.x;
       stru_721530.normal.x = stru_721530.position.x;
-      v15 = v1->vPosition.y;
+      v15 = pSpriteObjects[uLayingItemID].vPosition.y;
       stru_721530.uSectorID = 0;
       stru_721530.position.y = v15;
       stru_721530.normal.y = v15;
-      stru_721530.position.z = v1->vPosition.z + stru_721530.prolly_normal_d + 1;
+      stru_721530.position.z = pSpriteObjects[uLayingItemID].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;
+      stru_721530.velocity.x = pSpriteObjects[uLayingItemID].vVelocity.x;
+      stru_721530.velocity.y = pSpriteObjects[uLayingItemID].vVelocity.y;
+      stru_721530.velocity.z = pSpriteObjects[uLayingItemID].vVelocity.z;
       if ( stru_721530._47050A(0) )
         return;
       _46E889_collide_against_bmodels(0);
-      v16 = WorldPosToGridCellZ(v1->vPosition.y);
-      v18 = WorldPosToGridCellX(v1->vPosition.x);
+      v16 = WorldPosToGridCellZ(pSpriteObjects[uLayingItemID].vPosition.y);
+      v18 = WorldPosToGridCellX(pSpriteObjects[uLayingItemID].vPosition.x);
       _46E26D_collide_against_sprites(v18, v16);
-      if (PID_TYPE(v1->spell_caster_pid) != OBJECT_Player)
+      if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player)
         _46EF01_collision_chech_player(0);
-      if (PID_TYPE(v1->spell_caster_pid) == OBJECT_Actor)
+      if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor)
       {
-        v19 = PID_ID(v1->spell_caster_pid);
+        v19 = PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid);
         if (( v19 >= 0 )&&( v19 < (signed int)(uNumActors - 1) ))
         {
          
@@ -441,38 +440,32 @@
           Actor::_46DF1A_collide_against_actor(i, 0);
       }
       v26 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
-      v27 = ODM_GetFloorLevel(
-              stru_721530.normal2.x,
-              stru_721530.normal2.y,
-              stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
-              v2->uHeight,
-              &v49,
-              &v50,
-              0);
+      v27 = ODM_GetFloorLevel( stru_721530.normal2.x, stru_721530.normal2.y, stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
+              object->uHeight, &v49, &v50, 0);
       if ( on_water && v26 < v27 + 60 )
       {
         if ( v50 )
           v44 = v27 + 30;
         else
           v44 = v54 + 60;
-        sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v44);
+        sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v44);
         SpriteObject::OnInteraction(uLayingItemID_);
         return;
       }
       if ( stru_721530.field_7C >= stru_721530.field_6C )
       {
-        v1->vPosition.x = stru_721530.normal2.x;
-        v1->vPosition.y = stru_721530.normal2.y;
-        v1->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
-        v1->uSectorID = LOWORD(stru_721530.uSectorID);
+        pSpriteObjects[uLayingItemID].vPosition.x = stru_721530.normal2.x;
+        pSpriteObjects[uLayingItemID].vPosition.y = stru_721530.normal2.y;
+        pSpriteObjects[uLayingItemID].vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
+        pSpriteObjects[uLayingItemID].uSectorID = LOWORD(stru_721530.uSectorID);
         memset(&Dst, 0, 0x68u);
-        Dst.x = (double)v1->vPosition.x;
-        Dst.y = (double)v1->vPosition.y;
-        Dst.z = (double)v1->vPosition.z;
+        Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
+        Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
+        Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
         Dst.r = 0.0;
         Dst.g = 0.0;
         Dst.b = 0.0;
-        if ( v2->uFlags & OBJECT_DESC_TRIAL_FIRE )
+        if ( object->uFlags & OBJECT_DESC_TRIAL_FIRE )
         {
           Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
           Dst.uDiffuse = 0xFF3C1E;
@@ -482,7 +475,7 @@
           pGame->pParticleEngine->AddParticle(&Dst);
           return;
         }
-        else if ( v2->uFlags & OBJECT_DESC_TRIAL_LINE )
+        else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE )
         {
           Dst.type = ParticleType_Line;
           Dst.uTextureID = 0;
@@ -492,31 +485,31 @@
           pGame->pParticleEngine->AddParticle(&Dst);
           return;
         }
-        else if ( v2->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
-            { 
-            Dst.type = ParticleType_Bitmap | ParticleType_8;
-            Dst.uDiffuse = rand();         
-            Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
-            Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
-            Dst.flt_28 = 1.0;
-            pGame->pParticleEngine->AddParticle(&Dst);
-            }
+        else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
+        {
+          Dst.type = ParticleType_Bitmap | ParticleType_8;
+          Dst.uDiffuse = rand();
+          Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
+          Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
+          Dst.flt_28 = 1.0;
+          pGame->pParticleEngine->AddParticle(&Dst);
+        }
         return;
       }
       //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16);
-      v1->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
+      pSpriteObjects[uLayingItemID].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_mul(stru_721530.field_7C, stru_721530.direction.y);
+      pSpriteObjects[uLayingItemID].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_mul(stru_721530.field_7C, stru_721530.direction.z);
-      v29 = v1->vPosition.z;
-      v1->uSectorID = v28;
+      pSpriteObjects[uLayingItemID].vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
+      v29 = pSpriteObjects[uLayingItemID].vPosition.z;
+      pSpriteObjects[uLayingItemID].uSectorID = v28;
       stru_721530.field_70 += stru_721530.field_7C;
-      if ( v2->uFlags & OBJECT_DESC_INTERACTABLE )
+      if ( object->uFlags & OBJECT_DESC_INTERACTABLE )
       {
         if ( v29 < v54 )
-          v1->vPosition.z = v54 + 1;
+          pSpriteObjects[uLayingItemID].vPosition.z = v54 + 1;
         if ( !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) )
           return;
       }
@@ -529,8 +522,8 @@
         v32 = &v31->pFaces[v30 & 0x3F];
         if ( v32->uPolygonType != 3 )
         {
-          v56 = abs(v32->pFacePlane.vNormal.z * v1->vVelocity.z + v32->pFacePlane.vNormal.y * v1->vVelocity.y
-                                                                + v32->pFacePlane.vNormal.x * v1->vVelocity.x) >> 16;
+          v56 = abs(v32->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z + v32->pFacePlane.vNormal.y * pSpriteObjects[uLayingItemID].vVelocity.y
+                                                                + v32->pFacePlane.vNormal.x * pSpriteObjects[uLayingItemID].vVelocity.x) >> 16;
           if ( (stru_721530.speed >> 3) > v56 )
             v56 = stru_721530.speed >> 3;
           v57 = v32->pFacePlane.vNormal.x;
@@ -538,8 +531,8 @@
           v58 = v32->pFacePlane.vNormal.y;
           v58 = (unsigned __int64)(v56 * (signed __int64)v58) >> 16;
           v60 = ((unsigned __int64)(v56 * (signed __int64)v32->pFacePlane.vNormal.z) >> 16);
-          v1->vVelocity.x += 2 * v57;
-          v1->vVelocity.y += 2 * v58;
+          pSpriteObjects[uLayingItemID].vVelocity.x += 2 * v57;
+          pSpriteObjects[uLayingItemID].vVelocity.y += 2 * v58;
           if ( v32->pFacePlane.vNormal.z <= 32000 )
           {
             v37 = 2 * (short)v60;
@@ -547,30 +540,33 @@
           else
           {
             v36 = v60;
-            v1->vVelocity.z += (signed __int16)v60;
+            pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60;
             v58 = (unsigned __int64)(32000 * (signed __int64)(signed int)v36) >> 16;
             v37 = (unsigned int)(32000 * v36) >> 16;
           }
-          v1->vVelocity.z += v37;
-LABEL_70:
+          pSpriteObjects[uLayingItemID].vVelocity.z += v37;
           if ( BYTE3(v32->uAttributes) & 0x10 )
             EventProcessor(v32->sCogTriggeredID, 0, 1);
           goto LABEL_74;
         }
         v33 = v31->pVertices.pVertices[v32->pVertexIDs[0]].z;
-        v34 = v1->vVelocity.x;
-        v1->vPosition.z = v33 + 1;
-        if ( v1->vVelocity.y * v1->vVelocity.y + v34 * v34 >= 400 )
-          goto LABEL_70;
+        v34 = pSpriteObjects[uLayingItemID].vVelocity.x;
+        pSpriteObjects[uLayingItemID].vPosition.z = v33 + 1;
+        if ( pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y + v34 * v34 >= 400 )
+        {
+          if ( BYTE3(v32->uAttributes) & 0x10 )
+            EventProcessor(v32->sCogTriggeredID, 0, 1);
+          goto LABEL_74;
+        }
         LOWORD(v35) = 0;
-        v1->vVelocity.z = 0;
-        v1->vVelocity.x = 0;
-        goto LABEL_73;
+        pSpriteObjects[uLayingItemID].vVelocity.z = 0;
+        pSpriteObjects[uLayingItemID].vVelocity.x = 0;
+        pSpriteObjects[uLayingItemID].vVelocity.y = v35;
       }
 LABEL_74:
-      v1->vVelocity.x = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.x) >> 16);
-      v1->vVelocity.y = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.y) >> 16);
-      v1->vVelocity.z = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.z) >> 16);
+      pSpriteObjects[uLayingItemID].vVelocity.x = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)pSpriteObjects[uLayingItemID].vVelocity.x) >> 16);
+      pSpriteObjects[uLayingItemID].vVelocity.y = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)pSpriteObjects[uLayingItemID].vVelocity.y) >> 16);
+      pSpriteObjects[uLayingItemID].vVelocity.z = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)pSpriteObjects[uLayingItemID].vVelocity.z) >> 16);
 
       ++v55;
       //v43 = __OFSUB__(v55, 100);
@@ -578,22 +574,19 @@
       if (v55>=100 )//!(v42 ^ v43) 
         return;
     }
-    v57 = integer_sqrt(v1->vVelocity.y * v1->vVelocity.y + v1->vVelocity.x * v1->vVelocity.x);
-    v38 = stru_5C6E00->Atan2(
-            v1->vPosition.x - pLevelDecorations[v30].vPosition.x,
-            v1->vPosition.y - pLevelDecorations[v30].vPosition.y);
+    v57 = integer_sqrt(pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y + pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x);
+    v38 = stru_5C6E00->Atan2(pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[v30].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[v30].vPosition.y);
     v56 = v38;
     v39 = stru_5C6E00->Cos(v38);
    // v60 = v39;
     v40 = v39 * (signed __int64)v57;
     v58 = v40 >> 16;
-    v1->vVelocity.x = WORD1(v40);
+    pSpriteObjects[uLayingItemID].vVelocity.x = WORD1(v40);
     v41 = stru_5C6E00->Sin(v56 - stru_5C6E00->uIntegerHalfPi);
    // v60 = v41;
     v35 = (unsigned __int64)(v41 * (signed __int64)v57) >> 16;
     v58 = v35;
-LABEL_73:
-    v1->vVelocity.y = v35;
+    pSpriteObjects[uLayingItemID].vVelocity.y = v35;
     goto LABEL_74;
   }
 }