Mercurial > mm7
comparison Player.cpp @ 1731:34dd357a489d
Player::CompareVariable cleanup first round
author | Grumpy7 |
---|---|
date | Thu, 26 Sep 2013 08:07:50 +0200 |
parents | baa4eda7f924 |
children | c6fe09a06712 |
comparison
equal
deleted
inserted
replaced
1717:baa4eda7f924 | 1731:34dd357a489d |
---|---|
2593 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) | 2593 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) |
2594 // ADD: shield check because shield recovery is added later and can be accidentally doubled | 2594 // ADD: shield check because shield recovery is added later and can be accidentally doubled |
2595 { | 2595 { |
2596 if (base_recovery_times_per_weapon_type[GetOffHandItem()->GetPlayerSkillType()] > weapon_recovery) | 2596 if (base_recovery_times_per_weapon_type[GetOffHandItem()->GetPlayerSkillType()] > weapon_recovery) |
2597 { | 2597 { |
2598 weapon = GetOffHandItem(); | 2598 weapon = GetOffHandItem(); |
2599 weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()]; | 2599 weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()]; |
2600 } | 2600 } |
2601 } | 2601 } |
2602 | 2602 |
2603 uint armour_recovery = 0; | 2603 uint armour_recovery = 0; |
4984 return; | 4984 return; |
4985 } | 4985 } |
4986 } | 4986 } |
4987 | 4987 |
4988 //----- (00449BB4) -------------------------------------------------------- | 4988 //----- (00449BB4) -------------------------------------------------------- |
4989 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) | 4989 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 |
4990 { | 4990 { |
4991 Player *v3; // esi@1 | 4991 Assert(pValue >= 0, "Compare variable shouldn't have negative arguments"); |
4992 | |
4992 signed int v4; // edi@1 | 4993 signed int v4; // edi@1 |
4993 unsigned int v5; // eax@8 | 4994 unsigned int v5; // eax@8 |
4994 int v6; // eax@9 | 4995 int v6; // eax@9 |
4995 enum CHARACTER_RACE v7; // eax@11 | 4996 enum CHARACTER_RACE v7; // eax@11 |
4996 signed int v8; // eax@17 | 4997 signed int v8; // eax@17 |
4997 unsigned __int8 v9; // sf@17 | 4998 unsigned __int8 v9; // sf@17 |
4998 unsigned __int8 v10; // of@17 | 4999 unsigned __int8 v10; // of@17 |
4999 int v11; // eax@19 | 5000 int v11; // eax@19 |
5000 unsigned int v12; // eax@20 | 5001 unsigned int v12; // eax@20 |
5001 unsigned int test_bit_value; // eax@25 | 5002 unsigned int test_bit_value; // eax@25 |
5002 unsigned __int8 our_bit_value; // cl@25 | 5003 unsigned __int8 byteWithRequestedBit; // cl@25 |
5003 signed int v15; // ecx@28 | 5004 signed int v15; // ecx@28 |
5004 ItemGen *v16; // eax@28 | 5005 ItemGen *v16; // eax@28 |
5005 int v18; // edi@90 | 5006 int v18; // edi@90 |
5006 DDM_DLV_Header *v19; // eax@122 | 5007 DDM_DLV_Header *v19; // eax@122 |
5007 DDM_DLV_Header *v21; // eax@126 | 5008 DDM_DLV_Header *v21; // eax@126 |
5013 char *v27; // edi@155 | 5014 char *v27; // edi@155 |
5014 int v28; // ebx@161 | 5015 int v28; // ebx@161 |
5015 int v29; // eax@161 | 5016 int v29; // eax@161 |
5016 | 5017 |
5017 v6 = 0; | 5018 v6 = 0; |
5018 v3 = this; | |
5019 v4 = -1; | 5019 v4 = -1; |
5020 if ( VarNum > VAR_AutoNotes ) | 5020 if ( VarNum > VAR_AutoNotes ) |
5021 { | 5021 { |
5022 switch ( VarNum ) | 5022 switch ( VarNum ) |
5023 { | 5023 { |
5050 v19 = &pOutdoor->ddm; | 5050 v19 = &pOutdoor->ddm; |
5051 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | 5051 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) |
5052 v19 = &pIndoor->dlv; | 5052 v19 = &pIndoor->dlv; |
5053 v6 = v19->uReputation >= pValue; | 5053 v6 = v19->uReputation >= pValue; |
5054 return v6; | 5054 return v6; |
5055 case VAR_History_28|VAR_Sex: | 5055 case VAR_Unknown1: |
5056 v21 = &pOutdoor->ddm; | 5056 v21 = &pOutdoor->ddm; |
5057 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | 5057 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) |
5058 v21 = &pIndoor->dlv; | 5058 v21 = &pIndoor->dlv; |
5059 v6 = v21->field_C_alert == pValue; | 5059 v6 = v21->field_C_alert == pValue; |
5060 return v6; | 5060 return v6; |
5061 case VAR_MonthEquals2|VAR_Sex: | |
5062 case VAR_MonthEquals2|VAR_Class: | |
5063 case VAR_Counter1: | 5061 case VAR_Counter1: |
5064 case VAR_Counter2: | 5062 case VAR_Counter2: |
5065 case VAR_Counter3: | 5063 case VAR_Counter3: |
5066 case VAR_Counter4: | 5064 case VAR_Counter4: |
5067 case VAR_Counter5: | 5065 case VAR_Counter5: |
5068 case VAR_Counter6: | 5066 case VAR_Counter6: |
5069 case VAR_Counter7: | 5067 case VAR_Counter7: |
5070 case VAR_Counter8: | 5068 case VAR_Counter8: |
5069 case VAR_Counter9: | |
5070 case VAR_Counter10: | |
5071 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; | 5071 v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; |
5072 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] | 5072 if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] |
5073 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) | 5073 && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) |
5074 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) | 5074 + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) |
5075 return true; | 5075 return true; |
5076 return false; | 5076 return false; |
5077 case VAR_NumSkillPoints: | 5077 case VAR_NumSkillPoints: |
5078 v4 = this->uSkillPoints; | 5078 v4 = this->uSkillPoints; |
5079 return v4 >= pValue; | 5079 return v4 >= pValue; |
5080 case VAR_CircusPrises: | 5080 case VAR_CircusPrises: //isn't used in MM6 since 0x1D6u is a book of regeneration |
5081 v4 = 0; | 5081 v4 = 0; |
5082 v23 = pParty->pPlayers;//[0].pInventoryItems; | 5082 for (int playerNum = 0; playerNum < 4; playerNum++) |
5083 do | |
5084 { | 5083 { |
5085 v24 = v23->pInventoryItemList; | 5084 for (int invPos = 0; invPos < 138; invPos++) |
5086 v25 = 138; | |
5087 do | |
5088 { | 5085 { |
5089 switch ( v24->uItemID ) | 5086 int itemId = pParty->pPlayers[playerNum].pInventoryItemList[invPos].uItemID; |
5087 switch ( itemId ) | |
5090 { | 5088 { |
5091 case 0x1D6u: | 5089 case 0x1D6u: |
5092 ++v4; | 5090 ++v4; |
5093 break; | 5091 break; |
5094 case 0x1D7u: | 5092 case 0x1D7u: |
5095 v4 += 3; | 5093 v4 += 3; |
5096 break; | 5094 break; |
5097 case 0x1DDu: | 5095 case 0x1DDu: |
5098 v4 += 5; | 5096 v4 += 5; |
5099 break; | 5097 break; |
5100 } | 5098 } |
5101 ++v24; | |
5102 --v25; | |
5103 } | 5099 } |
5104 while ( v25 ); | |
5105 ++v23; | |
5106 } | 5100 } |
5107 while ( v23 <= &pParty->pPlayers[3] ); | |
5108 return v4 >= pValue; | 5101 return v4 >= pValue; |
5109 case VAR_MonthEquals2: | 5102 case VAR_MonthIs: |
5110 v6 = pParty->uCurrentMonth == pValue; | 5103 v6 = pParty->uCurrentMonth == pValue; |
5111 return v6; | 5104 return v6; |
5112 case VAR_IsFlying: | 5105 case VAR_IsFlying: |
5113 if ( pParty->bFlying | 5106 if ( pParty->bFlying |
5114 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) | 5107 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) |
5115 return true; | 5108 return true; |
5116 return false; | 5109 return false; |
5117 case VAR_HiredNPCHasSpeciality: | 5110 case VAR_HiredNPCHasSpeciality: |
5118 LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); | 5111 return CheckHiredNPCSpeciality(pValue); |
5119 return v6; | |
5120 case VAR_NPCs2: | 5112 case VAR_NPCs2: |
5121 return pNPCStats->pNewNPCData[pValue].Hired(); | 5113 return pNPCStats->pNewNPCData[pValue].Hired(); |
5122 case VAR_MonthEquals|VAR_CurrentSP: | 5114 case VAR_PlayerBits: |
5123 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; | 5115 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
5124 our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; | 5116 byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8]; |
5125 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | 5117 if ( !((unsigned __int8)test_bit_value & byteWithRequestedBit) ) |
5126 return v4 >= pValue; | 5118 return v4 >= pValue; |
5127 v4 = pValue; | 5119 v4 = pValue; |
5128 return v4 >= pValue; | 5120 return v4 >= pValue; |
5129 case VAR_ItemEquipped: | 5121 case VAR_ItemEquipped: |
5130 v26 = (ITEM_EQUIP_TYPE)0; | 5122 for (int i = 0; i < 16; i++) |
5131 v27 = (char *)&this->pEquipment; | 5123 { |
5132 break; | 5124 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) && GetNthEquippedIndexItem(i)->uItemID == pValue ) |
5125 { | |
5126 return true; | |
5127 } | |
5128 } | |
5129 return false; | |
5133 case VAR_GoldInBank: | 5130 case VAR_GoldInBank: |
5134 v4 = pParty->uNumGoldInBank; | 5131 v4 = pParty->uNumGoldInBank; |
5135 return v4 >= pValue; | 5132 return v4 >= pValue; |
5136 case VAR_ThieverySkill|0x80: | 5133 case VAR_IsMightMoreThanBase: |
5137 v28 = GetActualMight(); | 5134 v28 = GetActualMight(); |
5138 v29 = v3->GetBaseStrength(); | 5135 v29 = GetBaseStrength(); |
5139 goto LABEL_168; | 5136 return (v28 >= v29); |
5140 case VAR_DisarmTrapSkill|0x80: | 5137 case VAR_IsIntellectMoreThanBase: |
5141 v28 = GetActualIntelligence(); | 5138 v28 = GetActualIntelligence(); |
5142 v29 = v3->GetBaseIntelligence(); | 5139 v29 = GetBaseIntelligence(); |
5143 goto LABEL_168; | 5140 return (v28 >= v29); |
5144 case VAR_MonthEquals: | 5141 case VAR_IsPersonalityMoreThanBase: |
5145 v28 = GetActualWillpower(); | 5142 v28 = GetActualWillpower(); |
5146 v29 = v3->GetBaseWillpower(); | 5143 v29 = GetBaseWillpower(); |
5147 goto LABEL_168; | 5144 return (v28 >= v29); |
5148 case VAR_MonthEquals|VAR_Sex: | 5145 case VAR_IsEnduranceMoreThanBase: |
5149 v28 = GetActualEndurance(); | 5146 v28 = GetActualEndurance(); |
5150 v29 = v3->GetBaseEndurance(); | 5147 v29 = GetBaseEndurance(); |
5151 goto LABEL_168; | 5148 return (v28 >= v29); |
5152 case VAR_IdentifyMonsterSkill|0x80: | 5149 case VAR_IsSpeedMoreThanBase: |
5153 v28 = GetActualSpeed(); | 5150 v28 = GetActualSpeed(); |
5154 v29 = v3->GetBaseSpeed(); | 5151 v29 = GetBaseSpeed(); |
5155 goto LABEL_168; | 5152 return (v28 >= v29); |
5156 case VAR_ArmsmasterSkill|0x80: | 5153 case VAR_IsAccuracyMoreThanBase: |
5157 v28 = GetActualAccuracy(); | 5154 v28 = GetActualAccuracy(); |
5158 v29 = v3->GetBaseAccuracy(); | 5155 v29 = GetBaseAccuracy(); |
5159 goto LABEL_168; | 5156 return (v28 >= v29); |
5160 case VAR_MonthEquals|VAR_MaxHP: | 5157 case VAR_IsLuckMoreThanBase: |
5161 v28 = GetActualLuck(); | 5158 v28 = GetActualLuck(); |
5162 v29 = v3->GetBaseLuck(); | 5159 v29 = GetBaseLuck(); |
5163 LABEL_168: | 5160 return (v28 >= v29); |
5164 v10 = __OFSUB__(v28, v29); | |
5165 v9 = v28 - v29 < 0; | |
5166 LABEL_169: | |
5167 if ( v9 ^ v10 ) | |
5168 return v4 >= pValue; | |
5169 return true; | |
5170 default: | 5161 default: |
5171 return v4 >= pValue; | |
5172 } | |
5173 while ( !v3->HasItemEquipped(v26) | |
5174 || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) | |
5175 { | |
5176 v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); | |
5177 v27 += 4; | |
5178 if ( (signed int)v26 >= 16 ) | |
5179 return false; | 5162 return false; |
5180 } | 5163 } |
5181 return true; | 5164 } |
5182 } | 5165 if ( VarNum == VAR_AutoNotes ) //TODO: find out why the double subtraction. or whether this is even used |
5183 if ( VarNum == VAR_AutoNotes ) | 5166 { |
5184 { | 5167 test_bit_value = 0x80u >> (pValue - 2) % 8; |
5185 test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; | 5168 byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8]; |
5186 our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; | 5169 return (test_bit_value & byteWithRequestedBit); |
5187 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | |
5188 return false; | |
5189 return true; | |
5190 } | 5170 } |
5191 if ( VarNum <= VAR_BaseLuck ) | 5171 if ( VarNum <= VAR_BaseLuck ) |
5192 { | 5172 { |
5193 if ( VarNum != VAR_BaseLuck ) | 5173 if ( VarNum != VAR_BaseLuck ) |
5194 { | 5174 { |
5195 switch ( VarNum ) | 5175 switch ( VarNum ) |
5196 { | 5176 { |
5197 case VAR_Hour: | 5177 case VAR_Hour: |
5198 if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) | 5178 if ( (long long)(pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) |
5199 return true; | 5179 return true; |
5200 return false; | 5180 return false; |
5201 case VAR_DayOfYear: | 5181 case VAR_DayOfYear: |
5202 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; | 5182 if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 336 + 1 == pValue) |
5203 v6 = v5 == pValue; | 5183 return true; |
5204 return v6; | 5184 return false; |
5205 case VAR_DayOfWeek: | 5185 case VAR_DayOfWeek: |
5206 v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; | 5186 if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 7) |
5207 v6 = v5 == pValue; | 5187 return true; |
5208 return v6; | 5188 return false; |
5209 case VAR_Sex: | 5189 case VAR_Sex: |
5210 if ( pValue == (CHARACTER_RACE)this->uSex ) | 5190 if ( pValue == this->uSex ) |
5211 return true; | 5191 return true; |
5212 return v4 >= pValue; | 5192 return false; |
5213 case VAR_Class: | 5193 case VAR_Class: |
5214 v7 = (CHARACTER_RACE)this->classType; | 5194 if ( pValue == this->classType ) |
5215 if ( pValue == v7 ) | |
5216 return true; | 5195 return true; |
5217 return v4 >= pValue; | 5196 return false; |
5218 case VAR_Race: | 5197 case VAR_Race: |
5219 v7 = GetRace(); | 5198 if ( pValue == GetRace() ) |
5220 if ( pValue == v7 ) | |
5221 return true; | 5199 return true; |
5222 return v4 >= pValue; | 5200 return v4 >= pValue; |
5223 case VAR_CurrentHP: | 5201 case VAR_CurrentHP: |
5224 v4 = this->sHealth; | 5202 v4 = this->sHealth; |
5225 return v4 >= pValue; | 5203 return v4 >= pValue; |
5226 case VAR_MaxHP: | 5204 case VAR_MaxHP: |
5227 v8 = GetMaxHealth(); | 5205 v8 = GetMaxHealth(); |
5228 v10 = __OFSUB__(v3->sHealth, v8); | 5206 v9 = this->sHealth; |
5229 v9 = v3->sHealth - v8 < 0; | 5207 return (v9 >= v8); |
5230 goto LABEL_169; | |
5231 case VAR_CurrentSP: | 5208 case VAR_CurrentSP: |
5232 v4 = this->sMana; | 5209 v4 = this->sMana; |
5233 return v4 >= pValue; | 5210 return v4 >= pValue; |
5234 case VAR_MaxSP: | 5211 case VAR_MaxSP: |
5235 v11 = GetMaxMana(); | 5212 v8 = GetMaxMana(); |
5236 v10 = __OFSUB__(v3->sMana, v11); | 5213 v9 = this->sMana; |
5237 v9 = v3->sMana - v11 < 0; | 5214 return (v9 >= v8); |
5238 goto LABEL_169; | |
5239 case VAR_ActualAC: | 5215 case VAR_ActualAC: |
5240 v12 = GetActualAC(); | 5216 v4 = GetActualAC(); |
5241 goto _j_cmp_against_arg; | 5217 return v4 >= pValue; |
5242 case VAR_ACModifier: | 5218 case VAR_ACModifier: |
5243 v4 = this->sACModifier; | 5219 v4 = this->sACModifier; |
5244 return v4 >= pValue; | 5220 return v4 >= pValue; |
5245 case VAR_BaseLevel: | 5221 case VAR_BaseLevel: |
5246 v4 = this->uLevel; | 5222 v4 = this->uLevel; |
5247 return v4 >= pValue; | 5223 return v4 >= pValue; |
5248 case VAR_LevelModifier: | 5224 case VAR_LevelModifier: |
5249 v4 = this->sLevelModifier; | 5225 v4 = this->sLevelModifier; |
5250 return v4 >= pValue; | 5226 return v4 >= pValue; |
5251 case VAR_Age: | 5227 case VAR_Age: |
5252 v12 = GetActualAge(); | 5228 v4 = GetActualAge(); |
5253 goto _j_cmp_against_arg; | 5229 return v4 >= pValue; |
5254 case VAR_Award: | 5230 case VAR_Award: |
5255 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; | 5231 test_bit_value = 0x80u >> (pValue - 1) % 8; |
5256 our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8]; | 5232 byteWithRequestedBit = this->_achieved_awards_bits[(pValue - 1) /8]; |
5257 if ( !((unsigned __int8)test_bit_value & our_bit_value) ) | 5233 return ( test_bit_value & byteWithRequestedBit ); |
5258 return true; | |
5259 return false; | |
5260 case VAR_Experience: | 5234 case VAR_Experience: |
5261 v4 = LODWORD(this->uExperience); | 5235 v4 = LODWORD(this->uExperience); |
5262 return v4 >= pValue; | 5236 return v4 >= pValue; |
5263 case VAR_QBits_QuestsDone: | 5237 case VAR_QBits_QuestsDone: |
5264 test_bit_value = 0x80u >> (pValue - 1) % 8; | 5238 test_bit_value = 0x80u >> (pValue - 1) % 8; |
5265 our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; | 5239 byteWithRequestedBit = pParty->_quest_bits[(pValue - 1)/8]; |
5266 if ( test_bit_value & our_bit_value ) | 5240 return ( test_bit_value & byteWithRequestedBit ); |
5267 return true; | |
5268 return false; | |
5269 case VAR_PlayerItemInHands: | 5241 case VAR_PlayerItemInHands: |
5270 v15 = 0; | 5242 for (int i = 0; i < 138; i++) |
5271 v16 = v3->pInventoryItemList; | 5243 { |
5272 break; | 5244 if (pInventoryItemList[i].uItemID == pValue) |
5245 { | |
5246 return true; | |
5247 } | |
5248 } | |
5249 return pParty->pPickedItem.uItemID == pValue; | |
5273 case VAR_FixedGold: | 5250 case VAR_FixedGold: |
5274 v4 = pParty->uNumGold; | 5251 v4 = pParty->uNumGold; |
5275 return v4 >= pValue; | 5252 return v4 >= pValue; |
5276 case VAR_MightBonus: | 5253 case VAR_MightBonus: |
5277 v4 = this->uMightBonus; | 5254 v4 = this->uMightBonus; |
5314 return v4 >= pValue; | 5291 return v4 >= pValue; |
5315 case VAR_FixedFood: | 5292 case VAR_FixedFood: |
5316 v4 = pParty->uNumFoodRations; | 5293 v4 = pParty->uNumFoodRations; |
5317 return v4 >= pValue; | 5294 return v4 >= pValue; |
5318 default: | 5295 default: |
5319 return v4 >= pValue; | 5296 return false; |
5320 } | 5297 } |
5321 while ( v16->uItemID != pValue ) | |
5322 { | |
5323 ++v15; | |
5324 ++v16; | |
5325 if ( v15 >= 138 ) | |
5326 { | |
5327 v6 = pParty->pPickedItem.uItemID == pValue; | |
5328 return v6; | |
5329 } | |
5330 } | |
5331 return true; | |
5332 } | 5298 } |
5333 v4 = this->uLuck; | 5299 v4 = this->uLuck; |
5334 return v4 >= pValue; | 5300 return v4 >= pValue; |
5335 } | 5301 } |
5336 if ( VarNum <= VAR_MagicResistance ) | 5302 if ( VarNum <= VAR_MagicResistance ) |
5369 return v4 >= pValue; | 5335 return v4 >= pValue; |
5370 case VAR_DarkResistance: | 5336 case VAR_DarkResistance: |
5371 v4 = this->sResDarkBase; | 5337 v4 = this->sResDarkBase; |
5372 return v4 >= pValue; | 5338 return v4 >= pValue; |
5373 case VAR_ActualMight: | 5339 case VAR_ActualMight: |
5374 v12 = GetActualMight(); | 5340 v4 = GetActualMight(); |
5375 goto _j_cmp_against_arg; | 5341 return v4 >= pValue; |
5376 case VAR_ActualIntellect: | 5342 case VAR_ActualIntellect: |
5377 v12 = GetActualIntelligence(); | 5343 v4 = GetActualIntelligence(); |
5378 goto _j_cmp_against_arg; | 5344 return v4 >= pValue; |
5379 case VAR_ActualPersonality: | 5345 case VAR_ActualPersonality: |
5380 v12 = GetActualWillpower(); | 5346 v4 = GetActualWillpower(); |
5381 goto _j_cmp_against_arg; | 5347 return v4 >= pValue; |
5382 case VAR_ActualEndurance: | 5348 case VAR_ActualEndurance: |
5383 v12 = GetActualEndurance(); | 5349 v4 = GetActualEndurance(); |
5384 goto _j_cmp_against_arg; | 5350 return v4 >= pValue; |
5385 case VAR_ActualSpeed: | 5351 case VAR_ActualSpeed: |
5386 v12 = GetActualSpeed(); | 5352 v4 = GetActualSpeed(); |
5387 goto _j_cmp_against_arg; | 5353 return v4 >= pValue; |
5388 case VAR_ActualAccuracy: | 5354 case VAR_ActualAccuracy: |
5389 v12 = GetActualAccuracy(); | 5355 v4 = GetActualAccuracy(); |
5390 goto _j_cmp_against_arg; | 5356 return v4 >= pValue; |
5391 case VAR_ActualLuck: | 5357 case VAR_ActualLuck: |
5392 v12 = GetActualLuck(); | 5358 v4 = GetActualLuck(); |
5393 _j_cmp_against_arg: | 5359 return v4 >= pValue; |
5394 v4 = v12; | |
5395 break; | 5360 break; |
5396 default: | 5361 default: |
5397 return v4 >= pValue; | 5362 return v4 >= pValue; |
5398 } | 5363 } |
5399 } | 5364 } |
5407 { | 5372 { |
5408 switch ( VarNum ) | 5373 switch ( VarNum ) |
5409 { | 5374 { |
5410 case VAR_MindResistanceBonus: | 5375 case VAR_MindResistanceBonus: |
5411 v4 = this->sResMindBonus; | 5376 v4 = this->sResMindBonus; |
5412 break; | 5377 return v4 >= pValue; |
5413 case VAR_FireResistanceBonus: | 5378 case VAR_FireResistanceBonus: |
5414 v4 = this->sResFireBonus; | 5379 v4 = this->sResFireBonus; |
5415 break; | 5380 return v4 >= pValue; |
5416 case VAR_AirResistanceBonus: | 5381 case VAR_AirResistanceBonus: |
5417 v4 = this->sResAirBonus; | 5382 v4 = this->sResAirBonus; |
5418 break; | 5383 return v4 >= pValue; |
5419 case VAR_WaterResistanceBonus: | 5384 case VAR_WaterResistanceBonus: |
5420 v4 = this->sResWaterBonus; | 5385 v4 = this->sResWaterBonus; |
5421 break; | 5386 return v4 >= pValue; |
5422 case VAR_EarthResistanceBonus: | 5387 case VAR_EarthResistanceBonus: |
5423 v4 = this->sResEarthBonus; | 5388 v4 = this->sResEarthBonus; |
5424 break; | 5389 return v4 >= pValue; |
5425 case VAR_SpiritResistanceBonus: | 5390 case VAR_SpiritResistanceBonus: |
5426 v4 = this->sResSpiritBonus; | 5391 v4 = this->sResSpiritBonus; |
5427 break; | 5392 return v4 >= pValue; |
5428 } | 5393 } |
5429 return v4 >= pValue; | |
5430 } | 5394 } |
5431 if ( VarNum == VAR_BodyResistanceBonus ) | 5395 if ( VarNum == VAR_BodyResistanceBonus ) |
5432 { | 5396 { |
5433 v4 = this->sResBodyBonus; | 5397 v4 = this->sResBodyBonus; |
5434 return v4 >= pValue; | 5398 return v4 >= pValue; |
5449 return v4 >= pValue; | 5413 return v4 >= pValue; |
5450 } | 5414 } |
5451 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) | 5415 if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) |
5452 return v4 >= pValue; | 5416 return v4 >= pValue; |
5453 } | 5417 } |
5454 LABEL_90: | |
5455 v18 = *((short *)&this->pConditions[16] + VarNum); | 5418 v18 = *((short *)&this->pConditions[16] + VarNum); |
5456 if ( pValue <= 63 ) | 5419 if ( pValue <= 63 ) |
5457 v4 = v18 & 0x3F; | 5420 v4 = v18 & 0x3F; |
5458 else | 5421 else |
5459 v4 = pValue & v18; | 5422 v4 = pValue & v18; |
5460 return v4 >= pValue; | 5423 return v4 >= pValue; |
5461 } | 5424 } |
5462 if ( VarNum == 104 ) | 5425 if ( VarNum == 104 ) |
5463 goto LABEL_90; | 5426 { |
5427 v18 = *((short *)&this->pConditions[16] + VarNum); | |
5428 if ( pValue <= 63 ) | |
5429 v4 = v18 & 0x3F; | |
5430 else | |
5431 v4 = pValue & v18; | |
5432 return v4 >= pValue; | |
5433 } | |
5464 if ( (signed int)VarNum <= 104 ) | 5434 if ( (signed int)VarNum <= 104 ) |
5465 return v4 >= pValue; | 5435 return v4 >= pValue; |
5466 if ( (signed int)VarNum > 0x79 ) | 5436 if ( (signed int)VarNum > 0x79 ) |
5467 { | 5437 { |
5468 if ( VarNum != 122 ) | 5438 if ( VarNum != 122 ) |
5477 return v4 >= pValue; | 5447 return v4 >= pValue; |
5478 } | 5448 } |
5479 v4 = pValue; | 5449 v4 = pValue; |
5480 return v4 >= pValue; | 5450 return v4 >= pValue; |
5481 } | 5451 } |
5482 return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); | 5452 return (this->pConditions[VarNum - 105] > 0);// *((int *)this + 2 * VarNum - 210); the original was never used, which is why probably it wasn't correct |
5483 } | 5453 } |
5484 | 5454 |
5485 | 5455 |
5486 //----- (0044A5CB) -------------------------------------------------------- | 5456 //----- (0044A5CB) -------------------------------------------------------- |
5487 void Player::SetVariable(enum VariableType var_type, signed int var_value) | 5457 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
5546 } | 5516 } |
5547 else | 5517 else |
5548 { | 5518 { |
5549 switch ( var_type ) | 5519 switch ( var_type ) |
5550 { | 5520 { |
5551 case VAR_MonthEquals|VAR_CurrentSP: | 5521 case VAR_PlayerBits: |
5552 __debugbreak(); //how do I get here? | 5522 __debugbreak(); //how do I get here? |
5553 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); | 5523 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); |
5554 break; | 5524 break; |
5555 case VAR_NPCs2: | 5525 case VAR_NPCs2: |
5556 __debugbreak(); //how do I get here? | 5526 __debugbreak(); //how do I get here? |
6525 } | 6495 } |
6526 else | 6496 else |
6527 { | 6497 { |
6528 switch ( var_type ) | 6498 switch ( var_type ) |
6529 { | 6499 { |
6530 case VAR_MonthEquals|VAR_CurrentSP: | 6500 case VAR_PlayerBits: |
6531 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); | 6501 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); |
6532 break; | 6502 break; |
6533 case VAR_NPCs2: | 6503 case VAR_NPCs2: |
6534 pParty->field_709 = 0; | 6504 pParty->field_709 = 0; |
6535 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | 6505 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; |