Mercurial > might-and-magic-trilogy
changeset 144:38a1c8ef6874
25.11.12
author | Ritor1 |
---|---|
date | Sun, 25 Nov 2012 00:09:29 +0600 |
parents | 163719cd2aca |
children | 20c034b5a6e2 d1ea5dda614d |
files | Player.cpp Player.h |
diffstat | 2 files changed, 45 insertions(+), 88 deletions(-) [+] |
line wrap: on
line diff
--- a/Player.cpp Sat Nov 24 18:25:13 2012 +0600 +++ b/Player.cpp Sun Nov 25 00:09:29 2012 +0600 @@ -6624,21 +6624,13 @@ //----- (0049048D) -------------------------------------------------------- //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute) -unsigned __int16 Player::DecreaseAttribute(int eAttribute) +void Player::DecreaseAttribute(int eAttribute) { int v2; // eax@1 - //Player *pPlayer; // edx@1 int pBaseValue; // ecx@1 int pDroppedStep; // ebx@1 int pStep; // esi@1 unsigned __int16 result; // ax@7 - //int v8; // edi@8 - //int v9; // edi@12 - //int v10; // edi@16 - //int v11; // edi@20 - //int v12; // edi@24 - //int v13; // edi@28 - //int v14; // edi@32 int uMinValue; // [sp+Ch] [bp-4h]@1 v2 = eAttribute + 7 * GetRace(); @@ -6646,95 +6638,51 @@ pDroppedStep = stru_4ED7B0.race[0].attr[v2].uDroppedStep; uMinValue = pBaseValue - 2; pStep = stru_4ED7B0.race[0].attr[v2].uBaseStep; - if ( eAttribute ) - { switch ( eAttribute ) { - case 1: //Intelligence - result = this->uIntelligence; - //v13 = this->uIntelligence; - if ( result <= pBaseValue ) + case CHARACTER_MIGHT: + if ( this->uMight <= pBaseValue ) + pStep = pDroppedStep; + if ( this->uMight - pStep >= uMinValue ) + this->uMight -= pStep; + break; + case CHARACTER_INTELLIGANCE: + if ( this->uIntelligence <= pBaseValue ) pStep = pDroppedStep; if ( this->uIntelligence - pStep >= uMinValue ) - { - result -= pStep; - this->uIntelligence = result; - } - break; - case 2://Willpower - result = this->uWillpower; - //v12 = this->uWillpower; - if ( result <= pBaseValue ) - pStep = pDroppedStep; - if ( result - pStep >= uMinValue ) - { - result -= pStep; - this->uWillpower = result; - } + this->uIntelligence -= pStep; break; - case 3://Endurance - result = this->uEndurance; - //v11 = this->uEndurance; - if ( result <= pBaseValue ) + case CHARACTER_WILLPOWER: + if ( this->uWillpower <= pBaseValue ) pStep = pDroppedStep; - if ( result - pStep >= uMinValue ) - { - result -= pStep; - this->uEndurance = result; - } + if ( this->uWillpower - pStep >= uMinValue ) + this->uWillpower -= pStep; break; - case 4://Accuracy - result = this->uAccuracy; - //v10 = this->uAccuracy; - if ( result <= pBaseValue ) + case CHARACTER_ENDURANCE: + if ( this->uEndurance <= pBaseValue ) pStep = pDroppedStep; - if ( result - pStep >= uMinValue ) - { - result -= pStep; - this->uAccuracy = result; - } + if ( this->uEndurance - pStep >= uMinValue ) + this->uEndurance -= pStep; break; - case 5://Speed - result = this->uSpeed; - //v9 = this->uSpeed; - if ( result <= pBaseValue ) + case CHARACTER_ACCURACY: + if ( this->uAccuracy <= pBaseValue ) pStep = pDroppedStep; - if ( result - pStep >= uMinValue ) - { - result -= pStep; - this->uSpeed = result; - } + if ( this->uAccuracy - pStep >= uMinValue ) + this->uAccuracy -= pStep; break; - default: - result = eAttribute - 6; - if ( eAttribute == 6 )//Luck - { - result = this->uLuck; - //v8 = this->uLuck; - if ( result <= pBaseValue ) - pStep = pDroppedStep; - if ( result - pStep >= uMinValue ) - { - result -= pStep; - this->uLuck = result; - } - } + case CHARACTER_SPEED: + if ( this->uSpeed <= pBaseValue ) + pStep = pDroppedStep; + if ( this->uSpeed - pStep >= uMinValue ) + this->uSpeed -= pStep; break; - } - } - else - { - result = this->uMight; - //v14 = this->uMight; - if ( result <= pBaseValue ) - pStep = pDroppedStep; - if ( result - pStep >= uMinValue ) - { - result -= pStep; - this->uMight = result; - } - } - return result; + case CHARACTER_LUCK: + if ( this->uLuck <= pBaseValue ) + pStep = pDroppedStep; + if ( this->uLuck - pStep >= uMinValue ) + this->uLuck -= pStep; + break; + } } //----- (004905F5) --------------------------------------------------------
--- a/Player.h Sat Nov 24 18:25:13 2012 +0600 +++ b/Player.h Sun Nov 25 00:09:29 2012 +0600 @@ -14,7 +14,16 @@ CHARACTER_RACE_GOBLIN = 0x2, CHARACTER_RACE_DWARF = 0x3, }; - +enum CHARACTER_ATTRIBUTE +{ + CHARACTER_MIGHT = 0x0, + CHARACTER_INTELLIGANCE = 0x1, + CHARACTER_WILLPOWER = 0x2, + CHARACTER_ENDURANCE = 0x3, + CHARACTER_ACCURACY = 0x4, + CHARACTER_SPEED = 0x5, + CHARACTER_LUCK = 0x6, +}; /* 332 */ enum CHARACTER_ATTRIBUTE_TYPE @@ -297,7 +306,7 @@ int SetSexByVoice(); void Reset(unsigned __int8 uClass); enum PLAYER_SKILL_TYPE GetSkillIdxByOrder(signed int order); - unsigned __int16 DecreaseAttribute(int eAttribute); + void DecreaseAttribute(int eAttribute); int IncreaseAttribute(int eAttribute); void Player::Zero(); __int16 GetStatColor(unsigned int uStat);