diff Actor.cpp @ 2251:47bcb700b74b

for StackLight_TerrainFace
author Ritor1
date Wed, 26 Feb 2014 20:10:43 +0600
parents 6ab7d7c112bb
children 2e02c384c62b
line wrap: on
line diff
--- a/Actor.cpp	Tue Feb 25 20:02:06 2014 +0600
+++ b/Actor.cpp	Wed Feb 26 20:10:43 2014 +0600
@@ -95,9 +95,7 @@
     v9 = uTextureID_mhp_grn;
 
   if ( actor->sCurrentHP < (int)actor->pMonsterInfo.uHP )
-  {
     v10 = bar_length / actor->pMonsterInfo.uHP * actor->sCurrentHP;
-  }
 
   uX = window->uFrameX + (signed int)(window->uFrameWidth - bar_length) / 2;
 
@@ -117,9 +115,7 @@
   if ( uActorID >= 0 && uActorID <= (signed int)(uNumActors - 1) )
   {
     if ( bToggle )
-    {
       pActors[uActorID].uAttributes |= uFlag;
-    }
     else
     {
       if ( uFlag == 0x10000 )
@@ -138,9 +134,7 @@
   for (uint i = 0; i < uNumActors; i++)
   {
     if (pActors[uNumActors].sNPC_ID == npc)
-    {
       Actor::GiveItem(i, item, a3);
-    }
   }
 }
 
@@ -149,24 +143,23 @@
 {
   if ( (uActorID >= 0) && (signed int)uActorID <= (signed int)(uNumActors - 1) )
   {
-    Actor* currActor = &pActors[uActorID];
     if ( bGive )
     {
-      if ( currActor->uCarriedItemID == 0)
-        currActor->uCarriedItemID = uItemID;
-      else if ( currActor->array_000234[0].uItemID == 0)
-        currActor->array_000234[0].uItemID = uItemID;
-      else if ( currActor->array_000234[1].uItemID == 0)
-        currActor->array_000234[1].uItemID = uItemID;
+      if ( pActors[uActorID].uCarriedItemID == 0)
+        pActors[uActorID].uCarriedItemID = uItemID;
+      else if ( pActors[uActorID].array_000234[0].uItemID == 0)
+        pActors[uActorID].array_000234[0].uItemID = uItemID;
+      else if ( pActors[uActorID].array_000234[1].uItemID == 0)
+        pActors[uActorID].array_000234[1].uItemID = uItemID;
     }
     else
     {
-      if ( currActor->uCarriedItemID == uItemID )
-        currActor->uCarriedItemID = 0;
-      else if ( currActor->array_000234[0].uItemID == uItemID )
-        currActor->array_000234[0].Reset();
-      else if ( currActor->array_000234[1].uItemID == uItemID )
-        currActor->array_000234[1].Reset();
+      if ( pActors[uActorID].uCarriedItemID == uItemID )
+        pActors[uActorID].uCarriedItemID = 0;
+      else if ( pActors[uActorID].array_000234[0].uItemID == uItemID )
+        pActors[uActorID].array_000234[0].Reset();
+      else if ( pActors[uActorID].array_000234[1].uItemID == uItemID )
+        pActors[uActorID].array_000234[1].Reset();
     }
   }
 }
@@ -176,12 +169,11 @@
 {
   bool isparalyzed; // esi@1
   bool isstoned; // edi@2
-  AIState v3; // ax@6
 
   isstoned = (signed __int64)this->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0;// stoned
   isparalyzed = (signed __int64)this->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0;// paralyzed
-  v3 = this->uAIState;
-  return !(isstoned || isparalyzed || v3 == Dying || v3 == Dead || v3 == Removed || v3 == Summoned || v3 == Disabled);
+  return !(isstoned || isparalyzed || this->uAIState == Dying || this->uAIState == Dead
+                    || this->uAIState == Removed || this->uAIState == Summoned || this->uAIState == Disabled);
 }
 
 //----- (004089C7) --------------------------------------------------------
@@ -197,7 +189,6 @@
 void Actor::SetRandomGoldIfTheresNoItem()
 {
   int v2; // edi@1
-  unsigned __int8 v4; // al@7
 
   v2 = 0;
   if ( !this->array_000234[3].uItemID )
@@ -205,9 +196,7 @@
     if ( this->pMonsterInfo.uTreasureDiceRolls )
     {
       for (int i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++)
-      {
         v2 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1;
-      }
       if ( v2 )
       {
         this->array_000234[3].uItemID = 197;
@@ -217,9 +206,8 @@
   }
   if ( rand() % 100 < this->pMonsterInfo.uTreasureDropChance )
   {
-    v4 = this->pMonsterInfo.uTreasureLevel;
-    if ( v4 )
-      pItemsTable->GenerateItem(v4, this->pMonsterInfo.uTreasureType, &this->array_000234[2]);
+    if ( this->pMonsterInfo.uTreasureLevel )
+      pItemsTable->GenerateItem(this->pMonsterInfo.uTreasureLevel, this->pMonsterInfo.uTreasureType, &this->array_000234[2]);
   }
   this->uAttributes |= 0x800000;
 }
@@ -246,18 +234,18 @@
   int v48; // ecx@110
   int v51; // ecx@130
   int v54; // ecx@138
-  Player *v57; // esi@145
-  int v58; // eax@146
+  //Player *v57; // esi@145
+  //int v58; // eax@146
   int v59; // edi@146
-  int v60; // eax@146
+  //int v60; // eax@146
   int v61; // edi@146
-  int v62; // eax@146
+  //int v62; // eax@146
   signed int v63; // edi@146
   int v68; // edi@168
   signed int v70; // ecx@172
   int v79; // edx@185
   int v80; // eax@185
-  signed int v89; // ecx@192
+  //signed int v89; // ecx@192
   signed int v91; // eax@200
   int v94; // ecx@208
   int v96; // ecx@217
@@ -308,26 +296,21 @@
       a1.uFacing = LOWORD(pDir->uYawAngle);
       a1.uSoundID = 0;
       a1.uAttributes = 0;
-      v89 = pDir->uDistance;
       a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z);
       a1.uSpriteFrameID = 0;
       a1.spell_caster_pid = PID(OBJECT_Actor, uActorID);
       a1.spell_target_pid = 0;
-      if ((double)v89 < 307.2 )
+      if ((double)pDir->uDistance < 307.2 )
         a1.field_60_distance_related_prolly_lod = 0;
-      else if ( v89 < 1024 )
+      else if ( pDir->uDistance < 1024 )
         a1.field_60_distance_related_prolly_lod = 1;
-      else if ( v89 < 2560 )
+      else if ( pDir->uDistance < 2560 )
         a1.field_60_distance_related_prolly_lod = 2;
       else 
         a1.field_60_distance_related_prolly_lod = 3;
 
       a1.field_61 = 2;
-      v91 = a1.Create(
-        pDir->uYawAngle,
-        pDir->uPitchAngle,
-        pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-        0);
+      v91 = a1.Create(pDir->uYawAngle, pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
       if ( v91 != -1 )
       {
         pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], PID(OBJECT_Item, v91), 0, -1, 0, 0, 0, 0);
@@ -345,12 +328,8 @@
         v39 = 240 * (realPoints + 15);
       else
         v39 = 0;
-      actorPtr->pActorBuffs[ACTOR_BUFF_HASTE].Apply(
-        pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
-        masteryLevel,
-        0,
-        0,
-        0);
+      actorPtr->pActorBuffs[ACTOR_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
+        masteryLevel, 0, 0, 0);
       pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFF3C1Eu);
       pAudioPlayer->PlaySound((SoundID)10040, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
@@ -411,15 +390,9 @@
         else 
           a1.field_60_distance_related_prolly_lod = 3;
         a1.field_61 = 2;
-        v36 = a1.Create(
-          v32,
-          pitch,
-          pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-          0);
+        v36 = a1.Create(v32, pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
         if ( v36 != -1 )
-        {
           pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[9], PID(OBJECT_Item, v36), 0, -1, 0, 0, 0, 0);
-        }
         spellnumb = rand() % 1024 - 512;
         v28 = rand() % 1024 - 512;
       }
