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