comparison Player.cpp @ 1782:421e826f4477

Player::SetVariable finishing cleanup
author Grumpy7
date Thu, 03 Oct 2013 05:56:52 +0200
parents 7b42e79eb2d0
children a3e86ec5d3ce
comparison
equal deleted inserted replaced
1781:7b42e79eb2d0 1782:421e826f4477
5417 void Player::SetVariable(enum VariableType var_type, signed int var_value) 5417 void Player::SetVariable(enum VariableType var_type, signed int var_value)
5418 { 5418 {
5419 signed int currPlayerId; // ebx@1 5419 signed int currPlayerId; // ebx@1
5420 unsigned int v6; // esi@13 5420 unsigned int v6; // esi@13
5421 unsigned int v7; // esi@14 5421 unsigned int v7; // esi@14
5422 signed int v8; // eax@17
5423 ItemGen *v9; // ecx@17
5424 int v10; // eax@21
5425 signed int v11; // eax@30 5422 signed int v11; // eax@30
5426 int v15; // ecx@86
5427 int v16; // esi@106
5428 char v17; // al@106
5429 int v18; // eax@107
5430 int v22; // eax@145
5431 DDM_DLV_Header *v24; // ecx@148 5423 DDM_DLV_Header *v24; // ecx@148
5432 ItemGen item; // [sp+Ch] [bp-28h]@52 5424 ItemGen item; // [sp+Ch] [bp-28h]@52
5433 5425
5434 currPlayerId = 0; 5426 currPlayerId = 0;
5435 if ( this == pPlayers[2] ) 5427 if ( this == pPlayers[2] )
5469 5461
5470 switch ( var_type ) 5462 switch ( var_type )
5471 { 5463 {
5472 case VAR_Sex: 5464 case VAR_Sex:
5473 this->uSex = (PLAYER_SEX)var_value; 5465 this->uSex = (PLAYER_SEX)var_value;
5474 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5466 PlayAwardSound_Anim(currPlayerId);
5475 PlayAwardSound(currPlayerId);
5476 return; 5467 return;
5477 case VAR_Class: 5468 case VAR_Class:
5478 this->classType = (PLAYER_CLASS_TYPE)var_value; 5469 this->classType = (PLAYER_CLASS_TYPE)var_value;
5479 if ( (PLAYER_CLASS_TYPE)var_value == PLAYER_CLASS_LICH ) 5470 if ( (PLAYER_CLASS_TYPE)var_value == PLAYER_CLASS_LICH )
5480 { 5471 {
5509 this->uCurrentFace = 20; 5500 this->uCurrentFace = 20;
5510 this->uVoiceID = 20; 5501 this->uVoiceID = 20;
5511 } 5502 }
5512 ReloadPlayerPortraits(currPlayerId, this->uCurrentFace); 5503 ReloadPlayerPortraits(currPlayerId, this->uCurrentFace);
5513 } 5504 }
5514 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5505 PlayAwardSound_Anim(currPlayerId);
5515 PlayAwardSound(currPlayerId);
5516 return; 5506 return;
5517 case VAR_CurrentHP: 5507 case VAR_CurrentHP:
5518 this->sHealth = var_value; 5508 this->sHealth = var_value;
5519 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5509 PlayAwardSound_Anim(currPlayerId);
5520 PlayAwardSound(currPlayerId);
5521 return; 5510 return;
5522 case VAR_MaxHP: 5511 case VAR_MaxHP:
5523 this->sHealth = GetMaxHealth(); 5512 this->sHealth = GetMaxHealth();
5524 return; 5513 return;
5525 case VAR_CurrentSP: 5514 case VAR_CurrentSP:
5526 this->sMana = var_value; 5515 this->sMana = var_value;
5527 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5516 PlayAwardSound_Anim(currPlayerId);
5528 PlayAwardSound(currPlayerId);
5529 return; 5517 return;
5530 case VAR_MaxSP: 5518 case VAR_MaxSP:
5531 this->sMana = GetMaxMana(); 5519 this->sMana = GetMaxMana();
5532 return; 5520 return;
5533 case VAR_ACModifier: 5521 case VAR_ACModifier:
5534 this->sACModifier = (unsigned __int8)var_value; 5522 this->sACModifier = (unsigned __int8)var_value;
5535 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5523 PlayAwardSound_Anim(currPlayerId);
5536 PlayAwardSound(currPlayerId);
5537 return; 5524 return;
5538 case VAR_BaseLevel: 5525 case VAR_BaseLevel:
5539 this->uLevel = (unsigned __int8)var_value; 5526 this->uLevel = (unsigned __int8)var_value;
5540 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5527 PlayAwardSound_Anim(currPlayerId);
5541 PlayAwardSound(currPlayerId);
5542 return; 5528 return;
5543 case VAR_LevelModifier: 5529 case VAR_LevelModifier:
5544 this->sLevelModifier = (unsigned __int8)var_value; 5530 this->sLevelModifier = (unsigned __int8)var_value;
5545 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5531 PlayAwardSound_Anim(currPlayerId);
5546 PlayAwardSound(currPlayerId);
5547 return; 5532 return;
5548 case VAR_Age: 5533 case VAR_Age:
5549 this->sAgeModifier = var_value; 5534 this->sAgeModifier = var_value;
5550 return; 5535 return;
5551 case VAR_Award: 5536 case VAR_Award:
5552 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & 5537 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) &
5553 this->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8]) //&& dword_723E80_award_related[2 * a3] ) 5538 this->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8]) //&& dword_723E80_award_related[2 * a3] )
5554 && pAwards[var_value].pText ) 5539 && pAwards[var_value].pText )
5555 { 5540 {
5556 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5541 PlayAwardSound_Anim(currPlayerId);
5557 PlayAwardSound(currPlayerId);
5558 this->PlaySound(SPEECH_96, 0); 5542 this->PlaySound(SPEECH_96, 0);
5559 } 5543 }
5560 _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u); 5544 _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u);
5561 return; 5545 return;
5562 case VAR_Experience: 5546 case VAR_Experience:
5563 this->uExperience = var_value; 5547 this->uExperience = var_value;
5564 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5548 PlayAwardSound_Anim(currPlayerId);
5565 PlayAwardSound(currPlayerId);
5566 return; 5549 return;
5567 case VAR_QBits_QuestsDone: 5550 case VAR_QBits_QuestsDone:
5568 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3])// && (&dword_722F10)[4 * a3] ) 5551 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3])// && (&dword_722F10)[4 * a3] )
5569 && pQuestTable[var_value-1] ) 5552 && pQuestTable[var_value-1] )
5570 { 5553 {
5593 ShowStatusBarString(pTmpBuf.data(), 2u); 5576 ShowStatusBarString(pTmpBuf.data(), 2u);
5594 GameUI_DrawFoodAndGold(); 5577 GameUI_DrawFoodAndGold();
5595 return; 5578 return;
5596 case VAR_FixedFood: 5579 case VAR_FixedFood:
5597 Party::SetFood(var_value); 5580 Party::SetFood(var_value);
5598 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5581 PlayAwardSound_Anim(currPlayerId);
5599 PlayAwardSound(currPlayerId);
5600 return; 5582 return;
5601 case VAR_RandomFood: 5583 case VAR_RandomFood:
5602 v7 = rand() % var_value + 1; 5584 v7 = rand() % var_value + 1;
5603 Party::SetFood(v7); 5585 Party::SetFood(v7);
5604 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food 5586 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food
5605 ShowStatusBarString(pTmpBuf.data(), 2u); 5587 ShowStatusBarString(pTmpBuf.data(), 2u);
5606 GameUI_DrawFoodAndGold(); 5588 GameUI_DrawFoodAndGold();
5607 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5589 PlayAwardSound_Anim(currPlayerId);
5608 PlayAwardSound(currPlayerId);
5609 return; 5590 return;
5610 case VAR_BaseMight: 5591 case VAR_BaseMight:
5611 this->uMight = (unsigned __int8)var_value; 5592 this->uMight = (unsigned __int8)var_value;
5612 this->PlaySound(SPEECH_92, 0); 5593 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5613 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5614 PlayAwardSound(currPlayerId);
5615 return; 5594 return;
5616 case VAR_BaseIntellect: 5595 case VAR_BaseIntellect:
5617 this->uIntelligence = (unsigned __int8)var_value; 5596 this->uIntelligence = (unsigned __int8)var_value;
5618 this->PlaySound(SPEECH_92, 0); 5597 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5619 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5620 PlayAwardSound(currPlayerId);
5621 return; 5598 return;
5622 case VAR_BasePersonality: 5599 case VAR_BasePersonality:
5623 this->uWillpower = (unsigned __int8)var_value; 5600 this->uWillpower = (unsigned __int8)var_value;
5624 this->PlaySound(SPEECH_92, 0); 5601 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5625 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5626 PlayAwardSound(currPlayerId);
5627 return; 5602 return;
5628 case VAR_BaseEndurance: 5603 case VAR_BaseEndurance:
5629 this->uEndurance = (unsigned __int8)var_value; 5604 this->uEndurance = (unsigned __int8)var_value;
5630 this->PlaySound(SPEECH_92, 0); 5605 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5631 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5632 PlayAwardSound(currPlayerId);
5633 return; 5606 return;
5634 case VAR_BaseSpeed: 5607 case VAR_BaseSpeed:
5635 this->uSpeed = (unsigned __int8)var_value; 5608 this->uSpeed = (unsigned __int8)var_value;
5636 this->PlaySound(SPEECH_92, 0); 5609 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5637 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5638 PlayAwardSound(currPlayerId);
5639 return; 5610 return;
5640 case VAR_BaseAccuracy: 5611 case VAR_BaseAccuracy:
5641 this->uAccuracy = (unsigned __int8)var_value; 5612 this->uAccuracy = (unsigned __int8)var_value;
5642 this->PlaySound(SPEECH_92, 0); 5613 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5643 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5644 PlayAwardSound(currPlayerId);
5645 return; 5614 return;
5646 case VAR_BaseLuck: 5615 case VAR_BaseLuck:
5647 this->uLuck = (unsigned __int8)var_value; 5616 this->uLuck = (unsigned __int8)var_value;
5648 this->PlaySound(SPEECH_92, 0); 5617 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5649 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5650 PlayAwardSound(currPlayerId);
5651 return; 5618 return;
5652 case VAR_MightBonus: 5619 case VAR_MightBonus:
5653 case VAR_ActualMight: 5620 case VAR_ActualMight:
5654 this->uMightBonus = (unsigned __int8)var_value; 5621 this->uMightBonus = (unsigned __int8)var_value;
5655 this->PlaySound(SPEECH_91, 0); 5622 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5656 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5657 PlayAwardSound(currPlayerId);
5658 return; 5623 return;
5659 case VAR_IntellectBonus: 5624 case VAR_IntellectBonus:
5660 case VAR_ActualIntellect: 5625 case VAR_ActualIntellect:
5661 this->uIntelligenceBonus = (unsigned __int8)var_value; 5626 this->uIntelligenceBonus = (unsigned __int8)var_value;
5662 this->PlaySound(SPEECH_91, 0); 5627 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5663 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5664 PlayAwardSound(currPlayerId);
5665 return; 5628 return;
5666 case VAR_PersonalityBonus: 5629 case VAR_PersonalityBonus:
5667 case VAR_ActualPersonality: 5630 case VAR_ActualPersonality:
5668 this->uWillpowerBonus = (unsigned __int8)var_value; 5631 this->uWillpowerBonus = (unsigned __int8)var_value;
5669 this->PlaySound(SPEECH_91, 0); 5632 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5670 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5671 PlayAwardSound(currPlayerId);
5672 return; 5633 return;
5673 case VAR_EnduranceBonus: 5634 case VAR_EnduranceBonus:
5674 case VAR_ActualEndurance: 5635 case VAR_ActualEndurance:
5675 this->uEnduranceBonus = (unsigned __int8)var_value; 5636 this->uEnduranceBonus = (unsigned __int8)var_value;
5676 this->PlaySound(SPEECH_91, 0); 5637 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5677 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5678 PlayAwardSound(currPlayerId);
5679 return; 5638 return;
5680 case VAR_SpeedBonus: 5639 case VAR_SpeedBonus:
5681 case VAR_ActualSpeed: 5640 case VAR_ActualSpeed:
5682 this->uSpeedBonus = (unsigned __int8)var_value; 5641 this->uSpeedBonus = (unsigned __int8)var_value;
5683 this->PlaySound(SPEECH_91, 0); 5642 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5684 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5685 PlayAwardSound(currPlayerId);
5686 return; 5643 return;
5687 case VAR_AccuracyBonus: 5644 case VAR_AccuracyBonus:
5688 case VAR_ActualAccuracy: 5645 case VAR_ActualAccuracy:
5689 this->uAccuracyBonus = (unsigned __int8)var_value; 5646 this->uAccuracyBonus = (unsigned __int8)var_value;
5690 this->PlaySound(SPEECH_92, 0); 5647 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5691 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5692 PlayAwardSound(currPlayerId);
5693 return; 5648 return;
5694 case VAR_LuckBonus: 5649 case VAR_LuckBonus:
5695 case VAR_ActualLuck: 5650 case VAR_ActualLuck:
5696 this->uLuckBonus = (unsigned __int8)var_value; 5651 this->uLuckBonus = (unsigned __int8)var_value;
5697 this->PlaySound(SPEECH_92, 0); 5652 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5698 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5699 PlayAwardSound(currPlayerId);
5700 return; 5653 return;
5701 case VAR_FireResistance: 5654 case VAR_FireResistance:
5702 this->sResFireBase = (unsigned __int8)var_value; 5655 this->sResFireBase = (unsigned __int8)var_value;
5703 this->PlaySound(SPEECH_92, 0); 5656 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5704 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5705 PlayAwardSound(currPlayerId);
5706 return; 5657 return;
5707 case VAR_AirResistance: 5658 case VAR_AirResistance:
5708 this->sResAirBase = (unsigned __int8)var_value; 5659 this->sResAirBase = (unsigned __int8)var_value;
5709 this->PlaySound(SPEECH_92, 0); 5660 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5710 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5711 PlayAwardSound(currPlayerId);
5712 return; 5661 return;
5713 case VAR_WaterResistance: 5662 case VAR_WaterResistance:
5714 this->sResWaterBase = (unsigned __int8)var_value; 5663 this->sResWaterBase = (unsigned __int8)var_value;
5715 this->PlaySound(SPEECH_92, 0); 5664 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5716 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5717 PlayAwardSound(currPlayerId);
5718 return; 5665 return;
5719 case VAR_EarthResistance: 5666 case VAR_EarthResistance:
5720 this->sResEarthBase = (unsigned __int8)var_value; 5667 this->sResEarthBase = (unsigned __int8)var_value;
5721 this->PlaySound(SPEECH_92, 0); 5668 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5722 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5723 PlayAwardSound(currPlayerId);
5724 return; 5669 return;
5725 case VAR_SpiritResistance: 5670 case VAR_SpiritResistance:
5726 this->sResSpiritBase = (unsigned __int8)var_value; 5671 this->sResSpiritBase = (unsigned __int8)var_value;
5727 this->PlaySound(SPEECH_92, 0); 5672 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5728 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5729 PlayAwardSound(currPlayerId);
5730 return; 5673 return;
5731 case VAR_MindResistance: 5674 case VAR_MindResistance:
5732 this->sResMindBase = (unsigned __int8)var_value; 5675 this->sResMindBase = (unsigned __int8)var_value;
5733 this->PlaySound(SPEECH_92, 0); 5676 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5734 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5735 PlayAwardSound(currPlayerId);
5736 return; 5677 return;
5737 case VAR_BodyResistance: 5678 case VAR_BodyResistance:
5738 this->sResBodyBase = (unsigned __int8)var_value; 5679 this->sResBodyBase = (unsigned __int8)var_value;
5739 this->PlaySound(SPEECH_92, 0); 5680 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5740 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5741 PlayAwardSound(currPlayerId);
5742 return; 5681 return;
5743 case VAR_LightResistance: 5682 case VAR_LightResistance:
5744 this->sResLightBase = (unsigned __int8)var_value; 5683 this->sResLightBase = (unsigned __int8)var_value;
5745 this->PlaySound(SPEECH_92, 0); 5684 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5746 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5747 PlayAwardSound(currPlayerId);
5748 return; 5685 return;
5749 case VAR_DarkResistance: 5686 case VAR_DarkResistance:
5750 this->sResDarkBase = (unsigned __int8)var_value; 5687 this->sResDarkBase = (unsigned __int8)var_value;
5751 this->PlaySound(SPEECH_92, 0); 5688 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5752 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5753 PlayAwardSound(currPlayerId);
5754 return; 5689 return;
5755 case VAR_MagicResistance: 5690 case VAR_MagicResistance:
5756 this->sResMagicBase = (unsigned __int8)var_value; 5691 this->sResMagicBase = (unsigned __int8)var_value;
5757 this->PlaySound(SPEECH_92, 0); 5692 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_92);
5758 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5759 PlayAwardSound(currPlayerId);
5760 return; 5693 return;
5761 case VAR_FireResistanceBonus: 5694 case VAR_FireResistanceBonus:
5762 this->sResFireBonus = (unsigned __int8)var_value; 5695 this->sResFireBonus = (unsigned __int8)var_value;
5763 this->PlaySound(SPEECH_91, 0); 5696 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5764 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5765 PlayAwardSound(currPlayerId);
5766 return; 5697 return;
5767 case VAR_AirResistanceBonus: 5698 case VAR_AirResistanceBonus:
5768 this->sResAirBonus = (unsigned __int8)var_value; 5699 this->sResAirBonus = (unsigned __int8)var_value;
5769 this->PlaySound(SPEECH_91, 0); 5700 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5770 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5771 PlayAwardSound(currPlayerId);
5772 return; 5701 return;
5773 case VAR_WaterResistanceBonus: 5702 case VAR_WaterResistanceBonus:
5774 this->sResWaterBonus = (unsigned __int8)var_value; 5703 this->sResWaterBonus = (unsigned __int8)var_value;
5775 this->PlaySound(SPEECH_91, 0); 5704 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5776 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5777 PlayAwardSound(currPlayerId);
5778 return; 5705 return;
5779 case VAR_EarthResistanceBonus: 5706 case VAR_EarthResistanceBonus:
5780 this->sResEarthBonus = (unsigned __int8)var_value; 5707 this->sResEarthBonus = (unsigned __int8)var_value;
5781 this->PlaySound(SPEECH_91, 0); 5708 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5782 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5783 PlayAwardSound(currPlayerId);
5784 return; 5709 return;
5785 case VAR_SpiritResistanceBonus: 5710 case VAR_SpiritResistanceBonus:
5786 this->sResSpiritBonus = (unsigned __int8)var_value; 5711 this->sResSpiritBonus = (unsigned __int8)var_value;
5787 this->PlaySound(SPEECH_91, 0); 5712 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5788 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5789 PlayAwardSound(currPlayerId);
5790 return; 5713 return;
5791 case VAR_MindResistanceBonus: 5714 case VAR_MindResistanceBonus:
5792 this->sResMindBonus = (unsigned __int8)var_value; 5715 this->sResMindBonus = (unsigned __int8)var_value;
5793 this->PlaySound(SPEECH_91, 0); 5716 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5794 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5795 PlayAwardSound(currPlayerId);
5796 return; 5717 return;
5797 case VAR_BodyResistanceBonus: 5718 case VAR_BodyResistanceBonus:
5798 this->sResBodyBonus = (unsigned __int8)var_value; 5719 this->sResBodyBonus = (unsigned __int8)var_value;
5799 this->PlaySound(SPEECH_91, 0); 5720 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5800 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5801 PlayAwardSound(currPlayerId);
5802 return; 5721 return;
5803 case VAR_LightResistanceBonus: 5722 case VAR_LightResistanceBonus:
5804 this->sResLightBonus = (unsigned __int8)var_value; 5723 this->sResLightBonus = (unsigned __int8)var_value;
5805 this->PlaySound(SPEECH_91, 0); 5724 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5806 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5807 PlayAwardSound(currPlayerId);
5808 return; 5725 return;
5809 case VAR_DarkResistanceBonus: 5726 case VAR_DarkResistanceBonus:
5810 this->sResDarkBonus = (unsigned __int8)var_value; 5727 this->sResDarkBonus = (unsigned __int8)var_value;
5811 this->PlaySound(SPEECH_91, 0); 5728 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5812 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5813 PlayAwardSound(currPlayerId);
5814 return; 5729 return;
5815 case VAR_PhysicalResistanceBonus: 5730 case VAR_PhysicalResistanceBonus:
5816 Error("Physical res. bonus not used"); 5731 Error("Physical res. bonus not used");
5817 return; 5732 return;
5818 case VAR_MagicResistanceBonus: 5733 case VAR_MagicResistanceBonus:
5819 this->sResMagicBonus = (unsigned __int8)var_value; 5734 this->sResMagicBonus = (unsigned __int8)var_value;
5820 this->PlaySound(SPEECH_91, 0); 5735 PlayAwardSound_Anim_Face(currPlayerId, SPEECH_91);
5821 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5822 PlayAwardSound(currPlayerId);
5823 return; 5736 return;
5824 case VAR_Cursed: 5737 case VAR_Cursed:
5825 this->SetCondition(Condition_Cursed, 1); 5738 this->SetCondition(Condition_Cursed, 1);
5826 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5739 PlayAwardSound_Anim(currPlayerId);
5827 PlayAwardSound(currPlayerId);
5828 return; 5740 return;
5829 case VAR_Weak: 5741 case VAR_Weak:
5830 this->SetCondition(Condition_Weak, 1); 5742 this->SetCondition(Condition_Weak, 1);
5831 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5743 PlayAwardSound_Anim(currPlayerId);
5832 PlayAwardSound(currPlayerId);
5833 return; 5744 return;
5834 case VAR_Asleep: 5745 case VAR_Asleep:
5835 this->SetCondition(Condition_Sleep, 1); 5746 this->SetCondition(Condition_Sleep, 1);
5836 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5747 PlayAwardSound_Anim(currPlayerId);
5837 PlayAwardSound(currPlayerId);
5838 return; 5748 return;
5839 case VAR_Afraid: 5749 case VAR_Afraid:
5840 this->SetCondition(Condition_Fear, 1); 5750 this->SetCondition(Condition_Fear, 1);
5841 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5751 PlayAwardSound_Anim(currPlayerId);
5842 PlayAwardSound(currPlayerId);
5843 return; 5752 return;
5844 case VAR_Drunk: 5753 case VAR_Drunk:
5845 this->SetCondition(Condition_Drunk, 1); 5754 this->SetCondition(Condition_Drunk, 1);
5846 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5755 PlayAwardSound_Anim(currPlayerId);
5847 PlayAwardSound(currPlayerId);
5848 return; 5756 return;
5849 case VAR_Insane: 5757 case VAR_Insane:
5850 this->SetCondition(Condition_Insane, 1); 5758 this->SetCondition(Condition_Insane, 1);
5851 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5759 PlayAwardSound_Anim(currPlayerId);
5852 PlayAwardSound(currPlayerId);
5853 return; 5760 return;
5854 case VAR_PoisonedGreen: 5761 case VAR_PoisonedGreen:
5855 this->SetCondition(Condition_Poison1, 1); 5762 this->SetCondition(Condition_Poison1, 1);
5856 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5763 PlayAwardSound_Anim(currPlayerId);
5857 PlayAwardSound(currPlayerId);
5858 return; 5764 return;
5859 case VAR_DiseasedGreen: 5765 case VAR_DiseasedGreen:
5860 this->SetCondition(Condition_Disease1, 1); 5766 this->SetCondition(Condition_Disease1, 1);
5861 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5767 PlayAwardSound_Anim(currPlayerId);
5862 PlayAwardSound(currPlayerId);
5863 return; 5768 return;
5864 case VAR_PoisonedYellow: 5769 case VAR_PoisonedYellow:
5865 this->SetCondition(Condition_Poison2, 1); 5770 this->SetCondition(Condition_Poison2, 1);
5866 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5771 PlayAwardSound_Anim(currPlayerId);
5867 PlayAwardSound(currPlayerId);
5868 return; 5772 return;
5869 case VAR_DiseasedYellow: 5773 case VAR_DiseasedYellow:
5870 this->SetCondition(Condition_Disease2, 1); 5774 this->SetCondition(Condition_Disease2, 1);
5871 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5775 PlayAwardSound_Anim(currPlayerId);
5872 PlayAwardSound(currPlayerId);
5873 return; 5776 return;
5874 case VAR_PoisonedRed: 5777 case VAR_PoisonedRed:
5875 this->SetCondition(Condition_Poison3, 1); 5778 this->SetCondition(Condition_Poison3, 1);
5876 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5779 PlayAwardSound_Anim(currPlayerId);
5877 PlayAwardSound(currPlayerId);
5878 return; 5780 return;
5879 case VAR_DiseasedRed: 5781 case VAR_DiseasedRed:
5880 this->SetCondition(Condition_Disease3, 1); 5782 this->SetCondition(Condition_Disease3, 1);
5881 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5783 PlayAwardSound_Anim(currPlayerId);
5882 PlayAwardSound(currPlayerId);
5883 return; 5784 return;
5884 case VAR_Paralyzed: 5785 case VAR_Paralyzed:
5885 this->SetCondition(Condition_Paralyzed, 1); 5786 this->SetCondition(Condition_Paralyzed, 1);
5886 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5787 PlayAwardSound_Anim(currPlayerId);
5887 PlayAwardSound(currPlayerId);
5888 return; 5788 return;
5889 case VAR_Unconsious: 5789 case VAR_Unconsious:
5890 this->SetCondition(Condition_Unconcious, 1); 5790 this->SetCondition(Condition_Unconcious, 1);
5891 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5791 PlayAwardSound_Anim(currPlayerId);
5892 PlayAwardSound(currPlayerId);
5893 return; 5792 return;
5894 case VAR_Dead: 5793 case VAR_Dead:
5895 this->SetCondition(Condition_Dead, 1); 5794 this->SetCondition(Condition_Dead, 1);
5896 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5795 PlayAwardSound_Anim(currPlayerId);
5897 PlayAwardSound(currPlayerId);
5898 return; 5796 return;
5899 case VAR_Stoned: 5797 case VAR_Stoned:
5900 this->SetCondition(Condition_Pertified, 1); 5798 this->SetCondition(Condition_Pertified, 1);
5901 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5799 PlayAwardSound_Anim(currPlayerId);
5902 PlayAwardSound(currPlayerId);
5903 return; 5800 return;
5904 case VAR_Eradicated: 5801 case VAR_Eradicated:
5905 this->SetCondition(Condition_Eradicated, 1); 5802 this->SetCondition(Condition_Eradicated, 1);
5906 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5803 PlayAwardSound_Anim(currPlayerId);
5907 PlayAwardSound(currPlayerId);
5908 return; 5804 return;
5909 case VAR_MajorCondition: 5805 case VAR_MajorCondition:
5910 memset(this, 0, 0xA0u); 5806 memset(this, 0, 0xA0u);
5911 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5807 PlayAwardSound_Anim(currPlayerId);
5912 PlayAwardSound(currPlayerId);
5913 return; 5808 return;
5914 case VAR_AutoNotes: 5809 case VAR_AutoNotes:
5915 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3]) //&& (&dword_723718_autonote_related)[8 * a3] ) 5810 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3]) //&& (&dword_723718_autonote_related)[8 * a3] )
5916 && pAutonoteTxt[var_value-1].pText ) 5811 && pAutonoteTxt[var_value-1].pText )
5917 { 5812 {
5977 pParty->uNumArenaKnightWins = var_value; 5872 pParty->uNumArenaKnightWins = var_value;
5978 return; 5873 return;
5979 case VAR_ArenaWinsLord: 5874 case VAR_ArenaWinsLord:
5980 pParty->uNumArenaLordWins = var_value; 5875 pParty->uNumArenaLordWins = var_value;
5981 return; 5876 return;
5982 } 5877 case VAR_StaffSkill:
5983 5878 SetSkillByEvent(&Player::skillStaff, var_type, currPlayerId);
5984 if (var_type >= VAR_StaffSkill && var_type <= VAR_LearningSkill) 5879 return;
5985 { 5880 case VAR_SwordSkill:
5986 HIWORD(v15) = 0; 5881 SetSkillByEvent(&Player::skillSword, var_type, currPlayerId);
5987 5882 return;
5988 v16 = (int)((char *)&this->pConditions[16] + 2 * var_type); 5883 case VAR_DaggerSkill:
5989 v17 = *(char *)v16; 5884 SetSkillByEvent(&Player::skillDagger, var_type, currPlayerId);
5990 if ( var_value <= 63 ) 5885 return;
5991 { 5886 case VAR_AxeSkill:
5992 LOWORD(v15) = (unsigned __int8)var_value; 5887 SetSkillByEvent(&Player::skillAxe, var_type, currPlayerId);
5993 v18 = v15 | v17 & 63; 5888 return;
5994 } 5889 case VAR_SpearSkill:
5995 else 5890 SetSkillByEvent(&Player::skillSpear, var_type, currPlayerId);
5996 { 5891 return;
5997 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); 5892 case VAR_BowSkill:
5998 } 5893 SetSkillByEvent(&Player::skillBow, var_type, currPlayerId);
5999 *(short *)v16 = v18; 5894 return;
6000 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5895 case VAR_MaceSkill:
6001 PlayAwardSound(currPlayerId); 5896 SetSkillByEvent(&Player::skillMace, var_type, currPlayerId);
6002 return; 5897 return;
6003 } 5898 case VAR_BlasterSkill:
6004 5899 SetSkillByEvent(&Player::skillBlaster, var_type, currPlayerId);
5900 return;
5901 case VAR_ShieldSkill:
5902 SetSkillByEvent(&Player::skillShield, var_type, currPlayerId);
5903 return;
5904 case VAR_LeatherSkill:
5905 SetSkillByEvent(&Player::skillLeather, var_type, currPlayerId);
5906 return;
5907 case VAR_SkillChain:
5908 SetSkillByEvent(&Player::skillChain, var_type, currPlayerId);
5909 return;
5910 case VAR_PlateSkill:
5911 SetSkillByEvent(&Player::skillPlate, var_type, currPlayerId);
5912 return;
5913 case VAR_FireSkill:
5914 SetSkillByEvent(&Player::skillFire, var_type, currPlayerId);
5915 return;
5916 case VAR_AirSkill:
5917 SetSkillByEvent(&Player::skillAir, var_type, currPlayerId);
5918 return;
5919 case VAR_WaterSkill:
5920 SetSkillByEvent(&Player::skillWater, var_type, currPlayerId);
5921 return;
5922 case VAR_EarthSkill:
5923 SetSkillByEvent(&Player::skillEarth, var_type, currPlayerId);
5924 return;
5925 case VAR_SpiritSkill:
5926 SetSkillByEvent(&Player::skillSpirit, var_type, currPlayerId);
5927 return;
5928 case VAR_MindSkill:
5929 SetSkillByEvent(&Player::skillMind, var_type, currPlayerId);
5930 return;
5931 case VAR_BodySkill:
5932 SetSkillByEvent(&Player::skillBody, var_type, currPlayerId);
5933 return;
5934 case VAR_LightSkill:
5935 SetSkillByEvent(&Player::skillLight, var_type, currPlayerId);
5936 return;
5937 case VAR_DarkSkill:
5938 SetSkillByEvent(&Player::skillDark, var_type, currPlayerId);
5939 return;
5940 case VAR_IdentifyItemSkill:
5941 SetSkillByEvent(&Player::skillItemId, var_type, currPlayerId);
5942 return;
5943 case VAR_MerchantSkill:
5944 SetSkillByEvent(&Player::skillMerchant, var_type, currPlayerId);
5945 return;
5946 case VAR_RepairSkill:
5947 SetSkillByEvent(&Player::skillRepair, var_type, currPlayerId);
5948 return;
5949 case VAR_BodybuildingSkill:
5950 SetSkillByEvent(&Player::skillBodybuilding, var_type, currPlayerId);
5951 return;
5952 case VAR_MeditationSkill:
5953 SetSkillByEvent(&Player::skillMeditation, var_type, currPlayerId);
5954 return;
5955 case VAR_PerceptionSkill:
5956 SetSkillByEvent(&Player::skillPerception, var_type, currPlayerId);
5957 return;
5958 case VAR_DiplomacySkill:
5959 SetSkillByEvent(&Player::skillDiplomacy, var_type, currPlayerId);
5960 return;
5961 case VAR_ThieverySkill:
5962 Error ("Thieving unsupported");
5963 return;
5964 case VAR_DisarmTrapSkill:
5965 SetSkillByEvent(&Player::skillDisarmTrap, var_type, currPlayerId);
5966 return;
5967 case VAR_DodgeSkill:
5968 SetSkillByEvent(&Player::skillDodge, var_type, currPlayerId);
5969 return;
5970 case VAR_UnarmedSkill:
5971 SetSkillByEvent(&Player::skillUnarmed, var_type, currPlayerId);
5972 return;
5973 case VAR_IdentifyMonsterSkill:
5974 SetSkillByEvent(&Player::skillMonsterId, var_type, currPlayerId);
5975 return;
5976 case VAR_ArmsmasterSkill:
5977 SetSkillByEvent(&Player::skillArmsmaster, var_type, currPlayerId);
5978 return;
5979 case VAR_StealingSkill:
5980 SetSkillByEvent(&Player::skillStealing, var_type, currPlayerId);
5981 return;
5982 case VAR_AlchemySkill:
5983 SetSkillByEvent(&Player::skillAlchemy, var_type, currPlayerId);
5984 return;
5985 case VAR_LearningSkill:
5986 SetSkillByEvent(&Player::skillLearning, var_type, currPlayerId);
5987 return;
5988 }
6005 } 5989 }
6006 5990
6007 5991
6008 //----- (new function) -------------------------------------------------------- 5992 //----- (new function) --------------------------------------------------------
6009 void Player::PlayAwardSound(int currPlayerId) 5993 void Player::PlayAwardSound(int currPlayerId)
6011 signed int v25 = 8 * currPlayerId + 400; 5995 signed int v25 = 8 * currPlayerId + 400;
6012 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); 5996 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
6013 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); 5997 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
6014 } 5998 }
6015 5999
6000 //----- (new function) --------------------------------------------------------
6001 void Player::PlayAwardSound_Anim(int currPlayerId)
6002 {
6003 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
6004 PlayAwardSound(currPlayerId);
6005 }
6006
6007 //----- (new function) --------------------------------------------------------
6008 void Player::PlayAwardSound_Anim_Face(int currPlayerId, PlayerSpeech speech)
6009 {
6010 this->PlaySound(speech, 0);
6011 PlayAwardSound_Anim(currPlayerId);
6012 }
6013
6014 //----- (new function) --------------------------------------------------------
6016 void Player::SetSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 newSkillValue, int currPlayerId ) 6015 void Player::SetSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 newSkillValue, int currPlayerId )
6017 { 6016 {
6018 unsigned __int16 currSkillValue = this->*skillToSet; 6017 unsigned __int16 currSkillValue = this->*skillToSet;
6019 if ( newSkillValue > 63 ) //the original had the condition reversed which was probably wrong 6018 if ( newSkillValue > 63 ) //the original had the condition reversed which was probably wrong
6020 { 6019 {