comparison UI/UIPopup.cpp @ 1298:b97d0cdd6c79

new folder UI
author Ritor1
date Wed, 19 Jun 2013 17:18:35 +0600
parents
children 8c2f689b5f0b
comparison
equal deleted inserted replaced
1297:5450af4f57ef 1298:b97d0cdd6c79
1 #ifdef _MSC_VER
2 #define _CRT_SECURE_NO_WARNINGS
3 #endif
4
5 #include <assert.h>
6
7 #include "MM7.h"
8
9 #include "Mouse.h"
10
11 #include "Sprites.h"
12 #include "Vis.h"
13 #include "Game.h"
14 #include "GUIWindow.h"
15 #include "GUIFont.h"
16 #include "Party.h"
17 #include "AudioPlayer.h"
18 #include "LOD.h"
19 #include "Actor.h"
20 #include "Viewport.h"
21 #include "SpriteObject.h"
22 #include "ObjectList.h"
23 #include "Chest.h"
24 #include "PaletteManager.h"
25 #include "Time.h"
26 #include "texts.h"
27
28 #include "mm7_data.h"
29
30 static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually
31
32 //----- (004151D9) --------------------------------------------------------
33 void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight)
34 {
35 unsigned int v4; // ebx@1
36 Texture *v5; // edi@1
37 signed int uTileWidth; // ecx@1
38 int v7; // eax@5
39 int v8; // ecx@10
40 unsigned int v9; // ebx@14
41 int v10; // [sp+10h] [bp-28h]@5
42 signed int uTileHeight; // [sp+18h] [bp-20h]@1
43 int v12; // [sp+1Ch] [bp-1Ch]@7
44 int v13; // [sp+20h] [bp-18h]@1
45 int a5; // [sp+24h] [bp-14h]@5
46 unsigned int a5a; // [sp+24h] [bp-14h]@11
47 unsigned int a4; // [sp+28h] [bp-10h]@1
48 int uNumXTiles; // [sp+2Ch] [bp-Ch]@3
49 unsigned int uNumXTilesa; // [sp+2Ch] [bp-Ch]@6
50 unsigned int uNumXTilesb; // [sp+2Ch] [bp-Ch]@11
51 unsigned int a2a; // [sp+30h] [bp-8h]@1
52 unsigned int v21; // [sp+34h] [bp-4h]@5
53 unsigned int v22; // [sp+34h] [bp-4h]@11
54
55 v4 = uY;
56 a2a = uX;
57 a4 = uX + uWidth;
58 pRenderer->SetTextureClipRect(uX, v4, uX + uWidth, v4 + uHeight);
59 v5 = pIcons_LOD->GetTexture(uTextureID_Parchment);
60 uTileWidth = v5->uTextureWidth;
61 v13 = v5->uTextureWidth;
62 uTileHeight = v5->uTextureHeight;
63 if ( v5->uTextureWidth && v5->uTextureHeight)
64 {
65 uNumXTiles = (signed int)uWidth / uTileWidth;
66 if ( (signed int)uWidth % uTileWidth )
67 ++uNumXTiles;
68 a5 = 0;
69 v21 = v4;
70 v7 = uNumXTiles + 1;
71 v10 = uNumXTiles + 1;
72 do
73 {
74 uNumXTilesa = a2a - v13;
75 if ( v7 > 0 )
76 {
77 v12 = v7;
78 do
79 {
80 uNumXTilesa += v13;
81 pRenderer->DrawTextureIndexed(uNumXTilesa, v21, v5);
82 --v12;
83 }
84 while ( v12 );
85 v7 = v10;
86 }
87 v21 += uTileHeight;
88 v8 = a5++;
89 }
90 while ( v8 < (signed int)uHeight / uTileHeight );
91 a5a = v4 + uHeight - 32;
92 pRenderer->DrawTextureTransparent(a2a, v4, pIcons_LOD->GetTexture(uTextureID_5076AC));
93 pRenderer->DrawTextureTransparent(a2a, a5a, pIcons_LOD->GetTexture(uTextureID_5076B4));
94 pRenderer->DrawTextureTransparent(a4 - 32, v4, pIcons_LOD->GetTexture(uTextureID_5076A8));
95 pRenderer->DrawTextureTransparent(a4 - 32, a5a, pIcons_LOD->GetTexture(uTextureID_5076B0));
96 uNumXTilesb = a2a + 32;
97 v22 = v4 + uHeight - 10;
98 if ( (signed int)uWidth > 64 )
99 {
100 pRenderer->SetTextureClipRect(a2a + 32, v4, a4 - 32, v4 + uHeight);
101 pRenderer->DrawTextureTransparent(uNumXTilesb, v4, pIcons_LOD->GetTexture(uTextureID_507698));
102 pRenderer->DrawTextureTransparent(uNumXTilesb, v22, pIcons_LOD->GetTexture(uTextureID_5076A4));
103 if ( (signed int)uWidth > 512 )
104 {
105 pRenderer->DrawTextureTransparent(a2a + 544, v4, pIcons_LOD->GetTexture(uTextureID_507698));
106 pRenderer->DrawTextureTransparent(a2a + 544, v22, pIcons_LOD->GetTexture(uTextureID_5076A4));
107 }
108 }
109 v9 = v4 + 32;
110 if ( (signed int)uHeight > 64 )
111 {
112 pRenderer->SetTextureClipRect(a2a, v9, a4, a5a);
113 pRenderer->DrawTextureTransparent(a2a, v9, pIcons_LOD->GetTexture(uTextureID_5076A0));
114 pRenderer->DrawTextureTransparent(a4 - 10, v9, pIcons_LOD->GetTexture(uTextureID_50769C));
115 }
116 pRenderer->ResetTextureClipRect();
117 }
118 }
119
120
121
122 //----- (0041D895) --------------------------------------------------------
123 void GameUI_DrawItemInfo( struct ItemGen* inspect_item )
124 {
125 ItemGen *v1; // esi@1
126 unsigned int v2; // eax@3
127 //char *v3; // edi@5
128 //unsigned int v4; // eax@5
129 //unsigned int v5; // esi@5
130 signed int v6; // eax@5
131 int v7; // edx@5
132 //unsigned int v9; // eax@12
133 char v10; // zf@16
134 ItemGen *v11; // eax@16
135 ItemGen *v12; // eax@25
136 //unsigned int v13; // ecx@32
137 //unsigned int v14; // eax@32
138 //Render *v15; // edi@33
139 const char *v16; // eax@34
140 int v17; // eax@36
141 int v18; // esi@37
142 unsigned __int16 v19; // ax@37
143 //char v20; // al@40
144 char v21; // al@44
145 //char v22; // al@48
146 //char v23; // al@51
147 int v24; // eax@52
148 int v25; // eax@57
149 int v26; // eax@60
150 int v27; // eax@67
151 const char *v28; // edi@69
152 int v29; // eax@70
153 char v30; // edi@78
154 const char *v31; // eax@78
155 int v32; // ecx@81
156 unsigned int v33; // eax@81
157 int v34; // esi@81
158 const char *v35; // eax@85
159 const char *v36; // eax@87
160 unsigned int v37; // eax@109
161 unsigned int v38; // eax@109
162 int v39; // eax@113
163 GUIFont *v40; // edx@113
164 signed int v41; // [sp-20h] [bp-298h]@113
165 int v42; // [sp-1Ch] [bp-294h]@113
166 //char *v43; // [sp-18h] [bp-290h]@46
167 unsigned int v44; // [sp-18h] [bp-290h]@113
168 //int v45; // [sp-14h] [bp-28Ch]@46
169 const char *v46; // [sp-14h] [bp-28Ch]@58
170 char *v47; // [sp-14h] [bp-28Ch]@110
171 //char *v48; // [sp-10h] [bp-288h]@46
172 const char *v49; // [sp-10h] [bp-288h]@56
173 char *v50; // [sp-10h] [bp-288h]@58
174 int v51; // [sp-10h] [bp-288h]@110
175 const char *v52; // [sp-Ch] [bp-284h]@36
176 //int v53; // [sp-Ch] [bp-284h]@46
177 char *v54; // [sp-Ch] [bp-284h]@56
178 int v55; // [sp-Ch] [bp-284h]@58
179 int v56; // [sp-Ch] [bp-284h]@110
180 unsigned int v57; // [sp-8h] [bp-280h]@36
181 //int v58; // [sp-8h] [bp-280h]@46
182 int v59; // [sp-8h] [bp-280h]@56
183 int v60; // [sp-8h] [bp-280h]@58
184 unsigned int v61; // [sp-8h] [bp-280h]@110
185 char out_text[300]; // [sp+8h] [bp-270h]@40
186 //char Dest[100]; // [sp+6Ch] [bp-20Ch]@40
187 //char v64[100]; // [sp+D0h] [bp-1A8h]@40
188 char v65[120]; // [sp+134h] [bp-144h]@92
189 char Source[40]; // [sp+1ACh] [bp-CCh]@49
190 stru351_summoned_item v67;
191 //int v67; // [sp+1D4h] [bp-A4h]@91
192 //int v68; // [sp+1D8h] [bp-A0h]@106
193 //int v69; // [sp+1DCh] [bp-9Ch]@101
194 //int v70; // [sp+1E0h] [bp-98h]@97
195 //int v71; // [sp+1E8h] [bp-90h]@93
196 //int v72; // [sp+1ECh] [bp-8Ch]@91
197 int var88; // [sp+1F0h] [bp-88h]@1
198 Texture *v73; // [sp+1F4h] [bp-84h]@5
199 //unsigned int v75; // [sp+1F8h] [bp-80h]@5
200 //char *v76; // [sp+1FCh] [bp-7Ch]@5
201 int v77; // [sp+200h] [bp-78h]@12
202 int v78; // [sp+204h] [bp-74h]@5
203 GUIWindow wHintWindow; // [sp+208h] [bp-70h]@2
204 POINT a2; // [sp+25Ch] [bp-1Ch]@2
205 int v81; // [sp+264h] [bp-14h]@5
206 // GUIFont *pFontComic; // [sp+268h] [bp-10h]@1
207 PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18
208 char* v84;
209 int v85;
210 char *Str; // [sp+270h] [bp-8h]@65
211
212 v1 = inspect_item;
213 var88 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
214 if (!inspect_item->uItemID)
215 return;
216
217 wHintWindow.Hint = 0;
218 wHintWindow.uFrameWidth = 384;
219 wHintWindow.uFrameHeight = 180;
220 wHintWindow.uFrameY = 40;
221 if ( pMouse->GetCursorPos(&a2)->x <= 320 )
222 v2 = pMouse->GetCursorPos(&a2)->x + 30;
223 else
224 v2 = pMouse->GetCursorPos(&a2)->x - wHintWindow.uFrameWidth - 30;
225 wHintWindow.uFrameX = v2;
226 auto item_desc = &pItemsTable->pItems[inspect_item->uItemID];
227 //v3 = (char *)&pItemsTable->pItems[_this->uItemID].pIconName;
228 //v76 = v3;
229 //v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[_this->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
230 //v5 = v4;
231 //v4 *= 72;
232 //v75 = v4;
233 //v73 = &pIcons_LOD->pTextures[v4];
234 v73 = pIcons_LOD->LoadTexturePtr(item_desc->pIconName, TEXTURE_16BIT_PALETTE);
235 v6 = 100 - v73->uTextureWidth;
236 v7 = v73->uTextureHeight;
237 v78 = v6;
238 v81 = 144 - v7;
239 if ( v6 > 0 )
240 v78 = v6 >> 1;
241 if ( v81 <= 0 )
242 v81 = 0;
243 else
244 v81 >>= 1;
245 if ( !item_desc->uItemID_Rep_St )
246 inspect_item->SetIdentified();
247 //v9 = v8->uAttributes;
248 v77 = 0;
249 //a2.y = v8->uAttributes & 2;
250 if (pItemsTable->pItems[inspect_item->uItemID].uEquipType == EQUIP_GOLD)
251 v77 = inspect_item->uSpecEnchantmentType;
252 if ( uActiveCharacter )
253 {
254 //try to identify
255 if (!inspect_item->Identified())
256 {
257
258 v11 = inspect_item;
259 if ( pPlayers[uActiveCharacter]->CanIdentify(inspect_item) == 1 )
260 inspect_item->SetIdentified();
261 v83 = SPEECH_9;
262 if ( !inspect_item->Identified() )
263 {
264 ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2u);//"Identify Failed"
265 }
266 else
267 {
268 v83 = SPEECH_8;
269 if ( inspect_item->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) )
270 v83 = SPEECH_7;
271 }
272 if ( dword_4E455C )
273 {
274 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0);
275 dword_4E455C = 0;
276 }
277 }
278 inspect_item->UpdateTempBonus(pParty->uTimePlayed);
279 if (inspect_item->Broken())
280 {
281 if ( pPlayers[uActiveCharacter]->CanRepair(inspect_item) == 1 )
282 inspect_item->uAttributes = inspect_item->uAttributes & 0xFFFFFFFD | 1;
283 v83 = SPEECH_11;
284 if ( !inspect_item->Broken() )
285 v83 = SPEECH_10;
286 else
287 ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2u);//"Repair Failed"
288 if ( dword_4E455C )
289 {
290 pPlayers[uActiveCharacter]->PlaySound(v83, 0);
291 dword_4E455C = 0;
292 }
293 }
294 }
295 //v13 = _this->uAttributes;
296 //v14 = _this->Identified();
297 //a2.y = inspect_item->Identified();
298 if (inspect_item->Broken())
299 {
300 wHintWindow.DrawMessageBox(0);
301 //v15 = &;
302 pRenderer->SetTextureClipRect(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12,
303 wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12,
304 wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12);
305 wHintWindow.uFrameWidth -= 24;
306 wHintWindow.uFrameHeight -= 12;
307 wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
308 wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
309 pRenderer->DrawTransparentRedShade(wHintWindow.uFrameX + v78, v81 + wHintWindow.uFrameY + 30, v73);
310 if ( inspect_item->Identified())
311 v16 = inspect_item->GetIdentifiedName();
312 else
313 v16 = item_desc->pUnidentifiedName;
314 wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, v16, 3u);
315 v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &wHintWindow, 0, 0); //"Broken Item"
316 v18 = v17 >> 1;
317 v19 = TargetColor(0xFFu, 0x19u, 0x19u);
318 wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item"
319 pRenderer->ResetTextureClipRect();
320 if ( !areWeLoadingTexture )
321 {
322 v73->Release();
323 pIcons_LOD->SyncLoadedFilesCount();
324 }
325 return;
326 }
327 if (!inspect_item->Identified())
328 {
329 wHintWindow.DrawMessageBox(0);
330 pRenderer->SetTextureClipRect(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12,
331 wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12,
332 wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12);
333 wHintWindow.uFrameWidth -= 24;
334 wHintWindow.uFrameHeight -= 12;
335 wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
336 wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
337 pRenderer->DrawTextureTransparent(wHintWindow.uFrameX + v78, v81 + wHintWindow.uFrameY + 30, v73);
338 wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, item_desc->pUnidentifiedName, 3u);
339 v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &wHintWindow, 0, 0); ///"Not Identified"
340 v18 = v17 >> 1;
341 v19 = TargetColor(0xFFu, 0x19u, 0x19u);
342 wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[232], 3);
343 pRenderer->ResetTextureClipRect();
344 if ( !areWeLoadingTexture )
345 {
346 v73->Release();
347 pIcons_LOD->SyncLoadedFilesCount();
348 }
349 return;
350 }
351
352 sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], item_desc->pUnidentifiedName); //"Type: %s"
353 out_text[100] = 0;
354 out_text[200] = 0;
355 //v20 = item_desc->uEquipType;
356 switch (item_desc->uEquipType)
357 {
358 case EQUIP_OFF_HAND:
359 case EQUIP_MAIN_HAND:
360 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK],
361 (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll); //"Damage"
362 if (item_desc->uDamageMod)
363 {
364 char mod[16];
365 sprintf(mod, "+%d", (int)item_desc->uDamageMod);
366 strcat(out_text + 100, mod);
367 }
368 break;
369
370 case EQUIP_BOW:
371 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot"
372 (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], //"Damage"
373 (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll);
374 if (item_desc->uDamageMod)
375 {
376 char mod[16];
377 sprintf(mod, "+%d", (int)item_desc->uDamageMod);
378 strcat(out_text + 100, mod);
379 }
380 break;
381
382 case EQUIP_ARMOUR:
383 case EQUIP_SHIELD:
384 case EQUIP_HELMET:
385 case EQUIP_BELT:
386 case EQUIP_CLOAK:
387 case EQUIP_GAUNTLETS:
388 case EQUIP_BOOTS:
389 case EQUIP_RING:
390 case EQUIP_AMULET:
391 if (item_desc->uDamageDice) //"Armor"
392 sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], item_desc->uDamageDice + item_desc->uDamageMod);
393 break;
394
395 }
396
397 if ( !v77 )
398 {
399 if (item_desc->uEquipType ==EQUIP_POTION) //this is CORRECT! do not move to switch!
400 {
401 if ( inspect_item->uEnchantmentType )
402 sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power"
403 }
404 else if (item_desc->uEquipType == EQUIP_REAGENT)
405 {
406 sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power"
407 }
408
409 else if ( inspect_item->uEnchantmentType )
410 {
411 sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210],
412 pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special"
413 }
414 else if ( inspect_item->uSpecEnchantmentType )
415 {
416 sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210],
417 pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->_bonus_strength);
418 }
419
420 else if ( inspect_item->uNumCharges )
421 {
422 sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges"
423
424 }
425 }
426 wHintWindow.uFrameWidth -= 12;
427 v85 = 3;
428 wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
429 wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
430 Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8));
431 v84 = &out_text[0];
432 do
433 {
434 if ( *v84 )
435 {
436 v27 = pFontComic->CalcTextHeight(v84, &wHintWindow, 100, 0);
437 Str += v27 + 3;
438 }
439 v84 += 100;
440 --v85;
441 }
442 while ( v85 );
443 v28 = item_desc->pDescription;
444 if ( *v28 )
445 {
446 v29 = pFontSmallnum->CalcTextHeight(v28, &wHintWindow, 100, 0);
447 Str += v29;
448 }
449 wHintWindow.uFrameHeight = v73->uTextureHeight + v81 + 54;
450 if ( (signed int)Str > (signed int)wHintWindow.uFrameHeight )
451 wHintWindow.uFrameHeight = (unsigned int)Str;
452 if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
453 wHintWindow.uFrameHeight += LOBYTE(pFontComic->uFontHeight);
454 v85 = 0;
455 if ( pFontArrus->uFontHeight )
456 {
457 wHintWindow.uFrameWidth -= 24;
458 v30 = pFontArrus->uFontHeight;
459 v31 = inspect_item->GetIdentifiedName();
460 if ( pFontArrus->CalcTextHeight(v31, &wHintWindow, 0, 0) / (signed int)v30 )
461 v85 = v30;
462 wHintWindow.uFrameWidth += 24;
463 }
464 wHintWindow.uFrameWidth += 12;
465 wHintWindow.uFrameHeight += (unsigned int)v85;
466 wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
467 wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
468 wHintWindow.DrawMessageBox(0);
469 //v15 = pRenderer;
470 pRenderer->SetTextureClipRect(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12,
471 wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12);
472 wHintWindow.uFrameWidth -= 12;
473 v32 = v73->uTextureHeight;
474 v33 = wHintWindow.uFrameHeight;
475 wHintWindow.uFrameHeight -= 12;
476 wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
477 wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
478 pRenderer->DrawTextureTransparent(
479 wHintWindow.uFrameX + v78,
480 wHintWindow.uFrameY + (signed int)(v33 - v32) / 2,
481 v73);
482
483 v34 = (int)(v85 + 35);
484 v85 = 3;
485 Str = out_text;
486 do
487 {
488 if ( *Str )
489 {
490 wHintWindow.DrawText(pFontComic, 100, v34, 0, Str, 0, 0, 0);
491 v34 += pFontComic->CalcTextHeight(Str, &wHintWindow, 100, 0) + 3;
492 }
493 Str += 100;
494 --v85;
495 }
496 while (v85 );
497 v35 = item_desc->pDescription;
498 if ( *v35 )
499 wHintWindow.DrawText(pFontSmallnum, 100, v34, 0, v35, 0, 0, 0);
500 wHintWindow.uFrameX += 12;
501 wHintWindow.uFrameWidth -= 24;
502 v36 = inspect_item->GetIdentifiedName();
503 wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, v36, 3u);
504 wHintWindow.uFrameWidth += 24;
505 wHintWindow.uFrameX -= 12;
506 if ( v77 )
507 {
508 sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value"
509 v40 = pFontComic;
510 v61 = 0;
511 v56 = 0;
512 v51 = 0;
513 v47 = pTmpBuf.data();
514 v44 = 0;
515 v42 = wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight);
516 v41 = 100;
517 }
518 else
519 {
520 if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
521 {
522 sub_493F79(&v67, inspect_item->uExpireTime - pParty->uTimePlayed);
523 strcpy(pTmpBuf.data(), "Duration:");
524 Str = (char *)(v67.field_18_expire_year - game_starting_year);
525 if (v67.field_18_expire_year != 1168 )
526 {
527 sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year);
528 strcat(pTmpBuf.data(), v65);
529 }
530 if ( (((v67.field_14_exprie_month || Str) &&
531 ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str)
532 || v67.field_C_expire_day)
533 && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str ||
534 v67.field_C_expire_day)
535 || v67.field_8_expire_hour)
536 && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf.data(), v65), v67.field_14_exprie_month) || Str ||
537 v67.field_C_expire_day || v67.field_8_expire_hour)
538 || v67.field_4_expire_minute )
539 {
540 sprintf(v65, " %d:mn", v67.field_4_expire_minute);
541 strcat(pTmpBuf.data(), v65);
542 }
543 wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
544 }
545 v37 = inspect_item->GetValue();
546 sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v37);
547 wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
548 v38 = inspect_item->uAttributes;
549 if ( BYTE1(v38) & 1 )
550 {
551 v61 = 0;
552 v56 = 0;
553 v51 = 0;
554 v47 = pGlobalTXT_LocalizationStrings[187]; //"Stolen"
555 }
556 else
557 {
558 if ( !(BYTE1(v38) & 2) )
559 {
560 pRenderer->ResetTextureClipRect();
561 if ( !areWeLoadingTexture )
562 {
563 v73->Release();
564 pIcons_LOD->SyncLoadedFilesCount();
565 }
566 return;
567 }
568 v61 = 0;
569 v56 = 0;
570 v51 = 0;
571 v47 = pGlobalTXT_LocalizationStrings[651]; //"Hardened"
572 }
573 LOWORD(v38) = LOWORD(pRenderer->uTargetRMask);
574 v44 = v38;
575 v42 = wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight);
576 v39 = pFontComic->GetLineWidth(pTmpBuf.data());
577 v40 = pFontComic;
578 v41 = v39 + 132;
579 }
580 wHintWindow.DrawText(v40, v41, v42, v44, v47, v51, v56, v61);
581 pRenderer->ResetTextureClipRect();
582 if ( !areWeLoadingTexture )
583 {
584 v73->Release();
585 pIcons_LOD->SyncLoadedFilesCount();
586 }
587 return;
588 }
589 // 4E455C: using guessed type int dword_4E455C;
590 // 506128: using guessed type int areWeLoadingTexture;
591
592
593
594 //----- (0041E360) --------------------------------------------------------
595 void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *edx0)
596 {
597 unsigned int v2; // esi@1
598 Actor *v3; // esi@3
599 int v4; // eax@3
600 //unsigned int v5; // ecx@3
601 NPCData *v6; // eax@3
602 unsigned __int16 v7; // cx@3
603 int v8; // eax@4
604 unsigned __int16 v9; // dx@4
605 SpriteFrame *v10; // edi@17
606 LODSprite *v11; // esi@17
607 unsigned int v12; // ecx@17
608 Sprite *v13; // edi@18
609 //int v14; // ecx@18
610 //int v15; // edx@18
611 //int v16; // edx@18
612 //int v17; // eax@18
613 unsigned int v18; // ecx@19
614 unsigned int v19; // eax@21
615 char *v20; // esi@28
616 int v21; // edx@29
617 unsigned __int16 *v22; // ecx@29
618 int v23; // eax@29
619 int v24; // eax@32
620 int v25; // esi@32
621 char *v26; // edx@34
622 unsigned __int8 v27; // sf@36
623 unsigned __int8 v28; // of@36
624 //int v29; // esi@40
625 //unsigned __int16 *v30; // ecx@40
626 //int v31; // eax@40
627 //int v32; // esi@43
628 //unsigned __int16 v33; // ax@45
629 //int v34; // edx@45
630 //int v35; // eax@45
631 int v36; // eax@49
632 //char *v37; // eax@52
633 int v38; // eax@55
634 unsigned __int16 v39; // ax@59
635 SpellBuff *v40; // eax@60
636 int v41; // edi@61
637 unsigned int v42; // eax@61
638 int v43; // eax@62
639 int v44; // eax@63
640 signed int v45; // edi@65
641 unsigned __int16 v46; // ax@73
642 Player *v47; // ecx@77
643 //unsigned int v48; // eax@85
644 GUIFont *v49; // edi@90
645 int v50; // edi@90
646 SpellBuff *v51; // eax@91
647 char *v52; // ecx@98
648 char *v53; // ecx@101
649 char *v54; // ST0C_4@118
650 unsigned int v55; // eax@118
651 GUIFont *v56; // edi@124
652 unsigned __int8 v57; // al@128
653 int v58; // eax@132
654 Actor *v59; // ecx@133
655 unsigned __int8 v60; // dl@138
656 char *v62; // eax@147
657 int v63; // eax@152
658 //char *result; // eax@152
659 int v65; // eax@155
660 const char *v66; // [sp-10h] [bp-1FCh]@121
661 const char *v67; // [sp-10h] [bp-1FCh]@125
662 const char *v68; // [sp-10h] [bp-1FCh]@142
663 int v69; // [sp-Ch] [bp-1F8h]@121
664 char *v70; // [sp-Ch] [bp-1F8h]@125
665 char *v71; // [sp-Ch] [bp-1F8h]@142
666 char *v72; // [sp-8h] [bp-1F4h]@54
667 int v73; // [sp-8h] [bp-1F4h]@79
668 int v74; // [sp-8h] [bp-1F4h]@121
669 int v75; // [sp-8h] [bp-1F4h]@125
670 int v76; // [sp-8h] [bp-1F4h]@142
671 size_t v77; // [sp-4h] [bp-1F0h]@54
672 unsigned int v78; // [sp-4h] [bp-1F0h]@121
673 unsigned int v79; // [sp-4h] [bp-1F0h]@125
674 char *v80; // [sp-4h] [bp-1F0h]@142
675 char *v81; // [sp-4h] [bp-1F0h]@148
676 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18
677 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18
678 RECT v84; // [sp+ECh] [bp-100h]@26
679 char *v85[10]; // [sp+FCh] [bp-F0h]@145
680 char *v95[11]; // [sp+124h] [bp-C8h]@127
681 RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3
682 unsigned int v107; // [sp+1A0h] [bp-4Ch]@18
683 unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34
684 unsigned int v109; // [sp+1A8h] [bp-44h]@32
685 LPVOID v110; // [sp+1ACh] [bp-40h]@28
686 unsigned int v111; // [sp+1B0h] [bp-3Ch]@29
687 int v112; // [sp+1B4h] [bp-38h]@3
688 int v222; // [sp+1B8h] [bp-34h]@18
689 unsigned __int8 v114; // [sp+1BFh] [bp-2Dh]@133
690 int v115; // [sp+1C0h] [bp-2Ch]@3
691 unsigned int v116; // [sp+1C4h] [bp-28h]@18
692 int i; // [sp+1C8h] [bp-24h]@18
693 int a2; // [sp+1CCh] [bp-20h]@28
694 int v119; // [sp+1D0h] [bp-1Ch]@18
695 SpellBuff *v120; // [sp+1D4h] [bp-18h]@18
696 Actor *v121; // [sp+1D8h] [bp-14h]@3
697 int a5; // [sp+1DCh] [bp-10h]@3
698 GUIWindow *a1; // [sp+1E0h] [bp-Ch]@1
699 int v124; // [sp+1E4h] [bp-8h]@18
700 int a4; // [sp+1E8h] [bp-4h]@18
701
702 a1 = edx0;
703 v2 = uActorID;
704
705 static Actor pMonsterInfoUI_Doll;
706 /*if ( !(bMonsterInfoUI_bDollInitialized & 1) )
707 {
708 bMonsterInfoUI_bDollInitialized |= 1u;
709 Actor::Actor(&pMonsterInfoUI_Doll);
710 atexit(nullsub_3);
711 }*/
712 v106.uParentBillboardID = -1;
713 v3 = &pActors[v2];
714 v121 = v3;
715 v4 = TargetColor(0xE1u, 255, 0x9Bu);
716 //v5 = v3->sNPC_ID;
717 a5 = v4;
718 v6 = GetNPCData(v3->sNPC_ID);
719 v7 = v3->pMonsterInfo.uID;
720 //v112 = (char **)v6;
721 v115 = monster_popup_y_offsets[((signed __int16)v7 - 1) / 3] - 40;
722 if ( v7 == pMonsterInfoUI_Doll.pMonsterInfo.uID )
723 {
724 v9 = pMonsterInfoUI_Doll.uCurrentActionLength;
725 }
726 else
727 {
728 memcpy(&pMonsterInfoUI_Doll, v3, sizeof(pMonsterInfoUI_Doll));
729 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored;
730 pMonsterInfoUI_Doll.uCurrentActionTime = 0;
731 v8 = rand();
732 v3 = v121;
733 v9 = v8 % 256 + 128;
734 pMonsterInfoUI_Doll.uCurrentActionLength = v8 % 256 + 128;
735 }
736
737 if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 )
738 {
739 pMonsterInfoUI_Doll.uCurrentActionTime = 0;
740 if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_Bored || pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_AtkMelee)
741 {
742 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Standing;
743 pMonsterInfoUI_Doll.uCurrentActionLength = rand() % 128 + 128;
744 }
745 else
746 {
747 //rand();
748 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored;
749 if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) &&
750 (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) && rand() % 30 < 100 )
751 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_AtkMelee;
752 pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength;
753 }
754 }
755 v10 = pSpriteFrameTable->GetFrame( v3->pSpriteIDs[pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime);
756 v11 = &pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]];//40 * v10->pHwSpriteIDs[0] + 7218180;
757 v106.pTarget = pRenderer->pTargetSurface;
758 v106.pTargetZ = pRenderer->pActiveZBuffer;
759 v106.uTargetPitch = pRenderer->uTargetSurfacePitch;
760 v12 = a1->uFrameY + 52;
761 v106.uViewportX = a1->uFrameX + 13;
762 v106.uViewportY = v12;
763 v106.uViewportW = v12 + 128;
764 v106.uViewportZ = v106.uViewportX + 128;
765 v106.uScreenSpaceX = (signed int)(v106.uViewportX + 128 + v106.uViewportX) / 2;
766 v106._screenspace_x_scaler_packedfloat = 65536;
767 v106._screenspace_y_scaler_packedfloat = 65536;
768 v106.uScreenSpaceY = v115 + v12 + v11->uHeight;
769 v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1);
770 v106.sZValue = 0;
771 v106.uFlags = 0;
772 pRenderer->SetRasterClipRect(0, 0, 0x27Fu, 0x1DFu);
773 pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5);
774 pRenderer->RasterLine2D( v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, a5);
775 pRenderer->RasterLine2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5);
776 pRenderer->RasterLine2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5);
777 if ( pRenderer->pRenderD3D )
778 {
779 v13 = &pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]];
780 v106.uScreenSpaceY = v115 + v106.uViewportY + v13->uBufferHeight;
781 //v222 = (IDirectDrawSurface *)v13->pTextureSurface;
782 memset(&Dst, 0, 0x64u);
783 Dst.dwSize = 100;
784 Dst.dwFillColor = 0;
785 memset(&pDesc, 0, 0x7Cu);
786 pDesc.dwSize = 124;
787 v13->pTextureSurface->GetSurfaceDesc(&pDesc);
788 //v14 = v13->uBufferHeight;
789 //v120 = (SpellBuff *)v13->uBufferWidth;
790 v107 = 0;
791 //v15 = v13->uAreaX;
792 //v119 = v13->uBufferWidth / 2;
793 i = 0;
794 //a4 = v106.uScreenSpaceX + v15 - v13->uBufferWidth / 2;
795 int dst_x = v106.uScreenSpaceX + v13->uAreaX - v13->uBufferWidth / 2;
796 //v115 = v13->uAreaY;
797 //v16 = v13->uAreaWidth + v13->uBufferWidth / 2 + v13->uAreaX - v13->uBufferWidth;
798 //v124 = v106.uScreenSpaceY + v115 - v14;
799 int dst_y = v106.uScreenSpaceY + v13->uAreaY - v13->uBufferHeight;
800 //v17 = v13->uAreaHeight + v13->uAreaY - v14;
801 //v116 = v106.uScreenSpaceX + v16;
802 uint dst_z = v106.uScreenSpaceX + v13->uAreaX + v13->uAreaWidth + v13->uBufferWidth / 2 - v13->uBufferWidth;
803 //v119 = v106.uScreenSpaceY + v17;
804 uint dst_w = v106.uScreenSpaceY + v13->uAreaY + v13->uAreaHeight - v13->uBufferHeight;
805 if (dst_x < v106.uViewportX)
806 {
807 v18 = v106.uViewportX - dst_x;
808 dst_x = v106.uViewportX;
809 v107 = v18;
810 }
811 if (dst_y < v106.uViewportY)
812 {
813 v19 = v106.uViewportY - dst_y;
814 dst_y = v106.uViewportY;
815 i = v19;
816 }
817 if (dst_z > v106.uViewportZ)
818 dst_z = v106.uViewportZ;
819 if (dst_w > v106.uViewportW)
820 dst_w = v106.uViewportW;
821 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, pRenderer->uTargetBMask | pRenderer->uTargetGMask);
822 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, pRenderer->uTargetBMask | pRenderer->uTargetGMask);
823 v84.left = v106.uViewportX;
824 v84.top = v106.uViewportY;
825 v84.right = v106.uViewportZ;
826 v84.bottom = v106.uViewportW;
827 ErrD3D(pRenderer->pBackBuffer4->Blt(&v84, 0, 0, 16778240u, &Dst));
828 if ( pRenderer->uTargetGBits == 5 )
829 {
830 __debugbreak(); // no monster popup for r5g5b5 yet
831 memset(&pDesc, 0, 0x7Cu);
832 pDesc.dwSize = 124;
833 if ( pRenderer->LockSurface_DDraw4(v13->pTextureSurface, &pDesc, DDLOCK_WAIT))
834 {
835 v20 = (char *)dst_y;
836 v110 = pDesc.lpSurface;
837 a2 = dst_y;
838 if (dst_y < dst_w)
839 {
840 //v111 = 2 * pRenderer->uTargetSurfacePitch;
841 v21 = dst_x;
842 v22 = &pRenderer->pTargetSurface[dst_y * pRenderer->uTargetSurfacePitch + dst_x];
843 auto _v22_2 = v22;
844 v23 = i - dst_y;
845 //v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]];
846 v115 = i - dst_y;
847 while ( 1 )
848 {
849 dst_y = v21;
850 if ( v21 < dst_z )
851 {
852 v24 = (int)&v20[v23];
853 v25 = v107 - v21;
854 v109 = v24;
855 for ( i = v107 - v21; ; v25 = i )
856 {
857 v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / v13->uAreaHeight);
858 v26 = (char *)v108 + pDesc.dwWidth * (v25 + dst_y++) / v13->uAreaWidth;
859 *v22 = *((short *)v110 + (int)v26);
860 ++v22;
861 if ( dst_y >= dst_z )
862 break;
863 }
864 v23 = v115;
865 }
866 v22 = (unsigned __int16 *)((char *)_v22_2 + 2 * pRenderer->uTargetSurfacePitch);
867 _v22_2 = v22;
868 v20 = (char *)(a2 + 1);
869 v28 = __OFSUB__(a2 + 1, dst_w);
870 v27 = (signed int)(a2++ + 1 - dst_w) < 0;
871 //a2 = (Player *)((char *)a2 + 1);
872 //v120 = (SpellBuff *)((char *)v120 + v111);
873 if ( !(v27 ^ v28) )
874 break;
875 v21 = dst_x;
876 }
877 }
878 v13->pTextureSurface->Unlock(0);
879 }
880 }
881 else
882 {
883 memset(&pDesc, 0, 0x7Cu);
884 pDesc.dwSize = 124;
885 if ( pRenderer->LockSurface_DDraw4(v13->pTextureSurface, &pDesc, DDLOCK_WAIT) )
886 {
887 auto src = (unsigned __int16 *)pDesc.lpSurface;
888
889 uint num_top_scanlines_above_frame_y = i - dst_y;
890 for (uint y = dst_y; y < dst_w; ++y)
891 {
892 auto dst = &pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + dst_x];
893
894 uint src_y = num_top_scanlines_above_frame_y + y;
895 for (uint x = dst_x; x < dst_z; ++x)
896 {
897 uint src_x = v107 - dst_x + x; // num scanlines left to frame_x + current x
898
899 uint idx = pDesc.dwHeight * src_y / v13->uAreaHeight * (pDesc.lPitch / sizeof(short)) +
900 pDesc.dwWidth * src_x / v13->uAreaWidth;
901 uint b = src[idx] & 0x1F;
902 *dst++ = b | 2 * (src[idx] & 0xFFE0);
903 }
904 }
905 v13->pTextureSurface->Unlock(0);
906 }
907 }
908 }
909 else
910 {
911 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0);
912 v36 = v10->pHwSpriteIDs[0];
913 if ( v36 >= 0 )
914 pSprites_LOD->pSpriteHeaders[v36].DrawSprite_sw(&v106, 0);
915 }
916
917 if ( v121->sNPC_ID )
918 {
919 //v37 = v6->uProfession;
920 if (v6->uProfession)
921 {
922 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v6->uProfession]); // "%s the %s" / ^Pi[%s] %s
923 }
924 else
925 {
926 v77 = 2000;
927 v72 = v6->pName;
928 }
929 }
930 else
931 {
932 v38 = v121->dword_000334_unique_name;
933 v77 = 2000;
934 if ( v38 )
935 v72 = pMonsterStats->pPlaceStrings[v38];
936 else
937 v72 = pMonsterStats->pInfos[v121->pMonsterInfo.uID].pName;
938 }
939 if(!v121->sNPC_ID || (v121->sNPC_ID && !v6->uProfession))
940 strncpy(pTmpBuf.data(), v72, v77);
941 v39 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
942 a1->DrawTitleText(pFontComic, 0, 0xCu, v39, pTmpBuf.data(), 3u);
943 Actor::DrawHealthBar(v121, a1);
944 v119 = 0;
945 pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed;
946 v115 = 0;
947 v116 = 0;
948 i = 0;
949 v112 = 0;
950 if ( !uActiveCharacter )
951 {
952 v45 = 1;
953 }
954 else
955 {
956 LOBYTE(v40) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID);
957 v120 = v40;
958 if ( !v40 )
959 v45 = 1;
960 else
961 {
962 v41 = (unsigned __int8)v40 & 0x3F;
963 v42 = SkillToMastery((unsigned __int16)v40) - 1;
964 if ( !v42 )
965 {
966 if ( v41 + 10 >= v121->pMonsterInfo.uLevel )
967 {
968 v45 = 1;
969 v119 = 1;
970 }
971 else
972 v45 = 1;
973 }
974 else
975 {
976 v43 = v42 - 1;
977 if ( !v43 )
978 {
979 if ( 2 * v41 + 10 >= v121->pMonsterInfo.uLevel )
980 {
981 v45 = 1;
982 v119 = 1;
983 v116 = 1;
984 }
985 else
986 v45 = 1;
987 }
988 else
989 {
990 v44 = v43 - 1;
991 if ( !v44 )
992 {
993 if ( 3 * v41 + 10 >= v121->pMonsterInfo.uLevel )
994 {
995 v45 = 1;
996 v119 = 1;
997 v116 = 1;
998 i = 1;
999 }
1000 else
1001 {
1002 v45 = 1;
1003 }
1004 }
1005 else
1006 {
1007 if ( v44 != 1 )
1008 v45 = 1;
1009 else
1010 {
1011 v45 = 1;
1012 v119 = 1;
1013 v116 = 1;
1014 i = 1;
1015 v112 = 1;
1016 }
1017 }
1018 }
1019 }
1020 }
1021 // LABEL_73:
1022 v46 = v121->uAIState;
1023 if ( v46 != 5 && v46 != 4 && !dword_507BF0_is_there_popup_onscreen && v120 )
1024 {
1025 v47 = pPlayers[uActiveCharacter];
1026 if ( v119 | v116 | i | (unsigned int)v112 )
1027 {
1028 if ( v121->pMonsterInfo.uLevel >= v47->uLevel - 5 )
1029 v73 = SPEECH_105;
1030 else
1031 v73 = SPEECH_104;
1032 }
1033 else
1034 {
1035 v73 = SPEECH_106;
1036 }
1037 v47->PlaySound((PlayerSpeech)v73, 0);
1038 }
1039 }
1040
1041 for (uint _it = 0; _it < 4; ++_it)
1042 {
1043 auto player = pParty->pPlayers + _it;
1044
1045 //LOBYTE(v48) = player->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID);
1046 //v111 = v48;
1047 v111 = player->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID);
1048 v120 = (SpellBuff *)138;
1049 do
1050 {
1051 if ( (signed int)SkillToMastery(v111) >= 3 )
1052 v115 = v45;
1053 v120 = (SpellBuff *)((char *)v120 - 1);
1054 }
1055 while ( v120 );
1056 //++a2;
1057 }
1058 //while ( (signed int)a2 < (signed int)pParty->pHirelings );
1059
1060 v49 = pFontSmallnum;
1061 a2 = (int)pFontSmallnum;
1062 a1->DrawText(pFontSmallnum, 12, 196, a5, pGlobalTXT_LocalizationStrings[631], 0, 0, 0);
1063 v50 = LOBYTE(v49->uFontHeight) + 193;
1064 if ( !v115 )
1065 {
1066 v78 = 0;
1067 v74 = 0;
1068 v69 = 0;
1069 v66 = pGlobalTXT_LocalizationStrings[630];
1070 a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78);
1071 }
1072 else
1073 {
1074 a4 = 0;
1075 v51 = &v121->pActorBuffs[1];
1076 v222 = 0;
1077 v120 = &v121->pActorBuffs[1];
1078 do
1079 {
1080 if ( (signed __int64)v51->uExpireTime > 0 )
1081 {
1082 switch ( (int)v51 )
1083 {
1084 case 0u:
1085 v124 = 60;
1086 a4 = (int)pGlobalTXT_LocalizationStrings[591];
1087 break;
1088 case 1u:
1089 v124 = 82;
1090 a4 = (int)pGlobalTXT_LocalizationStrings[649];
1091 break;
1092 case 2u:
1093 v124 = 92;
1094 a4 = (int)pGlobalTXT_LocalizationStrings[592];
1095 break;
1096 case 3u:
1097 v124 = 63;
1098 a4 = (int)pGlobalTXT_LocalizationStrings[4];
1099 break;
1100 case 4u:
1101 v52 = pGlobalTXT_LocalizationStrings[220];
1102 a4 = (int)v52;
1103 v124 = 81;
1104 break;
1105 case 5u:
1106 v52 = pGlobalTXT_LocalizationStrings[162];
1107 a4 = (int)v52;
1108 v124 = 81;
1109 break;
1110 case 6u:
1111 v53 = pGlobalTXT_LocalizationStrings[593];
1112 v124 = 35;
1113 a4 = (int)v53;
1114 break;
1115 case 8u:
1116 v53 = pGlobalTXT_LocalizationStrings[608];
1117 v124 = 62;
1118 a4 = (int)v53;
1119 break;
1120 case 7u:
1121 case 9u:
1122 a4 = 0;
1123 v124 = 0;
1124 ++v51;
1125 v222 = v222 + 1;
1126 v120 = v51;
1127 __debugbreak(); // fix condition
1128 continue;
1129 case 0xAu:
1130 v124 = 47;
1131 a4 = (int)pGlobalTXT_LocalizationStrings[221];
1132 break;
1133 case 0xBu:
1134 v124 = 66;
1135 a4 = (int)pGlobalTXT_LocalizationStrings[607];
1136 break;
1137 case 0xCu:
1138 v124 = 85;
1139 a4 = (int)pGlobalTXT_LocalizationStrings[610];
1140 break;
1141 case 0xDu:
1142 v124 = 86;
1143 a4 = (int)pGlobalTXT_LocalizationStrings[609];
1144 break;
1145 case 0xEu:
1146 v124 = 17;
1147 a4 = (int)pGlobalTXT_LocalizationStrings[279];
1148 break;
1149 case 0xFu:
1150 v124 = 38;
1151 a4 = (int)pGlobalTXT_LocalizationStrings[442];
1152 break;
1153 case 0x10u:
1154 v124 = 46;
1155 a4 = (int)pGlobalTXT_LocalizationStrings[443];
1156 break;
1157 case 0x11u:
1158 v124 = 51;
1159 a4 = (int)pGlobalTXT_LocalizationStrings[440];
1160 break;
1161 case 0x12u:
1162 v124 = 5;
1163 a4 = (int)pGlobalTXT_LocalizationStrings[441];
1164 break;
1165 case 0x13u:
1166 v124 = 95;
1167 a4 = (int)pGlobalTXT_LocalizationStrings[229];
1168 break;
1169 case 0x14u:
1170 v124 = 73;
1171 a4 = (int)pGlobalTXT_LocalizationStrings[228];
1172 break;
1173 default:
1174 a4 = 0;
1175 break;
1176 }
1177 if ( a4 )
1178 {
1179 v54 = (char *)a4;
1180 v55 = GetSpellColor(v124);
1181 a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0);
1182 v50 = v50 + *(char *)(a2 + 5) - 3;
1183 v51 = v120;
1184 }
1185 }
1186
1187 ++v51;
1188 v222 = v222 + 1;
1189 v120 = v51;
1190
1191 __debugbreak(); // fix condition
1192 }
1193 //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 );
1194 while (true);
1195
1196 if ( !a4 )
1197 {
1198 v78 = 0;
1199 v74 = 0;
1200 v69 = 0;
1201 v66 = pGlobalTXT_LocalizationStrings[153];
1202 a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78);
1203 }
1204 }
1205 v56 = pFontSmallnum;
1206 a4 = v106.uViewportY;
1207 if ( v119 )
1208 {
1209 sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP);
1210 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
1211 a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
1212 v79 = v121->pMonsterInfo.uAC;
1213 v75 = 0;
1214 v70 = pGlobalTXT_LocalizationStrings[12];
1215 v67 = "%s\f%05u\t100%d\n";
1216 }
1217 else
1218 {
1219 sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);
1220 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
1221 v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630];
1222 v75 = 0;
1223 v70 = pGlobalTXT_LocalizationStrings[12];
1224 a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
1225 v67 = "%s\f%05u\t100%s\n";
1226 }
1227 sprintf(pTmpBuf.data(), v67, v70, v75, v79);
1228 a1->DrawText(v56, 150, a4, a5, pTmpBuf.data(), 0, 0, 0);
1229 a4 = a4 + LOBYTE(v56->uFontHeight) - 6 + LOBYTE(v56->uFontHeight);
1230 v95[0] = pGlobalTXT_LocalizationStrings[87];
1231 v95[1] = pGlobalTXT_LocalizationStrings[6];
1232 v95[2] = pGlobalTXT_LocalizationStrings[240];
1233 v95[3] = pGlobalTXT_LocalizationStrings[70];
1234 v95[4] = pGlobalTXT_LocalizationStrings[624];
1235 v95[5] = pGlobalTXT_LocalizationStrings[138];
1236 v95[6] = pGlobalTXT_LocalizationStrings[214];
1237 v95[7] = pGlobalTXT_LocalizationStrings[142];
1238 v95[8] = pGlobalTXT_LocalizationStrings[29];
1239 v95[9] = pGlobalTXT_LocalizationStrings[133];
1240 v95[10] = pGlobalTXT_LocalizationStrings[54];
1241 if ( v116 )
1242 {
1243 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, v95[v121->pMonsterInfo.uAttack1Type]);
1244 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
1245 a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
1246 v57 = v121->pMonsterInfo.uAttack1DamageBonus;
1247 if ( v57 )
1248 sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53],
1249 0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides, v57);
1250 else
1251 sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53],
1252 0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides);
1253 }
1254 else
1255 {
1256 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]);
1257 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
1258 a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
1259 sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]);
1260 }
1261 a1->DrawText(v56, 150, a4, a5, pTmpBuf.data(), 0, 0, 0);
1262 v58 = LOBYTE(v56->uFontHeight);
1263 a4 = a4 + v58 - 6 + v58;
1264 if ( !i )
1265 {
1266 v80 = pGlobalTXT_LocalizationStrings[630];
1267 v76 = 0;
1268 v71 = pGlobalTXT_LocalizationStrings[628];
1269 v68 = "%s\f%05u\t080%s\n";
1270 sprintf(pTmpBuf.data(), v68, v71, v76, v80);
1271 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
1272 v58 = LOBYTE(v56->uFontHeight);
1273 a4 = a4 + v58 - 3;
1274 }
1275 else
1276 {
1277 v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628];
1278 v59 = v121;
1279 v114 = v121->pMonsterInfo.uSpell1ID;
1280 if ( v114 && v121->pMonsterInfo.uSpell2ID )
1281 v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629];
1282 if ( v114 )
1283 {
1284 sprintf(pTmpBuf.data(), "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName);
1285 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
1286 v58 = LOBYTE(v56->uFontHeight);
1287 a4 = a4 + v58 - 3;
1288 v59 = v121;
1289 }
1290 v60 = v59->pMonsterInfo.uSpell2ID;
1291 if ( v60 )
1292 {
1293 sprintf(pTmpBuf.data(), "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName);
1294 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
1295 v58 = LOBYTE(v56->uFontHeight);
1296 a4 = a4 + v58 - 3;
1297 v59 = v121;
1298 }
1299 if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID )
1300 {
1301 v80 = pGlobalTXT_LocalizationStrings[153];
1302 v76 = 0;
1303 v71 = pGlobalTXT_LocalizationStrings[628];
1304 v68 = "%s\f%05u\t060%s\n";
1305 sprintf(pTmpBuf.data(), v68, v71, v76, v80);
1306 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf.data(), 0, 0, 0);
1307 v58 = LOBYTE(v56->uFontHeight);
1308 a4 = a4 + v58 - 3;
1309 }
1310 }
1311 a4 = a4 + v58 - 3;
1312 a1->DrawText(v56, 150, a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0);
1313 a4 = a4 + LOBYTE(v56->uFontHeight) - 3;
1314 v85[0] = pGlobalTXT_LocalizationStrings[87];
1315 v85[1] = pGlobalTXT_LocalizationStrings[6];
1316 v85[2] = pGlobalTXT_LocalizationStrings[240];
1317 v85[3] = pGlobalTXT_LocalizationStrings[70];
1318 v85[4] = pGlobalTXT_LocalizationStrings[142];
1319 v85[5] = pGlobalTXT_LocalizationStrings[214];
1320 v85[6] = pGlobalTXT_LocalizationStrings[29];
1321 v85[7] = pGlobalTXT_LocalizationStrings[133];
1322 v85[8] = pGlobalTXT_LocalizationStrings[54];
1323 v85[9] = pGlobalTXT_LocalizationStrings[624];
1324 v95[1] = (char *)v121->pMonsterInfo.uResFire;
1325 v95[2] = (char *)v121->pMonsterInfo.uResAir;
1326 v95[3] = (char *)v121->pMonsterInfo.uResWater;
1327 v95[4] = (char *)v121->pMonsterInfo.uResEarth;
1328 v95[5] = (char *)v121->pMonsterInfo.uResMind;
1329 v95[6] = (char *)v121->pMonsterInfo.uResSpirit;
1330 v95[7] = (char *)v121->pMonsterInfo.uResBody;
1331 v95[8] = (char *)v121->pMonsterInfo.uResLight;
1332 v95[9] = (char *)v121->pMonsterInfo.uResPhysical;
1333 v95[10] = (char *)v121->pMonsterInfo.uResDark;
1334 if ( v112 )
1335 {
1336 v124 = 0;
1337 do
1338 {
1339 v62 = v95[v124+1];
1340 if ( v62 == (char *)200 )
1341 {
1342 v81 = pGlobalTXT_LocalizationStrings[625];
1343 }
1344 else
1345 {
1346 if ( v62 )
1347 v81 = pGlobalTXT_LocalizationStrings[627];
1348 else
1349 v81 = pGlobalTXT_LocalizationStrings[153];
1350 }
1351 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", v85[v124], 0, v81);
1352 a1->DrawText(v56, 170, a4, a5, pTmpBuf.data(), 0, 0, 0);
1353 v63 = LOBYTE(v56->uFontHeight);
1354 v124 += 4;
1355 a4 = a4 + v63 - 3;
1356 }
1357 while ( v124 < 40 );
1358 }
1359 else
1360 {
1361 i = 0;
1362 do
1363 {
1364 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", v85[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?"
1365 a1->DrawText(v56, 170, a4, a5, pTmpBuf.data(), 0, 0, 0);
1366 v65 = LOBYTE(v56->uFontHeight);
1367 ++i;
1368 a4 = a4 + v65 - 3;
1369 }
1370 while ( i < 10 );
1371 }
1372 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 )
1373 {
1374 sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP);
1375 pFontSmallnum->GetLineWidth(pTmpBuf.data());
1376 a1->DrawTitleText(pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf.data(), 3);
1377 }
1378 }
1379
1380
1381 //----- (00417BB5) --------------------------------------------------------
1382 const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType)
1383 {
1384 //enum PLAYER_SKILL_TYPE v2; // esi@1
1385 //unsigned int v3; // ebx@1
1386 int v4; // edi@1
1387 int v5; // eax@1
1388 Player *pPlayer; // ebx@7
1389 char v7; // al@7
1390 char v8; // cl@7
1391 unsigned int v9; // eax@8
1392 unsigned int v10; // eax@8
1393 unsigned int v11; // eax@8
1394 PLAYER_SKILL_TYPE v12; // edi@8
1395 unsigned int v13; // eax@8
1396 unsigned int v14; // eax@8
1397 PLAYER_SKILL_TYPE v15; // esi@8
1398 int v16; // edi@8
1399 char v17; // al@8
1400 int v18; // ST5C_4@8
1401 int v19; // ST4C_4@8
1402 int v20; // ST3C_4@8
1403 int v21; // ST2C_4@8
1404 int v22; // ST1C_4@8
1405 char *v23; // esi@8
1406 unsigned int v24; // eax@9
1407 unsigned int v25; // eax@9
1408 unsigned int v26; // eax@9
1409 unsigned int v27; // ecx@9
1410 PLAYER_SKILL_TYPE v28; // ebx@9
1411 unsigned int v29; // eax@9
1412 char a2[1200]; // [sp+Ch] [bp-538h]@7
1413 char Source[120]; // [sp+4BCh] [bp-88h]@7
1414 unsigned __int16 *v33; // [sp+534h] [bp-10h]@1
1415 int v34; // [sp+538h] [bp-Ch]@1
1416 unsigned __int16 *v35; // [sp+53Ch] [bp-8h]@1
1417 //enum PLAYER_SKILL_TYPE v36; // [sp+540h] [bp-4h]@1
1418
1419 //v2 = uPlayerSkillType;
1420 //v3 = uPlayerID;
1421 //v36 = uPlayerSkillType;
1422 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal
1423 v34 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert
1424 v33 = (unsigned __int16 *)pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master
1425 v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand
1426 v35 = (unsigned __int16 *)v4;
1427 if ( v34 > v4 )
1428 v35 = (unsigned __int16 *)v34;
1429 if ( (signed int)v33 > (signed int)v35 )
1430 v35 = v33;
1431 if ( v5 > (signed int)v35 )
1432 v35 = (unsigned __int16 *)v5;
1433 pPlayer = &pParty->pPlayers[uPlayerID];
1434 //v33 = &pPlayer->pActiveSkills[uPlayerSkillType];
1435 v7 = pPlayer->GetActualSkillLevel(uPlayerSkillType);
1436 v8 = pPlayer->pActiveSkills[uPlayerSkillType];
1437 a2[0] = 0;
1438 Source[0] = 0;
1439 if ( (v8 & 0x3F) == (v7 & 0x3F) )
1440 {
1441 strcpy(a2, "%s\n\n");
1442 v24 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1);
1443 sprintf(Source, "\f%05d", v24);
1444 strcat(a2, Source);
1445 strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
1446 v25 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2);
1447 sprintf(Source, "\f%05d", v25);
1448 strcat(a2, Source);
1449 strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
1450 v26 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3);
1451 sprintf(Source, "\f%05d", v26);
1452 strcat(a2, Source);
1453 strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
1454 v27 = pPlayer->classType;
1455 v28 = uPlayerSkillType;
1456 v29 = GetSkillColor(v27, uPlayerSkillType, 4);
1457 sprintf(Source, "\f%05d", v29);
1458 strcat(a2, Source);
1459 strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
1460
1461 v23 = static_sub_417BB5_out_string;
1462 sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[v28], pGlobalTXT_LocalizationStrings[431], // Normal
1463 (char *)v35 + 3, v35 + 5, pNormalSkillDesc[v28], pGlobalTXT_LocalizationStrings[433], // Expert
1464 (char *)v35 + 3, v35 + 5, pExpertSkillDesc[v28], pGlobalTXT_LocalizationStrings[432], // Master
1465 (char *)v35 + 3, v35 + 5, pMasterSkillDesc[v28], pGlobalTXT_LocalizationStrings[96], // Grand
1466 (char *)v35 + 3, v35 + 5, pGrandSkillDesc[v28]);
1467 }
1468 else
1469 {
1470 strcpy(a2, "%s\n\n");
1471 v9 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1);
1472 sprintf(Source, "\f%05d", v9);
1473 strcat(a2, Source);
1474 strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
1475 v10 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2);
1476 sprintf(Source, "\f%05d", v10);
1477 strcat(a2, Source);
1478 strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
1479 v11 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3);
1480 sprintf(Source, "\f%05d", v11);
1481 strcat(a2, Source);
1482 strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
1483 v12 = uPlayerSkillType;
1484 v13 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 4);
1485 sprintf(Source, "\f%05d", v13);
1486 strcat(a2, Source);
1487 strcat(a2, "%s\t%03d:\t%03d%s\t000\n\n");
1488 v14 = TargetColor(0xFFu, 0xFFu, 0xFFu);
1489 sprintf(Source, "\f%05d", v14);
1490 strcat(a2, Source);
1491 strcat(a2, "%s: +%d");
1492 v15 = v12;
1493 v16 = (int)(v35 + 5);
1494 v15 = (PLAYER_SKILL_TYPE)((int)v15 * 4);
1495 v34 = (int)((char *)v35 + 3);
1496 v17 = pPlayer->GetActualSkillLevel(uPlayerSkillType);
1497 v18 = *(int *)(pGrandSkillDesc[v15]);
1498 v19 = *(int *)(pMasterSkillDesc[v15]);
1499 v20 = *(int *)(pExpertSkillDesc[v15]);
1500 v21 = *(int *)(pNormalSkillDesc[v15]);
1501 v22 = *(int *)(pSkillDesc[v15]);
1502 v23 = static_sub_417BB5_out_string;
1503 sprintf(
1504 static_sub_417BB5_out_string,
1505 a2,
1506 v22,
1507 pGlobalTXT_LocalizationStrings[431],
1508 v34,
1509 v16,
1510 v21,
1511 pGlobalTXT_LocalizationStrings[433],
1512 v34,
1513 v16,
1514 v20,
1515 pGlobalTXT_LocalizationStrings[432],
1516 v34,
1517 v16,
1518 v19,
1519 pGlobalTXT_LocalizationStrings[96],
1520 v34,
1521 v16,
1522 v18,
1523 pGlobalTXT_LocalizationStrings[623],
1524 (v17 & 0x3F) - (*(char *)v33 & 0x3F));
1525 }
1526 return v23;
1527 }
1528
1529 //----- (00417FE5) --------------------------------------------------------
1530 void CharacterUI_SkillsTab_ShowHint()
1531 {
1532 unsigned int v0; // ecx@1
1533 unsigned int v1; // eax@1
1534 GUIButton *i; // esi@6
1535 const char *v3; // eax@12
1536 unsigned int pX; // [sp+4h] [bp-8h]@1
1537 unsigned int pY; // [sp+8h] [bp-4h]@1
1538
1539 pMouse->GetClickPos(&pX, &pY);
1540 v0 = pX;
1541 v1 = pY;
1542 if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 )
1543 {
1544 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )
1545 {
1546 if ( i->msg == UIMSG_SkillUp
1547 && (signed int)v0 >= (signed int)i->uX
1548 && (signed int)v0 <= (signed int)i->uZ
1549 && (signed int)v1 >= (signed int)i->uY
1550 && (signed int)v1 <= (signed int)i->uW )
1551 {
1552 v3 = CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)i->msg_param);
1553 sub_4179BC_draw_tooltip(pSkillNames[i->msg_param], v3);
1554 v1 = pY;
1555 v0 = pX;
1556 }
1557 }
1558 }
1559 else
1560 {
1561 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
1562 }
1563
1564 }
1565
1566 //----- (00418083) --------------------------------------------------------
1567 void __cdecl CharacterUI_StatsTab_ShowHint()
1568 {
1569 LONG _x; // esi@1
1570 LONG _y; // eax@1
1571 int pStringNum; // edi@1
1572 signed int pTextColor; // eax@15
1573 char *pHourWord; // ecx@17
1574 char *pDayWord; // eax@20
1575 int v15; // ebx@28
1576 int v16; // eax@33
1577 POINT a2; // [sp+Ch] [bp-24h]@1
1578 int pHour; // [sp+14h] [bp-1Ch]@15
1579 unsigned int pDay; // [sp+24h] [bp-Ch]@15
1580
1581 _x = pMouse->GetCursorPos(&a2)->x;
1582 _y = pMouse->GetCursorPos(&a2)->y;
1583 for ( pStringNum = 0; pStringNum < (signed int)&off_4E2A12; ++pStringNum )
1584 {
1585 if ( _x >= stat_string_coord[pStringNum].x && _x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width )
1586 {
1587 if ( _y >= stat_string_coord[pStringNum].y && _y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height )
1588 break;
1589 }
1590 }
1591 switch ( pStringNum )
1592 {
1593 case 0:// Attributes
1594 case 1:
1595 case 2:
1596 case 3:
1597 case 4:
1598 case 5:
1599 case 6:
1600 if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] )
1601 sub_4179BC_draw_tooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]);
1602 break;
1603 case 7:// Health Points
1604 if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription )
1605 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription);
1606 break;
1607 case 8:// Spell Points
1608 if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription )
1609 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription);
1610 break;
1611 case 9:// Armor Class
1612 if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription )
1613 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription);
1614 break;
1615 case 10:// Player Condition
1616 strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription);
1617 strcat(pTmpBuf2.data(), "\n");
1618 extern std::array<unsigned int, 18> pConditionImportancyTable;
1619 for ( uint i = 0; i < 18; ++i )
1620 {
1621 if ( pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]] )
1622 {
1623 strcat(pTmpBuf2.data(), " \n");
1624 pHour = pParty->uTimePlayed - pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]];
1625 pHour = (unsigned int)((pHour * 0.234375) / 60 / 60);
1626 pDay = (unsigned int)pHour / 24;
1627 pHour %= 24i64;
1628 pTextColor = GetConditionDrawColor(pConditionImportancyTable[i]);
1629 sprintfex(pTmpBuf.data(), format_4E2DE8, pTextColor, aCharacterConditionNames[pConditionImportancyTable[i]]);
1630 strcat(pTmpBuf2.data(), pTmpBuf.data());
1631 if ( pHour && pHour <= 1 )
1632 pHourWord = pGlobalTXT_LocalizationStrings[109];
1633 else
1634 pHourWord = pGlobalTXT_LocalizationStrings[110];
1635 if ( !pDay || (pDayWord = pGlobalTXT_LocalizationStrings[56], pDay > 1) )
1636 pDayWord = pGlobalTXT_LocalizationStrings[57];
1637 sprintfex(pTmpBuf.data(), "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord);
1638 strcat(pTmpBuf2.data(), pTmpBuf.data());
1639 }
1640 }
1641 if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2.data() )
1642 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data());
1643 break;
1644 case 11:// Fast Spell
1645 if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription )
1646 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription);
1647 break;
1648 case 12:// Player Age
1649 if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription )
1650 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription);
1651 break;
1652 case 13:// Player Level
1653 if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription )
1654 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription);
1655 break;
1656 case 14://Experience
1657 v15 = pPlayers[uActiveCharacter]->uLevel;
1658 do
1659 {
1660 if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)sub_4B46F8(v15) )
1661 break;
1662 ++v15;
1663 }
1664 while ( v15 <= 10000 );
1665 pTmpBuf[0] = 0;
1666 pTmpBuf2[0] = 0;
1667 if ( v15 > pPlayers[uActiveCharacter]->uLevel )
1668 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15);
1669 v16 = sub_4B46F8(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience);
1670 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], v16, v15 + 1);
1671 strcat(pTmpBuf.data(), "\n");
1672 strcat(pTmpBuf.data(), pTmpBuf2.data());
1673 sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data());
1674 if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() )
1675 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data());
1676 break;
1677 case 15:// Attack Bonus
1678 if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription )
1679 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription);
1680 break;
1681 case 16:// Attack Damage
1682 if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription )
1683 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription);
1684 break;
1685 case 17:// Missle Bonus
1686 if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription )
1687 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription);
1688 break;
1689 case 18:// Missle Damage
1690 if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription )
1691 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription);
1692 break;
1693 case 19:// Fire Resistance
1694 if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription )
1695 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription);
1696 break;
1697 case 20:// Air Resistance
1698 if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription )
1699 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription);
1700 break;
1701 case 21:// Water Resistance
1702 if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription )
1703 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription);
1704 break;
1705 case 22:// Earth Resistance
1706 if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription )
1707 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription);
1708 break;
1709 case 23:// Mind Resistance
1710 if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription )
1711 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription);
1712 break;
1713 case 24:// Body Resistance
1714 if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription )
1715 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription);
1716 break;
1717 case 25: // Skill Points
1718 if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription )
1719 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
1720 break;
1721 case 26:
1722 __debugbreak();
1723 //_y = (Player *)(4 * pPlayers[uActiveCharacter]->classType);
1724 //v24 = *(char **)((char *)_y->pConditions + (int)pClassNames);
1725 //v7 = *(char **)((char *)_y->pConditions + (int)pClassDescriptions);
1726 //if ( v24 && v7 )
1727 //sub_4179BC_draw_tooltip(v24, v7);
1728 break;
1729 default:
1730 break;
1731 }
1732 }
1733
1734 //----- (00410B28) --------------------------------------------------------
1735 void __thiscall DrawSpellDescriptionPopup(int spell_index)
1736 {
1737 Player *v1; // edi@1
1738 SpellInfo *v2; // esi@1
1739 unsigned int v3; // eax@2
1740 int v4; // eax@4
1741 LONG v5; // ecx@4
1742 int v6; // eax@10
1743 char *v7; // ST44_4@12
1744 unsigned __int16 v8; // ax@12
1745 GUIWindow a1; // [sp+Ch] [bp-68h]@4
1746 int v10; // [sp+60h] [bp-14h]@1
1747 POINT a2; // [sp+64h] [bp-10h]@1
1748 int v12; // [sp+6Ch] [bp-8h]@4
1749 int v13; // [sp+70h] [bp-4h]@4
1750
1751 v1 = pPlayers[uActiveCharacter];
1752 v10 = spell_index;
1753 v2 = &pSpellStats->pInfos[spell_index + 11 * v1->lastOpenedSpellbookPage + 1];
1754 if ( pMouse->GetCursorPos(&a2)->y <= 250 )
1755 v3 = pMouse->GetCursorPos(&a2)->y + 30;
1756 else
1757 v3 = 30;
1758 a1.uFrameY = v3;
1759 a1.uFrameWidth = 328;
1760 a1.uFrameHeight = 68;
1761 a1.uFrameX = 90;
1762 a1.uFrameZ = 417;
1763 a1.uFrameW = v3 + 67;
1764 a1.Hint = 0;
1765 a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]);
1766 v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]);
1767 v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]);
1768 v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]);
1769 v5 = a2.y;
1770 if ( v13 > a2.y )
1771 v5 = v13;
1772 if ( v12 > v5 )
1773 v5 = v12;
1774 if ( v4 > v5 )
1775 v5 = v4;
1776 sprintf( pTmpBuf2.data(),
1777 "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
1778 v2->pDescription,
1779 pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL],
1780 v5 + 3, v5 + 10,
1781 v2->pBasicSkillDesc,
1782 pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT],
1783 v5 + 3, v5 + 10,
1784 v2->pExpertSkillDesc,
1785 pGlobalTXT_LocalizationStrings[LOCSTR_MASTER],
1786 v5 + 3, v5 + 10,
1787 v2->pMasterSkillDesc,
1788 pGlobalTXT_LocalizationStrings[LOCSTR_GRAND],
1789 v5 + 3, v5 + 10,
1790 v2->pGrandmasterSkillDesc);
1791 v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0);
1792 a1.uFrameHeight += v6;
1793 if ( (signed int)a1.uFrameHeight < 150 )
1794 a1.uFrameHeight = 150;
1795 a1.uFrameWidth = game_viewport_width;
1796 a1.DrawMessageBox(0);
1797 a1.uFrameWidth -= 12;
1798 a1.uFrameHeight -= 12;
1799 v7 = v2->pName;
1800 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
1801 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
1802 v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
1803 a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
1804 a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0);
1805 a1.uFrameWidth = 108;
1806 a1.uFrameZ = a1.uFrameX + 107;
1807 a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->lastOpenedSpellbookPage + 12], 3u);
1808 sprintf( pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST],
1809 pSpellDatas[spell_index + 11 * v1->lastOpenedSpellbookPage + 1].mana_per_skill[v1->pActiveSkills[v1->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]);
1810 // *(&[0].field_12 //temp_fix field_14
1811 // + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6)
1812 // + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage)));
1813 a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3u);
1814 dword_507B00_spell_info_to_draw_in_popup = 0;
1815 }
1816 // 507B00: using guessed type int dword_507B00_spell_info_to_draw_in_popup;
1817
1818
1819
1820
1821
1822 //----- (00416D62) --------------------------------------------------------
1823 void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(Vec2_int_ *_this)
1824 {
1825 signed int pPlayerNum; // eax@12
1826 char *v2; // eax@32
1827 void *v3; // ecx@52
1828 unsigned int v4; // eax@59
1829 int v5; // esi@62
1830 signed int v6; // esi@64
1831 signed int v7; // esi@69
1832 ItemGen *v8; // ecx@70
1833 unsigned int v9; // eax@72
1834 unsigned int v10; // eax@76
1835 //char v11; // zf@83
1836 GUIButton *pButton; // esi@84
1837 unsigned int v13; // ecx@85
1838 char *pStr; // edi@85
1839 //signed int pControlID; // eax@92
1840 int v16; // eax@95
1841 int v17; // eax@96
1842 PLAYER_SKILL_TYPE v18; // eax@98
1843 char *pStr2; // eax@99
1844 unsigned int v20; // eax@108
1845 unsigned int pSkillId; // eax@109
1846 const char *pSkillInfo; // eax@111
1847 //char *v23; // ebx@112
1848 char *pHint; // edx@113
1849 unsigned int pColor; // eax@113
1850 GUIWindow pWindow; // [sp+4h] [bp-74h]@32
1851 double v27; // [sp+58h] [bp-20h]@33
1852 struct tagPOINT Point; // [sp+60h] [bp-18h]@6
1853 char *v29; // [sp+68h] [bp-10h]@33
1854 float v30; // [sp+6Ch] [bp-Ch]@33
1855 unsigned int pX; // [sp+70h] [bp-8h]@3
1856 unsigned int pY; // [sp+74h] [bp-4h]@3
1857
1858 if ( pCurrentScreen == SCREEN_VIDEO )
1859 return;
1860 if ( _this )
1861 {
1862 pX = _this->x;
1863 pY = _this->y;
1864 }
1865 else
1866 {
1867 pMouse->GetClickPos(&pX, &pY);
1868 }
1869 if ( pRenderer->bWindowMode )
1870 {
1871 GetCursorPos(&Point);
1872 ScreenToClient(hWnd, &Point);
1873 if ( Point.x < 1 || Point.y < 1 || Point.x > 638 || Point.y > 478 )
1874 {
1875 back_to_game();
1876 return;
1877 }
1878 }
1879
1880 if ( pParty->pPickedItem.uItemID )//нажатие на портрет перса правой кнопкой мыши с раствором
1881 {
1882 //v1 = 0;
1883 //do
1884 for ( pPlayerNum = 0; pPlayerNum < 4; ++pPlayerNum)
1885 {
1886 if ( (signed int)pX > RightClickPortraitXmin[pPlayerNum] && (signed int)pX < RightClickPortraitXmax[pPlayerNum]
1887 && (signed int)pY > 375 && (signed int)pY < 466 )
1888 {
1889 pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(pPlayerNum + 1, 1);
1890 return;
1891 }
1892 //++v1;
1893 }
1894 //while ( v1 < 4 );
1895 }
1896
1897 pEventTimer->Pause();
1898
1899 switch(pCurrentScreen)
1900 {
1901 case SCREEN_CASTING:
1902 {
1903 identify_item();
1904 break;
1905 }
1906
1907 case SCREEN_CHEST:
1908 {
1909 if ( !pPlayers[uActiveCharacter]->CanAct() )
1910 {
1911 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427],//%s не в состоянии %s
1912 pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//Опознать предметы
1913 pWindow.Hint = pTmpBuf.data();
1914 pWindow.uFrameWidth = 384;
1915 pWindow.uFrameHeight = 180;
1916 pWindow.uFrameY = 40;
1917 if ( (signed int)pX <= 320 )
1918 v10 = pX + 30;
1919 else
1920 v10 = pX - 414;
1921 pWindow.uFrameX = v10;
1922 pWindow.DrawMessageBox(0);
1923 }
1924 else
1925 {
1926 v9 = pX + pSRZBufferLineOffsets[pY];
1927 if ( pRenderer->pActiveZBuffer[v9] & 0xFFFF )
1928 {
1929
1930 // __debugbreak(); // invalid indexing will result in invalid object ptr
1931 // v8 = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18* *((short *)&pChests[0].igChestItems[139].uExpireTime
1932 // + (pRenderer->pActiveZBuffer[v9] & 0xFFFF) + 2662 * (unsigned int)pChestWindow->ptr_1C + 3));
1933 v10=pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[v9] & 0xFFFF)-1];
1934 v8 =&pChests[pChestWindow->par1C].igChestItems[v10-1];
1935 GameUI_DrawItemInfo(v8);
1936 }
1937 }
1938 break;
1939 }
1940 case SCREEN_GAME:
1941 {
1942 if (GetCurrentMenuID() > 0)
1943 break;
1944
1945 if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y )
1946 {
1947 pWindow.ptr_1C = (void *)((signed int)pX / 118);
1948 if ( (signed int)pX / 118 < 4 )
1949 {
1950 pWindow.Hint = 0;
1951 pWindow.uFrameWidth = 400;
1952 pWindow.uFrameHeight = 200;
1953 pWindow.uFrameX = 38;
1954 pWindow.uFrameY = 60;
1955 pAudioPlayer->StopChannels(-1, -1);
1956 GameUI_CharacterQuickRecord_Draw(&pWindow, pPlayers[(int)pWindow.ptr_1C + 1]);
1957 }
1958 }
1959 else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X )
1960 {
1961 if ( (signed int)pY >= 130 )
1962 {
1963 if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 )
1964 {
1965 pWindow.Hint = 0;
1966 pWindow.uFrameWidth = 400;
1967 pWindow.uFrameHeight = 200;
1968 pWindow.uFrameX = 38;
1969 pWindow.uFrameY = 60;
1970 pAudioPlayer->StopChannels(-1, -1);
1971 pWindow._41D73D_draw_buff_tooltip();
1972 }
1973 else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 )
1974 {
1975 if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 ))
1976 {
1977 pAudioPlayer->StopChannels(-1, -1);
1978 v3 = (void *)1;
1979 GameUI_DrawNPCPopup(v3);
1980 }
1981 }
1982 else
1983 {
1984 pAudioPlayer->StopChannels(-1, -1);
1985 v3 = 0;
1986 GameUI_DrawNPCPopup(v3);
1987 }
1988 }
1989 else
1990 {
1991 pWindow.Hint = (char *)GameUI_GetMinimapHintText();
1992 pWindow.uFrameWidth = 256;
1993 pWindow.uFrameX = 130;
1994 pWindow.uFrameY = 140;
1995 pWindow.uFrameHeight = 64;
1996 pAudioPlayer->StopChannels(-1, -1);
1997 pWindow.DrawMessageBox(0);
1998 }
1999 }
2000 else
2001 {
2002 pWindow.Hint = 0;
2003 pWindow.uFrameWidth = 320;
2004 pWindow.uFrameHeight = 320;
2005 v4 = pX - 350;
2006 if ( (signed int)pX <= 320 )
2007 v4 = pX + 30;
2008 pWindow.uFrameX = v4;
2009 pWindow.uFrameY = 40;
2010 if ( pRenderer->pRenderD3D )
2011 LOWORD(v5) = pGame->pVisInstance->get_picked_object_zbuf_val();
2012 else
2013 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
2014 v6 = (unsigned __int16)v5;
2015 if (PID_TYPE(v6) != OBJECT_Item)
2016 {
2017 if (PID_TYPE(v6) == OBJECT_Actor)
2018 {
2019 if ( pRenderer->uNumSceneBegins )
2020 {
2021 pWindow.DrawMessageBox(1);
2022 MonsterPopup_Draw(PID_ID(v6), &pWindow);
2023 }
2024 else
2025 {
2026 pRenderer->BeginScene();
2027 pWindow.DrawMessageBox(1);
2028 MonsterPopup_Draw(PID_ID(v6), &pWindow);
2029 pRenderer->EndScene();
2030 }
2031 }
2032 }
2033 else
2034 {
2035 v7 = PID_ID(v6);
2036 if ( ! (pObjectList->pObjects[pSpriteObjects[v7].uObjectDescID].uFlags & 0x10 ) )
2037 {
2038 v8 = &pSpriteObjects[v7].stru_24;
2039 GameUI_DrawItemInfo(v8);
2040 }
2041 }
2042 }
2043 break;
2044 }
2045 case SCREEN_BOOKS:
2046 {
2047 if ( !dword_506364
2048 || (signed int)pX < (signed int)pViewport->uViewportTL_X
2049 || (signed int)pX > (signed int)pViewport->uViewportBR_X
2050 || (signed int)pY < (signed int)pViewport->uViewportTL_Y
2051 || (signed int)pY > (signed int)pViewport->uViewportBR_Y
2052 || (v2 = (char *)sub_444564(), (pWindow.Hint = v2) == 0) )
2053 break;
2054 v30 = (double)(pFontArrus->GetLineWidth(v2) + 32);
2055 v27 = v30 + 6.7553994e15;
2056 v29 = (char *)LODWORD(v27);
2057 pWindow.uFrameWidth = LODWORD(v27);
2058 pWindow.uFrameX = pX + 5;
2059 pWindow.uFrameY = pY + 5;
2060 pWindow.uFrameHeight = 64;
2061 pAudioPlayer->StopChannels(-1, -1);
2062 pWindow.DrawMessageBox(0);
2063 break;
2064 }
2065 case SCREEN_CHARACTERS:
2066 case SCREEN_E:
2067 case SCREEN_CHEST_INVENTORY:
2068 {
2069 if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E )
2070 {
2071 identify_item();
2072 }
2073 else if ( (signed int)pY >= 345 )
2074 break;
2075 else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats
2076 {
2077 CharacterUI_StatsTab_ShowHint();
2078 }
2079 else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills
2080 {
2081 CharacterUI_SkillsTab_ShowHint();
2082 }
2083 else
2084 {
2085 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory
2086 identify_item();
2087 }
2088 break;
2089 }
2090 case SCREEN_SPELL_BOOK:
2091 {
2092 if ( dword_507B00_spell_info_to_draw_in_popup )
2093 DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1);
2094 break;
2095 }
2096 case SCREEN_HOUSE:
2097 {
2098 if ( (signed int)pY < 345 && (signed int)pX < 469 )
2099 ShowPopupShopItem();
2100 break;
2101 }
2102 case SCREEN_PARTY_CREATION:
2103 {
2104 pWindow.Hint = 0;
2105 pStr = 0;
2106 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext)
2107 {
2108 if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ
2109 && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW )
2110 {
2111 switch ( pButton->msg )
2112 {
2113 case UIMSG_0: //stats info
2114 pWindow.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7];
2115 pStr = aAttributeNames[(signed int)pButton->msg_param % 7];
2116 break;
2117 case UIMSG_PlayerCreationClickPlus: //Plus button info
2118 pStr = pGlobalTXT_LocalizationStrings[670];//Добавить
2119 pWindow.Hint = pGlobalTXT_LocalizationStrings[671];//"Добавляет очко к выделенному навыку, забирая его из накопителя очков"
2120 break;
2121 case UIMSG_PlayerCreationClickMinus: //Minus button info
2122 pStr = pGlobalTXT_LocalizationStrings[668];//Вычесть
2123 pWindow.Hint = pGlobalTXT_LocalizationStrings[669];//"Вычитает очко из выделенного навыка, возвращая его в накопитель очков"
2124 break;
2125 case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info
2126 v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4);
2127 pStr = pSkillNames[v18];
2128 pWindow.Hint = pSkillDesc[v18];
2129 break;
2130 case UIMSG_PlayerCreationSelectClass: //Available Class Info
2131 pWindow.Hint = pClassDescriptions[pButton->msg_param];
2132 pStr = pClassNames[pButton->msg_param];
2133 break;
2134 case UIMSG_PlayerCreationClickOK: //OK Info
2135 pWindow.Hint = pGlobalTXT_LocalizationStrings[664];//Щелкните здесь для утверждения состава отряда и продолжения игры.
2136 pStr = pGlobalTXT_LocalizationStrings[665];//Кнопка ОК
2137 break;
2138 case UIMSG_PlayerCreationClickReset: //Clear info
2139 pWindow.Hint = pGlobalTXT_LocalizationStrings[666];//Сбрасывает все параметры и навыки отряда.
2140 pStr = pGlobalTXT_LocalizationStrings[667];//Кнопка Очистить
2141 break;
2142 case UIMSG_PlayerCreation_SelectAttribute: // Character info
2143 pStr = pParty->pPlayers[pButton->msg_param].pName;
2144 pWindow.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType];
2145 break;
2146 }
2147 if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info
2148 {
2149 pSkillId = pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48);
2150 pY = 0;
2151 if ( (signed int)pSkillId < 37 )
2152 {
2153 pSkillInfo = CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pSkillId);
2154 strcpy(pTmpBuf2.data(), pSkillInfo);
2155 pWindow.Hint = pTmpBuf2.data();
2156 pStr = pSkillNames[pSkillId];
2157 }
2158 }
2159 }
2160 }
2161 if ( pWindow.Hint )
2162 {
2163 pHint = (char*)pWindow.Hint;
2164 pWindow.Hint = 0;
2165 pWindow.uFrameWidth = 384;
2166 pWindow.uFrameHeight = 256;
2167 pWindow.uFrameX = 128;
2168 pWindow.uFrameY = 40;
2169 pWindow.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &pWindow, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24;
2170 pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1;
2171 pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1;
2172 pWindow.DrawMessageBox(0);
2173 pWindow.uFrameX += 12;
2174 pWindow.uFrameWidth -= 24;
2175 pWindow.uFrameY += 12;
2176 pWindow.uFrameHeight -= 12;
2177 pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1;
2178 pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1;
2179 pColor = TargetColor(0xFF, 0xFF, 0x9B);
2180 sprintf(pTmpBuf.data(), format_4E2D80, pColor, pStr);//"\f%05d%s\f00000\n"
2181 pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3);
2182 pWindow.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0);
2183 }
2184 break;
2185 }
2186 default:
2187 {
2188 break;
2189 }
2190 }
2191 dword_507BF0_is_there_popup_onscreen = 1;
2192 viewparams->bRedrawGameUI = 1;
2193 }