changeset 1800:c3140e8ad3ef

Merge
author Ritor1
date Sun, 06 Oct 2013 22:45:11 +0600
parents dfafcd39c67b (current diff) 3f1e09a71726 (diff)
children 3a41be960164
files mm7_data.cpp
diffstat 11 files changed, 587 insertions(+), 574 deletions(-) [+]
line wrap: on
line diff
--- a/CastSpellInfo.cpp	Sun Oct 06 22:45:00 2013 +0600
+++ b/CastSpellInfo.cpp	Sun Oct 06 22:45:11 2013 +0600
@@ -3833,7 +3833,7 @@
 			}
 			v608 = pCastSpell->uPlayerID_2;
 			if ( v608 != 4 && v608 != 5
-				|| (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
+				|| (v609 = (signed int)*(&pFontCChar + v608 + pParty->hirelingScrollPosition), v609 <= 0)
 				|| v609 >= 3 )
 			{
 				ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
--- a/NPC.cpp	Sun Oct 06 22:45:00 2013 +0600
+++ b/NPC.cpp	Sun Oct 06 22:45:11 2013 +0600
@@ -1520,7 +1520,7 @@
   }
   //LOBYTE(v2->uFlags) |= 0x80u;
   pCurrentNPCInfo->uFlags |= 128;
-  pParty->field_709 = 0;
+  pParty->hirelingScrollPosition = 0;
   pParty->CountHirelings();
   if ( pParty->pHirelings[0].pName )
   {
@@ -1535,7 +1535,7 @@
     v22 = pParty->pHireling1Name;
   }
   strcpy(v22, v24);
-  pParty->field_709 = 0;
+  pParty->hirelingScrollPosition = 0;
   pParty->CountHirelings();
   PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C);
   dialog_menu_id = HOUSE_DIALOGUE_MAIN;
--- a/Party.cpp	Sun Oct 06 22:45:00 2013 +0600
+++ b/Party.cpp	Sun Oct 06 22:45:11 2013 +0600
@@ -355,7 +355,7 @@
 
   pHireling1Name[0] = 0;
   pHireling2Name[0] = 0;
-  pParty->field_709 = 0;
+  pParty->hirelingScrollPosition = 0;
   memset(pHirelings, 0, 2 * sizeof(*pHirelings));
 
   strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); //Zoltan
@@ -1042,7 +1042,7 @@
       Assert(sizeof(NPCData) == 0x4C);
       memset(hireling, 0, sizeof(*hireling));
 
-      pParty->field_709 = 0;
+      pParty->hirelingScrollPosition = 0;
       pParty->CountHirelings();
       viewparams->bRedrawGameUI = true;
     }
--- a/Party.h	Sun Oct 06 22:45:00 2013 +0600
+++ b/Party.h	Sun Oct 06 22:45:11 2013 +0600
@@ -242,7 +242,7 @@
   int uFallStartY;
   unsigned int bFlying;
   char field_708;
-  char field_709;
+  unsigned __int8 hirelingScrollPosition;
   char field_70A;
   char field_70B;
   unsigned int uCurrentYear;
--- a/Player.cpp	Sun Oct 06 22:45:00 2013 +0600
+++ b/Player.cpp	Sun Oct 06 22:45:11 2013 +0600
@@ -5809,7 +5809,7 @@
       _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u);
       return;
     case VAR_NPCs2:
-      pParty->field_709 = 0;
+      pParty->hirelingScrollPosition = 0;
       LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u;
       pParty->CountHirelings();
       viewparams->bRedrawGameUI = true;
