Mercurial > mm7
comparison Player.cpp @ 1822:5f9eeb7bf8e6
Finishing Player.cpp, fixing some bugs
author | Grumpy7 |
---|---|
date | Wed, 09 Oct 2013 08:06:26 +0200 |
parents | 49a4db499c0a |
children | 23deb6b09c8c |
comparison
equal
deleted
inserted
replaced
1821:49a4db499c0a | 1822:5f9eeb7bf8e6 |
---|---|
1326 uNumDivineInterventionCastsThisDay = 0; | 1326 uNumDivineInterventionCastsThisDay = 0; |
1327 uNumArmageddonCasts = 0; | 1327 uNumArmageddonCasts = 0; |
1328 uNumFireSpikeCasts = 0; | 1328 uNumFireSpikeCasts = 0; |
1329 | 1329 |
1330 memset(field_1988, 0, 49 * sizeof(int)); | 1330 memset(field_1988, 0, 49 * sizeof(int)); |
1331 memset(field_1A50, 0, 64 * sizeof(char)); | 1331 memset(playerEventBits, 0, 64 * sizeof(char)); |
1332 | 1332 |
1333 field_E0 = 0; | 1333 field_E0 = 0; |
1334 field_E4 = 0; | 1334 field_E4 = 0; |
1335 field_E8 = 0; | 1335 field_E8 = 0; |
1336 field_EC = 0; | 1336 field_EC = 0; |
1665 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) && ( enchType == 39 || itemId == ITEM_ARTIFACT_GIBBET)) | 1665 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) && ( enchType == 39 || itemId == ITEM_ARTIFACT_GIBBET)) |
1666 { | 1666 { |
1667 totalDmg *= 2; | 1667 totalDmg *= 2; |
1668 } | 1668 } |
1669 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_DRAGON) && ( enchType == 40 || itemId == ITEM_ARTIFACT_GIBBET)) | 1669 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_DRAGON) && ( enchType == 40 || itemId == ITEM_ARTIFACT_GIBBET)) |
1670 { | |
1671 totalDmg *= 2; | |
1672 } | |
1673 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_ELF) && ( enchType == 63 || itemId == ITEM_RELIC_OLD_NICK)) | |
1670 { | 1674 { |
1671 totalDmg *= 2; | 1675 totalDmg *= 2; |
1672 } | 1676 } |
1673 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_TITAN) && ( enchType == 65 )) | 1677 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_TITAN) && ( enchType == 65 )) |
1674 { | 1678 { |
4446 break; | 4450 break; |
4447 case 228: //Haste | 4451 case 228: //Haste |
4448 if ( !playerAffected->pConditions[Condition_Weak] ) | 4452 if ( !playerAffected->pConditions[Condition_Weak] ) |
4449 { | 4453 { |
4450 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4454 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4451 playerAffected->pPlayerBuffs[7].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | 4455 playerAffected->pPlayerBuffs[PLAYER_BUFF_HASTE].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); |
4452 playerAffected->PlaySound(SPEECH_36, 0); | 4456 playerAffected->PlaySound(SPEECH_36, 0); |
4453 } | 4457 } |
4454 break; | 4458 break; |
4455 case 229: //Heroism | 4459 case 229: //Heroism |
4456 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4460 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4457 playerAffected->pPlayerBuffs[8].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | 4461 playerAffected->pPlayerBuffs[PLAYER_BUFF_HEROISM].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); |
4458 playerAffected->PlaySound(SPEECH_36, 0); | 4462 playerAffected->PlaySound(SPEECH_36, 0); |
4459 break; | 4463 break; |
4460 case 230: //Bless | 4464 case 230: //Bless |
4461 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4465 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4462 playerAffected->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | 4466 playerAffected->pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); |
4463 playerAffected->PlaySound(SPEECH_36, 0); | 4467 playerAffected->PlaySound(SPEECH_36, 0); |
4464 break; | 4468 break; |
4465 case 231: //Preservation | 4469 case 231: //Preservation |
4466 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4470 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4467 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4471 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4468 playerAffected->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4472 playerAffected->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4469 playerAffected->PlaySound(SPEECH_36, 0); | 4473 playerAffected->PlaySound(SPEECH_36, 0); |
4470 break; | 4474 break; |
4471 case 232: //Shield | 4475 case 232: //Shield |
4472 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4476 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4473 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4477 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4474 playerAffected->pPlayerBuffs[13].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4478 playerAffected->pPlayerBuffs[PLAYER_BUFF_SHIELD].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4475 playerAffected->PlaySound(SPEECH_36, 0); | 4479 playerAffected->PlaySound(SPEECH_36, 0); |
4476 break; | 4480 break; |
4477 case 234: //Stoneskin | 4481 case 234: //Stoneskin |
4478 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4482 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4479 playerAffected->pPlayerBuffs[14].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); | 4483 playerAffected->pPlayerBuffs[PLAYER_BUFF_STONESKIN].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0); |
4480 playerAffected->PlaySound(SPEECH_36, 0); | 4484 playerAffected->PlaySound(SPEECH_36, 0); |
4481 break; | 4485 break; |
4482 case 235: //Water Breathing | 4486 case 235: //Water Breathing |
4483 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), | 4487 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335), |
4484 playerAffected->pPlayerBuffs[23].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); | 4488 playerAffected->pPlayerBuffs[PLAYER_BUFF_WATER_WALK].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0); |
4485 break; | 4489 break; |
4486 case 237: //Remove Fear | 4490 case 237: //Remove Fear |
4487 playerAffected->pConditions[Condition_Fear] = 0i64; | 4491 playerAffected->pConditions[Condition_Fear] = 0i64; |
4488 playerAffected->PlaySound(SPEECH_36, 0); | 4492 playerAffected->PlaySound(SPEECH_36, 0); |
4489 break; | 4493 break; |
4496 playerAffected->PlaySound(SPEECH_36, 0); | 4500 playerAffected->PlaySound(SPEECH_36, 0); |
4497 break; | 4501 break; |
4498 case 240: //Might Boost | 4502 case 240: //Might Boost |
4499 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4503 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4500 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4504 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4501 playerAffected->pPlayerBuffs[19].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4505 playerAffected->pPlayerBuffs[PLAYER_BUFF_STRENGTH].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4502 playerAffected->PlaySound(SPEECH_36, 0); | 4506 playerAffected->PlaySound(SPEECH_36, 0); |
4503 break; | 4507 break; |
4504 case 241: //Intellect Boost | 4508 case 241: //Intellect Boost |
4505 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4509 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4506 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4510 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4507 playerAffected->pPlayerBuffs[17].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4511 playerAffected->pPlayerBuffs[PLAYER_BUFF_INTELLIGENCE].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4508 playerAffected->PlaySound(SPEECH_36, 0); | 4512 playerAffected->PlaySound(SPEECH_36, 0); |
4509 break; | 4513 break; |
4510 case 242: //Personality Boost | 4514 case 242: //Personality Boost |
4511 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4515 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4512 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4516 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4513 playerAffected->pPlayerBuffs[20].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4517 playerAffected->pPlayerBuffs[PLAYER_BUFF_WILLPOWER].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4514 playerAffected->PlaySound(SPEECH_36, 0); | 4518 playerAffected->PlaySound(SPEECH_36, 0); |
4515 break; | 4519 break; |
4516 case 243://Endurance Boost | 4520 case 243://Endurance Boost |
4517 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4521 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4518 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4522 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4519 playerAffected->pPlayerBuffs[16].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4523 playerAffected->pPlayerBuffs[PLAYER_BUFF_ENDURANCE].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4520 playerAffected->PlaySound(SPEECH_36, 0); | 4524 playerAffected->PlaySound(SPEECH_36, 0); |
4521 break; | 4525 break; |
4522 case 244: //Speed Boost | 4526 case 244: //Speed Boost |
4523 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4527 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4524 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4528 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4525 playerAffected->pPlayerBuffs[21].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4529 playerAffected->pPlayerBuffs[PLAYER_BUFF_SPEED].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4526 playerAffected->PlaySound(SPEECH_36, 0); | 4530 playerAffected->PlaySound(SPEECH_36, 0); |
4527 break; | 4531 break; |
4528 case 245: //Accuracy Boost | 4532 case 245: //Accuracy Boost |
4529 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4533 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4530 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4534 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4531 playerAffected->pPlayerBuffs[15].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4535 playerAffected->pPlayerBuffs[PLAYER_BUFF_ACCURACY].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4532 playerAffected->PlaySound(SPEECH_36, 0); | 4536 playerAffected->PlaySound(SPEECH_36, 0); |
4533 break; | 4537 break; |
4534 case 251: //Cure Paralysis | 4538 case 251: //Cure Paralysis |
4535 playerAffected->pConditions[Condition_Paralyzed] = 0i64; | 4539 playerAffected->pConditions[Condition_Paralyzed] = 0i64; |
4536 playerAffected->PlaySound(SPEECH_36, 0); | 4540 playerAffected->PlaySound(SPEECH_36, 0); |
4559 playerAffected->PlaySound(SPEECH_36, 0); | 4563 playerAffected->PlaySound(SPEECH_36, 0); |
4560 break; | 4564 break; |
4561 case 255: //Luck Boost | 4565 case 255: //Luck Boost |
4562 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4566 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4563 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4567 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4564 playerAffected->pPlayerBuffs[18].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4568 playerAffected->pPlayerBuffs[PLAYER_BUFF_LUCK].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4565 playerAffected->PlaySound(SPEECH_36, 0); | 4569 playerAffected->PlaySound(SPEECH_36, 0); |
4566 break; | 4570 break; |
4567 case 256: //Fire Resistance | 4571 case 256: //Fire Resistance |
4568 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4572 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4569 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4573 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4570 playerAffected->pPlayerBuffs[5].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4574 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4571 playerAffected->PlaySound(SPEECH_36, 0); | 4575 playerAffected->PlaySound(SPEECH_36, 0); |
4572 break; | 4576 break; |
4573 case 257: //Air Resistance | 4577 case 257: //Air Resistance |
4574 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4578 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4575 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4579 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4576 playerAffected->pPlayerBuffs[0].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4580 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4577 playerAffected->PlaySound(SPEECH_36, 0); | 4581 playerAffected->PlaySound(SPEECH_36, 0); |
4578 break; | 4582 break; |
4579 case 258: //Water Resistance | 4583 case 258: //Water Resistance |
4580 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4584 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4581 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4585 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4582 playerAffected->pPlayerBuffs[22].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4586 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4583 playerAffected->PlaySound(SPEECH_36, 0); | 4587 playerAffected->PlaySound(SPEECH_36, 0); |
4584 break; | 4588 break; |
4585 case 259: //Earth Resistance | 4589 case 259: //Earth Resistance |
4586 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4590 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4587 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4591 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4588 playerAffected->pPlayerBuffs[3].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4592 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4589 playerAffected->PlaySound(SPEECH_36, 0); | 4593 playerAffected->PlaySound(SPEECH_36, 0); |
4590 break; | 4594 break; |
4591 case 260: //Mind Resistance | 4595 case 260: //Mind Resistance |
4592 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4596 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4593 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4597 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4594 playerAffected->pPlayerBuffs[9].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4598 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4595 playerAffected->PlaySound(SPEECH_36, 0); | 4599 playerAffected->PlaySound(SPEECH_36, 0); |
4596 break; | 4600 break; |
4597 case 261: //Body Resistance | 4601 case 261: //Body Resistance |
4598 v50 = 3 * pParty->pPickedItem.uEnchantmentType; | 4602 v50 = 3 * pParty->pPickedItem.uEnchantmentType; |
4599 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); | 4603 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335); |
4600 playerAffected->pPlayerBuffs[2].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); | 4604 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0); |
4601 playerAffected->PlaySound(SPEECH_36, 0); | 4605 playerAffected->PlaySound(SPEECH_36, 0); |
4602 break; | 4606 break; |
4603 case 262: //Stone to Flesh | 4607 case 262: //Stone to Flesh |
4604 playerAffected->pConditions[Condition_Pertified] = 0i64; | 4608 playerAffected->pConditions[Condition_Pertified] = 0i64; |
4605 playerAffected->PlaySound(SPEECH_36, 0); | 4609 playerAffected->PlaySound(SPEECH_36, 0); |
4993 { | 4997 { |
4994 int v4; | 4998 int v4; |
4995 if ( valToCompare <= 63 ) | 4999 if ( valToCompare <= 63 ) |
4996 v4 = skillValue & 0x3F; | 5000 v4 = skillValue & 0x3F; |
4997 else | 5001 else |
4998 v4 = valToCompare & skillValue; | 5002 v4 = skillValue & skillValue; |
4999 return v4 >= valToCompare; | 5003 return v4 >= valToCompare; |
5000 } | 5004 } |
5001 | 5005 |
5002 //----- (00449BB4) -------------------------------------------------------- | 5006 //----- (00449BB4) -------------------------------------------------------- |
5003 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive and v4 was -1 by default | 5007 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive and v4 was -1 by default |
5308 actStat = GetActualLuck(); | 5312 actStat = GetActualLuck(); |
5309 baseStat = GetBaseLuck(); | 5313 baseStat = GetBaseLuck(); |
5310 return (actStat >= baseStat); | 5314 return (actStat >= baseStat); |
5311 case VAR_PlayerBits: | 5315 case VAR_PlayerBits: |
5312 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; | 5316 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; |
5313 byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8]; | 5317 byteWithRequestedBit = this->playerEventBits[((signed __int16)pValue - 1)/8]; |
5314 return ( test_bit_value & byteWithRequestedBit ) != 0; | 5318 return ( test_bit_value & byteWithRequestedBit ) != 0; |
5315 case VAR_NPCs2: | 5319 case VAR_NPCs2: |
5316 return pNPCStats->pNewNPCData[pValue].Hired(); | 5320 return pNPCStats->pNewNPCData[pValue].Hired(); |
5317 case VAR_IsFlying: | 5321 case VAR_IsFlying: |
5318 if ( pParty->bFlying | 5322 if ( pParty->bFlying |
5405 | 5409 |
5406 | 5410 |
5407 //----- (0044A5CB) -------------------------------------------------------- | 5411 //----- (0044A5CB) -------------------------------------------------------- |
5408 void Player::SetVariable(enum VariableType var_type, signed int var_value) | 5412 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
5409 { | 5413 { |
5410 signed int currPlayerId; // ebx@1 | |
5411 unsigned int v6; // esi@13 | 5414 unsigned int v6; // esi@13 |
5412 unsigned int v7; // esi@14 | 5415 unsigned int v7; // esi@14 |
5413 signed int v11; // eax@30 | 5416 signed int v11; // eax@30 |
5414 DDM_DLV_Header *v24; // ecx@148 | 5417 DDM_DLV_Header *v24; // ecx@148 |
5415 ItemGen item; // [sp+Ch] [bp-28h]@52 | 5418 ItemGen item; // [sp+Ch] [bp-28h]@52 |
5416 | 5419 |
5417 currPlayerId = 0; | |
5418 if ( this == pPlayers[2] ) | |
5419 currPlayerId = 1; | |
5420 else if ( this == pPlayers[3] ) | |
5421 currPlayerId = 2; | |
5422 else if ( this == pPlayers[4] ) | |
5423 currPlayerId = 3; | |
5424 | |
5425 | 5420 |
5426 if ( var_type >= VAR_History_0 && var_type <= VAR_History_28) | 5421 if ( var_type >= VAR_History_0 && var_type <= VAR_History_28) |
5427 { | 5422 { |
5428 if (!pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0]) | 5423 if (!pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0]) |
5429 { | 5424 { |
5430 pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed; | 5425 pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed; |
5431 if (pStorylineText->StoreLine[var_type - VAR_History_0].pText) | 5426 if (pStorylineText->StoreLine[var_type - VAR_History_0].pText) |
5432 { | 5427 { |
5433 bFlashHistoryBook = 1; | 5428 bFlashHistoryBook = 1; |
5434 PlayAwardSound(currPlayerId); | 5429 PlayAwardSound(); |
5435 } | 5430 } |
5436 } | 5431 } |
5437 return; | 5432 return; |
5438 } | 5433 } |
5439 | 5434 |
5440 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_99 ) | 5435 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_99 ) |
5441 { | 5436 { |
5442 byte_5E4C15[var_type] = var_value; | 5437 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_74 ) |
5438 stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0] = (char)var_value; // originally (unsigned __int8)byte_5E4C15[VarNum]; | |
5439 if ( var_type >= VAR_MapPersistentVariable_75 && var_type <= VAR_MapPersistentVariable_99 ) | |
5440 stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75] = (unsigned char)var_value; //not really sure whether the number gets up to 99, but can't ignore the possibility | |
5443 return; | 5441 return; |
5444 } | 5442 } |
5445 | 5443 |
5446 if ( var_type >= VAR_UnknownTimeEvent0 && var_type <= VAR_UnknownTimeEvent19 ) | 5444 if ( var_type >= VAR_UnknownTimeEvent0 && var_type <= VAR_UnknownTimeEvent19 ) |
5447 { | 5445 { |
5448 pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed; //*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);, *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed | 5446 pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed; //*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);, *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed |
5449 PlayAwardSound(currPlayerId); | 5447 PlayAwardSound(); |
5450 return; | 5448 return; |
5451 } | 5449 } |
5452 | 5450 |
5453 switch ( var_type ) | 5451 switch ( var_type ) |
5454 { | 5452 { |
5455 case VAR_Sex: | 5453 case VAR_Sex: |
5456 this->uSex = (PLAYER_SEX)var_value; | 5454 this->uSex = (PLAYER_SEX)var_value; |
5457 PlayAwardSound_Anim(currPlayerId); | 5455 PlayAwardSound_Anim(); |
5458 return; | 5456 return; |
5459 case VAR_Class: | 5457 case VAR_Class: |
5460 this->classType = (PLAYER_CLASS_TYPE)var_value; | 5458 this->classType = (PLAYER_CLASS_TYPE)var_value; |
5461 if ( (PLAYER_CLASS_TYPE)var_value == PLAYER_CLASS_LICH ) | 5459 if ( (PLAYER_CLASS_TYPE)var_value == PLAYER_CLASS_LICH ) |
5462 { | 5460 { |
5463 for (int i = 0; i < 138; i++) | 5461 for (int i = 0; i < 138; i++) |
5464 { | 5462 { |
5465 if (this->pOwnItems[i].uItemID == ITEM_LICH_JAR_EMPTY) | 5463 if (this->pOwnItems[i].uItemID == ITEM_LICH_JAR_EMPTY) |
5466 { | 5464 { |
5467 this->pOwnItems[i].uItemID = ITEM_LICH_JAR_FULL; | 5465 this->pOwnItems[i].uItemID = ITEM_LICH_JAR_FULL; |
5468 this->pOwnItems[i].uHolderPlayer = currPlayerId + 1; | 5466 this->pOwnItems[i].uHolderPlayer = GetPlayerIndex() + 1; |
5469 } | 5467 } |
5470 } | 5468 } |
5471 if ( this->sResFireBase < 20 ) | 5469 if ( this->sResFireBase < 20 ) |
5472 this->sResFireBase = 20; | 5470 this->sResFireBase = 20; |
5473 if ( this->sResAirBase < 20 ) | 5471 if ( this->sResAirBase < 20 ) |
5489 else | 5487 else |
5490 { | 5488 { |
5491 this->uCurrentFace = 20; | 5489 this->uCurrentFace = 20; |
5492 this->uVoiceID = 20; | 5490 this->uVoiceID = 20; |
5493 } | 5491 } |
5494 ReloadPlayerPortraits(currPlayerId, this->uCurrentFace); | 5492 ReloadPlayerPortraits(GetPlayerIndex(), this->uCurrentFace); |
5495 } | 5493 } |
5496 PlayAwardSound_Anim(currPlayerId); | 5494 PlayAwardSound_Anim(); |
5497 return; | 5495 return; |
5498 case VAR_CurrentHP: | 5496 case VAR_CurrentHP: |
5499 this->sHealth = var_value; | 5497 this->sHealth = var_value; |
5500 PlayAwardSound_Anim(currPlayerId); | 5498 PlayAwardSound_Anim(); |
5501 return; | 5499 return; |
5502 case VAR_MaxHP: | 5500 case VAR_MaxHP: |
5503 this->sHealth = GetMaxHealth(); | 5501 this->sHealth = GetMaxHealth(); |
5504 return; | 5502 return; |
5505 case VAR_CurrentSP: | 5503 case VAR_CurrentSP: |
5506 this->sMana = var_value; | 5504 this->sMana = var_value; |
5507 PlayAwardSound_Anim(currPlayerId); | 5505 PlayAwardSound_Anim(); |
5508 return; | 5506 return; |
5509 case VAR_MaxSP: | 5507 case VAR_MaxSP: |
5510 this->sMana = GetMaxMana(); | 5508 this->sMana = GetMaxMana(); |
5511 return; | 5509 return; |
5512 case VAR_ACModifier: | 5510 case VAR_ACModifier: |
5513 this->sACModifier = (unsigned __int8)var_value; | 5511 this->sACModifier = (unsigned __int8)var_value; |
5514 PlayAwardSound_Anim(currPlayerId); | 5512 PlayAwardSound_Anim(); |
5515 return; | 5513 return; |
5516 case VAR_BaseLevel: | 5514 case VAR_BaseLevel: |
5517 this->uLevel = (unsigned __int8)var_value; | 5515 this->uLevel = (unsigned __int8)var_value; |
5518 PlayAwardSound_Anim(currPlayerId); | 5516 PlayAwardSound_Anim(); |
5519 return; | 5517 return; |
5520 case VAR_LevelModifier: | 5518 case VAR_LevelModifier: |
5521 this->sLevelModifier = (unsigned __int8)var_value; | 5519 this->sLevelModifier = (unsigned __int8)var_value; |
5522 PlayAwardSound_Anim(currPlayerId); | 5520 PlayAwardSound_Anim(); |
5523 return; | 5521 return; |
5524 case VAR_Age: | 5522 case VAR_Age: |
5525 this->sAgeModifier = var_value; | 5523 this->sAgeModifier = var_value; |
5526 return; | 5524 return; |
5527 case VAR_Award: | 5525 case VAR_Award: |
5528 if ( !_449B57_test_bit(this->_achieved_awards_bits, var_value) && pAwards[var_value].pText ) | 5526 if ( !_449B57_test_bit(this->_achieved_awards_bits, var_value) && pAwards[var_value].pText ) |
5529 { | 5527 { |
5530 PlayAwardSound_Anim(currPlayerId); | 5528 PlayAwardSound_Anim(); |
5531 this->PlaySound(SPEECH_96, 0); | 5529 this->PlaySound(SPEECH_96, 0); |
5532 } | 5530 } |
5533 _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u); | 5531 _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u); |
5534 return; | 5532 return; |
5535 case VAR_Experience: | 5533 case VAR_Experience: |
5536 this->uExperience = var_value; | 5534 this->uExperience = var_value; |
5537 PlayAwardSound_Anim(currPlayerId); | 5535 PlayAwardSound_Anim(); |
5538 return; | 5536 return; |
5539 case VAR_QBits_QuestsDone: | 5537 case VAR_QBits_QuestsDone: |
5540 if ( !_449B57_test_bit(pParty->_quest_bits, var_value) && pQuestTable[var_value-1] ) | 5538 if ( !_449B57_test_bit(pParty->_quest_bits, var_value) && pQuestTable[var_value-1] ) |
5541 { | 5539 { |
5542 bFlashQuestBook = 1; | 5540 bFlashQuestBook = 1; |
5543 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | 5541 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, GetPlayerIndex()); |
5544 PlayAwardSound(currPlayerId); | 5542 PlayAwardSound(); |
5545 this->PlaySound(SPEECH_93, 0); | 5543 this->PlaySound(SPEECH_93, 0); |
5546 } | 5544 } |
5547 _449B7E_toggle_bit(pParty->_quest_bits, var_value, 1u); | 5545 _449B7E_toggle_bit(pParty->_quest_bits, var_value, 1u); |
5548 return; | 5546 return; |
5549 case VAR_PlayerItemInHands: | 5547 case VAR_PlayerItemInHands: |
5564 ShowStatusBarString(pTmpBuf.data(), 2u); | 5562 ShowStatusBarString(pTmpBuf.data(), 2u); |
5565 GameUI_DrawFoodAndGold(); | 5563 GameUI_DrawFoodAndGold(); |
5566 return; | 5564 return; |
5567 case VAR_FixedFood: | 5565 case VAR_FixedFood: |
5568 Party::SetFood(var_value); | 5566 Party::SetFood(var_value); |
5569 PlayAwardSound_Anim(currPlayerId); | 5567 PlayAwardSound_Anim(); |
5570 return; | 5568 return; |
5571 case VAR_RandomFood: | 5569 case VAR_RandomFood: |
5572 v7 = rand() % var_value + 1; | 5570 v7 = rand() % var_value + 1; |
5573 Party::SetFood(v7); | 5571 Party::SetFood(v7); |
5574 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | 5572 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food |
5575 ShowStatusBarString(pTmpBuf.data(), 2u); | 5573 ShowStatusBarString(pTmpBuf.data(), 2u); |
5576 GameUI_DrawFoodAndGold(); | 5574 GameUI_DrawFoodAndGold(); |
5577 PlayAwardSound_Anim(currPlayerId); | 5575 PlayAwardSound_Anim(); |
5578 return; | 5576 return; |
5579 case VAR_BaseMight: | 5577 case VAR_BaseMight: |
5580 this->uMight = (unsigned __int8)var_value; | 5578 this->uMight = (unsigned __int8)var_value; |
5581 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5579 PlayAwardSound_Anim_Face(SPEECH_92); |
5582 return; | 5580 return; |
5583 case VAR_BaseIntellect: | 5581 case VAR_BaseIntellect: |
5584 this->uIntelligence = (unsigned __int8)var_value; | 5582 this->uIntelligence = (unsigned __int8)var_value; |
5585 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5583 PlayAwardSound_Anim_Face(SPEECH_92); |
5586 return; | 5584 return; |
5587 case VAR_BasePersonality: | 5585 case VAR_BasePersonality: |
5588 this->uWillpower = (unsigned __int8)var_value; | 5586 this->uWillpower = (unsigned __int8)var_value; |
5589 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5587 PlayAwardSound_Anim_Face(SPEECH_92); |
5590 return; | 5588 return; |
5591 case VAR_BaseEndurance: | 5589 case VAR_BaseEndurance: |
5592 this->uEndurance = (unsigned __int8)var_value; | 5590 this->uEndurance = (unsigned __int8)var_value; |
5593 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5591 PlayAwardSound_Anim_Face(SPEECH_92); |
5594 return; | 5592 return; |
5595 case VAR_BaseSpeed: | 5593 case VAR_BaseSpeed: |
5596 this->uSpeed = (unsigned __int8)var_value; | 5594 this->uSpeed = (unsigned __int8)var_value; |
5597 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5595 PlayAwardSound_Anim_Face(SPEECH_92); |
5598 return; | 5596 return; |
5599 case VAR_BaseAccuracy: | 5597 case VAR_BaseAccuracy: |
5600 this->uAccuracy = (unsigned __int8)var_value; | 5598 this->uAccuracy = (unsigned __int8)var_value; |
5601 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5599 PlayAwardSound_Anim_Face(SPEECH_92); |
5602 return; | 5600 return; |
5603 case VAR_BaseLuck: | 5601 case VAR_BaseLuck: |
5604 this->uLuck = (unsigned __int8)var_value; | 5602 this->uLuck = (unsigned __int8)var_value; |
5605 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5603 PlayAwardSound_Anim_Face(SPEECH_92); |
5606 return; | 5604 return; |
5607 case VAR_MightBonus: | 5605 case VAR_MightBonus: |
5608 case VAR_ActualMight: | 5606 case VAR_ActualMight: |
5609 this->uMightBonus = (unsigned __int8)var_value; | 5607 this->uMightBonus = (unsigned __int8)var_value; |
5610 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5608 PlayAwardSound_Anim_Face(SPEECH_91); |
5611 return; | 5609 return; |
5612 case VAR_IntellectBonus: | 5610 case VAR_IntellectBonus: |
5613 case VAR_ActualIntellect: | 5611 case VAR_ActualIntellect: |
5614 this->uIntelligenceBonus = (unsigned __int8)var_value; | 5612 this->uIntelligenceBonus = (unsigned __int8)var_value; |
5615 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5613 PlayAwardSound_Anim_Face(SPEECH_91); |
5616 return; | 5614 return; |
5617 case VAR_PersonalityBonus: | 5615 case VAR_PersonalityBonus: |
5618 case VAR_ActualPersonality: | 5616 case VAR_ActualPersonality: |
5619 this->uWillpowerBonus = (unsigned __int8)var_value; | 5617 this->uWillpowerBonus = (unsigned __int8)var_value; |
5620 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5618 PlayAwardSound_Anim_Face(SPEECH_91); |
5621 return; | 5619 return; |
5622 case VAR_EnduranceBonus: | 5620 case VAR_EnduranceBonus: |
5623 case VAR_ActualEndurance: | 5621 case VAR_ActualEndurance: |
5624 this->uEnduranceBonus = (unsigned __int8)var_value; | 5622 this->uEnduranceBonus = (unsigned __int8)var_value; |
5625 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5623 PlayAwardSound_Anim_Face(SPEECH_91); |
5626 return; | 5624 return; |
5627 case VAR_SpeedBonus: | 5625 case VAR_SpeedBonus: |
5628 case VAR_ActualSpeed: | 5626 case VAR_ActualSpeed: |
5629 this->uSpeedBonus = (unsigned __int8)var_value; | 5627 this->uSpeedBonus = (unsigned __int8)var_value; |
5630 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5628 PlayAwardSound_Anim_Face(SPEECH_91); |
5631 return; | 5629 return; |
5632 case VAR_AccuracyBonus: | 5630 case VAR_AccuracyBonus: |
5633 case VAR_ActualAccuracy: | 5631 case VAR_ActualAccuracy: |
5634 this->uAccuracyBonus = (unsigned __int8)var_value; | 5632 this->uAccuracyBonus = (unsigned __int8)var_value; |
5635 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5633 PlayAwardSound_Anim_Face(SPEECH_92); |
5636 return; | 5634 return; |
5637 case VAR_LuckBonus: | 5635 case VAR_LuckBonus: |
5638 case VAR_ActualLuck: | 5636 case VAR_ActualLuck: |
5639 this->uLuckBonus = (unsigned __int8)var_value; | 5637 this->uLuckBonus = (unsigned __int8)var_value; |
5640 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5638 PlayAwardSound_Anim_Face(SPEECH_92); |
5641 return; | 5639 return; |
5642 case VAR_FireResistance: | 5640 case VAR_FireResistance: |
5643 this->sResFireBase = (unsigned __int8)var_value; | 5641 this->sResFireBase = (unsigned __int8)var_value; |
5644 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5642 PlayAwardSound_Anim_Face(SPEECH_92); |
5645 return; | 5643 return; |
5646 case VAR_AirResistance: | 5644 case VAR_AirResistance: |
5647 this->sResAirBase = (unsigned __int8)var_value; | 5645 this->sResAirBase = (unsigned __int8)var_value; |
5648 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5646 PlayAwardSound_Anim_Face(SPEECH_92); |
5649 return; | 5647 return; |
5650 case VAR_WaterResistance: | 5648 case VAR_WaterResistance: |
5651 this->sResWaterBase = (unsigned __int8)var_value; | 5649 this->sResWaterBase = (unsigned __int8)var_value; |
5652 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5650 PlayAwardSound_Anim_Face(SPEECH_92); |
5653 return; | 5651 return; |
5654 case VAR_EarthResistance: | 5652 case VAR_EarthResistance: |
5655 this->sResEarthBase = (unsigned __int8)var_value; | 5653 this->sResEarthBase = (unsigned __int8)var_value; |
5656 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5654 PlayAwardSound_Anim_Face(SPEECH_92); |
5657 return; | 5655 return; |
5658 case VAR_SpiritResistance: | 5656 case VAR_SpiritResistance: |
5659 this->sResSpiritBase = (unsigned __int8)var_value; | 5657 this->sResSpiritBase = (unsigned __int8)var_value; |
5660 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5658 PlayAwardSound_Anim_Face(SPEECH_92); |
5661 return; | 5659 return; |
5662 case VAR_MindResistance: | 5660 case VAR_MindResistance: |
5663 this->sResMindBase = (unsigned __int8)var_value; | 5661 this->sResMindBase = (unsigned __int8)var_value; |
5664 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5662 PlayAwardSound_Anim_Face(SPEECH_92); |
5665 return; | 5663 return; |
5666 case VAR_BodyResistance: | 5664 case VAR_BodyResistance: |
5667 this->sResBodyBase = (unsigned __int8)var_value; | 5665 this->sResBodyBase = (unsigned __int8)var_value; |
5668 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5666 PlayAwardSound_Anim_Face(SPEECH_92); |
5669 return; | 5667 return; |
5670 case VAR_LightResistance: | 5668 case VAR_LightResistance: |
5671 this->sResLightBase = (unsigned __int8)var_value; | 5669 this->sResLightBase = (unsigned __int8)var_value; |
5672 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5670 PlayAwardSound_Anim_Face(SPEECH_92); |
5673 return; | 5671 return; |
5674 case VAR_DarkResistance: | 5672 case VAR_DarkResistance: |
5675 this->sResDarkBase = (unsigned __int8)var_value; | 5673 this->sResDarkBase = (unsigned __int8)var_value; |
5676 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5674 PlayAwardSound_Anim_Face(SPEECH_92); |
5677 return; | 5675 return; |
5678 case VAR_MagicResistance: | 5676 case VAR_MagicResistance: |
5679 this->sResMagicBase = (unsigned __int8)var_value; | 5677 this->sResMagicBase = (unsigned __int8)var_value; |
5680 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92); | 5678 PlayAwardSound_Anim_Face(SPEECH_92); |
5681 return; | 5679 return; |
5682 case VAR_FireResistanceBonus: | 5680 case VAR_FireResistanceBonus: |
5683 this->sResFireBonus = (unsigned __int8)var_value; | 5681 this->sResFireBonus = (unsigned __int8)var_value; |
5684 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5682 PlayAwardSound_Anim_Face(SPEECH_91); |
5685 return; | 5683 return; |
5686 case VAR_AirResistanceBonus: | 5684 case VAR_AirResistanceBonus: |
5687 this->sResAirBonus = (unsigned __int8)var_value; | 5685 this->sResAirBonus = (unsigned __int8)var_value; |
5688 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5686 PlayAwardSound_Anim_Face(SPEECH_91); |
5689 return; | 5687 return; |
5690 case VAR_WaterResistanceBonus: | 5688 case VAR_WaterResistanceBonus: |
5691 this->sResWaterBonus = (unsigned __int8)var_value; | 5689 this->sResWaterBonus = (unsigned __int8)var_value; |
5692 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5690 PlayAwardSound_Anim_Face(SPEECH_91); |
5693 return; | 5691 return; |
5694 case VAR_EarthResistanceBonus: | 5692 case VAR_EarthResistanceBonus: |
5695 this->sResEarthBonus = (unsigned __int8)var_value; | 5693 this->sResEarthBonus = (unsigned __int8)var_value; |
5696 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5694 PlayAwardSound_Anim_Face(SPEECH_91); |
5697 return; | 5695 return; |
5698 case VAR_SpiritResistanceBonus: | 5696 case VAR_SpiritResistanceBonus: |
5699 this->sResSpiritBonus = (unsigned __int8)var_value; | 5697 this->sResSpiritBonus = (unsigned __int8)var_value; |
5700 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5698 PlayAwardSound_Anim_Face(SPEECH_91); |
5701 return; | 5699 return; |
5702 case VAR_MindResistanceBonus: | 5700 case VAR_MindResistanceBonus: |
5703 this->sResMindBonus = (unsigned __int8)var_value; | 5701 this->sResMindBonus = (unsigned __int8)var_value; |
5704 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5702 PlayAwardSound_Anim_Face(SPEECH_91); |
5705 return; | 5703 return; |
5706 case VAR_BodyResistanceBonus: | 5704 case VAR_BodyResistanceBonus: |
5707 this->sResBodyBonus = (unsigned __int8)var_value; | 5705 this->sResBodyBonus = (unsigned __int8)var_value; |
5708 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5706 PlayAwardSound_Anim_Face(SPEECH_91); |
5709 return; | 5707 return; |
5710 case VAR_LightResistanceBonus: | 5708 case VAR_LightResistanceBonus: |
5711 this->sResLightBonus = (unsigned __int8)var_value; | 5709 this->sResLightBonus = (unsigned __int8)var_value; |
5712 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5710 PlayAwardSound_Anim_Face(SPEECH_91); |
5713 return; | 5711 return; |
5714 case VAR_DarkResistanceBonus: | 5712 case VAR_DarkResistanceBonus: |
5715 this->sResDarkBonus = (unsigned __int8)var_value; | 5713 this->sResDarkBonus = (unsigned __int8)var_value; |
5716 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5714 PlayAwardSound_Anim_Face(SPEECH_91); |
5717 return; | 5715 return; |
5718 case VAR_PhysicalResistanceBonus: | 5716 case VAR_PhysicalResistanceBonus: |
5719 Error("Physical res. bonus not used"); | 5717 Error("Physical res. bonus not used"); |
5720 return; | 5718 return; |
5721 case VAR_MagicResistanceBonus: | 5719 case VAR_MagicResistanceBonus: |
5722 this->sResMagicBonus = (unsigned __int8)var_value; | 5720 this->sResMagicBonus = (unsigned __int8)var_value; |
5723 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91); | 5721 PlayAwardSound_Anim_Face(SPEECH_91); |
5724 return; | 5722 return; |
5725 case VAR_Cursed: | 5723 case VAR_Cursed: |
5726 this->SetCondition(Condition_Cursed, 1); | 5724 this->SetCondition(Condition_Cursed, 1); |
5727 PlayAwardSound_Anim(currPlayerId); | 5725 PlayAwardSound_Anim(); |
5728 return; | 5726 return; |
5729 case VAR_Weak: | 5727 case VAR_Weak: |
5730 this->SetCondition(Condition_Weak, 1); | 5728 this->SetCondition(Condition_Weak, 1); |
5731 PlayAwardSound_Anim(currPlayerId); | 5729 PlayAwardSound_Anim(); |
5732 return; | 5730 return; |
5733 case VAR_Asleep: | 5731 case VAR_Asleep: |
5734 this->SetCondition(Condition_Sleep, 1); | 5732 this->SetCondition(Condition_Sleep, 1); |
5735 PlayAwardSound_Anim(currPlayerId); | 5733 PlayAwardSound_Anim(); |
5736 return; | 5734 return; |
5737 case VAR_Afraid: | 5735 case VAR_Afraid: |
5738 this->SetCondition(Condition_Fear, 1); | 5736 this->SetCondition(Condition_Fear, 1); |
5739 PlayAwardSound_Anim(currPlayerId); | 5737 PlayAwardSound_Anim(); |
5740 return; | 5738 return; |
5741 case VAR_Drunk: | 5739 case VAR_Drunk: |
5742 this->SetCondition(Condition_Drunk, 1); | 5740 this->SetCondition(Condition_Drunk, 1); |
5743 PlayAwardSound_Anim(currPlayerId); | 5741 PlayAwardSound_Anim(); |
5744 return; | 5742 return; |
5745 case VAR_Insane: | 5743 case VAR_Insane: |
5746 this->SetCondition(Condition_Insane, 1); | 5744 this->SetCondition(Condition_Insane, 1); |
5747 PlayAwardSound_Anim(currPlayerId); | 5745 PlayAwardSound_Anim(); |
5748 return; | 5746 return; |
5749 case VAR_PoisonedGreen: | 5747 case VAR_PoisonedGreen: |
5750 this->SetCondition(Condition_Poison1, 1); | 5748 this->SetCondition(Condition_Poison1, 1); |
5751 PlayAwardSound_Anim(currPlayerId); | 5749 PlayAwardSound_Anim(); |
5752 return; | 5750 return; |
5753 case VAR_DiseasedGreen: | 5751 case VAR_DiseasedGreen: |
5754 this->SetCondition(Condition_Disease1, 1); | 5752 this->SetCondition(Condition_Disease1, 1); |
5755 PlayAwardSound_Anim(currPlayerId); | 5753 PlayAwardSound_Anim(); |
5756 return; | 5754 return; |
5757 case VAR_PoisonedYellow: | 5755 case VAR_PoisonedYellow: |
5758 this->SetCondition(Condition_Poison2, 1); | 5756 this->SetCondition(Condition_Poison2, 1); |
5759 PlayAwardSound_Anim(currPlayerId); | 5757 PlayAwardSound_Anim(); |
5760 return; | 5758 return; |
5761 case VAR_DiseasedYellow: | 5759 case VAR_DiseasedYellow: |
5762 this->SetCondition(Condition_Disease2, 1); | 5760 this->SetCondition(Condition_Disease2, 1); |
5763 PlayAwardSound_Anim(currPlayerId); | 5761 PlayAwardSound_Anim(); |
5764 return; | 5762 return; |
5765 case VAR_PoisonedRed: | 5763 case VAR_PoisonedRed: |
5766 this->SetCondition(Condition_Poison3, 1); | 5764 this->SetCondition(Condition_Poison3, 1); |
5767 PlayAwardSound_Anim(currPlayerId); | 5765 PlayAwardSound_Anim(); |
5768 return; | 5766 return; |
5769 case VAR_DiseasedRed: | 5767 case VAR_DiseasedRed: |
5770 this->SetCondition(Condition_Disease3, 1); | 5768 this->SetCondition(Condition_Disease3, 1); |
5771 PlayAwardSound_Anim(currPlayerId); | 5769 PlayAwardSound_Anim(); |
5772 return; | 5770 return; |
5773 case VAR_Paralyzed: | 5771 case VAR_Paralyzed: |
5774 this->SetCondition(Condition_Paralyzed, 1); | 5772 this->SetCondition(Condition_Paralyzed, 1); |
5775 PlayAwardSound_Anim(currPlayerId); | 5773 PlayAwardSound_Anim(); |
5776 return; | 5774 return; |
5777 case VAR_Unconsious: | 5775 case VAR_Unconsious: |
5778 this->SetCondition(Condition_Unconcious, 1); | 5776 this->SetCondition(Condition_Unconcious, 1); |
5779 PlayAwardSound_Anim(currPlayerId); | 5777 PlayAwardSound_Anim(); |
5780 return; | 5778 return; |
5781 case VAR_Dead: | 5779 case VAR_Dead: |
5782 this->SetCondition(Condition_Dead, 1); | 5780 this->SetCondition(Condition_Dead, 1); |
5783 PlayAwardSound_Anim(currPlayerId); | 5781 PlayAwardSound_Anim(); |
5784 return; | 5782 return; |
5785 case VAR_Stoned: | 5783 case VAR_Stoned: |
5786 this->SetCondition(Condition_Pertified, 1); | 5784 this->SetCondition(Condition_Pertified, 1); |
5787 PlayAwardSound_Anim(currPlayerId); | 5785 PlayAwardSound_Anim(); |
5788 return; | 5786 return; |
5789 case VAR_Eradicated: | 5787 case VAR_Eradicated: |
5790 this->SetCondition(Condition_Eradicated, 1); | 5788 this->SetCondition(Condition_Eradicated, 1); |
5791 PlayAwardSound_Anim(currPlayerId); | 5789 PlayAwardSound_Anim(); |
5792 return; | 5790 return; |
5793 case VAR_MajorCondition: | 5791 case VAR_MajorCondition: |
5794 memset(this, 0, 0xA0u); | 5792 memset(this, 0, 0xA0u); |
5795 PlayAwardSound_Anim(currPlayerId); | 5793 PlayAwardSound_Anim(); |
5796 return; | 5794 return; |
5797 case VAR_AutoNotes: | 5795 case VAR_AutoNotes: |
5798 if ( !_449B57_test_bit(pParty->_autonote_bits, var_value) && pAutonoteTxt[var_value-1].pText ) | 5796 if ( !_449B57_test_bit(pParty->_autonote_bits, var_value) && pAutonoteTxt[var_value-1].pText ) |
5799 { | 5797 { |
5800 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | 5798 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, GetPlayerIndex()); |
5801 this->PlaySound(SPEECH_96, 0); | 5799 this->PlaySound(SPEECH_96, 0); |
5802 bFlashAutonotesBook = 1; | 5800 bFlashAutonotesBook = 1; |
5803 _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; | 5801 _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
5804 } | 5802 } |
5805 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); | 5803 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
5806 PlayAwardSound(currPlayerId); | 5804 PlayAwardSound(); |
5807 return; | 5805 return; |
5808 case VAR_PlayerBits: | 5806 case VAR_PlayerBits: |
5809 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); | 5807 _449B7E_toggle_bit((unsigned char *)playerEventBits, var_value, 1u); |
5810 return; | 5808 return; |
5811 case VAR_NPCs2: | 5809 case VAR_NPCs2: |
5812 pParty->hirelingScrollPosition = 0; | 5810 pParty->hirelingScrollPosition = 0; |
5813 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; | 5811 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; |
5814 pParty->CountHirelings(); | 5812 pParty->CountHirelings(); |
5860 return; | 5858 return; |
5861 case VAR_ArenaWinsLord: | 5859 case VAR_ArenaWinsLord: |
5862 pParty->uNumArenaLordWins = var_value; | 5860 pParty->uNumArenaLordWins = var_value; |
5863 return; | 5861 return; |
5864 case VAR_StaffSkill: | 5862 case VAR_StaffSkill: |
5865 SetSkillByEvent(&Player::skillStaff, var_type, currPlayerId); | 5863 SetSkillByEvent(&Player::skillStaff, var_value); |
5866 return; | 5864 return; |
5867 case VAR_SwordSkill: | 5865 case VAR_SwordSkill: |
5868 SetSkillByEvent(&Player::skillSword, var_type, currPlayerId); | 5866 SetSkillByEvent(&Player::skillSword, var_value); |
5869 return; | 5867 return; |
5870 case VAR_DaggerSkill: | 5868 case VAR_DaggerSkill: |
5871 SetSkillByEvent(&Player::skillDagger, var_type, currPlayerId); | 5869 SetSkillByEvent(&Player::skillDagger, var_value); |
5872 return; | 5870 return; |
5873 case VAR_AxeSkill: | 5871 case VAR_AxeSkill: |
5874 SetSkillByEvent(&Player::skillAxe, var_type, currPlayerId); | 5872 SetSkillByEvent(&Player::skillAxe, var_value); |
5875 return; | 5873 return; |
5876 case VAR_SpearSkill: | 5874 case VAR_SpearSkill: |
5877 SetSkillByEvent(&Player::skillSpear, var_type, currPlayerId); | 5875 SetSkillByEvent(&Player::skillSpear, var_value); |
5878 return; | 5876 return; |
5879 case VAR_BowSkill: | 5877 case VAR_BowSkill: |
5880 SetSkillByEvent(&Player::skillBow, var_type, currPlayerId); | 5878 SetSkillByEvent(&Player::skillBow, var_value); |
5881 return; | 5879 return; |
5882 case VAR_MaceSkill: | 5880 case VAR_MaceSkill: |
5883 SetSkillByEvent(&Player::skillMace, var_type, currPlayerId); | 5881 SetSkillByEvent(&Player::skillMace, var_value); |
5884 return; | 5882 return; |
5885 case VAR_BlasterSkill: | 5883 case VAR_BlasterSkill: |
5886 SetSkillByEvent(&Player::skillBlaster, var_type, currPlayerId); | 5884 SetSkillByEvent(&Player::skillBlaster, var_value); |
5887 return; | 5885 return; |
5888 case VAR_ShieldSkill: | 5886 case VAR_ShieldSkill: |
5889 SetSkillByEvent(&Player::skillShield, var_type, currPlayerId); | 5887 SetSkillByEvent(&Player::skillShield, var_value); |
5890 return; | 5888 return; |
5891 case VAR_LeatherSkill: | 5889 case VAR_LeatherSkill: |
5892 SetSkillByEvent(&Player::skillLeather, var_type, currPlayerId); | 5890 SetSkillByEvent(&Player::skillLeather, var_value); |
5893 return; | 5891 return; |
5894 case VAR_SkillChain: | 5892 case VAR_SkillChain: |
5895 SetSkillByEvent(&Player::skillChain, var_type, currPlayerId); | 5893 SetSkillByEvent(&Player::skillChain, var_value); |
5896 return; | 5894 return; |
5897 case VAR_PlateSkill: | 5895 case VAR_PlateSkill: |
5898 SetSkillByEvent(&Player::skillPlate, var_type, currPlayerId); | 5896 SetSkillByEvent(&Player::skillPlate, var_value); |
5899 return; | 5897 return; |
5900 case VAR_FireSkill: | 5898 case VAR_FireSkill: |
5901 SetSkillByEvent(&Player::skillFire, var_type, currPlayerId); | 5899 SetSkillByEvent(&Player::skillFire, var_value); |
5902 return; | 5900 return; |
5903 case VAR_AirSkill: | 5901 case VAR_AirSkill: |
5904 SetSkillByEvent(&Player::skillAir, var_type, currPlayerId); | 5902 SetSkillByEvent(&Player::skillAir, var_value); |
5905 return; | 5903 return; |
5906 case VAR_WaterSkill: | 5904 case VAR_WaterSkill: |
5907 SetSkillByEvent(&Player::skillWater, var_type, currPlayerId); | 5905 SetSkillByEvent(&Player::skillWater, var_value); |
5908 return; | 5906 return; |
5909 case VAR_EarthSkill: | 5907 case VAR_EarthSkill: |
5910 SetSkillByEvent(&Player::skillEarth, var_type, currPlayerId); | 5908 SetSkillByEvent(&Player::skillEarth, var_value); |
5911 return; | 5909 return; |
5912 case VAR_SpiritSkill: | 5910 case VAR_SpiritSkill: |
5913 SetSkillByEvent(&Player::skillSpirit, var_type, currPlayerId); | 5911 SetSkillByEvent(&Player::skillSpirit, var_value); |
5914 return; | 5912 return; |
5915 case VAR_MindSkill: | 5913 case VAR_MindSkill: |
5916 SetSkillByEvent(&Player::skillMind, var_type, currPlayerId); | 5914 SetSkillByEvent(&Player::skillMind, var_value); |
5917 return; | 5915 return; |
5918 case VAR_BodySkill: | 5916 case VAR_BodySkill: |
5919 SetSkillByEvent(&Player::skillBody, var_type, currPlayerId); | 5917 SetSkillByEvent(&Player::skillBody, var_value); |
5920 return; | 5918 return; |
5921 case VAR_LightSkill: | 5919 case VAR_LightSkill: |
5922 SetSkillByEvent(&Player::skillLight, var_type, currPlayerId); | 5920 SetSkillByEvent(&Player::skillLight, var_value); |
5923 return; | 5921 return; |
5924 case VAR_DarkSkill: | 5922 case VAR_DarkSkill: |
5925 SetSkillByEvent(&Player::skillDark, var_type, currPlayerId); | 5923 SetSkillByEvent(&Player::skillDark, var_value); |
5926 return; | 5924 return; |
5927 case VAR_IdentifyItemSkill: | 5925 case VAR_IdentifyItemSkill: |
5928 SetSkillByEvent(&Player::skillItemId, var_type, currPlayerId); | 5926 SetSkillByEvent(&Player::skillItemId, var_value); |
5929 return; | 5927 return; |
5930 case VAR_MerchantSkill: | 5928 case VAR_MerchantSkill: |
5931 SetSkillByEvent(&Player::skillMerchant, var_type, currPlayerId); | 5929 SetSkillByEvent(&Player::skillMerchant, var_value); |
5932 return; | 5930 return; |
5933 case VAR_RepairSkill: | 5931 case VAR_RepairSkill: |
5934 SetSkillByEvent(&Player::skillRepair, var_type, currPlayerId); | 5932 SetSkillByEvent(&Player::skillRepair, var_value); |
5935 return; | 5933 return; |
5936 case VAR_BodybuildingSkill: | 5934 case VAR_BodybuildingSkill: |
5937 SetSkillByEvent(&Player::skillBodybuilding, var_type, currPlayerId); | 5935 SetSkillByEvent(&Player::skillBodybuilding, var_value); |
5938 return; | 5936 return; |
5939 case VAR_MeditationSkill: | 5937 case VAR_MeditationSkill: |
5940 SetSkillByEvent(&Player::skillMeditation, var_type, currPlayerId); | 5938 SetSkillByEvent(&Player::skillMeditation, var_value); |
5941 return; | 5939 return; |
5942 case VAR_PerceptionSkill: | 5940 case VAR_PerceptionSkill: |
5943 SetSkillByEvent(&Player::skillPerception, var_type, currPlayerId); | 5941 SetSkillByEvent(&Player::skillPerception, var_value); |
5944 return; | 5942 return; |
5945 case VAR_DiplomacySkill: | 5943 case VAR_DiplomacySkill: |
5946 SetSkillByEvent(&Player::skillDiplomacy, var_type, currPlayerId); | 5944 SetSkillByEvent(&Player::skillDiplomacy, var_value); |
5947 return; | 5945 return; |
5948 case VAR_ThieverySkill: | 5946 case VAR_ThieverySkill: |
5949 Error ("Thieving unsupported"); | 5947 Error ("Thieving unsupported"); |
5950 return; | 5948 return; |
5951 case VAR_DisarmTrapSkill: | 5949 case VAR_DisarmTrapSkill: |
5952 SetSkillByEvent(&Player::skillDisarmTrap, var_type, currPlayerId); | 5950 SetSkillByEvent(&Player::skillDisarmTrap, var_value); |
5953 return; | 5951 return; |
5954 case VAR_DodgeSkill: | 5952 case VAR_DodgeSkill: |
5955 SetSkillByEvent(&Player::skillDodge, var_type, currPlayerId); | 5953 SetSkillByEvent(&Player::skillDodge, var_value); |
5956 return; | 5954 return; |
5957 case VAR_UnarmedSkill: | 5955 case VAR_UnarmedSkill: |
5958 SetSkillByEvent(&Player::skillUnarmed, var_type, currPlayerId); | 5956 SetSkillByEvent(&Player::skillUnarmed, var_value); |
5959 return; | 5957 return; |
5960 case VAR_IdentifyMonsterSkill: | 5958 case VAR_IdentifyMonsterSkill: |
5961 SetSkillByEvent(&Player::skillMonsterId, var_type, currPlayerId); | 5959 SetSkillByEvent(&Player::skillMonsterId, var_value); |
5962 return; | 5960 return; |
5963 case VAR_ArmsmasterSkill: | 5961 case VAR_ArmsmasterSkill: |
5964 SetSkillByEvent(&Player::skillArmsmaster, var_type, currPlayerId); | 5962 SetSkillByEvent(&Player::skillArmsmaster, var_value); |
5965 return; | 5963 return; |
5966 case VAR_StealingSkill: | 5964 case VAR_StealingSkill: |
5967 SetSkillByEvent(&Player::skillStealing, var_type, currPlayerId); | 5965 SetSkillByEvent(&Player::skillStealing, var_value); |
5968 return; | 5966 return; |
5969 case VAR_AlchemySkill: | 5967 case VAR_AlchemySkill: |
5970 SetSkillByEvent(&Player::skillAlchemy, var_type, currPlayerId); | 5968 SetSkillByEvent(&Player::skillAlchemy, var_value); |
5971 return; | 5969 return; |
5972 case VAR_LearningSkill: | 5970 case VAR_LearningSkill: |
5973 SetSkillByEvent(&Player::skillLearning, var_type, currPlayerId); | 5971 SetSkillByEvent(&Player::skillLearning, var_value); |
5974 return; | 5972 return; |
5975 } | 5973 } |
5976 } | 5974 } |
5977 | 5975 |
5978 | 5976 |
5979 //----- (new function) -------------------------------------------------------- | 5977 //----- (new function) -------------------------------------------------------- |
5980 void Player::PlayAwardSound(int currPlayerId) | 5978 void Player::PlayAwardSound() |
5981 { | 5979 { |
5982 signed int v25 = 8 * currPlayerId + 400; | 5980 int playerIndex = GetPlayerIndex(); |
5983 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); | 5981 signed int v25 = 8 * playerIndex + 400; |
5982 LOBYTE(v25) = PID(OBJECT_Player,playerIndex - 112); | |
5984 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); | 5983 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
5985 } | 5984 } |
5986 | 5985 |
5987 //----- (new function) -------------------------------------------------------- | 5986 //----- (new function) -------------------------------------------------------- |
5988 void Player::PlayAwardSound_Anim(int currPlayerId) | 5987 void Player::PlayAwardSound_Anim() |
5989 { | 5988 { |
5990 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | 5989 int playerIndex = GetPlayerIndex(); |
5991 PlayAwardSound(currPlayerId); | 5990 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, playerIndex); |
5991 PlayAwardSound(); | |
5992 } | 5992 } |
5993 | 5993 |
5994 //----- (new function) -------------------------------------------------------- | 5994 //----- (new function) -------------------------------------------------------- |
5995 void Player::PlayAwardSound_Anim_Face(int currPlayerId, PlayerSpeech speech) | 5995 void Player::PlayAwardSound_Anim_Face( PlayerSpeech speech ) |
5996 { | 5996 { |
5997 this->PlaySound(speech, 0); | 5997 this->PlaySound(speech, 0); |
5998 PlayAwardSound_Anim(currPlayerId); | 5998 PlayAwardSound_Anim(); |
5999 } | 5999 } |
6000 | 6000 |
6001 //----- (new function) -------------------------------------------------------- | 6001 //----- (new function) -------------------------------------------------------- |
6002 void Player::SetSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 newSkillValue, int currPlayerId ) | 6002 void Player::SetSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 skillValue ) |
6003 { | 6003 { |
6004 unsigned __int16 currSkillValue = this->*skillToSet; | 6004 unsigned __int16 currSkillValue = this->*skillToSet; |
6005 if ( newSkillValue > 63 ) //the original had the condition reversed which was probably wrong | 6005 if ( skillValue > 63 ) //the original had the condition reversed which was probably wrong |
6006 { | 6006 { |
6007 this->*skillToSet = newSkillValue | currSkillValue & 63; | 6007 this->*skillToSet = skillValue | currSkillValue & 63; |
6008 } | 6008 } |
6009 else | 6009 else |
6010 { | 6010 { |
6011 this->*skillToSet = newSkillValue | currSkillValue & 0xC0; | 6011 this->*skillToSet = skillValue | currSkillValue & 0xC0; |
6012 } | 6012 } |
6013 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | 6013 int playerIndex = GetPlayerIndex(); |
6014 PlayAwardSound(currPlayerId); | 6014 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, playerIndex); |
6015 PlayAwardSound(); | |
6015 } | 6016 } |
6016 | 6017 |
6017 //----- (0044AFFB) -------------------------------------------------------- | 6018 //----- (0044AFFB) -------------------------------------------------------- |
6018 void Player::AddVariable(enum VariableType var_type, signed int val) | 6019 void Player::AddVariable(enum VariableType var_type, signed int val) |
6019 { | 6020 { |
6020 signed int uPlayerIdx; // edi@1 | |
6021 int v6; // eax@15 | 6021 int v6; // eax@15 |
6022 unsigned int v7; // esi@18 | 6022 unsigned int v7; // esi@18 |
6023 DDM_DLV_Header *v27; // eax@153 | 6023 DDM_DLV_Header *v27; // eax@153 |
6024 ItemGen item; // [sp+Ch] [bp-2Ch]@45 | 6024 ItemGen item; // [sp+Ch] [bp-2Ch]@45 |
6025 | |
6026 uPlayerIdx = 0; | |
6027 if ( this == pPlayers[2] ) | |
6028 uPlayerIdx = 1; | |
6029 else if ( this == pPlayers[3] ) | |
6030 uPlayerIdx = 2; | |
6031 else if ( this == pPlayers[4] ) | |
6032 uPlayerIdx = 3; | |
6033 | 6025 |
6034 if ( var_type >= VAR_Counter1 && var_type <= VAR_Counter10) | 6026 if ( var_type >= VAR_Counter1 && var_type <= VAR_Counter10) |
6035 { | 6027 { |
6036 pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed; | 6028 pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed; |
6037 return; | 6029 return; |
6038 } | 6030 } |
6039 | 6031 |
6040 if ( var_type >= VAR_UnknownTimeEvent0 && var_type <= VAR_UnknownTimeEvent19 ) | 6032 if ( var_type >= VAR_UnknownTimeEvent0 && var_type <= VAR_UnknownTimeEvent19 ) |
6041 { | 6033 { |
6042 pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed; | 6034 pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed; |
6043 PlayAwardSound(uPlayerIdx); | 6035 PlayAwardSound(); |
6044 return; | 6036 return; |
6045 } | 6037 } |
6046 | 6038 |
6047 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_99 ) | 6039 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_99 ) |
6048 { | 6040 { |
6049 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) | 6041 |
6050 byte_5E4C15[var_type] += val; | 6042 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_74 ) |
6051 else | 6043 { |
6052 byte_5E4C15[var_type] = -1; | 6044 if (255 - val > stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0]) |
6045 stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0] += val; | |
6046 else | |
6047 stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0] = 255; | |
6048 } | |
6049 if ( (signed int)var_type >= VAR_MapPersistentVariable_75 && var_type <= VAR_MapPersistentVariable_99 ) | |
6050 { | |
6051 if (255 - val > stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75]) | |
6052 stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75] += val; | |
6053 else | |
6054 stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75] = 255; | |
6055 } | |
6053 return; | 6056 return; |
6054 } | 6057 } |
6055 | 6058 |
6056 if ( var_type >= VAR_History_0 && var_type <= VAR_History_28) | 6059 if ( var_type >= VAR_History_0 && var_type <= VAR_History_28) |
6057 { | 6060 { |
6059 { | 6062 { |
6060 pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed; | 6063 pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed; |
6061 if (pStorylineText->StoreLine[var_type - VAR_History_0].pText = 0) | 6064 if (pStorylineText->StoreLine[var_type - VAR_History_0].pText = 0) |
6062 { | 6065 { |
6063 bFlashHistoryBook = 1; | 6066 bFlashHistoryBook = 1; |
6064 PlayAwardSound(uPlayerIdx); | 6067 PlayAwardSound(); |
6065 } | 6068 } |
6066 } | 6069 } |
6067 return; | 6070 return; |
6068 } | 6071 } |
6069 | 6072 |
6082 v7 = rand() % val + 1; | 6085 v7 = rand() % val + 1; |
6083 Party::GiveFood(v7); | 6086 Party::GiveFood(v7); |
6084 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food | 6087 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food |
6085 ShowStatusBarString(pTmpBuf.data(), 2u); | 6088 ShowStatusBarString(pTmpBuf.data(), 2u); |
6086 GameUI_DrawFoodAndGold(); | 6089 GameUI_DrawFoodAndGold(); |
6087 PlayAwardSound(uPlayerIdx); | 6090 PlayAwardSound(); |
6088 return; | 6091 return; |
6089 case VAR_Sex: | 6092 case VAR_Sex: |
6090 this->uSex = (PLAYER_SEX)val; | 6093 this->uSex = (PLAYER_SEX)val; |
6091 PlayAwardSound_Anim97(uPlayerIdx); | 6094 PlayAwardSound_Anim97(); |
6092 return; | 6095 return; |
6093 case VAR_Class: | 6096 case VAR_Class: |
6094 this->classType = (PLAYER_CLASS_TYPE)val; | 6097 this->classType = (PLAYER_CLASS_TYPE)val; |
6095 PlayAwardSound_Anim97(uPlayerIdx); | 6098 PlayAwardSound_Anim97(); |
6096 return; | 6099 return; |
6097 case VAR_CurrentHP: | 6100 case VAR_CurrentHP: |
6098 this->sHealth = min(this->sHealth + val, this->GetMaxHealth() ); | 6101 this->sHealth = min(this->sHealth + val, this->GetMaxHealth() ); |
6099 PlayAwardSound_Anim97(uPlayerIdx); | 6102 PlayAwardSound_Anim97(); |
6100 return; | 6103 return; |
6101 case VAR_MaxHP: | 6104 case VAR_MaxHP: |
6102 this->_health_related = 0; | 6105 this->_health_related = 0; |
6103 this->uFullHealthBonus = 0; | 6106 this->uFullHealthBonus = 0; |
6104 this->sHealth = this->GetMaxHealth(); | 6107 this->sHealth = this->GetMaxHealth(); |
6105 return; | 6108 return; |
6106 case VAR_CurrentSP: | 6109 case VAR_CurrentSP: |
6107 this->sMana = min(this->sMana + val, this->GetMaxMana() ); | 6110 this->sMana = min(this->sMana + val, this->GetMaxMana() ); |
6108 PlayAwardSound_Anim97(uPlayerIdx); | 6111 PlayAwardSound_Anim97(); |
6109 return; | 6112 return; |
6110 case VAR_MaxSP: | 6113 case VAR_MaxSP: |
6111 this->_mana_related = 0; | 6114 this->_mana_related = 0; |
6112 this->uFullManaBonus = 0; | 6115 this->uFullManaBonus = 0; |
6113 this->sMana = GetMaxMana(); | 6116 this->sMana = GetMaxMana(); |
6114 return; | 6117 return; |
6115 case VAR_ACModifier: | 6118 case VAR_ACModifier: |
6116 this->sACModifier = min(this->sACModifier + val, 255); | 6119 this->sACModifier = min(this->sACModifier + val, 255); |
6117 PlayAwardSound_Anim97(uPlayerIdx); | 6120 PlayAwardSound_Anim97(); |
6118 return; | 6121 return; |
6119 case VAR_BaseLevel: | 6122 case VAR_BaseLevel: |
6120 this->uLevel = min(this->uLevel + val, 255); | 6123 this->uLevel = min(this->uLevel + val, 255); |
6121 PlayAwardSound_Anim97(uPlayerIdx); | 6124 PlayAwardSound_Anim97(); |
6122 return; | 6125 return; |
6123 case VAR_LevelModifier: | 6126 case VAR_LevelModifier: |
6124 this->sLevelModifier = min(this->sLevelModifier + val, 255); | 6127 this->sLevelModifier = min(this->sLevelModifier + val, 255); |
6125 PlayAwardSound_Anim97(uPlayerIdx); | 6128 PlayAwardSound_Anim97(); |
6126 return; | 6129 return; |
6127 case VAR_Age: | 6130 case VAR_Age: |
6128 this->sAgeModifier += val; | 6131 this->sAgeModifier += val; |
6129 return; | 6132 return; |
6130 case VAR_Award: | 6133 case VAR_Award: |
6131 if (_449B57_test_bit(this->_achieved_awards_bits, val) && pAwards[val].pText ) | 6134 if (_449B57_test_bit(this->_achieved_awards_bits, val) && pAwards[val].pText ) |
6132 { | 6135 { |
6133 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_96); | 6136 PlayAwardSound_Anim97_Face(SPEECH_96); |
6134 } | 6137 } |
6135 _449B7E_toggle_bit(this->_achieved_awards_bits, val, 1); | 6138 _449B7E_toggle_bit(this->_achieved_awards_bits, val, 1); |
6136 return; | 6139 return; |
6137 case VAR_Experience: | 6140 case VAR_Experience: |
6138 this->uExperience = min(this->uExperience + val, 4000000000i64); | 6141 this->uExperience = min(this->uExperience + val, 4000000000i64); |
6139 PlayAwardSound_Anim97(uPlayerIdx); | 6142 PlayAwardSound_Anim97(); |
6140 return; | 6143 return; |
6141 case VAR_QBits_QuestsDone: | 6144 case VAR_QBits_QuestsDone: |
6142 if ( !_449B57_test_bit(pParty->_quest_bits, val) && pQuestTable[val] ) | 6145 if ( !_449B57_test_bit(pParty->_quest_bits, val) && pQuestTable[val] ) |
6143 { | 6146 { |
6144 bFlashQuestBook = 1; | 6147 bFlashQuestBook = 1; |
6145 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_93); | 6148 PlayAwardSound_Anim97_Face(SPEECH_93); |
6146 } | 6149 } |
6147 _449B7E_toggle_bit(pParty->_quest_bits, val, 1); | 6150 _449B7E_toggle_bit(pParty->_quest_bits, val, 1); |
6148 return; | 6151 return; |
6149 case VAR_PlayerItemInHands: | 6152 case VAR_PlayerItemInHands: |
6150 item.Reset(); | 6153 item.Reset(); |
6162 case VAR_FixedGold: | 6165 case VAR_FixedGold: |
6163 party_finds_gold(val, 1); | 6166 party_finds_gold(val, 1); |
6164 return; | 6167 return; |
6165 case VAR_BaseMight: | 6168 case VAR_BaseMight: |
6166 this->uMight = min(this->uMight + val, 255); | 6169 this->uMight = min(this->uMight + val, 255); |
6167 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6170 PlayAwardSound_Anim97_Face(SPEECH_92); |
6168 return; | 6171 return; |
6169 case VAR_BaseIntellect: | 6172 case VAR_BaseIntellect: |
6170 this->uIntelligence = min(this->uIntelligence + val, 255); | 6173 this->uIntelligence = min(this->uIntelligence + val, 255); |
6171 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6174 PlayAwardSound_Anim97_Face(SPEECH_92); |
6172 return; | 6175 return; |
6173 case VAR_BasePersonality: | 6176 case VAR_BasePersonality: |
6174 this->uWillpower = min(this->uWillpower + val, 255); | 6177 this->uWillpower = min(this->uWillpower + val, 255); |
6175 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6178 PlayAwardSound_Anim97_Face(SPEECH_92); |
6176 return; | 6179 return; |
6177 case VAR_BaseEndurance: | 6180 case VAR_BaseEndurance: |
6178 this->uEndurance = min(this->uEndurance + val, 255); | 6181 this->uEndurance = min(this->uEndurance + val, 255); |
6179 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6182 PlayAwardSound_Anim97_Face(SPEECH_92); |
6180 return; | 6183 return; |
6181 case VAR_BaseSpeed: | 6184 case VAR_BaseSpeed: |
6182 this->uSpeed = min(this->uSpeed + val, 255); | 6185 this->uSpeed = min(this->uSpeed + val, 255); |
6183 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6186 PlayAwardSound_Anim97_Face(SPEECH_92); |
6184 return; | 6187 return; |
6185 case VAR_BaseAccuracy: | 6188 case VAR_BaseAccuracy: |
6186 this->uAccuracy = min(this->uAccuracy + val, 255); | 6189 this->uAccuracy = min(this->uAccuracy + val, 255); |
6187 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6190 PlayAwardSound_Anim97_Face(SPEECH_92); |
6188 return; | 6191 return; |
6189 case VAR_BaseLuck: | 6192 case VAR_BaseLuck: |
6190 this->uLuck = min(this->uLuck + val, 255); | 6193 this->uLuck = min(this->uLuck + val, 255); |
6191 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6194 PlayAwardSound_Anim97_Face(SPEECH_92); |
6192 return; | 6195 return; |
6193 case VAR_FixedFood: | 6196 case VAR_FixedFood: |
6194 Party::GiveFood(val); | 6197 Party::GiveFood(val); |
6195 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); | 6198 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val); |
6196 ShowStatusBarString(pTmpBuf.data(), 2u); | 6199 ShowStatusBarString(pTmpBuf.data(), 2u); |
6197 if ( pParty->uNumFoodRations > 0xFFFF ) | 6200 if ( pParty->uNumFoodRations > 0xFFFF ) |
6198 Party::SetFood(0xFFFFu); | 6201 Party::SetFood(0xFFFFu); |
6199 PlayAwardSound(uPlayerIdx); | 6202 PlayAwardSound(); |
6200 return; | 6203 return; |
6201 case VAR_MightBonus: | 6204 case VAR_MightBonus: |
6202 case VAR_ActualMight: | 6205 case VAR_ActualMight: |
6203 this->uMightBonus = min(this->uMightBonus + val, 255); | 6206 this->uMightBonus = min(this->uMightBonus + val, 255); |
6204 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6207 PlayAwardSound_Anim97_Face(SPEECH_91); |
6205 return; | 6208 return; |
6206 case VAR_IntellectBonus: | 6209 case VAR_IntellectBonus: |
6207 case VAR_ActualIntellect: | 6210 case VAR_ActualIntellect: |
6208 this->uIntelligenceBonus = min(this->uIntelligenceBonus + val, 255); | 6211 this->uIntelligenceBonus = min(this->uIntelligenceBonus + val, 255); |
6209 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6212 PlayAwardSound_Anim97_Face(SPEECH_91); |
6210 return; | 6213 return; |
6211 case VAR_PersonalityBonus: | 6214 case VAR_PersonalityBonus: |
6212 case VAR_ActualPersonality: | 6215 case VAR_ActualPersonality: |
6213 this->uWillpowerBonus = min(this->uWillpowerBonus + val, 255); | 6216 this->uWillpowerBonus = min(this->uWillpowerBonus + val, 255); |
6214 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6217 PlayAwardSound_Anim97_Face(SPEECH_91); |
6215 return; | 6218 return; |
6216 case VAR_EnduranceBonus: | 6219 case VAR_EnduranceBonus: |
6217 case VAR_ActualEndurance: | 6220 case VAR_ActualEndurance: |
6218 this->uEnduranceBonus = min(this->uEnduranceBonus + val, 255); | 6221 this->uEnduranceBonus = min(this->uEnduranceBonus + val, 255); |
6219 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6222 PlayAwardSound_Anim97_Face(SPEECH_91); |
6220 return; | 6223 return; |
6221 case VAR_SpeedBonus: | 6224 case VAR_SpeedBonus: |
6222 case VAR_ActualSpeed: | 6225 case VAR_ActualSpeed: |
6223 this->uSpeedBonus = min(this->uSpeedBonus + val, 255); | 6226 this->uSpeedBonus = min(this->uSpeedBonus + val, 255); |
6224 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6227 PlayAwardSound_Anim97_Face(SPEECH_91); |
6225 return; | 6228 return; |
6226 case VAR_AccuracyBonus: | 6229 case VAR_AccuracyBonus: |
6227 case VAR_ActualAccuracy: | 6230 case VAR_ActualAccuracy: |
6228 this->uAccuracyBonus = min(this->uAccuracyBonus + val, 255); | 6231 this->uAccuracyBonus = min(this->uAccuracyBonus + val, 255); |
6229 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6232 PlayAwardSound_Anim97_Face(SPEECH_91); |
6230 return; | 6233 return; |
6231 case VAR_LuckBonus: | 6234 case VAR_LuckBonus: |
6232 case VAR_ActualLuck: | 6235 case VAR_ActualLuck: |
6233 this->uLuckBonus = min(this->uLuckBonus + val, 255); | 6236 this->uLuckBonus = min(this->uLuckBonus + val, 255); |
6234 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6237 PlayAwardSound_Anim97_Face(SPEECH_91); |
6235 return; | 6238 return; |
6236 case VAR_FireResistance: | 6239 case VAR_FireResistance: |
6237 this->sResFireBase = min(this->sResFireBase + val, 255); | 6240 this->sResFireBase = min(this->sResFireBase + val, 255); |
6238 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6241 PlayAwardSound_Anim97_Face(SPEECH_92); |
6239 return; | 6242 return; |
6240 case VAR_AirResistance: | 6243 case VAR_AirResistance: |
6241 this->sResAirBase = min(this->sResAirBase + val, 255); | 6244 this->sResAirBase = min(this->sResAirBase + val, 255); |
6242 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6245 PlayAwardSound_Anim97_Face(SPEECH_92); |
6243 return; | 6246 return; |
6244 case VAR_WaterResistance: | 6247 case VAR_WaterResistance: |
6245 this->sResWaterBase = min(this->sResWaterBase + val, 255); | 6248 this->sResWaterBase = min(this->sResWaterBase + val, 255); |
6246 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6249 PlayAwardSound_Anim97_Face(SPEECH_92); |
6247 return; | 6250 return; |
6248 case VAR_EarthResistance: | 6251 case VAR_EarthResistance: |
6249 this->sResEarthBase = min(this->sResEarthBase + val, 255); | 6252 this->sResEarthBase = min(this->sResEarthBase + val, 255); |
6250 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6253 PlayAwardSound_Anim97_Face(SPEECH_92); |
6251 return; | 6254 return; |
6252 case VAR_SpiritResistance: | 6255 case VAR_SpiritResistance: |
6253 this->sResSpiritBase = min(this->sResSpiritBase + val, 255); | 6256 this->sResSpiritBase = min(this->sResSpiritBase + val, 255); |
6254 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6257 PlayAwardSound_Anim97_Face(SPEECH_92); |
6255 return; | 6258 return; |
6256 case VAR_MindResistance: | 6259 case VAR_MindResistance: |
6257 this->sResMindBase = min(this->sResMindBase + val, 255); | 6260 this->sResMindBase = min(this->sResMindBase + val, 255); |
6258 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6261 PlayAwardSound_Anim97_Face(SPEECH_92); |
6259 return; | 6262 return; |
6260 case VAR_BodyResistance: | 6263 case VAR_BodyResistance: |
6261 this->sResBodyBase = min(this->sResBodyBase + val, 255); | 6264 this->sResBodyBase = min(this->sResBodyBase + val, 255); |
6262 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6265 PlayAwardSound_Anim97_Face(SPEECH_92); |
6263 return; | 6266 return; |
6264 case VAR_LightResistance: | 6267 case VAR_LightResistance: |
6265 this->sResLightBase = min(this->sResLightBase + val, 255); | 6268 this->sResLightBase = min(this->sResLightBase + val, 255); |
6266 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6269 PlayAwardSound_Anim97_Face(SPEECH_92); |
6267 return; | 6270 return; |
6268 case VAR_DarkResistance: | 6271 case VAR_DarkResistance: |
6269 this->sResDarkBase = min(this->sResDarkBase + val, 255); | 6272 this->sResDarkBase = min(this->sResDarkBase + val, 255); |
6270 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6273 PlayAwardSound_Anim97_Face(SPEECH_92); |
6271 return; | 6274 return; |
6272 case VAR_MagicResistance: | 6275 case VAR_MagicResistance: |
6273 this->sResMagicBase = min(this->sResMagicBase + val, 255); | 6276 this->sResMagicBase = min(this->sResMagicBase + val, 255); |
6274 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_92); | 6277 PlayAwardSound_Anim97_Face(SPEECH_92); |
6275 return; | 6278 return; |
6276 case VAR_FireResistanceBonus: | 6279 case VAR_FireResistanceBonus: |
6277 this->sResFireBonus = min(this->sResFireBonus + val, 255); | 6280 this->sResFireBonus = min(this->sResFireBonus + val, 255); |
6278 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6281 PlayAwardSound_Anim97_Face(SPEECH_91); |
6279 return; | 6282 return; |
6280 case VAR_AirResistanceBonus: | 6283 case VAR_AirResistanceBonus: |
6281 this->sResAirBonus = min(this->sResAirBonus + val, 255); | 6284 this->sResAirBonus = min(this->sResAirBonus + val, 255); |
6282 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6285 PlayAwardSound_Anim97_Face(SPEECH_91); |
6283 return; | 6286 return; |
6284 case VAR_WaterResistanceBonus: | 6287 case VAR_WaterResistanceBonus: |
6285 this->sResWaterBonus = min(this->sResWaterBonus + val, 255); | 6288 this->sResWaterBonus = min(this->sResWaterBonus + val, 255); |
6286 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6289 PlayAwardSound_Anim97_Face(SPEECH_91); |
6287 return; | 6290 return; |
6288 case VAR_EarthResistanceBonus: | 6291 case VAR_EarthResistanceBonus: |
6289 this->sResEarthBonus = min(this->sResEarthBonus + val, 255); | 6292 this->sResEarthBonus = min(this->sResEarthBonus + val, 255); |
6290 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6293 PlayAwardSound_Anim97_Face(SPEECH_91); |
6291 return; | 6294 return; |
6292 case VAR_SpiritResistanceBonus: | 6295 case VAR_SpiritResistanceBonus: |
6293 this->sResSpiritBonus = min(this->sResSpiritBonus + val, 255); | 6296 this->sResSpiritBonus = min(this->sResSpiritBonus + val, 255); |
6294 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6297 PlayAwardSound_Anim97_Face(SPEECH_91); |
6295 return; | 6298 return; |
6296 case VAR_MindResistanceBonus: | 6299 case VAR_MindResistanceBonus: |
6297 this->sResMindBonus = min(this->sResMindBonus + val, 255); | 6300 this->sResMindBonus = min(this->sResMindBonus + val, 255); |
6298 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6301 PlayAwardSound_Anim97_Face(SPEECH_91); |
6299 return; | 6302 return; |
6300 case VAR_BodyResistanceBonus: | 6303 case VAR_BodyResistanceBonus: |
6301 this->sResBodyBonus = min(this->sResBodyBonus + val, 255); | 6304 this->sResBodyBonus = min(this->sResBodyBonus + val, 255); |
6302 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6305 PlayAwardSound_Anim97_Face(SPEECH_91); |
6303 return; | 6306 return; |
6304 case VAR_LightResistanceBonus: | 6307 case VAR_LightResistanceBonus: |
6305 this->sResLightBonus = min(this->sResLightBonus + val, 255); | 6308 this->sResLightBonus = min(this->sResLightBonus + val, 255); |
6306 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6309 PlayAwardSound_Anim97_Face(SPEECH_91); |
6307 return; | 6310 return; |
6308 case VAR_DarkResistanceBonus: | 6311 case VAR_DarkResistanceBonus: |
6309 this->sResDarkBonus = min(this->sResDarkBonus + val, 255); | 6312 this->sResDarkBonus = min(this->sResDarkBonus + val, 255); |
6310 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6313 PlayAwardSound_Anim97_Face(SPEECH_91); |
6311 return; | 6314 return; |
6312 case VAR_MagicResistanceBonus: | 6315 case VAR_MagicResistanceBonus: |
6313 this->sResMagicBonus = min(this->sResMagicBonus + val, 255); | 6316 this->sResMagicBonus = min(this->sResMagicBonus + val, 255); |
6314 PlayAwardSound_Anim97_Face(uPlayerIdx, SPEECH_91); | 6317 PlayAwardSound_Anim97_Face(SPEECH_91); |
6315 return; | 6318 return; |
6316 case VAR_Cursed: | 6319 case VAR_Cursed: |
6317 this->SetCondition(Condition_Cursed, 1); | 6320 this->SetCondition(Condition_Cursed, 1); |
6318 PlayAwardSound_Anim97(uPlayerIdx); | 6321 PlayAwardSound_Anim97(); |
6319 return; | 6322 return; |
6320 case VAR_Weak: | 6323 case VAR_Weak: |
6321 this->SetCondition(Condition_Weak, 1); | 6324 this->SetCondition(Condition_Weak, 1); |
6322 PlayAwardSound_Anim97(uPlayerIdx); | 6325 PlayAwardSound_Anim97(); |
6323 return; | 6326 return; |
6324 case VAR_Asleep: | 6327 case VAR_Asleep: |
6325 this->SetCondition(Condition_Sleep, 1); | 6328 this->SetCondition(Condition_Sleep, 1); |
6326 PlayAwardSound_Anim97(uPlayerIdx); | 6329 PlayAwardSound_Anim97(); |
6327 return; | 6330 return; |
6328 case VAR_Afraid: | 6331 case VAR_Afraid: |
6329 this->SetCondition(Condition_Fear, 1); | 6332 this->SetCondition(Condition_Fear, 1); |
6330 PlayAwardSound_Anim97(uPlayerIdx); | 6333 PlayAwardSound_Anim97(); |
6331 return; | 6334 return; |
6332 case VAR_Drunk: | 6335 case VAR_Drunk: |
6333 this->SetCondition(Condition_Drunk, 1); | 6336 this->SetCondition(Condition_Drunk, 1); |
6334 PlayAwardSound_Anim97(uPlayerIdx); | 6337 PlayAwardSound_Anim97(); |
6335 return; | 6338 return; |
6336 case VAR_Insane: | 6339 case VAR_Insane: |
6337 this->SetCondition(Condition_Insane, 1); | 6340 this->SetCondition(Condition_Insane, 1); |
6338 PlayAwardSound_Anim97(uPlayerIdx); | 6341 PlayAwardSound_Anim97(); |
6339 return; | 6342 return; |
6340 case VAR_PoisonedGreen: | 6343 case VAR_PoisonedGreen: |
6341 this->SetCondition(Condition_Poison1, 1); | 6344 this->SetCondition(Condition_Poison1, 1); |
6342 PlayAwardSound_Anim97(uPlayerIdx); | 6345 PlayAwardSound_Anim97(); |
6343 return; | 6346 return; |
6344 case VAR_DiseasedGreen: | 6347 case VAR_DiseasedGreen: |
6345 this->SetCondition(Condition_Disease1, 1); | 6348 this->SetCondition(Condition_Disease1, 1); |
6346 PlayAwardSound_Anim97(uPlayerIdx); | 6349 PlayAwardSound_Anim97(); |
6347 return; | 6350 return; |
6348 case VAR_PoisonedYellow: | 6351 case VAR_PoisonedYellow: |
6349 this->SetCondition(Condition_Poison2, 1); | 6352 this->SetCondition(Condition_Poison2, 1); |
6350 PlayAwardSound_Anim97(uPlayerIdx); | 6353 PlayAwardSound_Anim97(); |
6351 return; | 6354 return; |
6352 case VAR_DiseasedYellow: | 6355 case VAR_DiseasedYellow: |
6353 this->SetCondition(Condition_Disease2, 1); | 6356 this->SetCondition(Condition_Disease2, 1); |
6354 PlayAwardSound_Anim97(uPlayerIdx); | 6357 PlayAwardSound_Anim97(); |
6355 return; | 6358 return; |
6356 case VAR_PoisonedRed: | 6359 case VAR_PoisonedRed: |
6357 this->SetCondition(Condition_Poison3, 1); | 6360 this->SetCondition(Condition_Poison3, 1); |
6358 PlayAwardSound_Anim97(uPlayerIdx); | 6361 PlayAwardSound_Anim97(); |
6359 return; | 6362 return; |
6360 case VAR_DiseasedRed: | 6363 case VAR_DiseasedRed: |
6361 this->SetCondition(Condition_Disease3, 1); | 6364 this->SetCondition(Condition_Disease3, 1); |
6362 PlayAwardSound_Anim97(uPlayerIdx); | 6365 PlayAwardSound_Anim97(); |
6363 return; | 6366 return; |
6364 case VAR_Paralyzed: | 6367 case VAR_Paralyzed: |
6365 this->SetCondition(Condition_Paralyzed, 1); | 6368 this->SetCondition(Condition_Paralyzed, 1); |
6366 PlayAwardSound_Anim97(uPlayerIdx); | 6369 PlayAwardSound_Anim97(); |
6367 return; | 6370 return; |
6368 case VAR_Unconsious: | 6371 case VAR_Unconsious: |
6369 this->SetCondition(Condition_Unconcious, 1); | 6372 this->SetCondition(Condition_Unconcious, 1); |
6370 PlayAwardSound_Anim97(uPlayerIdx); | 6373 PlayAwardSound_Anim97(); |
6371 return; | 6374 return; |
6372 case VAR_Dead: | 6375 case VAR_Dead: |
6373 this->SetCondition(Condition_Dead, 1); | 6376 this->SetCondition(Condition_Dead, 1); |
6374 PlayAwardSound_Anim97(uPlayerIdx); | 6377 PlayAwardSound_Anim97(); |
6375 return; | 6378 return; |
6376 case VAR_Stoned: | 6379 case VAR_Stoned: |
6377 this->SetCondition(Condition_Pertified, 1); | 6380 this->SetCondition(Condition_Pertified, 1); |
6378 PlayAwardSound_Anim97(uPlayerIdx); | 6381 PlayAwardSound_Anim97(); |
6379 return; | 6382 return; |
6380 case VAR_Eradicated: | 6383 case VAR_Eradicated: |
6381 this->SetCondition(Condition_Eradicated, 1); | 6384 this->SetCondition(Condition_Eradicated, 1); |
6382 PlayAwardSound_Anim97(uPlayerIdx); | 6385 PlayAwardSound_Anim97(); |
6383 return; | 6386 return; |
6384 case VAR_MajorCondition : | 6387 case VAR_MajorCondition : |
6385 memset(this, 0, 0xA0u); | 6388 memset(this, 0, 0xA0u); |
6386 PlayAwardSound_Anim97(uPlayerIdx); | 6389 PlayAwardSound_Anim97(); |
6387 return; | 6390 return; |
6388 case VAR_AutoNotes: | 6391 case VAR_AutoNotes: |
6389 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText ) | 6392 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText ) |
6390 { | 6393 { |
6391 this->PlaySound(SPEECH_96, 0); | 6394 this->PlaySound(SPEECH_96, 0); |
6392 bFlashAutonotesBook = 1; | 6395 bFlashAutonotesBook = 1; |
6393 _506568_autonote_type = pAutonoteTxt[val].eType; | 6396 _506568_autonote_type = pAutonoteTxt[val].eType; |
6394 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, uPlayerIdx); | 6397 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, GetPlayerIndex()); |
6395 } | 6398 } |
6396 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); | 6399 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); |
6397 PlayAwardSound(uPlayerIdx); | 6400 PlayAwardSound(); |
6398 return; | 6401 return; |
6399 case VAR_PlayerBits: | 6402 case VAR_PlayerBits: |
6400 _449B7E_toggle_bit((unsigned char *)this->field_1A50, val, 1u); | 6403 _449B7E_toggle_bit((unsigned char *)this->playerEventBits, val, 1u); |
6401 return; | 6404 return; |
6402 case VAR_NPCs2: | 6405 case VAR_NPCs2: |
6403 pParty->hirelingScrollPosition = 0; | 6406 pParty->hirelingScrollPosition = 0; |
6404 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; | 6407 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u; |
6405 pParty->CountHirelings(); | 6408 pParty->CountHirelings(); |
6439 return; | 6442 return; |
6440 case VAR_ArenaWinsLord: | 6443 case VAR_ArenaWinsLord: |
6441 pParty->uNumArenaLordWins += val; | 6444 pParty->uNumArenaLordWins += val; |
6442 return; | 6445 return; |
6443 case VAR_StaffSkill: | 6446 case VAR_StaffSkill: |
6444 AddSkillByEvent(&Player::skillStaff, val, uPlayerIdx); | 6447 AddSkillByEvent(&Player::skillStaff, val); |
6445 return; | 6448 return; |
6446 case VAR_SwordSkill: | 6449 case VAR_SwordSkill: |
6447 AddSkillByEvent(&Player::skillSword, val, uPlayerIdx); | 6450 AddSkillByEvent(&Player::skillSword, val); |
6448 return; | 6451 return; |
6449 case VAR_DaggerSkill: | 6452 case VAR_DaggerSkill: |
6450 AddSkillByEvent(&Player::skillDagger, val, uPlayerIdx); | 6453 AddSkillByEvent(&Player::skillDagger, val); |
6451 return; | 6454 return; |
6452 case VAR_AxeSkill: | 6455 case VAR_AxeSkill: |
6453 AddSkillByEvent(&Player::skillAxe, val, uPlayerIdx); | 6456 AddSkillByEvent(&Player::skillAxe, val); |
6454 return; | 6457 return; |
6455 case VAR_SpearSkill: | 6458 case VAR_SpearSkill: |
6456 AddSkillByEvent(&Player::skillSpear, val, uPlayerIdx); | 6459 AddSkillByEvent(&Player::skillSpear, val); |
6457 return; | 6460 return; |
6458 case VAR_BowSkill: | 6461 case VAR_BowSkill: |
6459 AddSkillByEvent(&Player::skillBow, val, uPlayerIdx); | 6462 AddSkillByEvent(&Player::skillBow, val); |
6460 return; | 6463 return; |
6461 case VAR_MaceSkill: | 6464 case VAR_MaceSkill: |
6462 AddSkillByEvent(&Player::skillMace, val, uPlayerIdx); | 6465 AddSkillByEvent(&Player::skillMace, val); |
6463 return; | 6466 return; |
6464 case VAR_BlasterSkill: | 6467 case VAR_BlasterSkill: |
6465 AddSkillByEvent(&Player::skillBlaster, val, uPlayerIdx); | 6468 AddSkillByEvent(&Player::skillBlaster, val); |
6466 return; | 6469 return; |
6467 case VAR_ShieldSkill: | 6470 case VAR_ShieldSkill: |
6468 AddSkillByEvent(&Player::skillShield, val, uPlayerIdx); | 6471 AddSkillByEvent(&Player::skillShield, val); |
6469 return; | 6472 return; |
6470 case VAR_LeatherSkill: | 6473 case VAR_LeatherSkill: |
6471 AddSkillByEvent(&Player::skillLeather, val, uPlayerIdx); | 6474 AddSkillByEvent(&Player::skillLeather, val); |
6472 return; | 6475 return; |
6473 case VAR_SkillChain: | 6476 case VAR_SkillChain: |
6474 AddSkillByEvent(&Player::skillChain, val, uPlayerIdx); | 6477 AddSkillByEvent(&Player::skillChain, val); |
6475 return; | 6478 return; |
6476 case VAR_PlateSkill: | 6479 case VAR_PlateSkill: |
6477 AddSkillByEvent(&Player::skillPlate, val, uPlayerIdx); | 6480 AddSkillByEvent(&Player::skillPlate, val); |
6478 return; | 6481 return; |
6479 case VAR_FireSkill: | 6482 case VAR_FireSkill: |
6480 AddSkillByEvent(&Player::skillFire, val, uPlayerIdx); | 6483 AddSkillByEvent(&Player::skillFire, val); |
6481 return; | 6484 return; |
6482 case VAR_AirSkill: | 6485 case VAR_AirSkill: |
6483 AddSkillByEvent(&Player::skillAir, val, uPlayerIdx); | 6486 AddSkillByEvent(&Player::skillAir, val); |
6484 return; | 6487 return; |
6485 case VAR_WaterSkill: | 6488 case VAR_WaterSkill: |
6486 AddSkillByEvent(&Player::skillWater, val, uPlayerIdx); | 6489 AddSkillByEvent(&Player::skillWater, val); |
6487 return; | 6490 return; |
6488 case VAR_EarthSkill: | 6491 case VAR_EarthSkill: |
6489 AddSkillByEvent(&Player::skillEarth, val, uPlayerIdx); | 6492 AddSkillByEvent(&Player::skillEarth, val); |
6490 return; | 6493 return; |
6491 case VAR_SpiritSkill: | 6494 case VAR_SpiritSkill: |
6492 AddSkillByEvent(&Player::skillSpirit, val, uPlayerIdx); | 6495 AddSkillByEvent(&Player::skillSpirit, val); |
6493 return; | 6496 return; |
6494 case VAR_MindSkill: | 6497 case VAR_MindSkill: |
6495 AddSkillByEvent(&Player::skillMind, val, uPlayerIdx); | 6498 AddSkillByEvent(&Player::skillMind, val); |
6496 return; | 6499 return; |
6497 case VAR_BodySkill: | 6500 case VAR_BodySkill: |
6498 AddSkillByEvent(&Player::skillBody, val, uPlayerIdx); | 6501 AddSkillByEvent(&Player::skillBody, val); |
6499 return; | 6502 return; |
6500 case VAR_LightSkill: | 6503 case VAR_LightSkill: |
6501 AddSkillByEvent(&Player::skillLight, val, uPlayerIdx); | 6504 AddSkillByEvent(&Player::skillLight, val); |
6502 return; | 6505 return; |
6503 case VAR_DarkSkill: | 6506 case VAR_DarkSkill: |
6504 AddSkillByEvent(&Player::skillDark, val, uPlayerIdx); | 6507 AddSkillByEvent(&Player::skillDark, val); |
6505 return; | 6508 return; |
6506 case VAR_IdentifyItemSkill: | 6509 case VAR_IdentifyItemSkill: |
6507 AddSkillByEvent(&Player::skillItemId, val, uPlayerIdx); | 6510 AddSkillByEvent(&Player::skillItemId, val); |
6508 return; | 6511 return; |
6509 case VAR_MerchantSkill: | 6512 case VAR_MerchantSkill: |
6510 AddSkillByEvent(&Player::skillMerchant, val, uPlayerIdx); | 6513 AddSkillByEvent(&Player::skillMerchant, val); |
6511 return; | 6514 return; |
6512 case VAR_RepairSkill: | 6515 case VAR_RepairSkill: |
6513 AddSkillByEvent(&Player::skillRepair, val, uPlayerIdx); | 6516 AddSkillByEvent(&Player::skillRepair, val); |
6514 return; | 6517 return; |
6515 case VAR_BodybuildingSkill: | 6518 case VAR_BodybuildingSkill: |
6516 AddSkillByEvent(&Player::skillBodybuilding, val, uPlayerIdx); | 6519 AddSkillByEvent(&Player::skillBodybuilding, val); |
6517 return; | 6520 return; |
6518 case VAR_MeditationSkill: | 6521 case VAR_MeditationSkill: |
6519 AddSkillByEvent(&Player::skillMeditation, val, uPlayerIdx); | 6522 AddSkillByEvent(&Player::skillMeditation, val); |
6520 return; | 6523 return; |
6521 case VAR_PerceptionSkill: | 6524 case VAR_PerceptionSkill: |
6522 AddSkillByEvent(&Player::skillPerception, val, uPlayerIdx); | 6525 AddSkillByEvent(&Player::skillPerception, val); |
6523 return; | 6526 return; |
6524 case VAR_DiplomacySkill: | 6527 case VAR_DiplomacySkill: |
6525 AddSkillByEvent(&Player::skillDiplomacy, val, uPlayerIdx); | 6528 AddSkillByEvent(&Player::skillDiplomacy, val); |
6526 return; | 6529 return; |
6527 case VAR_ThieverySkill: | 6530 case VAR_ThieverySkill: |
6528 Error ("Thieving unsupported"); | 6531 Error ("Thieving unsupported"); |
6529 return; | 6532 return; |
6530 case VAR_DisarmTrapSkill: | 6533 case VAR_DisarmTrapSkill: |
6531 AddSkillByEvent(&Player::skillDisarmTrap, val, uPlayerIdx); | 6534 AddSkillByEvent(&Player::skillDisarmTrap, val); |
6532 return; | 6535 return; |
6533 case VAR_DodgeSkill: | 6536 case VAR_DodgeSkill: |
6534 AddSkillByEvent(&Player::skillDodge, val, uPlayerIdx); | 6537 AddSkillByEvent(&Player::skillDodge, val); |
6535 return; | 6538 return; |
6536 case VAR_UnarmedSkill: | 6539 case VAR_UnarmedSkill: |
6537 AddSkillByEvent(&Player::skillUnarmed, val, uPlayerIdx); | 6540 AddSkillByEvent(&Player::skillUnarmed, val); |
6538 return; | 6541 return; |
6539 case VAR_IdentifyMonsterSkill: | 6542 case VAR_IdentifyMonsterSkill: |
6540 AddSkillByEvent(&Player::skillMonsterId, val, uPlayerIdx); | 6543 AddSkillByEvent(&Player::skillMonsterId, val); |
6541 return; | 6544 return; |
6542 case VAR_ArmsmasterSkill: | 6545 case VAR_ArmsmasterSkill: |
6543 AddSkillByEvent(&Player::skillArmsmaster, val, uPlayerIdx); | 6546 AddSkillByEvent(&Player::skillArmsmaster, val); |
6544 return; | 6547 return; |
6545 case VAR_StealingSkill: | 6548 case VAR_StealingSkill: |
6546 AddSkillByEvent(&Player::skillStealing, val, uPlayerIdx); | 6549 AddSkillByEvent(&Player::skillStealing, val); |
6547 return; | 6550 return; |
6548 case VAR_AlchemySkill: | 6551 case VAR_AlchemySkill: |
6549 AddSkillByEvent(&Player::skillAlchemy, val, uPlayerIdx); | 6552 AddSkillByEvent(&Player::skillAlchemy, val); |
6550 return; | 6553 return; |
6551 case VAR_LearningSkill: | 6554 case VAR_LearningSkill: |
6552 AddSkillByEvent(&Player::skillLearning, val, uPlayerIdx); | 6555 AddSkillByEvent(&Player::skillLearning, val); |
6553 return; | 6556 return; |
6554 default: | 6557 default: |
6555 return; | 6558 return; |
6556 } | 6559 } |
6557 } | 6560 } |
6558 | 6561 |
6559 //----- (new function) -------------------------------------------------------- | 6562 //----- (new function) -------------------------------------------------------- |
6560 void Player::PlayAwardSound_Anim97(int currPlayerId) | 6563 void Player::PlayAwardSound_Anim97() |
6561 { | 6564 { |
6562 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, currPlayerId); | 6565 int playerIndex = GetPlayerIndex(); |
6563 PlayAwardSound(currPlayerId); | 6566 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, playerIndex); |
6567 PlayAwardSound(); | |
6564 } | 6568 } |
6565 | 6569 |
6566 //----- (new function) -------------------------------------------------------- | 6570 //----- (new function) -------------------------------------------------------- |
6567 void Player::PlayAwardSound_Anim97_Face(int currPlayerId, PlayerSpeech speech) | 6571 void Player::PlayAwardSound_Anim97_Face( PlayerSpeech speech ) |
6568 { | 6572 { |
6569 this->PlaySound(speech, 0); | 6573 this->PlaySound(speech, 0); |
6570 PlayAwardSound_Anim97(currPlayerId); | 6574 PlayAwardSound_Anim97(); |
6571 } | 6575 } |
6572 | 6576 |
6573 //----- (new function) -------------------------------------------------------- | 6577 //----- (new function) -------------------------------------------------------- |
6574 void Player::AddSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 addSkillValue, int currPlayerId ) | 6578 void Player::AddSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 addSkillValue ) |
6575 { | 6579 { |
6576 if ( addSkillValue > 63 ) | 6580 if ( addSkillValue > 63 ) |
6577 { | 6581 { |
6578 this->*skillToSet = (unsigned __int8)addSkillValue | this->*skillToSet & 63; | 6582 this->*skillToSet = (unsigned __int8)addSkillValue | this->*skillToSet & 63; |
6579 } | 6583 } |
6580 else | 6584 else |
6581 { | 6585 { |
6582 this->*skillToSet = min(this->*skillToSet + addSkillValue, 60) | this->*skillToSet & 0xC0; | 6586 this->*skillToSet = min(this->*skillToSet + addSkillValue, 60) | this->*skillToSet & 0xC0; |
6583 } | 6587 } |
6584 PlayAwardSound_Anim97(currPlayerId); | 6588 PlayAwardSound_Anim97(); |
6585 return; | 6589 return; |
6586 } | 6590 } |
6587 | 6591 |
6588 //----- (0044B9C4) -------------------------------------------------------- | 6592 //----- (0044B9C4) -------------------------------------------------------- |
6589 void Player::SubtractVariable( enum VariableType VarNum, signed int pValue ) | 6593 void Player::SubtractVariable( enum VariableType VarNum, signed int pValue ) |
6590 { | 6594 { |
6591 signed int playerId; // esi@1 | |
6592 DDM_DLV_Header *locationHeader; // eax@90 | 6595 DDM_DLV_Header *locationHeader; // eax@90 |
6593 int randGold; | 6596 int randGold; |
6594 int randFood; | 6597 int randFood; |
6595 int npcIndex; | 6598 int npcIndex; |
6596 | 6599 |
6597 playerId = 0; | |
6598 if ( this == pPlayers[2] ) | |
6599 playerId = 1; | |
6600 else if ( this == pPlayers[3] ) | |
6601 playerId = 2; | |
6602 else if ( this == pPlayers[4] ) | |
6603 playerId = 3; | |
6604 | |
6605 if ( VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_99 ) | 6600 if ( VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_99 ) |
6606 { | 6601 { |
6607 | 6602 if ( VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_74 ) |
6608 byte_5E4C15[VarNum] -= (char)pValue; | 6603 { |
6604 stru_5E4C90_MapPersistVars.field_0[VarNum - VAR_MapPersistentVariable_0] -= pValue; | |
6605 } | |
6606 if ( (signed int)VarNum >= VAR_MapPersistentVariable_75 && VarNum <= VAR_MapPersistentVariable_99 ) | |
6607 { | |
6608 stru_5E4C90_MapPersistVars._decor_events[VarNum - VAR_MapPersistentVariable_75] -= pValue; | |
6609 } | |
6609 return; | 6610 return; |
6610 } | 6611 } |
6611 | 6612 |
6612 switch (VarNum) | 6613 switch (VarNum) |
6613 { | 6614 { |
6614 case VAR_CurrentHP: | 6615 case VAR_CurrentHP: |
6615 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); | 6616 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
6616 PlayAwardSound_Anim98(playerId); | 6617 PlayAwardSound_Anim98(); |
6617 return; | 6618 return; |
6618 case VAR_CurrentSP: | 6619 case VAR_CurrentSP: |
6619 this->sMana = max(this->sMana - pValue, 0); | 6620 this->sMana = max(this->sMana - pValue, 0); |
6620 PlayAwardSound_Anim98(playerId); | 6621 PlayAwardSound_Anim98(); |
6621 return; | 6622 return; |
6622 case VAR_ACModifier: | 6623 case VAR_ACModifier: |
6623 this->sACModifier -= (unsigned __int8)pValue; | 6624 this->sACModifier -= (unsigned __int8)pValue; |
6624 PlayAwardSound_Anim98(playerId); | 6625 PlayAwardSound_Anim98(); |
6625 return; | 6626 return; |
6626 case VAR_BaseLevel: | 6627 case VAR_BaseLevel: |
6627 this->uLevel -= (unsigned __int8)pValue; | 6628 this->uLevel -= (unsigned __int8)pValue; |
6628 PlayAwardSound_Anim98(playerId); | 6629 PlayAwardSound_Anim98(); |
6629 return; | 6630 return; |
6630 case VAR_LevelModifier: | 6631 case VAR_LevelModifier: |
6631 this->sLevelModifier -= (unsigned __int8)pValue; | 6632 this->sLevelModifier -= (unsigned __int8)pValue; |
6632 PlayAwardSound_Anim98(playerId); | 6633 PlayAwardSound_Anim98(); |
6633 return; | 6634 return; |
6634 case VAR_Age: | 6635 case VAR_Age: |
6635 this->sAgeModifier -= (signed __int16)pValue; | 6636 this->sAgeModifier -= (signed __int16)pValue; |
6636 return; | 6637 return; |
6637 case VAR_Award: | 6638 case VAR_Award: |
6638 _449B7E_toggle_bit(this->_achieved_awards_bits, (signed __int16)pValue, 0); | 6639 _449B7E_toggle_bit(this->_achieved_awards_bits, (signed __int16)pValue, 0); |
6639 return; | 6640 return; |
6640 case VAR_Experience: | 6641 case VAR_Experience: |
6641 this->uExperience -= pValue; | 6642 this->uExperience -= pValue; |
6642 PlayAwardSound_Anim98(playerId); | 6643 PlayAwardSound_Anim98(); |
6643 return; | 6644 return; |
6644 case VAR_QBits_QuestsDone: | 6645 case VAR_QBits_QuestsDone: |
6645 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); | 6646 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); |
6646 this->PlaySound(SPEECH_96, 0); | 6647 this->PlaySound(SPEECH_96, 0); |
6647 return; | 6648 return; |
6677 ShowStatusBarString(pTmpBuf.data(), 2); | 6678 ShowStatusBarString(pTmpBuf.data(), 2); |
6678 GameUI_DrawFoodAndGold(); | 6679 GameUI_DrawFoodAndGold(); |
6679 return; | 6680 return; |
6680 case VAR_FixedFood: | 6681 case VAR_FixedFood: |
6681 Party::TakeFood((unsigned int)pValue); | 6682 Party::TakeFood((unsigned int)pValue); |
6682 PlayAwardSound_Anim98(playerId); | 6683 PlayAwardSound_Anim98(); |
6683 return; | 6684 return; |
6684 case VAR_RandomFood: | 6685 case VAR_RandomFood: |
6685 randFood = rand() % (signed int)pValue + 1; | 6686 randFood = rand() % (signed int)pValue + 1; |
6686 if ( (unsigned int)randFood > pParty->uNumFoodRations ) | 6687 if ( (unsigned int)randFood > pParty->uNumFoodRations ) |
6687 randFood = pParty->uNumFoodRations; | 6688 randFood = pParty->uNumFoodRations; |
6688 Party::TakeFood(randFood); | 6689 Party::TakeFood(randFood); |
6689 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], randFood); | 6690 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], randFood); |
6690 ShowStatusBarString(pTmpBuf.data(), 2u); | 6691 ShowStatusBarString(pTmpBuf.data(), 2u); |
6691 GameUI_DrawFoodAndGold(); | 6692 GameUI_DrawFoodAndGold(); |
6692 PlayAwardSound_Anim98(playerId); | 6693 PlayAwardSound_Anim98(); |
6693 return; | 6694 return; |
6694 case VAR_MightBonus: | 6695 case VAR_MightBonus: |
6695 case VAR_ActualMight: | 6696 case VAR_ActualMight: |
6696 this->uMightBonus -= (unsigned __int16)pValue; | 6697 this->uMightBonus -= (unsigned __int16)pValue; |
6697 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6698 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6698 return; | 6699 return; |
6699 case VAR_IntellectBonus: | 6700 case VAR_IntellectBonus: |
6700 case VAR_ActualIntellect: | 6701 case VAR_ActualIntellect: |
6701 this->uIntelligenceBonus -= (unsigned __int16)pValue; | 6702 this->uIntelligenceBonus -= (unsigned __int16)pValue; |
6702 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6703 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6703 return; | 6704 return; |
6704 case VAR_PersonalityBonus: | 6705 case VAR_PersonalityBonus: |
6705 case VAR_ActualPersonality: | 6706 case VAR_ActualPersonality: |
6706 this->uWillpowerBonus -= (unsigned __int16)pValue; | 6707 this->uWillpowerBonus -= (unsigned __int16)pValue; |
6707 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6708 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6708 return; | 6709 return; |
6709 case VAR_EnduranceBonus: | 6710 case VAR_EnduranceBonus: |
6710 case VAR_ActualEndurance: | 6711 case VAR_ActualEndurance: |
6711 this->uEnduranceBonus -= (unsigned __int16)pValue; | 6712 this->uEnduranceBonus -= (unsigned __int16)pValue; |
6712 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6713 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6713 return; | 6714 return; |
6714 case VAR_SpeedBonus: | 6715 case VAR_SpeedBonus: |
6715 case VAR_ActualSpeed: | 6716 case VAR_ActualSpeed: |
6716 this->uSpeedBonus -= (unsigned __int16)pValue; | 6717 this->uSpeedBonus -= (unsigned __int16)pValue; |
6717 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6718 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6718 return; | 6719 return; |
6719 case VAR_AccuracyBonus: | 6720 case VAR_AccuracyBonus: |
6720 case VAR_ActualAccuracy: | 6721 case VAR_ActualAccuracy: |
6721 this->uAccuracyBonus -= (unsigned __int16)pValue; | 6722 this->uAccuracyBonus -= (unsigned __int16)pValue; |
6722 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6723 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6723 return; | 6724 return; |
6724 case VAR_LuckBonus: | 6725 case VAR_LuckBonus: |
6725 case VAR_ActualLuck: | 6726 case VAR_ActualLuck: |
6726 this->uLuckBonus -= (unsigned __int16)pValue; | 6727 this->uLuckBonus -= (unsigned __int16)pValue; |
6727 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6728 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6728 return; | 6729 return; |
6729 case VAR_BaseMight: | 6730 case VAR_BaseMight: |
6730 this->uMight -= (unsigned __int16)pValue; | 6731 this->uMight -= (unsigned __int16)pValue; |
6731 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6732 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6732 return; | 6733 return; |
6733 case VAR_BaseIntellect: | 6734 case VAR_BaseIntellect: |
6734 this->uIntelligence -= (unsigned __int16)pValue; | 6735 this->uIntelligence -= (unsigned __int16)pValue; |
6735 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6736 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6736 return; | 6737 return; |
6737 case VAR_BasePersonality: | 6738 case VAR_BasePersonality: |
6738 this->uWillpower -= (unsigned __int16)pValue; | 6739 this->uWillpower -= (unsigned __int16)pValue; |
6739 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6740 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6740 return; | 6741 return; |
6741 case VAR_BaseEndurance: | 6742 case VAR_BaseEndurance: |
6742 this->uEndurance -= (unsigned __int16)pValue; | 6743 this->uEndurance -= (unsigned __int16)pValue; |
6743 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6744 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6744 return; | 6745 return; |
6745 case VAR_BaseSpeed: | 6746 case VAR_BaseSpeed: |
6746 this->uSpeed -= (unsigned __int16)pValue; | 6747 this->uSpeed -= (unsigned __int16)pValue; |
6747 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6748 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6748 return; | 6749 return; |
6749 case VAR_BaseAccuracy: | 6750 case VAR_BaseAccuracy: |
6750 this->uAccuracy -= (unsigned __int16)pValue; | 6751 this->uAccuracy -= (unsigned __int16)pValue; |
6751 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6752 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6752 return; | 6753 return; |
6753 case VAR_BaseLuck: | 6754 case VAR_BaseLuck: |
6754 this->uLuck -= (unsigned __int16)pValue; | 6755 this->uLuck -= (unsigned __int16)pValue; |
6755 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6756 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6756 return; | 6757 return; |
6757 case VAR_FireResistance: | 6758 case VAR_FireResistance: |
6758 this->sResFireBase -= (signed __int16)pValue; | 6759 this->sResFireBase -= (signed __int16)pValue; |
6759 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6760 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6760 return; | 6761 return; |
6761 case VAR_AirResistance: | 6762 case VAR_AirResistance: |
6762 this->sResAirBase -= (signed __int16)pValue; | 6763 this->sResAirBase -= (signed __int16)pValue; |
6763 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6764 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6764 return; | 6765 return; |
6765 case VAR_WaterResistance: | 6766 case VAR_WaterResistance: |
6766 this->sResWaterBase -= (signed __int16)pValue; | 6767 this->sResWaterBase -= (signed __int16)pValue; |
6767 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6768 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6768 return; | 6769 return; |
6769 case VAR_EarthResistance: | 6770 case VAR_EarthResistance: |
6770 this->sResEarthBase -= (signed __int16)pValue; | 6771 this->sResEarthBase -= (signed __int16)pValue; |
6771 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6772 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6772 return; | 6773 return; |
6773 case VAR_SpiritResistance: | 6774 case VAR_SpiritResistance: |
6774 this->sResSpiritBase -= (signed __int16)pValue; | 6775 this->sResSpiritBase -= (signed __int16)pValue; |
6775 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6776 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6776 return; | 6777 return; |
6777 case VAR_MindResistance: | 6778 case VAR_MindResistance: |
6778 this->sResMindBase -= (signed __int16)pValue; | 6779 this->sResMindBase -= (signed __int16)pValue; |
6779 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6780 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6780 return; | 6781 return; |
6781 case VAR_BodyResistance: | 6782 case VAR_BodyResistance: |
6782 this->sResBodyBase -= (signed __int16)pValue; | 6783 this->sResBodyBase -= (signed __int16)pValue; |
6783 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6784 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6784 return; | 6785 return; |
6785 case VAR_LightResistance: | 6786 case VAR_LightResistance: |
6786 this->sResLightBase -= (signed __int16)pValue; | 6787 this->sResLightBase -= (signed __int16)pValue; |
6787 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6788 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6788 return; | 6789 return; |
6789 case VAR_DarkResistance: | 6790 case VAR_DarkResistance: |
6790 this->sResDarkBase -= (signed __int16)pValue; | 6791 this->sResDarkBase -= (signed __int16)pValue; |
6791 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6792 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6792 return; | 6793 return; |
6793 case VAR_MagicResistance: | 6794 case VAR_MagicResistance: |
6794 this->sResMagicBase -= (signed __int16)pValue; | 6795 this->sResMagicBase -= (signed __int16)pValue; |
6795 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6796 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6796 return; | 6797 return; |
6797 case VAR_FireResistanceBonus: | 6798 case VAR_FireResistanceBonus: |
6798 this->sResFireBonus -= (signed __int16)pValue; | 6799 this->sResFireBonus -= (signed __int16)pValue; |
6799 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6800 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6800 return; | 6801 return; |
6801 case VAR_AirResistanceBonus: | 6802 case VAR_AirResistanceBonus: |
6802 this->sResAirBonus -= (signed __int16)pValue; | 6803 this->sResAirBonus -= (signed __int16)pValue; |
6803 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | 6804 this->PlayAwardSound_Anim98_Face(SPEECH_92); |
6804 return; | 6805 return; |
6805 case VAR_WaterResistanceBonus: | 6806 case VAR_WaterResistanceBonus: |
6806 this->sResWaterBonus -= (signed __int16)pValue; | 6807 this->sResWaterBonus -= (signed __int16)pValue; |
6807 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6808 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6808 return; | 6809 return; |
6809 case VAR_EarthResistanceBonus: | 6810 case VAR_EarthResistanceBonus: |
6810 this->sResEarthBonus -= (signed __int16)pValue; | 6811 this->sResEarthBonus -= (signed __int16)pValue; |
6811 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6812 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6812 return; | 6813 return; |
6813 case VAR_SpiritResistanceBonus: | 6814 case VAR_SpiritResistanceBonus: |
6814 this->sResSpiritBonus -= (signed __int16)pValue; | 6815 this->sResSpiritBonus -= (signed __int16)pValue; |
6815 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6816 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6816 return; | 6817 return; |
6817 case VAR_MindResistanceBonus: | 6818 case VAR_MindResistanceBonus: |
6818 this->sResMindBonus -= (signed __int16)pValue; | 6819 this->sResMindBonus -= (signed __int16)pValue; |
6819 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6820 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6820 return; | 6821 return; |
6821 case VAR_BodyResistanceBonus: | 6822 case VAR_BodyResistanceBonus: |
6822 this->sResBodyBonus -= (signed __int16)pValue; | 6823 this->sResBodyBonus -= (signed __int16)pValue; |
6823 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6824 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6824 return; | 6825 return; |
6825 case VAR_LightResistanceBonus: | 6826 case VAR_LightResistanceBonus: |
6826 this->sResLightBonus -= (signed __int16)pValue; | 6827 this->sResLightBonus -= (signed __int16)pValue; |
6827 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6828 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6828 return; | 6829 return; |
6829 case VAR_DarkResistanceBonus: | 6830 case VAR_DarkResistanceBonus: |
6830 this->sResDarkBonus -= (signed __int16)pValue; | 6831 this->sResDarkBonus -= (signed __int16)pValue; |
6831 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6832 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6832 return; | 6833 return; |
6833 case VAR_MagicResistanceBonus: | 6834 case VAR_MagicResistanceBonus: |
6834 this->sResMagicBonus -= (signed __int16)pValue; | 6835 this->sResMagicBonus -= (signed __int16)pValue; |
6835 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | 6836 this->PlayAwardSound_Anim98_Face(SPEECH_91); |
6836 return; | 6837 return; |
6837 case VAR_StaffSkill: | 6838 case VAR_StaffSkill: |
6838 this->skillStaff -= (unsigned __int8)pValue; | 6839 this->skillStaff -= (unsigned __int8)pValue; |
6839 PlayAwardSound_Anim98(playerId); | 6840 PlayAwardSound_Anim98(); |
6840 return; | 6841 return; |
6841 case VAR_SwordSkill: | 6842 case VAR_SwordSkill: |
6842 this->skillSword -= (unsigned __int8)pValue; | 6843 this->skillSword -= (unsigned __int8)pValue; |
6843 PlayAwardSound_Anim98(playerId); | 6844 PlayAwardSound_Anim98(); |
6844 return; | 6845 return; |
6845 case VAR_DaggerSkill: | 6846 case VAR_DaggerSkill: |
6846 this->skillDagger -= (unsigned __int8)pValue; | 6847 this->skillDagger -= (unsigned __int8)pValue; |
6847 PlayAwardSound_Anim98(playerId); | 6848 PlayAwardSound_Anim98(); |
6848 return; | 6849 return; |
6849 case VAR_AxeSkill: | 6850 case VAR_AxeSkill: |
6850 this->skillAxe -= (unsigned __int8)pValue; | 6851 this->skillAxe -= (unsigned __int8)pValue; |
6851 PlayAwardSound_Anim98(playerId); | 6852 PlayAwardSound_Anim98(); |
6852 return; | 6853 return; |
6853 case VAR_SpearSkill: | 6854 case VAR_SpearSkill: |
6854 this->skillSpear -= (unsigned __int8)pValue; | 6855 this->skillSpear -= (unsigned __int8)pValue; |
6855 PlayAwardSound_Anim98(playerId); | 6856 PlayAwardSound_Anim98(); |
6856 return; | 6857 return; |
6857 case VAR_BowSkill: | 6858 case VAR_BowSkill: |
6858 this->skillBow -= (unsigned __int8)pValue; | 6859 this->skillBow -= (unsigned __int8)pValue; |
6859 PlayAwardSound_Anim98(playerId); | 6860 PlayAwardSound_Anim98(); |
6860 return; | 6861 return; |
6861 case VAR_MaceSkill: | 6862 case VAR_MaceSkill: |
6862 this->skillMace -= (unsigned __int8)pValue; | 6863 this->skillMace -= (unsigned __int8)pValue; |
6863 PlayAwardSound_Anim98(playerId); | 6864 PlayAwardSound_Anim98(); |
6864 return; | 6865 return; |
6865 case VAR_BlasterSkill: | 6866 case VAR_BlasterSkill: |
6866 this->skillBlaster -= (unsigned __int8)pValue; | 6867 this->skillBlaster -= (unsigned __int8)pValue; |
6867 PlayAwardSound_Anim98(playerId); | 6868 PlayAwardSound_Anim98(); |
6868 return; | 6869 return; |
6869 case VAR_ShieldSkill: | 6870 case VAR_ShieldSkill: |
6870 this->skillShield -= (unsigned __int8)pValue; | 6871 this->skillShield -= (unsigned __int8)pValue; |
6871 PlayAwardSound_Anim98(playerId); | 6872 PlayAwardSound_Anim98(); |
6872 return; | 6873 return; |
6873 case VAR_LeatherSkill: | 6874 case VAR_LeatherSkill: |
6874 this->skillLearning -= (unsigned __int8)pValue; | 6875 this->skillLearning -= (unsigned __int8)pValue; |
6875 PlayAwardSound_Anim98(playerId); | 6876 PlayAwardSound_Anim98(); |
6876 return; | 6877 return; |
6877 case VAR_SkillChain: | 6878 case VAR_SkillChain: |
6878 this->skillChain -= (unsigned __int8)pValue; | 6879 this->skillChain -= (unsigned __int8)pValue; |
6879 PlayAwardSound_Anim98(playerId); | 6880 PlayAwardSound_Anim98(); |
6880 return; | 6881 return; |
6881 case VAR_PlateSkill: | 6882 case VAR_PlateSkill: |
6882 this->skillPlate -= (unsigned __int8)pValue; | 6883 this->skillPlate -= (unsigned __int8)pValue; |
6883 PlayAwardSound_Anim98(playerId); | 6884 PlayAwardSound_Anim98(); |
6884 return; | 6885 return; |
6885 case VAR_FireSkill: | 6886 case VAR_FireSkill: |
6886 this->skillFire -= (unsigned __int8)pValue; | 6887 this->skillFire -= (unsigned __int8)pValue; |
6887 PlayAwardSound_Anim98(playerId); | 6888 PlayAwardSound_Anim98(); |
6888 return; | 6889 return; |
6889 case VAR_AirSkill: | 6890 case VAR_AirSkill: |
6890 this->skillAir -= (unsigned __int8)pValue; | 6891 this->skillAir -= (unsigned __int8)pValue; |
6891 PlayAwardSound_Anim98(playerId); | 6892 PlayAwardSound_Anim98(); |
6892 return; | 6893 return; |
6893 case VAR_WaterSkill: | 6894 case VAR_WaterSkill: |
6894 this->skillWater -= (unsigned __int8)pValue; | 6895 this->skillWater -= (unsigned __int8)pValue; |
6895 PlayAwardSound_Anim98(playerId); | 6896 PlayAwardSound_Anim98(); |
6896 return; | 6897 return; |
6897 case VAR_EarthSkill: | 6898 case VAR_EarthSkill: |
6898 this->skillEarth -= (unsigned __int8)pValue; | 6899 this->skillEarth -= (unsigned __int8)pValue; |
6899 PlayAwardSound_Anim98(playerId); | 6900 PlayAwardSound_Anim98(); |
6900 return; | 6901 return; |
6901 case VAR_SpiritSkill: | 6902 case VAR_SpiritSkill: |
6902 this->skillSpirit -= (unsigned __int8)pValue; | 6903 this->skillSpirit -= (unsigned __int8)pValue; |
6903 PlayAwardSound_Anim98(playerId); | 6904 PlayAwardSound_Anim98(); |
6904 return; | 6905 return; |
6905 case VAR_MindSkill: | 6906 case VAR_MindSkill: |
6906 this->skillMind -= (unsigned __int8)pValue; | 6907 this->skillMind -= (unsigned __int8)pValue; |
6907 PlayAwardSound_Anim98(playerId); | 6908 PlayAwardSound_Anim98(); |
6908 return; | 6909 return; |
6909 case VAR_BodySkill: | 6910 case VAR_BodySkill: |
6910 this->skillBody -= (unsigned __int8)pValue; | 6911 this->skillBody -= (unsigned __int8)pValue; |
6911 PlayAwardSound_Anim98(playerId); | 6912 PlayAwardSound_Anim98(); |
6912 return; | 6913 return; |
6913 case VAR_LightSkill: | 6914 case VAR_LightSkill: |
6914 this->skillLight -= (unsigned __int8)pValue; | 6915 this->skillLight -= (unsigned __int8)pValue; |
6915 PlayAwardSound_Anim98(playerId); | 6916 PlayAwardSound_Anim98(); |
6916 return; | 6917 return; |
6917 case VAR_DarkSkill: | 6918 case VAR_DarkSkill: |
6918 this->skillDark -= (unsigned __int8)pValue; | 6919 this->skillDark -= (unsigned __int8)pValue; |
6919 PlayAwardSound_Anim98(playerId); | 6920 PlayAwardSound_Anim98(); |
6920 return; | 6921 return; |
6921 case VAR_IdentifyItemSkill: | 6922 case VAR_IdentifyItemSkill: |
6922 this->skillItemId -= (unsigned __int8)pValue; | 6923 this->skillItemId -= (unsigned __int8)pValue; |
6923 PlayAwardSound_Anim98(playerId); | 6924 PlayAwardSound_Anim98(); |
6924 return; | 6925 return; |
6925 case VAR_MerchantSkill: | 6926 case VAR_MerchantSkill: |
6926 this->skillMerchant -= (unsigned __int8)pValue; | 6927 this->skillMerchant -= (unsigned __int8)pValue; |
6927 PlayAwardSound_Anim98(playerId); | 6928 PlayAwardSound_Anim98(); |
6928 return; | 6929 return; |
6929 case VAR_RepairSkill: | 6930 case VAR_RepairSkill: |
6930 this->skillRepair -= (unsigned __int8)pValue; | 6931 this->skillRepair -= (unsigned __int8)pValue; |
6931 PlayAwardSound_Anim98(playerId); | 6932 PlayAwardSound_Anim98(); |
6932 return; | 6933 return; |
6933 case VAR_BodybuildingSkill: | 6934 case VAR_BodybuildingSkill: |
6934 this->skillBodybuilding -= (unsigned __int8)pValue; | 6935 this->skillBodybuilding -= (unsigned __int8)pValue; |
6935 PlayAwardSound_Anim98(playerId); | 6936 PlayAwardSound_Anim98(); |
6936 return; | 6937 return; |
6937 case VAR_MeditationSkill: | 6938 case VAR_MeditationSkill: |
6938 this->skillMeditation -= (unsigned __int8)pValue; | 6939 this->skillMeditation -= (unsigned __int8)pValue; |
6939 PlayAwardSound_Anim98(playerId); | 6940 PlayAwardSound_Anim98(); |
6940 return; | 6941 return; |
6941 case VAR_PerceptionSkill: | 6942 case VAR_PerceptionSkill: |
6942 this->skillPerception -= (unsigned __int8)pValue; | 6943 this->skillPerception -= (unsigned __int8)pValue; |
6943 PlayAwardSound_Anim98(playerId); | 6944 PlayAwardSound_Anim98(); |
6944 return; | 6945 return; |
6945 case VAR_DiplomacySkill: | 6946 case VAR_DiplomacySkill: |
6946 this->skillDiplomacy -= (unsigned __int8)pValue; | 6947 this->skillDiplomacy -= (unsigned __int8)pValue; |
6947 PlayAwardSound_Anim98(playerId); | 6948 PlayAwardSound_Anim98(); |
6949 return; | |
6950 case VAR_ThieverySkill: | |
6951 Error ("Thieving unsupported"); | |
6948 return; | 6952 return; |
6949 case VAR_DisarmTrapSkill: | 6953 case VAR_DisarmTrapSkill: |
6950 this->skillDisarmTrap -= (unsigned __int8)pValue; | 6954 this->skillDisarmTrap -= (unsigned __int8)pValue; |
6951 PlayAwardSound_Anim98(playerId); | 6955 PlayAwardSound_Anim98(); |
6952 return; | 6956 return; |
6953 case VAR_DodgeSkill: | 6957 case VAR_DodgeSkill: |
6954 this->skillDodge -= (unsigned __int8)pValue; | 6958 this->skillDodge -= (unsigned __int8)pValue; |
6955 PlayAwardSound_Anim98(playerId); | 6959 PlayAwardSound_Anim98(); |
6956 return; | 6960 return; |
6957 case VAR_UnarmedSkill: | 6961 case VAR_UnarmedSkill: |
6958 this->skillUnarmed -= (unsigned __int8)pValue; | 6962 this->skillUnarmed -= (unsigned __int8)pValue; |
6959 PlayAwardSound_Anim98(playerId); | 6963 PlayAwardSound_Anim98(); |
6960 return; | 6964 return; |
6961 case VAR_IdentifyMonsterSkill: | 6965 case VAR_IdentifyMonsterSkill: |
6962 this->skillMonsterId -= (unsigned __int8)pValue; | 6966 this->skillMonsterId -= (unsigned __int8)pValue; |
6963 PlayAwardSound_Anim98(playerId); | 6967 PlayAwardSound_Anim98(); |
6964 return; | 6968 return; |
6965 case VAR_ArmsmasterSkill: | 6969 case VAR_ArmsmasterSkill: |
6966 this->skillArmsmaster -= (unsigned __int8)pValue; | 6970 this->skillArmsmaster -= (unsigned __int8)pValue; |
6967 PlayAwardSound_Anim98(playerId); | 6971 PlayAwardSound_Anim98(); |
6968 return; | 6972 return; |
6969 case VAR_StealingSkill: | 6973 case VAR_StealingSkill: |
6970 this->skillStealing -= (unsigned __int8)pValue; | 6974 this->skillStealing -= (unsigned __int8)pValue; |
6971 PlayAwardSound_Anim98(playerId); | 6975 PlayAwardSound_Anim98(); |
6972 return; | 6976 return; |
6973 case VAR_AlchemySkill: | 6977 case VAR_AlchemySkill: |
6974 this->skillAlchemy -= (unsigned __int8)pValue; | 6978 this->skillAlchemy -= (unsigned __int8)pValue; |
6975 PlayAwardSound_Anim98(playerId); | 6979 PlayAwardSound_Anim98(); |
6976 return; | 6980 return; |
6977 case VAR_LearningSkill: | 6981 case VAR_LearningSkill: |
6978 this->skillLearning -= (unsigned __int8)pValue; | 6982 this->skillLearning -= (unsigned __int8)pValue; |
6979 PlayAwardSound_Anim98(playerId); | 6983 PlayAwardSound_Anim98(); |
6980 return; | 6984 return; |
6981 case VAR_Cursed: | 6985 case VAR_Cursed: |
6982 this->pConditions[Condition_Cursed] = 0; | 6986 this->pConditions[Condition_Cursed] = 0; |
6983 PlayAwardSound_Anim98(playerId); | 6987 PlayAwardSound_Anim98(); |
6984 return; | 6988 return; |
6985 case VAR_Weak: | 6989 case VAR_Weak: |
6986 this->pConditions[Condition_Weak] = 0; | 6990 this->pConditions[Condition_Weak] = 0; |
6987 PlayAwardSound_Anim98(playerId); | 6991 PlayAwardSound_Anim98(); |
6988 return; | 6992 return; |
6989 case VAR_Asleep: | 6993 case VAR_Asleep: |
6990 this->pConditions[Condition_Sleep] = 0; | 6994 this->pConditions[Condition_Sleep] = 0; |
6991 PlayAwardSound_Anim98(playerId); | 6995 PlayAwardSound_Anim98(); |
6992 return; | 6996 return; |
6993 case VAR_Afraid: | 6997 case VAR_Afraid: |
6994 this->pConditions[Condition_Fear] = 0; | 6998 this->pConditions[Condition_Fear] = 0; |
6995 PlayAwardSound_Anim98(playerId); | 6999 PlayAwardSound_Anim98(); |
6996 return; | 7000 return; |
6997 case VAR_Drunk: | 7001 case VAR_Drunk: |
6998 this->pConditions[Condition_Drunk] = 0; | 7002 this->pConditions[Condition_Drunk] = 0; |
6999 PlayAwardSound_Anim98(playerId); | 7003 PlayAwardSound_Anim98(); |
7000 return; | 7004 return; |
7001 case VAR_Insane: | 7005 case VAR_Insane: |
7002 this->pConditions[Condition_Insane] = 0; | 7006 this->pConditions[Condition_Insane] = 0; |
7003 PlayAwardSound_Anim98(playerId); | 7007 PlayAwardSound_Anim98(); |
7004 return; | 7008 return; |
7005 case VAR_PoisonedGreen: | 7009 case VAR_PoisonedGreen: |
7006 this->pConditions[Condition_Poison1] = 0; | 7010 this->pConditions[Condition_Poison1] = 0; |
7007 PlayAwardSound_Anim98(playerId); | 7011 PlayAwardSound_Anim98(); |
7008 return; | 7012 return; |
7009 case VAR_DiseasedGreen: | 7013 case VAR_DiseasedGreen: |
7010 this->pConditions[Condition_Disease1] = 0; | 7014 this->pConditions[Condition_Disease1] = 0; |
7011 PlayAwardSound_Anim98(playerId); | 7015 PlayAwardSound_Anim98(); |
7012 return; | 7016 return; |
7013 case VAR_PoisonedYellow: | 7017 case VAR_PoisonedYellow: |
7014 this->pConditions[Condition_Poison2] = 0; | 7018 this->pConditions[Condition_Poison2] = 0; |
7015 PlayAwardSound_Anim98(playerId); | 7019 PlayAwardSound_Anim98(); |
7016 return; | 7020 return; |
7017 case VAR_DiseasedYellow: | 7021 case VAR_DiseasedYellow: |
7018 this->pConditions[Condition_Disease2] = 0; | 7022 this->pConditions[Condition_Disease2] = 0; |
7019 PlayAwardSound_Anim98(playerId); | 7023 PlayAwardSound_Anim98(); |
7020 return; | 7024 return; |
7021 case VAR_PoisonedRed: | 7025 case VAR_PoisonedRed: |
7022 this->pConditions[Condition_Poison3] = 0; | 7026 this->pConditions[Condition_Poison3] = 0; |
7023 PlayAwardSound_Anim98(playerId); | 7027 PlayAwardSound_Anim98(); |
7024 return; | 7028 return; |
7025 case VAR_DiseasedRed: | 7029 case VAR_DiseasedRed: |
7026 this->pConditions[Condition_Disease3] = 0; | 7030 this->pConditions[Condition_Disease3] = 0; |
7027 PlayAwardSound_Anim98(playerId); | 7031 PlayAwardSound_Anim98(); |
7028 return; | 7032 return; |
7029 case VAR_Paralyzed: | 7033 case VAR_Paralyzed: |
7030 this->pConditions[Condition_Paralyzed] = 0; | 7034 this->pConditions[Condition_Paralyzed] = 0; |
7031 PlayAwardSound_Anim98(playerId); | 7035 PlayAwardSound_Anim98(); |
7032 return; | 7036 return; |
7033 case VAR_Unconsious: | 7037 case VAR_Unconsious: |
7034 this->pConditions[Condition_Unconcious] = 0; | 7038 this->pConditions[Condition_Unconcious] = 0; |
7035 PlayAwardSound_Anim98(playerId); | 7039 PlayAwardSound_Anim98(); |
7036 return; | 7040 return; |
7037 case VAR_Dead: | 7041 case VAR_Dead: |
7038 this->pConditions[Condition_Dead] = 0; | 7042 this->pConditions[Condition_Dead] = 0; |
7039 PlayAwardSound_Anim98(playerId); | 7043 PlayAwardSound_Anim98(); |
7040 return; | 7044 return; |
7041 case VAR_Stoned: | 7045 case VAR_Stoned: |
7042 this->pConditions[Condition_Pertified] = 0; | 7046 this->pConditions[Condition_Pertified] = 0; |
7043 PlayAwardSound_Anim98(playerId); | 7047 PlayAwardSound_Anim98(); |
7044 return; | 7048 return; |
7045 case VAR_Eradicated: | 7049 case VAR_Eradicated: |
7046 this->pConditions[Condition_Eradicated] = 0; | 7050 this->pConditions[Condition_Eradicated] = 0; |
7047 PlayAwardSound_Anim98(playerId); | 7051 PlayAwardSound_Anim98(); |
7048 return; | 7052 return; |
7049 case VAR_AutoNotes: | 7053 case VAR_AutoNotes: |
7050 _449B7E_toggle_bit(pParty->_autonote_bits, pValue - 1, 0); | 7054 _449B7E_toggle_bit(pParty->_autonote_bits, pValue - 1, 0); |
7051 return; | 7055 return; |
7052 case VAR_NPCs2: | 7056 case VAR_NPCs2: |
7133 } | 7137 } |
7134 // 5B65C4: using guessed type int dword_5B65C4; | 7138 // 5B65C4: using guessed type int dword_5B65C4; |
7135 // 5B65CC: using guessed type int dword_5B65CC; | 7139 // 5B65CC: using guessed type int dword_5B65CC; |
7136 | 7140 |
7137 //----- (new function) -------------------------------------------------------- | 7141 //----- (new function) -------------------------------------------------------- |
7138 void Player::PlayAwardSound_Anim98(int currPlayerId) | 7142 void Player::PlayAwardSound_Anim98() |
7139 { | 7143 { |
7140 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, currPlayerId); | 7144 int playerIndex = GetPlayerIndex(); |
7141 PlayAwardSound(currPlayerId); | 7145 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, playerIndex); |
7146 PlayAwardSound(); | |
7142 } | 7147 } |
7143 | 7148 |
7144 //----- (new function) -------------------------------------------------------- | 7149 //----- (new function) -------------------------------------------------------- |
7145 void Player::PlayAwardSound_Anim98_Face(int currPlayerId, PlayerSpeech speech) | 7150 void Player::PlayAwardSound_Anim98_Face( PlayerSpeech speech ) |
7146 { | 7151 { |
7147 this->PlaySound(speech, 0); | 7152 this->PlaySound(speech, 0); |
7148 PlayAwardSound_Anim98(currPlayerId); | 7153 PlayAwardSound_Anim98(); |
7149 } | 7154 } |
7150 | 7155 |
7151 //----- (00467E7F) -------------------------------------------------------- | 7156 //----- (00467E7F) -------------------------------------------------------- |
7152 void Player::EquipBody(ITEM_EQUIP_TYPE uEquipType) | 7157 void Player::EquipBody(ITEM_EQUIP_TYPE uEquipType) |
7153 { | 7158 { |
7154 int v2; // ebx@1 | 7159 int itemAnchor; // ebx@1 |
7155 Player *v3; // eax@1 | 7160 Player *currChar; // eax@1 |
7156 int v4; // edx@1 | 7161 int itemInvLocation; // edx@1 |
7157 int v7; // eax@3 | 7162 int freeSlot; // eax@3 |
7158 ItemGen tempPickedItem; // [sp+Ch] [bp-30h]@1 | 7163 ItemGen tempPickedItem; // [sp+Ch] [bp-30h]@1 |
7159 unsigned int *v11; // [sp+38h] [bp-4h]@1 | 7164 unsigned int *equipAnchor; // [sp+38h] [bp-4h]@1 |
7160 | 7165 |
7161 tempPickedItem.Reset(); | 7166 tempPickedItem.Reset(); |
7162 v2 = pEquipTypeToBodyAnchor[uEquipType]; | 7167 itemAnchor = pEquipTypeToBodyAnchor[uEquipType]; |
7163 v3 = pPlayers[uActiveCharacter]; | 7168 currChar = pPlayers[uActiveCharacter]; |
7164 v11 = &v3->pEquipment.pIndices[v2]; | 7169 equipAnchor = &currChar->pEquipment.pIndices[itemAnchor]; |
7165 v4 = *v11; | 7170 itemInvLocation = currChar->pEquipment.pIndices[itemAnchor]; |
7166 if ( v4 ) | 7171 if ( itemInvLocation ) |
7167 { | 7172 { |
7168 memcpy(&tempPickedItem, &pParty->pPickedItem, sizeof(tempPickedItem)); | 7173 memcpy(&tempPickedItem, &pParty->pPickedItem, sizeof(tempPickedItem)); |
7169 v3->pInventoryItemList[v4 - 1].uBodyAnchor = 0; | 7174 currChar->pInventoryItemList[itemInvLocation - 1].uBodyAnchor = 0; |
7170 pParty->pPickedItem.Reset(); | 7175 pParty->pPickedItem.Reset(); |
7171 pParty->SetHoldingItem(&v3->pInventoryItemList[v4 - 1]); | 7176 pParty->SetHoldingItem(&currChar->pInventoryItemList[itemInvLocation - 1]); |
7172 tempPickedItem.uBodyAnchor = v2 + 1; | 7177 tempPickedItem.uBodyAnchor = itemAnchor + 1; |
7173 memcpy(&v3->pInventoryItemList[v4 - 1], &tempPickedItem, sizeof(ItemGen)); | 7178 memcpy(&currChar->pInventoryItemList[itemInvLocation - 1], &tempPickedItem, sizeof(ItemGen)); |
7174 *v11 = v4; | 7179 *equipAnchor = itemInvLocation; |
7175 } | 7180 } |
7176 else | 7181 else |
7177 { | 7182 { |
7178 v7 = v3->FindFreeInventoryListSlot(); | 7183 freeSlot = currChar->FindFreeInventoryListSlot(); |
7179 if (v7 >= 0) | 7184 if (freeSlot >= 0) |
7180 { | 7185 { |
7181 pParty->pPickedItem.uBodyAnchor = v2 + 1; | 7186 pParty->pPickedItem.uBodyAnchor = itemAnchor + 1; |
7182 memcpy(&v3->pInventoryItemList[v7], &pParty->pPickedItem, sizeof(ItemGen)); | 7187 memcpy(&currChar->pInventoryItemList[freeSlot], &pParty->pPickedItem, sizeof(ItemGen)); |
7183 *v11 = v7 + 1; | 7188 *equipAnchor = freeSlot + 1; |
7184 pMouse->RemoveHoldingItem(); | 7189 pMouse->RemoveHoldingItem(); |
7185 } | 7190 } |
7186 } | 7191 } |
7187 } | 7192 } |
7188 | 7193 |
7214 } | 7219 } |
7215 return true; | 7220 return true; |
7216 } | 7221 } |
7217 | 7222 |
7218 //----- (0043EE15) -------------------------------------------------------- | 7223 //----- (0043EE15) -------------------------------------------------------- |
7219 bool Player::HasItem( unsigned int uItemID, char a3 ) | 7224 bool Player::HasItem( unsigned int uItemID, bool checkHeldItem ) |
7220 { | 7225 { |
7221 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) | 7226 if ( !checkHeldItem || pParty->pPickedItem.uItemID != uItemID ) |
7222 { | 7227 { |
7223 for ( uint i = 0; i < 126; ++i ) | 7228 for ( uint i = 0; i < 126; ++i ) |
7224 { | 7229 { |
7225 if ( this->pInventoryMatrix[i] > 0 ) | 7230 if ( this->pInventoryMatrix[i] > 0 ) |
7226 { | 7231 { |
7234 { | 7239 { |
7235 if ( (unsigned int)this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID == uItemID ) | 7240 if ( (unsigned int)this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID == uItemID ) |
7236 return true; | 7241 return true; |
7237 } | 7242 } |
7238 } | 7243 } |
7239 } | 7244 return false; |
7240 return false; | 7245 } |
7246 else | |
7247 { | |
7248 return true; | |
7249 } | |
7241 } | 7250 } |
7242 //----- (0043EDB9) -------------------------------------------------------- | 7251 //----- (0043EDB9) -------------------------------------------------------- |
7243 bool ShouldLoadTexturesForRaceAndGender(unsigned int _this) | 7252 bool ShouldLoadTexturesForRaceAndGender(unsigned int _this) |
7244 { | 7253 { |
7245 CHARACTER_RACE race; // edi@2 | 7254 CHARACTER_RACE race; // edi@2 |
7367 break; | 7376 break; |
7368 } | 7377 } |
7369 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | 7378 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) |
7370 { | 7379 { |
7371 dmgToReceive = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType); | 7380 dmgToReceive = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType); |
7372 if ( playerPtr->pPlayerBuffs[10].uExpireTime > 0 ) | 7381 if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime > 0 ) |
7373 { | 7382 { |
7374 int actorState = actorPtr->uAIState; | 7383 int actorState = actorPtr->uAIState; |
7375 if ( actorState != Dying && actorState != Dead) | 7384 if ( actorState != Dying && actorState != Dead) |
7376 { | 7385 { |
7377 int reflectedDamage = stru_50C198.CalcMagicalDamageToActor(actorPtr, damageType, dmgToReceive); | 7386 int reflectedDamage = stru_50C198.CalcMagicalDamageToActor(actorPtr, damageType, dmgToReceive); |
7436 { | 7445 { |
7437 playerPtr = &pParty->pPlayers[a4]; | 7446 playerPtr = &pParty->pPlayers[a4]; |
7438 } | 7447 } |
7439 else | 7448 else |
7440 { | 7449 { |
7441 element = 0; | 7450 int activePlayerCounter = 0; |
7442 for (int i = 1; i <= 4; i++) | 7451 for (int i = 1; i <= 4; i++) |
7443 { | 7452 { |
7444 v72[element] = i; | 7453 if (pPlayers[i]->CanAct()) |
7445 element++; | 7454 { |
7455 v72[activePlayerCounter] = i; | |
7456 activePlayerCounter++; | |
7457 } | |
7446 } | 7458 } |
7447 if ( element ) | 7459 if ( activePlayerCounter ) |
7448 { | 7460 { |
7449 playerPtr = &pParty->pPlayers[v72[rand() % element]];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; | 7461 playerPtr = &pParty->pPlayers[v72[rand() % activePlayerCounter]];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; |
7450 } | 7462 } |
7451 } | 7463 } |
7452 int v68; | 7464 int v68; |
7453 int v69; | 7465 int v69; |
7454 if ( uActorType != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) | 7466 if ( uActorType != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) |
7501 || spriteType == 535 | 7513 || spriteType == 535 |
7502 || spriteType == 540 ) | 7514 || spriteType == 540 ) |
7503 { | 7515 { |
7504 if ( !stru_50C198.ActorHitOrMiss(actorPtr, playerPtr) ) | 7516 if ( !stru_50C198.ActorHitOrMiss(actorPtr, playerPtr) ) |
7505 return; | 7517 return; |
7506 if ( playerPtr->pPlayerBuffs[13].uExpireTime > 0 ) | 7518 if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime > 0 ) |
7507 dmgToReceive >>= 1; | 7519 dmgToReceive >>= 1; |
7508 if ( playerPtr->HasEnchantedItemEquipped(36) ) | 7520 if ( playerPtr->HasEnchantedItemEquipped(36) ) |
7509 dmgToReceive >>= 1; | 7521 dmgToReceive >>= 1; |
7510 if ( playerPtr->HasEnchantedItemEquipped(69) ) | 7522 if ( playerPtr->HasEnchantedItemEquipped(69) ) |
7511 dmgToReceive >>= 1; | 7523 dmgToReceive >>= 1; |
7556 break; | 7568 break; |
7557 } | 7569 } |
7558 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | 7570 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) |
7559 { | 7571 { |
7560 int reflectedDmg = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType); | 7572 int reflectedDmg = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType); |
7561 if ( playerPtr->pPlayerBuffs[10].uExpireTime > 0 ) | 7573 if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime > 0 ) |
7562 { | 7574 { |
7563 unsigned __int16 actorState = actorPtr->uAIState; | 7575 unsigned __int16 actorState = actorPtr->uAIState; |
7564 if ( actorState != Dying && actorState != Dead) | 7576 if ( actorState != Dying && actorState != Dead) |
7565 { | 7577 { |
7566 recvdMagicDmg = stru_50C198.CalcMagicalDamageToActor(actorPtr, damageType, reflectedDmg); | 7578 recvdMagicDmg = stru_50C198.CalcMagicalDamageToActor(actorPtr, damageType, reflectedDmg); |
7617 } | 7629 } |
7618 } | 7630 } |
7619 //----- (00421EA6) -------------------------------------------------------- | 7631 //----- (00421EA6) -------------------------------------------------------- |
7620 void Player::OnInventoryLeftClick() | 7632 void Player::OnInventoryLeftClick() |
7621 { | 7633 { |
7622 signed int v2; // ecx@2 | 7634 signed int inventoryXCoord; // ecx@2 |
7623 int v3; // eax@2 | 7635 int inventoryYCoord; // eax@2 |
7624 int invMatrixIndex; // eax@2 | 7636 int invMatrixIndex; // eax@2 |
7625 unsigned int v6; // eax@7 | 7637 unsigned int enchantedItemPos; // eax@7 |
7626 unsigned int pickedItemId; // esi@12 | 7638 unsigned int pickedItemId; // esi@12 |
7627 unsigned int invItemIndex; // eax@12 | 7639 unsigned int invItemIndex; // eax@12 |
7628 unsigned int v9; // eax@16 | 7640 unsigned int itemPos; // eax@18 |
7629 unsigned int v10; // eax@18 | |
7630 ItemGen tmpItem; // [sp+Ch] [bp-3Ch]@1 | 7641 ItemGen tmpItem; // [sp+Ch] [bp-3Ch]@1 |
7631 POINT a2; // [sp+30h] [bp-18h]@4 | |
7632 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | 7642 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 |
7633 unsigned int pX; // [sp+40h] [bp-8h]@2 | 7643 unsigned int pX; // [sp+40h] [bp-8h]@2 |
7634 | 7644 |
7635 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) | 7645 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) |
7636 { | 7646 { |
7637 pMouse->GetClickPos(&pX, &pY); | 7647 pMouse->GetClickPos(&pX, &pY); |
7638 v3 = Player::INVETORYSLOTSWIDTH * ((pY - 17) / 32); | 7648 inventoryYCoord = (pY - 17) / 32; |
7639 v2 = (pX - 14) / 32; | 7649 inventoryXCoord = (pX - 14) / 32; |
7640 invMatrixIndex = v2 + v3; | 7650 invMatrixIndex = inventoryXCoord + (INVETORYSLOTSWIDTH * inventoryYCoord); |
7641 if ( v2 + v3 >= 0 ) | 7651 if ( inventoryYCoord >= 0 && inventoryYCoord < INVETORYSLOTSHEIGHT && inventoryXCoord >= 0 && inventoryXCoord < INVETORYSLOTSWIDTH) |
7642 { | 7652 { |
7643 if ( invMatrixIndex <= 126 && pMouse->GetCursorPos(&a2)->x < 462 | 7653 if ( _50C9A0_IsEnchantingInProgress ) |
7644 && pMouse->GetCursorPos(&a2)->x >= 14 ) | 7654 { |
7645 { | 7655 enchantedItemPos = this->GetItemIDAtInventoryIndex(&invMatrixIndex); |
7646 if ( _50C9A0_IsEnchantingInProgress ) | 7656 if ( enchantedItemPos ) |
7647 { | 7657 { |
7648 v6 = this->GetItemIDAtInventoryIndex(&invMatrixIndex); | 7658 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; |
7649 if ( v6 ) | 7659 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; |
7650 { | 7660 *((int *)pGUIWindow_Settings->ptr_1C + 3) = enchantedItemPos - 1; |
7651 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | 7661 *((short *)pGUIWindow_Settings->ptr_1C + 3) = invMatrixIndex; |
7652 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | 7662 ptr_50C9A4_ItemToEnchant = &this->pInventoryItemList[enchantedItemPos-1]; |
7653 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | 7663 _50C9A0_IsEnchantingInProgress = 0; |
7654 *((short *)pGUIWindow_Settings->ptr_1C + 3) = invMatrixIndex; | 7664 if ( pMessageQueue_50CBD0->uNumMessages ) |
7655 ptr_50C9A4_ItemToEnchant = &this->pInventoryItemList[v6-1]; | 7665 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
7656 _50C9A0_IsEnchantingInProgress = 0; | 7666 pMouse->SetCursorBitmap("MICON1"); |
7657 if ( pMessageQueue_50CBD0->uNumMessages ) | 7667 _50C9D0_AfterEnchClickEventId = 113; |
7658 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | 7668 _50C9D4_AfterEnchClickEventSecondParam = 0; |
7659 pMouse->SetCursorBitmap("MICON1"); | 7669 _50C9D8_AfterEnchClickEventTimeout = 256; |
7660 _50C9D0_AfterEnchClickEventId = 113; | 7670 } |
7661 _50C9D4_AfterEnchClickEventSecondParam = 0; | 7671 return; |
7662 _50C9D8_AfterEnchClickEventTimeout = 256; | 7672 } |
7663 } | 7673 if ( ptr_50C9A4_ItemToEnchant ) |
7674 return; | |
7675 pickedItemId = pParty->pPickedItem.uItemID; | |
7676 invItemIndex = this->GetItemIDAtInventoryIndex(&invMatrixIndex); | |
7677 if (!pickedItemId) | |
7678 { | |
7679 if ( !invItemIndex ) | |
7680 return; | |
7681 else | |
7682 { | |
7683 memcpy(&pParty->pPickedItem, &this->pInventoryItemList[invItemIndex-1], sizeof(pParty->pPickedItem)); | |
7684 this->RemoveItemAtInventoryIndex(invMatrixIndex); | |
7685 pickedItemId = pParty->pPickedItem.uItemID; | |
7686 pMouse->SetCursorBitmap(pItemsTable->pItems[pickedItemId].pIconName); | |
7664 return; | 7687 return; |
7665 } | 7688 } |
7666 if ( ptr_50C9A4_ItemToEnchant ) | 7689 } |
7690 else | |
7691 { | |
7692 if ( invItemIndex ) | |
7693 { | |
7694 ItemGen* invItemPtr = &this->pInventoryItemList[invItemIndex-1]; | |
7695 memcpy(&tmpItem, invItemPtr, sizeof(tmpItem)); | |
7696 this->RemoveItemAtInventoryIndex(invMatrixIndex); | |
7697 int emptyIndex = this->AddItem2(invMatrixIndex, &pParty->pPickedItem); | |
7698 if ( !emptyIndex ) | |
7699 { | |
7700 emptyIndex = this->AddItem2(-1, &pParty->pPickedItem); | |
7701 if ( !emptyIndex ) | |
7702 { | |
7703 this->PutItemArInventoryIndex(tmpItem.uItemID, invItemIndex - 1, invMatrixIndex); | |
7704 memcpy(invItemPtr, &tmpItem, sizeof(ItemGen)); | |
7705 return; | |
7706 } | |
7707 } | |
7708 memcpy(&pParty->pPickedItem, &tmpItem, sizeof(ItemGen)); | |
7709 pMouse->SetCursorBitmap(pParty->pPickedItem.GetIconName()); | |
7667 return; | 7710 return; |
7668 pickedItemId = pParty->pPickedItem.uItemID; | 7711 } |
7669 invItemIndex = this->GetItemIDAtInventoryIndex(&invMatrixIndex); | 7712 else |
7670 if (!pickedItemId) | |
7671 { | 7713 { |
7672 if ( !invItemIndex ) | 7714 itemPos = this->AddItem(invMatrixIndex, pickedItemId); |
7715 if ( itemPos ) | |
7716 { | |
7717 memcpy(&this->pInventoryItemList[itemPos-1], &pParty->pPickedItem, sizeof(ItemGen)); | |
7718 pMouse->RemoveHoldingItem(); | |
7673 return; | 7719 return; |
7674 else | 7720 } |
7721 itemPos = this->AddItem(-1, pickedItemId); | |
7722 if ( itemPos ) | |
7675 { | 7723 { |
7676 memcpy(&pParty->pPickedItem, &this->pInventoryItemList[invItemIndex-1], sizeof(pParty->pPickedItem)); | 7724 memcpy(&this->pInventoryItemList[itemPos-1], &pParty->pPickedItem, sizeof(ItemGen)); |
7677 this->RemoveItemAtInventoryIndex(invMatrixIndex); | 7725 pMouse->RemoveHoldingItem(); |
7678 v9 = pParty->pPickedItem.uItemID; | |
7679 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
7680 return; | 7726 return; |
7681 } | 7727 } |
7682 } | 7728 } |
7683 else | |
7684 { | |
7685 if ( invItemIndex ) | |
7686 { | |
7687 ItemGen* invItemPtr = &this->pInventoryItemList[invItemIndex-1]; | |
7688 memcpy(&tmpItem, invItemPtr, sizeof(tmpItem)); | |
7689 this->RemoveItemAtInventoryIndex(invMatrixIndex); | |
7690 int emptyIndex = this->AddItem2(invMatrixIndex, &pParty->pPickedItem); | |
7691 if ( !emptyIndex ) | |
7692 { | |
7693 emptyIndex = this->AddItem2(-1, &pParty->pPickedItem); | |
7694 if ( !emptyIndex ) | |
7695 { | |
7696 this->PutItemArInventoryIndex(tmpItem.uItemID, invItemIndex - 1, invMatrixIndex); | |
7697 memcpy(invItemPtr, &tmpItem, sizeof(ItemGen)); | |
7698 return; | |
7699 } | |
7700 } | |
7701 v9 = tmpItem.uItemID; | |
7702 memcpy(&pParty->pPickedItem, &tmpItem, sizeof(ItemGen)); | |
7703 pMouse->SetCursorBitmap(pParty->pPickedItem.GetIconName()); | |
7704 return; | |
7705 } | |
7706 else | |
7707 { | |
7708 v10 = this->AddItem(invMatrixIndex, pickedItemId); | |
7709 if ( v10 ) | |
7710 { | |
7711 memcpy(&this->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen)); | |
7712 pMouse->RemoveHoldingItem(); | |
7713 return; | |
7714 } | |
7715 v10 = this->AddItem(-1, pickedItemId); | |
7716 if ( v10 ) | |
7717 { | |
7718 memcpy(&this->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen)); | |
7719 pMouse->RemoveHoldingItem(); | |
7720 return; | |
7721 } | |
7722 } | |
7723 } | |
7724 } | 7729 } |
7725 } | 7730 } |
7726 } | 7731 } |
7727 } | 7732 } |
7728 | 7733 |
7957 { | 7962 { |
7958 return nullptr; | 7963 return nullptr; |
7959 } | 7964 } |
7960 return &this->pInventoryItemList[this->pEquipment.*itemPos - 1]; | 7965 return &this->pInventoryItemList[this->pEquipment.*itemPos - 1]; |
7961 } | 7966 } |
7967 | |
7968 int Player::GetPlayerIndex() | |
7969 { | |
7970 int uPlayerIdx = 0; | |
7971 if ( this == pPlayers[1] ) | |
7972 uPlayerIdx = 0; | |
7973 else if( this == pPlayers[2] ) | |
7974 uPlayerIdx = 1; | |
7975 else if ( this == pPlayers[3] ) | |
7976 uPlayerIdx = 2; | |
7977 else if ( this == pPlayers[4] ) | |
7978 uPlayerIdx = 3; | |
7979 Error("Unexpected player pointer"); | |
7980 } |