changeset 1970:8e36ef7de0db

Actor::_427102 cleaned up
author Grumpy7
date Sat, 26 Oct 2013 00:06:07 -0700
parents a9adc0aa49ca
children e45c277da9f1
files Actor.cpp Actor.h
diffstat 2 files changed, 30 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Fri Oct 25 23:52:16 2013 -0700
+++ b/Actor.cpp	Sat Oct 26 00:06:07 2013 -0700
@@ -4123,10 +4123,6 @@
 void Actor::LootActor()
 {
   signed int v2; // edi@1
-  char v3; // zf@1
-  unsigned int v4; // eax@13
-  unsigned int v5; // esi@13
-  int v6; // eax@14
   unsigned __int8 v7; // al@30
   char *v9; // [sp-4h] [bp-3Ch]@10
   char *v10; // [sp-4h] [bp-3Ch]@31
@@ -4268,160 +4264,90 @@
 
 
 //----- (00427102) --------------------------------------------------------
-int Actor::_427102(signed int a2)
+bool Actor::_427102( signed int a2 )
 {
-  unsigned __int8 v3; // cf@11
-  unsigned __int8 v4; // zf@11
-  SpellBuff *v6; // ecx@46
-  Player *v7; // esi@49
-  signed int v8; // edx@50
-  SpellBuff *v9; // ecx@50
-
   switch(a2)
   {
   case SPELL_BODY_POWER_CURE:
     {
       if ( this->sCurrentHP >= (signed int)this->pMonsterInfo.uHP )
-        return 0;
-      return 1;
+        return false;
+      return true;
     }
   case SPELL_LIGHT_DISPEL_MAGIC:
     {
-      v6 = pParty->pPartyBuffs.data();
-      while ( (signed __int64)v6->uExpireTime <= 0 )
+      for (int i = 0; i < 20; i++)
       {
-        ++v6;
-        if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] )
+        if (pParty->pPartyBuffs[i].uExpireTime > 0)
         {
-          v7 = pParty->pPlayers.data();//[0].pPlayerBuffs;
-LABEL_50:
-          v8 = 0;
-          v9 = v7->pPlayerBuffs.data();
-          while ( v9->uExpireTime <= 0i64 )
-          {
-            ++v8;
-            ++v9;
-            if ( v8 >= 24 )
-            {
-              ++v7;
-              if ( v7 <= &pParty->pPlayers[3] )
-                goto LABEL_50;
-              return 0;
-            }
-          }
-          return 1;
+          return true;
         }
       }
-      return 1;
+      for ( int i = 1; i <= 4; i++ )
+      {
+        for ( int j = 0; j < 22; j++ )
+        {
+          if (pPlayers[i]->pPlayerBuffs[j].uExpireTime > 0)
+          {
+            return true;
+          }
+        }
+      }
+      return false;
     }
   case SPELL_LIGHT_DAY_OF_PROTECTION:
     {
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) < 0 )
-        return 1;
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) > 0 )
-        return 0;
-      v3 = 0;
-      v4 = LODWORD(this->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) == 0;
+      return this->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime <= 0;
       break;
     }
   case SPELL_LIGHT_HOUR_OF_POWER:
     {
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) < 0 )
-        return 1;
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) > 0 )
-        return 0;
-      v3 = 0;
-      v4 = LODWORD(this->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) == 0;
+      return this->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime <= 0;
       break;
     }
   case SPELL_DARK_PAIN_REFLECTION:
     {
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) < 0 )
-        return 1;
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) > 0 )
-        return 0;
-      v3 = 0;
-      v4 = LODWORD(this->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) == 0;
+      return this->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime <= 0;
       break;
     }
   case SPELL_BODY_HAMMERHANDS:
     {
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) < 0 )
-        return 1;
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) > 0 )
-        return 0;
-      v3 = 0;
-      v4 = LODWORD(this->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) == 0;
+      return this->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime <= 0;
       break;
     }
   case SPELL_FIRE_HASTE:
     {
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) < 0 )
-        return 1;
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) > 0 )
-        return 0;
-      v3 = 0;
-      v4 = LODWORD(this->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) == 0;
+      return this->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime <= 0;
       break;
     }
   case SPELL_AIR_SHIELD:
     {
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) < 0 )
-        return 1;
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > 0 )
-        return 0;
-      v3 = 0;
-      v4 = LODWORD(this->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) == 0;
+      return this->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime <= 0;
       break;
     }
   case SPELL_EARTH_STONESKIN:
     {
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) < 0 )
-        return 1;
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) > 0 )
-        return 0;
-      v3 = 0;
-      v4 = LODWORD(this->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) == 0;
+      return this->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime <= 0;
+      break;
     }
   case SPELL_SPIRIT_BLESS:
     {
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) < 0 )
-        return 1;
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) > 0 )
-        return 0;
-      v3 = 0;
-      v4 = LODWORD(this->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) == 0;
+      return this->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime <= 0;
       break;
     }
   case SPELL_SPIRIT_FATE:
     {
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) < 0 )
-        return 1;
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) > 0 )
-        return 0;
-      v3 = 0;
-      v4 = LODWORD(this->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) == 0;
+      return this->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime <= 0;
       break;
     }
   case SPELL_SPIRIT_HEROISM:
     {
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) < 0 )
-        return 1;
-      if ( SHIDWORD(this->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) <= 0 )
-      {
-        v3 = 0;
-        v4 = LODWORD(this->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) == 0;
-      }
-      else
-        return 0;
+      return this->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime <= 0;
       break;
     }
   default:
     {
-      return 1;
+      return true;
     }
   }
-  if ( !(v3 | v4) )
-    return 0;
-  return 1;
 }
\ No newline at end of file
--- a/Actor.h	Fri Oct 25 23:52:16 2013 -0700
+++ b/Actor.h	Sat Oct 26 00:06:07 2013 -0700
@@ -248,7 +248,7 @@
 
 
   void LootActor();
-  int _427102(signed int a2);
+  bool _427102(signed int a2);
 
   char pActorName[32];
   signed __int16 sNPC_ID;