1300
|
1 #include "..\Items.h"
|
|
2 #include "..\GUIWindow.h"
|
|
3 #include "..\mm7_data.h"
|
|
4 #include "..\texts.h"
|
|
5 #include "UIHouses.h"
|
|
6 #include "..\GUIFont.h"
|
|
7 #include "..\Render.h"
|
|
8 #include "..\Party.h"
|
|
9 #include "..\Texture.h"
|
|
10 #include "..\Mouse.h"
|
|
11 #include "..\Events2D.h"
|
|
12 #include "..\AudioPlayer.h"
|
|
13 #include "..\MapInfo.h"
|
|
14 #include "..\Viewport.h"
|
|
15
|
|
16 //----- (004B910F) --------------------------------------------------------
|
|
17 void __cdecl WeaponShopDialog()
|
|
18 {
|
|
19 int v0; // ebx@1
|
|
20 int pNumActiveItem; // eax@6
|
|
21 signed int v2; // esi@8
|
|
22 ItemGen *v4; // eax@11
|
|
23 char *v5; // ecx@12
|
|
24 unsigned __int8 v6; // dl@13
|
|
25 char *v7; // edx@14
|
|
26 int v9; // ST08_4@16
|
|
27 int v10; // eax@16
|
|
28 signed int v11; // esi@18
|
|
29 int v12; // ST08_4@21
|
|
30 int v13; // eax@21
|
|
31 int v14; // edi@23
|
|
32 char **v15; // esi@23
|
|
33 int v16; // eax@24
|
|
34 //int v18; // edx@25
|
|
35 int v19; // edi@25
|
|
36 unsigned __int8 v20; // sf@25
|
|
37 GUIButton *pButton; // esi@27
|
|
38 int pNewItem; // eax@27
|
|
39 unsigned int v24; // ecx@27
|
|
40 int v25; // edx@27
|
|
41 unsigned int pColorText; // ax@27
|
|
42 signed int v27; // esi@32
|
|
43 int v28; // ST08_4@36
|
|
44 int v29; // eax@36
|
|
45 signed int v32; // esi@41
|
|
46 unsigned int v33; // esi@43
|
|
47 int v34; // eax@43
|
|
48 unsigned int v35; // eax@44
|
|
49 int v36; // eax@46
|
|
50 __int32 v37; // ecx@51
|
|
51 int v40; // eax@53
|
|
52 char *v41; // eax@55
|
|
53 unsigned int v43; // ecx@55
|
|
54 const char **v44; // edx@55
|
|
55 int v45; // eax@55
|
|
56 int v47; // eax@59
|
|
57 const char **v48; // eax@63
|
|
58 unsigned int v49; // esi@65
|
|
59 Texture *v50; // eax@65
|
|
60 int v51; // edi@65
|
|
61 int v52; // esi@70
|
|
62 Texture *v53; // ST1C_4@70
|
|
63 int v54; // edi@70
|
|
64 signed int v55; // ecx@73
|
|
65 SHORT v56; // di@82
|
|
66 bool v57; // eax@82
|
|
67 const char *v58; // ecx@84
|
|
68 POINT *v59; // esi@89
|
|
69 LONG v60; // ecx@90
|
|
70 int v61; // eax@90
|
|
71 int v62; // ecx@90
|
|
72 ItemGen *pItemInShop; // esi@90
|
|
73 int v64; // eax@95
|
|
74 int all_text_height; // esi@96
|
|
75 char **v66; // edi@96
|
|
76 int v67; // eax@97
|
|
77 int v69; // edx@98
|
|
78 int v70; // edi@98
|
|
79 int v71;
|
|
80 const char **v72; // eax@100
|
|
81 int pTextHeight; // eax@100
|
|
82 unsigned int v74; // ecx@100
|
|
83 int v78; // [sp-14h] [bp-10Ch]@14
|
|
84 ItemGen *v79; // [sp-10h] [bp-108h]@12
|
|
85 int v80; // [sp-10h] [bp-108h]@14
|
|
86 void *v81; // [sp-Ch] [bp-104h]@12
|
|
87 unsigned __int16 v82; // [sp-Ch] [bp-104h]@14
|
|
88 int v83; // [sp-8h] [bp-100h]@11
|
|
89 char *v84; // [sp-8h] [bp-100h]@14
|
|
90 __int64 *v85; // [sp-4h] [bp-FCh]@11
|
|
91 unsigned int v86; // [sp-4h] [bp-FCh]@14
|
|
92 POINT v87; // [sp+Ch] [bp-ECh]@8
|
|
93 POINT v88; // [sp+14h] [bp-E4h]@18
|
|
94 POINT v89; // [sp+1Ch] [bp-DCh]@89
|
|
95 POINT v90; // [sp+24h] [bp-D4h]@19
|
|
96 POINT v91; // [sp+2Ch] [bp-CCh]@89
|
|
97 POINT v92; // [sp+34h] [bp-C4h]@9
|
|
98 POINT v93; // [sp+3Ch] [bp-BCh]@33
|
|
99 POINT v94; // [sp+44h] [bp-B4h]@18
|
|
100 POINT v95; // [sp+4Ch] [bp-ACh]@32
|
|
101 POINT v96; // [sp+54h] [bp-A4h]@18
|
|
102 POINT v97; // [sp+5Ch] [bp-9Ch]@32
|
|
103 POINT a2; // [sp+64h] [bp-94h]@8
|
|
104 POINT v99; // [sp+6Ch] [bp-8Ch]@32
|
|
105 POINT v100; // [sp+74h] [bp-84h]@8
|
|
106 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
|
|
107 char *Str; // [sp+D0h] [bp-28h]@55
|
|
108 __int32 v103; // [sp+D4h] [bp-24h]@25
|
|
109 int pColorYellow; // [sp+D8h] [bp-20h]@1
|
|
110 int pColorWhite; // [sp+DCh] [bp-1Ch]@1
|
|
111 POINT v106; // [sp+E0h] [bp-18h]@8
|
|
112 Player *pPlayer; // [sp+E8h] [bp-10h]@1
|
|
113 int pItemNum; // [sp+ECh] [bp-Ch]@26
|
|
114 const char **v109; // [sp+F0h] [bp-8h]@26
|
|
115 unsigned __int8 v110; // [sp+F7h] [bp-1h]@16
|
|
116 int pNumString;
|
|
117
|
|
118 pPlayer = pPlayers[uActiveCharacter];
|
|
119 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
120 dialog_window.uFrameX = 483;
|
|
121 dialog_window.uFrameWidth = 148;
|
|
122 dialog_window.uFrameZ = 334;
|
|
123 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
124 pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u);
|
|
125
|
|
126 switch(dialog_menu_id)
|
|
127 {
|
|
128 case HOUSE_DIALOGUE_MAIN:
|
|
129 {
|
|
130 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
131 if ( pNumActiveItem )
|
|
132 {
|
|
133 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
|
|
134 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
|
|
135 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
|
|
136 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
137 all_text_height = 0;
|
|
138 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
139 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
140 v103 = (174 - all_text_height) / 4;
|
|
141 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
142 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
143 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
144 if ( v20 ^ (pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton ))
|
|
145 {
|
|
146 pItemNum = 2;
|
|
147 pNumString = 0;
|
|
148 do
|
|
149 {
|
|
150 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
151 pButton->uY = v103 + v19;
|
|
152 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
153 pButton->uHeight = pTextHeight;
|
|
154 v19 = pButton->uY + pTextHeight - 1;
|
|
155 pButton->uW = v19;
|
|
156 pColorText = pColorYellow;
|
|
157 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
158 pColorText = pColorWhite;
|
|
159 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
|
160 ++pItemNum;
|
|
161 ++pNumString;
|
|
162 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
163 }
|
|
164 while ( pItemNum < pNumActiveItem );
|
|
165 }
|
|
166 }
|
|
167 break;
|
|
168 }
|
|
169
|
|
170 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
|
171 {
|
|
172 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
173 v48 = 0;
|
|
174 pItemNum = 0;
|
|
175 v109 = 0;
|
|
176 do
|
|
177 {
|
|
178 // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] )
|
|
179 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID)
|
|
180 {
|
|
181 v49 = word_F8B158[(signed int)v48];
|
|
182 v50 = ItemsInShopTexture[(signed int)v48];
|
|
183 v49 += 30;
|
|
184 v51 = 60 - ((signed int)v50->uTextureWidth >> 1);
|
|
185 pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50);
|
|
186 sub_40F92A(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
|
|
187 v48 = v109;
|
|
188 }
|
|
189 pItemNum += 70;
|
|
190 v48 = (const char **)((char *)v48 + 1);
|
|
191 v109 = v48;
|
|
192 }
|
|
193 while ( (signed int)v48 < 6 );
|
|
194 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
195 if ( pNumActiveItem )
|
|
196 {
|
|
197 v55 = 0;
|
|
198 v106.x = 0;
|
|
199 v106.x = 0;
|
|
200 do
|
|
201 {
|
|
202 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
203 ++v106.x;
|
|
204 ++v55;
|
|
205 }
|
|
206 while ( v55 < 6 );
|
|
207 v56 = GetAsyncKeyState(17);
|
|
208 v57 = pPlayer->CanSteal();
|
|
209 Str = (char *)v57;
|
|
210 if ( v56 && v57 )
|
|
211 {
|
|
212 v58 = pGlobalTXT_LocalizationStrings[185];
|
|
213 }
|
|
214 else
|
|
215 {
|
|
216 v58 = pGlobalTXT_LocalizationStrings[195];
|
|
217 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
218 v58 = pGlobalTXT_LocalizationStrings[196];
|
|
219 }
|
|
220 DrawTextAtStatusBar(v58, 0);
|
|
221 if ( v106.x )
|
|
222 {
|
|
223 v59 = pMouse->GetCursorPos(&v91);
|
|
224 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y];
|
|
225 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
226 {
|
|
227 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
228 v106.x = v60;
|
|
229 v61 = (int)window_SpeakInHouse->ptr_1C;//maybe ptr_1C - BuildID_2Events
|
|
230 // v62 = 9 * (v60 + 12 * v61);
|
|
231 pItemInShop = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
|
|
232 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
233 pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60];
|
|
234 if ( !v56 || !Str )
|
|
235 {
|
|
236 v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BildingType_WeaponShop, v61, 2);
|
|
237 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
238 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
239 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
240 }
|
|
241 else
|
|
242 {
|
|
243 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
244 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
245 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
246 }
|
|
247 }
|
|
248 }
|
|
249 else
|
|
250 {
|
|
251 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
252 pNumActiveItem = 0; //added
|
|
253 }
|
|
254 }
|
|
255 break;
|
|
256 }
|
|
257
|
|
258 case HOUSE_DIALOGUE_SHOP_SELL:
|
|
259 {
|
|
260 draw_leather();
|
|
261 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
262 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
|
|
263 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
264 return;
|
|
265 if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5),
|
|
266 pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462
|
|
267 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) )
|
|
268 return;
|
|
269 v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
270 v13 = pPlayer->SelectPhrasesTransaction(v79, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3);
|
|
271 v7 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
|
272 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
273 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
274 break;
|
|
275 }
|
|
276
|
|
277 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
|
278 {
|
|
279 draw_leather();
|
|
280 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
281 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
|
|
282 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
283 return;
|
|
284 if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
|
|
285 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
|
|
286 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) )
|
|
287 return;
|
|
288 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
289 if (!v4->Identified())
|
|
290 {
|
|
291 v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
292 v7 = BuilDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
293 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
294 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
295 }
|
|
296 else
|
|
297 {
|
|
298 v7 = BuilDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
299 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
300 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
301 }
|
|
302 break;
|
|
303 }
|
|
304
|
|
305 case HOUSE_DIALOGUE_SHOP_REPAIR:
|
|
306 {
|
|
307 draw_leather();
|
|
308 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
309 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
|
|
310 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
311 return;
|
|
312 if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5),
|
|
313 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462
|
|
314 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem)
|
|
315 || (!(pPlayer->pOwnItems[pNumActiveItem-1].uAttributes& 2)) )
|
|
316 return;
|
|
317 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
318 v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5);
|
|
319 v7 = BuilDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
|
|
320 pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138;
|
|
321 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3);
|
|
322 return;
|
|
323 }
|
|
324 break;
|
|
325
|
|
326 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
|
327 {
|
|
328 draw_leather();
|
|
329 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
330 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];//sell
|
|
331 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];//identify
|
|
332 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair
|
|
333 all_text_height = 0;
|
|
334 for ( int i = 0; i < 3; ++i )
|
|
335 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
336 v103 = (174 - all_text_height) / 3;
|
|
337 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
338 v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138;
|
|
339 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
340 if ( v20 ^ (pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton ))
|
|
341 {
|
|
342 pItemNum = 2;
|
|
343 pNumString = 0;
|
|
344 do
|
|
345 {
|
|
346 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
347 pButton->uY = v103 + v70;
|
|
348 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
349 pButton->uHeight = pTextHeight;
|
|
350 v70 = pButton->uY + pTextHeight - 1;
|
|
351 pButton->uW = v70;
|
|
352 pColorText = pColorYellow;
|
|
353 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
354 pColorText = pColorWhite;
|
|
355 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
|
356 ++pItemNum;
|
|
357 ++pNumString;
|
|
358 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
359 }
|
|
360 while ( pItemNum < pNumActiveItem );
|
|
361 }
|
|
362 break;
|
|
363 }
|
|
364
|
|
365 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
|
366 {
|
|
367 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
368 v109 = 0;
|
|
369 pItemNum = 0;
|
|
370 do
|
|
371 {
|
|
372 // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] )
|
|
373 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
|
|
374 {
|
|
375 v52 = word_F8B158[(signed int)v109] + 30;
|
|
376 v53 = ItemsInShopTexture[(signed int)v109];
|
|
377 v54 = 60 - ((signed int)v53->uTextureWidth >> 1);
|
|
378 pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53);
|
|
379 sub_40F92A(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1));
|
|
380 }
|
|
381 v109 = (const char **)((char *)v109 + 1);
|
|
382 pItemNum += 70;
|
|
383 }
|
|
384 while ( (signed int)v109 < 6 );
|
|
385 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
|
|
386 if ( pNumActiveItem )
|
|
387 {
|
|
388 v55 = 0;
|
|
389 v106.x = 0;
|
|
390 do
|
|
391 {
|
|
392 // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
393 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
|
|
394 ++v106.x;
|
|
395 ++v55;
|
|
396 }
|
|
397 while ( v55 < 6 );
|
|
398 v56 = GetAsyncKeyState(17);
|
|
399 v57 = pPlayer->CanSteal();
|
|
400 Str = (char *)v57;
|
|
401 if ( v56 && v57 )
|
|
402 {
|
|
403 v58 = pGlobalTXT_LocalizationStrings[185];
|
|
404 }
|
|
405 else
|
|
406 {
|
|
407 v58 = pGlobalTXT_LocalizationStrings[195];
|
|
408 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
409 v58 = pGlobalTXT_LocalizationStrings[196];
|
|
410 }
|
|
411 DrawTextAtStatusBar(v58, 0);
|
|
412 if ( v106.x )
|
|
413 {
|
|
414 v59 = pMouse->GetCursorPos(&v91);
|
|
415 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y];
|
|
416 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
417 {
|
|
418 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
419 v106.x = v60;
|
|
420 v61 = (int)window_SpeakInHouse->ptr_1C;
|
|
421 // v62 = 9 * (v60 + 12 * v61);
|
|
422 pItemInShop = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
|
|
423 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
424 pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
|
|
425 if ( !v56 || !Str )
|
|
426 {
|
|
427 v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BildingType_WeaponShop, v61, 2);
|
|
428 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
429 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
430 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
431 }
|
|
432 else
|
|
433 {
|
|
434 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
435 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0);
|
|
436 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3);
|
|
437 }
|
|
438 }
|
|
439 }
|
|
440 else
|
|
441 {
|
|
442 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
443 pNumActiveItem = 0; //added
|
|
444 }
|
|
445 }
|
|
446 break;
|
|
447 }
|
|
448
|
|
449 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
|
450 {
|
|
451 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
452 return;
|
|
453 v0 = 0;
|
|
454 all_text_height = 0;
|
|
455 //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0);
|
|
456 v32 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
457 pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100;
|
|
458 if ( pItemNum < v32 / 3 )
|
|
459 pItemNum = v32 / 3;
|
|
460 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
461 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
462 {
|
|
463 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
464 strcat(pTmpBuf.data(), "\n \n");
|
|
465 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
|
|
466 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
|
|
467 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
|
|
468 return;
|
|
469 }
|
|
470 do
|
|
471 {
|
|
472 v35 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36;
|
|
473 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] )
|
|
474 {
|
|
475 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0);
|
|
476 v0++;
|
|
477 }
|
|
478 ++pNumActiveItem;
|
|
479 }
|
|
480 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
481 if ( !v0 )
|
|
482 {
|
|
483 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
484 strcat(pTmpBuf.data(), "\n \n");
|
|
485 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
|
|
486 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
|
|
487 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
|
|
488 return;
|
|
489 }
|
|
490 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
491 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
|
|
492 v103 = (149 - all_text_height) / v0;
|
|
493 if ( (149 - all_text_height) / v0 > 32 )
|
|
494 v103 = 32;
|
|
495 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
496 v37 = (149 - v0 * v103 - all_text_height) / 2 - v103 / 2 + 162;
|
|
497 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
498 {
|
|
499 pItemNum = 2;
|
|
500 do
|
|
501 {
|
|
502 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
503 v40 = pButton->msg_param - 36;
|
|
504 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] )
|
|
505 {
|
|
506 pButton->uW = 0;
|
|
507 pButton->uHeight = 0;
|
|
508 pButton->uY = 0;
|
|
509 }
|
|
510 else
|
|
511 {
|
|
512 pButton->uY = v103 + v37;
|
|
513 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0);
|
|
514 pButton->uHeight = pTextHeight;
|
|
515 v37 = pButton->uY + pTextHeight - 1;
|
|
516 pButton->uW = v37;
|
|
517 pColorText = pColorYellow;
|
|
518 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
519 pColorText = pColorWhite;
|
|
520 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v40], 3);
|
|
521 }
|
|
522 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
523 pItemNum++;
|
|
524 }
|
|
525 while ( pItemNum < pNumActiveItem );
|
|
526 }
|
|
527 break;
|
|
528 }
|
|
529 default:
|
|
530 {
|
|
531 if( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR)
|
|
532 pNumActiveItem = dialog_menu_id - 96;
|
|
533 else
|
|
534 pNumActiveItem = dialog_menu_id - 4;
|
|
535 break;
|
|
536 }
|
|
537 }
|
|
538 }
|
|
539
|
|
540 //----- (004BA928) --------------------------------------------------------
|
|
541 void __cdecl ArmorShopDialog()
|
|
542 {
|
|
543 signed int v1; // esi@8
|
|
544 unsigned int v2; // eax@10
|
|
545 ItemGen *v3; // eax@11
|
|
546 char *v5; // ecx@12
|
|
547 char *v6; // eax@13
|
|
548 int v8; // eax@15
|
|
549 signed int v9; // esi@17
|
|
550 unsigned int v10; // eax@19
|
|
551 char *v11; // edi@19
|
|
552 int v12; // ST08_4@20
|
|
553 int v13; // eax@20
|
|
554 char *v15; // ecx@20
|
|
555 char **v16; // edi@22
|
|
556 int all_text_height; // ebx@22
|
|
557 char **v18; // esi@22
|
|
558 int v19; // eax@23
|
|
559 GUIWindow *v20; // ecx@24
|
|
560 int v21; // eax@24
|
|
561 int v22; // edx@24
|
|
562 int v23; // ebx@24
|
|
563 unsigned __int8 v24; // sf@24
|
|
564 GUIButton *pButton; // eax@26
|
|
565 unsigned int v28; // ecx@26
|
|
566 int v29; // edx@26
|
|
567 signed int v31; // esi@31
|
|
568 unsigned int v32; // eax@33
|
|
569 int v33; // eax@34
|
|
570 int v35; // eax@35
|
|
571 char *v36; // edx@36
|
|
572 signed int v38; // esi@42
|
|
573 unsigned int v39; // esi@44
|
|
574 int v40; // eax@44
|
|
575 unsigned int v41; // eax@45
|
|
576 int v42; // eax@47
|
|
577 int v43; // ecx@52
|
|
578 int v46; // eax@54
|
|
579 unsigned int v49; // ecx@56
|
|
580 int v51; // eax@56
|
|
581 int v53; // eax@60
|
|
582 int textureH; // eax@60
|
|
583 signed int textureW; // ebx@65
|
|
584 Texture *v56; // eax@67
|
|
585 unsigned int pY_item; // edi@68
|
|
586 Texture *v58; // ST1C_4@68
|
|
587 int v59; // eax@68
|
|
588 int v60; // edi@69
|
|
589 signed int v61; // ebx@73
|
|
590 Texture *v62; // eax@75
|
|
591 int v63; // edi@76
|
|
592 Texture *v64; // ST1C_4@76
|
|
593 unsigned int v65; // ST18_4@76
|
|
594 int v66; // eax@76
|
|
595 int v67; // edi@77
|
|
596 signed int v68; // ecx@81
|
|
597 const char *pStatusText; // ecx@91
|
|
598 void *v72; // eax@95
|
|
599 POINT *v73; // esi@97
|
|
600 int v74; // ecx@97
|
|
601 int v75; // eax@98
|
|
602 int v76; // ecx@98
|
|
603 ItemGen *selected_item; // ecx@99
|
|
604 unsigned __int8 v78; // bl@104
|
|
605 int v80; // ebx@105
|
|
606 char **v81; // esi@105
|
|
607 int v82; // eax@106
|
|
608 int v86; // ebx@107
|
|
609 int pTextHeight; // eax@109
|
|
610 unsigned int v90; // ecx@109
|
|
611 int pNumString; // edx@109
|
|
612 unsigned __int16 pTextColor; // ax@109
|
|
613 signed int v93; // edx@114
|
|
614 POINT *v94; // edi@120
|
|
615 __int32 v95; // ecx@120
|
|
616 void *v96; // ST14_4@122
|
|
617 unsigned __int8 v97; // bl@122
|
|
618 ItemGen *v98; // ST10_4@122
|
|
619 int v99; // eax@122
|
|
620 char *v100; // eax@122
|
|
621 const char *v101; // ST18_4@122
|
|
622 unsigned __int16 v102; // ST14_2@122
|
|
623 int v103; // eax@122
|
|
624 signed int v104; // edi@123
|
|
625 Texture *v105; // eax@125
|
|
626 int v106; // ebx@126
|
|
627 unsigned int v108; // ST18_4@126
|
|
628 int v109; // eax@126
|
|
629 int v110; // ebx@127
|
|
630 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36
|
|
631 unsigned int v112; // [sp-14h] [bp-118h]@13
|
|
632 int v113; // [sp-14h] [bp-118h]@36
|
|
633 unsigned int v115; // [sp-10h] [bp-114h]@13
|
|
634 ItemGen *v116; // [sp-10h] [bp-114h]@20
|
|
635 int v117; // [sp-10h] [bp-114h]@36
|
|
636 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13
|
|
637 char *v121; // [sp-8h] [bp-10Ch]@13
|
|
638 int v122; // [sp-8h] [bp-10Ch]@20
|
|
639 unsigned int v123; // [sp-4h] [bp-108h]@13
|
|
640 __int64 *v124; // [sp-4h] [bp-108h]@20
|
|
641 int v125; // [sp-4h] [bp-108h]@68
|
|
642 int v126; // [sp-4h] [bp-108h]@76
|
|
643 int v127; // [sp-4h] [bp-108h]@126
|
|
644 POINT v128; // [sp+Ch] [bp-F8h]@8
|
|
645 POINT v129; // [sp+14h] [bp-F0h]@18
|
|
646 char v130; // [sp+1Ch] [bp-E8h]@120
|
|
647 POINT a2; // [sp+24h] [bp-E0h]@8
|
|
648 POINT v132; // [sp+2Ch] [bp-D8h]@120
|
|
649 POINT v133; // [sp+34h] [bp-D0h]@17
|
|
650 POINT v134; // [sp+3Ch] [bp-C8h]@97
|
|
651 POINT v135; // [sp+44h] [bp-C0h]@31
|
|
652 POINT v136; // [sp+4Ch] [bp-B8h]@97
|
|
653 POINT v137; // [sp+54h] [bp-B0h]@17
|
|
654 POINT v138; // [sp+5Ch] [bp-A8h]@32
|
|
655 POINT v139; // [sp+64h] [bp-A0h]@17
|
|
656 POINT v140; // [sp+6Ch] [bp-98h]@31
|
|
657 POINT v141; // [sp+74h] [bp-90h]@8
|
|
658 POINT v142; // [sp+7Ch] [bp-88h]@31
|
|
659 POINT v143; // [sp+84h] [bp-80h]@9
|
|
660 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1
|
|
661 int v146; // [sp+E4h] [bp-20h]@24
|
|
662 int pYellowColor; // [sp+E8h] [bp-1Ch]@1
|
|
663 int pWhiteColor; // [sp+ECh] [bp-18h]@1
|
|
664 __int32 pItemCount; // [sp+F0h] [bp-14h]@8
|
|
665 int v152; // [sp+FCh] [bp-8h]@24
|
|
666 int v153; // [sp+100h] [bp-4h]@44
|
|
667 int th;
|
|
668 short text_color;
|
|
669 int pActiveButton;
|
|
670
|
|
671 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
672 dialog_window.uFrameX = 483;
|
|
673 dialog_window.uFrameWidth = 148;
|
|
674 dialog_window.uFrameZ = 334;
|
|
675 pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
676 pYellowColor = TargetColor(0xE1u, 0xCDu, 0x23u);
|
|
677 switch (dialog_menu_id)
|
|
678 {
|
|
679 case HOUSE_DIALOGUE_MAIN:
|
|
680 {
|
|
681 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
682 return;
|
|
683 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
|
|
684 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
|
|
685 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
|
|
686 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
687 all_text_height = 0;
|
|
688 for( int i = 0; i < 4; ++i )
|
|
689 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
690 v146 = ( 174 - all_text_height ) / 4;
|
|
691 v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138;
|
|
692 pNumString = 0;
|
|
693 if ( pDialogueWindow->pNumPresenceButton>=0 )
|
|
694 {
|
|
695 for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton)
|
|
696 {
|
|
697 pButton = pDialogueWindow->GetControl(pActiveButton);
|
|
698 pButton->uY = v146 + v23;
|
|
699 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
700 pButton->uHeight = pTextHeight;
|
|
701 v23 = pButton->uY + pButton->uHeight - 1;
|
|
702 pButton->uW = v23;
|
|
703 pTextColor = pYellowColor;
|
|
704 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton )
|
|
705 pTextColor = pWhiteColor;
|
|
706 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3);
|
|
707 ++pNumString;
|
|
708 }
|
|
709 }
|
|
710 }
|
|
711 break;
|
|
712 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
|
713 {
|
|
714 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// ïîäëîæêà
|
|
715 textureW = 0;
|
|
716 v153 = 0;
|
|
717 for ( int i = 0; i < 8; ++i )// ðàçìåñòèòü âåùè
|
|
718 {
|
|
719 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
|
|
720 {
|
|
721 textureW = ItemsInShopTexture[i]->uTextureWidth;
|
|
722 textureH = ItemsInShopTexture[i]->uTextureHeight;
|
|
723 if ( i >= 4 ) //low row
|
|
724 {
|
|
725 v60 = 90 - (textureW/2);
|
|
726 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]);
|
|
727 v59 = v60 + v153 + 80220;
|
|
728 }
|
|
729 else
|
|
730 {
|
|
731 pY_item = 98 - textureH;
|
|
732 v152 = 86 - (textureW/2);
|
|
733 pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]);
|
|
734 v59 = v153 + v152 + 640 * pY_item;
|
|
735 }
|
|
736 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1);
|
|
737 }
|
|
738 v153 += 105;
|
|
739 }
|
|
740 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
741 return;
|
|
742 pItemCount = 0;
|
|
743 for ( int i = 0; i < 8; ++i )
|
|
744 {
|
|
745 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID )
|
|
746 ++pItemCount;
|
|
747 }
|
|
748 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
|
|
749 pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
|
|
750 else
|
|
751 pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item"
|
|
752 DrawTextAtStatusBar(pStatusText, 0);
|
|
753 if ( pItemCount != 0 )
|
|
754 {
|
|
755 v73 = pMouse->GetCursorPos(&v136);
|
|
756 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF;
|
|
757 if ( !v74 )
|
|
758 return;
|
|
759 pItemCount = v74 - 1;
|
|
760 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
|
|
761 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0)
|
|
762 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BildingType_ArmorShop, window_SpeakInHouse->par1C, 2)];
|
|
763 else
|
|
764 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
|
|
765 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
766 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
767 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
|
|
768 return;
|
|
769 }
|
|
770 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
771 return;
|
|
772 }
|
|
773 break;
|
|
774 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
|
775 {
|
|
776 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
777 v11 = 0;
|
|
778 v61 = 0;
|
|
779 v153 = 0;
|
|
780 do
|
|
781 {
|
|
782 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID)
|
|
783 {
|
|
784 v62 = ItemsInShopTexture[v61];
|
|
785 if ( v61 >= 4 )
|
|
786 {
|
|
787 v67 = 90 - ((signed int)v62->uTextureWidth >> 1);
|
|
788 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]);
|
|
789 v66 = v153 + v67 + 80220;
|
|
790 }
|
|
791 else
|
|
792 {
|
|
793 v63 = 98 - v62->uTextureHeight;
|
|
794 v64 = ItemsInShopTexture[v61];
|
|
795 v65 = 98 - v62->uTextureHeight;
|
|
796 v152 = 86 - ((signed int)v62->uTextureWidth >> 1);
|
|
797 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64);
|
|
798 v66 = v152 + v153 + 640 * v63;
|
|
799 }
|
|
800 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1);
|
|
801 }
|
|
802 v153 += 105;
|
|
803 ++v61;
|
|
804 }
|
|
805 while ( v61 < 8 );
|
|
806 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
807 return;
|
|
808 v68 = 0;
|
|
809 pItemCount = 0;
|
|
810 do
|
|
811 {
|
|
812 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID)
|
|
813 ++pItemCount;
|
|
814 ++v68;
|
|
815 }
|
|
816 while ( v68 < 6 );
|
|
817 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
|
|
818 pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy"
|
|
819 else
|
|
820 pStatusText = pGlobalTXT_LocalizationStrings[185];
|
|
821 DrawTextAtStatusBar(pStatusText, 0);
|
|
822 if ( (char *)pItemCount != 0 )
|
|
823 {
|
|
824 v73 = pMouse->GetCursorPos(&v136);
|
|
825 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF;
|
|
826 if ( !v74 )
|
|
827 return;
|
|
828 pItemCount = v74 - 1;
|
|
829 if ( dialog_menu_id == 2 )
|
|
830 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74 - 1];
|
|
831 else
|
|
832 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74 - 1];
|
|
833 if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 )
|
|
834 v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(selected_item, BildingType_ArmorShop, window_SpeakInHouse->par1C, 2)];
|
|
835 else
|
|
836 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
|
|
837 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
838 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
839 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
|
|
840 return;
|
|
841 }
|
|
842 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
843 return;
|
|
844 }
|
|
845 break;
|
|
846 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
|
847 {
|
|
848 draw_leather();
|
|
849 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
850 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell"
|
|
851 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify"
|
|
852 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair"
|
|
853 all_text_height = 0;
|
|
854 for ( int i = 0; i < 3; ++i )
|
|
855 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
856 v152 = (174 - all_text_height) / 3;
|
|
857 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138;
|
|
858 v24 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
859 pActiveButton = pDialogueWindow->pStartingPosActiveItem;
|
|
860 if ( v24 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) )
|
|
861 {
|
|
862 pNumString = 0;
|
|
863 do
|
|
864 {
|
|
865 pButton = pDialogueWindow->GetControl((unsigned int)pActiveButton);
|
|
866 pButton->uY = v152 + v86;
|
|
867 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
868 v90 = pButton->uY;
|
|
869 pButton->uHeight = pTextHeight;
|
|
870 v86 = v90 + pTextHeight - 1;
|
|
871 pButton->uW = v86;
|
|
872 pTextColor = pYellowColor;
|
|
873 if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton )
|
|
874 pTextColor = pWhiteColor;
|
|
875 dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3);
|
|
876 ++pNumString;
|
|
877 ++pActiveButton;
|
|
878 }
|
|
879 while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
880 }
|
|
881 return;
|
|
882 }
|
|
883 break;
|
|
884 case HOUSE_DIALOGUE_SHOP_SELL:
|
|
885 {
|
|
886 draw_leather();
|
|
887 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
888 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell"
|
|
889 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
890 return;
|
|
891 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, pItemCount = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5),
|
|
892 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462
|
|
893 || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) )
|
|
894 return;
|
|
895 v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v10 - 1];
|
|
896 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BildingType_ArmorShop, window_SpeakInHouse->par1C, 3);
|
|
897 v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BildingType_ArmorShop, window_SpeakInHouse->par1C, 3)];
|
|
898 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0);
|
|
899 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
900 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
|
|
901 return;
|
|
902 }
|
|
903 break;
|
|
904 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
|
905 {
|
|
906 draw_leather();
|
|
907 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
908 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify"
|
|
909 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
910 {
|
|
911 v1 = pMouse->GetCursorPos(&a2)->x - 14;
|
|
912 pItemCount = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5);
|
|
913 if ( pMouse->GetCursorPos(&v141)->x > 13 )
|
|
914 {
|
|
915 if ( pMouse->GetCursorPos(&v143)->x < 462 )
|
|
916 {
|
|
917 v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount);
|
|
918 if ( v2 )
|
|
919 {
|
|
920 v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v2-1];
|
|
921 if (v3->Identified())
|
|
922 v5 = "%24";
|
|
923 else
|
|
924 {
|
|
925 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v3, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
926 v5 = (char *)pMerchantsIdentifyPhrases[v8];
|
|
927 }
|
|
928 v6 = BuilDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
929 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138;
|
|
930 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3);
|
|
931 return;
|
|
932 }
|
|
933 }
|
|
934 }
|
|
935 }
|
|
936 }
|
|
937 break;
|
|
938 case HOUSE_DIALOGUE_SHOP_REPAIR:
|
|
939 {
|
|
940 draw_leather();
|
|
941 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
942 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
|
|
943 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
944 return;
|
|
945 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14,
|
|
946 pItemCount = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5),
|
|
947 pMouse->GetCursorPos(&v140)->x <= 13)
|
|
948 || pMouse->GetCursorPos(&v138)->x >= 462
|
|
949 || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32)
|
|
950 || (!(pPlayers[uActiveCharacter]->pOwnItems[v32-1].uAttributes& 2)) )
|
|
951 return;
|
|
952 v116 = &pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1];
|
|
953 v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[v32 - 1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 5);
|
|
954 v15 = (char *)pMerchantsRepairPhrases[v35];
|
|
955 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
|
|
956 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
|
|
957 dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3);
|
|
958 return;
|
|
959 }
|
|
960 break;
|
|
961 case HOUSE_DIALOGUE_SHOP_6: //buy standart ???
|
|
962 {
|
|
963 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
|
|
964 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy"
|
|
965 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
966 return;
|
|
967 pItemCount = 0;
|
|
968 for( int i = 0; i < 6 ; ++i )
|
|
969 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
|
|
970 ++pItemCount;
|
|
971 if ( pItemCount )
|
|
972 {
|
|
973 v94 = pMouse->GetCursorPos(&v132);
|
|
974 pItemCount = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]];
|
|
975 v95 = pItemCount;
|
|
976 if ( pItemCount && pItemCount != -65536 )
|
|
977 {
|
|
978 --pItemCount;
|
|
979 v97 = uActiveCharacter - 1;
|
|
980 v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 2);
|
|
981 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0);
|
|
982 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0);
|
|
983 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3);
|
|
984 }
|
|
985 v104 = 0;
|
|
986 v153 = 0;
|
|
987 do
|
|
988 {
|
|
989 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
|
|
990 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID)
|
|
991 {
|
|
992 v105 = ItemsInShopTexture[v104];
|
|
993 if ( v104 >= 4 )
|
|
994 {
|
|
995 v110 = 90 - ((signed int)v105->uTextureWidth >> 1);
|
|
996 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]);
|
|
997 v127 = v104 + 1;
|
|
998 v109 = v153 + v110 + 80220;
|
|
999 }
|
|
1000 else
|
|
1001 {
|
|
1002 v106 = 98 - v105->uTextureHeight;
|
|
1003 v108 = 98 - v105->uTextureHeight;
|
|
1004 v152 = 86 - ((signed int)v105->uTextureWidth >> 1);
|
|
1005 pRenderer->DrawTextureTransparent(v152 + v153, v108, ItemsInShopTexture[v104]);
|
|
1006 v127 = v104 + 1;
|
|
1007 v109 = v152 + v153 + 640 * v106;
|
|
1008 }
|
|
1009 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127);
|
|
1010 }
|
|
1011 v153 += 105;
|
|
1012 ++v104;
|
|
1013 }
|
|
1014 while ( v104 < 8 );
|
|
1015 return;
|
|
1016 }
|
|
1017 dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
|
|
1018 return;
|
|
1019 }
|
|
1020 break;
|
|
1021 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
|
1022 {
|
|
1023 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1024 return;
|
|
1025 v152 = 0;
|
|
1026 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
1027 pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
1028 if ( (signed int)pActiveButton < v38 / 3 )
|
|
1029 pActiveButton = v38 / 3;
|
|
1030 v39 = pDialogueWindow->pStartingPosActiveItem;
|
|
1031 v40 = pDialogueWindow->pNumPresenceButton;
|
|
1032 v153 = 0;
|
|
1033 if ( (signed int)v39 < (signed int)(v39 + v40) )
|
|
1034 {
|
|
1035 do
|
|
1036 {
|
|
1037 v41 = pDialogueWindow->GetControl(v39)->msg_param - 36;
|
|
1038 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] && !pPlayers[uActiveCharacter]->pActiveSkills[v41] )
|
|
1039 {
|
|
1040 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
|
|
1041 v152 += v42;
|
|
1042 ++v153;
|
|
1043 }
|
|
1044 ++v39;
|
|
1045 }
|
|
1046 while ( (signed int)v39 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
1047 if ( v153 )
|
|
1048 {
|
|
1049 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pActiveButton);
|
|
1050 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
|
|
1051 pActiveButton = (149 - v152) / v153;
|
|
1052 if ( (149 - v152) / v153 > 32 )
|
|
1053 pActiveButton = 32;
|
|
1054 v43 = (149 - v153 * (signed int)pActiveButton - v152) / 2 - (signed int)pActiveButton / 2 + 162;
|
|
1055 v152 = pDialogueWindow->pStartingPosActiveItem;
|
|
1056 v146 = v43;
|
|
1057 if ( v152 < v152 + pDialogueWindow->pNumPresenceButton )
|
|
1058 {
|
|
1059 v153 = 2;
|
|
1060 do
|
|
1061 {
|
|
1062 pButton = pDialogueWindow->GetControl(v152);
|
|
1063 v46 = pButton->msg_param - 36;
|
|
1064 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v46] || pPlayers[uActiveCharacter]->pActiveSkills[v46] )
|
|
1065 {
|
|
1066 pButton->uW = 0;
|
|
1067 pButton->uHeight = 0;
|
|
1068 pButton->uY = 0;
|
|
1069 }
|
|
1070 else
|
|
1071 {
|
|
1072 pButton->uY = (unsigned int)((char *)pActiveButton + v146);
|
|
1073 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v46], &dialog_window, 0, 0);
|
|
1074 v49 = pButton->uY;
|
|
1075 pButton->uHeight = pTextHeight;
|
|
1076 v51 = v49 + pTextHeight - 1;
|
|
1077 pButton->uW = v51;
|
|
1078 v146 = v51;
|
|
1079 pTextColor = pYellowColor;
|
|
1080 if ( pDialogueWindow->pCurrentPosActiveItem != v153 )
|
|
1081 pTextColor = pWhiteColor;
|
|
1082 dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3);
|
|
1083 }
|
|
1084 v53 = pDialogueWindow->pStartingPosActiveItem;
|
|
1085 ++v152;
|
|
1086 textureH = pDialogueWindow->pNumPresenceButton + v53;
|
|
1087 ++v153;
|
|
1088 }
|
|
1089 while ( v152 < textureH );
|
|
1090 }
|
|
1091 return;
|
|
1092 }
|
|
1093 }
|
|
1094 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s"
|
|
1095 strcat(pTmpBuf.data(), "\n \n");
|
|
1096 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
|
|
1097 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
|
|
1098 dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf.data(), 3);
|
|
1099 return;
|
|
1100 }
|
|
1101 break;
|
|
1102 }
|
|
1103 }
|
|
1104 //----- (004B9CC6) --------------------------------------------------------
|
|
1105 void __cdecl AlchemistDialog()
|
|
1106 {
|
|
1107 int v0;
|
|
1108 int pNumActiveItem; // eax@7
|
|
1109 signed int v5; // esi@9
|
|
1110 unsigned int v6; // esi@11
|
|
1111 int v7; // eax@11
|
|
1112 unsigned int v8; // eax@12
|
|
1113 int v9; // eax@14
|
|
1114 int v10; // ecx@19
|
|
1115 int v13; // eax@21
|
|
1116 char *v14; // eax@23
|
|
1117 int v15; // eax@23
|
|
1118 unsigned int v16; // ecx@23
|
|
1119 int v17; // edx@23
|
|
1120 int v18; // eax@23
|
|
1121 int v20; // eax@27
|
|
1122 char *v21; // edx@29
|
|
1123 int v22; // esi@30
|
|
1124 char **v23; // edi@30
|
|
1125 int v24; // eax@31
|
|
1126 int v26; // edx@32
|
|
1127 int v27; // edi@32
|
|
1128 unsigned __int8 v28; // sf@32
|
|
1129 const char **v30; // eax@34
|
|
1130 int v31; // eax@34
|
|
1131 unsigned int v32; // ecx@34
|
|
1132 int v34; // eax@34
|
|
1133 signed int v36; // esi@39
|
|
1134 ItemGen *v37; // eax@42
|
|
1135 char *v38; // ecx@43
|
|
1136 unsigned __int8 v39; // dl@44
|
|
1137 int v40; // eax@46
|
|
1138 int v41; // ST08_4@47
|
|
1139 int v42; // eax@47
|
|
1140 signed int v43; // esi@49
|
|
1141 int v44; // ST08_4@52
|
|
1142 int v45; // eax@52
|
|
1143 Texture *v46; // ecx@55
|
|
1144 unsigned int v47; // edi@55
|
|
1145 unsigned int v48; // esi@57
|
|
1146 int v49; // edx@61
|
|
1147 Texture *v50; // ecx@67
|
|
1148 unsigned int v51; // edi@67
|
|
1149 unsigned int v52; // esi@69
|
|
1150 int v53; // edx@73
|
|
1151 Texture *v54; // ecx@79
|
|
1152 unsigned int v55; // edi@79
|
|
1153 unsigned int v56; // esi@81
|
|
1154 int v57; // edx@85
|
|
1155 Texture *v58; // ecx@91
|
|
1156 unsigned int v59; // edi@91
|
|
1157 unsigned int v60; // esi@93
|
|
1158 int v61; // edx@97
|
|
1159 signed int v62; // ecx@102
|
|
1160 SHORT v63; // di@110
|
|
1161 bool v64; // eax@110
|
|
1162 const char *v65; // ecx@112
|
|
1163 POINT *v66; // esi@117
|
|
1164 int v67; // ecx@118
|
|
1165 int v68; // eax@118
|
|
1166 int v69; // ecx@118
|
|
1167 ItemGen *v70; // esi@118
|
|
1168 int v71; // eax@123
|
|
1169 int all_text_height; // edi@125
|
|
1170 char **v73; // esi@125
|
|
1171 int v74; // eax@126
|
|
1172 int pItemNum;
|
|
1173 int v76; // edx@127
|
|
1174 int v77; // edi@127
|
|
1175 GUIButton *pButton; // esi@129
|
|
1176 const char **v79; // eax@129
|
|
1177 int pTextHeight; // eax@129
|
|
1178 unsigned int v81; // ecx@129
|
|
1179 unsigned int pColorText; // ax@129
|
|
1180 int v85; // [sp-14h] [bp-ECh]@29
|
|
1181 int v86; // [sp-10h] [bp-E8h]@29
|
|
1182 ItemGen *v87; // [sp-10h] [bp-E8h]@43
|
|
1183 unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29
|
|
1184 void *v89; // [sp-Ch] [bp-E4h]@43
|
|
1185 char *v90; // [sp-8h] [bp-E0h]@29
|
|
1186 int v91; // [sp-8h] [bp-E0h]@42
|
|
1187 unsigned int v92; // [sp-4h] [bp-DCh]@29
|
|
1188 __int64 *v93; // [sp-4h] [bp-DCh]@42
|
|
1189 POINT v94; // [sp+Ch] [bp-CCh]@39
|
|
1190 POINT v95; // [sp+14h] [bp-C4h]@49
|
|
1191 POINT v96; // [sp+1Ch] [bp-BCh]@117
|
|
1192 POINT v97; // [sp+24h] [bp-B4h]@40
|
|
1193 POINT v98; // [sp+2Ch] [bp-ACh]@117
|
|
1194 POINT v99; // [sp+34h] [bp-A4h]@49
|
|
1195 POINT v100; // [sp+3Ch] [bp-9Ch]@50
|
|
1196 POINT v101; // [sp+44h] [bp-94h]@39
|
|
1197 POINT v102; // [sp+4Ch] [bp-8Ch]@49
|
|
1198 POINT a2; // [sp+54h] [bp-84h]@39
|
|
1199 GUIWindow dialog_window; // [sp+5Ch] [bp-7Ch]@1
|
|
1200 int v105; // [sp+B0h] [bp-28h]@19
|
|
1201 int pColorYellow; // [sp+B4h] [bp-24h]@1
|
|
1202 int Str; // [sp+B8h] [bp-20h]@23
|
|
1203 int pColorWhite; // [sp+BCh] [bp-1Ch]@1
|
|
1204 __int32 v109; // [sp+C0h] [bp-18h]@39
|
|
1205 Player *pPlayer; // [sp+C4h] [bp-14h]@1
|
|
1206 int pNumString; // [sp+C8h] [bp-10h]@9
|
|
1207 unsigned int v112; // [sp+CCh] [bp-Ch]@9
|
|
1208 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47
|
|
1209 int v114; // [sp+D4h] [bp-4h]@11
|
|
1210
|
|
1211 pPlayer = pPlayers[uActiveCharacter];
|
|
1212 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
1213 dialog_window.uFrameX = 483;
|
|
1214 dialog_window.uFrameWidth = 148;
|
|
1215 dialog_window.uFrameZ = 334;
|
|
1216 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
|
|
1217 pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u);
|
|
1218 switch(dialog_menu_id)
|
|
1219 {
|
|
1220 case HOUSE_DIALOGUE_MAIN:
|
|
1221 {
|
|
1222 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1223 {
|
|
1224 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
|
|
1225 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
|
|
1226 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
|
|
1227 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
1228 all_text_height = 0;
|
|
1229 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
|
|
1230 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
1231 Str = (174 - all_text_height) / 4;
|
|
1232 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1233 v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
1234 v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
1235 v28 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
1236 if ( v28 ^ (pNumActiveItem > v76) )
|
|
1237 {
|
|
1238 pItemNum = 2;
|
|
1239 pNumString = 0;
|
|
1240 do
|
|
1241 {
|
|
1242 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1243 pButton->uY = Str + v77;
|
|
1244 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
1245 pButton->uHeight = pTextHeight;
|
|
1246 v77 = pButton->uY + pTextHeight - 1;
|
|
1247 pButton->uW = v77;
|
|
1248 pColorText = pColorYellow;
|
|
1249 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
1250 pColorText = pColorWhite;
|
|
1251 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
|
1252 ++pItemNum;
|
|
1253 ++pNumString;
|
|
1254 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1255 }
|
|
1256 while ( pItemNum < pNumActiveItem );
|
|
1257 }
|
|
1258 }
|
|
1259 return;
|
|
1260 }
|
|
1261 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
|
1262 {
|
|
1263 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
1264 v114 = 0;
|
|
1265 do
|
|
1266 {
|
|
1267 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
|
|
1268 {
|
|
1269 v46 = ItemsInShopTexture[v114];
|
|
1270 v47 = 152 - v46->uTextureHeight;
|
|
1271 if ( (signed int)v47 < 1 )
|
|
1272 v47 = 0;
|
|
1273 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40;
|
|
1274 if ( v114 )
|
|
1275 {
|
|
1276 if ( v114 == 5 )
|
|
1277 {
|
|
1278 v49 = ItemsInShopTexture[5]->uTextureWidth;
|
|
1279 if ( (signed int)v48 > 457 - v49 )
|
|
1280 v48 = 457 - v49;
|
|
1281 }
|
|
1282 }
|
|
1283 else if ( (signed int)v48 < 18 )
|
|
1284 v48 = 18;
|
|
1285 pRenderer->DrawTextureTransparent(v48, v47, v46);
|
|
1286 sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1);
|
|
1287 }
|
|
1288 ++v114;
|
|
1289 }
|
|
1290 while ( v114 < 6 );
|
|
1291 v114 = 0;
|
|
1292 do
|
|
1293 {
|
|
1294 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114 + 6].uItemID)
|
|
1295 {
|
|
1296 v50 = ItemsInShopTexture[v114 + 6];
|
|
1297 v51 = 308 - v50->uTextureHeight;
|
|
1298 if ( (signed int)v51 < 1 )
|
|
1299 v51 = 0;
|
|
1300 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40;
|
|
1301 if ( v114 )
|
|
1302 {
|
|
1303 if ( v114 == 5 )
|
|
1304 {
|
|
1305 v53 = ItemsInShopTexture[11]->uTextureWidth;
|
|
1306 if ( (signed int)v52 > 457 - v53 )
|
|
1307 v52 = 457 - v53;
|
|
1308 }
|
|
1309 }
|
|
1310 else
|
|
1311 {
|
|
1312 if ( (signed int)v52 < 18 )
|
|
1313 v52 = 18;
|
|
1314 }
|
|
1315 pRenderer->DrawTextureTransparent(v52, v51, v50);
|
|
1316 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7);
|
|
1317 }
|
|
1318 ++v114;
|
|
1319 }
|
|
1320 while ( v114 < 6 );
|
|
1321 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1322 {
|
|
1323 v62 = 0;
|
|
1324 v109 = 0;
|
|
1325 do
|
|
1326 {
|
|
1327 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
|
|
1328 ++v109;
|
|
1329 ++v62;
|
|
1330 }
|
|
1331 while ( v62 < 12 );
|
|
1332 v63 = GetAsyncKeyState(17);
|
|
1333 v64 = pPlayer->CanSteal();
|
|
1334 Str = v64;
|
|
1335 if ( v63 && v64 )
|
|
1336 {
|
|
1337 v65 = pGlobalTXT_LocalizationStrings[185];
|
|
1338 }
|
|
1339 else if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
1340 {
|
|
1341 v65 = pGlobalTXT_LocalizationStrings[195];
|
|
1342 }
|
|
1343 else
|
|
1344 {
|
|
1345 v65 = pGlobalTXT_LocalizationStrings[196];
|
|
1346 }
|
|
1347 DrawTextAtStatusBar(v65, 0);
|
|
1348 if ( !v109 )
|
|
1349 {
|
|
1350 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
1351 return;
|
|
1352 }
|
|
1353 v66 = pMouse->GetCursorPos(&v98);
|
|
1354 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y];
|
|
1355 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
1356 {
|
|
1357 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
1358 v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];
|
|
1359 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
1360 v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
|
|
1361 if ( !v63 || !Str )
|
|
1362 {
|
|
1363 v71 = pPlayer->SelectPhrasesTransaction(v70, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 2);
|
|
1364 v38 = (char *)pMerchantsBuyPhrases[v71];
|
|
1365 }
|
|
1366 else
|
|
1367 {
|
|
1368 v38 = pGlobalTXT_LocalizationStrings[181];
|
|
1369 }
|
|
1370 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
1371 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
1372 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
1373 return ;
|
|
1374 }
|
|
1375 }
|
|
1376 return;
|
|
1377 }
|
|
1378 case HOUSE_DIALOGUE_SHOP_SELL:
|
|
1379 {
|
|
1380 draw_leather();
|
|
1381 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
1382 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
|
|
1383 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1384 return;
|
|
1385 if ((v43 = pMouse->GetCursorPos(&v99)->x - 14, v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5),
|
|
1386 pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462
|
|
1387 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) )
|
|
1388 return;
|
|
1389 v87 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
1390 v45 = pPlayer->SelectPhrasesTransaction(v87, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3);
|
|
1391 v21 = BuilDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
|
1392 pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
1393 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3);
|
|
1394 return;
|
|
1395 }
|
|
1396 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
|
1397 {
|
|
1398 draw_leather();
|
|
1399 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
1400 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
|
|
1401 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1402 return;
|
|
1403 if ((v36 = pMouse->GetCursorPos(&a2)->x - 14, v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5),
|
|
1404 pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462
|
|
1405 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) )
|
|
1406 return;
|
|
1407 v37 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1];
|
|
1408 if (!v37->Identified())
|
|
1409 {
|
|
1410 v42 = pPlayer->SelectPhrasesTransaction(v37, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
1411 v38 = (char *)pMerchantsIdentifyPhrases[v42];
|
|
1412 }
|
|
1413 else
|
|
1414 {
|
|
1415 v38 = "%24";
|
|
1416 }
|
|
1417 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v37, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
1418 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
1419 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
1420 return;
|
|
1421 }
|
|
1422 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
|
1423 {
|
|
1424 draw_leather();
|
|
1425 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
1426 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];
|
|
1427 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];
|
|
1428 all_text_height = 0;
|
|
1429 for ( int i = 0; i < 2; ++i )
|
|
1430 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
1431 Str = (174 - all_text_height) / 2;
|
|
1432 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1433 v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
|
|
1434 v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
|
|
1435 v28 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
1436 if ( v28 ^ (pNumActiveItem > v26) )
|
|
1437 {
|
|
1438 pItemNum = 2;
|
|
1439 pNumString = 0;
|
|
1440 do
|
|
1441 {
|
|
1442 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1443 pButton->uY = Str + v27;
|
|
1444 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
|
|
1445 pButton->uHeight = pTextHeight;
|
|
1446 v27 = pButton->uY + pTextHeight - 1;
|
|
1447 pButton->uW = v27;
|
|
1448 pColorText = pColorYellow;
|
|
1449 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
1450 pColorText = pColorWhite;
|
|
1451 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
|
|
1452 ++pItemNum;
|
|
1453 ++pNumString;
|
|
1454 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1455 }
|
|
1456 while ( pItemNum < pNumActiveItem );
|
|
1457 }
|
|
1458 return;
|
|
1459 }
|
|
1460 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
|
1461 {
|
|
1462 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
1463 v114 = 0;
|
|
1464 do
|
|
1465 {
|
|
1466 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID)
|
|
1467 {
|
|
1468 v54 = ItemsInShopTexture[v114];
|
|
1469 v55 = 152 - v54->uTextureHeight;
|
|
1470 if ( (signed int)v55 < 1 )
|
|
1471 v55 = 0;
|
|
1472 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40;
|
|
1473 if ( v114 )
|
|
1474 {
|
|
1475 if ( v114 == 5 )
|
|
1476 {
|
|
1477 v57 = ItemsInShopTexture[5]->uTextureWidth;
|
|
1478 if ( (signed int)v56 > 457 - v57 )
|
|
1479 v56 = 457 - v57;
|
|
1480 }
|
|
1481 }
|
|
1482 else
|
|
1483 {
|
|
1484 if ( (signed int)v56 < 18 )
|
|
1485 v56 = 18;
|
|
1486 }
|
|
1487 pRenderer->DrawTextureTransparent(v56, v55, v54);
|
|
1488 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1);
|
|
1489 }
|
|
1490 ++v114;
|
|
1491 }
|
|
1492 while ( v114 < 6 );
|
|
1493 v114 = 0;
|
|
1494 do
|
|
1495 {
|
|
1496 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114 + 6].uItemID) //not itemid
|
|
1497 {
|
|
1498 v58 = ItemsInShopTexture[v114 + 6];
|
|
1499 v59 = 308 - v58->uTextureHeight;
|
|
1500 if ( (signed int)v59 < 1 )
|
|
1501 v59 = 0;
|
|
1502 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40;
|
|
1503 if ( v114 )
|
|
1504 {
|
|
1505 if ( v114 == 5 )
|
|
1506 {
|
|
1507 v61 = ItemsInShopTexture[11]->uTextureWidth;
|
|
1508 if ( (signed int)v60 > 457 - v61 )
|
|
1509 v60 = 457 - v61;
|
|
1510 }
|
|
1511 }
|
|
1512 else
|
|
1513 {
|
|
1514 if ( (signed int)v60 < 18 )
|
|
1515 v60 = 18;
|
|
1516 }
|
|
1517 pRenderer->DrawTextureTransparent(v60, v59, v58);
|
|
1518 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7);
|
|
1519 }
|
|
1520 ++v114;
|
|
1521 }
|
|
1522 while ( v114 < 6 );
|
|
1523 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1524 {
|
|
1525 v62 = 0;
|
|
1526 v109 = 0;
|
|
1527 do
|
|
1528 {
|
|
1529 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID)
|
|
1530 ++v109;
|
|
1531 ++v62;
|
|
1532 }
|
|
1533 while ( v62 < 12 );
|
|
1534 v63 = GetAsyncKeyState(17);
|
|
1535 v64 = pPlayer->CanSteal();
|
|
1536 Str = v64;
|
|
1537 if ( v63 && v64 )
|
|
1538 {
|
|
1539 v65 = pGlobalTXT_LocalizationStrings[185];
|
|
1540 }
|
|
1541 else
|
|
1542 {
|
|
1543 v65 = pGlobalTXT_LocalizationStrings[195];
|
|
1544 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
1545 v65 = pGlobalTXT_LocalizationStrings[196];
|
|
1546 }
|
|
1547 DrawTextAtStatusBar(v65, 0);
|
|
1548 if ( !v109 )
|
|
1549 {
|
|
1550 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
1551 return;
|
|
1552 }
|
|
1553 v66 = pMouse->GetCursorPos(&v98);
|
|
1554 pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y];
|
|
1555 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF )
|
|
1556 {
|
|
1557 v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1;
|
|
1558 v109 = v67;
|
|
1559 v68 = (int)window_SpeakInHouse->ptr_1C;
|
|
1560 // v69 = 9 * (v67 + 12 * v68);
|
|
1561 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
|
|
1562 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
1563 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
|
|
1564 if ( !v63 || !Str )
|
|
1565 {
|
|
1566 v71 = pPlayer->SelectPhrasesTransaction(v70, BildingType_AlchemistShop, v68, 2);
|
|
1567 v38 = (char *)pMerchantsBuyPhrases[v71];
|
|
1568 }
|
|
1569 else
|
|
1570 {
|
|
1571 v38 = pGlobalTXT_LocalizationStrings[181];
|
|
1572 }
|
|
1573 v21 = BuilDialogueString(v38, uActiveCharacter - 1, v70, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
1574 v40 = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0);
|
|
1575 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3);
|
|
1576 return;
|
|
1577 }
|
|
1578 }
|
|
1579 return;
|
|
1580 }
|
|
1581 case HOUSE_DIALOGUE_LEARN_SKILLS:
|
|
1582 {
|
|
1583 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
|
|
1584 return;
|
|
1585 all_text_height = 0;
|
|
1586 v5 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
1587 pItemNum = v5 * (100 - pPlayer->GetMerchant()) / 100;
|
|
1588 if ( pItemNum < v5 / 3 )
|
|
1589 pItemNum = v5 / 3;
|
|
1590 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1591 v114 = 0;
|
|
1592 if ( pNumActiveItem >= pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1593 {
|
|
1594 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
1595 strcat(pTmpBuf.data(), "\n \n");
|
|
1596 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
|
|
1597 v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
|
|
1598 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
|
|
1599 return;
|
|
1600 }
|
|
1601 do
|
|
1602 {
|
|
1603 v8 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36;
|
|
1604 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v8] && !pPlayer->pActiveSkills[v8] )
|
|
1605 {
|
|
1606 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v8], &dialog_window, 0, 0);
|
|
1607 ++v114;
|
|
1608 }
|
|
1609 ++pNumActiveItem;
|
|
1610 }
|
|
1611 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
1612 if ( !v114 )
|
|
1613 {
|
|
1614 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]);
|
|
1615 strcat(pTmpBuf.data(), "\n \n");
|
|
1616 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
|
|
1617 v40 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0);
|
|
1618 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
|
|
1619 return;
|
|
1620 }
|
|
1621 if ( v114 )
|
|
1622 {
|
|
1623 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum);
|
|
1624 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
|
|
1625 v18 = (149 - all_text_height) / v114;
|
|
1626 if ( (149 - all_text_height) / v114 > 32 )
|
|
1627 v18 = 32;
|
|
1628 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
|
|
1629 v105 = (149 - v114 * v18 - all_text_height) / 2 - v18 / 2 + 162;
|
|
1630 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
1631 {
|
|
1632 pItemNum = 2;
|
|
1633 do
|
|
1634 {
|
|
1635 pButton = pDialogueWindow->GetControl(pItemNum);
|
|
1636 v13 = pButton->msg_param - 36;
|
|
1637 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v13] || pPlayer->pActiveSkills[v13] )
|
|
1638 {
|
|
1639 pButton->uW = 0;
|
|
1640 pButton->uHeight = 0;
|
|
1641 pButton->uY = 0;
|
|
1642 }
|
|
1643 else
|
|
1644 {
|
|
1645 pButton->uY = v18 + v105;
|
|
1646 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v13], &dialog_window, 0, 0);
|
|
1647 pButton->uHeight = pTextHeight;
|
|
1648 v105 = pButton->uY + pTextHeight - 1;
|
|
1649 pButton->uW = v105;
|
|
1650 pColorText = pColorYellow;
|
|
1651 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
|
|
1652 pColorText = pColorWhite;
|
|
1653 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v13], 3);
|
|
1654 }
|
|
1655 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem;
|
|
1656 pItemNum++;
|
|
1657 }
|
|
1658 while ( pItemNum < pNumActiveItem );
|
|
1659 }
|
|
1660 return;
|
|
1661 }
|
|
1662 }
|
|
1663 default:
|
|
1664 {
|
|
1665 return;// (POINT *)dialog_menu_id - 96;
|
|
1666 }
|
|
1667 }
|
|
1668 }
|
|
1669 //----- (004B4FCF) --------------------------------------------------------
|
|
1670 void MagicShopDialog()
|
|
1671 {
|
|
1672 int result; // eax@6
|
|
1673 signed int v2; // esi@8
|
|
1674 unsigned int v3; // ebx@10
|
|
1675 char *v4; // eax@11
|
|
1676 char *v5; // eax@12
|
|
1677 unsigned int v6; // eax@12
|
|
1678 int v7; // ST08_4@14
|
|
1679 int v8; // eax@14
|
|
1680 unsigned __int8 v9; // dl@14
|
|
1681 char *v10; // ecx@14
|
|
1682 signed int v11; // esi@16
|
|
1683 int v12; // ST08_4@19
|
|
1684 int v13; // eax@19
|
|
1685 int all_text_height; // edi@21
|
|
1686 char **v15; // esi@21
|
|
1687 int v16; // eax@22
|
|
1688 int v18; // edx@23
|
|
1689 int v19; // edi@23
|
|
1690 unsigned __int8 v20; // sf@23
|
|
1691 GUIButton *control_button; // esi@25
|
|
1692 const char **v22; // eax@25
|
|
1693 int v23; // eax@25
|
|
1694 unsigned int v24; // ecx@25
|
|
1695 const char **v25; // edx@25
|
|
1696 unsigned __int16 text_color; // ax@25
|
|
1697 signed int pTextHeight; // esi@30
|
|
1698 int v28; // ST08_4@34
|
|
1699 int v29; // eax@34
|
|
1700 char *v30; // edx@35
|
|
1701 void *v32; // eax@40
|
|
1702 signed int v33; // esi@40
|
|
1703 unsigned int v34; // esi@42
|
|
1704 int v35; // eax@42
|
|
1705 unsigned int v36; // eax@43
|
|
1706 int v37; // eax@45
|
|
1707 int v38; // ecx@50
|
|
1708 int v41; // eax@52
|
|
1709 char *v42; // eax@54
|
|
1710 int v43; // eax@54
|
|
1711 unsigned int v44; // ecx@54
|
|
1712 int v45; // edx@54
|
|
1713 int v46; // eax@54
|
|
1714 unsigned __int16 v47; // ax@54
|
|
1715 int v48; // eax@58
|
|
1716 signed int v49; // esi@62
|
|
1717 Texture *v50; // ecx@64
|
|
1718 unsigned int v51; // edi@64
|
|
1719 unsigned int v52; // esi@66
|
|
1720 int v53; // edx@70
|
|
1721 Texture *v54; // ecx@76
|
|
1722 unsigned int v55; // edi@76
|
|
1723 unsigned int v56; // esi@76
|
|
1724 int v57; // edx@80
|
|
1725 unsigned int v59; // edi@86
|
|
1726 unsigned int v60; // esi@88
|
|
1727 int v61; // edx@92
|
|
1728 unsigned int v63; // edi@98
|
|
1729 unsigned int v64; // esi@100
|
|
1730 int v65; // edx@104
|
|
1731 signed int v66; // ecx@109
|
|
1732 SHORT v67; // di@117
|
|
1733 bool v68; // eax@117
|
|
1734 const char *v69; // ecx@119
|
|
1735 POINT *v70; // esi@124
|
|
1736 int v71; // ecx@125
|
|
1737 int v73; // ecx@125
|
|
1738 int v75; // eax@130
|
|
1739 int v78; // eax@132
|
|
1740 int v80; // edx@133
|
|
1741 int v81; // edi@133
|
|
1742 const char **v83; // eax@135
|
|
1743 int v84; // eax@135
|
|
1744 unsigned int v85; // ecx@135
|
|
1745 int v86; // edx@135
|
|
1746 int v89; // [sp-14h] [bp-10Ch]@35
|
|
1747 int v91; // [sp-10h] [bp-108h]@35
|
|
1748 unsigned __int16 v92; // [sp-Ch] [bp-104h]@12
|
|
1749 void *v93; // [sp-Ch] [bp-104h]@14
|
|
1750 int v94; // [sp-8h] [bp-100h]@11
|
|
1751 char *v95; // [sp-8h] [bp-100h]@12
|
|
1752 __int64 *v96; // [sp-4h] [bp-FCh]@11
|
|
1753 unsigned int v97; // [sp-4h] [bp-FCh]@12
|
|
1754 POINT v98; // [sp+Ch] [bp-ECh]@8
|
|
1755 POINT v99; // [sp+14h] [bp-E4h]@16
|
|
1756 POINT v100; // [sp+1Ch] [bp-DCh]@124
|
|
1757 POINT v101; // [sp+24h] [bp-D4h]@17
|
|
1758 POINT v102; // [sp+2Ch] [bp-CCh]@124
|
|
1759 POINT v103; // [sp+34h] [bp-C4h]@9
|
|
1760 POINT v104; // [sp+3Ch] [bp-BCh]@31
|
|
1761 POINT v105; // [sp+44h] [bp-B4h]@16
|
|
1762 POINT v106; // [sp+4Ch] [bp-ACh]@30
|
|
1763 POINT v107; // [sp+54h] [bp-A4h]@16
|
|
1764 POINT v108; // [sp+5Ch] [bp-9Ch]@30
|
|
1765 POINT a2; // [sp+64h] [bp-94h]@8
|
|
1766 POINT v110; // [sp+6Ch] [bp-8Ch]@30
|
|
1767 POINT v111; // [sp+74h] [bp-84h]@8
|
|
1768 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1
|
|
1769 char *Str; // [sp+D0h] [bp-28h]@54
|
|
1770 int v146; // [sp+D4h] [bp-24h]@23
|
|
1771 unsigned int pYellowColor; // [sp+D8h] [bp-20h]@1
|
|
1772 unsigned int pWhiteColor; // [sp+DCh] [bp-1Ch]@1
|
|
1773 __int32 v117; // [sp+E0h] [bp-18h]@8
|
|
1774 int v118; // [sp+E4h] [bp-14h]@40
|
|
1775 const char **v119; // [sp+E8h] [bp-10h]@24
|
|
1776 int _this; // [sp+ECh] [bp-Ch]@1
|
|
1777 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14
|
|
1778 int v152; // [sp+F4h] [bp-4h]@23
|
|
1779 int v122;
|
|
1780 int v114;
|
|
1781 int pSrtingNum;
|
|
1782 int pActiveItemNum;
|
|
1783 ItemGen *item;
|
|
1784
|
|
1785 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
|
|
1786 dialog_window.uFrameX = 483;
|
|
1787 dialog_window.uFrameWidth = 148;
|
|
1788 dialog_window.uFrameZ = 334;
|
|
1789 pWhiteColor = TargetColor(255, 255, 255);
|
|
1790 pYellowColor = TargetColor(225, 205, 35);
|
|
1791 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
|
|
1792 {
|
|
1793 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1794 return;
|
|
1795 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
|
|
1796 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
|
|
1797 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
|
|
1798 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
|
|
1799 all_text_height = 0;
|
|
1800 for ( int i = 0; i < 4; ++i )
|
|
1801 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
1802 v146 = (174 - all_text_height) / 4;
|
|
1803 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
|
|
1804 int j = 0;
|
|
1805 if ( pDialogueWindow->pNumPresenceButton>=0 )
|
|
1806 {
|
|
1807 int th = 2;
|
|
1808 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
|
|
1809 {
|
|
1810 control_button = pDialogueWindow->GetControl(v152);
|
|
1811 control_button->uY = v146 + v23;
|
|
1812 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
|
|
1813 control_button->uHeight = pTextHeight;
|
|
1814 v23 = control_button->uY + control_button->uHeight - 1;
|
|
1815 control_button->uW = v23;
|
|
1816 text_color = pYellowColor;
|
|
1817 if ( pDialogueWindow->pCurrentPosActiveItem != th )
|
|
1818 text_color = pWhiteColor;
|
|
1819 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
|
|
1820 ++th;
|
|
1821 ++j;
|
|
1822 }
|
|
1823 }
|
|
1824 return;
|
|
1825 }
|
|
1826 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
1827 {
|
|
1828 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
1829 v3 = 0;
|
|
1830 v49 = 0;
|
|
1831 v122 = 0;
|
|
1832 do
|
|
1833 {
|
|
1834 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
|
|
1835 {
|
|
1836 v50 = ItemsInShopTexture[v49];
|
|
1837 v51 = 152 - v50->uTextureHeight;
|
|
1838 if ( (signed int)v51 < 1 )
|
|
1839 v51 = 0;
|
|
1840 v52 = 75 * v49 - v50->uTextureWidth / 2 + 40;
|
|
1841 if ( v122 )
|
|
1842 {
|
|
1843 if ( v122 == 5 )
|
|
1844 {
|
|
1845 v53 = ItemsInShopTexture[5]->uTextureWidth;
|
|
1846 if ( (signed int)v52 > 457 - v53 )
|
|
1847 v52 = 457 - v53;
|
|
1848 }
|
|
1849 }
|
|
1850 else
|
|
1851 {
|
|
1852 if ( (signed int)v52 < 18 )
|
|
1853 v52 = 18;
|
|
1854 }
|
|
1855 pRenderer->DrawTextureTransparent(v52, v51, v50);
|
|
1856 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1);
|
|
1857 v49 = v122;
|
|
1858 }
|
|
1859 ++v49;
|
|
1860 v122 = v49;
|
|
1861 }
|
|
1862 while ( v49 < 6 );
|
|
1863 v122 = 0;
|
|
1864 do
|
|
1865 {
|
|
1866 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID)
|
|
1867 {
|
|
1868 v54 = ItemsInShopTexture[v122 + 6];
|
|
1869 v55 = 306 - v54->uTextureHeight;
|
|
1870 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40;
|
|
1871 if ( v122 )
|
|
1872 {
|
|
1873 if ( v122 == 5 )
|
|
1874 {
|
|
1875 v57 = ItemsInShopTexture[11]->uTextureWidth;
|
|
1876 if ( (signed int)v56 > 457 - v57 )
|
|
1877 v56 = 457 - v57;
|
|
1878 }
|
|
1879 }
|
|
1880 else
|
|
1881 {
|
|
1882 if ( (signed int)v56 < 18 )
|
|
1883 v56 = 18;
|
|
1884 }
|
|
1885 pRenderer->DrawTextureTransparent(v56, v55, v54);
|
|
1886 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7);
|
|
1887 }
|
|
1888 ++v122;
|
|
1889 }
|
|
1890 while ( v122 < 6 );
|
|
1891 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
1892 {
|
|
1893 v66 = 0;
|
|
1894 v117 = 0;
|
|
1895 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
1896 {
|
|
1897 do
|
|
1898 {
|
|
1899 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
1900 ++v117;
|
|
1901 ++v66;
|
|
1902 }
|
|
1903 while ( v66 < 12 );
|
|
1904 }
|
|
1905 else
|
|
1906 {
|
|
1907 do
|
|
1908 {
|
|
1909 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
|
|
1910 ++v117;
|
|
1911 ++v66;
|
|
1912 }
|
|
1913 while ( v66 < 12 );
|
|
1914 }
|
|
1915 v67 = GetAsyncKeyState(VK_CONTROL);
|
|
1916 v68 = pPlayers[uActiveCharacter]->CanSteal();
|
|
1917 Str = (char *)v68;
|
|
1918 if ( v67 && v68 )
|
|
1919 {
|
|
1920 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
|
|
1921 }
|
|
1922 else
|
|
1923 {
|
|
1924 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
|
|
1925 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
1926 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
|
|
1927 }
|
|
1928 DrawTextAtStatusBar(v69, 0);
|
|
1929 if ( !v117 )
|
|
1930 {
|
|
1931 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
1932 return;
|
|
1933 }
|
|
1934 v70 = pMouse->GetCursorPos(&v102);
|
|
1935 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
|
|
1936 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
1937 {
|
|
1938 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
|
|
1939 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
|
|
1940 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
1941 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
|
|
1942 if ( v67 && Str )
|
|
1943 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
|
|
1944 else
|
|
1945 {
|
|
1946 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
|
|
1947 v10 = (char *)pMerchantsBuyPhrases[v75];
|
|
1948 }
|
|
1949 v30 = BuilDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
1950 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
|
|
1951 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
|
|
1952 return;
|
|
1953 }
|
|
1954 }
|
|
1955 return;
|
|
1956 }
|
|
1957 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL)
|
|
1958 {
|
|
1959 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
|
|
1960 v3 = 0;
|
|
1961 v49 = 0;
|
|
1962 v122 = 0;
|
|
1963 do
|
|
1964 {
|
|
1965 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
|
|
1966 {
|
|
1967 v59 = 152 - ItemsInShopTexture[v49]->uTextureHeight;
|
|
1968 if ( (signed int)v59 < 1 )
|
|
1969 v59 = 0;
|
|
1970 v60 = 75 * v49 - ItemsInShopTexture[v49]->uTextureWidth / 2 + 40;
|
|
1971 if ( v122 )
|
|
1972 {
|
|
1973 if ( v122 == 5 )
|
|
1974 {
|
|
1975 v61 = ItemsInShopTexture[5]->uTextureWidth;
|
|
1976 if ( (signed int)v60 > 457 - v61 )
|
|
1977 v60 = 457 - v61;
|
|
1978 }
|
|
1979 }
|
|
1980 else
|
|
1981 {
|
|
1982 if ( (signed int)v60 < 18 )
|
|
1983 v60 = 18;
|
|
1984 }
|
|
1985 pRenderer->DrawTextureTransparent(v60, v59, ItemsInShopTexture[v49]);
|
|
1986 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1);
|
|
1987 v49 = v122;
|
|
1988 }
|
|
1989 ++v49;
|
|
1990 v122 = v49;
|
|
1991 }
|
|
1992 while ( v49 < 6 );
|
|
1993 v122 = 0;
|
|
1994 do
|
|
1995 {
|
|
1996 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122 + 6].uItemID)
|
|
1997 {
|
|
1998 v63 = 306 - ItemsInShopTexture[v122 + 6]->uTextureHeight;
|
|
1999 if ( (signed int)v63 < 1 )
|
|
2000 v63 = 0;
|
|
2001 v64 = 75 * v122 - ItemsInShopTexture[v122 + 6]->uTextureWidth / 2 + 40;
|
|
2002 if ( v122 )
|
|
2003 {
|
|
2004 if ( v122 == 5 )
|
|
2005 {
|
|
2006 v65 = ItemsInShopTexture[11]->uTextureWidth;
|
|
2007 if ( (signed int)v64 > 457 - v65 )
|
|
2008 v64 = 457 - v65;
|
|
2009 }
|
|
2010 }
|
|
2011 else
|
|
2012 {
|
|
2013 if ( (signed int)v64 < 18 )
|
|
2014 v64 = 18;
|
|
2015 }
|
|
2016 pRenderer->DrawTextureTransparent(v64, v63, ItemsInShopTexture[v122 + 6]);
|
|
2017 sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7);
|
|
2018 }
|
|
2019 ++v122;
|
|
2020 }
|
|
2021 while ( v122 < 6 );
|
|
2022 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2023 {
|
|
2024 v66 = 0;
|
|
2025 v117 = 0;
|
|
2026 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
2027 {
|
|
2028 do
|
|
2029 {
|
|
2030 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
|
|
2031 ++v117;
|
|
2032 ++v66;
|
|
2033 }
|
|
2034 while ( v66 < 12 );
|
|
2035 }
|
|
2036 else
|
|
2037 {
|
|
2038 do
|
|
2039 {
|
|
2040 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID)
|
|
2041 ++v117;
|
|
2042 ++v66;
|
|
2043 }
|
|
2044 while ( v66 < 12 );
|
|
2045 }
|
|
2046 v67 = GetAsyncKeyState(VK_CONTROL);
|
|
2047 v68 = pPlayers[uActiveCharacter]->CanSteal();
|
|
2048 Str = (char *)v68;
|
|
2049 if ( v67 && v68 )
|
|
2050 {
|
|
2051 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item"
|
|
2052 }
|
|
2053 else
|
|
2054 {
|
|
2055 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
|
|
2056 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
2057 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
|
|
2058 }
|
|
2059 DrawTextAtStatusBar(v69, 0);
|
|
2060 if ( !v117 )
|
|
2061 {
|
|
2062 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
|
|
2063 return;
|
|
2064 }
|
|
2065 v70 = pMouse->GetCursorPos(&v102);
|
|
2066 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
|
|
2067 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
|
|
2068 {
|
|
2069 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
|
|
2070 item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
|
|
2071 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
2072 item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v71];
|
|
2073 if ( v67 && Str )
|
|
2074 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
|
|
2075 else
|
|
2076 {
|
|
2077 v75 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
|
|
2078 v10 = (char *)pMerchantsBuyPhrases[v75];
|
|
2079 }
|
|
2080 v30 = BuilDialogueString(v10, uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
|
|
2081 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
|
|
2082 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
|
|
2083 return;
|
|
2084 }
|
|
2085 }
|
|
2086 return;
|
|
2087 }
|
|
2088 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
|
|
2089 {
|
|
2090 draw_leather();
|
|
2091 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
2092 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell"
|
|
2093 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify"
|
|
2094 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair"
|
|
2095 all_text_height = 0;
|
|
2096 for ( uint i = 0; i < 3; ++i )
|
|
2097 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
|
|
2098 _this = ((174 - all_text_height) / 3);
|
|
2099 v81 = (3 * (58 - (signed int)_this) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138;
|
|
2100 v20 = -pDialogueWindow->pNumPresenceButton < 0;
|
|
2101 v118 = pDialogueWindow->pStartingPosActiveItem;
|
|
2102 if ( v20 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) )
|
|
2103 {
|
|
2104 v122 = 2;
|
|
2105 pSrtingNum = 0;
|
|
2106 do
|
|
2107 {
|
|
2108 control_button = pDialogueWindow->GetControl(v118);
|
|
2109 control_button->uY = (unsigned int)((char *)_this + v81);
|
|
2110 pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pSrtingNum], &dialog_window, 0, 0);
|
|
2111 v85 = control_button->uY;
|
|
2112 control_button->uHeight = pTextHeight;
|
|
2113 v81 = pTextHeight + v85 - 1;
|
|
2114 control_button->uW = v81;
|
|
2115 text_color = pYellowColor;
|
|
2116 if ( pDialogueWindow->pCurrentPosActiveItem != v122 )
|
|
2117 text_color = pWhiteColor;
|
|
2118 dialog_window.DrawTitleText(pFontArrus, 0, v85, text_color, pShopOptions[pSrtingNum], 3);
|
|
2119 ++v122;
|
|
2120 ++pSrtingNum;
|
|
2121 ++v118;
|
|
2122 }
|
|
2123 while ( v118 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
2124 }
|
|
2125 return;
|
|
2126 }
|
|
2127 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL)
|
|
2128 {
|
|
2129 draw_leather();
|
|
2130 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
2131 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell"
|
|
2132 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()
|
|
2133 || (v11 = pMouse->GetCursorPos(&v107)->x - 14,
|
|
2134 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5),
|
|
2135 result = (int)pMouse->GetCursorPos(&v105),
|
|
2136 *(int *)result <= 13)
|
|
2137 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462)
|
|
2138 || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) )
|
|
2139 return;
|
|
2140 item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1];
|
|
2141 v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3);
|
|
2142 v30 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0);
|
|
2143 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
|
|
2144 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
|
|
2145 return;
|
|
2146 }
|
|
2147 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY)
|
|
2148 {
|
|
2149 draw_leather();
|
|
2150 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
2151 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify"
|
|
2152 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2153 {
|
|
2154 v2 = pMouse->GetCursorPos(&a2)->x - 14;
|
|
2155 v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5);
|
|
2156 result = (int)pMouse->GetCursorPos(&v111);
|
|
2157 if ( *(int *)result > 13 )
|
|
2158 {
|
|
2159 result = (int)pMouse->GetCursorPos(&v103);
|
|
2160 if ( *(int *)result < 462 )
|
|
2161 {
|
|
2162 result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117);
|
|
2163 if ( result )
|
|
2164 {
|
|
2165 item = &pPlayers[uActiveCharacter]->pInventoryItems[result-1];
|
|
2166 if ( item->uAttributes & 1 )
|
|
2167 {
|
|
2168 v5 = BuilDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
2169 v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101;
|
|
2170 dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v5, 3);
|
|
2171 return;
|
|
2172 }
|
|
2173 v8 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 4);
|
|
2174 v30 = BuilDialogueString((char *)pMerchantsIdentifyPhrases[v8], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
|
|
2175 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, 0, 0)) / 2 + 138;
|
|
2176 dialog_window.DrawTitleText(pFontArrus, 0, v6, pWhiteColor, v30, 3);
|
|
2177 return;
|
|
2178 }
|
|
2179 }
|
|
2180 }
|
|
2181 }
|
|
2182 return;
|
|
2183 }
|
|
2184 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR)
|
|
2185 {
|
|
2186 draw_leather();
|
|
2187 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
2188 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair"
|
|
2189 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()
|
|
2190 || (pTextHeight = pMouse->GetCursorPos(&v110)->x - 14,
|
|
2191 v117 = (pTextHeight >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5),
|
|
2192 result = (int)pMouse->GetCursorPos(&v106),
|
|
2193 *(int *)result <= 13)
|
|
2194 || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462)
|
|
2195 || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result)
|
|
2196 // || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) )
|
|
2197 || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) )
|
|
2198 return;
|
|
2199 item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1];
|
|
2200 v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[result - 1], BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5);
|
|
2201 v30 = BuilDialogueString((char *)pMerchantsRepairPhrases[v29], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0);
|
|
2202 v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138;
|
|
2203 dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3);
|
|
2204 return;
|
|
2205 }
|
|
2206 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS )
|
|
2207 {
|
|
2208 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2209 {
|
|
2210 v3 = 0;
|
|
2211 all_text_height = 0;
|
|
2212 v33 = (signed __int64)(p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
2213 v119 = (const char **)(v33 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100);
|
|
2214 if ( (signed int)v119 < v33 / 3 )
|
|
2215 v119 = (const char **)(v33 / 3);
|
|
2216 pActiveItemNum = pDialogueWindow->pStartingPosActiveItem;
|
|
2217 v122 = 0;
|
|
2218 if ( (signed int)pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2219 {
|
|
2220 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//
|
|
2221 // "Seek knowledge elsewhere %s the %s"
|
|
2222 strcat(pTmpBuf.data(), "\n \n");
|
|
2223 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
|
2224 v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
|
|
2225 dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3);
|
|
2226 return;
|
|
2227 }
|
|
2228 do
|
|
2229 {
|
|
2230 v36 = pDialogueWindow->GetControl(pActiveItemNum)->msg_param - 36;
|
|
2231 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v36] && !pPlayers[uActiveCharacter]->pActiveSkills[v36] )
|
|
2232 {
|
|
2233 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0);
|
|
2234 ++v122;
|
|
2235 }
|
|
2236 ++pActiveItemNum;
|
|
2237 }
|
|
2238 while ( pActiveItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
2239 if ( !v122 )
|
|
2240 {
|
|
2241 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]);//
|
|
2242 // "Seek knowledge elsewhere %s the %s"
|
|
2243 strcat(pTmpBuf.data(), "\n \n");
|
|
2244 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further."
|
|
2245 v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138;
|
|
2246 dialog_window.DrawTitleText(pFontArrus, v3, v6, pYellowColor, pTmpBuf.data(), 3);
|
|
2247 return;
|
|
2248 }
|
|
2249 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu"
|
|
2250 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
|
|
2251 v119 = (const char **)((149 - all_text_height) / v122);
|
|
2252 if ( (149 - all_text_height) / v122 > 32 )
|
|
2253 v119 = (const char **)32;
|
|
2254 v38 = (149 - v122 * (signed int)v119 - all_text_height) / 2 - (signed int)v119 / 2 + 162;
|
|
2255 v118 = 2;
|
|
2256 if ( pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
|
|
2257 {
|
|
2258 v122 = 2;
|
|
2259 do
|
|
2260 {
|
|
2261 control_button = pDialogueWindow->GetControl(v122);
|
|
2262 v41 = control_button->msg_param - 36;
|
|
2263 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] || pPlayers[uActiveCharacter]->pActiveSkills[v41] )
|
|
2264 {
|
|
2265 control_button->uW = 0;
|
|
2266 control_button->uHeight = 0;
|
|
2267 control_button->uY = 0;
|
|
2268 }
|
|
2269 else
|
|
2270 {
|
|
2271 control_button->uY = (unsigned int)((char *)v119 + v38);
|
|
2272 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
|
|
2273 v44 = control_button->uY;
|
|
2274 control_button->uHeight = pTextHeight;
|
|
2275 v38 = v44 + pTextHeight - 1;
|
|
2276 control_button->uW = v38;
|
|
2277 text_color = pYellowColor;
|
|
2278 if ( pDialogueWindow->pCurrentPosActiveItem != v122 )
|
|
2279 text_color = pWhiteColor;
|
|
2280 dialog_window.DrawTitleText(pFontArrus, 0, v44, text_color, pSkillNames[v41], 3);
|
|
2281 }
|
|
2282 ++v122;
|
|
2283 }
|
|
2284 while ( v122 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
|
|
2285 }
|
|
2286 }
|
|
2287 return;
|
|
2288 }
|
|
2289 return;
|
|
2290 }
|
|
2291 //----- (004BDB56) --------------------------------------------------------
|
|
2292 void __cdecl UIShop_Buy_Identify_Repair()
|
|
2293 {
|
|
2294 int v8; // eax@15
|
|
2295 unsigned int pItemID; // esi@20
|
|
2296 ItemGen *item; // esi@21
|
|
2297 unsigned int v15; // eax@33
|
|
2298 POINT *pCursorPos; // esi@37
|
|
2299 int v18; // ecx@37
|
|
2300 float pPriceMultiplier; // ST1C_4@38
|
|
2301 int taken_item; // eax@40
|
|
2302 ItemGen *bought_item; // esi@51
|
|
2303 int party_reputation; // eax@55
|
|
2304 int v39; // eax@63
|
|
2305 int v42; // esi@74
|
|
2306 signed int v43; // ebx@74
|
|
2307 unsigned __int16 *pSkill; // esi@77
|
|
2308 int v55; // [sp+0h] [bp-B4h]@26
|
|
2309 POINT cursor; // [sp+40h] [bp-74h]@37
|
|
2310 int a6; // [sp+98h] [bp-1Ch]@57
|
|
2311 int a3; // [sp+9Ch] [bp-18h]@53
|
|
2312 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53
|
|
2313 unsigned int v79; // [sp+A8h] [bp-Ch]@9
|
|
2314 int uPriceItemService; // [sp+ACh] [bp-8h]@12
|
|
2315
|
|
2316 if ( pCurrentScreen == SCREEN_E )
|
|
2317 {
|
|
2318 OnInventoryLeftClick();
|
|
2319 return;
|
|
2320 }
|
|
2321 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
|
|
2322 {
|
|
2323 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
2324 return;
|
|
2325 }
|
|
2326
|
|
2327 switch(dialog_menu_id)
|
|
2328 {
|
|
2329 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
|
|
2330 {
|
|
2331 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
|
|
2332 OnInventoryLeftClick();
|
|
2333 break;
|
|
2334 }
|
|
2335 case HOUSE_DIALOGUE_GUILD_BUY_BOOKS:
|
|
2336 {
|
|
2337 pCursorPos = pMouse->GetCursorPos(&cursor);
|
|
2338 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&cursor)->y]] & 0xFFFF;
|
|
2339 if ( !v18 )
|
|
2340 return;
|
|
2341 bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C));
|
|
2342 pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
2343 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier);
|
|
2344 GetAsyncKeyState(VK_CONTROL);
|
|
2345 if ( pParty->uNumGold < uPriceItemService )
|
|
2346 {
|
|
2347 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
|
|
2348 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
|
2349 return;
|
|
2350 }
|
|
2351 taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
|
|
2352 if ( taken_item )
|
|
2353 {
|
|
2354 bought_item->SetIdentified();
|
|
2355 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[taken_item - 1], bought_item, 0x24u);
|
|
2356 dword_F8B1E4 = 1;
|
|
2357 Party::TakeGold(uPriceItemService);
|
|
2358 viewparams->bRedrawGameUI = 1;
|
|
2359 bought_item->Reset();
|
|
2360 pRenderer->ClearZBuffer(0, 479);
|
|
2361 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
|
|
2362 return;
|
|
2363 }
|
|
2364 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
|
|
2365 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!"
|
|
2366 break;
|
|
2367 }
|
|
2368 case HOUSE_DIALOGUE_SHOP_SELL:
|
|
2369 {
|
|
2370 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5);
|
|
2371 if ( pMouse->GetCursorPos(&cursor)->x <= 13
|
|
2372 || pMouse->GetCursorPos(&cursor)->x >= 462
|
|
2373 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) )
|
|
2374 return;
|
|
2375 if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItems[v15 - 1], (int)window_SpeakInHouse->ptr_1C) )
|
|
2376 {
|
|
2377 dword_F8B1E4 = 1;
|
|
2378 pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C);
|
|
2379 viewparams->bRedrawGameUI = 1;
|
|
2380 pRenderer->ClearZBuffer(0, 479);
|
|
2381 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0);
|
|
2382 return;
|
|
2383 }
|
|
2384 pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0);
|
|
2385 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
2386 break;
|
|
2387 }
|
|
2388 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
|
|
2389 {
|
|
2390 pMouse->GetCursorPos(&cursor);
|
|
2391 v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5);
|
|
2392 if (cursor.x > 13 && cursor.x < 462)
|
|
2393 {
|
|
2394 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79);
|
|
2395 if ( pItemID )
|
|
2396 {
|
|
2397 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
|
|
2398 item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1];
|
|
2399 if ( !(item->uAttributes & 1) )
|
|
2400 {
|
|
2401 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) )
|
|
2402 {
|
|
2403 if ( pParty->uNumGold >= uPriceItemService )
|
|
2404 {
|
|
2405 dword_F8B1E4 = 1;
|
|
2406 Party::TakeGold(uPriceItemService);
|
|
2407 item->uAttributes |= 1;
|
|
2408 pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0);
|
|
2409 ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2);
|
|
2410 return;
|
|
2411 }
|
|
2412 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
|
|
2413 return;
|
|
2414 }
|
|
2415 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
2416 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
|
|
2417 return;
|
|
2418 }
|
|
2419 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
|
|
2420 return;
|
|
2421 }
|
|
2422 }
|
|
2423 break;
|
|
2424 }
|
|
2425 case HOUSE_DIALOGUE_SHOP_REPAIR:
|
|
2426 {
|
|
2427 v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5);
|
|
2428 if ( pMouse->GetCursorPos(&cursor)->x > 13 )
|
|
2429 {
|
|
2430 if ( pMouse->GetCursorPos(&cursor)->x < 462 )
|
|
2431 {
|
|
2432 pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79);
|
|
2433 if ( pItemID )
|
|
2434 {
|
|
2435 item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1];
|
|
2436 pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
|
|
2437 auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1];
|
|
2438 uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier);
|
|
2439 if ( item->uAttributes & 2 )
|
|
2440 {
|
|
2441 if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) )
|
|
2442 {
|
|
2443 if ( pParty->uNumGold >= uPriceItemService )
|
|
2444 {
|
|
2445 dword_F8B1E4 = 1;
|
|
2446 Party::TakeGold(uPriceItemService);
|
|
2447 v8 = item->uAttributes;
|
|
2448 LOBYTE(v8) = v8 & 0xFD;
|
|
2449 item->uAttributes = v8 | 1;
|
|
2450 pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0);
|
|
2451 ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2);
|
|
2452 return;
|
|
2453 }
|
|
2454 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
|
|
2455 return;
|
|
2456 }
|
|
2457 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
|
|
2458 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
|
|
2459 return;
|
|
2460 }
|
|
2461 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
|
|
2462 return;
|
|
2463 }
|
|
2464 }
|
|
2465 }
|
|
2466 break;
|
|
2467 }
|
|
2468 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
|
|
2469 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
|
|
2470 {
|
|
2471 pCursorPos = pMouse->GetCursorPos(&cursor);
|
|
2472 v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF;
|
|
2473 if ( !v18 )
|
|
2474 return;
|
|
2475 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
2476 bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];
|
|
2477 else
|
|
2478 bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
|
|
2479 uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
|
|
2480 uNumSeconds = 0;
|
|
2481 a3 = 0;
|
|
2482 if ( pMapStats->GetMapInfo(pCurrentMapName.data()) )
|
|
2483 a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())]._steal_perm;
|
|
2484 party_reputation = GetPartyReputation();
|
|
2485 if (pPlayers[uActiveCharacter]->CanSteal())
|
|
2486 {
|
|
2487 if ( GetAsyncKeyState(VK_CONTROL) )
|
|
2488 {
|
|
2489 uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6);
|
|
2490 if ( !uNumSeconds )
|
|
2491 {
|
|
2492 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6);
|
|
2493 return;
|
|
2494 }
|
|
2495 }
|
|
2496 }
|
|
2497 if ( pParty->uNumGold < uPriceItemService )
|
|
2498 {
|
|
2499 if ( uNumSeconds != 2 )
|
|
2500 {
|
|
2501 if ( uNumSeconds != 1 )
|
|
2502 {
|
|
2503 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
|
|
2504 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
|
|
2505 return;
|
|
2506 }
|
|
2507 }
|
|
2508 }
|
|
2509 v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
|
|
2510 if ( v39 )
|
|
2511 {
|
|
2512 bought_item->SetIdentified();
|
|
2513 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1], bought_item, sizeof(ItemGen));
|
|
2514 if ( pPlayers[uActiveCharacter]->CanSteal() )
|
|
2515 {
|
|
2516 if ( GetAsyncKeyState(VK_CONTROL) )
|
|
2517 {
|
|
2518 if ( uNumSeconds == 1 || uNumSeconds == 2 )
|
|
2519 {
|
|
2520 pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1].SetStolen();
|
|
2521 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6);
|
|
2522 viewparams->bRedrawGameUI = 1;
|
|
2523 bought_item->Reset();
|
|
2524 pRenderer->ClearZBuffer(0, 479);
|
|
2525 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
|
|
2526 return;
|
|
2527 }
|
|
2528 }
|
|
2529 }
|
|
2530 dword_F8B1E4 = 1;
|
|
2531 Party::TakeGold(uPriceItemService);
|
|
2532 viewparams->bRedrawGameUI = 1;
|
|
2533 bought_item->Reset();
|
|
2534 pRenderer->ClearZBuffer(0, 479);
|
|
2535 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
|
|
2536 return;
|
|
2537 }
|
|
2538 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
|
|
2539 ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!"
|
|
2540 break;
|
|
2541 }
|
|
2542 default:// if click video screen in shop
|
|
2543 {
|
|
2544 __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum
|
|
2545 if( dialog_menu_id >= 36 && dialog_menu_id <= 72 )
|
|
2546 {
|
|
2547 v42 = dialog_menu_id - 36;
|
|
2548 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
|
|
2549 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
|
|
2550 uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
|
|
2551 if ( uPriceItemService < v43 / 3 )
|
|
2552 uPriceItemService = v43 / 3;
|
|
2553 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] )
|
|
2554 {
|
|
2555 pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42];
|
|
2556 if ( !*pSkill )
|
|
2557 {
|
|
2558 if ( pParty->uNumGold < uPriceItemService )
|
|
2559 {
|
|
2560 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
|
|
2561 if ( in_current_building_type == BildingType_Training )
|
|
2562 v55 = 4;
|
|
2563 else
|
|
2564 v55 = 2;
|
|
2565 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55);
|
|
2566 return;
|
|
2567 }
|
|
2568 Party::TakeGold(uPriceItemService);
|
|
2569 dword_F8B1E4 = 1;
|
|
2570 *pSkill = 1;
|
|
2571 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0);
|
|
2572 return;
|
|
2573 }
|
|
2574 }
|
|
2575 }
|
|
2576 break;
|
|
2577 }
|
|
2578 }
|
|
2579 }
|
|
2580 //----- (004B1A2D) --------------------------------------------------------
|
|
2581 void __cdecl ShowPopupShopItem()
|
|
2582 {
|
|
2583 POINT *v1; // esi@5
|
|
2584 unsigned int v2; // eax@5
|
|
2585 int v3; // ecx@5
|
|
2586 POINT *v4; // esi@12
|
|
2587 int v5; // eax@12
|
|
2588 unsigned int v6; // eax@13
|
|
2589 ItemGen *v7; // ecx@13
|
|
2590 signed int v8; // esi@17
|
|
2591 unsigned int v9; // eax@19
|
|
2592 POINT v10; // [sp+8h] [bp-44h]@12
|
|
2593 POINT v11; // [sp+10h] [bp-3Ch]@12
|
|
2594 POINT v12; // [sp+18h] [bp-34h]@18
|
|
2595 POINT v13; // [sp+20h] [bp-2Ch]@17
|
|
2596 POINT v14; // [sp+28h] [bp-24h]@17
|
|
2597 POINT v15; // [sp+30h] [bp-1Ch]@17
|
|
2598 POINT v16; // [sp+38h] [bp-14h]@5
|
|
2599 POINT a2; // [sp+40h] [bp-Ch]@5
|
|
2600
|
|
2601 if ( in_current_building_type <= 0 )
|
|
2602 return;
|
|
2603 if ( in_current_building_type <= BildingType_AlchemistShop )
|
|
2604 {
|
|
2605 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
2606 {
|
|
2607 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
2608 return;
|
|
2609 if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT )
|
|
2610 {
|
|
2611 v8 = pMouse->GetCursorPos(&v15)->x - 14;
|
|
2612 v5 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5);
|
|
2613 if ( pMouse->GetCursorPos(&v13)->x <= 13
|
|
2614 || pMouse->GetCursorPos(&v12)->x >= 462
|
|
2615 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 )
|
|
2616 return;
|
|
2617 GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]);
|
|
2618 return;
|
|
2619 }
|
|
2620 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
|
|
2621 return;
|
|
2622 }
|
|
2623 v4 = pMouse->GetCursorPos(&v11);
|
|
2624 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF;
|
|
2625 if ( !v5 )
|
|
2626 return;
|
|
2627 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C);
|
|
2628 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4);
|
|
2629 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
|
|
2630 v7 = &pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5 - 1];
|
|
2631 GameUI_DrawItemInfo(v7);
|
|
2632 return;
|
|
2633 }
|
|
2634 if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS )
|
|
2635 {
|
|
2636 v1 = pMouse->GetCursorPos(&a2);
|
|
2637 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y];
|
|
2638 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
|
|
2639 v5 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
|
|
2640 if ( v5 )
|
|
2641 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C));
|
|
2642 }
|
|
2643 }
|
|
2644 //----- (004B1D27) --------------------------------------------------------
|
|
2645 void __cdecl sub_4B1D27()
|
|
2646 {
|
|
2647 int v0; // edx@2
|
|
2648 unsigned int v1; // ecx@7
|
|
2649 signed int v2; // edi@10
|
|
2650 int v3; // esi@10
|
|
2651 __int16 v4; // ax@15
|
|
2652 signed int v5; // edi@20
|
|
2653 int v6; // esi@20
|
|
2654 int v7[4]; // [sp+Ch] [bp-10h]@12
|
|
2655
|
|
2656 if ( in_current_building_type > 0 )
|
|
2657 {
|
|
2658 v0 = 3;
|
|
2659 if ( in_current_building_type > BildingType_MagicShop )
|
|
2660 {
|
|
2661 if ( in_current_building_type == BildingType_Bank )
|
|
2662 {
|
|
2663 if ( !dword_F8B1E4 )
|
|
2664 return;
|
|
2665 }
|
|
2666 else
|
|
2667 {
|
|
2668 if ( in_current_building_type != BildingType_Temple )
|
|
2669 return;
|
|
2670 }
|
|
2671 v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
|
|
2672 PlayHouseSound(v1, (HouseSoundID)v0);
|
|
2673 return;
|
|
2674 }
|
|
2675 v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
|
|
2676 if ( (signed __int64)pParty->field_3C._shop_ban_times[v1 ]<= (signed __int64)pParty->uTimePlayed )
|
|
2677 {
|
|
2678 if ( pParty->uNumGold <= 0x2710 )
|
|
2679 {
|
|
2680 if ( !dword_F8B1E4 )
|
|
2681 return;
|
|
2682 v0 = 4;
|
|
2683 PlayHouseSound(v1, (HouseSoundID)v0);
|
|
2684 return;
|
|
2685 }
|
|
2686 PlayHouseSound(v1, (HouseSoundID)(dword_F8B1E4 + 3));
|
|
2687 if ( !dword_F8B1E4 && !qword_A750D8 )
|
|
2688 {
|
|
2689 v5 = 0;
|
|
2690 v6 = 1;
|
|
2691 do
|
|
2692 {
|
|
2693 if ( pPlayers[v6]->CanAct() )
|
|
2694 v7[v5++] = v6;
|
|
2695 ++v6;
|
|
2696 }
|
|
2697 while ( v6 <= 4 );
|
|
2698 if ( v5 )
|
|
2699 {
|
|
2700 qword_A750D8 = 256i64;
|
|
2701 word_A750E0 = 80;
|
|
2702 v4 = LOWORD(v7[rand() % v5]);
|
|
2703 word_A750E2 = v4;
|
|
2704 return;
|
|
2705 }
|
|
2706 }
|
|
2707 }
|
|
2708 else
|
|
2709 {
|
|
2710 if ( !qword_A750D8 )
|
|
2711 {
|
|
2712 v2 = 0;
|
|
2713 v3 = 1;
|
|
2714 do
|
|
2715 {
|
|
2716 if ( pPlayers[v3]->CanAct() )
|
|
2717 v7[v2++] = v3;
|
|
2718 ++v3;
|
|
2719 }
|
|
2720 while ( v3 <= 4 );
|
|
2721 if ( v2 )
|
|
2722 {
|
|
2723 qword_A750D8 = 256i64;
|
|
2724 word_A750E0 = 80;
|
|
2725 v4 = LOWORD(v7[rand() % v2]);
|
|
2726 word_A750E2 = v4;
|
|
2727 return;
|
|
2728 }
|
|
2729 }
|
|
2730 }
|
|
2731 }
|
|
2732 } |