diff Player.cpp @ 1779:50e91a820f6f

Player::SetVariable helper function for award sound
author Grumpy7
date Wed, 02 Oct 2013 08:51:43 +0200
parents 4e881879e259
children 01b3c314e9be
line wrap: on
line diff
--- a/Player.cpp	Wed Oct 02 07:42:43 2013 +0200
+++ b/Player.cpp	Wed Oct 02 08:51:43 2013 +0200
@@ -5423,25 +5423,15 @@
   ItemGen *v9; // ecx@17
   int v10; // eax@21
   signed int v11; // eax@30
-  char *v13; // ecx@45
   int v15; // ecx@86
   int v16; // esi@106
   char v17; // al@106
   int v18; // eax@107
-  int v21; // eax@127
   int v22; // eax@145
-  char v23; // zf@146
   DDM_DLV_Header *v24; // ecx@148
-  signed int v25; // eax@172
-  int v26; // [sp-8h] [bp-3Ch]@84
-  signed int v27; // [sp-4h] [bp-38h]@4
   ItemGen item; // [sp+Ch] [bp-28h]@52
-  char v30; // [sp+32h] [bp-2h]@1
-  char v31; // [sp+33h] [bp-1h]@1
 
   currPlayerId = 0;
-  v30 = 0;
-  v31 = 0;
   if ( this == pPlayers[2] )
     currPlayerId = 1;
   else if ( this == pPlayers[3] )
@@ -5462,6 +5452,7 @@
         if ( (signed int)var_type >= 0xF5 )
         {
           pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed; //           *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed);*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed);
+          return;
         }
         else
         {
@@ -5469,16 +5460,16 @@
           {
             case VAR_PlayerBits:
               _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u);
-              break;
+              return;
             case VAR_NPCs2:
               pParty->field_709 = 0;
               LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u;
               pParty->CountHirelings();
               viewparams->bRedrawGameUI = true;
-              break;
+              return;
             case VAR_NumSkillPoints:
               this->uSkillPoints = var_value;
-              break;
+              return;
           }
         }
         return;
@@ -5487,7 +5478,9 @@
         return;
       if ( (signed int)var_type <= VAR_UnknownTimeEvent19 )
       {
-        pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed;    //*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);, *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed);
+        pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed;    //*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);, *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed
+        PlayAwardSound(currPlayerId);
+        return;
       }
       else
       {
@@ -5501,17 +5494,17 @@
             v24->uReputation = 10000;
           return;
         }
-        if ( var_type <= VAR_ReputationInCurrentLocation
-          || var_type > VAR_History_28
-          || (v22 = var_type - VAR_History_0, pParty->PartyTimes.HistoryEventTimes[v22])
-          || (pParty->PartyTimes.HistoryEventTimes[v22] = pParty->uTimePlayed,
-              pStorylineText->StoreLine[v22].pText == 0) )//*(&pStorylineText->field_0 + 3 * v22) == 0,
+        if ( var_type >= VAR_History_0 && var_type <= VAR_History_28 && !pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0])
+        {
+          pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed;
+          if (pStorylineText->StoreLine[v22].pText)
+          {
+            bFlashHistoryBook = 1;
+            PlayAwardSound(currPlayerId);
+          }
           return;
-        bFlashHistoryBook = 1;
-      }
-      v25 = 8 * currPlayerId + 400;
-      LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        }
+      }
       return;
     }
     if ( var_type != 307 )
@@ -5520,22 +5513,22 @@
       {
         case 308:
           pParty->uNumBountiesCollected = var_value;
-          break;
+          return;
         case 309:
           pParty->uNumPrisonTerms = var_value;
-          break;
+          return;
         case 310:
           pParty->uNumArenaPageWins = var_value;
-          break;
+          return;
         case 311:
           pParty->uNumArenaSquireWins = var_value;
-          break;
+          return;
         case 312:
           pParty->uNumArenaKnightWins = var_value;
-          break;
+          return;
         case 313:
           pParty->uNumArenaLordWins = var_value;
-          break;
+          return;
       }
       return;
     }
@@ -5550,14 +5543,11 @@
     {
       pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
       this->PlaySound(SPEECH_96, 0);
-	    v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3];
       bFlashAutonotesBook = 1;
-      _506568_autonote_type = v21;
+      _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3];
     }
     _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u);
-    v25 = 8 * currPlayerId + 400;
-    LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-    pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+    PlayAwardSound(currPlayerId);
     return;
   }
   if ( var_type <= VAR_ActualMight )
