diff Player.cpp @ 310:4c2cdda88562

m
author Gloval
date Wed, 20 Feb 2013 01:40:18 +0400
parents b0db84628733
children e41fe9cf3613
line wrap: on
line diff
--- a/Player.cpp	Wed Feb 20 00:28:52 2013 +0400
+++ b/Player.cpp	Wed Feb 20 01:40:18 2013 +0400
@@ -8301,7 +8301,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 +8328,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 +8764,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 +8793,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 +8805,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 +8992,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 +9075,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 +9099,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 +9145,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 +9193,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 +9224,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 +9256,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;