# HG changeset patch # User Ritor1 # Date 1371296360 -21600 # Node ID 2767980b98bbf38cd48a25c94262c82bc5ba658f # Parent 2a1ca27945e1d3c5972e1f4d735c34f21c067607# Parent 34c433886ed435edac5cef786ae4343c5ae701ed Слияние diff -r 2a1ca27945e1 -r 2767980b98bb DecalBuilder.cpp --- a/DecalBuilder.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/DecalBuilder.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -9,6 +9,7 @@ #include "stru9.h" +#include "Outdoor_stuff.h" struct DecalBuilder *pDecalBuilder = new DecalBuilder; diff -r 2a1ca27945e1 -r 2767980b98bb Game.cpp --- a/Game.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/Game.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -25,6 +25,7 @@ #include "Viewport.h" #include "Time.h" #include "Outdoor.h" +#include "Outdoor_stuff.h" #include "Overlays.h" #include "AudioPlayer.h" #include "LOD.h" diff -r 2a1ca27945e1 -r 2767980b98bb LightmapBuilder.cpp --- a/LightmapBuilder.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/LightmapBuilder.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -2,6 +2,7 @@ #include "Game.h" #include "stru314.h" #include "Outdoor.h" +#include "Outdoor_stuff.h" #include "Log.h" #include "OutdoorCamera.h" diff -r 2a1ca27945e1 -r 2767980b98bb MM7.h --- a/MM7.h Sat Jun 15 17:39:01 2013 +0600 +++ b/MM7.h Sat Jun 15 17:39:20 2013 +0600 @@ -1,8 +1,5 @@ #pragma once -#include -#include -#include -#include +#include typedef unsigned int uint; @@ -15,15 +12,6 @@ typedef unsigned __int64 _QWORD; -#include "VectorTypes.h" -#include "IndoorCameraD3D.h" - - - - - - - /* 288 */ /*#pragma pack(push, 1) struct CheckHRESULT_stru0 diff -r 2a1ca27945e1 -r 2767980b98bb Outdoor.cpp --- a/Outdoor.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/Outdoor.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -9,6 +9,7 @@ #include "Sprites.h" #include "LightmapBuilder.h" #include "Outdoor.h" +#include "Outdoor_stuff.h" #include "Party.h" #include "SpriteObject.h" #include "LOD.h" diff -r 2a1ca27945e1 -r 2767980b98bb Outdoor.h --- a/Outdoor.h Sat Jun 15 17:39:01 2013 +0600 +++ b/Outdoor.h Sat Jun 15 17:39:20 2013 +0600 @@ -2,7 +2,6 @@ #include "Indoor.h" #include "TileFrameTable.h" -#include "Outdoor_stuff.h" #define DAY_ATTRIB_FOG 1 diff -r 2a1ca27945e1 -r 2767980b98bb Outdoor_stuff.h --- a/Outdoor_stuff.h Sat Jun 15 17:39:01 2013 +0600 +++ b/Outdoor_stuff.h Sat Jun 15 17:39:20 2013 +0600 @@ -1,6 +1,8 @@ #pragma once +#include "VectorTypes.h" +#include - +struct ODMFace; /* 141 */ diff -r 2a1ca27945e1 -r 2767980b98bb Player.cpp --- a/Player.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/Player.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -138,75 +138,61 @@ //----- (00490913) -------------------------------------------------------- -signed int __cdecl PlayerCreation_ComputeAttributeBonus() +signed int __cdecl PlayerCreation_GetUnspentAttributePointCount() { signed int v0; // edi@1 - signed int v1; // esi@1 - int v2; // ebx@2 - int v3; // ecx@17 + int raceId; // ebx@2 signed int v4; // eax@17 int v5; // edx@18 signed int v6; // ecx@18 - signed int v8; // [sp+Ch] [bp-8h]@1 - signed int v9; // [sp+10h] [bp-4h]@2 - - v8 = 50; + signed int remainingStatPoints; // [sp+Ch] [bp-8h]@1 + + remainingStatPoints = 50; v0 = 50; - v1 = 0; - do - { - v9 = 0; - v2 = 7 * pParty->pPlayers[v1].GetRace(); - do - { - if ( v9 ) + for (int playerNum = 0; playerNum < 4; playerNum++) + { + raceId = pParty->pPlayers[playerNum].GetRace(); + for (int statNum = 0; statNum <= 6; statNum++) + { + switch ( statNum ) { - switch ( v9 ) - { - case 1: - v0 = pParty->pPlayers[v1].uIntelligence; - break; - case 2: - v0 = pParty->pPlayers[v1].uWillpower; - break; - case 3: - v0 = pParty->pPlayers[v1].uEndurance; - break; - case 4: - v0 = pParty->pPlayers[v1].uAccuracy; - break; - case 5: - v0 = pParty->pPlayers[v1].uSpeed; - break; - case 6: - v0 = pParty->pPlayers[v1].uLuck; - break; - } + case 0: + v0 = pParty->pPlayers[playerNum].uMight; + break; + case 1: + v0 = pParty->pPlayers[playerNum].uIntelligence; + break; + case 2: + v0 = pParty->pPlayers[playerNum].uWillpower; + break; + case 3: + v0 = pParty->pPlayers[playerNum].uEndurance; + break; + case 4: + v0 = pParty->pPlayers[playerNum].uAccuracy; + break; + case 5: + v0 = pParty->pPlayers[playerNum].uSpeed; + break; + case 6: + v0 = pParty->pPlayers[playerNum].uLuck; + break; + } + v4 = StatTable[raceId][statNum].uBaseValue; + if ( v0 >= v4 ) + { + v5 = StatTable[raceId][statNum].uDroppedStep; + v6 = StatTable[raceId][statNum].uBaseStep; } else { - v0 = pParty->pPlayers[v1].uMight; - } - v3 = v2 + v9; - v4 = StatTable[0][v3].uBaseValue; - if ( v0 >= v4 ) - { - v5 = StatTable[0][v3].uDroppedStep; - v6 = StatTable[0][v3].uBaseStep; + v5 = StatTable[raceId][statNum].uBaseStep; + v6 = StatTable[raceId][statNum].uDroppedStep; } - else - { - v5 = StatTable[0][v3].uBaseStep; - v6 = StatTable[0][v3].uDroppedStep; - } - v8 += v5 * (v4 - v0) / v6; - ++v9; - } - while ( v9 <= 6 ); - ++v1; - } - while ( v1 < 4 ); - return v8; + remainingStatPoints += v5 * (v4 - v0) / v6; + } + } + return remainingStatPoints; } @@ -214,9 +200,9 @@ //----- (00427730) -------------------------------------------------------- bool Player::CanCastSpell(unsigned int uRequiredMana) { - if (sMana >= uRequiredMana) - { - sMana -= uRequiredMana; + if (sMana >= (signed int)uRequiredMana) + { + sMana -= (signed int)uRequiredMana; return true; } @@ -273,56 +259,48 @@ } //----- (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 && conditionIdx <= 16) + { + if ( conditionIdx <= 15 ) + { + baseConditionMultiplier = 5; + } + if ( conditionIdx == 16 ) + { + baseConditionMultiplier = 10; + } + conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx); + } + else if (conditionIdx < 14) + { + baseConditionMultiplier = 1; + conditionTimeMultiplier = 0; + for (int i = 0; i <= 13; i++) + { + v6 = GetConditionDayOfWeek(i); + if ( v6 > conditionTimeMultiplier ) + conditionTimeMultiplier = v6; + } + if ( !conditionTimeMultiplier ) + conditionTimeMultiplier = 1; + } + else{ + conditionTimeMultiplier = 1; + baseConditionMultiplier = 1; + } + result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2); + if ( result < 1 ) + result = 1; + return result; } //----- (004B8102) -------------------------------------------------------- @@ -331,7 +309,7 @@ signed int v3; // esi@1 signed int result; // eax@3 - v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100; + v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100); if ( v3 > uRealValue ) v3 = uRealValue; result = 1; @@ -343,7 +321,7 @@ //----- (004B8142) -------------------------------------------------------- int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) { - uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; + uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100); assert (price > 0); if (price < uRealValue) @@ -358,7 +336,7 @@ int v3; // ecx@1 signed int result; // eax@3 - v2 = (signed __int64)(a2 * 50.0); + v2 = (signed int)(a2 * 50.0); v3 = v2 * (100 - GetMerchant()) / 100; if ( v3 < v2 / 3 ) v3 = v2 / 3; @@ -375,7 +353,7 @@ int v4; // ecx@1 signed int result; // eax@3 - v3 = (signed __int64)((double)a2 / (6.0 - a3)); + v3 = (signed int)((double)a2 / (6.0 - a3)); v4 = v3 * (100 - GetMerchant()) / 100; if ( v4 < v3 / 3 ) v4 = v3 / 3; @@ -386,46 +364,46 @@ } //----- (004B8213) -------------------------------------------------------- -int Player::_4B8213(int a2, float a3) -{ - signed __int64 v3; // qax@1 - - v3 = (signed __int64)((double)a2 / (a3 + 2.0)); - if ( (signed int)v3 < 1 ) - LODWORD(v3) = 1; +int Player::GetBaseSellingPrice(int a2, float a3) +{ + signed int v3; // qax@1 + + v3 = (signed int)((double)a2 / (a3 + 2.0)); + if ( v3 < 1 ) + v3 = 1; return v3; } //----- (004B8233) -------------------------------------------------------- -int Player::_4B8233(int a2, float a3) -{ - signed __int64 v3; // qax@1 - - v3 = (signed __int64)((double)a2 * a3); - if ( (signed int)v3 < 1 ) - LODWORD(v3) = 1; +int Player::GetBaseBuyingPrice(int a2, float a3) +{ + signed int v3; // qax@1 + + v3 = (signed int)((double)a2 * a3); + if ( v3 < 1 ) + v3 = 1; return v3; } //----- (004B824B) -------------------------------------------------------- -int Player::_4B824B(float a2) -{ - signed __int64 v2; // qax@1 - - v2 = (signed __int64)(a2 * 50.0); - if ( (signed int)v2 < 1 ) - LODWORD(v2) = 1; +int Player::GetBaseIdentifyPrice(float a2) +{ + signed int v2; // qax@1 + + v2 = (signed int)(a2 * 50.0); + if ( v2 < 1 ) + v2 = 1; return v2; } //----- (004B8265) -------------------------------------------------------- -int Player::_4B8265(int a2, float a3) -{ - signed __int64 v3; // qax@1 - - v3 = (signed __int64)((double)a2 / (6.0 - a3)); - if ( (signed int)v3 < 1 ) - LODWORD(v3) = 1; +int Player::GetBaseRepairPrice(int a2, float a3) +{ + signed int v3; // qax@1 + + v3 = (signed int)((double)a2 / (6.0 - a3)); + if ( v3 < 1 ) + v3 = 1; return v3; } @@ -434,30 +412,27 @@ //----- (004B6FF9) -------------------------------------------------------- -int Player::_4B6FF9() -{ - Player *v1; // esi@1 +int Player::IsPlayerHealableByTemple() +{ signed int v2; // eax@1 - char v3; // zf@4 - - v1 = this; v2 = (signed int)window_SpeakInHouse->ptr_1C; - if ( (v2 == 78 || v2 > 80) && v2 <= 82 ) - { - if ( GetMajorConditionIdx() == 18 ) - goto LABEL_6; - v3 = GetMajorConditionIdx() == 17; + + if ( this->sHealth < GetMaxHealth() || this->sMana < GetMaxMana() ) + { + return 1; + } + else if (GetMajorConditionIdx() == 18) + { + return 0; + } + else if (GetMajorConditionIdx() == 17 && (v2 == 78 || v2 > 80) && v2 <= 82) + { + return 0; } else { - v3 = GetMajorConditionIdx() == 18; - } - if ( !v3 ) return 1; -LABEL_6: - if ( v1->sHealth < GetMaxHealth() || v1->sMana < GetMaxMana() ) - return 1; - return 0; + } } @@ -6367,78 +6342,43 @@ //----- (004903C9) -------------------------------------------------------- PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order) { - PLAYER_SKILL_TYPE result; // eax@5 - int v3; // edx@5 - char *v4; // ecx@5 - int v5; // esi@11 - unsigned __int16 *v6; // edx@11 - int v7; // esi@18 - unsigned __int16 *pActiveSkill; // edx@18 - - if ( order >= 0 ) - { - if ( order <= 1 ) - { - result = (PLAYER_SKILL_TYPE)0; - v7 = 0; - pActiveSkill = this->pActiveSkills; - do - { - if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) - { - if ( v7 == order ) - return result; - ++v7; - } - result = (PLAYER_SKILL_TYPE)((int)result + 1); - ++pActiveSkill; - } - while ( (signed int)result < 37 ); - } - else - { - if ( order <= 3 ) - { - result = (PLAYER_SKILL_TYPE)0; - v5 = 0; - pActiveSkill = this->pActiveSkills; - do - { - if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) - { - if ( v5 == order - 2 ) - return result; - ++v5; - } - result = (PLAYER_SKILL_TYPE)((int)result + 1); - ++pActiveSkill; - } - while ( (signed int)result < 37 ); - } - else - { - if ( order <= 12 ) - { - result = (PLAYER_SKILL_TYPE)0; - v3 = 0; - v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; - do - { - if ( *v4 == 1 ) - { - if ( v3 == order - 4 ) - return result; - ++v3; - } - result = (PLAYER_SKILL_TYPE)((int)result + 1); - ++v4; - } - while ( (signed int)result < 37 ); - } - } - } - } - return (PLAYER_SKILL_TYPE)37; + int counter; // edx@5 + bool canBeInactive; + unsigned char requiredValue; + signed int offset; + + if ( order <= 1 ) + { + canBeInactive = false; + requiredValue = 2; // 2 - primary skill + offset = 0; + } + else if ( order <= 3 ) + { + canBeInactive = false; + requiredValue = 1; // 1 - available + offset = 2; + } + else if ( order <= 12 ) + { + canBeInactive = true; + requiredValue = 1; // 1 - available + offset = 4; + } + else + { + return (PLAYER_SKILL_TYPE)37; + } + counter = 0; + for (int i = 0; i < 37; i++) + { + if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue ) + { + if ( counter == order - offset ) + return (PLAYER_SKILL_TYPE)i; + ++counter; + } + } } @@ -6459,157 +6399,100 @@ pDroppedStep = StatTable[0][v2].uDroppedStep; uMinValue = pBaseValue - 2; pStep = StatTable[0][v2].uBaseStep; - switch ( eAttribute ) - { - case CHARACTER_ATTRIBUTE_STRENGTH: - if ( this->uMight <= pBaseValue ) - pStep = pDroppedStep; - if ( this->uMight - pStep >= uMinValue ) - this->uMight -= pStep; - break; - case CHARACTER_ATTRIBUTE_INTELLIGENCE: - if ( this->uIntelligence <= pBaseValue ) - pStep = pDroppedStep; - if ( this->uIntelligence - pStep >= uMinValue ) - this->uIntelligence -= pStep; - break; - case CHARACTER_ATTRIBUTE_WILLPOWER: - if ( this->uWillpower <= pBaseValue ) - pStep = pDroppedStep; - if ( this->uWillpower - pStep >= uMinValue ) - this->uWillpower -= pStep; - break; - case CHARACTER_ATTRIBUTE_ENDURANCE: - if ( this->uEndurance <= pBaseValue ) - pStep = pDroppedStep; - if ( this->uEndurance - pStep >= uMinValue ) - this->uEndurance -= pStep; - break; - case CHARACTER_ATTRIBUTE_ACCURACY: - if ( this->uAccuracy <= pBaseValue ) - pStep = pDroppedStep; - if ( this->uAccuracy - pStep >= uMinValue ) - this->uAccuracy -= pStep; - break; - case CHARACTER_ATTRIBUTE_SPEED: - if ( this->uSpeed <= pBaseValue ) - pStep = pDroppedStep; - if ( this->uSpeed - pStep >= uMinValue ) - this->uSpeed -= pStep; - break; - case CHARACTER_ATTRIBUTE_LUCK: - if ( this->uLuck <= pBaseValue ) - pStep = pDroppedStep; - if ( this->uLuck - pStep >= uMinValue ) - this->uLuck -= pStep; - break; - } + unsigned short* AttrToChange = nullptr; + switch ( eAttribute ) + { + case CHARACTER_ATTRIBUTE_STRENGTH: + AttrToChange = &this->uMight; + break; + case CHARACTER_ATTRIBUTE_INTELLIGENCE: + AttrToChange = &this->uIntelligence; + break; + case CHARACTER_ATTRIBUTE_WILLPOWER: + AttrToChange = &this->uWillpower; + break; + case CHARACTER_ATTRIBUTE_ENDURANCE: + AttrToChange = &this->uEndurance; + break; + case CHARACTER_ATTRIBUTE_ACCURACY: + AttrToChange = &this->uAccuracy; + break; + case CHARACTER_ATTRIBUTE_SPEED: + AttrToChange = &this->uSpeed; + break; + case CHARACTER_ATTRIBUTE_LUCK: + AttrToChange = &this->uLuck; + break; + } + if ( *AttrToChange <= pBaseValue ) + pStep = pDroppedStep; + if ( *AttrToChange - pStep >= uMinValue ) + *AttrToChange -= pStep; } //----- (004905F5) -------------------------------------------------------- //signed int __thiscall PartyCreation_BtnPlusClick(Player *this, int eAttribute) -int Player::IncreaseAttribute(int eAttribute) -{ - Player *v2; // esi@1 - int v3; // eax@1 - int v4; // ebx@1 - signed int v5; // edi@1 - int v6; // eax@8 - signed int v7; // eax@17 +void Player::IncreaseAttribute( int eAttribute ) +{ + int raceId; // eax@1 + int maxValue; // ebx@1 + signed int baseStep; // edi@1 + signed int tmp; // eax@17 signed int result; // eax@18 - int v9; // [sp+Ch] [bp-8h]@1 - signed int v10; // [sp+10h] [bp-4h]@1 - - v2 = this; - v3 = eAttribute + 7 * GetRace(); - v4 = StatTable[0][v3].uMaxValue; - v5 = StatTable[0][v3].uBaseStep; - v9 = StatTable[0][v3].uBaseValue; - v10 = StatTable[0][v3].uDroppedStep; - PlayerCreation_ComputeAttributeBonus(); - if ( eAttribute ) - { - switch ( eAttribute ) - { - case 1: - v6 = v2->uIntelligence; - break; - case 2: - v6 = v2->uWillpower; - break; - case 3: - v6 = v2->uEndurance; - break; - case 4: - v6 = v2->uAccuracy; - break; - case 5: - v6 = v2->uSpeed; - break; - case 6: - v6 = v2->uLuck; - break; - default: - v6 = eAttribute; - break; - } - } - else - { - v6 = v2->uMight; - } - if ( v6 < v9 ) - { - v7 = v5; - v5 = v10; - v10 = v7; - } - result = PlayerCreation_ComputeAttributeBonus(); - if ( result >= v10 ) - { - if ( eAttribute ) - { - switch ( eAttribute ) - { - case 1: - result = (signed int)&v2->uIntelligence; - break; - case 2: - result = (signed int)&v2->uWillpower; - break; - case 3: - result = (signed int)&v2->uEndurance; - break; - case 4: - result = (signed int)&v2->uAccuracy; - break; - case 5: - result = (signed int)&v2->uSpeed; - break; - default: - result = eAttribute - 6; - if ( eAttribute != 6 ) - return result; - result = (signed int)&v2->uLuck; - break; - } - } - else - { - result = (signed int)&v2->uMight; - } - if ( v5 + *(short *)result <= v4 ) - *(short *)result += v5; - } - return result; + int baseValue; // [sp+Ch] [bp-8h]@1 + signed int droppedStep; // [sp+10h] [bp-4h]@1 + unsigned short* statToChange; + + raceId = GetRace(); + maxValue = StatTable[raceId][eAttribute].uMaxValue; + baseStep = StatTable[raceId][eAttribute].uBaseStep; + baseValue = StatTable[raceId][eAttribute].uBaseValue; + droppedStep = StatTable[raceId][eAttribute].uDroppedStep; + PlayerCreation_GetUnspentAttributePointCount(); + switch ( eAttribute ) + { + case 0: + statToChange = &this->uMight; + break; + case 1: + statToChange = &this->uIntelligence; + break; + case 2: + statToChange = &this->uWillpower; + break; + case 3: + statToChange = &this->uEndurance; + break; + case 4: + statToChange = &this->uAccuracy; + break; + case 5: + statToChange = &this->uSpeed; + break; + case 6: + statToChange = &this->uLuck; + default: + assert(false); + return; + break; + } + if ( *statToChange < baseValue ) + { + tmp = baseStep; + baseStep = droppedStep; + droppedStep = tmp; + } + result = PlayerCreation_GetUnspentAttributePointCount(); + if ( result >= droppedStep ) + { + if ( baseStep + *statToChange <= maxValue ) + *statToChange += baseStep; + } } //----- (0049070F) -------------------------------------------------------- void Player::Zero() { - Player *v1; // esi@1 - - v1 = this; this->sLevelModifier = 0; this->sACModifier = 0; this->uLuckBonus = 0; @@ -6629,18 +6512,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) -------------------------------------------------------- @@ -9558,4 +9441,84 @@ } } // 5B65C4: using guessed type int dword_5B65C4; -// 5B65CC: using guessed type int dword_5B65CC; \ No newline at end of file +// 5B65CC: using guessed type int dword_5B65CC; + + +//----- (00467E7F) -------------------------------------------------------- +void Player::EquipBody(ITEM_EQUIP_TYPE uEquipType) +{ + //unsigned int v1; // esi@1 + int v2; // ebx@1 + Player *v3; // eax@1 + int v4; // edx@1 + int v5; // esi@2 + //int v6; // eax@2 + unsigned int v7; // eax@3 + ItemGen _this; // [sp+Ch] [bp-30h]@1 + //Player *v9; // [sp+30h] [bp-Ch]@1 + int v10; // [sp+34h] [bp-8h]@1 + int *v11; // [sp+38h] [bp-4h]@1 + + static unsigned char byte_4E8398[200] = // 4E8398 + { + 1, // EQUIP_OFF_HAND + 1, // EQUIP_MAIN_HAND + 2, // EQUIP_BOW + 3, // EQUIP_ARMOUR + 0, // EQUIP_SHIELD + 4, // EQUIP_HELMET + 5, // EQUIP_BELT + 6, // EQUIP_CLOAK + 7, // EQUIP_GAUNTLETS + 8, // EQUIP_BOOTS + 10, // EQUIP_RING + 9, // EQUIP_AMULET + 1, // EQUIP_WAND + 0, // EQUIP_REAGENT + 0, // EQUIP_POTION + 0, // EQUIP_SPELL_SCROLL + 0, // EQUIP_BOOK + 0, // EQUIP_MESSAGE_SCROLL + 0, // EQUIP_GOLD + 0, // EQUIP_GEM + 0, // EQUIP_NONE + // ??? + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, + 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 1, 1, 1, + 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0 + }; + + _this.Reset(); + v2 = byte_4E8398[uEquipType]; + v3 = pPlayers[uActiveCharacter]; + v11 = (int *)&v3->pEquipment.pIndices[v2]; + v4 = *v11; + v10 = *v11; + if ( v10 ) + { + memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); + v5 = (int)((char *)v3 + 4 * (9 * v4 - 9)); + *(char *)(v5 + 556) = 0; + pParty->pPickedItem.Reset(); + pParty->SetHoldingItem((ItemGen *)(v5 + 532)); + _this.uBodyAnchor = v2 + 1; + memcpy((void *)(v5 + 532), &_this, 0x24u); + *v11 = v10; + } + else + { + v7 = v3->FindFreeInventorySlot(); + if (v7 >= 0) + { + pParty->pPickedItem.uBodyAnchor = v2 + 1; + memcpy(&v3->pInventoryItems[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItems[v7])); + *v11 = v7 + 1; + pMouse->RemoveHoldingItem(); + } + } +} \ No newline at end of file diff -r 2a1ca27945e1 -r 2767980b98bb Player.h --- a/Player.h Sat Jun 15 17:39:01 2013 +0600 +++ b/Player.h Sat Jun 15 17:39:20 2013 +0600 @@ -543,7 +543,7 @@ void Reset(PLAYER_CLASS_TYPE classType); PLAYER_SKILL_TYPE GetSkillIdxByOrder(signed int order); void DecreaseAttribute(int eAttribute); - int IncreaseAttribute(int eAttribute); + void IncreaseAttribute(int eAttribute); void Player::Zero(); unsigned int GetStatColor(int uStat); bool DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime); @@ -575,16 +575,16 @@ void PlayEmotion(CHARACTER_EXPRESSION_ID expression, int a3); void ItemsEnchant(int enchant_count); unsigned int GetItemIDAtInventoryIndex(int *a2); - int _4B6FF9(); - int _4B824B(float a2); - int _4B8265(int a2, float a3); - int _4B8233(int a2, float a3); - int _4B8213(int a2, float a3); + int IsPlayerHealableByTemple(); + int GetBaseIdentifyPrice(float a2); + int GetBaseRepairPrice(int a2, float a3); + int GetBaseBuyingPrice(int a2, float a3); + int GetBaseSellingPrice(int a2, float a3); int GetPriceRepair(int a2, float a3); 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 @@ -592,6 +592,7 @@ bool CanCastSpell(unsigned int uRequiredMana); void PlaySoundBasedOnCondition(int currPlayerId); void DrawPlayerBuffAnimBasedOnCondition(int currPlayerId); + void EquipBody(ITEM_EQUIP_TYPE uEquipType); inline bool Weak() {return pConditions[Condition_Weak] != 0;} inline bool Dead() {return pConditions[Condition_Dead] != 0;} diff -r 2a1ca27945e1 -r 2767980b98bb Render.cpp --- a/Render.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/Render.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -4,6 +4,7 @@ #include +#include "Outdoor_stuff.h" #include "VideoPlayer.h" #include "Sprites.h" #include "Mouse.h" diff -r 2a1ca27945e1 -r 2767980b98bb Render.h --- a/Render.h Sat Jun 15 17:39:01 2013 +0600 +++ b/Render.h Sat Jun 15 17:39:20 2013 +0600 @@ -44,6 +44,7 @@ unsigned int specular; Vec2_float_ texcoord; }; +#pragma pack(pop) class Sprite; class SpriteFrame; diff -r 2a1ca27945e1 -r 2767980b98bb UIHouses.cpp --- a/UIHouses.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/UIHouses.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -710,7 +710,7 @@ } else if (uActiveCharacter) { - if ( !pPlayers[uActiveCharacter]->_4B6FF9() ) + if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) return; v8 = window_SpeakInHouse; } @@ -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 ) { @@ -4920,7 +4920,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); return; } - if ( !v1->_4B6FF9() ) + if ( !v1->IsPlayerHealableByTemple() ) return; v25 = 0; if ( pParty->uNumGold < v2 ) @@ -4993,7 +4993,7 @@ strcpy(a1, ""); v41->uHeight = 0; v41->uY = 0; - if ( v1->_4B6FF9() ) + if ( v1->IsPlayerHealableByTemple() ) { sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]); v63 = 0; diff -r 2a1ca27945e1 -r 2767980b98bb UIPartyCreation.cpp --- a/UIPartyCreation.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/UIPartyCreation.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -454,7 +454,7 @@ pTextCenter = pFontCreate->AlignText_Center(0x5C, pGlobalTXT_LocalizationStrings[30]);// "Bonus" pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 533, 394, uColor1, pGlobalTXT_LocalizationStrings[30], 0, 0, 0); - pBonusNum = PlayerCreation_ComputeAttributeBonus(); + pBonusNum = PlayerCreation_GetUnspentAttributePointCount(); sprintf(pTmpBuf.data(), "%d", pBonusNum); pTextCenter = pFontCreate->AlignText_Center(84, pTmpBuf.data()); pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 530, 410, uColorWhite, pTmpBuf.data(), 0, 0, 0); diff -r 2a1ca27945e1 -r 2767980b98bb mm7_1.cpp --- a/mm7_1.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/mm7_1.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -1488,444 +1488,21 @@ //----- (00423B5D) -------------------------------------------------------- int __fastcall sub_423B5D(unsigned int uFaceID) { - BLVFace *pFace; // ebx@1 - //Vec3_short_ *v2; // esi@1 - //int v3; // ST28_4@1 - //__int16 v4; // ST2C_2@1 - //signed int v5; // esi@1 - //Vec3_short_ *v6; // eax@4 - //signed int v7; // edi@5 - //signed int v8; // eax@5 - //signed int i_; // ecx@10 - //int v10; // eax@10 - //int v11; // edx@11 - //int v12; // ST28_4@12 - //signed int v13; // edx@12 - //signed __int64 v14; // qtt@12 - //int *v15; // ebx@12 - //int v16; // ST28_4@14 - //signed int v17; // eax@14 - //signed __int64 v18; // qtt@14 - //signed int v19; // edx@15 - //signed int v20; // edx@17 - //signed int v21; // ebx@19 - //signed int v22; // esi@20 - //int v23; // edi@21 - int v24; // eax@21 - //int v25; // eax@22 - int v26; // eax@22 - //signed int v27; // ST30_4@24 - //signed __int64 v28; // qtt@24 - //int v29; // ST18_4@25 - int v30; // eax@26 - //int v31; // eax@27 - int v32; // eax@27 - //signed int v33; // ST30_4@29 - //signed __int64 v34; // qtt@29 - //int v35; // ST30_4@30 - signed int for_x_num_vertices; // edi@31 - //unsigned int v37; // eax@31 - //bool v38; // edx@31 - //int v39; // ecx@31 - //int v40; // ecx@32 - //int v41; // esi@32 - int v42; // eax@34 - signed int for_z_num_vertices; // ebx@41 - //unsigned int v44; // eax@41 - //signed int v45; // ecx@42 - //int v46; // esi@42 - int v47; // eax@44 - signed int for_y_num_vertices; // edi@51 - //unsigned int v49; // eax@51 - //bool v50; // edx@51 - //int v51; // ecx@51 - //int v52; // ecx@52 - //signed int v53; // esi@52 - int v54; // eax@54 - int for_w_num_vertices; // ebx@61 - //unsigned int v56; // eax@61 - //signed int v57; // ecx@62 - //int v58; // esi@62 - int v59; // eax@64 - char v61; // zf@72 - signed int v62; // edx@75 - int v63; // ecx@76 - int v64; // esi@76 - int v65; // ecx@83 - //signed int v66; // [sp+14h] [bp-14h]@3 - int v67; // [sp+14h] [bp-14h]@34 - int v68; // [sp+14h] [bp-14h]@44 - int v69; // [sp+14h] [bp-14h]@54 - int v70; // [sp+14h] [bp-14h]@64 - signed int v71; // [sp+14h] [bp-14h]@75 - bool current_vertices_flag; // [sp+18h] [bp-10h]@9 - //int thisb; // [sp+18h] [bp-10h]@12 - //int thisc; // [sp+18h] [bp-10h]@20 - //bool thisd; // [sp+18h] [bp-10h]@41 - //bool thise; // [sp+18h] [bp-10h]@61 - int thisf; // [sp+18h] [bp-10h]@74 - signed int depth_num_vertices; // [sp+1Ch] [bp-Ch]@9 - int v80; // [sp+1Ch] [bp-Ch]@76 - bool next_vertices_flag; // [sp+20h] [bp-8h]@10 - //bool v82; // [sp+20h] [bp-8h]@32 - //bool v83; // [sp+20h] [bp-8h]@42 - //bool v84; // [sp+20h] [bp-8h]@52 - //bool v85; // [sp+20h] [bp-8h]@62 - //signed int i; // [sp+24h] [bp-4h]@9 - //unsigned int i; // [sp+24h] [bp-4h]@19 - //signed int ix; // [sp+24h] [bp-4h]@31 - //signed int iz; // [sp+24h] [bp-4h]@41 - //signed int iy; // [sp+24h] [bp-4h]@51 - //signed int iw; // [sp+24h] [bp-4h]@61 - - pFace = &pIndoor->pFaces[uFaceID]; - memset(&stru_50B700, 0, sizeof(stru367)); - - if ( pFace->pFacePlane.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x)//check the angle of the vector and the plane - + pFace->pFacePlane.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) - + pFace->pFacePlane.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) - { - stru_50B700.field_0 = 1; - } - else - { - stru_50B700.field_0 = 0; - if ( !pFace->Portal() ) - return 0; - } - for (uint i = 0; i < pFace->uNumVertices; ++i) - { - pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(pIndoor->pVertices[pFace->pVertexIDs[i]].x, - pIndoor->pVertices[pFace->pVertexIDs[i]].y, pIndoor->pVertices[pFace->pVertexIDs[i]].z, - &stru_50B700._view_transformed_xs[i], &stru_50B700._view_transformed_zs[i], &stru_50B700._view_transformed_ys[i], 0); - } - - if (pFace->uNumVertices <= 0) - return 0; - - bool bFound = false; - for (uint i = 0; i < pFace->uNumVertices; ++i) - if (stru_50B700._view_transformed_xs[i] >= 0x80000u)//find vertices > near clip plane - { - bFound = true; - break; - } - if (!bFound) - return 0; - - int t; - depth_num_vertices = 0; - stru_50B700._view_transformed_xs[pFace->uNumVertices] = stru_50B700._view_transformed_xs[0]; - stru_50B700._view_transformed_zs[pFace->uNumVertices] = stru_50B700._view_transformed_zs[0]; - stru_50B700._view_transformed_ys[pFace->uNumVertices] = stru_50B700._view_transformed_ys[0]; - - //for near clip plane - current_vertices_flag = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u; - for ( uint i = 1; i <= pFace->uNumVertices; ++i) - { - next_vertices_flag = stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u; - if ( current_vertices_flag ^ next_vertices_flag ) - { - if ( next_vertices_flag ) - { - //t = (near_clip - v0.z)/(v1.z - v0.z) - t = (0x80000 - stru_50B700._view_transformed_xs[i - 1]) / (stru_50B700._view_transformed_xs[i] - stru_50B700._view_transformed_xs[i - 1]); - //x = (v1.x -v0.x)*t + v1.x - stru_50B700.field_38[depth_num_vertices] = (unsigned __int64)((stru_50B700._view_transformed_ys[i] - stru_50B700._view_transformed_ys[i - 1]) - * t) + stru_50B700._view_transformed_ys[i]; - //y = (v1.y - v0.y)*t + v0.y - stru_50B700.field_128[depth_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i] - stru_50B700._view_transformed_zs[i - 1]) - * t)) + stru_50B700._view_transformed_zs[i - 1]; - } - else - { - t = (0x80000 - stru_50B700._view_transformed_xs[i]) / (stru_50B700._view_transformed_xs[i - 1] - stru_50B700._view_transformed_xs[i]); - //x = (v0.x - v1.x)*t + v1.x - stru_50B700.field_38[depth_num_vertices] = (unsigned __int64)((stru_50B700._view_transformed_ys[i - 1] - stru_50B700._view_transformed_ys[i]) - * t) + stru_50B700._view_transformed_ys[i]; - //y = (v0.y - v1.y)*t + v1.y - stru_50B700.field_128[depth_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i - 1] - stru_50B700._view_transformed_zs[i]) - * t)) + stru_50B700._view_transformed_zs[i]; - } - stru_50B700.field_218[depth_num_vertices] = 0x80000u;//z = 8.0 - depth_num_vertices++; - } - if ( next_vertices_flag ) - { - stru_50B700.field_38[depth_num_vertices] = stru_50B700._view_transformed_ys[i]; - stru_50B700.field_128[depth_num_vertices] = stru_50B700._view_transformed_zs[i]; - stru_50B700.field_218[depth_num_vertices] = stru_50B700._view_transformed_xs[i]; - depth_num_vertices++; - } - current_vertices_flag = next_vertices_flag; - } - stru_50B700.field_218[depth_num_vertices] = stru_50B700.field_218[0]; - stru_50B700.field_128[depth_num_vertices] = stru_50B700.field_128[0]; - stru_50B700.field_38[depth_num_vertices] = stru_50B700.field_38[0]; - - //for far clip plane - for ( uint i = 1; i <= depth_num_vertices; ++i ) - { - if (SHIWORD(stru_50B700.field_128[i]) >= 0) - { - if (SHIWORD(stru_50B700.field_218[i]) >= 0) - v26 = 0x400000; // 64.0 - else - v26 = 0xFFC00000; // -63.0 - } - else - { - if (SHIWORD(stru_50B700.field_218[i]) >= 0) - v26 = 0xFFC00000; // -63.0 - else - v26 = 0x400000; // 64.0 - } - stru_50B700._xs3[i] = v26; - if (SHIWORD(stru_50B700.field_38[i]) >= 0) - { - if (SHIWORD(stru_50B700.field_218[i]) >= 0) - v26 = 0x400000; // 64.0 - else - v26 = 0xFFC00000; // -63.0 - } - else - { - if (SHIWORD(stru_50B700.field_218[i]) >= 0) - v26 = 0xFFC00000; // -63.0 - else - v26 = 0x400000; // 64.0 - } - stru_50B700._ys2[i] = v26; - stru_50B700._xs3[i] = pBLVRenderParams->uViewportCenterX -(unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)//maybe screen space x - * (signed __int64)stru_50B700._xs3[i]); - stru_50B700._ys2[i] = pBLVRenderParams->uViewportCenterY - (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)//screen space y - * (signed __int64)stru_50B700._ys2[i]); - } - - for_x_num_vertices = 0; - stru_50B700._xs3[depth_num_vertices] = stru_50B700._xs3[0]; - stru_50B700._ys2[depth_num_vertices] = stru_50B700._ys2[0]; - if ( depth_num_vertices < 1 ) - return 0; - - //for left clip plane - current_vertices_flag = stru_50B700._xs3[0] >= (signed int)pBLVRenderParams->uViewportX; - for ( uint i = 1; i <= depth_num_vertices; i++ ) - { - next_vertices_flag = stru_50B700._xs3[i] >= (signed int)pBLVRenderParams->uViewportX;// >= - if ( current_vertices_flag ^ next_vertices_flag ) - { - if ( next_vertices_flag ) - { - v67 = (signed int)(pBLVRenderParams->uViewportX - stru_50B700._xs3[i - 1]) - * (signed __int64)(stru_50B700._ys2[i] - stru_50B700._ys2[i - 1]) / (stru_50B700._xs3[i] - stru_50B700._xs3[i - 1]); - v42 = stru_50B700._ys2[i - 1]; - } - else - { - v67 = (signed int)(pBLVRenderParams->uViewportX - stru_50B700._xs3[i]) - * (signed __int64)(stru_50B700._ys2[i - 1] - stru_50B700._ys2[i]) / (stru_50B700._xs3[i - 1] - stru_50B700._xs3[i]); - v42 = stru_50B700._ys2[i]; - } - stru_50B700._ys[for_x_num_vertices] = v67 + v42; - stru_50B700._xs2[for_x_num_vertices] = pBLVRenderParams->uViewportX; - ++for_x_num_vertices; - } - current_vertices_flag = next_vertices_flag; - if ( next_vertices_flag ) - { - stru_50B700._xs2[for_x_num_vertices] = stru_50B700._xs3[i]; - stru_50B700._ys[for_x_num_vertices] = stru_50B700._ys2[i]; - ++for_x_num_vertices; - } - } - - if (for_x_num_vertices < 1) - return 0; - - for_z_num_vertices = 0; - stru_50B700._xs2[for_x_num_vertices] = stru_50B700._xs2[0]; - stru_50B700._ys[for_x_num_vertices] = stru_50B700._ys[0]; - - //for right clip plane - current_vertices_flag = stru_50B700._xs2[0] <= (signed int)pBLVRenderParams->uViewportZ; - for ( uint i = 1; i <= for_x_num_vertices; ++i ) - { - next_vertices_flag = stru_50B700._xs2[i] <= (signed int)pBLVRenderParams->uViewportZ; - if ( current_vertices_flag ^ next_vertices_flag ) - { - if ( next_vertices_flag ) - { - v68 = (signed int)(pBLVRenderParams->uViewportZ - stru_50B700._xs2[i - 1]) - * (signed __int64)(stru_50B700._ys[i] - stru_50B700._ys[i - 1]) / (stru_50B700._xs2[i] - stru_50B700._xs2[i - 1]); - v47 = stru_50B700._ys[i - 1]; - } - else - { - v68 = (signed int)(pBLVRenderParams->uViewportZ - stru_50B700._xs2[i]) - * (signed __int64)(stru_50B700._ys[i - 1] - stru_50B700._ys[i]) / (stru_50B700._xs2[i - 1] - stru_50B700._xs2[i]); - v47 = stru_50B700._ys[i]; - } - stru_50B700.field_2F0[for_z_num_vertices] = v68 + v47; - stru_50B700._xs[for_z_num_vertices] = pBLVRenderParams->uViewportZ; - ++for_z_num_vertices; - } - if ( next_vertices_flag ) - { - stru_50B700._xs[for_z_num_vertices] = stru_50B700._xs2[i]; - stru_50B700.field_2F0[for_z_num_vertices++] = stru_50B700._ys[i]; - } - current_vertices_flag = next_vertices_flag; - } - - if (for_z_num_vertices < 1) - return 0; - - for_y_num_vertices = 0; - stru_50B700._xs[for_z_num_vertices] = stru_50B700._xs[0]; - stru_50B700.field_2F0[for_z_num_vertices] = stru_50B700.field_2F0[0]; - - //for top clip plane - current_vertices_flag = stru_50B700.field_2F0[0] >= (signed int)pBLVRenderParams->uViewportY; - for ( uint i = 1; i <= for_z_num_vertices; i++ ) - { - next_vertices_flag = stru_50B700.field_2F0[i] >= (signed int)pBLVRenderParams->uViewportY; - if ( current_vertices_flag ^ next_vertices_flag ) - { - if ( next_vertices_flag ) - { - v69 = (signed int)(pBLVRenderParams->uViewportY - stru_50B700.field_2F0[i - 1]) - * (signed __int64)(stru_50B700._xs[i] - stru_50B700._xs[i - 1]) / (stru_50B700.field_2F0[i] - stru_50B700.field_2F0[i - 1]); - v54 = stru_50B700._xs[i - 1]; - } - else - { - v69 = (signed int)(pBLVRenderParams->uViewportY - stru_50B700.field_2F0[i]) - * (signed __int64)(stru_50B700._xs[i - 1] - stru_50B700._xs[i]) / (stru_50B700.field_2F0[i - 1] - stru_50B700.field_2F0[i]); - v54 = stru_50B700._xs[i]; - } - stru_50B700.field_3D4[for_y_num_vertices] = v69 + v54; - stru_50B700._xs[for_y_num_vertices + 1] = pBLVRenderParams->uViewportY; - ++for_y_num_vertices; - } - current_vertices_flag = next_vertices_flag; - if ( next_vertices_flag ) - { - stru_50B700.field_3D4[for_y_num_vertices] = stru_50B700._xs[i]; - stru_50B700._xs[for_y_num_vertices + 1] = stru_50B700.field_2F0[i]; - for_y_num_vertices++; - } - } - - if (for_y_num_vertices < 1) - return 0; - - for_w_num_vertices = 0; - stru_50B700.field_3D4[for_y_num_vertices] = stru_50B700.field_3D4[0]; - stru_50B700._xs[for_y_num_vertices + 1] = stru_50B700._xs[1]; - - //for bottom clip plane - current_vertices_flag = stru_50B700._xs[1] <= (signed int)pBLVRenderParams->uViewportW; - for ( uint i = 1; i <= for_y_num_vertices; ++i ) - { - next_vertices_flag = stru_50B700._xs[i + 1] <= (signed int)pBLVRenderParams->uViewportW; - if ( current_vertices_flag ^ next_vertices_flag ) - { - if ( next_vertices_flag ) - { - v70 = (signed int)(pBLVRenderParams->uViewportW - stru_50B700._xs[i]) - * (signed __int64)(stru_50B700.field_3D4[i] - stru_50B700.field_3D4[i - 1]) / (stru_50B700._xs[i + 1] - stru_50B700._xs[i]); - v59 = stru_50B700.field_3D4[i - 1]; - } - else - { - v70 = (signed int)(pBLVRenderParams->uViewportW - stru_50B700._xs[i + 1]) - * (signed __int64)(stru_50B700.field_3D4[i - 1] - stru_50B700.field_3D4[i]) / (stru_50B700._xs[i] - stru_50B700._xs[i + 1]); - v59 = stru_50B700.field_3D4[i]; - } - stru_50B700._screen_space_x[for_w_num_vertices] = v70 + v59; - stru_50B700._screen_space_y[for_w_num_vertices] = pBLVRenderParams->uViewportW; - ++for_w_num_vertices; - } - if ( next_vertices_flag ) - { - stru_50B700._screen_space_x[for_w_num_vertices] = stru_50B700.field_3D4[i]; - stru_50B700._screen_space_y[for_w_num_vertices++] = stru_50B700._xs[i + 1]; - } - current_vertices_flag = next_vertices_flag; - } - - if ( !for_w_num_vertices ) - return 0; - v61 = pRenderer->pRenderD3D == 0; - stru_50B700._screen_space_x[for_w_num_vertices] = stru_50B700._screen_space_x[0]; - stru_50B700._screen_space_y[for_w_num_vertices] = stru_50B700._screen_space_y[0]; - if ( v61 && for_w_num_vertices > 3 ) - { - stru_50B700._screen_space_x[for_w_num_vertices + 1] = stru_50B700._screen_space_x[1]; - stru_50B700._screen_space_y[for_w_num_vertices + 1] = stru_50B700._screen_space_y[1]; - thisf = 2 * (stru_50B700.field_0 != 0) - 1; - if ( for_w_num_vertices > 0 ) - { - v62 = 1; - v71 = 1; - do - { - v63 = v62 - 1; - v64 = v62 + 1; - v80 = v62 + 1; - if ( v62 - 1 >= for_w_num_vertices ) - v63 -= for_w_num_vertices; - if ( v62 >= for_w_num_vertices ) - v62 -= for_w_num_vertices; - if ( v64 >= for_w_num_vertices ) - v64 -= for_w_num_vertices; - if ( thisf * ((stru_50B700._screen_space_y[v64] - stru_50B700._screen_space_y[v63]) - * (stru_50B700._screen_space_x[v62] - stru_50B700._screen_space_x[v63]) - - (stru_50B700._screen_space_y[v62] - stru_50B700._screen_space_y[v63]) - * (stru_50B700._screen_space_x[v64] - stru_50B700._screen_space_x[v63])) < 0 ) - { - v62 = v80; - v71 = v80; - } - else - { - v62 = v71; - v65 = v71; - if ( v71 < for_w_num_vertices || (v65 = v71 - for_w_num_vertices, v71 - for_w_num_vertices < for_w_num_vertices) ) - { - memcpy(&stru_50B700._screen_space_y[v65], &stru_50B700._screen_space_y[v65 + 1], 4 * ((unsigned int)(4 * (for_w_num_vertices - v65)) >> 2)); - memcpy(&stru_50B700._screen_space_x[v65], &stru_50B700._screen_space_x[v65 + 1], 4 * ((unsigned int)(4 * (for_w_num_vertices - v65)) >> 2)); - } - --for_w_num_vertices; - } - } - while ( v62 - 1 < for_w_num_vertices ); - } - stru_50B700._screen_space_x[for_w_num_vertices] = stru_50B700._screen_space_x[0]; - stru_50B700._screen_space_y[for_w_num_vertices] = stru_50B700._screen_space_y[0]; - } - return for_w_num_vertices; -} - -//old function -/*int __fastcall sub_423B5D(unsigned int uFaceID) -{ BLVFace *v1; // ebx@1 Vec3_short_ *v2; // esi@1 - //int v3; // ST28_4@1 + int v3; // ST28_4@1 __int16 v4; // ST2C_2@1 - //signed int v5; // esi@1 - //Vec3_short_ *v6; // eax@4 - //signed int v7; // edi@5 - //signed int v8; // eax@5 - //signed int i_; // ecx@10 + signed int v5; // esi@1 + Vec3_short_ *v6; // eax@4 + signed int v7; // edi@5 + signed int v8; // eax@5 + signed int v9; // ecx@10 int v10; // eax@10 int v11; // edx@11 int v12; // ST28_4@12 signed int v13; // edx@12 signed __int64 v14; // qtt@12 - int *v15; // ebx@12 + char *v15; // ebx@12 int v16; // ST28_4@14 signed int v17; // eax@14 signed __int64 v18; // qtt@14 @@ -1963,7 +1540,7 @@ bool v50; // edx@51 int v51; // ecx@51 int v52; // ecx@52 - signed int v53; // esi@52 + int v53; // esi@52 int v54; // eax@54 int v55; // ebx@61 unsigned int v56; // eax@61 @@ -1975,12 +1552,13 @@ int v63; // ecx@76 int v64; // esi@76 int v65; // ecx@83 - //signed int v66; // [sp+14h] [bp-14h]@3 + signed int v66; // [sp+14h] [bp-14h]@3 int v67; // [sp+14h] [bp-14h]@34 int v68; // [sp+14h] [bp-14h]@44 int v69; // [sp+14h] [bp-14h]@54 int v70; // [sp+14h] [bp-14h]@64 signed int v71; // [sp+14h] [bp-14h]@75 + IndoorCameraD3D *_this; // [sp+18h] [bp-10h]@1 bool thisa; // [sp+18h] [bp-10h]@9 int thisb; // [sp+18h] [bp-10h]@12 int thisc; // [sp+18h] [bp-10h]@20 @@ -1994,349 +1572,383 @@ bool v83; // [sp+20h] [bp-8h]@42 bool v84; // [sp+20h] [bp-8h]@52 bool v85; // [sp+20h] [bp-8h]@62 - //signed int i; // [sp+24h] [bp-4h]@9 - signed int ia; // [sp+24h] [bp-4h]@19 - signed int ib; // [sp+24h] [bp-4h]@31 - signed int ic; // [sp+24h] [bp-4h]@41 - signed int id; // [sp+24h] [bp-4h]@51 - signed int ie; // [sp+24h] [bp-4h]@61 + signed int v86; // [sp+24h] [bp-4h]@9 + signed int v87; // [sp+24h] [bp-4h]@19 + signed int v88; // [sp+24h] [bp-4h]@31 + signed int v89; // [sp+24h] [bp-4h]@41 + signed int v90; // [sp+24h] [bp-4h]@51 + signed int v91; // [sp+24h] [bp-4h]@61 v1 = &pIndoor->pFaces[uFaceID]; - //this = pGame->pIndoorCameraD3D; - v2 = &pIndoor->pVertices[v1->pVertexIDs[0]]; - //v3 = *(_DWORD *)&v2->x; + _this = pGame->pIndoorCameraD3D; + v2 = &pIndoor->pVertices[*v1->pVertexIDs]; + v3 = *(_DWORD *)&v2->x; v4 = v2->z; - //v5 = 0; - if ( v1->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) - + v1->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) - + v1->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) + v5 = 0; + if ( v1->pFacePlane_old.vNormal.x * ((signed __int16)v3 - pBLVRenderParams->vPartyPos.x) + + v1->pFacePlane_old.vNormal.y * (SHIWORD(v3) - pBLVRenderParams->vPartyPos.y) + + v1->pFacePlane_old.vNormal.z * (v4 - pBLVRenderParams->vPartyPos.z) < 0 ) { - dword_50B700 = 1; + stru_50B700.field_0 = 1; } else { - dword_50B700 = 0; - if ( !v1->Portal() ) + stru_50B700.field_0 = 0; + if ( !(v1->uAttributes & 1) ) return 0; } - //v66 = v1->uNumVertices; - for (uint i = 0; i < v1->uNumVertices; ++i) + v66 = v1->uNumVertices; + if ( (signed int)v1->uNumVertices > 0 ) { - auto v6 = &pIndoor->pVertices[v1->pVertexIDs[i]]; + do + { + v6 = &pIndoor->pVertices[v1->pVertexIDs[v5]]; pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( v6->x, v6->y, v6->z, - &_50B924_view_transformed_xs[i], - &_50B834_view_transformed_zs[i], - &_50B744_view_transformed_ys[i], + &stru_50B700._view_transformed_xs[v5 + 3], + &stru_50B700._view_transformed_zs[v5 + 3], + &stru_50B700._view_transformed_ys[v5 + 3], 0); + ++v5; + } + while ( v5 < v66 ); } - - //v7 = v1->uNumVertices; - //v8 = 0; - if (v1->uNumVertices <= 0) + v7 = v66; + v8 = 0; + if ( v66 <= 0 ) return 0; - - bool bFound = false; - for (uint i = 0; i < v1->uNumVertices; ++i) - if (_50B924_view_transformed_xs[i] >= 0x80000u) + do + { + if ( stru_50B700._view_transformed_xs[v8 + 3] >= 524288 ) + break; + ++v8; + } + while ( v8 < v66 ); + if ( v8 >= v66 ) + return 0; + v79 = 0; + stru_50B700._view_transformed_xs[v66 + 3] = stru_50B700._view_transformed_xs[3]; + stru_50B700._view_transformed_zs[v66 + 3] = stru_50B700._view_transformed_zs[3]; + stru_50B700._view_transformed_ys[v66 + 3] = stru_50B700._view_transformed_ys[3]; + thisa = stru_50B700._view_transformed_xs[3] >= 524288; + v86 = 1; + if ( v66 >= 1 ) + { + do { - bFound = true; - break; - } - if (!bFound) - return 0; - - v79 = 0; - _50B924_view_transformed_xs[v1->uNumVertices] = _50B924_view_transformed_xs[0]; - _50B834_view_transformed_zs[v1->uNumVertices] = _50B834_view_transformed_zs[0]; - _50B744_view_transformed_ys[v1->uNumVertices] = _50B744_view_transformed_ys[0]; - thisa = _50B924_view_transformed_xs[0] >= (signed int)0x80000u; - //int i = 1; - for (uint i = 1; i <= v1->uNumVertices; ++i) - { - v10 = _50B924_view_transformed_xs[i]; - v81 = v10 >= (signed int)0x80000u; + v9 = v86; + v10 = stru_50B700._view_transformed_xs[v86 + 3]; + v81 = v10 >= 524288; if ( thisa ^ v81 ) { - v11 = _50B924_view_transformed_xs[i - 1]; - if ( v10 >= (signed int)0x80000u ) + v11 = stru_50B700._view_transformed_xs[v9 + 2]; + if ( v10 >= 524288 ) { v12 = v10 - v11; - v13 = 0x80000 - v11; + v13 = 524288 - v11; LODWORD(v14) = v13 << 16; HIDWORD(v14) = v13 >> 16; - v15 = &_50B744_view_transformed_ys[i - 1]; - dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i] - _50B834_view_transformed_zs[i - 1]) * v14 / v12) >> 16) + _50B834_view_transformed_zs[i - 1]; - thisb = (unsigned __int64)((_50B744_view_transformed_ys[i] - _50B744_view_transformed_ys[i - 1]) * v14 / v12) >> 16; + v15 = (char *)&stru_50B700._view_transformed_ys[v9 + 2]; + stru_50B700._view_transformed_zs[v79] = ((unsigned __int64)((stru_50B700._view_transformed_zs[v9 + 3] + - stru_50B700._view_transformed_zs[v9 + 2]) + * v14 + / v12) >> 16) + + stru_50B700._view_transformed_zs[v9 + 2]; + thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[v9 + 3] - stru_50B700._view_transformed_ys[v9 + 2]) + * v14 + / v12) >> 16; } else { v16 = v11 - v10; - v17 = 0x80000 - v10; + v17 = 524288 - v10; LODWORD(v18) = v17 << 16; HIDWORD(v18) = v17 >> 16; - v15 = &_50B744_view_transformed_ys[i]; - dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i - 1] - _50B834_view_transformed_zs[i]) * v18 / v16) >> 16) + _50B834_view_transformed_zs[i]; - thisb = (unsigned __int64)((_50B744_view_transformed_ys[i - 1] - _50B744_view_transformed_ys[i]) * v18 / v16) >> 16; + v15 = (char *)&stru_50B700._view_transformed_ys[v9 + 3]; + stru_50B700._view_transformed_zs[v79] = ((unsigned __int64)((stru_50B700._view_transformed_zs[v9 + 2] + - stru_50B700._view_transformed_zs[v9 + 3]) + * v18 + / v16) >> 16) + + stru_50B700._view_transformed_zs[v9 + 3]; + thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[v9 + 2] - stru_50B700._view_transformed_ys[v9 + 3]) + * v18 + / v16) >> 16; } v19 = v79++; - //v7 = v66; - dword_50B738[v19] = thisb + *v15; - dword_50B918[v19] = 0x80000u; + v7 = v66; + stru_50B700._view_transformed_ys[v19] = thisb + *(_DWORD *)v15; + stru_50B700._view_transformed_xs[v19] = 524288; } if ( v81 ) { v20 = v79++; - dword_50B918[v20] = _50B924_view_transformed_xs[i]; - dword_50B828[v20] = _50B834_view_transformed_zs[i]; - dword_50B738[v20] = _50B744_view_transformed_ys[i]; + stru_50B700._view_transformed_xs[v20] = stru_50B700._view_transformed_xs[v9 + 3]; + stru_50B700._view_transformed_zs[v20] = stru_50B700._view_transformed_zs[v9 + 3]; + stru_50B700._view_transformed_ys[v20] = stru_50B700._view_transformed_ys[v9 + 3]; } - //++i; + ++v86; thisa = v81; + } + while ( v86 <= v7 ); } + v87 = 0; v21 = v79; - dword_50B918[v79] = dword_50B918[0]; - dword_50B828[v79] = dword_50B828[0]; - dword_50B738[v79] = dword_50B738[0]; - for (ia = 0; ia < v79; ++ia) + stru_50B700._view_transformed_xs[v79] = stru_50B700._view_transformed_xs[0]; + stru_50B700._view_transformed_zs[v79] = stru_50B700._view_transformed_zs[0]; + for ( stru_50B700._view_transformed_ys[v79] = stru_50B700._view_transformed_ys[0]; + v87 < v79; + stru_50B700._screen_space_y[v22 + 12] = pBLVRenderParams->uViewportCenterY - v35 ) { - v22 = ia; - thisc = abs(dword_50B918[ia]); - if ( abs(dword_50B828[ia]) >> 13 <= thisc ) + v22 = v87; + thisc = abs(stru_50B700._view_transformed_xs[v87]); + if ( abs(stru_50B700._view_transformed_zs[v87]) >> 13 <= thisc ) { - v27 = dword_50B828[v22]; + v27 = stru_50B700._view_transformed_zs[v22]; LODWORD(v28) = v27 << 16; HIDWORD(v28) = v27 >> 16; - v26 = v28 / dword_50B918[v22]; + v26 = v28 / stru_50B700._view_transformed_xs[v22]; v23 = 0; } else { v23 = 0; v24 = 0; - if ( dword_50B828[v22] >= 0 ) + if ( stru_50B700._view_transformed_zs[v22] >= 0 ) { - LOBYTE(v24) = dword_50B918[v22] >= 0; - v26 = ((v24 - 1) & 0xFF800000) + 0x400000; + LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; + v26 = ((v24 - 1) & 0xFF800000) + 4194304; } else { - LOBYTE(v24) = dword_50B918[v22] >= 0; + LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; v25 = v24 - 1; - v26 = (v25 & 0x800000) - 0x400000; + v26 = (v25 & 0x800000) - 4194304; } } - v29 = dword_50B738[v22]; - dword_50BAF8_xs[v22] = v26; + v29 = stru_50B700._view_transformed_ys[v22]; + stru_50B700._screen_space_x[v22 + 12] = v26; if ( abs(v29) >> 13 <= thisc ) { - v33 = dword_50B738[v22]; + v33 = stru_50B700._view_transformed_ys[v22]; LODWORD(v34) = v33 << 16; HIDWORD(v34) = v33 >> 16; - v32 = v34 / dword_50B918[v22]; + v32 = v34 / stru_50B700._view_transformed_xs[v22]; } else { v30 = 0; - if ( dword_50B738[v22] >= v23 ) + if ( stru_50B700._view_transformed_ys[v22] >= v23 ) { - LOBYTE(v30) = dword_50B918[v22] >= v23; - v32 = ((v30 - 1) & 0xFF800000) + 0x400000; + LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; + v32 = ((v30 - 1) & 0xFF800000) + 4194304; } else { - LOBYTE(v30) = dword_50B918[v22] >= v23; + LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; v31 = v30 - 1; - v32 = (v31 & 0x800000) - 0x400000; + v32 = (v31 & 0x800000) - 4194304; } } - dword_50BA08_ys[v22] = v32; - dword_50BAF8_xs[v22] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BAF8_xs[v22]) >> 16; - v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08_ys[v22]) >> 16; - dword_50BAF8_xs[v22] = pBLVRenderParams->uViewportCenterX - dword_50BAF8_xs[v22]; - dword_50BA08_ys[v22] = pBLVRenderParams->uViewportCenterY - v35; + stru_50B700._screen_space_y[v22 + 12] = v32; + stru_50B700._screen_space_x[v22 + 12] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) + * (signed __int64)stru_50B700._screen_space_x[v22 + 12]) >> 16; + v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._screen_space_y[v22 + 12]) >> 16; + stru_50B700._screen_space_x[v22 + 12] = pBLVRenderParams->uViewportCenterX - stru_50B700._screen_space_x[v22 + 12]; + ++v87; } v36 = 0; - dword_50BAF8_xs[v21] = dword_50BAF8_xs[0]; - dword_50BA08_ys[v21] = dword_50BA08_ys[0]; + stru_50B700._screen_space_x[v21 + 12] = stru_50B700._screen_space_x[12]; + stru_50B700._screen_space_y[v21 + 12] = stru_50B700._screen_space_y[12]; v37 = pBLVRenderParams->uViewportX; - v38 = dword_50BAF8_xs[0] < (signed int)pBLVRenderParams->uViewportX; - LOBYTE(v38) = dword_50BAF8_xs[0] >= (signed int)pBLVRenderParams->uViewportX; + v38 = stru_50B700._screen_space_x[12] < (signed int)pBLVRenderParams->uViewportX; + LOBYTE(v38) = stru_50B700._screen_space_x[12] >= (signed int)pBLVRenderParams->uViewportX; v39 = 1; - ib = 1; + v88 = 1; if ( v79 < 1 ) return 0; do { v40 = v39; - v41 = dword_50BAF8_xs[v40]; + v41 = stru_50B700._screen_space_x[v40 + 12]; v82 = v41 >= (signed int)v37; if ( v38 ^ v82 ) { if ( v41 >= (signed int)v37 ) { - v67 = (signed int)(v37 - dword_50BAF8_xs[v40 - 1]) * (signed __int64)(dword_50BA08_ys[v40] - dword_50BA08_ys[v40 - 1]) / (v41 - dword_50BAF8_xs[v40 - 1]); - v42 = dword_50BA08_ys[v40 - 1]; + v67 = (signed int)(v37 - stru_50B700._screen_space_x[v40 + 11]) + * (signed __int64)(stru_50B700._screen_space_y[v40 + 12] - stru_50B700._screen_space_y[v40 + 11]) + / (v41 - stru_50B700._screen_space_x[v40 + 11]); + v42 = stru_50B700._screen_space_y[v40 + 11]; } else { - v67 = (signed int)(v37 - v41) * (signed __int64)(dword_50BA08_ys[v40 - 1] - dword_50BA08_ys[v40]) / (dword_50BAF8_xs[v40 - 1] - v41); - v42 = dword_50BA08_ys[v40]; + v67 = (signed int)(v37 - v41) + * (signed __int64)(stru_50B700._screen_space_y[v40 + 11] - stru_50B700._screen_space_y[v40 + 12]) + / (stru_50B700._screen_space_x[v40 + 11] - v41); + v42 = stru_50B700._screen_space_y[v40 + 12]; } - dword_50B9FC_ys[v36] = v67 + v42; + ++v36; + stru_50B700._screen_space_y[v36 + 8] = v67 + v42; v37 = pBLVRenderParams->uViewportX; - dword_50BAEC_xs[v36] = pBLVRenderParams->uViewportX; - ++v36; + stru_50B700._screen_space_x[v36 + 8] = pBLVRenderParams->uViewportX; } v38 = v82; if ( v82 ) { - dword_50BAEC_xs[v36] = dword_50BAF8_xs[v40]; - dword_50B9FC_ys[v36] = dword_50BA08_ys[v40]; - ++v36; + stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[v40 + 12]; + stru_50B700._screen_space_y[v36++ + 9] = stru_50B700._screen_space_y[v40 + 12]; } - v39 = ib++ + 1; + v39 = v88++ + 1; } - while ( ib <= v79 ); - - if (v36 < 1) + while ( v88 <= v79 ); + if ( !v36 + || (v43 = 0, + stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[9], + stru_50B700._screen_space_y[v36 + 9] = stru_50B700._screen_space_y[9], + v44 = pBLVRenderParams->uViewportZ, + thisd = stru_50B700._screen_space_x[9] <= (signed int)pBLVRenderParams->uViewportZ, + v89 = 1, + v36 < 1) ) return 0; - - v43 = 0; - dword_50BAEC_xs[v36] = dword_50BAEC_xs[0]; - dword_50B9FC_ys[v36] = dword_50B9FC_ys[0]; - v44 = pBLVRenderParams->uViewportZ; - thisd = dword_50BAEC_xs[0] <= (signed int)pBLVRenderParams->uViewportZ; - ic = 1; - do { - v45 = ic; - v46 = dword_50BAEC_xs[ic]; + v45 = v89; + v46 = stru_50B700._screen_space_x[v89 + 9]; v83 = v46 <= (signed int)v44; if ( thisd ^ v83 ) { if ( v46 <= (signed int)v44 ) { - v68 = (signed int)(v44 - dword_50BAEC_xs[v45 - 1]) * (signed __int64)(dword_50B9FC_ys[v45] - dword_50B9FC_ys[v45 - 1]) / (v46 - dword_50BAEC_xs[v45 - 1]); - v47 = dword_50B9FC_ys[v45 - 1]; + v68 = (signed int)(v44 - stru_50B700._screen_space_x[v45 + 8]) + * (signed __int64)(stru_50B700._screen_space_y[v45 + 9] - stru_50B700._screen_space_y[v45 + 8]) + / (v46 - stru_50B700._screen_space_x[v45 + 8]); + v47 = stru_50B700._screen_space_y[v45 + 8]; } else { - v68 = (signed int)(v44 - v46) * (signed __int64)(dword_50B9FC_ys[v45 - 1] - dword_50B9FC_ys[v45]) / (dword_50BAEC_xs[v45 - 1] - v46); - v47 = dword_50B9FC_ys[v45]; + v68 = (signed int)(v44 - v46) + * (signed __int64)(stru_50B700._screen_space_y[v45 + 8] - stru_50B700._screen_space_y[v45 + 9]) + / (stru_50B700._screen_space_x[v45 + 8] - v46); + v47 = stru_50B700._screen_space_y[v45 + 9]; } - dword_50B9F0[v43] = v68 + v47; + ++v43; + stru_50B700._screen_space_y[v43 + 5] = v68 + v47; v44 = pBLVRenderParams->uViewportZ; - dword_50BAE0[v43] = pBLVRenderParams->uViewportZ; - ++v43; + stru_50B700._screen_space_x[v43 + 5] = pBLVRenderParams->uViewportZ; } if ( v83 ) { - dword_50BAE0[v43] = dword_50BAEC_xs[v45]; - dword_50B9F0[v43++] = dword_50B9FC_ys[v45]; + stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[v45 + 9]; + stru_50B700._screen_space_y[v43++ + 6] = stru_50B700._screen_space_y[v45 + 9]; } - ++ic; + ++v89; thisd = v83; } - while ( ic <= v36 ); - - if (v43 < 1) + while ( v89 <= v36 ); + if ( !v43 + || (v48 = 0, + stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[6], + stru_50B700._screen_space_y[v43 + 6] = stru_50B700._screen_space_y[6], + v49 = pBLVRenderParams->uViewportY, + v50 = stru_50B700._screen_space_y[6] < (signed int)pBLVRenderParams->uViewportY, + LOBYTE(v50) = stru_50B700._screen_space_y[6] >= (signed int)pBLVRenderParams->uViewportY, + v51 = 1, + v90 = 1, + v43 < 1) ) return 0; - - v48 = 0; - dword_50BAE0[v43] = dword_50BAE0[0]; - dword_50B9F0[v43] = dword_50B9F0[0]; - v49 = pBLVRenderParams->uViewportY; - v50 = dword_50B9F0[0] < (signed int)pBLVRenderParams->uViewportY; - LOBYTE(v50) = dword_50B9F0[0] >= (signed int)pBLVRenderParams->uViewportY; - v51 = 1; - id = 1; do { v52 = v51; - v53 = dword_50B9F0[v52]; + v53 = stru_50B700._screen_space_y[v52 + 6]; v84 = v53 >= (signed int)v49; if ( v50 ^ v84 ) { if ( v53 >= (signed int)v49 ) { - v69 = (signed int)(v49 - dword_50B9F0[v52 - 1]) * (signed __int64)(dword_50BAE0[v52] - dword_50BAE0[v52 - 1]) / (v53 - dword_50B9F0[v52 - 1]); - v54 = dword_50BAE0[v52 - 1]; + v69 = (signed int)(v49 - stru_50B700._screen_space_y[v52 + 5]) + * (signed __int64)(stru_50B700._screen_space_x[v52 + 6] - stru_50B700._screen_space_x[v52 + 5]) + / (v53 - stru_50B700._screen_space_y[v52 + 5]); + v54 = stru_50B700._screen_space_x[v52 + 5]; } else { - v69 = (signed int)(v49 - v53) * (signed __int64)(dword_50BAE0[v52 - 1] - dword_50BAE0[v52]) / (dword_50B9F0[v52 - 1] - v53); - v54 = dword_50BAE0[v52]; + v69 = (signed int)(v49 - v53) + * (signed __int64)(stru_50B700._screen_space_x[v52 + 5] - stru_50B700._screen_space_x[v52 + 6]) + / (stru_50B700._screen_space_y[v52 + 5] - v53); + v54 = stru_50B700._screen_space_x[v52 + 6]; } - dword_50BAD4[v48] = v69 + v54; + ++v48; + stru_50B700._screen_space_x[v48 + 2] = v69 + v54; v49 = pBLVRenderParams->uViewportY; - dword_50B9E4[v48] = pBLVRenderParams->uViewportY; - ++v48; + stru_50B700._screen_space_y[v48 + 2] = pBLVRenderParams->uViewportY; } v50 = v84; if ( v84 ) { - dword_50BAD4[v48] = dword_50BAE0[v52]; - dword_50B9E4[v48++] = dword_50B9F0[v52]; + stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[v52 + 6]; + stru_50B700._screen_space_y[v48++ + 3] = stru_50B700._screen_space_y[v52 + 6]; } - v51 = id++ + 1; + v51 = v90++ + 1; } - while ( id <= v43 ); - - if (v48 < 1) + while ( v90 <= v43 ); + if ( !v48 + || (v55 = 0, + stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[3], + stru_50B700._screen_space_y[v48 + 3] = stru_50B700._screen_space_y[3], + v56 = pBLVRenderParams->uViewportW, + thise = stru_50B700._screen_space_y[3] <= (signed int)pBLVRenderParams->uViewportW, + v91 = 1, + v48 < 1) ) return 0; - - v55 = 0; - dword_50BAD4[v48] = dword_50BAD4[0]; - dword_50B9E4[v48] = dword_50B9E4[0]; - v56 = pBLVRenderParams->uViewportW; - thise = dword_50B9E4[0] <= (signed int)pBLVRenderParams->uViewportW; - ie = 1; do { - v57 = ie; - v58 = dword_50B9E4[ie]; + v57 = v91; + v58 = stru_50B700._screen_space_y[v91 + 3]; v85 = v58 <= (signed int)v56; if ( thise ^ v85 ) { if ( v58 <= (signed int)v56 ) { - v70 = (signed int)(v56 - dword_50B9E4[v57 - 1]) * (signed __int64)(dword_50BAD4[v57] - dword_50BAD4[v57 - 1]) / (v58 - dword_50B9E4[v57 - 1]); - v59 = dword_50BAD4[v57 - 1]; + v70 = (signed int)(v56 - stru_50B700._screen_space_y[v57 + 2]) + * (signed __int64)(stru_50B700._screen_space_x[v57 + 3] - stru_50B700._screen_space_x[v57 + 2]) + / (v58 - stru_50B700._screen_space_y[v57 + 2]); + v59 = stru_50B700._screen_space_x[v57 + 2]; } else { - v70 = (signed int)(v56 - v58) * (signed __int64)(dword_50BAD4[v57 - 1] - dword_50BAD4[v57]) / (dword_50B9E4[v57 - 1] - v58); - v59 = dword_50BAD4[v57]; + v70 = (signed int)(v56 - v58) + * (signed __int64)(stru_50B700._screen_space_x[v57 + 2] - stru_50B700._screen_space_x[v57 + 3]) + / (stru_50B700._screen_space_y[v57 + 2] - v58); + v59 = stru_50B700._screen_space_x[v57 + 3]; } - _50BAC8_screen_space_x[v55] = v70 + v59; + ++v55; + //stru_50B700._screen_space_y[v55 + 59] = v70 + v59; + stru_50B700._screen_space_x[v55 - 1] = v70 + v59; v56 = pBLVRenderParams->uViewportW; - _50B9D8_screen_space_y[v55] = pBLVRenderParams->uViewportW; - ++v55; + //stru_50B700._view_transformed_xs[v55 + 47] = pBLVRenderParams->uViewportW; + stru_50B700._screen_space_y[v55 - 1] = pBLVRenderParams->uViewportW; } if ( v85 ) { - _50BAC8_screen_space_x[v55] = dword_50BAD4[v57]; - _50B9D8_screen_space_y[v55++] = dword_50B9E4[v57]; + stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[v57 + 3]; + stru_50B700._screen_space_y[v55++] = stru_50B700._screen_space_y[v57 + 3]; } - ++ie; + ++v91; thise = v85; } - while ( ie <= v48 ); - + while ( v91 <= v48 ); if ( !v55 ) return 0; v61 = pRenderer->pRenderD3D == 0; - _50BAC8_screen_space_x[v55] = _50BAC8_screen_space_x[0]; - _50B9D8_screen_space_y[v55] = _50B9D8_screen_space_y[0]; + stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; + stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; if ( v61 && v55 > 3 ) { - _50BAC8_screen_space_x[v55 + 1] = _50BAC8_screen_space_x[1]; - _50B9D8_screen_space_y[v55 + 1] = _50B9D8_screen_space_y[1]; - thisf = 2 * (dword_50B700 != 0) - 1; + stru_50B700._screen_space_x[v55 + 1] = stru_50B700._screen_space_x[1]; + stru_50B700._screen_space_y[v55 + 1] = stru_50B700._screen_space_y[1]; + thisf = 2 * (stru_50B700.field_0 != 0) - 1; if ( v55 > 0 ) { v62 = 1; @@ -2353,8 +1965,10 @@ if ( v64 >= v55 ) v64 -= v55; if ( thisf - * ((_50B9D8_screen_space_y[v64] - _50B9D8_screen_space_y[v63]) * (_50BAC8_screen_space_x[v62] - _50BAC8_screen_space_x[v63]) - - (_50B9D8_screen_space_y[v62] - _50B9D8_screen_space_y[v63]) * (_50BAC8_screen_space_x[v64] - _50BAC8_screen_space_x[v63])) < 0 ) + * ((stru_50B700._screen_space_y[v64] - stru_50B700._screen_space_y[v63]) + * (stru_50B700._screen_space_x[v62] - stru_50B700._screen_space_x[v63]) + - (stru_50B700._screen_space_y[v62] - stru_50B700._screen_space_y[v63]) + * (stru_50B700._screen_space_x[v64] - stru_50B700._screen_space_x[v63])) < 0 ) { v62 = v80; v71 = v80; @@ -2365,20 +1979,25 @@ v65 = v71; if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) { - memcpy(&_50B9D8_screen_space_y[v65], &_50B9D8_screen_space_y[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); - memcpy(&_50BAC8_screen_space_x[v65], &_50BAC8_screen_space_x[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); + memcpy( + &stru_50B700._screen_space_y[v65], + &stru_50B700._screen_space_y[v65 + 1], + 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); + memcpy( + &stru_50B700._screen_space_x[v65], + &stru_50B700._screen_space_x[v65 + 1], + 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); } --v55; } } while ( v62 - 1 < v55 ); } - _50BAC8_screen_space_x[v55] = _50BAC8_screen_space_x[0]; - _50B9D8_screen_space_y[v55] = _50B9D8_screen_space_y[0]; + stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; + stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; } return v55; -}*/ - +} //----- (00424579) -------------------------------------------------------- int __fastcall sub_424579(int uFaceID, stru320 *a2) { @@ -2796,7 +2415,7 @@ { v62 = stru_50B700._screen_space_x[v55] << 16; v54 = ((stru_50B700._screen_space_x[v13] - stru_50B700._screen_space_x[v55]) << 16) / (stru_50B700._screen_space_y[v13] - stru_50B700._screen_space_y[v55]); - a2->viewport_left_side[min_y] = LOWORD(stru_50B700._screen_space_x[v55]); + a2->array_18[min_y] = LOWORD(stru_50B700._screen_space_x[v55]); } v15 = v65; v61 = v65; @@ -2833,13 +2452,13 @@ { v61 = stru_50B700._screen_space_x[v20] << 16; v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20]; - a2->viewport_right_side[max_y] = LOWORD(stru_50B700._screen_space_x[v20]); + a2->array_3D8[max_y] = LOWORD(stru_50B700._screen_space_x[v20]); } v22 = min_y; if ( min_y <= max_y ) { - //v56 = &a2->viewport_right_side[v7]; - //v23 = &a2->viewport_left_side[v7]; + //v56 = &a2->array_3D8[v7]; + //v23 = &a2->array_18[v7]; for ( v70 = min_y; v70 <= max_y; ++v70 ) { v24 = v13; @@ -2880,21 +2499,21 @@ v61 = stru_50B700._screen_space_x[v29] << 16; } } - //v34 = (char *)a2->viewport_left_side - (char *)a2->viewport_right_side; - //v35 = *(__int16 *)((char *)&a2->viewport_right_side[v70] + v34); + //v34 = (char *)a2->array_18 - (char *)a2->array_3D8; + //v35 = *(__int16 *)((char *)&a2->array_3D8[v70] + v34); //v35 = HIWORD(v62); - a2->viewport_left_side[v70] = HIWORD(v62); - a2->viewport_right_side[v70] = HIWORD(v61); + a2->array_18[v70] = HIWORD(v62); + a2->array_3D8[v70] = HIWORD(v61); //v34 = &a2->array_3D8[v70]; //v35 = a2->array_3D8[v70]; - if ( a2->viewport_left_side[v70] > a2->viewport_right_side[v70] ) + if ( a2->array_18[v70] > a2->array_3D8[v70] ) { - v36 = a2->viewport_left_side[v70] ^ a2->viewport_right_side[v70]; - v37 = a2->viewport_right_side[v70]; - a2->viewport_left_side[v70] = v36; + v36 = a2->array_18[v70] ^ a2->array_3D8[v70]; + v37 = a2->array_3D8[v70]; + a2->array_18[v70] = v36; v38 = v37 ^ v36; - a2->viewport_left_side[v70] ^= v38; - a2->viewport_right_side[v70] = v38; + a2->array_18[v70] ^= v38; + a2->array_3D8[v70] = v38; } //++v56; v62 += v54; @@ -2914,11 +2533,11 @@ if ( min_y <= max_y ) { //a3a = (char *)a2 - (char *)a3; - //v42 = &a3->viewport_right_side[v7]; + //v42 = &a3->array_3D8[v7]; //v57 = *(__int16 *)((char *)v42 + a3a); for ( v71 = min_y; v71 <= max_y; ++v71 ) { - if ( a2->viewport_left_side[v71] >= a3->viewport_left_side[v71] && a2->viewport_left_side[v71] <= a3->viewport_right_side[v71] ) + if ( a2->array_18[v71] >= a3->array_18[v71] && a2->array_18[v71] <= a3->array_3D8[v71] ) break; //++v57; ++min_y; @@ -2928,11 +2547,11 @@ if ( max_y < min_y ) return false; //a3a = (char *)a2 - (char *)a3; - //v43 = &a3->viewport_right_side[v8]; + //v43 = &a3->array_3D8[v8]; //v58 = *(__int16 *)((char *)v43 + a3a); for ( v72 = max_y; v72 >= min_y; --v72 ) { - if ( a2->viewport_right_side[v72] >= a3->viewport_left_side[v72] && a2->viewport_left_side[v72] <= a3->viewport_right_side[v72] ) + if ( a2->array_3D8[v72] >= a3->array_18[v72] && a2->array_18[v72] <= a3->array_3D8[v72] ) break; //--v58; --max_y; @@ -2943,40 +2562,40 @@ return false; //a3b = (char *)a3 - (char *)a2; v59 = min_y; - //v45 = &a2->viewport_left_side[v7]; + //v45 = &a2->array_18[v7]; for ( v46 = max_y - min_y + 1; v46; --v46 ) { //v47 = *(__int16 *)((char *)v45 + a3b); - if ( a2->viewport_left_side[v59] < a3->viewport_left_side[v59] ) - a2->viewport_left_side[v59] = a3->viewport_left_side[v59]; - if ( a2->viewport_right_side[v59] > a3->viewport_right_side[v59] ) - a2->viewport_right_side[v59] = a3->viewport_right_side[v59]; + if ( a2->array_18[v59] < a3->array_18[v59] ) + a2->array_18[v59] = a3->array_18[v59]; + if ( a2->array_3D8[v59] > a3->array_3D8[v59] ) + a2->array_3D8[v59] = a3->array_3D8[v59]; ++v59; //++v45; } a2->_viewport_space_y = min_y; a2->_viewport_space_w = max_y; - a2->field_8 = a2->viewport_left_side[min_y]; - //v48 = a2->viewport_right_side[v7]; + a2->field_8 = a2->array_18[min_y]; + //v48 = a2->array_3D8[v7]; a2->field_10 = min_y; a2->field_14 = min_y; - a2->field_C = a2->viewport_right_side[min_y]; + a2->field_C = a2->array_3D8[min_y]; v49 = min_y + 1; if ( v49 <= max_y ) { - //v50 = &a2->viewport_right_side[v49]; + //v50 = &a2->array_3D8[v49]; for ( v49; v49 <= max_y; ++v49 ) { - //v51 = a2->viewport_left_side[v49]; - if ( a2->viewport_left_side[v49] < a2->field_8 ) + //v51 = a2->array_18[v49]; + if ( a2->array_18[v49] < a2->field_8 ) { - a2->field_8 = a2->viewport_left_side[v49]; + a2->field_8 = a2->array_18[v49]; a2->field_10 = v49; } - if ( a2->viewport_right_side[v49] > a2->field_C ) + if ( a2->array_3D8[v49] > a2->field_C ) { - a2->field_C = a2->viewport_right_side[v49]; + a2->field_C = a2->array_3D8[v49]; a2->field_14 = v49; } //++v50; diff -r 2a1ca27945e1 -r 2767980b98bb mm7_2.cpp --- a/mm7_2.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/mm7_2.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -7986,86 +7986,6 @@ return uCurrentMenuID; } - -//----- (00467E7F) -------------------------------------------------------- -void sub_467E7F_EquipBody(ITEM_EQUIP_TYPE uEquipType) -{ - //unsigned int v1; // esi@1 - int v2; // ebx@1 - Player *v3; // eax@1 - int v4; // edx@1 - int v5; // esi@2 - //int v6; // eax@2 - unsigned int v7; // eax@3 - ItemGen _this; // [sp+Ch] [bp-30h]@1 - //Player *v9; // [sp+30h] [bp-Ch]@1 - int v10; // [sp+34h] [bp-8h]@1 - int *v11; // [sp+38h] [bp-4h]@1 - - static unsigned char byte_4E8398[200] = // 4E8398 - { - 1, // EQUIP_OFF_HAND - 1, // EQUIP_MAIN_HAND - 2, // EQUIP_BOW - 3, // EQUIP_ARMOUR - 0, // EQUIP_SHIELD - 4, // EQUIP_HELMET - 5, // EQUIP_BELT - 6, // EQUIP_CLOAK - 7, // EQUIP_GAUNTLETS - 8, // EQUIP_BOOTS - 10, // EQUIP_RING - 9, // EQUIP_AMULET - 1, // EQUIP_WAND - 0, // EQUIP_REAGENT - 0, // EQUIP_POTION - 0, // EQUIP_SPELL_SCROLL - 0, // EQUIP_BOOK - 0, // EQUIP_MESSAGE_SCROLL - 0, // EQUIP_GOLD - 0, // EQUIP_GEM - 0, // EQUIP_NONE - // ??? - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, - 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0 -}; - - _this.Reset(); - v2 = byte_4E8398[uEquipType]; - v3 = pPlayers[uActiveCharacter]; - v11 = (int *)&v3->pEquipment.pIndices[v2]; - v4 = *v11; - v10 = *v11; - if ( v10 ) - { - memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - v5 = (int)((char *)v3 + 4 * (9 * v4 - 9)); - *(char *)(v5 + 556) = 0; - pParty->pPickedItem.Reset(); - pParty->SetHoldingItem((ItemGen *)(v5 + 532)); - _this.uBodyAnchor = v2 + 1; - memcpy((void *)(v5 + 532), &_this, 0x24u); - *v11 = v10; - } - else - { - v7 = v3->FindFreeInventorySlot(); - if (v7 >= 0) - { - pParty->pPickedItem.uBodyAnchor = v2 + 1; - memcpy(&v3->pInventoryItems[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItems[v7])); - *v11 = v7 + 1; - pMouse->RemoveHoldingItem(); - } - } -} - //----- (00467F48) -------------------------------------------------------- void CreateMsgScrollWindow( signed int mscroll_id ) { @@ -8239,7 +8159,7 @@ } if ( pParty->pPickedItem.uItemID == 604 ) { - sub_467E7F_EquipBody((ITEM_EQUIP_TYPE)3); + pPlayers[uActiveCharacter]->EquipBody((ITEM_EQUIP_TYPE)3); WetsuitOn(uActiveCharacter); return; } @@ -8264,7 +8184,7 @@ pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); return; } - sub_467E7F_EquipBody((ITEM_EQUIP_TYPE)v6); + pPlayers[uActiveCharacter]->EquipBody((ITEM_EQUIP_TYPE)v6); if ( pParty->pPickedItem.uItemID == 604 ) WetsuitOff(uActiveCharacter); return; diff -r 2a1ca27945e1 -r 2767980b98bb mm7_3.cpp --- a/mm7_3.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/mm7_3.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -25,6 +25,7 @@ #include "Party.h" #include "AudioPlayer.h" #include "Outdoor.h" +#include "Outdoor_stuff.h" #include "IndoorCamera.h" #include "Overlays.h" #include "LOD.h" diff -r 2a1ca27945e1 -r 2767980b98bb mm7_4.cpp --- a/mm7_4.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/mm7_4.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -24,6 +24,7 @@ #include "Party.h" #include "AudioPlayer.h" #include "Outdoor.h" +#include "Outdoor_stuff.h" #include "IndoorCamera.h" #include "LOD.h" #include "Actor.h" @@ -3594,26 +3595,26 @@ v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; v38 = *v37; v39 = a3->GetValue(); - v29 = pPlayer->_4B8233(v39, v38); + v29 = pPlayer->GetBaseBuyingPrice(v39, v38); switch ( a5 ) { case 3: v44 = *v37; v45 = a3->GetValue(); - v29 = pPlayer->_4B8213(v45, v44); + v29 = pPlayer->GetBaseSellingPrice(v45, v44); break; case 4: - v29 = pPlayer->_4B824B(*v37); + v29 = pPlayer->GetBaseIdentifyPrice(*v37); break; case 5: v42 = *v37; v43 = a3->GetValue(); - v29 = pPlayer->_4B8265(v43, v42); + v29 = pPlayer->GetBaseRepairPrice(v43, v42); break; case 6: v40 = *v37; v41 = a3->GetValue(); - v29 = pPlayer->_4B8213(v41, v40) / 2; + v29 = pPlayer->GetBaseSellingPrice(v41, v40) / 2; break; } goto _continue_sprintf; diff -r 2a1ca27945e1 -r 2767980b98bb mm7_5.cpp --- a/mm7_5.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/mm7_5.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -3409,7 +3409,7 @@ break; case UIMSG_PlayerCreationClickOK: GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0); - if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() ) + if ( PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Chose4Skills() ) GameUI_Footer_TimeLeft = GetTickCount() + 4000; else uGameState = GAME_STATE_STARTING_NEW_GAME; diff -r 2a1ca27945e1 -r 2767980b98bb mm7_6.cpp --- a/mm7_6.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/mm7_6.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -6,6 +6,7 @@ + #include "Sprites.h" #include "BSPModel.h" #include "OutdoorCamera.h" @@ -20,6 +21,7 @@ #include "Party.h" #include "AudioPlayer.h" #include "Outdoor.h" +#include "Outdoor_stuff.h" #include "Overlays.h" #include "LOD.h" #include "Actor.h" diff -r 2a1ca27945e1 -r 2767980b98bb mm7_data.cpp --- a/mm7_data.cpp Sat Jun 15 17:39:01 2013 +0600 +++ b/mm7_data.cpp Sat Jun 15 17:39:20 2013 +0600 @@ -887,7 +887,7 @@ int ai_arrays_size; // weak std::array ai_near_actors_distances; std::array ai_near_actors_ids; -std::array dword_4F8580; // weak +std::array dword_4F8580; // weak diff -r 2a1ca27945e1 -r 2767980b98bb mm7_data.h --- a/mm7_data.h Sat Jun 15 17:39:01 2013 +0600 +++ b/mm7_data.h Sat Jun 15 17:39:20 2013 +0600 @@ -3,7 +3,6 @@ #include "VectorTypes.h" #include "OSAPI.h" #include -#include "Items.h" //TODO: remove this once sub_467E7F_EquipBody if moved to a class or something typedef char _UNKNOWN; @@ -528,7 +527,7 @@ extern int ai_arrays_size; // weak extern std::array ai_near_actors_distances; extern std::array ai_near_actors_ids; -extern std::array dword_4F8580; // weak +extern std::array dword_4F8580; // weak extern int dword_4FA9B0[]; // weak extern int dword_4FA9B4[]; // weak @@ -1344,7 +1343,6 @@ enum MENU_STATE GetCurrentMenuID(); void *__thiscall output_debug_string(void *_this, std::string a2, const char *a3, int a4); std::string *__fastcall _4678E2_make_error_string(std::string *a1, int line, std::string file); -void sub_467E7F_EquipBody(ITEM_EQUIP_TYPE uEquipType); // idb void CreateMsgScrollWindow(signed int mscroll_id); void __cdecl free_book_subwindow(); void CreateScrollWindow(); @@ -1448,7 +1446,7 @@ void __fastcall RGB2HSV(float *a1, float *a2, float a3, float a4, float a5, float *a6); unsigned int ReplaceHSV(unsigned int uColor, float a2, float gamma, float a4); signed int __cdecl PlayerCreation_Chose4Skills(); -signed int __cdecl PlayerCreation_ComputeAttributeBonus(); +signed int __cdecl PlayerCreation_GetUnspentAttributePointCount(); void LoadPlayerPortraintsAndVoices(); int __fastcall ReloadPlayerPortraits(int, int); // weak void sub_491E3A(); diff -r 2a1ca27945e1 -r 2767980b98bb stru367.h --- a/stru367.h Sat Jun 15 17:39:01 2013 +0600 +++ b/stru367.h Sat Jun 15 17:39:20 2013 +0600 @@ -7,34 +7,12 @@ struct stru367 { int field_0; - int field_4[13]; - int field_38[2]; - int _view_transformed_ys_minus1; - int _view_transformed_ys[57]; - int field_128[2]; - int _view_transformed_zs_minus1; - int _view_transformed_zs[57]; - int field_218[2]; - int _view_transformed_xs_minus1; - int _view_transformed_xs[45]; - int _screen_space_y[2]; - int field_2E0; - int field_2E4[2]; - int field_2EC; - int field_2F0[2]; - int field_2F8; - int _ys[3]; - int _ys2[48]; - int _screen_space_x[2]; - int field_3D0; - int field_3D4[2]; - int field_3DC; - //int field_3E0; - int _xs[54]; - int field_3E4; - int field_3E8; - int _xs2[3]; - int _xs3[48]; + std::array field_4; + std::array _view_transformed_ys; + std::array _view_transformed_zs; + std::array _view_transformed_xs; + std::array _screen_space_y; + std::array _screen_space_x; }; #pragma pack(pop)