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