changeset 444:ac6039b9ab5b

Слияние
author Ritor1
date Sat, 23 Feb 2013 19:07:14 +0600
parents 89f0edd8adbf (current diff) bbd8888534dc (diff)
children d0355e4f9be8
files
diffstat 7 files changed, 143 insertions(+), 100 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.h	Sat Feb 23 19:07:06 2013 +0600
+++ b/Actor.h	Sat Feb 23 19:07:14 2013 +0600
@@ -40,6 +40,8 @@
 /*  361 */
 enum ACTOR_BUFF_INDEX
 {
+  ACTOR_BUFF_CHARM = 1,  // an assumption
+  ACTOR_BUFF_SHRINK = 3, // an assumption
   ACTOR_BUFF_STONED = 5,
   ACTOR_BUFF_PARALYZED = 6,
 };
--- a/AudioPlayer.cpp	Sat Feb 23 19:07:06 2013 +0600
+++ b/AudioPlayer.cpp	Sat Feb 23 19:07:14 2013 +0600
@@ -1642,6 +1642,7 @@
     {
       case 0:
       case OBJECT_Player:
+      case OBJECT_BModel:
         continue;
 
       case OBJECT_BLVDoor:
--- a/mm7_2.cpp	Sat Feb 23 19:07:06 2013 +0600
+++ b/mm7_2.cpp	Sat Feb 23 19:07:14 2013 +0600
@@ -992,8 +992,8 @@
     }
     v3 = 5 * v2;
     v2 = (signed int)v0->ptr_1C;
-    v4 = word_4F03FE[v3];
-    v5 = word_4F0400[5 * v2 + rand() % 4];
+    v4 = word_4F0404[v3 - 4];
+    v5 = word_4F0404[5 * v2 + rand() % 4 - 2];
     goto LABEL_13;
   }
 LABEL_15:
--- a/mm7_3.cpp	Sat Feb 23 19:07:06 2013 +0600
+++ b/mm7_3.cpp	Sat Feb 23 19:07:14 2013 +0600
@@ -17671,7 +17671,7 @@
 //----- (00401A91) --------------------------------------------------------
 void __cdecl sub_401A91_AI()
 {
-  unsigned int v0; // esi@4
+  //unsigned int v0; // esi@4
   int v1; // eax@7
   int v2; // ecx@7
   int v3; // eax@7
@@ -17681,16 +17681,16 @@
   __int16 v7; // cx@14
   Player **v8; // esi@20
   Player *pPlayer; // ecx@21
-  Actor *pActor; // esi@34
-  __int16 v11; // ax@34
-  unsigned int v12; // eax@47
-  signed int v13; // edi@47
-  SpellBuff *v14; // ebx@47
-  unsigned int v15; // edi@67
-  char *v16; // eax@67
-  unsigned int v17; // edx@67
-  unsigned int v18; // ecx@67
-  unsigned __int16 v19; // ax@72
+  //Actor *pActor; // esi@34
+  //__int16 v11; // ax@34
+  //unsigned int v12; // eax@47
+  //signed int v13; // edi@47
+  //SpellBuff *v14; // ebx@47
+  //unsigned int v15; // edi@67
+  //char *v16; // eax@67
+  //unsigned int v17; // edx@67
+  //unsigned int v18; // ecx@67
+  //unsigned __int16 v19; // ax@72
   int *v20; // esi@80
   Actor *v21; // ebx@80
   unsigned __int16 v22; // ax@86
@@ -17763,7 +17763,7 @@
   else
     MakeActorAIList_BLV();
 
-  v0 = 0;
+  //v0 = 0;
   if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 )
   {
     if ( pParty->armageddon_timer > 417 )
@@ -17824,9 +17824,9 @@
           ++v8;
         }
         while ( (signed int)v8 <= (signed int)&pPlayers[4] );
