changeset 1968:7d2c5fa98584

moving stru319::_427102 to Actor::_427102
author Grumpy7
date Fri, 25 Oct 2013 23:14:53 -0700
parents 05787232b571
children a9adc0aa49ca
files Actor.cpp Actor.h mm7_6.cpp
diffstat 3 files changed, 166 insertions(+), 164 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Fri Oct 25 23:09:04 2013 -0700
+++ b/Actor.cpp	Fri Oct 25 23:14:53 2013 -0700
@@ -4264,4 +4264,167 @@
   {
     this->Remove();
   }
+}
+
+
+//----- (00427102) --------------------------------------------------------
+int 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 77:
+    {
+      if ( this->sCurrentHP >= (signed int)this->pMonsterInfo.uHP )
+        return 0;
+      return 1;
+    }
+  case 80:
+    {
+      v6 = pParty->pPartyBuffs.data();
+      while ( (signed __int64)v6->uExpireTime <= 0 )
+      {
+        ++v6;
+        if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] )
+        {
+          v7 = pParty->pPlayers.data();//[0].pPlayerBuffs;
+          v8 = 0;
+          v9 = v7->pPlayerBuffs.data();
+          while ( v9->uExpireTime <= 0i64 )
+          {
+            ++v8;
+            ++v9;
+            if ( v8 >= 24 )
+            {
+              ++v7;
+              if ( v7 <= &pParty->pPlayers[3] )
+              {
+                v8 = 0;
+                v9 = v7->pPlayerBuffs.data();
+              }
+              else
+                return 0;
+            }
+          }
+          return 1;
+        }
+      }
+      return 1;
+    }
+  case 85:
+    {
+      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;
+      break;
+    }
+  case 86:
+    {
+      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;
+      break;
+    }
+  case 95:
+    {
+      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;
+      break;
+    }
+  case 73:
+    {
+      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;
+      break;
+    }
+  case 5:
+    {
+      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;
+      break;
+    }
+  case 17:
+    {
+      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;
+      break;
+    }
+  case 38:
+    {
+      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;
+    }
+  case 46:
+    {
+      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;
+      break;
+    }
+  case 47:
+    {
+      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;
+      break;
+    }
+  case 51:
+    {
+      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;
+      break;
+    }
+  default:
+    {
+      return 1;
+    }
+  }
+  if ( !(v3 | v4) )
+    return 0;
+  return 1;
 }
\ No newline at end of file
--- a/Actor.h	Fri Oct 25 23:09:04 2013 -0700
+++ b/Actor.h	Fri Oct 25 23:14:53 2013 -0700
@@ -14,7 +14,6 @@
 {
   int which_player_to_attack(struct Actor *pActor);
   int  special_ability_use_check(struct Actor *pActor, int a2);
-  int _427102(struct Actor *pActor, signed int a2);
   int PlayerHitOrMiss(struct Player *pPlayer, struct Actor *pActor, int a3, int a4);
   bool _4273BB(struct Actor *pActor, struct Actor *a2, int a3, int a4);
   bool ActorHitOrMiss(struct Actor *pActor, struct Player *pPlayer);
@@ -249,6 +248,7 @@
 
 
   void LootActor();
+  int _427102(signed int a2);
 
   char pActorName[32];
   signed __int16 sNPC_ID;
--- a/mm7_6.cpp	Fri Oct 25 23:09:04 2013 -0700
+++ b/mm7_6.cpp	Fri Oct 25 23:14:53 2013 -0700
@@ -54,8 +54,8 @@
     && pActor->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u
     && rand() % 100 < 5 )
     pActor->SummonMinion(a2);
-  v4 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell1ID);
-  v5 = v3->_427102(pActor, pActor->pMonsterInfo.uSpell2ID);
+  v4 = pActor->_427102(pActor->pMonsterInfo.uSpell1ID);
+  v5 = pActor->_427102(pActor->pMonsterInfo.uSpell2ID);
   if ( v4 && pActor->pMonsterInfo.uSpell1UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell1UseChance )
     return 2;
   if ( v5 && pActor->pMonsterInfo.uSpell2UseChance && rand() % 100 < pActor->pMonsterInfo.uSpell2UseChance )
