# HG changeset patch # User Ritor1 # Date 1372752520 -21600 # Node ID 27a699abee51f552c764d88a4a81b8acbb5acb72 # Parent 8ed112935a48d5d7ff7247145686db2247a241d2# Parent d9e4c0bbb2d2f5fc9dc5ff86b397878edbaa9ae1 Слияние diff -r 8ed112935a48 -r 27a699abee51 Actor.cpp --- a/Actor.cpp Tue Jul 02 14:08:30 2013 +0600 +++ b/Actor.cpp Tue Jul 02 14:08:40 2013 +0600 @@ -29,7 +29,6 @@ #include "LOD.h" #include "Party.h" #include "GUIWindow.h" -#include "GUIFont.h" #include "MM7.h" #include "SpriteObject.h" diff -r 8ed112935a48 -r 27a699abee51 Events.cpp --- a/Events.cpp Tue Jul 02 14:08:30 2013 +0600 +++ b/Events.cpp Tue Jul 02 14:08:40 2013 +0600 @@ -5,6 +5,7 @@ #include #include +#include "Weather.h" #include "Texture.h" #include "mm7_data.h" #include "VideoPlayer.h" diff -r 8ed112935a48 -r 27a699abee51 Indoor.h --- a/Indoor.h Tue Jul 02 14:08:30 2013 +0600 +++ b/Indoor.h Tue Jul 02 14:08:40 2013 +0600 @@ -1,9 +1,19 @@ #pragma once #include "VectorTypes.h" -#include "Weather.h" #include "Indoor_stuff.h" +#pragma pack(push, 1) +struct LocationTime_stru1 +{ + unsigned __int64 uLastVisitDay; + char sky_texture_name[12]; + int day_attrib; + int day_fogrange_1; + int day_fogrange_2; + char field_2F4[24]; +}; +#pragma pack(pop) /* 319 */ enum LEVEL_TYPE diff -r 8ed112935a48 -r 27a699abee51 Outdoor.cpp --- a/Outdoor.cpp Tue Jul 02 14:08:30 2013 +0600 +++ b/Outdoor.cpp Tue Jul 02 14:08:40 2013 +0600 @@ -5,7 +5,7 @@ #include #include "stru6.h" - +#include "Weather.h" #include "Sprites.h" #include "LightmapBuilder.h" #include "Outdoor.h" @@ -3594,4 +3594,30 @@ pIcons_LOD->SyncLoadedFilesCount(); sprintf(pTmpBuf.data(), "TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour); pTexture_RestUI_CurrentSkyFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); -} \ No newline at end of file +} + + +//----- (004626BA) -------------------------------------------------------- +OutdoorLocation::OutdoorLocation() +{ + subconstuctor(); + uLastSunlightUpdateMinute = 0; + + uNumBModels = 0; + pBModels = nullptr; +} + +//----- (004626CD) -------------------------------------------------------- +void OutdoorLocation::subconstuctor() +{ + //OutdoorLocationTerrain::OutdoorLocationTerrain(&this->pTerrain); + field_F0 = 0; + field_F4 = 0x40000000u; + //DLVHeader::DLVHeader(&v1->ddm); + pSpawnPoints = 0; + pBModels = 0; + pCmap = 0; + pFaceIDLIST = 0; + pOMAP = 0; +} + diff -r 8ed112935a48 -r 27a699abee51 Outdoor.h --- a/Outdoor.h Tue Jul 02 14:08:30 2013 +0600 +++ b/Outdoor.h Tue Jul 02 14:08:40 2013 +0600 @@ -127,28 +127,8 @@ #pragma pack(push, 1) struct OutdoorLocation { - //----- (004626BA) -------------------------------------------------------- - OutdoorLocation() - { - subconstuctor(); - uLastSunlightUpdateMinute = 0; - - uNumBModels = 0; - pBModels = nullptr; - } - //----- (004626CD) -------------------------------------------------------- - void subconstuctor() - { - //OutdoorLocationTerrain::OutdoorLocationTerrain(&this->pTerrain); - field_F0 = 0; - field_F4 = 0x40000000u; - //DLVHeader::DLVHeader(&v1->ddm); - pSpawnPoints = 0; - pBModels = 0; - pCmap = 0; - pFaceIDLIST = 0; - pOMAP = 0; - } + OutdoorLocation(); + void subconstuctor(); void ExecDraw(unsigned int bRedraw); void PrepareActorsDrawList(); diff -r 8ed112935a48 -r 27a699abee51 Player.cpp --- a/Player.cpp Tue Jul 02 14:08:30 2013 +0600 +++ b/Player.cpp Tue Jul 02 14:08:40 2013 +0600 @@ -91,21 +91,23 @@ unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3}; unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6}; -unsigned char pConditionStrengthMultiplier[19] = {100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; -unsigned char pConditionIntelligenceMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; -unsigned char pConditionWillpowerMultiplier[19] = {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}; -unsigned char pConditionEnduranceMultiplier[19] = {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}; -unsigned char pConditionAccuracyMultiplier[19] = {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; -unsigned char pConditionSpeedMultiplier[19] = {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}; -unsigned char pConditionLuckMultiplier[19] = {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; - -unsigned char pAgeingStrengthMultiplier[4] = {100, 75, 40, 10}; -unsigned char pAgeingIntelligenceMultiplier[4] = {100, 150, 100, 10}; -unsigned char pAgeingWillpowerMultiplier[4] = {100, 150, 100, 10}; -unsigned char pAgeingEnduranceMultiplier[4] = {100, 75, 40, 10}; -unsigned char pAgeingAccuracyMultiplier[4] = {100, 100, 40, 10}; -unsigned char pAgeingSpeedMultiplier[4] = {100, 100, 40, 10}; -unsigned char pAgeingLuckMultiplier[4] = {100, 100, 100, 100}; +unsigned char pConditionAttributeModifier[7][19] = +{{100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Might + {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Intelligence + {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Willpower + {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Endurance + {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Accuracy + {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Speed + {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}}; //Luck + +unsigned char pAgingAttributeModifier[7][4] = +{{100, 75, 40, 10}, //Might + {100, 150, 100, 10}, //Intelligence + {100, 150, 100, 10}, //Willpower + {100, 75, 40, 10}, //Endurance + {100, 100, 40, 10}, //Accuracy + {100, 100, 40, 10}, //Speed + {100, 100, 100, 100}}; //Luck signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF}; @@ -422,11 +424,11 @@ { return 1; } - else if (GetMajorConditionIdx() == 18) + else if (GetMajorConditionIdx() == Condition_Good) { return 0; } - else if (GetMajorConditionIdx() == 17 && (v2 == 78 || v2 > 80) && v2 <= 82) + else if (GetMajorConditionIdx() == Condition_Zombie && (v2 == 78 || v2 == 81 || v2 == 82)) { return 0; } @@ -2402,176 +2404,43 @@ //----- (0048C93C) -------------------------------------------------------- int Player::GetActualMight() { - Player *v1; // esi@1 - unsigned int v2; // eax@1 - signed int v3; // ecx@1 - signed int v4; // ebx@4 - int v5; // edi@5 - int v6; // ST14_4@5 - - v1 = this; - v2 = this->sAgeModifier + GetBaseAge(); - v3 = 0; - while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) - { - ++v3; - if ( v3 >= 4 ) - { - v4 = 100; - goto LABEL_5; - } - } - v4 = pAgeingStrengthMultiplier[v3]; -LABEL_5: - v5 = pConditionStrengthMultiplier[GetMajorConditionIdx()]; - v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH, 0); - return v5 * v4 * v1->uMight / 100 / 100 + GetMagicalBonus((CHARACTER_ATTRIBUTE_TYPE)0) + v6 + v1->uMightBonus; + return GetActualAttribute(CHARACTER_ATTRIBUTE_STRENGTH); } //----- (0048C9C2) -------------------------------------------------------- int Player::GetActualIntelligence() { - Player *v1; // esi@1 - unsigned int sAge; // eax@1 - signed int uAgeLevel; // ecx@1 - signed int v4; // ebx@4 - int v5; // edi@5 - int v6; // ebp@5 - - v1 = this; - sAge = this->sAgeModifier + GetBaseAge(); - uAgeLevel = 0; - while ( (signed int)sAge >= (signed int)pAgeingTable[uAgeLevel] ) - { - ++uAgeLevel; - if ( uAgeLevel >= 4 ) - { - v4 = 100; - goto LABEL_5; - } - } - v4 = pAgeingIntelligenceMultiplier[uAgeLevel]; -LABEL_5: - v5 = pConditionIntelligenceMultiplier[GetMajorConditionIdx()]; - v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE, 0); - return v5 * v4 * v1->uIntelligence / 100 / 100 - + GetMagicalBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE) - + v6 - + v1->uIntelligenceBonus; + return GetActualAttribute(CHARACTER_ATTRIBUTE_INTELLIGENCE); } //----- (0048CA3F) -------------------------------------------------------- int Player::GetActualWillpower() { - int v5; // edi@5 - - uint uActualAge = GetBaseAge() + sAgeModifier; - uint uAgeingMultiplier = 100; - for (uint i = 0; i < 4; ++i) - if (uActualAge >= pAgeingTable[i]) - uAgeingMultiplier = pAgeingWillpowerMultiplier[i]; - else break; - - v5 = pConditionWillpowerMultiplier[GetMajorConditionIdx()]; - return v5 * uAgeingMultiplier * uWillpower / 100 / 100 - + GetMagicalBonus(CHARACTER_ATTRIBUTE_WILLPOWER) - + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER, 0) - + uWillpowerBonus; + return GetActualAttribute(CHARACTER_ATTRIBUTE_WILLPOWER); } //----- (0048CABC) -------------------------------------------------------- int Player::GetActualEndurance() { - uint uActualAge = GetBaseAge() + sAgeModifier; - uint uAgeingMultiplier = 100; - for (uint i = 0; i < 4; ++i) - if (uActualAge >= pAgeingTable[i]) - uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; - else break; - - auto uConditionMult = pConditionEnduranceMultiplier[GetMajorConditionIdx()]; - auto uItemBonus = GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0); - return uConditionMult * uAgeingMultiplier * uEndurance / 100 / 100 - + GetMagicalBonus(CHARACTER_ATTRIBUTE_ENDURANCE) - + uItemBonus - + uEnduranceBonus; + return GetActualAttribute(CHARACTER_ATTRIBUTE_ENDURANCE); } //----- (0048CB39) -------------------------------------------------------- int Player::GetActualAccuracy() { - Player *v1; // esi@1 - unsigned int v2; // eax@1 - signed int v3; // ecx@1 - signed int v4; // ebx@4 - int v5; // edi@5 - int v6; // ebp@5 - - v1 = this; - v2 = this->sAgeModifier + GetBaseAge(); - v3 = 0; - while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) - { - ++v3; - if ( v3 >= 4 ) - { - v4 = 100; - goto LABEL_5; - } - } - v4 = pAgeingAccuracyMultiplier[v3]; -LABEL_5: - v5 = pConditionAccuracyMultiplier[GetMajorConditionIdx()]; - v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY, 0); - return v5 * v4 * v1->uAccuracy / 100 / 100 - + GetMagicalBonus(CHARACTER_ATTRIBUTE_ACCURACY) - + v6 - + v1->uAccuracyBonus; + return GetActualAttribute(CHARACTER_ATTRIBUTE_ACCURACY); } //----- (0048CBB6) -------------------------------------------------------- int Player::GetActualSpeed() { - Player *v1; // esi@1 - unsigned int v2; // eax@1 - signed int v3; // ecx@1 - signed int v4; // ebx@4 - int v5; // edi@5 - int v6; // ebp@5 - - v1 = this; - v2 = this->sAgeModifier + GetBaseAge(); - v3 = 0; - while ( (signed int)v2 >= (signed int)pAgeingTable[v3] ) - { - ++v3; - if ( v3 >= 4 ) - { - v4 = 100; - goto LABEL_5; - } - } - v4 = pAgeingSpeedMultiplier[v3]; -LABEL_5: - v5 = pConditionSpeedMultiplier[GetMajorConditionIdx()]; - v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED, 0); - return v5 * v4 * v1->uSpeed / 100 / 100 - + GetMagicalBonus(CHARACTER_ATTRIBUTE_SPEED) - + v6 - + v1->uSpeedBonus; + return GetActualAttribute(CHARACTER_ATTRIBUTE_SPEED); } //----- (0048CC33) -------------------------------------------------------- int Player::GetActualLuck() { - signed int curr_age; // eax@7 - signed int i; // ecx@7 - signed int age_luck_pc; // ebx@10 - int condition_luck_pc; // edi@11 - int items_luck_bonus; // ebp@11 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1 - signed int magic_luck_bonus; // [sp+10h] [bp-4h]@1 - int full_luck; npc_luck_bonus = 0; if ( CheckHiredNPCSpeciality(Fool) ) @@ -2580,25 +2449,67 @@ npc_luck_bonus += 20; if ( CheckHiredNPCSpeciality(Psychic) ) npc_luck_bonus += 10; - curr_age = sAgeModifier + GetBaseAge(); - i = 0; - while ( curr_age >= pAgeingTable[i] ) - { - ++i; - if ( i >= 4 ) + + return GetActualAttribute(CHARACTER_ATTRIBUTE_LUCK) + + npc_luck_bonus; +} + +//----- (new function) -------------------------------------------------------- +int Player::GetActualAttribute( CHARACTER_ATTRIBUTE_TYPE attrId ) +{ + unsigned __int16 attrValue = 0; + unsigned __int16 attrBonus = 0; + switch (attrId) + { + case CHARACTER_ATTRIBUTE_STRENGTH: + attrValue = uMight; + attrBonus = uMightBonus; + break; + case CHARACTER_ATTRIBUTE_INTELLIGENCE: + attrValue = uIntelligence; + attrBonus = uIntelligenceBonus; + break; + case CHARACTER_ATTRIBUTE_WILLPOWER: + attrValue = uWillpower; + attrBonus = uWillpowerBonus; + break; + case CHARACTER_ATTRIBUTE_ENDURANCE: + attrValue = uEndurance; + attrBonus = uEnduranceBonus; + break; + case CHARACTER_ATTRIBUTE_ACCURACY: + attrValue = uAccuracy; + attrBonus = uAccuracyBonus; + break; + case CHARACTER_ATTRIBUTE_SPEED: + attrValue = uSpeed; + attrBonus = uSpeedBonus; + break; + case CHARACTER_ATTRIBUTE_LUCK: + attrValue = uLuck; + attrBonus = uLuckBonus; + break; + default: + return 0; + } + + uint uActualAge = this->sAgeModifier + GetBaseAge(); + uint uAgeingMultiplier = 100; + for (uint i = 0; i < 4; ++i) + { + if (uActualAge >= pAgeingTable[i]) + uAgeingMultiplier = pAgingAttributeModifier[attrId][i]; + else break; } - if (i < 4) - age_luck_pc = pAgeingLuckMultiplier[i]; - else - age_luck_pc = 100; - - condition_luck_pc = pConditionLuckMultiplier[GetMajorConditionIdx()]; - items_luck_bonus = GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK, 0); - magic_luck_bonus = GetMagicalBonus(CHARACTER_ATTRIBUTE_LUCK); - full_luck = magic_luck_bonus + items_luck_bonus + npc_luck_bonus+ uLuckBonus - + condition_luck_pc * age_luck_pc * uLuck / 100 / 100; - return full_luck; + + auto uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()]; + int magicBonus = GetMagicalBonus(attrId); + int itemBonus = GetItemsBonus(attrId, 0); + return uConditionMult * uAgeingMultiplier * attrValue / 100 / 100 + + magicBonus + + magicBonus + + attrBonus; } //----- (0048CCF5) -------------------------------------------------------- @@ -7924,7 +7835,7 @@ if (v9->uItemID == 615) break; } - if (v9 != NULL || v9->uItemID != 615) + if (v9 != NULL && v9->uItemID != 615) { v10 = (int)((char *)this + 36 * 138); //originally 36 * v8. the code got to this condition only if v8 was equal to 138 *(int *)(v10 + 532) = 601; diff -r 8ed112935a48 -r 27a699abee51 Player.h --- a/Player.h Tue Jul 02 14:08:30 2013 +0600 +++ b/Player.h Tue Jul 02 14:08:40 2013 +0600 @@ -477,6 +477,7 @@ bool CompareVariable(enum VariableType VarNum, signed int pValue); void UseItem_DrinkPotion_etc(signed int a2, int a3); bool AddItem(struct ItemGen *pItem); + int GetActualAttribute(CHARACTER_ATTRIBUTE_TYPE attrId); int GetBaseStrength(); int GetBaseIntelligence(); int GetBaseWillpower(); @@ -621,7 +622,6 @@ inline void SetZombie(bool state) {pConditions[Condition_Zombie] = state;} - __int64 pConditions[20]; unsigned __int64 uExperience; char pName[16]; diff -r 8ed112935a48 -r 27a699abee51 Weather.h --- a/Weather.h Tue Jul 02 14:08:30 2013 +0600 +++ b/Weather.h Tue Jul 02 14:08:40 2013 +0600 @@ -2,21 +2,10 @@ #pragma pack(push, 1) -struct LocationTime_stru1 - { - unsigned __int64 uLastVisitDay; - char sky_texture_name[12]; - int day_attrib; - int day_fogrange_1; - int day_fogrange_2; - char field_2F4[24]; - }; -#pragma pack(pop) /* 255 */ -#pragma pack(push, 1) struct Weather { inline Weather(): diff -r 8ed112935a48 -r 27a699abee51 mm7_3.cpp --- a/mm7_3.cpp Tue Jul 02 14:08:30 2013 +0600 +++ b/mm7_3.cpp Tue Jul 02 14:08:40 2013 +0600 @@ -4,7 +4,7 @@ #include - +#include "Weather.h" #include "Texture.h" #include "mm7_data.h" #include "Sprites.h" diff -r 8ed112935a48 -r 27a699abee51 mm7_6.cpp --- a/mm7_6.cpp Tue Jul 02 14:08:30 2013 +0600 +++ b/mm7_6.cpp Tue Jul 02 14:08:40 2013 +0600 @@ -6,7 +6,7 @@ - +#include "Weather.h" #include "Sprites.h" #include "BSPModel.h" #include "OutdoorCamera.h"