-        v0 = 0;
-      }
-      if ( pTurnEngine->field_1C != v0 )
+        //v0 = 0;
+      }
+      if (pTurnEngine->field_1C)
         --pTurnEngine->field_1C;
     }
   }
@@ -17838,26 +17838,34 @@
   }
 
 
-  uActorID = v0;
-  if ( (signed int)uNumActors > (signed int)v0 )
-  {
-    LODWORD(v80) = (int)(char *)pActors + 176;
-    do
-    {
-      pActor = (Actor *)(LODWORD(v80) - 176);
-      v11 = *(unsigned int *)LODWORD(v80);
-      v49 = *(unsigned int *)LODWORD(v80) == 5;
-      dword_4F6E08[uActorID] = 4;
-      if ( v49 || v11 == 11 || v11 == 19 || *(char *)(LODWORD(v80) - 139) & 4 )
-        goto LABEL_78;
-      if ( !*(short *)(LODWORD(v80) - 136) && v11 != 4 )
-        Actor::Die(uActorID);
-      v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1;
-      v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1;
-      v12 = 0;
-      v13 = 0;
-      v14 = (SpellBuff *)(LODWORD(v80) + 36);
-      do
+  //uActorID = v0;
+  for (uint i = 0; i < uNumActors; ++i)
+  {
+    auto actor = pActors + i;
+    //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState
+    //do
+    //{
+      //pActor = (Actor *)(LODWORD(v80) - 176);
+      //v11 = *(unsigned int *)LODWORD(v80);
+      //v49 = *(unsigned int *)LODWORD(v80) == 5;
+    dword_4F6E08[i] = 4;
+    if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400)
+      continue;
+
+    if (!actor->sCurrentHP && actor->uAIState != Dying)
+      Actor::Die(i);
+
+    //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1;
+    //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1;
+      //v12 = 0;
+      //v13 = 0;
+      //v14 = (SpellBuff *)(LODWORD(v80) + 36);
+    for (uint j = 0; j < 22; ++j)
+    {
+      if (j != 10)
+        actor->pActorBuffs[j]._4585CA(pParty->uTimePlayed);
+    }
+      /*do
       {
         if ( v13 != 10 )
         {
@@ -17867,61 +17875,56 @@
         ++v13;
         ++v14;
       }
-      while ( v13 < 22 );
-      if ( v84 != v12
-        && SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12
-        && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12
-         || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) )
-        pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight;
-      if ( v82 != v12 )
-      {
-        pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
-        if ( SHIDWORD(pActor->pActorBuffs[1].uExpireTime) <= (signed int)v12 )
-        {
-          if ( SHIDWORD(pActor->pActorBuffs[1].uExpireTime) < (signed int)v12
-            || LODWORD(pActor->pActorBuffs[1].uExpireTime) <= v12 )
-            pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType;
-        }
-      }
-      if ( SHIDWORD(pActor->pActorBuffs[5].uExpireTime) > (signed int)v12
-        || SHIDWORD(pActor->pActorBuffs[5].uExpireTime) >= (signed int)v12
-        && LODWORD(pActor->pActorBuffs[5].uExpireTime)
-        || SHIDWORD(pActor->pActorBuffs[6].uExpireTime) > 0
-        || SHIDWORD(pActor->pActorBuffs[6].uExpireTime) >= 0 && LODWORD(pActor->pActorBuffs[6].uExpireTime) )
-        goto LABEL_78;
-      v15 = pMiscTimer->uTimeElapsed;
-      v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime;
-      pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed;
-      v17 = pActor->uCurrentActionTime;
-      v18 = pActor->pMonsterInfo.uRecoveryTime;
-      if ( (signed int)v18 > 0 )
-        *(int *)v16 = v18 - v15;
-      if ( *(int *)v16 < 0 )
-        *(int *)v16 = 0;
-      if ( (signed int)v17 < pActor->uCurrentActionLength )
-        goto LABEL_78;
-      v19 = pActor->uAIState;
-      if ( v19 == Dying )
-      {
-        pActor->uAIState = Dead;
-      }
-      else
-      {
-        if ( v19 != 17 )
-        {
-          Actor::_403F58(uActorID, Dying, 256, 0);
-          goto LABEL_78;
-        }
-        pActor->uAIState = Standing;
-      }
-      pActor->uCurrentActionTime = 0;
-      pActor->uCurrentActionLength = 0;
-      pActor->UpdateAnimation();
-LABEL_78:
-      ++uActorID;
-      LODWORD(v80) += 836;
-    }
-    while ( (signed int)uActorID < (signed int)uNumActors );
+      while ( v13 < 22 );*/
+    if (!actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime)
+        //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12
+        // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) )
+      actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight;
+    if (actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime)
+      actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
+    else
+      actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType;
+
+    if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime ||
+        actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime)
+      continue;
+
+      //v15 = pMiscTimer->uTimeElapsed;
+      //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime;
+      //v17 = pActor->uCurrentActionTime;
+      //v18 = pActor->pMonsterInfo.uRecoveryTime;
+    if (actor->pMonsterInfo.uRecoveryTime)
+    {
+      if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed)
+        actor->pMonsterInfo.uRecoveryTime = 0;
+      else actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed;
+    }
+    
+    actor->uCurrentActionTime += pMiscTimer->uTimeElapsed;
+    if (actor->uCurrentActionTime < actor->uCurrentActionLength)
+      continue;
+
+      //v19 = actor->uAIState;
+    if (actor->uAIState == Dying)
+        actor->uAIState = Dead;
+    else
+    {
+      if (actor->uAIState != Summoned)
+      {
+        Actor::_403F58(i, Dying, 256, 0);
+        continue;
+      }
+      actor->uAIState = Standing;
+    }
+
+    actor->uCurrentActionTime = 0;
+    actor->uCurrentActionLength = 0;
+    actor->UpdateAnimation();
+//LABEL_78:
+      //++uActorID;
+      //LODWORD(v80) += 836;
+    //}
+    //while ( (signed int)uActorID < (signed int)uNumActors );
   }
 
 
