Mercurial > mm7
comparison mm7_2.cpp @ 633:f6aeea3eb893
Слияние
author | Ritor1 |
---|---|
date | Mon, 11 Mar 2013 09:28:57 +0600 |
parents | 3d03a3a674bc |
children | 71ecba604995 |
comparison
equal
deleted
inserted
replaced
632:f234b67a9caf | 633:f6aeea3eb893 |
---|---|
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(dword_F8B19C) | |
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(dword_F8B19C) | |
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(dword_F8B19C) | |
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 dword_F8B19C = 0; | |
654 while ( sub_4BD8B5() ) | |
655 ; | |
656 sub_4B1D27(); | |
657 pVideoPlayer->Unload(); | |
658 window_SpeakInHouse->Release(); | |
659 window_SpeakInHouse = 0; | |
660 | |
661 if ( pMessageQueue_50CBD0->uNumMessages ) | |
662 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
663 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_OpenRestUI; | |
664 pMessageQueue_50CBD0->pMessages[0].param = v27; | |
665 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; | |
666 //LABEL_51: | |
667 ++pMessageQueue_50CBD0->uNumMessages; | |
668 return; | |
669 } | |
670 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
671 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); | |
672 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); | |
673 break; | |
674 } | |
675 case 96: | |
676 { | |
677 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
678 return; | |
679 v8 = pDialogueWindow; | |
680 *(float *)&v89 = 0.0; | |
681 | |
682 //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); | |
683 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
684 | |
685 pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100); | |
686 if ( (signed int)pOutString < v9 / 3 ) | |
687 pOutString = (GUIFont *)(v9 / 3); | |
688 v10 = v8->pStartingPosActiveItem; | |
689 v11 = v10 + v8->pNumPresenceButton; | |
690 v86 = 0; | |
691 if ( (signed int)v10 < v11 ) | |
692 { | |
693 do | |
694 { | |
695 v12 = v8->GetControl(v10)->uControlParam - 36; | |
696 if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] ) | |
697 { | |
698 v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0); | |
699 v89 += v13; | |
700 ++v86; | |
701 } | |
702 ++v10; | |
703 } | |
704 while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); | |
705 if ( v86 ) | |
706 { | |
707 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); | |
708 v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
709 pOutString = (GUIFont *)((149 - v89) / v86); | |
710 if ( (149 - v89) / v86 > 32 ) | |
711 pOutString = (GUIFont *)32; | |
712 v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162; | |
713 v89 = v8->pStartingPosActiveItem; | |
714 v83 = v14; | |
715 if ( v89 < v89 + v8->pNumPresenceButton ) | |
716 { | |
717 v86 = 2; | |
718 do | |
719 { | |
720 v15 = v8->GetControl(v89); | |
721 v16 = v15; | |
722 v17 = v15->uControlParam - 36; | |
723 if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] ) | |
724 { | |
725 v16->uW = 0; | |
726 v16->uHeight = 0; | |
727 v16->uY = 0; | |
728 } | |
729 else | |
730 { | |
731 v18 = pSkillNames[v17]; | |
732 v16->uY = (unsigned int)((char *)pOutString + v83); | |
733 Str[1] = v18; | |
734 v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0); | |
735 v20 = v16->uY; | |
736 v21 = v86; | |
737 v16->uHeight = v19; | |
738 v22 = v19 + v20 - 1; | |
739 v16->uW = v22; | |
740 v83 = v22; | |
741 v23 = v84[0]; | |
742 if ( pDialogueWindow->pCurrentPosActiveItem != v21 ) | |
743 v23 = v81; | |
744 v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u); | |
745 } | |
746 v24 = v8->pNumPresenceButton; | |
747 ++v89; | |
748 v25 = v8->pStartingPosActiveItem + v24; | |
749 ++v86; | |
750 } | |
751 while ( v89 < v25 ); | |
752 } | |
753 return; | |
754 } | |
755 } | |
756 v26 = pTmpBuf; | |
757 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]); | |
758 strcat(pTmpBuf, "\n \n"); | |
759 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
760 v71 = 3; | |
761 v69 = v26; | |
762 v67 = v84[0]; | |
763 v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; | |
764 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); | |
765 return; | |
766 break; | |
767 } | |
768 case 16: | |
769 { | |
770 *(_QWORD *)Str = pParty->uNumFoodRations; | |
771 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) | |
772 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) | |
773 { | |
774 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); | |
775 if ( uActiveCharacter ) | |
776 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); | |
777 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); | |
778 return; | |
779 } | |
780 if ( pParty->uNumGold >= v7 ) | |
781 { | |
782 Party::TakeGold(v7); | |
783 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; | |
784 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | |
785 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3); | |
786 v5 = 1; | |
787 //LABEL_43: | |
788 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); | |
789 return; | |
790 //goto LABEL_51; | |
791 } | |
792 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
793 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); | |
794 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); | |
795 break; | |
796 } | |
797 case 1: | |
798 { | |
799 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
800 return; | |
801 v28 = *(int *)v84; | |
802 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) | |
803 v28 = v81; | |
804 sprintf(Dest, format_4E2DC8, v28); | |
805 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); | |
806 strcat(Dest, pTmpBuf2); | |
807 v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0); | |
808 strcat(Dest, "\n \n"); | |
809 v29 = *(int *)v84; | |
810 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) | |
811 v29 = v81; | |
812 sprintf(a1, format_4E2DC8, v29); | |
813 sprintf(pTmpBuf2, | |
814 pGlobalTXT_LocalizationStrings[86], | |
815 //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], | |
816 (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, | |
817 v83); | |
818 strcat(a1, pTmpBuf2); | |
819 v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0); | |
820 strcat(a1, "\n \n"); | |
821 v30 = *(int *)v84; | |
822 if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) | |
823 v30 = v81; | |
824 sprintf(v77, format_4E2DC8, v30); | |
825 strcat(v77, pGlobalTXT_LocalizationStrings[160]); | |
826 v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0); | |
827 strcat(v77, "\n \n"); | |
828 v75[0] = 0; | |
829 v87 = 0; | |
830 v31 = (signed int)window_SpeakInHouse->ptr_1C; | |
831 if ( v31 >= 108 && v31 <= 120 ) | |
832 { | |
833 v32 = *(int *)v84; | |
834 if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) | |
835 v32 = v81; | |
836 sprintf(v75, format_4E2DC8, v32); | |
837 strcat(v75, pGlobalTXT_LocalizationStrings[611]); | |
838 v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0); | |
839 } | |
840 v33 = pDialogueWindow; | |
841 Str[1] = (char *)pDialogueWindow; | |
842 v34 = pDialogueWindow->pStartingPosActiveItem; | |
843 v35 = v34 + pDialogueWindow->pNumPresenceButton; | |
844 v36 = LOBYTE(pFontArrus->uFontHeight) - 3; | |
845 v37 = -pDialogueWindow->pNumPresenceButton < 0; | |
846 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; | |
847 if ( !(v37 ^ __OFSUB__(v34, v35)) ) | |
848 { | |
849 //LABEL_75: | |
850 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); | |
851 v71 = 3; | |
852 v69 = pTmpBuf; | |
853 v67 = 0; | |
854 v66 = 146; | |
855 //LABEL_98: | |
856 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); | |
857 return; | |
858 } | |
859 while ( 1 ) | |
860 { | |
861 v38 = v33->GetControl((unsigned int)pOutString); | |
862 if ( v38->uControlParam == 15 ) | |
863 { | |
864 v46 = v90; | |
865 v38->uHeight = v90; | |
866 v38->uY = 146; | |
867 v41 = v46 + 145; | |
868 v38->uW = v41; | |
869 } | |
870 else if ( v38->uControlParam == 16 ) | |
871 { | |
872 v44 = v88; | |
873 v45 = v90 + v36 + 146; | |
874 v38->uHeight = v88; | |
875 v38->uY = v45; | |
876 v41 = v45 + v44 - 1; | |
877 v38->uW = v41; | |
878 } | |
879 else if ( v38->uControlParam == 96 ) | |
880 { | |
881 v42 = v90 + v88 + 2 * v36 + 146; | |
882 v43 = v82; | |
883 v38->uY = v42; | |
884 v38->uHeight = v43; | |
885 v41 = v43 + v42 - 1; | |
886 v38->uW = v41; | |
887 } | |
888 else if ( v38->uControlParam == 101 ) | |
889 { | |
890 v39 = v90 + 3 * v36 + v87 + v88 + 146; | |
891 v33 = (GUIWindow *)Str[1]; | |
892 v40 = v87; | |
893 v38->uHeight = v87; | |
894 v38->uY = v39; | |
895 v41 = v39 + v40 - 1; | |
896 //LABEL_73: | |
897 v38->uW = v41; | |
898 } | |
899 v47 = v33->pStartingPosActiveItem; | |
900 pOutString = (GUIFont *)((char *)pOutString + 1); | |
901 if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 ) | |
902 { | |
903 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); | |
904 v71 = 3; | |
905 v69 = pTmpBuf; | |
906 v67 = 0; | |
907 v66 = 146; | |
908 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); | |
909 return; | |
910 } | |
911 } | |
912 break; | |
913 } | |
914 case 101: | |
915 { | |
916 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
917 { | |
918 v48 = 2; | |
919 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; | |
920 pOutString = 0; | |
921 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; | |
922 if ( pParty->HasItem(0x28Bu) ) | |
923 { | |
924 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; | |
925 v48 = 3; | |
926 } | |
927 for ( i = 0; i < v48; ++i ) | |
928 { | |
929 v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0); | |
930 pOutString = (GUIFont *)((char *)pOutString + v50); | |
931 } | |
932 v86 = (174 - (signed int)pOutString) / v48; | |
933 v51 = pDialogueWindow; | |
934 v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString; | |
935 v53 = v52 - HIDWORD(v52); | |
936 LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem; | |
937 HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton; | |
938 v54 = (v53 >> 1) - v86 / 2 + 138; | |
939 v37 = -pDialogueWindow->pNumPresenceButton < 0; | |
940 v89 = pDialogueWindow->pStartingPosActiveItem; | |
941 if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) ) | |
942 { | |
943 v85 = (Player *)2; | |
944 pOutString = (GUIFont *)pShopOptions; | |
945 do | |
946 { | |
947 v55 = v51->GetControl(v89); | |
948 v56 = (const char **)pOutString; | |
949 v55->uY = v86 + v54; | |
950 v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0); | |
951 v58 = v55->uY; | |
952 v59 = v85; | |
953 v55->uHeight = v57; | |
954 v54 = v57 + v58 - 1; | |
955 v55->uW = v54; | |
956 v60 = v84[0]; | |
957 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 ) | |
958 v60 = v81; | |
959 v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u); | |
960 v51 = pDialogueWindow; | |
961 v85 = (Player *)((char *)v85 + 1); | |
962 pOutString = (GUIFont *)((char *)pOutString + 4); | |
963 ++v89; | |
964 } | |
965 while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
966 } | |
967 } | |
968 break; | |
969 } | |
970 default: | |
971 { | |
972 break; | |
973 } | |
974 } | |
975 } | |
976 | |
977 | |
978 //----- (004B910F) -------------------------------------------------------- | |
979 char *__cdecl WeaponShopDialog() | |
980 { | |
981 Player *v0; // ebx@1 | |
982 char *result; // eax@6 | |
983 signed int v2; // esi@8 | |
984 unsigned int v3; // ebx@10 | |
985 ItemGen *v4; // eax@11 | |
986 char *v5; // ecx@12 | |
987 unsigned __int8 v6; // dl@13 | |
988 char *v7; // edx@14 | |
989 int v8; // eax@15 | |
990 int v9; // ST08_4@16 | |
991 int v10; // eax@16 | |
992 signed int v11; // esi@18 | |
993 int v12; // ST08_4@21 | |
994 int v13; // eax@21 | |
995 int v14; // edi@23 | |
996 char **v15; // esi@23 | |
997 int v16; // eax@24 | |
998 GUIWindow *v17; // ecx@25 | |
999 int v18; // edx@25 | |
1000 int v19; // edi@25 | |
1001 unsigned __int8 v20; // sf@25 | |
1002 GUIButton *v21; // esi@27 | |
1003 const char **v22; // eax@27 | |
1004 int v23; // eax@27 | |
1005 unsigned int v24; // ecx@27 | |
1006 int v25; // edx@27 | |
1007 unsigned __int16 v26; // ax@27 | |
1008 signed int v27; // esi@32 | |
1009 int v28; // ST08_4@36 | |
1010 int v29; // eax@36 | |
1011 GUIWindow *v30; // edi@41 | |
1012 void *v31; // eax@41 | |
1013 signed int v32; // esi@41 | |
1014 unsigned int v33; // esi@43 | |
1015 int v34; // eax@43 | |
1016 unsigned int v35; // eax@44 | |
1017 int v36; // eax@46 | |
1018 __int32 v37; // ecx@51 | |
1019 GUIButton *v38; // eax@53 | |
1020 GUIButton *v39; // esi@53 | |
1021 int v40; // eax@53 | |
1022 char *v41; // eax@55 | |
1023 int v42; // eax@55 | |
1024 unsigned int v43; // ecx@55 | |
1025 const char **v44; // edx@55 | |
1026 int v45; // eax@55 | |
1027 unsigned __int16 v46; // ax@55 | |
1028 int v47; // eax@59 | |
1029 const char **v48; // eax@63 | |
1030 unsigned int v49; // esi@65 | |
1031 Texture *v50; // eax@65 | |
1032 int v51; // edi@65 | |
1033 int v52; // esi@70 | |
1034 Texture *v53; // ST1C_4@70 | |
1035 int v54; // edi@70 | |
1036 signed int v55; // ecx@73 | |
1037 SHORT v56; // di@82 | |
1038 bool v57; // eax@82 | |
1039 const char *v58; // ecx@84 | |
1040 POINT *v59; // esi@89 | |
1041 LONG v60; // ecx@90 | |
1042 int v61; // eax@90 | |
1043 int v62; // ecx@90 | |
1044 ItemGen *v63; // esi@90 | |
1045 int v64; // eax@95 | |
1046 int v65; // esi@96 | |
1047 char **v66; // edi@96 | |
1048 int v67; // eax@97 | |
1049 GUIWindow *v68; // ecx@98 | |
1050 int v69; // edx@98 | |
1051 int v70; // edi@98 | |
1052 GUIButton *v71; // esi@100 | |
1053 const char **v72; // eax@100 | |
1054 int v73; // eax@100 | |
1055 unsigned int v74; // ecx@100 | |
1056 Player *v75; // edx@100 | |
1057 unsigned __int16 v76; // ax@100 | |
1058 GUIWindow *v77; // [sp-18h] [bp-110h]@14 | |
1059 int v78; // [sp-14h] [bp-10Ch]@14 | |
1060 ItemGen *v79; // [sp-10h] [bp-108h]@12 | |
1061 int v80; // [sp-10h] [bp-108h]@14 | |
1062 void *v81; // [sp-Ch] [bp-104h]@12 | |
1063 unsigned __int16 v82; // [sp-Ch] [bp-104h]@14 | |
1064 int v83; // [sp-8h] [bp-100h]@11 | |
1065 char *v84; // [sp-8h] [bp-100h]@14 | |
1066 __int64 *v85; // [sp-4h] [bp-FCh]@11 | |
1067 unsigned int v86; // [sp-4h] [bp-FCh]@14 | |
1068 POINT v87; // [sp+Ch] [bp-ECh]@8 | |
1069 POINT v88; // [sp+14h] [bp-E4h]@18 | |
1070 POINT v89; // [sp+1Ch] [bp-DCh]@89 | |
1071 POINT v90; // [sp+24h] [bp-D4h]@19 | |
1072 POINT v91; // [sp+2Ch] [bp-CCh]@89 | |
1073 POINT v92; // [sp+34h] [bp-C4h]@9 | |
1074 POINT v93; // [sp+3Ch] [bp-BCh]@33 | |
1075 POINT v94; // [sp+44h] [bp-B4h]@18 | |
1076 POINT v95; // [sp+4Ch] [bp-ACh]@32 | |
1077 POINT v96; // [sp+54h] [bp-A4h]@18 | |
1078 POINT v97; // [sp+5Ch] [bp-9Ch]@32 | |
1079 POINT a2; // [sp+64h] [bp-94h]@8 | |
1080 POINT v99; // [sp+6Ch] [bp-8Ch]@32 | |
1081 POINT v100; // [sp+74h] [bp-84h]@8 | |
1082 GUIWindow v101; // [sp+7Ch] [bp-7Ch]@1 | |
1083 char *Str; // [sp+D0h] [bp-28h]@55 | |
1084 __int32 v103; // [sp+D4h] [bp-24h]@25 | |
1085 int v104; // [sp+D8h] [bp-20h]@1 | |
1086 int v105; // [sp+DCh] [bp-1Ch]@1 | |
1087 POINT v106; // [sp+E0h] [bp-18h]@8 | |
1088 Player *_this; // [sp+E8h] [bp-10h]@1 | |
1089 int v108; // [sp+ECh] [bp-Ch]@26 | |
1090 const char **v109; // [sp+F0h] [bp-8h]@26 | |
1091 unsigned __int8 v110; // [sp+F7h] [bp-1h]@16 | |
1092 | |
1093 v0 = pPlayers[uActiveCharacter]; | |
1094 _this = pPlayers[uActiveCharacter]; | |
1095 memcpy(&v101, window_SpeakInHouse, sizeof(v101)); | |
1096 v101.uFrameX = 483; | |
1097 v101.uFrameWidth = 148; | |
1098 v101.uFrameZ = 334; | |
1099 v105 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
1100 v104 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
1101 switch(dword_F8B19C) | |
1102 { | |
1103 case 94: | |
1104 { | |
1105 draw_leather(); | |
1106 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1107 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; | |
1108 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; | |
1109 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; | |
1110 v65 = 0; | |
1111 v66 = pShopOptions; | |
1112 do | |
1113 { | |
1114 v67 = pFontArrus->CalcTextHeight(*v66, &v101, 0, 0); | |
1115 ++v66; | |
1116 v65 += v67; | |
1117 } | |
1118 while ( (signed int)v66 < (signed int)&pShopOptions[3] ); | |
1119 v68 = pDialogueWindow; | |
1120 v109 = (const char **)((174 - v65) / 3); | |
1121 result = (char *)pDialogueWindow->pStartingPosActiveItem; | |
1122 v69 = (int)&result[pDialogueWindow->pNumPresenceButton]; | |
1123 v70 = (3 * (58 - (signed int)v109) - v65) / 2 - (174 - v65) / 3 / 2 + 138; | |
1124 v20 = -pDialogueWindow->pNumPresenceButton < 0; | |
1125 v106.y = pDialogueWindow->pStartingPosActiveItem; | |
1126 if ( v20 ^ __OFSUB__((int)result, (int)v69) ) | |
1127 { | |
1128 _this = (Player *)2; | |
1129 v108 = (int)pShopOptions; | |
1130 do | |
1131 { | |
1132 v71 = v68->GetControl(v106.y); | |
1133 v72 = (const char **)v108; | |
1134 v71->uY = (unsigned int)((char *)v109 + v70); | |
1135 v73 = pFontArrus->CalcTextHeight(*v72, &v101, 0, 0); | |
1136 v74 = v71->uY; | |
1137 v75 = _this; | |
1138 v71->uHeight = v73; | |
1139 v70 = v73 + v74 - 1; | |
1140 v71->uW = v70; | |
1141 v76 = v104; | |
1142 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v75 ) | |
1143 v76 = v105; | |
1144 v101.DrawTitleText(pFontArrus, 0, v74, v76, *(const char **)v108, 3u); | |
1145 v68 = pDialogueWindow; | |
1146 _this = (Player *)((char *)_this + 1); | |
1147 v108 += 4; | |
1148 ++v106.y; | |
1149 result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); | |
1150 } | |
1151 while ( v106.y < (signed int)result ); | |
1152 } | |
1153 break; | |
1154 } | |
1155 case 96: | |
1156 { | |
1157 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1158 if ( result ) | |
1159 { | |
1160 v30 = pDialogueWindow; | |
1161 v3 = 0; | |
1162 v31 = window_SpeakInHouse->ptr_1C; | |
1163 v106.y = 0; | |
1164 //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); | |
1165 v32 = (signed __int64)(p2DEvents[(signed int)v31 - 1].flt_24 * 500.0); | |
1166 v108 = v32 * (100 - _this->GetMerchant()) / 100; | |
1167 if ( v108 < v32 / 3 ) | |
1168 v108 = v32 / 3; | |
1169 v33 = v30->pStartingPosActiveItem; | |
1170 v34 = v33 + v30->pNumPresenceButton; | |
1171 v109 = 0; | |
1172 if ( (signed int)v33 >= v34 ) | |
1173 { | |
1174 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); | |
1175 strcat(pTmpBuf, "\n \n"); | |
1176 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
1177 v7 = pTmpBuf; | |
1178 v86 = 3; | |
1179 v84 = pTmpBuf; | |
1180 v82 = v104; | |
1181 v80 = 0; | |
1182 v78 = 0; | |
1183 v77 = &v101; | |
1184 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); | |
1185 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); | |
1186 } | |
1187 do | |
1188 { | |
1189 v35 = v30->GetControl(v33)->uControlParam - 36; | |
1190 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v35] && !_this->pActiveSkills[v35] ) | |
1191 { | |
1192 v36 = pFontArrus->CalcTextHeight(pSkillNames[v35], &v101, 0, 0); | |
1193 v106.y += v36; | |
1194 v109 = (const char **)((char *)v109 + 1); | |
1195 } | |
1196 ++v33; | |
1197 } | |
1198 while ( (signed int)v33 < v30->pNumPresenceButton + v30->pStartingPosActiveItem ); | |
1199 if ( !v109 ) | |
1200 { | |
1201 //LABEL_105: | |
1202 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); | |
1203 strcat(pTmpBuf, "\n \n"); | |
1204 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
1205 v7 = pTmpBuf; | |
1206 v86 = 3; | |
1207 v84 = pTmpBuf; | |
1208 v82 = v104; | |
1209 v80 = 0; | |
1210 v78 = 0; | |
1211 v77 = &v101; | |
1212 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); | |
1213 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); | |
1214 } | |
1215 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108); | |
1216 v101.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
1217 v108 = (149 - v106.y) / (signed int)v109; | |
1218 if ( (149 - v106.y) / (signed int)v109 > 32 ) | |
1219 v108 = 32; | |
1220 result = (char *)v30->pStartingPosActiveItem; | |
1221 v37 = (149 - (signed int)v109 * v108 - v106.y) / 2 - v108 / 2 + 162; | |
1222 v106.y = (LONG)result; | |
1223 v103 = v37; | |
1224 if ( (signed int)result < (signed int)&result[v30->pNumPresenceButton] ) | |
1225 { | |
1226 v109 = (const char **)2; | |
1227 do | |
1228 { | |
1229 v38 = v30->GetControl(v106.y); | |
1230 v39 = v38; | |
1231 v40 = v38->uControlParam - 36; | |
1232 if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v40] || _this->pActiveSkills[v40] ) | |
1233 { | |
1234 v39->uW = 0; | |
1235 v39->uHeight = 0; | |
1236 v39->uY = 0; | |
1237 } | |
1238 else | |
1239 { | |
1240 v41 = pSkillNames[v40]; | |
1241 v39->uY = v108 + v103; | |
1242 Str = v41; | |
1243 v42 = pFontArrus->CalcTextHeight(v41, &v101, 0, 0); | |
1244 v43 = v39->uY; | |
1245 v44 = v109; | |
1246 v39->uHeight = v42; | |
1247 v45 = v43 + v42 - 1; | |
1248 v39->uW = v45; | |
1249 v103 = v45; | |
1250 v46 = v104; | |
1251 if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v44 ) | |
1252 v46 = v105; | |
1253 v101.DrawTitleText(pFontArrus, 0, v43, v46, Str, 3u); | |
1254 } | |
1255 v47 = v30->pStartingPosActiveItem; | |
1256 ++v106.y; | |
1257 result = (char *)(v30->pNumPresenceButton + v47); | |
1258 v109 = (const char **)((char *)v109 + 1); | |
1259 } | |
1260 while ( v106.y < (signed int)result ); | |
1261 } | |
1262 } | |
1263 break; | |
1264 } | |
1265 case 95: | |
1266 { | |
1267 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
1268 v3 = 0; | |
1269 v109 = 0; | |
1270 v108 = 0; | |
1271 do | |
1272 { | |
1273 // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) | |
1274 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) | |
1275 { | |
1276 v52 = word_F8B158[(signed int)v109] + 30; | |
1277 v53 = ItemsInShopTexture[(signed int)v109]; | |
1278 v54 = 60 - ((signed int)v53->uTextureWidth >> 1); | |
1279 pRenderer->DrawTextureTransparent(v54 + v108, word_F8B158[(signed int)v109] + 30, v53); | |
1280 sub_40F92A( | |
1281 &pRenderer->pActiveZBuffer[v54 + v108 + 640 * v52], | |
1282 ItemsInShopTexture[(signed int)v109], | |
1283 (int)((char *)v109 + 1)); | |
1284 } | |
1285 v109 = (const char **)((char *)v109 + 1); | |
1286 v108 += 70; | |
1287 } | |
1288 while ( (signed int)v109 < 6 ); | |
1289 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1290 if ( result ) | |
1291 { | |
1292 v55 = 0; | |
1293 v106.x = 0; | |
1294 do | |
1295 { | |
1296 // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
1297 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) | |
1298 ++v106.x; | |
1299 ++v55; | |
1300 } | |
1301 while ( v55 < 6 ); | |
1302 v56 = GetAsyncKeyState(17); | |
1303 v57 = _this->CanSteal(); | |
1304 Str = (char *)v57; | |
1305 if ( v56 && v57 ) | |
1306 { | |
1307 v58 = pGlobalTXT_LocalizationStrings[185]; | |
1308 } | |
1309 else | |
1310 { | |
1311 v58 = pGlobalTXT_LocalizationStrings[195]; | |
1312 if ( dword_F8B19C != 2 ) | |
1313 v58 = pGlobalTXT_LocalizationStrings[196]; | |
1314 } | |
1315 DrawTextAtStatusBar(v58, 0); | |
1316 if ( v106.x ) | |
1317 { | |
1318 v59 = pMouse->GetCursorPos(&v91); | |
1319 result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]); | |
1320 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) | |
1321 { | |
1322 v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; | |
1323 v106.x = v60; | |
1324 v61 = (int)window_SpeakInHouse->ptr_1C; | |
1325 // v62 = 9 * (v60 + 12 * v61); | |
1326 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; | |
1327 if ( dword_F8B19C != 2 ) | |
1328 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; | |
1329 if ( !v56 || !Str ) | |
1330 { | |
1331 v85 = 0; | |
1332 v83 = 2; | |
1333 v81 = window_SpeakInHouse->ptr_1C; | |
1334 v79 = v63; | |
1335 v110 = uActiveCharacter - 1; | |
1336 v64 = _this->_490EEE(v63, 1, v61, 2); | |
1337 v6 = v110; | |
1338 v5 = (char *)pMerchantsBuyPhrases[v64]; | |
1339 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); | |
1340 v86 = 3; | |
1341 v84 = v7; | |
1342 v82 = v105; | |
1343 v80 = v3; | |
1344 v78 = v3; | |
1345 v77 = &v101; | |
1346 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); | |
1347 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); | |
1348 } | |
1349 v5 = pGlobalTXT_LocalizationStrings[181]; | |
1350 v85 = 0; | |
1351 v83 = 2; | |
1352 v81 = window_SpeakInHouse->ptr_1C; | |
1353 v79 = v63; | |
1354 v6 = uActiveCharacter - 1; | |
1355 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); | |
1356 v86 = 3; | |
1357 v84 = v7; | |
1358 v82 = v105; | |
1359 v80 = v3; | |
1360 v78 = v3; | |
1361 v77 = &v101; | |
1362 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); | |
1363 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); | |
1364 } | |
1365 } | |
1366 else | |
1367 { | |
1368 v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
1369 result =0; //added | |
1370 } | |
1371 } | |
1372 break; | |
1373 } | |
1374 case 2: | |
1375 { | |
1376 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
1377 v3 = 0; | |
1378 v48 = 0; | |
1379 v108 = 0; | |
1380 v109 = 0; | |
1381 do | |
1382 { | |
1383 // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) | |
1384 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); | |
1385 { | |
1386 v49 = word_F8B158[(signed int)v48]; | |
1387 v50 = ItemsInShopTexture[(signed int)v48]; | |
1388 v49 += 30; | |
1389 v51 = 60 - ((signed int)v50->uTextureWidth >> 1); | |
1390 pRenderer->DrawTextureTransparent(v51 + v108, v49, v50); | |
1391 sub_40F92A( | |
1392 &pRenderer->pActiveZBuffer[v51 + v108 + 640 * v49], | |
1393 ItemsInShopTexture[(signed int)v109], | |
1394 (int)((char *)v109 + 1)); | |
1395 v48 = v109; | |
1396 } | |
1397 v108 += 70; | |
1398 v48 = (const char **)((char *)v48 + 1); | |
1399 v109 = v48; | |
1400 } | |
1401 while ( (signed int)v48 < 6 ); | |
1402 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1403 if ( result ) | |
1404 { | |
1405 v55 = 0; | |
1406 v106.x = 0; | |
1407 v106.x = 0; | |
1408 do | |
1409 { | |
1410 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
1411 ++v106.x; | |
1412 ++v55; | |
1413 } | |
1414 while ( v55 < 6 ); | |
1415 v56 = GetAsyncKeyState(17); | |
1416 v57 = _this->CanSteal(); | |
1417 Str = (char *)v57; | |
1418 if ( v56 && v57 ) | |
1419 { | |
1420 v58 = pGlobalTXT_LocalizationStrings[185]; | |
1421 } | |
1422 else | |
1423 { | |
1424 v58 = pGlobalTXT_LocalizationStrings[195]; | |
1425 if ( dword_F8B19C != 2 ) | |
1426 v58 = pGlobalTXT_LocalizationStrings[196]; | |
1427 } | |
1428 DrawTextAtStatusBar(v58, 0); | |
1429 if ( v106.x ) | |
1430 { | |
1431 v59 = pMouse->GetCursorPos(&v91); | |
1432 result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]); | |
1433 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) | |
1434 { | |
1435 v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; | |
1436 v106.x = v60; | |
1437 v61 = (int)window_SpeakInHouse->ptr_1C; | |
1438 // v62 = 9 * (v60 + 12 * v61); | |
1439 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; | |
1440 if ( dword_F8B19C != 2 ) | |
1441 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; | |
1442 if ( !v56 || !Str ) | |
1443 { | |
1444 v85 = 0; | |
1445 v83 = 2; | |
1446 v81 = window_SpeakInHouse->ptr_1C; | |
1447 v79 = v63; | |
1448 v110 = uActiveCharacter - 1; | |
1449 v64 = _this->_490EEE(v63, 1, v61, 2); | |
1450 v6 = v110; | |
1451 v5 = (char *)pMerchantsBuyPhrases[v64]; | |
1452 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); | |
1453 v86 = 3; | |
1454 v84 = v7; | |
1455 v82 = v105; | |
1456 v80 = v3; | |
1457 v78 = v3; | |
1458 v77 = &v101; | |
1459 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); | |
1460 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); | |
1461 } | |
1462 v5 = pGlobalTXT_LocalizationStrings[181]; | |
1463 v85 = 0; | |
1464 v83 = 2; | |
1465 v81 = window_SpeakInHouse->ptr_1C; | |
1466 v79 = v63; | |
1467 v6 = uActiveCharacter - 1; | |
1468 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); | |
1469 v86 = 3; | |
1470 v84 = v7; | |
1471 v82 = v105; | |
1472 v80 = v3; | |
1473 v78 = v3; | |
1474 v77 = &v101; | |
1475 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); | |
1476 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); | |
1477 } | |
1478 } | |
1479 else | |
1480 { | |
1481 v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
1482 result =0; //added | |
1483 } | |
1484 } | |
1485 break; | |
1486 } | |
1487 case 3: | |
1488 { | |
1489 draw_leather(); | |
1490 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1491 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | |
1492 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1493 if ( result ) | |
1494 { | |
1495 v11 = pMouse->GetCursorPos(&v96)->x - 14; | |
1496 v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5); | |
1497 result = (char *)pMouse->GetCursorPos(&v94); | |
1498 if ( *(int *)result > 13 ) | |
1499 { | |
1500 result = (char *)pMouse->GetCursorPos(&v90); | |
1501 if ( *(int *)result < 462 ) | |
1502 { | |
1503 result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); | |
1504 v3 = 0; | |
1505 if ( result ) | |
1506 { | |
1507 v85 = 0; | |
1508 v83 = 3; | |
1509 v81 = window_SpeakInHouse->ptr_1C; | |
1510 v79 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; | |
1511 v12 = (int)window_SpeakInHouse->ptr_1C; | |
1512 v110 = uActiveCharacter - 1; | |
1513 v13 = _this->_490EEE(v79, 1, v12, 3); | |
1514 v6 = v110; | |
1515 v5 = (char *)pMerchantsSellPhrases[v13]; | |
1516 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); | |
1517 v86 = 3; | |
1518 v84 = v7; | |
1519 v82 = v105; | |
1520 v80 = v3; | |
1521 v78 = v3; | |
1522 v77 = &v101; | |
1523 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); | |
1524 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); | |
1525 } | |
1526 } | |
1527 } | |
1528 } | |
1529 break; | |
1530 } | |
1531 case 4: | |
1532 { | |
1533 draw_leather(); | |
1534 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1535 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | |
1536 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1537 if ( result ) | |
1538 { | |
1539 v2 = pMouse->GetCursorPos(&a2)->x - 14; | |
1540 v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5); | |
1541 result = (char *)pMouse->GetCursorPos(&v100); | |
1542 if ( *(int *)result > 13 ) | |
1543 { | |
1544 result = (char *)pMouse->GetCursorPos(&v92); | |
1545 if ( *(int *)result < 462 ) | |
1546 { | |
1547 result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); | |
1548 v3 = 0; | |
1549 if ( result ) | |
1550 { | |
1551 v85 = 0; | |
1552 v83 = 4; | |
1553 v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; | |
1554 if (!v4->Identified()) | |
1555 { | |
1556 v81 = window_SpeakInHouse->ptr_1C; | |
1557 v79 = v4; | |
1558 v9 = (int)window_SpeakInHouse->ptr_1C; | |
1559 v110 = uActiveCharacter - 1; | |
1560 v10 = _this->_490EEE(v4, 1, v9, 4); | |
1561 v6 = v110; | |
1562 v5 = (char *)pMerchantsIdentifyPhrases[v10]; | |
1563 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); | |
1564 v86 = 3; | |
1565 v84 = v7; | |
1566 v82 = v105; | |
1567 v80 = v3; | |
1568 v78 = v3; | |
1569 v77 = &v101; | |
1570 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); | |
1571 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); | |
1572 } | |
1573 v81 = window_SpeakInHouse->ptr_1C; | |
1574 v5 = "%24"; | |
1575 v79 = v4; | |
1576 //LABEL_13: | |
1577 v6 = uActiveCharacter - 1; | |
1578 //LABEL_14: | |
1579 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); | |
1580 v86 = 3; | |
1581 v84 = v7; | |
1582 v82 = v105; | |
1583 v80 = v3; | |
1584 v78 = v3; | |
1585 v77 = &v101; | |
1586 //LABEL_15: | |
1587 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); | |
1588 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); | |
1589 } | |
1590 } | |
1591 } | |
1592 } | |
1593 break; | |
1594 } | |
1595 case 1: | |
1596 { | |
1597 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1598 if ( result ) | |
1599 { | |
1600 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; | |
1601 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; | |
1602 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; | |
1603 v14 = 0; | |
1604 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
1605 v15 = pShopOptions; | |
1606 do | |
1607 { | |
1608 v16 = pFontArrus->CalcTextHeight(*v15, &v101, 0, 0); | |
1609 ++v15; | |
1610 v14 += v16; | |
1611 } | |
1612 while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); | |
1613 v17 = pDialogueWindow; | |
1614 v103 = (174 - v14) / 4; | |
1615 result = (char *)pDialogueWindow->pStartingPosActiveItem; | |
1616 v18 = (int)&result[pDialogueWindow->pNumPresenceButton]; | |
1617 v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; | |
1618 v20 = -pDialogueWindow->pNumPresenceButton < 0; | |
1619 _this = (Player *)pDialogueWindow->pStartingPosActiveItem; | |
1620 if ( v20 ^ __OFSUB__((int)result, v18) ) | |
1621 { | |
1622 v108 = 2; | |
1623 v109 = (const char **)pShopOptions; | |
1624 do | |
1625 { | |
1626 v21 = v17->GetControl((unsigned int)_this); | |
1627 v22 = v109; | |
1628 v21->uY = v103 + v19; | |
1629 v23 = pFontArrus->CalcTextHeight(*v22, &v101, 0, 0); | |
1630 v24 = v21->uY; | |
1631 v25 = v108; | |
1632 v21->uHeight = v23; | |
1633 v19 = v24 + v23 - 1; | |
1634 v21->uW = v19; | |
1635 v26 = v104; | |
1636 if ( pDialogueWindow->pCurrentPosActiveItem != v25 ) | |
1637 v26 = v105; | |
1638 v101.DrawTitleText(pFontArrus, 0, v24, v26, *v109, 3u); | |
1639 v17 = pDialogueWindow; | |
1640 ++v108; | |
1641 ++v109; | |
1642 _this = (Player *)((char *)_this + 1); | |
1643 result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); | |
1644 } | |
1645 while ( (signed int)_this < (signed int)result ); | |
1646 } | |
1647 } | |
1648 break; | |
1649 } | |
1650 default: | |
1651 { | |
1652 if( dword_F8B19C > 5 ) | |
1653 result = (char *)(dword_F8B19C - 96); | |
1654 else | |
1655 result = (char *)(dword_F8B19C - 4); | |
1656 break; | |
1657 } | |
1658 } | |
1659 return result; | |
1660 } | |
1661 | |
1662 | |
1663 //----- (004B9CC6) -------------------------------------------------------- | |
1664 POINT *__cdecl AlchemistDialog() | |
1665 { | |
1666 Player *v0; // ebx@1 | |
1667 POINT *result; // eax@7 | |
1668 GUIWindow *v2; // edi@9 | |
1669 unsigned int v3; // ebx@9 | |
1670 void *v4; // eax@9 | |
1671 signed int v5; // esi@9 | |
1672 unsigned int v6; // esi@11 | |
1673 int v7; // eax@11 | |
1674 unsigned int v8; // eax@12 | |
1675 int v9; // eax@14 | |
1676 int v10; // ecx@19 | |
1677 GUIButton *v11; // eax@21 | |
1678 GUIButton *v12; // esi@21 | |
1679 int v13; // eax@21 | |
1680 char *v14; // eax@23 | |
1681 int v15; // eax@23 | |
1682 unsigned int v16; // ecx@23 | |
1683 int v17; // edx@23 | |
1684 int v18; // eax@23 | |
1685 unsigned __int16 v19; // ax@23 | |
1686 int v20; // eax@27 | |
1687 char *v21; // edx@29 | |
1688 int v22; // esi@30 | |
1689 char **v23; // edi@30 | |
1690 int v24; // eax@31 | |
1691 GUIWindow *v25; // ecx@32 | |
1692 int v26; // edx@32 | |
1693 int v27; // edi@32 | |
1694 unsigned __int8 v28; // sf@32 | |
1695 GUIButton *v29; // esi@34 | |
1696 const char **v30; // eax@34 | |
1697 int v31; // eax@34 | |
1698 unsigned int v32; // ecx@34 | |
1699 Player *v33; // edx@34 | |
1700 int v34; // eax@34 | |
1701 unsigned __int16 v35; // ax@34 | |
1702 signed int v36; // esi@39 | |
1703 ItemGen *v37; // eax@42 | |
1704 char *v38; // ecx@43 | |
1705 unsigned __int8 v39; // dl@44 | |
1706 int v40; // eax@46 | |
1707 int v41; // ST08_4@47 | |
1708 int v42; // eax@47 | |
1709 signed int v43; // esi@49 | |
1710 int v44; // ST08_4@52 | |
1711 int v45; // eax@52 | |
1712 Texture *v46; // ecx@55 | |
1713 unsigned int v47; // edi@55 | |
1714 unsigned int v48; // esi@57 | |
1715 int v49; // edx@61 | |
1716 Texture *v50; // ecx@67 | |
1717 unsigned int v51; // edi@67 | |
1718 unsigned int v52; // esi@69 | |
1719 int v53; // edx@73 | |
1720 Texture *v54; // ecx@79 | |
1721 unsigned int v55; // edi@79 | |
1722 unsigned int v56; // esi@81 | |
1723 int v57; // edx@85 | |
1724 Texture *v58; // ecx@91 | |
1725 unsigned int v59; // edi@91 | |
1726 unsigned int v60; // esi@93 | |
1727 int v61; // edx@97 | |
1728 signed int v62; // ecx@102 | |
1729 SHORT v63; // di@110 | |
1730 bool v64; // eax@110 | |
1731 const char *v65; // ecx@112 | |
1732 POINT *v66; // esi@117 | |
1733 int v67; // ecx@118 | |
1734 int v68; // eax@118 | |
1735 int v69; // ecx@118 | |
1736 ItemGen *v70; // esi@118 | |
1737 int v71; // eax@123 | |
1738 int v72; // edi@125 | |
1739 char **v73; // esi@125 | |
1740 int v74; // eax@126 | |
1741 GUIWindow *v75; // ecx@127 | |
1742 int v76; // edx@127 | |
1743 int v77; // edi@127 | |
1744 GUIButton *v78; // esi@129 | |
1745 const char **v79; // eax@129 | |
1746 int v80; // eax@129 | |
1747 unsigned int v81; // ecx@129 | |
1748 Player *v82; // edx@129 | |
1749 unsigned __int16 v83; // ax@129 | |
1750 GUIWindow *v84; // [sp-18h] [bp-F0h]@29 | |
1751 int v85; // [sp-14h] [bp-ECh]@29 | |
1752 int v86; // [sp-10h] [bp-E8h]@29 | |
1753 ItemGen *v87; // [sp-10h] [bp-E8h]@43 | |
1754 unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29 | |
1755 void *v89; // [sp-Ch] [bp-E4h]@43 | |
1756 char *v90; // [sp-8h] [bp-E0h]@29 | |
1757 int v91; // [sp-8h] [bp-E0h]@42 | |
1758 unsigned int v92; // [sp-4h] [bp-DCh]@29 | |
1759 __int64 *v93; // [sp-4h] [bp-DCh]@42 | |
1760 POINT v94; // [sp+Ch] [bp-CCh]@39 | |
1761 POINT v95; // [sp+14h] [bp-C4h]@49 | |
1762 POINT v96; // [sp+1Ch] [bp-BCh]@117 | |
1763 POINT v97; // [sp+24h] [bp-B4h]@40 | |
1764 POINT v98; // [sp+2Ch] [bp-ACh]@117 | |
1765 POINT v99; // [sp+34h] [bp-A4h]@49 | |
1766 POINT v100; // [sp+3Ch] [bp-9Ch]@50 | |
1767 POINT v101; // [sp+44h] [bp-94h]@39 | |
1768 POINT v102; // [sp+4Ch] [bp-8Ch]@49 | |
1769 POINT a2; // [sp+54h] [bp-84h]@39 | |
1770 GUIWindow v104; // [sp+5Ch] [bp-7Ch]@1 | |
1771 int v105; // [sp+B0h] [bp-28h]@19 | |
1772 int v106; // [sp+B4h] [bp-24h]@1 | |
1773 char *Str; // [sp+B8h] [bp-20h]@23 | |
1774 int v108; // [sp+BCh] [bp-1Ch]@1 | |
1775 __int32 v109; // [sp+C0h] [bp-18h]@39 | |
1776 Player *_this; // [sp+C4h] [bp-14h]@1 | |
1777 const char **v111; // [sp+C8h] [bp-10h]@9 | |
1778 unsigned int v112; // [sp+CCh] [bp-Ch]@9 | |
1779 unsigned __int8 v113; // [sp+D3h] [bp-5h]@47 | |
1780 int v114; // [sp+D4h] [bp-4h]@11 | |
1781 | |
1782 v0 = pPlayers[uActiveCharacter]; | |
1783 _this = pPlayers[uActiveCharacter]; | |
1784 memcpy(&v104, window_SpeakInHouse, sizeof(v104)); | |
1785 v104.uFrameX = 483; | |
1786 v104.uFrameWidth = 148; | |
1787 v104.uFrameZ = 334; | |
1788 v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
1789 v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
1790 switch(dword_F8B19C) | |
1791 { | |
1792 case 1: | |
1793 { | |
1794 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1795 if ( result ) | |
1796 { | |
1797 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; | |
1798 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; | |
1799 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; | |
1800 v72 = 0; | |
1801 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
1802 v73 = pShopOptions; | |
1803 do | |
1804 { | |
1805 v74 = pFontArrus->CalcTextHeight(*v73, &v104, 0, 0); | |
1806 ++v73; | |
1807 v72 += v74; | |
1808 } | |
1809 while ( (signed int)v73 < (signed int)&unk_F8B1C8 ); | |
1810 v75 = pDialogueWindow; | |
1811 Str = (char *)((174 - v72) / 4); | |
1812 result = (POINT *)pDialogueWindow->pStartingPosActiveItem; | |
1813 v76 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); | |
1814 v77 = (174 - 4 * (174 - v72) / 4 - v72) / 2 - (174 - v72) / 4 / 2 + 138; | |
1815 v28 = -pDialogueWindow->pNumPresenceButton < 0; | |
1816 v112 = pDialogueWindow->pStartingPosActiveItem; | |
1817 if ( v28 ^ __OFSUB__((int)result, v76) ) | |
1818 { | |
1819 _this = (Player *)2; | |
1820 v111 = (const char **)pShopOptions; | |
1821 do | |
1822 { | |
1823 v78 = v75->GetControl(v112); | |
1824 v79 = v111; | |
1825 v78->uY = (unsigned int)&Str[v77]; | |
1826 v80 = pFontArrus->CalcTextHeight(*v79, &v104, 0, 0); | |
1827 v81 = v78->uY; | |
1828 v82 = _this; | |
1829 v78->uHeight = v80; | |
1830 v77 = v81 + v80 - 1; | |
1831 v78->uW = v77; | |
1832 v83 = v106; | |
1833 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v82 ) | |
1834 v83 = v108; | |
1835 v104.DrawTitleText(pFontArrus, 0, v81, v83, *v111, 3u); | |
1836 v75 = pDialogueWindow; | |
1837 _this = (Player *)((char *)_this + 1); | |
1838 ++v111; | |
1839 ++v112; | |
1840 result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); | |
1841 } | |
1842 while ( (signed int)v112 < (signed int)result ); | |
1843 } | |
1844 } | |
1845 return result; | |
1846 } | |
1847 case 3: | |
1848 { | |
1849 draw_leather(); | |
1850 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1851 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | |
1852 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1853 if ( !result | |
1854 || (v43 = pMouse->GetCursorPos(&v99)->x - 14, | |
1855 v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), | |
1856 result = pMouse->GetCursorPos(&v102), | |
1857 result->x <= 13) | |
1858 || (result = pMouse->GetCursorPos(&v100), result->x >= 462) | |
1859 || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) | |
1860 return result; | |
1861 v93 = 0; | |
1862 v91 = 3; | |
1863 v89 = window_SpeakInHouse->ptr_1C; | |
1864 v87 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; | |
1865 v44 = (int)window_SpeakInHouse->ptr_1C; | |
1866 v113 = uActiveCharacter - 1; | |
1867 v45 = _this->_490EEE(v87, 4, v44, 3); | |
1868 v39 = v113; | |
1869 v38 = (char *)pMerchantsSellPhrases[v45]; | |
1870 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); | |
1871 v92 = 3; | |
1872 v90 = v21; | |
1873 v88 = v108; | |
1874 v86 = v3; | |
1875 v85 = v3; | |
1876 v84 = &v104; | |
1877 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | |
1878 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | |
1879 } | |
1880 case 4: | |
1881 { | |
1882 draw_leather(); | |
1883 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1884 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | |
1885 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
1886 if ( !result | |
1887 || (v36 = pMouse->GetCursorPos(&a2)->x - 14, | |
1888 v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), | |
1889 result = pMouse->GetCursorPos(&v101), | |
1890 result->x <= 13) | |
1891 || (result = pMouse->GetCursorPos(&v97), result->x >= 462) | |
1892 || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) | |
1893 return result; | |
1894 v93 = 0; | |
1895 v91 = 4; | |
1896 v37 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; | |
1897 if (!v37->Identified()) | |
1898 { | |
1899 v89 = window_SpeakInHouse->ptr_1C; | |
1900 v87 = v37; | |
1901 v41 = (int)window_SpeakInHouse->ptr_1C; | |
1902 v113 = uActiveCharacter - 1; | |
1903 v42 = _this->_490EEE(v37, 4, v41, 4); | |
1904 v39 = v113; | |
1905 v38 = (char *)pMerchantsIdentifyPhrases[v42]; | |
1906 } | |
1907 else | |
1908 { | |
1909 v89 = window_SpeakInHouse->ptr_1C; | |
1910 v38 = "%24"; | |
1911 v87 = v37; | |
1912 v39 = uActiveCharacter - 1; | |
1913 } | |
1914 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); | |
1915 v92 = 3; | |
1916 v90 = v21; | |
1917 v88 = v108; | |
1918 v86 = v3; | |
1919 v85 = v3; | |
1920 v84 = &v104; | |
1921 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | |
1922 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | |
1923 } | |
1924 case 94: | |
1925 { | |
1926 draw_leather(); | |
1927 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
1928 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; | |
1929 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; | |
1930 v22 = 0; | |
1931 v23 = pShopOptions; | |
1932 do | |
1933 { | |
1934 v24 = pFontArrus->CalcTextHeight(*v23, &v104, 0, 0); | |
1935 ++v23; | |
1936 v22 += v24; | |
1937 } | |
1938 while ( (signed int)v23 < (signed int)&pShopOptions[2] ); | |
1939 Str = (char *)((174 - v22) / 2); | |
1940 v25 = pDialogueWindow; | |
1941 result = (POINT *)pDialogueWindow->pStartingPosActiveItem; | |
1942 v26 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); | |
1943 v27 = (2 * (87 - (174 - v22) / 2) - v22) / 2 - (174 - v22) / 2 / 2 + 138; | |
1944 v28 = -pDialogueWindow->pNumPresenceButton < 0; | |
1945 v112 = pDialogueWindow->pStartingPosActiveItem; | |
1946 if ( v28 ^ __OFSUB__((int)result, v26) ) | |
1947 { | |
1948 _this = (Player *)2; | |
1949 v111 = (const char **)pShopOptions; | |
1950 do | |
1951 { | |
1952 v29 = v25->GetControl(v112); | |
1953 v30 = v111; | |
1954 v29->uY = (unsigned int)&Str[v27]; | |
1955 v31 = pFontArrus->CalcTextHeight(*v30, &v104, 0, 0); | |
1956 v32 = v29->uY; | |
1957 v33 = _this; | |
1958 v29->uHeight = v31; | |
1959 v34 = v31 + v32 - 1; | |
1960 v29->uW = v34; | |
1961 v27 = v34; | |
1962 v35 = v106; | |
1963 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v33 ) | |
1964 v35 = v108; | |
1965 v104.DrawTitleText(pFontArrus, 0, v32, v35, *v111, 3u); | |
1966 v25 = pDialogueWindow; | |
1967 _this = (Player *)((char *)_this + 1); | |
1968 ++v111; | |
1969 ++v112; | |
1970 result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); | |
1971 } | |
1972 while ( (signed int)v112 < (signed int)result ); | |
1973 } | |
1974 return result; | |
1975 } | |
1976 case 2: | |
1977 { | |
1978 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
1979 v3 = 0; | |
1980 v114 = 0; | |
1981 do | |
1982 { | |
1983 // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
1984 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); | |
1985 { | |
1986 v46 = ItemsInShopTexture[v114]; | |
1987 v47 = 152 - v46->uTextureHeight; | |
1988 if ( (signed int)v47 < 1 ) | |
1989 v47 = 0; | |
1990 v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; | |
1991 if ( v114 ) | |
1992 { | |
1993 if ( v114 == 5 ) | |
1994 { | |
1995 v49 = ItemsInShopTexture[5]->uTextureWidth; | |
1996 if ( (signed int)v48 > 457 - v49 ) | |
1997 v48 = 457 - v49; | |
1998 } | |
1999 } | |
2000 else if ( (signed int)v48 < 18 ) | |
2001 v48 = 18; | |
2002 pRenderer->DrawTextureTransparent(v48, v47, v46); | |
2003 sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); | |
2004 } | |
2005 ++v114; | |
2006 } | |
2007 while ( v114 < 6 ); | |
2008 v114 = 0; | |
2009 do | |
2010 { | |
2011 // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) | |
2012 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); | |
2013 { | |
2014 v50 = ItemsInShopTexture[v114 + 6]; | |
2015 v51 = 308 - v50->uTextureHeight; | |
2016 if ( (signed int)v51 < 1 ) | |
2017 v51 = 0; | |
2018 v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; | |
2019 if ( v114 ) | |
2020 { | |
2021 if ( v114 == 5 ) | |
2022 { | |
2023 v53 = ItemsInShopTexture[11]->uTextureWidth; | |
2024 if ( (signed int)v52 > 457 - v53 ) | |
2025 v52 = 457 - v53; | |
2026 } | |
2027 } | |
2028 else | |
2029 { | |
2030 if ( (signed int)v52 < 18 ) | |
2031 v52 = 18; | |
2032 } | |
2033 pRenderer->DrawTextureTransparent(v52, v51, v50); | |
2034 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); | |
2035 } | |
2036 ++v114; | |
2037 } | |
2038 while ( v114 < 6 ); | |
2039 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
2040 if ( result ) | |
2041 { | |
2042 v62 = 0; | |
2043 v109 = 0; | |
2044 do | |
2045 { | |
2046 // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
2047 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); | |
2048 ++v109; | |
2049 ++v62; | |
2050 } | |
2051 while ( v62 < 12 ); | |
2052 v63 = GetAsyncKeyState(17); | |
2053 v64 = _this->CanSteal(); | |
2054 Str = (char *)v64; | |
2055 if ( v63 && v64 ) | |
2056 { | |
2057 v65 = pGlobalTXT_LocalizationStrings[185]; | |
2058 } | |
2059 else if ( dword_F8B19C == 2 ) | |
2060 { | |
2061 v65 = pGlobalTXT_LocalizationStrings[195]; | |
2062 } | |
2063 else | |
2064 { | |
2065 v65 = pGlobalTXT_LocalizationStrings[196]; | |
2066 } | |
2067 DrawTextAtStatusBar(v65, 0); | |
2068 if ( !v109 ) | |
2069 { | |
2070 v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
2071 return 0; | |
2072 } | |
2073 v66 = pMouse->GetCursorPos(&v98); | |
2074 result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); | |
2075 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) | |
2076 { | |
2077 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; | |
2078 v109 = v67; | |
2079 v68 = (int)window_SpeakInHouse->ptr_1C; | |
2080 // v69 = 9 * (v67 + 12 * v68); | |
2081 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; | |
2082 if ( dword_F8B19C != 2 ) | |
2083 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; | |
2084 if ( !v63 || !Str ) | |
2085 { | |
2086 v93 = 0; | |
2087 v91 = 2; | |
2088 v89 = window_SpeakInHouse->ptr_1C; | |
2089 v87 = v70; | |
2090 v113 = uActiveCharacter - 1; | |
2091 v71 = _this->_490EEE(v70, 4, v68, 2); | |
2092 v39 = v113; | |
2093 v38 = (char *)pMerchantsBuyPhrases[v71]; | |
2094 } | |
2095 else | |
2096 { | |
2097 v38 = pGlobalTXT_LocalizationStrings[181]; | |
2098 v93 = 0; | |
2099 v91 = 2; | |
2100 v89 = window_SpeakInHouse->ptr_1C; | |
2101 v87 = v70; | |
2102 v39 = uActiveCharacter - 1; | |
2103 } | |
2104 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); | |
2105 v92 = 3; | |
2106 v90 = v21; | |
2107 v88 = v108; | |
2108 v86 = v3; | |
2109 v85 = v3; | |
2110 v84 = &v104; | |
2111 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | |
2112 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | |
2113 } | |
2114 } | |
2115 return result; | |
2116 } | |
2117 case 95: | |
2118 { | |
2119 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
2120 v3 = 0; | |
2121 v114 = 0; | |
2122 do | |
2123 { | |
2124 //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
2125 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) | |
2126 { | |
2127 v54 = ItemsInShopTexture[v114]; | |
2128 v55 = 152 - v54->uTextureHeight; | |
2129 if ( (signed int)v55 < 1 ) | |
2130 v55 = 0; | |
2131 v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; | |
2132 if ( v114 ) | |
2133 { | |
2134 if ( v114 == 5 ) | |
2135 { | |
2136 v57 = ItemsInShopTexture[5]->uTextureWidth; | |
2137 if ( (signed int)v56 > 457 - v57 ) | |
2138 v56 = 457 - v57; | |
2139 } | |
2140 } | |
2141 else | |
2142 { | |
2143 if ( (signed int)v56 < 18 ) | |
2144 v56 = 18; | |
2145 } | |
2146 pRenderer->DrawTextureTransparent(v56, v55, v54); | |
2147 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); | |
2148 } | |
2149 ++v114; | |
2150 } | |
2151 while ( v114 < 6 ); | |
2152 v114 = 0; | |
2153 do | |
2154 { | |
2155 // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak | |
2156 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid | |
2157 { | |
2158 v58 = ItemsInShopTexture[v114 + 6]; | |
2159 v59 = 308 - v58->uTextureHeight; | |
2160 if ( (signed int)v59 < 1 ) | |
2161 v59 = 0; | |
2162 v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; | |
2163 if ( v114 ) | |
2164 { | |
2165 if ( v114 == 5 ) | |
2166 { | |
2167 v61 = ItemsInShopTexture[11]->uTextureWidth; | |
2168 if ( (signed int)v60 > 457 - v61 ) | |
2169 v60 = 457 - v61; | |
2170 } | |
2171 } | |
2172 else | |
2173 { | |
2174 if ( (signed int)v60 < 18 ) | |
2175 v60 = 18; | |
2176 } | |
2177 pRenderer->DrawTextureTransparent(v60, v59, v58); | |
2178 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); | |
2179 } | |
2180 ++v114; | |
2181 } | |
2182 while ( v114 < 6 ); | |
2183 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
2184 if ( result ) | |
2185 { | |
2186 v62 = 0; | |
2187 v109 = 0; | |
2188 do | |
2189 { | |
2190 //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
2191 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) | |
2192 ++v109; | |
2193 ++v62; | |
2194 } | |
2195 while ( v62 < 12 ); | |
2196 v63 = GetAsyncKeyState(17); | |
2197 v64 = _this->CanSteal(); | |
2198 Str = (char *)v64; | |
2199 if ( v63 && v64 ) | |
2200 { | |
2201 v65 = pGlobalTXT_LocalizationStrings[185]; | |
2202 } | |
2203 else | |
2204 { | |
2205 v65 = pGlobalTXT_LocalizationStrings[195]; | |
2206 if ( dword_F8B19C != 2 ) | |
2207 v65 = pGlobalTXT_LocalizationStrings[196]; | |
2208 } | |
2209 DrawTextAtStatusBar(v65, 0); | |
2210 if ( !v109 ) | |
2211 { | |
2212 v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
2213 return 0; | |
2214 } | |
2215 v66 = pMouse->GetCursorPos(&v98); | |
2216 result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); | |
2217 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) | |
2218 { | |
2219 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; | |
2220 v109 = v67; | |
2221 v68 = (int)window_SpeakInHouse->ptr_1C; | |
2222 // v69 = 9 * (v67 + 12 * v68); | |
2223 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; | |
2224 if ( dword_F8B19C != 2 ) | |
2225 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; | |
2226 if ( !v63 || !Str ) | |
2227 { | |
2228 v93 = 0; | |
2229 v91 = 2; | |
2230 v89 = window_SpeakInHouse->ptr_1C; | |
2231 v87 = v70; | |
2232 v113 = uActiveCharacter - 1; | |
2233 v71 = _this->_490EEE(v70, 4, v68, 2); | |
2234 v39 = v113; | |
2235 v38 = (char *)pMerchantsBuyPhrases[v71]; | |
2236 } | |
2237 else | |
2238 { | |
2239 v38 = pGlobalTXT_LocalizationStrings[181]; | |
2240 v93 = 0; | |
2241 v91 = 2; | |
2242 v89 = window_SpeakInHouse->ptr_1C; | |
2243 v87 = v70; | |
2244 v39 = uActiveCharacter - 1; | |
2245 } | |
2246 v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); | |
2247 v92 = 3; | |
2248 v90 = v21; | |
2249 v88 = v108; | |
2250 v86 = v3; | |
2251 v85 = v3; | |
2252 v84 = &v104; | |
2253 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | |
2254 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | |
2255 } | |
2256 } | |
2257 return result; | |
2258 } | |
2259 case 96: | |
2260 { | |
2261 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) | |
2262 return 0; | |
2263 v2 = pDialogueWindow; | |
2264 v3 = 0; | |
2265 v4 = window_SpeakInHouse->ptr_1C; | |
2266 v112 = 0; | |
2267 //v5 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v4] * 500.0); | |
2268 v5 = (signed __int64)(p2DEvents[(signed int)v4 - 1].flt_24 * 500.0); | |
2269 v111 = (const char **)(v5 * (100 - _this->GetMerchant()) / 100); | |
2270 if ( (signed int)v111 < v5 / 3 ) | |
2271 v111 = (const char **)(v5 / 3); | |
2272 v6 = v2->pStartingPosActiveItem; | |
2273 v7 = v6 + v2->pNumPresenceButton; | |
2274 v114 = 0; | |
2275 if ( (signed int)v6 < v7 ) | |
2276 { | |
2277 do | |
2278 { | |
2279 v8 = v2->GetControl(v6)->uControlParam - 36; | |
2280 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v8] && !_this->pActiveSkills[v8] ) | |
2281 { | |
2282 v9 = pFontArrus->CalcTextHeight(pSkillNames[v8], &v104, 0, 0); | |
2283 v112 += v9; | |
2284 ++v114; | |
2285 } | |
2286 ++v6; | |
2287 } | |
2288 while ( (signed int)v6 < v2->pNumPresenceButton + v2->pStartingPosActiveItem ); | |
2289 if ( v114 ) | |
2290 { | |
2291 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111); | |
2292 v104.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
2293 v111 = (const char **)((signed int)(149 - v112) / v114); | |
2294 if ( (signed int)(149 - v112) / v114 > 32 ) | |
2295 v111 = (const char **)32; | |
2296 result = (POINT *)v2->pStartingPosActiveItem; | |
2297 v10 = (signed int)(149 - v114 * (int)v111 - v112) / 2 - (signed int)v111 / 2 + 162; | |
2298 v112 = (unsigned int)result; | |
2299 v105 = v10; | |
2300 if ( (signed int)result < (signed int)((char *)result + v2->pNumPresenceButton) ) | |
2301 { | |
2302 v114 = 2; | |
2303 do | |
2304 { | |
2305 v11 = v2->GetControl(v112); | |
2306 v12 = v11; | |
2307 v13 = v11->uControlParam - 36; | |
2308 if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v13] || _this->pActiveSkills[v13] ) | |
2309 { | |
2310 v12->uW = 0; | |
2311 v12->uHeight = 0; | |
2312 v12->uY = 0; | |
2313 } | |
2314 else | |
2315 { | |
2316 v14 = pSkillNames[v13]; | |
2317 v12->uY = (unsigned int)((char *)v111 + v105); | |
2318 Str = v14; | |
2319 v15 = pFontArrus->CalcTextHeight(v14, &v104, 0, 0); | |
2320 v16 = v12->uY; | |
2321 v17 = v114; | |
2322 v12->uHeight = v15; | |
2323 v18 = v16 + v15 - 1; | |
2324 v12->uW = v18; | |
2325 v105 = v18; | |
2326 v19 = v106; | |
2327 if ( pDialogueWindow->pCurrentPosActiveItem != v17 ) | |
2328 v19 = v108; | |
2329 v104.DrawTitleText(pFontArrus, 0, v16, v19, Str, 3u); | |
2330 } | |
2331 v20 = v2->pStartingPosActiveItem; | |
2332 ++v112; | |
2333 result = (POINT *)(v2->pNumPresenceButton + v20); | |
2334 ++v114; | |
2335 } | |
2336 while ( (signed int)v112 < (signed int)result ); | |
2337 } | |
2338 return result; | |
2339 } | |
2340 } | |
2341 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); | |
2342 strcat(pTmpBuf, "\n \n"); | |
2343 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
2344 v21 = pTmpBuf; | |
2345 v92 = 3; | |
2346 v90 = pTmpBuf; | |
2347 v88 = v106; | |
2348 v86 = 0; | |
2349 v85 = 0; | |
2350 v84 = &v104; | |
2351 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | |
2352 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | |
2353 } | |
2354 default: | |
2355 { | |
2356 return (POINT *)dword_F8B19C - 96; | |
2357 } | |
2358 } | |
2359 } | |
2360 | |
2361 | |
2362 //----- (004BA928) -------------------------------------------------------- | |
2363 void __cdecl ArmorShopDialog() | |
2364 { | |
2365 Player *v0; // ebx@1 | |
2366 signed int v1; // esi@8 | |
2367 unsigned int v2; // eax@10 | |
2368 ItemGen *v3; // eax@11 | |
2369 unsigned __int8 v4; // dl@12 | |
2370 char *v5; // ecx@12 | |
2371 char *v6; // eax@13 | |
2372 int v7; // ST08_4@15 | |
2373 int v8; // eax@15 | |
2374 signed int v9; // esi@17 | |
2375 unsigned int v10; // eax@19 | |
2376 char *v11; // edi@19 | |
2377 int v12; // ST08_4@20 | |
2378 int v13; // eax@20 | |
2379 unsigned __int8 v14; // dl@20 | |
2380 char *v15; // ecx@20 | |
2381 char **v16; // edi@22 | |
2382 int v17; // ebx@22 | |
2383 char **v18; // esi@22 | |
2384 int v19; // eax@23 | |
2385 GUIWindow *v20; // ecx@24 | |
2386 int v21; // eax@24 | |
2387 int v22; // edx@24 | |
2388 int v23; // ebx@24 | |
2389 unsigned __int8 v24; // sf@24 | |
2390 GUIButton *v25; // eax@26 | |
2391 GUIButton *v26; // esi@26 | |
2392 int v27; // eax@26 | |
2393 unsigned int v28; // ecx@26 | |
2394 int v29; // edx@26 | |
2395 unsigned __int16 v30; // ax@26 | |
2396 signed int v31; // esi@31 | |
2397 unsigned int v32; // eax@33 | |
2398 int v33; // eax@34 | |
2399 int v34; // ST08_4@35 | |
2400 int v35; // eax@35 | |
2401 char *v36; // edx@36 | |
2402 GUIWindow *v37; // edi@42 | |
2403 signed int v38; // esi@42 | |
2404 unsigned int v39; // esi@44 | |
2405 int v40; // eax@44 | |
2406 unsigned int v41; // eax@45 | |
2407 int v42; // eax@47 | |
2408 int v43; // ecx@52 | |
2409 GUIButton *v44; // eax@54 | |
2410 GUIButton *v45; // esi@54 | |
2411 int v46; // eax@54 | |
2412 char *v47; // eax@56 | |
2413 int v48; // eax@56 | |
2414 unsigned int v49; // ecx@56 | |
2415 int v50; // edx@56 | |
2416 int v51; // eax@56 | |
2417 unsigned __int16 v52; // ax@56 | |
2418 int v53; // eax@60 | |
2419 int v54; // eax@60 | |
2420 signed int v55; // ebx@65 | |
2421 Texture *v56; // eax@67 | |
2422 unsigned int v57; // edi@68 | |
2423 Texture *v58; // ST1C_4@68 | |
2424 int v59; // eax@68 | |
2425 int v60; // edi@69 | |
2426 signed int v61; // ebx@73 | |
2427 Texture *v62; // eax@75 | |
2428 int v63; // edi@76 | |
2429 Texture *v64; // ST1C_4@76 | |
2430 unsigned int v65; // ST18_4@76 | |
2431 int v66; // eax@76 | |
2432 int v67; // edi@77 | |
2433 signed int v68; // ecx@81 | |
2434 SHORT v69; // bx@89 | |
2435 bool v70; // eax@89 | |
2436 const char *v71; // ecx@91 | |
2437 void *v72; // eax@95 | |
2438 POINT *v73; // esi@97 | |
2439 int v74; // ecx@97 | |
2440 int v75; // eax@98 | |
2441 int v76; // ecx@98 | |
2442 ItemGen *v77; // ecx@99 | |
2443 unsigned __int8 v78; // bl@104 | |
2444 char **v79; // edi@105 | |
2445 int v80; // ebx@105 | |
2446 char **v81; // esi@105 | |
2447 int v82; // eax@106 | |
2448 GUIWindow *v83; // ecx@107 | |
2449 int v84; // eax@107 | |
2450 int v85; // edx@107 | |
2451 int v86; // ebx@107 | |
2452 GUIButton *v87; // eax@109 | |
2453 GUIButton *v88; // esi@109 | |
2454 int v89; // eax@109 | |
2455 unsigned int v90; // ecx@109 | |
2456 int v91; // edx@109 | |
2457 unsigned __int16 v92; // ax@109 | |
2458 signed int v93; // edx@114 | |
2459 POINT *v94; // edi@120 | |
2460 __int32 v95; // ecx@120 | |
2461 void *v96; // ST14_4@122 | |
2462 unsigned __int8 v97; // bl@122 | |
2463 ItemGen *v98; // ST10_4@122 | |
2464 int v99; // eax@122 | |
2465 char *v100; // eax@122 | |
2466 const char *v101; // ST18_4@122 | |
2467 unsigned __int16 v102; // ST14_2@122 | |
2468 int v103; // eax@122 | |
2469 signed int v104; // edi@123 | |
2470 Texture *v105; // eax@125 | |
2471 int v106; // ebx@126 | |
2472 Texture *v107; // ST1C_4@126 | |
2473 unsigned int v108; // ST18_4@126 | |
2474 int v109; // eax@126 | |
2475 int v110; // ebx@127 | |
2476 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 | |
2477 unsigned int v112; // [sp-14h] [bp-118h]@13 | |
2478 int v113; // [sp-14h] [bp-118h]@36 | |
2479 ItemGen *v114; // [sp-10h] [bp-114h]@12 | |
2480 unsigned int v115; // [sp-10h] [bp-114h]@13 | |
2481 ItemGen *v116; // [sp-10h] [bp-114h]@20 | |
2482 int v117; // [sp-10h] [bp-114h]@36 | |
2483 void *v118; // [sp-Ch] [bp-110h]@12 | |
2484 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 | |
2485 void *v120; // [sp-Ch] [bp-110h]@20 | |
2486 char *v121; // [sp-8h] [bp-10Ch]@13 | |
2487 int v122; // [sp-8h] [bp-10Ch]@20 | |
2488 unsigned int v123; // [sp-4h] [bp-108h]@13 | |
2489 __int64 *v124; // [sp-4h] [bp-108h]@20 | |
2490 int v125; // [sp-4h] [bp-108h]@68 | |
2491 int v126; // [sp-4h] [bp-108h]@76 | |
2492 int v127; // [sp-4h] [bp-108h]@126 | |
2493 POINT v128; // [sp+Ch] [bp-F8h]@8 | |
2494 POINT v129; // [sp+14h] [bp-F0h]@18 | |
2495 char v130; // [sp+1Ch] [bp-E8h]@120 | |
2496 POINT a2; // [sp+24h] [bp-E0h]@8 | |
2497 POINT v132; // [sp+2Ch] [bp-D8h]@120 | |
2498 POINT v133; // [sp+34h] [bp-D0h]@17 | |
2499 POINT v134; // [sp+3Ch] [bp-C8h]@97 | |
2500 POINT v135; // [sp+44h] [bp-C0h]@31 | |
2501 POINT v136; // [sp+4Ch] [bp-B8h]@97 | |
2502 POINT v137; // [sp+54h] [bp-B0h]@17 | |
2503 POINT v138; // [sp+5Ch] [bp-A8h]@32 | |
2504 POINT v139; // [sp+64h] [bp-A0h]@17 | |
2505 POINT v140; // [sp+6Ch] [bp-98h]@31 | |
2506 POINT v141; // [sp+74h] [bp-90h]@8 | |
2507 POINT v142; // [sp+7Ch] [bp-88h]@31 | |
2508 POINT v143; // [sp+84h] [bp-80h]@9 | |
2509 GUIWindow v144; // [sp+8Ch] [bp-78h]@1 | |
2510 char *Str; // [sp+E0h] [bp-24h]@56 | |
2511 int v146; // [sp+E4h] [bp-20h]@24 | |
2512 int v147; // [sp+E8h] [bp-1Ch]@1 | |
2513 int v148; // [sp+ECh] [bp-18h]@1 | |
2514 __int32 v149; // [sp+F0h] [bp-14h]@8 | |
2515 Player* _this; // [sp+F4h] [bp-10h]@1 | |
2516 unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15 | |
2517 int v152; // [sp+FCh] [bp-8h]@24 | |
2518 int v153; // [sp+100h] [bp-4h]@44 | |
2519 int th; | |
2520 | |
2521 v0 = pPlayers[uActiveCharacter]; | |
2522 _this = pPlayers[uActiveCharacter]; | |
2523 memcpy(&v144, window_SpeakInHouse, sizeof(v144)); | |
2524 v144.uFrameX = 483; | |
2525 v144.uFrameWidth = 148; | |
2526 v144.uFrameZ = 334; | |
2527 v148 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
2528 v147 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
2529 switch (dword_F8B19C) | |
2530 { | |
2531 case 1: //prepare shop text | |
2532 { | |
2533 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2534 { | |
2535 v16 = pShopOptions; | |
2536 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; | |
2537 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; | |
2538 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; | |
2539 v17 = 0; | |
2540 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
2541 for(int i=0;i<4;++i) | |
2542 { | |
2543 v19 = pFontArrus->CalcTextHeight(pShopOptions[i], &v144, 0, 0); | |
2544 v17 += v19; | |
2545 } | |
2546 v20 = pDialogueWindow; | |
2547 v146 = (174 - v17) / 4; | |
2548 v21 = pDialogueWindow->pStartingPosActiveItem; | |
2549 v22 = v21 + pDialogueWindow->pNumPresenceButton; | |
2550 v23 = (174 - 4 * (174 - v17) / 4 - v17) / 2 - (174 - v17) / 4 / 2 + 138; | |
2551 v24 = -pDialogueWindow->pNumPresenceButton < 0; | |
2552 v152 = pDialogueWindow->pStartingPosActiveItem; | |
2553 if ( v24 ^ __OFSUB__(v21, v22) ) | |
2554 { | |
2555 th = 2; | |
2556 do | |
2557 { | |
2558 v25 = v20->GetControl(v152); | |
2559 v26 = v25; | |
2560 v25->uY = v146 + v23; | |
2561 v27 = pFontArrus->CalcTextHeight(*v16, &v144, 0, 0); | |
2562 v28 = v26->uY; | |
2563 v29 = th; | |
2564 v26->uHeight = v27; | |
2565 v23 = v28 + v27 - 1; | |
2566 v26->uW = v23; | |
2567 v30 = v147; | |
2568 if ( pDialogueWindow->pCurrentPosActiveItem != v29 ) | |
2569 v30 = v148; | |
2570 v144.DrawTitleText(pFontArrus, 0, v28, v30, *v16, 3u); | |
2571 v20 = pDialogueWindow; | |
2572 ++th; | |
2573 ++v16; | |
2574 ++v152; | |
2575 } | |
2576 while ( v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
2577 } | |
2578 } | |
2579 } | |
2580 break; | |
2581 case 2: //buy standart | |
2582 { | |
2583 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
2584 v55 = 0; | |
2585 v153 = 0; | |
2586 for(int i=0; i<8; ++i) | |
2587 { | |
2588 // if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
2589 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID); | |
2590 { | |
2591 v56 = ItemsInShopTexture[v55]; | |
2592 if ( i >= 4 ) | |
2593 { | |
2594 v60 = 90 - ((signed int)v56->uTextureWidth >> 1); | |
2595 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); | |
2596 v59 = v60 + v153 + 80220; | |
2597 } | |
2598 else | |
2599 { | |
2600 v57 = 98 - v56->uTextureHeight; | |
2601 v58 = ItemsInShopTexture[i]; | |
2602 v152 = 86 - ((signed int)v56->uTextureWidth >> 1); | |
2603 pRenderer->DrawTextureTransparent(v153 + v152, v57, v58); | |
2604 v59 = v153 + v152 + 640 * v57; | |
2605 } | |
2606 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); | |
2607 } | |
2608 v153 += 105; | |
2609 | |
2610 } | |
2611 | |
2612 v11 = 0; | |
2613 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2614 return; | |
2615 | |
2616 v149 = 0; | |
2617 for(int i=0; i<6; ++i) | |
2618 { | |
2619 // if ( (char *)pParty->field_777C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] != v11 ) | |
2620 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID); | |
2621 ++v149; | |
2622 | |
2623 } | |
2624 | |
2625 v69 = GetAsyncKeyState(17); | |
2626 v70 = _this->CanSteal(); | |
2627 //Str = (char *)v70; | |
2628 if ( v69 == 0 || v70 == 0 ) | |
2629 { | |
2630 v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" | |
2631 } | |
2632 else | |
2633 { | |
2634 v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item" | |
2635 } | |
2636 DrawTextAtStatusBar(v71, 0); | |
2637 if ( v149 != 0 ) | |
2638 { | |
2639 v73 = pMouse->GetCursorPos(&v136); | |
2640 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; | |
2641 if ( !v74 ) | |
2642 return; | |
2643 v149 = v74 - 1; | |
2644 v75 = (int)window_SpeakInHouse->ptr_1C; | |
2645 v77 = &pParty->StandartItemsInShops[(int)v75][v74-1]; | |
2646 if ( v69 ==0 || v70 == 0) | |
2647 { | |
2648 v120 = window_SpeakInHouse->ptr_1C; | |
2649 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(v77, 2, v75, 2)]; | |
2650 } | |
2651 else | |
2652 { | |
2653 v120 = window_SpeakInHouse->ptr_1C; | |
2654 v15 = pGlobalTXT_LocalizationStrings[181]; | |
2655 } | |
2656 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v77, (char *)v120, 2, 0); | |
2657 v115 = (174 - pFontArrus->CalcTextHeight(v36, &v144, 0, 0)) / 2 + 138; | |
2658 v144.DrawTitleText(pFontArrus, 0, v115, v148, v36, 3); | |
2659 return; | |
2660 } | |
2661 v72 = window_SpeakInHouse->ptr_1C; | |
2662 v144.DrawCurrentTime( pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); | |
2663 return; | |
2664 } | |
2665 break; | |
2666 case 3: | |
2667 { | |
2668 draw_leather(); | |
2669 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
2670 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); | |
2671 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
2672 || (v9 = pMouse->GetCursorPos(&v139)->x - 14, | |
2673 v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), | |
2674 pMouse->GetCursorPos(&v137)->x <= 13) | |
2675 || pMouse->GetCursorPos(&v129)->x >= 462 | |
2676 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) | |
2677 return; | |
2678 v124 = 0; | |
2679 v122 = 3; | |
2680 v120 = window_SpeakInHouse->ptr_1C; | |
2681 v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; | |
2682 v12 = (int)window_SpeakInHouse->ptr_1C; | |
2683 uPlayerID = uActiveCharacter - 1; | |
2684 v13 = v0->_490EEE(v116, 2, v12, 3); | |
2685 v14 = uPlayerID; | |
2686 v15 = (char *)pMerchantsSellPhrases[v13]; | |
2687 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); | |
2688 v123 = 3; | |
2689 v121 = v36; | |
2690 v119 = v148; | |
2691 v117 = (int)v11; | |
2692 v113 = (int)v11; | |
2693 v111 = &v144; | |
2694 v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; | |
2695 v112 = (unsigned int)v11; | |
2696 v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); | |
2697 return; | |
2698 } | |
2699 break; | |
2700 case 4: | |
2701 { | |
2702 draw_leather(); | |
2703 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
2704 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); | |
2705 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2706 { | |
2707 v1 = pMouse->GetCursorPos(&a2)->x - 14; | |
2708 v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); | |
2709 if ( pMouse->GetCursorPos(&v141)->x > 13 ) | |
2710 { | |
2711 if ( pMouse->GetCursorPos(&v143)->x < 462 ) | |
2712 { | |
2713 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); | |
2714 if ( v2 ) | |
2715 { | |
2716 v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; | |
2717 if (v3->Identified()) | |
2718 { | |
2719 v118 = window_SpeakInHouse->ptr_1C; | |
2720 v4 = uActiveCharacter - 1; | |
2721 v5 = "%24"; | |
2722 v114 = v3; | |
2723 } | |
2724 else | |
2725 { | |
2726 v118 = window_SpeakInHouse->ptr_1C; | |
2727 v114 = v3; | |
2728 v7 = (int)window_SpeakInHouse->ptr_1C; | |
2729 uPlayerID = uActiveCharacter - 1; | |
2730 v8 = v0->_490EEE(v3, 2, v7, 4); | |
2731 v4 = uPlayerID; | |
2732 v5 = (char *)pMerchantsIdentifyPhrases[v8]; | |
2733 } | |
2734 v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0); | |
2735 v123 = 3; | |
2736 v121 = v6; | |
2737 v119 = v148; | |
2738 v115 = (174 - pFontArrus->CalcTextHeight(v6, &v144, 0, 0)) / 2 + 138; | |
2739 v112 = 0; | |
2740 v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); | |
2741 return; | |
2742 } | |
2743 } | |
2744 } | |
2745 } | |
2746 } | |
2747 break; | |
2748 case 5: | |
2749 { | |
2750 draw_leather(); | |
2751 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
2752 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); | |
2753 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() | |
2754 || (v31 = pMouse->GetCursorPos(&v135)->x - 14, | |
2755 v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), | |
2756 pMouse->GetCursorPos(&v140)->x <= 13) | |
2757 || pMouse->GetCursorPos(&v138)->x >= 462 | |
2758 || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32) | |
2759 || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) | |
2760 return; | |
2761 v124 = 0; | |
2762 v122 = 5; | |
2763 v120 = window_SpeakInHouse->ptr_1C; | |
2764 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; | |
2765 v34 = (int)window_SpeakInHouse->ptr_1C; | |
2766 uPlayerID = uActiveCharacter - 1; | |
2767 v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5); | |
2768 v14 = uPlayerID; | |
2769 v15 = (char *)pMerchantsRepairPhrases[v35]; | |
2770 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); | |
2771 v123 = 3; | |
2772 v121 = v36; | |
2773 v119 = v148; | |
2774 v117 = (int)v11; | |
2775 v113 = (int)v11; | |
2776 v111 = &v144; | |
2777 v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; | |
2778 v112 = (unsigned int)v11; | |
2779 v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); | |
2780 return; | |
2781 } | |
2782 break; | |
2783 case 6: | |
2784 { | |
2785 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
2786 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); | |
2787 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2788 return; | |
2789 v149 = 0; | |
2790 v93 = 0; | |
2791 do | |
2792 { | |
2793 // if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
2794 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID) | |
2795 ++v149; | |
2796 ++v93; | |
2797 } | |
2798 while ( v93 < 8 ); | |
2799 if ( v149 ) | |
2800 { | |
2801 v94 = pMouse->GetCursorPos(&v132); | |
2802 v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; | |
2803 v95 = v149; | |
2804 if ( v149 && v149 != -65536 ) | |
2805 { | |
2806 --v149; | |
2807 v96 = window_SpeakInHouse->ptr_1C; | |
2808 v97 = uActiveCharacter - 1; | |
2809 // v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724]; | |
2810 v99 = _this->_490EEE( | |
2811 &pParty->SpecialItemsInShops[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724], | |
2812 2, | |
2813 (int)window_SpeakInHouse->ptr_1C, | |
2814 2); | |
2815 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], v97, v98, (char *)v96, 2, 0); | |
2816 v101 = v100; | |
2817 v102 = v148; | |
2818 v103 = pFontArrus->CalcTextHeight(v100, &v144, 0, 0); | |
2819 v144.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, v102, v101, 3u); | |
2820 } | |
2821 v104 = 0; | |
2822 v153 = 0; | |
2823 do | |
2824 { | |
2825 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
2826 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID) | |
2827 { | |
2828 v105 = ItemsInShopTexture[v104]; | |
2829 if ( v104 >= 4 ) | |
2830 { | |
2831 v110 = 90 - ((signed int)v105->uTextureWidth >> 1); | |
2832 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); | |
2833 v127 = v104 + 1; | |
2834 v109 = v153 + v110 + 80220; | |
2835 } | |
2836 else | |
2837 { | |
2838 v106 = 98 - v105->uTextureHeight; | |
2839 v107 = ItemsInShopTexture[v104]; | |
2840 v108 = 98 - v105->uTextureHeight; | |
2841 v152 = 86 - ((signed int)v105->uTextureWidth >> 1); | |
2842 pRenderer->DrawTextureTransparent(v152 + v153, v108, v107); | |
2843 v127 = v104 + 1; | |
2844 v109 = v152 + v153 + 640 * v106; | |
2845 } | |
2846 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); | |
2847 } | |
2848 v153 += 105; | |
2849 ++v104; | |
2850 } | |
2851 while ( v104 < 8 ); | |
2852 return; | |
2853 } | |
2854 v72 = window_SpeakInHouse->ptr_1C; | |
2855 v144.DrawCurrentTime(pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); | |
2856 return; | |
2857 } | |
2858 break; | |
2859 case 94: | |
2860 { | |
2861 draw_leather(); | |
2862 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
2863 v79 = pShopOptions; | |
2864 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; | |
2865 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; | |
2866 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; | |
2867 v80 = 0; | |
2868 v81 = pShopOptions; | |
2869 do | |
2870 { | |
2871 v82 = pFontArrus->CalcTextHeight(*v81, &v144, 0, 0); | |
2872 ++v81; | |
2873 v80 += v82; | |
2874 } | |
2875 while ( (signed int)v81 < (signed int)&pShopOptions[3] ); | |
2876 v83 = pDialogueWindow; | |
2877 v152 = (174 - v80) / 3; | |
2878 v84 = pDialogueWindow->pStartingPosActiveItem; | |
2879 v85 = v84 + pDialogueWindow->pNumPresenceButton; | |
2880 v86 = (3 * (58 - v152) - v80) / 2 - v152 / 2 + 138; | |
2881 v24 = -pDialogueWindow->pNumPresenceButton < 0; | |
2882 _this = (Player *)pDialogueWindow->pStartingPosActiveItem; | |
2883 if ( v24 ^ __OFSUB__(v84, v85) ) | |
2884 { | |
2885 v153 = 2; | |
2886 do | |
2887 { | |
2888 v87 = v83->GetControl((unsigned int)_this); | |
2889 v88 = v87; | |
2890 v87->uY = v152 + v86; | |
2891 v89 = pFontArrus->CalcTextHeight(*v79, &v144, 0, 0); | |
2892 v90 = v88->uY; | |
2893 v91 = v153; | |
2894 v88->uHeight = v89; | |
2895 v86 = v90 + v89 - 1; | |
2896 v88->uW = v86; | |
2897 v92 = v147; | |
2898 if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) | |
2899 v92 = v148; | |
2900 v144.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u); | |
2901 v83 = pDialogueWindow; | |
2902 ++v153; | |
2903 ++v79; | |
2904 _this = (Player *)((char *)_this + 1); | |
2905 } | |
2906 while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
2907 } | |
2908 return; | |
2909 } | |
2910 break; | |
2911 case 95: //buy spesial | |
2912 { | |
2913 | |
2914 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
2915 | |
2916 v11 = 0; | |
2917 v61 = 0; | |
2918 v153 = 0; | |
2919 do | |
2920 { | |
2921 // if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) | |
2922 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID) | |
2923 { | |
2924 v62 = ItemsInShopTexture[v61]; | |
2925 if ( v61 >= 4 ) | |
2926 { | |
2927 v67 = 90 - ((signed int)v62->uTextureWidth >> 1); | |
2928 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); | |
2929 v126 = v61 + 1; | |
2930 v66 = v153 + v67 + 80220; | |
2931 } | |
2932 else | |
2933 { | |
2934 v63 = 98 - v62->uTextureHeight; | |
2935 v64 = ItemsInShopTexture[v61]; | |
2936 v65 = 98 - v62->uTextureHeight; | |
2937 v152 = 86 - ((signed int)v62->uTextureWidth >> 1); | |
2938 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); | |
2939 v126 = v61 + 1; | |
2940 v66 = v152 + v153 + 640 * v63; | |
2941 } | |
2942 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v126); | |
2943 v11 = 0; | |
2944 } | |
2945 v153 += 105; | |
2946 ++v61; | |
2947 } | |
2948 while ( v61 < 8 ); | |
2949 | |
2950 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
2951 return; | |
2952 v68 = 0; | |
2953 v149 = (__int32)v11; | |
2954 | |
2955 do | |
2956 { | |
2957 // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) | |
2958 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID) | |
2959 ++v149; | |
2960 ++v68; | |
2961 } | |
2962 while ( v68 < 6 ); | |
2963 | |
2964 v69 = GetAsyncKeyState(17); | |
2965 v70 = _this->CanSteal(); | |
2966 Str = (char *)v70; | |
2967 if ( v69 == (short)v11 || (char *)v70 == v11 ) | |
2968 { | |
2969 v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" | |
2970 } | |
2971 else | |
2972 { | |
2973 v71 = pGlobalTXT_LocalizationStrings[185]; | |
2974 } | |
2975 DrawTextAtStatusBar(v71, 0); | |
2976 if ( (char *)v149 != v11 ) | |
2977 { | |
2978 v73 = pMouse->GetCursorPos(&v136); | |
2979 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; | |
2980 if ( !v74 ) | |
2981 return; | |
2982 v149 = v74 - 1; | |
2983 v75 = (int)window_SpeakInHouse->ptr_1C; | |
2984 v76 = 9 * (v74 - 1 + 12 * v75); | |
2985 if ( dword_F8B19C == 2 ) | |
2986 v77 = (ItemGen *)&pParty->StandartItemsInShops[(int)75][v74-1]; | |
2987 else | |
2988 v77 = &pParty->SpecialItemsInShops[(int)v75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; | |
2989 if ( v69 == (short)v11 || Str == v11 ) | |
2990 { | |
2991 v124 = (__int64 *)v11; | |
2992 v122 = 2; | |
2993 v120 = window_SpeakInHouse->ptr_1C; | |
2994 v116 = v77; | |
2995 v78 = uActiveCharacter - 1; | |
2996 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(v77, 2, v75, 2)]; | |
2997 v14 = v78; | |
2998 } | |
2999 else | |
3000 { | |
3001 v124 = (__int64 *)v11; | |
3002 v122 = 2; | |
3003 v120 = window_SpeakInHouse->ptr_1C; | |
3004 v116 = v77; | |
3005 v15 = pGlobalTXT_LocalizationStrings[181]; | |
3006 v14 = uActiveCharacter - 1; | |
3007 } | |
3008 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); | |
3009 v123 = 3; | |
3010 v121 = v36; | |
3011 v119 = v148; | |
3012 v117 = (int)v11; | |
3013 v113 = (int)v11; | |
3014 v111 = &v144; | |
3015 v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; | |
3016 v112 = (unsigned int)v11; | |
3017 v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); | |
3018 return; | |
3019 } | |
3020 v72 = window_SpeakInHouse->ptr_1C; | |
3021 v144.DrawCurrentTime( pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); | |
3022 return; | |
3023 } | |
3024 | |
3025 break; | |
3026 case 96: | |
3027 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
3028 return; | |
3029 v152 = 0; | |
3030 v37 = pDialogueWindow; | |
3031 //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); | |
3032 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
3033 _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100); | |
3034 if ( (signed int)_this < v38 / 3 ) | |
3035 _this = (Player *)(v38 / 3); | |
3036 v39 = v37->pStartingPosActiveItem; | |
3037 v40 = v37->pNumPresenceButton; | |
3038 v153 = 0; | |
3039 if ( (signed int)v39 < (signed int)(v39 + v40) ) | |
3040 { | |
3041 do | |
3042 { | |
3043 v41 = v37->GetControl(v39)->uControlParam - 36; | |
3044 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) | |
3045 { | |
3046 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &v144, 0, 0); | |
3047 v152 += v42; | |
3048 ++v153; | |
3049 } | |
3050 ++v39; | |
3051 } | |
3052 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); | |
3053 if ( v153 ) | |
3054 { | |
3055 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); | |
3056 v144.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
3057 _this = (Player *)((149 - v152) / v153); | |
3058 if ( (149 - v152) / v153 > 32 ) | |
3059 _this = (Player *)32; | |
3060 v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162; | |
3061 v152 = v37->pStartingPosActiveItem; | |
3062 v146 = v43; | |
3063 if ( v152 < v152 + v37->pNumPresenceButton ) | |
3064 { | |
3065 v153 = 2; | |
3066 do | |
3067 { | |
3068 v44 = v37->GetControl(v152); | |
3069 v45 = v44; | |
3070 v46 = v44->uControlParam - 36; | |
3071 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] ) | |
3072 { | |
3073 v45->uW = 0; | |
3074 v45->uHeight = 0; | |
3075 v45->uY = 0; | |
3076 } | |
3077 else | |
3078 { | |
3079 v47 = pSkillNames[v46]; | |
3080 v45->uY = (unsigned int)((char *)_this + v146); | |
3081 Str = v47; | |
3082 v48 = pFontArrus->CalcTextHeight(v47, &v144, 0, 0); | |
3083 v49 = v45->uY; | |
3084 v50 = v153; | |
3085 v45->uHeight = v48; | |
3086 v51 = v49 + v48 - 1; | |
3087 v45->uW = v51; | |
3088 v146 = v51; | |
3089 v52 = v147; | |
3090 if ( pDialogueWindow->pCurrentPosActiveItem != v50 ) | |
3091 v52 = v148; | |
3092 v144.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u); | |
3093 } | |
3094 v53 = v37->pStartingPosActiveItem; | |
3095 ++v152; | |
3096 v54 = v37->pNumPresenceButton + v53; | |
3097 ++v153; | |
3098 } | |
3099 while ( v152 < v54 ); | |
3100 } | |
3101 return; | |
3102 } | |
3103 } | |
3104 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); | |
3105 strcat(pTmpBuf, "\n \n"); | |
3106 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
3107 v11 = 0; | |
3108 v36 = pTmpBuf; | |
3109 v123 = 3; | |
3110 v121 = pTmpBuf; | |
3111 v119 = v147; | |
3112 v117 = 0; | |
3113 v113 = 0; | |
3114 v111 = &v144; | |
3115 v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; | |
3116 v112 = (unsigned int)v11; | |
3117 v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); | |
3118 return; | |
3119 break; | |
3120 | |
3121 } | |
3122 | |
3123 } | |
3124 | 61 |
3125 //----- (004BB756) -------------------------------------------------------- | 62 //----- (004BB756) -------------------------------------------------------- |
3126 signed int __fastcall sub_4BB756(signed int a1) | 63 signed int __fastcall sub_4BB756(signed int a1) |
3127 { | 64 { |
3128 unsigned int v1; // esi@8 | 65 unsigned int v1; // esi@8 |
3362 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" | 299 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" |
3363 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); | 300 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); |
3364 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); | 301 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); |
3365 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); | 302 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); |
3366 pDialogueWindow->_41D08F(1, 1, 0, 2); | 303 pDialogueWindow->_41D08F(1, 1, 0, 2); |
3367 dword_F8B19C = -1; | 304 dialog_menu_id = -1; |
3368 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); | 305 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); |
3369 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 ) |
3370 { | 307 { |
3371 pParty->field_75A[v0] = 0; | 308 pParty->field_75A[v0] = 0; |
309 __debugbreak(); // starting year-related constant here; | |
3372 v1 = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) | 310 v1 = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) |
3373 * 0.033333335); | 311 * 0.033333335); |
3374 pParty->field_3C.field_0[2 * v0] = v1; | 312 pParty->field_3C.field_0[2 * v0] = v1; |
3375 pParty->field_3C.field_0[2 * v0 + 1] = HIDWORD(v1); | 313 pParty->field_3C.field_0[2 * v0 + 1] = HIDWORD(v1); |
3376 for ( i = rand(); ; i = rand() ) | 314 for ( i = rand(); ; i = rand() ) |
3950 //v55 = a1; | 888 //v55 = a1; |
3951 if ( !pDialogueWindow->pNumPresenceButton ) | 889 if ( !pDialogueWindow->pNumPresenceButton ) |
3952 return; | 890 return; |
3953 pRenderer->ClearZBuffer(0, 479); | 891 pRenderer->ClearZBuffer(0, 479); |
3954 //v3 = dword_F8B198; | 892 //v3 = dword_F8B198; |
3955 if ( dword_F8B19C != 1 ) | 893 if ( dialog_menu_id != 1 ) |
3956 { | 894 { |
3957 v8 = window_SpeakInHouse; | 895 v8 = window_SpeakInHouse; |
3958 } | 896 } |
3959 else | 897 else |
3960 { | 898 { |
4008 return; | 946 return; |
4009 v8 = window_SpeakInHouse; | 947 v8 = window_SpeakInHouse; |
4010 } | 948 } |
4011 } | 949 } |
4012 //LABEL_11: | 950 //LABEL_11: |
4013 dword_F8B19C = uMessageParam; | 951 dialog_menu_id = uMessageParam; |
4014 if ( in_current_building_type < BildingType_19 ) | 952 if ( in_current_building_type < BildingType_19 ) |
4015 { | 953 { |
4016 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); | 954 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); |
4017 //v3 = dword_F8B198; | 955 //v3 = dword_F8B198; |
4018 ShopTexture = &pIcons_LOD->pTextures[v9]; | 956 ShopTexture = &pIcons_LOD->pTextures[v9]; |
4022 } | 960 } |
4023 if ( in_current_building_type > BildingType_Tavern ) | 961 if ( in_current_building_type > BildingType_Tavern ) |
4024 { | 962 { |
4025 if ( in_current_building_type == BildingType_Bank ) | 963 if ( in_current_building_type == BildingType_Bank ) |
4026 { | 964 { |
4027 if ( dword_F8B19C >= 7 && dword_F8B19C <= 8 ) | 965 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) |
4028 pKeyActionMap->EnterText(1, 10, v8); | 966 pKeyActionMap->EnterText(1, 10, v8); |
4029 return; | 967 return; |
4030 } | 968 } |
4031 if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training ) | 969 if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training ) |
4032 return; | 970 return; |
4294 pDialogueWindow->eWindowType = WINDOW_MainMenu; | 1232 pDialogueWindow->eWindowType = WINDOW_MainMenu; |
4295 UI_CreateEndConversationButton(); | 1233 UI_CreateEndConversationButton(); |
4296 sub_4B3A72(in_current_building_type); | 1234 sub_4B3A72(in_current_building_type); |
4297 break; | 1235 break; |
4298 case 102: | 1236 case 102: |
4299 dword_F8B19C = 102; | 1237 dialog_menu_id = 102; |
4300 break; | 1238 break; |
4301 case 103: | 1239 case 103: |
4302 dword_F8B19C = 103; | 1240 dialog_menu_id = 103; |
4303 break; | 1241 break; |
4304 case 104: | 1242 case 104: |
4305 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | 1243 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
4306 { | 1244 { |
4307 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; | 1245 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; |
4308 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; | 1246 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; |
4309 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; | 1247 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; |
4310 ++pMessageQueue_50CBD0->uNumMessages; | 1248 ++pMessageQueue_50CBD0->uNumMessages; |
4311 }*/ | 1249 }*/ |
4312 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, v1, v1); | 1250 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, v1, v1); |
4313 dword_F8B19C = 104; | 1251 dialog_menu_id = 104; |
4314 break; | 1252 break; |
4315 } | 1253 } |
4316 return; | 1254 return; |
4317 } | 1255 } |
4318 if ( uMessageParam != 95 && uMessageParam != 2 ) | 1256 if ( uMessageParam != 95 && uMessageParam != 2 ) |
4319 { | 1257 { |
4320 if ( uMessageParam == 3 ) | 1258 if ( uMessageParam == 3 ) |
4321 { | 1259 { |
4322 dword_F8B19C = 3; | 1260 dialog_menu_id = 3; |
4323 } | 1261 } |
4324 else | 1262 else |
4325 { | 1263 { |
4326 if ( uMessageParam == 4 ) | 1264 if ( uMessageParam == 4 ) |
4327 { | 1265 { |
4328 dword_F8B19C = 4; | 1266 dialog_menu_id = 4; |
4329 } | 1267 } |
4330 else | 1268 else |
4331 { | 1269 { |
4332 if ( uMessageParam != 5 ) | 1270 if ( uMessageParam != 5 ) |
4333 { | 1271 { |
4384 } | 1322 } |
4385 } | 1323 } |
4386 } | 1324 } |
4387 return; | 1325 return; |
4388 } | 1326 } |
4389 dword_F8B19C = 5; | 1327 dialog_menu_id = 5; |
4390 } | 1328 } |
4391 } | 1329 } |
4392 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | 1330 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
4393 return; | 1331 return; |
4394 } | 1332 } |
4515 pKeyActionMap->ResetKeys(); | 1453 pKeyActionMap->ResetKeys(); |
4516 activeLevelDecoration = NULL; | 1454 activeLevelDecoration = NULL; |
4517 ptr_F8B1E8 = 0; | 1455 ptr_F8B1E8 = 0; |
4518 if ( pDialogueNPCCount ) | 1456 if ( pDialogueNPCCount ) |
4519 { | 1457 { |
4520 v0 = dword_F8B19C; | 1458 v0 = dialog_menu_id; |
4521 if ( dword_F8B19C != 2 | 1459 if ( dialog_menu_id != 2 |
4522 && dword_F8B19C != 3 | 1460 && dialog_menu_id != 3 |
4523 && dword_F8B19C != 97 | 1461 && dialog_menu_id != 97 |
4524 && dword_F8B19C != 5 | 1462 && dialog_menu_id != 5 |
4525 && dword_F8B19C != 4 | 1463 && dialog_menu_id != 4 |
4526 && ShopTexture ) | 1464 && ShopTexture ) |
4527 { | 1465 { |
4528 ShopTexture->Release(); | 1466 ShopTexture->Release(); |
4529 v0 = dword_F8B19C; | 1467 v0 = dialog_menu_id; |
4530 ShopTexture = 0; | 1468 ShopTexture = 0; |
4531 } | 1469 } |
4532 if ( v0 && v0 != 1 ) | 1470 if ( v0 && v0 != 1 ) |
4533 { | 1471 { |
4534 if ( v0 == -1 ) | 1472 if ( v0 == -1 ) |
4541 if ( v0 != 94 && v0 != 96 && v0 != 101 ) | 1479 if ( v0 != 94 && v0 != 96 && v0 != 101 ) |
4542 { | 1480 { |
4543 if ( v0 == 3 || v0 == 5 || v0 == 4 ) | 1481 if ( v0 == 3 || v0 == 5 || v0 == 4 ) |
4544 { | 1482 { |
4545 UI_CreateEndConversationButton(); | 1483 UI_CreateEndConversationButton(); |
4546 dword_F8B19C = 94; | 1484 dialog_menu_id = 94; |
4547 sub_4B3AD4(in_current_building_type); | 1485 sub_4B3AD4(in_current_building_type); |
4548 } | 1486 } |
4549 else | 1487 else |
4550 { | 1488 { |
4551 if ( v0 != 102 && v0 != 103 && v0 != 104 ) | 1489 if ( v0 != 102 && v0 != 103 && v0 != 104 ) |
4552 { | 1490 { |
4553 pVideoPlayer->_4BF5B2(); | 1491 pVideoPlayer->_4BF5B2(); |
4554 //LABEL_28: | 1492 //LABEL_28: |
4555 dword_F8B19C = 1; | 1493 dialog_menu_id = 1; |
4556 sub_4B3B42(in_current_building_type); | 1494 sub_4B3B42(in_current_building_type); |
4557 return 1; | 1495 return 1; |
4558 } | 1496 } |
4559 pVideoPlayer->_4BF5B2(); | 1497 pVideoPlayer->_4BF5B2(); |
4560 UI_CreateEndConversationButton(); | 1498 UI_CreateEndConversationButton(); |
4561 dword_F8B19C = 101; | 1499 dialog_menu_id = 101; |
4562 sub_4B3A72(in_current_building_type); | 1500 sub_4B3A72(in_current_building_type); |
4563 } | 1501 } |
4564 return 1; | 1502 return 1; |
4565 } | 1503 } |
4566 pVideoPlayer->_4BF5B2(); | 1504 pVideoPlayer->_4BF5B2(); |
4567 UI_CreateEndConversationButton(); | 1505 UI_CreateEndConversationButton(); |
4568 dword_F8B19C = 1; | 1506 dialog_menu_id = 1; |
4569 sub_4B3B42(in_current_building_type); | 1507 sub_4B3B42(in_current_building_type); |
4570 return 1; | 1508 return 1; |
4571 } | 1509 } |
4572 pDialogueNPCCount = 0; | 1510 pDialogueNPCCount = 0; |
4573 pDialogueWindow->Release(); | 1511 pDialogueWindow->Release(); |
4574 dword_F8B19C = 0; | 1512 dialog_menu_id = 0; |
4575 pDialogueWindow = 0; | 1513 pDialogueWindow = 0; |
4576 pIcons_LOD->_40F9C5(); | 1514 pIcons_LOD->_40F9C5(); |
4577 v1 = uNumDialogueNPCPortraits; | 1515 v1 = uNumDialogueNPCPortraits; |
4578 if ( uNumDialogueNPCPortraits != 1 ) | 1516 if ( uNumDialogueNPCPortraits != 1 ) |
4579 { | 1517 { |
4706 v47 = 0; | 1644 v47 = 0; |
4707 v46 = 0; | 1645 v46 = 0; |
4708 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); | 1646 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); |
4709 return; | 1647 return; |
4710 } | 1648 } |
4711 if ( dword_F8B19C > 18 ) | 1649 if ( dialog_menu_id > 18 ) |
4712 { | 1650 { |
4713 if ( dword_F8B19C < 36 ) | 1651 if ( dialog_menu_id < 36 ) |
4714 return; | 1652 return; |
4715 if ( dword_F8B19C <= 72 ) | 1653 if ( dialog_menu_id <= 72 ) |
4716 { | 1654 { |
4717 v42 = dword_F8B19C - 36; | 1655 v42 = dialog_menu_id - 36; |
4718 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); | 1656 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); |
4719 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 1657 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
4720 v44 = v43 * (100 - v0->GetMerchant()) / 100; | 1658 v44 = v43 * (100 - v0->GetMerchant()) / 100; |
4721 if ( v44 < v43 / 3 ) | 1659 if ( v44 < v43 / 3 ) |
4722 v44 = v43 / 3; | 1660 v44 = v43 / 3; |
4746 return; | 1684 return; |
4747 } | 1685 } |
4748 } | 1686 } |
4749 return; | 1687 return; |
4750 } | 1688 } |
4751 if ( dword_F8B19C != 94 ) | 1689 if ( dialog_menu_id != 94 ) |
4752 { | 1690 { |
4753 if ( dword_F8B19C != 95 ) | 1691 if ( dialog_menu_id != 95 ) |
4754 return; | 1692 return; |
4755 goto LABEL_49; | 1693 goto LABEL_49; |
4756 } | 1694 } |
4757 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | 1695 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
4758 //LABEL_73: | 1696 //LABEL_73: |
4759 sub_421EA6_OnInventoryLeftClick(); | 1697 sub_421EA6_OnInventoryLeftClick(); |
4760 return; | 1698 return; |
4761 } | 1699 } |
4762 if ( dword_F8B19C == 18 ) | 1700 if ( dialog_menu_id == 18 ) |
4763 { | 1701 { |
4764 v17 = pMouse->GetCursorPos(&v63); | 1702 v17 = pMouse->GetCursorPos(&v63); |
4765 v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF; | 1703 v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF; |
4766 if ( !v18 ) | 1704 if ( !v18 ) |
4767 return; | 1705 return; |
4806 //LABEL_70: | 1744 //LABEL_70: |
4807 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" | 1745 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" |
4808 ShowStatusBarString(v9, v54); | 1746 ShowStatusBarString(v9, v54); |
4809 return; | 1747 return; |
4810 } | 1748 } |
4811 if ( dword_F8B19C == 2 ) | 1749 if ( dialog_menu_id == 2 ) |
4812 { | 1750 { |
4813 LABEL_49: | 1751 LABEL_49: |
4814 v28 = pMouse->GetCursorPos(&v59); | 1752 v28 = pMouse->GetCursorPos(&v59); |
4815 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF; | 1753 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF; |
4816 if ( !v29 ) | 1754 if ( !v29 ) |
4817 return; | 1755 return; |
4818 v30 = window_SpeakInHouse->ptr_1C; | 1756 v30 = window_SpeakInHouse->ptr_1C; |
4819 // v31 = 9 * (v29 - 1 + 12 * (int)v30); | 1757 // v31 = 9 * (v29 - 1 + 12 * (int)v30); |
4820 if ( dword_F8B19C == 2 ) | 1758 if ( dialog_menu_id == 2 ) |
4821 { | 1759 { |
4822 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; | 1760 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; |
4823 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; | 1761 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; |
4824 } | 1762 } |
4825 else | 1763 else |
4914 v54 = 2; | 1852 v54 = 2; |
4915 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" | 1853 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" |
4916 ShowStatusBarString(v9, v54); | 1854 ShowStatusBarString(v9, v54); |
4917 return; | 1855 return; |
4918 } | 1856 } |
4919 if ( dword_F8B19C == 3 ) | 1857 if ( dialog_menu_id == 3 ) |
4920 { | 1858 { |
4921 v14 = pMouse->GetCursorPos(&v71)->x - 14; | 1859 v14 = pMouse->GetCursorPos(&v71)->x - 14; |
4922 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5); | 1860 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5); |
4923 if ( pMouse->GetCursorPos(&v67)->x <= 13 | 1861 if ( pMouse->GetCursorPos(&v67)->x <= 13 |
4924 || pMouse->GetCursorPos(&v65)->x >= 462 | 1862 || pMouse->GetCursorPos(&v65)->x >= 462 |
4947 v46 = 0; | 1885 v46 = 0; |
4948 //LABEL_87: | 1886 //LABEL_87: |
4949 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); | 1887 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); |
4950 return; | 1888 return; |
4951 } | 1889 } |
4952 if ( dword_F8B19C == 4 ) | 1890 if ( dialog_menu_id == 4 ) |
4953 { | 1891 { |
4954 v10 = pMouse->GetCursorPos(&v62)->x - 14; | 1892 v10 = pMouse->GetCursorPos(&v62)->x - 14; |
4955 v79 = (v10 >> 5) + 14 * ((pMouse->GetCursorPos(&v66)->y - 17) >> 5); | 1893 v79 = (v10 >> 5) + 14 * ((pMouse->GetCursorPos(&v66)->y - 17) >> 5); |
4956 if ( pMouse->GetCursorPos(&v58)->x > 13 ) | 1894 if ( pMouse->GetCursorPos(&v58)->x > 13 ) |
4957 { | 1895 { |
5001 } | 1939 } |
5002 } | 1940 } |
5003 } | 1941 } |
5004 else | 1942 else |
5005 { | 1943 { |
5006 if ( dword_F8B19C == 5 ) | 1944 if ( dialog_menu_id == 5 ) |
5007 { | 1945 { |
5008 v1 = pMouse->GetCursorPos(&a2)->x - 14; | 1946 v1 = pMouse->GetCursorPos(&a2)->x - 14; |
5009 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5); | 1947 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5); |
5010 if ( pMouse->GetCursorPos(&v60)->x > 13 ) | 1948 if ( pMouse->GetCursorPos(&v60)->x > 13 ) |
5011 { | 1949 { |
13447 assert(sizeof(BLVLightMM7) == 0x10); | 10385 assert(sizeof(BLVLightMM7) == 0x10); |
13448 assert(sizeof(BLVDoor) == 0x50); | 10386 assert(sizeof(BLVDoor) == 0x50); |
13449 assert(sizeof(IndoorLocation) == 0x690); | 10387 assert(sizeof(IndoorLocation) == 0x690); |
13450 assert(sizeof(OutdoorCamera) == 0x74); | 10388 assert(sizeof(OutdoorCamera) == 0x74); |
13451 assert(sizeof(Mouse) == 0x114); | 10389 assert(sizeof(Mouse) == 0x114); |
13452 assert(sizeof(Particle_) == 0x68); | 10390 assert(sizeof(Particle_sw) == 0x68); |
13453 assert(sizeof(Particle) == 0x68); | 10391 assert(sizeof(Particle) == 0x68); |
13454 assert(sizeof(ParticleEngine) == 0xE430); | 10392 assert(sizeof(ParticleEngine) == 0xE430); |
13455 assert(sizeof(Lightmap) == 0xC1C); | 10393 assert(sizeof(Lightmap) == 0xC1C); |
13456 assert(sizeof(LightmapBuilder) == 0x3CBC38); | 10394 assert(sizeof(LightmapBuilder) == 0x3CBC38); |
13457 assert(sizeof(Vis_SelectionList) == 0x2008); | 10395 assert(sizeof(Vis_SelectionList) == 0x2008); |
15995 { | 12933 { |
15996 LOBYTE(dword_6BE364_game_settings_1) = dword_6BE364_game_settings_1 & 0x7F; | 12934 LOBYTE(dword_6BE364_game_settings_1) = dword_6BE364_game_settings_1 & 0x7F; |
15997 } | 12935 } |
15998 else | 12936 else |
15999 { | 12937 { |
16000 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | 12938 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
16001 { | |
16002 BLV_UpdateUserInputAndOther(); | 12939 BLV_UpdateUserInputAndOther(); |
16003 } | 12940 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
16004 else | |
16005 { | |
16006 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
16007 ODM_UpdateUserInputAndOther(); | 12941 ODM_UpdateUserInputAndOther(); |
16008 } | 12942 |
16009 _438F8F_area_of_effect__damage_evaluate(); | 12943 _438F8F_area_of_effect__damage_evaluate(); |
16010 } | 12944 } |
16011 } | 12945 } |
16012 | 12946 |
16013 | 12947 |