# HG changeset patch # User Grumpy7 # Date 1371265728 -7200 # Node ID 351bc06722f24a452010e541b71fc004d9b340f0 # Parent fbb7428fa58c3776e13cabf289a610908f4b6045 Player::_4B807C changed to Player::GetTempleHealCostModifier, cleaned up diff -r fbb7428fa58c -r 351bc06722f2 Player.cpp --- a/Player.cpp Sat Jun 15 03:00:36 2013 +0200 +++ b/Player.cpp Sat Jun 15 05:08:48 2013 +0200 @@ -259,56 +259,44 @@ } //----- (004B807C) -------------------------------------------------------- -int Player::_4B807C(float a2) -{ - Player *v2; // edi@1 - unsigned int v3; // eax@1 - int v4; // esi@1 - unsigned int v5; // ebx@7 +int Player::GetTempleHealCostModifier(float a2) +{ + unsigned int conditionIdx; // eax@1 + int conditionTimeMultiplier; // esi@1 int v6; // eax@8 - signed __int64 v7; // qax@13 - unsigned int v9; // [sp-4h] [bp-14h]@4 - signed int v10; // [sp+8h] [bp-8h]@4 - int v11; // [sp+Ch] [bp-4h]@6 - - v2 = this; - v3 = GetMajorConditionIdx(); - v4 = 0; - if ( (signed int)v3 >= 14 ) - { - if ( (signed int)v3 <= 15 ) - { - v10 = 5; - v9 = v3; - goto LABEL_6; - } - if ( v3 == 16 ) - { - v10 = 10; - v9 = 16; -LABEL_6: - v11 = GetConditionDayOfWeek(v9); - goto LABEL_13; - } - } - v10 = 1; - v5 = 0; - do - { - v6 = GetConditionDayOfWeek(v5); - if ( v6 > v4 ) - v4 = v6; - ++v5; - } - while ( (signed int)v5 <= 13 ); - v11 = v4; - if ( !v4 ) - v11 = 1; -LABEL_13: - v7 = (signed __int64)((double)v11 * (double)v10 * a2); - if ( (signed int)v7 < 1 ) - LODWORD(v7) = 1; - return v7; + signed int result; // qax@13 + signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4 + + conditionIdx = GetMajorConditionIdx(); + if ( conditionIdx >= 14 ) + { + if ( conditionIdx <= 15 ) + { + baseConditionMultiplier = 5; + } + if ( conditionIdx == 16 ) + { + baseConditionMultiplier = 10; + } + conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); + } + else + { + baseConditionMultiplier = 1; + conditionTimeMultiplier = 0; + for (int i = 0; i <= 13; i++) + { + v6 = GetConditionDayOfWeek(i); + if ( v6 > conditionTimeMultiplier ) + conditionTimeMultiplier = v6; + } + if ( !conditionTimeMultiplier ) + conditionTimeMultiplier = 1; + } + result = ((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2); + if ( result < 1 ) + result = 1; + return result; } //----- (004B8102) -------------------------------------------------------- @@ -6504,9 +6492,6 @@ //----- (0049070F) -------------------------------------------------------- void Player::Zero() { - Player *v1; // esi@1 - - v1 = this; this->sLevelModifier = 0; this->sACModifier = 0; this->uLuckBonus = 0; @@ -6526,18 +6511,18 @@ this->field_E4 = 0; this->field_E0 = 0; memset(&this->sResFireBonus, 0, 0x16u); - v1->field_1A97 = 0; - v1->_ranged_dmg_bonus = 0; - v1->field_1A95 = 0; - v1->_ranged_atk_bonus = 0; - v1->field_1A93 = 0; - v1->_melee_dmg_bonus = 0; - v1->field_1A91 = 0; - v1->_some_attack_bonus = 0; - v1->_mana_related = 0; - v1->uFullManaBonus = 0; - v1->_health_related = 0; - v1->uFullHealthBonus = 0; + this->field_1A97 = 0; + this->_ranged_dmg_bonus = 0; + this->field_1A95 = 0; + this->_ranged_atk_bonus = 0; + this->field_1A93 = 0; + this->_melee_dmg_bonus = 0; + this->field_1A91 = 0; + this->_some_attack_bonus = 0; + this->_mana_related = 0; + this->uFullManaBonus = 0; + this->_health_related = 0; + this->uFullHealthBonus = 0; } //----- (004907E7) -------------------------------------------------------- diff -r fbb7428fa58c -r 351bc06722f2 Player.h --- a/Player.h Sat Jun 15 03:00:36 2013 +0200 +++ b/Player.h Sat Jun 15 05:08:48 2013 +0200 @@ -584,7 +584,7 @@ int GetPriceIdentification(float a2); int GetBuyingPrice(unsigned int uRealValue, float price_multiplier); int GetPriceSell(int uRealValue, float price_multiplier); - int _4B807C(float a2); + int GetTempleHealCostModifier(float a2); int GetConditionDayOfWeek(unsigned int uCondition); bool _43EEF3(); void SalesProcess(unsigned int inventory_idnx, int item_index, int _2devent_idx);//0x4BE2DD diff -r fbb7428fa58c -r 351bc06722f2 UIHouses.cpp --- a/UIHouses.cpp Sat Jun 15 03:00:36 2013 +0200 +++ b/UIHouses.cpp Sat Jun 15 05:08:48 2013 +0200 @@ -4748,7 +4748,7 @@ HIDWORD(v59) = TargetColor(0xFFu, 0xFFu, 0x9Bu); v1 = pPlayers[uActiveCharacter]; //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); - v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[v0->par1C - 1].fPriceMultiplier); + v2 = pPlayers[uActiveCharacter]->GetTempleHealCostModifier(p2DEvents[v0->par1C - 1].fPriceMultiplier); HIDWORD(v60) = v2; if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) {