Mercurial > mm7
comparison mm7_2.cpp @ 641:48ab06ab9766
Слияние
author | Ritor1 |
---|---|
date | Mon, 11 Mar 2013 20:03:02 +0600 |
parents | afc4cbf38aac 71ecba604995 |
children | 24a6c161d79b |
comparison
equal
deleted
inserted
replaced
640:afc4cbf38aac | 641:48ab06ab9766 |
---|---|
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 void __cdecl WeaponShopDialog() | |
980 { | |
981 //Player *v0; // ebx@1 | |
982 int pNumActiveItem; // 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 *pButton; // esi@27 | |
1003 int pNewItem; // 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 all_text_height; // 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 *pButton; // esi@100 | |
1053 const char **v72; // eax@100 | |
1054 int pTextHeight; // 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 dialog_window; // [sp+7Ch] [bp-7Ch]@1 | |
1083 char *Str; // [sp+D0h] [bp-28h]@55 | |
1084 __int32 v103; // [sp+D4h] [bp-24h]@25 | |
1085 int pColor2; // [sp+D8h] [bp-20h]@1 | |
1086 int pColorWhite; // [sp+DCh] [bp-1Ch]@1 | |
1087 POINT v106; // [sp+E0h] [bp-18h]@8 | |
1088 Player *pPlayer; // [sp+E8h] [bp-10h]@1 | |
1089 int pItemNum; // [sp+ECh] [bp-Ch]@26 | |
1090 const char **v109; // [sp+F0h] [bp-8h]@26 | |
1091 unsigned __int8 v110; // [sp+F7h] [bp-1h]@16 | |
1092 int pNumString; | |
1093 | |
1094 pPlayer = pPlayers[uActiveCharacter]; | |
1095 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
1096 dialog_window.uFrameX = 483; | |
1097 dialog_window.uFrameWidth = 148; | |
1098 dialog_window.uFrameZ = 334; | |
1099 pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
1100 pColor2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
1101 switch(dialog_menu_id) | |
1102 { | |
1103 case DIALOG_SHOP_MAIN: | |
1104 { | |
1105 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1106 if ( pNumActiveItem ) | |
1107 { | |
1108 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; | |
1109 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; | |
1110 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; | |
1111 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
1112 all_text_height = 0; | |
1113 for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); | |
1114 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
1115 v103 = (174 - all_text_height) / 4; | |
1116 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
1117 v18 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; | |
1118 v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | |
1119 v20 = -pDialogueWindow->pNumPresenceButton < 0; | |
1120 if ( v20 ^ pNumActiveItem > v18 ) | |
1121 { | |
1122 pItemNum = 2; | |
1123 pNumString = 0; | |
1124 do | |
1125 { | |
1126 pButton = pDialogueWindow->GetControl(pItemNum); | |
1127 pButton->uY = v103 + v19; | |
1128 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | |
1129 pButton->uHeight = pTextHeight; | |
1130 v19 = pButton->uY + pTextHeight - 1; | |
1131 pButton->uW = v19; | |
1132 v26 = pColor2; | |
1133 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1134 v26 = pColorWhite; | |
1135 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, v26, (const char *)pShopOptions[pNumString], 3); | |
1136 ++pItemNum; | |
1137 ++pNumString; | |
1138 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1139 } | |
1140 while ( pItemNum < pNumActiveItem ); | |
1141 } | |
1142 } | |
1143 break; | |
1144 } | |
1145 case DIALOG_SHOP_BUY_STANDART: | |
1146 { | |
1147 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1148 v3 = 0; | |
1149 v48 = 0; | |
1150 pItemNum = 0; | |
1151 v109 = 0; | |
1152 do | |
1153 { | |
1154 // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) | |
1155 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); | |
1156 { | |
1157 v49 = word_F8B158[(signed int)v48]; | |
1158 v50 = ItemsInShopTexture[(signed int)v48]; | |
1159 v49 += 30; | |
1160 v51 = 60 - ((signed int)v50->uTextureWidth >> 1); | |
1161 pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50); | |
1162 sub_40F92A(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); | |
1163 v48 = v109; | |
1164 } | |
1165 pItemNum += 70; | |
1166 v48 = (const char **)((char *)v48 + 1); | |
1167 v109 = v48; | |
1168 } | |
1169 while ( (signed int)v48 < 6 ); | |
1170 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1171 if ( pNumActiveItem ) | |
1172 { | |
1173 v55 = 0; | |
1174 v106.x = 0; | |
1175 v106.x = 0; | |
1176 do | |
1177 { | |
1178 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
1179 ++v106.x; | |
1180 ++v55; | |
1181 } | |
1182 while ( v55 < 6 ); | |
1183 v56 = GetAsyncKeyState(17); | |
1184 v57 = pPlayer->CanSteal(); | |
1185 Str = (char *)v57; | |
1186 if ( v56 && v57 ) | |
1187 { | |
1188 v58 = pGlobalTXT_LocalizationStrings[185]; | |
1189 } | |
1190 else | |
1191 { | |
1192 v58 = pGlobalTXT_LocalizationStrings[195]; | |
1193 if ( dialog_menu_id != 2 ) | |
1194 v58 = pGlobalTXT_LocalizationStrings[196]; | |
1195 } | |
1196 DrawTextAtStatusBar(v58, 0); | |
1197 if ( v106.x ) | |
1198 { | |
1199 v59 = pMouse->GetCursorPos(&v91); | |
1200 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]; | |
1201 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) | |
1202 { | |
1203 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; | |
1204 v106.x = v60; | |
1205 v61 = (int)window_SpeakInHouse->ptr_1C; | |
1206 // v62 = 9 * (v60 + 12 * v61); | |
1207 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; | |
1208 if ( dialog_menu_id != 2 ) | |
1209 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; | |
1210 if ( !v56 || !Str ) | |
1211 { | |
1212 v64 = pPlayer->_490EEE(v63, 1, v61, 2); | |
1213 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
1214 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); | |
1215 dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | |
1216 } | |
1217 else | |
1218 { | |
1219 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
1220 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); | |
1221 dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | |
1222 } | |
1223 } | |
1224 } | |
1225 else | |
1226 { | |
1227 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
1228 pNumActiveItem = 0; //added | |
1229 } | |
1230 } | |
1231 break; | |
1232 } | |
1233 case DIALOG_SHOP_SELL: | |
1234 { | |
1235 draw_leather(); | |
1236 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1237 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | |
1238 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
1239 return; | |
1240 if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5), | |
1241 pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462 | |
1242 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), v3 = 0, !pNumActiveItem) ) | |
1243 return; | |
1244 v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; | |
1245 v13 = pPlayer->_490EEE(v79, 1, (int)window_SpeakInHouse->ptr_1C, 3); | |
1246 v7 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0); | |
1247 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); | |
1248 dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | |
1249 break; | |
1250 } | |
1251 case DIALOG_SHOP_IDENTIFY: | |
1252 { | |
1253 draw_leather(); | |
1254 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1255 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | |
1256 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
1257 return; | |
1258 if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), | |
1259 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 | |
1260 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), v3 = 0, !pNumActiveItem) ) | |
1261 return; | |
1262 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; | |
1263 if (!v4->Identified()) | |
1264 { | |
1265 v10 = pPlayer->_490EEE(v4, 1, (int)window_SpeakInHouse->ptr_1C, 4); | |
1266 v7 = BuilDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
1267 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); | |
1268 dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | |
1269 } | |
1270 v7 = BuilDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
1271 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); | |
1272 dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | |
1273 break; | |
1274 } | |
1275 case DIALOG_SHOP_REPAIR: | |
1276 { | |
1277 draw_leather(); | |
1278 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1279 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); | |
1280 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) | |
1281 return; | |
1282 if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), | |
1283 pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 | |
1284 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), v3 = 0, !pNumActiveItem) | |
1285 || (pNumActiveItem = 9 * pNumActiveItem, !(pPlayer->field_1F5[4 * pNumActiveItem + 15] & 2)) ) | |
1286 return; | |
1287 v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; | |
1288 v10 = pPlayer->_490EEE(v4, 2, (int)window_SpeakInHouse->ptr_1C, 5); | |
1289 v7 = BuilDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0); | |
1290 pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138; | |
1291 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3); | |
1292 return; | |
1293 } | |
1294 break; | |
1295 case DIALOG_SHOP_DISPLAY_EQUIPMENT: | |
1296 { | |
1297 draw_leather(); | |
1298 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1299 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];//sell | |
1300 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];//identify | |
1301 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair | |
1302 all_text_height = 0; | |
1303 for ( int i = 0; i < 3; ++i ) | |
1304 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
1305 v103 = (174 - all_text_height) / 3; | |
1306 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
1307 v18 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; | |
1308 v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; | |
1309 v20 = -pDialogueWindow->pNumPresenceButton < 0; | |
1310 if ( v20 ^ pNumActiveItem > v18 ) | |
1311 { | |
1312 pItemNum = 2; | |
1313 pNumString = 0; | |
1314 do | |
1315 { | |
1316 pButton = pDialogueWindow->GetControl(pItemNum); | |
1317 pButton->uY = v103 + v70; | |
1318 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | |
1319 pButton->uHeight = pTextHeight; | |
1320 v70 = pButton->uY + pTextHeight - 1; | |
1321 pButton->uW = v70; | |
1322 v76 = pColor2; | |
1323 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
1324 v76 = pColorWhite; | |
1325 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, v76, (const char *)pShopOptions[pNumString], 3); | |
1326 ++pItemNum; | |
1327 ++pNumString; | |
1328 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
1329 } | |
1330 while ( pItemNum < pNumActiveItem ); | |
1331 } | |
1332 break; | |
1333 } | |
1334 case DIALOG_SHOP_BUY_SPECIAL: | |
1335 { | |
1336 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
1337 v3 = 0; | |
1338 v109 = 0; | |
1339 pItemNum = 0; | |
1340 do | |
1341 { | |
1342 // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) | |
1343 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) | |
1344 { | |
1345 v52 = word_F8B158[(signed int)v109] + 30; | |
1346 v53 = ItemsInShopTexture[(signed int)v109]; | |
1347 v54 = 60 - ((signed int)v53->uTextureWidth >> 1); | |
1348 pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53); | |
1349 sub_40F92A(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); | |
1350 } | |
1351 v109 = (const char **)((char *)v109 + 1); | |
1352 pItemNum += 70; | |
1353 } | |
1354 while ( (signed int)v109 < 6 ); | |
1355 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1356 if ( pNumActiveItem ) | |
1357 { | |
1358 v55 = 0; | |
1359 v106.x = 0; | |
1360 do | |
1361 { | |
1362 // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
1363 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) | |
1364 ++v106.x; | |
1365 ++v55; | |
1366 } | |
1367 while ( v55 < 6 ); | |
1368 v56 = GetAsyncKeyState(17); | |
1369 v57 = pPlayer->CanSteal(); | |
1370 Str = (char *)v57; | |
1371 if ( v56 && v57 ) | |
1372 { | |
1373 v58 = pGlobalTXT_LocalizationStrings[185]; | |
1374 } | |
1375 else | |
1376 { | |
1377 v58 = pGlobalTXT_LocalizationStrings[195]; | |
1378 if ( dialog_menu_id != 2 ) | |
1379 v58 = pGlobalTXT_LocalizationStrings[196]; | |
1380 } | |
1381 DrawTextAtStatusBar(v58, 0); | |
1382 if ( v106.x ) | |
1383 { | |
1384 v59 = pMouse->GetCursorPos(&v91); | |
1385 pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]; | |
1386 if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) | |
1387 { | |
1388 v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; | |
1389 v106.x = v60; | |
1390 v61 = (int)window_SpeakInHouse->ptr_1C; | |
1391 // v62 = 9 * (v60 + 12 * v61); | |
1392 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; | |
1393 if ( dialog_menu_id != 2 ) | |
1394 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; | |
1395 if ( !v56 || !Str ) | |
1396 { | |
1397 v64 = pPlayer->_490EEE(v63, 1, v61, 2); | |
1398 v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
1399 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); | |
1400 dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | |
1401 } | |
1402 else | |
1403 { | |
1404 v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); | |
1405 pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); | |
1406 dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); | |
1407 } | |
1408 } | |
1409 } | |
1410 else | |
1411 { | |
1412 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
1413 pNumActiveItem = 0; //added | |
1414 } | |
1415 } | |
1416 break; | |
1417 } | |
1418 case DIALOG_SHOP_SKILLS: | |
1419 { | |
1420 pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1421 if ( pNumActiveItem ) | |
1422 { | |
1423 v3 = 0; | |
1424 v31 = window_SpeakInHouse->ptr_1C; | |
1425 v106.y = 0; | |
1426 //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); | |
1427 v32 = (signed __int64)(p2DEvents[(signed int)v31 - 1].flt_24 * 500.0); | |
1428 pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100; | |
1429 if ( pItemNum < v32 / 3 ) | |
1430 pItemNum = v32 / 3; | |
1431 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
1432 v34 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; | |
1433 v109 = 0; | |
1434 if ( pNumActiveItem >= v34 ) | |
1435 { | |
1436 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); | |
1437 strcat(pTmpBuf, "\n \n"); | |
1438 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
1439 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0); | |
1440 dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColor2, pTmpBuf, 3); | |
1441 } | |
1442 do | |
1443 { | |
1444 v35 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36; | |
1445 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] ) | |
1446 { | |
1447 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0); | |
1448 v106.y += pTextHeight; | |
1449 v109 = (const char **)((char *)v109 + 1); | |
1450 } | |
1451 ++pNumActiveItem; | |
1452 } | |
1453 while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
1454 if ( !v109 ) | |
1455 { | |
1456 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); | |
1457 strcat(pTmpBuf, "\n \n"); | |
1458 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
1459 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0); | |
1460 dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColor2, pTmpBuf, 3); | |
1461 } | |
1462 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum); | |
1463 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3); | |
1464 pItemNum = (149 - v106.y) / (signed int)v109; | |
1465 if ( (149 - v106.y) / (signed int)v109 > 32 ) | |
1466 pItemNum = 32; | |
1467 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
1468 v37 = (149 - (signed int)v109 * pItemNum - v106.y) / 2 - pItemNum / 2 + 162; | |
1469 v106.y = (LONG)pNumActiveItem; | |
1470 v103 = v37; | |
1471 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | |
1472 { | |
1473 v109 = (const char **)2; | |
1474 do | |
1475 { | |
1476 pButton = pDialogueWindow->GetControl(v106.y); | |
1477 v40 = pButton->uControlParam - 36; | |
1478 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] ) | |
1479 { | |
1480 pButton->uW = 0; | |
1481 pButton->uHeight = 0; | |
1482 pButton->uY = 0; | |
1483 } | |
1484 else | |
1485 { | |
1486 pButton->uY = pItemNum + v103; | |
1487 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0); | |
1488 v43 = pButton->uY; | |
1489 v44 = v109; | |
1490 pButton->uHeight = pTextHeight; | |
1491 v45 = v43 + pTextHeight - 1; | |
1492 pButton->uW = v45; | |
1493 v103 = v45; | |
1494 v46 = pColor2; | |
1495 if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v44 ) | |
1496 v46 = pColorWhite; | |
1497 dialog_window.DrawTitleText(pFontArrus, 0, v43, v46, pSkillNames[v40], 3); | |
1498 } | |
1499 v47 = pDialogueWindow->pStartingPosActiveItem; | |
1500 ++v106.y; | |
1501 pNumActiveItem = pDialogueWindow->pNumPresenceButton + v47; | |
1502 v109 = (const char **)((char *)v109 + 1); | |
1503 } | |
1504 while ( v106.y < pNumActiveItem ); | |
1505 } | |
1506 } | |
1507 break; | |
1508 } | |
1509 default: | |
1510 { | |
1511 if( dialog_menu_id > 5 ) | |
1512 pNumActiveItem = dialog_menu_id - 96; | |
1513 else | |
1514 pNumActiveItem = dialog_menu_id - 4; | |
1515 break; | |
1516 } | |
1517 } | |
1518 } | |
1519 | |
1520 | |
1521 | |
1522 //----- (004B9CC6) -------------------------------------------------------- | |
1523 POINT *__cdecl AlchemistDialog() | |
1524 { | |
1525 Player *v0; // ebx@1 | |
1526 POINT *result; // eax@7 | |
1527 GUIWindow *v2; // edi@9 | |
1528 unsigned int v3; // ebx@9 | |
1529 void *v4; // eax@9 | |
1530 signed int v5; // esi@9 | |
1531 unsigned int v6; // esi@11 | |
1532 int v7; // eax@11 | |
1533 unsigned int v8; // eax@12 | |
1534 int v9; // eax@14 | |
1535 int v10; // ecx@19 | |
1536 GUIButton *v11; // eax@21 | |
1537 GUIButton *v12; // esi@21 | |
1538 int v13; // eax@21 | |
1539 char *v14; // eax@23 | |
1540 int v15; // eax@23 | |
1541 unsigned int v16; // ecx@23 | |
1542 int v17; // edx@23 | |
1543 int v18; // eax@23 | |
1544 unsigned __int16 v19; // ax@23 | |
1545 int v20; // eax@27 | |
1546 char *v21; // edx@29 | |
1547 int v22; // esi@30 | |
1548 char **v23; // edi@30 | |
1549 int v24; // eax@31 | |
1550 GUIWindow *v25; // ecx@32 | |
1551 int v26; // edx@32 | |
1552 int v27; // edi@32 | |
1553 unsigned __int8 v28; // sf@32 | |
1554 GUIButton *v29; // esi@34 | |
1555 const char **v30; // eax@34 | |
1556 int v31; // eax@34 | |
1557 unsigned int v32; // ecx@34 | |
1558 Player *v33; // edx@34 | |
1559 int v34; // eax@34 | |
1560 unsigned __int16 v35; // ax@34 | |
1561 signed int v36; // esi@39 | |
1562 ItemGen *v37; // eax@42 | |
1563 char *v38; // ecx@43 | |
1564 unsigned __int8 v39; // dl@44 | |
1565 int v40; // eax@46 | |
1566 int v41; // ST08_4@47 | |
1567 int v42; // eax@47 | |
1568 signed int v43; // esi@49 | |
1569 int v44; // ST08_4@52 | |
1570 int v45; // eax@52 | |
1571 Texture *v46; // ecx@55 | |
1572 unsigned int v47; // edi@55 | |
1573 unsigned int v48; // esi@57 | |
1574 int v49; // edx@61 | |
1575 Texture *v50; // ecx@67 | |
1576 unsigned int v51; // edi@67 | |
1577 unsigned int v52; // esi@69 | |
1578 int v53; // edx@73 | |
1579 Texture *v54; // ecx@79 | |
1580 unsigned int v55; // edi@79 | |
1581 unsigned int v56; // esi@81 | |
1582 int v57; // edx@85 | |
1583 Texture *v58; // ecx@91 | |
1584 unsigned int v59; // edi@91 | |
1585 unsigned int v60; // esi@93 | |
1586 int v61; // edx@97 | |
1587 signed int v62; // ecx@102 | |
1588 SHORT v63; // di@110 | |
1589 bool v64; // eax@110 | |
1590 const char *v65; // ecx@112 | |
1591 POINT *v66; // esi@117 | |
1592 int v67; // ecx@118 | |
1593 int v68; // eax@118 | |
1594 int v69; // ecx@118 | |
1595 ItemGen *v70; // esi@118 | |
1596 int v71; // eax@123 | |
1597 int v72; // edi@125 | |
1598 char **v73; // esi@125 | |
1599 int v74; // eax@126 | |
1600 GUIWindow *v75; // ecx@127 | |
1601 int v76; // edx@127 | |
1602 int v77; // edi@127 | |
1603 GUIButton *v78; // esi@129 | |
1604 const char **v79; // eax@129 | |
1605 int v80; // eax@129 | |
1606 unsigned int v81; // ecx@129 | |
1607 Player *v82; // edx@129 | |
1608 unsigned __int16 v83; // ax@129 | |
1609 GUIWindow *v84; // [sp-18h] [bp-F0h]@29 | |
1610 int v85; // [sp-14h] [bp-ECh]@29 | |
1611 int v86; // [sp-10h] [bp-E8h]@29 | |
1612 ItemGen *v87; // [sp-10h] [bp-E8h]@43 | |
1613 unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29 | |
1614 void *v89; // [sp-Ch] [bp-E4h]@43 | |
1615 char *v90; // [sp-8h] [bp-E0h]@29 | |
1616 int v91; // [sp-8h] [bp-E0h]@42 | |
1617 unsigned int v92; // [sp-4h] [bp-DCh]@29 | |
1618 __int64 *v93; // [sp-4h] [bp-DCh]@42 | |
1619 POINT v94; // [sp+Ch] [bp-CCh]@39 | |
1620 POINT v95; // [sp+14h] [bp-C4h]@49 | |
1621 POINT v96; // [sp+1Ch] [bp-BCh]@117 | |
1622 POINT v97; // [sp+24h] [bp-B4h]@40 | |
1623 POINT v98; // [sp+2Ch] [bp-ACh]@117 | |
1624 POINT v99; // [sp+34h] [bp-A4h]@49 | |
1625 POINT v100; // [sp+3Ch] [bp-9Ch]@50 | |
1626 POINT v101; // [sp+44h] [bp-94h]@39 | |
1627 POINT v102; // [sp+4Ch] [bp-8Ch]@49 | |
1628 POINT a2; // [sp+54h] [bp-84h]@39 | |
1629 GUIWindow v104; // [sp+5Ch] [bp-7Ch]@1 | |
1630 int v105; // [sp+B0h] [bp-28h]@19 | |
1631 int v106; // [sp+B4h] [bp-24h]@1 | |
1632 char *Str; // [sp+B8h] [bp-20h]@23 | |
1633 int v108; // [sp+BCh] [bp-1Ch]@1 | |
1634 __int32 v109; // [sp+C0h] [bp-18h]@39 | |
1635 Player *_this; // [sp+C4h] [bp-14h]@1 | |
1636 const char **v111; // [sp+C8h] [bp-10h]@9 | |
1637 unsigned int v112; // [sp+CCh] [bp-Ch]@9 | |
1638 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47 | |
1639 int v114; // [sp+D4h] [bp-4h]@11 | |
1640 | |
1641 v0 = pPlayers[uActiveCharacter]; | |
1642 _this = pPlayers[uActiveCharacter]; | |
1643 memcpy(&v104, window_SpeakInHouse, sizeof(v104)); | |
1644 v104.uFrameX = 483; | |
1645 v104.uFrameWidth = 148; | |
1646 v104.uFrameZ = 334; | |
1647 v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
1648 v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
1649 switch(dialog_menu_id) | |
1650 { | |
1651 case 1: | |
1652 { | |
1653 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1654 if ( result ) | |
1655 { | |
1656 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; | |
1657 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; | |
1658 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; | |
1659 v72 = 0; | |
1660 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
1661 v73 = pShopOptions; | |
1662 do | |
1663 { | |
1664 v74 = pFontArrus->CalcTextHeight(*v73, &v104, 0, 0); | |
1665 ++v73; | |
1666 v72 += v74; | |
1667 } | |
1668 while ( (signed int)v73 < (signed int)&unk_F8B1C8 ); | |
1669 v75 = pDialogueWindow; | |
1670 Str = (char *)((174 - v72) / 4); | |
1671 result = (POINT *)pDialogueWindow->pStartingPosActiveItem; | |
1672 v76 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); | |
1673 v77 = (174 - 4 * (174 - v72) / 4 - v72) / 2 - (174 - v72) / 4 / 2 + 138; | |
1674 v28 = -pDialogueWindow->pNumPresenceButton < 0; | |
1675 v112 = pDialogueWindow->pStartingPosActiveItem; | |
1676 if ( v28 ^ __OFSUB__((int)result, v76) ) | |
1677 { | |
1678 _this = (Player *)2; | |
1679 v111 = (const char **)pShopOptions; | |
1680 do | |
1681 { | |
1682 v78 = v75->GetControl(v112); | |
1683 v79 = v111; | |
1684 v78->uY = (unsigned int)&Str[v77]; | |
1685 v80 = pFontArrus->CalcTextHeight(*v79, &v104, 0, 0); | |
1686 v81 = v78->uY; | |
1687 v82 = _this; | |
1688 v78->uHeight = v80; | |
1689 v77 = v81 + v80 - 1; | |
1690 v78->uW = v77; | |
1691 v83 = v106; | |
1692 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v82 ) | |
1693 v83 = v108; | |
1694 v104.DrawTitleText(pFontArrus, 0, v81, v83, *v111, 3u); | |
1695 v75 = pDialogueWindow; | |
1696 _this = (Player *)((char *)_this + 1); | |
1697 ++v111; | |
1698 ++v112; | |
1699 result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); | |
1700 } | |
1701 while ( (signed int)v112 < (signed int)result ); | |
1702 } | |
1703 } | |
1704 return result; | |
1705 } | |
1706 case 3: | |
1707 { | |
1708 draw_leather(); | |
1709 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1710 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | |
1711 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1712 if ( !result | |
1713 || (v43 = pMouse->GetCursorPos(&v99)->x - 14, | |
1714 v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), | |
1715 result = pMouse->GetCursorPos(&v102), | |
1716 result->x <= 13) | |
1717 || (result = pMouse->GetCursorPos(&v100), result->x >= 462) | |
1718 || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) | |
1719 return result; | |
1720 v93 = 0; | |
1721 v91 = 3; | |
1722 v89 = window_SpeakInHouse->ptr_1C; | |
1723 v87 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; | |
1724 v44 = (int)window_SpeakInHouse->ptr_1C; | |
1725 v113 = uActiveCharacter - 1; | |
1726 v45 = _this->_490EEE(v87, 4, v44, 3); | |
1727 v39 = v113; | |
1728 v38 = (char *)pMerchantsSellPhrases[v45]; | |
1729 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); | |
1730 v92 = 3; | |
1731 v90 = v21; | |
1732 v88 = v108; | |
1733 v86 = v3; | |
1734 v85 = v3; | |
1735 v84 = &v104; | |
1736 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | |
1737 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | |
1738 } | |
1739 case 4: | |
1740 { | |
1741 draw_leather(); | |
1742 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1743 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | |
1744 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1745 if ( !result | |
1746 || (v36 = pMouse->GetCursorPos(&a2)->x - 14, | |
1747 v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), | |
1748 result = pMouse->GetCursorPos(&v101), | |
1749 result->x <= 13) | |
1750 || (result = pMouse->GetCursorPos(&v97), result->x >= 462) | |
1751 || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) | |
1752 return result; | |
1753 v93 = 0; | |
1754 v91 = 4; | |
1755 v37 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; | |
1756 if (!v37->Identified()) | |
1757 { | |
1758 v89 = window_SpeakInHouse->ptr_1C; | |
1759 v87 = v37; | |
1760 v41 = (int)window_SpeakInHouse->ptr_1C; | |
1761 v113 = uActiveCharacter - 1; | |
1762 v42 = _this->_490EEE(v37, 4, v41, 4); | |
1763 v39 = v113; | |
1764 v38 = (char *)pMerchantsIdentifyPhrases[v42]; | |
1765 } | |
1766 else | |
1767 { | |
1768 v89 = window_SpeakInHouse->ptr_1C; | |
1769 v38 = "%24"; | |
1770 v87 = v37; | |
1771 v39 = uActiveCharacter - 1; | |
1772 } | |
1773 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); | |
1774 v92 = 3; | |
1775 v90 = v21; | |
1776 v88 = v108; | |
1777 v86 = v3; | |
1778 v85 = v3; | |
1779 v84 = &v104; | |
1780 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | |
1781 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | |
1782 } | |
1783 case 94: | |
1784 { | |
1785 draw_leather(); | |
1786 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1787 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; | |
1788 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; | |
1789 v22 = 0; | |
1790 v23 = pShopOptions; | |
1791 do | |
1792 { | |
1793 v24 = pFontArrus->CalcTextHeight(*v23, &v104, 0, 0); | |
1794 ++v23; | |
1795 v22 += v24; | |
1796 } | |
1797 while ( (signed int)v23 < (signed int)&pShopOptions[2] ); | |
1798 Str = (char *)((174 - v22) / 2); | |
1799 v25 = pDialogueWindow; | |
1800 result = (POINT *)pDialogueWindow->pStartingPosActiveItem; | |
1801 v26 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); | |
1802 v27 = (2 * (87 - (174 - v22) / 2) - v22) / 2 - (174 - v22) / 2 / 2 + 138; | |
1803 v28 = -pDialogueWindow->pNumPresenceButton < 0; | |
1804 v112 = pDialogueWindow->pStartingPosActiveItem; | |
1805 if ( v28 ^ __OFSUB__((int)result, v26) ) | |
1806 { | |
1807 _this = (Player *)2; | |
1808 v111 = (const char **)pShopOptions; | |
1809 do | |
1810 { | |
1811 v29 = v25->GetControl(v112); | |
1812 v30 = v111; | |
1813 v29->uY = (unsigned int)&Str[v27]; | |
1814 v31 = pFontArrus->CalcTextHeight(*v30, &v104, 0, 0); | |
1815 v32 = v29->uY; | |
1816 v33 = _this; | |
1817 v29->uHeight = v31; | |
1818 v34 = v31 + v32 - 1; | |
1819 v29->uW = v34; | |
1820 v27 = v34; | |
1821 v35 = v106; | |
1822 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
1823 v35 = v108; | |
1824 v104.DrawTitleText(pFontArrus, 0, v32, v35, *v111, 3u); | |
1825 v25 = pDialogueWindow; | |
1826 _this = (Player *)((char *)_this + 1); | |
1827 ++v111; | |
1828 ++v112; | |
1829 result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); | |
1830 } | |
1831 while ( (signed int)v112 < (signed int)result ); | |
1832 } | |
1833 return result; | |
1834 } | |
1835 case 2: | |
1836 { | |
1837 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
1838 v3 = 0; | |
1839 v114 = 0; | |
1840 do | |
1841 { | |
1842 // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
1843 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); | |
1844 { | |
1845 v46 = ItemsInShopTexture[v114]; | |
1846 v47 = 152 - v46->uTextureHeight; | |
1847 if ( (signed int)v47 < 1 ) | |
1848 v47 = 0; | |
1849 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; | |
1850 if ( v114 ) | |
1851 { | |
1852 if ( v114 == 5 ) | |
1853 { | |
1854 v49 = ItemsInShopTexture[5]->uTextureWidth; | |
1855 if ( (signed int)v48 > 457 - v49 ) | |
1856 v48 = 457 - v49; | |
1857 } | |
1858 } | |
1859 else if ( (signed int)v48 < 18 ) | |
1860 v48 = 18; | |
1861 pRenderer->DrawTextureTransparent(v48, v47, v46); | |
1862 sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); | |
1863 } | |
1864 ++v114; | |
1865 } | |
1866 while ( v114 < 6 ); | |
1867 v114 = 0; | |
1868 do | |
1869 { | |
1870 // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) | |
1871 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); | |
1872 { | |
1873 v50 = ItemsInShopTexture[v114 + 6]; | |
1874 v51 = 308 - v50->uTextureHeight; | |
1875 if ( (signed int)v51 < 1 ) | |
1876 v51 = 0; | |
1877 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; | |
1878 if ( v114 ) | |
1879 { | |
1880 if ( v114 == 5 ) | |
1881 { | |
1882 v53 = ItemsInShopTexture[11]->uTextureWidth; | |
1883 if ( (signed int)v52 > 457 - v53 ) | |
1884 v52 = 457 - v53; | |
1885 } | |
1886 } | |
1887 else | |
1888 { | |
1889 if ( (signed int)v52 < 18 ) | |
1890 v52 = 18; | |
1891 } | |
1892 pRenderer->DrawTextureTransparent(v52, v51, v50); | |
1893 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); | |
1894 } | |
1895 ++v114; | |
1896 } | |
1897 while ( v114 < 6 ); | |
1898 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1899 if ( result ) | |
1900 { | |
1901 v62 = 0; | |
1902 v109 = 0; | |
1903 do | |
1904 { | |
1905 // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
1906 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); | |
1907 ++v109; | |
1908 ++v62; | |
1909 } | |
1910 while ( v62 < 12 ); | |
1911 v63 = GetAsyncKeyState(17); | |
1912 v64 = _this->CanSteal(); | |
1913 Str = (char *)v64; | |
1914 if ( v63 && v64 ) | |
1915 { | |
1916 v65 = pGlobalTXT_LocalizationStrings[185]; | |
1917 } | |
1918 else if ( dialog_menu_id == 2 ) | |
1919 { | |
1920 v65 = pGlobalTXT_LocalizationStrings[195]; | |
1921 } | |
1922 else | |
1923 { | |
1924 v65 = pGlobalTXT_LocalizationStrings[196]; | |
1925 } | |
1926 DrawTextAtStatusBar(v65, 0); | |
1927 if ( !v109 ) | |
1928 { | |
1929 v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
1930 return 0; | |
1931 } | |
1932 v66 = pMouse->GetCursorPos(&v98); | |
1933 result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); | |
1934 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) | |
1935 { | |
1936 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; | |
1937 v109 = v67; | |
1938 v68 = (int)window_SpeakInHouse->ptr_1C; | |
1939 // v69 = 9 * (v67 + 12 * v68); | |
1940 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; | |
1941 if ( dialog_menu_id != 2 ) | |
1942 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; | |
1943 if ( !v63 || !Str ) | |
1944 { | |
1945 v93 = 0; | |
1946 v91 = 2; | |
1947 v89 = window_SpeakInHouse->ptr_1C; | |
1948 v87 = v70; | |
1949 v113 = uActiveCharacter - 1; | |
1950 v71 = _this->_490EEE(v70, 4, v68, 2); | |
1951 v39 = v113; | |
1952 v38 = (char *)pMerchantsBuyPhrases[v71]; | |
1953 } | |
1954 else | |
1955 { | |
1956 v38 = pGlobalTXT_LocalizationStrings[181]; | |
1957 v93 = 0; | |
1958 v91 = 2; | |
1959 v89 = window_SpeakInHouse->ptr_1C; | |
1960 v87 = v70; | |
1961 v39 = uActiveCharacter - 1; | |
1962 } | |
1963 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); | |
1964 v92 = 3; | |
1965 v90 = v21; | |
1966 v88 = v108; | |
1967 v86 = v3; | |
1968 v85 = v3; | |
1969 v84 = &v104; | |
1970 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | |
1971 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | |
1972 } | |
1973 } | |
1974 return result; | |
1975 } | |
1976 case 95: | |
1977 { | |
1978 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
1979 v3 = 0; | |
1980 v114 = 0; | |
1981 do | |
1982 { | |
1983 //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
1984 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) | |
1985 { | |
1986 v54 = ItemsInShopTexture[v114]; | |
1987 v55 = 152 - v54->uTextureHeight; | |
1988 if ( (signed int)v55 < 1 ) | |
1989 v55 = 0; | |
1990 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; | |
1991 if ( v114 ) | |
1992 { | |
1993 if ( v114 == 5 ) | |
1994 { | |
1995 v57 = ItemsInShopTexture[5]->uTextureWidth; | |
1996 if ( (signed int)v56 > 457 - v57 ) | |
1997 v56 = 457 - v57; | |
1998 } | |
1999 } | |
2000 else | |
2001 { | |
2002 if ( (signed int)v56 < 18 ) | |
2003 v56 = 18; | |
2004 } | |
2005 pRenderer->DrawTextureTransparent(v56, v55, v54); | |
2006 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); | |
2007 } | |
2008 ++v114; | |
2009 } | |
2010 while ( v114 < 6 ); | |
2011 v114 = 0; | |
2012 do | |
2013 { | |
2014 // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak | |
2015 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid | |
2016 { | |
2017 v58 = ItemsInShopTexture[v114 + 6]; | |
2018 v59 = 308 - v58->uTextureHeight; | |
2019 if ( (signed int)v59 < 1 ) | |
2020 v59 = 0; | |
2021 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; | |
2022 if ( v114 ) | |
2023 { | |
2024 if ( v114 == 5 ) | |
2025 { | |
2026 v61 = ItemsInShopTexture[11]->uTextureWidth; | |
2027 if ( (signed int)v60 > 457 - v61 ) | |
2028 v60 = 457 - v61; | |
2029 } | |
2030 } | |
2031 else | |
2032 { | |
2033 if ( (signed int)v60 < 18 ) | |
2034 v60 = 18; | |
2035 } | |
2036 pRenderer->DrawTextureTransparent(v60, v59, v58); | |
2037 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); | |
2038 } | |
2039 ++v114; | |
2040 } | |
2041 while ( v114 < 6 ); | |
2042 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
2043 if ( result ) | |
2044 { | |
2045 v62 = 0; | |
2046 v109 = 0; | |
2047 do | |
2048 { | |
2049 //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
2050 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) | |
2051 ++v109; | |
2052 ++v62; | |
2053 } | |
2054 while ( v62 < 12 ); | |
2055 v63 = GetAsyncKeyState(17); | |
2056 v64 = _this->CanSteal(); | |
2057 Str = (char *)v64; | |
2058 if ( v63 && v64 ) | |
2059 { | |
2060 v65 = pGlobalTXT_LocalizationStrings[185]; | |
2061 } | |
2062 else | |
2063 { | |
2064 v65 = pGlobalTXT_LocalizationStrings[195]; | |
2065 if ( dialog_menu_id != 2 ) | |
2066 v65 = pGlobalTXT_LocalizationStrings[196]; | |
2067 } | |
2068 DrawTextAtStatusBar(v65, 0); | |
2069 if ( !v109 ) | |
2070 { | |
2071 v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
2072 return 0; | |
2073 } | |
2074 v66 = pMouse->GetCursorPos(&v98); | |
2075 result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); | |
2076 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) | |
2077 { | |
2078 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; | |
2079 v109 = v67; | |
2080 v68 = (int)window_SpeakInHouse->ptr_1C; | |
2081 // v69 = 9 * (v67 + 12 * v68); | |
2082 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; | |
2083 if ( dialog_menu_id != 2 ) | |
2084 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; | |
2085 if ( !v63 || !Str ) | |
2086 { | |
2087 v93 = 0; | |
2088 v91 = 2; | |
2089 v89 = window_SpeakInHouse->ptr_1C; | |
2090 v87 = v70; | |
2091 v113 = uActiveCharacter - 1; | |
2092 v71 = _this->_490EEE(v70, 4, v68, 2); | |
2093 v39 = v113; | |
2094 v38 = (char *)pMerchantsBuyPhrases[v71]; | |
2095 } | |
2096 else | |
2097 { | |
2098 v38 = pGlobalTXT_LocalizationStrings[181]; | |
2099 v93 = 0; | |
2100 v91 = 2; | |
2101 v89 = window_SpeakInHouse->ptr_1C; | |
2102 v87 = v70; | |
2103 v39 = uActiveCharacter - 1; | |
2104 } | |
2105 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); | |
2106 v92 = 3; | |
2107 v90 = v21; | |
2108 v88 = v108; | |
2109 v86 = v3; | |
2110 v85 = v3; | |
2111 v84 = &v104; | |
2112 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | |
2113 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | |
2114 } | |
2115 } | |
2116 return result; | |
2117 } | |
2118 case 96: | |
2119 { | |
2120 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) | |
2121 return 0; | |
2122 v2 = pDialogueWindow; | |
2123 v3 = 0; | |
2124 v4 = window_SpeakInHouse->ptr_1C; | |
2125 v112 = 0; | |
2126 //v5 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v4] * 500.0); | |
2127 v5 = (signed __int64)(p2DEvents[(signed int)v4 - 1].flt_24 * 500.0); | |
2128 v111 = (const char **)(v5 * (100 - _this->GetMerchant()) / 100); | |
2129 if ( (signed int)v111 < v5 / 3 ) | |
2130 v111 = (const char **)(v5 / 3); | |
2131 v6 = v2->pStartingPosActiveItem; | |
2132 v7 = v6 + v2->pNumPresenceButton; | |
2133 v114 = 0; | |
2134 if ( (signed int)v6 < v7 ) | |
2135 { | |
2136 do | |
2137 { | |
2138 v8 = v2->GetControl(v6)->uControlParam - 36; | |
2139 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v8] && !_this->pActiveSkills[v8] ) | |
2140 { | |
2141 v9 = pFontArrus->CalcTextHeight(pSkillNames[v8], &v104, 0, 0); | |
2142 v112 += v9; | |
2143 ++v114; | |
2144 } | |
2145 ++v6; | |
2146 } | |
2147 while ( (signed int)v6 < v2->pNumPresenceButton + v2->pStartingPosActiveItem ); | |
2148 if ( v114 ) | |
2149 { | |
2150 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111); | |
2151 v104.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
2152 v111 = (const char **)((signed int)(149 - v112) / v114); | |
2153 if ( (signed int)(149 - v112) / v114 > 32 ) | |
2154 v111 = (const char **)32; | |
2155 result = (POINT *)v2->pStartingPosActiveItem; | |
2156 v10 = (signed int)(149 - v114 * (int)v111 - v112) / 2 - (signed int)v111 / 2 + 162; | |
2157 v112 = (unsigned int)result; | |
2158 v105 = v10; | |
2159 if ( (signed int)result < (signed int)((char *)result + v2->pNumPresenceButton) ) | |
2160 { | |
2161 v114 = 2; | |
2162 do | |
2163 { | |
2164 v11 = v2->GetControl(v112); | |
2165 v12 = v11; | |
2166 v13 = v11->uControlParam - 36; | |
2167 if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v13] || _this->pActiveSkills[v13] ) | |
2168 { | |
2169 v12->uW = 0; | |
2170 v12->uHeight = 0; | |
2171 v12->uY = 0; | |
2172 } | |
2173 else | |
2174 { | |
2175 v14 = pSkillNames[v13]; | |
2176 v12->uY = (unsigned int)((char *)v111 + v105); | |
2177 Str = v14; | |
2178 v15 = pFontArrus->CalcTextHeight(v14, &v104, 0, 0); | |
2179 v16 = v12->uY; | |
2180 v17 = v114; | |
2181 v12->uHeight = v15; | |
2182 v18 = v16 + v15 - 1; | |
2183 v12->uW = v18; | |
2184 v105 = v18; | |
2185 v19 = v106; | |
2186 if ( pDialogueWindow->pCurrentPosActiveItem != v17 ) | |
2187 v19 = v108; | |
2188 v104.DrawTitleText(pFontArrus, 0, v16, v19, Str, 3u); | |
2189 } | |
2190 v20 = v2->pStartingPosActiveItem; | |
2191 ++v112; | |
2192 result = (POINT *)(v2->pNumPresenceButton + v20); | |
2193 ++v114; | |
2194 } | |
2195 while ( (signed int)v112 < (signed int)result ); | |
2196 } | |
2197 return result; | |
2198 } | |
2199 } | |
2200 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); | |
2201 strcat(pTmpBuf, "\n \n"); | |
2202 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
2203 v21 = pTmpBuf; | |
2204 v92 = 3; | |
2205 v90 = pTmpBuf; | |
2206 v88 = v106; | |
2207 v86 = 0; | |
2208 v85 = 0; | |
2209 v84 = &v104; | |
2210 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | |
2211 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | |
2212 } | |
2213 default: | |
2214 { | |
2215 return (POINT *)dialog_menu_id - 96; | |
2216 } | |
2217 } | |
2218 } | |
2219 | |
2220 | |
2221 //----- (004BA928) -------------------------------------------------------- | |
2222 void __cdecl ArmorShopDialog() | |
2223 { | |
2224 Player *v0; // ebx@1 | |
2225 signed int v1; // esi@8 | |
2226 unsigned int v2; // eax@10 | |
2227 ItemGen *v3; // eax@11 | |
2228 unsigned __int8 v4; // dl@12 | |
2229 char *v5; // ecx@12 | |
2230 char *v6; // eax@13 | |
2231 int v7; // ST08_4@15 | |
2232 int v8; // eax@15 | |
2233 signed int v9; // esi@17 | |
2234 unsigned int v10; // eax@19 | |
2235 char *v11; // edi@19 | |
2236 int v12; // ST08_4@20 | |
2237 int v13; // eax@20 | |
2238 unsigned __int8 v14; // dl@20 | |
2239 char *v15; // ecx@20 | |
2240 char **v16; // edi@22 | |
2241 int all_text_height; // ebx@22 | |
2242 char **v18; // esi@22 | |
2243 int v19; // eax@23 | |
2244 GUIWindow *v20; // ecx@24 | |
2245 int v21; // eax@24 | |
2246 int v22; // edx@24 | |
2247 int v23; // ebx@24 | |
2248 unsigned __int8 v24; // sf@24 | |
2249 GUIButton *control_button; // eax@26 | |
2250 GUIButton *v26; // esi@26 | |
2251 int v27; // eax@26 | |
2252 unsigned int v28; // ecx@26 | |
2253 int v29; // edx@26 | |
2254 | |
2255 signed int v31; // esi@31 | |
2256 unsigned int v32; // eax@33 | |
2257 int v33; // eax@34 | |
2258 int v34; // ST08_4@35 | |
2259 int v35; // eax@35 | |
2260 char *v36; // edx@36 | |
2261 GUIWindow *v37; // edi@42 | |
2262 signed int v38; // esi@42 | |
2263 unsigned int v39; // esi@44 | |
2264 int v40; // eax@44 | |
2265 unsigned int v41; // eax@45 | |
2266 int v42; // eax@47 | |
2267 int v43; // ecx@52 | |
2268 GUIButton *v44; // eax@54 | |
2269 GUIButton *v45; // esi@54 | |
2270 int v46; // eax@54 | |
2271 char *v47; // eax@56 | |
2272 int v48; // eax@56 | |
2273 unsigned int v49; // ecx@56 | |
2274 int v50; // edx@56 | |
2275 int v51; // eax@56 | |
2276 unsigned __int16 v52; // ax@56 | |
2277 int v53; // eax@60 | |
2278 int textureH; // eax@60 | |
2279 signed int textureW; // ebx@65 | |
2280 Texture *v56; // eax@67 | |
2281 unsigned int v57; // edi@68 | |
2282 Texture *v58; // ST1C_4@68 | |
2283 int v59; // eax@68 | |
2284 int v60; // edi@69 | |
2285 signed int v61; // ebx@73 | |
2286 Texture *v62; // eax@75 | |
2287 int v63; // edi@76 | |
2288 Texture *v64; // ST1C_4@76 | |
2289 unsigned int v65; // ST18_4@76 | |
2290 int v66; // eax@76 | |
2291 int v67; // edi@77 | |
2292 signed int v68; // ecx@81 | |
2293 SHORT v69; // bx@89 | |
2294 bool v70; // eax@89 | |
2295 const char *v71; // ecx@91 | |
2296 void *v72; // eax@95 | |
2297 POINT *v73; // esi@97 | |
2298 int v74; // ecx@97 | |
2299 int v75; // eax@98 | |
2300 int v76; // ecx@98 | |
2301 ItemGen *selected_item; // ecx@99 | |
2302 unsigned __int8 v78; // bl@104 | |
2303 char **v79; // edi@105 | |
2304 int v80; // ebx@105 | |
2305 char **v81; // esi@105 | |
2306 int v82; // eax@106 | |
2307 GUIWindow *v83; // ecx@107 | |
2308 int v84; // eax@107 | |
2309 int v85; // edx@107 | |
2310 int v86; // ebx@107 | |
2311 GUIButton *v87; // eax@109 | |
2312 GUIButton *v88; // esi@109 | |
2313 int v89; // eax@109 | |
2314 unsigned int v90; // ecx@109 | |
2315 int v91; // edx@109 | |
2316 unsigned __int16 v92; // ax@109 | |
2317 signed int v93; // edx@114 | |
2318 POINT *v94; // edi@120 | |
2319 __int32 v95; // ecx@120 | |
2320 void *v96; // ST14_4@122 | |
2321 unsigned __int8 v97; // bl@122 | |
2322 ItemGen *v98; // ST10_4@122 | |
2323 int v99; // eax@122 | |
2324 char *v100; // eax@122 | |
2325 const char *v101; // ST18_4@122 | |
2326 unsigned __int16 v102; // ST14_2@122 | |
2327 int v103; // eax@122 | |
2328 signed int v104; // edi@123 | |
2329 Texture *v105; // eax@125 | |
2330 int v106; // ebx@126 | |
2331 Texture *v107; // ST1C_4@126 | |
2332 unsigned int v108; // ST18_4@126 | |
2333 int v109; // eax@126 | |
2334 int v110; // ebx@127 | |
2335 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 | |
2336 unsigned int v112; // [sp-14h] [bp-118h]@13 | |
2337 int v113; // [sp-14h] [bp-118h]@36 | |
2338 ItemGen *v114; // [sp-10h] [bp-114h]@12 | |
2339 unsigned int v115; // [sp-10h] [bp-114h]@13 | |
2340 ItemGen *v116; // [sp-10h] [bp-114h]@20 | |
2341 int v117; // [sp-10h] [bp-114h]@36 | |
2342 void *v118; // [sp-Ch] [bp-110h]@12 | |
2343 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 | |
2344 void *v120; // [sp-Ch] [bp-110h]@20 | |
2345 char *v121; // [sp-8h] [bp-10Ch]@13 | |
2346 int v122; // [sp-8h] [bp-10Ch]@20 | |
2347 unsigned int v123; // [sp-4h] [bp-108h]@13 | |
2348 __int64 *v124; // [sp-4h] [bp-108h]@20 | |
2349 int v125; // [sp-4h] [bp-108h]@68 | |
2350 int v126; // [sp-4h] [bp-108h]@76 | |
2351 int v127; // [sp-4h] [bp-108h]@126 | |
2352 POINT v128; // [sp+Ch] [bp-F8h]@8 | |
2353 POINT v129; // [sp+14h] [bp-F0h]@18 | |
2354 char v130; // [sp+1Ch] [bp-E8h]@120 | |
2355 POINT a2; // [sp+24h] [bp-E0h]@8 | |
2356 POINT v132; // [sp+2Ch] [bp-D8h]@120 | |
2357 POINT v133; // [sp+34h] [bp-D0h]@17 | |
2358 POINT v134; // [sp+3Ch] [bp-C8h]@97 | |
2359 POINT v135; // [sp+44h] [bp-C0h]@31 | |
2360 POINT v136; // [sp+4Ch] [bp-B8h]@97 | |
2361 POINT v137; // [sp+54h] [bp-B0h]@17 | |
2362 POINT v138; // [sp+5Ch] [bp-A8h]@32 | |
2363 POINT v139; // [sp+64h] [bp-A0h]@17 | |
2364 POINT v140; // [sp+6Ch] [bp-98h]@31 | |
2365 POINT v141; // [sp+74h] [bp-90h]@8 | |
2366 POINT v142; // [sp+7Ch] [bp-88h]@31 | |
2367 POINT v143; // [sp+84h] [bp-80h]@9 | |
2368 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 | |
2369 char *Str; // [sp+E0h] [bp-24h]@56 | |
2370 int v146; // [sp+E4h] [bp-20h]@24 | |
2371 int hilight_color; // [sp+E8h] [bp-1Ch]@1 | |
2372 int m_text_color; // [sp+ECh] [bp-18h]@1 | |
2373 __int32 v149; // [sp+F0h] [bp-14h]@8 | |
2374 Player* _this; // [sp+F4h] [bp-10h]@1 | |
2375 unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15 | |
2376 int v152; // [sp+FCh] [bp-8h]@24 | |
2377 int v153; // [sp+100h] [bp-4h]@44 | |
2378 int th; | |
2379 short text_color; | |
2380 | |
2381 v0 = pPlayers[uActiveCharacter]; | |
2382 _this = pPlayers[uActiveCharacter]; | |
2383 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
2384 dialog_window.uFrameX = 483; | |
2385 dialog_window.uFrameWidth = 148; | |
2386 dialog_window.uFrameZ = 334; | |
2387 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
2388 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
2389 switch (dialog_menu_id) | |
2390 { | |
2391 case DIALOG_SHOP_MAIN: | |
2392 { | |
2393 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2394 return; | |
2395 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" | |
2396 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" | |
2397 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" | |
2398 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
2399 | |
2400 all_text_height = 0; | |
2401 for(int i=0;i<4;++i) | |
2402 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
2403 v146 = (174 - all_text_height) / 4; | |
2404 | |
2405 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | |
2406 int j=0; | |
2407 if ( pDialogueWindow->pNumPresenceButton>=0 ) | |
2408 { | |
2409 th = 2; | |
2410 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) | |
2411 { | |
2412 control_button = pDialogueWindow->GetControl(v152); | |
2413 control_button->uY = v146 + v23; | |
2414 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); | |
2415 control_button->uHeight = v27; | |
2416 v23 = control_button->uY + control_button->uHeight - 1; | |
2417 control_button->uW = v23; | |
2418 text_color = hilight_color; | |
2419 if ( pDialogueWindow->pCurrentPosActiveItem != th ) | |
2420 text_color = m_text_color; | |
2421 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); | |
2422 ++th; | |
2423 ++j; | |
2424 } | |
2425 } | |
2426 } | |
2427 break; | |
2428 case DIALOG_SHOP_BUY_STANDART: | |
2429 { | |
2430 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
2431 textureW = 0; | |
2432 v153 = 0; | |
2433 for(int i=0; i<8; ++i) | |
2434 { | |
2435 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); | |
2436 { | |
2437 textureW = ItemsInShopTexture[i]->uTextureWidth; | |
2438 textureH = ItemsInShopTexture[i]->uTextureHeight; | |
2439 if ( i >= 4 ) //low row | |
2440 { | |
2441 v60 = 90 - (textureW/2); | |
2442 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); | |
2443 v59 = v60 + v153 + 80220; | |
2444 } | |
2445 else | |
2446 { | |
2447 v57 = 98 - textureH; | |
2448 v152 = 86 - (textureW/2); | |
2449 pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]); | |
2450 v59 = v153 + v152 + 640 * v57; | |
2451 } | |
2452 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); | |
2453 } | |
2454 v153 += 105; | |
2455 | |
2456 } | |
2457 | |
2458 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2459 return; | |
2460 | |
2461 v149 = 0; | |
2462 for(int i=0; i<8; ++i) | |
2463 { | |
2464 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); | |
2465 ++v149; | |
2466 | |
2467 } | |
2468 | |
2469 v69 = GetAsyncKeyState(17); | |
2470 v70 = _this->CanSteal(); | |
2471 //Str = (char *)v70; | |
2472 if ( v69 == 0 || v70 == 0 ) | |
2473 { | |
2474 v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" | |
2475 } | |
2476 else | |
2477 { | |
2478 v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item" | |
2479 } | |
2480 DrawTextAtStatusBar(v71, 0); | |
2481 if ( v149 != 0 ) | |
2482 { | |
2483 v73 = pMouse->GetCursorPos(&v136); | |
2484 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; | |
2485 if ( !v74 ) | |
2486 return; | |
2487 v149 = v74 - 1; | |
2488 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; | |
2489 if ( v69 ==0 || v70 == 0) | |
2490 { | |
2491 v120 = window_SpeakInHouse->ptr_1C; | |
2492 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; | |
2493 } | |
2494 else | |
2495 { | |
2496 v120 = window_SpeakInHouse->ptr_1C; | |
2497 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" | |
2498 } | |
2499 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); | |
2500 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | |
2501 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); | |
2502 return; | |
2503 } | |
2504 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | |
2505 return; | |
2506 } | |
2507 break; | |
2508 case DIALOG_SHOP_SELL: | |
2509 { | |
2510 draw_leather(); | |
2511 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
2512 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" | |
2513 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) | |
2514 return; | |
2515 | |
2516 if((v9 = pMouse->GetCursorPos(&v139)->x - 14, v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), | |
2517 pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 | |
2518 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) | |
2519 return; | |
2520 | |
2521 v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; | |
2522 v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3); | |
2523 v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)]; | |
2524 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); | |
2525 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | |
2526 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); | |
2527 return; | |
2528 } | |
2529 break; | |
2530 case DIALOG_SHOP_IDENTIFY: | |
2531 { | |
2532 draw_leather(); | |
2533 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
2534 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" | |
2535 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2536 { | |
2537 v1 = pMouse->GetCursorPos(&a2)->x - 14; | |
2538 v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); | |
2539 if ( pMouse->GetCursorPos(&v141)->x > 13 ) | |
2540 { | |
2541 if ( pMouse->GetCursorPos(&v143)->x < 462 ) | |
2542 { | |
2543 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); | |
2544 if ( v2 ) | |
2545 { | |
2546 v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; | |
2547 if (v3->Identified()) | |
2548 { | |
2549 v118 = window_SpeakInHouse->ptr_1C; | |
2550 v4 = uActiveCharacter - 1; | |
2551 v5 = "%24"; | |
2552 v114 = v3; | |
2553 } | |
2554 else | |
2555 { | |
2556 v118 = window_SpeakInHouse->ptr_1C; | |
2557 v114 = v3; | |
2558 v7 = (int)window_SpeakInHouse->ptr_1C; | |
2559 uPlayerID = uActiveCharacter - 1; | |
2560 v8 = v0->_490EEE(v3, 2, v7, 4); | |
2561 v4 = uPlayerID; | |
2562 v5 = (char *)pMerchantsIdentifyPhrases[v8]; | |
2563 } | |
2564 v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0); | |
2565 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; | |
2566 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3); | |
2567 return; | |
2568 } | |
2569 } | |
2570 } | |
2571 } | |
2572 } | |
2573 break; | |
2574 case DIALOG_SHOP_REPAIR: | |
2575 { | |
2576 draw_leather(); | |
2577 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
2578 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); | |
2579 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) | |
2580 return; | |
2581 | |
2582 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, | |
2583 v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), | |
2584 pMouse->GetCursorPos(&v140)->x <= 13) | |
2585 || pMouse->GetCursorPos(&v138)->x >= 462 | |
2586 || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32) | |
2587 || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) | |
2588 return; | |
2589 | |
2590 | |
2591 v120 = window_SpeakInHouse->ptr_1C; | |
2592 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; | |
2593 v34 = (int)window_SpeakInHouse->ptr_1C; | |
2594 uPlayerID = uActiveCharacter - 1; | |
2595 v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5); | |
2596 v14 = uPlayerID; | |
2597 v15 = (char *)pMerchantsRepairPhrases[v35]; | |
2598 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0); | |
2599 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | |
2600 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); | |
2601 return; | |
2602 } | |
2603 break; | |
2604 case 6: //buy standart | |
2605 { | |
2606 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
2607 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" | |
2608 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2609 return; | |
2610 v149 = 0; | |
2611 for(int i=0;i<6;++i) | |
2612 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) | |
2613 ++v149; | |
2614 | |
2615 | |
2616 if ( v149 ) | |
2617 { | |
2618 v94 = pMouse->GetCursorPos(&v132); | |
2619 v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; | |
2620 v95 = v149; | |
2621 if ( v149 && v149 != -65536 ) | |
2622 { | |
2623 --v149; | |
2624 | |
2625 v97 = uActiveCharacter - 1; | |
2626 | |
2627 v99 = _this->_490EEE( | |
2628 &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2); | |
2629 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0); | |
2630 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); | |
2631 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3); | |
2632 } | |
2633 v104 = 0; | |
2634 v153 = 0; | |
2635 do | |
2636 { | |
2637 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
2638 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) | |
2639 { | |
2640 v105 = ItemsInShopTexture[v104]; | |
2641 if ( v104 >= 4 ) | |
2642 { | |
2643 v110 = 90 - ((signed int)v105->uTextureWidth >> 1); | |
2644 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); | |
2645 v127 = v104 + 1; | |
2646 v109 = v153 + v110 + 80220; | |
2647 } | |
2648 else | |
2649 { | |
2650 v106 = 98 - v105->uTextureHeight; | |
2651 v107 = ItemsInShopTexture[v104]; | |
2652 v108 = 98 - v105->uTextureHeight; | |
2653 v152 = 86 - ((signed int)v105->uTextureWidth >> 1); | |
2654 pRenderer->DrawTextureTransparent(v152 + v153, v108, v107); | |
2655 v127 = v104 + 1; | |
2656 v109 = v152 + v153 + 640 * v106; | |
2657 } | |
2658 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); | |
2659 } | |
2660 v153 += 105; | |
2661 ++v104; | |
2662 } | |
2663 while ( v104 < 8 ); | |
2664 return; | |
2665 } | |
2666 dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | |
2667 return; | |
2668 } | |
2669 break; | |
2670 case DIALOG_SHOP_DISPLAY_EQUIPMENT: | |
2671 { | |
2672 draw_leather(); | |
2673 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
2674 v79 = pShopOptions; | |
2675 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" | |
2676 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" | |
2677 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" | |
2678 | |
2679 all_text_height = 0; | |
2680 for(int i=0;i<3;++i) | |
2681 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
2682 v83 = pDialogueWindow; | |
2683 v152 = (174 - all_text_height) / 3; | |
2684 v84 = pDialogueWindow->pStartingPosActiveItem; | |
2685 v85 = v84 + pDialogueWindow->pNumPresenceButton; | |
2686 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; | |
2687 v24 = -pDialogueWindow->pNumPresenceButton < 0; | |
2688 _this = (Player *)pDialogueWindow->pStartingPosActiveItem; | |
2689 if ( v24 ^ __OFSUB__(v84, v85) ) | |
2690 { | |
2691 v153 = 2; | |
2692 do | |
2693 { | |
2694 v87 = v83->GetControl((unsigned int)_this); | |
2695 v88 = v87; | |
2696 v87->uY = v152 + v86; | |
2697 v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0); | |
2698 v90 = v88->uY; | |
2699 v91 = v153; | |
2700 v88->uHeight = v89; | |
2701 v86 = v90 + v89 - 1; | |
2702 v88->uW = v86; | |
2703 v92 = hilight_color; | |
2704 if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) | |
2705 v92 = m_text_color; | |
2706 dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u); | |
2707 v83 = pDialogueWindow; | |
2708 ++v153; | |
2709 ++v79; | |
2710 _this = (Player *)((char *)_this + 1); | |
2711 } | |
2712 while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
2713 } | |
2714 return; | |
2715 } | |
2716 break; | |
2717 case DIALOG_SHOP_BUY_SPECIAL: | |
2718 { | |
2719 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); | |
2720 v11 = 0; | |
2721 v61 = 0; | |
2722 v153 = 0; | |
2723 do | |
2724 { | |
2725 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) | |
2726 { | |
2727 v62 = ItemsInShopTexture[v61]; | |
2728 if ( v61 >= 4 ) | |
2729 { | |
2730 v67 = 90 - ((signed int)v62->uTextureWidth >> 1); | |
2731 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); | |
2732 v66 = v153 + v67 + 80220; | |
2733 } | |
2734 else | |
2735 { | |
2736 v63 = 98 - v62->uTextureHeight; | |
2737 v64 = ItemsInShopTexture[v61]; | |
2738 v65 = 98 - v62->uTextureHeight; | |
2739 v152 = 86 - ((signed int)v62->uTextureWidth >> 1); | |
2740 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); | |
2741 v66 = v152 + v153 + 640 * v63; | |
2742 } | |
2743 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); | |
2744 } | |
2745 v153 += 105; | |
2746 ++v61; | |
2747 } | |
2748 while ( v61 < 8 ); | |
2749 | |
2750 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2751 return; | |
2752 v68 = 0; | |
2753 v149 = 0; | |
2754 | |
2755 do | |
2756 { | |
2757 // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) | |
2758 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) | |
2759 ++v149; | |
2760 ++v68; | |
2761 } | |
2762 while ( v68 < 6 ); | |
2763 | |
2764 v69 = GetAsyncKeyState(17); | |
2765 v70 = _this->CanSteal(); | |
2766 Str = (char *)v70; | |
2767 if ( v69 == 0 || (char *)v70 == 0 ) | |
2768 { | |
2769 v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" | |
2770 } | |
2771 else | |
2772 { | |
2773 v71 = pGlobalTXT_LocalizationStrings[185]; | |
2774 } | |
2775 DrawTextAtStatusBar(v71, 0); | |
2776 if ( (char *)v149 != 0 ) | |
2777 { | |
2778 v73 = pMouse->GetCursorPos(&v136); | |
2779 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; | |
2780 if ( !v74 ) | |
2781 return; | |
2782 v149 = v74 - 1; | |
2783 | |
2784 if ( dialog_menu_id == 2 ) | |
2785 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; | |
2786 else | |
2787 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; | |
2788 if ( v69 == 0 || Str == 0 ) | |
2789 { | |
2790 v120 = window_SpeakInHouse->ptr_1C; | |
2791 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; | |
2792 } | |
2793 else | |
2794 { | |
2795 v120 = window_SpeakInHouse->ptr_1C; | |
2796 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" | |
2797 } | |
2798 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); | |
2799 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; | |
2800 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); | |
2801 return; | |
2802 } | |
2803 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); | |
2804 return; | |
2805 } | |
2806 break; | |
2807 case DIALOG_SHOP_SKILLS: | |
2808 { | |
2809 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2810 return; | |
2811 v152 = 0; | |
2812 v37 = pDialogueWindow; | |
2813 //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); | |
2814 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
2815 _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100); | |
2816 if ( (signed int)_this < v38 / 3 ) | |
2817 _this = (Player *)(v38 / 3); | |
2818 v39 = v37->pStartingPosActiveItem; | |
2819 v40 = v37->pNumPresenceButton; | |
2820 v153 = 0; | |
2821 if ( (signed int)v39 < (signed int)(v39 + v40) ) | |
2822 { | |
2823 do | |
2824 { | |
2825 v41 = v37->GetControl(v39)->uControlParam - 36; | |
2826 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) | |
2827 { | |
2828 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); | |
2829 v152 += v42; | |
2830 ++v153; | |
2831 } | |
2832 ++v39; | |
2833 } | |
2834 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); | |
2835 if ( v153 ) | |
2836 { | |
2837 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); | |
2838 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
2839 _this = (Player *)((149 - v152) / v153); | |
2840 if ( (149 - v152) / v153 > 32 ) | |
2841 _this = (Player *)32; | |
2842 v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162; | |
2843 v152 = v37->pStartingPosActiveItem; | |
2844 v146 = v43; | |
2845 if ( v152 < v152 + v37->pNumPresenceButton ) | |
2846 { | |
2847 v153 = 2; | |
2848 do | |
2849 { | |
2850 v44 = v37->GetControl(v152); | |
2851 v45 = v44; | |
2852 v46 = v44->uControlParam - 36; | |
2853 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] ) | |
2854 { | |
2855 v45->uW = 0; | |
2856 v45->uHeight = 0; | |
2857 v45->uY = 0; | |
2858 } | |
2859 else | |
2860 { | |
2861 v47 = pSkillNames[v46]; | |
2862 v45->uY = (unsigned int)((char *)_this + v146); | |
2863 Str = v47; | |
2864 v48 = pFontArrus->CalcTextHeight(v47, &dialog_window, 0, 0); | |
2865 v49 = v45->uY; | |
2866 v50 = v153; | |
2867 v45->uHeight = v48; | |
2868 v51 = v49 + v48 - 1; | |
2869 v45->uW = v51; | |
2870 v146 = v51; | |
2871 v52 = hilight_color; | |
2872 if ( pDialogueWindow->pCurrentPosActiveItem != v50 ) | |
2873 v52 = m_text_color; | |
2874 dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u); | |
2875 } | |
2876 v53 = v37->pStartingPosActiveItem; | |
2877 ++v152; | |
2878 textureH = v37->pNumPresenceButton + v53; | |
2879 ++v153; | |
2880 } | |
2881 while ( v152 < textureH ); | |
2882 } | |
2883 return; | |
2884 } | |
2885 } | |
2886 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s" | |
2887 strcat(pTmpBuf, "\n \n"); | |
2888 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." | |
2889 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; | |
2890 dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3); | |
2891 return; | |
2892 } | |
2893 break; | |
2894 } | |
2895 } | |
2896 | 61 |
2897 //----- (004BB756) -------------------------------------------------------- | 62 //----- (004BB756) -------------------------------------------------------- |
2898 signed int __fastcall sub_4BB756(signed int a1) | 63 signed int __fastcall sub_4BB756(signed int a1) |
2899 { | 64 { |
2900 unsigned int v1; // esi@8 | 65 unsigned int v1; // esi@8 |
3139 dialog_menu_id = -1; | 304 dialog_menu_id = -1; |
3140 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); | 305 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); |
3141 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) | 306 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) |
3142 { | 307 { |
3143 pParty->field_75A[v0] = 0; | 308 pParty->field_75A[v0] = 0; |
309 __debugbreak(); // starting year-related constant here; | |
3144 v1 = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) | 310 v1 = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) |
3145 * 0.033333335); | 311 * 0.033333335); |
3146 pParty->field_3C.field_0[2 * v0] = v1; | 312 pParty->field_3C.field_0[2 * v0] = v1; |
3147 pParty->field_3C.field_0[2 * v0 + 1] = HIDWORD(v1); | 313 pParty->field_3C.field_0[2 * v0 + 1] = HIDWORD(v1); |
3148 for ( i = rand(); ; i = rand() ) | 314 for ( i = rand(); ; i = rand() ) |
13278 assert(sizeof(TravelInfo) == 0x20); | 10444 assert(sizeof(TravelInfo) == 0x20); |
13279 assert(sizeof(stru336) == 0x798); | 10445 assert(sizeof(stru336) == 0x798); |
13280 } | 10446 } |
13281 | 10447 |
13282 bool new_sky = false; | 10448 bool new_sky = false; |
10449 bool change_seasons = true; | |
13283 | 10450 |
13284 //----- (00462C94) -------------------------------------------------------- | 10451 //----- (00462C94) -------------------------------------------------------- |
13285 bool MM_Main(const wchar_t *pCmdLine) | 10452 bool MM_Main(const wchar_t *pCmdLine) |
13286 { | 10453 { |
13287 HWND hPrevWnd; // eax@1 | 10454 HWND hPrevWnd; // eax@1 |
15767 { | 12934 { |
15768 LOBYTE(dword_6BE364_game_settings_1) = dword_6BE364_game_settings_1 & 0x7F; | 12935 LOBYTE(dword_6BE364_game_settings_1) = dword_6BE364_game_settings_1 & 0x7F; |
15769 } | 12936 } |
15770 else | 12937 else |
15771 { | 12938 { |
15772 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | 12939 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
15773 { | |
15774 BLV_UpdateUserInputAndOther(); | 12940 BLV_UpdateUserInputAndOther(); |
15775 } | 12941 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
15776 else | |
15777 { | |
15778 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
15779 ODM_UpdateUserInputAndOther(); | 12942 ODM_UpdateUserInputAndOther(); |
15780 } | 12943 |
15781 _438F8F_area_of_effect__damage_evaluate(); | 12944 _438F8F_area_of_effect__damage_evaluate(); |
15782 } | 12945 } |
15783 } | 12946 } |
15784 | 12947 |
15785 | 12948 |