changeset 1820:af7f08135ffb

Player::SubtractVariable changing return val to void, finishing cleanup
author Grumpy7
date Tue, 08 Oct 2013 07:10:00 +0200
parents 1641ab7f21ec
children 49a4db499c0a
files Events.cpp Player.cpp Player.h
diffstat 3 files changed, 486 insertions(+), 384 deletions(-) [+]
line wrap: on
line diff
--- a/Events.cpp	Tue Oct 08 05:46:44 2013 +0200
+++ b/Events.cpp	Tue Oct 08 07:10:00 2013 +0200
@@ -1020,8 +1020,7 @@
           v130 = 0;
           for(int i = 1; i < 5; ++i)
           {
-            if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
-              break;
+            pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
           }
           ++v130;
         }
--- a/Player.cpp	Tue Oct 08 05:46:44 2013 +0200
+++ b/Player.cpp	Tue Oct 08 07:10:00 2013 +0200
@@ -4310,7 +4310,7 @@
 //----- (004908A8) --------------------------------------------------------
 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime)
 {
-  if ( pConditions[uCondition] && (uTime < (signed long long)pConditions[uCondition]) )
+  if ( pConditions[uCondition] && (uTime < (unsigned long long)pConditions[uCondition]) )
   {
     pConditions[uCondition] = 0i64;
     return true;
@@ -6586,66 +6586,473 @@
 }
 
 //----- (0044B9C4) --------------------------------------------------------
-bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue)
-{
-  unsigned int v3; // ebx@1
-  signed int v4; // esi@1
-  bool result; // eax@8
-  int v6; // esi@11
-  int v7; // edi@14
-  signed int v8; // eax@17
-  char *v9; // eax@20
-  char v10; // sf@20
-  char *v11; // ecx@26
-  char *v12; // ecx@27
-  __int64 v13; // qax@27
-  unsigned __int8 v14; // cf@27
-  int *v15; // edx@29
-  char *v16; // eax@90
-  char *v17; // ecx@94
-  int v18; // esi@97
-  signed int v19; // edx@97
-  char *v20; // ecx@98
-  int v21; // eax@100
-  __int16 v22; // dx@112
-  int v23; // [sp-8h] [bp-14h]@45
-  signed int v24; // [sp-4h] [bp-10h]@4
-  int v25; // [sp-4h] [bp-10h]@45
-
-  v4 = 0;
+void Player::SubtractVariable( enum VariableType VarNum, signed int pValue )
+{
+  signed int playerId; // esi@1
+  DDM_DLV_Header *locationHeader; // eax@90
+  int randGold;
+  int randFood;
+  int npcIndex;
+
+  playerId = 0;
   if ( this == pPlayers[2] )
-    v4 = 1;
+    playerId = 1;
   else if ( this == pPlayers[3] )
-    v4 = 2;
+    playerId = 2;
   else if ( this == pPlayers[4] )  
-    v4 = 3;
-  
-
-
+    playerId = 3;
 
   if ( VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_99 )
   {
 
     byte_5E4C15[VarNum] -= (char)pValue;
-    return false;
+    return;
   }
 
   switch (VarNum)
   {
-    case VAR_NumDeaths:
-        pParty->uNumDeaths -= (unsigned int)pValue;
-        return pValue;
+    case VAR_CurrentHP:
+      ReceiveDamage((signed int)pValue, DMGT_PHISYCAL);
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_CurrentSP:
+      this->sMana = max(this->sMana - pValue, 0);
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_ACModifier:
+      this->sACModifier -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_BaseLevel:
+      this->uLevel -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_LevelModifier:
+      this->sLevelModifier -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Age:
+      this->sAgeModifier -= (signed __int16)pValue;
+      return;
+    case VAR_Award:
+      _449B7E_toggle_bit(this->_achieved_awards_bits, (signed __int16)pValue, 0);
+      return;
+    case VAR_Experience:
+      this->uExperience -= pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_QBits_QuestsDone:
+      _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0);
+      this->PlaySound(SPEECH_96, 0);
+      return;
+    case VAR_PlayerItemInHands:
+      for (int i = 0; i < 126; i++)
+      {
+        if ( this->pInventoryItemList[pInventoryMatrix[i]].uItemID == pValue )
+        {
+          RemoveItemAtInventoryIndex(i);
+          return;
+        }
+      }
+      if ( pParty->pPickedItem.uItemID == pValue )
+      {
+        pMouse->RemoveHoldingItem();
+        return;
+      }
+      return;
+    case VAR_FixedGold:
+      if ( (unsigned int)pValue > pParty->uNumGold )
+      {
+        dword_5B65C4 = 1;
+        return;
+      }
+      Party::TakeGold((unsigned int)pValue);
+      return;
+    case VAR_RandomGold:
+      randGold = rand() % (signed int)pValue + 1;
+      if ( (unsigned int)randGold > pParty->uNumGold )
+        randGold = pParty->uNumGold;
+      Party::TakeGold(randGold);
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], randGold);
+      ShowStatusBarString(pTmpBuf.data(), 2);
+      GameUI_DrawFoodAndGold();
+      return;
+    case VAR_FixedFood:
+      Party::TakeFood((unsigned int)pValue);
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_RandomFood:
+      randFood = rand() % (signed int)pValue + 1;
+      if ( (unsigned int)randFood > pParty->uNumFoodRations )
+        randFood = pParty->uNumFoodRations;
+      Party::TakeFood(randFood);
+      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], randFood);
+      ShowStatusBarString(pTmpBuf.data(), 2u);
+      GameUI_DrawFoodAndGold();
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_MightBonus:
+    case VAR_ActualMight:
+      this->uMightBonus -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_IntellectBonus:
+    case VAR_ActualIntellect:
+      this->uIntelligenceBonus -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_PersonalityBonus:
+    case VAR_ActualPersonality:
+      this->uWillpowerBonus -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_EnduranceBonus:
+    case VAR_ActualEndurance:
+      this->uEnduranceBonus -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_SpeedBonus:
+    case VAR_ActualSpeed:
+      this->uSpeedBonus -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_AccuracyBonus:
+    case VAR_ActualAccuracy:
+      this->uAccuracyBonus -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_LuckBonus:
+    case VAR_ActualLuck:
+      this->uLuckBonus -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_BaseMight:
+      this->uMight -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_BaseIntellect:
+      this->uIntelligence -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_BasePersonality:
+      this->uWillpower -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_BaseEndurance:
+      this->uEndurance -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_BaseSpeed:
+      this->uSpeed -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_BaseAccuracy:
+      this->uAccuracy -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_BaseLuck:
+      this->uLuck -= (unsigned __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_FireResistance:
+      this->sResFireBase -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_AirResistance:
+      this->sResAirBase -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_WaterResistance:
+      this->sResWaterBase -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_EarthResistance:
+      this->sResEarthBase -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_SpiritResistance:
+      this->sResSpiritBase -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_MindResistance:
+      this->sResMindBase -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_BodyResistance:
+      this->sResBodyBase -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_LightResistance:
+      this->sResLightBase -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_DarkResistance:
+      this->sResDarkBase -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_MagicResistance:
+      this->sResMagicBase -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_FireResistanceBonus:
+      this->sResFireBonus -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_AirResistanceBonus:
+      this->sResAirBonus -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92);
+      return;
+    case VAR_WaterResistanceBonus:
+      this->sResWaterBonus -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_EarthResistanceBonus:
+      this->sResEarthBonus -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_SpiritResistanceBonus:
+      this->sResSpiritBonus -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_MindResistanceBonus:
+      this->sResMindBonus -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_BodyResistanceBonus:
+      this->sResBodyBonus -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_LightResistanceBonus:
+      this->sResLightBonus -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_DarkResistanceBonus:
+      this->sResDarkBonus -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_MagicResistanceBonus:
+      this->sResMagicBonus -= (signed __int16)pValue;
+      this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91);
+      return;
+    case VAR_StaffSkill:
+      this->skillStaff -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_SwordSkill:
+      this->skillSword -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_DaggerSkill:
+      this->skillDagger -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_AxeSkill:
+      this->skillAxe -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_SpearSkill:
+      this->skillSpear -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_BowSkill:
+      this->skillBow -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_MaceSkill:
+      this->skillMace -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_BlasterSkill:
+      this->skillBlaster -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_ShieldSkill:
+      this->skillShield -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_LeatherSkill:
+      this->skillLearning -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_SkillChain:
+      this->skillChain -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_PlateSkill:
+      this->skillPlate -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_FireSkill:
+      this->skillFire -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_AirSkill:
+      this->skillAir -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_WaterSkill:
+      this->skillWater -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_EarthSkill:
+      this->skillEarth -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_SpiritSkill:
+      this->skillSpirit -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_MindSkill:
+      this->skillMind -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_BodySkill:
+      this->skillBody -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_LightSkill:
+      this->skillLight -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_DarkSkill:
+      this->skillDark -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_IdentifyItemSkill:
+      this->skillItemId -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_MerchantSkill:
+      this->skillMerchant -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_RepairSkill:
+      this->skillRepair -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_BodybuildingSkill:
+      this->skillBodybuilding -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_MeditationSkill:
+      this->skillMeditation -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_PerceptionSkill:
+      this->skillPerception -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_DiplomacySkill:
+      this->skillDiplomacy -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_DisarmTrapSkill:
+      this->skillDisarmTrap -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_DodgeSkill:
+      this->skillDodge -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_UnarmedSkill:
+      this->skillUnarmed -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_IdentifyMonsterSkill:
+      this->skillMonsterId -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_ArmsmasterSkill:
+      this->skillArmsmaster -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_StealingSkill:
+      this->skillStealing -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_AlchemySkill:
+      this->skillAlchemy -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_LearningSkill:
+      this->skillLearning -= (unsigned __int8)pValue;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Cursed:
+      this->pConditions[Condition_Cursed] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Weak:
+      this->pConditions[Condition_Weak] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Asleep:
+      this->pConditions[Condition_Sleep] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Afraid:
+      this->pConditions[Condition_Fear] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Drunk:
+      this->pConditions[Condition_Drunk] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Insane:
+      this->pConditions[Condition_Insane] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_PoisonedGreen:
+      this->pConditions[Condition_Poison1] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_DiseasedGreen:
+      this->pConditions[Condition_Disease1] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_PoisonedYellow:
+      this->pConditions[Condition_Poison2] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_DiseasedYellow:
+      this->pConditions[Condition_Disease2] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_PoisonedRed:
+      this->pConditions[Condition_Poison3] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_DiseasedRed:
+      this->pConditions[Condition_Disease3] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Paralyzed:
+      this->pConditions[Condition_Paralyzed] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Unconsious:
+      this->pConditions[Condition_Unconcious] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Dead:
+      this->pConditions[Condition_Dead] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Stoned:
+      this->pConditions[Condition_Pertified] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
+    case VAR_Eradicated:
+      this->pConditions[Condition_Eradicated] = 0;
+      PlayAwardSound_Anim98(playerId);
+      return;
     case VAR_AutoNotes:
-      v11 = (char *)pParty->_autonote_bits;
-      v22 = (short)pValue - 1;
-      _449B7E_toggle_bit((unsigned char *)v11, v22, 0);
-      return result;
-
+      _449B7E_toggle_bit(pParty->_autonote_bits, pValue - 1, 0);
+      return;
     case VAR_NPCs2:
-      v18 = 0;
-      GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &v18);
-      result = (bool) pValue;
-      if ( v18 == pValue )
+      npcIndex = 0;
+      GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &npcIndex);
+      if ( npcIndex == pValue )
       {
         npcIdToDismissAfterDialogue = pValue;
       }
@@ -6657,376 +7064,72 @@
         pParty->CountHirelings();
         viewparams->bRedrawGameUI = true;
       }
-      return result;
-      break;
+      return;
     case VAR_HiredNPCHasSpeciality:
-      if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
+      for (unsigned int i = 0; i < pNPCStats->uNumNewNPCs; i++)
       {
-        v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags;
-        for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 )
+        if (pNPCStats->pNewNPCData[i].uProfession == pValue)
         {
-          if ( *((void **)v20 + 4) == (void *)pValue )
-          {
-            v21 = *(int *)v20;
-            if ( (char)*(int *)v20 < 0 )
-            {
-              LOBYTE(v21) = v21 & 0x7F;
-              *(int *)v20 = v21;
-            }
-          }
-          v20 += 76;
+          LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu;
         }
       }
       if ( pParty->pHirelings[0].uProfession == pValue )
-        memset(pParty->pHirelings, 0, 0x4Cu);
+        memset(pParty->pHirelings, 0, sizeof(NPCData));
       if ( pParty->pHirelings[1].uProfession == pValue )
-        memset(&pParty->pHirelings[1], 0, 0x4Cu);
+        memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
       pParty->hirelingScrollPosition = 0;
       pParty->CountHirelings();
-      return result;
-      break;
-
+      return;
     case VAR_NumSkillPoints:
-      v17 = (char *)&this->uSkillPoints;
-      result = *v17 != NULL;
-      if ( (unsigned int)pValue <= *(int *)v17 )
+      if ((unsigned int)pValue <= this->uSkillPoints)
       {
-        *(int *)v17 -= (int)pValue;
-        result = (v17 != NULL);
+        this->uSkillPoints -= pValue;
       }
       else
-        *(int *)v17 = 0;
-      return result;
-      break;
+      {
+        this->uSkillPoints = 0;
+      }
+      return;
     case VAR_ReputationInCurrentLocation:
-      v16 = (char *)&pOutdoor->ddm;
+      locationHeader = &pOutdoor->ddm;
       if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
-        v16 = (char *)&pIndoor->dlv;
-      *((int *)v16 + 2) -= (int)pValue;
-      if ( *((int *)v16 + 2) < -10000 )
-        *((int *)v16 + 2) = -10000;
-      return result;
-      break;
+        locationHeader = &pIndoor->dlv;
+      locationHeader->uReputation -= pValue;
+      if (locationHeader->uReputation < -10000)
+        locationHeader->uReputation = -10000;
+      return;
     case VAR_GoldInBank:
-      result = VarNum - 306;
       if ( (unsigned int)pValue <= pParty->uNumGoldInBank )
       {
-        result = (bool)pValue;
         pParty->uNumGoldInBank -= (unsigned int)pValue;
       }
       else
       {
         dword_5B65C4 = 1;
       }
-      return result;
-      break;
-
-
+      return;
+    case VAR_NumDeaths:
+        pParty->uNumDeaths -= (unsigned int)pValue;
+        return;
     case VAR_NumBounties:
-      result = (bool)pValue;
       pParty->uNumBountiesCollected -= (unsigned int)pValue;
-      break;
+      return;
     case VAR_PrisonTerms:
-      result = (bool)pValue;
       pParty->uNumPrisonTerms -= (int)pValue;
-      break;
+      return;
     case VAR_ArenaWinsPage:
-      result = (bool)pValue;
       pParty->uNumArenaPageWins -= (char)pValue;
-      break;
+      return;
     case VAR_ArenaWinsSquire:
-      result = (bool)pValue;
       pParty->uNumArenaSquireWins -= (char)pValue;
-      break;
+      return;
     case VAR_ArenaWinsKnight:
-      result = (bool)pValue;
       pParty->uNumArenaKnightWins -= (char)pValue;
-      break;
+      return;
     case VAR_ArenaWinsLord:
-      result = (bool)pValue;
       pParty->uNumArenaLordWins -= (char)pValue;