@@ -458,19 +431,14 @@
       v19 = spellnuma / -2;
       a1a = spellnuma / 2;
       if ( spellnuma / -2 > spellnuma / 2 )
-      {
         v20 = spellnuma / 2;
-      }
       else
       {
         do
         {
           a1.uFacing = v19 + LOWORD(pDir->uYawAngle);
-          v20 = a1.Create(
-            (signed __int16)a1.uFacing,
-            pDir->uPitchAngle,
-            pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-            0);
+          v20 = a1.Create((signed __int16)a1.uFacing, pDir->uPitchAngle,
+            pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
           v19 += v118;
         }
         while ( v19 <= a1a );
@@ -494,10 +462,7 @@
         v8 = 0;
       actorPtr->pActorBuffs[ACTOR_BUFF_SHIELD].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335),
-        masteryLevel,
-        0,
-        0,
-        0);
+        masteryLevel, 0, 0, 0);
       return;
 
     case SPELL_EARTH_STONESKIN:
@@ -511,10 +476,7 @@
           v44 = 0;
       actorPtr->pActorBuffs[ACTOR_BUFF_STONESKIN].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335),
-        masteryLevel,
-        realPoints + 5,
-        0,
-        0);
+        masteryLevel, realPoints + 5, 0, 0);
       pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x5C310Eu);
       pAudioPlayer->PlaySound((SoundID)13040, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0);
       return;