--- a/mm7_4.cpp	Sat Feb 23 19:07:06 2013 +0600
+++ b/mm7_4.cpp	Sat Feb 23 19:07:14 2013 +0600
@@ -10440,7 +10440,7 @@
         if ( v1 )
           v21 = word_4F063E[(signed int)v20];
         else
-          v21 = word_4F03FE[(signed int)v20];
+          v21 = word_4F0404[(signed int)v20 - 4];//word_4F03FE[(signed int)v20];
         v22 = v21 - 23;
         if ( v22 )
         {
--- a/mm7_data.cpp	Sat Feb 23 19:07:06 2013 +0600
+++ b/mm7_data.cpp	Sat Feb 23 19:07:14 2013 +0600
@@ -1594,12 +1594,48 @@
   "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF",
   "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF",
   "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF",
-  "MAGSHELF"
+  "MAGSHELF", "MAGSHELF", "MAGSHELF"
+};
+//__int16 word_4F03FE[777]; // weak
+//__int16 word_4F0400[777]; // weak
+__int16 word_4F0404[] =
+{
+	0, 0, 1, 0x17, 0x1B, 0x14, 0x14, 1, 0x17, 0x18, 0x1C,
+	0x14, 2, 0x17, 0x18, 0x19, 0x14, 2, 0x1B, 0x1B, 0x1A, 0x1A,
+	4, 0x18, 0x1E, 0x19, 0x1B, 4, 0x18, 0x1E, 0x19, 0x1B, 3, 0x1E,
+	0x18, 0x14, 0x14, 2, 0x14, 0x14, 0x14, 0x14, 3, 0x1B, 0x1B, 0x1A, 0x1A,
+	3, 0x1C, 0x1C, 0x19, 0x19, 2, 0x17, 0x17, 0x18, 0x18,
+	3, 0x17, 0x17, 0x1A, 0x1A, 2, 0x1E, 0x1A, 0x1A, 0x1A, 2, 0x1C,
+	0x19, 0x1C, 0x1D, 0, 0
 };
