changeset 1777:47606ed5ffba

Player::SetVariable trivial variable substitution
author Grumpy7
date Wed, 02 Oct 2013 07:03:23 +0200
parents 0f273c459f78
children 4e881879e259
files Player.cpp
diffstat 1 files changed, 121 insertions(+), 266 deletions(-) [+]
line wrap: on
line diff
--- a/Player.cpp	Wed Oct 02 05:47:30 2013 +0200
+++ b/Player.cpp	Wed Oct 02 07:03:23 2013 +0200
@@ -5417,23 +5417,17 @@
 void Player::SetVariable(enum VariableType var_type, signed int var_value)
 {
   signed int currPlayerId; // ebx@1
-  Player *v4; // esi@1
-  unsigned int v5; // edi@1
   unsigned int v6; // esi@13
   unsigned int v7; // esi@14
   signed int v8; // eax@17
   ItemGen *v9; // ecx@17
   int v10; // eax@21
   signed int v11; // eax@30
-  Player *v12; // ecx@44
   char *v13; // ecx@45
-  Player *v14; // ecx@49
   int v15; // ecx@86
   int v16; // esi@106
   char v17; // al@106
   int v18; // eax@107
-  Player *v19; // ecx@112
-  Player *v20; // ecx@127
   int v21; // eax@127
   int v22; // eax@145
   char v23; // zf@146
@@ -5441,7 +5435,6 @@
   signed int v25; // eax@172
   int v26; // [sp-8h] [bp-3Ch]@84
   signed int v27; // [sp-4h] [bp-38h]@4
-  int v28; // [sp-4h] [bp-38h]@84
   ItemGen item; // [sp+Ch] [bp-28h]@52
   char v30; // [sp+32h] [bp-2h]@1
   char v31; // [sp+33h] [bp-1h]@1
@@ -5449,8 +5442,6 @@
   currPlayerId = 0;
   v30 = 0;
   v31 = 0;
-  v4 = this;
-  v5 = 0;
   if ( this == pPlayers[2] )
     currPlayerId = 1;
   else if ( this == pPlayers[3] )
@@ -5520,7 +5511,7 @@
       }
       v25 = 8 * currPlayerId + 400;
       LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+      pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
       return;
     }
     if ( var_type != 307 )
@@ -5553,19 +5544,17 @@
     {
       if ( v31 != 1 )
         return;
-      v5 = 0;
       v25 = 8 * currPlayerId + 400;
       LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+      pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
       return;
     }
     pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
     if ( v31 != 1 )
       return;
-    v5 = 0;
     v25 = 8 * currPlayerId + 400;
     LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-    pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+    pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
     return;
   }
   if ( var_type == VAR_AutoNotes )
@@ -5574,10 +5563,9 @@
       //&& (&dword_723718_autonote_related)[8 * a3] )
 	  && pAutonoteTxt[var_value-1].pText )
     {
-      v20 = pPlayers[currPlayerId + 1];
       v30 = 1;
-      v20->PlaySound(SPEECH_96, 0);
-	  v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3];
+      this->PlaySound(SPEECH_96, 0);
+	    v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3];
       bFlashAutonotesBook = 1;
       _506568_autonote_type = v21;
     }
@@ -5587,19 +5575,17 @@
     {
       if ( v31 != 1 )
         return;
-      v5 = 0;
       v25 = 8 * currPlayerId + 400;
       LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+      pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
       return;
     }
     pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
     if ( v31 != 1 )
       return;
-    v5 = 0;
     v25 = 8 * currPlayerId + 400;
     LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-    pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+    pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
     return;
   }
   if ( var_type <= VAR_ActualMight )
@@ -5625,10 +5611,9 @@
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_Sex:
           this->uSex = (PLAYER_SEX)var_value;
@@ -5636,10 +5621,9 @@
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_Class:
           this->classType = (PLAYER_CLASS_TYPE)var_value;
@@ -5649,10 +5633,9 @@
             pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
             if ( v31 != 1 )
               return;
-            v5 = 0;
             v25 = 8 * currPlayerId + 400;
             LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-            pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+            pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
             return;
           }
           v8 = 0;
@@ -5664,10 +5647,9 @@
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_MaxHP:
           this->sHealth = GetMaxHealth();
@@ -5678,10 +5660,9 @@
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_MaxSP:
           this->sMana = GetMaxMana();