@@ -530,10 +492,7 @@
         v42 = 0;
       actorPtr->pActorBuffs[ACTOR_BUFF_BLESS].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335),
-        masteryLevel,
-        realPoints + 5,
-        0,
-        0);
+        masteryLevel, realPoints + 5, 0, 0);
       pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
       pAudioPlayer->PlaySound((SoundID)14010, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0);
       return;
@@ -564,10 +523,7 @@
         v54 = 0;
       actorPtr->pActorBuffs[ACTOR_BUFF_HEROISM].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335),
-        masteryLevel,
-        realPoints + 5,
-        0,
-        0);
+        masteryLevel, realPoints + 5, 0, 0);
       pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
       pAudioPlayer->PlaySound((SoundID)14060, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0);
       return;
@@ -597,24 +553,16 @@
 
     case SPELL_LIGHT_DISPEL_MAGIC:
       for (int i = 0; i < 20; i++ )
-      {
         pParty->pPartyBuffs[i].Reset();
-      }
       for (int i = 1; i <= 4; i++)
       {
-        v57 = pPlayers[i];
-        v58 = v57->GetActualWillpower();
-        v59 = v57->GetParameterBonus(v58);
-        v60 = v57->GetActualIntelligence();
-        v61 = (v57->GetParameterBonus(v60) + v59) / 2;
-        v62 = v57->GetActualLuck();
-        v63 = v61 + v57->GetParameterBonus(v62) + 30;
+        v59 = pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualWillpower());
+        v61 = (pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualIntelligence()) + v59) / 2;
+        v63 = v61 + pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualLuck()) + 30;
         if ( rand() % v63 < 30 )
         {
-          for (uint k = 0; k < v57->pPlayerBuffs.size(); k++)
-          {
-            v57->pPlayerBuffs[k].Reset();
-          }
+          for (uint k = 0; k < pPlayers[i]->pPlayerBuffs.size(); k++)
+            pPlayers[i]->pPlayerBuffs[k].Reset();
           pOtherOverlayList->_4418B1(11210, i + 99, 0, 65536);
         }
       }
@@ -623,9 +571,7 @@
 
     case SPELL_LIGHT_DAY_OF_PROTECTION:
        if (masteryLevel == 1 || masteryLevel == 2)