@@ -6017,563 +6017,573 @@
 //----- (0044AFFB) --------------------------------------------------------
 void Player::AddVariable(enum VariableType var_type, signed int val)
 {
-  char v3; // bl@1
-  Player *v4; // esi@1
   signed int uPlayerIdx; // edi@1
   int v6; // eax@15
   unsigned int v7; // esi@18
-  int *v8; // ebx@21
-  int v9; // eax@22
-  signed int v10; // eax@24
-  int v11; // eax@27
-  __int16 *v12; // esi@28
-  Player *v13; // ecx@34
-  Player *v14; // ecx@36
-  char *v15; // ecx@37
-  unsigned __int8 v16; // cf@38
-  Player *v17; // ecx@42
-  __int16 *v18; // esi@53
-  __int16 *v19; // esi@62
-  char *v20; // esi@107
-  __int16 v21; // dx@107
-  int v22; // ecx@107
-  Player *v23; // ecx@132
-  int v24; // eax@132
-  int v25; // eax@150
-  char v26; // zf@151
   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
-  int v31; // [sp-4h] [bp-3Ch]@84
   ItemGen item; // [sp+Ch] [bp-2Ch]@45
-  unsigned int v33; // [sp+30h] [bp-8h]@34
-  char v34; // [sp+37h] [bp-1h]@1
-
-  auto Dst = this;
-  v3 = 0;
-  v34 = 0;
-  v4 = Dst;
+
   uPlayerIdx = 0;
-  if ( Dst == pPlayers[2] )
+  if ( this == pPlayers[2] )
     uPlayerIdx = 1;
-  else if ( Dst == pPlayers[3] )
+  else if ( this == pPlayers[3] )
     uPlayerIdx = 2;
-  else if ( Dst == pPlayers[4] )  
+  else if ( this == pPlayers[4] )  
     uPlayerIdx = 3;
  
-  if ( var_type <= VAR_AutoNotes )
-  {
-    if ( var_type != VAR_AutoNotes )
+  if ( var_type >= VAR_Counter1 && var_type <= VAR_Counter10)
+  {
+    pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed;
+    return;
+  }
+
+  if ( var_type >= VAR_UnknownTimeEvent0 && var_type <= VAR_UnknownTimeEvent19 )
+  {
+    pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed;
+    PlayAwardSound(uPlayerIdx);
+    return;
+  }
+
+  if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_99 )
+  {
+    if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 )
+      byte_5E4C15[var_type] += val;
+    else
+      byte_5E4C15[var_type] = -1;
+    return;
+  }
+
+  if ( var_type >= VAR_History_0 && var_type <= VAR_History_28)
+  {
+    if (!pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0])
     {
-      if ( var_type <= VAR_ActualMight )
+      pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed;
+      if (pStorylineText->StoreLine[var_type - VAR_History_0].pText = 0)
+      {
+        bFlashHistoryBook = 1;
+        PlayAwardSound(uPlayerIdx);
+      }
+    }
+    return;
+  }
+
+  switch ( var_type )
+  {
+    case VAR_RandomGold:
+      if ( val == 0 )
+        val = 1;
+      v6 = rand();
+      party_finds_gold(v6 % val + 1, 1);
+      GameUI_DrawFoodAndGold();
+      return;
+    case VAR_RandomFood:
+      if ( val == 0 )
+        val = 1;
+      v7 = rand() % val + 1;
+      Party::GiveFood(v7);
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food
+      ShowStatusBarString(pTmpBuf.data(), 2u);
+      GameUI_DrawFoodAndGold();
+      PlayAwardSound(uPlayerIdx);
+      return;
+    case VAR_Sex:
+      this->uSex = (PLAYER_SEX)val;
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Class:
+      this->classType = (PLAYER_CLASS_TYPE)val;
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_CurrentHP:
+      this->sHealth = min(this->sHealth + val, this->GetMaxHealth() );
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_MaxHP:
+      this->_health_related = 0;
+      this->uFullHealthBonus = 0;
+      this->sHealth = this->GetMaxHealth();
+      return;
+    case VAR_CurrentSP:
+      this->sMana = min(this->sMana + val, this->GetMaxMana() );
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_MaxSP:
+      this->_mana_related = 0;
+      this->uFullManaBonus = 0;
+      this->sMana = GetMaxMana();
+      return;
+    case VAR_ACModifier:
+      this->sACModifier = min(this->sACModifier + val, 255);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_BaseLevel:
+      this->uLevel = min(this->uLevel + val, 255);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_LevelModifier:
+      this->sLevelModifier = min(this->sLevelModifier + val, 255);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Age:
+      this->sAgeModifier += val;
+      return;
+    case VAR_Award:
+      if (_449B57_test_bit(this->_achieved_awards_bits, val) && pAwards[val].pText )
+      {
+        PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_96);
+      }
+      _449B7E_toggle_bit(this->_achieved_awards_bits, val, 1);
+      return;
+    case VAR_Experience:
+      this->uExperience = min(this->uExperience + val, 4000000000i64);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_QBits_QuestsDone:
+      if ( !_449B57_test_bit(pParty->_quest_bits, val) && pQuestTable[val] )
+      {
+        bFlashQuestBook = 1;
+        PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_93);
+      }
+      _449B7E_toggle_bit(pParty->_quest_bits, val, 1);
+      return;
+    case VAR_PlayerItemInHands:
+      item.Reset();
+      item.uAttributes = 1;
+      item.uItemID = val;
+      if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER )
+        pParty->pIsArtifactFound[val-500] = 1;
+      else if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION )
       {
-        if ( var_type != VAR_ActualMight )
-        {
-          switch ( var_type )
-          {
-            case VAR_RandomGold:
-              if ( !val )
-                val = 1;
-              v6 = rand();
-              party_finds_gold(v6 % val + 1, 1);
-              GameUI_DrawFoodAndGold();
-              return;
-            case VAR_RandomFood:
-              if ( !val )
-                val = 1;
-              v7 = rand() % val + 1;
-              Party::GiveFood(v7);
-              sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food
-              ShowStatusBarString(pTmpBuf.data(), 2u);
-              GameUI_DrawFoodAndGold();
-              goto _play_sound;
-            case VAR_Sex:
-              Dst->uSex = (PLAYER_SEX)val;
-              pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-              goto _play_sound;
-            case VAR_Class:
-              Dst->classType = (PLAYER_CLASS_TYPE)val;
-              pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-              goto _play_sound;
-            case VAR_CurrentHP:
-              v8 = &Dst->sHealth;
-              *v8 += val;
-              if ( Dst->sHealth <= Dst->GetMaxHealth() )
-              {
-                pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-                goto _play_sound;
-              }
-              v9 = v4->GetMaxHealth();
-              goto LABEL_23;
-            case VAR_MaxHP:
-              v10 = Dst->GetMaxHealth();
-              v4->_health_related = 0;
-              v4->uFullHealthBonus = 0;
-              v4->sHealth = v10;
-              return;
-            case VAR_CurrentSP:
-              v8 = &Dst->sMana;
-              *v8 += val;
-              if ( Dst->sMana > GetMaxMana() )
-              {
-                v9 = v4->GetMaxMana();
-LABEL_23:
-                *v8 = v9;
-              }
-              pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-              goto _play_sound;
-            case VAR_MaxSP:
-              v11 = GetMaxMana();
-              v4->_mana_related = 0;
-              v4->uFullManaBonus = 0;
-              v4->sMana = v11;
-              return;
-            case VAR_ACModifier:
-              v12 = &Dst->sACModifier;
-              goto LABEL_29;
-            case VAR_BaseLevel:
-              v12 = (__int16 *)&Dst->uLevel;
-              goto LABEL_29;
-            case VAR_LevelModifier:
-              v12 = &Dst->sLevelModifier;
-LABEL_29:
-              *v12 += val;
-              if ( *v12 > 255 )
-                *v12 = 255;
-              pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-              goto _play_sound;
-            case VAR_Age:
-              Dst->sAgeModifier += val;
-              return;
-            case VAR_Award:
-              v13 = pPlayers[uPlayerIdx + 1];
-              if (_449B57_test_bit((unsigned __int8 *)pPlayers[uPlayerIdx + 1]->_achieved_awards_bits, val) 
-             
-				&& pAwards[val].pText )
-              {
-                v14 = pPlayers[uPlayerIdx + 1];
-                v34 = 1;
-                v3 = 1;
-                v14->PlaySound(SPEECH_96, 0);
-              }
-              v15 = (char *)v4->_achieved_awards_bits;
-              _449B7E_toggle_bit((unsigned char *)v15, val, 1);
-              if ( v34 != 1 )
-              {
-                if ( v3 != 1 )
-                  return;
-                goto _play_sound;
-              }
-              pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-              if ( v3 != 1 )
-                return;
-              goto _play_sound;
-            case VAR_Experience:
-              v16 = __CFADD__(val, LODWORD(Dst->uExperience));
-              LODWORD(Dst->uExperience) += val;
-              HIDWORD(Dst->uExperience) += ((unsigned __int64)val >> 32) + v16;
-              if ( (signed __int64)Dst->uExperience > 4000000000i64 )
-                Dst->uExperience = 4000000000i64;
-              pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-              goto _play_sound;
-            case VAR_QBits_QuestsDone:
-              if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_quest_bits[((signed __int16)val - 1) >> 3])
-                //&& (&dword_722F10)[4 * val] )
-				&& pQuestTable[val] )
-              {
-                //v17 = pPlayers[uPlayerIdx + 1];
-                bFlashQuestBook = 1;
-                v34 = 1;
-                v3 = 1;
-                pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_93, 0);
-              }
-              v15 = (char *)pParty->_quest_bits;
-              _449B7E_toggle_bit((unsigned char *)v15, val, 1);
-              if ( v34 != 1 )
-              {
-                if ( v3 != 1 )
-                  return;
-                goto _play_sound;
-              }
-              pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-              if ( v3 != 1 )
-                return;
-              goto _play_sound;
-            case VAR_PlayerItemInHands:
-              item.Reset();
-              item.Reset();
-              item.uAttributes = 1;
-              item.uItemID = val;
-              if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER )
-                pParty->pIsArtifactFound[val-500] = 1;
-              if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION )
-              {
-                item.uNumCharges = rand() % 6 + item.GetDamageMod() + 1;
-                item.uMaxCharges = LOBYTE(item.uNumCharges);
-              }
-              pParty->SetHoldingItem(&item);
-              return;
-            case VAR_FixedGold:
-              party_finds_gold(val, 1);
-              return;
-            case VAR_BaseMight:
-              v18 = (__int16 *)&Dst->uMight;
-              goto LABEL_82;
-            case VAR_BaseIntellect:
-              v18 = (__int16 *)&Dst->uIntelligence;
-              goto LABEL_82;
-            case VAR_BasePersonality:
-              v18 = (__int16 *)&Dst->uWillpower;
-              goto LABEL_82;
-            case VAR_BaseEndurance:
-              v18 = (__int16 *)&Dst->uEndurance;
-              goto LABEL_82;
-            case VAR_BaseSpeed:
-              v18 = (__int16 *)&Dst->uSpeed;
-              goto LABEL_82;
-            case VAR_BaseAccuracy:
-              v18 = (__int16 *)&Dst->uAccuracy;
-              goto LABEL_82;
-            case VAR_BaseLuck:
-              v18 = (__int16 *)&Dst->uLuck;
-              goto LABEL_82;
-            case VAR_FixedFood:
-              Party::GiveFood(val);
-              sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val);
-              ShowStatusBarString(pTmpBuf.data(), 2u);
-              if ( pParty->uNumFoodRations > 0xFFFF )
-                Party::SetFood(0xFFFFu);
-              goto _play_sound;
-            case VAR_MightBonus:
-              goto LABEL_62;
-            case VAR_IntellectBonus:
-              goto LABEL_66;
-            case VAR_PersonalityBonus:
-              goto LABEL_67;
-            case VAR_EnduranceBonus:
-              goto LABEL_68;
-            case VAR_SpeedBonus:
-              goto LABEL_69;
-            case VAR_AccuracyBonus:
-              goto LABEL_70;
-            case VAR_LuckBonus:
-              goto LABEL_71;
-            default:
-              return;
-          }
-          return;
-        }
-LABEL_62:
-        v19 = (__int16 *)&Dst->uMightBonus;
-        goto LABEL_113;
+        item.uNumCharges = rand() % 6 + item.GetDamageMod() + 1;
+        item.uMaxCharges = LOBYTE(item.uNumCharges);
       }