@@ -5692,10 +5673,9 @@
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_BaseLevel:
           this->uLevel = (unsigned __int8)var_value;
@@ -5703,10 +5683,9 @@
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_LevelModifier:
           this->sLevelModifier = (unsigned __int8)var_value;
@@ -5714,43 +5693,42 @@
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_Age:
           this->sAgeModifier = var_value;
           return;
         case VAR_Award:
           if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & 
-			  pPlayers[currPlayerId + 1]->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8])
+			  this->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8])
             //&& dword_723E80_award_related[2 * a3] )
 			&& pAwards[var_value].pText )
           {
             v30 = 1;
             v31 = 1;
-            pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0);
+            this->PlaySound(SPEECH_96, 0);
           }
-          _449B7E_toggle_bit((unsigned char *)v4->_achieved_awards_bits, var_value, 1u);
+          _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, var_value, 1u);
           if ( v30 != 1 )
           {
             if ( v31 == 1 )
             {
-              v5 = 0;
               v25 = 8 * currPlayerId + 400;
               LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-              pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+              pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
               return;
             }
+            return;
           }
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 == 1 )
           {
-            v5 = 0;
             v25 = 8 * currPlayerId + 400;
             LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-            pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+            pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+            return;
           }
           return;
         case VAR_Experience:
@@ -5759,41 +5737,38 @@
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_QBits_QuestsDone:
           if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3])
            // && (&dword_722F10)[4 * a3] )
 		   && pQuestTable[var_value-1] )
           {
-            v14 = pPlayers[currPlayerId + 1];
             bFlashQuestBook = 1;
             v30 = 1;
             v31 = 1;
-            v14->PlaySound(SPEECH_93, 0);
+            this->PlaySound(SPEECH_93, 0);
           }
           _449B7E_toggle_bit((unsigned char *)pParty->_quest_bits, var_value, 1u);
           if ( v30 != 1 )
           {
             if ( v31 == 1 )
             {
-              v5 = 0;
               v25 = 8 * currPlayerId + 400;
               LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-              pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+              pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
               return;
             }
+            return;
           }
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 == 1 )
           {
-            v5 = 0;
             v25 = 8 * currPlayerId + 400;
             LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-            pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+            pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           }
           return;
         case VAR_PlayerItemInHands:
@@ -5810,108 +5785,80 @@
           return;
         case VAR_BaseMight:
           this->uMight = (unsigned __int8)var_value;
-          v28 = 0;
-          v26 = 92;
-          v19 = pPlayers[currPlayerId + 1];
           v31 = 1;
-          v19->PlaySound((PlayerSpeech)v26, v28);
+          this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_BaseIntellect:
           this->uIntelligence = (unsigned __int8)var_value;
-          v28 = 0;
-          v26 = 92;
-          v19 = pPlayers[currPlayerId + 1];
           v31 = 1;
-          v19->PlaySound((PlayerSpeech)v26, v28);
+          this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_BasePersonality:
           this->uWillpower = (unsigned __int8)var_value;
-          v28 = 0;
-          v26 = 92;
-          v19 = pPlayers[currPlayerId + 1];
           v31 = 1;
-          v19->PlaySound((PlayerSpeech)v26, v28);
+          this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_BaseEndurance:
           this->uEndurance = (unsigned __int8)var_value;
-          v28 = 0;
-          v26 = 92;
-          v19 = pPlayers[currPlayerId + 1];
           v31 = 1;
-          v19->PlaySound((PlayerSpeech)v26, v28);
+          this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_BaseSpeed:
           this->uSpeed = (unsigned __int8)var_value;
-          v28 = 0;
-          v26 = 92;
-          v19 = pPlayers[currPlayerId + 1];
           v31 = 1;
-          v19->PlaySound((PlayerSpeech)v26, v28);
+          this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_BaseAccuracy:
           this->uAccuracy = (unsigned __int8)var_value;
-          v28 = 0;
-          v26 = 92;
-          v19 = pPlayers[currPlayerId + 1];
           v31 = 1;
-          v19->PlaySound((PlayerSpeech)v26, v28);
+          this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_BaseLuck:
           this->uLuck = (unsigned __int8)var_value;
-          v28 = 0;
-          v26 = 92;
-          v19 = pPlayers[currPlayerId + 1];
           v31 = 1;
-          v19->PlaySound((PlayerSpeech)v26, v28);
+          this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_FixedFood:
           Party::SetFood(var_value);
@@ -5919,10 +5866,9 @@
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
           if ( v31 != 1 )
             return;
-          v5 = 0;
           v25 = 8 * currPlayerId + 400;
           LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
           return;
         case VAR_MightBonus:
           goto LABEL_64;
@@ -5948,58 +5894,53 @@
         if ( v8 >= 138 )
           goto LABEL_22;
       }
-      v10 = (int)((char *)v4 + 36 * v8);
+      v10 = (int)((char *)this + 36 * v8);
       *(int *)(v10 + 532) = 601;
       *(char *)(v10 + 558) = currPlayerId + 1;
 LABEL_22:
-      if ( v4->sResFireBase < 20 )
-        v4->sResFireBase = 20;
-      if ( v4->sResAirBase < 20 )
-        v4->sResAirBase = 20;
-      if ( v4->sResWaterBase < 20 )
-        v4->sResWaterBase = 20;
-      if ( v4->sResEarthBase < 20 )
-        v4->sResEarthBase = 20;
-      v4->sResMindBase = 200;
-      v4->sResBodyBase = 200;
-      v11 = v4->GetSexByVoice();
-      v4->uPrevVoiceID = v4->uVoiceID;
-      v4->uPrevFace = v4->uCurrentFace;
+      if ( this->sResFireBase < 20 )
+        this->sResFireBase = 20;
+      if ( this->sResAirBase < 20 )
+        this->sResAirBase = 20;
+      if ( this->sResWaterBase < 20 )
+        this->sResWaterBase = 20;
+      if ( this->sResEarthBase < 20 )
+        this->sResEarthBase = 20;
+      this->sResMindBase = 200;
+      this->sResBodyBase = 200;
+      v11 = this->GetSexByVoice();
+      this->uPrevVoiceID = this->uVoiceID;
+      this->uPrevFace = this->uCurrentFace;
       if ( v11 )
       {
-        v4->uCurrentFace = 21;
-        v4->uVoiceID = 21;
+        this->uCurrentFace = 21;
+        this->uVoiceID = 21;
       }
       else
       {
-        v4->uCurrentFace = 20;
-        v4->uVoiceID = 20;
-      }
-      ReloadPlayerPortraits(currPlayerId, v4->uCurrentFace);
+        this->uCurrentFace = 20;
+        this->uVoiceID = 20;
+      }
+      ReloadPlayerPortraits(currPlayerId, this->uCurrentFace);
       v31 = 1;
       pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
       if ( v31 != 1 )
         return;
-      v5 = 0;
       v25 = 8 * currPlayerId + 400;
       LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+      pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
       return;
     }
 LABEL_64:
     this->uMightBonus = (unsigned __int8)var_value;
-    v28 = 0;
-    v26 = SPEECH_91;
-    v19 = pPlayers[currPlayerId + 1];
     v31 = 1;
-    v19->PlaySound((PlayerSpeech)v26, v28);
+    this->PlaySound(SPEECH_91, 0);
     pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
     if ( v31 != 1 )
       return;
-    v5 = 0;
     v25 = 8 * currPlayerId + 400;
     LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-    pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+    pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
     return;
   }
   if ( var_type <= VAR_FireResistanceBonus )
@@ -6007,18 +5948,14 @@
     if ( var_type == VAR_FireResistanceBonus )
     {
       this->sResFireBonus = (unsigned __int8)var_value;
-      v28 = 0;
-      v26 = SPEECH_91;
-      v19 = pPlayers[currPlayerId + 1];
       v31 = 1;
-      v19->PlaySound((PlayerSpeech)v26, v28);
+      this->PlaySound(SPEECH_91, 0);
       pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
       if ( v31 != 1 )
         return;
-      v5 = 0;
       v25 = 8 * currPlayerId + 400;
       LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+      pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
       return;
     }
     switch ( var_type )