-      {
         v96 = 300 * realPoints + 3840;
-      }
       else if (masteryLevel == 3 )
       {
         LOWORD(realPoints) = 3 * realPoints;
@@ -643,10 +589,7 @@
       }
       actorPtr->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335),
-        masteryLevel,
-        realPoints,
-        0,
-        0);
+        masteryLevel, realPoints, 0, 0);
       pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu);
       pAudioPlayer->PlaySound((SoundID)17070, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
@@ -662,10 +605,7 @@
         v94 = 0;
       actorPtr->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335),
-        masteryLevel,
-        realPoints + 5,
-        0,
-        0);
+        masteryLevel, realPoints + 5, 0, 0);
       pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu);
       pAudioPlayer->PlaySound((SoundID)17080, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
@@ -701,20 +641,15 @@
       a1.field_60_distance_related_prolly_lod = 3;
       a1c = spellnume / -2;
       if ( spellnume / -2 > spellnume / 2 )
-      {
         v80 = spellnume / -2;
-      }
       else
       {
         do
         {
           v79 = pDir->uYawAngle;
           a1.uFacing = a1c + LOWORD(pDir->uYawAngle);
-          v80 = a1.Create(
-            v79,
-            pDir->uPitchAngle,
-            pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-            0);
+          v80 = a1.Create(v79, pDir->uPitchAngle,
+            pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
           a1c += v116;
         }
         while ( a1c <= spellnume / 2 );
@@ -736,17 +671,13 @@
         v68 = 900 * realPoints + 3840;
       actorPtr->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335),
-        masteryLevel,
-        0,
-        0,
-        0);
+        masteryLevel, 0, 0, 0);
       pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x7E7E7Eu);
       pAudioPlayer->PlaySound((SoundID)18060, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
   }
 }
 
