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