diff Player.cpp @ 333:405d0c4dd1b3

Слияние
author Ritor1
date Wed, 20 Feb 2013 20:51:55 +0600
parents 72de4ad353c6 8e23edf57e27
children d27e30e0158a
line wrap: on
line diff
--- a/Player.cpp	Wed Feb 20 20:50:22 2013 +0600
+++ b/Player.cpp	Wed Feb 20 20:51:55 2013 +0600
@@ -620,7 +620,7 @@
       {
         pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998;
         v12 = (8 * pPlayerNum + 312) | OBJECT_Player;
-        pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, (pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0), 0);
+        pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
       }
     }
   }
@@ -1859,7 +1859,7 @@
       return result;
   }
 LABEL_16:
-  if ( BYTE1(pItem->uAttributes) & 1 )
+  if (pItem->Stolen())
     return 6;
 LABEL_26:
   //v14 = &p2DEvents_minus1__20[13 * a4];
@@ -1872,7 +1872,7 @@
     v23 = *v14;
     v24 = pItem->GetValue();
     v17 = v27->_4B8102(v24, v23);
-    if ( !(pItem->uAttributes & 2) )
+    if (!pItem->Broken())
       goto LABEL_39;
     goto LABEL_38;
   }
@@ -1895,7 +1895,7 @@
   v18 = *v14;
   v19 = pItem->GetValue();
   v17 = v27->_4B8102(v19, v18) / 2;
-  if ( pItem->uAttributes & 2 )
+  if (pItem->Broken())
     v17 = 1;
   if ( v17 >= 1 )
     goto LABEL_39;
@@ -2339,7 +2339,7 @@
   v20 = thos;
   v2 = pItem->uItemID;
   if ( !pItemsTable->pItems[v2].uItemID_Rep_St )
-    pItem->uAttributes |= 1u;
+    pItem->SetIdentified();
   ///v15 = 0;
   //v16 = 1;
   //v18 = 3;
@@ -3509,7 +3509,7 @@
     v10 = v5->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation);
     if ( rand() % 100 < 5 || v10 > v29 + v7 * v30 || (_steal_perma = 2, BYTE2(v5->uAttributes) & 8) )
     {
-      Actor::_43AC45(uActorID, 1);
+      Actor::AggroSurroundingPeasants(uActorID, 1);
       _steal_perma = 0;
       v26 = (int)v31->pName;
       v25 = pGlobalTXT_LocalizationStrings[376];
@@ -3796,7 +3796,7 @@
       v13 = this->pInventoryItems;
       do
       {
-        if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !(v13->uAttributes & 2) )
+        if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken())
           v46[v4++] = v12;
         ++v12;
         ++v13;
@@ -4054,6 +4054,7 @@
   }
   return result;
 }
+
 // 48DCF6: using guessed type char var_94[140];
 
 //----- (0048E1A3) --------------------------------------------------------
@@ -7542,7 +7543,7 @@
       goto LABEL_92;
     }
     v15 = pParty->pPickedItem.uItemID - 400;
-    v72 = (char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2;
+    v72 = (char *)&v3->spellbook.pFireSpellbook+pParty->pPickedItem.uItemID-400;//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2;
     if ( *v72 )
     {
       v66 = pParty->pPickedItem.GetDisplayName();
@@ -8301,7 +8302,7 @@
       }
       if ( var <= VAR_Counter8 )
       {
-        if ( (signed int)var >= 245 )
+        if ( (signed int)var >= 0xF5 )
         {
           *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed);
           *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed);
@@ -8328,7 +8329,7 @@
       }
       if ( var < VAR_Counter9 )
         return;
-      if ( (signed int)var <= 274 )
+      if ( (signed int)var <= 0x112 )
       {
         *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed);
         *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed);
@@ -8764,7 +8765,7 @@
 
 
 //----- (0044AFFB) --------------------------------------------------------