-
 //----- (new func) --------------------------------------------------------
 unsigned short Actor::GetObjDescId( int spellId )
 {
@@ -792,7 +723,7 @@
   int v5; // ST1C_4@8
   int v6; // eax@8
 
-  int x = 0; BYTE2(x) |= 8u;
+  int x = 0; x |= 0x80000;
   int y = 0; y |= 0x80000;
   Actor* victim = &pActors[uActorID];
   if ( a2 == 1 )
@@ -823,11 +754,11 @@
 //----- (00404874) --------------------------------------------------------
 void Actor::AI_RangedAttack( unsigned int uActorID, struct AIDirection *pDir, int type, char a4 )
 {
-  Actor *actPtr; // esi@1
+  //Actor *actPtr; // esi@1
   char specAb; // al@1
   int v13; // edx@28
 
-  actPtr = &pActors[uActorID];
+  //actPtr = &pActors[uActorID];
 
   SpriteObject a1; // [sp+Ch] [bp-74h]@1
 
@@ -888,12 +819,12 @@
     return;
   }
   a1.stru_24.Reset();
-  a1.vPosition.x = actPtr->vPosition.x;
+  a1.vPosition.x = pActors[uActorID].vPosition.x;
   a1.spell_id = 0;
-  a1.vPosition.y = actPtr->vPosition.y;
+  a1.vPosition.y = pActors[uActorID].vPosition.y;
   a1.spell_level = 0;
   a1.spell_skill = 0;
-  a1.vPosition.z = actPtr->vPosition.z - (unsigned int)(actPtr->uActorHeight * -0.75);
+  a1.vPosition.z = pActors[uActorID].vPosition.z - (unsigned int)(pActors[uActorID].uActorHeight * -0.75);
   a1.uFacing = pDir->uYawAngle;
   a1.uSoundID = 0;
   a1.uAttributes = 0;
@@ -911,35 +842,24 @@
     a1.field_60_distance_related_prolly_lod = 3;
 
   a1.field_61 = a4;
-  a1.Create(
-             pDir->uYawAngle,
-             pDir->uPitchAngle,
-             pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-             0);
-  if ( actPtr->pMonsterInfo.uSpecialAbilityType == 1 )
+  a1.Create(pDir->uYawAngle, pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
+  if ( pActors[uActorID].pMonsterInfo.uSpecialAbilityType == 1 )
   {
-    specAb = actPtr->pMonsterInfo.uSpecialAbilityDamageDiceBonus;
+    specAb = pActors[uActorID].pMonsterInfo.uSpecialAbilityDamageDiceBonus;
     if ( specAb == 2 )
     {
-      a1.vPosition.z += 40;      
+      a1.vPosition.z += 40;
       v13 = pDir->uYawAngle;
     }
     else
     {
       if ( specAb != 3 )
         return;
-      a1.Create(
-        pDir->uYawAngle + 30,      //TODO find out why the YawAngle change
-        pDir->uPitchAngle,
-        pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-        0);
+      a1.Create(pDir->uYawAngle + 30,      //TODO find out why the YawAngle change
+        pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
       v13 = pDir->uYawAngle - 30;
     }
-    a1.Create(
-               v13,
-               pDir->uPitchAngle,
-               pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed,
-               0);
+    a1.Create(v13, pDir->uPitchAngle, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0);
   }
   return;
 }
@@ -947,20 +867,18 @@
 //----- (00404736) --------------------------------------------------------
 void Actor::Explode( unsigned int uActorID )
 {
-  Actor *v1; // esi@1
   SpriteObject a1; // [sp+Ch] [bp-78h]@1
 
-  v1 = &pActors[uActorID];
   a1.uType = 600;
   a1.uObjectDescID = GetObjDescId(a1.uType);
   a1.stru_24.Reset();
-  a1.vPosition.y = v1->vPosition.y;
   a1.spell_id = 0;
   a1.spell_level = 0;
   a1.spell_skill = 0;
-  a1.vPosition.x = v1->vPosition.x;
+  a1.vPosition.x = pActors[uActorID].vPosition.x;
+  a1.vPosition.y = pActors[uActorID].vPosition.y;
+  a1.vPosition.z = pActors[uActorID].vPosition.z - (unsigned int)(pActors[uActorID].uActorHeight * -0.75);
   a1.uFacing = 0;
-  a1.vPosition.z = v1->vPosition.z - (unsigned int)(v1->uActorHeight * -0.75);
   a1.uSoundID = 0;
   a1.uAttributes = 0;
   a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z);
@@ -1179,30 +1097,28 @@
 {
   AIDirection *v7; // eax@3
   AIDirection v1; // eax@3
-  Actor *v9; // ebx@3
+  //Actor *v9; // ebx@3
   AIDirection a3; // [sp+8h] [bp-38h]@4
 
   if ( rand() % 100 >= 5 )
   {
-    v9 = &pActors[uActorID];
+    //v9 = &pActors[uActorID];
     if ( !a4 )
     {
       Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), uObjID, &v1, 0);
       v7 = &v1;
     }
     else
-    {
       v7 = a4;
-    }
-    v9->uYawAngle = v7->uYawAngle;
-    v9->uCurrentActionTime = 0;
-    v9->vVelocity.z = 0;
-    v9->vVelocity.y = 0;
-    v9->vVelocity.x = 0;
-    v9->uPitchAngle = v7->uPitchAngle;
-    v9->uCurrentActionLength = 256;
-    v9->uAIState = Interacting;
-    v9->UpdateAnimation();
+    pActors[uActorID].uYawAngle = v7->uYawAngle;
+    pActors[uActorID].uCurrentActionTime = 0;
+    pActors[uActorID].vVelocity.z = 0;
+    pActors[uActorID].vVelocity.y = 0;
+    pActors[uActorID].vVelocity.x = 0;
+    pActors[uActorID].uPitchAngle = v7->uPitchAngle;
+    pActors[uActorID].uCurrentActionLength = 256;
+    pActors[uActorID].uAIState = Interacting;
+    pActors[uActorID].UpdateAnimation();
   }
   else
     Actor::AI_Bored(uActorID, uObjID, a4);
@@ -1221,7 +1137,7 @@
 void Actor::AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, AIDirection *a4)
 {
   assert(uActorID < uNumActors);
-  Actor* actor = &pActors[uActorID];
+ // Actor* actor = &pActors[uActorID];
   
   AIDirection a3;
   if (!a4)
@@ -1230,18 +1146,18 @@
     a4 = &a3;
   }
 
