Mercurial > mm7
changeset 1411:2423bc2af692
+InitializaDialogueOptions
+InitializaDialogueOptions_Shops
+InitializaDialogueOptions_Tavern
author | Nomad |
---|---|
date | Fri, 26 Jul 2013 23:35:34 +0200 |
parents | 38df78aba732 |
children | 182d58b2a34c b67a3e0d6fc3 |
files | Events2D.h GUIWindow.cpp GUIWindow.h NPC.cpp Player.cpp UI/UIGuilds.cpp UI/UIHouses.cpp UI/UIHouses.h UI/UIShops.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_data.h stru159.h |
diffstat | 14 files changed, 623 insertions(+), 431 deletions(-) [+] |
line wrap: on
line diff
--- a/Events2D.h Fri Jul 26 22:19:29 2013 +0200 +++ b/Events2D.h Fri Jul 26 23:35:34 2013 +0200 @@ -1,46 +1,46 @@ #pragma once /* 296 */ -enum BildingType: unsigned short +enum BuildingType: unsigned short { - BildingType_WeaponShop = 1, - BildingType_ArmorShop = 2, - BildingType_MagicShop = 3, - BildingType_AlchemistShop = 4, - BildingType_FireGuild = 5, - BildingType_AirGuild = 6, - BildingType_WaterGuild = 7, - BildingType_EarthGuild = 8, - BildingType_SpiritGuild = 9, - BildingType_MindGuild = 10, - BildingType_BodyGuild = 11, - BildingType_LightGuild = 12, - BildingType_DarkGuild = 13, - BildingType_14 = 14, - BildingType_15 = 15, - BildingType_16 = 16, - BildingType_TownHall = 17, - BildingType_18 = 18, - BildingType_19 = 19, - BildingType_Throne_Room = 20, - BildingType_Tavern = 21, - BildingType_Bank = 22, - BildingType_Temple = 23, + BuildingType_WeaponShop = 1, + BuildingType_ArmorShop = 2, + BuildingType_MagicShop = 3, + BuildingType_AlchemistShop = 4, + BuildingType_FireGuild = 5, + BuildingType_AirGuild = 6, + BuildingType_WaterGuild = 7, + BuildingType_EarthGuild = 8, + BuildingType_SpiritGuild = 9, + BuildingType_MindGuild = 10, + BuildingType_BodyGuild = 11, + BuildingType_LightGuild = 12, + BuildingType_DarkGuild = 13, + BuildingType_14 = 14, + BuildingType_15 = 15, + BuildingType_16 = 16, + BuildingType_TownHall = 17, + BuildingType_18 = 18, + BuildingType_19 = 19, + BuildingType_Throne_Room = 20, + BuildingType_Tavern = 21, + BuildingType_Bank = 22, + BuildingType_Temple = 23, BuildingType_24 = 24, - BildingType_Unic = 25, - BildingType_1A = 26, - BildingType_Stables = 27, - BildingType_Boats = 28, - BildingType_House = 29, - BildingType_Training = 30, - BildingType_Jail = 31 + BuildingType_Unic = 25, + BuildingType_1A = 26, + BuildingType_Stables = 27, + BuildingType_Boats = 28, + BuildingType_House = 29, + BuildingType_Training = 30, + BuildingType_Jail = 31 }; /* 168 */ #pragma pack(push, 1) struct _2devent { - BildingType uType; + BuildingType uType; unsigned __int16 uAnimationID; char *pName; const char *pProprieterName;
--- a/GUIWindow.cpp Fri Jul 26 22:19:29 2013 +0200 +++ b/GUIWindow.cpp Fri Jul 26 23:35:34 2013 +0200 @@ -249,11 +249,11 @@ //----- (0041D08F) -------------------------------------------------------- -void GUIWindow::_41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5) +void GUIWindow::_41D08F_set_keyboard_control_group(int num_buttons, int a3, int a4, int a5) { - if ( a2 ) + if (num_buttons) { - this->pNumPresenceButton = a2; + this->pNumPresenceButton = num_buttons; this->field_30 = a3; this->field_34 = a4; this->pCurrentPosActiveItem = a5; @@ -950,7 +950,7 @@ pWindow.uFrameZ += 8; if ( !pDialogueNPCCount ) { - if ( in_current_building_type == BildingType_Jail ) + if ( in_current_building_type == BuildingType_Jail ) { JailDialog(); if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) @@ -1057,56 +1057,56 @@ pWindow.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, pColor2, pTmpBuf.data(), 3); switch ( in_current_building_type ) { - case BildingType_WeaponShop: + case BuildingType_WeaponShop: WeaponShopDialog(); break; - case BildingType_ArmorShop: + case BuildingType_ArmorShop: ArmorShopDialog(); break; - case BildingType_MagicShop: + case BuildingType_MagicShop: MagicShopDialog(); break; - case BildingType_AlchemistShop: + case BuildingType_AlchemistShop: AlchemistDialog(); break; - case BildingType_FireGuild: - case BildingType_AirGuild: - case BildingType_WaterGuild: - case BildingType_EarthGuild: - case BildingType_SpiritGuild: - case BildingType_MindGuild: - case BildingType_BodyGuild: - case BildingType_LightGuild: - case BildingType_DarkGuild: + case BuildingType_FireGuild: + case BuildingType_AirGuild: + case BuildingType_WaterGuild: + case BuildingType_EarthGuild: + case BuildingType_SpiritGuild: + case BuildingType_MindGuild: + case BuildingType_BodyGuild: + case BuildingType_LightGuild: + case BuildingType_DarkGuild: GuildDialog(); break; - case BildingType_18: + case BuildingType_18: __debugbreak(); //What over the dialog? sub_4B6478(); break; - case BildingType_TownHall: + case BuildingType_TownHall: TownHallDialog(); break; - case BildingType_Tavern: + case BuildingType_Tavern: TavernDialog(); break; - case BildingType_Bank: + case BuildingType_Bank: BankDialog(); break; - case BildingType_Temple: + case BuildingType_Temple: TempleDialog(); break; - case BildingType_Stables: + case BuildingType_Stables: TravelByTransport(); break; - case BildingType_Training: + case BuildingType_Training: TrainingDialog(); break; - case BildingType_Jail: + case BuildingType_Jail: JailDialog(); break; default: - __debugbreak();//New BildingType + __debugbreak();//New BuildingType break; } }
--- a/GUIWindow.h Fri Jul 26 22:19:29 2013 +0200 +++ b/GUIWindow.h Fri Jul 26 23:35:34 2013 +0200 @@ -337,7 +337,7 @@ void DrawMessageBox(int arg0); GUIButton *GetControl(unsigned int uID); void Release(); - void _41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5); + void _41D08F_set_keyboard_control_group(int num_buttons, int a3, int a4, int a5); void _41D73D_draw_buff_tooltip(); static GUIWindow *Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eWindowType, int pButton, const char* hint);
--- a/NPC.cpp Fri Jul 26 22:19:29 2013 +0200 +++ b/NPC.cpp Fri Jul 26 23:35:34 2013 +0200 @@ -1657,7 +1657,7 @@ pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); if ( pDialogueNPCCount == 1 && dword_591080 ) { - sub_4B3B42(in_current_building_type); + InitializaDialogueOptions(in_current_building_type); } else {
--- a/Player.cpp Fri Jul 26 22:19:29 2013 +0200 +++ b/Player.cpp Fri Jul 26 23:35:34 2013 +0200 @@ -1066,25 +1066,25 @@ switch (building_type) { - case BildingType_WeaponShop: + case BuildingType_WeaponShop: if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) return 5; if (equipType > EQUIP_BOW) return 4; break; - case BildingType_ArmorShop: + case BuildingType_ArmorShop: if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) return 5; if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS) return 4; break; - case BildingType_MagicShop: + case BuildingType_MagicShop: if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) return 5; if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC ) return 4; break; - case BildingType_AlchemistShop: + case BuildingType_AlchemistShop: if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE) return 5; if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL))
--- a/UI/UIGuilds.cpp Fri Jul 26 22:19:29 2013 +0200 +++ b/UI/UIGuilds.cpp Fri Jul 26 23:35:34 2013 +0200 @@ -182,7 +182,7 @@ v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); v16 = (int)window_SpeakInHouse->ptr_1C; uPlayerID = uActiveCharacter - 1; - v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, BildingType_MagicShop, v16, 2); + v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, BuildingType_MagicShop, v16, 2); v18 = BuildDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorWhite, v18, 3);
--- a/UI/UIHouses.cpp Fri Jul 26 22:19:29 2013 +0200 +++ b/UI/UIHouses.cpp Fri Jul 26 23:35:34 2013 +0200 @@ -13,7 +13,6 @@ #include "..\Mouse.h" #include "..\GUIWindow.h" #include "..\GUIFont.h" -#include "..\Events2D.h" #include "..\Overlays.h" #include "..\Outdoor.h" #include "..\AudioPlayer.h" @@ -31,7 +30,7 @@ int dword_591080; // weak -int in_current_building_type; // 00F8B198 +BuildingType in_current_building_type; // 00F8B198 HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C #pragma pack(push, 1) @@ -315,6 +314,438 @@ }}; + +//----- (004B3A72) -------------------------------------------------------- +void InitializaDialogueOptions_Tavern(BuildingType type) +{ + int num_buttons; // esi@1 + + num_buttons = 0; + if (type == BuildingType_Tavern) + { + num_buttons = 2; + CreateButtonInColumn(0, 102); + CreateButtonInColumn(1, 103); + if ( pParty->HasItem(651) ) //Arcomage Deck + { + num_buttons = 3; + CreateButtonInColumn(2, 104); + } + } + pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); + dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; +} +// F8B1E0: using guessed type int dword_F8B1E0; + +//----- (004B3AD4) -------------------------------------------------------- +void InitializaDialogueOptions_Shops(BuildingType type) +{ + switch (type) + { + case BuildingType_WeaponShop: + case BuildingType_ArmorShop: + case BuildingType_MagicShop: + { + CreateButtonInColumn(0, 3); + CreateButtonInColumn(1, 4); + CreateButtonInColumn(2, 5); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_AlchemistShop: + { + CreateButtonInColumn(0, 3); + CreateButtonInColumn(1, 4); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); + } + break; + } + + dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; +} +// F8B1E0: using guessed type int dword_F8B1E0; + +//----- (004B3B42) -------------------------------------------------------- +void InitializaDialogueOptions(BuildingType type) +{ + /*int v1; // ecx@18 + int v2; // ecx@19 + int v3; // ecx@20 + signed int v4; // esi@22 + signed int v5; // eax@22 + unsigned int v6; // edx@24 + int v7; // ecx@24 + int result; // eax@43 + int v9; // [sp-10h] [bp-14h]@28 + int v10; // [sp-Ch] [bp-10h]@28 + int v11; // [sp-8h] [bp-Ch]@28 + unsigned int v12; // [sp-4h] [bp-8h]@4 + unsigned int v13; // [sp-4h] [bp-8h]@5 + unsigned int v14; // [sp-4h] [bp-8h]@9 + unsigned int v15; // [sp-4h] [bp-8h]@10 + unsigned int v16; // [sp-4h] [bp-8h]@14 + int v17; // [sp-4h] [bp-8h]@28*/ + + switch (type) + { + case BuildingType_WeaponShop: + case BuildingType_ArmorShop: + case BuildingType_MagicShop: + case BuildingType_AlchemistShop: + { + CreateButtonInColumn(0, 2); + CreateButtonInColumn(1, 95); + CreateButtonInColumn(2, 94); + CreateButtonInColumn(3, 96); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); + } + break; + + case BuildingType_FireGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 48); + CreateButtonInColumn(2, 72); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_AirGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 49); + CreateButtonInColumn(2, 72); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_WaterGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 50); + CreateButtonInColumn(2, 72); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_EarthGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 51); + CreateButtonInColumn(2, 72); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_SpiritGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 52); + CreateButtonInColumn(2, 61); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_MindGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 53); + CreateButtonInColumn(2, 61); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_BodyGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 54); + CreateButtonInColumn(2, 61); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_LightGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 55); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); + } + break; + + case BuildingType_DarkGuild: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 56); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); + } + break; + + case BuildingType_14: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 48); + CreateButtonInColumn(2, 49); + CreateButtonInColumn(3, 50); + CreateButtonInColumn(4, 51); + pDialogueWindow->_41D08F_set_keyboard_control_group(5, 1, 0, 2); + } + break; + + case BuildingType_15: + { + CreateButtonInColumn(0, 18); + CreateButtonInColumn(1, 52); + CreateButtonInColumn(2, 53); + CreateButtonInColumn(3, 54); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); + } + break; + + case BuildingType_16: + case BuildingType_TownHall: + { + int num_buttons = 1; + CreateButtonInColumn(0, 99); + + if (pParty->uFine) + { + num_buttons++; + CreateButtonInColumn(1, 100); + } + + pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); + } + break; + + case BuildingType_Bank: + { + CreateButtonInColumn(0, 7); + CreateButtonInColumn(1, 8); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); + } + break; + + case BuildingType_Temple: + { + CreateButtonInColumn(0, 10); + CreateButtonInColumn(1, 11); + CreateButtonInColumn(2, 96); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + } + break; + + case BuildingType_Stables: + case BuildingType_Boats: + { + CreateButtonInColumn(0, 105); + CreateButtonInColumn(1, 106); + CreateButtonInColumn(2, 107); + CreateButtonInColumn(3, 108); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); + } + break; + + case BuildingType_Training: + { + CreateButtonInColumn(0, 17); + CreateButtonInColumn(1, 96); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); + } + break; + + case BuildingType_18: + case BuildingType_19: + case BuildingType_Throne_Room: + case BuildingType_24: + case BuildingType_Unic: + case BuildingType_1A: + case BuildingType_House: + case BuildingType_Jail: + break; + + default: + assert(false && "Invalid enumeration value"); + } + +/* if ( a1 > 13 ) + { + if ( a1 > 22 ) + { + if ( a1 == 23 ) + { + CreateButtonInColumn(0, 0xAu); + CreateButtonInColumn(1, 0xBu); + v14 = 96; +LABEL_41: + CreateButtonInColumn(2, v14); + v17 = 2; + v11 = 0; + v10 = 1; + v9 = 3; + goto LABEL_42; + } + if ( a1 <= 26 ) + goto LABEL_43; + if ( a1 > 28 ) + { + if ( a1 != 30 ) + goto LABEL_43; + CreateButtonInColumn(0, 0x11u); + v16 = 96; + goto LABEL_37; + } + CreateButtonInColumn(0, 0x69u); + CreateButtonInColumn(1, 0x6Au); + CreateButtonInColumn(2, 0x6Bu); + v12 = 108; + } + else + { + if ( a1 == 22 ) + { + CreateButtonInColumn(0, 7u); + v16 = 8; + goto LABEL_37; + } + v1 = a1 - 14; + if ( !v1 ) // == 14 + { + CreateButtonInColumn(0, 0x12u); + CreateButtonInColumn(1, 0x30u); + CreateButtonInColumn(2, 0x31u); + CreateButtonInColumn(3, 0x32u); + CreateButtonInColumn(4, 0x33u); + v17 = 2; + v11 = 0; + v10 = 1; + v9 = 5; + goto LABEL_42; + } + v2 = v1 - 1; + if ( v2 ) // > 15 + { + v3 = v2 - 2; + if ( v3 ) // > 17 + { + if ( v3 != 4 ) // 18, 19, 20 + goto LABEL_43; + CreateButtonInColumn(0, 0xFu); // 21 + CreateButtonInColumn(1, 0x10u); + v4 = 3; + CreateButtonInColumn(2, 0x60u); + v5 = (signed int)window_SpeakInHouse->ptr_1C; + if ( v5 < 108 || v5 > 120 ) + goto LABEL_28; + v4 = 4; + v6 = 101; + v7 = 3; + } + else // 16, 17 + { + v4 = 1; + CreateButtonInColumn(0, 0x63u); + if ( !pParty->uFine ) + { +LABEL_28: + v17 = 2; + v11 = 0; + v10 = 1; + v9 = v4; +LABEL_42: + pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); + goto LABEL_43; + } + v4 = 2; + v7 = 1; + v6 = 100; + } + CreateButtonInColumn(v7, v6); + goto LABEL_28; + } + CreateButtonInColumn(0, 0x12u); // 15 + CreateButtonInColumn(1, 0x34u); + CreateButtonInColumn(2, 0x35u); + v12 = 54; + } +LABEL_39: + CreateButtonInColumn(3, v12); + v17 = 2; + v11 = 0; + v10 = 1; + v9 = 4; + goto LABEL_42; + } + if ( a1 == 13 ) + { + CreateButtonInColumn(0, 0x12u); + v16 = 56; +LABEL_37: + CreateButtonInColumn(1, v16); + v17 = 2; + v11 = 0; + v10 = 1; + v9 = 2; + goto LABEL_42; + } + switch ( a1 ) + { + case 1: + case 2: + case 3: + case 4: + CreateButtonInColumn(0, 2u); + CreateButtonInColumn(1, 0x5Fu); + CreateButtonInColumn(2, 0x5Eu); + v12 = 96; + goto LABEL_39; + case 5: + CreateButtonInColumn(0, 0x12u); + v13 = 48; + goto LABEL_9; + case 6: + CreateButtonInColumn(0, 0x12u); + v13 = 49; + goto LABEL_9; + case 7: + CreateButtonInColumn(0, 0x12u); + v13 = 50; + goto LABEL_9; + case 8: + CreateButtonInColumn(0, 0x12u); + v13 = 51; +LABEL_9: + CreateButtonInColumn(1, v13); + v14 = 72; + goto LABEL_41; + case 9: + CreateButtonInColumn(0, 0x12u); + v15 = 52; + goto LABEL_13; + case 10: + CreateButtonInColumn(0, 0x12u); + v15 = 53; + goto LABEL_13; + case 11: + CreateButtonInColumn(0, 0x12u); + v15 = 54; +LABEL_13: + CreateButtonInColumn(1, v15); + v14 = 61; + goto LABEL_41; + case 12: + CreateButtonInColumn(0, 0x12u); + v16 = 55; + goto LABEL_37; + default: + break; + } +LABEL_43:*/ + dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; +} +// F8B1E0: using guessed type int dword_F8B1E0; + + //----- (004B1784) -------------------------------------------------------- bool __cdecl HouseUI_CheckIfPlayerCanInteract() { @@ -441,13 +872,13 @@ pAudioPlayer->StopChannels(-1, -1); uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; - in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; - if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine ) // going 2 jail + in_current_building_type = (BuildingType)pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; + if ( in_current_building_type == BuildingType_Throne_Room && pParty->uFine ) // going 2 jail { uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; uHouseID = HOUSE_JAIL; pParty->uTimePlayed = pParty->uTimePlayed + 0x7620000; - in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType; + in_current_building_type = (BuildingType)pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType; ++pParty->uNumPrisonTerms; pParty->uFine = 0; for (uint i = 0; i < 4; ++i) @@ -664,7 +1095,7 @@ //else if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) { - if ( in_current_building_type == BildingType_Training ) + if ( in_current_building_type == BuildingType_Training ) { if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) { @@ -692,12 +1123,12 @@ v8 = window_SpeakInHouse; } //else - if ( in_current_building_type != BildingType_Training ) + if ( in_current_building_type != BuildingType_Training ) { v8 = window_SpeakInHouse; - if ((in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) && + if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] - || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild ) + || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) { //LABEL_9: pDialogueWindow->Release(); @@ -718,9 +1149,9 @@ } //LABEL_11: dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - if ( in_current_building_type < BildingType_19 ) + if ( in_current_building_type < BuildingType_19 ) { - v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); + v9 = pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE); //v3 = dword_F8B198; ShopTexture = &pIcons_LOD->pTextures[v9]; //LABEL_13: @@ -729,20 +1160,20 @@ } //NEW - switch(in_current_building_type) + switch (in_current_building_type) { - case BildingType_FireGuild: - case BildingType_AirGuild: - case BildingType_WaterGuild: - case BildingType_EarthGuild: - case BildingType_SpiritGuild: - case BildingType_MindGuild: - case BildingType_BodyGuild: - case BildingType_LightGuild: - case BildingType_DarkGuild: - case BildingType_14: - case BildingType_15: - case BildingType_16: + case BuildingType_FireGuild: + case BuildingType_AirGuild: + case BuildingType_WaterGuild: + case BuildingType_EarthGuild: + case BuildingType_SpiritGuild: + case BuildingType_MindGuild: + case BuildingType_BodyGuild: + case BuildingType_LightGuild: + case BuildingType_DarkGuild: + case BuildingType_14: + case BuildingType_15: + case BuildingType_16: { if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed && *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed ) @@ -775,7 +1206,7 @@ //return; break; } - case BildingType_TownHall: + case BuildingType_TownHall: { if ( uMessageParam == 99 ) { @@ -981,20 +1412,20 @@ } break; } - case BildingType_Bank: + case BuildingType_Bank: { if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) pKeyActionMap->EnterText(1, 10, v8); return; break; } - case BildingType_WeaponShop: - case BildingType_ArmorShop: - case BildingType_MagicShop: - case BildingType_AlchemistShop: - case BildingType_Tavern: - case BildingType_Temple: - case BildingType_Training: + case BuildingType_WeaponShop: + case BuildingType_ArmorShop: + case BuildingType_MagicShop: + case BuildingType_AlchemistShop: + case BuildingType_Tavern: + case BuildingType_Temple: + case BuildingType_Training: { break; } @@ -1006,25 +1437,25 @@ } /* - if ( in_current_building_type > BildingType_Tavern ) + if ( in_current_building_type > BuildingType_Tavern ) { - if ( in_current_building_type == BildingType_Bank ) + if ( in_current_building_type == BuildingType_Bank ) { if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) pKeyActionMap->EnterText(1, 10, v8); return; } - if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training ) + if ( in_current_building_type != BuildingType_Temple && in_current_building_type != BuildingType_Training ) return; } //else - if ( in_current_building_type < BildingType_Tavern ) + if ( in_current_building_type < BuildingType_Tavern ) { if (in_current_building_type <= 0) return; - if ( in_current_building_type > BildingType_AlchemistShop ) + if ( in_current_building_type > BuildingType_AlchemistShop ) { - if ( in_current_building_type <= BildingType_16 ) + if ( in_current_building_type <= BuildingType_16 ) { if ( (signed __int64)__PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], @@ -1059,9 +1490,9 @@ } return; } - if ( in_current_building_type != BildingType_TownHall ) + if ( in_current_building_type != BuildingType_TownHall ) return; - if ( in_current_building_type == BildingType_TownHall ) + if ( in_current_building_type == BuildingType_TownHall ) { if ( uMessageParam == 99 ) { @@ -1284,7 +1715,7 @@ { pDialogueWindow->eWindowType = WINDOW_MainMenu; UI_CreateEndConversationButton(); - sub_4B3A72(in_current_building_type); + InitializaDialogueOptions_Tavern(in_current_building_type); break; } case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: @@ -1328,7 +1759,7 @@ } } } - if ( in_current_building_type == BildingType_WeaponShop ) + if ( in_current_building_type == BuildingType_WeaponShop ) { v48 = 0; if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) @@ -1356,7 +1787,7 @@ } } } - if ( in_current_building_type == BildingType_WeaponShop ) + if ( in_current_building_type == BuildingType_WeaponShop ) { v53 = 0; if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) @@ -1385,7 +1816,7 @@ { pDialogueWindow->eWindowType = WINDOW_MainMenu; UI_CreateEndConversationButton(); - sub_4B3AD4(in_current_building_type); + InitializaDialogueOptions_Shops(in_current_building_type); break; } default: @@ -1408,7 +1839,7 @@ if ( pParty->uNumGold < v37 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); - if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) + if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) v39 = 4; else v39 = 2; @@ -1471,7 +1902,7 @@ if ( pParty->uNumGold < v37 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) + if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) v39 = 4; else v39 = 2; @@ -1493,7 +1924,7 @@ { pDialogueWindow->eWindowType = WINDOW_MainMenu; UI_CreateEndConversationButton(); - sub_4B3AD4(in_current_building_type); + InitializaDialogueOptions_Shops(in_current_building_type); } } } @@ -1543,7 +1974,7 @@ //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); } - if ( in_current_building_type == BildingType_WeaponShop ) + if ( in_current_building_type == BuildingType_WeaponShop ) { v47 = v8->ptr_1C; v48 = 0; @@ -1588,7 +2019,7 @@ //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); } - if ( in_current_building_type == BildingType_WeaponShop ) + if ( in_current_building_type == BuildingType_WeaponShop ) { v52 = v8->ptr_1C; v53 = 0; @@ -1697,10 +2128,10 @@ auto color_selected = TargetColor(255, 255, 155); v3 = 52 * (unsigned int)v0->ptr_1C; //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); - //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BildingType_Stables) - 1) & 0xFFFFFFE7) + 50); + //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BuildingType_Stables) - 1) & 0xFFFFFFE7) + 50); //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]); - v4 = p2DEvents[(unsigned int)v0->ptr_1C - 1].uType == BildingType_Stables ? 25 : 50; + v4 = p2DEvents[(unsigned int)v0->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50; v4 *= p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier; s1 = v4 * (100 - v1->GetMerchant()) / 100;
--- a/UI/UIHouses.h Fri Jul 26 22:19:29 2013 +0200 +++ b/UI/UIHouses.h Fri Jul 26 23:35:34 2013 +0200 @@ -1,4 +1,5 @@ #pragma once +#include "..\Events2D.h" enum HOUSE_DIALOGUE_MENU: __int32 { @@ -133,7 +134,12 @@ void __cdecl AlchemistDialog(); void __cdecl ArmorShopDialog(); + +void InitializaDialogueOptions_Tavern(BuildingType type); // idb +void InitializaDialogueOptions_Shops(BuildingType type); +void InitializaDialogueOptions(BuildingType type); + extern int uHouse_ExitPic; // weak extern int dword_591080; // weak -extern int in_current_building_type; // 00F8B198 +extern BuildingType in_current_building_type; // 00F8B198 extern HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C \ No newline at end of file
--- a/UI/UIShops.cpp Fri Jul 26 22:19:29 2013 +0200 +++ b/UI/UIShops.cpp Fri Jul 26 23:35:34 2013 +0200 @@ -233,7 +233,7 @@ pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60]; if ( !v56 || !Str ) { - v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BildingType_WeaponShop, v61, 2); + v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BuildingType_WeaponShop, v61, 2); v7 = BuildDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); @@ -267,7 +267,7 @@ || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) return; v79 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; - v13 = pPlayer->SelectPhrasesTransaction(v79, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); + v13 = pPlayer->SelectPhrasesTransaction(v79, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); v7 = BuildDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0); pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); @@ -288,7 +288,7 @@ v4 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; if (!v4->Identified()) { - v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); + v10 = pPlayer->SelectPhrasesTransaction(v4, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); v7 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); @@ -315,7 +315,7 @@ || (!(pPlayer->pOwnItems[pNumActiveItem-1].uAttributes& 2)) ) return; v4 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; - v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); + v10 = pPlayer->SelectPhrasesTransaction(v4, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); v7 = BuildDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0); pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138; dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3); @@ -424,7 +424,7 @@ pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; if ( !v56 || !Str ) { - v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BildingType_WeaponShop, v61, 2); + v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BuildingType_WeaponShop, v61, 2); v7 = BuildDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); @@ -761,7 +761,7 @@ pItemCount = v74 - 1; selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0) - v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; + v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; else v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); @@ -833,7 +833,7 @@ else selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) - v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; + v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; else v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" v36 = BuildDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); @@ -895,8 +895,8 @@ || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) ) return; v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v10 - 1]; - v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BildingType_ArmorShop, window_SpeakInHouse->par1C, 3); - v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; + v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3); + v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); @@ -924,7 +924,7 @@ v5 = "%24"; else { - v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v3, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 4); + v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v3, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 4); v5 = (char *)pMerchantsIdentifyPhrases[v8]; } v6 = BuildDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); @@ -953,7 +953,7 @@ return; __debugbreak(); // warning C4700: uninitialized local variable 'v33' used v116 = &pPlayers[uActiveCharacter]->pInventoryItemList[v33 - 1]; - v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 5); + v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); v15 = (char *)pMerchantsRepairPhrases[v35]; v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; @@ -981,7 +981,7 @@ --pItemCount; v97 = uActiveCharacter - 1; __debugbreak(); // warning C4700: uninitialized local variable 'v98' used - v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 2); + v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2); v100 = BuildDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0); v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3); @@ -1364,7 +1364,7 @@ v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; if ( !v63 || !Str ) { - v71 = pPlayer->SelectPhrasesTransaction(v70, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); + v71 = pPlayer->SelectPhrasesTransaction(v70, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2); v38 = (char *)pMerchantsBuyPhrases[v71]; } else @@ -1391,7 +1391,7 @@ || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) return; v87 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; - v45 = pPlayer->SelectPhrasesTransaction(v87, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); + v45 = pPlayer->SelectPhrasesTransaction(v87, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); v21 = BuildDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0); pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3); @@ -1411,7 +1411,7 @@ v37 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; if (!v37->Identified()) { - v42 = pPlayer->SelectPhrasesTransaction(v37, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); + v42 = pPlayer->SelectPhrasesTransaction(v37, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); v38 = (char *)pMerchantsIdentifyPhrases[v42]; } else @@ -1567,7 +1567,7 @@ v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; if ( !v63 || !Str ) { - v71 = pPlayer->SelectPhrasesTransaction(v70, BildingType_AlchemistShop, v68, 2); + v71 = pPlayer->SelectPhrasesTransaction(v70, BuildingType_AlchemistShop, v68, 2); v38 = (char *)pMerchantsBuyPhrases[v71]; } else @@ -1947,7 +1947,7 @@ v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" else { - v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); + v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); v10 = (char *)pMerchantsBuyPhrases[v75]; } v30 = BuildDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); @@ -2078,7 +2078,7 @@ v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" else { - v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); + v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); v10 = (char *)pMerchantsBuyPhrases[v75]; } v30 = BuildDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); @@ -2142,7 +2142,7 @@ || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) return; item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; - v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); + v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); v30 = BuildDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); @@ -2174,7 +2174,7 @@ dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v5, 3); return; } - v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4); + v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4); v30 = BuildDialogueString((char *)pMerchantsIdentifyPhrases[v8], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138; dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v30, 3); @@ -2201,7 +2201,7 @@ || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) ) return; item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; - v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[result - 1], BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); + v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[result - 1], BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); v30 = BuildDialogueString((char *)pMerchantsRepairPhrases[v29], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); @@ -2562,7 +2562,7 @@ if ( pParty->uNumGold < uPriceItemService ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" - if ( in_current_building_type == BildingType_Training ) + if ( in_current_building_type == BuildingType_Training ) v55 = 4; else v55 = 2; @@ -2604,7 +2604,7 @@ if ( in_current_building_type <= 0 ) return; - if ( in_current_building_type <= BildingType_AlchemistShop ) + if ( in_current_building_type <= BuildingType_AlchemistShop ) { if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) { @@ -2635,7 +2635,7 @@ GameUI_DrawItemInfo(v7); return; } - if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) + if ( in_current_building_type <= BuildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) { v1 = pMouse->GetCursorPos(&a2); v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; @@ -2654,16 +2654,16 @@ if ( in_current_building_type > 0 ) { - if ( in_current_building_type > BildingType_MagicShop ) + if ( in_current_building_type > BuildingType_MagicShop ) { - if ( in_current_building_type == BildingType_Bank ) + if ( in_current_building_type == BuildingType_Bank ) { if ( !dword_F8B1E4 ) return; } else { - if ( in_current_building_type != BildingType_Temple ) + if ( in_current_building_type != BuildingType_Temple ) return; } PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
--- a/mm7_2.cpp Fri Jul 26 22:19:29 2013 +0200 +++ b/mm7_2.cpp Fri Jul 26 23:35:34 2013 +0200 @@ -716,7 +716,7 @@ { UI_CreateEndConversationButton(); dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT; - sub_4B3AD4(in_current_building_type); + InitializaDialogueOptions_Shops(in_current_building_type); } else { @@ -725,20 +725,20 @@ pVideoPlayer->_4BF5B2(); //LABEL_28: dialog_menu_id = HOUSE_DIALOGUE_MAIN; - sub_4B3B42(in_current_building_type); + InitializaDialogueOptions(in_current_building_type); return 1; } pVideoPlayer->_4BF5B2(); UI_CreateEndConversationButton(); dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN; - sub_4B3A72(in_current_building_type); + InitializaDialogueOptions_Tavern(in_current_building_type); } return 1; } pVideoPlayer->_4BF5B2(); UI_CreateEndConversationButton(); dialog_menu_id = HOUSE_DIALOGUE_MAIN; - sub_4B3B42(in_current_building_type); + InitializaDialogueOptions(in_current_building_type); return 1; } pDialogueNPCCount = 0;
--- a/mm7_3.cpp Fri Jul 26 22:19:29 2013 +0200 +++ b/mm7_3.cpp Fri Jul 26 23:35:34 2013 +0200 @@ -6525,126 +6525,126 @@ { if ( !_strnicmp(test_string, "wea", 3) ) { - p2DEvents[i].uType = BildingType_WeaponShop; + p2DEvents[i].uType = BuildingType_WeaponShop; break; } if ( !_strnicmp(test_string, "arm", 3) ) { - p2DEvents[i].uType = BildingType_ArmorShop; + p2DEvents[i].uType = BuildingType_ArmorShop; break; } if ( !_strnicmp(test_string, "mag", 3) ) { - p2DEvents[i].uType = BildingType_MagicShop; + p2DEvents[i].uType = BuildingType_MagicShop; break; } if ( !_strnicmp(test_string, "alc", 3) ) { - p2DEvents[i].uType = BildingType_AlchemistShop; + p2DEvents[i].uType = BuildingType_AlchemistShop; break; } if ( !_strnicmp(test_string, "sta", 3) ) { - p2DEvents[i].uType = BildingType_Stables; + p2DEvents[i].uType = BuildingType_Stables; break; } if ( !_strnicmp(test_string, "boa", 3) ) { - p2DEvents[i].uType = BildingType_Boats; + p2DEvents[i].uType = BuildingType_Boats; break; } if ( !_strnicmp(test_string, "tem", 3) ) { - p2DEvents[i].uType = BildingType_Temple; + p2DEvents[i].uType = BuildingType_Temple; break; } if ( !_strnicmp(test_string, "tra", 3) ) { - p2DEvents[i].uType = BildingType_Training; + p2DEvents[i].uType = BuildingType_Training; break; } if ( !_strnicmp(test_string, "tow", 3) ) { - p2DEvents[i].uType = BildingType_TownHall; + p2DEvents[i].uType = BuildingType_TownHall; break; } if ( !_strnicmp(test_string, "tav", 3) ) { - p2DEvents[i].uType = BildingType_Tavern; + p2DEvents[i].uType = BuildingType_Tavern; break; } if ( !_strnicmp(test_string, "ban", 3) ) { - p2DEvents[i].uType = BildingType_Bank; + p2DEvents[i].uType = BuildingType_Bank; break; } if ( !_strnicmp(test_string, "fir", 3) ) { - p2DEvents[i].uType = BildingType_FireGuild; + p2DEvents[i].uType = BuildingType_FireGuild; break; } if ( !_strnicmp(test_string, "air", 3) ) { - p2DEvents[i].uType = BildingType_AirGuild; + p2DEvents[i].uType = BuildingType_AirGuild; break; } if ( !_strnicmp(test_string, "wat", 3) ) { - p2DEvents[i].uType = BildingType_WaterGuild; + p2DEvents[i].uType = BuildingType_WaterGuild; break; } if ( !_strnicmp(test_string, "ear", 3) ) { - p2DEvents[i].uType = BildingType_EarthGuild; + p2DEvents[i].uType = BuildingType_EarthGuild; break; } if ( !_strnicmp(test_string, "spi", 3) ) { - p2DEvents[i].uType = BildingType_SpiritGuild; + p2DEvents[i].uType = BuildingType_SpiritGuild; break; } if ( !_strnicmp(test_string, "min", 3) ) { - p2DEvents[i].uType = BildingType_MindGuild; + p2DEvents[i].uType = BuildingType_MindGuild; break; } if ( !_strnicmp(test_string, "bod", 3) ) { - p2DEvents[i].uType = BildingType_BodyGuild; + p2DEvents[i].uType = BuildingType_BodyGuild; break; } if ( !_strnicmp(test_string, "lig", 3) ) { - p2DEvents[i].uType = BildingType_LightGuild; + p2DEvents[i].uType = BuildingType_LightGuild; break; } if ( !_strnicmp(test_string, "dar", 3) ) { - p2DEvents[i].uType = BildingType_DarkGuild; + p2DEvents[i].uType = BuildingType_DarkGuild; break; } if ( !_strnicmp(test_string, "ele", 3) ) { - p2DEvents[i].uType = BildingType_14; + p2DEvents[i].uType = BuildingType_14; break; } if ( !_strnicmp(test_string, "sel", 3) ) { - p2DEvents[i].uType = BildingType_15; + p2DEvents[i].uType = BuildingType_15; break; } if ( !_strnicmp(test_string, "mir", 3) ) { - p2DEvents[i].uType = BildingType_16; + p2DEvents[i].uType = BuildingType_16; break; } if ( !_strnicmp(test_string, "mer", 3) ) { - p2DEvents[i].uType = BildingType_TownHall; + p2DEvents[i].uType = BuildingType_TownHall; break; } - p2DEvents[i].uType = BildingType_18; + p2DEvents[i].uType = BuildingType_18; } break; @@ -6933,7 +6933,7 @@ } //----- (00444360) -------------------------------------------------------- -void __thiscall Level_LoadEvtAndStr(const char *pLevelName) +void Level_LoadEvtAndStr(const char *pLevelName) { char pContainerName[120]; // [sp+8h] [bp-98h]@1 @@ -7031,7 +7031,7 @@ } //----- (00444D80) -------------------------------------------------------- -signed int __cdecl GetTravelTime() +int GetTravelTime() { signed int v0; // esi@1
--- a/mm7_4.cpp Fri Jul 26 22:19:29 2013 +0200 +++ b/mm7_4.cpp Fri Jul 26 23:35:34 2013 +0200 @@ -3539,249 +3539,6 @@ return pTmpBuf2.data(); } -//----- (004B3A72) -------------------------------------------------------- -void sub_4B3A72( int a1 ) - { - int num_buttons; // esi@1 - - num_buttons = 0; - if ( a1 == 21 ) - { - CreateButtonInColumn(0, 0x66u); - num_buttons = 2; - CreateButtonInColumn(1, 0x67u); - if ( pParty->HasItem(651) ) //Arcomage Deck - { - num_buttons = 3; - CreateButtonInColumn(2, 0x68u); - } - } - pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); - dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; -} -// F8B1E0: using guessed type int dword_F8B1E0; - -//----- (004B3AD4) -------------------------------------------------------- -void sub_4B3AD4( signed int a1 ) - { - if ( a1 > 0 ) - { - if ( a1 <= 3 ) - { - CreateButtonInColumn(0, 3u); - CreateButtonInColumn(1, 4u); - CreateButtonInColumn(2, 5u); - pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); - } - if ( a1 == 4 ) - { - CreateButtonInColumn(0, 3u); - CreateButtonInColumn(1, 4u); - pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); - } - } - dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; -} -// F8B1E0: using guessed type int dword_F8B1E0; - -//----- (004B3B42) -------------------------------------------------------- -void sub_4B3B42( signed int a1 ) - { - int v1; // ecx@18 - int v2; // ecx@19 - int v3; // ecx@20 - signed int v4; // esi@22 - signed int v5; // eax@22 - unsigned int v6; // edx@24 - int v7; // ecx@24 - int result; // eax@43 - int v9; // [sp-10h] [bp-14h]@28 - int v10; // [sp-Ch] [bp-10h]@28 - int v11; // [sp-8h] [bp-Ch]@28 - unsigned int v12; // [sp-4h] [bp-8h]@4 - unsigned int v13; // [sp-4h] [bp-8h]@5 - unsigned int v14; // [sp-4h] [bp-8h]@9 - unsigned int v15; // [sp-4h] [bp-8h]@10 - unsigned int v16; // [sp-4h] [bp-8h]@14 - int v17; // [sp-4h] [bp-8h]@28 - - if ( a1 > 13 ) - { - if ( a1 > 22 ) - { - if ( a1 == 23 ) - { - CreateButtonInColumn(0, 0xAu); - CreateButtonInColumn(1, 0xBu); - v14 = 96; -LABEL_41: - CreateButtonInColumn(2, v14); - v17 = 2; - v11 = 0; - v10 = 1; - v9 = 3; - goto LABEL_42; - } - if ( a1 <= 26 ) - goto LABEL_43; - if ( a1 > 28 ) - { - if ( a1 != 30 ) - goto LABEL_43; - CreateButtonInColumn(0, 0x11u); - v16 = 96; - goto LABEL_37; - } - CreateButtonInColumn(0, 0x69u); - CreateButtonInColumn(1, 0x6Au); - CreateButtonInColumn(2, 0x6Bu); - v12 = 108; - } - else - { - if ( a1 == 22 ) - { - CreateButtonInColumn(0, 7u); - v16 = 8; - goto LABEL_37; - } - v1 = a1 - 14; - if ( !v1 ) - { - CreateButtonInColumn(0, 0x12u); - CreateButtonInColumn(1, 0x30u); - CreateButtonInColumn(2, 0x31u); - CreateButtonInColumn(3, 0x32u); - CreateButtonInColumn(4, 0x33u); - v17 = 2; - v11 = 0; - v10 = 1; - v9 = 5; - goto LABEL_42; - } - v2 = v1 - 1; - if ( v2 ) - { - v3 = v2 - 2; - if ( v3 ) - { - if ( v3 != 4 ) - goto LABEL_43; - CreateButtonInColumn(0, 0xFu); - CreateButtonInColumn(1, 0x10u); - v4 = 3; - CreateButtonInColumn(2, 0x60u); - v5 = (signed int)window_SpeakInHouse->ptr_1C; - if ( v5 < 108 || v5 > 120 ) - goto LABEL_28; - v4 = 4; - v6 = 101; - v7 = 3; - } - else - { - v4 = 1; - CreateButtonInColumn(0, 0x63u); - if ( !pParty->uFine ) - { -LABEL_28: - v17 = 2; - v11 = 0; - v10 = 1; - v9 = v4; -LABEL_42: - pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); - goto LABEL_43; - } - v4 = 2; - v7 = 1; - v6 = 100; - } - CreateButtonInColumn(v7, v6); - goto LABEL_28; - } - CreateButtonInColumn(0, 0x12u); - CreateButtonInColumn(1, 0x34u); - CreateButtonInColumn(2, 0x35u); - v12 = 54; - } -LABEL_39: - CreateButtonInColumn(3, v12); - v17 = 2; - v11 = 0; - v10 = 1; - v9 = 4; - goto LABEL_42; - } - if ( a1 == 13 ) - { - CreateButtonInColumn(0, 0x12u); - v16 = 56; -LABEL_37: - CreateButtonInColumn(1, v16); - v17 = 2; - v11 = 0; - v10 = 1; - v9 = 2; - goto LABEL_42; - } - switch ( a1 ) - { - case 1: - case 2: - case 3: - case 4: - CreateButtonInColumn(0, 2u); - CreateButtonInColumn(1, 0x5Fu); - CreateButtonInColumn(2, 0x5Eu); - v12 = 96; - goto LABEL_39; - case 5: - CreateButtonInColumn(0, 0x12u); - v13 = 48; - goto LABEL_9; - case 6: - CreateButtonInColumn(0, 0x12u); - v13 = 49; - goto LABEL_9; - case 7: - CreateButtonInColumn(0, 0x12u); - v13 = 50; - goto LABEL_9; - case 8: - CreateButtonInColumn(0, 0x12u); - v13 = 51; -LABEL_9: - CreateButtonInColumn(1, v13); - v14 = 72; - goto LABEL_41; - case 9: - CreateButtonInColumn(0, 0x12u); - v15 = 52; - goto LABEL_13; - case 10: - CreateButtonInColumn(0, 0x12u); - v15 = 53; - goto LABEL_13; - case 11: - CreateButtonInColumn(0, 0x12u); - v15 = 54; -LABEL_13: - CreateButtonInColumn(1, v15); - v14 = 61; - goto LABEL_41; - case 12: - CreateButtonInColumn(0, 0x12u); - v16 = 55; - goto LABEL_37; - default: - break; - } -LABEL_43: - dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; -} -// F8B1E0: using guessed type int dword_F8B1E0; - //----- (004B3E1E) -------------------------------------------------------- void __cdecl sub_4B3E1E() { @@ -3811,7 +3568,8 @@ { int v1; // edi@1 char *v2; // edi@1 - + + __debugbreak(); v1 = a4; uDialogueType = 78; current_npc_text = (char *)pNPCTopics[a4 + 168].pText; @@ -3833,7 +3591,7 @@ //----- (004B46A5) -------------------------------------------------------- void __fastcall DrawTextAtStatusBar( const char *Str, int a5 ) - { +{ int v4; // eax@1 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); v4 = pFontLucida->AlignText_Center(450, Str); @@ -4093,22 +3851,22 @@ return 0; switch( p2DEvents[_2da_idx - 1].uType ) { - case BildingType_WeaponShop: + case BuildingType_WeaponShop: { test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; break; } - case BildingType_ArmorShop: + case BuildingType_ArmorShop: { test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; break; } - case BildingType_MagicShop: + case BuildingType_MagicShop: { test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; break; } - case BildingType_AlchemistShop: + case BuildingType_AlchemistShop: { test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17
--- a/mm7_data.h Fri Jul 26 22:19:29 2013 +0200 +++ b/mm7_data.h Fri Jul 26 23:35:34 2013 +0200 @@ -1217,10 +1217,10 @@ void __cdecl OnMapLeave(); void /*__usercall*/ OnMapLoad(); -void __thiscall Level_LoadEvtAndStr(const char *pLevelName); +void Level_LoadEvtAndStr(const char *pLevelName); const char *__cdecl sub_444564(); char *__thiscall GetEventHintString(unsigned int uEventID); // idb -signed int __cdecl GetTravelTime(); +int GetTravelTime(); void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4); void __cdecl sub_4452BB(); const char *GetProfessionActionText(int a1); @@ -1444,9 +1444,6 @@ void SimpleHouseAndBoatsDialog(); void CreateButtonInColumn(int a1, unsigned int a2); void FillAviableSkillsToTeach(int _this); -void sub_4B3A72(int a1); // idb -void sub_4B3AD4(signed int a1); -void sub_4B3B42(signed int a1); void __cdecl sub_4B3E1E(); void DrawJoinGuildWindow(int pEventCode); void __fastcall sub_4B3FE5(int a4);
--- a/stru159.h Fri Jul 26 22:19:29 2013 +0200 +++ b/stru159.h Fri Jul 26 23:35:34 2013 +0200 @@ -9,7 +9,7 @@ char *video_name; int field_4; int house_npc_id; - unsigned __int8 uBuildingType; + unsigned __int8 uBuildingType; // enum BuildingType unsigned __int8 uRoomSoundId; unsigned __int16 padding_e; };