annotate UI/UIShops.cpp @ 2038:d4cc4d71d9cf

Log::Warning
author Ritor1
date Fri, 22 Nov 2013 23:28:02 +0600
parents c1c74df0a33e
children 259df09dfb50
rev   line source
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1 #include "..\Items.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
2 #include "..\GUIWindow.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
3 #include "..\mm7_data.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
4 #include "..\texts.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
5 #include "UIHouses.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
6 #include "..\GUIFont.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
7 #include "..\Render.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
8 #include "..\Party.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
9 #include "..\Texture.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
10 #include "..\Mouse.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
11 #include "..\Events2D.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
12 #include "..\AudioPlayer.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
13 #include "..\MapInfo.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
14 #include "..\Viewport.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
15
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
16 //----- (004B910F) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1429
diff changeset
17 void WeaponShopDialog()
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
18 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
19 int phrases_id; // eax@16
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
20 int v19; // edi@25
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
21 GUIButton *pButton; // esi@27
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
22 unsigned int pColorText; // ax@27
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
23 signed int v32; // esi@41
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
24 const char *pText; // ecx@84
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
25 int all_text_height; // esi@96
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
26 ItemGen *item;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
27 int pItemID;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
28 POINT mouse; // [sp+64h] [bp-94h]@8
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
29 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
30 __int32 v103; // [sp+D4h] [bp-24h]@25
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
31 int pPrice; // [sp+ECh] [bp-Ch]@26
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
32 unsigned int v109;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
33 int pNumString;
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
34 int item_X;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
35
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
36 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
37 dialog_window.uFrameX = 483;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
38 dialog_window.uFrameWidth = 148;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
39 dialog_window.uFrameZ = 334;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
40
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
41 switch(dialog_menu_id)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
42 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
43 case HOUSE_DIALOGUE_MAIN:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
44 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
45 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
46 {
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
47 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]);
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
48 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]);
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
49 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]);
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
50 pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
51 all_text_height = 0;
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
52 for ( int i = 0; i < 4; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
53 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
54 v103 = (174 - all_text_height) / 4;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
55 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
56 pNumString = 0;
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
57 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
58 {
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
59 pButton = pDialogueWindow->GetControl(i);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
60 pButton->uY = v103 + v19;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
61 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
62 v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
63 pButton->uW = v19;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
64 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
65 if ( pDialogueWindow->pCurrentPosActiveItem != i )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
66 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
67 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
68 ++pNumString;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
69 }
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
70 }
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
71 break;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
72 }
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
73 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
74 {
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
75 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
76 item_X = 0;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
77 for ( uint i = 0; i < 6; ++i )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
78 {
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
79 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
80 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
81 pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
82 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + 640 * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
83 }
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
84 item_X += 70;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
85 }
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
86 if ( HouseUI_CheckIfPlayerCanInteract() )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
87 {
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
88 uint item_num = 0;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
89 for ( uint i = 0; i < 6; ++i )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
90 {
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
91 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
92 ++item_num;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
93 }
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
94 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
95 pText = pGlobalTXT_LocalizationStrings[185];//Украсть предмет
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
96 else
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
97 pText = pGlobalTXT_LocalizationStrings[195];//Выберите предмет для покупки
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
98 DrawTextAtStatusBar(pText, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
99 if ( item_num )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
100 {
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
101 pMouse->GetCursorPos(&mouse);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
102 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
103 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
104 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
105 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
106 {
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
107 pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)],
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
108 uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
109 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
110 }
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
111 else
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
112 {
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
113 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
114 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
115 }
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
116 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
117 }
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
118 else
1758
24e756a50073 DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents: 1754
diff changeset
119 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);//Приходите через 7 дней
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
120 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
121 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
122 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
123
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
124 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
125 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
126 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
127 item_X = 0;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
128 for ( uint i = 0; i < 6; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
129 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
130 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
131 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
132 pRenderer->DrawTextureTransparent((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
133 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + 640 * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
134 }
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
135 item_X += 70;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
136 }
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
137 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
138 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
139 uint item_num = 0;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
140 for ( uint i = 0; i < 6; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
141 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
142 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
143 ++item_num;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
144 }
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
145 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
146 pText = pGlobalTXT_LocalizationStrings[185];
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
147 else
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
148 pText = pGlobalTXT_LocalizationStrings[196];
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
149 DrawTextAtStatusBar(pText, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
150 if ( item_num )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
151 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
152 pMouse->GetCursorPos(&mouse);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
153 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
154 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
155 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
156 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
157 {
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
158 pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 2)],
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
159 uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
160 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
161 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
162 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
163 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
164 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
165 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
166 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
167 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
168 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
169 else
1758
24e756a50073 DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents: 1754
diff changeset
170 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
171 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
172 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
173 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
174
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
175 case HOUSE_DIALOGUE_SHOP_SELL:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
176 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
177 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
178 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
179 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
180 if ( !HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
181 return;
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
182 pMouse->GetCursorPos(&mouse);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
183 v109 = ((mouse.x + 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
184 if( mouse.x <= 13 || mouse.x >= 462 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
185 return;
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
186 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
187 if ( !pItemID )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
188 return;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
189 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
190 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
191 pText = BuildDialogueString(pMerchantsSellPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
192 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
193 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
194 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
195 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
196 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
197 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
198 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
199 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
200 if ( !HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
201 return;
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
202 pMouse->GetCursorPos(&mouse);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
203 v109 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
204 if( mouse.x <= 13 || mouse.x >= 462 )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
205 return;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
206 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
207 if ( !pItemID )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
208 return;
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
209 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
210 if (!item->IsIdentified())
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
211 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
212 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
213 pText = BuildDialogueString(pMerchantsIdentifyPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
214 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
215 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
216 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
217 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
218 pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
219 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
220 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
221 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
222 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
223
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
224 case HOUSE_DIALOGUE_SHOP_REPAIR:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
225 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
226 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
227 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
228 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
229 if ( !HouseUI_CheckIfPlayerCanInteract())
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
230 return;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
231 pMouse->GetCursorPos(&mouse);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
232 v109 = ((mouse.x - 14) >> 5) + 14 * (mouse.y - 17) >> 5;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
233 if( ( mouse.x <= 13) || mouse.x >= 462 )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
234 return;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
235 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v109);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
236 if ( !pItemID || (!(pPlayers[uActiveCharacter]->pOwnItems[pItemID - 1].uAttributes & 2)) )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
237 return;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
238 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
239 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
240 pText = BuildDialogueString(pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
241 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
242 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
243 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
244 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
245
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
246 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
247 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
248 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
249 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
250 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]);//sell
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
251 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]);//identify
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
252 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]);//repair
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
253 all_text_height = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
254 for ( int i = 0; i < 3; ++i )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
255 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
256 v103 = (174 - all_text_height) / 3;
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
257 v19 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
258 pNumString = 0;
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
259 for ( int i = pDialogueWindow->pStartingPosActiveItem; i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
260 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
261 pButton = pDialogueWindow->GetControl(i);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
262 pButton->uY = v103 + v19;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
263 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
264 v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
265 pButton->uW = v19;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
266 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
267 if ( pDialogueWindow->pCurrentPosActiveItem != i )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
268 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
269 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
270 ++pNumString;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
271 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
272 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
273 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
274
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
275 case HOUSE_DIALOGUE_LEARN_SKILLS:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
276 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
277 if (!HouseUI_CheckIfPlayerCanInteract())
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
278 return;
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
279 uint item_num = 0;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
280 all_text_height = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
281 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
282 pPrice = v32 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
283 if ( pPrice < v32 / 3 )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
284 pPrice = v32 / 3;
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
285 for ( int i = pDialogueWindow->pStartingPosActiveItem;
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
286 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
287 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
288 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36]
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
289 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
290 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
291 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
292 item_num++;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
293 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
294 }
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
295 if ( item_num )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
296 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
297 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);//Стоимость навыка: %lu
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
298 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
299 v103 = (149 - all_text_height) / item_num;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
300 if ( (149 - all_text_height) / item_num > 32 )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
301 v103 = 32;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
302 v19 = (149 - item_num * v103 - all_text_height) / 2 - v103 / 2 + 162;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
303 for ( uint i = pDialogueWindow->pStartingPosActiveItem;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
304 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
305 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
306 pButton = pDialogueWindow->GetControl(i);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
307 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
308 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
309 pButton->uW = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
310 pButton->uHeight = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
311 pButton->uY = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
312 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
313 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
314 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
315 pButton->uY = v103 + v19;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
316 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
317 v19 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
318 pButton->uW = v19;
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
319 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
320 if ( pDialogueWindow->pCurrentPosActiveItem != i )
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
321 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
322 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
323 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
324 }
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
325 break;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
326 }
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
327 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
328 strcat(pTmpBuf.data(), "\n \n");
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
329 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить.
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
330 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3);
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
331 return;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
332 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
333 default:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
334 {
1739
1776d4f033a7 WeaponShop cleared
Ritor1
parents: 1729
diff changeset
335 __debugbreak();
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
336 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
337 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
338 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
339 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
340
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
341 //----- (004BA928) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1429
diff changeset
342 void ArmorShopDialog()
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
343 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
344 int phrases_id; // eax@20
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
345 int all_text_height; // ebx@22
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
346 int v146; // [sp+E4h] [bp-20h]@24
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
347 int v23; // ebx@24
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
348 GUIButton *pButton; // eax@26
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
349 signed int v38; // esi@42
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
350 int v59; // eax@68
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
351 const char *pText; // ecx@91
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
352 ItemGen *selected_item; // ecx@99
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
353 int pNumString; // edx@109
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
354 unsigned __int16 pTextColor; // ax@109
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
355 POINT mouse; // [sp+4Ch] [bp-B8h]@97
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
356 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
357 __int32 pItemCount; // [sp+F0h] [bp-14h]@8
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
358 int item_x; // [sp+100h] [bp-4h]@44
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
359 int pPrice;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
360 unsigned int v153;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
361
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
362 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
363 dialog_window.uFrameX = 483;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
364 dialog_window.uFrameWidth = 148;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
365 dialog_window.uFrameZ = 334;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
366 switch (dialog_menu_id)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
367 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
368 case HOUSE_DIALOGUE_MAIN:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
369 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
370 if ( !HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
371 return;
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
372 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); //"Buy Standard"
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
373 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); //"Buy Special"
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
374 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); //"Display Inventory"
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
375 pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
376 all_text_height = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
377 for( int i = 0; i < 4; ++i )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
378 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
379 v146 = ( 174 - all_text_height ) / 4;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
380 v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
381 pNumString = 0;
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
382 for (int i = pDialogueWindow->pStartingPosActiveItem;
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
383 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i)
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
384 {
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
385 pButton = pDialogueWindow->GetControl(i);
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
386 pButton->uY = v146 + v23;
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
387 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
388 v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
389 pButton->uW = v23;
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
390 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u);
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
391 if ( pDialogueWindow->pCurrentPosActiveItem != i )
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
392 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
393 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3);
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
394 ++pNumString;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
395 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
396 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
397 break;
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
398
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
399 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
400 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
401 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// подложка
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
402 item_x = 0;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
403 for ( int i = 0; i < 8; ++i )// разместить вещи
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
404 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
405 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
406 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
407 if ( i >= 4 ) //low row
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
408 {
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
409 pRenderer->DrawTextureTransparent((90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x - 420, 126, ItemsInShopTexture[i]);
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
410 v59 = (90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 80220;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
411 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
412 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
413 {
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
414 pRenderer->DrawTextureTransparent(( 86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]);
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
415 v59 = item_x + (86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
416 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
417 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
418 }
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
419 item_x += 105;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
420 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
421 if ( !HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
422 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
423 pItemCount = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
424 for ( int i = 0; i < 8; ++i )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
425 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
426 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
427 ++pItemCount;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
428 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
429 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
430 pText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
431 else
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
432 pText = pGlobalTXT_LocalizationStrings[185];//"Steal item"
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
433 DrawTextAtStatusBar(pText, 0);
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
434 if ( pItemCount )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
435 {
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
436 pMouse->GetCursorPos(&mouse);
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
437 if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
438 return;
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
439 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
440 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal())
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
441 {
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
442 pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)],
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
443 uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
444 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
445 }
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
446 else
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
447 {
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
448 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); //"Steal %24"
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
449 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
450 }
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
451 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
452 }
1758
24e756a50073 DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents: 1754
diff changeset
453 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
454 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
455 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
456 break;
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
457
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
458 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
459 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
460 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
461 item_x = 0;
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
462 for ( int i = 0; i < 8; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
463 {
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
464 if ( pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
465 {
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
466 if ( i >= 4 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
467 {
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
468 pRenderer->DrawTextureTransparent(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
469 v59 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
470 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
471 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
472 {
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
473 pRenderer->DrawTextureTransparent(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
474 v59 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 640 * (98 - ItemsInShopTexture[i]->uTextureHeight);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
475 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
476 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
477 }
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
478 item_x += 105;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
479 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
480 if ( !HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
481 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
482 pItemCount = 0;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
483 for ( uint i = 0; i < 6; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
484 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
485 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
486 ++pItemCount;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
487 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
488 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() )
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
489 pText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
490 else
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
491 pText = pGlobalTXT_LocalizationStrings[185];
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
492 DrawTextAtStatusBar(pText, 0);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
493 if ( pItemCount )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
494 {
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
495 pMouse->GetCursorPos(&mouse);
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
496 if ( !(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
497 return;
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
498 pItemCount = (pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
499 if ( dialog_menu_id == 2 )
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
500 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
501 else
1741
4b0e19d91505 ArmorShop cleaning(continue)
Ritor1
parents: 1739
diff changeset
502 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
503 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
504 {
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
505 pText = BuildDialogueString(pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2)],
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
506 uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
507 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
508 }
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
509 else
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
510 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
511 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);//"Steal %24"
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
512 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
513 }
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
514 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
515 }
1758
24e756a50073 DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents: 1754
diff changeset
516 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
517 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
518 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
519 break;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
520
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
521 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
522 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
523 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
524 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
525 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]); //"Sell"
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
526 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]); //"Identify"
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
527 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]); //"Repair"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
528 all_text_height = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
529 for ( int i = 0; i < 3; ++i )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
530 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
531 v146 = (174 - all_text_height) / 3;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
532 v23 = (3 * (58 - v146) - all_text_height) / 2 - v146 / 2 + 138;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
533 pNumString = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
534 for ( int i = pDialogueWindow->pStartingPosActiveItem;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
535 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
536 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
537 pButton = pDialogueWindow->GetControl(i);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
538 pButton->uY = v146 + v23;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
539 pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
540 v23 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
541 pButton->uW = v23;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
542 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
543 if ( pDialogueWindow->pCurrentPosActiveItem != i )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
544 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
545 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
546 ++pNumString;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
547 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
548 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
549 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
550 break;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
551
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
552 case HOUSE_DIALOGUE_SHOP_SELL:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
553 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
554 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
555 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
556 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell"
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
557 if ( !HouseUI_CheckIfPlayerCanInteract())
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
558 return;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
559 pMouse->GetCursorPos(&mouse);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
560 v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
561 if ( mouse.x <= 13 || mouse.x >= 462 )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
562 return;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
563 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
564 return;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
565 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1];
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
566 pText = BuildDialogueString(pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop, window_SpeakInHouse->par1C, 3)],
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
567 uActiveCharacter - 1, selected_item, (char *) window_SpeakInHouse->par1C, 3, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
568 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
569 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
570 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
571 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
572 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
573 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
574 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
575 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
576 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify"
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
577 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
578 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
579 pMouse->GetCursorPos(&mouse);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
580 v153 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
581 if ( mouse.x > 13 && mouse.x < 462 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
582 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
583 if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
584 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
585 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153)-1];
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
586 if (selected_item->IsIdentified())
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
587 pText = BuildDialogueString("%24", uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
588 else
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
589 pText = BuildDialogueString(pMerchantsIdentifyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BuildingType_ArmorShop,
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
590 (int)window_SpeakInHouse->ptr_1C, 4)], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
591 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
592 return;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
593 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
594 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
595 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
596 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
597 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
598 case HOUSE_DIALOGUE_SHOP_REPAIR:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
599 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
600 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
601 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
602 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
603 if ( !HouseUI_CheckIfPlayerCanInteract())
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
604 return;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
605 pMouse->GetCursorPos(&mouse);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
606 v153 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
607 if( mouse.x <= 13 || mouse.x >= 462 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
608 return;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
609 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153)
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
610 || (!(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1].uAttributes& 2)) )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
611 return;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
612 selected_item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1];
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
613 phrases_id = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v153) - 1],
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
614 BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
615 pText = BuildDialogueString(pMerchantsRepairPhrases[phrases_id], uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
616 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
617 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
618 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
619 break;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
620
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
621 case HOUSE_DIALOGUE_LEARN_SKILLS:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
622 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
623 if (!HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
624 return;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
625 uint item_num = 0;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
626 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
627 pPrice = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
628 if ( (signed int)pPrice < v38 / 3 )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
629 pPrice = v38 / 3;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
630 all_text_height = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
631 for ( int i = pDialogueWindow->pStartingPosActiveItem;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
632 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
633 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
634 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36]
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
635 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
636 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
637 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
638 item_num ++;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
639 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
640 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
641 if ( item_num )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
642 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
643 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
644 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
645 v146 = (149 - all_text_height) / item_num;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
646 if ( (149 - all_text_height) / item_num > 32 )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
647 v146 = 32;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
648 v23 = (149 - v146 * item_num - all_text_height) / 2 - v146 / 2 + 162;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
649 for ( int i = pDialogueWindow->pStartingPosActiveItem;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
650 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
651 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
652 pButton = pDialogueWindow->GetControl(i);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
653 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36]
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
654 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
655 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
656 pButton->uW = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
657 pButton->uHeight = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
658 pButton->uY = 0;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
659 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
660 else
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
661 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
662 pButton->uY = v146 + v23;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
663 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
664 v23 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
665 pButton->uW = v23;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
666 pTextColor = TargetColor(0xE1u, 0xCDu, 0x23u);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
667 if ( pDialogueWindow->pCurrentPosActiveItem != i )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
668 pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
669 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
670 }
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
671 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
672 return;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
673 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
674 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
675 strcat(pTmpBuf.data(), "\n \n");
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
676 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
677 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
678 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
679 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
680 break;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
681 default:
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
682 __debugbreak();
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
683 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
684 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
685 //----- (004B9CC6) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1429
diff changeset
686 void AlchemistDialog()
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
687 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
688 int index; // eax@7
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
689 signed int v5; // esi@9
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
690 int v18; // eax@23
1838
211dfe2d8db1 changing global char* vars to const char* vars
Grumpy7
parents: 1827
diff changeset
691 const char *pText; // edx@29
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
692 unsigned int product_height_1row; // edi@55
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
693 unsigned int product_width_1row; // esi@57
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
694 unsigned int product_height_2row; // edi@67
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
695 unsigned int product_width_2row; // esi@69
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
696 ItemGen *item; // esi@118
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
697 int v71; // eax@123
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
698 int all_text_height; // edi@125
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
699 GUIButton *pButton; // esi@129
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
700 unsigned int pColorText; // ax@129
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
701 POINT mouse; // [sp+2Ch] [bp-ACh]@117
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
702 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
703 int v105; // [sp+B0h] [bp-28h]@19
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
704 int pNumString; // [sp+C8h] [bp-10h]@9
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
705 int item_num; // [sp+D4h] [bp-4h]@11
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
706 int pPrice;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
707
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
708 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
709 dialog_window.uFrameX = 483;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
710 dialog_window.uFrameWidth = 148;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
711 dialog_window.uFrameZ = 334;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
712 switch(dialog_menu_id)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
713 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
714 case HOUSE_DIALOGUE_MAIN:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
715 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
716 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
717 {
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
718 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]);
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
719 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]);
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
720 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]);
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
721 pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
722 all_text_height = 0;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
723 for ( int i = 0; i < 4; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
724 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
725 v18 = (174 - all_text_height) / 4;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
726 v105 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
727 pNumString = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
728 for ( int i = pDialogueWindow->pStartingPosActiveItem;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
729 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
730 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
731 pButton = pDialogueWindow->GetControl(i);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
732 pButton->uY = v18 + v105;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
733 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
734 v105 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
735 pButton->uW = v105;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
736 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
737 if ( pDialogueWindow->pCurrentPosActiveItem != i )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
738 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
739 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
740 ++pNumString;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
741 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
742 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
743 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
744 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
745
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
746 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
747 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
748 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
749 for ( uint i = 0; i < 6; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
750 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
751 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
752 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
753 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
754 if ( (signed int)product_height_1row < 1 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
755 product_height_1row = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
756 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
757 if ( i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
758 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
759 if ( i == 5 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
760 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
761 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
762 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
763 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
764 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
765 else if ( (signed int)product_width_1row < 18 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
766 product_width_1row = 18;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
767 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
768 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
769 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
770 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
771 for ( uint i = 0; i < 6; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
772 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
773 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
774 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
775 product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
776 if ( (signed int)product_height_2row < 1 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
777 product_height_2row = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
778 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
779 if ( i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
780 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
781 if ( i == 5 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
782 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
783 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
784 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
785 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
786 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
787 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
788 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
789 if ( (signed int)product_width_2row < 18 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
790 product_width_2row = 18;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
791 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
792 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
793 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
794 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
795 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
796 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
797 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
798 item_num = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
799 for ( uint i = 0; i < 12; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
800 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
801 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
802 ++item_num;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
803 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
804 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
805 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
806 else
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
807 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
808 if ( !item_num )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
809 {
1758
24e756a50073 DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents: 1754
diff changeset
810 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
811 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
812 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
813 pMouse->GetCursorPos(&mouse);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
814 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
815 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
816 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
817 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
818 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
819 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
820 pText = BuildDialogueString(pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
821 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
822 else
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
823 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
824 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
825 return ;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
826 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
827 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
828 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
829 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
830
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
831 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
832 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
833 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
834 for ( uint i = 0; i < 6; ++i )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
835 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
836 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
837 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
838 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
839 if ( (signed int)product_height_1row < 1 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
840 product_height_1row = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
841 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
842 if ( i )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
843 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
844 if ( i == 5 )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
845 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
846 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
847 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
848 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
849 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
850 else
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
851 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
852 if ( (signed int)product_width_1row < 18 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
853 product_width_1row = 18;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
854 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
855 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
856 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
857 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
858 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
859 for ( uint i = 0; i < 6; ++i )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
860 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
861 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
862 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
863 product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
864 if ( (signed int)product_height_2row < 1 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
865 product_height_2row = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
866 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
867 if ( i )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
868 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
869 if ( i == 5 )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
870 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
871 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
872 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
873 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
874 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
875 else
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
876 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
877 if ( (signed int)product_width_2row < 18 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
878 product_width_2row = 18;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
879 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
880 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
881 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
882 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
883 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
884 if ( HouseUI_CheckIfPlayerCanInteract() )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
885 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
886 item_num = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
887 for ( uint i = 0; i < 12; ++i )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
888 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
889 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
890 ++item_num;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
891 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
892 if ( GetAsyncKeyState(17) && pPlayers[uActiveCharacter]->CanSteal() )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
893 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
894 else
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
895 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
896 if ( !item_num )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
897 {
1758
24e756a50073 DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents: 1754
diff changeset
898 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
899 return;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
900 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
901 pMouse->GetCursorPos(&mouse);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
902 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
903 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
904 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
905 if ( !GetAsyncKeyState(17) || !pPlayers[uActiveCharacter]->CanSteal() )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
906 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
907 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
908 pText = BuildDialogueString(pMerchantsBuyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
909 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
910 else
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
911 pText = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
912 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
913 return;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
914 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
915 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
916 return;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
917 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
918
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
919 case HOUSE_DIALOGUE_SHOP_SELL:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
920 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
921 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
922 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
923 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
924 if ( !HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
925 return;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
926 pMouse->GetCursorPos(&mouse);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
927 index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
928 if ( mouse.x <= 13 || mouse.x >= 462 )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
929 return;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
930 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
931 return;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
932 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1],
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
933 BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
934 pText = BuildDialogueString(pMerchantsSellPhrases[v71], uActiveCharacter - 1, &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1],
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
935 (char *)window_SpeakInHouse->ptr_1C, 3, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
936 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
937 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
938 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
939
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
940 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
941 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
942 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
943 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
944 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
945 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
946 return;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
947 pMouse->GetCursorPos(&mouse);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
948 index = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
949 if ( mouse.x <= 13 || mouse.x >= 462 )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
950 return;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
951 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
952 return;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
953 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&index) - 1];
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
954 if (!item->IsIdentified())
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
955 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
956 v71 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
957 pText = BuildDialogueString(pMerchantsIdentifyPhrases[v71], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
958 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
959 else
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
960 pText = BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
961 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pText, &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xFFu, 0xFFu, 0xFFu), pText, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
962 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
963 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
964
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
965 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
966 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
967 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
968 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
969 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]);
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
970 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
971 all_text_height = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
972 for ( int i = 0; i < 2; ++i )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
973 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
974 v18 = (174 - all_text_height) / 2;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
975 v105 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
976 pNumString = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
977 for ( int i = pDialogueWindow->pStartingPosActiveItem;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
978 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
979 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
980 pButton = pDialogueWindow->GetControl(i);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
981 pButton->uY = v18 + v105;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
982 pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
983 v105 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
984 pButton->uW = v105;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
985 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
986 if ( pDialogueWindow->pCurrentPosActiveItem != i )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
987 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
988 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
989 ++pNumString;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
990 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
991 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
992 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
993
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
994 case HOUSE_DIALOGUE_LEARN_SKILLS:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
995 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
996 if (!HouseUI_CheckIfPlayerCanInteract())
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
997 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
998 all_text_height = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
999 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1000 pPrice = v5 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1001 if ( pPrice < v5 / 3 )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1002 pPrice = v5 / 3;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1003 item_num = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1004 for ( int i = pDialogueWindow->pStartingPosActiveItem;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1005 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1006 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1007 pButton = pDialogueWindow->GetControl(i);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1008 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36]
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1009 && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1010 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1011 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1012 ++item_num;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1013 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1014 }
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1015 if ( !item_num )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1016 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1017 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1018 strcat(pTmpBuf.data(), "\n \n");
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1019 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1020 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(0xE1u, 0xCDu, 0x23u), pTmpBuf.data(), 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1021 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1022 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1023 if ( item_num )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1024 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1025 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1026 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1027 v18 = (149 - all_text_height) / item_num;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1028 if ( (149 - all_text_height) / item_num > 32 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1029 v18 = 32;
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1030 v105 = (149 - item_num * v18 - all_text_height) / 2 - v18 / 2 + 162;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1031 for ( int i = pDialogueWindow->pStartingPosActiveItem;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1032 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; i++ )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1033 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1034 pButton = pDialogueWindow->GetControl(i);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1035 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36]
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1036 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1037 {
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1038 pButton->uW = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1039 pButton->uHeight = 0;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1040 pButton->uY = 0;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1041 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1042 else
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1043 {
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1044 pButton->uY = v18 + v105;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1045 pButton->uHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1046 v105 = pButton->uY + pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0) - 1;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1047 pButton->uW = v105;
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1048 pColorText = TargetColor(0xE1u, 0xCDu, 0x23u);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1049 if ( pDialogueWindow->pCurrentPosActiveItem != i )
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1050 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1051 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3);
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1052 }
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1053 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1054 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1055 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1056 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1057 default:
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1058 __debugbreak();
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1059 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1060 }
1746
f305a00a6d98 AlchemistDialog() cleared
Ritor1
parents: 1741
diff changeset
1061
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1062 //----- (004B4FCF) --------------------------------------------------------
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1063 void MagicShopDialog()
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1064 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1065 int all_text_height; // edi@21
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1066 GUIButton *control_button; // esi@25
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1067 int v23; // eax@25
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1068 unsigned __int16 text_color; // ax@25
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1069 char *v30; // edx@35
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1070 signed int v33; // esi@40
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1071 unsigned int product_height_1row; // edi@64
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1072 unsigned int product_width_1row; // esi@66
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1073 unsigned int product_height_2row; // edi@76
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1074 unsigned int product_width_2row; // esi@76
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1075 int v75; // eax@130
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1076 POINT mouse; // [sp+6Ch] [bp-8Ch]@30
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1077 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1078 int item_num; // [sp+E0h] [bp-18h]@8
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1079 int v117; // [sp+E4h] [bp-14h]@40
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1080 int pPrice; // [sp+E8h] [bp-10h]@24
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1081 int one_string; // [sp+ECh] [bp-Ch]@1
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1082 int pSrtingNum;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1083 ItemGen *item;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1084
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1085 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1086 dialog_window.uFrameX = 483;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1087 dialog_window.uFrameWidth = 148;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1088 dialog_window.uFrameZ = 334;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1089 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1090 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
1091 if ( !HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1092 return;
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1093 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[134]); //"Buy Standard"
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1094 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[152]); //"Buy Special"
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1095 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[159]); //"Display Inventory"
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1096 pShopOptions[3] = const_cast<char *>(pGlobalTXT_LocalizationStrings[160]);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1097 all_text_height = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1098 for ( int i = 0; i < 4; ++i )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1099 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1100 one_string = (174 - all_text_height) / 4;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1101 v23 = (174 - 4 * one_string - all_text_height) / 2 - one_string / 2 + 138;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1102 int pNumString = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1103 for (int i = pDialogueWindow->pStartingPosActiveItem;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1104 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i)
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1105 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1106 control_button = pDialogueWindow->GetControl(i);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1107 control_button->uY = one_string + v23;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1108 control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1109 v23 = control_button->uY + control_button->uHeight - 1;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1110 control_button->uW = v23;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1111 text_color = TargetColor(225, 205, 35);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1112 if ( pDialogueWindow->pCurrentPosActiveItem != i )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1113 text_color = TargetColor(255, 255, 255);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1114 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pNumString], 3);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1115 ++pNumString;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1116 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1117 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1118 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1119
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1120 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1121 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1122 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1123 for ( uint i = 0; i < 6; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1124 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1125 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1126 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1127 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1128 if ( (signed int)product_height_1row < 1 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1129 product_height_1row = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1130 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1131 if ( i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1132 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1133 if ( i == 5 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1134 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1135 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1136 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1137 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1138 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1139 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1140 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1141 if ( (signed int)product_width_1row < 18 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1142 product_width_1row = 18;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1143 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1144 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1145 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1146 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1147 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1148 for ( uint i = 0; i < 6; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1149 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1150 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID)
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1151 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1152 product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1153 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1154 if ( i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1155 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1156 if ( i == 5 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1157 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1158 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1159 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1160 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1161 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1162 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1163 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1164 if ( (signed int)product_width_2row < 18 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1165 product_width_2row = 18;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1166 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1167 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1168 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1169 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1170 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
1171 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1172 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1173 item_num = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1174 for ( uint i = 0; i < 12; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1175 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1176 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1177 ++item_num;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1178 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1179 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1180 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1181 else
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1182 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);// "Select the Item to Buy"
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1183 if ( !item_num )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1184 {
1758
24e756a50073 DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents: 1754
diff changeset
1185 dialog_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1186 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1187 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1188 pMouse->GetCursorPos(&mouse);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1189 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1190 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1191 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1192 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1193 v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1194 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1195 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
1196 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1197 v30 = BuildDialogueString(pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1198 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1199 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1200 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1201 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1202 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1203 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1204 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1205
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1206 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1207 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1208 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1209 for ( uint i = 0; i < 6; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1210 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1211 if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1212 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1213 product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1214 if ( (signed int)product_height_1row < 1 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1215 product_height_1row = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1216 product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1217 if ( i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1218 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1219 if ( i == 5 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1220 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1221 if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1222 product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1223 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1224 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1225 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1226 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1227 if ( (signed int)product_width_1row < 18 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1228 product_width_1row = 18;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1229 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1230 pRenderer->DrawTextureTransparent(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1231 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + 640 * product_height_1row], ItemsInShopTexture[i], i + 1);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1232 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1233 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1234 for ( uint i = 0; i < 6; ++i )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1235 {
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1236 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID)
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1237 {
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1238 product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1239 if ( (signed int)product_height_2row < 1 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1240 product_height_2row = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1241 product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1242 if ( i )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1243 {
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1244 if ( i == 5 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1245 {
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1246 if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1247 product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1248 }
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1249 }
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1250 else
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1251 {
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1252 if ( (signed int)product_width_2row < 18 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1253 product_width_2row = 18;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1254 }
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1255 pRenderer->DrawTextureTransparent(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1256 ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + 640 * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1257 }
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1258 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
1259 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1260 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1261 item_num = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1262 for ( uint i = 0; i < 12; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1263 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1264 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1265 ++item_num;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1266 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1267 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1268 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[185], 0);// "Steal item"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1269 else
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1270 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[196], 0);// "Select the Special Item to Buy"
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1271 if ( !item_num )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1272 {
1758
24e756a50073 DrawBuff_remaind_time_string and DrawShops_next_generation_time_string fix and cleared
Ritor1
parents: 1754
diff changeset
1273 dialog_window.DrawShops_next_generation_time_string( pParty->PartyTimes.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1274 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1275 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1276 pMouse->GetCursorPos(&mouse);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1277 if ( pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1278 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1279 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][(pRenderer->pActiveZBuffer[mouse.x + pSRZBufferLineOffsets[mouse.y]] & 0xFFFF) - 1];
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1280 if ( GetAsyncKeyState(VK_CONTROL) && pPlayers[uActiveCharacter]->CanSteal() )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1281 v30 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);// "Steal %24"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1282 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1283 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
1284 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1285 v30 = BuildDialogueString(pMerchantsBuyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1286 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1287 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1288 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1289 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1290 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1291 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1292 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1293
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1294 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1295 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1296 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1297 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1298 pShopOptions[0] = const_cast<char *>(pGlobalTXT_LocalizationStrings[200]);// "Sell"
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1299 pShopOptions[1] = const_cast<char *>(pGlobalTXT_LocalizationStrings[113]);// "Identify"
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1300 pShopOptions[2] = const_cast<char *>(pGlobalTXT_LocalizationStrings[179]);// "Repair"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1301 all_text_height = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1302 for ( uint i = 0; i < 3; ++i )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1303 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1304 one_string = ((174 - all_text_height) / 3);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1305 v23 = (3 * (58 - (signed int)one_string) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1306 pSrtingNum = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1307 for ( int i = pDialogueWindow->pStartingPosActiveItem;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1308 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1309 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1310 control_button = pDialogueWindow->GetControl(i);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1311 control_button->uY = one_string + v23;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1312 control_button->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1313 v23 = control_button->uHeight + control_button->uY - 1;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1314 control_button->uW = v23;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1315 text_color = TargetColor(225, 205, 35);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1316 if ( pDialogueWindow->pCurrentPosActiveItem != i )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1317 text_color = TargetColor(255, 255, 255);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1318 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[pSrtingNum], 3);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1319 ++pSrtingNum;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1320 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1321 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1322 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1323
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1324 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1325 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1326 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1327 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1328 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell"
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1329 if ( !HouseUI_CheckIfPlayerCanInteract() )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1330 return;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1331 pMouse->GetCursorPos(&mouse);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1332 v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1333 if ( mouse.x <= 13 || mouse.x >= 462 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1334 return;
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1335 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1336 return;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1337 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1];
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1338 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1339 v30 = BuildDialogueString(pMerchantsSellPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1340 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1341 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1342 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1343
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1344 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1345 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1346 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1347 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1348 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify"
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
1349 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1350 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1351 pMouse->GetCursorPos(&mouse);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1352 v117 = ((mouse.x -14) >> 5) + 14 * ((mouse.y - 17) >> 5);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1353 if ( mouse.x > 13 && mouse.x < 462 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1354 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1355 if ( pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1356 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1357 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1];
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1358 if ( item->uAttributes & 1 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1359 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1360 dialog_window.DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), &dialog_window, 0, 0)) / 2 + 101,
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1361 TargetColor(255, 255, 255), BuildDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0), 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1362 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1363 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1364 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1365 v30 = BuildDialogueString(pMerchantsIdentifyPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1366 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1367 return;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1368 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1369 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1370 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1371 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1372 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1373
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1374 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1375 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1376 draw_leather();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1377 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1378 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair"
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1379 if ( !HouseUI_CheckIfPlayerCanInteract() )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1380 return;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1381 pMouse->GetCursorPos(&mouse);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1382 v117 = ((mouse.x - 14) >> 5) + 14 * ((mouse.y - 17) >> 5);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1383 if ( mouse.x <= 13 || mouse.x >= 462 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1384 return;
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1385 if ( !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117)
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1386 || !(pPlayers[uActiveCharacter]->pOwnItems[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117)-1].uAttributes& 2) )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1387 return;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1388 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1];
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1389 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117) - 1],
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1390 BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1838
diff changeset
1391 v30 = BuildDialogueString(pMerchantsRepairPhrases[v75], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1392 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138, TargetColor(255, 255, 255), v30, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1393 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1394 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1395
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1396 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1397 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
1398 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1399 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1400 all_text_height = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1401 v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1402 pPrice = v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1403 if ( pPrice < v33 / 3 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1404 pPrice = v33 / 3;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1405 item_num = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1406 for ( int i = pDialogueWindow->pStartingPosActiveItem;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1407 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1408 {
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1409 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36]
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1410 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1411 {
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1412 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &dialog_window, 0, 0);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1413 ++item_num;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1414 }
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1415 }
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1416 if ( !item_num )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1417 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1418 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1419 // "Seek knowledge elsewhere %s the %s"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1420 strcat(pTmpBuf.data(), "\n \n");
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1421 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1422 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, TargetColor(225, 205, 35), pTmpBuf.data(), 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1423 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1424 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1425 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice);// "Skill Cost: %lu"
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1426 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1427 one_string = (149 - all_text_height) / item_num;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1428 if ( one_string > 32 )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1429 one_string = 32;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1430 v23 = (149 - item_num * one_string - all_text_height) / 2 - one_string / 2 + 162;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1431 for ( int i = pDialogueWindow->pStartingPosActiveItem;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1432 i < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++i)
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1433 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1434 control_button = pDialogueWindow->GetControl(i);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1435 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][control_button->msg_param - 36]
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1436 || pPlayers[uActiveCharacter]->pActiveSkills[control_button->msg_param - 36] )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1437 {
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1438 control_button->uW = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1439 control_button->uHeight = 0;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1440 control_button->uY = 0;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1441 }
1752
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1442 else
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1443 {
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1444 control_button->uY = one_string + v23;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1445 control_button->uHeight = pFontArrus->CalcTextHeight(pSkillNames[control_button->msg_param - 36], &dialog_window, 0, 0);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1446 v23 = control_button->uY + control_button->uHeight - 1;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1447 control_button->uW = v23;
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1448 text_color = TargetColor(225, 205, 35);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1449 if ( pDialogueWindow->pCurrentPosActiveItem != i )
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1450 text_color = TargetColor(255, 255, 255);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1451 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pSkillNames[control_button->msg_param - 36], 3);
07c7f446a929 MagicShop cleared
Ritor1
parents: 1746
diff changeset
1452 }
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1453 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1454 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1455 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1456 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1457 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1458 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1459 //----- (004BDB56) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1429
diff changeset
1460 void UIShop_Buy_Identify_Repair()
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1461 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1462 int v8; // eax@15
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1463 unsigned int pItemID; // esi@20
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1464 ItemGen *item; // esi@21
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1465 unsigned int v15; // eax@33
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1466 POINT *pCursorPos; // esi@37
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1467 int v18; // ecx@37
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1468 float pPriceMultiplier; // ST1C_4@38
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1469 int taken_item; // eax@40
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1470 ItemGen *bought_item; // esi@51
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1471 int party_reputation; // eax@55
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1472 int v39; // eax@63
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1473 int v42; // esi@74
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1474 signed int v43; // ebx@74
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1475 unsigned __int16 *pSkill; // esi@77
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1476 int v55; // [sp+0h] [bp-B4h]@26
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1477 POINT cursor; // [sp+40h] [bp-74h]@37
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1478 int a6; // [sp+98h] [bp-1Ch]@57
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1479 int a3; // [sp+9Ch] [bp-18h]@53
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1480 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1481 unsigned int v79; // [sp+A8h] [bp-Ch]@9
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1482 int uPriceItemService; // [sp+ACh] [bp-8h]@12
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1483
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1484 if ( pCurrentScreen == SCREEN_E )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1485 {
1683
96d567a7d15f moving OnInventoryLeftClick to Player::
Grumpy7
parents: 1567
diff changeset
1486 pPlayers[uActiveCharacter]->OnInventoryLeftClick();
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1487 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1488 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1384
diff changeset
1489 if ( !HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1490 {
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1491 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1492 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1493 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1494
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1495 switch(dialog_menu_id)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1496 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1497 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1498 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1499 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
1683
96d567a7d15f moving OnInventoryLeftClick to Player::
Grumpy7
parents: 1567
diff changeset
1500 pPlayers[uActiveCharacter]->OnInventoryLeftClick();
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1501 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1502 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1503 case HOUSE_DIALOGUE_GUILD_BUY_BOOKS:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1504 {
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1505 pMouse->GetCursorPos(&cursor);
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1506 v18 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1507 if ( !v18 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1508 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1509 bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C));
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1510 pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1511 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1512 GetAsyncKeyState(VK_CONTROL);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1513 if ( pParty->uNumGold < uPriceItemService )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1514 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1515 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1516 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1517 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1518 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1519 taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1520 if ( taken_item )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1521 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1522 bought_item->SetIdentified();
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1300
diff changeset
1523 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[taken_item - 1], bought_item, 0x24u);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1524 dword_F8B1E4 = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1525 Party::TakeGold(uPriceItemService);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1526 viewparams->bRedrawGameUI = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1527 bought_item->Reset();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1528 pRenderer->ClearZBuffer(0, 479);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1529 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1530 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1531 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1532 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1533 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1534 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1535 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1536 case HOUSE_DIALOGUE_SHOP_SELL:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1537 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1538 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1539 if ( pMouse->GetCursorPos(&cursor)->x <= 13
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1540 || pMouse->GetCursorPos(&cursor)->x >= 462
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1541 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1542 return;
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1300
diff changeset
1543 if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1], (int)window_SpeakInHouse->ptr_1C) )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1544 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1545 dword_F8B1E4 = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1546 pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1547 viewparams->bRedrawGameUI = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1548 pRenderer->ClearZBuffer(0, 479);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1549 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1550 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1551 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1552 pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0);
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1553 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1554 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1555 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1556 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1557 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1558 pMouse->GetCursorPos(&cursor);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1559 v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1560 if (cursor.x > 13 && cursor.x < 462)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1561 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1562 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1563 if ( pItemID )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1564 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1565 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1300
diff changeset
1566 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1567 if ( !(item->uAttributes & 1) )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1568 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1569 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1570 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1571 if ( pParty->uNumGold >= uPriceItemService )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1572 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1573 dword_F8B1E4 = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1574 Party::TakeGold(uPriceItemService);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1575 item->uAttributes |= 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1576 pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1577 ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1578 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1579 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1580 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1581 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1582 }
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1583 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1584 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1585 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1586 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1587 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1588 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1589 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1590 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1591 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1592 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1593 case HOUSE_DIALOGUE_SHOP_REPAIR:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1594 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1595 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1596 if ( pMouse->GetCursorPos(&cursor)->x > 13 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1597 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1598 if ( pMouse->GetCursorPos(&cursor)->x < 462 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1599 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1600 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1601 if ( pItemID )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1602 {
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1300
diff changeset
1603 item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1604 pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1843
diff changeset
1605 ItemGen* _v = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1606 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1607 if ( item->uAttributes & 2 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1608 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1609 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1610 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1611 if ( pParty->uNumGold >= uPriceItemService )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1612 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1613 dword_F8B1E4 = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1614 Party::TakeGold(uPriceItemService);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1615 v8 = item->uAttributes;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1616 LOBYTE(v8) = v8 & 0xFD;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1617 item->uAttributes = v8 | 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1618 pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1619 ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1620 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1621 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1622 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1623 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1624 }
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1625 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1626 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1627 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1628 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1629 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1630 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1631 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1632 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1633 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1634 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1635 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1636 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1637 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1638 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1639 pCursorPos = pMouse->GetCursorPos(&cursor);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1640 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1641 if ( !v18 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1642 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1643 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1644 bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1645 else
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1646 bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1647 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1648 uNumSeconds = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1649 a3 = 0;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1466
diff changeset
1650 if ( pMapStats->GetMapInfo(pCurrentMapName) )
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1466
diff changeset
1651 a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm;
1827
0c75c3e7e436 cleaned up part of party.cpp, renamed byte_AE3368 to playerAlreadyPicked + 3 vars after it, moved them to party.cpp, some player.cpp bugfixes
Grumpy7
parents: 1758
diff changeset
1652 party_reputation = pParty->GetPartyReputation();
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1653 if (pPlayers[uActiveCharacter]->CanSteal())
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1654 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1655 if ( GetAsyncKeyState(VK_CONTROL) )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1656 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1657 uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1658 if ( !uNumSeconds )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1659 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1660 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1661 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1662 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1663 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1664 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1665 if ( pParty->uNumGold < uPriceItemService )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1666 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1667 if ( uNumSeconds != 2 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1668 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1669 if ( uNumSeconds != 1 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1670 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1671 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1672 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1673 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1674 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1675 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1676 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1677 v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1678 if ( v39 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1679 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1680 bought_item->SetIdentified();
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1300
diff changeset
1681 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen));
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1682 if ( pPlayers[uActiveCharacter]->CanSteal() )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1683 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1684 if ( GetAsyncKeyState(VK_CONTROL) )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1685 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1686 if ( uNumSeconds == 1 || uNumSeconds == 2 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1687 {
1384
b51332ab228f changed a few member variables in Player to slightly less confusing names
Grumpy7
parents: 1300
diff changeset
1688 pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen();
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1689 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1690 viewparams->bRedrawGameUI = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1691 bought_item->Reset();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1692 pRenderer->ClearZBuffer(0, 479);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1693 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1694 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1695 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1696 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1697 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1698 dword_F8B1E4 = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1699 Party::TakeGold(uPriceItemService);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1700 viewparams->bRedrawGameUI = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1701 bought_item->Reset();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1702 pRenderer->ClearZBuffer(0, 479);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1703 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1704 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1705 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1706 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1707 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1708 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1709 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1710 default:// if click video screen in shop
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1711 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1712 __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1713 if( dialog_menu_id >= 36 && dialog_menu_id <= 72 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1714 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1715 v42 = dialog_menu_id - 36;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1716 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1717 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1718 uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1719 if ( uPriceItemService < v43 / 3 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1720 uPriceItemService = v43 / 3;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1721 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1722 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1723 pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42];
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1724 if ( !*pSkill )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1725 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1726 if ( pParty->uNumGold < uPriceItemService )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1727 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1728 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
1729 if ( in_current_building_type == BuildingType_Training )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1730 v55 = 4;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1731 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1732 v55 = 2;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1733 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1734 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1735 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1736 Party::TakeGold(uPriceItemService);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1737 dword_F8B1E4 = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1738 *pSkill = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1739 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1740 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1741 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1742 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1743 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1744 break;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1745 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1746 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1747 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1748 //----- (004B1A2D) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1429
diff changeset
1749 void ShowPopupShopItem()
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1750 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1751 int v3; // ecx@5
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1752 unsigned int v6; // eax@13
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1753 ItemGen *v7; // ecx@13
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1754 POINT cursor; // [sp+30h] [bp-1Ch]@17
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1755
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1756 if ( in_current_building_type <= 0 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1757 return;
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1758 if ( dialog_menu_id < HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1759 return;
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
1760 if ( in_current_building_type <= BuildingType_AlchemistShop )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1761 {
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1762 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1763 {
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1764 pMouse->GetCursorPos(&cursor);
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1765 v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1766 if ( !v3 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1767 return;
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1768 v7 = &pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1];
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1769 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL)
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1770 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v3 - 1];
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1771 GameUI_DrawItemInfo(v7);
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1772 return;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1773 }
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1774
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1775 if ( dialog_menu_id >= HOUSE_DIALOGUE_SHOP_SELL && dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1776 || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1777 {
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1778 pMouse->GetCursorPos(&cursor);
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1779 v3 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5);
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1780 if ( cursor.x <= 13 || cursor.x >= 462
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1781 || !pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) )
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1782 return;
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1783 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v3) - 1]);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1784 return;
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1785 }
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1786 }
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
1787 if ( in_current_building_type <= BuildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1788 {
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1789 pMouse->GetCursorPos(&cursor);
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1790 v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1753
diff changeset
1791 if ( v3 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1792 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C));
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1793 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1794 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1795 //----- (004B1D27) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1429
diff changeset
1796 void GetHouseGoodbyeSpeech()
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1797 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1798 signed int v2; // edi@10
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1799 signed int v5; // edi@20
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1800 int v7[4]; // [sp+Ch] [bp-10h]@12
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1801
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1802 if ( in_current_building_type > 0 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1803 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
1804 if ( in_current_building_type > BuildingType_MagicShop )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1805 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
1806 if ( in_current_building_type == BuildingType_Bank )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1807 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1808 if ( !dword_F8B1E4 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1809 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1810 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1811 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1812 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
1813 if ( in_current_building_type != BuildingType_Temple )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1814 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1815 }
1407
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1816 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1817 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1818 }
1749
42a1874a2171 Finishing member struct renaming
Grumpy7
parents: 1748
diff changeset
1819 if ( (signed __int64)pParty->PartyTimes._shop_ban_times[(unsigned int)window_SpeakInHouse->ptr_1C]<= (signed __int64)pParty->uTimePlayed )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1820 {
1407
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1821 if ( pParty->uNumGold <= 10000 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1822 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1823 if ( !dword_F8B1E4 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1824 return;
1407
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1825 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1826 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1827 }
1407
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1828 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)(dword_F8B1E4 + 3));
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1829 if ( !dword_F8B1E4 && !qword_A750D8 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1830 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1831 v5 = 0;
1407
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1832 for ( uint i = 1; i <= 4; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1833 {
1407
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1834 if ( pPlayers[i]->CanAct() )
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1835 v7[v5++] = i;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1836 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1837 if ( v5 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1838 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1839 qword_A750D8 = 256i64;
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1393
diff changeset
1840 PlayerSpeechID = SPEECH_80;
1407
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1841 uSpeakingCharacter = v7[rand() % v5];
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1842 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1843 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1844 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1845 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1846 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1847 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1848 if ( !qword_A750D8 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1849 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1850 v2 = 0;
1407
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1851 for ( uint i = 1; i <= 4; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1852 {
1407
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1853 if ( pPlayers[i]->CanAct() )
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1854 v7[v2++] = i;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1855 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1856 if ( v2 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1857 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1858 qword_A750D8 = 256i64;
1406
d071e0e9ba75 Explosion Traps fix
Ritor1
parents: 1393
diff changeset
1859 PlayerSpeechID = SPEECH_80;
1407
d4f57df4c299 PlayerSpeechID and uSpeakingCharacter
Ritor1
parents: 1406
diff changeset
1860 uSpeakingCharacter = v7[rand() % v2];
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1861 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1862 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1863 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1864 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1865 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1866 }