Mercurial > mm7
diff UI/UIHouses.cpp @ 1306:13b7be8b06a0
Слияние
author | Ritor1 |
---|---|
date | Sun, 23 Jun 2013 14:27:57 +0600 |
parents | 9d99e7b76cdc bedc304ab617 |
children | ae6c8e1ddef4 03d6ea33a8c9 |
line wrap: on
line diff
--- a/UI/UIHouses.cpp Sun Jun 23 14:27:32 2013 +0600 +++ b/UI/UIHouses.cpp Sun Jun 23 14:27:57 2013 +0600 @@ -2,31 +2,31 @@ #define _CRT_SECURE_NO_WARNINGS #endif -#include "Texture.h" -#include "mm7_data.h" +#include "..\Texture.h" +#include "..\mm7_data.h" #include "UIHouses.h" -#include "Party.h" -#include "texts.h" -#include "Events.h" -#include "Arcomage.h" -#include "LOD.h" -#include "Mouse.h" -#include "GUIWindow.h" -#include "GUIFont.h" -#include "Events2D.h" -#include "Overlays.h" -#include "Outdoor.h" -#include "AudioPlayer.h" -#include "VideoPlayer.h" -#include "Monsters.h" -#include "Viewport.h" -#include "Keyboard.h" -#include "IndoorCamera.h" -#include "MapInfo.h" -#include "Log.h" -#include "Game.h" +#include "..\Party.h" +#include "..\texts.h" +#include "..\Events.h" +#include "..\Arcomage.h" +#include "..\LOD.h" +#include "..\Mouse.h" +#include "..\GUIWindow.h" +#include "..\GUIFont.h" +#include "..\Events2D.h" +#include "..\Overlays.h" +#include "..\Outdoor.h" +#include "..\AudioPlayer.h" +#include "..\VideoPlayer.h" +#include "..\Monsters.h" +#include "..\Viewport.h" +#include "..\Keyboard.h" +#include "..\IndoorCamera.h" +#include "..\MapInfo.h" +#include "..\Log.h" +#include "..\Game.h" -#include "stru159.h" +#include "..\stru159.h" int uHouse_ExitPic; // weak int dword_591080; // weak @@ -314,92 +314,6 @@ {"Player Castle Bad", 0x24, 0, 25, 0, 0} }}; - - -//----- (0044606A) -------------------------------------------------------- -void PrepareHouse(HOUSE_ID house) -{ - //unsigned int v1; // ebx@1 - //signed int v2; // esi@1 - //int uExitPic; // edi@1 - __int16 uExitMapID; // ax@2 - //int result; // eax@5 - //unsigned int *v6; // ecx@8 - int v7; // ebx@11 - //int v8; // esi@16 - //unsigned int v9; // eax@16 - //unsigned int v10; // eax@19 - //int v11; // ecx@19 - //char pContainer[36]; // [sp+Ch] [bp-54h]@16 - int v13; // [sp+30h] [bp-30h]@11 - int npc_id_arr[6]; // [sp+34h] [bp-2Ch]@1 - //unsigned int v15; // [sp+4Ch] [bp-14h]@1 - int uAnimationID; // [sp+50h] [bp-10h]@1 - //unsigned int *v17; // [sp+54h] [bp-Ch]@3 - //unsigned int v18; // [sp+58h] [bp-8h]@1 - //int v19; // [sp+5Ch] [bp-4h]@7 - - - uAnimationID = p2DEvents[house - 1].uAnimationID; - memset(npc_id_arr, 0, sizeof(npc_id_arr)); - uNumDialogueNPCPortraits = 0; - uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; - if ( uHouse_ExitPic ) - { - uExitMapID = p2DEvents[house - 1]._quest_related; - if ( uExitMapID > 0 ) - { - if(_449B57_test_bit(pParty->_quest_bits,uExitMapID)) - { - uHouse_ExitPic = 0; - } - } - } - - dword_591080 = pAnimatedRooms[uAnimationID].house_npc_id; - HouseNPCData[0]=0; - uNumDialogueNPCPortraits = 0; - if ( dword_591080 ) - { - - npc_id_arr[0] = dword_591080; - uNumDialogueNPCPortraits = 1; - } - - for (uint i = 1; i < pNPCStats->uNumNewNPCs; ++i) - { - if (pNPCStats->pNewNPCData[i].Location2D == house ) - { - if (!(pNPCStats->pNewNPCData[i].uFlags & 0x80)) - { - - HouseNPCData[uNumDialogueNPCPortraits+1- (dword_591080 != 0) ? 1 : 0] = &pNPCStats->pNewNPCData[i]; - npc_id_arr[uNumDialogueNPCPortraits] = pNPCStats->pNewNPCData[i].uPortraitID; - ++uNumDialogueNPCPortraits; - if ((pNPCStats->pNewNPCData[i].uFlags & 3) != 2) - ++pNPCStats->pNewNPCData[i].uFlags; - } - } - - } - - for (uint i = 0; i < uNumDialogueNPCPortraits; ++i) - { - - char icon_name[128]; - sprintfex(icon_name, "npc%03u", npc_id_arr[i]); - pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); - } - - if (uHouse_ExitPic) - { - pDialogueNPCPortraits[uNumDialogueNPCPortraits] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); - ++uNumDialogueNPCPortraits; - uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; - } -} - - //----- (0044622E) -------------------------------------------------------- bool EnterHouse(enum HOUSE_ID uHouseID) { @@ -557,6 +471,88 @@ } } +//----- (0044606A) -------------------------------------------------------- +void PrepareHouse(HOUSE_ID house) +{ + //unsigned int v1; // ebx@1 + //signed int v2; // esi@1 + //int uExitPic; // edi@1 + __int16 uExitMapID; // ax@2 + //int result; // eax@5 + //unsigned int *v6; // ecx@8 + int v7; // ebx@11 + //int v8; // esi@16 + //unsigned int v9; // eax@16 + //unsigned int v10; // eax@19 + //int v11; // ecx@19 + //char pContainer[36]; // [sp+Ch] [bp-54h]@16 + int v13; // [sp+30h] [bp-30h]@11 + int npc_id_arr[6]; // [sp+34h] [bp-2Ch]@1 + //unsigned int v15; // [sp+4Ch] [bp-14h]@1 + int uAnimationID; // [sp+50h] [bp-10h]@1 + //unsigned int *v17; // [sp+54h] [bp-Ch]@3 + //unsigned int v18; // [sp+58h] [bp-8h]@1 + //int v19; // [sp+5Ch] [bp-4h]@7 + + + uAnimationID = p2DEvents[house - 1].uAnimationID; + memset(npc_id_arr, 0, sizeof(npc_id_arr)); + uNumDialogueNPCPortraits = 0; + uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; + if ( uHouse_ExitPic ) + { + uExitMapID = p2DEvents[house - 1]._quest_related; + if ( uExitMapID > 0 ) + { + if(_449B57_test_bit(pParty->_quest_bits,uExitMapID)) + { + uHouse_ExitPic = 0; + } + } + } + + dword_591080 = pAnimatedRooms[uAnimationID].house_npc_id; + HouseNPCData[0]=0; + uNumDialogueNPCPortraits = 0; + if ( dword_591080 ) + { + + npc_id_arr[0] = dword_591080; + uNumDialogueNPCPortraits = 1; + } + + for (uint i = 1; i < pNPCStats->uNumNewNPCs; ++i) + { + if (pNPCStats->pNewNPCData[i].Location2D == house ) + { + if (!(pNPCStats->pNewNPCData[i].uFlags & 0x80)) + { + + HouseNPCData[uNumDialogueNPCPortraits+1- (dword_591080 != 0) ? 1 : 0] = &pNPCStats->pNewNPCData[i]; + npc_id_arr[uNumDialogueNPCPortraits] = pNPCStats->pNewNPCData[i].uPortraitID; + ++uNumDialogueNPCPortraits; + if ((pNPCStats->pNewNPCData[i].uFlags & 3) != 2) + ++pNPCStats->pNewNPCData[i].uFlags; + } + } + + } + + for (uint i = 0; i < uNumDialogueNPCPortraits; ++i) + { + + char icon_name[128]; + sprintfex(icon_name, "npc%03u", npc_id_arr[i]); + pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); + } + + if (uHouse_ExitPic) + { + pDialogueNPCPortraits[uNumDialogueNPCPortraits] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); + ++uNumDialogueNPCPortraits; + uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; + } +} //----- (004B1E92) -------------------------------------------------------- void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound) { @@ -568,29 +564,6 @@ 806, 0, -1, 0, 0, 0, 0); } -//----- (004B4F4F) -------------------------------------------------------- -void JailDialog() -{ - const char *v0; // esi@1 - const char *v1; // ST10_4@1 - unsigned __int16 v2; // ST0C_2@1 - int v3; // eax@1 - GUIWindow v5; // [sp+8h] [bp-54h]@1 - - memcpy(&v5, window_SpeakInHouse, sizeof(v5)); - v0 = pGlobalTXT_LocalizationStrings[672]; - v1 = pGlobalTXT_LocalizationStrings[672]; - v5.uFrameX = 483; - v5.uFrameWidth = 148; - v5.uFrameZ = 334; - v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0); - v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u); -} - - - - //----- (004BCACC) -------------------------------------------------------- void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) { @@ -1613,9 +1586,6 @@ } */ } - - - //----- (004B6943) -------------------------------------------------------- void __cdecl TravelByTransport() { @@ -1929,12 +1899,6 @@ } } } - - - - - - //----- (004B68EA) -------------------------------------------------------- bool __fastcall IsTravelAvailable(int a1) { @@ -2130,8 +2094,6 @@ return; } - - //----- (004B7D7E) -------------------------------------------------------- void __cdecl BankDialog() { @@ -2715,1961 +2677,6 @@ } } - -//----- (004B910F) -------------------------------------------------------- -void __cdecl WeaponShopDialog() -{ - int v0; // ebx@1 - int pNumActiveItem; // eax@6 - signed int v2; // esi@8 - ItemGen *v4; // eax@11 - char *v5; // ecx@12 - unsigned __int8 v6; // dl@13 - char *v7; // edx@14 - int v9; // ST08_4@16 - int v10; // eax@16 - signed int v11; // esi@18 - int v12; // ST08_4@21 - int v13; // eax@21 - int v14; // edi@23 - char **v15; // esi@23 - int v16; // eax@24 - //int v18; // edx@25 - int v19; // edi@25 - unsigned __int8 v20; // sf@25 - GUIButton *pButton; // esi@27 - int pNewItem; // eax@27 - unsigned int v24; // ecx@27 - int v25; // edx@27 - unsigned int pColorText; // ax@27 - signed int v27; // esi@32 - int v28; // ST08_4@36 - int v29; // eax@36 - signed int v32; // esi@41 - unsigned int v33; // esi@43 - int v34; // eax@43 - unsigned int v35; // eax@44 - int v36; // eax@46 - __int32 v37; // ecx@51 - int v40; // eax@53 - char *v41; // eax@55 - unsigned int v43; // ecx@55 - const char **v44; // edx@55 - int v45; // eax@55 - int v47; // eax@59 - const char **v48; // eax@63 - unsigned int v49; // esi@65 - Texture *v50; // eax@65 - int v51; // edi@65 - int v52; // esi@70 - Texture *v53; // ST1C_4@70 - int v54; // edi@70 - signed int v55; // ecx@73 - SHORT v56; // di@82 - bool v57; // eax@82 - const char *v58; // ecx@84 - POINT *v59; // esi@89 - LONG v60; // ecx@90 - int v61; // eax@90 - int v62; // ecx@90 - ItemGen *pItemInShop; // esi@90 - int v64; // eax@95 - int all_text_height; // esi@96 - char **v66; // edi@96 - int v67; // eax@97 - int v69; // edx@98 - int v70; // edi@98 - int v71; - const char **v72; // eax@100 - int pTextHeight; // eax@100 - unsigned int v74; // ecx@100 - int v78; // [sp-14h] [bp-10Ch]@14 - ItemGen *v79; // [sp-10h] [bp-108h]@12 - int v80; // [sp-10h] [bp-108h]@14 - void *v81; // [sp-Ch] [bp-104h]@12 - unsigned __int16 v82; // [sp-Ch] [bp-104h]@14 - int v83; // [sp-8h] [bp-100h]@11 - char *v84; // [sp-8h] [bp-100h]@14 - __int64 *v85; // [sp-4h] [bp-FCh]@11 - unsigned int v86; // [sp-4h] [bp-FCh]@14 - POINT v87; // [sp+Ch] [bp-ECh]@8 - POINT v88; // [sp+14h] [bp-E4h]@18 - POINT v89; // [sp+1Ch] [bp-DCh]@89 - POINT v90; // [sp+24h] [bp-D4h]@19 - POINT v91; // [sp+2Ch] [bp-CCh]@89 - POINT v92; // [sp+34h] [bp-C4h]@9 - POINT v93; // [sp+3Ch] [bp-BCh]@33 - POINT v94; // [sp+44h] [bp-B4h]@18 - POINT v95; // [sp+4Ch] [bp-ACh]@32 - POINT v96; // [sp+54h] [bp-A4h]@18 - POINT v97; // [sp+5Ch] [bp-9Ch]@32 - POINT a2; // [sp+64h] [bp-94h]@8 - POINT v99; // [sp+6Ch] [bp-8Ch]@32 - POINT v100; // [sp+74h] [bp-84h]@8 - GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 - char *Str; // [sp+D0h] [bp-28h]@55 - __int32 v103; // [sp+D4h] [bp-24h]@25 - int pColorYellow; // [sp+D8h] [bp-20h]@1 - int pColorWhite; // [sp+DCh] [bp-1Ch]@1 - POINT v106; // [sp+E0h] [bp-18h]@8 - Player *pPlayer; // [sp+E8h] [bp-10h]@1 - int pItemNum; // [sp+ECh] [bp-Ch]@26 - const char **v109; // [sp+F0h] [bp-8h]@26 - unsigned __int8 v110; // [sp+F7h] [bp-1h]@16 - int pNumString; - - pPlayer = pPlayers[uActiveCharacter]; - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); - pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u); - - switch(dialog_menu_id) - { - case HOUSE_DIALOGUE_MAIN: - { - pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( pNumActiveItem ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - all_text_height = 0; - for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v103 = (174 - all_text_height) / 4; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - if ( v20 ^ (pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )) - { - pItemNum = 2; - pNumString = 0; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - pButton->uY = v103 + v19; - pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v19 = pButton->uY + pTextHeight - 1; - pButton->uW = v19; - pColorText = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); - ++pItemNum; - ++pNumString; - pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( pItemNum < pNumActiveItem ); - } - } - break; - } - - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v48 = 0; - pItemNum = 0; - v109 = 0; - do - { - // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID) - { - v49 = word_F8B158[(signed int)v48]; - v50 = ItemsInShopTexture[(signed int)v48]; - v49 += 30; - v51 = 60 - ((signed int)v50->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); - v48 = v109; - } - pItemNum += 70; - v48 = (const char **)((char *)v48 + 1); - v109 = v48; - } - while ( (signed int)v48 < 6 ); - pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( pNumActiveItem ) - { - v55 = 0; - v106.x = 0; - v106.x = 0; - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v106.x; - ++v55; - } - while ( v55 < 6 ); - v56 = GetAsyncKeyState(17); - v57 = pPlayer->CanSteal(); - Str = (char *)v57; - if ( v56 && v57 ) - { - v58 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - v58 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v58, 0); - if ( v106.x ) - { - v59 = pMouse->GetCursorPos(&v91); - pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]; - if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) - { - v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; - v106.x = v60; - v61 = (int)window_SpeakInHouse->ptr_1C;//maybe ptr_1C - BuildID_2Events - // v62 = 9 * (v60 + 12 * v61); - pItemInShop = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60]; - if ( !v56 || !Str ) - { - v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BildingType_WeaponShop, v61, 2); - v7 = BuilDialogueString((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); - } - else - { - v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); - } - } - } - else - { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - pNumActiveItem = 0; //added - } - } - break; - } - - case HOUSE_DIALOGUE_SHOP_SELL: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5), - pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) - return; - v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; - v13 = pPlayer->SelectPhrasesTransaction(v79, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); - v7 = BuilDialogueString((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); - break; - } - - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), - pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) - return; - v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; - if (!v4->Identified()) - { - v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); - v7 = BuilDialogueString((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); - } - else - { - v7 = BuilDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); - } - break; - } - - case HOUSE_DIALOGUE_SHOP_REPAIR: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return; - if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), - pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) - || (!(pPlayer->pOwnItems[pNumActiveItem-1].uAttributes& 2)) ) - return; - v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; - v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); - v7 = BuilDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0); - pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3); - return; - } - break; - - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];//sell - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];//identify - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair - all_text_height = 0; - for ( int i = 0; i < 3; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v103 = (174 - all_text_height) / 3; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - if ( v20 ^ (pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )) - { - pItemNum = 2; - pNumString = 0; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - pButton->uY = v103 + v70; - pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v70 = pButton->uY + pTextHeight - 1; - pButton->uW = v70; - pColorText = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); - ++pItemNum; - ++pNumString; - pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( pItemNum < pNumActiveItem ); - } - break; - } - - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v109 = 0; - pItemNum = 0; - do - { - // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) - { - v52 = word_F8B158[(signed int)v109] + 30; - v53 = ItemsInShopTexture[(signed int)v109]; - v54 = 60 - ((signed int)v53->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53); - sub_40F92A(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); - } - v109 = (const char **)((char *)v109 + 1); - pItemNum += 70; - } - while ( (signed int)v109 < 6 ); - pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( pNumActiveItem ) - { - v55 = 0; - v106.x = 0; - do - { - // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) - ++v106.x; - ++v55; - } - while ( v55 < 6 ); - v56 = GetAsyncKeyState(17); - v57 = pPlayer->CanSteal(); - Str = (char *)v57; - if ( v56 && v57 ) - { - v58 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - v58 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v58, 0); - if ( v106.x ) - { - v59 = pMouse->GetCursorPos(&v91); - pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]; - if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) - { - v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; - v106.x = v60; - v61 = (int)window_SpeakInHouse->ptr_1C; - // v62 = 9 * (v60 + 12 * v61); - pItemInShop = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; - if ( !v56 || !Str ) - { - v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BildingType_WeaponShop, v61, 2); - v7 = BuilDialogueString((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); - } - else - { - v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); - } - } - } - else - { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - pNumActiveItem = 0; //added - } - } - break; - } - - case HOUSE_DIALOGUE_LEARN_SKILLS: - { - if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return; - v0 = 0; - all_text_height = 0; - //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); - v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100; - if ( pItemNum < v32 / 3 ) - pItemNum = v32 / 3; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); - return; - } - do - { - v35 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0); - v0++; - } - ++pNumActiveItem; - } - while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - if ( !v0 ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); - pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); - return; - } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v103 = (149 - all_text_height) / v0; - if ( (149 - all_text_height) / v0 > 32 ) - v103 = 32; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v37 = (149 - v0 * v103 - all_text_height) / 2 - v103 / 2 + 162; - if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) - { - pItemNum = 2; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - v40 = pButton->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = v103 + v37; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v37 = pButton->uY + pTextHeight - 1; - pButton->uW = v37; - pColorText = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v40], 3); - } - pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - pItemNum++; - } - while ( pItemNum < pNumActiveItem ); - } - break; - } - default: - { - if( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR) - pNumActiveItem = dialog_menu_id - 96; - else - pNumActiveItem = dialog_menu_id - 4; - break; - } - } -} - - - -//----- (004B9CC6) -------------------------------------------------------- -void __cdecl AlchemistDialog() -{ - int v0; - int pNumActiveItem; // eax@7 - signed int v5; // esi@9 - unsigned int v6; // esi@11 - int v7; // eax@11 - unsigned int v8; // eax@12 - int v9; // eax@14 - int v10; // ecx@19 - int v13; // eax@21 - char *v14; // eax@23 - int v15; // eax@23 - unsigned int v16; // ecx@23 - int v17; // edx@23 - int v18; // eax@23 - int v20; // eax@27 - char *v21; // edx@29 - int v22; // esi@30 - char **v23; // edi@30 - int v24; // eax@31 - int v26; // edx@32 - int v27; // edi@32 - unsigned __int8 v28; // sf@32 - const char **v30; // eax@34 - int v31; // eax@34 - unsigned int v32; // ecx@34 - int v34; // eax@34 - signed int v36; // esi@39 - ItemGen *v37; // eax@42 - char *v38; // ecx@43 - unsigned __int8 v39; // dl@44 - int v40; // eax@46 - int v41; // ST08_4@47 - int v42; // eax@47 - signed int v43; // esi@49 - int v44; // ST08_4@52 - int v45; // eax@52 - Texture *v46; // ecx@55 - unsigned int v47; // edi@55 - unsigned int v48; // esi@57 - int v49; // edx@61 - Texture *v50; // ecx@67 - unsigned int v51; // edi@67 - unsigned int v52; // esi@69 - int v53; // edx@73 - Texture *v54; // ecx@79 - unsigned int v55; // edi@79 - unsigned int v56; // esi@81 - int v57; // edx@85 - Texture *v58; // ecx@91 - unsigned int v59; // edi@91 - unsigned int v60; // esi@93 - int v61; // edx@97 - signed int v62; // ecx@102 - SHORT v63; // di@110 - bool v64; // eax@110 - const char *v65; // ecx@112 - POINT *v66; // esi@117 - int v67; // ecx@118 - int v68; // eax@118 - int v69; // ecx@118 - ItemGen *v70; // esi@118 - int v71; // eax@123 - int all_text_height; // edi@125 - char **v73; // esi@125 - int v74; // eax@126 - int pItemNum; - int v76; // edx@127 - int v77; // edi@127 - GUIButton *pButton; // esi@129 - const char **v79; // eax@129 - int pTextHeight; // eax@129 - unsigned int v81; // ecx@129 - unsigned int pColorText; // ax@129 - int v85; // [sp-14h] [bp-ECh]@29 - int v86; // [sp-10h] [bp-E8h]@29 - ItemGen *v87; // [sp-10h] [bp-E8h]@43 - unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29 - void *v89; // [sp-Ch] [bp-E4h]@43 - char *v90; // [sp-8h] [bp-E0h]@29 - int v91; // [sp-8h] [bp-E0h]@42 - unsigned int v92; // [sp-4h] [bp-DCh]@29 - __int64 *v93; // [sp-4h] [bp-DCh]@42 - POINT v94; // [sp+Ch] [bp-CCh]@39 - POINT v95; // [sp+14h] [bp-C4h]@49 - POINT v96; // [sp+1Ch] [bp-BCh]@117 - POINT v97; // [sp+24h] [bp-B4h]@40 - POINT v98; // [sp+2Ch] [bp-ACh]@117 - POINT v99; // [sp+34h] [bp-A4h]@49 - POINT v100; // [sp+3Ch] [bp-9Ch]@50 - POINT v101; // [sp+44h] [bp-94h]@39 - POINT v102; // [sp+4Ch] [bp-8Ch]@49 - POINT a2; // [sp+54h] [bp-84h]@39 - GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1 - int v105; // [sp+B0h] [bp-28h]@19 - int pColorYellow; // [sp+B4h] [bp-24h]@1 - int Str; // [sp+B8h] [bp-20h]@23 - int pColorWhite; // [sp+BCh] [bp-1Ch]@1 - __int32 v109; // [sp+C0h] [bp-18h]@39 - Player *pPlayer; // [sp+C4h] [bp-14h]@1 - int pNumString; // [sp+C8h] [bp-10h]@9 - unsigned int v112; // [sp+CCh] [bp-Ch]@9 - unsigned __int8 v113; // [sp+D3h] [bp-5h]@47 - int v114; // [sp+D4h] [bp-4h]@11 - - pPlayer = pPlayers[uActiveCharacter]; - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); - pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u); - switch(dialog_menu_id) - { - case HOUSE_DIALOGUE_MAIN: - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - all_text_height = 0; - for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - Str = (174 - all_text_height) / 4; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; - v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - v28 = -pDialogueWindow->pNumPresenceButton < 0; - if ( v28 ^ (pNumActiveItem > v76) ) - { - pItemNum = 2; - pNumString = 0; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - pButton->uY = Str + v77; - pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v77 = pButton->uY + pTextHeight - 1; - pButton->uW = v77; - pColorText = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); - ++pItemNum; - ++pNumString; - pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( pItemNum < pNumActiveItem ); - } - } - return; - } - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v114 = 0; - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) - { - v46 = ItemsInShopTexture[v114]; - v47 = 152 - v46->uTextureHeight; - if ( (signed int)v47 < 1 ) - v47 = 0; - v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v49 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v48 > 457 - v49 ) - v48 = 457 - v49; - } - } - else if ( (signed int)v48 < 18 ) - v48 = 18; - pRenderer->DrawTextureTransparent(v48, v47, v46); - sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); - } - ++v114; - } - while ( v114 < 6 ); - v114 = 0; - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114 + 6].uItemID) - { - v50 = ItemsInShopTexture[v114 + 6]; - v51 = 308 - v50->uTextureHeight; - if ( (signed int)v51 < 1 ) - v51 = 0; - v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v53 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v52 > 457 - v53 ) - v52 = 457 - v53; - } - } - else - { - if ( (signed int)v52 < 18 ) - v52 = 18; - } - pRenderer->DrawTextureTransparent(v52, v51, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); - } - ++v114; - } - while ( v114 < 6 ); - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v62 = 0; - v109 = 0; - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) - ++v109; - ++v62; - } - while ( v62 < 12 ); - v63 = GetAsyncKeyState(17); - v64 = pPlayer->CanSteal(); - Str = v64; - if ( v63 && v64 ) - { - v65 = pGlobalTXT_LocalizationStrings[185]; - } - else if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - { - v65 = pGlobalTXT_LocalizationStrings[195]; - } - else - { - v65 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v65, 0); - if ( !v109 ) - { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - v66 = pMouse->GetCursorPos(&v98); - pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]; - if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) - { - v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; - v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - 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); - v38 = (char *)pMerchantsBuyPhrases[v71]; - } - else - { - v38 = pGlobalTXT_LocalizationStrings[181]; - } - v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); - return ; - } - } - return; - } - case HOUSE_DIALOGUE_SHOP_SELL: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - if ((v43 = pMouse->GetCursorPos(&v99)->x - 14, v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), - pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) - return; - v87 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; - v45 = pPlayer->SelectPhrasesTransaction(v87, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); - v21 = BuilDialogueString((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); - return; - } - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - if ((v36 = pMouse->GetCursorPos(&a2)->x - 14, v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), - pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462 - || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) - return; - v37 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; - if (!v37->Identified()) - { - v42 = pPlayer->SelectPhrasesTransaction(v37, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); - v38 = (char *)pMerchantsIdentifyPhrases[v42]; - } - else - { - v38 = "%24"; - } - v21 = BuilDialogueString(v38, uActiveCharacter - 1, v37, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); - return; - } - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; - all_text_height = 0; - for ( int i = 0; i < 2; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - Str = (174 - all_text_height) / 2; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; - v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138; - v28 = -pDialogueWindow->pNumPresenceButton < 0; - if ( v28 ^ (pNumActiveItem > v26) ) - { - pItemNum = 2; - pNumString = 0; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - pButton->uY = Str + v27; - pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v27 = pButton->uY + pTextHeight - 1; - pButton->uW = v27; - pColorText = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); - ++pItemNum; - ++pNumString; - pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( pItemNum < pNumActiveItem ); - } - return; - } - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v114 = 0; - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) - { - v54 = ItemsInShopTexture[v114]; - v55 = 152 - v54->uTextureHeight; - if ( (signed int)v55 < 1 ) - v55 = 0; - v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v57 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v56 > 457 - v57 ) - v56 = 457 - v57; - } - } - else - { - if ( (signed int)v56 < 18 ) - v56 = 18; - } - pRenderer->DrawTextureTransparent(v56, v55, v54); - sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); - } - ++v114; - } - while ( v114 < 6 ); - v114 = 0; - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114 + 6].uItemID) //not itemid - { - v58 = ItemsInShopTexture[v114 + 6]; - v59 = 308 - v58->uTextureHeight; - if ( (signed int)v59 < 1 ) - v59 = 0; - v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v61 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v60 > 457 - v61 ) - v60 = 457 - v61; - } - } - else - { - if ( (signed int)v60 < 18 ) - v60 = 18; - } - pRenderer->DrawTextureTransparent(v60, v59, v58); - sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); - } - ++v114; - } - while ( v114 < 6 ); - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v62 = 0; - v109 = 0; - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) - ++v109; - ++v62; - } - while ( v62 < 12 ); - v63 = GetAsyncKeyState(17); - v64 = pPlayer->CanSteal(); - Str = v64; - if ( v63 && v64 ) - { - v65 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v65 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - v65 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v65, 0); - if ( !v109 ) - { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - v66 = pMouse->GetCursorPos(&v98); - pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]; - if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) - { - v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; - v109 = v67; - v68 = (int)window_SpeakInHouse->ptr_1C; - // v69 = 9 * (v67 + 12 * v68); - v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; - if ( !v63 || !Str ) - { - v71 = pPlayer->SelectPhrasesTransaction(v70, BildingType_AlchemistShop, v68, 2); - v38 = (char *)pMerchantsBuyPhrases[v71]; - } - else - { - v38 = pGlobalTXT_LocalizationStrings[181]; - } - v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); - return; - } - } - return; - } - case HOUSE_DIALOGUE_LEARN_SKILLS: - { - if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return; - all_text_height = 0; - v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pItemNum = v5 * (100 - pPlayer->GetMerchant()) / 100; - if ( pItemNum < v5 / 3 ) - pItemNum = v5 / 3; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v114 = 0; - if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); - v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); - return; - } - do - { - v8 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] ) - { - all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0); - ++v114; - } - ++pNumActiveItem; - } - while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - if ( !v114 ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); - v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); - return; - } - if ( v114 ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - v18 = (149 - all_text_height) / v114; - if ( (149 - all_text_height) / v114 > 32 ) - v18 = 32; - pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; - v105 = (149 - v114 * v18 - all_text_height) / 2 - v18 / 2 + 162; - if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) - { - pItemNum = 2; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - v13 = pButton->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = v18 + v105; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v13], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v105 = pButton->uY + pTextHeight - 1; - pButton->uW = v105; - pColorText = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pColorText = pColorWhite; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v13], 3); - } - pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - pItemNum++; - } - while ( pItemNum < pNumActiveItem ); - } - return; - } - } - default: - { - return;// (POINT *)dialog_menu_id - 96; - } - } -} - -//----- (004BA928) -------------------------------------------------------- -void __cdecl ArmorShopDialog() -{ - signed int v1; // esi@8 - unsigned int v2; // eax@10 - ItemGen *v3; // eax@11 - char *v5; // ecx@12 - char *v6; // eax@13 - int v8; // eax@15 - signed int v9; // esi@17 - unsigned int v10; // eax@19 - char *v11; // edi@19 - int v12; // ST08_4@20 - int v13; // eax@20 - char *v15; // ecx@20 - char **v16; // edi@22 - int all_text_height; // ebx@22 - char **v18; // esi@22 - int v19; // eax@23 - GUIWindow *v20; // ecx@24 - int v21; // eax@24 - int v22; // edx@24 - int v23; // ebx@24 - unsigned __int8 v24; // sf@24 - GUIButton *pButton; // eax@26 - unsigned int v28; // ecx@26 - int v29; // edx@26 - signed int v31; // esi@31 - unsigned int v32; // eax@33 - int v33; // eax@34 - int v35; // eax@35 - char *v36; // edx@36 - signed int v38; // esi@42 - unsigned int v39; // esi@44 - int v40; // eax@44 - unsigned int v41; // eax@45 - int v42; // eax@47 - int v43; // ecx@52 - int v46; // eax@54 - unsigned int v49; // ecx@56 - int v51; // eax@56 - int v53; // eax@60 - int textureH; // eax@60 - signed int textureW; // ebx@65 - Texture *v56; // eax@67 - unsigned int pY_item; // edi@68 - Texture *v58; // ST1C_4@68 - int v59; // eax@68 - int v60; // edi@69 - signed int v61; // ebx@73 - Texture *v62; // eax@75 - int v63; // edi@76 - Texture *v64; // ST1C_4@76 - unsigned int v65; // ST18_4@76 - int v66; // eax@76 - int v67; // edi@77 - signed int v68; // ecx@81 - const char *pStatusText; // ecx@91 - void *v72; // eax@95 - POINT *v73; // esi@97 - int v74; // ecx@97 - int v75; // eax@98 - int v76; // ecx@98 - ItemGen *selected_item; // ecx@99 - unsigned __int8 v78; // bl@104 - int v80; // ebx@105 - char **v81; // esi@105 - int v82; // eax@106 - int v86; // ebx@107 - int pTextHeight; // eax@109 - unsigned int v90; // ecx@109 - int pNumString; // edx@109 - unsigned __int16 pTextColor; // ax@109 - signed int v93; // edx@114 - POINT *v94; // edi@120 - __int32 v95; // ecx@120 - void *v96; // ST14_4@122 - unsigned __int8 v97; // bl@122 - ItemGen *v98; // ST10_4@122 - int v99; // eax@122 - char *v100; // eax@122 - const char *v101; // ST18_4@122 - unsigned __int16 v102; // ST14_2@122 - int v103; // eax@122 - signed int v104; // edi@123 - Texture *v105; // eax@125 - int v106; // ebx@126 - unsigned int v108; // ST18_4@126 - int v109; // eax@126 - int v110; // ebx@127 - GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 - unsigned int v112; // [sp-14h] [bp-118h]@13 - int v113; // [sp-14h] [bp-118h]@36 - unsigned int v115; // [sp-10h] [bp-114h]@13 - ItemGen *v116; // [sp-10h] [bp-114h]@20 - int v117; // [sp-10h] [bp-114h]@36 - unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 - char *v121; // [sp-8h] [bp-10Ch]@13 - int v122; // [sp-8h] [bp-10Ch]@20 - unsigned int v123; // [sp-4h] [bp-108h]@13 - __int64 *v124; // [sp-4h] [bp-108h]@20 - int v125; // [sp-4h] [bp-108h]@68 - int v126; // [sp-4h] [bp-108h]@76 - int v127; // [sp-4h] [bp-108h]@126 - POINT v128; // [sp+Ch] [bp-F8h]@8 - POINT v129; // [sp+14h] [bp-F0h]@18 - char v130; // [sp+1Ch] [bp-E8h]@120 - POINT a2; // [sp+24h] [bp-E0h]@8 - POINT v132; // [sp+2Ch] [bp-D8h]@120 - POINT v133; // [sp+34h] [bp-D0h]@17 - POINT v134; // [sp+3Ch] [bp-C8h]@97 - POINT v135; // [sp+44h] [bp-C0h]@31 - POINT v136; // [sp+4Ch] [bp-B8h]@97 - POINT v137; // [sp+54h] [bp-B0h]@17 - POINT v138; // [sp+5Ch] [bp-A8h]@32 - POINT v139; // [sp+64h] [bp-A0h]@17 - POINT v140; // [sp+6Ch] [bp-98h]@31 - POINT v141; // [sp+74h] [bp-90h]@8 - POINT v142; // [sp+7Ch] [bp-88h]@31 - POINT v143; // [sp+84h] [bp-80h]@9 - GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 - int v146; // [sp+E4h] [bp-20h]@24 - int pYellowColor; // [sp+E8h] [bp-1Ch]@1 - int pWhiteColor; // [sp+ECh] [bp-18h]@1 - __int32 pItemCount; // [sp+F0h] [bp-14h]@8 - int v152; // [sp+FCh] [bp-8h]@24 - int v153; // [sp+100h] [bp-4h]@44 - int th; - short text_color; - int pActiveButton; - - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu); - pYellowColor = TargetColor(0xE1u, 0xCDu, 0x23u); - switch (dialog_menu_id) - { - case HOUSE_DIALOGUE_MAIN: - { - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - all_text_height = 0; - for( int i = 0; i < 4; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v146 = ( 174 - all_text_height ) / 4; - v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; - pNumString = 0; - if ( pDialogueWindow->pNumPresenceButton>=0 ) - { - for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton) - { - pButton = pDialogueWindow->GetControl(pActiveButton); - pButton->uY = v146 + v23; - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - pButton->uHeight = pTextHeight; - v23 = pButton->uY + pButton->uHeight - 1; - pButton->uW = v23; - pTextColor = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) - pTextColor = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); - ++pNumString; - } - } - } - break; - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// - textureW = 0; - v153 = 0; - for ( int i = 0; i < 8; ++i )// - { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - { - textureW = ItemsInShopTexture[i]->uTextureWidth; - textureH = ItemsInShopTexture[i]->uTextureHeight; - if ( i >= 4 ) //low row - { - v60 = 90 - (textureW/2); - pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); - v59 = v60 + v153 + 80220; - } - else - { - pY_item = 98 - textureH; - v152 = 86 - (textureW/2); - pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]); - v59 = v153 + v152 + 640 * pY_item; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); - } - v153 += 105; - } - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - pItemCount = 0; - for ( int i = 0; i < 8; ++i ) - { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) - ++pItemCount; - } - if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) - pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - else - pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item" - DrawTextAtStatusBar(pStatusText, 0); - if ( pItemCount != 0 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - pItemCount = v74 - 1; - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; - if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0) - v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BildingType_ArmorShop, window_SpeakInHouse->par1C, 2)]; - else - v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" - v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); - return; - } - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; - } - break; - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v11 = 0; - v61 = 0; - v153 = 0; - do - { - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) - { - v62 = ItemsInShopTexture[v61]; - if ( v61 >= 4 ) - { - v67 = 90 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); - v66 = v153 + v67 + 80220; - } - else - { - v63 = 98 - v62->uTextureHeight; - v64 = ItemsInShopTexture[v61]; - v65 = 98 - v62->uTextureHeight; - v152 = 86 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); - v66 = v152 + v153 + 640 * v63; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); - } - v153 += 105; - ++v61; - } - while ( v61 < 8 ); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v68 = 0; - pItemCount = 0; - do - { - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) - ++pItemCount; - ++v68; - } - while ( v68 < 6 ); - if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) - pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" - else - pStatusText = pGlobalTXT_LocalizationStrings[185]; - DrawTextAtStatusBar(pStatusText, 0); - if ( (char *)pItemCount != 0 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - pItemCount = v74 - 1; - if ( dialog_menu_id == 2 ) - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74 - 1]; - 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)]; - else - v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" - v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); - return; - } - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; - } - break; - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" - all_text_height = 0; - for ( int i = 0; i < 3; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v152 = (174 - all_text_height) / 3; - v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; - v24 = -pDialogueWindow->pNumPresenceButton < 0; - pActiveButton = pDialogueWindow->pStartingPosActiveItem; - if ( v24 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) ) - { - pNumString = 0; - do - { - pButton = pDialogueWindow->GetControl((unsigned int)pActiveButton); - pButton->uY = v152 + v86; - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); - v90 = pButton->uY; - pButton->uHeight = pTextHeight; - v86 = v90 + pTextHeight - 1; - pButton->uW = v86; - pTextColor = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) - pTextColor = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3); - ++pNumString; - ++pActiveButton; - } - while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - return; - } - break; - case HOUSE_DIALOGUE_SHOP_SELL: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return; - if((v9 = pMouse->GetCursorPos(&v139)->x - 14, pItemCount = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), - pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 - || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) ) - return; - v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[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)]; - v36 = BuilDialogueString(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); - return; - } - break; - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v1 = pMouse->GetCursorPos(&a2)->x - 14; - pItemCount = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&v141)->x > 13 ) - { - if ( pMouse->GetCursorPos(&v143)->x < 462 ) - { - v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount); - if ( v2 ) - { - v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v2-1]; - if (v3->Identified()) - v5 = "%24"; - else - { - v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v3, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 4); - v5 = (char *)pMerchantsIdentifyPhrases[v8]; - } - v6 = BuilDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3); - return; - } - } - } - } - } - break; - case HOUSE_DIALOGUE_SHOP_REPAIR: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return; - if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, - pItemCount = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), - pMouse->GetCursorPos(&v140)->x <= 13) - || pMouse->GetCursorPos(&v138)->x >= 462 - || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32) - || (!(pPlayers[uActiveCharacter]->pOwnItems[v32-1].uAttributes& 2)) ) - return; - v116 = &pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1]; - v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[v32 - 1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 5); - v15 = (char *)pMerchantsRepairPhrases[v35]; - v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); - return; - } - break; - case HOUSE_DIALOGUE_SHOP_6: //buy standart ??? - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - pItemCount = 0; - for( int i = 0; i < 6 ; ++i ) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - ++pItemCount; - if ( pItemCount ) - { - v94 = pMouse->GetCursorPos(&v132); - pItemCount = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; - v95 = pItemCount; - if ( pItemCount && pItemCount != -65536 ) - { - --pItemCount; - v97 = uActiveCharacter - 1; - v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 2); - v100 = BuilDialogueString((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); - } - v104 = 0; - v153 = 0; - do - { - //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) - { - v105 = ItemsInShopTexture[v104]; - if ( v104 >= 4 ) - { - v110 = 90 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); - v127 = v104 + 1; - v109 = v153 + v110 + 80220; - } - else - { - v106 = 98 - v105->uTextureHeight; - v108 = 98 - v105->uTextureHeight; - v152 = 86 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v108, ItemsInShopTexture[v104]); - v127 = v104 + 1; - v109 = v152 + v153 + 640 * v106; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); - } - v153 += 105; - ++v104; - } - while ( v104 < 8 ); - return; - } - dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; - } - break; - case HOUSE_DIALOGUE_LEARN_SKILLS: - { - if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v152 = 0; - v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( (signed int)pActiveButton < v38 / 3 ) - pActiveButton = v38 / 3; - v39 = pDialogueWindow->pStartingPosActiveItem; - v40 = pDialogueWindow->pNumPresenceButton; - v153 = 0; - if ( (signed int)v39 < (signed int)(v39 + v40) ) - { - do - { - v41 = pDialogueWindow->GetControl(v39)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] && !pPlayers[uActiveCharacter]->pActiveSkills[v41] ) - { - v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); - v152 += v42; - ++v153; - } - ++v39; - } - while ( (signed int)v39 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - if ( v153 ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pActiveButton); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - pActiveButton = (149 - v152) / v153; - if ( (149 - v152) / v153 > 32 ) - pActiveButton = 32; - v43 = (149 - v153 * (signed int)pActiveButton - v152) / 2 - (signed int)pActiveButton / 2 + 162; - v152 = pDialogueWindow->pStartingPosActiveItem; - v146 = v43; - if ( v152 < v152 + pDialogueWindow->pNumPresenceButton ) - { - v153 = 2; - do - { - pButton = pDialogueWindow->GetControl(v152); - v46 = pButton->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v46] || pPlayers[uActiveCharacter]->pActiveSkills[v46] ) - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - else - { - pButton->uY = (unsigned int)((char *)pActiveButton + v146); - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v46], &dialog_window, 0, 0); - v49 = pButton->uY; - pButton->uHeight = pTextHeight; - v51 = v49 + pTextHeight - 1; - pButton->uW = v51; - v146 = v51; - pTextColor = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != v153 ) - pTextColor = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3); - } - v53 = pDialogueWindow->pStartingPosActiveItem; - ++v152; - textureH = pDialogueWindow->pNumPresenceButton + v53; - ++v153; - } - while ( v152 < textureH ); - } - return; - } - } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf.data(), 3); - return; - } - break; - } -} - -//----- (004B5D7C) -------------------------------------------------------- -void GuildDialog() -{ - signed int base_teach_price; // ebx@1 - int v3; // edi@6 - int result; // eax@11 - int v6; // esi@13 - signed int v7; // esi@17 - int v8; // esi@22 - signed int v9; // ecx@22 - char *v10; // eax@22 - const char *statusbar_string; // ecx@26 - POINT *v12; // esi@30 - int v13; // ecx@30 - void *v14; // ST1C_4@31 - ItemGen *v15; // ST18_4@31 - int v16; // ST10_4@31 - int v17; // eax@31 - char *v18; // edx@31 - int v19; // eax@32 - int pActiveItem; // esi@35 - int v22; // eax@35 - unsigned int v23; // eax@36 - int v24; // eax@39 - int v25; // eax@40 - int v26; // ecx@47 - GUIButton *pButton; // eax@49 - unsigned int v29; // eax@49 - char *pText; // eax@52 - int pTextHeight; // eax@55 - unsigned int v32; // ecx@55 - int v33; // eax@55 - unsigned __int16 pTextColor; // ax@55 - int v35; // eax@58 - const char *v36; // ST20_4@61 - unsigned __int16 v37; // ST1C_2@61 - int v38; // eax@61 - int v40; // [sp-14h] [bp-300h]@31 - int v41; // [sp-10h] [bp-2FCh]@31 - unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31 - char *v43; // [sp-8h] [bp-2F4h]@31 - unsigned int v44; // [sp-4h] [bp-2F0h]@31 - char Dest[100]; // [sp+Ch] [bp-2E0h]@3 - char v46[100]; // [sp+70h] [bp-27Ch]@3 - char v47[100]; // [sp+D4h] [bp-218h]@3 - char v48[100]; // [sp+138h] [bp-1B4h]@3 - char v49[100]; // [sp+19Ch] [bp-150h]@3 - POINT v50; // [sp+264h] [bp-88h]@30 - POINT v51; // [sp+26Ch] [bp-80h]@30 - GUIWindow working_window; // [sp+274h] [bp-78h]@1 - signed int v53; // [sp+27Ch] [bp-70h]@1 - signed int v54; // [sp+284h] [bp-68h]@1 - int pColorWhite; // [sp+2CCh] [bp-20h]@1 - int pColorYellow; // [sp+2D0h] [bp-1Ch]@1 - int v58; // [sp+2D4h] [bp-18h]@1 - unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 - bool pSkillFlag; // [sp+2DCh] [bp-10h]@35 - int v61; // [sp+2E0h] [bp-Ch]@35 - int pItemNum; - unsigned int v62; // [sp+2E4h] [bp-8h]@13 - int v63; // [sp+2E8h] [bp-4h]@1 - int pNumActivItem; - int all_text_height; - - memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); - working_window.uFrameX = 483; - working_window.uFrameWidth = 148; - working_window.uFrameZ = 334; - pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); - pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu); - base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0); - v63 = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v63 < base_teach_price / 3 ) - v63 = base_teach_price / 3; - strcpy(Dest, ""); - strcpy(v46, ""); - strcpy(v47, ""); - strcpy(v48, ""); - strcpy(v49, ""); - if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) - { - if ( dialog_menu_id != HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" - ShowStatusBarString(pTmpBuf.data(), 2); - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - } - else - { - if ( pParty->uNumGold < v63 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - } - else - { - Party::TakeGold(v63); - pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; - } - } - } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; - } - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v6 = 0; - v62 = 0; - v63 = 32; - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID) - { - pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); - } - v63 += 70; - v62 += 280; - ++v6; - } - while ( v63 < 452 ); - v62 = 1680; - v7 = 6; - v63 = 32; - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) - { - pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); - } - v63 += 70; - v62 += 280; - ++v7; - } - while ( v63 < 452 ); - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v8 = 0; - v9 = 12; - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID ) - ++v8; - --v9; - } - while ( v9 ); - GetAsyncKeyState(17); - statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy" - DrawTextAtStatusBar(statusbar_string, 0); - if ( !v8 ) - { - working_window.DrawCurrentTime(__PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472], - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) - pParty->uTimePlayed); - return; - } - v12 = pMouse->GetCursorPos(&v51); - result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; - v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; - if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) - { - v14 = window_SpeakInHouse->ptr_1C; - 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); - v18 = BuilDialogueString((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); - return; - } - } - return; - } - if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, - guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) - { //you must me member - v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3u); - pDialogueWindow->pNumPresenceButton = 0; - return; - } - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v61 = 0; - pSkillFlag = false; - pActiveItem = pDialogueWindow->pStartingPosActiveItem; - v22 = pActiveItem + pDialogueWindow->pNumPresenceButton; - pItemNum = 0; - if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); - return; - } - all_text_height = 0; - do - { - v23 = pDialogueWindow->GetControl(pActiveItem)->msg_param; - if ( v23 == 18 ) - { - all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" - v61++; - } - else - { - if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v23 - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[v23 - 36] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v23 - 36], &working_window, 0, 0); - v61++; - pSkillFlag = true; - } - } - ++pActiveItem; - } - while ( pActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - if ( !v61 ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3); - return; - } - if ( pSkillFlag ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu" - working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); - } - v58 = (149 - all_text_height) / v61; - if ( v58 > 32 ) - v58 = 32; - v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162; - pNumActivItem = pDialogueWindow->pStartingPosActiveItem; - if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) - { - pItemNum = 2; - do - { - pButton = pDialogueWindow->GetControl(pItemNum); - v29 = pButton->msg_param; - if ( v29 == 18 ) - { - pText = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells" - pButton->uY = v58 + v26; - pTextHeight = pFontArrus->CalcTextHeight(pText, &working_window, 0, 0); - v32 = pButton->uY; - pButton->uHeight = pTextHeight; - v33 = v32 + pTextHeight - 1; - pButton->uW = v33; - v26 = v33; - pTextColor = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pTextColor = pColorWhite; - working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pText, 3); - } - else - { - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36] - && !pPlayers[uActiveCharacter]->pActiveSkills[v29 - 36] ) - { - pButton->uY = v58 + v26; - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v29 - 36], &working_window, 0, 0); - v32 = pButton->uY; - pButton->uHeight = pTextHeight; - v33 = v32 + pTextHeight - 1; - pButton->uW = v33; - v26 = v33; - pTextColor = pColorYellow; - if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) - pTextColor = pColorWhite; - working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pSkillNames[v29 - 36], 3); - } - else - { - pButton->uW = 0; - pButton->uHeight = 0; - pButton->uY = 0; - } - } - ++pItemNum; - } - while ( pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - return; -} - //----- (004B705E) -------------------------------------------------------- void TempleDialog() { @@ -5425,630 +3432,6 @@ } } -//----- (004B4FCF) -------------------------------------------------------- -void MagicShopDialog() -{ - int result; // eax@6 - signed int v2; // esi@8 - unsigned int v3; // ebx@10 - char *v4; // eax@11 - char *v5; // eax@12 - unsigned int v6; // eax@12 - int v7; // ST08_4@14 - int v8; // eax@14 - unsigned __int8 v9; // dl@14 - char *v10; // ecx@14 - signed int v11; // esi@16 - int v12; // ST08_4@19 - int v13; // eax@19 - int all_text_height; // edi@21 - char **v15; // esi@21 - int v16; // eax@22 - int v18; // edx@23 - int v19; // edi@23 - unsigned __int8 v20; // sf@23 - GUIButton *control_button; // esi@25 - const char **v22; // eax@25 - int v23; // eax@25 - unsigned int v24; // ecx@25 - const char **v25; // edx@25 - unsigned __int16 text_color; // ax@25 - signed int pTextHeight; // esi@30 - int v28; // ST08_4@34 - int v29; // eax@34 - char *v30; // edx@35 - void *v32; // eax@40 - signed int v33; // esi@40 - unsigned int v34; // esi@42 - int v35; // eax@42 - unsigned int v36; // eax@43 - int v37; // eax@45 - int v38; // ecx@50 - int v41; // eax@52 - char *v42; // eax@54 - int v43; // eax@54 - unsigned int v44; // ecx@54 - int v45; // edx@54 - int v46; // eax@54 - unsigned __int16 v47; // ax@54 - int v48; // eax@58 - signed int v49; // esi@62 - Texture *v50; // ecx@64 - unsigned int v51; // edi@64 - unsigned int v52; // esi@66 - int v53; // edx@70 - Texture *v54; // ecx@76 - unsigned int v55; // edi@76 - unsigned int v56; // esi@76 - int v57; // edx@80 - unsigned int v59; // edi@86 - unsigned int v60; // esi@88 - int v61; // edx@92 - unsigned int v63; // edi@98 - unsigned int v64; // esi@100 - int v65; // edx@104 - signed int v66; // ecx@109 - SHORT v67; // di@117 - bool v68; // eax@117 - const char *v69; // ecx@119 - POINT *v70; // esi@124 - int v71; // ecx@125 - int v73; // ecx@125 - int v75; // eax@130 - int v78; // eax@132 - int v80; // edx@133 - int v81; // edi@133 - const char **v83; // eax@135 - int v84; // eax@135 - unsigned int v85; // ecx@135 - int v86; // edx@135 - int v89; // [sp-14h] [bp-10Ch]@35 - int v91; // [sp-10h] [bp-108h]@35 - unsigned __int16 v92; // [sp-Ch] [bp-104h]@12 - void *v93; // [sp-Ch] [bp-104h]@14 - int v94; // [sp-8h] [bp-100h]@11 - char *v95; // [sp-8h] [bp-100h]@12 - __int64 *v96; // [sp-4h] [bp-FCh]@11 - unsigned int v97; // [sp-4h] [bp-FCh]@12 - POINT v98; // [sp+Ch] [bp-ECh]@8 - POINT v99; // [sp+14h] [bp-E4h]@16 - POINT v100; // [sp+1Ch] [bp-DCh]@124 - POINT v101; // [sp+24h] [bp-D4h]@17 - POINT v102; // [sp+2Ch] [bp-CCh]@124 - POINT v103; // [sp+34h] [bp-C4h]@9 - POINT v104; // [sp+3Ch] [bp-BCh]@31 - POINT v105; // [sp+44h] [bp-B4h]@16 - POINT v106; // [sp+4Ch] [bp-ACh]@30 - POINT v107; // [sp+54h] [bp-A4h]@16 - POINT v108; // [sp+5Ch] [bp-9Ch]@30 - POINT a2; // [sp+64h] [bp-94h]@8 - POINT v110; // [sp+6Ch] [bp-8Ch]@30 - POINT v111; // [sp+74h] [bp-84h]@8 - GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 - char *Str; // [sp+D0h] [bp-28h]@54 - int v146; // [sp+D4h] [bp-24h]@23 - unsigned int pYellowColor; // [sp+D8h] [bp-20h]@1 - unsigned int pWhiteColor; // [sp+DCh] [bp-1Ch]@1 - __int32 v117; // [sp+E0h] [bp-18h]@8 - int v118; // [sp+E4h] [bp-14h]@40 - const char **v119; // [sp+E8h] [bp-10h]@24 - int _this; // [sp+ECh] [bp-Ch]@1 - unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14 - int v152; // [sp+F4h] [bp-4h]@23 - int v122; - int v114; - int pSrtingNum; - int pActiveItemNum; - ItemGen *item; - - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - pWhiteColor = TargetColor(255, 255, 255); - pYellowColor = TargetColor(225, 205, 35); - if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) - { - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - all_text_height = 0; - for ( int i = 0; i < 4; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v146 = (174 - all_text_height) / 4; - v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - int j = 0; - if ( pDialogueWindow->pNumPresenceButton>=0 ) - { - int th = 2; - for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) - { - control_button = pDialogueWindow->GetControl(v152); - control_button->uY = v146 + v23; - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); - control_button->uHeight = pTextHeight; - v23 = control_button->uY + control_button->uHeight - 1; - control_button->uW = v23; - text_color = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != th ) - text_color = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); - ++th; - ++j; - } - } - return; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v3 = 0; - v49 = 0; - v122 = 0; - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) - { - v50 = ItemsInShopTexture[v49]; - v51 = 152 - v50->uTextureHeight; - if ( (signed int)v51 < 1 ) - v51 = 0; - v52 = 75 * v49 - v50->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v53 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v52 > 457 - v53 ) - v52 = 457 - v53; - } - } - else - { - if ( (signed int)v52 < 18 ) - v52 = 18; - } - pRenderer->DrawTextureTransparent(v52, v51, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1); - v49 = v122; - } - ++v49; - v122 = v49; - } - while ( v49 < 6 ); - v122 = 0; - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID) - { - v54 = ItemsInShopTexture[v122 + 6]; - v55 = 306 - v54->uTextureHeight; - v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v57 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v56 > 457 - v57 ) - v56 = 457 - v57; - } - } - else - { - if ( (signed int)v56 < 18 ) - v56 = 18; - } - pRenderer->DrawTextureTransparent(v56, v55, v54); - sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7); - } - ++v122; - } - while ( v122 < 6 ); - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v66 = 0; - v117 = 0; - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - { - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v117; - ++v66; - } - while ( v66 < 12 ); - } - else - { - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) - ++v117; - ++v66; - } - while ( v66 < 12 ); - } - v67 = GetAsyncKeyState(VK_CONTROL); - v68 = pPlayers[uActiveCharacter]->CanSteal(); - Str = (char *)v68; - if ( v67 && v68 ) - { - v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item" - } - else - { - v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" - } - DrawTextAtStatusBar(v69, 0); - if ( !v117 ) - { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - v70 = pMouse->GetCursorPos(&v102); - result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; - if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) - { - v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; - item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; - if ( v67 && Str ) - v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" - else - { - v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); - v10 = (char *)pMerchantsBuyPhrases[v75]; - } - v30 = BuilDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); - return; - } - } - return; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v3 = 0; - v49 = 0; - v122 = 0; - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) - { - v59 = 152 - ItemsInShopTexture[v49]->uTextureHeight; - if ( (signed int)v59 < 1 ) - v59 = 0; - v60 = 75 * v49 - ItemsInShopTexture[v49]->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v61 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v60 > 457 - v61 ) - v60 = 457 - v61; - } - } - else - { - if ( (signed int)v60 < 18 ) - v60 = 18; - } - pRenderer->DrawTextureTransparent(v60, v59, ItemsInShopTexture[v49]); - sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1); - v49 = v122; - } - ++v49; - v122 = v49; - } - while ( v49 < 6 ); - v122 = 0; - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID) - { - v63 = 306 - ItemsInShopTexture[v122 + 6]->uTextureHeight; - if ( (signed int)v63 < 1 ) - v63 = 0; - v64 = 75 * v122 - ItemsInShopTexture[v122 + 6]->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v65 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v64 > 457 - v65 ) - v64 = 457 - v65; - } - } - else - { - if ( (signed int)v64 < 18 ) - v64 = 18; - } - pRenderer->DrawTextureTransparent(v64, v63, ItemsInShopTexture[v122 + 6]); - sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); - } - ++v122; - } - while ( v122 < 6 ); - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v66 = 0; - v117 = 0; - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - { - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v117; - ++v66; - } - while ( v66 < 12 ); - } - else - { - do - { - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) - ++v117; - ++v66; - } - while ( v66 < 12 ); - } - v67 = GetAsyncKeyState(VK_CONTROL); - v68 = pPlayers[uActiveCharacter]->CanSteal(); - Str = (char *)v68; - if ( v67 && v68 ) - { - v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item" - } - else - { - v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" - } - DrawTextAtStatusBar(v69, 0); - if ( !v117 ) - { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - v70 = pMouse->GetCursorPos(&v102); - result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; - if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) - { - v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; - item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; - if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71]; - if ( v67 && Str ) - v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" - else - { - v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2); - v10 = (char *)pMerchantsBuyPhrases[v75]; - } - v30 = BuilDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); - return; - } - } - return; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair" - all_text_height = 0; - for ( uint i = 0; i < 3; ++i ) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - _this = ((174 - all_text_height) / 3); - v81 = (3 * (58 - (signed int)_this) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v118 = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) ) - { - v122 = 2; - pSrtingNum = 0; - do - { - control_button = pDialogueWindow->GetControl(v118); - control_button->uY = (unsigned int)((char *)_this + v81); - pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0); - v85 = control_button->uY; - control_button->uHeight = pTextHeight; - v81 = pTextHeight + v85 - 1; - control_button->uW = v81; - text_color = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != v122 ) - text_color = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, v85, text_color, pShopOptions[pSrtingNum], 3); - ++v122; - ++pSrtingNum; - ++v118; - } - while ( v118 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - return; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() - || (v11 = pMouse->GetCursorPos(&v107)->x - 14, - v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5), - result = (int)pMouse->GetCursorPos(&v105), - *(int *)result <= 13) - || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) - || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) - return; - item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1]; - v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); - v30 = BuilDialogueString((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); - return; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v2 = pMouse->GetCursorPos(&a2)->x - 14; - v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5); - result = (int)pMouse->GetCursorPos(&v111); - if ( *(int *)result > 13 ) - { - result = (int)pMouse->GetCursorPos(&v103); - if ( *(int *)result < 462 ) - { - result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117); - if ( result ) - { - item = &pPlayers[uActiveCharacter]->pInventoryItems[result-1]; - if ( item->uAttributes & 1 ) - { - v5 = BuilDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101; - dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v5, 3); - return; - } - v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4); - v30 = BuilDialogueString((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); - return; - } - } - } - } - return; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() - || (pTextHeight = pMouse->GetCursorPos(&v110)->x - 14, - v117 = (pTextHeight >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5), - result = (int)pMouse->GetCursorPos(&v106), - *(int *)result <= 13) - || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) - || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) - // || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) ) - || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) ) - return; - item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1]; - v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[result - 1], BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); - v30 = BuilDialogueString((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); - return; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v3 = 0; - all_text_height = 0; - v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - v119 = (const char **)(v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100); - if ( (signed int)v119 < v33 / 3 ) - v119 = (const char **)(v33 / 3); - pActiveItemNum = pDialogueWindow->pStartingPosActiveItem; - v122 = 0; - if ( (signed int)pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// - // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." - v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3); - return; - } - do - { - v36 = pDialogueWindow->GetControl(pActiveItemNum)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v36] && !pPlayers[uActiveCharacter]->pActiveSkills[v36] ) - { - all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0); - ++v122; - } - ++pActiveItemNum; - } - while ( pActiveItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - if ( !v122 ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);// - // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf.data(), "\n \n"); - strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." - v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3); - return; - } - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u); - v119 = (const char **)((149 - all_text_height) / v122); - if ( (149 - all_text_height) / v122 > 32 ) - v119 = (const char **)32; - v38 = (149 - v122 * (signed int)v119 - all_text_height) / 2 - (signed int)v119 / 2 + 162; - v118 = 2; - if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) - { - v122 = 2; - do - { - control_button = pDialogueWindow->GetControl(v122); - v41 = control_button->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] || pPlayers[uActiveCharacter]->pActiveSkills[v41] ) - { - control_button->uW = 0; - control_button->uHeight = 0; - control_button->uY = 0; - } - else - { - control_button->uY = (unsigned int)((char *)v119 + v38); - pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); - v44 = control_button->uY; - control_button->uHeight = pTextHeight; - v38 = v44 + pTextHeight - 1; - control_button->uW = v38; - text_color = pYellowColor; - if ( pDialogueWindow->pCurrentPosActiveItem != v122 ) - text_color = pWhiteColor; - dialog_window.DrawTitleText(pFontArrus, 0, v44, text_color, pSkillNames[v41], 3); - } - ++v122; - } - while ( v122 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - } - return; - } - return; -} - - //----- (004B6478) -------------------------------------------------------- void sub_4B6478() { @@ -6256,329 +3639,344 @@ } return; } -//----- (004BC8D5) -------------------------------------------------------- -void SpellBookGenerator()//for GuildDialogs + +//----- (004B2A74) -------------------------------------------------------- +void SimpleHouseAndBoatsDialog() { - int pItemNum; // esi@1 - int v4; // esi@7 + char *v0; // esi@3 + char *v1; // ST1C_4@3 + char *v2; // eax@3 + const char *v3; // ST1C_4@5 + int v4; // eax@5 + unsigned int i; // eax@5 + NPCData *v6; // esi@6 + unsigned __int16 v7; // bx@6 + unsigned int v8; // eax@6 + int v9; // eax@11 + unsigned int v10; // ecx@12 + int v11; // eax@12 + int v12; // esi@12 + char *v13; // eax@12 + GUIWindow *v14; // ebx@13 + char *v15; // esi@14 + GUIButton *v16; // eax@15 + unsigned int v17; // ecx@15 + int v18; // ecx@17 + int v19; // ecx@18 + int v20; // ecx@19 + int v21; // ecx@20 + int v22; // ecx@21 + unsigned int v23; // ecx@23 + int v24; // ecx@35 + int v25; // ecx@36 + int v26; // ecx@37 + int v27; // ecx@38 + int v28; // ecx@39 + char *v29; // esi@42 + unsigned int v30; // ST20_4@42 + int v31; // ST1C_4@42 + unsigned int v32; // eax@42 + char *v33; // eax@43 + int v34; // esi@51 + int v35; // eax@51 + unsigned int v36; // edi@51 + GUIButton *v37; // eax@52 + int v38; // eax@52 + signed int v39; // ecx@54 + int v40; // edi@57 + GUIButton *v41; // eax@60 + GUIButton *v42; // esi@60 + const char *v43; // ebx@60 + int v44; // eax@60 + unsigned int v45; // ecx@60 + unsigned __int16 v46; // ax@60 + GUIFont *v47; // ebx@64 + int v48; // esi@64 + char *v49; // eax@66 + GUIWindow w; // [sp+Ch] [bp-110h]@64 + GUIWindow v52; // [sp+60h] [bp-BCh]@13 + GUIWindow a1; // [sp+B4h] [bp-68h]@1 + unsigned int v54; // [sp+108h] [bp-14h]@14 + int v55; // [sp+10Ch] [bp-10h]@6 + int v56; // [sp+110h] [bp-Ch]@13 + char *pInString; // [sp+114h] [bp-8h]@12 + NPCData *v58; // [sp+118h] [bp-4h]@6 - for( int i = 0; i < 12; ++i ) + memcpy(&a1, pDialogueWindow, sizeof(a1)); + if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) { - if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 ) + v0 = pMapStats->pInfos[uHouse_ExitPic].pName; + v1 = pMapStats->pInfos[uHouse_ExitPic].pName; + a1.uFrameX = 493; + a1.uFrameWidth = 126; + a1.uFrameZ = 366; + a1.DrawTitleText(pFontCreate, 0, 2u, 0, v1, 3u); + a1.uFrameX = 483; + a1.uFrameWidth = 148; + a1.uFrameZ = 334; + v2 = pTransitionStrings[uHouse_ExitPic]; + if ( !v2 ) { - if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 ) - pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345; - else - { - if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 ) - v4 = rand() % 4; - else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 ) - v4 = rand() % 3 + 4; - else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 ) - v4 = rand() % 2 + 7; - if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 ) - pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400; - } - } - if ( pItemNum == 487 ) - { - if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) - pItemNum = 486; + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], v0); + v2 = pTmpBuf.data(); } - ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; - item_spellbook->Reset(); - pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum; - pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].Identified(); - ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE); - } - return; -} -//----- (004BDB56) -------------------------------------------------------- -void __cdecl UIShop_Buy_Identify_Repair() -{ - int v8; // eax@15 - unsigned int pItemID; // esi@20 - ItemGen *item; // esi@21 - unsigned int v15; // eax@33 - POINT *pCursorPos; // esi@37 - int v18; // ecx@37 - float pPriceMultiplier; // ST1C_4@38 - int taken_item; // eax@40 - ItemGen *bought_item; // esi@51 - int party_reputation; // eax@55 - int v39; // eax@63 - int v42; // esi@74 - signed int v43; // ebx@74 - unsigned __int16 *pSkill; // esi@77 - int v55; // [sp+0h] [bp-B4h]@26 - POINT cursor; // [sp+40h] [bp-74h]@37 - int a6; // [sp+98h] [bp-1Ch]@57 - int a3; // [sp+9Ch] [bp-18h]@53 - unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 - unsigned int v79; // [sp+A8h] [bp-Ch]@9 - int uPriceItemService; // [sp+ACh] [bp-8h]@12 - - if ( pCurrentScreen == SCREEN_E ) - { - OnInventoryLeftClick(); - return; - } - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + v3 = v2; + v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0); + a1.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, v3, 3u); return; } - - switch(dialog_menu_id) + a1.uFrameWidth -= 10; + a1.uFrameZ -= 10; + v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) )];//- 1 + v6 = v58; + v55 = TargetColor(0xE1u, 0xCDu, 0x23u); + v7 = TargetColor(0x15u, 0x99u, 0xE9u); + v8 = v6->uProfession; + if ( v8 ) + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]); + else + strcpy(pTmpBuf.data(), v6->pName); + a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf.data(), 3u); + if ( !dword_591080 ) { - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - { - pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - OnInventoryLeftClick(); - break; - } - case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: - { - pCursorPos = pMouse->GetCursorPos(&cursor); - v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&cursor)->y]] & 0xFFFF; - if ( !v18 ) - return; - bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C)); - pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier); - GetAsyncKeyState(VK_CONTROL); - if ( pParty->uNumGold < uPriceItemService ) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); - return; - } - taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); - if ( taken_item ) - { - bought_item->SetIdentified(); - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[taken_item - 1], bought_item, 0x24u); - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - viewparams->bRedrawGameUI = 1; - bought_item->Reset(); - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!" - break; - } - case HOUSE_DIALOGUE_SHOP_SELL: + if ( !uDialogueType ) { - v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&cursor)->x <= 13 - || pMouse->GetCursorPos(&cursor)->x >= 462 - || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) - return; - if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItems[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) - { - dword_F8B1E4 = 1; - pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); - viewparams->bRedrawGameUI = 1; - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0); - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - break; - } - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - { - pMouse->GetCursorPos(&cursor); - v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); - if (cursor.x > 13 && cursor.x < 462) - { - pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); - if ( pItemID ) - { - uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); - item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; - if ( !(item->uAttributes & 1) ) - { - if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) - { - if ( pParty->uNumGold >= uPriceItemService ) - { - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - item->uAttributes |= 1; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2); - return; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - return; - } - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); - return; - } - } - break; - } - case HOUSE_DIALOGUE_SHOP_REPAIR: - { - v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&cursor)->x > 13 ) + v9 = v6->greet; + if ( v9 ) { - if ( pMouse->GetCursorPos(&cursor)->x < 462 ) - { - pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); - if ( pItemID ) - { - item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; - pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; - uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); - if ( item->uAttributes & 2 ) - { - if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) - { - if ( pParty->uNumGold >= uPriceItemService ) - { - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - v8 = item->uAttributes; - LOBYTE(v8) = v8 & 0xFD; - item->uAttributes = v8 | 1; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2); - return; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - return; - } - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); - return; - } - } - } - break; - } - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pCursorPos = pMouse->GetCursorPos(&cursor); - v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF; - if ( !v18 ) - return; - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; - else - bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; - uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); - uNumSeconds = 0; - a3 = 0; - if ( pMapStats->GetMapInfo(pCurrentMapName.data()) ) - a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())]._steal_perm; - party_reputation = GetPartyReputation(); - if (pPlayers[uActiveCharacter]->CanSteal()) - { - if ( GetAsyncKeyState(VK_CONTROL) ) - { - uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6); - if ( !uNumSeconds ) - { - sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); - return; - } - } + v10 = v6->uFlags; + a1.uFrameWidth = game_viewport_width; + a1.uFrameZ = 452; + pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); + v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); + v12 = v11 + 7; + pRenderer->_4A6A68(8, 352 - (v11 + 7), + pIcons_LOD->GetTexture(uTextureID_Leather), + pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7)); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); + pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); } - if ( pParty->uNumGold < uPriceItemService ) - { - if ( uNumSeconds != 2 ) - { - if ( uNumSeconds != 1 ) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" - return; - } - } - } - v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); - if ( v39 ) - { - bought_item->SetIdentified(); - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1], bought_item, sizeof(ItemGen)); - if ( pPlayers[uActiveCharacter]->CanSteal() ) - { - if ( GetAsyncKeyState(VK_CONTROL) ) - { - if ( uNumSeconds == 1 || uNumSeconds == 2 ) - { - pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1].SetStolen(); - sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); - viewparams->bRedrawGameUI = 1; - bought_item->Reset(); - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); - return; - } - } - } - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - viewparams->bRedrawGameUI = 1; - bought_item->Reset(); - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" - break; - } - default:// if click video screen in shop - { - __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum - if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) - { - v42 = dialog_menu_id - 36; - //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( uPriceItemService < v43 / 3 ) - uPriceItemService = v43 / 3; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] ) - { - pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42]; - if ( !*pSkill ) - { - if ( pParty->uNumGold < uPriceItemService ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" - if ( in_current_building_type == BildingType_Training ) - v55 = 4; - else - v55 = 2; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55); - return; - } - Party::TakeGold(uPriceItemService); - dword_F8B1E4 = 1; - *pSkill = 1; - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0); - return; - } - } - } - break; } } + v14 = pDialogueWindow; + memcpy(&v52, pDialogueWindow, sizeof(v52)); + v52.uFrameX = 483; + v52.uFrameWidth = 148; + v52.uFrameZ = 334; + v56 = v52.pStartingPosActiveItem; + if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) + { + v15 = "";//(char *)v54; + while ( 1 ) + { + v16 = v52.GetControl(v56); + v17 = v16->msg_param; + pInString = (char *)v16; + if ( (signed int)v17 > 24 ) + { + v24 = v17 - 76; + if ( !v24 ) + { + v15 = pGlobalTXT_LocalizationStrings[406]; + goto LABEL_49; + } + v25 = v24 - 1; + if ( !v25 ) + { + v15 = pGlobalTXT_LocalizationStrings[407]; + goto LABEL_49; + } + v26 = v25 - 2; + if ( !v26 ) + { + v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); +LABEL_44: + v15 = v33; +LABEL_45: + v16 = (GUIButton *)pInString; + goto LABEL_49; + } + v27 = v26 - 3; + if ( !v27 ) + { + v33 = (char *)ContractSelectText((int)v52.ptr_1C); + goto LABEL_44; + } + v28 = v27 - 1; + if ( !v28 ) + { + v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; + v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); + v31 = *(int *)v29; + v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); + sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", v32, v31, v30); + sprintfex(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); + current_npc_text = pTmpBuf2.data(); + v15 = ""; + goto LABEL_45; + } + if ( v28 != 10 ) + goto LABEL_41; + } + else + { + if ( v17 == 24 ) + { + v23 = v58->evt_F; +LABEL_33: + v15 = (char *)pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; + if ( !v15 ) + { + v16->msg_param = 0; + v15 = ""; + } + goto LABEL_49; + } + v18 = v17 - 13; + if ( v18 ) + { + v19 = v18 - 6; + if ( !v19 ) + { + v23 = v58->evt_A; + goto LABEL_33; + } + v20 = v19 - 1; + if ( !v20 ) + { + v15 = (char *)pNPCTopics[v58->evt_B-1].pTopic;//(&dword_721660)[8 * v58->evtb]; + if ( !v15 ) + { + v16->msg_param = 0; + v15 = ""; + } + if ( uDialogueType != 84 ) + goto LABEL_49; + sprintf(pTmpBuf.data(), format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); + sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); + current_npc_text = pTmpBuf2.data(); + goto LABEL_45; + } + v21 = v20 - 1; + if ( !v21 ) + { + v23 = v58->evt_C; + goto LABEL_33; + } + v22 = v21 - 1; + if ( !v22 ) + { + v23 = v58->evt_D; + goto LABEL_33; + } + if ( v22 == 1 ) + { + v23 = v58->evt_E; + goto LABEL_33; + } +LABEL_41: + v15 = ""; + goto LABEL_49; + } + v15 = pGlobalTXT_LocalizationStrings[122]; + } +LABEL_49: + strcpy(v16->pButtonName, v15); + ++v56; + if ( v56 >= v52.pStartingPosActiveItem + v52.pNumPresenceButton ) + { + v14 = pDialogueWindow; + break; + } + } + } + v34 = 0; + v54 = TargetColor(0xFFu, 0xFFu, 0xFFu); + v35 = TargetColor(0xE1u, 0xCDu, 0x23u); + v36 = v14->pStartingPosActiveItem; + v55 = v35; + for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton + + pDialogueWindow->pStartingPosActiveItem ) + { + v37 = v14->GetControl(v36); + v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); + v14 = pDialogueWindow; + v34 += v38; + ++v36; + } + v39 = v14->pNumPresenceButton; + if ( v39 ) + { + v58 = (NPCData *)((174 - v34) / v39); + if ( (signed int)v58 > 32 ) + v58 = (NPCData *)32; + pInString = (char *)2; + v40 = (174 - (signed int)v58 * v39 - v34) / 2 - (signed int)v58 / 2 + 138; + v56 = v14->pStartingPosActiveItem; + i = v56; + if ( (signed int)i < (signed int)(i + v39) ) + { + while ( 1 ) + { + v41 = v14->GetControl(i); + v42 = v41; + v43 = v41->pButtonName; + v41->uY = (unsigned int)((char *)v58 + v40); + v44 = pFontArrus->CalcTextHeight(v41->pButtonName, &v52, 0, 0); + v45 = v42->uY; + v42->uHeight = v44; + v40 = v45 + v44 - 1; + v42->uW = v40; + v46 = v55; + if ( (char *)pDialogueWindow->pCurrentPosActiveItem != pInString ) + v46 = v54; + v52.DrawTitleText(pFontArrus, 0, v45, v46, v43, 3u); + v14 = pDialogueWindow; + ++pInString; + ++v56; + i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + if ( v56 >= (signed int)i ) + break; + i = v56; + } + } + } + if ( current_npc_text ) + { + w.uFrameWidth = 458; + w.uFrameZ = 457; + v47 = pFontArrus; + v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; + if ( 352 - v48 < 8 ) + { + v47 = pFontCreate; + v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; + } + pRenderer->_4A6A68(8, 352 - v48, + pIcons_LOD->GetTexture(uTextureID_Leather), + pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); + pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); + v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); + a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); + } +} +//----- (004B4F4F) -------------------------------------------------------- +void JailDialog() +{ + const char *v0; // esi@1 + const char *v1; // ST10_4@1 + unsigned __int16 v2; // ST0C_2@1 + int v3; // eax@1 + GUIWindow v5; // [sp+8h] [bp-54h]@1 + + memcpy(&v5, window_SpeakInHouse, sizeof(v5)); + v0 = pGlobalTXT_LocalizationStrings[672]; + v1 = pGlobalTXT_LocalizationStrings[672]; + v5.uFrameX = 483; + v5.uFrameWidth = 148; + v5.uFrameZ = 334; + v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu); + v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0); + v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u); } \ No newline at end of file