# HG changeset patch # User Grumpy7 # Date 1380785751 -7200 # Node ID 3155be890554d24211b75bc8fc647138c21d5c28 # Parent 9f610f47128331ed0fd39e8b02b4d3ed88ac6fe5 Player::AddVariable moving everything to a switch, cleaning up, finishing diff -r 9f610f471283 -r 3155be890554 Player.cpp --- a/Player.cpp Thu Oct 03 08:53:25 2013 +0200 +++ b/Player.cpp Thu Oct 03 09:35:51 2013 +0200 @@ -6017,35 +6017,12 @@ //----- (0044AFFB) -------------------------------------------------------- void Player::AddVariable(enum VariableType var_type, signed int val) { - char v3; // bl@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 - char *v15; // ecx@37 - unsigned __int8 v16; // cf@38 - __int16 *v18; // esi@53 - __int16 *v19; // esi@62 - char *v20; // esi@107 - __int16 v21; // dx@107 - int v22; // ecx@107 - 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 ItemGen item; // [sp+Ch] [bp-2Ch]@45 - unsigned int v33; // [sp+30h] [bp-8h]@34 - char v34; // [sp+37h] [bp-1h]@1 - - v3 = 0; - v34 = 0; + uPlayerIdx = 0; if ( this == pPlayers[2] ) uPlayerIdx = 1; @@ -6054,473 +6031,528 @@ else if ( this == pPlayers[4] ) uPlayerIdx = 3; - if ( var_type <= VAR_AutoNotes ) - { - if ( var_type != VAR_AutoNotes ) - { - if ( var_type <= VAR_ActualMight ) - { - if ( var_type != VAR_ActualMight ) - { - switch ( var_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 ) - { - 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: - 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: - 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: - this->uMightBonus = min(this->uMightBonus + val, 255); - PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); - return; - } - if ( var_type <= VAR_FireResistanceBonus ) - { - if ( var_type != VAR_FireResistanceBonus ) - { - switch ( var_type ) - { - case VAR_ActualIntellect: -LABEL_66: - this->uIntelligenceBonus = min(this->uIntelligenceBonus + val, 255); - PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); - return; - case VAR_ActualPersonality: -LABEL_67: - this->uWillpowerBonus = min(this->uWillpowerBonus + val, 255); - PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); - return; - case VAR_ActualEndurance: -LABEL_68: - this->uEnduranceBonus = min(this->uEnduranceBonus + val, 255); - PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); - return; - case VAR_ActualSpeed: -LABEL_69: - this->uSpeedBonus = min(this->uSpeedBonus + val, 255); - PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); - return; - case VAR_ActualAccuracy: -LABEL_70: - this->uAccuracyBonus = min(this->uAccuracyBonus + val, 255); - PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); - return; - case VAR_ActualLuck: -LABEL_71: - 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; - default: - return; - } - return; - } - this->sResFireBonus = min(this->sResFireBonus + val, 255); - PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); - return; - } - if ( var_type <= VAR_DisarmTrapSkill ) - { - if ( var_type != VAR_DisarmTrapSkill ) - { - if ( var_type <= VAR_BodyResistanceBonus ) - { - switch ( var_type ) - { - case VAR_BodyResistanceBonus: - this->sResBodyBonus = min(this->sResBodyBonus + 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; - break; - default: - return; - } - } - if ( var_type == VAR_LightResistanceBonus ) - { - this->sResLightBonus = min(this->sResLightBonus + val, 255); - PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); - return; - } - if ( var_type == VAR_DarkResistanceBonus ) - { - this->sResDarkBonus = min(this->sResDarkBonus + val, 255); - PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); - return; - } - if ( var_type == VAR_MagicResistanceBonus ) - { - this->sResMagicBonus = min(this->sResMagicBonus + val, 255); - PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); - return; - } - if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) - return; - } - if ( val <= 63 ) - { - *((short *)&this->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&this->pConditions[16] + 2 * var_type) & 63; - } - else - { - v20 = (char *)&this->pConditions[16] + 2 * var_type; - v21 = *(short *)v20; - v22 = (unsigned __int8)val + (v21 & 63); - if ( v22 > 60 ) - LOWORD(v22) = 60; - LOBYTE(v21) = v21 & 0xC0; - *(short *)v20 = v22 | v21; - } - PlayAwardSound_Anim97(uPlayerIdx); - return; - } - if ( var_type == VAR_LearningSkill ) - { - if ( val <= 63 ) - { - *((short *)&this->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&this->pConditions[16] + 2 * var_type) & 63; - } - else - { - v20 = (char *)&this->pConditions[16] + 2 * var_type; - v21 = *(short *)v20; - v22 = (unsigned __int8)val + (v21 & 63); - if ( v22 > 60 ) - LOWORD(v22) = 60; - LOBYTE(v21) = v21 & 0xC0; - *(short *)v20 = v22 | v21; - } - PlayAwardSound_Anim97(uPlayerIdx); - return; - } - if ( var_type <= VAR_LearningSkill ) - return; - if ( var_type <= VAR_Eradicated ) - { - this->SetCondition(var_type - 105, 0); - } - else - { - if ( var_type != VAR_MajorCondition ) - { - 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; - } - memset(this, 0, 0xA0u); - } - PlayAwardSound_Anim97(uPlayerIdx); - return; - } - if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText ) - { - this->PlaySound(SPEECH_96, 0); - //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; - bFlashAutonotesBook = 1; - _506568_autonote_type = pAutonoteTxt[val].eType; - pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); - } - _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); + 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_GoldInBank ) - { - if ( var_type == 307 ) - { - pParty->uNumDeaths += val; - return; - } - switch ( var_type ) + + 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]) { - 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; + pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed; + if (pStorylineText->StoreLine[var_type - VAR_History_0].pText = 0) + { + bFlashHistoryBook = 1; + PlayAwardSound(uPlayerIdx); + } } - } - else - { - if ( var_type == VAR_GoldInBank ) - { - pParty->uNumGoldInBank += val; - return; - } - if ( var_type <= VAR_Counter10 ) - { - if ( (signed int)var_type >= 245 ) + 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 ) { - pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed; + PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_96); } - else + _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 ) { - switch ( var_type ) - { - case VAR_PlayerBits: - _449B7E_toggle_bit((unsigned char *)this->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: - this->uSkillPoints += val; - break; - } + item.uNumCharges = rand() % 6 + item.GetDamageMod() + 1; + item.uMaxCharges = LOBYTE(item.uNumCharges); } - return; - } - if ( var_type <= VAR_Counter10 ) - return; - if ( var_type <= VAR_UnknownTimeEvent19 ) - { - pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed; + 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; - } - 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) ) + 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 ) + { + this->PlaySound(SPEECH_96, 0); + bFlashAutonotesBook = 1; + _506568_autonote_type = pAutonoteTxt[val].eType; + pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); + } + _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); + PlayAwardSound(uPlayerIdx); return; - bFlashHistoryBook = 1; - PlayAwardSound(uPlayerIdx); - return; - } - v27 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v27 = &pIndoor->dlv; - v27->uReputation += val; - if ( v27->uReputation > 10000 ) - v27->uReputation = 10000; + case VAR_PlayerBits: + _449B7E_toggle_bit((unsigned char *)this->field_1A50, val, 1u); + return; + case VAR_NPCs2: + pParty->field_709 = 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; + 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; } }