-      if ( var_type <= VAR_FireResistanceBonus )
-      {
-        if ( var_type != VAR_FireResistanceBonus )
+      pParty->SetHoldingItem(&item);
+      return;
+    case VAR_FixedGold:
+      party_finds_gold(val, 1);
+      return;
+    case VAR_BaseMight:
+      this->uMight = min(this->uMight + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_BaseIntellect:
+      this->uIntelligence = min(this->uIntelligence + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_BasePersonality:
+      this->uWillpower = min(this->uWillpower + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_BaseEndurance:
+      this->uEndurance = min(this->uEndurance + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_BaseSpeed:
+      this->uSpeed = min(this->uSpeed + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_BaseAccuracy:
+      this->uAccuracy = min(this->uAccuracy + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_BaseLuck:
+      this->uLuck = min(this->uLuck + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_FixedFood:
+      Party::GiveFood(val);
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val);
+      ShowStatusBarString(pTmpBuf.data(), 2u);
+      if ( pParty->uNumFoodRations > 0xFFFF )
+        Party::SetFood(0xFFFFu);
+      PlayAwardSound(uPlayerIdx);
+      return;
+    case VAR_MightBonus:
+    case VAR_ActualMight:
+      this->uMightBonus = min(this->uMightBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_IntellectBonus:
+    case VAR_ActualIntellect:
+      this->uIntelligenceBonus = min(this->uIntelligenceBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_PersonalityBonus:
+    case VAR_ActualPersonality:
+      this->uWillpowerBonus = min(this->uWillpowerBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_EnduranceBonus:
+    case VAR_ActualEndurance:
+      this->uEnduranceBonus = min(this->uEnduranceBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_SpeedBonus:
+    case VAR_ActualSpeed:
+      this->uSpeedBonus = min(this->uSpeedBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_AccuracyBonus:
+    case VAR_ActualAccuracy:
+      this->uAccuracyBonus = min(this->uAccuracyBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_LuckBonus:
+    case VAR_ActualLuck:
+      this->uLuckBonus = min(this->uLuckBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_FireResistance:
+      this->sResFireBase = min(this->sResFireBase + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_AirResistance:
+      this->sResAirBase = min(this->sResAirBase + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_WaterResistance:
+      this->sResWaterBase = min(this->sResWaterBase + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_EarthResistance:
+      this->sResEarthBase = min(this->sResEarthBase + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_SpiritResistance:
+      this->sResSpiritBase = min(this->sResSpiritBase + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_MindResistance:
+      this->sResMindBase = min(this->sResMindBase + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_BodyResistance:
+      this->sResBodyBase = min(this->sResBodyBase + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_LightResistance:
+      this->sResLightBase = min(this->sResLightBase + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_DarkResistance:
+      this->sResDarkBase = min(this->sResDarkBase + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_MagicResistance:
+      this->sResMagicBase = min(this->sResMagicBase + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
+      return;
+    case VAR_FireResistanceBonus:
+      this->sResFireBonus = min(this->sResFireBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_AirResistanceBonus:
+      this->sResAirBonus = min(this->sResAirBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_WaterResistanceBonus:
+      this->sResWaterBonus = min(this->sResWaterBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_EarthResistanceBonus:
+      this->sResEarthBonus = min(this->sResEarthBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_SpiritResistanceBonus:
+      this->sResSpiritBonus = min(this->sResSpiritBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_MindResistanceBonus:
+      this->sResMindBonus = min(this->sResMindBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_BodyResistanceBonus:
+      this->sResBodyBonus = min(this->sResBodyBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_LightResistanceBonus:
+      this->sResLightBonus = min(this->sResLightBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_DarkResistanceBonus:
+      this->sResDarkBonus = min(this->sResDarkBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_MagicResistanceBonus:
+      this->sResMagicBonus = min(this->sResMagicBonus + val, 255);
+      PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
+      return;
+    case VAR_Cursed:
+      this->SetCondition(Condition_Cursed, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Weak:
+      this->SetCondition(Condition_Weak, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Asleep:
+      this->SetCondition(Condition_Sleep, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Afraid:
+      this->SetCondition(Condition_Fear, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Drunk:
+      this->SetCondition(Condition_Drunk, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Insane:
+      this->SetCondition(Condition_Insane, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_PoisonedGreen:
+      this->SetCondition(Condition_Poison1, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_DiseasedGreen:
+      this->SetCondition(Condition_Disease1, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_PoisonedYellow:
+      this->SetCondition(Condition_Poison2, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_DiseasedYellow:
+      this->SetCondition(Condition_Disease2, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_PoisonedRed:
+      this->SetCondition(Condition_Poison3, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_DiseasedRed:
+      this->SetCondition(Condition_Disease3, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Paralyzed:
+      this->SetCondition(Condition_Paralyzed, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Unconsious:
+      this->SetCondition(Condition_Unconcious, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Dead:
+      this->SetCondition(Condition_Dead, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Stoned:
+      this->SetCondition(Condition_Pertified, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_Eradicated:
+      this->SetCondition(Condition_Eradicated, 1);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_MajorCondition :
+      memset(this, 0, 0xA0u);
+      PlayAwardSound_Anim97(uPlayerIdx);
+      return;
+    case VAR_AutoNotes:
+        if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText )
         {
-          switch ( var_type )
-          {
-            case VAR_ActualIntellect:
-LABEL_66:
-              v19 = (__int16 *)&Dst->uIntelligenceBonus;
-              goto LABEL_113;
-            case VAR_ActualPersonality:
-LABEL_67:
-              v19 = (__int16 *)&Dst->uWillpowerBonus;
-              goto LABEL_113;
-            case VAR_ActualEndurance:
-LABEL_68:
-              v19 = (__int16 *)&Dst->uEnduranceBonus;
-              goto LABEL_113;
-            case VAR_ActualSpeed:
-LABEL_69:
-              v19 = (__int16 *)&Dst->uSpeedBonus;
-              goto LABEL_113;
-            case VAR_ActualAccuracy:
-LABEL_70:
-              v19 = (__int16 *)&Dst->uAccuracyBonus;
-              goto LABEL_113;
-            case VAR_ActualLuck:
-LABEL_71:
-              v19 = (__int16 *)&Dst->uLuckBonus;
-              goto LABEL_113;
-            case VAR_FireResistance:
-              v18 = &Dst->sResFireBase;
-              goto LABEL_82;
-            case VAR_AirResistance:
-              v18 = &Dst->sResAirBase;
-              goto LABEL_82;
-            case VAR_WaterResistance:
-              v18 = &Dst->sResWaterBase;
-              goto LABEL_82;
-            case VAR_EarthResistance:
-              v18 = &Dst->sResEarthBase;
-              goto LABEL_82;
-            case VAR_SpiritResistance:
-              v18 = &Dst->sResSpiritBase;
-              goto LABEL_82;
-            case VAR_MindResistance:
-              v18 = &Dst->sResMindBase;
-              goto LABEL_82;
-            case VAR_BodyResistance:
-              v18 = &Dst->sResBodyBase;
-              goto LABEL_82;
-            case VAR_LightResistance:
-              v18 = &Dst->sResLightBase;
-              goto LABEL_82;
-            case VAR_DarkResistance:
-              v18 = &Dst->sResDarkBase;
-              goto LABEL_82;
-            case VAR_MagicResistance:
-              v18 = &Dst->sResMagicBase;
-LABEL_82:
-              *v18 += val;
-              if ( *v18 > 255 )
-                *v18 = 255;
-              pPlayers[uPlayerIdx + 1]->PlaySound(SPEECH_92, 0);
-              pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-              goto _play_sound;
-            default:
-              return;
-          }
-          return;
+          this->PlaySound(SPEECH_96, 0);
+          bFlashAutonotesBook = 1;
+          _506568_autonote_type = pAutonoteTxt[val].eType;
+          pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
         }
-        v19 = &Dst->sResFireBonus;
-LABEL_113:
-        *v19 += val;
-        if ( *v19 > 255 )
-          *v19 = 255;
-        v31 = 0;
-        v29 = SPEECH_91;
-        pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31);
-        pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-        goto _play_sound;
-      }
-      if ( var_type <= VAR_DisarmTrapSkill )
-      {
-        if ( var_type != VAR_DisarmTrapSkill )
-        {
-          if ( var_type <= VAR_BodyResistanceBonus )
-          {
-            switch ( var_type )
-            {
-              case VAR_BodyResistanceBonus:
-                v19 = &Dst->sResBodyBonus;
-                break;
-              case VAR_AirResistanceBonus:
-                v19 = &Dst->sResAirBonus;
-                break;
-              case VAR_WaterResistanceBonus:
-                v19 = &Dst->sResWaterBonus;
-                break;
-              case VAR_EarthResistanceBonus:
-                v19 = &Dst->sResEarthBonus;
-                break;
-              case VAR_SpiritResistanceBonus:
-                v19 = &Dst->sResSpiritBonus;
-                break;
-              default:
-                if ( var_type != 62 )
-                  return;
-                v19 = &Dst->sResMindBonus;
-                break;
-            }
-            goto LABEL_113;
-          }
-          if ( var_type == VAR_LightResistanceBonus )
-          {
-            v19 = &Dst->sResLightBonus;
-            goto LABEL_113;
-          }
-          if ( var_type == VAR_DarkResistanceBonus )
-          {
-            v19 = &Dst->sResDarkBonus;
-            goto LABEL_113;
-          }
-          if ( var_type == VAR_MagicResistanceBonus )
-          {
-            v19 = &Dst->sResMagicBonus;
-            goto LABEL_113;
-          }
-          if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill )
-            return;
-        }
-        goto LABEL_106;
-      }
-      if ( var_type == VAR_LearningSkill )
-      {
-LABEL_106:
-        if ( val <= 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_type;
-          v21 = *(short *)v20;
-          v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus);
-          if ( v22 > 60 )
-            LOWORD(v22) = 60;
-          LOBYTE(v21) = v21 & 0xC0;
-          *(short *)v20 = v22 | v21;
-        }
-        pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-        goto _play_sound;
-      }
-      if ( var_type <= VAR_LearningSkill )
+        _449B7E_toggle_bit(pParty->_autonote_bits, val, 1);
+        PlayAwardSound(uPlayerIdx);
         return;
-      if ( var_type <= VAR_Eradicated )
-      {
-        Dst->SetCondition(var_type - 105, 0);
-      }
-      else
-      {
-        if ( var_type != VAR_MajorCondition )
-        {
-          if ( var_type > VAR_MajorCondition && var_type <= VAR_MapPersistentVariable_99 )
-          {
-            if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 )
-              byte_5E4C15[var_type] += val;
-            else
-              byte_5E4C15[var_type] = -1;
-          }
-          return;
-        }
-        memset(Dst, 0, 0xA0u);
-      }
-      pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-      goto _play_sound;
-    }
-    if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & pParty->_autonote_bits[((signed __int16)val - 1) >> 3])
-      //&& (&dword_723718_autonote_related)[8 * val] )
-	  && pAutonoteTxt[val].pText )
-    {
-      v23 = pPlayers[uPlayerIdx + 1];
-      v34 = 1;
-      v23->PlaySound(SPEECH_96, 0);
-	  //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val];
-      bFlashAutonotesBook = 1;
-      _506568_autonote_type = pAutonoteTxt[val].eType;
-    }
-    _449B7E_toggle_bit(pParty->_autonote_bits, val, 1);
-    v3 = 1;
-    if ( v34 != 1 )
-    {
-      if ( v3 != 1 )
-        return;
-      goto _play_sound;
-    }
-    pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-    if ( v3 != 1 )
-      return;
-    goto _play_sound;
-  }
-  if ( var_type > VAR_GoldInBank )
-  {
-    if ( var_type == 307 )
-    {
+    case VAR_PlayerBits:
+      _449B7E_toggle_bit((unsigned char *)this->field_1A50, val, 1u);
+      return;
+    case VAR_NPCs2:
+      pParty->hirelingScrollPosition = 0;
+      LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u;
+      pParty->CountHirelings();
+      viewparams->bRedrawGameUI = true;
+      return;
+    case VAR_NumSkillPoints:
+      this->uSkillPoints += val;
+      return;
+    case VAR_ReputationInCurrentLocation:
+      v27 = &pOutdoor->ddm;
+      if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
+        v27 = &pIndoor->dlv;
+      v27->uReputation += val;
+      if ( v27->uReputation > 10000 )
+        v27->uReputation = 10000;
+      return;
+    case VAR_GoldInBank:
+      pParty->uNumGoldInBank += val;
+      return;
+    case VAR_NumDeaths:
       pParty->uNumDeaths += val;
-      if ( v34 != 1 )
-      {
-        if ( v3 != 1 )
-          return;
-        goto _play_sound;
-      }
-      pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
-      if ( v3 != 1 )
-        return;
-      goto _play_sound;
-    }
-    switch ( var_type )
-    {
-      case 308:
-        pParty->uNumBountiesCollected += val;
-        break;
-      case 309:
-        pParty->uNumPrisonTerms += val;
-        break;
-      case 310:
-        pParty->uNumArenaPageWins += val;
-        break;
-      case 311:
-        pParty->uNumArenaSquireWins += val;
-        break;
-      case 312:
-        pParty->uNumArenaKnightWins += val;
-        break;
-      case 313:
-        pParty->uNumArenaLordWins += val;
-        break;
-    }
+      return;
+    case VAR_NumBounties:
+      pParty->uNumBountiesCollected += val;
+      return;
+    case VAR_PrisonTerms:
+      pParty->uNumPrisonTerms += val;
+      return;
+    case VAR_ArenaWinsPage:
+      pParty->uNumArenaPageWins += val;
+      return;
+    case VAR_ArenaWinsSquire:
+      pParty->uNumArenaSquireWins += val;
+      return;
+    case VAR_ArenaWinsKnight:
+      pParty->uNumArenaKnightWins += val;
+      return;
+    case VAR_ArenaWinsLord:
+      pParty->uNumArenaLordWins += val;
+      return;
+    case VAR_StaffSkill:
+      AddSkillByEvent(&Player::skillStaff, val, uPlayerIdx);
+      return;
+    case VAR_SwordSkill:
+      AddSkillByEvent(&Player::skillSword, val, uPlayerIdx);
+      return;
+    case VAR_DaggerSkill:
+      AddSkillByEvent(&Player::skillDagger, val, uPlayerIdx);
+      return;
+    case VAR_AxeSkill:
+      AddSkillByEvent(&Player::skillAxe, val, uPlayerIdx);
+      return;
+    case VAR_SpearSkill:
+      AddSkillByEvent(&Player::skillSpear, val, uPlayerIdx);
+      return;
+    case VAR_BowSkill:
+      AddSkillByEvent(&Player::skillBow, val, uPlayerIdx);
+      return;
+    case VAR_MaceSkill:
+      AddSkillByEvent(&Player::skillMace, val, uPlayerIdx);
+      return;
+    case VAR_BlasterSkill:
+      AddSkillByEvent(&Player::skillBlaster, val, uPlayerIdx);
+      return;
+    case VAR_ShieldSkill:
+      AddSkillByEvent(&Player::skillShield, val, uPlayerIdx);
+      return;
+    case VAR_LeatherSkill:
+      AddSkillByEvent(&Player::skillLeather, val, uPlayerIdx);
+      return;
+    case VAR_SkillChain:
+      AddSkillByEvent(&Player::skillChain, val, uPlayerIdx);
+      return;
+    case VAR_PlateSkill:
+      AddSkillByEvent(&Player::skillPlate, val, uPlayerIdx);
+      return;
+    case VAR_FireSkill:
+      AddSkillByEvent(&Player::skillFire, val, uPlayerIdx);
+      return;
+    case VAR_AirSkill:
+      AddSkillByEvent(&Player::skillAir, val, uPlayerIdx);
+      return;
+    case VAR_WaterSkill:
+      AddSkillByEvent(&Player::skillWater, val, uPlayerIdx);
+      return;
+    case VAR_EarthSkill:
+      AddSkillByEvent(&Player::skillEarth, val, uPlayerIdx);
+      return;
+    case VAR_SpiritSkill:
+      AddSkillByEvent(&Player::skillSpirit, val, uPlayerIdx);
+      return;
+    case VAR_MindSkill:
+      AddSkillByEvent(&Player::skillMind, val, uPlayerIdx);
+      return;
+    case VAR_BodySkill:
+      AddSkillByEvent(&Player::skillBody, val, uPlayerIdx);
+      return;
+    case VAR_LightSkill:
+      AddSkillByEvent(&Player::skillLight, val, uPlayerIdx);
+      return;
+    case VAR_DarkSkill:
+      AddSkillByEvent(&Player::skillDark, val, uPlayerIdx);
+      return;
+    case VAR_IdentifyItemSkill:
+      AddSkillByEvent(&Player::skillItemId, val, uPlayerIdx);
+      return;
+    case VAR_MerchantSkill:
+      AddSkillByEvent(&Player::skillMerchant, val, uPlayerIdx);
+      return;
+    case VAR_RepairSkill:
+      AddSkillByEvent(&Player::skillRepair, val, uPlayerIdx);
+      return;
+    case VAR_BodybuildingSkill:
+      AddSkillByEvent(&Player::skillBodybuilding, val, uPlayerIdx);
+      return;
+    case VAR_MeditationSkill:
+      AddSkillByEvent(&Player::skillMeditation, val, uPlayerIdx);
+      return;
+    case VAR_PerceptionSkill:
+      AddSkillByEvent(&Player::skillPerception, val, uPlayerIdx);
+      return;
+    case VAR_DiplomacySkill:
+      AddSkillByEvent(&Player::skillDiplomacy, val, uPlayerIdx);
+      return;
+    case VAR_ThieverySkill:
+      Error ("Thieving unsupported");
+      return;
+    case VAR_DisarmTrapSkill:
+      AddSkillByEvent(&Player::skillDisarmTrap, val, uPlayerIdx);
+      return;
+    case VAR_DodgeSkill:
+      AddSkillByEvent(&Player::skillDodge, val, uPlayerIdx);
+      return;
+    case VAR_UnarmedSkill:
+      AddSkillByEvent(&Player::skillUnarmed, val, uPlayerIdx);
+      return;
+    case VAR_IdentifyMonsterSkill:
+      AddSkillByEvent(&Player::skillMonsterId, val, uPlayerIdx);
+      return;
+    case VAR_ArmsmasterSkill:
+      AddSkillByEvent(&Player::skillArmsmaster, val, uPlayerIdx);
+      return;
+    case VAR_StealingSkill:
+      AddSkillByEvent(&Player::skillStealing, val, uPlayerIdx);
+      return;
+    case VAR_AlchemySkill:
+      AddSkillByEvent(&Player::skillAlchemy, val, uPlayerIdx);
+      return;
+    case VAR_LearningSkill:
+      AddSkillByEvent(&Player::skillLearning, val, uPlayerIdx);
+      return;
+    default:
+      return;
+  }
+}
+
+//----- (new function) --------------------------------------------------------
+void Player::PlayAwardSound_Anim97(int currPlayerId)
+{
+  pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, currPlayerId);
+  PlayAwardSound(currPlayerId);
+}
+
+//----- (new function) --------------------------------------------------------
+void Player::PlayAwardSound_Anim97_Face(int currPlayerId, PlayerSpeech speech)
+{
+  this->PlaySound(speech, 0);
+  PlayAwardSound_Anim97(currPlayerId);
+}
+
+//----- (new function) --------------------------------------------------------
+void Player::AddSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 addSkillValue, int currPlayerId )
+{
+  if ( addSkillValue > 63 )
+  {
+    this->*skillToSet = (unsigned __int8)addSkillValue | this->*skillToSet & 63;
   }
   else
   {
-    if ( var_type == VAR_GoldInBank )
-    {
-      pParty->uNumGoldInBank += val;
-      return;
-    }
-    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_type )
-        {
-          case VAR_PlayerBits:
-            _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u);
-            break;
-          case VAR_NPCs2:
-            pParty->field_709 = 0;
-            LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u;
-            pParty->CountHirelings();
-            viewparams->bRedrawGameUI = true;
-            break;
-          case VAR_NumSkillPoints:
-            Dst->uSkillPoints += val;
-            break;
-        }
-      }
-      return;
-    }
-    if ( var_type < VAR_Counter9 )
-      return;
-    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_type != VAR_ReputationInCurrentLocation )
-    {
-      if ( var_type <= VAR_ReputationInCurrentLocation
-        || var_type > VAR_History_28
-        || (v25 = var_type - 276, pParty->PartyTimes.HistoryEventTimes[v25])
-        || (pParty->PartyTimes.HistoryEventTimes[var_type - 276] = pParty->uTimePlayed,
-            v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0,
-            v26) )
-        return;
-      bFlashHistoryBook = 1;
-_play_sound:
-      v28 = 8 * uPlayerIdx + 400;
-      LOBYTE(v28) = PID(OBJECT_Player,uPlayerIdx - 112);
-      pAudioPlayer->PlaySound(SOUND_20001, v28, 0, -1, 0, 0, 0, 0);
-      return;
-    }
-    v27 = &pOutdoor->ddm;
-    if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
-      v27 = &pIndoor->dlv;
-    v27->uReputation += val;
-    if ( v27->uReputation > 10000 )
-      v27->uReputation = 10000;
-  }
-}
-
+    this->*skillToSet = min(this->*skillToSet + addSkillValue, 60) | this->*skillToSet & 0xC0;
+  }
+  PlayAwardSound_Anim97(currPlayerId);
+  return;
+}
 
 //----- (0044B9C4) --------------------------------------------------------
 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue)
@@ -6629,14 +6639,14 @@
               VarNum = (VariableType)0;
               GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum);
               result = (bool) pValue;
-			  dword_5B65CC = 0;
+			  npcIdToDismissAfterDialogue = 0;
               if ( (int)VarNum == pValue )
               {
-                dword_5B65CC = (int)pValue;
+                npcIdToDismissAfterDialogue = (int)pValue;
               }
               else
               {
-                pParty->field_709 = 0;
+                pParty->hirelingScrollPosition = 0;
                 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu;
                 pParty->CountHirelings();
                 viewparams->bRedrawGameUI = true;
@@ -6664,7 +6674,7 @@
                 memset(pParty->pHirelings, 0, 0x4Cu);
               if ( pParty->pHirelings[1].uProfession == pValue )
                 memset(&pParty->pHirelings[1], 0, 0x4Cu);
-              pParty->field_709 = 0;
+              pParty->hirelingScrollPosition = 0;
               pParty->CountHirelings();
               break;
             case 243:
--- a/Player.h	Sun Oct 06 22:45:00 2013 +0600
+++ b/Player.h	Sun Oct 06 22:45:11 2013 +0600
@@ -603,8 +603,11 @@
   bool WearsItemAnyWhere(int item_id);
   float GetArmorRecoveryMultiplierFromSkillLevel( unsigned char armour_skill_type, float param2, float param3, float param4, float param5 );
   void SetSkillByEvent(unsigned __int16 Player::* skillToSet, unsigned __int16 skillValue, int currPlayerId);
+  void AddSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 addSkillValue, int currPlayerId );
+  void PlayAwardSound_Anim(int currPlayerId);
   void PlayAwardSound_Anim_Face(int currPlayerId, PlayerSpeech speech);
-  void PlayAwardSound_Anim(int currPlayerId);
+  void PlayAwardSound_Anim97(int currPlayerId);
+  void PlayAwardSound_Anim97_Face(int currPlayerId, PlayerSpeech speech);
 
   bool IsWeak();
   bool IsDead();
--- a/UI/UiGame.cpp	Sun Oct 06 22:45:00 2013 +0600
+++ b/UI/UiGame.cpp	Sun Oct 06 22:45:11 2013 +0600
@@ -187,9 +187,9 @@
         }
       }
     }
-    if ( (signed int)((char *)_this + (unsigned __int8)pParty->field_709) < v1 )
+    if ( (signed int)((char *)_this + pParty->hirelingScrollPosition) < v1 )
     {
-      sDialogue_SpeakingActorNPC_ID = -1 - (unsigned __int8)pParty->field_709 - (int)_this;
+      sDialogue_SpeakingActorNPC_ID = -1 - pParty->hirelingScrollPosition - (int)_this;
       pNPC = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &a2);
       if ( pNPC )
       {
@@ -2161,7 +2161,7 @@
       }
     }
 
-    for ( int i = (unsigned __int8)pParty->field_709; i < v22 && pNPC_limit_ID < 2; i++ )
+    for ( int i = pParty->hirelingScrollPosition; i < v22 && pNPC_limit_ID < 2; i++ )
     {
       if ( (unsigned __int8)pTmpBuf[i] >= 2 )
       {
--- a/mm7_4.cpp	Sun Oct 06 22:45:00 2013 +0600
+++ b/mm7_4.cpp	Sun Oct 06 22:45:11 2013 +0600
@@ -1405,7 +1405,7 @@
   int v8; // [sp+Ch] [bp-8h]@3
   int v9; // [sp+10h] [bp-4h]@2
   int a2a; // [sp+1Ch] [bp+8h]@1
-
+  return 0;
   v3 = 0;
   result = word_4EE088_sound_ids[uSoundID];
   v5 = this;
@@ -3446,7 +3446,7 @@
 				v11 = &pParty->pHirelings[1];
 				memset(v11, 0, sizeof(NPCData));
 			}
-			pParty->field_709 = 0;
+			pParty->hirelingScrollPosition = 0;
 			pParty->CountHirelings();
 			dword_591084 = 0;
 			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
@@ -3494,7 +3494,7 @@
 				v13 = pParty->pHireling1Name;
 			}
 			strcpy(v13, v15);
-			pParty->field_709 = 0;
+			pParty->hirelingScrollPosition = 0;
 			pParty->CountHirelings();
 
 			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
@@ -3555,7 +3555,7 @@
 				v11 = &pParty->pHirelings[1];
 				memset(v11, 0, sizeof(NPCData));
 			}
-			pParty->field_709 = 0;
+			pParty->hirelingScrollPosition = 0;
 			pParty->CountHirelings();
 			dword_591084 = 0;
 			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
--- a/mm7_5.cpp	Sun Oct 06 22:45:00 2013 +0600
+++ b/mm7_5.cpp	Sun Oct 06 22:45:11 2013 +0600
@@ -357,11 +357,11 @@
               //while ( _this < (signed int)pNPCStats->uNumNewNPCs );
             }
 
-            if ( (signed int)(hireling_idx + (unsigned __int8)pParty->field_709) < uAction )
+            if ( (signed int)(hireling_idx + pParty->hirelingScrollPosition) < uAction )
             {
               //Actor::Actor(&actor);
               memset(&actor, 0, 0x344u);
-              actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx;
+              actor.sNPC_ID += -1 - pParty->hirelingScrollPosition - hireling_idx;
               pActor = &actor;
               GameUI_InitializeDialogue(&actor, true);
             }
@@ -1343,26 +1343,26 @@
                       if ( uCurrentHouse_Animation == 153 )
                         PlayHouseSound(0x99u, HouseSound_Greeting_2);
                       pVideoPlayer->Unload();
-                      if ( dword_5B65CC )
+                      if ( npcIdToDismissAfterDialogue )
                       {
-                        pParty->field_709 = 0;
-                        LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu;
+                        pParty->hirelingScrollPosition = 0;
+                        LOBYTE(pNPCStats->pNewNPCData[npcIdToDismissAfterDialogue].uFlags) &= 0x7Fu;
                         pParty->CountHirelings();
                         viewparams->bRedrawGameUI = true;
-                        dword_5B65CC = 0;
+                        npcIdToDismissAfterDialogue = 0;
                       }
                       DialogueEnding();
                       pCurrentScreen = SCREEN_GAME;
                       viewparams->bRedrawGameUI = true;
                       continue;
                     case SCREEN_NPC_DIALOGUE://click escape
-                      if ( dword_5B65CC )
+                      if ( npcIdToDismissAfterDialogue )
                       {
-                        pParty->field_709 = 0;
-                        LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu;
+                        pParty->hirelingScrollPosition = 0;
+                        LOBYTE(pNPCStats->pNewNPCData[npcIdToDismissAfterDialogue].uFlags) &= 0x7Fu;
                         pParty->CountHirelings();
                         viewparams->bRedrawGameUI = true;
-                        dword_5B65CC = 0;
+                        npcIdToDismissAfterDialogue = 0;
                       }
                       //goto LABEL_317;
                       DialogueEnding();
@@ -1574,22 +1574,22 @@
           {
             GUIWindow::Create(626, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCRight, 0);
             v37 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + (unsigned __int8)pParty->field_70A - 2;
-            if ( (unsigned __int8)pParty->field_709 < v37 )
+            if ( pParty->hirelingScrollPosition < v37 )
             {
-              ++pParty->field_709;//??? maybe number of the first cell???
-              if ( (unsigned __int8)pParty->field_709 >= v37 )
-                pParty->field_709 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + pParty->field_70A - 2;
+              ++pParty->hirelingScrollPosition;//??? maybe number of the first cell???
+              if ( pParty->hirelingScrollPosition >= v37 )
+                pParty->hirelingScrollPosition = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + pParty->field_70A - 2;
             }
           }
           else
           {
             GUIWindow::Create(469, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCLeft, 0);
-            if ( pParty->field_709 )
+            /*if ( pParty->field_709 )
             {
               --pParty->field_709;
               if ( pParty->field_709 < 1 )
                 pParty->field_709 = 0;
-            }
+            }*/
           }
           GameUI_DrawHiredNPCs();
           continue;
--- a/mm7_data.cpp	Sun Oct 06 22:45:00 2013 +0600
+++ b/mm7_data.cpp	Sun Oct 06 22:45:11 2013 +0600
@@ -1055,7 +1055,7 @@
 int dword_5B65C0; // weak
 int dword_5B65C4; // weak
 int dword_5B65C8_timers_count; // weak
-int dword_5B65CC; // weak
+int npcIdToDismissAfterDialogue; // weak
 signed int dword_5B65D0_dialogue_actor_npc_id; // weak
 int dword_5C3418; // weak
 int dword_5C341C; // weak
--- a/mm7_data.h	Sun Oct 06 22:45:00 2013 +0600
+++ b/mm7_data.h	Sun Oct 06 22:45:11 2013 +0600
@@ -703,7 +703,7 @@
 extern int dword_5B65C0; // weak
 extern int dword_5B65C4; // weak
 extern int dword_5B65C8_timers_count; // weak
-extern int dword_5B65CC; // weak
+extern int npcIdToDismissAfterDialogue; // weak
 extern int dword_5B65D0_dialogue_actor_npc_id; // weak
 extern int dword_5C3418; // weak
 extern int dword_5C341C; // weak