Mercurial > mm7
comparison Player.cpp @ 1783:a3e86ec5d3ce
Player.cpp cosmetics
author | Grumpy7 |
---|---|
date | Thu, 03 Oct 2013 06:38:20 +0200 |
parents | 421e826f4477 |
children | ebde8e43839c |
comparison
equal
deleted
inserted
replaced
1782:421e826f4477 | 1783:a3e86ec5d3ce |
---|---|
295 { | 295 { |
296 if ( conditionIdx <= 15 ) | 296 if ( conditionIdx <= 15 ) |
297 { | 297 { |
298 baseConditionMultiplier = 5; | 298 baseConditionMultiplier = 5; |
299 } | 299 } |
300 if ( conditionIdx == 16 ) | 300 else //if ( conditionIdx == 16 ) |
301 { | 301 { |
302 baseConditionMultiplier = 10; | 302 baseConditionMultiplier = 10; |
303 } | 303 } |
304 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); | 304 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); |
305 } | 305 } |
898 } | 898 } |
899 | 899 |
900 //----- (004927A8) -------------------------------------------------------- | 900 //----- (004927A8) -------------------------------------------------------- |
901 int Player::AddItem(int index, unsigned int uItemID) | 901 int Player::AddItem(int index, unsigned int uItemID) |
902 { | 902 { |
903 int xStartValue = 0; | |
904 | |
905 if ( index == -1 ) | 903 if ( index == -1 ) |
906 { | 904 { |
907 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) | 905 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) |
908 { | 906 { |
909 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) | 907 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) |
1140 //----- (004910D3) -------------------------------------------------------- | 1138 //----- (004910D3) -------------------------------------------------------- |
1141 bool Player::CanIdentify( ItemGen *pItem ) | 1139 bool Player::CanIdentify( ItemGen *pItem ) |
1142 { | 1140 { |
1143 unsigned __int16 v2; // ax@1 | 1141 unsigned __int16 v2; // ax@1 |
1144 int v5; // edi@7 | 1142 int v5; // edi@7 |
1145 return true; | |
1146 if (CheckHiredNPCSpeciality(Scholar)) | 1143 if (CheckHiredNPCSpeciality(Scholar)) |
1147 return true; | 1144 return true; |
1148 | 1145 |
1149 v2 = GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); | 1146 v2 = GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); |
1150 if ( (signed int)SkillToMastery(v2) >= 4 ) | 1147 if ( (signed int)SkillToMastery(v2) >= 4 ) |
2096 int v30 = StealingMasteryBonuses[stealingMastery]; | 2093 int v30 = StealingMasteryBonuses[stealingMastery]; |
2097 int v29 = StealingRandomBonuses[rand() % 5]; | 2094 int v29 = StealingRandomBonuses[rand() % 5]; |
2098 fineIfFailed = actroPtr->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); | 2095 fineIfFailed = actroPtr->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation); |
2099 currMaxItemValue = v29 + v7 * v30; | 2096 currMaxItemValue = v29 + v7 * v30; |
2100 pGlobalTXT_LocalizationStrings[200]; | 2097 pGlobalTXT_LocalizationStrings[200]; |
2101 if ( false && (rand() % 100 < 5 || fineIfFailed > currMaxItemValue || BYTE2(actroPtr->uAttributes) & 8) ) | 2098 if ( rand() % 100 < 5 || fineIfFailed > currMaxItemValue || BYTE2(actroPtr->uAttributes) & 8 ) |
2102 { | 2099 { |
2103 Actor::AggroSurroundingPeasants(uActorID, 1); | 2100 Actor::AggroSurroundingPeasants(uActorID, 1); |
2104 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[376], this->pName); | 2101 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[376], this->pName); |
2105 ShowStatusBarString(pTmpBuf2.data(), 2u); | 2102 ShowStatusBarString(pTmpBuf2.data(), 2u); |
2106 return 0; | 2103 return 0; |
2277 unsigned int v47; // [sp+98h] [bp-8h]@1 | 2274 unsigned int v47; // [sp+98h] [bp-8h]@1 |
2278 ItemGen* v48; // [sp+9Ch] [bp-4h]@1 | 2275 ItemGen* v48; // [sp+9Ch] [bp-4h]@1 |
2279 | 2276 |
2280 v4 = 0; | 2277 v4 = 0; |
2281 v47 = 0; | 2278 v47 = 0; |
2279 v48 = nullptr; | |
2282 switch ( attTypeCast ) | 2280 switch ( attTypeCast ) |
2283 { | 2281 { |
2284 case SPECIAL_ATTACK_CURSE: | 2282 case SPECIAL_ATTACK_CURSE: |
2285 v6 = GetActualWillpower(); | 2283 v6 = GetActualWillpower(); |
2286 v11 = GetParameterBonus(v6); | 2284 v11 = GetParameterBonus(v6); |
2871 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT: | 2869 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT: |
2872 resStat = &sResBodyBase; | 2870 resStat = &sResBodyBase; |
2873 if (IsRaceHuman()) | 2871 if (IsRaceHuman()) |
2874 racialBonus = 5; | 2872 racialBonus = 5; |
2875 break; | 2873 break; |
2874 default: | |
2875 Error("Unknown attribute"); | |
2876 } | 2876 } |
2877 v7 = GetItemsBonus(a2) + racialBonus; | 2877 v7 = GetItemsBonus(a2) + racialBonus; |
2878 return v7 + *resStat; | 2878 return v7 + *resStat; |
2879 } | 2879 } |
2880 | 2880 |
2897 && HasItemEquipped(EQUIP_ARMOUR) | 2897 && HasItemEquipped(EQUIP_ARMOUR) |
2898 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) | 2898 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER ) |
2899 v10 += leatherArmorSkillLevel & 0x3F; | 2899 v10 += leatherArmorSkillLevel & 0x3F; |
2900 switch (a2) | 2900 switch (a2) |
2901 { | 2901 { |
2902 case CHARACTER_ATTRIBUTE_RESIST_FIRE: | 2902 case CHARACTER_ATTRIBUTE_RESIST_FIRE: |
2903 resStat = &sResFireBonus; | 2903 resStat = &sResFireBonus; |
2904 break; | 2904 break; |
2905 case CHARACTER_ATTRIBUTE_RESIST_AIR: | 2905 case CHARACTER_ATTRIBUTE_RESIST_AIR: |
2906 resStat = &sResAirBonus; | 2906 resStat = &sResAirBonus; |
2907 break; | 2907 break; |
2908 case CHARACTER_ATTRIBUTE_RESIST_WATER: | 2908 case CHARACTER_ATTRIBUTE_RESIST_WATER: |
2909 resStat = &sResWaterBonus; | 2909 resStat = &sResWaterBonus; |
2910 break; | 2910 break; |
2911 case CHARACTER_ATTRIBUTE_RESIST_EARTH: | 2911 case CHARACTER_ATTRIBUTE_RESIST_EARTH: |
2912 resStat = &sResEarthBonus; | 2912 resStat = &sResEarthBonus; |
2913 break; | 2913 break; |
2914 case CHARACTER_ATTRIBUTE_RESIST_MIND: | 2914 case CHARACTER_ATTRIBUTE_RESIST_MIND: |
2915 resStat = &sResMindBonus; | 2915 resStat = &sResMindBonus; |
2916 break; | 2916 break; |
2917 case CHARACTER_ATTRIBUTE_RESIST_BODY: | 2917 case CHARACTER_ATTRIBUTE_RESIST_BODY: |
2918 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT: | 2918 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT: |
2919 resStat = &sResBodyBonus; | 2919 resStat = &sResBodyBonus; |
2920 break; | 2920 break; |
2921 default: Error("Unexpected attribute"); | |
2921 } | 2922 } |
2922 baseRes = GetBaseResistance(a2); | 2923 baseRes = GetBaseResistance(a2); |
2923 result = v10 + GetMagicalBonus(a2) + baseRes + *(resStat); | 2924 result = v10 + GetMagicalBonus(a2) + baseRes + *(resStat); |
2924 return result; | 2925 return result; |
2925 } | 2926 } |
4293 case 2: attribute_value = uWillpower; break; | 4294 case 2: attribute_value = uWillpower; break; |
4294 case 3: attribute_value = uEndurance; break; | 4295 case 3: attribute_value = uEndurance; break; |
4295 case 4: attribute_value = uAccuracy; break; | 4296 case 4: attribute_value = uAccuracy; break; |
4296 case 5: attribute_value = uSpeed; break; | 4297 case 5: attribute_value = uSpeed; break; |
4297 case 6: attribute_value = uLuck; break; | 4298 case 6: attribute_value = uLuck; break; |
4299 default: Error("Unexpected attribute"); | |
4298 }; | 4300 }; |
4299 | 4301 |
4300 if (attribute_value == base_attribute_value) | 4302 if (attribute_value == base_attribute_value) |
4301 return ui_character_stat_default_color; | 4303 return ui_character_stat_default_color; |
4302 else if (attribute_value > base_attribute_value) | 4304 else if (attribute_value > base_attribute_value) |
4909 break; | 4911 break; |
4910 case 5: | 4912 case 5: |
4911 playerAffected->sResBodyBase += thisa; | 4913 playerAffected->sResBodyBase += thisa; |
4912 v13 = pGlobalTXT_LocalizationStrings[29]; | 4914 v13 = pGlobalTXT_LocalizationStrings[29]; |
4913 break; | 4915 break; |
4916 default: ("Unexpected attribute"); | |
4917 return; | |
4914 } | 4918 } |
4915 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); | 4919 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]); |
4916 break; | 4920 break; |
4917 | 4921 |
4918 } | 4922 } |
5006 DDM_DLV_Header *v19; // eax@122 | 5010 DDM_DLV_Header *v19; // eax@122 |
5007 DDM_DLV_Header *v21; // eax@126 | 5011 DDM_DLV_Header *v21; // eax@126 |
5008 int actStat; // ebx@161 | 5012 int actStat; // ebx@161 |
5009 int baseStat; // eax@161 | 5013 int baseStat; // eax@161 |
5010 | 5014 |
5011 if ( VarNum > VAR_AutoNotes ) | 5015 |
5012 { | 5016 if ( (signed int)VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_74 ) |
5013 switch ( VarNum ) | 5017 return (unsigned __int8)stru_5E4C90_MapPersistVars.field_0[VarNum - VAR_MapPersistentVariable_0] > 0; // originally (unsigned __int8)byte_5E4C15[VarNum]; |
5014 { | 5018 if ( (signed int)VarNum >= VAR_MapPersistentVariable_75 && VarNum <= VAR_MapPersistentVariable_99 ) |
5015 case VAR_AutoNotes : //TODO: find out why the double subtraction. or whether this is even used | 5019 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 |
5016 test_bit_value = 0x80u >> (pValue - 2) % 8; | 5020 |
5017 byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8]; | 5021 switch ( VarNum ) |
5018 return (test_bit_value & byteWithRequestedBit) != 0; | 5022 { |
5019 case VAR_IsMightMoreThanBase: | |
5020 actStat = GetActualMight(); | |
5021 baseStat = GetBaseStrength(); | |
5022 return (actStat >= baseStat); | |
5023 case VAR_IsIntellectMoreThanBase: | |
5024 actStat = GetActualIntelligence(); | |
5025 baseStat = GetBaseIntelligence(); | |
5026 return (actStat >= baseStat); | |
5027 case VAR_IsPersonalityMoreThanBase: | |
5028 actStat = GetActualWillpower(); | |
5029 baseStat = GetBaseWillpower(); | |
5030 return (actStat >= baseStat); | |
5031 case VAR_IsEnduranceMoreThanBase: | |
5032 actStat = GetActualEndurance(); | |
5033 baseStat = GetBaseEndurance(); | |
5034 return (actStat >= baseStat); | |
5035 case VAR_IsSpeedMoreThanBase: | |
5036 actStat = GetActualSpeed(); | |
5037 baseStat = GetBaseSpeed(); | |
5038 return (actStat >= baseStat); | |
5039 case VAR_IsAccuracyMoreThanBase: | |
5040 actStat = GetActualAccuracy(); | |
5041 baseStat = GetBaseAccuracy(); | |
5042 return (actStat >= baseStat); | |
5043 case VAR_IsLuckMoreThanBase: | |
5044 actStat = GetActualLuck(); | |
5045 baseStat = GetBaseLuck(); | |
5046 return (actStat >= baseStat); | |
5047 case VAR_PlayerBits: | |
5048 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; | |
5049 byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
5050 return ( test_bit_value & byteWithRequestedBit ) != 0; | |
5051 case VAR_NPCs2: | |
5052 return pNPCStats->pNewNPCData[pValue].Hired(); | |
5053 case VAR_IsFlying: | |
5054 if ( pParty->bFlying | |
5055 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) | |
5056 return true; | |
5057 return false; | |
5058 case VAR_HiredNPCHasSpeciality: | |
5059 return CheckHiredNPCSpeciality(pValue); | |
5060 case VAR_CircusPrises: //isn't used in MM6 since 0x1D6u is a book of regeneration | |
5061 v4 = 0; | |
5062 for (int playerNum = 0; playerNum < 4; playerNum++) | |
5063 { | |
5064 for (int invPos = 0; invPos < 138; invPos++) | |
5065 { | |
5066 int itemId = pParty->pPlayers[playerNum].pInventoryItemList[invPos].uItemID; | |
5067 switch ( itemId ) | |
5068 { | |
5069 case 0x1D6u: | |
5070 ++v4; | |
5071 break; | |
5072 case 0x1D7u: | |
5073 v4 += 3; | |
5074 break; | |
5075 case 0x1DDu: | |
5076 v4 += 5; | |
5077 break; | |
5078 } | |
5079 } | |
5080 } | |
5081 return v4 >= pValue; | |
5082 case VAR_NumSkillPoints: | |
5083 return this->uSkillPoints >= (unsigned int)pValue; | |
5084 case VAR_MonthIs: | |
5085 return (pParty->uCurrentMonth == (unsigned int)pValue); | |
5086 case VAR_Counter1: | |
5087 case VAR_Counter2: | |
5088 case VAR_Counter3: | |
5089 case VAR_Counter4: | |
5090 case VAR_Counter5: | |
5091 case VAR_Counter6: | |
5092 case VAR_Counter7: | |
5093 case VAR_Counter8: | |
5094 case VAR_Counter9: | |
5095 case VAR_Counter10: | |
5096 if (pParty->PartyTimes.CounterEventValues[VarNum - VAR_Counter1]) //originally (signed __int64)(__PAIR__(*(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304], *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
5097 { | |
5098 return (pParty->PartyTimes.CounterEventValues[VarNum - VAR_Counter1] + 460800 * pValue * 0.033333335) <= pParty->uTimePlayed ; | |
5099 } | |
5100 case VAR_ReputationInCurrentLocation: | |
5101 v19 = &pOutdoor->ddm; | |
5102 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5103 v19 = &pIndoor->dlv; | |
5104 return (v19->uReputation >= pValue); | |
5105 case VAR_Unknown1: | |
5106 v21 = &pOutdoor->ddm; | |
5107 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5108 v21 = &pIndoor->dlv; | |
5109 return (v21->field_C_alert == pValue); //yes, equality, not >= | |
5110 case VAR_GoldInBank: | |
5111 return pParty->uNumGoldInBank >= (unsigned int)pValue; | |
5112 case VAR_NumDeaths: | |
5113 return pParty->uNumDeaths >= (unsigned int)pValue; | |
5114 case VAR_NumBounties: | |
5115 return pParty->uNumBountiesCollected >= (unsigned int)pValue; | |
5116 case VAR_PrisonTerms: | |
5117 return pParty->uNumPrisonTerms >= pValue; | |
5118 case VAR_ArenaWinsPage: | |
5119 return (unsigned __int8)pParty->uNumArenaPageWins >= pValue; | |
5120 case VAR_ArenaWinsSquire: | |
5121 return (unsigned __int8)pParty->uNumArenaSquireWins >= pValue; | |
5122 case VAR_ArenaWinsKnight: | |
5123 return (unsigned __int8)pParty->uNumArenaKnightWins >= pValue; | |
5124 case VAR_ArenaWinsLord: | |
5125 return pParty->uNumArenaLordWins >= pValue; | |
5126 case VAR_Invisible: | |
5127 return ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 ); | |
5128 case VAR_ItemEquipped: | |
5129 for (int i = 0; i < 16; i++) | |
5130 { | |
5131 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) && GetNthEquippedIndexItem(i)->uItemID == pValue ) | |
5132 { | |
5133 return true; | |
5134 } | |
5135 } | |
5136 return false; | |
5137 default: | |
5138 return false; | |
5139 } | |
5140 } | |
5141 if ( VarNum <= VAR_MajorCondition ) | |
5142 { | |
5143 switch ( VarNum ) | |
5144 { | |
5145 case VAR_Sex: | 5023 case VAR_Sex: |
5146 return ( pValue == this->uSex ); | 5024 return ( pValue == this->uSex ); |
5147 case VAR_Class: | 5025 case VAR_Class: |
5148 return ( pValue == this->classType ); | 5026 return ( pValue == this->classType ); |
5149 case VAR_Race: | 5027 case VAR_Race: |
5165 case VAR_LevelModifier: | 5043 case VAR_LevelModifier: |
5166 return this->sLevelModifier >= pValue; | 5044 return this->sLevelModifier >= pValue; |
5167 case VAR_Age: | 5045 case VAR_Age: |
5168 return GetActualAge() >= (unsigned int)pValue; | 5046 return GetActualAge() >= (unsigned int)pValue; |
5169 case VAR_Award: | 5047 case VAR_Award: |
5170 test_bit_value = 0x80u >> (pValue - 1) % 8; | 5048 return _449B57_test_bit(this->_achieved_awards_bits, pValue); |
5171 byteWithRequestedBit = this->_achieved_awards_bits[(pValue - 1) /8]; | |
5172 return ( test_bit_value & byteWithRequestedBit ) != 0; | |
5173 case VAR_Experience: | 5049 case VAR_Experience: |
5174 return this->uExperience >= pValue; //TODO change pValue to long long | 5050 return this->uExperience >= pValue; //TODO change pValue to long long |
5175 case VAR_QBits_QuestsDone: | 5051 case VAR_QBits_QuestsDone: |
5176 test_bit_value = 0x80u >> (pValue - 1) % 8; | 5052 return _449B57_test_bit(pParty->_quest_bits, pValue); |
5177 byteWithRequestedBit = pParty->_quest_bits[(pValue - 1)/8]; | |
5178 return ( test_bit_value & byteWithRequestedBit ) != 0; | |
5179 case VAR_PlayerItemInHands: | 5053 case VAR_PlayerItemInHands: |
5180 for (int i = 0; i < 138; i++) | 5054 for (int i = 0; i < 138; i++) |
5181 { | 5055 { |
5182 if (pInventoryItemList[i].uItemID == pValue) | 5056 if (pInventoryItemList[i].uItemID == pValue) |
5183 { | 5057 { |
5400 if ( v4 != 18 ) | 5274 if ( v4 != 18 ) |
5401 { | 5275 { |
5402 return v4 >= pValue; | 5276 return v4 >= pValue; |
5403 } | 5277 } |
5404 return true; | 5278 return true; |
5405 } | 5279 case VAR_AutoNotes : //TODO: find out why the double subtraction. or whether this is even used |
5406 } | 5280 test_bit_value = 0x80u >> (pValue - 2) % 8; |
5407 if ( (signed int)VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_74 ) | 5281 byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8]; |
5408 return (unsigned __int8)stru_5E4C90_MapPersistVars.field_0[VarNum - VAR_MapPersistentVariable_0] > 0; // originally (unsigned __int8)byte_5E4C15[VarNum]; | 5282 return (test_bit_value & byteWithRequestedBit) != 0; |
5409 if ( (signed int)VarNum >= VAR_MapPersistentVariable_75 && VarNum <= VAR_MapPersistentVariable_99 ) | 5283 case VAR_IsMightMoreThanBase: |
5410 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 | 5284 actStat = GetActualMight(); |
5411 | 5285 baseStat = GetBaseStrength(); |
5286 return (actStat >= baseStat); | |
5287 case VAR_IsIntellectMoreThanBase: | |
5288 actStat = GetActualIntelligence(); | |
5289 baseStat = GetBaseIntelligence(); | |
5290 return (actStat >= baseStat); | |
5291 case VAR_IsPersonalityMoreThanBase: | |
5292 actStat = GetActualWillpower(); | |
5293 baseStat = GetBaseWillpower(); | |
5294 return (actStat >= baseStat); | |
5295 case VAR_IsEnduranceMoreThanBase: | |
5296 actStat = GetActualEndurance(); | |
5297 baseStat = GetBaseEndurance(); | |
5298 return (actStat >= baseStat); | |
5299 case VAR_IsSpeedMoreThanBase: | |
5300 actStat = GetActualSpeed(); | |
5301 baseStat = GetBaseSpeed(); | |
5302 return (actStat >= baseStat); | |
5303 case VAR_IsAccuracyMoreThanBase: | |
5304 actStat = GetActualAccuracy(); | |
5305 baseStat = GetBaseAccuracy(); | |
5306 return (actStat >= baseStat); | |
5307 case VAR_IsLuckMoreThanBase: | |
5308 actStat = GetActualLuck(); | |
5309 baseStat = GetBaseLuck(); | |
5310 return (actStat >= baseStat); | |
5311 case VAR_PlayerBits: | |
5312 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; | |
5313 byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8]; | |
5314 return ( test_bit_value & byteWithRequestedBit ) != 0; | |
5315 case VAR_NPCs2: | |
5316 return pNPCStats->pNewNPCData[pValue].Hired(); | |
5317 case VAR_IsFlying: | |
5318 if ( pParty->bFlying | |
5319 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) | |
5320 return true; | |
5321 return false; | |
5322 case VAR_HiredNPCHasSpeciality: | |
5323 return CheckHiredNPCSpeciality(pValue); | |
5324 case VAR_CircusPrises: //isn't used in MM6 since 0x1D6u is a book of regeneration | |
5325 v4 = 0; | |
5326 for (int playerNum = 0; playerNum < 4; playerNum++) | |
5327 { | |
5328 for (int invPos = 0; invPos < 138; invPos++) | |
5329 { | |
5330 int itemId = pParty->pPlayers[playerNum].pInventoryItemList[invPos].uItemID; | |
5331 switch ( itemId ) | |
5332 { | |
5333 case 0x1D6u: | |
5334 ++v4; | |
5335 break; | |
5336 case 0x1D7u: | |
5337 v4 += 3; | |
5338 break; | |
5339 case 0x1DDu: | |
5340 v4 += 5; | |
5341 break; | |
5342 } | |
5343 } | |
5344 } | |
5345 return v4 >= pValue; | |
5346 case VAR_NumSkillPoints: | |
5347 return this->uSkillPoints >= (unsigned int)pValue; | |
5348 case VAR_MonthIs: | |
5349 return (pParty->uCurrentMonth == (unsigned int)pValue); | |
5350 case VAR_Counter1: | |
5351 case VAR_Counter2: | |
5352 case VAR_Counter3: | |
5353 case VAR_Counter4: | |
5354 case VAR_Counter5: | |
5355 case VAR_Counter6: | |
5356 case VAR_Counter7: | |
5357 case VAR_Counter8: | |
5358 case VAR_Counter9: | |
5359 case VAR_Counter10: | |
5360 if (pParty->PartyTimes.CounterEventValues[VarNum - VAR_Counter1]) //originally (signed __int64)(__PAIR__(*(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304], *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | |
5361 { | |
5362 return (pParty->PartyTimes.CounterEventValues[VarNum - VAR_Counter1] + 460800 * pValue * 0.033333335) <= pParty->uTimePlayed ; | |
5363 } | |
5364 case VAR_ReputationInCurrentLocation: | |
5365 v19 = &pOutdoor->ddm; | |
5366 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5367 v19 = &pIndoor->dlv; | |
5368 return (v19->uReputation >= pValue); | |
5369 case VAR_Unknown1: | |
5370 v21 = &pOutdoor->ddm; | |
5371 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
5372 v21 = &pIndoor->dlv; | |
5373 return (v21->field_C_alert == pValue); //yes, equality, not >= | |
5374 case VAR_GoldInBank: | |
5375 return pParty->uNumGoldInBank >= (unsigned int)pValue; | |
5376 case VAR_NumDeaths: | |
5377 return pParty->uNumDeaths >= (unsigned int)pValue; | |
5378 case VAR_NumBounties: | |
5379 return pParty->uNumBountiesCollected >= (unsigned int)pValue; | |
5380 case VAR_PrisonTerms: | |
5381 return pParty->uNumPrisonTerms >= pValue; | |
5382 case VAR_ArenaWinsPage: | |
5383 return (unsigned __int8)pParty->uNumArenaPageWins >= pValue; | |
5384 case VAR_ArenaWinsSquire: | |
5385 return (unsigned __int8)pParty->uNumArenaSquireWins >= pValue; | |
5386 case VAR_ArenaWinsKnight: | |
5387 return (unsigned __int8)pParty->uNumArenaKnightWins >= pValue; | |
5388 case VAR_ArenaWinsLord: | |
5389 return pParty->uNumArenaLordWins >= pValue; | |
5390 case VAR_Invisible: | |
5391 return ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 ); | |
5392 case VAR_ItemEquipped: | |
5393 for (int i = 0; i < 16; i++) | |
5394 { | |
5395 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) && GetNthEquippedIndexItem(i)->uItemID == pValue ) | |
5396 { | |
5397 return true; | |
5398 } | |
5399 } | |
5400 return false; | |
5401 } | |
5402 | |
5412 return false; | 5403 return false; |
5413 } | 5404 } |
5414 | 5405 |
5415 | 5406 |
5416 //----- (0044A5CB) -------------------------------------------------------- | 5407 //----- (0044A5CB) -------------------------------------------------------- |
5532 return; | 5523 return; |
5533 case VAR_Age: | 5524 case VAR_Age: |
5534 this->sAgeModifier = var_value; | 5525 this->sAgeModifier = var_value; |
5535 return; | 5526 return; |
5536 case VAR_Award: | 5527 case VAR_Award: |
5537 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & | 5528 if ( !_449B57_test_bit(this->_achieved_awards_bits, var_value) && pAwards[var_value].pText ) |
5538 this->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8]) //&& dword_723E80_award_related[2 * a3] ) | |
5539 && pAwards[var_value].pText ) | |
5540 { | 5529 { |
5541 PlayAwardSound_Anim(currPlayerId); | 5530 PlayAwardSound_Anim(currPlayerId); |
5542 this->PlaySound(SPEECH_96, 0); | 5531 this->PlaySound(SPEECH_96, 0); |
5543 } | 5532 } |
5544 _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u); | 5533 _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u); |
5546 case VAR_Experience: | 5535 case VAR_Experience: |
5547 this->uExperience = var_value; | 5536 this->uExperience = var_value; |
5548 PlayAwardSound_Anim(currPlayerId); | 5537 PlayAwardSound_Anim(currPlayerId); |
5549 return; | 5538 return; |
5550 case VAR_QBits_QuestsDone: | 5539 case VAR_QBits_QuestsDone: |
5551 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3])// && (&dword_722F10)[4 * a3] ) | 5540 if ( !_449B57_test_bit(pParty->_quest_bits, var_value) && pQuestTable[var_value-1] ) |
5552 && pQuestTable[var_value-1] ) | |
5553 { | 5541 { |
5554 bFlashQuestBook = 1; | 5542 bFlashQuestBook = 1; |
5555 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | 5543 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
5556 PlayAwardSound(currPlayerId); | 5544 PlayAwardSound(currPlayerId); |
5557 this->PlaySound(SPEECH_93, 0); | 5545 this->PlaySound(SPEECH_93, 0); |
5805 case VAR_MajorCondition: | 5793 case VAR_MajorCondition: |
5806 memset(this, 0, 0xA0u); | 5794 memset(this, 0, 0xA0u); |
5807 PlayAwardSound_Anim(currPlayerId); | 5795 PlayAwardSound_Anim(currPlayerId); |
5808 return; | 5796 return; |
5809 case VAR_AutoNotes: | 5797 case VAR_AutoNotes: |
5810 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3]) //&& (&dword_723718_autonote_related)[8 * a3] ) | 5798 if ( !_449B57_test_bit(pParty->_autonote_bits, var_value) && pAutonoteTxt[var_value-1].pText ) |
5811 && pAutonoteTxt[var_value-1].pText ) | |
5812 { | 5799 { |
5813 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | 5800 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
5814 this->PlaySound(SPEECH_96, 0); | 5801 this->PlaySound(SPEECH_96, 0); |
5815 bFlashAutonotesBook = 1; | 5802 bFlashAutonotesBook = 1; |
5816 _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; | 5803 _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
7398 { | 7385 { |
7399 case 0 : soundToPlay = (SoundID)108; break; | 7386 case 0 : soundToPlay = (SoundID)108; break; |
7400 case 1 : soundToPlay = (SoundID)109; break; | 7387 case 1 : soundToPlay = (SoundID)109; break; |
7401 case 2 : soundToPlay = (SoundID)110; break; | 7388 case 2 : soundToPlay = (SoundID)110; break; |
7402 case 3 : soundToPlay = (SoundID)44; break; | 7389 case 3 : soundToPlay = (SoundID)44; break; |
7390 default: Error("Unexpected sound value"); | |
7403 } | 7391 } |
7404 } | 7392 } |
7405 else | 7393 else |
7406 { | 7394 { |
7407 int randVal = rand() % 4; | 7395 int randVal = rand() % 4; |
7409 { | 7397 { |
7410 case 0 : soundToPlay = (SoundID)105; break; | 7398 case 0 : soundToPlay = (SoundID)105; break; |
7411 case 1 : soundToPlay = (SoundID)106; break; | 7399 case 1 : soundToPlay = (SoundID)106; break; |
7412 case 2 : soundToPlay = (SoundID)107; break; | 7400 case 2 : soundToPlay = (SoundID)107; break; |
7413 case 3 : soundToPlay = (SoundID)45; break; | 7401 case 3 : soundToPlay = (SoundID)45; break; |
7402 default: Error("Unexpected sound value"); | |
7414 } | 7403 } |
7415 } | 7404 } |
7416 pAudioPlayer->PlaySound(soundToPlay, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); | 7405 pAudioPlayer->PlaySound(soundToPlay, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); |
7417 int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, element); | 7406 int dmgToReceive = Actor::_43B3E0_CalcDamage(actorPtr, element); |
7418 if ( actorPtr->pActorBuffs[3].uExpireTime > 0 ) | 7407 if ( actorPtr->pActorBuffs[3].uExpireTime > 0 ) |