-  actor->uAIState = Standing;
+  pActors[uActorID].uAIState = Standing;
   if (!uActionLength)
-    actor->uCurrentActionLength = rand() % 256 + 256;
+    pActors[uActorID].uCurrentActionLength = rand() % 256 + 256;
   else
-    actor->uCurrentActionLength = uActionLength;
-  actor->uCurrentActionTime = 0;
-  actor->uYawAngle = a4->uYawAngle;
-  actor->uPitchAngle = a4->uPitchAngle;
-  actor->vVelocity.z = 0;
-  actor->vVelocity.y = 0;
-  actor->vVelocity.x = 0;
-  actor->UpdateAnimation();
+    pActors[uActorID].uCurrentActionLength = uActionLength;
+  pActors[uActorID].uCurrentActionTime = 0;
+  pActors[uActorID].uYawAngle = a4->uYawAngle;
+  pActors[uActorID].uPitchAngle = a4->uPitchAngle;
+  pActors[uActorID].vVelocity.z = 0;
+  pActors[uActorID].vVelocity.y = 0;
+  pActors[uActorID].vVelocity.x = 0;
+  pActors[uActorID].UpdateAnimation();
 }
 
 //----- (00403E61) --------------------------------------------------------
@@ -1302,12 +1218,10 @@
   if ( sub_407A1C((int)v6, (int)v7, v23, v10) )
   {
     if (arg0 != nullptr)
-    {
       v12 = arg0;
-    }
     else
     {
-		  Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), sTargetPid, &a3, 0);
+      Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), sTargetPid, &a3, 0);
       v12 = &a3;
     }
     v3->uYawAngle = LOWORD(v12->uYawAngle);
@@ -1317,17 +1231,11 @@
     Actor::PlaySound(uActorID, 0);
     v25 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
     if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 )
-    {
       v25 *= 2;
-    }
     if ( pParty->bTurnBasedModeOn != 1 )
-    {
       v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * v25 * 2.133333333333333);
-    }
     else
-    {
       v3->pMonsterInfo.uRecoveryTime = v25;
-    }
     v3->vVelocity.z = 0;
     v3->vVelocity.y = 0;
     v3->vVelocity.x = 0;
@@ -1478,9 +1386,7 @@
       return 0;
   }
   for ( int i = 0; i < v3; i++)
-  {
     v11 += rand() % v4 + 1;
-  }
   return v11 + v5 + v2;
 }
 
@@ -1578,9 +1484,7 @@
       v9 = &a3;
     }
     else
-    {
       v9 = pDir;
-    }
     v3->uYawAngle = LOWORD(v9->uYawAngle);
     v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength;
     v3->uCurrentActionLength = 8 * v13;
@@ -1589,9 +1493,7 @@
     Actor::PlaySound(uActorID, 0);
     pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
     if (v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0)
-    {
       pDira *= 2;
-    }
     if ( pParty->bTurnBasedModeOn == 1 )
       v3->pMonsterInfo.uRecoveryTime = pDira;
     else
@@ -1662,9 +1564,7 @@
       v9 = &a3;
     }
     else
-    {
       v9 = pDir;
-    }
     v3->uYawAngle = LOWORD(v9->uYawAngle);
     v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength;
     v3->uCurrentActionLength = 8 * v13;
@@ -1673,9 +1573,7 @@
     Actor::PlaySound(uActorID, 0);
     pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
     if (v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0)
-    {
       pDira *= 2;
-    }
     if ( pParty->bTurnBasedModeOn == 1 )
       v3->pMonsterInfo.uRecoveryTime = pDira;
     else