@@ -6026,248 +5963,184 @@
       case VAR_ActualIntellect:
 LABEL_68:
         this->uIntelligenceBonus = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = SPEECH_91;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_ActualPersonality:
 LABEL_69:
         this->uWillpowerBonus = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = SPEECH_91;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_ActualEndurance:
 LABEL_70:
         this->uEnduranceBonus = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = SPEECH_91;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_ActualSpeed:
 LABEL_71:
         this->uSpeedBonus = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = SPEECH_91;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_ActualAccuracy:
 LABEL_72:
         this->uAccuracyBonus = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_ActualLuck:
 LABEL_73:
         this->uLuckBonus = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_FireResistance:
         this->sResFireBase = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_AirResistance:
         this->sResAirBase = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_WaterResistance:
         this->sResWaterBase = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_EarthResistance:
         this->sResEarthBase = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_SpiritResistance:
         this->sResSpiritBase = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_MindResistance:
         this->sResMindBase = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_BodyResistance:
         this->sResBodyBase = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_LightResistance:
         this->sResLightBase = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_DarkResistance:
         this->sResDarkBase = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       case VAR_MagicResistance:
         this->sResMagicBase = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = 92;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       default:
         return;
@@ -6283,7 +6156,7 @@
         return;
       if ( var_type <= VAR_Eradicated )
       {
-        v4->SetCondition(var_type - 105, 1);
+        this->SetCondition(var_type - 105, 1);
       }
       else
       {
@@ -6293,16 +6166,15 @@
             byte_5E4C15[var_type] = var_value;
           return;
         }
-        memset(v4, 0, 0xA0u);
+        memset(this, 0, 0xA0u);
       }
       v31 = 1;
       pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
       if ( v31 != 1 )
         return;
-      v5 = 0;
       v25 = 8 * currPlayerId + 400;
       LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+      pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
       return;
     }
   }
@@ -6315,89 +6187,73 @@
         switch ( var_type )
         {
         case VAR_BodyResistanceBonus:
-          v4->sResBodyBonus = (unsigned __int8)var_value;
+          this->sResBodyBonus = (unsigned __int8)var_value;
           break;
         case VAR_AirResistanceBonus:
-          v4->sResAirBonus = (unsigned __int8)var_value;
+          this->sResAirBonus = (unsigned __int8)var_value;
           break;
         case VAR_WaterResistanceBonus:
-          v4->sResWaterBonus = (unsigned __int8)var_value;
+          this->sResWaterBonus = (unsigned __int8)var_value;
           break;
         case VAR_EarthResistanceBonus:
-          v4->sResEarthBonus = (unsigned __int8)var_value;
+          this->sResEarthBonus = (unsigned __int8)var_value;
           break;
         case VAR_SpiritResistanceBonus:
-          v4->sResSpiritBonus = (unsigned __int8)var_value;
+          this->sResSpiritBonus = (unsigned __int8)var_value;
           break;
         default:
           if ( var_type != 62 )
             return;
-          v4->sResMindBonus = (unsigned __int8)var_value;
+          this->sResMindBonus = (unsigned __int8)var_value;
           break;
         }
-        v28 = 0;
-        v26 = SPEECH_91;
-        v19 = pPlayers[currPlayerId + 1];
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       }
       if ( var_type == VAR_LightResistanceBonus )
       {
-        v4->sResLightBonus = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = SPEECH_91;
-        v19 = pPlayers[currPlayerId + 1];
+        this->sResLightBonus = (unsigned __int8)var_value;
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       }
       if ( var_type == VAR_DarkResistanceBonus )
       {
-        v4->sResDarkBonus = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = SPEECH_91;
-        v19 = pPlayers[currPlayerId + 1];
+        this->sResDarkBonus = (unsigned __int8)var_value;
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       }
       if ( var_type == VAR_MagicResistanceBonus )
       {
-        v4->sResMagicBonus = (unsigned __int8)var_value;
-        v28 = 0;
-        v26 = SPEECH_91;
-        v19 = pPlayers[currPlayerId + 1];
+        this->sResMagicBonus = (unsigned __int8)var_value;
         v31 = 1;
-        v19->PlaySound((PlayerSpeech)v26, v28);
+        this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
         if ( v31 != 1 )
           return;
-        v5 = 0;
         v25 = 8 * currPlayerId + 400;
         LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
         return;
       }
       if ( var_type <= 67 || var_type > 95 )
@@ -6405,7 +6261,7 @@
     }
   }
   
-  v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type);
+  v16 = (int)((char *)&this->pConditions[16] + 2 * var_type);
   v17 = *(char *)v16;
   if ( var_value <= VAR_BodyResistanceBonus )
   {
@@ -6421,10 +6277,9 @@
   pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
   if ( v31 != 1 )
     return;
-  v5 = 0;
   v25 = 8 * currPlayerId + 400;
   LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-  pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
+  pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
   return;
 }