Mercurial > mm7
comparison Player.cpp @ 1820:af7f08135ffb
Player::SubtractVariable changing return val to void, finishing cleanup
author | Grumpy7 |
---|---|
date | Tue, 08 Oct 2013 07:10:00 +0200 |
parents | 1641ab7f21ec |
children | 49a4db499c0a |
comparison
equal
deleted
inserted
replaced
1819:1641ab7f21ec | 1820:af7f08135ffb |
---|---|
4308 } | 4308 } |
4309 | 4309 |
4310 //----- (004908A8) -------------------------------------------------------- | 4310 //----- (004908A8) -------------------------------------------------------- |
4311 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | 4311 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) |
4312 { | 4312 { |
4313 if ( pConditions[uCondition] && (uTime < (signed long long)pConditions[uCondition]) ) | 4313 if ( pConditions[uCondition] && (uTime < (unsigned long long)pConditions[uCondition]) ) |
4314 { | 4314 { |
4315 pConditions[uCondition] = 0i64; | 4315 pConditions[uCondition] = 0i64; |
4316 return true; | 4316 return true; |
4317 } | 4317 } |
4318 else | 4318 else |
6584 PlayAwardSound_Anim97(currPlayerId); | 6584 PlayAwardSound_Anim97(currPlayerId); |
6585 return; | 6585 return; |
6586 } | 6586 } |
6587 | 6587 |
6588 //----- (0044B9C4) -------------------------------------------------------- | 6588 //----- (0044B9C4) -------------------------------------------------------- |
6589 bool Player::SubtractVariable(enum VariableType VarNum, signed int pValue) | 6589 void Player::SubtractVariable( enum VariableType VarNum, signed int pValue ) |
6590 { | 6590 { |
6591 unsigned int v3; // ebx@1 | 6591 signed int playerId; // esi@1 |
6592 signed int v4; // esi@1 | 6592 DDM_DLV_Header *locationHeader; // eax@90 |
6593 bool result; // eax@8 | 6593 int randGold; |
6594 int v6; // esi@11 | 6594 int randFood; |
6595 int v7; // edi@14 | 6595 int npcIndex; |
6596 signed int v8; // eax@17 | 6596 |
6597 char *v9; // eax@20 | 6597 playerId = 0; |
6598 char v10; // sf@20 | |
6599 char *v11; // ecx@26 | |
6600 char *v12; // ecx@27 | |
6601 __int64 v13; // qax@27 | |
6602 unsigned __int8 v14; // cf@27 | |
6603 int *v15; // edx@29 | |
6604 char *v16; // eax@90 | |
6605 char *v17; // ecx@94 | |
6606 int v18; // esi@97 | |
6607 signed int v19; // edx@97 | |
6608 char *v20; // ecx@98 | |
6609 int v21; // eax@100 | |
6610 __int16 v22; // dx@112 | |
6611 int v23; // [sp-8h] [bp-14h]@45 | |
6612 signed int v24; // [sp-4h] [bp-10h]@4 | |
6613 int v25; // [sp-4h] [bp-10h]@45 | |
6614 | |
6615 v4 = 0; | |
6616 if ( this == pPlayers[2] ) | 6598 if ( this == pPlayers[2] ) |
6617 v4 = 1; | 6599 playerId = 1; |
6618 else if ( this == pPlayers[3] ) | 6600 else if ( this == pPlayers[3] ) |
6619 v4 = 2; | 6601 playerId = 2; |
6620 else if ( this == pPlayers[4] ) | 6602 else if ( this == pPlayers[4] ) |
6621 v4 = 3; | 6603 playerId = 3; |
6622 | |
6623 | |
6624 | |
6625 | 6604 |
6626 if ( VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_99 ) | 6605 if ( VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_99 ) |
6627 { | 6606 { |
6628 | 6607 |
6629 byte_5E4C15[VarNum] -= (char)pValue; | 6608 byte_5E4C15[VarNum] -= (char)pValue; |
6630 return false; | 6609 return; |
6631 } | 6610 } |
6632 | 6611 |
6633 switch (VarNum) | 6612 switch (VarNum) |
6634 { | 6613 { |
6635 case VAR_NumDeaths: | 6614 case VAR_CurrentHP: |
6636 pParty->uNumDeaths -= (unsigned int)pValue; | 6615 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); |
6637 return pValue; | 6616 PlayAwardSound_Anim98(playerId); |
6617 return; | |
6618 case VAR_CurrentSP: | |
6619 this->sMana = max(this->sMana - pValue, 0); | |
6620 PlayAwardSound_Anim98(playerId); | |
6621 return; | |
6622 case VAR_ACModifier: | |
6623 this->sACModifier -= (unsigned __int8)pValue; | |
6624 PlayAwardSound_Anim98(playerId); | |
6625 return; | |
6626 case VAR_BaseLevel: | |
6627 this->uLevel -= (unsigned __int8)pValue; | |
6628 PlayAwardSound_Anim98(playerId); | |
6629 return; | |
6630 case VAR_LevelModifier: | |
6631 this->sLevelModifier -= (unsigned __int8)pValue; | |
6632 PlayAwardSound_Anim98(playerId); | |
6633 return; | |
6634 case VAR_Age: | |
6635 this->sAgeModifier -= (signed __int16)pValue; | |
6636 return; | |
6637 case VAR_Award: | |
6638 _449B7E_toggle_bit(this->_achieved_awards_bits, (signed __int16)pValue, 0); | |
6639 return; | |
6640 case VAR_Experience: | |
6641 this->uExperience -= pValue; | |
6642 PlayAwardSound_Anim98(playerId); | |
6643 return; | |
6644 case VAR_QBits_QuestsDone: | |
6645 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); | |
6646 this->PlaySound(SPEECH_96, 0); | |
6647 return; | |
6648 case VAR_PlayerItemInHands: | |
6649 for (int i = 0; i < 126; i++) | |
6650 { | |
6651 if ( this->pInventoryItemList[pInventoryMatrix[i]].uItemID == pValue ) | |
6652 { | |
6653 RemoveItemAtInventoryIndex(i); | |
6654 return; | |
6655 } | |
6656 } | |
6657 if ( pParty->pPickedItem.uItemID == pValue ) | |
6658 { | |
6659 pMouse->RemoveHoldingItem(); | |
6660 return; | |
6661 } | |
6662 return; | |
6663 case VAR_FixedGold: | |
6664 if ( (unsigned int)pValue > pParty->uNumGold ) | |
6665 { | |
6666 dword_5B65C4 = 1; | |
6667 return; | |
6668 } | |
6669 Party::TakeGold((unsigned int)pValue); | |
6670 return; | |
6671 case VAR_RandomGold: | |
6672 randGold = rand() % (signed int)pValue + 1; | |
6673 if ( (unsigned int)randGold > pParty->uNumGold ) | |
6674 randGold = pParty->uNumGold; | |
6675 Party::TakeGold(randGold); | |
6676 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], randGold); | |
6677 ShowStatusBarString(pTmpBuf.data(), 2); | |
6678 GameUI_DrawFoodAndGold(); | |
6679 return; | |
6680 case VAR_FixedFood: | |
6681 Party::TakeFood((unsigned int)pValue); | |
6682 PlayAwardSound_Anim98(playerId); | |
6683 return; | |
6684 case VAR_RandomFood: | |
6685 randFood = rand() % (signed int)pValue + 1; | |
6686 if ( (unsigned int)randFood > pParty->uNumFoodRations ) | |
6687 randFood = pParty->uNumFoodRations; | |
6688 Party::TakeFood(randFood); | |
6689 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], randFood); | |
6690 ShowStatusBarString(pTmpBuf.data(), 2u); | |
6691 GameUI_DrawFoodAndGold(); | |
6692 PlayAwardSound_Anim98(playerId); | |
6693 return; | |
6694 case VAR_MightBonus: | |
6695 case VAR_ActualMight: | |
6696 this->uMightBonus -= (unsigned __int16)pValue; | |
6697 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6698 return; | |
6699 case VAR_IntellectBonus: | |
6700 case VAR_ActualIntellect: | |
6701 this->uIntelligenceBonus -= (unsigned __int16)pValue; | |
6702 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6703 return; | |
6704 case VAR_PersonalityBonus: | |
6705 case VAR_ActualPersonality: | |
6706 this->uWillpowerBonus -= (unsigned __int16)pValue; | |
6707 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6708 return; | |
6709 case VAR_EnduranceBonus: | |
6710 case VAR_ActualEndurance: | |
6711 this->uEnduranceBonus -= (unsigned __int16)pValue; | |
6712 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6713 return; | |
6714 case VAR_SpeedBonus: | |
6715 case VAR_ActualSpeed: | |
6716 this->uSpeedBonus -= (unsigned __int16)pValue; | |
6717 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6718 return; | |
6719 case VAR_AccuracyBonus: | |
6720 case VAR_ActualAccuracy: | |
6721 this->uAccuracyBonus -= (unsigned __int16)pValue; | |
6722 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6723 return; | |
6724 case VAR_LuckBonus: | |
6725 case VAR_ActualLuck: | |
6726 this->uLuckBonus -= (unsigned __int16)pValue; | |
6727 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6728 return; | |
6729 case VAR_BaseMight: | |
6730 this->uMight -= (unsigned __int16)pValue; | |
6731 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6732 return; | |
6733 case VAR_BaseIntellect: | |
6734 this->uIntelligence -= (unsigned __int16)pValue; | |
6735 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6736 return; | |
6737 case VAR_BasePersonality: | |
6738 this->uWillpower -= (unsigned __int16)pValue; | |
6739 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6740 return; | |
6741 case VAR_BaseEndurance: | |
6742 this->uEndurance -= (unsigned __int16)pValue; | |
6743 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6744 return; | |
6745 case VAR_BaseSpeed: | |
6746 this->uSpeed -= (unsigned __int16)pValue; | |
6747 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6748 return; | |
6749 case VAR_BaseAccuracy: | |
6750 this->uAccuracy -= (unsigned __int16)pValue; | |
6751 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6752 return; | |
6753 case VAR_BaseLuck: | |
6754 this->uLuck -= (unsigned __int16)pValue; | |
6755 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6756 return; | |
6757 case VAR_FireResistance: | |
6758 this->sResFireBase -= (signed __int16)pValue; | |
6759 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6760 return; | |
6761 case VAR_AirResistance: | |
6762 this->sResAirBase -= (signed __int16)pValue; | |
6763 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6764 return; | |
6765 case VAR_WaterResistance: | |
6766 this->sResWaterBase -= (signed __int16)pValue; | |
6767 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6768 return; | |
6769 case VAR_EarthResistance: | |
6770 this->sResEarthBase -= (signed __int16)pValue; | |
6771 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6772 return; | |
6773 case VAR_SpiritResistance: | |
6774 this->sResSpiritBase -= (signed __int16)pValue; | |
6775 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6776 return; | |
6777 case VAR_MindResistance: | |
6778 this->sResMindBase -= (signed __int16)pValue; | |
6779 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6780 return; | |
6781 case VAR_BodyResistance: | |
6782 this->sResBodyBase -= (signed __int16)pValue; | |
6783 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6784 return; | |
6785 case VAR_LightResistance: | |
6786 this->sResLightBase -= (signed __int16)pValue; | |
6787 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6788 return; | |
6789 case VAR_DarkResistance: | |
6790 this->sResDarkBase -= (signed __int16)pValue; | |
6791 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6792 return; | |
6793 case VAR_MagicResistance: | |
6794 this->sResMagicBase -= (signed __int16)pValue; | |
6795 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6796 return; | |
6797 case VAR_FireResistanceBonus: | |
6798 this->sResFireBonus -= (signed __int16)pValue; | |
6799 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6800 return; | |
6801 case VAR_AirResistanceBonus: | |
6802 this->sResAirBonus -= (signed __int16)pValue; | |
6803 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_92); | |
6804 return; | |
6805 case VAR_WaterResistanceBonus: | |
6806 this->sResWaterBonus -= (signed __int16)pValue; | |
6807 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6808 return; | |
6809 case VAR_EarthResistanceBonus: | |
6810 this->sResEarthBonus -= (signed __int16)pValue; | |
6811 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6812 return; | |
6813 case VAR_SpiritResistanceBonus: | |
6814 this->sResSpiritBonus -= (signed __int16)pValue; | |
6815 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6816 return; | |
6817 case VAR_MindResistanceBonus: | |
6818 this->sResMindBonus -= (signed __int16)pValue; | |
6819 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6820 return; | |
6821 case VAR_BodyResistanceBonus: | |
6822 this->sResBodyBonus -= (signed __int16)pValue; | |
6823 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6824 return; | |
6825 case VAR_LightResistanceBonus: | |
6826 this->sResLightBonus -= (signed __int16)pValue; | |
6827 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6828 return; | |
6829 case VAR_DarkResistanceBonus: | |
6830 this->sResDarkBonus -= (signed __int16)pValue; | |
6831 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6832 return; | |
6833 case VAR_MagicResistanceBonus: | |
6834 this->sResMagicBonus -= (signed __int16)pValue; | |
6835 this->PlayAwardSound_Anim98_Face(playerId, SPEECH_91); | |
6836 return; | |
6837 case VAR_StaffSkill: | |
6838 this->skillStaff -= (unsigned __int8)pValue; | |
6839 PlayAwardSound_Anim98(playerId); | |
6840 return; | |
6841 case VAR_SwordSkill: | |
6842 this->skillSword -= (unsigned __int8)pValue; | |
6843 PlayAwardSound_Anim98(playerId); | |
6844 return; | |
6845 case VAR_DaggerSkill: | |
6846 this->skillDagger -= (unsigned __int8)pValue; | |
6847 PlayAwardSound_Anim98(playerId); | |
6848 return; | |
6849 case VAR_AxeSkill: | |
6850 this->skillAxe -= (unsigned __int8)pValue; | |
6851 PlayAwardSound_Anim98(playerId); | |
6852 return; | |
6853 case VAR_SpearSkill: | |
6854 this->skillSpear -= (unsigned __int8)pValue; | |
6855 PlayAwardSound_Anim98(playerId); | |
6856 return; | |
6857 case VAR_BowSkill: | |
6858 this->skillBow -= (unsigned __int8)pValue; | |
6859 PlayAwardSound_Anim98(playerId); | |
6860 return; | |
6861 case VAR_MaceSkill: | |
6862 this->skillMace -= (unsigned __int8)pValue; | |
6863 PlayAwardSound_Anim98(playerId); | |
6864 return; | |
6865 case VAR_BlasterSkill: | |
6866 this->skillBlaster -= (unsigned __int8)pValue; | |
6867 PlayAwardSound_Anim98(playerId); | |
6868 return; | |
6869 case VAR_ShieldSkill: | |
6870 this->skillShield -= (unsigned __int8)pValue; | |
6871 PlayAwardSound_Anim98(playerId); | |
6872 return; | |
6873 case VAR_LeatherSkill: | |
6874 this->skillLearning -= (unsigned __int8)pValue; | |
6875 PlayAwardSound_Anim98(playerId); | |
6876 return; | |
6877 case VAR_SkillChain: | |
6878 this->skillChain -= (unsigned __int8)pValue; | |
6879 PlayAwardSound_Anim98(playerId); | |
6880 return; | |
6881 case VAR_PlateSkill: | |
6882 this->skillPlate -= (unsigned __int8)pValue; | |
6883 PlayAwardSound_Anim98(playerId); | |
6884 return; | |
6885 case VAR_FireSkill: | |
6886 this->skillFire -= (unsigned __int8)pValue; | |
6887 PlayAwardSound_Anim98(playerId); | |
6888 return; | |
6889 case VAR_AirSkill: | |
6890 this->skillAir -= (unsigned __int8)pValue; | |
6891 PlayAwardSound_Anim98(playerId); | |
6892 return; | |
6893 case VAR_WaterSkill: | |
6894 this->skillWater -= (unsigned __int8)pValue; | |
6895 PlayAwardSound_Anim98(playerId); | |
6896 return; | |
6897 case VAR_EarthSkill: | |
6898 this->skillEarth -= (unsigned __int8)pValue; | |
6899 PlayAwardSound_Anim98(playerId); | |
6900 return; | |
6901 case VAR_SpiritSkill: | |
6902 this->skillSpirit -= (unsigned __int8)pValue; | |
6903 PlayAwardSound_Anim98(playerId); | |
6904 return; | |
6905 case VAR_MindSkill: | |
6906 this->skillMind -= (unsigned __int8)pValue; | |
6907 PlayAwardSound_Anim98(playerId); | |
6908 return; | |
6909 case VAR_BodySkill: | |
6910 this->skillBody -= (unsigned __int8)pValue; | |
6911 PlayAwardSound_Anim98(playerId); | |
6912 return; | |
6913 case VAR_LightSkill: | |
6914 this->skillLight -= (unsigned __int8)pValue; | |
6915 PlayAwardSound_Anim98(playerId); | |
6916 return; | |
6917 case VAR_DarkSkill: | |
6918 this->skillDark -= (unsigned __int8)pValue; | |
6919 PlayAwardSound_Anim98(playerId); | |
6920 return; | |
6921 case VAR_IdentifyItemSkill: | |
6922 this->skillItemId -= (unsigned __int8)pValue; | |
6923 PlayAwardSound_Anim98(playerId); | |
6924 return; | |
6925 case VAR_MerchantSkill: | |
6926 this->skillMerchant -= (unsigned __int8)pValue; | |
6927 PlayAwardSound_Anim98(playerId); | |
6928 return; | |
6929 case VAR_RepairSkill: | |
6930 this->skillRepair -= (unsigned __int8)pValue; | |
6931 PlayAwardSound_Anim98(playerId); | |
6932 return; | |
6933 case VAR_BodybuildingSkill: | |
6934 this->skillBodybuilding -= (unsigned __int8)pValue; | |
6935 PlayAwardSound_Anim98(playerId); | |
6936 return; | |
6937 case VAR_MeditationSkill: | |
6938 this->skillMeditation -= (unsigned __int8)pValue; | |
6939 PlayAwardSound_Anim98(playerId); | |
6940 return; | |
6941 case VAR_PerceptionSkill: | |
6942 this->skillPerception -= (unsigned __int8)pValue; | |
6943 PlayAwardSound_Anim98(playerId); | |
6944 return; | |
6945 case VAR_DiplomacySkill: | |
6946 this->skillDiplomacy -= (unsigned __int8)pValue; | |
6947 PlayAwardSound_Anim98(playerId); | |
6948 return; | |
6949 case VAR_DisarmTrapSkill: | |
6950 this->skillDisarmTrap -= (unsigned __int8)pValue; | |
6951 PlayAwardSound_Anim98(playerId); | |
6952 return; | |
6953 case VAR_DodgeSkill: | |
6954 this->skillDodge -= (unsigned __int8)pValue; | |
6955 PlayAwardSound_Anim98(playerId); | |
6956 return; | |
6957 case VAR_UnarmedSkill: | |
6958 this->skillUnarmed -= (unsigned __int8)pValue; | |
6959 PlayAwardSound_Anim98(playerId); | |
6960 return; | |
6961 case VAR_IdentifyMonsterSkill: | |
6962 this->skillMonsterId -= (unsigned __int8)pValue; | |
6963 PlayAwardSound_Anim98(playerId); | |
6964 return; | |
6965 case VAR_ArmsmasterSkill: | |
6966 this->skillArmsmaster -= (unsigned __int8)pValue; | |
6967 PlayAwardSound_Anim98(playerId); | |
6968 return; | |
6969 case VAR_StealingSkill: | |
6970 this->skillStealing -= (unsigned __int8)pValue; | |
6971 PlayAwardSound_Anim98(playerId); | |
6972 return; | |
6973 case VAR_AlchemySkill: | |
6974 this->skillAlchemy -= (unsigned __int8)pValue; | |
6975 PlayAwardSound_Anim98(playerId); | |
6976 return; | |
6977 case VAR_LearningSkill: | |
6978 this->skillLearning -= (unsigned __int8)pValue; | |
6979 PlayAwardSound_Anim98(playerId); | |
6980 return; | |
6981 case VAR_Cursed: | |
6982 this->pConditions[Condition_Cursed] = 0; | |
6983 PlayAwardSound_Anim98(playerId); | |
6984 return; | |
6985 case VAR_Weak: | |
6986 this->pConditions[Condition_Weak] = 0; | |
6987 PlayAwardSound_Anim98(playerId); | |
6988 return; | |
6989 case VAR_Asleep: | |
6990 this->pConditions[Condition_Sleep] = 0; | |
6991 PlayAwardSound_Anim98(playerId); | |
6992 return; | |
6993 case VAR_Afraid: | |
6994 this->pConditions[Condition_Fear] = 0; | |
6995 PlayAwardSound_Anim98(playerId); | |
6996 return; | |
6997 case VAR_Drunk: | |
6998 this->pConditions[Condition_Drunk] = 0; | |
6999 PlayAwardSound_Anim98(playerId); | |
7000 return; | |
7001 case VAR_Insane: | |
7002 this->pConditions[Condition_Insane] = 0; | |
7003 PlayAwardSound_Anim98(playerId); | |
7004 return; | |
7005 case VAR_PoisonedGreen: | |
7006 this->pConditions[Condition_Poison1] = 0; | |
7007 PlayAwardSound_Anim98(playerId); | |
7008 return; | |
7009 case VAR_DiseasedGreen: | |
7010 this->pConditions[Condition_Disease1] = 0; | |
7011 PlayAwardSound_Anim98(playerId); | |
7012 return; | |
7013 case VAR_PoisonedYellow: | |
7014 this->pConditions[Condition_Poison2] = 0; | |
7015 PlayAwardSound_Anim98(playerId); | |
7016 return; | |
7017 case VAR_DiseasedYellow: | |
7018 this->pConditions[Condition_Disease2] = 0; | |
7019 PlayAwardSound_Anim98(playerId); | |
7020 return; | |
7021 case VAR_PoisonedRed: | |
7022 this->pConditions[Condition_Poison3] = 0; | |
7023 PlayAwardSound_Anim98(playerId); | |
7024 return; | |
7025 case VAR_DiseasedRed: | |
7026 this->pConditions[Condition_Disease3] = 0; | |
7027 PlayAwardSound_Anim98(playerId); | |
7028 return; | |
7029 case VAR_Paralyzed: | |
7030 this->pConditions[Condition_Paralyzed] = 0; | |
7031 PlayAwardSound_Anim98(playerId); | |
7032 return; | |
7033 case VAR_Unconsious: | |
7034 this->pConditions[Condition_Unconcious] = 0; | |
7035 PlayAwardSound_Anim98(playerId); | |
7036 return; | |
7037 case VAR_Dead: | |
7038 this->pConditions[Condition_Dead] = 0; | |
7039 PlayAwardSound_Anim98(playerId); | |
7040 return; | |
7041 case VAR_Stoned: | |
7042 this->pConditions[Condition_Pertified] = 0; | |
7043 PlayAwardSound_Anim98(playerId); | |
7044 return; | |
7045 case VAR_Eradicated: | |
7046 this->pConditions[Condition_Eradicated] = 0; | |
7047 PlayAwardSound_Anim98(playerId); | |
7048 return; | |
6638 case VAR_AutoNotes: | 7049 case VAR_AutoNotes: |
6639 v11 = (char *)pParty->_autonote_bits; | 7050 _449B7E_toggle_bit(pParty->_autonote_bits, pValue - 1, 0); |
6640 v22 = (short)pValue - 1; | 7051 return; |
6641 _449B7E_toggle_bit((unsigned char *)v11, v22, 0); | |
6642 return result; | |
6643 | |
6644 case VAR_NPCs2: | 7052 case VAR_NPCs2: |
6645 v18 = 0; | 7053 npcIndex = 0; |
6646 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &v18); | 7054 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &npcIndex); |
6647 result = (bool) pValue; | 7055 if ( npcIndex == pValue ) |
6648 if ( v18 == pValue ) | |
6649 { | 7056 { |
6650 npcIdToDismissAfterDialogue = pValue; | 7057 npcIdToDismissAfterDialogue = pValue; |
6651 } | 7058 } |
6652 else | 7059 else |
6653 { | 7060 { |
6655 pParty->hirelingScrollPosition = 0; | 7062 pParty->hirelingScrollPosition = 0; |
6656 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; | 7063 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
6657 pParty->CountHirelings(); | 7064 pParty->CountHirelings(); |
6658 viewparams->bRedrawGameUI = true; | 7065 viewparams->bRedrawGameUI = true; |
6659 } | 7066 } |
6660 return result; | 7067 return; |
6661 break; | |
6662 case VAR_HiredNPCHasSpeciality: | 7068 case VAR_HiredNPCHasSpeciality: |
6663 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | 7069 for (unsigned int i = 0; i < pNPCStats->uNumNewNPCs; i++) |
6664 { | 7070 { |
6665 v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; | 7071 if (pNPCStats->pNewNPCData[i].uProfession == pValue) |
6666 for ( v19 = 0; v19 < (signed int)pNPCStats->uNumNewNPCs; ++v19 ) | |
6667 { | 7072 { |
6668 if ( *((void **)v20 + 4) == (void *)pValue ) | 7073 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; |
6669 { | |
6670 v21 = *(int *)v20; | |
6671 if ( (char)*(int *)v20 < 0 ) | |
6672 { | |
6673 LOBYTE(v21) = v21 & 0x7F; | |
6674 *(int *)v20 = v21; | |
6675 } | |
6676 } | |
6677 v20 += 76; | |
6678 } | 7074 } |
6679 } | 7075 } |
6680 if ( pParty->pHirelings[0].uProfession == pValue ) | 7076 if ( pParty->pHirelings[0].uProfession == pValue ) |
6681 memset(pParty->pHirelings, 0, 0x4Cu); | 7077 memset(pParty->pHirelings, 0, sizeof(NPCData)); |
6682 if ( pParty->pHirelings[1].uProfession == pValue ) | 7078 if ( pParty->pHirelings[1].uProfession == pValue ) |
6683 memset(&pParty->pHirelings[1], 0, 0x4Cu); | 7079 memset(&pParty->pHirelings[1], 0, sizeof(NPCData)); |
6684 pParty->hirelingScrollPosition = 0; | 7080 pParty->hirelingScrollPosition = 0; |
6685 pParty->CountHirelings(); | 7081 pParty->CountHirelings(); |
6686 return result; | 7082 return; |
6687 break; | |
6688 | |
6689 case VAR_NumSkillPoints: | 7083 case VAR_NumSkillPoints: |
6690 v17 = (char *)&this->uSkillPoints; | 7084 if ((unsigned int)pValue <= this->uSkillPoints) |
6691 result = *v17 != NULL; | 7085 { |
6692 if ( (unsigned int)pValue <= *(int *)v17 ) | 7086 this->uSkillPoints -= pValue; |
6693 { | |
6694 *(int *)v17 -= (int)pValue; | |
6695 result = (v17 != NULL); | |
6696 } | 7087 } |
6697 else | 7088 else |
6698 *(int *)v17 = 0; | 7089 { |
6699 return result; | 7090 this->uSkillPoints = 0; |
6700 break; | 7091 } |
7092 return; | |
6701 case VAR_ReputationInCurrentLocation: | 7093 case VAR_ReputationInCurrentLocation: |
6702 v16 = (char *)&pOutdoor->ddm; | 7094 locationHeader = &pOutdoor->ddm; |
6703 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | 7095 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) |
6704 v16 = (char *)&pIndoor->dlv; | 7096 locationHeader = &pIndoor->dlv; |
6705 *((int *)v16 + 2) -= (int)pValue; | 7097 locationHeader->uReputation -= pValue; |
6706 if ( *((int *)v16 + 2) < -10000 ) | 7098 if (locationHeader->uReputation < -10000) |
6707 *((int *)v16 + 2) = -10000; | 7099 locationHeader->uReputation = -10000; |
6708 return result; | 7100 return; |
6709 break; | |
6710 case VAR_GoldInBank: | 7101 case VAR_GoldInBank: |
6711 result = VarNum - 306; | |
6712 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) | 7102 if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) |
6713 { | 7103 { |
6714 result = (bool)pValue; | |
6715 pParty->uNumGoldInBank -= (unsigned int)pValue; | 7104 pParty->uNumGoldInBank -= (unsigned int)pValue; |
6716 } | 7105 } |
6717 else | 7106 else |
6718 { | 7107 { |
6719 dword_5B65C4 = 1; | 7108 dword_5B65C4 = 1; |
6720 } | 7109 } |
6721 return result; | 7110 return; |
6722 break; | 7111 case VAR_NumDeaths: |
6723 | 7112 pParty->uNumDeaths -= (unsigned int)pValue; |
6724 | 7113 return; |
6725 case VAR_NumBounties: | 7114 case VAR_NumBounties: |
6726 result = (bool)pValue; | |
6727 pParty->uNumBountiesCollected -= (unsigned int)pValue; | 7115 pParty->uNumBountiesCollected -= (unsigned int)pValue; |
6728 break; | 7116 return; |
6729 case VAR_PrisonTerms: | 7117 case VAR_PrisonTerms: |
6730 result = (bool)pValue; | |
6731 pParty->uNumPrisonTerms -= (int)pValue; | 7118 pParty->uNumPrisonTerms -= (int)pValue; |
6732 break; | 7119 return; |
6733 case VAR_ArenaWinsPage: | 7120 case VAR_ArenaWinsPage: |
6734 result = (bool)pValue; | |
6735 pParty->uNumArenaPageWins -= (char)pValue; | 7121 pParty->uNumArenaPageWins -= (char)pValue; |
6736 break; | 7122 return; |
6737 case VAR_ArenaWinsSquire: | 7123 case VAR_ArenaWinsSquire: |
6738 result = (bool)pValue; | |
6739 pParty->uNumArenaSquireWins -= (char)pValue; | 7124 pParty->uNumArenaSquireWins -= (char)pValue; |
6740 break; | 7125 return; |
6741 case VAR_ArenaWinsKnight: | 7126 case VAR_ArenaWinsKnight: |
6742 result = (bool)pValue; | |
6743 pParty->uNumArenaKnightWins -= (char)pValue; | 7127 pParty->uNumArenaKnightWins -= (char)pValue; |
6744 break; | 7128 return; |
6745 case VAR_ArenaWinsLord: | 7129 case VAR_ArenaWinsLord: |
6746 result = (bool)pValue; | |
6747 pParty->uNumArenaLordWins -= (char)pValue; | 7130 pParty->uNumArenaLordWins -= (char)pValue; |
6748 break; | 7131 return; |
6749 | 7132 } |
6750 | |
6751 case VAR_RandomGold: | |
6752 v6 = rand() % (signed int)pValue + 1; | |
6753 if ( v6 > pParty->uNumGold ) | |
6754 v6 = pParty->uNumGold; | |
6755 Party::TakeGold(v6); | |
6756 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6); | |
6757 ShowStatusBarString(pTmpBuf.data(), 2); | |
6758 GameUI_DrawFoodAndGold(); | |
6759 return result; | |
6760 case VAR_RandomFood: | |
6761 v7 = rand() % (signed int)pValue + 1; | |
6762 if ( v7 > pParty->uNumFoodRations ) | |
6763 v7 = pParty->uNumFoodRations; | |
6764 Party::TakeFood(v7); | |
6765 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); | |
6766 ShowStatusBarString(pTmpBuf.data(), 2u); | |
6767 GameUI_DrawFoodAndGold(); | |
6768 PlayAwardSound_Anim98(v4); | |
6769 return result; | |
6770 case VAR_CurrentHP: | |
6771 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); | |
6772 PlayAwardSound_Anim98(v4); | |
6773 return result; | |
6774 case VAR_CurrentSP: | |
6775 this->sMana = max(this->sMana - pValue, 0); | |
6776 PlayAwardSound_Anim98(v4); | |
6777 return result; | |
6778 case VAR_ACModifier: | |
6779 this->sACModifier -= (unsigned __int8)pValue; | |
6780 PlayAwardSound_Anim98(v4); | |
6781 return result; | |
6782 case VAR_BaseLevel: | |
6783 this->uLevel -= (unsigned __int8)pValue; | |
6784 PlayAwardSound_Anim98(v4); | |
6785 return result; | |
6786 case VAR_LevelModifier: | |
6787 this->sLevelModifier -= (unsigned __int8)pValue; | |
6788 PlayAwardSound_Anim98(v4); | |
6789 return result; | |
6790 case VAR_Age: | |
6791 this->sAgeModifier -= (signed __int16)pValue; | |
6792 return result; | |
6793 case VAR_Award: | |
6794 _449B7E_toggle_bit(this->_achieved_awards_bits, (signed __int16)pValue, 0); | |
6795 return result; | |
6796 case VAR_Experience: | |
6797 this->uExperience -= pValue; | |
6798 PlayAwardSound_Anim98(v4); | |
6799 return result; | |
6800 case VAR_QBits_QuestsDone: | |
6801 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); | |
6802 this->PlaySound(SPEECH_96, 0); | |
6803 return true; | |
6804 case VAR_PlayerItemInHands: | |
6805 for (v3 = 0; v3 < 126; v3++) | |
6806 { | |
6807 if ( this->pInventoryItemList[pInventoryMatrix[v3]].uItemID == pValue ) | |
6808 { | |
6809 RemoveItemAtInventoryIndex(v3); | |
6810 return true; | |
6811 } | |
6812 } | |
6813 if ( pParty->pPickedItem.uItemID == pValue ) | |
6814 { | |
6815 pMouse->RemoveHoldingItem(); | |
6816 return true; | |
6817 } | |
6818 return false; | |
6819 break; | |
6820 case VAR_FixedGold: | |
6821 if ( (unsigned int)pValue > pParty->uNumGold ) | |
6822 { | |
6823 dword_5B65C4 = 1; | |
6824 return result; | |
6825 } | |
6826 Party::TakeGold((unsigned int)pValue); | |
6827 return result; | |
6828 case VAR_MightBonus: | |
6829 case VAR_ActualMight: | |
6830 this->uMightBonus -= (unsigned __int16)pValue; | |
6831 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6832 return result; | |
6833 case VAR_IntellectBonus: | |
6834 case VAR_ActualIntellect: | |
6835 this->uIntelligenceBonus -= (unsigned __int16)pValue; | |
6836 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6837 return result; | |
6838 case VAR_PersonalityBonus: | |
6839 case VAR_ActualPersonality: | |
6840 this->uWillpowerBonus -= (unsigned __int16)pValue; | |
6841 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6842 return result; | |
6843 case VAR_EnduranceBonus: | |
6844 case VAR_ActualEndurance: | |
6845 this->uEnduranceBonus -= (unsigned __int16)pValue; | |
6846 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6847 return result; | |
6848 case VAR_SpeedBonus: | |
6849 case VAR_ActualSpeed: | |
6850 this->uSpeedBonus -= (unsigned __int16)pValue; | |
6851 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6852 return result; | |
6853 case VAR_AccuracyBonus: | |
6854 case VAR_ActualAccuracy: | |
6855 this->uAccuracyBonus -= (unsigned __int16)pValue; | |
6856 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6857 return result; | |
6858 case VAR_LuckBonus: | |
6859 case VAR_ActualLuck: | |
6860 this->uLuckBonus -= (unsigned __int16)pValue; | |
6861 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6862 return result; | |
6863 case VAR_BaseMight: | |
6864 this->uMight -= (unsigned __int16)pValue; | |
6865 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6866 return result; | |
6867 case VAR_BaseIntellect: | |
6868 this->uIntelligence -= (unsigned __int16)pValue; | |
6869 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6870 return result; | |
6871 case VAR_BasePersonality: | |
6872 this->uWillpower -= (unsigned __int16)pValue; | |
6873 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6874 return result; | |
6875 case VAR_BaseEndurance: | |
6876 this->uEndurance -= (unsigned __int16)pValue; | |
6877 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6878 return result; | |
6879 case VAR_BaseSpeed: | |
6880 this->uSpeed -= (unsigned __int16)pValue; | |
6881 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6882 return result; | |
6883 case VAR_BaseAccuracy: | |
6884 this->uAccuracy -= (unsigned __int16)pValue; | |
6885 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6886 return result; | |
6887 case VAR_BaseLuck: | |
6888 this->uLuck -= (unsigned __int16)pValue; | |
6889 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6890 return result; | |
6891 case VAR_FireResistance: | |
6892 this->sResFireBase -= (signed __int16)pValue; | |
6893 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6894 return result; | |
6895 case VAR_AirResistance: | |
6896 this->sResAirBase -= (signed __int16)pValue; | |
6897 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6898 return result; | |
6899 case VAR_WaterResistance: | |
6900 this->sResWaterBase -= (signed __int16)pValue; | |
6901 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6902 return result; | |
6903 case VAR_EarthResistance: | |
6904 this->sResEarthBase -= (signed __int16)pValue; | |
6905 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6906 return result; | |
6907 case VAR_SpiritResistance: | |
6908 this->sResSpiritBase -= (signed __int16)pValue; | |
6909 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6910 return result; | |
6911 case VAR_MindResistance: | |
6912 this->sResMindBase -= (signed __int16)pValue; | |
6913 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6914 return result; | |
6915 case VAR_BodyResistance: | |
6916 this->sResBodyBase -= (signed __int16)pValue; | |
6917 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6918 return result; | |
6919 case VAR_LightResistance: | |
6920 this->sResLightBase -= (signed __int16)pValue; | |
6921 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6922 return result; | |
6923 case VAR_DarkResistance: | |
6924 this->sResDarkBase -= (signed __int16)pValue; | |
6925 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6926 return result; | |
6927 case VAR_MagicResistance: | |
6928 this->sResMagicBase -= (signed __int16)pValue; | |
6929 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6930 return result; | |
6931 case VAR_FireResistanceBonus: | |
6932 this->sResFireBonus -= (signed __int16)pValue; | |
6933 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6934 return result; | |
6935 case VAR_AirResistanceBonus: | |
6936 this->sResAirBonus -= (signed __int16)pValue; | |
6937 this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); | |
6938 return result; | |
6939 case VAR_WaterResistanceBonus: | |
6940 this->sResWaterBonus -= (signed __int16)pValue; | |
6941 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6942 return result; | |
6943 case VAR_EarthResistanceBonus: | |
6944 this->sResEarthBonus -= (signed __int16)pValue; | |
6945 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6946 return result; | |
6947 case VAR_SpiritResistanceBonus: | |
6948 this->sResSpiritBonus -= (signed __int16)pValue; | |
6949 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6950 return result; | |
6951 case VAR_MindResistanceBonus: | |
6952 this->sResMindBonus -= (signed __int16)pValue; | |
6953 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6954 return result; | |
6955 case VAR_BodyResistanceBonus: | |
6956 this->sResBodyBonus -= (signed __int16)pValue; | |
6957 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6958 return result; | |
6959 case VAR_LightResistanceBonus: | |
6960 this->sResLightBonus -= (signed __int16)pValue; | |
6961 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6962 return result; | |
6963 case VAR_DarkResistanceBonus: | |
6964 this->sResDarkBonus -= (signed __int16)pValue; | |
6965 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6966 return result; | |
6967 case VAR_MagicResistanceBonus: | |
6968 this->sResMagicBonus -= (signed __int16)pValue; | |
6969 this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); | |
6970 return result; | |
6971 case VAR_FixedFood: | |
6972 Party::TakeFood((unsigned int)pValue); | |
6973 PlayAwardSound_Anim98(v4); | |
6974 return result; | |
6975 case VAR_StaffSkill: | |
6976 case VAR_SwordSkill: | |
6977 case VAR_DaggerSkill: | |
6978 case VAR_AxeSkill: | |
6979 case VAR_SpearSkill: | |
6980 case VAR_BowSkill: | |
6981 case VAR_MaceSkill: | |
6982 case VAR_BlasterSkill: | |
6983 case VAR_ShieldSkill: | |
6984 case VAR_LeatherSkill: | |
6985 case VAR_SkillChain: | |
6986 case VAR_PlateSkill: | |
6987 case VAR_FireSkill: | |
6988 case VAR_AirSkill: | |
6989 case VAR_WaterSkill: | |
6990 case VAR_EarthSkill: | |
6991 case VAR_SpiritSkill: | |
6992 case VAR_MindSkill: | |
6993 case VAR_BodySkill: | |
6994 case VAR_LightSkill: | |
6995 case VAR_DarkSkill: | |
6996 case VAR_IdentifyItemSkill: | |
6997 case VAR_MerchantSkill: | |
6998 case VAR_RepairSkill: | |
6999 case VAR_BodybuildingSkill: | |
7000 case VAR_MeditationSkill: | |
7001 case VAR_PerceptionSkill: | |
7002 case VAR_DiplomacySkill: | |
7003 case VAR_DisarmTrapSkill: | |
7004 case VAR_LearningSkill: | |
7005 *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; | |
7006 PlayAwardSound_Anim98(v4); | |
7007 return result; | |
7008 case VAR_Cursed: | |
7009 case VAR_Weak: | |
7010 case VAR_Asleep: | |
7011 case VAR_Afraid: | |
7012 case VAR_Drunk: | |
7013 case VAR_Insane: | |
7014 case VAR_PoisonedGreen: | |
7015 case VAR_DiseasedGreen: | |
7016 case VAR_PoisonedYellow: | |
7017 case VAR_DiseasedYellow: | |
7018 case VAR_PoisonedRed: | |
7019 case VAR_DiseasedRed: | |
7020 case VAR_Paralyzed: | |
7021 case VAR_Unconsious: | |
7022 case VAR_Dead: | |
7023 case VAR_Stoned: | |
7024 case VAR_Eradicated: | |
7025 this->pConditions[VarNum] = 0; | |
7026 PlayAwardSound_Anim98(v4); | |
7027 return result; | |
7028 } | |
7029 return false; | |
7030 } | 7133 } |
7031 // 5B65C4: using guessed type int dword_5B65C4; | 7134 // 5B65C4: using guessed type int dword_5B65C4; |
7032 // 5B65CC: using guessed type int dword_5B65CC; | 7135 // 5B65CC: using guessed type int dword_5B65CC; |
7033 | 7136 |
7034 //----- (new function) -------------------------------------------------------- | 7137 //----- (new function) -------------------------------------------------------- |