changeset 1085:9759bc6d47f3

Merge
author Grumpy7
date Sun, 26 May 2013 00:14:37 +0200
parents 5a59b5b2699f (current diff) ddf53a2d0bf5 (diff)
children 74ab0ed7e308
files
diffstat 1 files changed, 39 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_3.cpp	Sun May 26 00:14:09 2013 +0200
+++ b/mm7_3.cpp	Sun May 26 00:14:37 2013 +0200
@@ -1334,7 +1334,7 @@
 {
   unsigned int v0; // ebx@0
   //unsigned int v1; // edi@1
-  char *v2; // esi@2
+  //char *v2; // esi@2
   //__int16 v3; // dx@5
   ObjectDesc *v4; // eax@5
   int v5; // ecx@6
@@ -1359,7 +1359,7 @@
   for (uint i = 0; i < uNumSpriteObjects; ++i)
   {
     auto item = pSpriteObjects + i;
-    v2 = (char *)&item->uSpriteFrameID;
+    //v2 = (char *)&item->uSpriteFrameID;
     //do
     //{
       //LOWORD(v0) = item->uAttributes;
@@ -1372,20 +1372,22 @@
       if (item->AttachedToActor())
       {
           v5 = PID_ID(item->spell_target_pid);
-          *(int *)(v2 - 26) = pActors[v5].vPosition.x;
-          *(int *)(v2 - 22) = pActors[v5].vPosition.y;
-          *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
-          if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) )
-            goto LABEL_36;
+		  item->vPosition.x = pActors[v5].vPosition.x;
+          item->vPosition.y = pActors[v5].vPosition.y;
+          item->vPosition.z = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
+		  if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID, item->uSpriteFrameID = v6, !(v4->uFlags & 4)) )
+            continue;
           if ( v6 >= 0 )
           {
             v7 = v4->uLifetime;
             if (item->uAttributes & 2)
-              v7 = *((short *)v2 + 1);
+              v7 = item->field_20;
             if ( v6 < v7 )
-              goto LABEL_36;
-          }
-          goto LABEL_34;
+              continue;
+          }
+            v10 = i;
+            SpriteObject::OnInteraction(v10);
+            continue;
       }
 
         if ( item->uObjectDescID )
@@ -1393,30 +1395,29 @@
           v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID;
           item->uSpriteFrameID = v8;
           v9 = v4->uFlags;
-          if ( !(v9 & 4) )
-            goto LABEL_22;
-          if ( v8 < 0 )
-          {
-            v10 = i;
-LABEL_35:
-            SpriteObject::OnInteraction(v10);
-            goto LABEL_36;
-          }
-          v11 = v4->uLifetime;
-          if (item->uAttributes & 2)
-            v11 = *((short *)v2 + 1);
-          if ( v8 < v11 )
-          {
-LABEL_22:
+          if ( v9 & 4 )
+		  {    
+			  if ( v8 < 0 )
+			  {
+				v10 = i;
+				SpriteObject::OnInteraction(v10);
+				continue;
+			  }
+			  v11 = v4->uLifetime;
+			  if (item->uAttributes & 2)
+				v11 = item->field_20;
+		  }
+		  if ( !(v9 & 4) || v8 < v11 )
+          {
             if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
               SpriteObject::UpdateObject_fn0_BLV(i);
             else
               SpriteObject::UpdateObject_fn0_ODM(i);
-            if ( pParty->bTurnBasedModeOn != 1 || !(*(v2 - 4) & 4) )
-              goto LABEL_36;
-            v12 = abs(pParty->vPosition.x - *(int *)(v2 - 26));
-            v18 = abs(pParty->vPosition.y - *(int *)(v2 - 22));
-            v19 = abs(pParty->vPosition.z - *(int *)(v2 - 18));
+			if ( pParty->bTurnBasedModeOn != 1 || !(item->uSectorID & 4) )
+              continue;
+			v12 = abs(pParty->vPosition.x - item->vPosition.x);
+			v18 = abs(pParty->vPosition.y - item->vPosition.y);
+			v19 = abs(pParty->vPosition.z - item->vPosition.z);
             v13 = v12;
             v14 = v18;
             v15 = v19;
@@ -1439,19 +1440,20 @@
             }
             v0 = (unsigned int)(11 * v14) >> 5;
             if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 )
-              goto LABEL_36;
-LABEL_34:
+              continue;
             v10 = i;
-            goto LABEL_35;
+            SpriteObject::OnInteraction(v10);
+            continue;
           }
           v10 = i;
           if ( !(v9 & 0x40) )
-            goto LABEL_35;
+		  {
+            SpriteObject::OnInteraction(v10);
+            continue;
+		  }
           _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i));
         }
     }
-LABEL_36:
-    ;
       //v2 += 112;
       //v1 = v20++ + 1;
     //}