Mercurial > mm7
diff Player.cpp @ 1736:c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
author | Grumpy7 |
---|---|
date | Fri, 27 Sep 2013 10:04:45 +0200 |
parents | 34dd357a489d |
children | ef86fc6d6a80 |
line wrap: on
line diff
--- a/Player.cpp Thu Sep 26 08:09:05 2013 +0200 +++ b/Player.cpp Fri Sep 27 10:04:45 2013 +0200 @@ -24,6 +24,7 @@ #include "Awards.h" #include "texts.h" +#include "stru123.h" #include "mm7_data.h" #include "MM7.h" #include "SpriteObject.h" @@ -1688,7 +1689,6 @@ //----- (0048D0B9) -------------------------------------------------------- int Player::GetRangedAttack() { - int v2; // eax@1 int v3; // edi@3 int v4; // eax@4 int v5; // edi@4 @@ -4985,98 +4985,79 @@ } } + +bool CmpSkillValue(int valToCompare, int skillValue) +{ + int v4; + if ( valToCompare <= 63 ) + v4 = skillValue & 0x3F; + else + v4 = valToCompare & skillValue; + return v4 >= valToCompare; +} + //----- (00449BB4) -------------------------------------------------------- -bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive +bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive and v4 was -1 by default { Assert(pValue >= 0, "Compare variable shouldn't have negative arguments"); signed int v4; // edi@1 - unsigned int v5; // eax@8 - int v6; // eax@9 - enum CHARACTER_RACE v7; // eax@11 - signed int v8; // eax@17 - unsigned __int8 v9; // sf@17 - unsigned __int8 v10; // of@17 - int v11; // eax@19 - unsigned int v12; // eax@20 - unsigned int test_bit_value; // eax@25 + unsigned __int8 test_bit_value; // eax@25 unsigned __int8 byteWithRequestedBit; // cl@25 - signed int v15; // ecx@28 - ItemGen *v16; // eax@28 - int v18; // edi@90 DDM_DLV_Header *v19; // eax@122 DDM_DLV_Header *v21; // eax@126 - unsigned int v22; // edi@129 - Player *v23; // esi@134 - ItemGen *v24; // ecx@135 - signed int v25; // edx@135 - ITEM_EQUIP_TYPE v26; // ebx@155 - char *v27; // edi@155 - int v28; // ebx@161 - int v29; // eax@161 - - v6 = 0; - v4 = -1; + int actStat; // ebx@161 + int baseStat; // eax@161 + if ( VarNum > VAR_AutoNotes ) { switch ( VarNum ) { - case VAR_Invisible: - if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) + case VAR_AutoNotes : //TODO: find out why the double subtraction. or whether this is even used + test_bit_value = 0x80u >> (pValue - 2) % 8; + byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8]; + return (test_bit_value & byteWithRequestedBit) != 0; + case VAR_IsMightMoreThanBase: + actStat = GetActualMight(); + baseStat = GetBaseStrength(); + return (actStat >= baseStat); + case VAR_IsIntellectMoreThanBase: + actStat = GetActualIntelligence(); + baseStat = GetBaseIntelligence(); + return (actStat >= baseStat); + case VAR_IsPersonalityMoreThanBase: + actStat = GetActualWillpower(); + baseStat = GetBaseWillpower(); + return (actStat >= baseStat); + case VAR_IsEnduranceMoreThanBase: + actStat = GetActualEndurance(); + baseStat = GetBaseEndurance(); + return (actStat >= baseStat); + case VAR_IsSpeedMoreThanBase: + actStat = GetActualSpeed(); + baseStat = GetBaseSpeed(); + return (actStat >= baseStat); + case VAR_IsAccuracyMoreThanBase: + actStat = GetActualAccuracy(); + baseStat = GetBaseAccuracy(); + return (actStat >= baseStat); + case VAR_IsLuckMoreThanBase: + actStat = GetActualLuck(); + baseStat = GetBaseLuck(); + return (actStat >= baseStat); + case VAR_PlayerBits: + test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; + byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8]; + return ( test_bit_value & byteWithRequestedBit ) != 0; + case VAR_NPCs2: + return pNPCStats->pNewNPCData[pValue].Hired(); + case VAR_IsFlying: + if ( pParty->bFlying + && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) return true; return false; - case VAR_NumDeaths: - v4 = pParty->uNumDeaths; - return v4 >= pValue; - case VAR_NumBounties: - v4 = pParty->uNumBountiesCollected; - return v4 >= pValue; - case VAR_PrisonTerms: - v4 = pParty->uNumPrisonTerms; - return v4 >= pValue; - case VAR_ArenaWinsPage: - v4 = (unsigned __int8)pParty->uNumArenaPageWins; - return v4 >= pValue; - case VAR_ArenaWinsSquire: - v4 = (unsigned __int8)pParty->uNumArenaSquireWins; - return v4 >= pValue; - case VAR_ArenaWinsKnight: - v4 = (unsigned __int8)pParty->uNumArenaKnightWins; - return v4 >= pValue; - case VAR_ArenaWinsLord: - v4 = (unsigned __int8)pParty->uNumArenaLordWins; - return v4 >= pValue; - case VAR_ReputationInCurrentLocation: - v19 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v19 = &pIndoor->dlv; - v6 = v19->uReputation >= pValue; - return v6; - case VAR_Unknown1: - v21 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v21 = &pIndoor->dlv; - v6 = v21->field_C_alert == pValue; - return v6; - case VAR_Counter1: - case VAR_Counter2: - case VAR_Counter3: - case VAR_Counter4: - case VAR_Counter5: - case VAR_Counter6: - case VAR_Counter7: - case VAR_Counter8: - case VAR_Counter9: - case VAR_Counter10: - v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; - if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] - && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) - + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) - return true; - return false; - case VAR_NumSkillPoints: - v4 = this->uSkillPoints; - return v4 >= pValue; + case VAR_HiredNPCHasSpeciality: + return CheckHiredNPCSpeciality(pValue); case VAR_CircusPrises: //isn't used in MM6 since 0x1D6u is a book of regeneration v4 = 0; for (int playerNum = 0; playerNum < 4; playerNum++) @@ -5099,25 +5080,52 @@ } } return v4 >= pValue; + case VAR_NumSkillPoints: + return this->uSkillPoints >= (unsigned int)pValue; case VAR_MonthIs: - v6 = pParty->uCurrentMonth == pValue; - return v6; - case VAR_IsFlying: - if ( pParty->bFlying - && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) - return true; - return false; - case VAR_HiredNPCHasSpeciality: - return CheckHiredNPCSpeciality(pValue); - case VAR_NPCs2: - return pNPCStats->pNewNPCData[pValue].Hired(); - case VAR_PlayerBits: - test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; - byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8]; - if ( !((unsigned __int8)test_bit_value & byteWithRequestedBit) ) - return v4 >= pValue; - v4 = pValue; - return v4 >= pValue; + return (pParty->uCurrentMonth == (unsigned int)pValue); + case VAR_Counter1: + case VAR_Counter2: + case VAR_Counter3: + case VAR_Counter4: + case VAR_Counter5: + case VAR_Counter6: + case VAR_Counter7: + case VAR_Counter8: + case VAR_Counter9: + case VAR_Counter10: + if (pParty->field_3C.CounterEventValues[VarNum - VAR_Counter1]) + { + return (pParty->field_3C.CounterEventValues[VarNum - VAR_Counter1] + 460800 * pValue * 0.033333335) <= pParty->uTimePlayed ; + } + case VAR_ReputationInCurrentLocation: + v19 = &pOutdoor->ddm; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) + v19 = &pIndoor->dlv; + return (v19->uReputation >= pValue); + case VAR_Unknown1: + v21 = &pOutdoor->ddm; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) + v21 = &pIndoor->dlv; + return (v21->field_C_alert == pValue); //yes, equality, not >= + case VAR_GoldInBank: + return pParty->uNumGoldInBank >= (unsigned int)pValue; + case VAR_NumDeaths: + return pParty->uNumDeaths >= (unsigned int)pValue; + case VAR_NumBounties: + return pParty->uNumBountiesCollected >= (unsigned int)pValue; + case VAR_PrisonTerms: + return pParty->uNumPrisonTerms >= pValue; + case VAR_ArenaWinsPage: + return (unsigned __int8)pParty->uNumArenaPageWins >= pValue; + case VAR_ArenaWinsSquire: + return (unsigned __int8)pParty->uNumArenaSquireWins >= pValue; + case VAR_ArenaWinsKnight: + return (unsigned __int8)pParty->uNumArenaKnightWins >= pValue; + case VAR_ArenaWinsLord: + return pParty->uNumArenaLordWins >= pValue; + case VAR_Invisible: + return ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 ); case VAR_ItemEquipped: for (int i = 0; i < 16; i++) { @@ -5127,329 +5135,282 @@ } } return false; - case VAR_GoldInBank: - v4 = pParty->uNumGoldInBank; - return v4 >= pValue; - case VAR_IsMightMoreThanBase: - v28 = GetActualMight(); - v29 = GetBaseStrength(); - return (v28 >= v29); - case VAR_IsIntellectMoreThanBase: - v28 = GetActualIntelligence(); - v29 = GetBaseIntelligence(); - return (v28 >= v29); - case VAR_IsPersonalityMoreThanBase: - v28 = GetActualWillpower(); - v29 = GetBaseWillpower(); - return (v28 >= v29); - case VAR_IsEnduranceMoreThanBase: - v28 = GetActualEndurance(); - v29 = GetBaseEndurance(); - return (v28 >= v29); - case VAR_IsSpeedMoreThanBase: - v28 = GetActualSpeed(); - v29 = GetBaseSpeed(); - return (v28 >= v29); - case VAR_IsAccuracyMoreThanBase: - v28 = GetActualAccuracy(); - v29 = GetBaseAccuracy(); - return (v28 >= v29); - case VAR_IsLuckMoreThanBase: - v28 = GetActualLuck(); - v29 = GetBaseLuck(); - return (v28 >= v29); default: return false; } } - if ( VarNum == VAR_AutoNotes ) //TODO: find out why the double subtraction. or whether this is even used - { - test_bit_value = 0x80u >> (pValue - 2) % 8; - byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8]; - return (test_bit_value & byteWithRequestedBit); - } - if ( VarNum <= VAR_BaseLuck ) - { - if ( VarNum != VAR_BaseLuck ) - { - switch ( VarNum ) + if ( VarNum <= VAR_MajorCondition ) + { + switch ( VarNum ) + { + case VAR_Sex: + return ( pValue == this->uSex ); + case VAR_Class: + return ( pValue == this->classType ); + case VAR_Race: + return pValue == GetRace(); + case VAR_CurrentHP: + return this->sHealth >= pValue; + case VAR_MaxHP: + return (this->sHealth >= GetMaxHealth()); + case VAR_CurrentSP: + return this->sMana >= pValue; + case VAR_MaxSP: + return (this->sMana >= GetMaxMana()); + case VAR_ActualAC: + return GetActualAC() >= pValue; + case VAR_ACModifier: + return this->sACModifier >= pValue; + case VAR_BaseLevel: + return this->uLevel >= pValue; + case VAR_LevelModifier: + return this->sLevelModifier >= pValue; + case VAR_Age: + return GetActualAge() >= (unsigned int)pValue; + case VAR_Award: + test_bit_value = 0x80u >> (pValue - 1) % 8; + byteWithRequestedBit = this->_achieved_awards_bits[(pValue - 1) /8]; + return ( test_bit_value & byteWithRequestedBit ) != 0; + case VAR_Experience: + return this->uExperience >= pValue; //TODO change pValue to long long + case VAR_QBits_QuestsDone: + test_bit_value = 0x80u >> (pValue - 1) % 8; + byteWithRequestedBit = pParty->_quest_bits[(pValue - 1)/8]; + return ( test_bit_value & byteWithRequestedBit ) != 0; + case VAR_PlayerItemInHands: + for (int i = 0; i < 138; i++) { - case VAR_Hour: - if ( (long long)(pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) - return true; - return false; - case VAR_DayOfYear: - if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 336 + 1 == pValue) - return true; - return false; - case VAR_DayOfWeek: - if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 7) - return true; - return false; - case VAR_Sex: - if ( pValue == this->uSex ) - return true; - return false; - case VAR_Class: - if ( pValue == this->classType ) - return true; - return false; - case VAR_Race: - if ( pValue == GetRace() ) - return true; - return v4 >= pValue; - case VAR_CurrentHP: - v4 = this->sHealth; - return v4 >= pValue; - case VAR_MaxHP: - v8 = GetMaxHealth(); - v9 = this->sHealth; - return (v9 >= v8); - case VAR_CurrentSP: - v4 = this->sMana; - return v4 >= pValue; - case VAR_MaxSP: - v8 = GetMaxMana(); - v9 = this->sMana; - return (v9 >= v8); - case VAR_ActualAC: - v4 = GetActualAC(); - return v4 >= pValue; - case VAR_ACModifier: - v4 = this->sACModifier; - return v4 >= pValue; - case VAR_BaseLevel: - v4 = this->uLevel; - return v4 >= pValue; - case VAR_LevelModifier: - v4 = this->sLevelModifier; - return v4 >= pValue; - case VAR_Age: - v4 = GetActualAge(); - return v4 >= pValue; - case VAR_Award: - test_bit_value = 0x80u >> (pValue - 1) % 8; - byteWithRequestedBit = this->_achieved_awards_bits[(pValue - 1) /8]; - return ( test_bit_value & byteWithRequestedBit ); - case VAR_Experience: - v4 = LODWORD(this->uExperience); - return v4 >= pValue; - case VAR_QBits_QuestsDone: - test_bit_value = 0x80u >> (pValue - 1) % 8; - byteWithRequestedBit = pParty->_quest_bits[(pValue - 1)/8]; - return ( test_bit_value & byteWithRequestedBit ); - case VAR_PlayerItemInHands: - for (int i = 0; i < 138; i++) - { - if (pInventoryItemList[i].uItemID == pValue) - { - return true; - } - } - return pParty->pPickedItem.uItemID == pValue; - case VAR_FixedGold: - v4 = pParty->uNumGold; - return v4 >= pValue; - case VAR_MightBonus: - v4 = this->uMightBonus; - return v4 >= pValue; - case VAR_IntellectBonus: - v4 = this->uIntelligenceBonus; - return v4 >= pValue; - case VAR_PersonalityBonus: - v4 = this->uWillpowerBonus; - return v4 >= pValue; - case VAR_EnduranceBonus: - v4 = this->uEnduranceBonus; - return v4 >= pValue; - case VAR_SpeedBonus: - v4 = this->uSpeedBonus; - return v4 >= pValue; - case VAR_AccuracyBonus: - v4 = this->uAccuracyBonus; - return v4 >= pValue; - case VAR_LuckBonus: - v4 = this->uLuckBonus; - return v4 >= pValue; - case VAR_BaseMight: - v4 = this->uMight; - return v4 >= pValue; - case VAR_BaseIntellect: - v4 = this->uIntelligence; - return v4 >= pValue; - case VAR_BasePersonality: - v4 = this->uWillpower; - return v4 >= pValue; - case VAR_BaseEndurance: - v4 = this->uEndurance; - return v4 >= pValue; - case VAR_BaseSpeed: - v4 = this->uSpeed; - return v4 >= pValue; - case VAR_BaseAccuracy: - v4 = this->uAccuracy; - return v4 >= pValue; - case VAR_FixedFood: - v4 = pParty->uNumFoodRations; - return v4 >= pValue; - default: - return false; - } - } - v4 = this->uLuck; - return v4 >= pValue; - } - if ( VarNum <= VAR_MagicResistance ) - { - if ( VarNum == VAR_MagicResistance ) - { - v4 = this->sResMagicBase; - } - else - { - switch ( VarNum ) - { - case VAR_FireResistance: - v4 = this->sResFireBase; - return v4 >= pValue; - case VAR_AirResistance: - v4 = this->sResAirBase; - return v4 >= pValue; - case VAR_WaterResistance: - v4 = this->sResWaterBase; - return v4 >= pValue; - case VAR_EarthResistance: - v4 = this->sResEarthBase; - return v4 >= pValue; - case VAR_SpiritResistance: - v4 = this->sResSpiritBase; - return v4 >= pValue; - case VAR_MindResistance: - v4 = this->sResMindBase; - return v4 >= pValue; - case VAR_BodyResistance: - v4 = this->sResBodyBase; - return v4 >= pValue; - case VAR_LightResistance: - v4 = this->sResLightBase; - return v4 >= pValue; - case VAR_DarkResistance: - v4 = this->sResDarkBase; - return v4 >= pValue; - case VAR_ActualMight: - v4 = GetActualMight(); - return v4 >= pValue; - case VAR_ActualIntellect: - v4 = GetActualIntelligence(); - return v4 >= pValue; - case VAR_ActualPersonality: - v4 = GetActualWillpower(); - return v4 >= pValue; - case VAR_ActualEndurance: - v4 = GetActualEndurance(); - return v4 >= pValue; - case VAR_ActualSpeed: - v4 = GetActualSpeed(); - return v4 >= pValue; - case VAR_ActualAccuracy: - v4 = GetActualAccuracy(); - return v4 >= pValue; - case VAR_ActualLuck: - v4 = GetActualLuck(); - return v4 >= pValue; - break; - default: - return v4 >= pValue; - } - } - return v4 >= pValue; - } - if ( VarNum <= VAR_DisarmTrapSkill ) - { - if ( VarNum != VAR_DisarmTrapSkill ) - { - if ( VarNum <= VAR_MindResistanceBonus ) - { - switch ( VarNum ) + if (pInventoryItemList[i].uItemID == pValue) { - case VAR_MindResistanceBonus: - v4 = this->sResMindBonus; - return v4 >= pValue; - case VAR_FireResistanceBonus: - v4 = this->sResFireBonus; - return v4 >= pValue; - case VAR_AirResistanceBonus: - v4 = this->sResAirBonus; - return v4 >= pValue; - case VAR_WaterResistanceBonus: - v4 = this->sResWaterBonus; - return v4 >= pValue; - case VAR_EarthResistanceBonus: - v4 = this->sResEarthBonus; - return v4 >= pValue; - case VAR_SpiritResistanceBonus: - v4 = this->sResSpiritBonus; - return v4 >= pValue; + return true; } } - if ( VarNum == VAR_BodyResistanceBonus ) - { - v4 = this->sResBodyBonus; - return v4 >= pValue; - } - if ( VarNum == VAR_LightResistanceBonus ) + return pParty->pPickedItem.uItemID == pValue; + case VAR_Hour: + if ( (long long)(pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) + return true; + return false; + case VAR_DayOfYear: + if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 336 + 1 == pValue) + return true; + return false; + case VAR_DayOfWeek: + if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 7) + return true; + return false; + case VAR_FixedGold: + return pParty->uNumGold >= (unsigned int)pValue; + case VAR_FixedFood: + return pParty->uNumFoodRations >= (unsigned int)pValue; + case VAR_MightBonus: + return this->uMightBonus >= pValue; + case VAR_IntellectBonus: + return this->uIntelligenceBonus >= pValue; + case VAR_PersonalityBonus: + return this->uWillpowerBonus >= pValue; + case VAR_EnduranceBonus: + return this->uEnduranceBonus >= pValue; + case VAR_SpeedBonus: + return this->uSpeedBonus >= pValue; + case VAR_AccuracyBonus: + return this->uAccuracyBonus >= pValue; + case VAR_LuckBonus: + return this->uLuckBonus >= pValue; + case VAR_BaseMight: + return this->uMight >= pValue; + case VAR_BaseIntellect: + return this->uIntelligence >= pValue; + case VAR_BasePersonality: + return this->uWillpower >= pValue; + case VAR_BaseEndurance: + return this->uEndurance >= pValue; + case VAR_BaseSpeed: + return this->uSpeed >= pValue; + case VAR_BaseAccuracy: + return this->uAccuracy >= pValue; + case VAR_BaseLuck: + return this->uLuck >= pValue; + case VAR_ActualMight: + return GetActualMight() >= pValue; + case VAR_ActualIntellect: + return GetActualIntelligence() >= pValue; + case VAR_ActualPersonality: + return GetActualWillpower() >= pValue; + case VAR_ActualEndurance: + return GetActualEndurance() >= pValue; + case VAR_ActualSpeed: + return GetActualSpeed() >= pValue; + case VAR_ActualAccuracy: + return GetActualAccuracy() >= pValue; + case VAR_ActualLuck: + return GetActualLuck() >= pValue; + case VAR_FireResistance: + return this->sResFireBase >= pValue; + case VAR_AirResistance: + return this->sResAirBase >= pValue; + case VAR_WaterResistance: + return this->sResWaterBase >= pValue; + case VAR_EarthResistance: + return this->sResEarthBase >= pValue; + case VAR_SpiritResistance: + return this->sResSpiritBase >= pValue; + case VAR_MindResistance: + return this->sResMindBase >= pValue; + case VAR_BodyResistance: + return this->sResBodyBase >= pValue; + case VAR_LightResistance: + return this->sResLightBase >= pValue; + case VAR_DarkResistance: + return this->sResDarkBase >= pValue; + case VAR_PhysicalResistance: + Error("Physical resistance isn't used in events"); + return false; + case VAR_MagicResistance: + return this->sResMagicBase >= pValue; + case VAR_FireResistanceBonus: + return this->sResFireBonus >= pValue; + case VAR_AirResistanceBonus: + return this->sResAirBonus >= pValue; + case VAR_WaterResistanceBonus: + return this->sResWaterBonus >= pValue; + case VAR_EarthResistanceBonus: + return this->sResEarthBonus >= pValue; + case VAR_SpiritResistanceBonus: + return this->sResSpiritBonus >= pValue; + case VAR_MindResistanceBonus: + return this->sResMindBonus >= pValue; + case VAR_BodyResistanceBonus: + return this->sResBodyBonus >= pValue; + case VAR_LightResistanceBonus: + return this->sResLightBonus >= pValue; + case VAR_DarkResistanceBonus: + return this->sResDarkBonus >= pValue; + case VAR_MagicResistanceBonus: + return this->sResMagicBonus >= pValue; + case VAR_StaffSkill: + return CmpSkillValue(pValue, this->skillStaff); + case VAR_SwordSkill: + return CmpSkillValue(pValue, this->skillSword); + case VAR_DaggerSkill: + return CmpSkillValue(pValue, this->skillDagger); + case VAR_AxeSkill: + return CmpSkillValue(pValue, this->skillAxe); + case VAR_SpearSkill: + return CmpSkillValue(pValue, this->skillSpear); + case VAR_BowSkill: + return CmpSkillValue(pValue, this->skillBow); + case VAR_MaceSkill: + return CmpSkillValue(pValue, this->skillMace); + case VAR_BlasterSkill: + return CmpSkillValue(pValue, this->skillBlaster); + case VAR_ShieldSkill: + return CmpSkillValue(pValue, this->skillShield); + case VAR_LeatherSkill: + return CmpSkillValue(pValue, this->skillLeather); + case VAR_SkillChain: + return CmpSkillValue(pValue, this->skillChain); + case VAR_PlateSkill: + return CmpSkillValue(pValue, this->skillPlate); + case VAR_FireSkill: + return CmpSkillValue(pValue, this->skillFire); + case VAR_AirSkill: + return CmpSkillValue(pValue, this->skillAir); + case VAR_WaterSkill: + return CmpSkillValue(pValue, this->skillWater); + case VAR_EarthSkill: + return CmpSkillValue(pValue, this->skillEarth); + case VAR_SpiritSkill: + return CmpSkillValue(pValue, this->skillSpirit); + case VAR_MindSkill: + return CmpSkillValue(pValue, this->skillMind); + case VAR_BodySkill: + return CmpSkillValue(pValue, this->skillBody); + case VAR_LightSkill: + return CmpSkillValue(pValue, this->skillLight); + case VAR_DarkSkill: + return CmpSkillValue(pValue, this->skillDark); + case VAR_IdentifyItemSkill: + return CmpSkillValue(pValue, this->skillItemId); + case VAR_MerchantSkill: + return CmpSkillValue(pValue, this->skillMerchant); + case VAR_RepairSkill: + return CmpSkillValue(pValue, this->skillRepair); + case VAR_BodybuildingSkill: + return CmpSkillValue(pValue, this->skillBodybuilding); + case VAR_MeditationSkill: + return CmpSkillValue(pValue, this->skillMeditation); + case VAR_PerceptionSkill: + return CmpSkillValue(pValue, this->skillPerception); + case VAR_DiplomacySkill: + return CmpSkillValue(pValue, this->skillDiplomacy); + case VAR_ThieverySkill: + Error("Thievery isn't used in events"); + return false; + case VAR_DisarmTrapSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillDisarmTrap); + case VAR_DodgeSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillDodge); + case VAR_UnarmedSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillUnarmed); + case VAR_IdentifyMonsterSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillMonsterId); + case VAR_ArmsmasterSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillArmsmaster); + case VAR_StealingSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillStealing); + case VAR_AlchemySkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillAlchemy); + case VAR_LearningSkill: + return CmpSkillValue(pValue, this->skillLearning); + case VAR_Cursed: + return pConditions[Condition_Cursed] > 0; + case VAR_Weak: + return pConditions[Condition_Weak] > 0; + case VAR_Asleep: + return pConditions[Condition_Sleep] > 0; + case VAR_Afraid: + return pConditions[Condition_Fear] > 0; + case VAR_Drunk: + return pConditions[Condition_Drunk] > 0; + case VAR_Insane: + return pConditions[Condition_Insane] > 0; + case VAR_PoisonedGreen: + return pConditions[Condition_Poison1] > 0; + case VAR_DiseasedGreen: + return pConditions[Condition_Disease1] > 0; + case VAR_PoisonedYellow: + return pConditions[Condition_Poison2] > 0; + case VAR_DiseasedYellow: + return pConditions[Condition_Disease2] > 0; + case VAR_PoisonedRed: + return pConditions[Condition_Poison3] > 0; + case VAR_DiseasedRed: + return pConditions[Condition_Disease3] > 0; + case VAR_Paralyzed: + return pConditions[Condition_Paralyzed] > 0; + case VAR_Unconsious: + return pConditions[Condition_Unconcious] > 0; + case VAR_Dead: + return pConditions[Condition_Dead] > 0; + case VAR_Stoned: + return pConditions[Condition_Pertified] > 0; + case VAR_Eradicated: + return pConditions[Condition_Eradicated] > 0; + case VAR_MajorCondition: + v4 = GetMajorConditionIdx(); + if ( v4 != 18 ) { - v4 = this->sResLightBonus; - return v4 >= pValue; - } - if ( VarNum == VAR_DarkResistanceBonus ) - { - v4 = this->sResDarkBonus; - return v4 >= pValue; - } - if ( VarNum == VAR_MagicResistanceBonus ) - { - v4 = this->sResMagicBonus; return v4 >= pValue; } - if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) - return v4 >= pValue; - } - v18 = *((short *)&this->pConditions[16] + VarNum); - if ( pValue <= 63 ) - v4 = v18 & 0x3F; - else - v4 = pValue & v18; - return v4 >= pValue; - } - if ( VarNum == 104 ) - { - v18 = *((short *)&this->pConditions[16] + VarNum); - if ( pValue <= 63 ) - v4 = v18 & 0x3F; - else - v4 = pValue & v18; - return v4 >= pValue; - } - if ( (signed int)VarNum <= 104 ) - return v4 >= pValue; - if ( (signed int)VarNum > 0x79 ) - { - if ( VarNum != 122 ) - { - if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) - v4 = (unsigned __int8)byte_5E4C15[VarNum]; - return v4 >= pValue; - } - v4 = GetMajorConditionIdx(); - if ( v4 != 18 ) - { - return v4 >= pValue; - } - v4 = pValue; - return v4 >= pValue; - } - return (this->pConditions[VarNum - 105] > 0);// *((int *)this + 2 * VarNum - 210); the original was never used, which is why probably it wasn't correct + return true; + } + } + if ( (signed int)VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_74 ) + return (unsigned __int8)stru_5E4C90_MapPersistVars.field_0[VarNum - VAR_MapPersistentVariable_0] > 0; // originally (unsigned __int8)byte_5E4C15[VarNum]; + if ( (signed int)VarNum >= VAR_MapPersistentVariable_75 && VarNum <= VAR_MapPersistentVariable_99 ) + return (unsigned __int8)stru_5E4C90_MapPersistVars._decor_events[VarNum - VAR_MapPersistentVariable_75] > 0; //not really sure whether the number gets up to 99, but can't ignore the possibility + + return false; } @@ -5893,7 +5854,7 @@ { if ( var_type != VAR_MajorCondition ) { - if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) + if ( var_type > VAR_MajorCondition && var_type <= VAR_MapPersistentVariable_99 ) byte_5E4C15[var_type] = var_value; return; } @@ -6403,7 +6364,7 @@ { if ( var_type != VAR_MajorCondition ) { - if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) + 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;