comparison UIPopup.cpp @ 706:d6236f6a9882

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