changeset 2276:e2433db49428

ActorHasItems
author Ritor1
date Fri, 14 Mar 2014 10:47:22 +0600
parents 8193a64c7461
children b9adf4f414f6
files Actor.cpp Actor.h Build/Visual Studio 2010/World of Might and Magic.vcxproj Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters CastSpellInfo.cpp DecorationList.cpp Indoor.cpp Player.cpp mm7_3.cpp
diffstat 9 files changed, 74 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Fri Mar 14 09:32:42 2014 +0600
+++ b/Actor.cpp	Fri Mar 14 10:47:22 2014 +0600
@@ -149,19 +149,19 @@
     {
       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 ( pActors[uActorID].ActorHasItems[0].uItemID == 0)
+        pActors[uActorID].ActorHasItems[0].uItemID = uItemID;
+      else if ( pActors[uActorID].ActorHasItems[1].uItemID == 0)
+        pActors[uActorID].ActorHasItems[1].uItemID = uItemID;
     }
     else
     {
       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();
+      else if ( pActors[uActorID].ActorHasItems[0].uItemID == uItemID )
+        pActors[uActorID].ActorHasItems[0].Reset();
+      else if ( pActors[uActorID].ActorHasItems[1].uItemID == uItemID )
+        pActors[uActorID].ActorHasItems[1].Reset();
     }
   }
 }
@@ -193,7 +193,7 @@
   int v2; // edi@1
 
   v2 = 0;
-  if ( !this->array_000234[3].uItemID )
+  if ( !this->ActorHasItems[3].uItemID )
   {
     if ( this->pMonsterInfo.uTreasureDiceRolls )
     {
@@ -201,15 +201,15 @@
         v2 += rand() % this->pMonsterInfo.uTreasureDiceSides + 1;
       if ( v2 )
       {
-        this->array_000234[3].uItemID = 197;
-        this->array_000234[3].uSpecEnchantmentType = v2;    //actual gold amount
+        this->ActorHasItems[3].uItemID = 197;
+        this->ActorHasItems[3].uSpecEnchantmentType = v2;    //actual gold amount
       }
     }
   }
   if ( rand() % 100 < this->pMonsterInfo.uTreasureDropChance )
   {
     if ( this->pMonsterInfo.uTreasureLevel )
-      pItemsTable->GenerateItem(this->pMonsterInfo.uTreasureLevel, this->pMonsterInfo.uTreasureType, &this->array_000234[2]);
+      pItemsTable->GenerateItem(this->pMonsterInfo.uTreasureLevel, this->pMonsterInfo.uTreasureType, &this->ActorHasItems[2]);
   }
   this->uAttributes |= 0x800000;
 }
@@ -1950,7 +1950,7 @@
   pActor->uCurrentActionAnimation = ANIM_Dying;
   pActor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[pActor->pSpriteIDs[ANIM_Dying]].uAnimLength;
   pActor->sCurrentHP = LOWORD(pActor->pMonsterInfo.uHP);
-  Actor::PlaySound(uActorID, 1u);
+  Actor::PlaySound(uActorID, 1);
   pActor->UpdateAnimation();
 }
 
@@ -3909,10 +3909,10 @@
     }
   else
   {
-    if ( this->array_000234[3].uItemID != 0 &&  this->array_000234[3].GetItemEquipType() == EQUIP_GOLD )
+    if ( this->ActorHasItems[3].uItemID != 0 &&  this->ActorHasItems[3].GetItemEquipType() == EQUIP_GOLD )
     {
-      v14 = this->array_000234[3].uSpecEnchantmentType;
-      this->array_000234[3].Reset();
+      v14 = this->ActorHasItems[3].uSpecEnchantmentType;
+      this->ActorHasItems[3].Reset();
       if ( v14 )
       {
         pParty->PartyFindsGold(v14, 0);
@@ -3929,7 +3929,7 @@
       sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v9);
     else
       sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v9);
-    ShowStatusBarString(pTmpBuf2.data(), 2u);
+    ShowStatusBarString(pTmpBuf2.data(), 2);
     if ( Dst.GetItemEquipType() == 12 )
     {
       Dst.uNumCharges = rand() % 6 + Dst.GetDamageMod() + 1;
@@ -3941,33 +3941,33 @@
     if ( !pParty->AddItemToParty(&Dst) )
       pParty->SetHoldingItem(&Dst);
     this->uCarriedItemID = 0;
-    if ( this->array_000234[0].uItemID )
+    if ( this->ActorHasItems[0].uItemID )
     {
-      if ( !pParty->AddItemToParty(this->array_000234) )
+      if ( !pParty->AddItemToParty(this->ActorHasItems) )
       {
         pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
-        pParty->SetHoldingItem(this->array_000234);
+        pParty->SetHoldingItem(this->ActorHasItems);
       }
-      this->array_000234[0].Reset();
+      this->ActorHasItems[0].Reset();
     }
-    if ( this->array_000234[1].uItemID )
+    if ( this->ActorHasItems[1].uItemID )
     {
-      if ( !pParty->AddItemToParty(&this->array_000234[1]) )
+      if ( !pParty->AddItemToParty(&this->ActorHasItems[1]) )
       {
         pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
-        pParty->SetHoldingItem(&this->array_000234[1]);
+        pParty->SetHoldingItem(&this->ActorHasItems[1]);
       }
-      this->array_000234[1].Reset();
+      this->ActorHasItems[1].Reset();
     }
     this->Remove();
     return;
   }
   if ( ( this->uAttributes & 0x800000 ) )
   {
-    if ( this->array_000234[3].uItemID )
+    if ( this->ActorHasItems[3].uItemID )
     {
-      memcpy(&Dst, &this->array_000234[3], sizeof(Dst));
-      this->array_000234[3].Reset();
+      memcpy(&Dst, &this->ActorHasItems[3], sizeof(Dst));
+      this->ActorHasItems[3].Reset();
       v11 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
       if ( v14 )
         sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v11);
@@ -3995,25 +3995,25 @@
       itemFound = true;
     }
   }
