diff mm7_6.cpp @ 1441:b67a3e0d6fc3

Слияние
author Ritor1
date Sat, 27 Jul 2013 09:36:55 +0600
parents d071e0e9ba75
children 9a1adf08f4ed
line wrap: on
line diff
--- a/mm7_6.cpp	Sat Jul 27 09:36:29 2013 +0600
+++ b/mm7_6.cpp	Sat Jul 27 09:36:55 2013 +0600
@@ -1607,118 +1607,74 @@
 //----- (0042F7EB) --------------------------------------------------------
 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9)
 {
-  unsigned int v9; // edi@1
-  signed int v10; // edx@3
-  char *v11; // ecx@4
-  unsigned __int16 v12; // ax@7
-  unsigned int v13; // edx@9
-  char *v14; // ecx@10
-  int v15; // esi@17
-  int v16; // eax@18
-  int v17; // edi@20
-  int v18; // esi@20
-  //SpriteObject a1a; // [sp+Ch] [bp-78h]@1
-  int v21; // [sp+7Ch] [bp-8h]@1
-  unsigned int v22; // [sp+80h] [bp-4h]@1
-
-  v9 = uSpriteID;
-  v21 = x;
-  v22 = uSpriteID;
+  unsigned __int16 pObjectDescID; // ax@7
+  SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1
 
-  SpriteObject a1a; // [sp+Ch] [bp-78h]@1
-  //SpriteObject::SpriteObject(&a1a);
-  a1a.stru_24.Reset();
-
+  pSpellObject.stru_24.Reset();
   if ( a9 )
-  {
-    memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24));
-    v9 = v22;
-  }
-  v10 = 0;
-  a1a.spell_skill = 0;
-  a1a.spell_level = 0;
-  a1a.spell_id = 0;
-  a1a.field_54 = 0;
-  a1a.uType = v9;
+    memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24));
+  pSpellObject.spell_skill = 0;
+  pSpellObject.spell_level = 0;
+  pSpellObject.spell_id = 0;
+  pSpellObject.field_54 = 0;
+  pSpellObject.uType = uSpriteID;
   if ( (signed int)pObjectList->uNumObjects <= 0 )
-  {
-LABEL_7:
-    v12 = 0;
-  }
+    pObjectDescID = 0;
   else
   {
-    v11 = (char *)&pObjectList->pObjects->uObjectID;
-    while ( (short)v9 != *(short *)v11 )
+    pObjectDescID = 0;
+    for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
     {
-      ++v10;
-      v11 += 56;
-      if ( v10 >= (signed int)pObjectList->uNumObjects )
-        goto LABEL_7;
-    }
-    v12 = v10;
-  }
-  a1a.uObjectDescID = v12;
-  a1a.vPosition.z = z;
-  a1a.vPosition.x = v21;
-  a1a.vPosition.y = y;
-  a1a.uSoundID = 0;
-  a1a.uAttributes = attributes;
-  a1a.uSectorID = pIndoor->GetSector(v21, y, z);
-  a1a.uSpriteFrameID = 0;
-  a1a.spell_caster_pid = 0;
-  a1a.spell_target_pid = 0;
-  if ( !(a1a.uAttributes & 0x10) )
-  {
-    v13 = 0;
-    if ( (signed int)pItemsTable->uAllItemsCount > 0 )
-    {
-      v14 = (char *)&pItemsTable->pItems[0].uSpriteID;
-      while ( *(short *)v14 != v9 )
-      {
-        ++v13;
-        v14 += 48;
-        if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount )
-          goto LABEL_16;
-      }
-      a1a.stru_24.uItemID = v13;
+      if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID )
+        pObjectDescID = i;
     }
   }
-LABEL_16:
+  pSpellObject.uObjectDescID = pObjectDescID;
+  pSpellObject.vPosition.x = x;
+  pSpellObject.vPosition.y = y;
+  pSpellObject.vPosition.z = z;
+  pSpellObject.uSoundID = 0;
+  pSpellObject.uAttributes = attributes;
+  pSpellObject.uSectorID = pIndoor->GetSector(x, y, z);
+  pSpellObject.uSpriteFrameID = 0;
+  pSpellObject.spell_caster_pid = 0;
+  pSpellObject.spell_target_pid = 0;
+  if ( !(pSpellObject.uAttributes & 0x10) )
+  {
+    if ( pItemsTable->uAllItemsCount )
+    {
+      for ( uint i = 0; i < pItemsTable->uAllItemsCount; ++i )
+      {
+        if ( pItemsTable->pItems[i].uSpriteID == uSpriteID )
+          pSpellObject.stru_24.uItemID = i;
+      }
+    }
+  }
   if ( a7 )
   {
-    v15 = count;
     if ( count > 0 )
     {
-      do
+      for ( uint i = count; i; --i )
       {
-        a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi;
-        v16 = rand();
-        a1a.Create(
-          (signed __int16)a1a.uFacing,
-          ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1),
-          a4,
-          0);
-        --v15;
+        pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi;
+        pSpellObject.Create((signed __int16)pSpellObject.uFacing,
+          ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0);
+        
       }
-      while ( v15 );
     }
   }
   else
   {
-    v17 = count;
-    v18 = stru_5C6E00->uIntegerHalfPi;
-    a1a.uFacing = 0;
+    pSpellObject.uFacing = 0;
     if ( count > 0 )
     {
-      do
+      for ( uint i = count; i; --i )
       {
-        a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0);
-        --v17;
+        pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0);
       }
-      while ( v17 );
     }
   }
-  return 1;
+  return true;
 }
 
 //----- (0042F960) --------------------------------------------------------