@@ -63,167 +63,6 @@
   return pActor->pMonsterInfo.uAttack2Chance && rand() % 100 < pActor->pMonsterInfo.uAttack2Chance?1:0;
 }
 
-//----- (00427102) --------------------------------------------------------
-int stru319::_427102(Actor *pActor, 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 77:
-		{
-		if ( pActor->sCurrentHP >= (signed int)pActor->pMonsterInfo.uHP )
-			return 0;
-		return 1;
-		}
-	case 80:
-		{
-		v6 = pParty->pPartyBuffs.data();
-		while ( (signed __int64)v6->uExpireTime <= 0 )
-		{
-			++v6;
-			if ( v6 > &pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE] )
-			{
-				v7 = pParty->pPlayers.data();//[0].pPlayerBuffs;
-				v8 = 0;
-				v9 = v7->pPlayerBuffs.data();
-				while ( v9->uExpireTime <= 0i64 )
-				{
-					++v8;
-					++v9;
-					if ( v8 >= 24 )
-					{
-						++v7;
-						if ( v7 <= &pParty->pPlayers[3] )
-						{
-							v8 = 0;
-							v9 = v7->pPlayerBuffs.data();
-						}
-						else
-							return 0;
-					}
-				}
-				return 1;
-			}
-		}
-		return 1;
-		}
-	case 85:
-		{
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) < 0 )
-			return 1;
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) > 0 )
-			return 0;
-		v3 = 0;
-		v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].uExpireTime) == 0;
-		break;
-		}
-	case 86:
-		{
-        if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) < 0 )
-			return 1;
-        if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) > 0 )
-			return 0;
-        v3 = 0;
-        v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime) == 0;
-		break;
-		}
-	case 95:
-		{
-        if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) < 0 )
-			return 1;
-        if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) > 0 )
-			return 0;
-        v3 = 0;
-        v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].uExpireTime) == 0;
-		break;
-		}
-	case 73:
-		{
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) < 0 )
-			return 1;
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) > 0 )
-			return 0;
-		v3 = 0;
-		v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_PAIN_HAMMERHANDS].uExpireTime) == 0;
-		break;
-		}
-	case 5:
-		{
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) < 0 )
-			return 1;
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) > 0 )
-			return 0;
-		v3 = 0;
-		v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_HASTE].uExpireTime) == 0;
-		break;
-		}
-	case 17:
-		{
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) < 0 )
-			return 1;
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > 0 )
-			return 0;
-		v3 = 0;
-		v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) == 0;
-		break;
-		}
-	case 38:
-		{
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) < 0 )
-			return 1;
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) > 0 )
-			return 0;
-		v3 = 0;
-		v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime) == 0;
-		}
-	case 46:
-		{
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) < 0 )
-			return 1;
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) > 0 )
-			return 0;
-		v3 = 0;
-		v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_BLESS].uExpireTime) == 0;
-		break;
-		}
-	case 47:
-		{
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) < 0 )
-			return 1;
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) > 0 )
-			return 0;
-		v3 = 0;
-		v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_FATE].uExpireTime) == 0;
-		break;
-		}
-	case 51:
-		{
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) < 0 )
-			return 1;
-		if ( SHIDWORD(pActor->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) <= 0 )
-		{
-			v3 = 0;
-			v4 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_HEROISM].uExpireTime) == 0;
-		}
-		else
-			return 0;
-		break;
-		}
-	default:
-		{
-		return 1;
-		}
-  }
-  if ( !(v3 | v4) )
-    return 0;
-  return 1;
-}
 
 //----- (004272F5) --------------------------------------------------------
 int stru319::PlayerHitOrMiss(Player *pPlayer, Actor *pActor, int a3, int a4)