-  if ( this->array_000234[0].uItemID )
+  if ( this->ActorHasItems[0].uItemID )
   {
-    if ( !pParty->AddItemToParty(this->array_000234) )
+    if ( !pParty->AddItemToParty(this->ActorHasItems) )
     {
       pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
-      pParty->SetHoldingItem(this->array_000234);
+      pParty->SetHoldingItem(this->ActorHasItems);
       itemFound = true;
     }
-    this->array_000234[0].Reset();
+    this->ActorHasItems[0].Reset();
   }
-  if ( this->array_000234[1].uItemID )
+  if ( this->ActorHasItems[1].uItemID )
   {
-    if ( !pParty->AddItemToParty(&this->array_000234[1]) )
+    if ( !pParty->AddItemToParty(&this->ActorHasItems[1]) )
     {
       pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
-      pParty->SetHoldingItem(&this->array_000234[1]);
+      pParty->SetHoldingItem(&this->ActorHasItems[1]);
       itemFound = true;
     }
-    this->array_000234[1].Reset();
+    this->ActorHasItems[1].Reset();
   }
   if ( !itemFound || rand() % 100 < 90 )
     this->Remove();
--- a/Actor.h	Fri Mar 14 09:32:42 2014 +0600
+++ b/Actor.h	Fri Mar 14 10:47:22 2014 +0600
@@ -162,40 +162,23 @@
 #pragma pack(push, 1)
 struct Actor
 {
-  //----- (0041F4C1) --------------------------------------------------------
+//----- (0041F4C1) --------------------------------------------------------
   inline Actor()
   {
-    Actor *v1; // esi@1
-    SpellBuff *v2; // eax@1
-    signed int v3; // edx@1
-    ItemGen *v4; // edi@3
-    signed int v5; // ebx@3
+    signed int i; // edx@1
 
-  v1 = this;
-  v2 = this->pActorBuffs;
-  v3 = 22;
-  do
-  {
-    v2->uSkill = 0;
-    v2->uPower = 0;
-    v2->uExpireTime = 0;
-    v2->uCaster = 0;
-    v2->uFlags = 0;
-    ++v2;
-    --v3;
+    for ( i = 0; i < 22; i++ )
+    {
+      this->pActorBuffs[i].uSkill = 0;
+      this->pActorBuffs[i].uPower = 0;
+      this->pActorBuffs[i].uExpireTime = 0;
+      this->pActorBuffs[i].uCaster = 0;
+      this->pActorBuffs[i].uFlags = 0;
+    }
+    for ( i = 0; i < 4; i++ )
+      this->ActorHasItems[i].Reset();
+    Reset();
   }
-  while ( v3 );
-  v4 = this->array_000234;
-  v5 = 4;
-  do
-  {
-    v4->Reset();
-    ++v4;
-    --v5;
-  }
-  while ( v5 );
-  Reset();
-}
 
   void SummonMinion(int summonerId);
   void Reset();
@@ -286,7 +269,7 @@
   unsigned __int16 pSpriteIDs[8];
   unsigned __int16 pSoundSampleIDs[4]; // 1 die     3 bored
   struct SpellBuff pActorBuffs[22];
-  struct ItemGen array_000234[4];
+  struct ItemGen ActorHasItems[4];
   unsigned int uGroup;
   unsigned int uAlly;
   struct ActorJob pScheduledJobs[8];
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj	Fri Mar 14 09:32:42 2014 +0600
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj	Fri Mar 14 10:47:22 2014 +0600
@@ -164,6 +164,7 @@
     <ClCompile Include="..\..\LOD.cpp" />
     <ClCompile Include="..\..\Log.cpp" />
     <ClCompile Include="..\..\LuaVM.cpp" />
+    <ClCompile Include="..\..\MapInfo.cpp" />
     <ClCompile Include="..\..\mm7text_ru.cpp" />
     <ClCompile Include="..\..\mm7_2.cpp" />
     <ClCompile Include="..\..\mm7_3.cpp" />
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters	Fri Mar 14 09:32:42 2014 +0600
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters	Fri Mar 14 10:47:22 2014 +0600
@@ -876,6 +876,7 @@
     <ClCompile Include="..\..\Timer.cpp" />
     <ClCompile Include="..\..\LuaVM.cpp" />
     <ClCompile Include="..\..\Player_wrap.cxx" />
+    <ClCompile Include="..\..\MapInfo.cpp" />
   </ItemGroup>
   <ItemGroup>
     <CustomBuild Include="..\..\NewUI\Core\UIControlModule.swig">
--- a/CastSpellInfo.cpp	Fri Mar 14 09:32:42 2014 +0600
+++ b/CastSpellInfo.cpp	Fri Mar 14 10:47:22 2014 +0600
@@ -2145,8 +2145,8 @@
           if ( !(pActors[mon_id].uAttributes & 0x800000) )
             pActors[mon_id].SetRandomGoldIfTheresNoItem();
           int gold_num = 0;
-          if ( pItemsTable->pItems[pActors[mon_id].array_000234[3].uItemID].uEquipType == EQUIP_GOLD )
-            gold_num = pActors[mon_id].array_000234[3].uSpecEnchantmentType;
+          if ( pItemsTable->pItems[pActors[mon_id].ActorHasItems[3].uItemID].uEquipType == EQUIP_GOLD )
+            gold_num = pActors[mon_id].ActorHasItems[3].uSpecEnchantmentType;
           ItemGen item;
           item.Reset();
           if (pActors[mon_id].uCarriedItemID)
@@ -2155,9 +2155,9 @@
           {
             for ( uint i = 0; i < 4; ++i )
             {
-              if ( pActors[mon_id].array_000234[i].uItemID > 0 && pItemsTable->pItems[pActors[mon_id].array_000234[i].uItemID].uEquipType != EQUIP_GOLD )
+              if ( pActors[mon_id].ActorHasItems[i].uItemID > 0 && pItemsTable->pItems[pActors[mon_id].ActorHasItems[i].uItemID].uEquipType != EQUIP_GOLD )
               {
-                memcpy(&item, &pActors[mon_id].array_000234[i], sizeof(item));
+                memcpy(&item, &pActors[mon_id].ActorHasItems[i], sizeof(item));
                 spell_level = v723;
               }
             }
--- a/DecorationList.cpp	Fri Mar 14 09:32:42 2014 +0600
+++ b/DecorationList.cpp	Fri Mar 14 10:47:22 2014 +0600
@@ -143,6 +143,7 @@
       //v22 = v42.pProperties[9];
       v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = atoi(v42.pProperties[8]);
       v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v42.pProperties[9]);
+      __debugbreak();//Ritor1: need cleaning
       v25 = __OFSUB__(v42.uPropCount, 10);
       v23 = v42.uPropCount == 10;
       v24 = v42.uPropCount - 10 < 0;
--- a/Indoor.cpp	Fri Mar 14 09:32:42 2014 +0600
+++ b/Indoor.cpp	Fri Mar 14 10:47:22 2014 +0600
@@ -2746,9 +2746,9 @@
       pActors[actor_id].uSectorID = v5;
       v56 = BLV_GetFloorLevel(pActors[actor_id].vPosition.x, pActors[actor_id].vPosition.y, pActors[actor_id].vPosition.z, v5, &uFaceID);
       if ( !v5 || v56 == -30000 )
-        goto LABEL_123;
+        continue;
     }