@@ -1746,9 +1644,7 @@
       v9 = &a3;
     }
     else
-    {
       v9 = pDir;
-    }
     v3->uYawAngle = LOWORD(v9->uYawAngle);
     v13 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength;
     v3->uCurrentActionLength = 8 * v13;
@@ -1757,15 +1653,11 @@
     Actor::PlaySound(uActorID, 0);
     pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
     if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 )
-    {
       pDira *= 2;
-    }
     if ( pParty->bTurnBasedModeOn != 1 )
       v3->pMonsterInfo.uRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * pDira * 2.133333333333333);
     else
-    {
       v3->pMonsterInfo.uRecoveryTime = pDira;
-    }
     v3->vVelocity.z = 0;
     v3->vVelocity.y = 0;
     v3->vVelocity.x = 0;
@@ -1827,9 +1719,7 @@
       v10 = &a3;
     }
     else
-    {
       v10 = pDir;
-    }
     v3->uYawAngle = LOWORD(v10->uYawAngle);
     v14 = pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[ANIM_AtkRanged]].uAnimLength;
     v3->uCurrentActionLength = 8 * v14;
@@ -1838,9 +1728,7 @@
     Actor::PlaySound(uActorID, 0);
     pDira = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uRecoveryTime;
     if ( v3->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 )
-    {
       pDira *= 2;
-    }
     if ( pParty->bTurnBasedModeOn == 1 )
       v3->pMonsterInfo.uRecoveryTime = pDira;
     else
@@ -1910,7 +1798,7 @@
   v5->uCurrentActionTime = 0;
   v5->uAIState = Tethered;
   if ( rand() % 100 < 2 )
-    Actor::PlaySound(uActor_id, 3u);
+    Actor::PlaySound(uActor_id, 3);
   v5->UpdateAnimation();
 }
 
@@ -2137,9 +2025,7 @@
   if ( v3 )
   {
     if ( pActors[uActorID].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime <= 0 )
-    {
       pAudioPlayer->PlaySound((SoundID)v3, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
-    }
     else
     {
       switch(pActors[uActorID].pActorBuffs[ACTOR_BUFF_SHRINK].uPower)
@@ -2189,9 +2075,7 @@
     v10 = &a3;
   }
   else
-  {
     v10 = pDir;
-  }
   if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
   {
     if ( !uActionLength )
@@ -2379,9 +2263,7 @@
     return Actor::AI_StandOrBored(uActorID, a2, uActionLength, a4);
   }
   if ( uActionLength )
-  {
     v6->uCurrentActionLength = uActionLength + rand() % uActionLength;
-  }
   else
   {
     v12 = v6->uMovementSpeed;
@@ -2510,8 +2392,6 @@
 //----- (0040104C) --------------------------------------------------------
 signed int Actor::GetActorsRelation(Actor *otherActPtr)
 {
-  unsigned int v5; // edx@15
-  unsigned int v6; // eax@16
   unsigned int thisGroup; // ebp@19
   int otherGroup; // eax@22
   unsigned int thisAlly; // edx@25
@@ -2519,9 +2399,7 @@
 
   if ( otherActPtr)
   {
-    v5 = otherActPtr->uGroup;
-    v6 = this->uGroup;
-    if ( v5 != 0 && v6 != 0 && v5 == v6 )
+    if ( otherActPtr->uGroup != 0 && this->uGroup != 0 && otherActPtr->uGroup == this->uGroup )
       return 0;
   }
 
@@ -2531,13 +2409,9 @@
   if ( this->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || thisAlly == 9999)
     thisGroup = 0;
   else if ( thisAlly > 0 )
-  {
     thisGroup = thisAlly;
-  }
   else
-  {
     thisGroup = (this->pMonsterInfo.uID - 1) / 3 + 1;
-  }
 
   if ( otherActPtr )
   {
@@ -2547,18 +2421,12 @@
     if ( otherActPtr->pActorBuffs[ACTOR_BUFF_ENSLAVED].uExpireTime > 0 || otherAlly == 9999)
       otherGroup = 0;
     else  if ( otherAlly > 0 )
-    {
       otherGroup = otherAlly;
-    }
     else
-    {
       otherGroup = (otherActPtr->pMonsterInfo.uID - 1) / 3 + 1;
-    }
   }
   else
-  {
     otherGroup = 0;
-  }
 
   if ( this->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !otherGroup
     || otherActPtr && otherActPtr->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 && !thisGroup )
@@ -2576,9 +2444,7 @@
       return 4;
   }
   else
-  {
     return pFactionTable->relations[thisGroup][otherGroup];
-  }
 }
 
 //----- (0045976D) --------------------------------------------------------
@@ -2716,8 +2582,8 @@
   uMovementSpeed = v9->uBaseSpeed;
   if ( !(load_sounds_if_bit1_set & 1) )
   {
-    for (int i=0;i<4;++i )
-       pSoundSampleIDs[i]=v3->pSoundSampleIDs[i];
+    for ( int i = 0; i < 4; ++i )
+      pSoundSampleIDs[i] = v3->pSoundSampleIDs[i];
   }
 }
 
@@ -2787,9 +2653,7 @@
     if ( v5 >= 90 )
       summonMonsterBaseType += 2;
     else if ( v5 >= 60 )
-    {
       summonMonsterBaseType += 1;
-    }
   }
   v7 = summonMonsterBaseType - 1;
   v8 = &pActors[uNumActors];