-__int16 word_4F03FE[777]; // weak
-__int16 word_4F0400[777]; // weak
-__int16 word_4F0498[777]; // weak
-__int16 word_4F0576[777]; // weak
+//__int16 word_4F0498[777]; // weak
+__int16 word_4F0498[] =
+{
+1, 0x23, 0x23, 0x26, 0x26, 1, 0x1F, 0x1F, 0x1F, 0x22, 1, 0x23, 0x23,
+0x26, 0x26, 1, 0x1F, 0x1F, 0x20, 0x22, 2, 0x23, 0x23,
+0x26, 0x26, 2, 0x1F, 0x20, 0x20, 0x21, 2, 0x23, 0x23,
+0x26, 0x26, 2, 0x1F, 0x1F, 0x20, 0x20, 4, 0x23, 0x23,
+0x26, 0x26, 4, 0x1F, 0x20, 0x21, 0x22, 4, 0x23, 0x23, 0x26, 0x26,
+4, 0x1F, 0x20, 0x21, 0x22, 3, 0x23, 0x23, 0x26, 0x26, 3,
+0x1F, 0x1F, 0x1F, 0x1F, 2, 0x23, 0x23, 0x26, 0x26, 2, 0x1F, 0x20,
+0x22, 0x22, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x1F, 0x1F,
+0x20, 0x20, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x20, 0x20, 0x20,
+0x21, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x1F, 0x1F, 0x1F, 0x20
+};
+//__int16 word_4F0576[777]; // weak
+__int16 word_4F0576[] =
+{
+0x23, 0x23, 0x26, 0x26, 3, 0x21, 0x1F, 0x20, 0x22, 3, 0x23, 0x23,
+0x26, 0x26, 3, 0x21, 0x1F, 0x20, 0x22, 4, 0x23, 0x23, 0x26, 0x26,
+4, 0x21, 0x1F, 0x20, 0x22, 0x1, 0x1, 0x2, 0x2, 0x4, 0x4,
+3, 2, 2, 2, 2, 2, 2, 0, 0x1, 0x1, 0x2, 0x2, 0x3, 0x3, 0x4, 0x4,
+2, 2, 2, 2, 0x0, 0x0, 1, 0, 0xA3, 0xA3, 0xA2, 0xA1, 0xA0,
+2, 0, 0xA3, 0xA3, 0xA2, 0xA1, 0xA0, 2, 0, 0xA3, 0xA3,
+0xA2, 0xA1, 0xA0, 2, 0, 0x0A3, 0x0A3, 0xA2, 0xA1, 0xA0,
+3, 0, 0xA3, 0xA3, 0xA2, 0xA1, 0xA0, 3, 0, 0xA3, 0xA3,
+0xA2, 0xA1, 0xA0
+};
+
 __int16 word_4F0578[777]; // weak
 __int16 word_4F05AE[777]; // weak
 char _4F063C_smthn_by_2da_uType[777]; // weak
--- a/mm7_data.h	Sat Feb 23 19:07:06 2013 +0600
+++ b/mm7_data.h	Sat Feb 23 19:07:14 2013 +0600
@@ -1000,8 +1000,9 @@
 extern void *off_4EFDB0; // weak
 extern int dword_4F031C[]; // weak
 extern const char *off_4F03B8[]; // idb
-extern __int16 word_4F03FE[]; // weak
-extern __int16 word_4F0400[]; // weak
+//extern __int16 word_4F03FE[]; // weak
+//extern __int16 word_4F0400[]; // weak
+extern __int16 word_4F0404[];
 extern __int16 word_4F0498[]; // weak
 extern __int16 word_4F0576[]; // weak
 extern __int16 word_4F0578[]; // weak