@@ -5580,36 +5570,57 @@
           ShowStatusBarString(pTmpBuf.data(), 2u);
           GameUI_DrawFoodAndGold();
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_Sex:
           this->uSex = (PLAYER_SEX)var_value;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_Class:
           this->classType = (PLAYER_CLASS_TYPE)var_value;
-          if ( (char)var_value != 35 )
+          if ( (PLAYER_CLASS_TYPE)var_value == PLAYER_CLASS_LICH )
           {
-            pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-            v25 = 8 * currPlayerId + 400;
-            LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-            pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
-            return;
+            for (int i = 0; i < 138; i++)
+            {
+              if (this->pOwnItems[i].uItemID == ITEM_LICH_JAR_EMPTY)
+              {
+                this->pOwnItems[i].uItemID = ITEM_LICH_JAR_FULL;
+                this->pOwnItems[i].uHolderPlayer = currPlayerId + 1;
+              }
+            }
+            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 )
+            {
+              this->uCurrentFace = 21;
+              this->uVoiceID = 21;
+            }
+            else
+            {
+              this->uCurrentFace = 20;
+              this->uVoiceID = 20;
+            }
+            ReloadPlayerPortraits(currPlayerId, this->uCurrentFace);
           }
-          v8 = 0;
-          v9 = this->pInventoryItemList;
-          break;
+          pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
+          PlayAwardSound(currPlayerId);
+          return;
         case VAR_CurrentHP:
           this->sHealth = var_value;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_MaxHP:
           this->sHealth = GetMaxHealth();
@@ -5617,9 +5628,7 @@
         case VAR_CurrentSP:
           this->sMana = var_value;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_MaxSP:
           this->sMana = GetMaxMana();
@@ -5627,23 +5636,17 @@
         case VAR_ACModifier:
           this->sACModifier = (unsigned __int8)var_value;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_BaseLevel:
           this->uLevel = (unsigned __int8)var_value;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_LevelModifier:
           this->sLevelModifier = (unsigned __int8)var_value;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_Age:
           this->sAgeModifier = var_value;
@@ -5654,20 +5657,16 @@
             //&& dword_723E80_award_related[2 * a3] )
 			&& pAwards[var_value].pText )
           {
-            v25 = 8 * currPlayerId + 400;
-            LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-            pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
             pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
+            PlayAwardSound(currPlayerId);
             this->PlaySound(SPEECH_96, 0);
           }
-          _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, var_value, 1u);
+          _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u);
           return;
         case VAR_Experience:
           this->uExperience = var_value;
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_QBits_QuestsDone:
           if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3])
@@ -5675,17 +5674,14 @@
 		   && pQuestTable[var_value-1] )
           {
             bFlashQuestBook = 1;
-            v25 = 8 * currPlayerId + 400;
-            LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-            pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
             pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
+            PlayAwardSound(currPlayerId);
             this->PlaySound(SPEECH_93, 0);
           }
-          _449B7E_toggle_bit((unsigned char *)pParty->_quest_bits, var_value, 1u);
+          _449B7E_toggle_bit(pParty->_quest_bits, var_value, 1u);
           return;
         case VAR_PlayerItemInHands:
           item.Reset();
-          item.Reset();
           item.uItemID = var_value;
           item.uAttributes = 1;
           pParty->SetHoldingItem(&item);
@@ -5699,64 +5695,48 @@
           this->uMight = (unsigned __int8)var_value;
           this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_BaseIntellect:
           this->uIntelligence = (unsigned __int8)var_value;
           this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_BasePersonality:
           this->uWillpower = (unsigned __int8)var_value;
           this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_BaseEndurance:
           this->uEndurance = (unsigned __int8)var_value;
           this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_BaseSpeed:
           this->uSpeed = (unsigned __int8)var_value;
           this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_BaseAccuracy:
           this->uAccuracy = (unsigned __int8)var_value;
           this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_BaseLuck:
           this->uLuck = (unsigned __int8)var_value;
           this->PlaySound(SPEECH_92, 0);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_FixedFood:
           Party::SetFood(var_value);
           pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-          v25 = 8 * currPlayerId + 400;
-          LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-          pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+          PlayAwardSound(currPlayerId);
           return;
         case VAR_MightBonus:
           goto LABEL_64;
@@ -5775,54 +5755,12 @@
         default:
           return;
       }