-void Player::AddVariable(enum VariableType var, signed int val)
+void Player::AddVariable(enum VariableType var_type, signed int val)
 {
   char v3; // bl@1
   Player *v4; // esi@1
@@ -8793,7 +8794,7 @@
   DDM_DLV_Header *v27; // eax@153
   signed int v28; // eax@176
   int v29; // [sp-8h] [bp-40h]@84
-  signed int v30; // [sp-4h] [bp-3Ch]@4
+ // signed int v30; // [sp-4h] [bp-3Ch]@4
   int v31; // [sp-4h] [bp-3Ch]@84
   ItemGen item; // [sp+Ch] [bp-2Ch]@45
   unsigned int v33; // [sp+30h] [bp-8h]@34
@@ -8805,31 +8806,21 @@
   v4 = Dst;
   uPlayerIdx = 0;
   if ( Dst == pPlayers[2] )
-  {
     uPlayerIdx = 1;
-    goto LABEL_8;
-  }
-  if ( Dst == pPlayers[3] )
-  {
-    v30 = 2;
-  }
-  else
-  {
-    if ( Dst != pPlayers[4] )
-      goto LABEL_8;
-    v30 = 3;
-  }
-  uPlayerIdx = v30;
-LABEL_8:
-  if ( var <= VAR_AutoNotes )
-  {
-    if ( var != VAR_AutoNotes )
-    {
-      if ( var <= VAR_ActualMight )
-      {
-        if ( var != VAR_ActualMight )
+  else if ( Dst == pPlayers[3] )
+    uPlayerIdx = 2;
+  else if ( Dst == pPlayers[4] )  
+    uPlayerIdx = 3;
+ 
+  if ( var_type <= VAR_AutoNotes )
+  {
+    if ( var_type != VAR_AutoNotes )
+    {
+      if ( var_type <= VAR_ActualMight )
+      {
+        if ( var_type != VAR_ActualMight )
         {
-          switch ( var )
+          switch ( var_type )
           {
             case VAR_RandomGold:
               if ( !val )
@@ -9002,11 +8993,11 @@
         v19 = (__int16 *)&Dst->uMightBonus;
         goto LABEL_113;
       }
-      if ( var <= VAR_FireResistanceBonus )
-      {
-        if ( var != VAR_FireResistanceBonus )
+      if ( var_type <= VAR_FireResistanceBonus )
+      {
+        if ( var_type != VAR_FireResistanceBonus )
         {
-          switch ( var )
+          switch ( var_type )
           {
             case VAR_ActualIntellect:
 LABEL_66:
@@ -9085,13 +9076,13 @@
         pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31);
         goto _play_anim_and_maybe_sound;
       }
-      if ( var <= VAR_DisarmTrapSkill )
-      {
-        if ( var != VAR_DisarmTrapSkill )
+      if ( var_type <= VAR_DisarmTrapSkill )
+      {
+        if ( var_type != VAR_DisarmTrapSkill )
         {
-          if ( var <= VAR_BodyResistanceBonus )
+          if ( var_type <= VAR_BodyResistanceBonus )
           {
-            switch ( var )
+            switch ( var_type )
             {
               case VAR_BodyResistanceBonus:
                 v19 = &Dst->sResBodyBonus;
@@ -9109,43 +9100,43 @@
                 v19 = &Dst->sResSpiritBonus;
                 break;
               default:
-                if ( var != 62 )
+                if ( var_type != 62 )
                   return;
                 v19 = &Dst->sResMindBonus;
                 break;
             }
             goto LABEL_113;
           }
-          if ( var == VAR_LightResistanceBonus )
+          if ( var_type == VAR_LightResistanceBonus )
           {
             v19 = &Dst->sResLightBonus;
             goto LABEL_113;
           }
-          if ( var == VAR_DarkResistanceBonus )
+          if ( var_type == VAR_DarkResistanceBonus )
           {
             v19 = &Dst->sResDarkBonus;
             goto LABEL_113;
           }
-          if ( var == VAR_MagicResistanceBonus )
+          if ( var_type == VAR_MagicResistanceBonus )
           {
             v19 = &Dst->sResMagicBonus;
             goto LABEL_113;
           }
-          if ( var <= VAR_MagicResistanceBonus || var > VAR_DiplomacySkill )
+          if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill )
             return;
         }
         goto LABEL_106;
       }
-      if ( var == VAR_LearningSkill )
+      if ( var_type == VAR_LearningSkill )
       {
 LABEL_106:
         if ( val <= VAR_BodyResistanceBonus )
         {
-          *((short *)&Dst->pConditions[16] + var) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var) & VAR_BodyResistanceBonus;
+          *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus;
         }
         else
         {
-          v20 = (char *)&Dst->pConditions[16] + 2 * var;
+          v20 = (char *)&Dst->pConditions[16] + 2 * var_type;
           v21 = *(short *)v20;
           v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus);
           if ( v22 > 60 )
@@ -9155,22 +9146,22 @@
         }
         goto _play_anim_and_exit;
       }
-      if ( var <= VAR_LearningSkill )
+      if ( var_type <= VAR_LearningSkill )
         return;
-      if ( var <= VAR_Eradicated )
-      {
-        Dst->SetCondition(var - 105, 0);
+      if ( var_type <= VAR_Eradicated )
+      {
+        Dst->SetCondition(var_type - 105, 0);
       }
       else
       {
-        if ( var != VAR_MajorCondition )
+        if ( var_type != VAR_MajorCondition )
         {
-          if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells )
+          if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells )
           {
-            if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var] <= 255 )
-              byte_5E4C15[var] += val;
+            if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 )
+              byte_5E4C15[var_type] += val;
             else
-              byte_5E4C15[var] = -1;
+              byte_5E4C15[var_type] = -1;
           }
           return;
         }
@@ -9203,14 +9194,14 @@
       goto _maybe_play_sound;
     goto _play_anim_and_maybe_sound;
   }
-  if ( var > VAR_GoldInBank )
-  {
-    if ( var == 307 )
+  if ( var_type > VAR_GoldInBank )
+  {
+    if ( var_type == 307 )
     {
       pParty->uNumDeaths += val;
       goto LABEL_173;
     }
-    switch ( var )
+    switch ( var_type )
     {
       case 308:
         pParty->uNumBountiesCollected += val;
@@ -9234,21 +9225,21 @@
   }
   else
   {
-    if ( var == VAR_GoldInBank )
+    if ( var_type == VAR_GoldInBank )
     {
       pParty->uNumGoldInBank += val;
       return;
     }
-    if ( var <= VAR_Counter8 )
-    {
-      if ( (signed int)var >= 245 )
-      {
-        *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed);
-        *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed);
+    if ( var_type <= VAR_Counter8 )
+    {
+      if ( (signed int)var_type >= 245 )
+      {
+        *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed);
+        *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed);
       }
       else
       {
-        switch ( var )
+        switch ( var_type )
         {
           case VAR_MonthEquals|VAR_CurrentSP:
             _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u);
@@ -9266,22 +9257,22 @@
       }
       return;
     }
-    if ( var < VAR_Counter9 )
+    if ( var_type < VAR_Counter9 )
       return;
-    if ( (signed int)var <= 274 )
-    {
-      *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed);
-      *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed);
+    if ( (signed int)var_type <= 274 )
+    {
+      *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);
+      *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed);
       goto _play_sound;
     }
-    if ( var != VAR_ReputationInCurrentLocation )
-    {
-      if ( var <= VAR_ReputationInCurrentLocation
-        || var > VAR_History_28
-        || (v25 = var - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25])
-        || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed),
+    if ( var_type != VAR_ReputationInCurrentLocation )
+    {
+      if ( var_type <= VAR_ReputationInCurrentLocation
+        || var_type > VAR_History_28
+        || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25])
+        || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed),
             v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0,
-            pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed),
+            pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed),
             v26) )
         return;
       bFlashHistoryBook = 1;