Mercurial > mm7
changeset 504:d027c6848fbb
Слияние
author | Ritor1 |
---|---|
date | Mon, 25 Feb 2013 18:52:45 +0600 |
parents | 23f8ecb60dd3 (current diff) 0dbf780e247f (diff) |
children | 81410c3feebc |
files | mm7_4.cpp |
diffstat | 19 files changed, 1270 insertions(+), 1211 deletions(-) [+] |
line wrap: on
line diff
--- a/Arcomage.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/Arcomage.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -5675,7 +5675,7 @@ _449B7E_toggle_bit((unsigned char *)v11, 103, 1u); v11 += 6972; } - while ( (signed int)v11 < (signed int)((char *)&pParty->field_777C[36] + 2) ); + while ( (signed int)v11 < (signed int)((char *)&pParty->StandartItemsInShops[36] + 2) ); ++pParty->field_874; if ( pParty->field_874 > 1000000 ) pParty->field_874 = 1000000; @@ -5689,7 +5689,7 @@ _449B7E_toggle_bit((unsigned char *)v12, 104, 1u); v12 += 6972; } - while ( (signed int)v12 < (signed int)((char *)&pParty->field_777C[36] + 2) ); + while ( (signed int)v12 < (signed int)((char *)&pParty->StandartItemsInShops[36] + 2) ); ++pParty->field_878; if ( pParty->field_878 > 1000000 ) pParty->field_878 = 1000000;
--- a/Chest.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/Chest.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -104,9 +104,9 @@ v31 = 813; v32 = 814; v5 = rand() % 4; - v6 = dword_5B5920 >> 3; + v6 = EvtTargetObj >> 3; v35 = v5; - if ( (dword_5B5920 & 7) == OBJECT_Decoration) + if ( (EvtTargetObj & 7) == OBJECT_Decoration) { v16 = v6; v14 = pLevelDecorations[v6].vPosition.x; @@ -116,11 +116,11 @@ } else { - if ( (dword_5B5920 & 7) != OBJECT_BModel) + if ( (EvtTargetObj & 7) != OBJECT_BModel) goto LABEL_12; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { - v7 = &pOutdoor->pBModels[dword_5B5920 >> 9].pFaces[(dword_5B5920 >> 3) & 0x3F]; + v7 = &pOutdoor->pBModels[EvtTargetObj >> 9].pFaces[(EvtTargetObj >> 3) & 0x3F]; v8 = v7->pBoundingBox.y1; v9 = v7->pBoundingBox.z2; v10 = v7->pBoundingBox.x1 + v7->pBoundingBox.x2;
--- a/Events.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/Events.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -141,7 +141,7 @@ //----- (0044684A) -------------------------------------------------------- -void EventProcessor(int uEventID, int a2, int a3) +void EventProcessor(int uEventID, int targetObj, int canShowMessages) { unsigned int v3; // eax@5 signed int v4; // esi@7 @@ -198,8 +198,8 @@ Player *v55; // esi@114 Player *v56; // ecx@117 int v57; // ecx@118 - signed int v58; // ebp@124 - Player *v59; // esi@125 + signed int pValue; // ebp@124 + Player *pPlayer; // esi@125 int v60; // eax@126 int v61; // edx@133 int v62; // eax@139 @@ -287,9 +287,9 @@ //v131 = uEventID; v133 = 0; - dword_5B5920 = a2; + EvtTargetObj = targetObj; dword_5B65C4 = 0; - if ( !a1 ) + if ( !uEventID ) { if ( !GameUI_StatusBar_TimedStringTimeLeft ) ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here @@ -297,7 +297,7 @@ } player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 curr_seq_num = start_event_seq_number; - if ( _5C3420_pDecoration ) + if ( GlobalEventInfo ) { uSomeEVT_NumEvents = uGlobalEVT_NumEvents; pSomeEVT = pGlobalEVT; @@ -504,21 +504,17 @@ break; case EVENT_SpeakNPC: - if ( a3 ) + if ( canShowMessages ) { //Actor::Actor(&Dst); memset(&Dst, 0, 0x344u); - dword_5B65D0_dialogue_actor_npc_id = _evt->v5 - + ((_evt->v6 - + ((_evt->v7 - + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); + dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); Dst.uNPC_ID = dword_5B65D0_dialogue_actor_npc_id; Dst.InitializeDialogue(0); } else { - bDialogueUI_InitializeActor_NPC_ID = _evt->v5 - + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); + bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); } ++curr_seq_num; v4 = v124; @@ -530,12 +526,12 @@ v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); if ( v25 ) { - stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = _evt->v5 - 124; + stru_5E4C90._decor_events[GlobalEventInfo + 28] = _evt->v5 - 124; } else { - v26 = _5C3420_pDecoration; - stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = 0; + v26 = (LevelDecoration *)GlobalEventInfo; + stru_5E4C90._decor_events[GlobalEventInfo + 28] = 0; LOBYTE(v26->field_2) |= 0x20u; } ++curr_seq_num; @@ -725,7 +721,7 @@ pVideoPlayer->Unload(); window_SpeakInHouse->Release(); pParty->uFlags &= 0xFFFFFFFDu; - _5C3420_pDecoration = (LevelDecoration *)1; + GlobalEventInfo = 1; if ( EnterHouse((enum HOUSE_TYPE)165) ) { pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); @@ -824,20 +820,20 @@ //v6 = v123; //v7 = ""; break; - case EVENT_Compare: - v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + case EVENT_Compare://_evt->_e_type == 14 cmp in Global.evt event 6 + pValue = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); if ( player_choose == 5 ) { v130 = 0; - v59 = pParty->pPlayers; + pPlayer = pParty->pPlayers; while ( 1 ) { - LOBYTE(v60) = v59->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v58); + v60 = pPlayer->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue); if ( v60 ) break; ++v130; - ++v59; - if ( (signed int)v59 >= (signed int)pParty->pHirelings ) + ++pPlayer; + if ( (signed int)pPlayer >= (signed int)pParty->pHirelings ) { ++curr_seq_num; v4 = v124; @@ -876,9 +872,7 @@ LABEL_138: //v123 = v6; LABEL_139: - LOBYTE(v62) = ((Player *)v6)->CompareVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v58); + v62 = ((Player *)v6)->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue); LABEL_140: if ( v62 ) goto LABEL_129; @@ -889,10 +883,7 @@ //v7 = ""; break; case EVENT_IsActorAlive: - v62 = IsActorAlive( - _evt->v5, - _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8), - _evt->v10); + v62 = IsActorAlive(_evt->v5, _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8), _evt->v10); goto LABEL_140; case EVENT_Substract: v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8)); @@ -1030,9 +1021,7 @@ v130 = 4; do { - v76->SubtractVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v63); + v76->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); ++v76; } while ( (signed int)v76 < (signed int)pParty->pHirelings ); @@ -1082,9 +1071,7 @@ v130 = 4; do { - v79->SetVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v77); + v79->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); ++v79; } while ( (signed int)v79 < (signed int)pParty->pHirelings ); @@ -1108,9 +1095,7 @@ if ( player_choose == 6 ) goto LABEL_208; LABEL_211: - ((Player *)v6)->AddVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v80); + ((Player *)v6)->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v80); goto LABEL_212; } if ( uActiveCharacter ) @@ -1131,9 +1116,7 @@ v130 = 4; do { - v82->AddVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v80); + v82->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v80); ++v82; } while ( (signed int)v82 < (signed int)pParty->pHirelings ); @@ -1150,11 +1133,7 @@ case EVENT_InputString: if ( !start_event_seq_number ) { - strcpy( - GameUI_StatusBar_TimedString, - &pLevelStr[pLevelStrOffsets[_evt->v5 - + ((_evt->v6 - + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); + strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); v105 = curr_seq_num; v121 = 26; LABEL_295: @@ -1166,10 +1145,7 @@ return; } v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); - if ( !_strcmpi( - GameUI_StatusBar_TimedString, - &pLevelStr[pLevelStrOffsets[_evt->v9 - + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) + if ( !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) || !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) ) { v11 = _evt->v17; @@ -1301,9 +1277,9 @@ break; case EVENT_StatusText: v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - if ( _5C3420_pDecoration ) + if ( GlobalEventInfo ) { - if ( _5C3420_pDecoration == (LevelDecoration *)1 ) + if ( GlobalEventInfo == 1 ) { ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; ++curr_seq_num; @@ -1313,7 +1289,7 @@ //v7 = ""; break; } - if ( a3 == 1 ) + if ( canShowMessages == 1 ) { v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; //LABEL_248: @@ -1328,7 +1304,7 @@ } else { - if ( a3 == 1 ) + if ( canShowMessages == 1 ) { v91 = &pLevelStr[pLevelStrOffsets[v90]]; ShowStatusBarString(v91, 2u); @@ -1348,7 +1324,7 @@ break; case EVENT_ShowMessage: v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - if ( _5C3420_pDecoration ) + if ( GlobalEventInfo ) { v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; byte_5B0938[0] = 0; @@ -1501,7 +1477,7 @@ } else { - pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1); + pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((GlobalEventInfo == 0) + 1); sub_44987B(v99, 0); v133 = 1; if ( pCurrentScreen == SCREEN_HOUSE )
--- a/GUIWindow.h Mon Feb 25 18:52:30 2013 +0600 +++ b/GUIWindow.h Mon Feb 25 18:52:45 2013 +0600 @@ -259,7 +259,7 @@ UIMSG_PlayerCreation_FaceNext = 0xAC, UIMSG_AD = 0xAD, UIMSG_AE = 0xAE, - UIMSG_AF = 0xAF, + UIMSG_ClickNPCTopic = 0xAF, UIMSG_CycleCharacters = 0xB0, UIMSG_B1 = 0xB1, UIMSG_B2 = 0xB2, @@ -306,7 +306,7 @@ UIMSG_16F = 0x16F, UIMSG_170 = 0x170, UIMSG_Game_Action = 0x194, - UIMSG_195 = 0x195, + UIMSG_ClickLearnSkillDialog = 0x195, UIMSG_OpenRestUI = 0x199, UIMSG_19A = 0x19A, UIMSG_TransitionUI_Confirm = 0x19B,
--- a/Indoor.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/Indoor.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -41,7 +41,7 @@ LevelDecoration pLevelDecorations[3000]; size_t uNumLevelDecorations; -LevelDecoration *_5C3420_pDecoration; +int GlobalEventInfo; LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null;
--- a/Indoor.h Mon Feb 25 18:52:30 2013 +0600 +++ b/Indoor.h Mon Feb 25 18:52:45 2013 +0600 @@ -42,7 +42,7 @@ #pragma pack(pop) extern LevelDecoration pLevelDecorations[3000]; extern size_t uNumLevelDecorations; -extern LevelDecoration *_5C3420_pDecoration; +extern int GlobalEventInfo;
--- a/Items.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/Items.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -5,6 +5,9 @@ #include "MapInfo.h" #include "FrameTableInc.h" #include "Allocator.h" +#include "GUIWindow.h" +#include "Events2D.h" +#include "Chest.h" #include "LOD.h" #include "Monsters.h" #include "Party.h" @@ -15,6 +18,87 @@ +struct ITEM_VARIATION + { + unsigned __int16 treasure_level; + unsigned __int16 item_class[4]; + }; + + +char uItemsAmountPerShopType[5]={ 0, 6, 8, 12, 12}; + +ITEM_VARIATION shopWeap_variation_ord[15] ={ + { 0, { 0, 0, 0, 0 }}, + { 1, { 23, 27, 20, 20 }}, + { 1, { 23, 24, 28, 20 }}, + { 2, { 23, 24, 25, 20 }}, + { 2, { 27, 27, 26, 26 }}, + { 4, { 24, 30, 25, 27 }}, + { 4, { 24, 30, 25, 27 }}, + { 3, { 30, 24, 20, 20 }}, + { 2, { 20, 20, 20, 20 }}, + { 3, { 27, 27, 26, 26 }}, + { 3, { 28, 28, 25, 25 }}, + { 2, { 23, 23, 24, 24 }}, + { 3, { 23, 23, 26, 26 }}, + { 2, { 30, 26, 26, 26 }}, + { 2, { 28, 25, 28, 29 }}}; + +ITEM_VARIATION shopArmr_variation_ord[30] ={ + { 1, { 35, 35, 38, 38 }}, + { 1, { 31, 31, 31, 34 }}, + { 1, { 35, 35, 38, 38 }}, + { 1, { 31, 31, 32, 34 }}, + { 2, { 35, 35, 38, 38 }}, + { 2, { 31, 32, 32, 33 }}, + { 2, { 35, 35, 38, 38 }}, + { 2, { 31, 31, 32, 32 }}, + { 4, { 35, 35, 38, 38 }}, + { 4, { 31, 32, 33, 34 }}, + { 4, { 35, 35, 38, 38 }}, + { 4, { 31, 32, 33, 34 }}, + { 3, { 35, 35, 38, 38 }}, + { 3, { 31, 31, 31, 31 }}, + { 2, { 35, 35, 38, 38 }}, + { 2, { 31, 32, 34, 34 }}, + { 3, { 35, 35, 38, 38 }}, + { 3, { 31, 31, 32, 32 }}, + { 3, { 35, 35, 38, 38 }}, + { 3, { 32, 32, 32, 33 }}, + { 3, { 35, 35, 38, 38 }}, + { 3, { 31, 31, 31, 32 }}, + { 3, { 35, 35, 38, 38 }}, + { 3, { 33, 31, 32, 34 }}, + { 3, { 35, 35, 38, 38 }}, + { 3, { 33, 31, 32, 34 }}, + { 4, { 35, 35, 38, 38 }}, + { 4, { 33, 31, 32, 34 }}}; + + + +unsigned __int16 shopMagic_treasure_lvl[14]= {0, 1, 1, 2, 2, 4, 4, 3, 2, 2, 2, 2, 2, 2}; +unsigned __int16 shopAlch_treasure_lvl[13]= {0, 1, 1, 2, 2, 3, 3, 4, 4, 2, 2, 2, 2}; + +ITEM_VARIATION shopWeap_variation_spc[15]={ + { 0, { 0, 0, 0, 0 }}, +{ 2, { 25, 30, 20, 20}}, +{ 2, { 23, 24, 28, 20}}, +{ 3, { 23, 24, 25, 20}}, +{ 3, { 27, 27, 26, 26}}, +{ 5, { 23, 26, 28, 27}}, +{ 5, { 23, 26, 28, 27}}, +{ 4, { 30, 24, 20, 20}}, +{ 3, { 20, 20, 20, 20}}, +{ 4, { 27, 27, 26, 26}}, +{ 4, { 28, 28, 25, 25}}, +{ 4, { 23, 23, 24, 24}}, +{ 4, { 24, 24, 27, 20}}, +{ 4, { 30, 26, 26, 26}}, +{ 4, { 28, 25, 28, 29}}}; + + + +unsigned __int16 shopMagicSpc_treasure_lvl[14]= {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3}; ItemGen *ptr_50C9A4; @@ -139,17 +223,13 @@ //----- (00458260) -------------------------------------------------------- void ItemGen::UpdateTempBonus(__int64 uTimePlayed) { - unsigned int v2; // eax@1 - - v2 = this->uAttributes; - if ( v2 & ITEM_TEMP_BONUS ) + if ( this->uAttributes & ITEM_TEMP_BONUS ) { if ( uTimePlayed > (signed __int64)this->uExpireTime ) { this->uEncantmentType = 0; - LOBYTE(v2) = v2 & 0xF7; this->uSpecEnchantmentType = 0; - this->uAttributes = v2; + this->uAttributes = this->uAttributes&(~ITEM_TEMP_BONUS); } } } @@ -1313,36 +1393,25 @@ //----- (00456442) -------------------------------------------------------- unsigned int ItemGen::GetValue() -{ - ItemGen *v1; // esi@1 - unsigned int uBaseValue; // edi@1 - int v3; // eax@4 - int v4; // esi@5 - unsigned int result; // eax@7 + { + unsigned int uBaseValue; // edi@1 + unsigned int bonus; - v1 = this; - uBaseValue = pItemsTable->pItems[this->uItemID].uValue; - if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->IsMaterialNonCommon(this) ) - return uBaseValue; - if ( v1->uEncantmentType ) - { - v3 = 100 * v1->_bonus_strength; - return uBaseValue + v3; - } - v4 = v1->uSpecEnchantmentType; - if ( !v4 ) - { - result = uBaseValue; - } - else - { - v3 = pItemsTable->pSpecialEnchantments[v4].iTreasureLevel; - if ( (unsigned int)v3 > 0xA ) - return uBaseValue + v3; - result = uBaseValue * v3; - } - return result; -} + uBaseValue = pItemsTable->pItems[this->uItemID].uValue; + if ( this->uAttributes & ITEM_TEMP_BONUS || pItemsTable->IsMaterialNonCommon(this) ) + return uBaseValue; + if (uEncantmentType ) + return uBaseValue + 100 * _bonus_strength;; + if (uSpecEnchantmentType ) + { + bonus = pItemsTable->pSpecialEnchantments[uSpecEnchantmentType].iTreasureLevel; + if ( bonus > 10 ) + return uBaseValue + bonus; + else + return uBaseValue * bonus; + } + return uBaseValue; + } //----- (00456499) -------------------------------------------------------- const char *ItemGen::GetDisplayName() @@ -1814,15 +1883,9 @@ //----- (004505CC) -------------------------------------------------------- bool ItemGen::GenerateArtifact() { - ItemGen *v1; // edi@1 signed int uNumArtifactsNotFound; // esi@1 - int v3; // eax@1 - bool result; // eax@6 - int artifacts_list[32]; // [sp+8h] [bp-A0h]@3 - char Dst[32]; // [sp+88h] [bp-20h]@1 + int artifacts_list[32]; - auto a2 = this; - v1 = a2; memset(artifacts_list, 0,sizeof(artifacts_list)); uNumArtifactsNotFound = 0; @@ -1841,4 +1904,777 @@ return false; } -// 4505CC: using guessed type int var_A0[32]; \ No newline at end of file +//----- (004B8E3D) -------------------------------------------------------- +void GenerateStandartShopItems() + { + signed int item_count; + signed int shop_index; + int treasure_lvl; + int item_class; + int mdf; + + shop_index = (signed int)window_SpeakInHouse->ptr_1C; + if ( uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType] ) + { + for (item_count=0; item_count<=uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]; ++item_count ) + { + if (shop_index<=14) //weapon shop + { + treasure_lvl = shopWeap_variation_ord[shop_index].treasure_level; + item_class =shopWeap_variation_ord[shop_index].item_class[rand() % 4]; + } + else if (shop_index<=28) //armor shop + { + mdf =0; + if (item_count > 3) + ++mdf;// rechek offsets + treasure_lvl = shopArmr_variation_ord[2*(shop_index-15)+mdf].treasure_level; + item_class =shopArmr_variation_ord[2*(shop_index-15)+mdf].item_class[rand() % 4]; + } + else if (shop_index<=41) //magic shop + { + treasure_lvl = shopMagic_treasure_lvl[shop_index-28]; + item_class = 22; //misc + } + else if (shop_index<=53) //alchemist shop + { + if (item_count<6) + { + pParty->StandartItemsInShops[shop_index][item_count].Reset(); + pParty->StandartItemsInShops[shop_index][item_count].uItemID = 220; //potion bottle + continue; + } + else + { + treasure_lvl = shopAlch_treasure_lvl[shop_index-41]; + item_class = 45; //reagent + } + } + pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->StandartItemsInShops[shop_index][item_count]); + pParty->StandartItemsInShops[shop_index][item_count].SetIdentified(); //identified + } + } + pParty->InTheShopFlags[shop_index] = 0; + } + +//----- (004B8F94) -------------------------------------------------------- +void GenerateSpecialShopItems() + { + /*GUIWindow *v0; // edi@1 + signed int v1; // ebp@1 + int v2; // ebx@1 + signed int v3; // esi@1 + int v4; // eax@3 + int v5; // ebx@3 + int v6; // ecx@3 + bool v7; // eax@5 + bool v8; // ST1C_4@5 + int v9; // eax@5 + int v10; // eax@10 + void *result; // eax@15 + signed int v12; // [sp-4h] [bp-18h]@7*/ + + signed int item_count; + signed int shop_index; + int treasure_lvl; + int item_class; + int mdf; + + shop_index = (signed int)window_SpeakInHouse->ptr_1C; + if ( uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType] ) + { + for (item_count=0; item_count<=uItemsAmountPerShopType[p2DEvents[shop_index - 1].uType]; ++item_count ) + { + if (shop_index<=14) //weapon shop + { + treasure_lvl = shopWeap_variation_spc[shop_index].treasure_level; + item_class = shopWeap_variation_spc[shop_index].item_class[rand() % 4]; + } + else if (shop_index<=28) //armor shop + { + mdf =0; + if (item_count > 3) + ++mdf; + treasure_lvl = shopArmr_variation_ord[2*(shop_index-15)+mdf].treasure_level; + item_class =shopArmr_variation_ord[2*(shop_index-15)+mdf].item_class[rand() % 4]; + } + else if (shop_index<=41) //magic shop + { + treasure_lvl = shopMagicSpc_treasure_lvl[shop_index-28]; + item_class = 22; //misc + } + else if (shop_index<=53) //alchemist shop + { + if (item_count<6) + { + pParty->SpecialItemsInShop[shop_index][item_count].Reset(); + pParty->SpecialItemsInShop[shop_index][item_count].uItemID = rand() % 32 + 740; //mscrool + continue; + } + else + { + treasure_lvl = shopAlch_treasure_lvl[shop_index-41]; + item_class = 44; //potion + } + } + pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->SpecialItemsInShop[shop_index][item_count]); + pParty->SpecialItemsInShop[shop_index][item_count].SetIdentified(); //identified + } + } + pParty->InTheShopFlags[shop_index] = 0; + + + +/* + + v0 = window_SpeakInHouse; + v1 = 0; + v2 = (int)&window_SpeakInHouse->ptr_1C; + v3 = (signed int)window_SpeakInHouse->ptr_1C; + //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] ) + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + while ( v3 > 14 ) + { + if ( v3 <= 28 ) + { + v7 = v1 > 3; + v8 = v7; + v9 = 5 * (v7 + 2 * v3 - 30); + v3 = (signed int)v0->ptr_1C; + v5 = word_4F06D8[v9]; + v6 = word_4F05AE[5 * (v8 + 2 * v3) + rand() % 4]; + goto LABEL_13; + } + if ( v3 <= 41 ) + { + v5 = word_4F07B6[v3]; + v12 = 22; + goto LABEL_12; + } + if ( v3 <= 53 ) + { + if ( v1 >= 6 ) + { + v5 = word_4F07B6[v3 + 1]; + v12 = 44; +LABEL_12: + v6 = v12; +LABEL_13: + pItemsTable->GenerateItem(v5, v6,&pParty->SpecialItemsInShop[v3][v1]);//(ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]); + v0 = window_SpeakInHouse; + v2 = (int)&window_SpeakInHouse->ptr_1C; + // pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1; + pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes= 1; + goto LABEL_14; + } + // auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]; + auto _a =&pParty->SpecialItemsInShop[v3][v1]; + _a->Reset(); + // v2 = (int)&v0->ptr_1C; + //v10 = rand(); + // v0 = window_SpeakInHouse; + // pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740; + pParty->SpecialItemsInShop[(int)v0->ptr_1C][v1].uItemID= rand() % 32 + 740; + } +LABEL_14: + v3 = *(int *)v2; + ++v1; + //if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * *(int *)v2]] ) + if ( v1 >= (unsigned __int8)uItemsAmountPerShopType[p2DEvents[*(int *)v2 - 1].uType] ) + goto LABEL_15; + } + v4 = 5 * v3; + v3 = (signed int)v0->ptr_1C; + v5 = word_4F063E[v4]; + v6 = word_4F063E[5 * v3 + rand() % 4 + 1]; + goto LABEL_13; + } +LABEL_15: + result = v0->ptr_1C; + pParty->InTheShopFlags[(int)v0->ptr_1C] = 0;*/ + } + + +//----- (00450218) -------------------------------------------------------- +void __cdecl sub_450218_prolly_generate_chests_loot() + { + unsigned int v0; // eax@1 + Chest *v1; // ebx@1 + MapInfo *v2; // esi@1 + ItemGen *v3; // ebx@2 + int v4; // ebp@4 + int v5; // edi@4 + int v6; // esi@4 + int v7; // eax@4 + signed int v8; // esi@4 + int v9; // edx@4 + int v10; // esi@8 + int v11; // ebp@25 + int v12; // esi@25 + signed int v13; // ebp@27 + ItemGen *v14; // edi@28 + signed int v15; // edx@32 + signed __int64 v16; // qtt@32 + int v17; // esi@34 + signed int v18; // [sp+10h] [bp-18h]@1 + int v19; // [sp+14h] [bp-14h]@4 + MapInfo *v20; // [sp+18h] [bp-10h]@1 + Chest *v21; // [sp+1Ch] [bp-Ch]@1 + int v22; // [sp+20h] [bp-8h]@26 + signed int v23; // [sp+24h] [bp-4h]@2 + + v18 = rand() % 100; + v0 = pMapStats->GetMapInfo(pCurrentMapName); + v1 = pChests; + v2 = &pMapStats->pInfos[v0]; + v21 = pChests; + v20 = &pMapStats->pInfos[v0]; + do + { + v3 = v1->mm7__vector_pItems; + v23 = 140; + do + { + if ( (v3->uItemID & 0x80000000u) == 0 ) + goto LABEL_56; + v4 = rand() % 5 + 1; + v5 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2]; + v6 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob+1];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3]; + v7 = rand(); + v8 = v6 - v5 + 1; + v9 = v5 + v7 % v8; + v19 = v5 + v7 % v8; + if ( v9 < 7 ) + { + if ( v18 < 20 ) + { + v3->Reset(); + goto LABEL_25; + } + if ( v18 < 60 ) + { + v10 = 0; + v3->Reset(); + if ( v19 == 1 ) + { + v10 = rand() % 51 + 50; + } + else + { + if ( v19 != 2 ) + { + if ( v19 == 3 ) + { + v10 = rand() % 301 + 200; + } + else + { + if ( v19 != 4 ) + { + if ( v19 == 5 ) + { + v10 = rand() % 1001 + 1000; +LABEL_15: + v3->uItemID = 199; + } + else + { + if ( v19 == 6 ) + { + v10 = rand() % 3001 + 2000; + goto LABEL_15; + } + } +LABEL_23: + v3->SetIdentified(); + v3->uSpecEnchantmentType = v10; +LABEL_25: + v11 = v4 - 1; + v12 = 0; + if ( v11 > 0 ) + { + v22 = v11; + while ( 1 ) + { + v13 = v12; + if ( v12 >= 140 ) + goto LABEL_52; + v14 = &v21->mm7__vector_pItems[v12]; + while ( v14->uItemID ) + { + ++v13; + ++v14; + if ( v13 >= 140 ) + goto LABEL_52; + } + v16 = rand(); + v15 = v16 % 100; + v18 = v16 % 100; + if ( v15 < 20 ) + goto LABEL_52; + if ( v15 >= 60 ) + { + pItemsTable->GenerateItem(v19, 0, v14); + goto LABEL_51; + } + v17 = 0; + v14->Reset(); + if ( v19 == 1 ) + { + v17 = rand() % 51 + 50; + goto LABEL_48; + } + if ( v19 == 2 ) + { + v17 = rand() % 101 + 100; +LABEL_48: + v14->uItemID = 197; + goto LABEL_49; + } + if ( v19 == 3 ) + { + v17 = rand() % 301 + 200; + goto LABEL_44; + } + if ( v19 == 4 ) + { + v17 = rand() % 501 + 500; +LABEL_44: + v14->uItemID = 198; + goto LABEL_49; + } + if ( v19 == 5 ) + break; + if ( v19 == 6 ) + { + v17 = rand() % 3001 + 2000; +LABEL_41: + v14->uItemID = 199; + } +LABEL_49: + v14->uSpecEnchantmentType = v17; +LABEL_51: + v12 = v13 + 1; +LABEL_52: + --v22; + if ( !v22 ) + goto LABEL_55; + } + v17 = rand() % 1001 + 1000; + goto LABEL_41; + } + goto LABEL_55; + } + v10 = rand() % 501 + 500; + } + v3->uItemID = 198; + goto LABEL_23; + } + v10 = rand() % 101 + 100; + } + v3->uItemID = 197; + goto LABEL_23; + } + pItemsTable->GenerateItem(v9, 0, v3); + goto LABEL_25; + } + v3->GenerateArtifact(); +LABEL_55: + v2 = v20; +LABEL_56: + ++v3; + --v23; + } + while ( v23 ); + v1 = v21 + 1; + ++v21; + } + while ( (signed int)v21 < (signed int)&uNumChests ); + } + + + + +// 4505CC: using guessed type int var_A0[32]; + //----- (004B3703) -------------------------------------------------------- + int sub_4B3703( int _this ) + { + signed int v1; // edi@1 + int v2; // eax@1 + int v3; // ecx@1 + signed int v4; // ebx@1 + int v5; // ecx@2 + int v6; // ecx@3 + int v7; // ecx@4 + int v8; // ecx@5 + int v9; // ecx@6 + signed int v10; // ebx@13 + signed int v11; // edi@14 + signed int v12; // esi@15 + unsigned int v13; // ecx@16 + int v14; // ecx@16 + int v15; // ecx@17 + int v16; // ecx@19 + int v17; // ecx@20 + int v18; // ecx@21 + signed int v19; // esi@32 + char *v20; // ecx@33 + int v21; // ecx@34 + int v22; // ecx@36 + int v23; // ecx@37 + int v24; // ecx@38 + int v25; // ecx@39 + int v26; // ecx@40 + int v27; // ecx@41 + int *v28; // esi@54 + unsigned int v29; // edx@56 + char *v30; // ecx@65 + int v31; // ecx@106 + int result; // eax@107 + int v33; // [sp-4h] [bp-2Ch]@23 + int v34; // [sp-4h] [bp-2Ch]@43 + int v35[5]; // [sp+Ch] [bp-1Ch]@8 + int a2; // [sp+20h] [bp-8h]@1 + int v37; // [sp+24h] [bp-4h]@1 + + //need fixing + __debugbreak(); + v1 = 0; + v2 = 0; + v3 = _this - 1; + a2 = 0; + v37 = 0; + dword_F8B1DC = 0; + v4 = 2; + if ( !v3 ) + { + while ( 1 ) + { + v19 = 1; + do + { + v20 = (char *)window_SpeakInHouse->ptr_1C + 4 * (unsigned int)window_SpeakInHouse->ptr_1C + v19; + /*if ( v1 ) + v21 = word_4F063E[(signed int)v20]; + else + v21 = word_4F0404[(signed int)v20 - 4];//word_4F03FE[(signed int)v20];*/ + v22 = v21 - 23; + if ( v22 ) + { + v23 = v22 - 1; + if ( v23 ) + { + v24 = v23 - 1; + if ( v24 ) + { + v25 = v24 - 1; + if ( v25 ) + { + v26 = v25 - 1; + if ( v26 ) + { + v27 = v26 - 1; + if ( v27 ) + { + if ( v27 != v4 ) + goto LABEL_51; + v34 = 36; + } + else + { + v34 = 42; + } + } + else + { + v34 = 41; + } + } + else + { + v34 = 40; + } + } + else + { + v34 = 39; + } + } + else + { + v34 = 38; + } + } + else + { + v34 = 37; + } + v37 = sub_4BE571(v34, v35, v37, 5); + v2 = dword_F8B1DC; + v4 = 2; +LABEL_51: + ++v19; + } + while ( v19 <= 4 ); + ++v1; + if ( v1 >= v4 ) + goto LABEL_53; + } + } + v5 = (int)(v3 - 1); + if ( !v5 ) + { + v10 = 0; + while ( 1 ) + { + v11 = 0; + do + { + v12 = 1; + do + { + v13 = v11 + 2 * (unsigned int)window_SpeakInHouse->ptr_1C - 30; + v14 = v12 + 4 * v13 + v13; + /* if ( v10 ) + v15 = word_4F06D8[v14]; + else + v15 = word_4F0498[v14];*/ + v16 = v15 - 31; + if ( v16 ) + { + v17 = v16 - 1; + if ( v17 ) + { + v18 = v17 - 1; + if ( v18 ) + { + if ( v18 != 1 ) + goto LABEL_28; + v33 = 44; + } + else + { + v33 = 47; + } + } + else + { + v33 = 46; + } + } + else + { + v33 = 45; + } + v37 = sub_4BE571(v33, v35, v37, 5); + v2 = dword_F8B1DC; +LABEL_28: + ++v12; + } + while ( v12 <= 4 ); + ++v11; + } + while ( v11 < 2 ); + ++v10; + if ( v10 >= 2 ) + goto LABEL_53; + } + } + v6 = v5 - 1; + if ( v6 ) + { + v7 = v6 - 1; + if ( v7 ) + { + v8 = v7 - 17; + if ( v8 ) + { + v9 = v8 - 2; + if ( v9 ) + { + if ( v9 == 7 ) + { + v37 = 2; + v35[0] = 69; + v35[1] = 60; + } + } + else + { + v37 = 3; + v35[0] = 67; + v35[1] = 66; + v35[2] = 58; + } + } + else + { + v37 = 3; + v35[0] = 70; + v35[1] = 65; + v35[2] = 62; + } + } + else + { + v37 = 2; + v35[0] = 71; + v35[1] = 68; + } + } + else + { + v37 = 2; + v35[0] = 57; + v35[1] = 59; + } +LABEL_53: + if ( v37 > 0 ) + { + v28 = v35; + while ( 1 ) + { + v29 = *v28; + if ( *v28 <= 47 ) + break; + if ( (signed int)v29 <= 66 ) + { + if ( v29 == 66 ) + { + v30 = pSkillNames[30]; + goto LABEL_106; + } + if ( v29 == 57 ) + { + v30 = pSkillNames[21]; + goto LABEL_106; + } + if ( v29 == 58 ) + { + v30 = pSkillNames[22]; + goto LABEL_106; + } + if ( v29 == 60 ) + { + v30 = pSkillNames[24]; + goto LABEL_106; + } + if ( v29 == 62 ) + { + v30 = pSkillNames[26]; + goto LABEL_106; + } + if ( v29 == 65 ) + { + v30 = pSkillNames[29]; + goto LABEL_106; + } + goto LABEL_100; + } + switch ( v29 ) + { + case 0x43u: + v30 = pSkillNames[31]; + break; + case 0x44u: + v30 = pSkillNames[32]; + break; + case 0x45u: + v30 = pSkillNames[33]; + break; + case 0x46u: + v30 = pSkillNames[34]; + break; + default: + if ( v29 != 71 ) + goto LABEL_100; + v30 = pSkillNames[35]; + break; + } +LABEL_106: + pShopOptions[v2] = v30; + v31 = a2++; + dword_F8B1DC = v2 + 1; + sub_4B36CC(v31, v29); + ++v28; + if ( a2 >= v37 ) + goto LABEL_107; + v2 = dword_F8B1DC; + } + if ( *v28 == 47 ) + { + v30 = pSkillNames[11]; + goto LABEL_106; + } + if ( (signed int)v29 > 40 ) + { + if ( v29 == 41 ) + { + v30 = pSkillNames[5]; + goto LABEL_106; + } + if ( v29 == 42 ) + { + v30 = pSkillNames[6]; + goto LABEL_106; + } + if ( v29 == 44 ) + { + v30 = pSkillNames[8]; + goto LABEL_106; + } + if ( v29 == 45 ) + { + v30 = pSkillNames[9]; + goto LABEL_106; + } + if ( v29 == 46 ) + { + v30 = pSkillNames[10]; + goto LABEL_106; + } + } + else + { + if ( v29 == 40 ) + { + v30 = pSkillNames[4]; + goto LABEL_106; + } + if ( v29 == 5 ) + { + v30 = pSkillNames[23]; + goto LABEL_106; + } + if ( v29 == 36 ) + { + v30 = pSkillNames[0]; + goto LABEL_106; + } + if ( v29 == 37 ) + { + v30 = pSkillNames[1]; + goto LABEL_106; + } + if ( v29 == 38 ) + { + v30 = pSkillNames[2]; + goto LABEL_106; + } + if ( v29 == 39 ) + { + v30 = pSkillNames[3]; + goto LABEL_106; + } + } +LABEL_100: + v30 = pGlobalTXT_LocalizationStrings[127]; //"No Text!" + goto LABEL_106; + } +LABEL_107: + pDialogueWindow->_41D08F(a2, 1, 0, 2); + result = pDialogueWindow->pNumPresenceButton; + dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; + return result; + }
--- a/Items.h Mon Feb 25 18:52:30 2013 +0600 +++ b/Items.h Mon Feb 25 18:52:45 2013 +0600 @@ -6,7 +6,7 @@ /* 338 */ -enum ITEM_FLAGS +enum ITEM_FLAGS :unsigned int { ITEM_IDENTIFIED = 0x1, ITEM_BROKEN = 0x2, @@ -270,7 +270,8 @@ }; #pragma pack(pop) - +void GenerateStandartShopItems(); +void GenerateSpecialShopItems(); extern ItemGen *ptr_50C9A4;
--- a/Party.h Mon Feb 25 18:52:30 2013 +0600 +++ b/Party.h Mon Feb 25 18:52:45 2013 +0600 @@ -272,8 +272,8 @@ NPCData pHirelings[2]; ItemGen pPickedItem; unsigned int uFlags; - ItemGen field_777C[53][12]; - ItemGen Recipes_Item[53][12]; //D0EC + ItemGen StandartItemsInShops[53][12]; + ItemGen SpecialItemsInShop[53][12]; //D0EC int field_12A5C[2117]; char field_14B70[5000]; char field_15EF8[250]; @@ -283,7 +283,7 @@ int armageddon_timer; int field_16140; int pTurnBasedPlayerRecoveryTimes[4]; - int field_16154[53]; + int InTheShopFlags[53]; int uFine; float flt_TorchlightColorR; float flt_TorchlightColorG;
--- a/Player.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/Player.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -7701,7 +7701,7 @@ //----- (00449BB4) -------------------------------------------------------- -char Player::CompareVariable(enum VariableType var, signed int a1) +char Player::CompareVariable(enum VariableType VarNum, signed int pValue) { Player *v3; // esi@1 signed int v4; // edi@1 @@ -7731,51 +7731,50 @@ int v28; // ebx@161 int v29; // eax@161 + v6 = 0; v3 = this; v4 = -1; - if ( var > VAR_AutoNotes ) - { - switch ( var ) + if ( VarNum > VAR_AutoNotes ) + { + switch ( VarNum ) { case VAR_Invisible: if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) ) - goto _return_true; - goto _cmp_against_arg; + return true; + return v4 >= pValue; case VAR_NumDeaths: v4 = pParty->uNumDeaths; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_NumBounties: v4 = pParty->uNumBountiesCollected; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_PrisonTerms: v4 = pParty->uNumPrisonTerms; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ArenaWinsPage: v4 = (unsigned __int8)pParty->uNumArenaPageWins; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ArenaWinsSquire: v4 = (unsigned __int8)pParty->uNumArenaSquireWins; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ArenaWinsKnight: v4 = (unsigned __int8)pParty->uNumArenaKnightWins; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ArenaWinsLord: v4 = (unsigned __int8)pParty->uNumArenaLordWins; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ReputationInCurrentLocation: v19 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v19 = &pIndoor->dlv; - v20 = v19->uReputation >= a1; - goto _return; + v6 = v19->uReputation >= pValue; + return v6; case VAR_History_28|VAR_Sex: v21 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v21 = &pIndoor->dlv; - v20 = v21->field_C_alert == a1; -_return: - LOBYTE(v6) = v20; + v6 = v21->field_C_alert == pValue; return v6; case VAR_MonthEquals2|VAR_Sex: case VAR_MonthEquals2|VAR_Class: @@ -7787,21 +7786,21 @@ case VAR_Counter6: case VAR_Counter7: case VAR_Counter8: - v22 = *(int *)&stru_AA1058[3].pSounds[8 * var + 44304]; - if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] - && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * var + 44300]) - + (signed __int64)((double)(460800 * a1) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) - goto _return_true; - goto _return_false; + 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; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_CircusPrises: v4 = 0; v23 = pParty->pPlayers;//[0].pInventoryItems; do { - v24 = v23->pInventoryItems; + v24 = v23->pInventoryItems; v25 = 138; do { @@ -7824,32 +7823,35 @@ ++v23; } while ( v23 <= &pParty->pPlayers[3] ); - goto _cmp_against_arg; + return v4 >= pValue; case VAR_MonthEquals2: - v17 = pParty->uCurrentMonth == a1; - goto _return2; + v6 = pParty->uCurrentMonth == pValue; + return v6; case VAR_IsFlying: if ( pParty->bFlying && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) > 0) ) - goto _return_true; - goto _return_false; + return true; + return false; case VAR_HiredNPCHasSpeciality: - LOBYTE(v6) = CheckHiredNPCSpeciality(a1); + LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); return v6; case VAR_NPCs2: - return pNPCStats->pNewNPCData[a1].Hired(); + return pNPCStats->pNewNPCData[pValue].Hired(); case VAR_MonthEquals|VAR_CurrentSP: v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; v14 = this->field_1A50[((signed __int16)a1 - 1) >> 3]; - goto LABEL_108; + if ( !((unsigned __int8)v13 & v14) ) + return v4 >= pValue; + v4 = pValue; + return v4 >= pValue; case VAR_ItemEquipped: v26 = (ITEM_EQUIP_TYPE)0; v27 = (char *)&this->pEquipment; break; case VAR_GoldInBank: v4 = pParty->uNumGoldInBank; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ThieverySkill|0x80: v28 = GetActualMight(); v29 = v3->GetBaseStrength(); @@ -7882,70 +7884,65 @@ v9 = v28 - v29 < 0; LABEL_169: if ( v9 ^ v10 ) - goto _cmp_against_arg; - goto _return_true; + return v4 >= pValue; + return true; default: - goto _cmp_against_arg; + return v4 >= pValue; } while ( !v3->HasItemEquipped(v26) - || *(int *)&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v27 + 5] != a1 ) + || *(int *)&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v27 + 5] != pValue ) { v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); v27 += 4; if ( (signed int)v26 >= 16 ) - { -_return_false: - LOBYTE(v6) = 0; - return v6; - } - } - goto _return_true; - } - if ( var == VAR_AutoNotes ) + return false; + } + return true; + } + if ( VarNum == VAR_AutoNotes ) { v13 = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; v14 = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) >> 3]; -LABEL_108: if ( !((unsigned __int8)v13 & v14) ) - goto _cmp_against_arg; - goto LABEL_109; - } - if ( var <= VAR_BaseLuck ) - { - if ( var != VAR_BaseLuck ) - { - switch ( var ) + return v4 >= pValue; + v4 = pValue; + return v4 >= pValue; + } + if ( VarNum <= VAR_BaseLuck ) + { + if ( VarNum != VAR_BaseLuck ) + { + switch ( VarNum ) { case VAR_Hour: - if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == a1 ) - goto _return_true; - goto _return_false; + if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) + return true; + return false; case VAR_DayOfYear: - v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 - % 0x150 - + 1; - goto LABEL_9; + v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; + v6 = v5 == pValue; + return v6; case VAR_DayOfWeek: - v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 - % 7; -LABEL_9: - LOBYTE(v6) = v5 == a1; + v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; + v6 = v5 == pValue; return v6; case VAR_Sex: - v7 = (CHARACTER_RACE)this->uSex; - goto _cmp_against_arg2; + if ( pValue == (CHARACTER_RACE)this->uSex ) + return true; + return v4 >= pValue; case VAR_Class: v7 = (CHARACTER_RACE)this->classType; - goto _cmp_against_arg2; + if ( pValue == v7 ) + return true; + return v4 >= pValue; case VAR_Race: v7 = GetRace(); -_cmp_against_arg2: - if ( a1 == v7 ) - goto _return_true; - goto _cmp_against_arg; + if ( pValue == v7 ) + return true; + return v4 >= pValue; case VAR_CurrentHP: v4 = this->sHealth; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_MaxHP: v8 = GetMaxHealth(); v10 = __OFSUB__(v3->sHealth, v8); @@ -7953,7 +7950,7 @@ goto LABEL_169; case VAR_CurrentSP: v4 = this->sMana; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_MaxSP: v11 = GetMaxMana(); v10 = __OFSUB__(v3->sMana, v11); @@ -7964,135 +7961,136 @@ goto _j_cmp_against_arg; case VAR_ACModifier: v4 = this->sACModifier; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseLevel: v4 = this->uLevel; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_LevelModifier: v4 = this->sLevelModifier; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_Age: v12 = GetActualAge(); goto _j_cmp_against_arg; case VAR_Award: v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; v14 = this->field_152[((signed __int16)a1 - 1) >> 3]; - goto LABEL_108; + if ( !((unsigned __int8)v13 & v14) ) + return v4 >= pValue; + v4 = pValue; + return v4 >= pValue; case VAR_Experience: v4 = LODWORD(this->uExperience); - goto _cmp_against_arg; + return v4 >= pValue; case VAR_QBits_QuestsDone: - v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; - v14 = pParty->_award_bits[((signed __int16)a1 - 1) >> 3]; - goto LABEL_108; + v13 = 0x80u >> (pValue - 1) % 8; + v14 = pParty->_award_bits[(pValue - 1) >> 3]; + if ( !((unsigned __int8)v13 & v14) ) + return false; + return true; case VAR_PlayerItemInHands: v15 = 0; v16 = v3->pInventoryItems; break; case VAR_FixedGold: v4 = pParty->uNumGold; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_MightBonus: v4 = this->uMightBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_IntellectBonus: v4 = this->uIntelligenceBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_PersonalityBonus: v4 = this->uWillpowerBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_EnduranceBonus: v4 = this->uEnduranceBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_SpeedBonus: v4 = this->uSpeedBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_AccuracyBonus: v4 = this->uAccuracyBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_LuckBonus: v4 = this->uLuckBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseMight: v4 = this->uMight; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseIntellect: v4 = this->uIntelligence; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BasePersonality: v4 = this->uWillpower; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseEndurance: v4 = this->uEndurance; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseSpeed: v4 = this->uSpeed; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseAccuracy: v4 = this->uAccuracy; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_FixedFood: v4 = pParty->uNumFoodRations; - goto _cmp_against_arg; + return v4 >= pValue; default: - goto _cmp_against_arg; - } - while ( v16->uItemID != a1 ) + return v4 >= pValue; + } + while ( v16->uItemID != pValue ) { ++v15; ++v16; if ( v15 >= 138 ) { - v17 = pParty->pPickedItem.uItemID == a1; -_return2: - LOBYTE(v6) = v17; + v6 = pParty->pPickedItem.uItemID == pValue; return v6; } } -_return_true: - LOBYTE(v6) = 1; - return v6; + return true; } v4 = this->uLuck; - goto _cmp_against_arg; - } - if ( var <= VAR_MagicResistance ) - { - if ( var == VAR_MagicResistance ) + return v4 >= pValue; + } + if ( VarNum <= VAR_MagicResistance ) + { + if ( VarNum == VAR_MagicResistance ) { v4 = this->sResMagicBase; } else { - switch ( var ) + switch ( VarNum ) { case VAR_FireResistance: v4 = this->sResFireBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_AirResistance: v4 = this->sResAirBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_WaterResistance: v4 = this->sResWaterBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_EarthResistance: v4 = this->sResEarthBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_SpiritResistance: v4 = this->sResSpiritBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_MindResistance: v4 = this->sResMindBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BodyResistance: v4 = this->sResBodyBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_LightResistance: v4 = this->sResLightBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_DarkResistance: v4 = this->sResDarkBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ActualMight: v12 = GetActualMight(); goto _j_cmp_against_arg; @@ -8117,18 +8115,18 @@ v4 = v12; break; default: - goto _cmp_against_arg; - } - } - goto _cmp_against_arg; - } - if ( var <= VAR_DisarmTrapSkill ) - { - if ( var != VAR_DisarmTrapSkill ) - { - if ( var <= VAR_MindResistanceBonus ) - { - switch ( var ) + return v4 >= pValue; + } + } + return v4 >= pValue; + } + if ( VarNum <= VAR_DisarmTrapSkill ) + { + if ( VarNum != VAR_DisarmTrapSkill ) + { + if ( VarNum <= VAR_MindResistanceBonus ) + { + switch ( VarNum ) { case VAR_MindResistanceBonus: v4 = this->sResMindBonus; @@ -8149,63 +8147,60 @@ v4 = this->sResSpiritBonus; break; } - goto _cmp_against_arg; - } - if ( var == VAR_BodyResistanceBonus ) + return v4 >= pValue; + } + if ( VarNum == VAR_BodyResistanceBonus ) { v4 = this->sResBodyBonus; - goto _cmp_against_arg; - } - if ( var == VAR_LightResistanceBonus ) + return v4 >= pValue; + } + if ( VarNum == VAR_LightResistanceBonus ) { v4 = this->sResLightBonus; - goto _cmp_against_arg; - } - if ( var == VAR_DarkResistanceBonus ) + return v4 >= pValue; + } + if ( VarNum == VAR_DarkResistanceBonus ) { v4 = this->sResDarkBonus; - goto _cmp_against_arg; - } - if ( var == VAR_MagicResistanceBonus ) + return v4 >= pValue; + } + if ( VarNum == VAR_MagicResistanceBonus ) { v4 = this->sResMagicBonus; - goto _cmp_against_arg; - } - if ( var <= VAR_MagicResistanceBonus || var > VAR_DiplomacySkill ) - goto _cmp_against_arg; + return v4 >= pValue; + } + if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) + return v4 >= pValue; } LABEL_90: - v18 = *((short *)&this->pConditions[16] + var); - if ( a1 <= 63 ) + v18 = *((short *)&this->pConditions[16] + VarNum); + if ( pValue <= 63 ) v4 = v18 & 0x3F; else - v4 = a1 & v18; - goto _cmp_against_arg; - } - if ( var == 104 ) + v4 = pValue & v18; + return v4 >= pValue; + } + if ( VarNum == 104 ) goto LABEL_90; - if ( (signed int)var <= 104 ) - goto _cmp_against_arg; - if ( (signed int)var > 0x79 ) - { - if ( var != 122 ) - { - if ( (signed int)var > 122 && var <= VAR_ActiveSpells ) - v4 = (unsigned __int8)byte_5E4C15[var]; - goto _cmp_against_arg; + 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 ) { -_cmp_against_arg: - LOBYTE(v6) = v4 >= a1; - return v6; - } -LABEL_109: - v4 = a1; - goto _cmp_against_arg; - } - return *((int *)this + 2 * var - 210); + return v4 >= pValue; + } + v4 = pValue; + return v4 >= pValue; + } + return *((int *)this + 2 * VarNum - 210); }
--- a/Player.h Mon Feb 25 18:52:30 2013 +0600 +++ b/Player.h Mon Feb 25 18:52:45 2013 +0600 @@ -444,7 +444,7 @@ void SetVariable(enum VariableType var, signed int a3); void AddVariable(enum VariableType var, signed int val); void SubtractVariable(enum VariableType var, void *a3); - char CompareVariable(enum VariableType var, signed int a1); + char CompareVariable(enum VariableType VarNum, signed int pValue); void UseItem_DrinkPotion_etc(signed int a2, int a3); bool AddItem(struct ItemGen *pItem); int GetBaseStrength();
--- a/mm7_1.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/mm7_1.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -5274,9 +5274,9 @@ if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() ) { v15 = stru_5E4C90._decor_events[v13->_idx_in_stru123 - 75] + 380; - _5C3420_pDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; + GlobalEventInfo = (int)&pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; EventProcessor(v15, 0, 1); - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; } return; }
--- a/mm7_2.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/mm7_2.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -925,84 +925,6 @@ } } -//----- (004B8E3D) -------------------------------------------------------- -void *__cdecl GenerateShopItems() -{ - GUIWindow *v0; // eax@1 - signed int v1; // edi@1 - signed int v2; // esi@1 - int v3; // ecx@3 - int v4; // ebx@3 - int v5; // ecx@3 - bool v6; // ebp@5 - int v7; // ecx@5 - void *result; // eax@15 - signed int v9; // [sp-Ch] [bp-14h]@7 - - v0 = window_SpeakInHouse; - v1 = 0; - v2 = (signed int)window_SpeakInHouse->ptr_1C; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] ) - if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) - { - while ( v2 > 14 ) - { - if ( v2 <= 28 ) - { - v6 = v1 > 3; - v7 = v6 + 2 * v2 - 30; - v2 = (signed int)v0->ptr_1C; - v4 = word_4F0498[5 * v7]; - __debugbreak(); - //things happen around word_4F0400 actually - //v5 = *(short *)&aTooManyStation[2 * (5 * (v6 + 2 * v2) + rand() % 4) + 10]; - goto LABEL_13; - } - if ( v2 <= 41 ) - { - v4 = word_4F0576[v2]; - v9 = 22; //misc - goto LABEL_12; - } - if ( v2 <= 53 ) - { - if ( v1 >= 6 ) - { - v4 = word_4F0578[v2]; - v9 = 45; //reagent -LABEL_12: - v5 = v9; -LABEL_13: - pItemsTable->GenerateItem(v4, v5, (ItemGen *)&pParty->field_777C[v2][v1]);//9 * (v1 + 12 * v2)]); - v0 = window_SpeakInHouse; - pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes = 1; //identified - goto LABEL_14; - } - auto _t = (ItemGen *)&pParty->field_777C[v2][v1]; - _t->Reset(); - v0 = window_SpeakInHouse; - pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uItemID = 220; //potion bottle - } -LABEL_14: - v2 = (signed int)v0->ptr_1C; - ++v1; - //if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v0->ptr_1C]] ) - if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v0->ptr_1C - 1].uType] ) - goto LABEL_15; - } - v3 = 5 * v2; - v2 = (signed int)v0->ptr_1C; - v4 = word_4F0404[v3 - 4]; - v5 = word_4F0404[5 * v2 + rand() % 4 - 2]; - goto LABEL_13; - } -LABEL_15: - result = v0->ptr_1C; - *(int *)&pParty->field_16154[4 * (int)result] = 0; - return result; -} - - //----- (004B910F) -------------------------------------------------------- char *__cdecl WeaponShopDialog() @@ -1492,7 +1414,7 @@ do { // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) - if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); { v49 = word_F8B158[(signed int)v48]; v50 = dword_F8B168[(signed int)v48]; @@ -1518,7 +1440,7 @@ do { // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) { v52 = word_F8B158[(signed int)v109] + 30; v53 = dword_F8B168[(signed int)v109]; @@ -1544,7 +1466,7 @@ v106.x = 0; do { - if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) ++v106.x; ++v55; } @@ -1555,7 +1477,7 @@ do { // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) ++v106.x; ++v55; } @@ -1585,9 +1507,9 @@ v106.x = v60; v61 = (int)window_SpeakInHouse->ptr_1C; // v62 = 9 * (v60 + 12 * v61); - v63 = (ItemGen *)&pParty->field_777C[(int)v61][v60]; + v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; if ( dword_F8B19C != 2 ) - v63 = &pParty->Recipes_Item[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; + v63 = &pParty->SpecialItemsInShop[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; if ( !v56 || !Str ) { v85 = 0; @@ -2033,7 +1955,7 @@ do { // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); { v46 = dword_F8B168[v114]; v47 = 152 - v46->uTextureHeight; @@ -2064,7 +1986,7 @@ do { // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) - if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); { v50 = dword_F8B168[v114 + 6]; v51 = 308 - v50->uTextureHeight; @@ -2097,7 +2019,7 @@ do { //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) { v54 = dword_F8B168[v114]; v55 = 152 - v54->uTextureHeight; @@ -2128,7 +2050,7 @@ do { // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid { v58 = dword_F8B168[v114 + 6]; v59 = 308 - v58->uTextureHeight; @@ -2166,7 +2088,7 @@ do { // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); ++v109; ++v62; } @@ -2177,7 +2099,7 @@ do { //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) ++v109; ++v62; } @@ -2211,9 +2133,9 @@ v109 = v67; v68 = (int)window_SpeakInHouse->ptr_1C; // v69 = 9 * (v67 + 12 * v68); - v70 = (ItemGen *)&pParty->field_777C[v68][v67]; + v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; if ( dword_F8B19C != 2 ) - v70 = &pParty->Recipes_Item[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; + v70 = &pParty->SpecialItemsInShop[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; if ( !v63 || !Str ) { v93 = 0; @@ -2418,7 +2340,7 @@ do { // if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID) ++v149; ++v93; } @@ -2435,7 +2357,7 @@ v97 = uActiveCharacter - 1; // v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724]; v99 = _this->_490EEE( - &pParty->Recipes_Item[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724], + &pParty->SpecialItemsInShop[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724], 2, (int)window_SpeakInHouse->ptr_1C, 2); @@ -2450,7 +2372,7 @@ do { //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID) { v105 = dword_F8B168[v104]; if ( v104 >= 4 ) @@ -2638,7 +2560,7 @@ do { // if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID); { v56 = dword_F8B168[v55]; if ( v55 >= 4 ) @@ -2673,7 +2595,7 @@ do { // if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID) { v62 = dword_F8B168[v61]; if ( v61 >= 4 ) @@ -2710,7 +2632,7 @@ do { // if ( (char *)pParty->field_777C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] != v11 ) - if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v68].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v68].uItemID); ++v149; ++v68; } @@ -2721,7 +2643,7 @@ do { // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID) ++v149; ++v68; } @@ -2751,9 +2673,9 @@ v75 = (int)window_SpeakInHouse->ptr_1C; v76 = 9 * (v74 - 1 + 12 * v75); if ( dword_F8B19C == 2 ) - v77 = (ItemGen *)&pParty->field_777C[v76]; + v77 = (ItemGen *)&pParty->StandartItemsInShops[v76]; else - v77 = &pParty->Recipes_Item[(int)75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; + v77 = &pParty->SpecialItemsInShop[(int)75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; if ( v69 == (short)v11 || Str == v11 ) { v124 = (__int64 *)v11; @@ -3709,7 +3631,7 @@ } //----- (004BCACC) -------------------------------------------------------- -void __fastcall sub_4BCACC_bounties(signed int a1) +void __fastcall DrawLearnSkillDialog(signed int uMessageParam) { unsigned int v1; // edi@1 //signed int v2; // ebx@1 @@ -3779,7 +3701,7 @@ goto LABEL_13; if ( dword_F8B198 == 30 ) { - if ( a1 == 17 ) + if ( uMessageParam == 17 ) { v4 = 0; v5 = 0; @@ -3799,8 +3721,8 @@ } v8 = window_SpeakInHouse; if ( (dword_F8B198 == 27 || dword_F8B198 == 28) - && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + a1)] + pParty->uDaysPlayed % 7)) - || dword_F8B198 != 23 || a1 != 10 ) + && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7)) + || dword_F8B198 != 23 || uMessageParam != 10 ) { LABEL_9: pDialogueWindow->Release(); @@ -3820,7 +3742,7 @@ goto LABEL_10; } LABEL_11: - dword_F8B19C = a1; + dword_F8B19C = uMessageParam; if ( dword_F8B198 < 19 ) { v9 = pIcons_LOD->LoadTexture(off_4F03B8[dword_F8B198], TEXTURE_16BIT_PALETTE); @@ -3886,7 +3808,7 @@ } if ( dword_F8B198 != 17 ) return; - if ( a1 == 99 ) + if ( uMessageParam == 99 ) { v10 = (int)((char *)v8->ptr_1C - 102); v56 = v10; @@ -4084,7 +4006,7 @@ } goto LABEL_196; } - if ( a1 == 100 ) + if ( uMessageParam == 100 ) { pKeyActionMap->EnterText(1, 10, v8); goto LABEL_196; @@ -4092,15 +4014,15 @@ } } } - if ( a1 > 95 ) + if ( uMessageParam > 95 ) { LABEL_196: - switch ( a1 ) + switch ( uMessageParam ) { case 96: pDialogueWindow->eWindowType = WINDOW_MainMenu; UI_CreateEndConversationButton(); - sub_4B3703((void *)dword_F8B198); + sub_4B3703(dword_F8B198); break; case 101: pDialogueWindow->eWindowType = WINDOW_MainMenu; @@ -4127,25 +4049,25 @@ } return; } - if ( a1 != 95 && a1 != 2 ) - { - if ( a1 == 3 ) + if ( uMessageParam != 95 && uMessageParam != 2 ) + { + if ( uMessageParam == 3 ) { dword_F8B19C = 3; } else { - if ( a1 == 4 ) + if ( uMessageParam == 4 ) { dword_F8B19C = 4; } else { - if ( a1 != 5 ) - { - if ( a1 > 35 ) - { - if ( a1 <= 72 ) + 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); @@ -4164,7 +4086,7 @@ if (false) //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) { - v38 = (int)(&v35->uIntelligence + a1); + v38 = (int)(&v35->uIntelligence + uMessageParam); if ( !*(short *)v38 ) { if ( pParty->uNumGold < v37 ) @@ -4188,7 +4110,7 @@ } else { - if ( a1 == 94 ) + if ( uMessageParam == 94 ) { pDialogueWindow->eWindowType = WINDOW_MainMenu; UI_CreateEndConversationButton(); @@ -4208,8 +4130,8 @@ pParty->field_3C.field_50[2 * (unsigned int)v8->ptr_1C + 1], pParty->field_3C.field_50[2 * (unsigned int)v8->ptr_1C]) < (signed __int64)pParty->uTimePlayed ) { - GenerateShopItems(); - sub_4B8F94(); + GenerateStandartShopItems(); + GenerateSpecialShopItems(); v8 = window_SpeakInHouse; v40 = window_SpeakInHouse->ptr_1C; //v3 = dword_F8B198; @@ -4224,13 +4146,13 @@ v43 = 0; //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; - if ( a1 == 2 ) - { - if ( _4F063C_smthn_by_2da_uType[v44] ) + if ( uMessageParam == 2 ) + { + if ( uItemsAmountPerShopType[v44] ) { do { - v45 = pParty->field_777C[(int)v42][v43].uItemID; + v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID; if ( v45 ) { v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); @@ -4242,19 +4164,19 @@ ++v43; } //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); + while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); } if ( dword_F8B198 == 1 ) { v47 = v8->ptr_1C; v48 = 0; //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) { do { // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] ) - if ( pParty->field_777C[(int)v47][v48].uItemID); + if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID); { v49 = rand(); v8 = window_SpeakInHouse; @@ -4264,18 +4186,18 @@ ++v48; } //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); + while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); } } } else { - if ( _4F063C_smthn_by_2da_uType[v44] ) + if ( uItemsAmountPerShopType[v44] ) { do { //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724]; - v50=pParty->Recipes_Item[(unsigned int)v42][(signed int)v43].uItemID; + v50=pParty->SpecialItemsInShop[(unsigned int)v42][(signed int)v43].uItemID; if ( v50 ) { v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); @@ -4287,19 +4209,19 @@ ++v43; } //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); + while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); } if ( dword_F8B198 == 1 ) { v52 = v8->ptr_1C; v53 = 0; //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) { do { // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) - if (pParty->Recipes_Item[(unsigned int)v52][v53].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)v52][v53].uItemID) { v54 = rand(); v8 = window_SpeakInHouse; @@ -4309,7 +4231,7 @@ ++v53; } //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] ); + while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] ); } } } @@ -4327,7 +4249,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pKeyActionMap->_459ED1(3); pKeyActionMap->ResetKeys(); - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; ptr_F8B1E8 = 0; if ( pDialogueNPCCount ) { @@ -4612,13 +4534,13 @@ // v31 = 9 * (v29 - 1 + 12 * (int)v30); if ( dword_F8B19C == 2 ) { - v32 = (ItemGen *)&pParty->field_777C[(int)v30][v29]; - _this = (ItemGen *)&pParty->field_777C[(int)v30][v29]; + v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; + _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; } else { - _this =&pParty->Recipes_Item[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724]; - v32 = &pParty->Recipes_Item[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; + _this =&pParty->SpecialItemsInShop[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724]; + v32 = &pParty->SpecialItemsInShop[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; } //v33 = p2DEvents_minus1__20[13 * (signed int)v30]; v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier; @@ -8071,202 +7993,6 @@ return a1a.Create(0, 0, 0, 0); } -//----- (00450218) -------------------------------------------------------- -void __cdecl sub_450218_prolly_generate_chests_loot() -{ - unsigned int v0; // eax@1 - Chest *v1; // ebx@1 - MapInfo *v2; // esi@1 - ItemGen *v3; // ebx@2 - int v4; // ebp@4 - int v5; // edi@4 - int v6; // esi@4 - int v7; // eax@4 - signed int v8; // esi@4 - int v9; // edx@4 - int v10; // esi@8 - int v11; // ebp@25 - int v12; // esi@25 - signed int v13; // ebp@27 - ItemGen *v14; // edi@28 - signed int v15; // edx@32 - signed __int64 v16; // qtt@32 - int v17; // esi@34 - signed int v18; // [sp+10h] [bp-18h]@1 - int v19; // [sp+14h] [bp-14h]@4 - MapInfo *v20; // [sp+18h] [bp-10h]@1 - Chest *v21; // [sp+1Ch] [bp-Ch]@1 - int v22; // [sp+20h] [bp-8h]@26 - signed int v23; // [sp+24h] [bp-4h]@2 - - v18 = rand() % 100; - v0 = pMapStats->GetMapInfo(pCurrentMapName); - v1 = pChests; - v2 = &pMapStats->pInfos[v0]; - v21 = pChests; - v20 = &pMapStats->pInfos[v0]; - do - { - v3 = v1->mm7__vector_pItems; - v23 = 140; - do - { - if ( (v3->uItemID & 0x80000000u) == 0 ) - goto LABEL_56; - v4 = rand() % 5 + 1; - v5 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2]; - v6 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob+1];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3]; - v7 = rand(); - v8 = v6 - v5 + 1; - v9 = v5 + v7 % v8; - v19 = v5 + v7 % v8; - if ( v9 < 7 ) - { - if ( v18 < 20 ) - { - v3->Reset(); - goto LABEL_25; - } - if ( v18 < 60 ) - { - v10 = 0; - v3->Reset(); - if ( v19 == 1 ) - { - v10 = rand() % 51 + 50; - } - else - { - if ( v19 != 2 ) - { - if ( v19 == 3 ) - { - v10 = rand() % 301 + 200; - } - else - { - if ( v19 != 4 ) - { - if ( v19 == 5 ) - { - v10 = rand() % 1001 + 1000; -LABEL_15: - v3->uItemID = 199; - } - else - { - if ( v19 == 6 ) - { - v10 = rand() % 3001 + 2000; - goto LABEL_15; - } - } -LABEL_23: - v3->SetIdentified(); - v3->uSpecEnchantmentType = v10; -LABEL_25: - v11 = v4 - 1; - v12 = 0; - if ( v11 > 0 ) - { - v22 = v11; - while ( 1 ) - { - v13 = v12; - if ( v12 >= 140 ) - goto LABEL_52; - v14 = &v21->mm7__vector_pItems[v12]; - while ( v14->uItemID ) - { - ++v13; - ++v14; - if ( v13 >= 140 ) - goto LABEL_52; - } - v16 = rand(); - v15 = v16 % 100; - v18 = v16 % 100; - if ( v15 < 20 ) - goto LABEL_52; - if ( v15 >= 60 ) - { - pItemsTable->GenerateItem(v19, 0, v14); - goto LABEL_51; - } - v17 = 0; - v14->Reset(); - if ( v19 == 1 ) - { - v17 = rand() % 51 + 50; - goto LABEL_48; - } - if ( v19 == 2 ) - { - v17 = rand() % 101 + 100; -LABEL_48: - v14->uItemID = 197; - goto LABEL_49; - } - if ( v19 == 3 ) - { - v17 = rand() % 301 + 200; - goto LABEL_44; - } - if ( v19 == 4 ) - { - v17 = rand() % 501 + 500; -LABEL_44: - v14->uItemID = 198; - goto LABEL_49; - } - if ( v19 == 5 ) - break; - if ( v19 == 6 ) - { - v17 = rand() % 3001 + 2000; -LABEL_41: - v14->uItemID = 199; - } -LABEL_49: - v14->uSpecEnchantmentType = v17; -LABEL_51: - v12 = v13 + 1; -LABEL_52: - --v22; - if ( !v22 ) - goto LABEL_55; - } - v17 = rand() % 1001 + 1000; - goto LABEL_41; - } - goto LABEL_55; - } - v10 = rand() % 501 + 500; - } - v3->uItemID = 198; - goto LABEL_23; - } - v10 = rand() % 101 + 100; - } - v3->uItemID = 197; - goto LABEL_23; - } - pItemsTable->GenerateItem(v9, 0, v3); - goto LABEL_25; - } - v3->GenerateArtifact(); -LABEL_55: - v2 = v20; -LABEL_56: - ++v3; - --v23; - } - while ( v23 ); - v1 = v21 + 1; - ++v21; - } - while ( (signed int)v21 < (signed int)&uNumChests ); -} //----- (00450521) -------------------------------------------------------- signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6) @@ -15276,9 +15002,9 @@ v10 = v8->_idx_in_stru123; v24 = 1; v11 = stru_5E4C90._decor_events[v10 - 75] + 380; - _5C3420_pDecoration = v8; + GlobalEventInfo = (int)v8; EventProcessor(v11, 0, 1); - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; } break;
--- a/mm7_3.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/mm7_3.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -14860,7 +14860,7 @@ pEventTimer->Pause(); dword_5C3418 = v4; dword_5C341C = v3; - _591094_decoration = _5C3420_pDecoration; + _591094_decoration = (LevelDecoration *)GlobalEventInfo; pGUIWindow2 = GUIWindow::Create(0, 0, 640u, 480u, (enum WindowType)19, a4, 0); pGUIWindow2->CreateButton(61u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); pGUIWindow2->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); @@ -14874,11 +14874,11 @@ { pGUIWindow2->Release(); pGUIWindow2 = 0; - _5C3420_pDecoration = _591094_decoration; + GlobalEventInfo = (int)_591094_decoration; start_event_seq_number = dword_5C341C; EventProcessor(dword_5C3418, 0, 1); start_event_seq_number = 0; - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; pEventTimer->Resume(); }
--- a/mm7_4.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/mm7_4.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -4915,7 +4915,7 @@ NPCData *npc = nullptr; if ( dword_5C35D4 ) { - __debugbreak(); // fix + //__debugbreak(); // fix npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; } else @@ -8922,7 +8922,7 @@ pParty->field_3C._shop_ban_times[2 * a1] = LODWORD(pParty->uTimePlayed) + 368640; pParty->field_3C._shop_ban_times[2 * a1 + 1] = HIDWORD(v6); LABEL_13: - *(int *)&pParty->field_16154[4 * a1] = 1; + pParty->InTheShopFlags[a1] = 1; if ( v3 ) { v7 = &pOutdoor->ddm; @@ -9055,7 +9055,7 @@ // F8B1E0: using guessed type int dword_F8B1E0; - +//view item details in shop? //----- (004B1A2D) -------------------------------------------------------- void __cdecl sub_4B1A2D() { @@ -9113,7 +9113,7 @@ v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); if ( dword_F8B19C != 2 ) // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; - v7 =&pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; + v7 =&pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; goto LABEL_15; } if ( dword_F8B198 <= 16 && dword_F8B19C == 18 ) @@ -9383,32 +9383,30 @@ NPCData *pCurrentNPCInfo; // ebp@1 int pEventNumber; // ecx@8 Player *v4; // esi@20 - int v5; // eax@28 - int v6; // eax@31 - int v7; // eax@34 - int v8; // eax@37 - int v9; // eax@40 - unsigned int v10; // eax@43 - unsigned int v11; // eax@48 + //int v5; // eax@28 + //int v6; // eax@31 + //int v7; // eax@34 + //int v8; // eax@37 + //int v9; // eax@40 + //unsigned int v10; // eax@43 char *v12; // eax@53 char *v13; // eax@56 char *v14; // eax@57 char *v15; // eax@58 - unsigned int v16; // ebp@62 + //unsigned int v16; // ebp@62 char *v17; // ecx@63 char *v18; // eax@65 const char *v19; // ecx@68 //unsigned int v20; // eax@69 - unsigned int v21; // ecx@70 + signed int pPrice; // ecx@70 char *v22; // [sp-Ch] [bp-18h]@73 - int v23; // [sp-8h] [bp-14h]@49 + //int v23; // [sp-8h] [bp-14h]@49 char *v24; // [sp-8h] [bp-14h]@73 - int v25; // [sp-4h] [bp-10h]@49 - - //v1 = a1; + //int v25; // [sp-4h] [bp-10h]@49 + uDialogueType = uMessageParam + 1; pCurrentNPCInfo = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; - if ( uMessageParam <= 23 ) + if ( uMessageParam <= 24 ) { switch ( uMessageParam ) { @@ -9437,8 +9435,17 @@ pEventNumber = pCurrentNPCInfo->evt_F; break; default: - goto _return; - } + goto _return; + } + /*switch ( pEventNumber ) + { + case 139: + sub_4B1ECE(); + goto _return; + case 311: + sub_4BBA85_bounties(); + goto _return; + }*/ if ( pEventNumber < 200 || pEventNumber > 310 ) { if ( pEventNumber < 400 || pEventNumber > 410 ) @@ -9456,9 +9463,9 @@ else { ptr_F8B1E8 = 0; - _5C3420_pDecoration = (LevelDecoration *)1; + GlobalEventInfo = 1; EventProcessor(pEventNumber, 0, 1); - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; } } } @@ -9478,7 +9485,7 @@ { if ( uMessageParam == 77 ) { - v16 = pCurrentNPCInfo->uProfession; + //v16 = pCurrentNPCInfo->uProfession; if (dialogue_show_profession_details) v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; else @@ -9541,37 +9548,34 @@ switch ( dword_F8B1D8 ) { case 19: - v10 = pCurrentNPCInfo->evt_A; - if ( (signed int)v10 >= 400 && (signed int)v10 <= 416 ) + pEventNumber = pCurrentNPCInfo->evt_A; + if ( pEventNumber >= 400 && pEventNumber <= 416 ) pCurrentNPCInfo->evt_A = 0; break; case 20: - v9 = pCurrentNPCInfo->evt_B; - if ( v9 >= 400 && v9 <= 416 ) + pEventNumber = pCurrentNPCInfo->evt_B; + if ( pEventNumber >= 400 && pEventNumber <= 416 ) pCurrentNPCInfo->evt_B = 0; break; case 21: - v8 = pCurrentNPCInfo->evt_C; - if ( v8 >= 400 && v8 <= 416 ) + pEventNumber = pCurrentNPCInfo->evt_C; + if ( pEventNumber >= 400 && pEventNumber <= 416 ) pCurrentNPCInfo->evt_C = 0; break; case 22: - v7 = pCurrentNPCInfo->evt_D; - if ( v7 >= 400 && v7 <= 416 ) + pEventNumber = pCurrentNPCInfo->evt_D; + if ( pEventNumber >= 400 && pEventNumber <= 416 ) pCurrentNPCInfo->evt_D = 0; break; case 23: - v6 = pCurrentNPCInfo->evt_E; - if ( v6 >= 400 && v6 <= 416 ) + pEventNumber = pCurrentNPCInfo->evt_E; + if ( pEventNumber >= 400 && pEventNumber <= 416 ) pCurrentNPCInfo->evt_E = 0; break; case 24: - v5 = pCurrentNPCInfo->evt_F; - if ( v5 >= 400 ) - { - if ( v5 <= 416 ) - pCurrentNPCInfo->evt_F = 0; - } + pEventNumber = pCurrentNPCInfo->evt_F; + if ( pEventNumber >= 400 && pEventNumber <= 416) + pCurrentNPCInfo->evt_F = 0; break; } pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); @@ -9582,13 +9586,10 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - v11 = uActiveCharacter; + //v11 = uActiveCharacter; if ( uActiveCharacter ) { - v25 = 0; - v23 = SPEECH_86; -LABEL_50: - pPlayers[v11]->PlaySound((PlayerSpeech)v23, v25); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0); goto _return; } } @@ -9598,28 +9599,25 @@ } if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName ) { - v19 = pGlobalTXT_LocalizationStrings[533]; // ""I cannot join you, you're party is full"" -LABEL_77: - ShowStatusBarString(v19, 2u); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full"" goto _return; } - //v20 = v2->uProfession; if ( pCurrentNPCInfo->uProfession != 51 ) { - v21 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; - if ( pParty->uNumGold < v21 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].uHirePrice; + if ( pParty->uNumGold < pPrice ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); dialogue_show_profession_details = false; uDialogueType = 13; ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); - v19 = pGlobalTXT_LocalizationStrings[155]; - goto LABEL_77; - } - Party::TakeGold(v21); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); + goto _return; + } + Party::TakeGold(pPrice); } //LOBYTE(v2->uFlags) |= 0x80u; pCurrentNPCInfo->uFlags = 128; @@ -9651,13 +9649,8 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - v11 = uActiveCharacter; if ( uActiveCharacter ) - { - v25 = 0; - v23 = 61; - goto LABEL_50; - } + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0); _return: pVideoPlayer->_4BF5B2();//HouseVideo } @@ -10373,385 +10366,6 @@ 0); } -//----- (004B3703) -------------------------------------------------------- -int __thiscall sub_4B3703(void *_this) -{ - signed int v1; // edi@1 - int v2; // eax@1 - char *v3; // ecx@1 - signed int v4; // ebx@1 - int v5; // ecx@2 - int v6; // ecx@3 - int v7; // ecx@4 - int v8; // ecx@5 - int v9; // ecx@6 - signed int v10; // ebx@13 - signed int v11; // edi@14 - signed int v12; // esi@15 - unsigned int v13; // ecx@16 - int v14; // ecx@16 - int v15; // ecx@17 - int v16; // ecx@19 - int v17; // ecx@20 - int v18; // ecx@21 - signed int v19; // esi@32 - char *v20; // ecx@33 - int v21; // ecx@34 - int v22; // ecx@36 - int v23; // ecx@37 - int v24; // ecx@38 - int v25; // ecx@39 - int v26; // ecx@40 - int v27; // ecx@41 - int *v28; // esi@54 - unsigned int v29; // edx@56 - char *v30; // ecx@65 - int v31; // ecx@106 - int result; // eax@107 - int v33; // [sp-4h] [bp-2Ch]@23 - int v34; // [sp-4h] [bp-2Ch]@43 - int v35[5]; // [sp+Ch] [bp-1Ch]@8 - int a2; // [sp+20h] [bp-8h]@1 - int v37; // [sp+24h] [bp-4h]@1 - - v1 = 0; - v2 = 0; - v3 = (char *)_this - 1; - a2 = 0; - v37 = 0; - dword_F8B1DC = 0; - v4 = 2; - if ( !v3 ) - { - while ( 1 ) - { - v19 = 1; - do - { - v20 = (char *)window_SpeakInHouse->ptr_1C + 4 * (unsigned int)window_SpeakInHouse->ptr_1C + v19; - if ( v1 ) - v21 = word_4F063E[(signed int)v20]; - else - v21 = word_4F0404[(signed int)v20 - 4];//word_4F03FE[(signed int)v20]; - v22 = v21 - 23; - if ( v22 ) - { - v23 = v22 - 1; - if ( v23 ) - { - v24 = v23 - 1; - if ( v24 ) - { - v25 = v24 - 1; - if ( v25 ) - { - v26 = v25 - 1; - if ( v26 ) - { - v27 = v26 - 1; - if ( v27 ) - { - if ( v27 != v4 ) - goto LABEL_51; - v34 = 36; - } - else - { - v34 = 42; - } - } - else - { - v34 = 41; - } - } - else - { - v34 = 40; - } - } - else - { - v34 = 39; - } - } - else - { - v34 = 38; - } - } - else - { - v34 = 37; - } - v37 = sub_4BE571(v34, v35, v37, 5); - v2 = dword_F8B1DC; - v4 = 2; -LABEL_51: - ++v19; - } - while ( v19 <= 4 ); - ++v1; - if ( v1 >= v4 ) - goto LABEL_53; - } - } - v5 = (int)(v3 - 1); - if ( !v5 ) - { - v10 = 0; - while ( 1 ) - { - v11 = 0; - do - { - v12 = 1; - do - { - v13 = v11 + 2 * (unsigned int)window_SpeakInHouse->ptr_1C - 30; - v14 = v12 + 4 * v13 + v13; - if ( v10 ) - v15 = word_4F06D8[v14]; - else - v15 = word_4F0498[v14]; - v16 = v15 - 31; - if ( v16 ) - { - v17 = v16 - 1; - if ( v17 ) - { - v18 = v17 - 1; - if ( v18 ) - { - if ( v18 != 1 ) - goto LABEL_28; - v33 = 44; - } - else - { - v33 = 47; - } - } - else - { - v33 = 46; - } - } - else - { - v33 = 45; - } - v37 = sub_4BE571(v33, v35, v37, 5); - v2 = dword_F8B1DC; -LABEL_28: - ++v12; - } - while ( v12 <= 4 ); - ++v11; - } - while ( v11 < 2 ); - ++v10; - if ( v10 >= 2 ) - goto LABEL_53; - } - } - v6 = v5 - 1; - if ( v6 ) - { - v7 = v6 - 1; - if ( v7 ) - { - v8 = v7 - 17; - if ( v8 ) - { - v9 = v8 - 2; - if ( v9 ) - { - if ( v9 == 7 ) - { - v37 = 2; - v35[0] = 69; - v35[1] = 60; - } - } - else - { - v37 = 3; - v35[0] = 67; - v35[1] = 66; - v35[2] = 58; - } - } - else - { - v37 = 3; - v35[0] = 70; - v35[1] = 65; - v35[2] = 62; - } - } - else - { - v37 = 2; - v35[0] = 71; - v35[1] = 68; - } - } - else - { - v37 = 2; - v35[0] = 57; - v35[1] = 59; - } -LABEL_53: - if ( v37 > 0 ) - { - v28 = v35; - while ( 1 ) - { - v29 = *v28; - if ( *v28 <= 47 ) - break; - if ( (signed int)v29 <= 66 ) - { - if ( v29 == 66 ) - { - v30 = pSkillNames[30]; - goto LABEL_106; - } - if ( v29 == 57 ) - { - v30 = pSkillNames[21]; - goto LABEL_106; - } - if ( v29 == 58 ) - { - v30 = pSkillNames[22]; - goto LABEL_106; - } - if ( v29 == 60 ) - { - v30 = pSkillNames[24]; - goto LABEL_106; - } - if ( v29 == 62 ) - { - v30 = pSkillNames[26]; - goto LABEL_106; - } - if ( v29 == 65 ) - { - v30 = pSkillNames[29]; - goto LABEL_106; - } - goto LABEL_100; - } - switch ( v29 ) - { - case 0x43u: - v30 = pSkillNames[31]; - break; - case 0x44u: - v30 = pSkillNames[32]; - break; - case 0x45u: - v30 = pSkillNames[33]; - break; - case 0x46u: - v30 = pSkillNames[34]; - break; - default: - if ( v29 != 71 ) - goto LABEL_100; - v30 = pSkillNames[35]; - break; - } -LABEL_106: - pShopOptions[v2] = v30; - v31 = a2++; - dword_F8B1DC = v2 + 1; - sub_4B36CC(v31, v29); - ++v28; - if ( a2 >= v37 ) - goto LABEL_107; - v2 = dword_F8B1DC; - } - if ( *v28 == 47 ) - { - v30 = pSkillNames[11]; - goto LABEL_106; - } - if ( (signed int)v29 > 40 ) - { - if ( v29 == 41 ) - { - v30 = pSkillNames[5]; - goto LABEL_106; - } - if ( v29 == 42 ) - { - v30 = pSkillNames[6]; - goto LABEL_106; - } - if ( v29 == 44 ) - { - v30 = pSkillNames[8]; - goto LABEL_106; - } - if ( v29 == 45 ) - { - v30 = pSkillNames[9]; - goto LABEL_106; - } - if ( v29 == 46 ) - { - v30 = pSkillNames[10]; - goto LABEL_106; - } - } - else - { - if ( v29 == 40 ) - { - v30 = pSkillNames[4]; - goto LABEL_106; - } - if ( v29 == 5 ) - { - v30 = pSkillNames[23]; - goto LABEL_106; - } - if ( v29 == 36 ) - { - v30 = pSkillNames[0]; - goto LABEL_106; - } - if ( v29 == 37 ) - { - v30 = pSkillNames[1]; - goto LABEL_106; - } - if ( v29 == 38 ) - { - v30 = pSkillNames[2]; - goto LABEL_106; - } - if ( v29 == 39 ) - { - v30 = pSkillNames[3]; - goto LABEL_106; - } - } -LABEL_100: - v30 = pGlobalTXT_LocalizationStrings[127]; - goto LABEL_106; - } -LABEL_107: - pDialogueWindow->_41D08F(a2, 1, 0, 2); - result = pDialogueWindow->pNumPresenceButton; - dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; - return result; -} //----- (004B3A72) -------------------------------------------------------- @@ -11046,7 +10660,7 @@ //----- (004B3EF0) -------------------------------------------------------- void __fastcall DrawJoinGuildWindow(int pEventNumber) { - uDialogueType = 81; + uDialogueType = 81;//enum JoinGuildDialog ptr_F8B1E8 = (char *)pNPCTopics[pEventNumber + 99].pText; ContractSelectText(pEventNumber); pDialogueWindow->Release(); @@ -12169,7 +11783,7 @@ do { // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID); { v50 = dword_F8B168[v49]; v51 = 152 - v50->uTextureHeight; @@ -12202,7 +11816,7 @@ do { //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) - if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID); { v54 = dword_F8B168[v122 + 6]; v55 = 306 - v54->uTextureHeight; @@ -12233,7 +11847,7 @@ do { // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) { v58 = dword_F8B168[v49]; v59 = 152 - v58->uTextureHeight; @@ -12266,7 +11880,7 @@ do { //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes) { v62 = dword_F8B168[v122 + 6]; v63 = 306 - v62->uTextureHeight; @@ -12303,7 +11917,7 @@ { do { - if ( pParty->field_777C[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) ++v117; ++v66; } @@ -12314,7 +11928,7 @@ do { //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) + if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) ++v117; ++v66; } @@ -12348,10 +11962,10 @@ v117 = v71; v72 = (int)window_SpeakInHouse->ptr_1C; // v73 = 9 * (v71 + 12 * v72); - v74 = (ItemGen *)&pParty->field_777C[v72][v71]; + v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71]; if ( dword_F8B19C != 2 ) // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724]; - v74 =&pParty->Recipes_Item[v72][v71]; + v74 =&pParty->SpecialItemsInShop[v72][v71]; if ( v67 && Str ) { v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" @@ -12614,10 +12228,10 @@ sub_4BBCDD(); break; default: - _5C3420_pDecoration = (LevelDecoration *)1; + GlobalEventInfo = 1; ptr_F8B1E8 = 0; EventProcessor(v4, 0, 1); - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; break; } } @@ -13447,92 +13061,6 @@ -//----- (004B8F94) -------------------------------------------------------- -void sub_4B8F94() -{ - GUIWindow *v0; // edi@1 - signed int v1; // ebp@1 - int v2; // ebx@1 - signed int v3; // esi@1 - int v4; // eax@3 - int v5; // ebx@3 - int v6; // ecx@3 - bool v7; // eax@5 - bool v8; // ST1C_4@5 - int v9; // eax@5 - int v10; // eax@10 - void *result; // eax@15 - signed int v12; // [sp-4h] [bp-18h]@7 - - v0 = window_SpeakInHouse; - v1 = 0; - v2 = (int)&window_SpeakInHouse->ptr_1C; - v3 = (signed int)window_SpeakInHouse->ptr_1C; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] ) - if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) - { - while ( v3 > 14 ) - { - if ( v3 <= 28 ) - { - v7 = v1 > 3; - v8 = v7; - v9 = 5 * (v7 + 2 * v3 - 30); - v3 = (signed int)v0->ptr_1C; - v5 = word_4F06D8[v9]; - v6 = word_4F05AE[5 * (v8 + 2 * v3) + rand() % 4]; - goto LABEL_13; - } - if ( v3 <= 41 ) - { - v5 = word_4F07B6[v3]; - v12 = 22; - goto LABEL_12; - } - if ( v3 <= 53 ) - { - if ( v1 >= 6 ) - { - v5 = word_4F07B6[v3 + 1]; - v12 = 44; -LABEL_12: - v6 = v12; -LABEL_13: - pItemsTable->GenerateItem(v5, v6,&pParty->Recipes_Item[v3][v1]);//(ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]); - v0 = window_SpeakInHouse; - v2 = (int)&window_SpeakInHouse->ptr_1C; - // pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1; - pParty->Recipes_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes= 1; - goto LABEL_14; - } - // auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]; - auto _a =&pParty->Recipes_Item[v3][v1]; - _a->Reset(); - // v2 = (int)&v0->ptr_1C; - //v10 = rand(); - // v0 = window_SpeakInHouse; - // pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740; - pParty->Recipes_Item[(int)v0->ptr_1C][v1].uItemID= rand() % 32 + 740; - } -LABEL_14: - v3 = *(int *)v2; - ++v1; - //if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * *(int *)v2]] ) - if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[*(int *)v2 - 1].uType] ) - goto LABEL_15; - } - v4 = 5 * v3; - v3 = (signed int)v0->ptr_1C; - v5 = word_4F063E[v4]; - v6 = word_4F063E[5 * v3 + rand() % 4 + 1]; - goto LABEL_13; - } -LABEL_15: - result = v0->ptr_1C; - pParty->field_16154[(int)v0->ptr_1C] = 0; -} - - //----- (004B6478) -------------------------------------------------------- int __cdecl sub_4B6478() {
--- a/mm7_5.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/mm7_5.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -393,11 +393,11 @@ case UIMSG_51: sub_4BDB56_buy_skill____(); continue; - case UIMSG_AF://Click topic - ClickNPCTopic(uMessageParam);//CheckNPCTopic - continue; - case UIMSG_195: - sub_4BCACC_bounties(uMessageParam); + case UIMSG_ClickNPCTopic: + ClickNPCTopic(uMessageParam); + continue; + case UIMSG_ClickLearnSkillDialog: + DrawLearnSkillDialog(uMessageParam); continue; case UIMSG_SelectDialogueOption: OnSelectDialogueOption((DIALOGUE_TYPE)uMessageParam);
--- a/mm7_6.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/mm7_6.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -6506,9 +6506,9 @@ } if ( v447->IsInteractive() ) { - _5C3420_pDecoration = v447; + GlobalEventInfo = (int)v447; EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); - _5C3420_pDecoration = (LevelDecoration *)v1; + GlobalEventInfo = v1; } } }
--- a/mm7_data.cpp Mon Feb 25 18:52:30 2013 +0600 +++ b/mm7_data.cpp Mon Feb 25 18:52:45 2013 +0600 @@ -1620,7 +1620,7 @@ }; //__int16 word_4F03FE[777]; // weak //__int16 word_4F0400[777]; // weak -__int16 word_4F0404[] = +/*__int16 word_4F0404[] = { 0, 0, 1, 0x17, 0x1B, 0x14, 0x14, 1, 0x17, 0x18, 0x1C, 0x14, 2, 0x17, 0x18, 0x19, 0x14, 2, 0x1B, 0x1B, 0x1A, 0x1A, @@ -1629,9 +1629,9 @@ 3, 0x1C, 0x1C, 0x19, 0x19, 2, 0x17, 0x17, 0x18, 0x18, 3, 0x17, 0x17, 0x1A, 0x1A, 2, 0x1E, 0x1A, 0x1A, 0x1A, 2, 0x1C, 0x19, 0x1C, 0x1D, 0, 0 -}; +};*/ //__int16 word_4F0498[777]; // weak -__int16 word_4F0498[] = +/*__int16 word_4F0498[] = { 1, 0x23, 0x23, 0x26, 0x26, 1, 0x1F, 0x1F, 0x1F, 0x22, 1, 0x23, 0x23, 0x26, 0x26, 1, 0x1F, 0x1F, 0x20, 0x22, 2, 0x23, 0x23, @@ -1643,9 +1643,9 @@ 0x22, 0x22, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x1F, 0x1F, 0x20, 0x20, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x20, 0x20, 0x20, 0x21, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x1F, 0x1F, 0x1F, 0x20 -}; +};*/ //__int16 word_4F0576[777]; // weak -__int16 word_4F0576[] = +/*__int16 word_4F0576[] = { 0x23, 0x23, 0x26, 0x26, 3, 0x21, 0x1F, 0x20, 0x22, 3, 0x23, 0x23, 0x26, 0x26, 3, 0x21, 0x1F, 0x20, 0x22, 4, 0x23, 0x23, 0x26, 0x26, @@ -1656,18 +1656,16 @@ 0xA2, 0xA1, 0xA0, 2, 0, 0x0A3, 0x0A3, 0xA2, 0xA1, 0xA0, 3, 0, 0xA3, 0xA3, 0xA2, 0xA1, 0xA0, 3, 0, 0xA3, 0xA3, 0xA2, 0xA1, 0xA0 -}; +};*/ -__int16 word_4F0578[777]; // weak -__int16 word_4F05AE[777]; // weak -char _4F063C_smthn_by_2da_uType[31]={ // weak -0, 6, 8, 12, 12, 0, 0, 0, 0, 0, 0, 0, 2, 0, 25, 0, 30, -0, 20, 0, 20, 0, 2, 0, 23, 0, 24, 0, 28, 0, 20}; -__int16 word_4F063E[290]; -__int16 word_4F06D8[22]; +//__int16 word_4F0578[777]; // weak +//__int16 word_4F05AE[777]; // weak + +//__int16 word_4F063E[290]; +//__int16 word_4F06D8[22]; __int16 word_4F0704[40]; __int16 word_4F0754[49]; -__int16 word_4F07B6[88]; +//__int16 word_4F07B6[88]; __int16 word_4F0866[14]; __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54]= { @@ -2010,7 +2008,7 @@ _UNKNOWN unk_597F10; // weak int start_event_seq_number; // weak char byte_5B0938[2000]; -int dword_5B5920; // weak +int EvtTargetObj; // 0x5B5920 int _unused_5B5924_is_travel_ui_drawn = false; // 005B5924 int _5B65A8_npcdata_uflags_or_other; // weak int _5B65AC_npcdata_fame_or_other; // weak
--- a/mm7_data.h Mon Feb 25 18:52:30 2013 +0600 +++ b/mm7_data.h Mon Feb 25 18:52:45 2013 +0600 @@ -1000,17 +1000,17 @@ extern const char *off_4F03B8[]; // idb //extern __int16 word_4F03FE[]; // weak //extern __int16 word_4F0400[]; // weak -extern __int16 word_4F0404[]; -extern __int16 word_4F0498[]; // weak +//extern __int16 word_4F0404[]; +//extern __int16 word_4F0498[]; // weak extern __int16 word_4F0576[]; // weak -extern __int16 word_4F0578[]; // weak -extern __int16 word_4F05AE[]; // weak -extern char _4F063C_smthn_by_2da_uType[]; // weak -extern __int16 word_4F063E[290]; -extern __int16 word_4F06D8[22]; + +//extern __int16 word_4F05AE[]; // weak +extern char uItemsAmountPerShopType[]; // weak +//extern __int16 word_4F063E[290]; +//extern __int16 word_4F06D8[22]; extern __int16 word_4F0704[40]; extern __int16 word_4F0754[49]; -extern __int16 word_4F07B6[88]; +//extern __int16 word_4F07B6[88]; extern __int16 word_4F0866[14]; extern __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54]; extern int dword_4F08EC[]; // weak @@ -1343,7 +1343,7 @@ extern _UNKNOWN unk_597F10; // weak extern int start_event_seq_number; // weak extern char byte_5B0938[2000]; -extern int dword_5B5920; // weak +extern int EvtTargetObj; // weak extern int _unused_5B5924_is_travel_ui_drawn; // 005B5924 extern int _5B65A8_npcdata_uflags_or_other; // weak extern int _5B65AC_npcdata_fame_or_other; // weak @@ -2308,7 +2308,7 @@ const char *__fastcall ContractSelectText(int pEventNumber); char __cdecl SimpleHouseAndBoatsDialog(); struct GUIButton *__fastcall sub_4B36CC(int a1, unsigned int a2); -int __thiscall sub_4B3703(void *_this); +int sub_4B3703(int _this); int __thiscall sub_4B3A72(int a1); // idb int __fastcall sub_4B3AD4(signed int a1); int __fastcall sub_4B3B42(signed int a1); @@ -2330,8 +2330,7 @@ void __cdecl sub_4B7911(); void __cdecl _4B7D7E_bank(); void __cdecl TavernDialog(); -void *__cdecl GenerateShopItems(); -void sub_4B8F94(); + char *__cdecl WeaponShopDialog(); POINT *__cdecl AlchemistDialog(); void __cdecl ArmorShopDialog(); @@ -2342,7 +2341,7 @@ void __cdecl ArenaFight(); struct Texture *__cdecl sub_4BC8D5(); struct GUIButton *__cdecl UI_CreateEndConversationButton(); -void __fastcall sub_4BCACC_bounties(signed int a1); +void __fastcall DrawLearnSkillDialog(signed int uMessageParam); signed int __cdecl sub_4BD8B5(); bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx); void __cdecl sub_4BDB56_buy_skill____();