# HG changeset patch # User Gloval # Date 1368902486 -14400 # Node ID 446175a32a1593db56198820fcfad5b4392435ac # Parent 7e4045b6f191f2cf1b077a07c15719d0329c5494 player math fix diff -r 7e4045b6f191 -r 446175a32a15 Player.cpp --- a/Player.cpp Sat May 18 22:01:42 2013 +0400 +++ b/Player.cpp Sat May 18 22:41:26 2013 +0400 @@ -1982,7 +1982,7 @@ } else { - if ( v1 >= 0 ) + if ( (v1&0xFF) >= 0 ) { v4 = ((v1 & 0x40) != 0) + 1; return v2 * v4; @@ -1997,27 +1997,27 @@ int Player::GetMeditation() { char v1; // al@1 - int v2; // ecx@1 + int base_level; // ecx@1 int v4; // eax@3 signed int v6; // [sp-4h] [bp-4h]@2 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); - v2 = v1 & 0x3F; + base_level = v1 & 0x3F; if ( v1 & 0x100 ) { v6 = 5; } else { - if ( v1 >= 0 ) + if ( (v1&0xFF) >= 0 ) { v4 = ((v1 & 0x40) != 0) + 1; - return v2 * v4; + return base_level * v4; } v6 = 3; } v4 = v6; - return v2 * v4; + return base_level * v4; } //----- (004910D3) -------------------------------------------------------- @@ -5644,8 +5644,8 @@ } //----- (0048F882) -------------------------------------------------------- -char Player::GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType) -{ +int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType ) + { signed int v2; // esi@1 unsigned __int16 v3; // ax@126 char result; // al@127 @@ -5875,10 +5875,10 @@ } v3 = pActiveSkills[uSkillType]; - if ( v2 + (pActiveSkills[uSkillType] & 0x3F) < 60 ) + if ( v2 + (v3 & 0x3F) < 60 ) result = v2 + v3; else - result = v3 & 0xFC | 0x3C; + result = v3 & 0xFFFC | 0x3C; //al return result; } diff -r 7e4045b6f191 -r 446175a32a15 Player.h --- a/Player.h Sat May 18 22:01:42 2013 +0400 +++ b/Player.h Sat May 18 22:41:26 2013 +0400 @@ -515,7 +515,7 @@ int _48EA46_calc_special_bonus_by_items(int a2); int GetItemsBonus(enum CHARACTER_ATTRIBUTE_TYPE attr, int a3); int GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2); - char GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType); + int GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType); int GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2); enum CHARACTER_RACE GetRace(); PLAYER_SEX GetSexByVoice();