comparison Player.cpp @ 1790:5ace90f129d3

Player::AddVariable value capping done with calls to min, setplayerbuffanim and playsound contition variables removed
author Grumpy7
date Thu, 03 Oct 2013 08:32:59 +0200
parents 4d70df78baca
children 9f610f471283
comparison
equal deleted inserted replaced
1789:4d70df78baca 1790:5ace90f129d3
6038 char v26; // zf@151 6038 char v26; // zf@151
6039 DDM_DLV_Header *v27; // eax@153 6039 DDM_DLV_Header *v27; // eax@153
6040 signed int v28; // eax@176 6040 signed int v28; // eax@176
6041 int v29; // [sp-8h] [bp-40h]@84 6041 int v29; // [sp-8h] [bp-40h]@84
6042 // signed int v30; // [sp-4h] [bp-3Ch]@4 6042 // signed int v30; // [sp-4h] [bp-3Ch]@4
6043 int v31; // [sp-4h] [bp-3Ch]@84
6044 ItemGen item; // [sp+Ch] [bp-2Ch]@45 6043 ItemGen item; // [sp+Ch] [bp-2Ch]@45
6045 unsigned int v33; // [sp+30h] [bp-8h]@34 6044 unsigned int v33; // [sp+30h] [bp-8h]@34
6046 char v34; // [sp+37h] [bp-1h]@1 6045 char v34; // [sp+37h] [bp-1h]@1
6047 6046
6048 v3 = 0; 6047 v3 = 0;
6064 if ( var_type != VAR_ActualMight ) 6063 if ( var_type != VAR_ActualMight )
6065 { 6064 {
6066 switch ( var_type ) 6065 switch ( var_type )
6067 { 6066 {
6068 case VAR_RandomGold: 6067 case VAR_RandomGold:
6069 if ( !val ) 6068 if ( val == 0 )
6070 val = 1; 6069 val = 1;
6071 v6 = rand(); 6070 v6 = rand();
6072 party_finds_gold(v6 % val + 1, 1); 6071 party_finds_gold(v6 % val + 1, 1);
6073 GameUI_DrawFoodAndGold(); 6072 GameUI_DrawFoodAndGold();
6074 return; 6073 return;
6075 case VAR_RandomFood: 6074 case VAR_RandomFood:
6076 if ( !val ) 6075 if ( val == 0 )
6077 val = 1; 6076 val = 1;
6078 v7 = rand() % val + 1; 6077 v7 = rand() % val + 1;
6079 Party::GiveFood(v7); 6078 Party::GiveFood(v7);
6080 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food 6079 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food
6081 ShowStatusBarString(pTmpBuf.data(), 2u); 6080 ShowStatusBarString(pTmpBuf.data(), 2u);
6091 this->classType = (PLAYER_CLASS_TYPE)val; 6090 this->classType = (PLAYER_CLASS_TYPE)val;
6092 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6091 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6093 PlayAwardSound(uPlayerIdx); 6092 PlayAwardSound(uPlayerIdx);
6094 return; 6093 return;
6095 case VAR_CurrentHP: 6094 case VAR_CurrentHP:
6096 v8 = &this->sHealth; 6095 this->sHealth = min(this->sHealth + val, this->GetMaxHealth() );
6097 *v8 += val;
6098 if ( this->sHealth <= this->GetMaxHealth() )
6099 {
6100 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6101 PlayAwardSound(uPlayerIdx);
6102 return;
6103 }
6104 v9 = this->GetMaxHealth();
6105 *v8 = v9;
6106 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6096 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6107 PlayAwardSound(uPlayerIdx); 6097 PlayAwardSound(uPlayerIdx);
6108 return; 6098 return;
6109 case VAR_MaxHP: 6099 case VAR_MaxHP:
6110 v10 = this->GetMaxHealth();
6111 this->_health_related = 0; 6100 this->_health_related = 0;
6112 this->uFullHealthBonus = 0; 6101 this->uFullHealthBonus = 0;
6113 this->sHealth = v10; 6102 this->sHealth = this->GetMaxHealth();
6114 return; 6103 return;
6115 case VAR_CurrentSP: 6104 case VAR_CurrentSP:
6116 v8 = &this->sMana; 6105 this->sMana = min(this->sMana + val, this->GetMaxMana() );
6117 *v8 += val;
6118 if ( this->sMana > GetMaxMana() )
6119 {
6120 v9 = this->GetMaxMana();
6121 *v8 = v9;
6122 }
6123 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6106 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6124 PlayAwardSound(uPlayerIdx); 6107 PlayAwardSound(uPlayerIdx);
6125 return; 6108 return;
6126 case VAR_MaxSP: 6109 case VAR_MaxSP:
6127 v11 = GetMaxMana();
6128 this->_mana_related = 0; 6110 this->_mana_related = 0;
6129 this->uFullManaBonus = 0; 6111 this->uFullManaBonus = 0;
6130 this->sMana = v11; 6112 this->sMana = GetMaxMana();
6131 return; 6113 return;
6132 case VAR_ACModifier: 6114 case VAR_ACModifier:
6133 v12 = &this->sACModifier; 6115 this->sACModifier = min(this->sACModifier + val, 255);
6134 *v12 += val;
6135 if ( *v12 > 255 )
6136 *v12 = 255;
6137 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6116 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6138 PlayAwardSound(uPlayerIdx); 6117 PlayAwardSound(uPlayerIdx);
6139 return; 6118 return;
6140 case VAR_BaseLevel: 6119 case VAR_BaseLevel:
6141 v12 = (__int16 *)&this->uLevel; 6120 this->uLevel = min(this->uLevel + val, 255);
6142 *v12 += val;
6143 if ( *v12 > 255 )
6144 *v12 = 255;
6145 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6121 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6146 PlayAwardSound(uPlayerIdx); 6122 PlayAwardSound(uPlayerIdx);
6147 return; 6123 return;
6148 case VAR_LevelModifier: 6124 case VAR_LevelModifier:
6149 v12 = &this->sLevelModifier; 6125 this->sLevelModifier = min(this->sLevelModifier + val, 255);
6150 *v12 += val;
6151 if ( *v12 > 255 )
6152 *v12 = 255;
6153 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6126 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6154 PlayAwardSound(uPlayerIdx); 6127 PlayAwardSound(uPlayerIdx);
6155 return; 6128 return;
6156 case VAR_Age: 6129 case VAR_Age:
6157 this->sAgeModifier += val; 6130 this->sAgeModifier += val;
6158 return; 6131 return;
6159 case VAR_Award: 6132 case VAR_Award:
6160 if (_449B57_test_bit(this->_achieved_awards_bits, val) && pAwards[val].pText ) 6133 if (_449B57_test_bit(this->_achieved_awards_bits, val) && pAwards[val].pText )
6161 { 6134 {
6162 v34 = 1;
6163 v3 = 1;
6164 this->PlaySound(SPEECH_96, 0); 6135 this->PlaySound(SPEECH_96, 0);
6136 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6137 PlayAwardSound(uPlayerIdx);
6165 } 6138 }
6166 v15 = (char *)this->_achieved_awards_bits; 6139 _449B7E_toggle_bit(this->_achieved_awards_bits, val, 1);
6167 _449B7E_toggle_bit((unsigned char *)v15, val, 1);
6168 if ( v34 != 1 )
6169 {
6170 if ( v3 != 1 )
6171 return;
6172 PlayAwardSound(uPlayerIdx);
6173 return;
6174 }
6175 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6176 if ( v3 != 1 )
6177 return;
6178 PlayAwardSound(uPlayerIdx);
6179 return; 6140 return;
6180 case VAR_Experience: 6141 case VAR_Experience:
6181 this->uExperience += val; 6142 this->uExperience = min(this->uExperience + val, 4000000000i64);
6182 if ( this->uExperience > 4000000000i64 )
6183 this->uExperience = 4000000000i64;
6184 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6143 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6185 PlayAwardSound(uPlayerIdx); 6144 PlayAwardSound(uPlayerIdx);
6186 return; 6145 return;
6187 case VAR_QBits_QuestsDone: 6146 case VAR_QBits_QuestsDone:
6188 if ( !_449B57_test_bit(pParty->_quest_bits, val) && pQuestTable[val] ) 6147 if ( !_449B57_test_bit(pParty->_quest_bits, val) && pQuestTable[val] )
6189 { 6148 {
6190 //v17 = pPlayers[uPlayerIdx + 1];
6191 bFlashQuestBook = 1; 6149 bFlashQuestBook = 1;
6192 v34 = 1;
6193 v3 = 1;
6194 this->PlaySound(SPEECH_93, 0); 6150 this->PlaySound(SPEECH_93, 0);
6151 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6152 PlayAwardSound(uPlayerIdx);
6195 } 6153 }
6196 _449B7E_toggle_bit(pParty->_quest_bits, val, 1); 6154 _449B7E_toggle_bit(pParty->_quest_bits, val, 1);
6197 if ( v34 != 1 )
6198 {
6199 if ( v3 != 1 )
6200 return;
6201 PlayAwardSound(uPlayerIdx);
6202 return;
6203 }
6204 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6205 if ( v3 != 1 )
6206 return;
6207 PlayAwardSound(uPlayerIdx);
6208 return; 6155 return;
6209 case VAR_PlayerItemInHands: 6156 case VAR_PlayerItemInHands:
6210 item.Reset(); 6157 item.Reset();
6211 item.uAttributes = 1; 6158 item.uAttributes = 1;
6212 item.uItemID = val; 6159 item.uItemID = val;
6221 return; 6168 return;
6222 case VAR_FixedGold: 6169 case VAR_FixedGold:
6223 party_finds_gold(val, 1); 6170 party_finds_gold(val, 1);
6224 return; 6171 return;
6225 case VAR_BaseMight: 6172 case VAR_BaseMight:
6226 v18 = (__int16 *)&this->uMight; 6173 this->uMight = min(this->uMight + val, 255);
6227 *v18 += val;
6228 if ( *v18 > 255 )
6229 *v18 = 255;
6230 this->PlaySound(SPEECH_92, 0); 6174 this->PlaySound(SPEECH_92, 0);
6231 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6175 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6232 PlayAwardSound(uPlayerIdx); 6176 PlayAwardSound(uPlayerIdx);
6233 return; 6177 return;
6234 case VAR_BaseIntellect: 6178 case VAR_BaseIntellect:
6235 v18 = (__int16 *)&this->uIntelligence; 6179 this->uIntelligence = min(this->uIntelligence + val, 255);
6236 *v18 += val;
6237 if ( *v18 > 255 )
6238 *v18 = 255;
6239 this->PlaySound(SPEECH_92, 0); 6180 this->PlaySound(SPEECH_92, 0);
6240 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6181 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6241 PlayAwardSound(uPlayerIdx); 6182 PlayAwardSound(uPlayerIdx);
6242 return; 6183 return;
6243 case VAR_BasePersonality: 6184 case VAR_BasePersonality:
6244 v18 = (__int16 *)&this->uWillpower; 6185 this->uWillpower = min(this->uWillpower + val, 255);
6245 *v18 += val;
6246 if ( *v18 > 255 )
6247 *v18 = 255;
6248 this->PlaySound(SPEECH_92, 0); 6186 this->PlaySound(SPEECH_92, 0);
6249 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6187 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6250 PlayAwardSound(uPlayerIdx); 6188 PlayAwardSound(uPlayerIdx);
6251 return; 6189 return;
6252 case VAR_BaseEndurance: 6190 case VAR_BaseEndurance:
6253 v18 = (__int16 *)&this->uEndurance; 6191 this->uEndurance = min(this->uEndurance + val, 255);
6254 *v18 += val;
6255 if ( *v18 > 255 )
6256 *v18 = 255;
6257 this->PlaySound(SPEECH_92, 0); 6192 this->PlaySound(SPEECH_92, 0);
6258 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6193 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6259 PlayAwardSound(uPlayerIdx); 6194 PlayAwardSound(uPlayerIdx);
6260 return; 6195 return;
6261 case VAR_BaseSpeed: 6196 case VAR_BaseSpeed:
6262 v18 = (__int16 *)&this->uSpeed; 6197 this->uSpeed = min(this->uSpeed + val, 255);
6263 *v18 += val;
6264 if ( *v18 > 255 )
6265 *v18 = 255;
6266 this->PlaySound(SPEECH_92, 0); 6198 this->PlaySound(SPEECH_92, 0);
6267 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6199 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6268 PlayAwardSound(uPlayerIdx); 6200 PlayAwardSound(uPlayerIdx);
6269 return; 6201 return;
6270 case VAR_BaseAccuracy: 6202 case VAR_BaseAccuracy:
6271 v18 = (__int16 *)&this->uAccuracy; 6203 this->uAccuracy = min(this->uAccuracy + val, 255);
6272 *v18 += val;
6273 if ( *v18 > 255 )
6274 *v18 = 255;
6275 this->PlaySound(SPEECH_92, 0); 6204 this->PlaySound(SPEECH_92, 0);
6276 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6205 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6277 PlayAwardSound(uPlayerIdx); 6206 PlayAwardSound(uPlayerIdx);
6278 return; 6207 return;
6279 case VAR_BaseLuck: 6208 case VAR_BaseLuck:
6280 v18 = (__int16 *)&this->uLuck; 6209 this->uLuck = min(this->uLuck + val, 255);
6281 *v18 += val;
6282 if ( *v18 > 255 )
6283 *v18 = 255;
6284 this->PlaySound(SPEECH_92, 0); 6210 this->PlaySound(SPEECH_92, 0);
6285 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6211 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6286 PlayAwardSound(uPlayerIdx); 6212 PlayAwardSound(uPlayerIdx);
6287 return; 6213 return;
6288 case VAR_FixedFood: 6214 case VAR_FixedFood:
6311 return; 6237 return;
6312 } 6238 }
6313 return; 6239 return;
6314 } 6240 }
6315 LABEL_62: 6241 LABEL_62:
6316 v19 = (__int16 *)&this->uMightBonus; 6242 this->uMightBonus = min(this->uMightBonus + val, 255);
6317 *v19 += val; 6243 this->PlaySound(SPEECH_91, 0);
6318 if ( *v19 > 255 )
6319 *v19 = 255;
6320 v31 = 0;
6321 this->PlaySound(SPEECH_91, v31);
6322 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6244 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6323 PlayAwardSound(uPlayerIdx); 6245 PlayAwardSound(uPlayerIdx);
6324 return; 6246 return;
6325 } 6247 }
6326 if ( var_type <= VAR_FireResistanceBonus ) 6248 if ( var_type <= VAR_FireResistanceBonus )
6329 { 6251 {
6330 switch ( var_type ) 6252 switch ( var_type )
6331 { 6253 {
6332 case VAR_ActualIntellect: 6254 case VAR_ActualIntellect:
6333 LABEL_66: 6255 LABEL_66:
6334 v19 = (__int16 *)&this->uIntelligenceBonus; 6256 this->uIntelligenceBonus = min(this->uIntelligenceBonus + val, 255);
6335 *v19 += val; 6257 this->PlaySound(SPEECH_91, 0);
6336 if ( *v19 > 255 )
6337 *v19 = 255;
6338 v31 = 0;
6339 this->PlaySound(SPEECH_91, v31);
6340 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6258 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6341 PlayAwardSound(uPlayerIdx); 6259 PlayAwardSound(uPlayerIdx);
6342 return; 6260 return;
6343 case VAR_ActualPersonality: 6261 case VAR_ActualPersonality:
6344 LABEL_67: 6262 LABEL_67:
6345 v19 = (__int16 *)&this->uWillpowerBonus; 6263 this->uWillpowerBonus = min(this->uWillpowerBonus + val, 255);
6346 *v19 += val; 6264 this->PlaySound(SPEECH_91, 0);
6347 if ( *v19 > 255 )
6348 *v19 = 255;
6349 v31 = 0;
6350 this->PlaySound(SPEECH_91, v31);
6351 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6265 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6352 PlayAwardSound(uPlayerIdx); 6266 PlayAwardSound(uPlayerIdx);
6353 return; 6267 return;
6354 case VAR_ActualEndurance: 6268 case VAR_ActualEndurance:
6355 LABEL_68: 6269 LABEL_68:
6356 v19 = (__int16 *)&this->uEnduranceBonus; 6270 this->uEnduranceBonus = min(this->uEnduranceBonus + val, 255);
6357 *v19 += val; 6271 this->PlaySound(SPEECH_91, 0);
6358 if ( *v19 > 255 )
6359 *v19 = 255;
6360 v31 = 0;
6361 this->PlaySound(SPEECH_91, v31);
6362 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6272 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6363 PlayAwardSound(uPlayerIdx); 6273 PlayAwardSound(uPlayerIdx);
6364 return; 6274 return;
6365 case VAR_ActualSpeed: 6275 case VAR_ActualSpeed:
6366 LABEL_69: 6276 LABEL_69:
6367 v19 = (__int16 *)&this->uSpeedBonus; 6277 this->uSpeedBonus = min(this->uSpeedBonus + val, 255);
6368 *v19 += val; 6278 this->PlaySound(SPEECH_91, 0);
6369 if ( *v19 > 255 )
6370 *v19 = 255;
6371 v31 = 0;
6372 this->PlaySound(SPEECH_91, v31);
6373 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6279 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6374 PlayAwardSound(uPlayerIdx); 6280 PlayAwardSound(uPlayerIdx);
6375 return; 6281 return;
6376 case VAR_ActualAccuracy: 6282 case VAR_ActualAccuracy:
6377 LABEL_70: 6283 LABEL_70:
6378 v19 = (__int16 *)&this->uAccuracyBonus; 6284 this->uAccuracyBonus = min(this->uAccuracyBonus + val, 255);
6379 *v19 += val; 6285 this->PlaySound(SPEECH_91, 0);
6380 if ( *v19 > 255 )
6381 *v19 = 255;
6382 v31 = 0;
6383 this->PlaySound(SPEECH_91, v31);
6384 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6286 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6385 PlayAwardSound(uPlayerIdx); 6287 PlayAwardSound(uPlayerIdx);
6386 return; 6288 return;
6387 case VAR_ActualLuck: 6289 case VAR_ActualLuck:
6388 LABEL_71: 6290 LABEL_71:
6389 v19 = (__int16 *)&this->uLuckBonus; 6291 this->uLuckBonus = min(this->uLuckBonus + val, 255);
6390 *v19 += val; 6292 this->PlaySound(SPEECH_91, 0);
6391 if ( *v19 > 255 )
6392 *v19 = 255;
6393 v31 = 0;
6394 this->PlaySound(SPEECH_91, v31);
6395 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6293 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6396 PlayAwardSound(uPlayerIdx); 6294 PlayAwardSound(uPlayerIdx);
6397 return; 6295 return;
6398 case VAR_FireResistance: 6296 case VAR_FireResistance:
6399 v18 = &this->sResFireBase; 6297 this->sResFireBase = min(this->sResFireBase + val, 255);
6400 *v18 += val;
6401 if ( *v18 > 255 )
6402 *v18 = 255;
6403 this->PlaySound(SPEECH_92, 0); 6298 this->PlaySound(SPEECH_92, 0);
6404 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6299 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6405 PlayAwardSound(uPlayerIdx); 6300 PlayAwardSound(uPlayerIdx);
6406 return; 6301 return;
6407 case VAR_AirResistance: 6302 case VAR_AirResistance:
6408 v18 = &this->sResAirBase; 6303 this->sResAirBase = min(this->sResAirBase + val, 255);
6409 *v18 += val;
6410 if ( *v18 > 255 )
6411 *v18 = 255;
6412 this->PlaySound(SPEECH_92, 0); 6304 this->PlaySound(SPEECH_92, 0);
6413 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6305 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6414 PlayAwardSound(uPlayerIdx); 6306 PlayAwardSound(uPlayerIdx);
6415 return; 6307 return;
6416 case VAR_WaterResistance: 6308 case VAR_WaterResistance:
6417 v18 = &this->sResWaterBase; 6309 this->sResWaterBase = min(this->sResWaterBase + val, 255);
6418 *v18 += val;
6419 if ( *v18 > 255 )
6420 *v18 = 255;
6421 this->PlaySound(SPEECH_92, 0); 6310 this->PlaySound(SPEECH_92, 0);
6422 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6311 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6423 PlayAwardSound(uPlayerIdx); 6312 PlayAwardSound(uPlayerIdx);
6424 return; 6313 return;
6425 case VAR_EarthResistance: 6314 case VAR_EarthResistance:
6426 v18 = &this->sResEarthBase; 6315 this->sResEarthBase = min(this->sResEarthBase + val, 255);
6427 *v18 += val;
6428 if ( *v18 > 255 )
6429 *v18 = 255;
6430 this->PlaySound(SPEECH_92, 0); 6316 this->PlaySound(SPEECH_92, 0);
6431 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6317 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6432 PlayAwardSound(uPlayerIdx); 6318 PlayAwardSound(uPlayerIdx);
6433 return; 6319 return;
6434 case VAR_SpiritResistance: 6320 case VAR_SpiritResistance:
6435 v18 = &this->sResSpiritBase; 6321 this->sResSpiritBase = min(this->sResSpiritBase + val, 255);
6436 *v18 += val;
6437 if ( *v18 > 255 )
6438 *v18 = 255;
6439 this->PlaySound(SPEECH_92, 0); 6322 this->PlaySound(SPEECH_92, 0);
6440 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6323 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6441 PlayAwardSound(uPlayerIdx); 6324 PlayAwardSound(uPlayerIdx);
6442 return; 6325 return;
6443 case VAR_MindResistance: 6326 case VAR_MindResistance:
6444 v18 = &this->sResMindBase; 6327 this->sResMindBase = min(this->sResMindBase + val, 255);
6445 *v18 += val;
6446 if ( *v18 > 255 )
6447 *v18 = 255;
6448 this->PlaySound(SPEECH_92, 0); 6328 this->PlaySound(SPEECH_92, 0);
6449 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6329 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6450 PlayAwardSound(uPlayerIdx); 6330 PlayAwardSound(uPlayerIdx);
6451 return; 6331 return;
6452 case VAR_BodyResistance: 6332 case VAR_BodyResistance:
6453 v18 = &this->sResBodyBase; 6333 this->sResBodyBase = min(this->sResBodyBase + val, 255);
6454 *v18 += val;
6455 if ( *v18 > 255 )
6456 *v18 = 255;
6457 this->PlaySound(SPEECH_92, 0); 6334 this->PlaySound(SPEECH_92, 0);
6458 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6335 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6459 PlayAwardSound(uPlayerIdx); 6336 PlayAwardSound(uPlayerIdx);
6460 return; 6337 return;
6461 case VAR_LightResistance: 6338 case VAR_LightResistance:
6462 v18 = &this->sResLightBase; 6339 this->sResLightBase = min(this->sResLightBase + val, 255);
6463 *v18 += val;
6464 if ( *v18 > 255 )
6465 *v18 = 255;
6466 this->PlaySound(SPEECH_92, 0); 6340 this->PlaySound(SPEECH_92, 0);
6467 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6341 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6468 PlayAwardSound(uPlayerIdx); 6342 PlayAwardSound(uPlayerIdx);
6469 return; 6343 return;
6470 case VAR_DarkResistance: 6344 case VAR_DarkResistance:
6471 v18 = &this->sResDarkBase; 6345 this->sResDarkBase = min(this->sResDarkBase + val, 255);
6472 *v18 += val;
6473 if ( *v18 > 255 )
6474 *v18 = 255;
6475 this->PlaySound(SPEECH_92, 0); 6346 this->PlaySound(SPEECH_92, 0);
6476 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6347 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6477 PlayAwardSound(uPlayerIdx); 6348 PlayAwardSound(uPlayerIdx);
6478 return; 6349 return;
6479 case VAR_MagicResistance: 6350 case VAR_MagicResistance:
6480 v18 = &this->sResMagicBase; 6351 this->sResMagicBase = min(this->sResMagicBase + val, 255);
6481 *v18 += val;
6482 if ( *v18 > 255 )
6483 *v18 = 255;
6484 this->PlaySound(SPEECH_92, 0); 6352 this->PlaySound(SPEECH_92, 0);
6485 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6353 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6486 PlayAwardSound(uPlayerIdx); 6354 PlayAwardSound(uPlayerIdx);
6487 return; 6355 return;
6488 default: 6356 default:
6489 return; 6357 return;
6490 } 6358 }
6491 return; 6359 return;
6492 } 6360 }
6493 v19 = &this->sResFireBonus; 6361 this->sResFireBonus = min(this->sResFireBonus + val, 255);
6494 *v19 += val; 6362 this->PlaySound(SPEECH_91, 0);
6495 if ( *v19 > 255 )
6496 *v19 = 255;
6497 v31 = 0;
6498 this->PlaySound(SPEECH_91, v31);
6499 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6363 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6500 PlayAwardSound(uPlayerIdx); 6364 PlayAwardSound(uPlayerIdx);
6501 return; 6365 return;
6502 } 6366 }
6503 if ( var_type <= VAR_DisarmTrapSkill ) 6367 if ( var_type <= VAR_DisarmTrapSkill )
6507 if ( var_type <= VAR_BodyResistanceBonus ) 6371 if ( var_type <= VAR_BodyResistanceBonus )
6508 { 6372 {
6509 switch ( var_type ) 6373 switch ( var_type )
6510 { 6374 {
6511 case VAR_BodyResistanceBonus: 6375 case VAR_BodyResistanceBonus:
6512 v19 = &this->sResBodyBonus; 6376 this->sResBodyBonus = min(this->sResBodyBonus + val, 255);
6513 break; 6377 this->PlaySound(SPEECH_91, 0);
6378 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6379 PlayAwardSound(uPlayerIdx);
6380 return;
6514 case VAR_AirResistanceBonus: 6381 case VAR_AirResistanceBonus:
6515 v19 = &this->sResAirBonus; 6382 this->sResAirBonus = min(this->sResAirBonus + val, 255);
6516 break; 6383 this->PlaySound(SPEECH_91, 0);
6384 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6385 PlayAwardSound(uPlayerIdx);
6386 return;
6517 case VAR_WaterResistanceBonus: 6387 case VAR_WaterResistanceBonus:
6518 v19 = &this->sResWaterBonus; 6388 this->sResWaterBonus = min(this->sResWaterBonus + val, 255);
6519 break; 6389 this->PlaySound(SPEECH_91, 0);
6390 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6391 PlayAwardSound(uPlayerIdx);
6392 return;
6520 case VAR_EarthResistanceBonus: 6393 case VAR_EarthResistanceBonus:
6521 v19 = &this->sResEarthBonus; 6394 this->sResEarthBonus = min(this->sResEarthBonus + val, 255);
6522 break; 6395 this->PlaySound(SPEECH_91, 0);
6396 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6397 PlayAwardSound(uPlayerIdx);
6398 return;
6523 case VAR_SpiritResistanceBonus: 6399 case VAR_SpiritResistanceBonus:
6524 v19 = &this->sResSpiritBonus; 6400 this->sResSpiritBonus = min(this->sResSpiritBonus + val, 255);
6401 this->PlaySound(SPEECH_91, 0);
6402 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6403 PlayAwardSound(uPlayerIdx);
6404 return;
6405 case VAR_MindResistanceBonus:
6406 this->sResMindBonus = min(this->sResMindBonus + val, 255);
6407 this->PlaySound(SPEECH_91, 0);
6408 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6409 PlayAwardSound(uPlayerIdx);
6410 return;
6525 break; 6411 break;
6526 default: 6412 default:
6527 if ( var_type != 62 ) 6413 return;
6528 return;
6529 v19 = &this->sResMindBonus;
6530 break;
6531 } 6414 }
6532 *v19 += val; 6415 *v19 += val;
6533 if ( *v19 > 255 ) 6416 if ( *v19 > 255 )
6534 *v19 = 255; 6417 *v19 = 255;
6535 v31 = 0; 6418 this->PlaySound(SPEECH_91, 0);
6536 this->PlaySound(SPEECH_91, v31);
6537 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6419 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6538 PlayAwardSound(uPlayerIdx); 6420 PlayAwardSound(uPlayerIdx);
6539 return; 6421 return;
6540 } 6422 }
6541 if ( var_type == VAR_LightResistanceBonus ) 6423 if ( var_type == VAR_LightResistanceBonus )
6542 { 6424 {
6543 v19 = &this->sResLightBonus; 6425 this->sResLightBonus = min(this->sResLightBonus + val, 255);
6544 *v19 += val; 6426 this->PlaySound(SPEECH_91, 0);
6545 if ( *v19 > 255 )
6546 *v19 = 255;
6547 v31 = 0;
6548 this->PlaySound(SPEECH_91, v31);
6549 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6427 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6550 PlayAwardSound(uPlayerIdx); 6428 PlayAwardSound(uPlayerIdx);
6551 return; 6429 return;
6552 } 6430 }
6553 if ( var_type == VAR_DarkResistanceBonus ) 6431 if ( var_type == VAR_DarkResistanceBonus )
6554 { 6432 {
6555 v19 = &this->sResDarkBonus; 6433 this->sResDarkBonus = min(this->sResDarkBonus + val, 255);
6556 *v19 += val; 6434 this->PlaySound(SPEECH_91, 0);
6557 if ( *v19 > 255 )
6558 *v19 = 255;
6559 v31 = 0;
6560 this->PlaySound(SPEECH_91, v31);
6561 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6435 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6562 PlayAwardSound(uPlayerIdx); 6436 PlayAwardSound(uPlayerIdx);
6563 return; 6437 return;
6564 } 6438 }
6565 if ( var_type == VAR_MagicResistanceBonus ) 6439 if ( var_type == VAR_MagicResistanceBonus )
6566 { 6440 {
6567 v19 = &this->sResMagicBonus; 6441 this->sResMagicBonus = min(this->sResMagicBonus + val, 255);
6568 *v19 += val; 6442 this->PlaySound(SPEECH_91, 0);
6569 if ( *v19 > 255 )
6570 *v19 = 255;
6571 v31 = 0;
6572 this->PlaySound(SPEECH_91, v31);
6573 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6443 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6574 PlayAwardSound(uPlayerIdx); 6444 PlayAwardSound(uPlayerIdx);
6575 return; 6445 return;
6576 } 6446 }
6577 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) 6447 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill )
6640 PlayAwardSound(uPlayerIdx); 6510 PlayAwardSound(uPlayerIdx);
6641 return; 6511 return;
6642 } 6512 }
6643 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText ) 6513 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText )
6644 { 6514 {
6645 v34 = 1;
6646 this->PlaySound(SPEECH_96, 0); 6515 this->PlaySound(SPEECH_96, 0);
6647 //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val]; 6516 //v24 = pAutonoteTxt[val].eType;//dword_72371C[2 * val];
6648 bFlashAutonotesBook = 1; 6517 bFlashAutonotesBook = 1;
6649 _506568_autonote_type = pAutonoteTxt[val].eType; 6518 _506568_autonote_type = pAutonoteTxt[val].eType;
6519 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6650 } 6520 }
6651 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); 6521 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1);
6652 v3 = 1;
6653 if ( v34 != 1 )
6654 {
6655 if ( v3 != 1 )
6656 return;
6657 PlayAwardSound(uPlayerIdx);
6658 return;
6659 }
6660 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6661 if ( v3 != 1 )
6662 return;
6663 PlayAwardSound(uPlayerIdx); 6522 PlayAwardSound(uPlayerIdx);
6664 return; 6523 return;
6665 } 6524 }
6666 if ( var_type > VAR_GoldInBank ) 6525 if ( var_type > VAR_GoldInBank )
6667 { 6526 {
6668 if ( var_type == 307 ) 6527 if ( var_type == 307 )
6669 { 6528 {
6670 pParty->uNumDeaths += val; 6529 pParty->uNumDeaths += val;
6671 if ( v34 != 1 )
6672 {
6673 if ( v3 != 1 )
6674 return;
6675 PlayAwardSound(uPlayerIdx);
6676 return;
6677 }
6678 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6679 if ( v3 != 1 )
6680 return;
6681 PlayAwardSound(uPlayerIdx);
6682 return; 6530 return;
6683 } 6531 }
6684 switch ( var_type ) 6532 switch ( var_type )
6685 { 6533 {
6686 case 308: 6534 case 308: