changeset 2257:8878fba164fd

simplifying a loop in immolation effect
author Grumpy7
date Thu, 27 Feb 2014 00:36:31 +0100
parents 27f2a2c2fd8f
children 01d7e9ec51e6 90f56da08d76
files mm7_2.cpp mm7_4.cpp
diffstat 2 files changed, 4 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_2.cpp	Thu Feb 27 00:30:03 2014 +0100
+++ b/mm7_2.cpp	Thu Feb 27 00:36:31 2014 +0100
@@ -4491,35 +4491,6 @@
 }
 
 
-//----- (0046A89E) --------------------------------------------------------
-int _46A89E_immolation_effect(int* affected, int affectedArrSize, int effectRange)
-{
-  int v5; // ebx@3
-  int v17; // [sp+Ch] [bp-10h]@3
-  int v18; // [sp+10h] [bp-Ch]@3
-  int affectedCount; // [sp+18h] [bp-4h]@1
-
-  affectedCount = 0;
-  for ( size_t i = 0; i < uNumActors; ++i )
-  {
-    v5 = abs(pActors[i].vPosition.x - pParty->vPosition.x);
-    v17 = abs(pActors[i].vPosition.y - pParty->vPosition.y);
-    v18 = abs(pActors[i].vPosition.z - pParty->vPosition.z);
-    if ( int_get_vector_length(v5, v17, v18) <= effectRange )
-    {
-      if ( pActors[i].uAIState != Dead && pActors[i].uAIState != Dying && pActors[i].uAIState != Removed
-        && pActors[i].uAIState != Disabled && pActors[i].uAIState != Summoned )
-      {
-        affected[affectedCount] = i;
-        affectedCount++;
-        if ( affectedCount >= affectedArrSize )
-          break;
-      }
-    }
-  }
-  return affectedCount;
-}
-
 //----- (0046BDA8) --------------------------------------------------------
 unsigned int  GetGravityStrength()
 {
--- a/mm7_4.cpp	Thu Feb 27 00:30:03 2014 +0100
+++ b/mm7_4.cpp	Thu Feb 27 00:36:31 2014 +0100
@@ -345,21 +345,11 @@
       v10 = 0;
       a1.uType = 1070;
       a1.spell_id = SPELL_FIRE_IMMOLATION;
-      if ( (signed int)pObjectList->uNumObjects <= 0 )
-      {
-LABEL_19:
-        LOWORD(v10) = 0;
-      }
-      else
+      v10 = 0;
+      for (uint i = 0; i > pObjectList->uNumObjects; i++)
       {
-        v11 = &pObjectList->pObjects->uObjectID;
-        while ( stru_4E3ACC[8].uType != *v11 )
-        {
-          ++v10;
-          v11 += 28;
-          if ( v10 >= (signed int)pObjectList->uNumObjects )
-            goto LABEL_19;
-        }
+        if (pObjectList->pObjects[i].uObjectID == stru_4E3ACC[8].uType) 
+          v10 = i;
       }
       a1.uObjectDescID = v10;
       a1.field_60_distance_related_prolly_lod = 0;