@@ -2826,7 +2690,7 @@
   ++uNumActors;
   ++this->pMonsterInfo.uSpecialAbilityDamageDiceBonus;
   if ( this->uAttributes & 0x80000 )
-    v8->uAttributes |= 0x80000u;
+    v8->uAttributes |= 0x80000;
   v8->uSummonerID = PID(OBJECT_Actor,summonerId);
 
 }
@@ -3352,15 +3216,11 @@
   if ( uType )
   {
     if ( uType == 1 )
-    {
       uAliveActors = SearchActorByGroup(&uTotalActors, uParam);
-    }
     else
     {
       if ( uType == 2 )
-      {
         uAliveActors = SearchActorByMonsterID(&uTotalActors, uParam);
-      }
       else
       {
         if ( uType != 3 )
@@ -3370,9 +3230,7 @@
     }
   }
   else
-  {
     uAliveActors = SearchAliveActors(&uTotalActors);
-  }
 
   if (uNumAlive)
     return uAliveActors >= uNumAlive;
@@ -4040,9 +3898,7 @@
   if ( !( this->uAttributes & 0x800000 ) )
   {
     for (uchar i = 0; i < this->pMonsterInfo.uTreasureDiceRolls; i++ )
-    {
         v14 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1;
-      }
     if ( v14 != 0 )
       {
         pParty->PartyFindsGold(v14, 0);
@@ -4158,9 +4014,7 @@
     this->array_000234[1].Reset();
   }
   if ( !itemFound || rand() % 100 < 90 )
-  {
     this->Remove();
-  }
 }
 
 
@@ -4180,18 +4034,14 @@
       for (int i = 0; i < 20; i++)
       {
         if (pParty->pPartyBuffs[i].uExpireTime > 0)
-        {
           return true;
-        }
       }
       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;
@@ -4247,9 +4097,7 @@
       break;
     }
   default:
-    {
       return true;
-    }
   }
 }
 
@@ -4261,7 +4109,7 @@
   signed int okToCastSpell2; // edi@5
 
   if ( this->pMonsterInfo.uSpecialAbilityType == 2
-    && this->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3u
+    && this->pMonsterInfo.uSpecialAbilityDamageDiceBonus < 3
     && rand() % 100 < 5 )
     this->SummonMinion(a2);
   okToCastSpell1 = this->_427102_IsOkToCastSpell(this->pMonsterInfo.uSpell1ID);