-      break;
-
-
-    case VAR_RandomGold:
-      v6 = rand() % (signed int)pValue + 1;
-      if ( v6 > pParty->uNumGold )
-        v6 = pParty->uNumGold;
-      Party::TakeGold(v6);
-      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6);
-      ShowStatusBarString(pTmpBuf.data(), 2);
-      GameUI_DrawFoodAndGold();
-      return result;
-    case VAR_RandomFood:
-      v7 = rand() % (signed int)pValue + 1;
-      if ( v7 > pParty->uNumFoodRations )
-        v7 = pParty->uNumFoodRations;
-      Party::TakeFood(v7);
-      sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7);
-      ShowStatusBarString(pTmpBuf.data(), 2u);
-      GameUI_DrawFoodAndGold();
-      PlayAwardSound_Anim98(v4);
-      return result;
-    case VAR_CurrentHP:
-      ReceiveDamage((signed int)pValue, DMGT_PHISYCAL);
-      PlayAwardSound_Anim98(v4);
-      return result;
-    case VAR_CurrentSP:
-      this->sMana = max(this->sMana - pValue, 0);
-      PlayAwardSound_Anim98(v4);
-      return result;
-    case VAR_ACModifier:
-      this->sACModifier -= (unsigned __int8)pValue;
-      PlayAwardSound_Anim98(v4);
-      return result;
-    case VAR_BaseLevel:
-      this->uLevel -= (unsigned __int8)pValue;
-      PlayAwardSound_Anim98(v4);
-      return result;
-    case VAR_LevelModifier:
-      this->sLevelModifier -= (unsigned __int8)pValue;
-      PlayAwardSound_Anim98(v4);
-      return result;
-    case VAR_Age:
-      this->sAgeModifier -= (signed __int16)pValue;
-      return result;
-    case VAR_Award:
-      _449B7E_toggle_bit(this->_achieved_awards_bits, (signed __int16)pValue, 0);
-      return result;
-    case VAR_Experience:
-      this->uExperience -= pValue;
-      PlayAwardSound_Anim98(v4);
-      return result;
-    case VAR_QBits_QuestsDone:
-      _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0);
-      this->PlaySound(SPEECH_96, 0);
-      return true;
-    case VAR_PlayerItemInHands:
-      for (v3 = 0; v3 < 126; v3++)
-      {
-        if ( this->pInventoryItemList[pInventoryMatrix[v3]].uItemID == pValue )
-        {
-          RemoveItemAtInventoryIndex(v3);
-          return true;
-        }
-      }
-      if ( pParty->pPickedItem.uItemID == pValue )
-      {
-        pMouse->RemoveHoldingItem();
-        return true;
-      }
-      return false;
-      break;
-    case VAR_FixedGold:
-      if ( (unsigned int)pValue > pParty->uNumGold )
-      {
-        dword_5B65C4 = 1;
-        return result;
-      }
-      Party::TakeGold((unsigned int)pValue);
-      return result;
-    case VAR_MightBonus:
-    case VAR_ActualMight:
-      this->uMightBonus -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_IntellectBonus:
-    case VAR_ActualIntellect:
-      this->uIntelligenceBonus -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_PersonalityBonus:
-    case VAR_ActualPersonality:
-      this->uWillpowerBonus -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_EnduranceBonus:
-    case VAR_ActualEndurance:
-      this->uEnduranceBonus -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_SpeedBonus:
-    case VAR_ActualSpeed:
-      this->uSpeedBonus -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_AccuracyBonus:
-    case VAR_ActualAccuracy:
-      this->uAccuracyBonus -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_LuckBonus:
-    case VAR_ActualLuck:
-      this->uLuckBonus -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_BaseMight:
-      this->uMight -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_BaseIntellect:
-      this->uIntelligence -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_BasePersonality:
-      this->uWillpower -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_BaseEndurance:
-      this->uEndurance -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_BaseSpeed:
-      this->uSpeed -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_BaseAccuracy:
-      this->uAccuracy -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_BaseLuck:
-      this->uLuck -= (unsigned __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_FireResistance:
-      this->sResFireBase -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_AirResistance:
-      this->sResAirBase -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_WaterResistance:
-      this->sResWaterBase -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_EarthResistance:
-      this->sResEarthBase -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_SpiritResistance:
-      this->sResSpiritBase -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_MindResistance:
-      this->sResMindBase -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_BodyResistance:
-      this->sResBodyBase -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_LightResistance:
-      this->sResLightBase -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_DarkResistance:
-      this->sResDarkBase -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_MagicResistance:
-      this->sResMagicBase -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_FireResistanceBonus:
-      this->sResFireBonus -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_AirResistanceBonus:
-      this->sResAirBonus -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_92);
-      return result;
-    case VAR_WaterResistanceBonus:
-      this->sResWaterBonus -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_EarthResistanceBonus:
-      this->sResEarthBonus -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_SpiritResistanceBonus:
-      this->sResSpiritBonus -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_MindResistanceBonus:
-      this->sResMindBonus -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_BodyResistanceBonus:
-      this->sResBodyBonus -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_LightResistanceBonus:
-      this->sResLightBonus -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_DarkResistanceBonus:
-      this->sResDarkBonus -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_MagicResistanceBonus:
-      this->sResMagicBonus -= (signed __int16)pValue;
-      this->PlayAwardSound_Anim98_Face(v4, SPEECH_91);
-      return result;
-    case VAR_FixedFood:
-      Party::TakeFood((unsigned int)pValue);
-      PlayAwardSound_Anim98(v4);
-      return result;
-    case VAR_StaffSkill:
-    case VAR_SwordSkill:
-    case VAR_DaggerSkill:
-    case VAR_AxeSkill:
-    case VAR_SpearSkill:
-    case VAR_BowSkill:
-    case VAR_MaceSkill:
-    case VAR_BlasterSkill:
-    case VAR_ShieldSkill:
-    case VAR_LeatherSkill:
-    case VAR_SkillChain:
-    case VAR_PlateSkill:
-    case VAR_FireSkill:
-    case VAR_AirSkill:
-    case VAR_WaterSkill:
-    case VAR_EarthSkill:
-    case VAR_SpiritSkill:
-    case VAR_MindSkill:
-    case VAR_BodySkill:
-    case VAR_LightSkill:
-    case VAR_DarkSkill:
-    case VAR_IdentifyItemSkill:
-    case VAR_MerchantSkill:
-    case VAR_RepairSkill:
-    case VAR_BodybuildingSkill:
-    case VAR_MeditationSkill:
-    case VAR_PerceptionSkill:
-    case VAR_DiplomacySkill:
-    case VAR_DisarmTrapSkill:
-    case VAR_LearningSkill:
-      *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue;
-      PlayAwardSound_Anim98(v4);
-      return result;
-    case VAR_Cursed:
-    case VAR_Weak:
-    case VAR_Asleep:
-    case VAR_Afraid:
-    case VAR_Drunk:
-    case VAR_Insane:
-    case VAR_PoisonedGreen:
-    case VAR_DiseasedGreen:
-    case VAR_PoisonedYellow:
-    case VAR_DiseasedYellow:
-    case VAR_PoisonedRed:
-    case VAR_DiseasedRed:
-    case VAR_Paralyzed:
-    case VAR_Unconsious:
-    case VAR_Dead:
-    case VAR_Stoned:
-    case VAR_Eradicated:
-      this->pConditions[VarNum] = 0;
-      PlayAwardSound_Anim98(v4);
-      return result;
-  }
-  return false;
+      return;
+  }
 }
 // 5B65C4: using guessed type int dword_5B65C4;
 // 5B65CC: using guessed type int dword_5B65CC;
--- a/Player.h	Tue Oct 08 05:46:44 2013 +0200
+++ b/Player.h	Tue Oct 08 07:10:00 2013 +0200
@@ -474,7 +474,7 @@
 
   void SetVariable(enum VariableType var, signed int a3);
   void AddVariable(enum VariableType var, signed int val);
-  bool SubtractVariable(enum VariableType VarNum, signed int pValue);
+  void SubtractVariable(enum VariableType VarNum, signed int pValue);
   bool CompareVariable(enum VariableType VarNum, signed int pValue);
   void UseItem_DrinkPotion_etc(signed int a2, int a3);
   bool AddItem(struct ItemGen *pItem);