comparison Player.cpp @ 1791:9f610f471283

Player::AddVariable adding helper functions
author Grumpy7
date Thu, 03 Oct 2013 08:53:25 +0200
parents 5ace90f129d3
children 3155be890554
comparison
equal deleted inserted replaced
1790:5ace90f129d3 1791:9f610f471283
6081 GameUI_DrawFoodAndGold(); 6081 GameUI_DrawFoodAndGold();
6082 PlayAwardSound(uPlayerIdx); 6082 PlayAwardSound(uPlayerIdx);
6083 return; 6083 return;
6084 case VAR_Sex: 6084 case VAR_Sex:
6085 this->uSex = (PLAYER_SEX)val; 6085 this->uSex = (PLAYER_SEX)val;
6086 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6086 PlayAwardSound_Anim97(uPlayerIdx);
6087 PlayAwardSound(uPlayerIdx);
6088 return; 6087 return;
6089 case VAR_Class: 6088 case VAR_Class:
6090 this->classType = (PLAYER_CLASS_TYPE)val; 6089 this->classType = (PLAYER_CLASS_TYPE)val;
6091 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6090 PlayAwardSound_Anim97(uPlayerIdx);
6092 PlayAwardSound(uPlayerIdx);
6093 return; 6091 return;
6094 case VAR_CurrentHP: 6092 case VAR_CurrentHP:
6095 this->sHealth = min(this->sHealth + val, this->GetMaxHealth() ); 6093 this->sHealth = min(this->sHealth + val, this->GetMaxHealth() );
6096 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6094 PlayAwardSound_Anim97(uPlayerIdx);
6097 PlayAwardSound(uPlayerIdx);
6098 return; 6095 return;
6099 case VAR_MaxHP: 6096 case VAR_MaxHP:
6100 this->_health_related = 0; 6097 this->_health_related = 0;
6101 this->uFullHealthBonus = 0; 6098 this->uFullHealthBonus = 0;
6102 this->sHealth = this->GetMaxHealth(); 6099 this->sHealth = this->GetMaxHealth();
6103 return; 6100 return;
6104 case VAR_CurrentSP: 6101 case VAR_CurrentSP:
6105 this->sMana = min(this->sMana + val, this->GetMaxMana() ); 6102 this->sMana = min(this->sMana + val, this->GetMaxMana() );
6106 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6103 PlayAwardSound_Anim97(uPlayerIdx);
6107 PlayAwardSound(uPlayerIdx);
6108 return; 6104 return;
6109 case VAR_MaxSP: 6105 case VAR_MaxSP:
6110 this->_mana_related = 0; 6106 this->_mana_related = 0;
6111 this->uFullManaBonus = 0; 6107 this->uFullManaBonus = 0;
6112 this->sMana = GetMaxMana(); 6108 this->sMana = GetMaxMana();
6113 return; 6109 return;
6114 case VAR_ACModifier: 6110 case VAR_ACModifier:
6115 this->sACModifier = min(this->sACModifier + val, 255); 6111 this->sACModifier = min(this->sACModifier + val, 255);
6116 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6112 PlayAwardSound_Anim97(uPlayerIdx);
6117 PlayAwardSound(uPlayerIdx);
6118 return; 6113 return;
6119 case VAR_BaseLevel: 6114 case VAR_BaseLevel:
6120 this->uLevel = min(this->uLevel + val, 255); 6115 this->uLevel = min(this->uLevel + val, 255);
6121 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6116 PlayAwardSound_Anim97(uPlayerIdx);
6122 PlayAwardSound(uPlayerIdx);
6123 return; 6117 return;
6124 case VAR_LevelModifier: 6118 case VAR_LevelModifier:
6125 this->sLevelModifier = min(this->sLevelModifier + val, 255); 6119 this->sLevelModifier = min(this->sLevelModifier + val, 255);
6126 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6120 PlayAwardSound_Anim97(uPlayerIdx);
6127 PlayAwardSound(uPlayerIdx);
6128 return; 6121 return;
6129 case VAR_Age: 6122 case VAR_Age:
6130 this->sAgeModifier += val; 6123 this->sAgeModifier += val;
6131 return; 6124 return;
6132 case VAR_Award: 6125 case VAR_Award:
6133 if (_449B57_test_bit(this->_achieved_awards_bits, val) && pAwards[val].pText ) 6126 if (_449B57_test_bit(this->_achieved_awards_bits, val) && pAwards[val].pText )
6134 { 6127 {
6135 this->PlaySound(SPEECH_96, 0); 6128 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_96);
6136 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6137 PlayAwardSound(uPlayerIdx);
6138 } 6129 }
6139 _449B7E_toggle_bit(this->_achieved_awards_bits, val, 1); 6130 _449B7E_toggle_bit(this->_achieved_awards_bits, val, 1);
6140 return; 6131 return;
6141 case VAR_Experience: 6132 case VAR_Experience:
6142 this->uExperience = min(this->uExperience + val, 4000000000i64); 6133 this->uExperience = min(this->uExperience + val, 4000000000i64);
6143 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6134 PlayAwardSound_Anim97(uPlayerIdx);
6144 PlayAwardSound(uPlayerIdx);
6145 return; 6135 return;
6146 case VAR_QBits_QuestsDone: 6136 case VAR_QBits_QuestsDone:
6147 if ( !_449B57_test_bit(pParty->_quest_bits, val) && pQuestTable[val] ) 6137 if ( !_449B57_test_bit(pParty->_quest_bits, val) && pQuestTable[val] )
6148 { 6138 {
6149 bFlashQuestBook = 1; 6139 bFlashQuestBook = 1;
6150 this->PlaySound(SPEECH_93, 0); 6140 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_93);
6151 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6152 PlayAwardSound(uPlayerIdx);
6153 } 6141 }
6154 _449B7E_toggle_bit(pParty->_quest_bits, val, 1); 6142 _449B7E_toggle_bit(pParty->_quest_bits, val, 1);
6155 return; 6143 return;
6156 case VAR_PlayerItemInHands: 6144 case VAR_PlayerItemInHands:
6157 item.Reset(); 6145 item.Reset();
6158 item.uAttributes = 1; 6146 item.uAttributes = 1;
6159 item.uItemID = val; 6147 item.uItemID = val;
6160 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER ) 6148 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER )
6161 pParty->pIsArtifactFound[val-500] = 1; 6149 pParty->pIsArtifactFound[val-500] = 1;
6162 if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) 6150 else if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION )
6163 { 6151 {
6164 item.uNumCharges = rand() % 6 + item.GetDamageMod() + 1; 6152 item.uNumCharges = rand() % 6 + item.GetDamageMod() + 1;
6165 item.uMaxCharges = LOBYTE(item.uNumCharges); 6153 item.uMaxCharges = LOBYTE(item.uNumCharges);
6166 } 6154 }
6167 pParty->SetHoldingItem(&item); 6155 pParty->SetHoldingItem(&item);
6169 case VAR_FixedGold: 6157 case VAR_FixedGold:
6170 party_finds_gold(val, 1); 6158 party_finds_gold(val, 1);
6171 return; 6159 return;
6172 case VAR_BaseMight: 6160 case VAR_BaseMight:
6173 this->uMight = min(this->uMight + val, 255); 6161 this->uMight = min(this->uMight + val, 255);
6174 this->PlaySound(SPEECH_92, 0); 6162 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6175 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6176 PlayAwardSound(uPlayerIdx);
6177 return; 6163 return;
6178 case VAR_BaseIntellect: 6164 case VAR_BaseIntellect:
6179 this->uIntelligence = min(this->uIntelligence + val, 255); 6165 this->uIntelligence = min(this->uIntelligence + val, 255);
6180 this->PlaySound(SPEECH_92, 0); 6166 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6181 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6182 PlayAwardSound(uPlayerIdx);
6183 return; 6167 return;
6184 case VAR_BasePersonality: 6168 case VAR_BasePersonality:
6185 this->uWillpower = min(this->uWillpower + val, 255); 6169 this->uWillpower = min(this->uWillpower + val, 255);
6186 this->PlaySound(SPEECH_92, 0); 6170 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6187 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6188 PlayAwardSound(uPlayerIdx);
6189 return; 6171 return;
6190 case VAR_BaseEndurance: 6172 case VAR_BaseEndurance:
6191 this->uEndurance = min(this->uEndurance + val, 255); 6173 this->uEndurance = min(this->uEndurance + val, 255);
6192 this->PlaySound(SPEECH_92, 0); 6174 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6193 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6194 PlayAwardSound(uPlayerIdx);
6195 return; 6175 return;
6196 case VAR_BaseSpeed: 6176 case VAR_BaseSpeed:
6197 this->uSpeed = min(this->uSpeed + val, 255); 6177 this->uSpeed = min(this->uSpeed + val, 255);
6198 this->PlaySound(SPEECH_92, 0); 6178 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6199 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6200 PlayAwardSound(uPlayerIdx);
6201 return; 6179 return;
6202 case VAR_BaseAccuracy: 6180 case VAR_BaseAccuracy:
6203 this->uAccuracy = min(this->uAccuracy + val, 255); 6181 this->uAccuracy = min(this->uAccuracy + val, 255);
6204 this->PlaySound(SPEECH_92, 0); 6182 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6205 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6206 PlayAwardSound(uPlayerIdx);
6207 return; 6183 return;
6208 case VAR_BaseLuck: 6184 case VAR_BaseLuck:
6209 this->uLuck = min(this->uLuck + val, 255); 6185 this->uLuck = min(this->uLuck + val, 255);
6210 this->PlaySound(SPEECH_92, 0); 6186 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6211 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6212 PlayAwardSound(uPlayerIdx);
6213 return; 6187 return;
6214 case VAR_FixedFood: 6188 case VAR_FixedFood:
6215 Party::GiveFood(val); 6189 Party::GiveFood(val);
6216 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); 6190 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val);
6217 ShowStatusBarString(pTmpBuf.data(), 2u); 6191 ShowStatusBarString(pTmpBuf.data(), 2u);
6238 } 6212 }
6239 return; 6213 return;
6240 } 6214 }
6241 LABEL_62: 6215 LABEL_62:
6242 this->uMightBonus = min(this->uMightBonus + val, 255); 6216 this->uMightBonus = min(this->uMightBonus + val, 255);
6243 this->PlaySound(SPEECH_91, 0); 6217 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6244 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6245 PlayAwardSound(uPlayerIdx);
6246 return; 6218 return;
6247 } 6219 }
6248 if ( var_type <= VAR_FireResistanceBonus ) 6220 if ( var_type <= VAR_FireResistanceBonus )
6249 { 6221 {
6250 if ( var_type != VAR_FireResistanceBonus ) 6222 if ( var_type != VAR_FireResistanceBonus )
6252 switch ( var_type ) 6224 switch ( var_type )
6253 { 6225 {
6254 case VAR_ActualIntellect: 6226 case VAR_ActualIntellect:
6255 LABEL_66: 6227 LABEL_66:
6256 this->uIntelligenceBonus = min(this->uIntelligenceBonus + val, 255); 6228 this->uIntelligenceBonus = min(this->uIntelligenceBonus + val, 255);
6257 this->PlaySound(SPEECH_91, 0); 6229 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6258 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6259 PlayAwardSound(uPlayerIdx);
6260 return; 6230 return;
6261 case VAR_ActualPersonality: 6231 case VAR_ActualPersonality:
6262 LABEL_67: 6232 LABEL_67:
6263 this->uWillpowerBonus = min(this->uWillpowerBonus + val, 255); 6233 this->uWillpowerBonus = min(this->uWillpowerBonus + val, 255);
6264 this->PlaySound(SPEECH_91, 0); 6234 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6265 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6266 PlayAwardSound(uPlayerIdx);
6267 return; 6235 return;
6268 case VAR_ActualEndurance: 6236 case VAR_ActualEndurance:
6269 LABEL_68: 6237 LABEL_68:
6270 this->uEnduranceBonus = min(this->uEnduranceBonus + val, 255); 6238 this->uEnduranceBonus = min(this->uEnduranceBonus + val, 255);
6271 this->PlaySound(SPEECH_91, 0); 6239 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6272 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6273 PlayAwardSound(uPlayerIdx);
6274 return; 6240 return;
6275 case VAR_ActualSpeed: 6241 case VAR_ActualSpeed:
6276 LABEL_69: 6242 LABEL_69:
6277 this->uSpeedBonus = min(this->uSpeedBonus + val, 255); 6243 this->uSpeedBonus = min(this->uSpeedBonus + val, 255);
6278 this->PlaySound(SPEECH_91, 0); 6244 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6279 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6280 PlayAwardSound(uPlayerIdx);
6281 return; 6245 return;
6282 case VAR_ActualAccuracy: 6246 case VAR_ActualAccuracy:
6283 LABEL_70: 6247 LABEL_70:
6284 this->uAccuracyBonus = min(this->uAccuracyBonus + val, 255); 6248 this->uAccuracyBonus = min(this->uAccuracyBonus + val, 255);
6285 this->PlaySound(SPEECH_91, 0); 6249 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6286 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6287 PlayAwardSound(uPlayerIdx);
6288 return; 6250 return;
6289 case VAR_ActualLuck: 6251 case VAR_ActualLuck:
6290 LABEL_71: 6252 LABEL_71:
6291 this->uLuckBonus = min(this->uLuckBonus + val, 255); 6253 this->uLuckBonus = min(this->uLuckBonus + val, 255);
6292 this->PlaySound(SPEECH_91, 0); 6254 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6293 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6294 PlayAwardSound(uPlayerIdx);
6295 return; 6255 return;
6296 case VAR_FireResistance: 6256 case VAR_FireResistance:
6297 this->sResFireBase = min(this->sResFireBase + val, 255); 6257 this->sResFireBase = min(this->sResFireBase + val, 255);
6298 this->PlaySound(SPEECH_92, 0); 6258 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6299 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6300 PlayAwardSound(uPlayerIdx);
6301 return; 6259 return;
6302 case VAR_AirResistance: 6260 case VAR_AirResistance:
6303 this->sResAirBase = min(this->sResAirBase + val, 255); 6261 this->sResAirBase = min(this->sResAirBase + val, 255);
6304 this->PlaySound(SPEECH_92, 0); 6262 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6305 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6306 PlayAwardSound(uPlayerIdx);
6307 return; 6263 return;
6308 case VAR_WaterResistance: 6264 case VAR_WaterResistance:
6309 this->sResWaterBase = min(this->sResWaterBase + val, 255); 6265 this->sResWaterBase = min(this->sResWaterBase + val, 255);
6310 this->PlaySound(SPEECH_92, 0); 6266 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6311 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6312 PlayAwardSound(uPlayerIdx);
6313 return; 6267 return;
6314 case VAR_EarthResistance: 6268 case VAR_EarthResistance:
6315 this->sResEarthBase = min(this->sResEarthBase + val, 255); 6269 this->sResEarthBase = min(this->sResEarthBase + val, 255);
6316 this->PlaySound(SPEECH_92, 0); 6270 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6317 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6318 PlayAwardSound(uPlayerIdx);
6319 return; 6271 return;
6320 case VAR_SpiritResistance: 6272 case VAR_SpiritResistance:
6321 this->sResSpiritBase = min(this->sResSpiritBase + val, 255); 6273 this->sResSpiritBase = min(this->sResSpiritBase + val, 255);
6322 this->PlaySound(SPEECH_92, 0); 6274 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6323 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6324 PlayAwardSound(uPlayerIdx);
6325 return; 6275 return;
6326 case VAR_MindResistance: 6276 case VAR_MindResistance:
6327 this->sResMindBase = min(this->sResMindBase + val, 255); 6277 this->sResMindBase = min(this->sResMindBase + val, 255);
6328 this->PlaySound(SPEECH_92, 0); 6278 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6329 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6330 PlayAwardSound(uPlayerIdx);
6331 return; 6279 return;
6332 case VAR_BodyResistance: 6280 case VAR_BodyResistance:
6333 this->sResBodyBase = min(this->sResBodyBase + val, 255); 6281 this->sResBodyBase = min(this->sResBodyBase + val, 255);
6334 this->PlaySound(SPEECH_92, 0); 6282 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6335 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6336 PlayAwardSound(uPlayerIdx);
6337 return; 6283 return;
6338 case VAR_LightResistance: 6284 case VAR_LightResistance:
6339 this->sResLightBase = min(this->sResLightBase + val, 255); 6285 this->sResLightBase = min(this->sResLightBase + val, 255);
6340 this->PlaySound(SPEECH_92, 0); 6286 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6341 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6342 PlayAwardSound(uPlayerIdx);
6343 return; 6287 return;
6344 case VAR_DarkResistance: 6288 case VAR_DarkResistance:
6345 this->sResDarkBase = min(this->sResDarkBase + val, 255); 6289 this->sResDarkBase = min(this->sResDarkBase + val, 255);
6346 this->PlaySound(SPEECH_92, 0); 6290 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6347 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6348 PlayAwardSound(uPlayerIdx);
6349 return; 6291 return;
6350 case VAR_MagicResistance: 6292 case VAR_MagicResistance:
6351 this->sResMagicBase = min(this->sResMagicBase + val, 255); 6293 this->sResMagicBase = min(this->sResMagicBase + val, 255);
6352 this->PlaySound(SPEECH_92, 0); 6294 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92);
6353 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6354 PlayAwardSound(uPlayerIdx);
6355 return; 6295 return;
6356 default: 6296 default:
6357 return; 6297 return;
6358 } 6298 }
6359 return; 6299 return;
6360 } 6300 }
6361 this->sResFireBonus = min(this->sResFireBonus + val, 255); 6301 this->sResFireBonus = min(this->sResFireBonus + val, 255);
6362 this->PlaySound(SPEECH_91, 0); 6302 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6363 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6364 PlayAwardSound(uPlayerIdx);
6365 return; 6303 return;
6366 } 6304 }
6367 if ( var_type <= VAR_DisarmTrapSkill ) 6305 if ( var_type <= VAR_DisarmTrapSkill )
6368 { 6306 {
6369 if ( var_type != VAR_DisarmTrapSkill ) 6307 if ( var_type != VAR_DisarmTrapSkill )
6372 { 6310 {
6373 switch ( var_type ) 6311 switch ( var_type )
6374 { 6312 {
6375 case VAR_BodyResistanceBonus: 6313 case VAR_BodyResistanceBonus:
6376 this->sResBodyBonus = min(this->sResBodyBonus + val, 255); 6314 this->sResBodyBonus = min(this->sResBodyBonus + val, 255);
6377 this->PlaySound(SPEECH_91, 0); 6315 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6378 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6379 PlayAwardSound(uPlayerIdx);
6380 return; 6316 return;
6381 case VAR_AirResistanceBonus: 6317 case VAR_AirResistanceBonus:
6382 this->sResAirBonus = min(this->sResAirBonus + val, 255); 6318 this->sResAirBonus = min(this->sResAirBonus + val, 255);
6383 this->PlaySound(SPEECH_91, 0); 6319 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6384 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6385 PlayAwardSound(uPlayerIdx);
6386 return; 6320 return;
6387 case VAR_WaterResistanceBonus: 6321 case VAR_WaterResistanceBonus:
6388 this->sResWaterBonus = min(this->sResWaterBonus + val, 255); 6322 this->sResWaterBonus = min(this->sResWaterBonus + val, 255);
6389 this->PlaySound(SPEECH_91, 0); 6323 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6390 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6391 PlayAwardSound(uPlayerIdx);
6392 return; 6324 return;
6393 case VAR_EarthResistanceBonus: 6325 case VAR_EarthResistanceBonus:
6394 this->sResEarthBonus = min(this->sResEarthBonus + val, 255); 6326 this->sResEarthBonus = min(this->sResEarthBonus + val, 255);
6395 this->PlaySound(SPEECH_91, 0); 6327 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6396 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6397 PlayAwardSound(uPlayerIdx);
6398 return; 6328 return;
6399 case VAR_SpiritResistanceBonus: 6329 case VAR_SpiritResistanceBonus:
6400 this->sResSpiritBonus = min(this->sResSpiritBonus + val, 255); 6330 this->sResSpiritBonus = min(this->sResSpiritBonus + val, 255);
6401 this->PlaySound(SPEECH_91, 0); 6331 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6402 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6403 PlayAwardSound(uPlayerIdx);
6404 return; 6332 return;
6405 case VAR_MindResistanceBonus: 6333 case VAR_MindResistanceBonus:
6406 this->sResMindBonus = min(this->sResMindBonus + val, 255); 6334 this->sResMindBonus = min(this->sResMindBonus + val, 255);
6407 this->PlaySound(SPEECH_91, 0); 6335 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6408 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6409 PlayAwardSound(uPlayerIdx);
6410 return; 6336 return;
6411 break; 6337 break;
6412 default: 6338 default:
6413 return; 6339 return;
6414 } 6340 }
6415 *v19 += val;
6416 if ( *v19 > 255 )
6417 *v19 = 255;
6418 this->PlaySound(SPEECH_91, 0);
6419 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6420 PlayAwardSound(uPlayerIdx);
6421 return;
6422 } 6341 }
6423 if ( var_type == VAR_LightResistanceBonus ) 6342 if ( var_type == VAR_LightResistanceBonus )
6424 { 6343 {
6425 this->sResLightBonus = min(this->sResLightBonus + val, 255); 6344 this->sResLightBonus = min(this->sResLightBonus + val, 255);
6426 this->PlaySound(SPEECH_91, 0); 6345 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6427 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6428 PlayAwardSound(uPlayerIdx);
6429 return; 6346 return;
6430 } 6347 }
6431 if ( var_type == VAR_DarkResistanceBonus ) 6348 if ( var_type == VAR_DarkResistanceBonus )
6432 { 6349 {
6433 this->sResDarkBonus = min(this->sResDarkBonus + val, 255); 6350 this->sResDarkBonus = min(this->sResDarkBonus + val, 255);
6434 this->PlaySound(SPEECH_91, 0); 6351 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6435 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6436 PlayAwardSound(uPlayerIdx);
6437 return; 6352 return;
6438 } 6353 }
6439 if ( var_type == VAR_MagicResistanceBonus ) 6354 if ( var_type == VAR_MagicResistanceBonus )
6440 { 6355 {
6441 this->sResMagicBonus = min(this->sResMagicBonus + val, 255); 6356 this->sResMagicBonus = min(this->sResMagicBonus + val, 255);
6442 this->PlaySound(SPEECH_91, 0); 6357 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91);
6443 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx);
6444 PlayAwardSound(uPlayerIdx);
6445 return; 6358 return;
6446 } 6359 }
6447 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) 6360 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill )
6448 return; 6361 return;
6449 } 6362 }
6459 if ( v22 > 60 ) 6372 if ( v22 > 60 )
6460 LOWORD(v22) = 60; 6373 LOWORD(v22) = 60;
6461 LOBYTE(v21) = v21 & 0xC0; 6374 LOBYTE(v21) = v21 & 0xC0;
6462 *(short *)v20 = v22 | v21; 6375 *(short *)v20 = v22 | v21;
6463 } 6376 }
6464 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6377 PlayAwardSound_Anim97(uPlayerIdx);
6465 PlayAwardSound(uPlayerIdx);
6466 return; 6378 return;
6467 } 6379 }
6468 if ( var_type == VAR_LearningSkill ) 6380 if ( var_type == VAR_LearningSkill )
6469 { 6381 {
6470 if ( val <= 63 ) 6382 if ( val <= 63 )
6479 if ( v22 > 60 ) 6391 if ( v22 > 60 )
6480 LOWORD(v22) = 60; 6392 LOWORD(v22) = 60;
6481 LOBYTE(v21) = v21 & 0xC0; 6393 LOBYTE(v21) = v21 & 0xC0;
6482 *(short *)v20 = v22 | v21; 6394 *(short *)v20 = v22 | v21;
6483 } 6395 }
6484 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6396 PlayAwardSound_Anim97(uPlayerIdx);
6485 PlayAwardSound(uPlayerIdx);
6486 return; 6397 return;
6487 } 6398 }
6488 if ( var_type <= VAR_LearningSkill ) 6399 if ( var_type <= VAR_LearningSkill )
6489 return; 6400 return;
6490 if ( var_type <= VAR_Eradicated ) 6401 if ( var_type <= VAR_Eradicated )
6504 } 6415 }
6505 return; 6416 return;
6506 } 6417 }
6507 memset(this, 0, 0xA0u); 6418 memset(this, 0, 0xA0u);
6508 } 6419 }
6509 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); 6420 PlayAwardSound_Anim97(uPlayerIdx);
6510 PlayAwardSound(uPlayerIdx);
6511 return; 6421 return;
6512 } 6422 }
6513 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText ) 6423 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText )
6514 { 6424 {
6515 this->PlaySound(SPEECH_96, 0); 6425 this->PlaySound(SPEECH_96, 0);
6612 if ( v27->uReputation > 10000 ) 6522 if ( v27->uReputation > 10000 )
6613 v27->uReputation = 10000; 6523 v27->uReputation = 10000;
6614 } 6524 }
6615 } 6525 }
6616 6526
6527 //----- (new function) --------------------------------------------------------
6528 void Player::PlayAwardSound_Anim97(int currPlayerId)
6529 {
6530 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, currPlayerId);
6531 PlayAwardSound(currPlayerId);
6532 }
6533
6534 //----- (new function) --------------------------------------------------------
6535 void Player::PlayAwardSound_Anim97_Face(int currPlayerId, PlayerSpeech speech)
6536 {
6537 this->PlaySound(speech, 0);
6538 PlayAwardSound_Anim97(currPlayerId);
6539 }
6540
6541 //----- (new function) --------------------------------------------------------
6542 void Player::AddSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 addSkillValue, int currPlayerId )
6543 {
6544 if ( addSkillValue > 63 )
6545 {
6546 this->*skillToSet = (unsigned __int8)addSkillValue | this->*skillToSet & 63;
6547 }
6548 else
6549 {
6550 this->*skillToSet = min(this->*skillToSet + addSkillValue, 60) | this->*skillToSet & 0xC0;
6551 }
6552 PlayAwardSound_Anim97(currPlayerId);
6553 return;
6554 }
6617 6555
6618 //----- (0044B9C4) -------------------------------------------------------- 6556 //----- (0044B9C4) --------------------------------------------------------
6619 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) 6557 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue)
6620 { 6558 {
6621 unsigned int v3; // ebx@1 6559 unsigned int v3; // ebx@1