-    if ( pActors[actor_id].uCurrentActionAnimation == ANIM_Walking)
+    if ( pActors[actor_id].uCurrentActionAnimation == ANIM_Walking)//монстр двигается
     {
       v6 = pActors[actor_id].uMovementSpeed;
       if ( pActors[actor_id].pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 )
@@ -2770,7 +2770,7 @@
       if ( v62 )
         pActors[actor_id].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pActors[actor_id].uPitchAngle), v6);
     }
-    else
+    else//actor is not moving(актор не двигается)
     {
       pActors[actor_id].vVelocity.x = fixpoint_mul(55000, pActors[actor_id].vVelocity.x);
       pActors[actor_id].vVelocity.y = fixpoint_mul(55000, pActors[actor_id].vVelocity.y);
@@ -2877,7 +2877,7 @@
                 pActors[actor_id].vPosition.y = LOWORD(stru_721530.normal2.y);
                 pActors[actor_id].vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1;
                 pActors[actor_id].uSectorID = LOWORD(stru_721530.uSectorID);
-                goto LABEL_123;
+                continue;
               }
               pActors[actor_id].vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
               pActors[actor_id].vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
@@ -3036,11 +3036,11 @@
           else
           {
             if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->turn_stage == TE_MOVEMENT) )
-              goto LABEL_123;
+              continue;
             if ( !pActors[actor_id].pMonsterInfo.uHostilityType || v56 != v22 )
             {
               Actor::AI_StandOrBored(actor_id, 4, v22, &v52);
-              goto LABEL_123;
+              continue;
             }
           }
         }
@@ -3057,8 +3057,8 @@
           pActors[actor_id].uAIState = Removed;
       }
     }
-LABEL_123:
-    ;
+//LABEL_123:
+    //;
   }
 }
 
@@ -4101,7 +4101,6 @@
     return;
   }
 
-
   if (pDecorationList->pDecorations[pLevelDecorations[uDecorationID].uDecorationDescID].uFlags & DECORATION_DESC_DONT_DRAW)
     return;
 
--- a/Player.cpp	Fri Mar 14 09:32:42 2014 +0600
+++ b/Player.cpp	Fri Mar 14 10:47:22 2014 +0600
@@ -2021,12 +2021,12 @@
       enchBonusSum = 0;
       for (int i = 0; i < v7; i++)
         enchBonusSum += rand() % StealingEnchantmentBonusForSkill[stealingMastery] + 1;
-      if ( actroPtr->array_000234[3].GetItemEquipType() != EQUIP_GOLD )
+      if ( actroPtr->ActorHasItems[3].GetItemEquipType() != EQUIP_GOLD )
         return 2;
-      enchTypePtr = &actroPtr->array_000234[3].uSpecEnchantmentType;
+      enchTypePtr = &actroPtr->ActorHasItems[3].uSpecEnchantmentType;
       if ( (int)enchBonusSum >= *enchTypePtr )
       {
-        actroPtr->array_000234[3].uItemID = 0;
+        actroPtr->ActorHasItems[3].uItemID = 0;
         *enchTypePtr = 0;
       }
       else
@@ -2048,7 +2048,7 @@
       int i;
       for (i = 0; i < 4; i++)
       {
-        if ( actroPtr->array_000234[i].uItemID != 0 && actroPtr->array_000234[i].GetItemEquipType() != EQUIP_GOLD )
+        if ( actroPtr->ActorHasItems[i].uItemID != 0 && actroPtr->ActorHasItems[i].GetItemEquipType() != EQUIP_GOLD )
           break;
       }
       if (i == 4)
@@ -2068,7 +2068,7 @@
         }
         else
         {
-          ItemGen* itemToSteal = &actroPtr->array_000234[rand() % 4];
+          ItemGen* itemToSteal = &actroPtr->ActorHasItems[rand() % 4];
           memcpy(&tempItem, itemToSteal, sizeof(tempItem));
           itemToSteal->Reset();
           carriedItemId = tempItem.uItemID;
@@ -2413,11 +2413,11 @@
         break;
       case SPECIAL_ATTACK_STEAL:
         PlaySound(SPEECH_40, 0);
-        v27 = pActor->array_000234;
-        if ( pActor->array_000234[0].uItemID )
+        v27 = pActor->ActorHasItems;
+        if ( pActor->ActorHasItems[0].uItemID )
         {
-          v27 = &pActor->array_000234[1];
-          if ( pActor->array_000234[1].uItemID )
+          v27 = &pActor->ActorHasItems[1];
+          if ( pActor->ActorHasItems[1].uItemID )
           {
             pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
             return 1;
--- a/mm7_3.cpp	Fri Mar 14 09:32:42 2014 +0600
+++ b/mm7_3.cpp	Fri Mar 14 10:47:22 2014 +0600
@@ -699,13 +699,9 @@
     {
       v8 = pActors[v75].uMovementSpeed;
       if ( (signed __int64)pActors[v75].pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 )
-      {
         v8 = (signed __int64)((double)v8 * 0.5);
-      }
       if ( pActors[v75].uAIState == Fleeing || pActors[v75].uAIState == Pursuing )
-      {
         v8 *= 2;
-      }
       if ( pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == TE_WAIT )
         v8 *= flt_6BE3AC_debug_recmod1_x_1_6;
       if ( v8 > 1000 )