-      while ( v9->uItemID != 615 )
-      {
-        ++v8;
-        ++v9;
-        if ( v8 >= 138 )
-          goto LABEL_22;
-      }
-      v10 = (int)((char *)this + 36 * v8);
-      *(int *)(v10 + 532) = 601;
-      *(char *)(v10 + 558) = currPlayerId + 1;
-LABEL_22:
-      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 )
-      {
-        this->uCurrentFace = 21;
-        this->uVoiceID = 21;
-      }
-      else
-      {
-        this->uCurrentFace = 20;
-        this->uVoiceID = 20;
-      }
-      ReloadPlayerPortraits(currPlayerId, this->uCurrentFace);
-      pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-      v25 = 8 * currPlayerId + 400;
-      LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
-      return;
     }
 LABEL_64:
     this->uMightBonus = (unsigned __int8)var_value;
     this->PlaySound(SPEECH_91, 0);
     pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-    v25 = 8 * currPlayerId + 400;
-    LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-    pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+    PlayAwardSound(currPlayerId);
     return;
   }
   if ( var_type <= VAR_FireResistanceBonus )
@@ -5832,9 +5770,7 @@
       this->sResFireBonus = (unsigned __int8)var_value;
       this->PlaySound(SPEECH_91, 0);
       pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-      v25 = 8 * currPlayerId + 400;
-      LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+      PlayAwardSound(currPlayerId);
       return;
     }
     switch ( var_type )
@@ -5844,134 +5780,102 @@
         this->uIntelligenceBonus = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_ActualPersonality:
 LABEL_69:
         this->uWillpowerBonus = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_ActualEndurance:
 LABEL_70:
         this->uEnduranceBonus = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_ActualSpeed:
 LABEL_71:
         this->uSpeedBonus = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_ActualAccuracy:
 LABEL_72:
         this->uAccuracyBonus = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_ActualLuck:
 LABEL_73:
         this->uLuckBonus = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_FireResistance:
         this->sResFireBase = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_AirResistance:
         this->sResAirBase = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_WaterResistance:
         this->sResWaterBase = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_EarthResistance:
         this->sResEarthBase = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_SpiritResistance:
         this->sResSpiritBase = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_MindResistance:
         this->sResMindBase = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_BodyResistance:
         this->sResBodyBase = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_LightResistance:
         this->sResLightBase = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_DarkResistance:
         this->sResDarkBase = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       case VAR_MagicResistance:
         this->sResMagicBase = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_92, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       default:
         return;
@@ -6000,9 +5904,7 @@
         memset(this, 0, 0xA0u);
       }
       pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-      v25 = 8 * currPlayerId + 400;
-      LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+      PlayAwardSound(currPlayerId);
       return;
     }
   }
@@ -6037,9 +5939,7 @@
         }
         this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       }
       if ( var_type == VAR_LightResistanceBonus )
@@ -6047,9 +5947,7 @@
         this->sResLightBonus = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       }
       if ( var_type == VAR_DarkResistanceBonus )
@@ -6057,9 +5955,7 @@
         this->sResDarkBonus = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       }
       if ( var_type == VAR_MagicResistanceBonus )
@@ -6067,22 +5963,20 @@
         this->sResMagicBonus = (unsigned __int8)var_value;
         this->PlaySound(SPEECH_91, 0);
         pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-        v25 = 8 * currPlayerId + 400;
-        LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-        pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+        PlayAwardSound(currPlayerId);
         return;
       }
-      if ( var_type <= 67 || var_type > 95 )
+      if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill )
         return;
     }
   }
   
   v16 = (int)((char *)&this->pConditions[16] + 2 * var_type);
   v17 = *(char *)v16;
-  if ( var_value <= VAR_BodyResistanceBonus )
+  if ( var_value <= 63 )
   {
     LOWORD(v15) = (unsigned __int8)var_value;
-    v18 = v15 | v17 & VAR_BodyResistanceBonus;
+    v18 = v15 | v17 & 63;
   }
   else
   {
@@ -6090,27 +5984,19 @@
   }
   *(short *)v16 = v18;
   pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-  v25 = 8 * currPlayerId + 400;
-  LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
-  pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
+  PlayAwardSound(currPlayerId);
   return;
 }
 
 
 //----- (new function) --------------------------------------------------------
-void Player::PlaySoundBasedOnCondition(int currPlayerId)
+void Player::PlayAwardSound(int currPlayerId)
 {
   signed int v25 = 8 * currPlayerId + 400;
   LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
   pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
 }
 
-//----- (new function) --------------------------------------------------------
-void Player::DrawPlayerBuffAnimBasedOnCondition(int currPlayerId)
-{
-  pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
-}
-
 //----- (0044AFFB) --------------------------------------------------------
 void Player::AddVariable(enum VariableType var_type, signed int val)
 {