Mercurial > mm7
changeset 1745:9ab644fb39aa
Merge
author | Ritor1 |
---|---|
date | Fri, 27 Sep 2013 18:58:48 +0600 |
parents | 2b5c8fe78e79 (current diff) 4b0e19d91505 (diff) |
children | f305a00a6d98 |
files | |
diffstat | 18 files changed, 944 insertions(+), 1753 deletions(-) [+] |
line wrap: on
line diff
--- a/CastSpellInfo.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/CastSpellInfo.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -2996,7 +2996,7 @@ if ( pLevelDecorations[v445].IsInteractive() ) { activeLevelDecoration = &pLevelDecorations[v445]; - EventProcessor(stru_5E4C90._decor_events[pLevelDecorations[v445]._idx_in_stru123 - 75] + 380, 0, 1); + EventProcessor(stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v445]._idx_in_stru123 - 75] + 380, 0, 1); activeLevelDecoration = NULL; } }
--- a/Events.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/Events.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -654,12 +654,12 @@ v25 = EVT_DWORD(_evt->v5); if ( v25 ) { - stru_5E4C90._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; + stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; } else { v26 = (LevelDecoration *)activeLevelDecoration; - stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; + stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; v26->uFlags |= LEVEL_DECORATION_INVISIBLE; } ++curr_seq_num;
--- a/Events.h Fri Sep 27 18:58:25 2013 +0600 +++ b/Events.h Fri Sep 27 18:58:48 2013 +0600 @@ -257,14 +257,9 @@ VAR_Eradicated = 0x79, VAR_MajorCondition = 0x7A, VAR_MapPersistentVariable_0 = 123, - VAR_MapPersistentVariable_1 = 124, - VAR_MapPersistentVariable_2 = 125, - VAR_MapPersistentVariable_3 = 126, - VAR_MapPersistentVariable_4 = 127, - VAR_MapPersistentVariable_5 = 0x80, - VAR_NPCs = 0xD6, - VAR_Reputation = 0xD7, - VAR_ActiveSpells = 0xDE, + VAR_MapPersistentVariable_74 = 0xC5, + VAR_MapPersistentVariable_75 = 0xC6, + VAR_MapPersistentVariable_99 = 0xDE, VAR_AutoNotes = 0xDF, VAR_IsMightMoreThanBase = 0xE0, VAR_IsIntellectMoreThanBase = 0xE1,
--- a/Indoor.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/Indoor.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -2419,7 +2419,7 @@ pGameLoadingUI_ProgressBar->Progress(); - memcpy(&stru_5E4C90, pData, 0xC8); + memcpy(&stru_5E4C90_MapPersistVars, pData, 0xC8); pData += 0xC8; pGameLoadingUI_ProgressBar->Progress(); @@ -3874,7 +3874,7 @@ { v21 = v35 + 1; pDecortaion->_idx_in_stru123 = v35 + 75; - v22 = stru_5E4C90._decor_events[v21 + 74 - 75]; + v22 = stru_5E4C90_MapPersistVars._decor_events[v21 + 74 - 75]; v35 = v21; if ( !v22 ) pDecortaion->uFlags |= LEVEL_DECORATION_INVISIBLE; @@ -6132,7 +6132,7 @@ return 1; v10 = v8->_idx_in_stru123; v24 = 1; - v11 = stru_5E4C90._decor_events[v10 - 75] + 380; + v11 = stru_5E4C90_MapPersistVars._decor_events[v10 - 75] + 380; activeLevelDecoration = v8; EventProcessor(v11, 0, 1); activeLevelDecoration = NULL;
--- a/Outdoor.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/Outdoor.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -2299,7 +2299,7 @@ //v96 = (char *)v95 + (int)pFilename; pGameLoadingUI_ProgressBar->Progress(); - memcpy(&stru_5E4C90, pSrc, 0xC8); + memcpy(&stru_5E4C90_MapPersistVars, pSrc, 0xC8); pSrc += 0xC8; pGameLoadingUI_ProgressBar->Progress(); @@ -2700,7 +2700,7 @@ { v6 = v1 + 75; decor->_idx_in_stru123 = v6; - if ( !stru_5E4C90._decor_events[v1++] ) + if ( !stru_5E4C90_MapPersistVars._decor_events[v1++] ) decor->uFlags |= LEVEL_DECORATION_INVISIBLE; } }
--- a/Party.h Fri Sep 27 18:58:25 2013 +0600 +++ b/Party.h Fri Sep 27 18:58:48 2013 +0600 @@ -155,7 +155,7 @@ // int field_50[170]; __int64 Shops_next_generation_time[85];//field_50 __int64 _shop_ban_times[53]; - int field_4A0[20]; + unsigned __int64 CounterEventValues[10]; int field_4F0[38]; char field_588[2]; __int64 _s_times[21]; //5d8 440h+8*51
--- a/Player.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/Player.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -24,6 +24,7 @@ #include "Awards.h" #include "texts.h" +#include "stru123.h" #include "mm7_data.h" #include "MM7.h" #include "SpriteObject.h" @@ -1688,7 +1689,6 @@ //----- (0048D0B9) -------------------------------------------------------- int Player::GetRangedAttack() { - int v2; // eax@1 int v3; // edi@3 int v4; // eax@4 int v5; // edi@4 @@ -4985,98 +4985,79 @@ } } + +bool CmpSkillValue(int valToCompare, int skillValue) +{ + int v4; + if ( valToCompare <= 63 ) + v4 = skillValue & 0x3F; + else + v4 = valToCompare & skillValue; + return v4 >= valToCompare; +} + //----- (00449BB4) -------------------------------------------------------- -bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive +bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive and v4 was -1 by default { Assert(pValue >= 0, "Compare variable shouldn't have negative arguments"); signed int v4; // edi@1 - unsigned int v5; // eax@8 - int v6; // eax@9 - enum CHARACTER_RACE v7; // eax@11 - signed int v8; // eax@17 - unsigned __int8 v9; // sf@17 - unsigned __int8 v10; // of@17 - int v11; // eax@19 - unsigned int v12; // eax@20 - unsigned int test_bit_value; // eax@25 + unsigned __int8 test_bit_value; // eax@25 unsigned __int8 byteWithRequestedBit; // cl@25 - signed int v15; // ecx@28 - ItemGen *v16; // eax@28 - int v18; // edi@90 DDM_DLV_Header *v19; // eax@122 DDM_DLV_Header *v21; // eax@126 - unsigned int v22; // edi@129 - Player *v23; // esi@134 - ItemGen *v24; // ecx@135 - signed int v25; // edx@135 - ITEM_EQUIP_TYPE v26; // ebx@155 - char *v27; // edi@155 - int v28; // ebx@161 - int v29; // eax@161 - - v6 = 0; - v4 = -1; + int actStat; // ebx@161 + int baseStat; // eax@161 + if ( VarNum > VAR_AutoNotes ) { switch ( VarNum ) { - case VAR_Invisible: - if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 ) + case VAR_AutoNotes : //TODO: find out why the double subtraction. or whether this is even used + test_bit_value = 0x80u >> (pValue - 2) % 8; + byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8]; + return (test_bit_value & byteWithRequestedBit) != 0; + case VAR_IsMightMoreThanBase: + actStat = GetActualMight(); + baseStat = GetBaseStrength(); + return (actStat >= baseStat); + case VAR_IsIntellectMoreThanBase: + actStat = GetActualIntelligence(); + baseStat = GetBaseIntelligence(); + return (actStat >= baseStat); + case VAR_IsPersonalityMoreThanBase: + actStat = GetActualWillpower(); + baseStat = GetBaseWillpower(); + return (actStat >= baseStat); + case VAR_IsEnduranceMoreThanBase: + actStat = GetActualEndurance(); + baseStat = GetBaseEndurance(); + return (actStat >= baseStat); + case VAR_IsSpeedMoreThanBase: + actStat = GetActualSpeed(); + baseStat = GetBaseSpeed(); + return (actStat >= baseStat); + case VAR_IsAccuracyMoreThanBase: + actStat = GetActualAccuracy(); + baseStat = GetBaseAccuracy(); + return (actStat >= baseStat); + case VAR_IsLuckMoreThanBase: + actStat = GetActualLuck(); + baseStat = GetBaseLuck(); + return (actStat >= baseStat); + case VAR_PlayerBits: + test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; + byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8]; + return ( test_bit_value & byteWithRequestedBit ) != 0; + case VAR_NPCs2: + return pNPCStats->pNewNPCData[pValue].Hired(); + case VAR_IsFlying: + if ( pParty->bFlying + && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) return true; return false; - case VAR_NumDeaths: - v4 = pParty->uNumDeaths; - return v4 >= pValue; - case VAR_NumBounties: - v4 = pParty->uNumBountiesCollected; - return v4 >= pValue; - case VAR_PrisonTerms: - v4 = pParty->uNumPrisonTerms; - return v4 >= pValue; - case VAR_ArenaWinsPage: - v4 = (unsigned __int8)pParty->uNumArenaPageWins; - return v4 >= pValue; - case VAR_ArenaWinsSquire: - v4 = (unsigned __int8)pParty->uNumArenaSquireWins; - return v4 >= pValue; - case VAR_ArenaWinsKnight: - v4 = (unsigned __int8)pParty->uNumArenaKnightWins; - return v4 >= pValue; - case VAR_ArenaWinsLord: - v4 = (unsigned __int8)pParty->uNumArenaLordWins; - return v4 >= pValue; - case VAR_ReputationInCurrentLocation: - v19 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v19 = &pIndoor->dlv; - v6 = v19->uReputation >= pValue; - return v6; - case VAR_Unknown1: - v21 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v21 = &pIndoor->dlv; - v6 = v21->field_C_alert == pValue; - return v6; - case VAR_Counter1: - case VAR_Counter2: - case VAR_Counter3: - case VAR_Counter4: - case VAR_Counter5: - case VAR_Counter6: - case VAR_Counter7: - case VAR_Counter8: - case VAR_Counter9: - case VAR_Counter10: - v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; - if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] - && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) - + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) - return true; - return false; - case VAR_NumSkillPoints: - v4 = this->uSkillPoints; - return v4 >= pValue; + case VAR_HiredNPCHasSpeciality: + return CheckHiredNPCSpeciality(pValue); case VAR_CircusPrises: //isn't used in MM6 since 0x1D6u is a book of regeneration v4 = 0; for (int playerNum = 0; playerNum < 4; playerNum++) @@ -5099,25 +5080,52 @@ } } return v4 >= pValue; + case VAR_NumSkillPoints: + return this->uSkillPoints >= (unsigned int)pValue; case VAR_MonthIs: - v6 = pParty->uCurrentMonth == pValue; - return v6; - case VAR_IsFlying: - if ( pParty->bFlying - && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) ) - return true; - return false; - case VAR_HiredNPCHasSpeciality: - return CheckHiredNPCSpeciality(pValue); - case VAR_NPCs2: - return pNPCStats->pNewNPCData[pValue].Hired(); - case VAR_PlayerBits: - test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; - byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8]; - if ( !((unsigned __int8)test_bit_value & byteWithRequestedBit) ) - return v4 >= pValue; - v4 = pValue; - return v4 >= pValue; + return (pParty->uCurrentMonth == (unsigned int)pValue); + case VAR_Counter1: + case VAR_Counter2: + case VAR_Counter3: + case VAR_Counter4: + case VAR_Counter5: + case VAR_Counter6: + case VAR_Counter7: + case VAR_Counter8: + case VAR_Counter9: + case VAR_Counter10: + if (pParty->field_3C.CounterEventValues[VarNum - VAR_Counter1]) //originally (signed __int64)(__PAIR__(*(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304], *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) + { + return (pParty->field_3C.CounterEventValues[VarNum - VAR_Counter1] + 460800 * pValue * 0.033333335) <= pParty->uTimePlayed ; + } + case VAR_ReputationInCurrentLocation: + v19 = &pOutdoor->ddm; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) + v19 = &pIndoor->dlv; + return (v19->uReputation >= pValue); + case VAR_Unknown1: + v21 = &pOutdoor->ddm; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) + v21 = &pIndoor->dlv; + return (v21->field_C_alert == pValue); //yes, equality, not >= + case VAR_GoldInBank: + return pParty->uNumGoldInBank >= (unsigned int)pValue; + case VAR_NumDeaths: + return pParty->uNumDeaths >= (unsigned int)pValue; + case VAR_NumBounties: + return pParty->uNumBountiesCollected >= (unsigned int)pValue; + case VAR_PrisonTerms: + return pParty->uNumPrisonTerms >= pValue; + case VAR_ArenaWinsPage: + return (unsigned __int8)pParty->uNumArenaPageWins >= pValue; + case VAR_ArenaWinsSquire: + return (unsigned __int8)pParty->uNumArenaSquireWins >= pValue; + case VAR_ArenaWinsKnight: + return (unsigned __int8)pParty->uNumArenaKnightWins >= pValue; + case VAR_ArenaWinsLord: + return pParty->uNumArenaLordWins >= pValue; + case VAR_Invisible: + return ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 ); case VAR_ItemEquipped: for (int i = 0; i < 16; i++) { @@ -5127,329 +5135,282 @@ } } return false; - case VAR_GoldInBank: - v4 = pParty->uNumGoldInBank; - return v4 >= pValue; - case VAR_IsMightMoreThanBase: - v28 = GetActualMight(); - v29 = GetBaseStrength(); - return (v28 >= v29); - case VAR_IsIntellectMoreThanBase: - v28 = GetActualIntelligence(); - v29 = GetBaseIntelligence(); - return (v28 >= v29); - case VAR_IsPersonalityMoreThanBase: - v28 = GetActualWillpower(); - v29 = GetBaseWillpower(); - return (v28 >= v29); - case VAR_IsEnduranceMoreThanBase: - v28 = GetActualEndurance(); - v29 = GetBaseEndurance(); - return (v28 >= v29); - case VAR_IsSpeedMoreThanBase: - v28 = GetActualSpeed(); - v29 = GetBaseSpeed(); - return (v28 >= v29); - case VAR_IsAccuracyMoreThanBase: - v28 = GetActualAccuracy(); - v29 = GetBaseAccuracy(); - return (v28 >= v29); - case VAR_IsLuckMoreThanBase: - v28 = GetActualLuck(); - v29 = GetBaseLuck(); - return (v28 >= v29); default: return false; } } - if ( VarNum == VAR_AutoNotes ) //TODO: find out why the double subtraction. or whether this is even used - { - test_bit_value = 0x80u >> (pValue - 2) % 8; - byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8]; - return (test_bit_value & byteWithRequestedBit); - } - if ( VarNum <= VAR_BaseLuck ) - { - if ( VarNum != VAR_BaseLuck ) - { - switch ( VarNum ) + if ( VarNum <= VAR_MajorCondition ) + { + switch ( VarNum ) + { + case VAR_Sex: + return ( pValue == this->uSex ); + case VAR_Class: + return ( pValue == this->classType ); + case VAR_Race: + return pValue == GetRace(); + case VAR_CurrentHP: + return this->sHealth >= pValue; + case VAR_MaxHP: + return (this->sHealth >= GetMaxHealth()); + case VAR_CurrentSP: + return this->sMana >= pValue; + case VAR_MaxSP: + return (this->sMana >= GetMaxMana()); + case VAR_ActualAC: + return GetActualAC() >= pValue; + case VAR_ACModifier: + return this->sACModifier >= pValue; + case VAR_BaseLevel: + return this->uLevel >= pValue; + case VAR_LevelModifier: + return this->sLevelModifier >= pValue; + case VAR_Age: + return GetActualAge() >= (unsigned int)pValue; + case VAR_Award: + test_bit_value = 0x80u >> (pValue - 1) % 8; + byteWithRequestedBit = this->_achieved_awards_bits[(pValue - 1) /8]; + return ( test_bit_value & byteWithRequestedBit ) != 0; + case VAR_Experience: + return this->uExperience >= pValue; //TODO change pValue to long long + case VAR_QBits_QuestsDone: + test_bit_value = 0x80u >> (pValue - 1) % 8; + byteWithRequestedBit = pParty->_quest_bits[(pValue - 1)/8]; + return ( test_bit_value & byteWithRequestedBit ) != 0; + case VAR_PlayerItemInHands: + for (int i = 0; i < 138; i++) { - case VAR_Hour: - if ( (long long)(pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) - return true; - return false; - case VAR_DayOfYear: - if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 336 + 1 == pValue) - return true; - return false; - case VAR_DayOfWeek: - if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 7) - return true; - return false; - case VAR_Sex: - if ( pValue == this->uSex ) - return true; - return false; - case VAR_Class: - if ( pValue == this->classType ) - return true; - return false; - case VAR_Race: - if ( pValue == GetRace() ) - return true; - return v4 >= pValue; - case VAR_CurrentHP: - v4 = this->sHealth; - return v4 >= pValue; - case VAR_MaxHP: - v8 = GetMaxHealth(); - v9 = this->sHealth; - return (v9 >= v8); - case VAR_CurrentSP: - v4 = this->sMana; - return v4 >= pValue; - case VAR_MaxSP: - v8 = GetMaxMana(); - v9 = this->sMana; - return (v9 >= v8); - case VAR_ActualAC: - v4 = GetActualAC(); - return v4 >= pValue; - case VAR_ACModifier: - v4 = this->sACModifier; - return v4 >= pValue; - case VAR_BaseLevel: - v4 = this->uLevel; - return v4 >= pValue; - case VAR_LevelModifier: - v4 = this->sLevelModifier; - return v4 >= pValue; - case VAR_Age: - v4 = GetActualAge(); - return v4 >= pValue; - case VAR_Award: - test_bit_value = 0x80u >> (pValue - 1) % 8; - byteWithRequestedBit = this->_achieved_awards_bits[(pValue - 1) /8]; - return ( test_bit_value & byteWithRequestedBit ); - case VAR_Experience: - v4 = LODWORD(this->uExperience); - return v4 >= pValue; - case VAR_QBits_QuestsDone: - test_bit_value = 0x80u >> (pValue - 1) % 8; - byteWithRequestedBit = pParty->_quest_bits[(pValue - 1)/8]; - return ( test_bit_value & byteWithRequestedBit ); - case VAR_PlayerItemInHands: - for (int i = 0; i < 138; i++) - { - if (pInventoryItemList[i].uItemID == pValue) - { - return true; - } - } - return pParty->pPickedItem.uItemID == pValue; - case VAR_FixedGold: - v4 = pParty->uNumGold; - return v4 >= pValue; - case VAR_MightBonus: - v4 = this->uMightBonus; - return v4 >= pValue; - case VAR_IntellectBonus: - v4 = this->uIntelligenceBonus; - return v4 >= pValue; - case VAR_PersonalityBonus: - v4 = this->uWillpowerBonus; - return v4 >= pValue; - case VAR_EnduranceBonus: - v4 = this->uEnduranceBonus; - return v4 >= pValue; - case VAR_SpeedBonus: - v4 = this->uSpeedBonus; - return v4 >= pValue; - case VAR_AccuracyBonus: - v4 = this->uAccuracyBonus; - return v4 >= pValue; - case VAR_LuckBonus: - v4 = this->uLuckBonus; - return v4 >= pValue; - case VAR_BaseMight: - v4 = this->uMight; - return v4 >= pValue; - case VAR_BaseIntellect: - v4 = this->uIntelligence; - return v4 >= pValue; - case VAR_BasePersonality: - v4 = this->uWillpower; - return v4 >= pValue; - case VAR_BaseEndurance: - v4 = this->uEndurance; - return v4 >= pValue; - case VAR_BaseSpeed: - v4 = this->uSpeed; - return v4 >= pValue; - case VAR_BaseAccuracy: - v4 = this->uAccuracy; - return v4 >= pValue; - case VAR_FixedFood: - v4 = pParty->uNumFoodRations; - return v4 >= pValue; - default: - return false; - } - } - v4 = this->uLuck; - return v4 >= pValue; - } - if ( VarNum <= VAR_MagicResistance ) - { - if ( VarNum == VAR_MagicResistance ) - { - v4 = this->sResMagicBase; - } - else - { - switch ( VarNum ) - { - case VAR_FireResistance: - v4 = this->sResFireBase; - return v4 >= pValue; - case VAR_AirResistance: - v4 = this->sResAirBase; - return v4 >= pValue; - case VAR_WaterResistance: - v4 = this->sResWaterBase; - return v4 >= pValue; - case VAR_EarthResistance: - v4 = this->sResEarthBase; - return v4 >= pValue; - case VAR_SpiritResistance: - v4 = this->sResSpiritBase; - return v4 >= pValue; - case VAR_MindResistance: - v4 = this->sResMindBase; - return v4 >= pValue; - case VAR_BodyResistance: - v4 = this->sResBodyBase; - return v4 >= pValue; - case VAR_LightResistance: - v4 = this->sResLightBase; - return v4 >= pValue; - case VAR_DarkResistance: - v4 = this->sResDarkBase; - return v4 >= pValue; - case VAR_ActualMight: - v4 = GetActualMight(); - return v4 >= pValue; - case VAR_ActualIntellect: - v4 = GetActualIntelligence(); - return v4 >= pValue; - case VAR_ActualPersonality: - v4 = GetActualWillpower(); - return v4 >= pValue; - case VAR_ActualEndurance: - v4 = GetActualEndurance(); - return v4 >= pValue; - case VAR_ActualSpeed: - v4 = GetActualSpeed(); - return v4 >= pValue; - case VAR_ActualAccuracy: - v4 = GetActualAccuracy(); - return v4 >= pValue; - case VAR_ActualLuck: - v4 = GetActualLuck(); - return v4 >= pValue; - break; - default: - return v4 >= pValue; - } - } - return v4 >= pValue; - } - if ( VarNum <= VAR_DisarmTrapSkill ) - { - if ( VarNum != VAR_DisarmTrapSkill ) - { - if ( VarNum <= VAR_MindResistanceBonus ) - { - switch ( VarNum ) + if (pInventoryItemList[i].uItemID == pValue) { - case VAR_MindResistanceBonus: - v4 = this->sResMindBonus; - return v4 >= pValue; - case VAR_FireResistanceBonus: - v4 = this->sResFireBonus; - return v4 >= pValue; - case VAR_AirResistanceBonus: - v4 = this->sResAirBonus; - return v4 >= pValue; - case VAR_WaterResistanceBonus: - v4 = this->sResWaterBonus; - return v4 >= pValue; - case VAR_EarthResistanceBonus: - v4 = this->sResEarthBonus; - return v4 >= pValue; - case VAR_SpiritResistanceBonus: - v4 = this->sResSpiritBonus; - return v4 >= pValue; + return true; } } - if ( VarNum == VAR_BodyResistanceBonus ) - { - v4 = this->sResBodyBonus; - return v4 >= pValue; - } - if ( VarNum == VAR_LightResistanceBonus ) + return pParty->pPickedItem.uItemID == pValue; + case VAR_Hour: + if ( (long long)(pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) + return true; + return false; + case VAR_DayOfYear: + if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 336 + 1 == pValue) + return true; + return false; + case VAR_DayOfWeek: + if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 7) + return true; + return false; + case VAR_FixedGold: + return pParty->uNumGold >= (unsigned int)pValue; + case VAR_FixedFood: + return pParty->uNumFoodRations >= (unsigned int)pValue; + case VAR_MightBonus: + return this->uMightBonus >= pValue; + case VAR_IntellectBonus: + return this->uIntelligenceBonus >= pValue; + case VAR_PersonalityBonus: + return this->uWillpowerBonus >= pValue; + case VAR_EnduranceBonus: + return this->uEnduranceBonus >= pValue; + case VAR_SpeedBonus: + return this->uSpeedBonus >= pValue; + case VAR_AccuracyBonus: + return this->uAccuracyBonus >= pValue; + case VAR_LuckBonus: + return this->uLuckBonus >= pValue; + case VAR_BaseMight: + return this->uMight >= pValue; + case VAR_BaseIntellect: + return this->uIntelligence >= pValue; + case VAR_BasePersonality: + return this->uWillpower >= pValue; + case VAR_BaseEndurance: + return this->uEndurance >= pValue; + case VAR_BaseSpeed: + return this->uSpeed >= pValue; + case VAR_BaseAccuracy: + return this->uAccuracy >= pValue; + case VAR_BaseLuck: + return this->uLuck >= pValue; + case VAR_ActualMight: + return GetActualMight() >= pValue; + case VAR_ActualIntellect: + return GetActualIntelligence() >= pValue; + case VAR_ActualPersonality: + return GetActualWillpower() >= pValue; + case VAR_ActualEndurance: + return GetActualEndurance() >= pValue; + case VAR_ActualSpeed: + return GetActualSpeed() >= pValue; + case VAR_ActualAccuracy: + return GetActualAccuracy() >= pValue; + case VAR_ActualLuck: + return GetActualLuck() >= pValue; + case VAR_FireResistance: + return this->sResFireBase >= pValue; + case VAR_AirResistance: + return this->sResAirBase >= pValue; + case VAR_WaterResistance: + return this->sResWaterBase >= pValue; + case VAR_EarthResistance: + return this->sResEarthBase >= pValue; + case VAR_SpiritResistance: + return this->sResSpiritBase >= pValue; + case VAR_MindResistance: + return this->sResMindBase >= pValue; + case VAR_BodyResistance: + return this->sResBodyBase >= pValue; + case VAR_LightResistance: + return this->sResLightBase >= pValue; + case VAR_DarkResistance: + return this->sResDarkBase >= pValue; + case VAR_PhysicalResistance: + Error("Physical resistance isn't used in events"); + return false; + case VAR_MagicResistance: + return this->sResMagicBase >= pValue; + case VAR_FireResistanceBonus: + return this->sResFireBonus >= pValue; + case VAR_AirResistanceBonus: + return this->sResAirBonus >= pValue; + case VAR_WaterResistanceBonus: + return this->sResWaterBonus >= pValue; + case VAR_EarthResistanceBonus: + return this->sResEarthBonus >= pValue; + case VAR_SpiritResistanceBonus: + return this->sResSpiritBonus >= pValue; + case VAR_MindResistanceBonus: + return this->sResMindBonus >= pValue; + case VAR_BodyResistanceBonus: + return this->sResBodyBonus >= pValue; + case VAR_LightResistanceBonus: + return this->sResLightBonus >= pValue; + case VAR_DarkResistanceBonus: + return this->sResDarkBonus >= pValue; + case VAR_MagicResistanceBonus: + return this->sResMagicBonus >= pValue; + case VAR_StaffSkill: + return CmpSkillValue(pValue, this->skillStaff); + case VAR_SwordSkill: + return CmpSkillValue(pValue, this->skillSword); + case VAR_DaggerSkill: + return CmpSkillValue(pValue, this->skillDagger); + case VAR_AxeSkill: + return CmpSkillValue(pValue, this->skillAxe); + case VAR_SpearSkill: + return CmpSkillValue(pValue, this->skillSpear); + case VAR_BowSkill: + return CmpSkillValue(pValue, this->skillBow); + case VAR_MaceSkill: + return CmpSkillValue(pValue, this->skillMace); + case VAR_BlasterSkill: + return CmpSkillValue(pValue, this->skillBlaster); + case VAR_ShieldSkill: + return CmpSkillValue(pValue, this->skillShield); + case VAR_LeatherSkill: + return CmpSkillValue(pValue, this->skillLeather); + case VAR_SkillChain: + return CmpSkillValue(pValue, this->skillChain); + case VAR_PlateSkill: + return CmpSkillValue(pValue, this->skillPlate); + case VAR_FireSkill: + return CmpSkillValue(pValue, this->skillFire); + case VAR_AirSkill: + return CmpSkillValue(pValue, this->skillAir); + case VAR_WaterSkill: + return CmpSkillValue(pValue, this->skillWater); + case VAR_EarthSkill: + return CmpSkillValue(pValue, this->skillEarth); + case VAR_SpiritSkill: + return CmpSkillValue(pValue, this->skillSpirit); + case VAR_MindSkill: + return CmpSkillValue(pValue, this->skillMind); + case VAR_BodySkill: + return CmpSkillValue(pValue, this->skillBody); + case VAR_LightSkill: + return CmpSkillValue(pValue, this->skillLight); + case VAR_DarkSkill: + return CmpSkillValue(pValue, this->skillDark); + case VAR_IdentifyItemSkill: + return CmpSkillValue(pValue, this->skillItemId); + case VAR_MerchantSkill: + return CmpSkillValue(pValue, this->skillMerchant); + case VAR_RepairSkill: + return CmpSkillValue(pValue, this->skillRepair); + case VAR_BodybuildingSkill: + return CmpSkillValue(pValue, this->skillBodybuilding); + case VAR_MeditationSkill: + return CmpSkillValue(pValue, this->skillMeditation); + case VAR_PerceptionSkill: + return CmpSkillValue(pValue, this->skillPerception); + case VAR_DiplomacySkill: + return CmpSkillValue(pValue, this->skillDiplomacy); + case VAR_ThieverySkill: + Error("Thievery isn't used in events"); + return false; + case VAR_DisarmTrapSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillDisarmTrap); + case VAR_DodgeSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillDodge); + case VAR_UnarmedSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillUnarmed); + case VAR_IdentifyMonsterSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillMonsterId); + case VAR_ArmsmasterSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillArmsmaster); + case VAR_StealingSkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillStealing); + case VAR_AlchemySkill: //wasn't in the original + return CmpSkillValue(pValue, this->skillAlchemy); + case VAR_LearningSkill: + return CmpSkillValue(pValue, this->skillLearning); + case VAR_Cursed: + return pConditions[Condition_Cursed] > 0; + case VAR_Weak: + return pConditions[Condition_Weak] > 0; + case VAR_Asleep: + return pConditions[Condition_Sleep] > 0; + case VAR_Afraid: + return pConditions[Condition_Fear] > 0; + case VAR_Drunk: + return pConditions[Condition_Drunk] > 0; + case VAR_Insane: + return pConditions[Condition_Insane] > 0; + case VAR_PoisonedGreen: + return pConditions[Condition_Poison1] > 0; + case VAR_DiseasedGreen: + return pConditions[Condition_Disease1] > 0; + case VAR_PoisonedYellow: + return pConditions[Condition_Poison2] > 0; + case VAR_DiseasedYellow: + return pConditions[Condition_Disease2] > 0; + case VAR_PoisonedRed: + return pConditions[Condition_Poison3] > 0; + case VAR_DiseasedRed: + return pConditions[Condition_Disease3] > 0; + case VAR_Paralyzed: + return pConditions[Condition_Paralyzed] > 0; + case VAR_Unconsious: + return pConditions[Condition_Unconcious] > 0; + case VAR_Dead: + return pConditions[Condition_Dead] > 0; + case VAR_Stoned: + return pConditions[Condition_Pertified] > 0; + case VAR_Eradicated: + return pConditions[Condition_Eradicated] > 0; + case VAR_MajorCondition: + v4 = GetMajorConditionIdx(); + if ( v4 != 18 ) { - v4 = this->sResLightBonus; - return v4 >= pValue; - } - if ( VarNum == VAR_DarkResistanceBonus ) - { - v4 = this->sResDarkBonus; - return v4 >= pValue; - } - if ( VarNum == VAR_MagicResistanceBonus ) - { - v4 = this->sResMagicBonus; return v4 >= pValue; } - if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) - return v4 >= pValue; - } - v18 = *((short *)&this->pConditions[16] + VarNum); - if ( pValue <= 63 ) - v4 = v18 & 0x3F; - else - v4 = pValue & v18; - return v4 >= pValue; - } - if ( VarNum == 104 ) - { - v18 = *((short *)&this->pConditions[16] + VarNum); - if ( pValue <= 63 ) - v4 = v18 & 0x3F; - else - v4 = pValue & v18; - return v4 >= pValue; - } - if ( (signed int)VarNum <= 104 ) - return v4 >= pValue; - if ( (signed int)VarNum > 0x79 ) - { - if ( VarNum != 122 ) - { - if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) - v4 = (unsigned __int8)byte_5E4C15[VarNum]; - return v4 >= pValue; - } - v4 = GetMajorConditionIdx(); - if ( v4 != 18 ) - { - return v4 >= pValue; - } - v4 = pValue; - return v4 >= pValue; - } - return (this->pConditions[VarNum - 105] > 0);// *((int *)this + 2 * VarNum - 210); the original was never used, which is why probably it wasn't correct + return true; + } + } + if ( (signed int)VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_74 ) + return (unsigned __int8)stru_5E4C90_MapPersistVars.field_0[VarNum - VAR_MapPersistentVariable_0] > 0; // originally (unsigned __int8)byte_5E4C15[VarNum]; + if ( (signed int)VarNum >= VAR_MapPersistentVariable_75 && VarNum <= VAR_MapPersistentVariable_99 ) + return (unsigned __int8)stru_5E4C90_MapPersistVars._decor_events[VarNum - VAR_MapPersistentVariable_75] > 0; //not really sure whether the number gets up to 99, but can't ignore the possibility + + return false; } @@ -5893,7 +5854,7 @@ { if ( var_type != VAR_MajorCondition ) { - if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) + if ( var_type > VAR_MajorCondition && var_type <= VAR_MapPersistentVariable_99 ) byte_5E4C15[var_type] = var_value; return; } @@ -6403,7 +6364,7 @@ { if ( var_type != VAR_MajorCondition ) { - if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) + if ( var_type > VAR_MajorCondition && var_type <= VAR_MapPersistentVariable_99 ) { if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) byte_5E4C15[var_type] += val;
--- a/SaveLoad.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/SaveLoad.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -430,7 +430,7 @@ data_write_pos += 16000; memcpy(data_write_pos, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size); data_write_pos += pIndoor->blv.uDoors_ddata_Size; - memcpy(data_write_pos, &stru_5E4C90, 0xC8); + memcpy(data_write_pos, &stru_5E4C90_MapPersistVars, 0xC8); data_write_pos += 200; memcpy(data_write_pos, &pIndoor->stru1, 0x38); data_write_pos += 56; @@ -475,7 +475,7 @@ data_write_pos += 4; memcpy(data_write_pos, pChests.data(), sizeof(Chest)* uNumChests); data_write_pos += sizeof(Chest)* uNumChests; - memcpy(data_write_pos, &stru_5E4C90, 0xC8); + memcpy(data_write_pos, &stru_5E4C90_MapPersistVars, 0xC8); data_write_pos += 200; memcpy(data_write_pos, &pOutdoor->loc_time, 0x38); data_write_pos += 56;
--- a/UI/UIHouses.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/UI/UIHouses.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -988,41 +988,14 @@ void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) { int experience_for_next_level; // eax@5 - GUIWindow *v8; // esi@10 int v16; // eax@32 - int v17; // eax@33 - int v18; // eax@34 - int v19; // eax@35 - __int16 v20; // ax@37 - __int16 v21; // ax@76 - __int16 v22; // ax@107 - __int16 v23; // ax@132 __int16 v24; // ax@163 - unsigned int v34; // eax@211 signed int v36; // esi@227 - int v37; // ecx@227 - int v38; // esi@230 - int v39; // edx@235 - int v40; // edi@243 - unsigned __int64 v41; // qax@243 - signed int v43; // edi@244 - int v44; // edx@244 - int v45; // eax@246 - unsigned int v46; // eax@247 - void *v47; // eax@250 - signed int v48; // edi@250 - int v49; // eax@252 - int v50; // eax@256 - unsigned int v51; // eax@257 - void *v52; // eax@260 - signed int v53; // edi@260 - int v54; // eax@262 + int pPrice; // ecx@227 if ( !pDialogueWindow->pNumPresenceButton ) return; pRenderer->ClearZBuffer(0, 479); - if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) - v8 = window_SpeakInHouse; if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) { if ( in_current_building_type == BuildingType_Training ) @@ -1044,11 +1017,9 @@ pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); - v8 = window_SpeakInHouse; } if ( in_current_building_type != BuildingType_Training ) { - v8 = window_SpeakInHouse; if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) @@ -1058,21 +1029,16 @@ pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); - v8 = window_SpeakInHouse; } else if (uActiveCharacter) { if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) return; - v8 = window_SpeakInHouse; } } dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; if ( in_current_building_type < BuildingType_19 ) - { ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; - v8 = window_SpeakInHouse; - } } //NEW @@ -1095,12 +1061,8 @@ { for ( uint i = 0; i < 12; ++i ) { - if ( pParty->SpellBooksInGuilds[v8->par1C-139][i].uItemID ) - { - v34 = pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[v8->par1C-139][i].GetIconName(), TEXTURE_16BIT_PALETTE); - v8 = window_SpeakInHouse; - ItemsInShopTexture[i] = &pIcons_LOD->pTextures[v34]; - } + if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID ) + ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; } } else//generation new books @@ -1115,17 +1077,17 @@ { if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE ) { - if ( pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)v8->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation + if ( pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation { - pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] = false; - pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)v8->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); - pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; + pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); if ( !v16 ) { while ( 1 ) { - v24 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; + v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) { if ( ((unsigned __int16)v24 < 235 || (unsigned __int16)v24 > 252) @@ -1141,144 +1103,144 @@ && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) break; } - pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; } } if ( v16 == 1 ) { while ( 1 ) { - v23 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; - if ( (unsigned __int16)v23 < 115 || (unsigned __int16)v23 > 132 ) + v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) { - if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) - && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) - && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) - && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) - && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) - && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) - && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) - && ((unsigned __int16)v23 < 4 || (unsigned __int16)v23 > 6) - && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) - && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) - && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) - && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) - && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) - && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) + if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0x52u || (unsigned __int16)v24 > 0x54u) + && ((unsigned __int16)v24 < 4 || (unsigned __int16)v24 > 6) + && ((unsigned __int16)v24 < 0x37u || (unsigned __int16)v24 > 0x39u) + && ((unsigned __int16)v24 < 0x3Au || (unsigned __int16)v24 > 0x3Cu) + && ((unsigned __int16)v24 < 0x3Du || (unsigned __int16)v24 > 0x3Fu) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) + && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) ) break; } - pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; } } if ( v16 == 2 ) { while ( 1 ) { - v22 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; - if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) + v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) { - if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) - && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) - && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) - && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) - && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) - && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) - && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) - && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) - && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) - && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) - && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) + if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0x31u || (unsigned __int16)v24 > 0x33u) + && ((unsigned __int16)v24 < 0x34u || (unsigned __int16)v24 > 0x36u) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) + && ((unsigned __int16)v24 < 0x1Cu || (unsigned __int16)v24 > 0x1Eu) ) break; } - pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; } } if ( v16 == 3 ) { while ( 1 ) { - v21 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; - if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) + v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) { - if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) - && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) - && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) - && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) - && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) - && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) - && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) - && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) - && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) - && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) - && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) - && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) - && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) - && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) + if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) + && ((unsigned __int16)v24 < 0x43u || (unsigned __int16)v24 > 0x45u) + && ((unsigned __int16)v24 < 0x4Fu || (unsigned __int16)v24 > 0x51u) + && ((unsigned __int16)v24 < 0xC1u || (unsigned __int16)v24 > 0xC3u) + && ((unsigned __int16)v24 < 0x13u || (unsigned __int16)v24 > 0x15u) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) + && ((unsigned __int16)v24 < 0x6Au || (unsigned __int16)v24 > 0x6Cu) ) break; } - pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; } } if ( v16 == 4 ) { while ( 1 ) { - v20 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; - if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) + v24 = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) { - if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) - && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) - && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) - && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) - && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) - && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) - && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) - && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) - && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) - && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) - && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) - && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) - && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) - && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) - && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) - && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) - && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) - && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) + if ( ((unsigned __int16)v24 < 0xE8u || (unsigned __int16)v24 > 0xF9u) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) + && ((unsigned __int16)v24 < 0x46u || (unsigned __int16)v24 > 0x48u) + && ((unsigned __int16)v24 < 0x100u || (unsigned __int16)v24 > 0x102u) + && ((unsigned __int16)v24 < 0xD9u || (unsigned __int16)v24 > 0xDBu) + && ((unsigned __int16)v24 < 0xC7u || (unsigned __int16)v24 > 0xC9u) + && ((unsigned __int16)v24 < 0xE5u || (unsigned __int16)v24 > 0xE7u) + && ((unsigned __int16)v24 < 0xDFu || (unsigned __int16)v24 > 0xE1u) + && ((unsigned __int16)v24 < 0x5Bu || (unsigned __int16)v24 > 0x5Du) + && ((unsigned __int16)v24 < 0x49u || (unsigned __int16)v24 > 0x4Bu) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) + && ((unsigned __int16)v24 < 0x10u || (unsigned __int16)v24 > 0x12u) ) break; } - pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand() % 258 + 1; } } } - bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; - if ( !pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] ) + bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( !pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) { bountyHunting_text = pNPCTopics[351].pText;//"В этом месяцу назначена награда за голову %s..." - if ( !pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] ) + if ( !pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) bountyHunting_text = pNPCTopics[353].pText;//"Кое кто уже приходил в этом месяце за наградой" } else { - if ( pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] > 0 )//get prize + if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] > 0 )//get prize { - party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]].uLevel, 0); + party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); for ( uint i = 0; i < 4; ++i ) pParty->pPlayers[i].SetVariable(VAR_Award, 86); - pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]].uLevel; - pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = 0; - pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] = false; + pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel; + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0; + pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; } bountyHunting_text = pNPCTopics[352].pText;//"Поздравляю! Вы успешно..." } } else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE ) - pKeyActionMap->EnterText(1, 10, v8); + pKeyActionMap->EnterText(1, 10, window_SpeakInHouse); break; } case BuildingType_Bank: { if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) - pKeyActionMap->EnterText(1, 10, v8); + pKeyActionMap->EnterText(1, 10, window_SpeakInHouse); return; break; } @@ -1299,272 +1261,6 @@ } } - /* - if ( in_current_building_type > BuildingType_Tavern ) - { - if ( in_current_building_type == BuildingType_Bank ) - { - if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) - pKeyActionMap->EnterText(1, 10, v8); - return; - } - if ( in_current_building_type != BuildingType_Temple && in_current_building_type != BuildingType_Training ) - return; - } - //else - if ( in_current_building_type < BuildingType_Tavern ) - { - if (in_current_building_type <= 0) - return; - if ( in_current_building_type > BuildingType_AlchemistShop ) - { - if ( in_current_building_type <= BuildingType_16 ) - { - if ( (signed __int64)__PAIR__( - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed ) - { - v32 = 0; - do - { - //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); - v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; - if ( v33 ) - { - v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); - v8 = window_SpeakInHouse; - ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; - } - ++v32; - } - while ( v32 < 12 ); - } - else - { - SpellBookGenerator(); - v30 = window_SpeakInHouse->ptr_1C; - v31 = pParty->uTimePlayed - + (signed __int64)((double)(0xA8C000 - //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) - * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) - * 0.033333335); - *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; - *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); - } - return; - } - if ( in_current_building_type != BuildingType_TownHall ) - return; - if ( in_current_building_type == BuildingType_TownHall ) - { - if ( uMessageParam == 99 ) - { - v10 = (int)((char *)v8->ptr_1C - 102); - v56 = v10; - v11 = 8 * v10 + 11325428; - if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed ) - { - v13 = 0; - } - else - { - v12 = v10; - v13 = 0; - pParty->field_75A[v12] = 0; - *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); - v14 = rand() % 258; - v15 = window_SpeakInHouse; - pParty->field_750[v12] = v14 + 1; - v16 = (int)((char *)v15->ptr_1C - 102); - if ( v16 ) - { - v17 = v16 - 1; - if ( v17 ) - { - v18 = v17 - 1; - if ( v18 ) - { - v19 = v18 - 1; - if ( v19 ) - { - if ( v19 == 1 ) - { - while ( 1 ) - { - v20 = pParty->field_750[v12]; - if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) - { - if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) - && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) - && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) - && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) - && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) - && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) - && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) - && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) - && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) - && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) - && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) - && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) - && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) - && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) - && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) - && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) - && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) - && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v21 = pParty->field_750[v12]; - if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) - { - if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) - && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) - && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) - && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) - && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) - && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) - && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) - && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) - && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) - && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) - && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) - && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) - && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) - && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v22 = pParty->field_750[v12]; - if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) - { - if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) - && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) - && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) - && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) - && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) - && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) - && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) - && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) - && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) - && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) - && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v23 = pParty->field_750[v12]; - if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) - { - if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) - && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) - && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) - && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) - && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) - && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) - && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) - && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) - && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) - && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) - && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) - && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) - && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) - && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v24 = pParty->field_750[v12]; - if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) - { - if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) - && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) - && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) - && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) - && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) - && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) - && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) - && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) - && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) - && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) - && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - v10 = v56; - } - v25 = v10; - v26 = pParty->field_750[v25]; - v27 = pParty->field_75A[v25] == v13; - bountyHunting_monster_id_for_hunting = pParty->field_750[v25]; - if ( v27 ) - { - //v1 = 0; - v27 = v26 == v13; - v29 = (int)pNPCTopics[351].pText; - if ( v27 ) - v29 = (int)pNPCTopics[353].pText; - bountyHunting_text = (char *)v29; - } - else - { - if ( v26 != v13 ) - { - party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); - v28 = pParty->pPlayers; - do - { - v28->SetVariable(VAR_Award, 86); - ++v28; - } - while ( (signed int)v28 < (signed int)pParty->pHirelings ); - pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel; - pParty->field_750[v25] = v13; - pParty->field_75A[v25] = v13; - } - //v1 = 0; - bountyHunting_text = pNPCTopics[352].pText; - } - } - else if ( uMessageParam == 100 ) - { - pKeyActionMap->EnterText(1, 10, v8); - } - } - } - } - */ - - -//LABEL_196: switch ( uMessageParam ) { case HOUSE_DIALOGUE_LEARN_SKILLS: @@ -1589,13 +1285,6 @@ } case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: { - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_PlayArcomage; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; break; @@ -1603,7 +1292,7 @@ case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { - if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) + if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] < (signed __int64)pParty->uTimePlayed ) { GenerateStandartShopItems(); GenerateSpecialShopItems(); @@ -1613,59 +1302,47 @@ { if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) { - for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 ) + for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) { - if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID ) - { - v46 = pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].GetIconName(), TEXTURE_16BIT_PALETTE); - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; - } + if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID ) + ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; } } if ( in_current_building_type == BuildingType_WeaponShop ) { - v48 = 0; if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) { - do + for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) { - if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v48].uItemID) - word_F8B158[v48] = rand() % (300 - ItemsInShopTexture[v48]->uTextureHeight); - ++v48; - } - while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ); + if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][i].uItemID) + weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight); } } } - if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) + } + if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) + { + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) + { + if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) + ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].GetIconName(), TEXTURE_16BIT_PALETTE)]; + } + } + if ( in_current_building_type == BuildingType_WeaponShop ) { if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) { - for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 ) + for ( uint i = 0; i < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++i ) { - if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID ) - { - v51 = pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].GetIconName(), TEXTURE_16BIT_PALETTE); - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; - } - } - } - if ( in_current_building_type == BuildingType_WeaponShop ) - { - v53 = 0; - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) - { - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v53].uItemID) - word_F8B158[v53] = rand() % (300 - ItemsInShopTexture[v53]->uTextureHeight); - ++v53; - } - while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType ] ); + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + weapons_Ypos[i] = rand() % (300 - ItemsInShopTexture[i]->uTextureHeight); } } } - break; + } + break; } case HOUSE_DIALOGUE_SHOP_SELL: case HOUSE_DIALOGUE_SHOP_IDENTIFY: @@ -1686,29 +1363,25 @@ { if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) { - v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); - v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v37 < v36 / 3 ) - v37 = v36 / 3; - //if (false) - if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36]) - //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) + v36 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pPrice = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v36 / 3 ) + pPrice = v36 / 3; + if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam - 36]) { - //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam); if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) { - if ( pParty->uNumGold < v37 ) + if ( pParty->uNumGold < pPrice ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) - v39 = 4; + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); else - v39 = 2; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); } else { - Party::TakeGold(v37); + Party::TakeGold(pPrice); dword_F8B1E4 = 1; pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); @@ -1719,192 +1392,6 @@ break; } } - /* - if ( uMessageParam != 95 && uMessageParam != 2 ) - { - if ( uMessageParam == 3 ) - { - dialog_menu_id = 3; - } - else - { - if ( uMessageParam == 4 ) - { - dialog_menu_id = 4; - } - else - { - if ( uMessageParam != 5 ) - { - if ( uMessageParam > 35 ) - { - if ( uMessageParam <= 72 ) - { - v35 = pPlayers[uActiveCharacter]; - //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); - v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); - v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v37 < v36 / 3 ) - v37 = v36 / 3; - - __debugbreak(); - //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] - - if (false) - //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) - { - v38 = (int)(&v35->uIntelligence + uMessageParam); - if ( !*(short *)v38 ) - { - if ( pParty->uNumGold < v37 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) - v39 = 4; - else - v39 = 2; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39); - } - else - { - Party::TakeGold(v37); - dword_F8B1E4 = 1; - *(short *)v38 = 1; - v35->PlaySound(SPEECH_78, 0); - } - } - } - } - else - { - if ( uMessageParam == 94 ) - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - InitializaDialogueOptions_Shops(in_current_building_type); - } - } - } - return; - } - dialog_menu_id = 5; - } - } - sub_421B2C_PlaceInInventory_or_DropPickedItem(); - return; - } - if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) - { - GenerateStandartShopItems(); - GenerateSpecialShopItems(); - v8 = window_SpeakInHouse; - v40 = window_SpeakInHouse->par1C; - //v3 = dword_F8B198; - v41 = pParty->uTimePlayed - //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) - + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) - * 0.033333335); - pParty->field_3C.Shops_next_generation_time[v40] = v41; - - } - v42 = v8->ptr_1C; - v43 = 0; - //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; - v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; - if ( uMessageParam == 2 ) - { - if ( uItemsAmountPerShopType[v44] ) - { - do - { - v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID; - if ( v45 ) - { - v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; - } - v42 = v8->ptr_1C; - ++v43; - } - //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - if ( in_current_building_type == BuildingType_WeaponShop ) - { - v47 = v8->ptr_1C; - v48 = 0; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) - { - do - { - // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] ) - if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID); - { - v49 = rand(); - v8 = window_SpeakInHouse; - word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight); - } - v47 = v8->ptr_1C; - ++v48; - } - //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - } - } - if ( uMessageParam == 95 ) - { - if ( uItemsAmountPerShopType[v44] ) - { - do - { - //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724]; - v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID; - if ( v50 ) - { - v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; - } - v42 = v8->ptr_1C; - ++v43; - } - //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - if ( in_current_building_type == BuildingType_WeaponShop ) - { - v52 = v8->ptr_1C; - v53 = 0; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) - { - do - { - // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID) - { - v54 = rand(); - v8 = window_SpeakInHouse; - word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight); - } - v52 = v8->ptr_1C; - ++v53; - } - //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] ); - } - } - } -*/ } //----- (004B6943) -------------------------------------------------------- void TravelByTransport()
--- a/UI/UISaveLoad.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/UI/UISaveLoad.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -148,219 +148,178 @@ UI_DrawSaveLoad(true); } - //----- (0045E361) -------------------------------------------------------- void LoadUI_Load(unsigned int uDialogueType) { - unsigned int v1; // ebp@5 - unsigned int v2; // eax@5 - //signed int v3; // ebp@11 - FILE *v4; // eax@14 - FILE *v5; // eax@18 - unsigned int v6; // eax@25 - GUIButton *v7; // eax@27 - const char *v8; // [sp-8h] [bp-26Ch]@25 - //char *v9; // [sp-4h] [bp-268h]@19 - enum TEXTURE_TYPE v10; // [sp-4h] [bp-268h]@25 - unsigned int uDialogueType_; // [sp+10h] [bp-254h]@1 - //RGBTexture *pTex; // [sp+10h] [bp-254h]@12 - //SavegameHeader *Dest; // [sp+14h] [bp-250h]@12 - //const char *Str1; // [sp+18h] [bp-24Ch]@12 - LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 - int v16; // [sp+260h] [bp-4h]@1 + LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 - uDialogueType_ = uDialogueType; - dword_6BE138 = -1; - pIcons_LOD->_inlined_sub2(); + dword_6BE138 = -1; + pIcons_LOD->_inlined_sub2(); - memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); - memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture)); - uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); - uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); - uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); - uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); - uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); - uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); - if ( uDialogueType_ ) - { - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); - if ( pCurrentScreen == SCREEN_SAVEGAME ) - { - v1 = uTextureID_save_up; - v2 = uTextureID_LS_saveU; - } - else - { - v1 = uTextureID_load_up; - v2 = uTextureID_LS_loadU; - } - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v2)); - pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(v1)); - pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - } + memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); + memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture)); + uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); + uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); + uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); + uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); + uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); + uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); + if ( uDialogueType ) + { + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); + if ( pCurrentScreen == SCREEN_SAVEGAME ) + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); + } else - { - pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); - } - pGUIWindow_CurrentMenu = GUIWindow::Create(saveload_dlg_xs[uDialogueType_], saveload_dlg_ys[uDialogueType_], saveload_dlg_zs[uDialogueType_], - saveload_dlg_ws[uDialogueType_], WINDOW_MainMenu_Load, 0, 0); - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..." - pRenderer->Present(); - pSavegameList->Initialize(0); - if ( pSaveListPosition > (signed int)uNumSavegameFiles ) - { - pSaveListPosition = 0; - uLoadGameUI_SelectedSlot = 0; - } - pLODFile.AllocSubIndicesAndIO(0x12C, 0); - Assert(sizeof(SavegameHeader) == 0x64); - //v3 = 0; - for (uint i = 0; i < uNumSavegameFiles; ++i) - { + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); + } + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + } + else + pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); + pGUIWindow_CurrentMenu = GUIWindow::Create(saveload_dlg_xs[uDialogueType], saveload_dlg_ys[uDialogueType], saveload_dlg_zs[uDialogueType], + saveload_dlg_ws[uDialogueType], WINDOW_MainMenu_Load, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..." + pRenderer->Present(); + pSavegameList->Initialize(0); + if ( pSaveListPosition > (signed int)uNumSavegameFiles ) + { + pSaveListPosition = 0; + uLoadGameUI_SelectedSlot = 0; + } + pLODFile.AllocSubIndicesAndIO(300, 0); + Assert(sizeof(SavegameHeader) == 100); + for (uint i = 0; i < uNumSavegameFiles; ++i) + { + sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); + if (_access(pTmpBuf.data(), 6)) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" + continue; + } + pLODFile.LoadFile(pTmpBuf.data(), 1); + if ( pLODFile.FindContainer("header.bin", true) ) + fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", true)); + if ( !_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" + if ( !pLODFile.FindContainer("image.pcx", true) ) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); + } + else + { + pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", true), 0, true); + pLODFile.CloseWriteFile(); + pSavegameUsedSlots[i] = 1; + } + } - sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); - if (_access(pTmpBuf.data(), 6)) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" - continue; - } - pLODFile.LoadFile(pTmpBuf.data(), 1); - v4 = pLODFile.FindContainer("header.bin", true); - if ( v4 ) - fread(&pSavegameHeader[i], 0x64, 1, v4); - if ( !_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" - v5 = pLODFile.FindContainer("image.pcx", true); - if ( !v5 ) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); - } - else - { - pSavegameThumbnails[i].LoadFromFILE(v5, 0, true); - pLODFile.CloseWriteFile(); - pSavegameUsedSlots[i] = 1; - } - } - - //LABEL_24: - pLODFile.FreeSubIndexAndIO(); - if ( pCurrentScreen == SCREEN_SAVEGAME ) - { - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD",TEXTURE_16BIT_PALETTE); - } - else - { - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD",TEXTURE_16BIT_PALETTE); - } - uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); - uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); - pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); - pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); - pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); - pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); + pLODFile.FreeSubIndexAndIO(); + if ( pCurrentScreen == SCREEN_SAVEGAME ) + { + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD",TEXTURE_16BIT_PALETTE); + } + else + { + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD",TEXTURE_16BIT_PALETTE); + } + uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); + uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); + pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); + pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); + pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); + pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); + pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); } //----- (0045E93E) -------------------------------------------------------- void SaveUI_Load() { - unsigned int v0; // ebp@4 - unsigned int v1; // eax@4 - char *v3; // eax@7 - FILE *v4; // eax@11 - FILE *v5; // eax@11 - LODWriteableFile v11; // [sp+1Ch] [bp-248h]@1 + char *v3; // eax@7 + LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - memset(pSavegameUsedSlots.data(), 0, 0xB4u); - memset(&pSavegameThumbnails, 0, 0x708u); - uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); - uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); - uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); - uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); - uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); - uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); - if ( pCurrentScreen == SCREEN_SAVEGAME ) + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + memset(pSavegameUsedSlots.data(), 0, 0xB4u); + memset(&pSavegameThumbnails, 0, 0x708u); + uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); + uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); + uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); + uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); + uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); + uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); + if ( pCurrentScreen == SCREEN_SAVEGAME ) + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); + } + else + { + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); + pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); + } + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...) + pRenderer->Present(); + pSavegameList->Initialize(1); + pLODFile.AllocSubIndicesAndIO(300, 0); + for (uint i = 0; i < 40; ++i) + { + v3 = pSavegameList->pFileList[i].pSaveFileName; + if ( !*pSavegameList->pFileList[i].pSaveFileName ) + v3 = "1.mm7"; + sprintf(pTmpBuf.data(), "saves\\%s", v3); + if ( _access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6) ) { - v0 = uTextureID_save_up; - v1 = uTextureID_LS_saveU; - } + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); + } else { - v0 = uTextureID_load_up; - v1 = uTextureID_LS_loadU; - } - pRenderer->DrawTextureIndexed(0xF1u, 0x12Eu, pIcons_LOD->GetTexture(v1)); - pRenderer->DrawTextureIndexed(0x15Fu, 0x12Eu, pIcons_LOD->GetTexture(uTextureID_x_u)); - pRenderer->DrawTextureIndexed(0x12u, 0x8Du, pIcons_LOD->GetTexture(v0)); - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0); - pRenderer->Present(); - pSavegameList->Initialize(1u); - v11.AllocSubIndicesAndIO(0x12Cu, 0); - //v2 = pSavegameUsedSlots; - // Dest = pSavegameHeader; - // this_ = pSavegameThumbnails; - // v8 = (char *)pSavegameList->pSavesNames; - for (uint i = 0; i < 40; ++i) - { - v3 = pSavegameList->pFileList[i].pSaveFileName; - if ( !*pSavegameList->pFileList[i].pSaveFileName ) - v3 = "1.mm7"; - sprintf(pTmpBuf.data(), "saves\\%s", v3); - if ( _access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6) ) - { - pSavegameUsedSlots[i] = 0; - strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); - } - else - { - v11.LoadFile(pTmpBuf.data(), 1); - v4 = v11.FindContainer("header.bin", 1); - fread(&pSavegameHeader[i], 100, 1u, v4); - v5 = v11.FindContainer("image.pcx", 1); - if ( v5 ) - { - pSavegameThumbnails[i].LoadFromFILE(v5, 0, 1u); - v11.CloseWriteFile(); - pSavegameUsedSlots[i] = 1; - } - else - { - pSavegameUsedSlots[i] = 0; - } - } - - } - - v11.FreeSubIndexAndIO(); - uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); - uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); - uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); - uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SaveLoadButtons, 0, 0); - pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); - pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); - pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); - pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); - pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); -} + pLODFile.LoadFile(pTmpBuf.data(), 1); + fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", 1)); + if ( pLODFile.FindContainer("image.pcx", 1) ) + { + pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", 1), 0, 1); + pLODFile.CloseWriteFile(); + pSavegameUsedSlots[i] = 1; + } + else + pSavegameUsedSlots[i] = 0; + } + } + pLODFile.FreeSubIndexAndIO(); + uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); + uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); + uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); + uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SaveLoadButtons, 0, 0); + pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); + pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); + pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); + pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); + pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); +} \ No newline at end of file
--- a/UI/UIShops.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/UI/UIShops.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -16,241 +16,158 @@ //----- (004B910F) -------------------------------------------------------- void WeaponShopDialog() { - int v0; // ebx@1 - int pNumActiveItem; // eax@6 - signed int v2; // esi@8 - ItemGen *v4; // eax@11 - char *v5; // ecx@12 - unsigned __int8 v6; // dl@13 - char *v7; // edx@14 - int v9; // ST08_4@16 - int v10; // eax@16 - signed int v11; // esi@18 - int v12; // ST08_4@21 - int v13; // eax@21 - int v14; // edi@23 - char **v15; // esi@23 - int v16; // eax@24 - //int v18; // edx@25 + int phrases_id; // eax@16 int v19; // edi@25 - unsigned __int8 v20; // sf@25 GUIButton *pButton; // esi@27 - int pNewItem; // eax@27 - unsigned int v24; // ecx@27 - int v25; // edx@27 unsigned int pColorText; // ax@27 - signed int v27; // esi@32 - int v28; // ST08_4@36 - int v29; // eax@36 signed int v32; // esi@41 - unsigned int v33; // esi@43 - int v34; // eax@43 - unsigned int v35; // eax@44 - int v36; // eax@46 - __int32 v37; // ecx@51 - int v40; // eax@53 - char *v41; // eax@55 - unsigned int v43; // ecx@55 - const char **v44; // edx@55 - int v45; // eax@55 - int v47; // eax@59 - const char **v48; // eax@63 - unsigned int v49; // esi@65 - Texture *v50; // eax@65 - int v51; // edi@65 - int v52; // esi@70 - Texture *v53; // ST1C_4@70 - int v54; // edi@70 - signed int v55; // ecx@73 - SHORT v56; // di@82 - bool v57; // eax@82 - const char *v58; // ecx@84 - POINT *v59; // esi@89 - LONG v60; // ecx@90 - int v61; // eax@90 - int v62; // ecx@90 - ItemGen *pItemInShop; // esi@90 - //int v64; // eax@95 + const char *pText; // ecx@84 int all_text_height; // esi@96 - char **v66; // edi@96 - int v67; // eax@97 - int v69; // edx@98 - int v70; // edi@98 - int v71; - const char **v72; // eax@100 - int pTextHeight; // eax@100 - unsigned int v74; // ecx@100 - int v78; // [sp-14h] [bp-10Ch]@14 - ItemGen *v79; // [sp-10h] [bp-108h]@12 - int v80; // [sp-10h] [bp-108h]@14 - void *v81; // [sp-Ch] [bp-104h]@12 - unsigned __int16 v82; // [sp-Ch] [bp-104h]@14 - int v83; // [sp-8h] [bp-100h]@11 - char *v84; // [sp-8h] [bp-100h]@14 - __int64 *v85; // [sp-4h] [bp-FCh]@11 - unsigned int v86; // [sp-4h] [bp-FCh]@14 - POINT v87; // [sp+Ch] [bp-ECh]@8 - POINT v88; // [sp+14h] [bp-E4h]@18 - POINT v89; // [sp+1Ch] [bp-DCh]@89 - POINT v90; // [sp+24h] [bp-D4h]@19 - POINT v91; // [sp+2Ch] [bp-CCh]@89 - POINT v92; // [sp+34h] [bp-C4h]@9 - POINT v93; // [sp+3Ch] [bp-BCh]@33 - POINT v94; // [sp+44h] [bp-B4h]@18 - POINT v95; // [sp+4Ch] [bp-ACh]@32 - POINT v96; // [sp+54h] [bp-A4h]@18 - POINT v97; // [sp+5Ch] [bp-9Ch]@32 - POINT a2; // [sp+64h] [bp-94h]@8 - POINT v99; // [sp+6Ch] [bp-8Ch]@32 - POINT v100; // [sp+74h] [bp-84h]@8 + ItemGen *item; + int pItemID; + POINT mouse; // [sp+64h] [bp-94h]@8 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 - char *Str; // [sp+D0h] [bp-28h]@55 __int32 v103; // [sp+D4h] [bp-24h]@25 - int pColorYellow; // [sp+D8h] [bp-20h]@1 - int pColorWhite; // [sp+DCh] [bp-1Ch]@1 - POINT v106; // [sp+E0h] [bp-18h]@8 - Player *pPlayer; // [sp+E8h] [bp-10h]@1 - int pItemNum; // [sp+ECh] [bp-Ch]@26 - const char **v109; // [sp+F0h] [bp-8h]@26 - unsigned __int8 v110; // [sp+F7h] [bp-1h]@16 + int pPrice; // [sp+ECh] [bp-Ch]@26 + unsigned int v109; int pNumString; + int item_X; - pPlayer = pPlayers[uActiveCharacter]; memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; dialog_window.uFrameWidth = 148; dialog_window.uFrameZ = 334; - pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); - pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u); switch(dialog_menu_id) { case HOUSE_DIALOGUE_MAIN: { - pNumActiveItem = HouseUI_CheckIfPlayerCanInteract(); - if ( pNumActiveItem ) + if ( HouseUI_CheckIfPlayerCanInteract() ) { pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; all_text_height = 0; - for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); + for ( int i = 0; i < 4; ++i ) all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); v103 = (174 - all_text_height) / 4; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - if ( v20 ^ (pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )) + pNumString = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { - pItemNum = 2; - pNumString = 0; - do + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v103 + v19; + pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); + v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uW = v19; + pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); + ++pNumString; + } + } + break; + } + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + item_X = 0; + for ( uint i = 0; i < 6; ++i ) + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + { + pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + 640 * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); + } + item_X += 70; + } + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + uint item_num = 0; + for ( uint i = 0; i < 6; ++i ) + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) + ++item_num; + } + if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) + pText = pGlobalTXT_LocalizationStrings[185];//Украсть предмет + else + pText = pGlobalTXT_LocalizationStrings[195];//Выберите предмет для покупки + DrawTextAtStatusBar(pText, 0); + if ( item_num ) + { + pMouse->GetCursorPos(&mouse); + if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) { - pButton = pDialogueWindow->GetControl(pItemNum); - pButton->uY = v103 + v19; - pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v19 = pButton->uY + pTextHeight - 1; - pButton->uW = v19; - pColorText = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); - ++pItemNum; - ++pNumString; - pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) + { + pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], + uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); + } + else + { + pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); + } } - while ( pItemNum < pNumActiveItem ); } + else + dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней } break; } - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v48 = 0; - pItemNum = 0; - v109 = 0; - do + item_X = 0; + for ( uint i = 0; i < 6; ++i ) { - // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID) { - v49 = word_F8B158[(signed int)v48]; - v50 = ItemsInShopTexture[(signed int)v48]; - v49 += 30; - v51 = 60 - ((signed int)v50->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); - v48 = v109; - } - pItemNum += 70; - v48 = (const char **)((char *)v48 + 1); - v109 = v48; - } - while ( (signed int)v48 < 6 ); - pNumActiveItem = HouseUI_CheckIfPlayerCanInteract(); - if ( pNumActiveItem ) - { - v55 = 0; - v106.x = 0; - v106.x = 0; - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v106.x; - ++v55; + pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]); + ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + 640 * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1); } - while ( v55 < 6 ); - v56 = GetAsyncKeyState(17); - v57 = pPlayer->CanSteal(); - Str = (char *)v57; - if ( v56 && v57 ) - { - v58 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - v58 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v58, 0); - if ( v106.x ) + item_X += 70; + } + if ( HouseUI_CheckIfPlayerCanInteract() ) + { + uint item_num = 0; + for ( uint i = 0; i < 6; ++i ) { - v59 = pMouse->GetCursorPos(&v91); - pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]; - if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) + if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID ) + ++item_num; + } + if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() ) + pText = pGlobalTXT_LocalizationStrings[185]; + else + pText = pGlobalTXT_LocalizationStrings[196]; + DrawTextAtStatusBar(pText, 0); + if ( item_num ) + { + pMouse->GetCursorPos(&mouse); + if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF ) { - v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; - v106.x = v60; - v61 = (int)window_SpeakInHouse->ptr_1C;//maybe ptr_1C - BuildID_2Events - // v62 = 9 * (v60 + 12 * v61); - pItemInShop = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60]; - if ( !v56 || !Str ) + item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() ) { - v7 = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayer->SelectPhrasesTransaction(pItemInShop, BuildingType_WeaponShop, v61, 2)], - uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)], + uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); } else { - v7 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); } } } else - { - dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней - pNumActiveItem = 0; //added - } + dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); } break; } @@ -262,18 +179,19 @@ DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); if ( !HouseUI_CheckIfPlayerCanInteract() ) return; - if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5), - pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) + pMouse->GetCursorPos(&mouse); + v109 = ((mouse.x + 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if( mouse.x <= 13 || mouse.x >= 462 ) return; - v79 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; - v13 = pPlayer->SelectPhrasesTransaction(v79, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); - v7 = BuildDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); + if ( !pItemID ) + return; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; + phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); + pText = BuildDialogueString((char *)pMerchantsSellPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); break; } - case HOUSE_DIALOGUE_SHOP_IDENTIFY: { draw_leather(); @@ -281,23 +199,24 @@ DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); if ( !HouseUI_CheckIfPlayerCanInteract() ) return; - if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), - pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) + pMouse->GetCursorPos(&mouse); + v109 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5); + if( mouse.x <= 13 || mouse.x >= 462 ) + return; + pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); + if ( !pItemID ) return; - v4 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; - if (!v4->IsIdentified()) + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; + if (!item->IsIdentified()) { - v10 = pPlayer->SelectPhrasesTransaction(v4, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); - v7 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); + pText = BuildDialogueString((char *)pMerchantsIdentifyPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); } else { - v7 = BuildDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); } break; } @@ -308,17 +227,18 @@ CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); if ( !HouseUI_CheckIfPlayerCanInteract()) - return; - if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), - pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) - || (!(pPlayer->pOwnItems[pNumActiveItem-1].uAttributes& 2)) ) - return; - v4 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; - v10 = pPlayer->SelectPhrasesTransaction(v4, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); - v7 = BuildDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0); - pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3); + return; + pMouse->GetCursorPos(&mouse); + v109 = ((mouse.x - 14) >> 5) + 14 * (mouse.y - 17) >> 5; + if( ( mouse.x <= 13) || mouse.x >= 462 ) + return; + pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109); + if ( !pItemID || (!(pPlayers[uActiveCharacter]->pOwnItems[pItemID - 1].uAttributes & 2)) ) + return; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; + phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); + pText = BuildDialogueString((char *)pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3); return; } break; @@ -334,113 +254,21 @@ for ( int i = 0; i < 3; ++i ) all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); v103 = (174 - all_text_height) / 3; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - if ( v20 ^ (pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )) - { - pItemNum = 2; - pNumString = 0; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - pButton->uY = v103 + v70; - pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v70 = pButton->uY + pTextHeight - 1; - pButton->uW = v70; - pColorText = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); - ++pItemNum; - ++pNumString; - pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( pItemNum < pNumActiveItem ); - } - break; - } - - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v109 = 0; - pItemNum = 0; - do - { - // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) - { - v52 = word_F8B158[(signed int)v109] + 30; - v53 = ItemsInShopTexture[(signed int)v109]; - v54 = 60 - ((signed int)v53->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53); - ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); - } - v109 = (const char **)((char *)v109 + 1); - pItemNum += 70; - } - while ( (signed int)v109 < 6 ); - pNumActiveItem = HouseUI_CheckIfPlayerCanInteract(); - if ( pNumActiveItem ) + v19 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; + pNumString = 0; + for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { - v55 = 0; - v106.x = 0; - do - { - // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) - ++v106.x; - ++v55; - } - while ( v55 < 6 ); - v56 = GetAsyncKeyState(17); - v57 = pPlayer->CanSteal(); - Str = (char *)v57; - if ( v56 && v57 ) - { - v58 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - v58 = pGlobalTXT_LocalizationStrings[196]; + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v103 + v19; + pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); + v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uW = v19; + pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); + ++pNumString; } - DrawTextAtStatusBar(v58, 0); - if ( v106.x ) - { - v59 = pMouse->GetCursorPos(&v91); - pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]; - if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) - { - v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; - v106.x = v60; - v61 = (int)window_SpeakInHouse->ptr_1C; - // v62 = 9 * (v60 + 12 * v61); - pItemInShop = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; - if ( !v56 || !Str ) - { - v7 = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayer->SelectPhrasesTransaction(pItemInShop, BuildingType_WeaponShop, v61, 2)], - uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138, pColorWhite, v7, 3); - } - else - { - v7 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138, pColorWhite, v7, 3); - } - } - } - else - { - dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - pNumActiveItem = 0; //added - } - } break; } @@ -448,58 +276,35 @@ { if (!HouseUI_CheckIfPlayerCanInteract()) return; - v0 = 0; + uint item_num = 0; all_text_height = 0; - //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100; - if ( pItemNum < v32 / 3 ) - pItemNum = v32 / 3; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton ) + pPrice = v32 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( pPrice < v32 / 3 ) + pPrice = v32 / 3; + for ( int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); - return; - } - do - { - v35 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] ) + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36] + && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] ) { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0); - v0++; + all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0); + item_num++; } - ++pNumActiveItem; } - while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - if ( !v0 ) + if ( item_num ) { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); - return; - } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v103 = (149 - all_text_height) / v0; - if ( (149 - all_text_height) / v0 > 32 ) - v103 = 32; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v37 = (149 - v0 * v103 - all_text_height) / 2 - v103 / 2 + 162; - if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) - { - pItemNum = 2; - do + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); + v103 = (149 - all_text_height) / item_num; + if ( (149 - all_text_height) / item_num > 32 ) + v103 = 32; + v19 = (149 - item_num * v103 - all_text_height) / 2 - v103 / 2 + 162; + for ( uint i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) { - pButton = pDialogueWindow->GetControl(pItemNum); - v40 = pButton->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] ) + pButton = pDialogueWindow->GetControl(i); + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) { pButton->uW = 0; pButton->uHeight = 0; @@ -507,29 +312,27 @@ } else { - pButton->uY = v103 + v37; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v37 = pButton->uY + pTextHeight - 1; - pButton->uW = v37; - pColorText = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v40], 3); + pButton->uY = v103 + v19; + pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); + v19 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1; + pButton->uW = v19; + pColorText = TargetColor(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); } - pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - pItemNum++; } - while ( pItemNum < pNumActiveItem ); + break; } - break; + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); + strcat(pTmpBuf.data(), "\n \n"); + strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); + return; } default: { - if( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR) - pNumActiveItem = dialog_menu_id - 96; - else - pNumActiveItem = dialog_menu_id - 4; + __debugbreak(); break; } } @@ -592,7 +395,7 @@ int v66; // eax@76 int v67; // edi@77 signed int v68; // ecx@81 - const char *pStatusText; // ecx@91 + const char *pText; // ecx@91 void *v72; // eax@95 POINT *v73; // esi@97 int v74; // ecx@97 @@ -647,7 +450,7 @@ POINT v133; // [sp+34h] [bp-D0h]@17 POINT v134; // [sp+3Ch] [bp-C8h]@97 POINT v135; // [sp+44h] [bp-C0h]@31 - POINT v136; // [sp+4Ch] [bp-B8h]@97 + POINT mouse; // [sp+4Ch] [bp-B8h]@97 POINT v137; // [sp+54h] [bp-B0h]@17 POINT v138; // [sp+5Ch] [bp-A8h]@32 POINT v139; // [sp+64h] [bp-A0h]@17 @@ -657,23 +460,19 @@ POINT v143; // [sp+84h] [bp-80h]@9 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 int v146; // [sp+E4h] [bp-20h]@24 - int pYellowColor; // [sp+E8h] [bp-1Ch]@1 - int pWhiteColor; // [sp+ECh] [bp-18h]@1 + //int pYellowColor; // [sp+E8h] [bp-1Ch]@1 + //int pWhiteColor; // [sp+ECh] [bp-18h]@1 __int32 pItemCount; // [sp+F0h] [bp-14h]@8 int v152; // [sp+FCh] [bp-8h]@24 - int v153; // [sp+100h] [bp-4h]@44 + int item_x; // [sp+100h] [bp-4h]@44 int th; short text_color; int pActiveButton; - //__debugbreak(); // uishops.cpp(952): warning C4700: uninitialized local variable 'v33' used - //__debugbreak(); // uishops.cpp(981): warning C4700: uninitialized local variable 'v98' used memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; dialog_window.uFrameWidth = 148; dialog_window.uFrameZ = 334; - pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu); - pYellowColor = TargetColor(0xE1u, 0xCDu, 0x23u); switch (dialog_menu_id) { case HOUSE_DIALOGUE_MAIN: @@ -690,52 +489,44 @@ v146 = ( 174 - all_text_height ) / 4; v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; pNumString = 0; - if ( pDialogueWindow->pNumPresenceButton>=0 ) + for (int i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i) { - for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton) - { - pButton = pDialogueWindow->GetControl(pActiveButton); - pButton->uY = v146 + v23; - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v23 = pButton->uY + pButton->uHeight - 1; - pButton->uW = v23; - pTextColor = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) - pTextColor = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); - ++pNumString; - } + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v146 + v23; + pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1; + pButton->uW = v23; + pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); + ++pNumString; } } break; + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка - textureW = 0; - v153 = 0; + item_x = 0; for ( int i = 0; i < 8; ++i )// разместить вещи { if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) { - textureW = ItemsInShopTexture[i]->uTextureWidth; - textureH = ItemsInShopTexture[i]->uTextureHeight; if ( i >= 4 ) //low row { - v60 = 90 - (textureW/2); - pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); - v59 = v60 + v153 + 80220; + pRenderer->DrawTextureTransparent((90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x - 420, 126, ItemsInShopTexture[i]); + v59 = (90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 80220; } else { - pY_item = 98 - textureH; - v152 = 86 - (textureW/2); - pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]); - v59 = v153 + v152 + 640 * pY_item; + pRenderer->DrawTextureTransparent(( 86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); + v59 = item_x + (86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight); } ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); } - v153 += 105; + item_x += 105; } if ( !HouseUI_CheckIfPlayerCanInteract() ) return; @@ -746,63 +537,62 @@ ++pItemCount; } if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) - pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" + pText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" else - pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item" - DrawTextAtStatusBar(pStatusText, 0); - if ( pItemCount != 0 ) + pText = pGlobalTXT_LocalizationStrings[185];//"Steal item" + DrawTextAtStatusBar(pText, 0); + if ( pItemCount ) { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; - if ( !v74 ) + pMouse->GetCursorPos(&mouse); + if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) return; - pItemCount = v74 - 1; - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; - if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0) - v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; + if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal()) + { + pText = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)], + uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); + } else - v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" - v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + { + pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); //"Steal %24" + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); + } return; } dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); return; } break; + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v11 = 0; - v61 = 0; - v153 = 0; - do + item_x = 0; + for ( int i = 0; i < 8; ++i ) { - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) + if ( pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) { - v62 = ItemsInShopTexture[v61]; - if ( v61 >= 4 ) + //v62 = ItemsInShopTexture[i]; + if ( i >= 4 ) { - v67 = 90 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); - v66 = v153 + v67 + 80220; + //v67 = 90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2); + pRenderer->DrawTextureTransparent(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]); + v66 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220; } else { - v63 = 98 - v62->uTextureHeight; - v64 = ItemsInShopTexture[v61]; - v65 = 98 - v62->uTextureHeight; - v152 = 86 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); - v66 = v152 + v153 + 640 * v63; + //v63 = 98 - ItemsInShopTexture[i]->uTextureHeight; + //v64 = ItemsInShopTexture[i]; + //v65 = 98 - ItemsInShopTexture[i]->uTextureHeight; + //v152 = 86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2); + pRenderer->DrawTextureTransparent(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]); + v66 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight); } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[i], i + 1); } - v153 += 105; - ++v61; + item_x += 105; } - while ( v61 < 8 ); if ( !HouseUI_CheckIfPlayerCanInteract() ) return; v68 = 0; @@ -815,28 +605,27 @@ } while ( v68 < 6 ); if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) - pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" + pText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" else - pStatusText = pGlobalTXT_LocalizationStrings[185]; - DrawTextAtStatusBar(pStatusText, 0); + pText = pGlobalTXT_LocalizationStrings[185]; + DrawTextAtStatusBar(pText, 0); if ( (char *)pItemCount != 0 ) { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; - if ( !v74 ) + pMouse->GetCursorPos(&mouse); + if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) ) return; - pItemCount = v74 - 1; + pItemCount = (pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1; if ( dialog_menu_id == 2 ) - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; else - selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; + selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1]; if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; else v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); return; } dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); @@ -869,9 +658,9 @@ pButton->uHeight = pTextHeight; v86 = v90 + pTextHeight - 1; pButton->uW = v86; - pTextColor = pYellowColor; + pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) - pTextColor = pWhiteColor; + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3); ++pNumString; ++pActiveButton; @@ -897,7 +686,7 @@ v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); return; } break; @@ -927,7 +716,7 @@ } v6 = BuildDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v6, 3); return; } } @@ -955,7 +744,7 @@ v15 = (char *)pMerchantsRepairPhrases[v35]; v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xFFu, 0xFFu, 0xFFu), v36, 3); return; } break; @@ -982,10 +771,10 @@ v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2); v100 = BuildDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], (char *)window_SpeakInHouse->par1C, 2, 0); v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), v100, 3); } v104 = 0; - v153 = 0; + int v153 = 0; do { //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) @@ -1031,7 +820,7 @@ pActiveButton = v38 / 3; v39 = pDialogueWindow->pStartingPosActiveItem; v40 = pDialogueWindow->pNumPresenceButton; - v153 = 0; + int v153 = 0; if ( (signed int)v39 < (signed int)(v39 + v40) ) { do @@ -1078,9 +867,9 @@ v51 = v49 + pTextHeight - 1; pButton->uW = v51; v146 = v51; - pTextColor = pYellowColor; + pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u); if ( pDialogueWindow->pCurrentPosActiveItem != v153 ) - pTextColor = pWhiteColor; + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3); } v53 = pDialogueWindow->pStartingPosActiveItem; @@ -1097,7 +886,7 @@ strcat(pTmpBuf.data(), "\n \n"); strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf.data(), 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3); return; } break;
--- a/UI/UiGame.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/UI/UiGame.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -1230,7 +1230,7 @@ if ( !pLevelDecorations[v19].uEventID ) { if ( pLevelDecorations[v19].IsInteractive() ) - pText = pNPCTopics[stru_5E4C90._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 379].pTopic;//неверно для костра + pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 379].pTopic;//неверно для костра else pText = pDecorationList->pDecorations[pLevelDecorations[v19].uDecorationDescID].field_20; GameUI_SetFooterString(pText);
--- a/Viewport.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/Viewport.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -542,7 +542,7 @@ { if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() ) { - v15 = stru_5E4C90._decor_events[pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]._idx_in_stru123 - 75] + 380; + v15 = stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]._idx_in_stru123 - 75] + 380; activeLevelDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; EventProcessor(v15, 0, 1); activeLevelDecoration = NULL;
--- a/mm7_2.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/mm7_2.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -1740,7 +1740,7 @@ //----- (00450AAA) -------------------------------------------------------- void RespawnGlobalDecorations() { - memset(stru_5E4C90._decor_events, 0, 125); + memset(stru_5E4C90_MapPersistVars._decor_events, 0, 125); uint decorEventIdx = 0; for (uint i = 0; i < uNumLevelDecorations; ++i) @@ -1754,7 +1754,7 @@ if (decorEventIdx < 124) { decor->_idx_in_stru123 = decorEventIdx + 75; - stru_5E4C90._decor_events[decorEventIdx++] = decor->GetGlobalEvent(); + stru_5E4C90_MapPersistVars._decor_events[decorEventIdx++] = decor->GetGlobalEvent(); } } } @@ -5965,7 +5965,7 @@ return v19; } if ( v25->IsInteractive() ) - v24 = pNPCTopics[stru_5E4C90._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic; + v24 = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic; else v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20; GameUI_SetFooterString(v24);
--- a/mm7_3.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/mm7_3.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -2181,7 +2181,7 @@ { //LOBYTE(pParty->uFlags) &= 0x7Fu; bWaterWalk = 1; - *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; + *(short *)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) && pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 ) bWaterWalk = 0; @@ -2571,7 +2571,7 @@ if ( pModel ) pZ = v113; if (pParty->FlyActive()) - stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu; + stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu; pParty->uFallStartY = pZ; } else @@ -2583,14 +2583,14 @@ pParty->uFallStartY = v111; v113 = pZ; if (pParty->FlyActive()) - stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; + stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; } } else { v113 = pZ; if (pParty->FlyActive()) - stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; + stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; } //LABEL_141: if (bJumping && !pParty->bFlying) @@ -3078,7 +3078,7 @@ pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; //v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 6180178; //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; - v79 = (int)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119]; + v79 = (int)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119]; *(short *)v79 |= 1u; if ( !v122 || !v69 ) {
--- a/mm7_data.cpp Fri Sep 27 18:58:25 2013 +0600 +++ b/mm7_data.cpp Fri Sep 27 18:58:48 2013 +0600 @@ -40,7 +40,7 @@ #include "stru123.h" -stru123 stru_5E4C90; +stru123 stru_5E4C90_MapPersistVars; #include "stru298.h" stru298 stru_50FE08; // weak @@ -1326,7 +1326,7 @@ std::array<int, 32> dword_F1B430; // weak //int dword_F8B144; // nexindex [-1] to the following std::array<int, 4> player_levels = {{1, 1, 1, 1}}; -std::array<__int16, 777> word_F8B158; // weak +std::array<__int16, 6> weapons_Ypos; // word_F8B158 struct Texture *ShopTexture; // idb std::array<struct Texture *, 12> ItemsInShopTexture; __int16 bountyHunting_monster_id_for_hunting; // word_F8B1A0
--- a/mm7_data.h Fri Sep 27 18:58:25 2013 +0600 +++ b/mm7_data.h Fri Sep 27 18:58:48 2013 +0600 @@ -984,7 +984,7 @@ extern char byte_AE5B91; // weak extern std::array<int, 32> dword_F1B430; // weak extern std::array<int, 4> player_levels; -extern std::array<__int16, 777> word_F8B158; // weak +extern std::array<__int16, 6> weapons_Ypos; // word_F8B158 extern struct Texture *ShopTexture; // idb extern std::array<struct Texture *, 12> ItemsInShopTexture; extern __int16 bountyHunting_monster_id_for_hunting; // weak